@formio/js 5.1.0-dev.6068.fbce2f7 → 5.1.0-dev.6070.c51663f
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 +543 -532
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +545 -534
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.js +21 -10
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +22 -11
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +4 -32
- package/lib/cjs/components/_classes/component/Component.js +37 -68
- package/lib/cjs/components/editgrid/EditGrid.js +3 -1
- package/lib/cjs/components/form/Form.d.ts +1 -0
- package/lib/cjs/components/form/Form.js +20 -12
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +18 -18
- package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -0
- package/lib/cjs/components/survey/Survey.js +1 -1
- package/lib/cjs/components/textarea/TextArea.js +9 -1
- package/lib/cjs/components/unknown/Unknown.form.d.ts +2 -1
- package/lib/cjs/components/unknown/Unknown.form.js +13 -9
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/utils.js +2 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +4 -32
- package/lib/mjs/components/_classes/component/Component.js +37 -68
- package/lib/mjs/components/editgrid/EditGrid.js +3 -1
- package/lib/mjs/components/form/Form.d.ts +1 -0
- package/lib/mjs/components/form/Form.js +20 -12
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +18 -18
- package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -0
- package/lib/mjs/components/survey/Survey.js +1 -1
- package/lib/mjs/components/textarea/TextArea.js +9 -1
- package/lib/mjs/components/unknown/Unknown.form.d.ts +2 -1
- package/lib/mjs/components/unknown/Unknown.form.js +13 -9
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/utils.js +2 -1
- package/package.json +2 -2
@@ -163,22 +163,8 @@ declare class Component extends Element {
|
|
163
163
|
*/
|
164
164
|
info: any;
|
165
165
|
get componentsMap(): object;
|
166
|
-
/**
|
167
|
-
* Returns if the parent should conditionally clear.
|
168
|
-
* This method does not need to walk up the parent tree since the variables
|
169
|
-
* _conditionallyClear and _conditionallyHidden are set on the parent component
|
170
|
-
* before the child component is determined, and the parent component also references
|
171
|
-
* its parent component.
|
172
|
-
*
|
173
|
-
* @returns {boolean} - If the parent should conditionally clear.
|
174
|
-
*/
|
175
166
|
parentShouldConditionallyClear(): boolean;
|
176
167
|
parentConditionallyHidden(): boolean;
|
177
|
-
/**
|
178
|
-
* Returns true if any of the parents default their component "hidden" property to true.
|
179
|
-
* @returns {boolean} - If any parent defaults the hidden property to true.
|
180
|
-
*/
|
181
|
-
anyParentDefaultsHidden(): boolean;
|
182
168
|
set data(value: any);
|
183
169
|
get data(): any;
|
184
170
|
mergeSchema(component?: {}): any;
|
@@ -242,23 +228,8 @@ declare class Component extends Element {
|
|
242
228
|
get visible(): boolean;
|
243
229
|
get logicallyHidden(): any;
|
244
230
|
_logicallyHidden: any;
|
245
|
-
|
246
|
-
|
247
|
-
* @returns {boolean} - If the component should clear its value when the root form is pristine.
|
248
|
-
*/
|
249
|
-
shouldConditionallyClearOnPristine(): boolean;
|
250
|
-
/**
|
251
|
-
* Returns if the component should clear its value when conditionally hidden.
|
252
|
-
* @returns {boolean} - If the component should clear its value when conditionally hidden.
|
253
|
-
*/
|
254
|
-
shouldConditionallyClear(): boolean;
|
255
|
-
_conditionallyClear: boolean | undefined;
|
256
|
-
/**
|
257
|
-
* Returns if the component is conditionally hidden.
|
258
|
-
* @returns {boolean} - If the component is conditionally hidden.
|
259
|
-
*/
|
260
|
-
conditionallyHidden(): boolean;
|
261
|
-
_conditionallyHidden: boolean | undefined;
|
231
|
+
shouldConditionallyClear(skipParent?: boolean): boolean;
|
232
|
+
conditionallyHidden(skipParent?: boolean): boolean;
|
262
233
|
set currentForm(instance: any);
|
263
234
|
get currentForm(): any;
|
264
235
|
_currentForm: any;
|
@@ -1040,9 +1011,10 @@ declare class Component extends Element {
|
|
1040
1011
|
* @param {boolean} dirty - If the component is dirty.
|
1041
1012
|
* @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
|
1042
1013
|
* @param {*} row - Contextual row data for this component.
|
1014
|
+
* @param {*} options - Additional options for validation.
|
1043
1015
|
* @returns {string} - The message to show when the component is invalid.
|
1044
1016
|
*/
|
1045
|
-
invalidMessage(data: any, dirty: boolean, ignoreCondition: boolean, row: any): string;
|
1017
|
+
invalidMessage(data: any, dirty: boolean, ignoreCondition: boolean, row: any, options?: any): string;
|
1046
1018
|
/**
|
1047
1019
|
* Returns if the component is valid or not.
|
1048
1020
|
* @param {*} data - The data to check if the component is valid.
|
@@ -458,20 +458,10 @@ class Component extends Element_1.default {
|
|
458
458
|
var _a;
|
459
459
|
return ((_a = this.root) === null || _a === void 0 ? void 0 : _a.childComponentsMap) || {};
|
460
460
|
}
|
461
|
-
/**
|
462
|
-
* Returns if the parent should conditionally clear.
|
463
|
-
* This method does not need to walk up the parent tree since the variables
|
464
|
-
* _conditionallyClear and _conditionallyHidden are set on the parent component
|
465
|
-
* before the child component is determined, and the parent component also references
|
466
|
-
* its parent component.
|
467
|
-
*
|
468
|
-
* @returns {boolean} - If the parent should conditionally clear.
|
469
|
-
*/
|
470
461
|
parentShouldConditionallyClear() {
|
471
462
|
let currentParent = this.parent;
|
472
463
|
while (currentParent) {
|
473
|
-
if (
|
474
|
-
(!currentParent.allowData && currentParent._conditionallyHidden)) {
|
464
|
+
if (currentParent.shouldConditionallyClear(true)) {
|
475
465
|
return true;
|
476
466
|
}
|
477
467
|
currentParent = currentParent.parent;
|
@@ -481,21 +471,7 @@ class Component extends Element_1.default {
|
|
481
471
|
parentConditionallyHidden() {
|
482
472
|
let currentParent = this.parent;
|
483
473
|
while (currentParent) {
|
484
|
-
if (currentParent.
|
485
|
-
return true;
|
486
|
-
}
|
487
|
-
currentParent = currentParent.parent;
|
488
|
-
}
|
489
|
-
return false;
|
490
|
-
}
|
491
|
-
/**
|
492
|
-
* Returns true if any of the parents default their component "hidden" property to true.
|
493
|
-
* @returns {boolean} - If any parent defaults the hidden property to true.
|
494
|
-
*/
|
495
|
-
anyParentDefaultsHidden() {
|
496
|
-
let currentParent = this.parent;
|
497
|
-
while (currentParent) {
|
498
|
-
if (currentParent.component.hidden) {
|
474
|
+
if (currentParent.conditionallyHidden(true)) {
|
499
475
|
return true;
|
500
476
|
}
|
501
477
|
currentParent = currentParent.parent;
|
@@ -713,58 +689,48 @@ class Component extends Element_1.default {
|
|
713
689
|
}
|
714
690
|
return this._logicallyHidden;
|
715
691
|
}
|
716
|
-
|
717
|
-
* Determines if the component should clear its value when the root form is pristine.
|
718
|
-
* @returns {boolean} - If the component should clear its value when the root form is pristine.
|
719
|
-
*/
|
720
|
-
shouldConditionallyClearOnPristine() {
|
721
|
-
// If the form is pristine, we should NOT clear the value of a conditionally hidden child component
|
722
|
-
// of a layout component that defaults to hidden using the "hidden" component property.
|
723
|
-
return !this.anyParentDefaultsHidden();
|
724
|
-
}
|
725
|
-
/**
|
726
|
-
* Returns if the component should clear its value when conditionally hidden.
|
727
|
-
* @returns {boolean} - If the component should clear its value when conditionally hidden.
|
728
|
-
*/
|
729
|
-
shouldConditionallyClear() {
|
692
|
+
shouldConditionallyClear(skipParent = false) {
|
730
693
|
// Skip if this component has clearOnHide set to false.
|
731
694
|
if (this.component.clearOnHide === false) {
|
732
|
-
|
733
|
-
return this._conditionallyClear;
|
695
|
+
return false;
|
734
696
|
}
|
735
697
|
// If the component is logically hidden, then it is conditionally hidden and should clear.
|
736
698
|
if (this.logicallyHidden) {
|
737
|
-
|
738
|
-
return this._conditionallyClear;
|
699
|
+
return true;
|
739
700
|
}
|
740
701
|
// If we have a condition and it is not conditionally visible, the it should conditionally clear.
|
741
|
-
if (this.hasCondition() &&
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
702
|
+
if (this.hasCondition() && !this.conditionallyVisible()) {
|
703
|
+
return true;
|
704
|
+
}
|
705
|
+
if (skipParent) {
|
706
|
+
// Stop recurrsion for the parent checks.
|
707
|
+
return false;
|
708
|
+
}
|
709
|
+
// If this component has a set value, then it should ONLY clear if a parent is hidden
|
710
|
+
// and has the clearOnHide set to true.
|
711
|
+
if (this.hasSetValue) {
|
712
|
+
return this.parentShouldConditionallyClear();
|
746
713
|
}
|
747
|
-
|
748
|
-
return this.
|
714
|
+
// Clear the value if the parent is conditionally hidden.
|
715
|
+
return this.parentConditionallyHidden();
|
749
716
|
}
|
750
|
-
|
751
|
-
* Returns if the component is conditionally hidden.
|
752
|
-
* @returns {boolean} - If the component is conditionally hidden.
|
753
|
-
*/
|
754
|
-
conditionallyHidden() {
|
755
|
-
// If it is logically hidden, then it is conditionally hidden.
|
717
|
+
conditionallyHidden(skipParent = false) {
|
756
718
|
if (this.logicallyHidden) {
|
757
|
-
|
758
|
-
return this._conditionallyHidden;
|
719
|
+
return true;
|
759
720
|
}
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
721
|
+
if (!this.hasCondition() && !skipParent) {
|
722
|
+
return this.parentConditionallyHidden();
|
723
|
+
}
|
724
|
+
// Return if we are not conditionally visible (conditionallyHidden)
|
725
|
+
if (!this.conditionallyVisible()) {
|
726
|
+
return true;
|
727
|
+
}
|
728
|
+
if (skipParent) {
|
729
|
+
// Stop recurrsion for the parent checks.
|
730
|
+
return false;
|
764
731
|
}
|
765
|
-
//
|
766
|
-
|
767
|
-
return this._conditionallyHidden;
|
732
|
+
// Check the parent.
|
733
|
+
return this.parentConditionallyHidden();
|
768
734
|
}
|
769
735
|
get currentForm() {
|
770
736
|
return this._currentForm;
|
@@ -3033,10 +2999,12 @@ class Component extends Element_1.default {
|
|
3033
2999
|
* @param {boolean} dirty - If the component is dirty.
|
3034
3000
|
* @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
|
3035
3001
|
* @param {*} row - Contextual row data for this component.
|
3002
|
+
* @param {*} options - Additional options for validation.
|
3036
3003
|
* @returns {string} - The message to show when the component is invalid.
|
3037
3004
|
*/
|
3038
|
-
invalidMessage(data, dirty, ignoreCondition, row) {
|
3005
|
+
invalidMessage(data, dirty, ignoreCondition, row, options = {}) {
|
3039
3006
|
var _a;
|
3007
|
+
const { local } = options;
|
3040
3008
|
if (!row) {
|
3041
3009
|
row = (0, utils_1.getContextualRowData)(this.component, data, this.paths);
|
3042
3010
|
}
|
@@ -3056,6 +3024,7 @@ class Component extends Element_1.default {
|
|
3056
3024
|
component: this.component,
|
3057
3025
|
data,
|
3058
3026
|
row,
|
3027
|
+
local,
|
3059
3028
|
path: this.path || this.component.key,
|
3060
3029
|
parent: (_a = this.parent) === null || _a === void 0 ? void 0 : _a.component,
|
3061
3030
|
paths: this.paths,
|
@@ -3234,7 +3203,7 @@ class Component extends Element_1.default {
|
|
3234
3203
|
row = row || this.data;
|
3235
3204
|
// Some components (for legacy reasons) have calls to "checkData" in inappropriate places such
|
3236
3205
|
// as setValue. Historically, this was bypassed by a series of cached states around the data model
|
3237
|
-
// which caused its own problems. We need to ensure that premium and custom components do not fall into
|
3206
|
+
// which caused its own problems. We need to ensure that premium and custom components do not fall into
|
3238
3207
|
// an infinite loop by only checking this component once.
|
3239
3208
|
if (this.checkingData) {
|
3240
3209
|
return;
|
@@ -1107,7 +1107,9 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
1107
1107
|
errors.push(...this._errors);
|
1108
1108
|
return false;
|
1109
1109
|
}
|
1110
|
-
|
1110
|
+
// TODO: this is the only place invalidMessage gets called, and it's not clear why it's needed - we already validate the editGrid
|
1111
|
+
// component above with super.checkComponentValidity
|
1112
|
+
const message = this.invalid || this.invalidMessage(data, dirty, false, row, options);
|
1111
1113
|
if (allRowErrors.length && ((_b = this.root) === null || _b === void 0 ? void 0 : _b.submitted) && !message) {
|
1112
1114
|
this._errors = this.setCustomValidity(message, dirty);
|
1113
1115
|
errors.push(...this._errors);
|
@@ -98,6 +98,7 @@ export default class FormComponent extends Component {
|
|
98
98
|
* @returns {void}
|
99
99
|
*/
|
100
100
|
onSetSubFormValue(submission: object | null | undefined, flags: object | null | undefined): void;
|
101
|
+
areAllComponentsEmpty(data: any): boolean;
|
101
102
|
updateSubFormVisibility(): void;
|
102
103
|
/**
|
103
104
|
* Determines if this form is a Nested Wizard
|
@@ -101,9 +101,6 @@ class FormComponent extends Component_1.default {
|
|
101
101
|
}
|
102
102
|
return this.createSubForm();
|
103
103
|
}
|
104
|
-
shouldConditionallyClearOnPristine() {
|
105
|
-
return !this.hasSetValue && super.shouldConditionallyClearOnPristine();
|
106
|
-
}
|
107
104
|
get dataReady() {
|
108
105
|
var _a;
|
109
106
|
return ((_a = this.subForm) === null || _a === void 0 ? void 0 : _a.dataReady) || this.subFormReady || Promise.resolve();
|
@@ -293,13 +290,11 @@ class FormComponent extends Component_1.default {
|
|
293
290
|
}
|
294
291
|
this.subForm.attach(element);
|
295
292
|
this.valueChanged = this.hasSetValue;
|
296
|
-
if (!this.
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
this.restoreValue();
|
302
|
-
}
|
293
|
+
if (!this.valueChanged && this.dataValue.state !== 'submitted') {
|
294
|
+
this.setDefaultValue();
|
295
|
+
}
|
296
|
+
else {
|
297
|
+
this.restoreValue();
|
303
298
|
}
|
304
299
|
}
|
305
300
|
if (!this.builderMode && this.component.modalEdit) {
|
@@ -416,7 +411,7 @@ class FormComponent extends Component_1.default {
|
|
416
411
|
lodash_1.default.assign(componentsMap, formComponentsMap);
|
417
412
|
this.component.components = this.subForm.components.map((comp) => comp.component);
|
418
413
|
this.subForm.on('change', () => {
|
419
|
-
if (this.subForm
|
414
|
+
if (this.subForm) {
|
420
415
|
this.dataValue = this.subForm.getValue();
|
421
416
|
this.triggerChange({
|
422
417
|
noEmit: true
|
@@ -684,7 +679,20 @@ class FormComponent extends Component_1.default {
|
|
684
679
|
}
|
685
680
|
}
|
686
681
|
isEmpty(value = this.dataValue) {
|
687
|
-
return value === null || lodash_1.default.isEqual(value, this.emptyValue);
|
682
|
+
return value === null || lodash_1.default.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value === null || value === void 0 ? void 0 : value.data) && !(value === null || value === void 0 ? void 0 : value._id));
|
683
|
+
}
|
684
|
+
areAllComponentsEmpty(data) {
|
685
|
+
let res = true;
|
686
|
+
if (this.subForm) {
|
687
|
+
this.subForm.everyComponent((comp) => {
|
688
|
+
const componentValue = lodash_1.default.get(data, comp.key);
|
689
|
+
res &= comp.isEmpty(componentValue);
|
690
|
+
});
|
691
|
+
}
|
692
|
+
else {
|
693
|
+
res = false;
|
694
|
+
}
|
695
|
+
return res;
|
688
696
|
}
|
689
697
|
getValue() {
|
690
698
|
if (this.subForm) {
|
@@ -17,8 +17,8 @@ declare const _default: ({
|
|
17
17
|
tooltip?: undefined;
|
18
18
|
description?: undefined;
|
19
19
|
conditional?: undefined;
|
20
|
-
reorder?: undefined;
|
21
20
|
defaultValue?: undefined;
|
21
|
+
reorder?: undefined;
|
22
22
|
components?: undefined;
|
23
23
|
dataSrc?: undefined;
|
24
24
|
authenticate?: undefined;
|
@@ -59,8 +59,8 @@ declare const _default: ({
|
|
59
59
|
};
|
60
60
|
};
|
61
61
|
data?: undefined;
|
62
|
-
reorder?: undefined;
|
63
62
|
defaultValue?: undefined;
|
63
|
+
reorder?: undefined;
|
64
64
|
components?: undefined;
|
65
65
|
dataSrc?: undefined;
|
66
66
|
authenticate?: undefined;
|
@@ -88,6 +88,7 @@ declare const _default: ({
|
|
88
88
|
key: string;
|
89
89
|
tooltip: string;
|
90
90
|
weight: number;
|
91
|
+
defaultValue: boolean;
|
91
92
|
conditional: {
|
92
93
|
json: {
|
93
94
|
and: ({
|
@@ -110,7 +111,6 @@ declare const _default: ({
|
|
110
111
|
editor?: undefined;
|
111
112
|
description?: undefined;
|
112
113
|
reorder?: undefined;
|
113
|
-
defaultValue?: undefined;
|
114
114
|
components?: undefined;
|
115
115
|
dataSrc?: undefined;
|
116
116
|
authenticate?: undefined;
|
@@ -220,8 +220,8 @@ declare const _default: ({
|
|
220
220
|
as?: undefined;
|
221
221
|
editor?: undefined;
|
222
222
|
description?: undefined;
|
223
|
-
reorder?: undefined;
|
224
223
|
defaultValue?: undefined;
|
224
|
+
reorder?: undefined;
|
225
225
|
components?: undefined;
|
226
226
|
skipMerge?: undefined;
|
227
227
|
refreshOn?: undefined;
|
@@ -256,8 +256,8 @@ declare const _default: ({
|
|
256
256
|
data?: undefined;
|
257
257
|
as?: undefined;
|
258
258
|
editor?: undefined;
|
259
|
-
reorder?: undefined;
|
260
259
|
defaultValue?: undefined;
|
260
|
+
reorder?: undefined;
|
261
261
|
components?: undefined;
|
262
262
|
dataSrc?: undefined;
|
263
263
|
authenticate?: undefined;
|
@@ -328,8 +328,8 @@ declare const _default: ({
|
|
328
328
|
as?: undefined;
|
329
329
|
editor?: undefined;
|
330
330
|
description?: undefined;
|
331
|
-
reorder?: undefined;
|
332
331
|
defaultValue?: undefined;
|
332
|
+
reorder?: undefined;
|
333
333
|
components?: undefined;
|
334
334
|
authenticate?: undefined;
|
335
335
|
placeholder?: undefined;
|
@@ -363,8 +363,8 @@ declare const _default: ({
|
|
363
363
|
editor?: undefined;
|
364
364
|
description?: undefined;
|
365
365
|
conditional?: undefined;
|
366
|
-
reorder?: undefined;
|
367
366
|
defaultValue?: undefined;
|
367
|
+
reorder?: undefined;
|
368
368
|
components?: undefined;
|
369
369
|
authenticate?: undefined;
|
370
370
|
valueProperty?: undefined;
|
@@ -395,8 +395,8 @@ declare const _default: ({
|
|
395
395
|
editor?: undefined;
|
396
396
|
description?: undefined;
|
397
397
|
conditional?: undefined;
|
398
|
-
reorder?: undefined;
|
399
398
|
defaultValue?: undefined;
|
399
|
+
reorder?: undefined;
|
400
400
|
components?: undefined;
|
401
401
|
dataSrc?: undefined;
|
402
402
|
authenticate?: undefined;
|
@@ -436,8 +436,8 @@ declare const _default: ({
|
|
436
436
|
as?: undefined;
|
437
437
|
editor?: undefined;
|
438
438
|
description?: undefined;
|
439
|
-
reorder?: undefined;
|
440
439
|
defaultValue?: undefined;
|
440
|
+
reorder?: undefined;
|
441
441
|
components?: undefined;
|
442
442
|
dataSrc?: undefined;
|
443
443
|
authenticate?: undefined;
|
@@ -478,8 +478,8 @@ declare const _default: ({
|
|
478
478
|
data?: undefined;
|
479
479
|
as?: undefined;
|
480
480
|
editor?: undefined;
|
481
|
-
reorder?: undefined;
|
482
481
|
defaultValue?: undefined;
|
482
|
+
reorder?: undefined;
|
483
483
|
components?: undefined;
|
484
484
|
dataSrc?: undefined;
|
485
485
|
authenticate?: undefined;
|
@@ -626,8 +626,8 @@ declare const _default: ({
|
|
626
626
|
data?: undefined;
|
627
627
|
as?: undefined;
|
628
628
|
editor?: undefined;
|
629
|
-
reorder?: undefined;
|
630
629
|
defaultValue?: undefined;
|
630
|
+
reorder?: undefined;
|
631
631
|
components?: undefined;
|
632
632
|
dataSrc?: undefined;
|
633
633
|
authenticate?: undefined;
|
@@ -669,8 +669,8 @@ declare const _default: ({
|
|
669
669
|
data?: undefined;
|
670
670
|
as?: undefined;
|
671
671
|
description?: undefined;
|
672
|
-
reorder?: undefined;
|
673
672
|
defaultValue?: undefined;
|
673
|
+
reorder?: undefined;
|
674
674
|
components?: undefined;
|
675
675
|
dataSrc?: undefined;
|
676
676
|
authenticate?: undefined;
|
@@ -718,8 +718,8 @@ declare const _default: ({
|
|
718
718
|
as?: undefined;
|
719
719
|
editor?: undefined;
|
720
720
|
description?: undefined;
|
721
|
-
reorder?: undefined;
|
722
721
|
defaultValue?: undefined;
|
722
|
+
reorder?: undefined;
|
723
723
|
components?: undefined;
|
724
724
|
authenticate?: undefined;
|
725
725
|
template?: undefined;
|
@@ -932,8 +932,8 @@ declare const _default: ({
|
|
932
932
|
as?: undefined;
|
933
933
|
editor?: undefined;
|
934
934
|
description?: undefined;
|
935
|
-
reorder?: undefined;
|
936
935
|
defaultValue?: undefined;
|
936
|
+
reorder?: undefined;
|
937
937
|
components?: undefined;
|
938
938
|
dataSrc?: undefined;
|
939
939
|
authenticate?: undefined;
|
@@ -965,8 +965,8 @@ declare const _default: ({
|
|
965
965
|
editor?: undefined;
|
966
966
|
description?: undefined;
|
967
967
|
conditional?: undefined;
|
968
|
-
reorder?: undefined;
|
969
968
|
defaultValue?: undefined;
|
969
|
+
reorder?: undefined;
|
970
970
|
components?: undefined;
|
971
971
|
dataSrc?: undefined;
|
972
972
|
authenticate?: undefined;
|
@@ -1035,8 +1035,8 @@ declare const _default: ({
|
|
1035
1035
|
tooltip?: undefined;
|
1036
1036
|
description?: undefined;
|
1037
1037
|
conditional?: undefined;
|
1038
|
-
reorder?: undefined;
|
1039
1038
|
defaultValue?: undefined;
|
1039
|
+
reorder?: undefined;
|
1040
1040
|
components?: undefined;
|
1041
1041
|
dataSrc?: undefined;
|
1042
1042
|
authenticate?: undefined;
|
@@ -1115,8 +1115,8 @@ declare const _default: ({
|
|
1115
1115
|
label?: undefined;
|
1116
1116
|
tooltip?: undefined;
|
1117
1117
|
description?: undefined;
|
1118
|
-
reorder?: undefined;
|
1119
1118
|
defaultValue?: undefined;
|
1119
|
+
reorder?: undefined;
|
1120
1120
|
components?: undefined;
|
1121
1121
|
dataSrc?: undefined;
|
1122
1122
|
authenticate?: undefined;
|
@@ -1150,8 +1150,8 @@ declare const _default: ({
|
|
1150
1150
|
tooltip?: undefined;
|
1151
1151
|
description?: undefined;
|
1152
1152
|
conditional?: undefined;
|
1153
|
-
reorder?: undefined;
|
1154
1153
|
defaultValue?: undefined;
|
1154
|
+
reorder?: undefined;
|
1155
1155
|
components?: undefined;
|
1156
1156
|
dataSrc?: undefined;
|
1157
1157
|
authenticate?: undefined;
|
@@ -83,6 +83,7 @@ exports.default = [
|
|
83
83
|
key: 'lazyLoad',
|
84
84
|
tooltip: 'When set, this will not fire off the request to the URL until this control is within focus. This can improve performance if you have many Select dropdowns on your form where the API\'s will only fire when the control is activated.',
|
85
85
|
weight: 11,
|
86
|
+
defaultValue: true,
|
86
87
|
conditional: {
|
87
88
|
json: {
|
88
89
|
and: [
|
@@ -120,7 +120,7 @@ class SurveyComponent extends Field_1.default {
|
|
120
120
|
return this.component.questions.reduce((result, question) => result && Boolean(value[question.value]), true);
|
121
121
|
}
|
122
122
|
getInputName(question) {
|
123
|
-
return `${this.options.name}[${question.value}]`;
|
123
|
+
return `${this.options.name}[${question.value}][${this.id}]`;
|
124
124
|
}
|
125
125
|
getValueAsString(value, options) {
|
126
126
|
if (options === null || options === void 0 ? void 0 : options.email) {
|
@@ -62,7 +62,15 @@ class TextAreaComponent extends TextField_1.default {
|
|
62
62
|
info.content = value;
|
63
63
|
if ((this.options.readOnly || this.disabled) && !this.isHtmlRenderMode()) {
|
64
64
|
const elementStyle = this.info.attr.style || '';
|
65
|
-
const children =
|
65
|
+
const children = `
|
66
|
+
<div ${this._referenceAttributeName}="input"
|
67
|
+
class="formio-editor-read-only-content"
|
68
|
+
${elementStyle ? `style='${elementStyle}'` : ''}
|
69
|
+
role="textbox"
|
70
|
+
aria-multiline="true"
|
71
|
+
aria-readonly="true"
|
72
|
+
>
|
73
|
+
</div>`;
|
66
74
|
return this.renderTemplate('well', {
|
67
75
|
children,
|
68
76
|
nestedKey: this.key,
|
@@ -3,25 +3,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const lodash_1 = require("lodash");
|
6
7
|
const Unknown_edit_display_1 = __importDefault(require("./editForm/Unknown.edit.display"));
|
8
|
+
const utils_1 = __importDefault(require("../../components/_classes/component/editForm/utils"));
|
7
9
|
/**
|
8
10
|
* Unknown Component schema.
|
11
|
+
* @param {...any} extend
|
9
12
|
* @returns {object} - The Unknown Component edit form.
|
10
13
|
*/
|
11
|
-
function default_1() {
|
14
|
+
function default_1(...extend) {
|
15
|
+
const components = [
|
16
|
+
{
|
17
|
+
label: 'Custom',
|
18
|
+
key: 'display',
|
19
|
+
weight: 0,
|
20
|
+
components: Unknown_edit_display_1.default
|
21
|
+
}
|
22
|
+
].concat(...extend);
|
12
23
|
return {
|
13
24
|
components: [
|
14
25
|
{
|
15
26
|
type: 'tabs',
|
16
27
|
key: 'tabs',
|
17
|
-
components:
|
18
|
-
{
|
19
|
-
label: 'Custom',
|
20
|
-
key: 'display',
|
21
|
-
weight: 0,
|
22
|
-
components: Unknown_edit_display_1.default
|
23
|
-
}
|
24
|
-
]
|
28
|
+
components: (0, lodash_1.unionWith)(components, utils_1.default.unifyComponents)
|
25
29
|
}
|
26
30
|
]
|
27
31
|
};
|
@@ -26,8 +26,8 @@ export const getBestMatch: typeof Utils.getBestMatch;
|
|
26
26
|
export const getComponentFromPath: typeof Utils.getComponentFromPath;
|
27
27
|
export const getComponentValue: typeof Utils.getComponentValue;
|
28
28
|
export const findComponents: typeof Utils.findComponents;
|
29
|
-
export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?:
|
30
|
-
export const eachComponentData: (components: Component[], data: DataObject, fn: EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?:
|
29
|
+
export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => Promise<void>;
|
30
|
+
export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => void;
|
31
31
|
export const getComponentKey: typeof Utils.getComponentKey;
|
32
32
|
export const getContextualRowPath: typeof Utils.getContextualRowPath;
|
33
33
|
export const getContextualRowData: typeof Utils.getContextualRowData;
|
package/lib/cjs/utils/utils.js
CHANGED
@@ -34,6 +34,7 @@ const Evaluator_1 = require("./Evaluator");
|
|
34
34
|
Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
|
35
35
|
const conditionOperators_1 = __importDefault(require("./conditionOperators"));
|
36
36
|
exports.ConditionOperators = conditionOperators_1.default;
|
37
|
+
const core_1 = require("@formio/core");
|
37
38
|
const interpolate = Evaluator_1.Evaluator.interpolate;
|
38
39
|
exports.interpolate = interpolate;
|
39
40
|
__exportStar(require("./formUtils"), exports);
|
@@ -271,7 +272,7 @@ function checkSimpleConditional(component, condition, row, data, instance) {
|
|
271
272
|
default:
|
272
273
|
result = lodash_1.default.every(conditionsResult.flat(), res => !!res);
|
273
274
|
}
|
274
|
-
return show ? result : !result;
|
275
|
+
return (0, core_1.convertShowToBoolean)(show) ? result : !result;
|
275
276
|
}
|
276
277
|
}
|
277
278
|
exports.checkSimpleConditional = checkSimpleConditional;
|
@@ -163,22 +163,8 @@ declare class Component extends Element {
|
|
163
163
|
*/
|
164
164
|
info: any;
|
165
165
|
get componentsMap(): object;
|
166
|
-
/**
|
167
|
-
* Returns if the parent should conditionally clear.
|
168
|
-
* This method does not need to walk up the parent tree since the variables
|
169
|
-
* _conditionallyClear and _conditionallyHidden are set on the parent component
|
170
|
-
* before the child component is determined, and the parent component also references
|
171
|
-
* its parent component.
|
172
|
-
*
|
173
|
-
* @returns {boolean} - If the parent should conditionally clear.
|
174
|
-
*/
|
175
166
|
parentShouldConditionallyClear(): boolean;
|
176
167
|
parentConditionallyHidden(): boolean;
|
177
|
-
/**
|
178
|
-
* Returns true if any of the parents default their component "hidden" property to true.
|
179
|
-
* @returns {boolean} - If any parent defaults the hidden property to true.
|
180
|
-
*/
|
181
|
-
anyParentDefaultsHidden(): boolean;
|
182
168
|
set data(value: any);
|
183
169
|
get data(): any;
|
184
170
|
mergeSchema(component?: {}): any;
|
@@ -242,23 +228,8 @@ declare class Component extends Element {
|
|
242
228
|
get visible(): boolean;
|
243
229
|
get logicallyHidden(): any;
|
244
230
|
_logicallyHidden: any;
|
245
|
-
|
246
|
-
|
247
|
-
* @returns {boolean} - If the component should clear its value when the root form is pristine.
|
248
|
-
*/
|
249
|
-
shouldConditionallyClearOnPristine(): boolean;
|
250
|
-
/**
|
251
|
-
* Returns if the component should clear its value when conditionally hidden.
|
252
|
-
* @returns {boolean} - If the component should clear its value when conditionally hidden.
|
253
|
-
*/
|
254
|
-
shouldConditionallyClear(): boolean;
|
255
|
-
_conditionallyClear: boolean | undefined;
|
256
|
-
/**
|
257
|
-
* Returns if the component is conditionally hidden.
|
258
|
-
* @returns {boolean} - If the component is conditionally hidden.
|
259
|
-
*/
|
260
|
-
conditionallyHidden(): boolean;
|
261
|
-
_conditionallyHidden: boolean | undefined;
|
231
|
+
shouldConditionallyClear(skipParent?: boolean): boolean;
|
232
|
+
conditionallyHidden(skipParent?: boolean): boolean;
|
262
233
|
set currentForm(instance: any);
|
263
234
|
get currentForm(): any;
|
264
235
|
_currentForm: any;
|
@@ -1040,9 +1011,10 @@ declare class Component extends Element {
|
|
1040
1011
|
* @param {boolean} dirty - If the component is dirty.
|
1041
1012
|
* @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
|
1042
1013
|
* @param {*} row - Contextual row data for this component.
|
1014
|
+
* @param {*} options - Additional options for validation.
|
1043
1015
|
* @returns {string} - The message to show when the component is invalid.
|
1044
1016
|
*/
|
1045
|
-
invalidMessage(data: any, dirty: boolean, ignoreCondition: boolean, row: any): string;
|
1017
|
+
invalidMessage(data: any, dirty: boolean, ignoreCondition: boolean, row: any, options?: any): string;
|
1046
1018
|
/**
|
1047
1019
|
* Returns if the component is valid or not.
|
1048
1020
|
* @param {*} data - The data to check if the component is valid.
|