@formio/js 5.1.0-dev.6002.16f1966 → 5.1.0-dev.6007.fade2e3
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 +5 -5
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/Webform.d.ts +4 -1
- package/lib/cjs/Webform.js +16 -11
- package/lib/cjs/components/_classes/component/Component.js +3 -0
- package/lib/cjs/components/form/editForm/Form.edit.data.js +1 -1
- package/lib/cjs/components/form/editForm/Form.edit.form.js +2 -2
- package/lib/cjs/components/select/editForm/Select.edit.data.js +2 -2
- package/lib/mjs/Webform.d.ts +4 -1
- package/lib/mjs/Webform.js +16 -11
- package/lib/mjs/components/_classes/component/Component.js +3 -0
- package/lib/mjs/components/form/editForm/Form.edit.data.js +1 -1
- package/lib/mjs/components/form/editForm/Form.edit.form.js +2 -2
- package/lib/mjs/components/select/editForm/Select.edit.data.js +2 -2
- package/package.json +1 -1
package/lib/cjs/Webform.d.ts
CHANGED
@@ -190,7 +190,10 @@ declare class Webform extends NestedDataComponent {
|
|
190
190
|
get language(): string;
|
191
191
|
root: this;
|
192
192
|
localRoot: this;
|
193
|
+
beforeInit(): void;
|
194
|
+
executeFormController: any;
|
193
195
|
get emptyValue(): null;
|
196
|
+
get shouldCallFormController(): any;
|
194
197
|
get shadowRoot(): any;
|
195
198
|
/**
|
196
199
|
* Add a language for translations
|
@@ -360,7 +363,7 @@ declare class Webform extends NestedDataComponent {
|
|
360
363
|
* @returns {Promise} - The promise that is triggered when the form is built.
|
361
364
|
*/
|
362
365
|
init(): Promise<any>;
|
363
|
-
|
366
|
+
_executeFormController(): void;
|
364
367
|
build(element: any): Promise<any>;
|
365
368
|
getClassName(): string;
|
366
369
|
render(): string;
|
package/lib/cjs/Webform.js
CHANGED
@@ -315,12 +315,24 @@ class Webform extends NestedDataComponent_1.default {
|
|
315
315
|
this.localRoot = this;
|
316
316
|
}
|
317
317
|
/* eslint-enable max-statements */
|
318
|
+
beforeInit() {
|
319
|
+
this.executeFormController = lodash_1.default.once(this._executeFormController);
|
320
|
+
}
|
318
321
|
get language() {
|
319
322
|
return this.options.language;
|
320
323
|
}
|
321
324
|
get emptyValue() {
|
322
325
|
return null;
|
323
326
|
}
|
327
|
+
get shouldCallFormController() {
|
328
|
+
// If no controller value or
|
329
|
+
// hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)
|
330
|
+
return (this.form &&
|
331
|
+
this.form.controller &&
|
332
|
+
!((!this.visible || this.component.hidden) &&
|
333
|
+
this.component.clearOnHide &&
|
334
|
+
!this.rootPristine));
|
335
|
+
}
|
324
336
|
componentContext() {
|
325
337
|
return this._data;
|
326
338
|
}
|
@@ -899,19 +911,12 @@ class Webform extends NestedDataComponent_1.default {
|
|
899
911
|
this.on('resetForm', () => this.resetValue(), true);
|
900
912
|
this.on('deleteSubmission', () => this.deleteSubmission(), true);
|
901
913
|
this.on('refreshData', () => this.updateValue(), true);
|
902
|
-
this.
|
914
|
+
if (this.shouldCallFormController) {
|
915
|
+
this.executeFormController();
|
916
|
+
}
|
903
917
|
return this.formReady;
|
904
918
|
}
|
905
|
-
|
906
|
-
// If no controller value or
|
907
|
-
// hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)
|
908
|
-
if (!this.form ||
|
909
|
-
!this.form.controller ||
|
910
|
-
((!this.visible || this.component.hidden) &&
|
911
|
-
this.component.clearOnHide &&
|
912
|
-
!this.rootPristine)) {
|
913
|
-
return false;
|
914
|
-
}
|
919
|
+
_executeFormController() {
|
915
920
|
this.formReady.then(() => {
|
916
921
|
this.evaluate(this.form.controller, {
|
917
922
|
components: this.components,
|
@@ -453,6 +453,9 @@ class Component extends Element_1.default {
|
|
453
453
|
// Allow anyone to hook into the component creation.
|
454
454
|
this.hook('component');
|
455
455
|
if (!this.options.skipInit) {
|
456
|
+
if (typeof this.beforeInit === 'function') {
|
457
|
+
this.beforeInit();
|
458
|
+
}
|
456
459
|
this.init();
|
457
460
|
}
|
458
461
|
}
|
@@ -11,7 +11,7 @@ exports.default = [
|
|
11
11
|
{
|
12
12
|
weight: 140,
|
13
13
|
type: 'checkbox',
|
14
|
-
label: '
|
14
|
+
label: 'Omit Value From Submission Data When Conditionally Hidden',
|
15
15
|
key: 'clearOnHide',
|
16
16
|
defaultValue: true,
|
17
17
|
tooltip: 'When a field is hidden, clear the value.',
|
@@ -69,7 +69,7 @@ exports.default = [
|
|
69
69
|
input: true,
|
70
70
|
weight: 20,
|
71
71
|
key: 'reference',
|
72
|
-
label: '
|
73
|
-
tooltip: '
|
72
|
+
label: 'Submit as reference',
|
73
|
+
tooltip: 'When "Submit as reference" is enabled, the form submission will be recorded against the Parent Form as well as the Child Form. When a submission recorded with "Submit as reference" is edited, the update is applied to each submission made against the Parent Form and Child Form.'
|
74
74
|
}
|
75
75
|
];
|
@@ -641,8 +641,8 @@ exports.default = [
|
|
641
641
|
input: true,
|
642
642
|
weight: 25,
|
643
643
|
key: 'reference',
|
644
|
-
label: '
|
645
|
-
tooltip: 'Using this option will
|
644
|
+
label: 'Submit as reference',
|
645
|
+
tooltip: 'Using this option will submit this field as a reference id and link its value to the value of the origin record.',
|
646
646
|
conditional: {
|
647
647
|
json: { '===': [{ var: 'data.dataSrc' }, 'resource'] },
|
648
648
|
},
|
package/lib/mjs/Webform.d.ts
CHANGED
@@ -190,7 +190,10 @@ declare class Webform extends NestedDataComponent {
|
|
190
190
|
get language(): string;
|
191
191
|
root: this;
|
192
192
|
localRoot: this;
|
193
|
+
beforeInit(): void;
|
194
|
+
executeFormController: any;
|
193
195
|
get emptyValue(): null;
|
196
|
+
get shouldCallFormController(): any;
|
194
197
|
get shadowRoot(): any;
|
195
198
|
/**
|
196
199
|
* Add a language for translations
|
@@ -360,7 +363,7 @@ declare class Webform extends NestedDataComponent {
|
|
360
363
|
* @returns {Promise} - The promise that is triggered when the form is built.
|
361
364
|
*/
|
362
365
|
init(): Promise<any>;
|
363
|
-
|
366
|
+
_executeFormController(): void;
|
364
367
|
build(element: any): Promise<any>;
|
365
368
|
getClassName(): string;
|
366
369
|
render(): string;
|
package/lib/mjs/Webform.js
CHANGED
@@ -287,12 +287,24 @@ export default class Webform extends NestedDataComponent {
|
|
287
287
|
this.localRoot = this;
|
288
288
|
}
|
289
289
|
/* eslint-enable max-statements */
|
290
|
+
beforeInit() {
|
291
|
+
this.executeFormController = _.once(this._executeFormController);
|
292
|
+
}
|
290
293
|
get language() {
|
291
294
|
return this.options.language;
|
292
295
|
}
|
293
296
|
get emptyValue() {
|
294
297
|
return null;
|
295
298
|
}
|
299
|
+
get shouldCallFormController() {
|
300
|
+
// If no controller value or
|
301
|
+
// hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)
|
302
|
+
return (this.form &&
|
303
|
+
this.form.controller &&
|
304
|
+
!((!this.visible || this.component.hidden) &&
|
305
|
+
this.component.clearOnHide &&
|
306
|
+
!this.rootPristine));
|
307
|
+
}
|
296
308
|
componentContext() {
|
297
309
|
return this._data;
|
298
310
|
}
|
@@ -902,19 +914,12 @@ export default class Webform extends NestedDataComponent {
|
|
902
914
|
this.on('resetForm', () => this.resetValue(), true);
|
903
915
|
this.on('deleteSubmission', () => this.deleteSubmission(), true);
|
904
916
|
this.on('refreshData', () => this.updateValue(), true);
|
905
|
-
this.
|
917
|
+
if (this.shouldCallFormController) {
|
918
|
+
this.executeFormController();
|
919
|
+
}
|
906
920
|
return this.formReady;
|
907
921
|
}
|
908
|
-
|
909
|
-
// If no controller value or
|
910
|
-
// hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)
|
911
|
-
if (!this.form ||
|
912
|
-
!this.form.controller ||
|
913
|
-
((!this.visible || this.component.hidden) &&
|
914
|
-
this.component.clearOnHide &&
|
915
|
-
!this.rootPristine)) {
|
916
|
-
return false;
|
917
|
-
}
|
922
|
+
_executeFormController() {
|
918
923
|
this.formReady.then(() => {
|
919
924
|
this.evaluate(this.form.controller, {
|
920
925
|
components: this.components,
|
@@ -418,6 +418,9 @@ export default class Component extends Element {
|
|
418
418
|
// Allow anyone to hook into the component creation.
|
419
419
|
this.hook('component');
|
420
420
|
if (!this.options.skipInit) {
|
421
|
+
if (typeof this.beforeInit === 'function') {
|
422
|
+
this.beforeInit();
|
423
|
+
}
|
421
424
|
this.init();
|
422
425
|
}
|
423
426
|
}
|
@@ -66,7 +66,7 @@ export default [
|
|
66
66
|
input: true,
|
67
67
|
weight: 20,
|
68
68
|
key: 'reference',
|
69
|
-
label: '
|
70
|
-
tooltip: '
|
69
|
+
label: 'Submit as reference',
|
70
|
+
tooltip: 'When "Submit as reference" is enabled, the form submission will be recorded against the Parent Form as well as the Child Form. When a submission recorded with "Submit as reference" is edited, the update is applied to each submission made against the Parent Form and Child Form.'
|
71
71
|
}
|
72
72
|
];
|
@@ -635,8 +635,8 @@ export default [
|
|
635
635
|
input: true,
|
636
636
|
weight: 25,
|
637
637
|
key: 'reference',
|
638
|
-
label: '
|
639
|
-
tooltip: 'Using this option will
|
638
|
+
label: 'Submit as reference',
|
639
|
+
tooltip: 'Using this option will submit this field as a reference id and link its value to the value of the origin record.',
|
640
640
|
conditional: {
|
641
641
|
json: { '===': [{ var: 'data.dataSrc' }, 'resource'] },
|
642
642
|
},
|