Skip to content

Commit

Permalink
FIO-7933 added PDF Document Designer (#5539)
Browse files Browse the repository at this point in the history
  • Loading branch information
HannaKurban authored Mar 22, 2024
1 parent 877ce32 commit c505ccd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion src/WebformBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export default class WebformBuilder extends Component {
html,
disableBuilderActions: self?.component?.disableBuilderActions,
childComponent: component,
design: self?.options?.design
});
};

Expand Down Expand Up @@ -560,6 +561,7 @@ export default class WebformBuilder extends Component {
attach(element) {
this.on('change', (form) => {
this.populateRecaptchaSettings(form);
this.webform.setAlert(false);
});
return super.attach(element).then(() => {
this.loadRefs(element, {
Expand Down Expand Up @@ -945,6 +947,21 @@ export default class WebformBuilder extends Component {
}
}

if (draggableComponent.uniqueComponent) {
let isCompAlreadyExists = false;
eachComponent(this.webform.components, (component) => {
if (component.key === draggableComponent.schema.key) {
isCompAlreadyExists = true;
return;
}
}, true);
if (isCompAlreadyExists) {
this.webform.redraw();
this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.title} component to one page.`);
return;
}
}

if (target !== source) {
// Ensure the key remains unique in its new container.
BuilderUtils.uniquify(this.findNamespaceRoot(target.formioComponent), info);
Expand Down Expand Up @@ -982,7 +999,7 @@ export default class WebformBuilder extends Component {

const componentInDataGrid = parent.type === 'datagrid';

if (isNew && !this.options.noNewEdit && !info.noNewEdit) {
if (isNew && !this.options.noNewEdit && !info.noNewEdit && !(this.options.design && info.type === 'reviewpage')) {
this.editComponent(info, target, isNew, null, null, { inDataGrid: componentInDataGrid });
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/datagrid/DataGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export default class DataGridComponent extends NestedArrayComponent {
}

get canAddColumn() {
return this.builderMode;
return this.builderMode && !this.options.design;
}

render() {
Expand Down

0 comments on commit c505ccd

Please sign in to comment.