@formio/js 5.1.0-dev.6021.da4224e → 5.1.0-dev.6025.8026a2f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/formio.form.js +2 -2
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +4 -4
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/PDFBuilder.js +2 -2
- package/lib/cjs/Webform.d.ts +1 -1
- package/lib/cjs/Webform.js +5 -3
- package/lib/cjs/WebformBuilder.d.ts +1 -0
- package/lib/cjs/WebformBuilder.js +14 -3
- package/lib/cjs/Wizard.js +1 -0
- package/lib/mjs/PDFBuilder.js +2 -2
- package/lib/mjs/Webform.d.ts +1 -1
- package/lib/mjs/Webform.js +5 -3
- package/lib/mjs/WebformBuilder.d.ts +1 -0
- package/lib/mjs/WebformBuilder.js +13 -2
- package/lib/mjs/Wizard.js +1 -0
- package/package.json +1 -1
package/lib/cjs/PDFBuilder.js
CHANGED
@@ -300,7 +300,7 @@ class PDFBuilder extends WebformBuilder_1.default {
|
|
300
300
|
height: schema.height,
|
301
301
|
width: schema.width
|
302
302
|
};
|
303
|
-
if (!this.options.noNewEdit && !component.component.noNewEdit) {
|
303
|
+
if (!this.options.noNewEdit && !component.component.noNewEdit && this.hasEditTabs(component.type)) {
|
304
304
|
this.editComponent(component.component, this.getParentContainer(component), isNew);
|
305
305
|
}
|
306
306
|
this.emit('updateComponent', component.component);
|
@@ -324,7 +324,7 @@ class PDFBuilder extends WebformBuilder_1.default {
|
|
324
324
|
});
|
325
325
|
this.webform.on('iframe-componentClick', schema => {
|
326
326
|
const component = this.webform.getComponentById(schema.id);
|
327
|
-
if (component) {
|
327
|
+
if (component && this.hasEditTabs(component.type)) {
|
328
328
|
this.editComponent(component.component, this.getParentContainer(component));
|
329
329
|
}
|
330
330
|
}, true);
|
package/lib/cjs/Webform.d.ts
CHANGED
@@ -455,7 +455,7 @@ declare class Webform extends NestedDataComponent {
|
|
455
455
|
*/
|
456
456
|
submit(before?: boolean, options?: any): Promise<any>;
|
457
457
|
submitUrl(URL: any, headers: any): void;
|
458
|
-
triggerCaptcha(): void;
|
458
|
+
triggerCaptcha(components?: null): void;
|
459
459
|
_nosubmit: any;
|
460
460
|
get conditions(): any;
|
461
461
|
get variables(): any;
|
package/lib/cjs/Webform.js
CHANGED
@@ -1534,17 +1534,20 @@ class Webform extends NestedDataComponent_1.default {
|
|
1534
1534
|
return console.warn(message);
|
1535
1535
|
}
|
1536
1536
|
}
|
1537
|
-
triggerCaptcha() {
|
1537
|
+
triggerCaptcha(components = null) {
|
1538
1538
|
if (!this || !this.components || this.options.preview) {
|
1539
1539
|
return;
|
1540
1540
|
}
|
1541
1541
|
const captchaComponent = [];
|
1542
|
-
(0, formUtils_1.eachComponent)(this.components, (component) => {
|
1542
|
+
(0, formUtils_1.eachComponent)(components || this.components, (component) => {
|
1543
1543
|
if (/^(re)?captcha$/.test(component.type) && component.component.eventType === 'formLoad') {
|
1544
1544
|
captchaComponent.push(component);
|
1545
1545
|
}
|
1546
1546
|
}, true);
|
1547
1547
|
if (captchaComponent.length > 0) {
|
1548
|
+
if (captchaComponent[0].component.provider === 'google' && components) {
|
1549
|
+
return;
|
1550
|
+
}
|
1548
1551
|
if (this.parent) {
|
1549
1552
|
this.parent.subFormReady.then(() => {
|
1550
1553
|
captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
|
@@ -1553,7 +1556,6 @@ class Webform extends NestedDataComponent_1.default {
|
|
1553
1556
|
else {
|
1554
1557
|
captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
|
1555
1558
|
}
|
1556
|
-
;
|
1557
1559
|
}
|
1558
1560
|
}
|
1559
1561
|
set nosubmit(value) {
|
@@ -123,6 +123,7 @@ export default class WebformBuilder extends Component {
|
|
123
123
|
addBuilderGroup(name: any, group: any): void;
|
124
124
|
updateBuilderGroup(name: any, group: any): void;
|
125
125
|
generateKey(info: any): any;
|
126
|
+
hasEditTabs(type: any): boolean;
|
126
127
|
}
|
127
128
|
import Component from './components/_classes/component/Component';
|
128
129
|
import Webform from './Webform';
|
@@ -123,7 +123,7 @@ class WebformBuilder extends Component_1.default {
|
|
123
123
|
}
|
124
124
|
this.options.hooks = this.options.hooks || {};
|
125
125
|
this.options.hooks.renderComponent = (html, { component, self }) => {
|
126
|
-
var _a, _b;
|
126
|
+
var _a, _b, _c;
|
127
127
|
if (self.type === 'form' && !self.key) {
|
128
128
|
const template = this.hook('renderComponentFormTemplate', html.replace('formio-component-form', ''));
|
129
129
|
// The main webform shouldn't have this class as it adds extra styles.
|
@@ -136,7 +136,9 @@ class WebformBuilder extends Component_1.default {
|
|
136
136
|
html,
|
137
137
|
disableBuilderActions: (_a = self === null || self === void 0 ? void 0 : self.component) === null || _a === void 0 ? void 0 : _a.disableBuilderActions,
|
138
138
|
childComponent: component,
|
139
|
-
design: (_b = self === null || self === void 0 ? void 0 : self.options) === null || _b === void 0 ? void 0 : _b.design
|
139
|
+
design: (_b = self === null || self === void 0 ? void 0 : self.options) === null || _b === void 0 ? void 0 : _b.design,
|
140
|
+
editJson: (_c = self === null || self === void 0 ? void 0 : self.options) === null || _c === void 0 ? void 0 : _c.editJson,
|
141
|
+
editComponent: this.hasEditTabs(component.type)
|
140
142
|
});
|
141
143
|
};
|
142
144
|
this.options.hooks.renderComponents = (html, { components, self }) => {
|
@@ -855,7 +857,11 @@ class WebformBuilder extends Component_1.default {
|
|
855
857
|
parent.addChildComponent(info, element, target, source, sibling);
|
856
858
|
}
|
857
859
|
const componentInDataGrid = parent.type === 'datagrid';
|
858
|
-
if (isNew
|
860
|
+
if (isNew
|
861
|
+
&& !this.options.noNewEdit
|
862
|
+
&& !info.noNewEdit
|
863
|
+
&& this.hasEditTabs(info.type)
|
864
|
+
&& !(this.options.design && info.type === 'reviewpage')) {
|
859
865
|
this.editComponent(info, target, isNew, null, null, { inDataGrid: componentInDataGrid });
|
860
866
|
}
|
861
867
|
// Only rebuild the parts needing to be rebuilt.
|
@@ -1616,5 +1622,10 @@ class WebformBuilder extends Component_1.default {
|
|
1616
1622
|
info.placeholder ||
|
1617
1623
|
info.type);
|
1618
1624
|
}
|
1625
|
+
hasEditTabs(type) {
|
1626
|
+
const editTabs = (0, formUtils_1.getComponent)(Components_1.default.components[type].editForm().components, 'tabs', true).components;
|
1627
|
+
const hiddenEditTabs = lodash_1.default.filter(lodash_1.default.get(this.options, `editForm.${type}`, []), 'ignore');
|
1628
|
+
return lodash_1.default.intersectionBy(editTabs, hiddenEditTabs, 'key').length !== editTabs.length;
|
1629
|
+
}
|
1619
1630
|
}
|
1620
1631
|
exports.default = WebformBuilder;
|
package/lib/cjs/Wizard.js
CHANGED
@@ -602,6 +602,7 @@ class Wizard extends Webform_1.default {
|
|
602
602
|
}
|
603
603
|
this.redraw().then(() => {
|
604
604
|
this.checkData(this.submission.data);
|
605
|
+
this.triggerCaptcha(this.currentPanel.componets);
|
605
606
|
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
606
607
|
if (this.alert) {
|
607
608
|
this.showErrors(errors, true, true);
|
package/lib/mjs/PDFBuilder.js
CHANGED
@@ -294,7 +294,7 @@ export default class PDFBuilder extends WebformBuilder {
|
|
294
294
|
height: schema.height,
|
295
295
|
width: schema.width
|
296
296
|
};
|
297
|
-
if (!this.options.noNewEdit && !component.component.noNewEdit) {
|
297
|
+
if (!this.options.noNewEdit && !component.component.noNewEdit && this.hasEditTabs(component.type)) {
|
298
298
|
this.editComponent(component.component, this.getParentContainer(component), isNew);
|
299
299
|
}
|
300
300
|
this.emit('updateComponent', component.component);
|
@@ -318,7 +318,7 @@ export default class PDFBuilder extends WebformBuilder {
|
|
318
318
|
});
|
319
319
|
this.webform.on('iframe-componentClick', schema => {
|
320
320
|
const component = this.webform.getComponentById(schema.id);
|
321
|
-
if (component) {
|
321
|
+
if (component && this.hasEditTabs(component.type)) {
|
322
322
|
this.editComponent(component.component, this.getParentContainer(component));
|
323
323
|
}
|
324
324
|
}, true);
|
package/lib/mjs/Webform.d.ts
CHANGED
@@ -455,7 +455,7 @@ declare class Webform extends NestedDataComponent {
|
|
455
455
|
*/
|
456
456
|
submit(before?: boolean, options?: any): Promise<any>;
|
457
457
|
submitUrl(URL: any, headers: any): void;
|
458
|
-
triggerCaptcha(): void;
|
458
|
+
triggerCaptcha(components?: null): void;
|
459
459
|
_nosubmit: any;
|
460
460
|
get conditions(): any;
|
461
461
|
get variables(): any;
|
package/lib/mjs/Webform.js
CHANGED
@@ -1534,17 +1534,20 @@ export default class Webform extends NestedDataComponent {
|
|
1534
1534
|
return console.warn(message);
|
1535
1535
|
}
|
1536
1536
|
}
|
1537
|
-
triggerCaptcha() {
|
1537
|
+
triggerCaptcha(components = null) {
|
1538
1538
|
if (!this || !this.components || this.options.preview) {
|
1539
1539
|
return;
|
1540
1540
|
}
|
1541
1541
|
const captchaComponent = [];
|
1542
|
-
eachComponent(this.components, (component) => {
|
1542
|
+
eachComponent(components || this.components, (component) => {
|
1543
1543
|
if (/^(re)?captcha$/.test(component.type) && component.component.eventType === 'formLoad') {
|
1544
1544
|
captchaComponent.push(component);
|
1545
1545
|
}
|
1546
1546
|
}, true);
|
1547
1547
|
if (captchaComponent.length > 0) {
|
1548
|
+
if (captchaComponent[0].component.provider === 'google' && components) {
|
1549
|
+
return;
|
1550
|
+
}
|
1548
1551
|
if (this.parent) {
|
1549
1552
|
this.parent.subFormReady.then(() => {
|
1550
1553
|
captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
|
@@ -1553,7 +1556,6 @@ export default class Webform extends NestedDataComponent {
|
|
1553
1556
|
else {
|
1554
1557
|
captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
|
1555
1558
|
}
|
1556
|
-
;
|
1557
1559
|
}
|
1558
1560
|
}
|
1559
1561
|
set nosubmit(value) {
|
@@ -123,6 +123,7 @@ export default class WebformBuilder extends Component {
|
|
123
123
|
addBuilderGroup(name: any, group: any): void;
|
124
124
|
updateBuilderGroup(name: any, group: any): void;
|
125
125
|
generateKey(info: any): any;
|
126
|
+
hasEditTabs(type: any): boolean;
|
126
127
|
}
|
127
128
|
import Component from './components/_classes/component/Component';
|
128
129
|
import Webform from './Webform';
|
@@ -115,7 +115,9 @@ export default class WebformBuilder extends Component {
|
|
115
115
|
html,
|
116
116
|
disableBuilderActions: self?.component?.disableBuilderActions,
|
117
117
|
childComponent: component,
|
118
|
-
design: self?.options?.design
|
118
|
+
design: self?.options?.design,
|
119
|
+
editJson: self?.options?.editJson,
|
120
|
+
editComponent: this.hasEditTabs(component.type)
|
119
121
|
});
|
120
122
|
};
|
121
123
|
this.options.hooks.renderComponents = (html, { components, self }) => {
|
@@ -840,7 +842,11 @@ export default class WebformBuilder extends Component {
|
|
840
842
|
parent.addChildComponent(info, element, target, source, sibling);
|
841
843
|
}
|
842
844
|
const componentInDataGrid = parent.type === 'datagrid';
|
843
|
-
if (isNew
|
845
|
+
if (isNew
|
846
|
+
&& !this.options.noNewEdit
|
847
|
+
&& !info.noNewEdit
|
848
|
+
&& this.hasEditTabs(info.type)
|
849
|
+
&& !(this.options.design && info.type === 'reviewpage')) {
|
844
850
|
this.editComponent(info, target, isNew, null, null, { inDataGrid: componentInDataGrid });
|
845
851
|
}
|
846
852
|
// Only rebuild the parts needing to be rebuilt.
|
@@ -1619,4 +1625,9 @@ export default class WebformBuilder extends Component {
|
|
1619
1625
|
info.placeholder ||
|
1620
1626
|
info.type);
|
1621
1627
|
}
|
1628
|
+
hasEditTabs(type) {
|
1629
|
+
const editTabs = getComponent(Components.components[type].editForm().components, 'tabs', true).components;
|
1630
|
+
const hiddenEditTabs = _.filter(_.get(this.options, `editForm.${type}`, []), 'ignore');
|
1631
|
+
return _.intersectionBy(editTabs, hiddenEditTabs, 'key').length !== editTabs.length;
|
1632
|
+
}
|
1622
1633
|
}
|
package/lib/mjs/Wizard.js
CHANGED
@@ -594,6 +594,7 @@ export default class Wizard extends Webform {
|
|
594
594
|
}
|
595
595
|
this.redraw().then(() => {
|
596
596
|
this.checkData(this.submission.data);
|
597
|
+
this.triggerCaptcha(this.currentPanel.componets);
|
597
598
|
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
598
599
|
if (this.alert) {
|
599
600
|
this.showErrors(errors, true, true);
|