Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIO-7933 added PDF Document Designer #5539

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading