@formio/js 5.0.0-rc.91 → 5.0.0-rc.93
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +31 -31
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +32 -32
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +4 -4
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +12 -12
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Webform.js +7 -1
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +1 -1
- package/lib/cjs/components/_classes/component/Component.js +7 -9
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/cjs/components/day/Day.d.ts +1 -1
- package/lib/cjs/components/day/Day.js +15 -0
- package/lib/cjs/components/day/fixtures/comp5.d.ts +18 -2
- package/lib/cjs/components/day/fixtures/comp5.js +6 -0
- package/lib/cjs/components/editgrid/EditGrid.d.ts +2 -2
- package/lib/cjs/components/editgrid/EditGrid.js +14 -7
- package/lib/cjs/components/editgrid/fixtures/comp19.d.ts +59 -0
- package/lib/cjs/components/editgrid/fixtures/comp19.js +73 -0
- package/lib/cjs/components/editgrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/editgrid/fixtures/index.js +3 -1
- package/lib/cjs/components/form/editForm/Form.edit.data.js +1 -1
- package/lib/cjs/components/number/fixtures/comp11.d.ts +17 -0
- package/lib/cjs/components/number/fixtures/comp11.js +20 -0
- package/lib/cjs/components/number/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/number/fixtures/index.js +3 -1
- package/lib/cjs/components/radio/Radio.d.ts +1 -0
- package/lib/cjs/components/radio/Radio.js +13 -4
- package/lib/cjs/components/select/Select.js +1 -1
- package/lib/cjs/components/select/fixtures/comp25.d.ts +43 -28
- package/lib/cjs/components/select/fixtures/comp25.js +56 -49
- package/lib/cjs/components/select/fixtures/comp26.d.ts +44 -0
- package/lib/cjs/components/select/fixtures/comp26.js +59 -0
- package/lib/cjs/components/select/fixtures/index.d.ts +1 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +9 -2
- package/lib/cjs/components/textarea/TextArea.d.ts +4 -4
- package/lib/cjs/components/textarea/TextArea.js +4 -4
- package/lib/cjs/components/time/Time.js +0 -6
- package/lib/cjs/components/time/fixtures/timeForm2.js +9 -0
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +1 -9
- package/lib/cjs/utils/formUtils.d.ts +3 -0
- package/lib/cjs/utils/formUtils.js +5 -2
- package/lib/cjs/utils/utils.d.ts +0 -12
- package/lib/cjs/utils/utils.js +1 -33
- package/lib/mjs/Webform.js +6 -1
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +1 -1
- package/lib/mjs/components/_classes/component/Component.js +7 -9
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/mjs/components/day/Day.d.ts +1 -1
- package/lib/mjs/components/day/Day.js +15 -0
- package/lib/mjs/components/day/fixtures/comp5.d.ts +18 -2
- package/lib/mjs/components/day/fixtures/comp5.js +6 -0
- package/lib/mjs/components/editgrid/EditGrid.d.ts +2 -2
- package/lib/mjs/components/editgrid/EditGrid.js +14 -7
- package/lib/mjs/components/editgrid/fixtures/comp19.d.ts +59 -0
- package/lib/mjs/components/editgrid/fixtures/comp19.js +71 -0
- package/lib/mjs/components/editgrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/editgrid/fixtures/index.js +2 -1
- package/lib/mjs/components/form/editForm/Form.edit.data.js +1 -1
- package/lib/mjs/components/number/fixtures/comp11.d.ts +17 -0
- package/lib/mjs/components/number/fixtures/comp11.js +18 -0
- package/lib/mjs/components/number/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/number/fixtures/index.js +2 -1
- package/lib/mjs/components/radio/Radio.d.ts +1 -0
- package/lib/mjs/components/radio/Radio.js +13 -4
- package/lib/mjs/components/select/Select.js +1 -1
- package/lib/mjs/components/select/fixtures/comp25.d.ts +43 -28
- package/lib/mjs/components/select/fixtures/comp25.js +56 -49
- package/lib/mjs/components/select/fixtures/comp26.d.ts +44 -0
- package/lib/mjs/components/select/fixtures/comp26.js +57 -0
- package/lib/mjs/components/select/fixtures/index.d.ts +1 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +8 -2
- package/lib/mjs/components/textarea/TextArea.d.ts +4 -4
- package/lib/mjs/components/textarea/TextArea.js +4 -4
- package/lib/mjs/components/time/Time.js +0 -6
- package/lib/mjs/components/time/fixtures/timeForm2.js +9 -0
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +2 -10
- package/lib/mjs/utils/formUtils.d.ts +3 -0
- package/lib/mjs/utils/formUtils.js +2 -2
- package/lib/mjs/utils/utils.d.ts +0 -12
- package/lib/mjs/utils/utils.js +0 -30
- package/package.json +3 -3
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
|
22
22
|
|
23
|
-
/*! formiojs v5.0.0-rc.
|
23
|
+
/*! formiojs v5.0.0-rc.93 | https://unpkg.com/formiojs@5.0.0-rc.93/LICENSE.txt */
|
24
24
|
|
25
25
|
/**
|
26
26
|
* @license
|
package/lib/cjs/Webform.js
CHANGED
@@ -1228,9 +1228,15 @@ class Webform extends NestedDataComponent_1.default {
|
|
1228
1228
|
* @param {any} changes - The changes that have occured in the form.
|
1229
1229
|
*/
|
1230
1230
|
onChange(flags, changed, modified, changes) {
|
1231
|
+
var _a;
|
1231
1232
|
flags = flags || {};
|
1232
1233
|
let isChangeEventEmitted = false;
|
1233
|
-
|
1234
|
+
if (((_a = this.parent) === null || _a === void 0 ? void 0 : _a.subForm) === this) {
|
1235
|
+
super.onChange(Object.assign(Object.assign({}, flags), { modified }), false);
|
1236
|
+
}
|
1237
|
+
else {
|
1238
|
+
super.onChange(flags, true);
|
1239
|
+
}
|
1234
1240
|
const value = lodash_1.default.clone(this.submission);
|
1235
1241
|
flags.changed = value.changed = changed;
|
1236
1242
|
flags.changes = changes;
|
package/lib/cjs/Wizard.js
CHANGED
@@ -916,7 +916,7 @@ class Wizard extends Webform_1.default {
|
|
916
916
|
const components = !currentPageOnly || this.isLastPage()
|
917
917
|
? this.getComponents()
|
918
918
|
: this.currentPage.components;
|
919
|
-
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, childErrors) && check, true);
|
919
|
+
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
|
920
920
|
}
|
921
921
|
get errors() {
|
922
922
|
if (!this.isLastPage()) {
|
@@ -1067,7 +1067,7 @@ declare class Component extends Element {
|
|
1067
1067
|
elementInfo(): any;
|
1068
1068
|
autofocus(): void;
|
1069
1069
|
scrollIntoView(element: any, verticalOnly: any): void;
|
1070
|
-
focus(index
|
1070
|
+
focus(index: any): void;
|
1071
1071
|
/**
|
1072
1072
|
* Get `Formio` instance for working with files
|
1073
1073
|
* @returns {import('@formio/core').Formio} - The Formio instance file service.
|
@@ -1738,12 +1738,12 @@ class Component extends Element_1.default {
|
|
1738
1738
|
var _a, _b, _c;
|
1739
1739
|
if ((_a = this.root) === null || _a === void 0 ? void 0 : _a.currentSelection) {
|
1740
1740
|
if ((_b = this.refs.input) === null || _b === void 0 ? void 0 : _b.length) {
|
1741
|
-
const {
|
1741
|
+
const { index } = this.root.currentSelection;
|
1742
1742
|
let input = this.refs.input[index];
|
1743
1743
|
const isInputRangeSelectable = (i) => /text|search|password|tel|url/i.test((i === null || i === void 0 ? void 0 : i.type) || '');
|
1744
1744
|
if (input) {
|
1745
1745
|
if (isInputRangeSelectable(input)) {
|
1746
|
-
input.setSelectionRange(
|
1746
|
+
input.setSelectionRange(input.value.length, input.value.length);
|
1747
1747
|
}
|
1748
1748
|
}
|
1749
1749
|
else {
|
@@ -2934,14 +2934,12 @@ class Component extends Element_1.default {
|
|
2934
2934
|
if (flags.silentCheck) {
|
2935
2935
|
return [];
|
2936
2936
|
}
|
2937
|
+
let isDirty = this.dirty || flags.dirty;
|
2937
2938
|
if (this.options.alwaysDirty) {
|
2938
|
-
|
2939
|
+
isDirty = true;
|
2939
2940
|
}
|
2940
|
-
|
2941
|
-
|
2942
|
-
}
|
2943
|
-
this.setDirty(flags.dirty);
|
2944
|
-
return this.setComponentValidity(errors, flags.dirty, flags.silentCheck, flags.fromSubmission);
|
2941
|
+
this.setDirty(isDirty);
|
2942
|
+
return this.setComponentValidity(errors, isDirty, flags.silentCheck, flags.fromSubmission);
|
2945
2943
|
}
|
2946
2944
|
/**
|
2947
2945
|
* Perform a component validation.
|
@@ -3436,7 +3434,7 @@ class Component extends Element_1.default {
|
|
3436
3434
|
const { left, top } = element.getBoundingClientRect();
|
3437
3435
|
window.scrollTo(verticalOnly ? window.scrollX : left + window.scrollX, top + window.scrollY);
|
3438
3436
|
}
|
3439
|
-
focus(index
|
3437
|
+
focus(index) {
|
3440
3438
|
var _a, _b, _c, _d;
|
3441
3439
|
if ('beforeFocus' in this.parent) {
|
3442
3440
|
this.parent.beforeFocus(this);
|
@@ -50,6 +50,6 @@ exports.default = [
|
|
50
50
|
},
|
51
51
|
utils_1.default.javaScriptValue('Advanced Conditions', 'customConditional', 'conditional.json', 110, '<p>You must assign the <strong>show</strong> variable a boolean result.</p>' +
|
52
52
|
'<p><strong>Note: Advanced Conditional logic will override the results of the Simple Conditional logic.</strong></p>' +
|
53
|
-
'<h5>Example</h5><pre>show = !!data.showMe;</pre>', '<p><a href="
|
53
|
+
'<h5>Example</h5><pre>show = !!data.showMe;</pre>', '<p><a href="https://help.form.io/userguide/form-building/logic-and-conditions" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>')
|
54
54
|
];
|
55
55
|
/* eslint-enable quotes, max-len */
|
@@ -140,7 +140,7 @@ exports.default = [
|
|
140
140
|
input: true
|
141
141
|
},
|
142
142
|
utils_1.default.javaScriptValue('Custom Default Value', 'customDefaultValue', 'customDefaultValue', 1000, '<p><h4>Example:</h4><pre>value = data.firstName + " " + data.lastName;</pre></p>', '<p><h4>Example:</h4><pre>{"cat": [{"var": "data.firstName"}, " ", {"var": "data.lastName"}]}</pre>'),
|
143
|
-
utils_1.default.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 1100, '<p><h4>Example:</h4><pre>value = data.a + data.b + data.c;</pre></p>', '<p><h4>Example:</h4><pre>{"+": [{"var": "data.a"}, {"var": "data.b"}, {"var": "data.c"}]}</pre><p><a href="
|
143
|
+
utils_1.default.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 1100, '<p><h4>Example:</h4><pre>value = data.a + data.b + data.c;</pre></p>', '<p><h4>Example:</h4><pre>{"+": [{"var": "data.a"}, {"var": "data.b"}, {"var": "data.c"}]}</pre><p><a href="https://help.form.io/userguide/form-building/logic-and-conditions#calculated-values" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>', '<tr><th>token</th><td>The decoded JWT token for the authenticated user.</td></tr>'),
|
144
144
|
{
|
145
145
|
type: 'checkbox',
|
146
146
|
input: true,
|
@@ -55,7 +55,7 @@ const EditFormUtils = {
|
|
55
55
|
'<tr><th>value</th><td>The current value of the component.</td></tr>' +
|
56
56
|
'<tr><th>moment</th><td>The moment.js library for date manipulation.</td></tr>' +
|
57
57
|
'<tr><th>_</th><td>An instance of <a href="https://lodash.com/docs/" target="_blank" rel="noopener noreferrer">Lodash</a>.</td></tr>' +
|
58
|
-
'<tr><th>utils</th><td>An instance of the <a href="
|
58
|
+
'<tr><th>utils</th><td>An instance of the <a href="https://help.form.io/developers/javascript-development/javascript-utilities" target="_blank" rel="noopener noreferrer">FormioUtils</a> object.</td></tr>' +
|
59
59
|
'<tr><th>util</th><td>An alias for "utils".</td></tr>' +
|
60
60
|
'</table><br/>'
|
61
61
|
/* eslint-enable prefer-template */
|
@@ -11,6 +11,7 @@ export default class DayComponent extends Field {
|
|
11
11
|
operators: string[];
|
12
12
|
};
|
13
13
|
static savedValueTypes(schema: any): string[];
|
14
|
+
static oldEmptyValue: string;
|
14
15
|
static get serverConditionSettings(): {
|
15
16
|
operators: string[];
|
16
17
|
};
|
@@ -135,7 +136,6 @@ export default class DayComponent extends Field {
|
|
135
136
|
* @returns {string|null} - The string value of the date.
|
136
137
|
*/
|
137
138
|
getValueAsString(value: any): string | null;
|
138
|
-
focus(field: any): void;
|
139
139
|
isPartialDay(value: any): boolean;
|
140
140
|
getValidationFormat(): string;
|
141
141
|
}
|
@@ -104,6 +104,12 @@ class DayComponent extends Field_1.default {
|
|
104
104
|
info.changeEvent = 'input';
|
105
105
|
return info;
|
106
106
|
}
|
107
|
+
isEmpty(value = this.dataValue) {
|
108
|
+
if (value === DayComponent.oldEmptyValue) {
|
109
|
+
return true;
|
110
|
+
}
|
111
|
+
return super.isEmpty(value);
|
112
|
+
}
|
107
113
|
inputDefinition(name) {
|
108
114
|
let min, max;
|
109
115
|
if (name === 'day') {
|
@@ -337,6 +343,10 @@ class DayComponent extends Field_1.default {
|
|
337
343
|
}
|
338
344
|
}
|
339
345
|
normalizeValue(value) {
|
346
|
+
// Adjust the value from old to new format
|
347
|
+
if (value === DayComponent.oldEmptyValue) {
|
348
|
+
value = '';
|
349
|
+
}
|
340
350
|
if (!value || this.valueMask.test(value)) {
|
341
351
|
return value;
|
342
352
|
}
|
@@ -584,6 +594,9 @@ class DayComponent extends Field_1.default {
|
|
584
594
|
* @returns {string|null} - The string value of the date.
|
585
595
|
*/
|
586
596
|
getValueAsString(value) {
|
597
|
+
if (!value) {
|
598
|
+
return '';
|
599
|
+
}
|
587
600
|
return this.getDate(value) || '';
|
588
601
|
}
|
589
602
|
focus(field) {
|
@@ -640,4 +653,6 @@ class DayComponent extends Field_1.default {
|
|
640
653
|
return validationFormat;
|
641
654
|
}
|
642
655
|
}
|
656
|
+
// Empty value used before 9.3.x
|
657
|
+
DayComponent.oldEmptyValue = '00/00/0000';
|
643
658
|
exports.default = DayComponent;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
declare namespace _default {
|
2
2
|
let type: string;
|
3
3
|
let display: string;
|
4
|
-
let components: {
|
4
|
+
let components: ({
|
5
5
|
label: string;
|
6
6
|
hideInputLabels: boolean;
|
7
7
|
inputsLabelPosition: string;
|
@@ -24,6 +24,22 @@ declare namespace _default {
|
|
24
24
|
type: string;
|
25
25
|
input: boolean;
|
26
26
|
defaultValue: string;
|
27
|
-
|
27
|
+
action?: undefined;
|
28
|
+
theme?: undefined;
|
29
|
+
} | {
|
30
|
+
type: string;
|
31
|
+
action: string;
|
32
|
+
label: string;
|
33
|
+
theme: string;
|
34
|
+
hideInputLabels?: undefined;
|
35
|
+
inputsLabelPosition?: undefined;
|
36
|
+
useLocaleSettings?: undefined;
|
37
|
+
tableView?: undefined;
|
38
|
+
fields?: undefined;
|
39
|
+
validateOn?: undefined;
|
40
|
+
key?: undefined;
|
41
|
+
input?: undefined;
|
42
|
+
defaultValue?: undefined;
|
43
|
+
})[];
|
28
44
|
}
|
29
45
|
export default _default;
|
@@ -89,8 +89,8 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
89
89
|
hasOpenRows(): any;
|
90
90
|
getAttachedData(data?: null): any;
|
91
91
|
shouldValidateDraft(editRow: any): any;
|
92
|
-
shouldValidateRow(editRow: any, dirty: any): any;
|
93
|
-
validateRow(editRow: any, dirty: any, forceSilentCheck: any): any;
|
92
|
+
shouldValidateRow(editRow: any, dirty: any, fromSubmission: any): any;
|
93
|
+
validateRow(editRow: any, dirty: any, forceSilentCheck: any, fromSubmission: any): any;
|
94
94
|
showRowErrorAlerts(editRow: any, errors: any): void;
|
95
95
|
/**
|
96
96
|
* @returns {boolean} - Return that this component processes its own validation.
|
@@ -13,6 +13,7 @@ const utils_1 = require("../../utils/utils");
|
|
13
13
|
const EditRowState = {
|
14
14
|
New: 'new',
|
15
15
|
Editing: 'editing',
|
16
|
+
Saving: 'saving',
|
16
17
|
Saved: 'saved',
|
17
18
|
Viewing: 'viewing',
|
18
19
|
Removed: 'removed',
|
@@ -798,6 +799,10 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
798
799
|
if (!this.component.rowDrafts) {
|
799
800
|
editRow.components.forEach((comp) => comp.setPristine(false));
|
800
801
|
}
|
802
|
+
// Mark the row with a 'Saving' state to trigger validation for future row changes
|
803
|
+
if (editRow.state === EditRowState.New) {
|
804
|
+
editRow.state = EditRowState.Saving;
|
805
|
+
}
|
801
806
|
const errors = this.validateRow(editRow, true);
|
802
807
|
if (!this.component.rowDrafts) {
|
803
808
|
if (errors.length) {
|
@@ -810,7 +815,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
810
815
|
this.root.focusedComponent = null;
|
811
816
|
}
|
812
817
|
switch (editRow.state) {
|
813
|
-
case EditRowState.
|
818
|
+
case EditRowState.Saving: {
|
814
819
|
const newIndex = dataValue.length;
|
815
820
|
dataValue.push(editRow.data);
|
816
821
|
editRow.components.forEach(component => component.rowIndex = newIndex);
|
@@ -968,17 +973,18 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
968
973
|
!this.hasOpenRows()) ||
|
969
974
|
((_b = this.root) === null || _b === void 0 ? void 0 : _b.submitted);
|
970
975
|
}
|
971
|
-
shouldValidateRow(editRow, dirty) {
|
976
|
+
shouldValidateRow(editRow, dirty, fromSubmission) {
|
972
977
|
return this.shouldValidateDraft(editRow) ||
|
973
|
-
editRow.state === EditRowState.
|
978
|
+
editRow.state === EditRowState.Saving ||
|
974
979
|
editRow.state === EditRowState.Editing ||
|
975
980
|
editRow.alerts ||
|
981
|
+
fromSubmission ||
|
976
982
|
dirty;
|
977
983
|
}
|
978
|
-
validateRow(editRow, dirty, forceSilentCheck) {
|
984
|
+
validateRow(editRow, dirty, forceSilentCheck, fromSubmission) {
|
979
985
|
var _a;
|
980
986
|
editRow.errors = [];
|
981
|
-
if (this.shouldValidateRow(editRow, dirty)) {
|
987
|
+
if (this.shouldValidateRow(editRow, dirty, fromSubmission)) {
|
982
988
|
const silentCheck = (this.component.rowDrafts && !this.shouldValidateDraft(editRow)) || forceSilentCheck;
|
983
989
|
const rootValue = (0, utils_1.fastCloneDeep)(this.rootValue);
|
984
990
|
const editGridValue = lodash_1.default.get(rootValue, this.path, []);
|
@@ -1050,7 +1056,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
1050
1056
|
}
|
1051
1057
|
checkComponentValidity(data, dirty, row, options = {}, errors = []) {
|
1052
1058
|
var _a, _b;
|
1053
|
-
const { silentCheck } = options;
|
1059
|
+
const { silentCheck, fromSubmission } = options;
|
1054
1060
|
const superValid = super.checkComponentValidity(data, dirty, row, options, errors);
|
1055
1061
|
// If super tells us that component invalid and there is no need to update alerts, just return false
|
1056
1062
|
if (!superValid && (!this.alert && !this.hasOpenRows())) {
|
@@ -1060,7 +1066,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
1060
1066
|
const allRowErrors = [];
|
1061
1067
|
this.editRows.forEach((editRow, index) => {
|
1062
1068
|
// Trigger all errors on the row.
|
1063
|
-
const rowErrors = this.validateRow(editRow, dirty, silentCheck);
|
1069
|
+
const rowErrors = this.validateRow(editRow, dirty, silentCheck, fromSubmission);
|
1064
1070
|
errors.push(...rowErrors);
|
1065
1071
|
allRowErrors.push(...rowErrors);
|
1066
1072
|
if (this.rowRefs) {
|
@@ -1074,6 +1080,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
1074
1080
|
}
|
1075
1081
|
else if (errorContainer) {
|
1076
1082
|
errorContainer.textContent = '';
|
1083
|
+
this.removeClass(errorContainer, 'help-block');
|
1077
1084
|
}
|
1078
1085
|
}
|
1079
1086
|
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
let _id: string;
|
3
|
+
let title: string;
|
4
|
+
let name: string;
|
5
|
+
let path: string;
|
6
|
+
let type: string;
|
7
|
+
let display: string;
|
8
|
+
let components: ({
|
9
|
+
label: string;
|
10
|
+
tableView: boolean;
|
11
|
+
validateWhenHidden: boolean;
|
12
|
+
rowDrafts: boolean;
|
13
|
+
key: string;
|
14
|
+
type: string;
|
15
|
+
displayAsTable: boolean;
|
16
|
+
input: boolean;
|
17
|
+
components: {
|
18
|
+
label: string;
|
19
|
+
columns: {
|
20
|
+
components: {
|
21
|
+
label: string;
|
22
|
+
applyMaskOn: string;
|
23
|
+
tableView: boolean;
|
24
|
+
validate: {
|
25
|
+
required: boolean;
|
26
|
+
};
|
27
|
+
validateWhenHidden: boolean;
|
28
|
+
key: string;
|
29
|
+
type: string;
|
30
|
+
input: boolean;
|
31
|
+
}[];
|
32
|
+
width: number;
|
33
|
+
offset: number;
|
34
|
+
push: number;
|
35
|
+
pull: number;
|
36
|
+
size: string;
|
37
|
+
currentWidth: number;
|
38
|
+
}[];
|
39
|
+
key: string;
|
40
|
+
type: string;
|
41
|
+
input: boolean;
|
42
|
+
tableView: boolean;
|
43
|
+
}[];
|
44
|
+
disableOnInvalid?: undefined;
|
45
|
+
} | {
|
46
|
+
type: string;
|
47
|
+
label: string;
|
48
|
+
key: string;
|
49
|
+
disableOnInvalid: boolean;
|
50
|
+
input: boolean;
|
51
|
+
tableView: boolean;
|
52
|
+
validateWhenHidden?: undefined;
|
53
|
+
rowDrafts?: undefined;
|
54
|
+
displayAsTable?: undefined;
|
55
|
+
components?: undefined;
|
56
|
+
})[];
|
57
|
+
let project: string;
|
58
|
+
}
|
59
|
+
export default _default;
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
_id: '6704f3d329cf52a3ddd4e244',
|
5
|
+
title: 'uiu',
|
6
|
+
name: 'uiu',
|
7
|
+
path: 'uiu',
|
8
|
+
type: 'resource',
|
9
|
+
display: 'form',
|
10
|
+
components: [
|
11
|
+
{
|
12
|
+
label: 'Edit Grid',
|
13
|
+
tableView: false,
|
14
|
+
validateWhenHidden: false,
|
15
|
+
rowDrafts: false,
|
16
|
+
key: 'editGrid',
|
17
|
+
type: 'editgrid',
|
18
|
+
displayAsTable: false,
|
19
|
+
input: true,
|
20
|
+
components: [
|
21
|
+
{
|
22
|
+
label: 'Columns',
|
23
|
+
columns: [
|
24
|
+
{
|
25
|
+
components: [
|
26
|
+
{
|
27
|
+
label: 'Text Field',
|
28
|
+
applyMaskOn: 'change',
|
29
|
+
tableView: true,
|
30
|
+
validate: {
|
31
|
+
required: true,
|
32
|
+
},
|
33
|
+
validateWhenHidden: false,
|
34
|
+
key: 'textField',
|
35
|
+
type: 'textfield',
|
36
|
+
input: true,
|
37
|
+
},
|
38
|
+
],
|
39
|
+
width: 6,
|
40
|
+
offset: 0,
|
41
|
+
push: 0,
|
42
|
+
pull: 0,
|
43
|
+
size: 'md',
|
44
|
+
currentWidth: 6,
|
45
|
+
},
|
46
|
+
{
|
47
|
+
components: [],
|
48
|
+
width: 6,
|
49
|
+
offset: 0,
|
50
|
+
push: 0,
|
51
|
+
pull: 0,
|
52
|
+
size: 'md',
|
53
|
+
currentWidth: 6,
|
54
|
+
},
|
55
|
+
],
|
56
|
+
key: 'columns',
|
57
|
+
type: 'columns',
|
58
|
+
input: false,
|
59
|
+
tableView: false,
|
60
|
+
},
|
61
|
+
],
|
62
|
+
},
|
63
|
+
{
|
64
|
+
type: 'button',
|
65
|
+
label: 'Submit',
|
66
|
+
key: 'submit',
|
67
|
+
disableOnInvalid: true,
|
68
|
+
input: true,
|
69
|
+
tableView: false,
|
70
|
+
},
|
71
|
+
],
|
72
|
+
project: '66f66c655879bf08113cf465',
|
73
|
+
};
|
@@ -15,7 +15,8 @@ import comp14 from './comp14';
|
|
15
15
|
import comp15 from './comp15';
|
16
16
|
import comp16 from './comp16';
|
17
17
|
import comp18 from './comp18';
|
18
|
+
import comp19 from './comp19';
|
18
19
|
import compOpenWhenEmpty from './comp-openWhenEmpty';
|
19
20
|
import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
|
20
21
|
import compWithCustomDefaultValue from './comp-with-custom-default-value';
|
21
|
-
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
|
22
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
|
@@ -3,7 +3,7 @@ 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
|
-
exports.compTestEvents = exports.compWithCustomDefaultValue = exports.withOpenWhenEmptyAndConditions = exports.compOpenWhenEmpty = exports.comp18 = exports.comp17 = exports.comp16 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
6
|
+
exports.compTestEvents = exports.compWithCustomDefaultValue = exports.withOpenWhenEmptyAndConditions = exports.compOpenWhenEmpty = exports.comp19 = exports.comp18 = exports.comp17 = exports.comp16 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
8
8
|
exports.comp1 = comp1_1.default;
|
9
9
|
const comp2_1 = __importDefault(require("./comp2"));
|
@@ -40,6 +40,8 @@ const comp17_1 = __importDefault(require("./comp17"));
|
|
40
40
|
exports.comp17 = comp17_1.default;
|
41
41
|
const comp18_1 = __importDefault(require("./comp18"));
|
42
42
|
exports.comp18 = comp18_1.default;
|
43
|
+
const comp19_1 = __importDefault(require("./comp19"));
|
44
|
+
exports.comp19 = comp19_1.default;
|
43
45
|
const comp_with_conditions_and_openWhenEmpty_1 = __importDefault(require("./comp-with-conditions-and-openWhenEmpty"));
|
44
46
|
exports.withOpenWhenEmptyAndConditions = comp_with_conditions_and_openWhenEmpty_1.default;
|
45
47
|
const comp_openWhenEmpty_1 = __importDefault(require("./comp-openWhenEmpty"));
|
@@ -7,7 +7,7 @@ const utils_1 = __importDefault(require("../../_classes/component/editForm/utils
|
|
7
7
|
/* eslint-disable max-len */
|
8
8
|
exports.default = [
|
9
9
|
utils_1.default.javaScriptValue('Custom Default Value', 'customDefaultValue', 'customDefaultValue', 120, '<p><h4>Example:</h4><pre>value = data.firstName + " " + data.lastName;</pre></p>', '<p><h4>Example:</h4><pre>{"cat": [{"var": "data.firstName"}, " ", {"var": "data.lastName"}]}</pre>'),
|
10
|
-
utils_1.default.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 130, '<p><h4>Example:</h4><pre>value = data.a + data.b + data.c;</pre></p>', '<p><h4>Example:</h4><pre>{"+": [{"var": "data.a"}, {"var": "data.b"}, {"var": "data.c"}]}</pre><p><a href="
|
10
|
+
utils_1.default.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 130, '<p><h4>Example:</h4><pre>value = data.a + data.b + data.c;</pre></p>', '<p><h4>Example:</h4><pre>{"+": [{"var": "data.a"}, {"var": "data.b"}, {"var": "data.c"}]}</pre><p><a href="https://help.form.io/userguide/form-building/logic-and-conditions#calculated-values" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>'),
|
11
11
|
{
|
12
12
|
weight: 140,
|
13
13
|
type: 'checkbox',
|
@@ -0,0 +1,17 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
let components: {
|
3
|
+
label: string;
|
4
|
+
mask: boolean;
|
5
|
+
tableView: boolean;
|
6
|
+
modalEdit: boolean;
|
7
|
+
multiple: boolean;
|
8
|
+
delimiter: string;
|
9
|
+
requireDecimal: boolean;
|
10
|
+
inputFormat: string;
|
11
|
+
truncateMultipleSpaces: boolean;
|
12
|
+
key: string;
|
13
|
+
type: string;
|
14
|
+
input: boolean;
|
15
|
+
}[];
|
16
|
+
}
|
17
|
+
export default _default;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
components: [
|
5
|
+
{
|
6
|
+
label: 'Number',
|
7
|
+
mask: true,
|
8
|
+
tableView: false,
|
9
|
+
modalEdit: true,
|
10
|
+
multiple: true,
|
11
|
+
delimiter: ',',
|
12
|
+
requireDecimal: false,
|
13
|
+
inputFormat: 'plain',
|
14
|
+
truncateMultipleSpaces: false,
|
15
|
+
key: 'number',
|
16
|
+
type: 'number',
|
17
|
+
input: true
|
18
|
+
}
|
19
|
+
]
|
20
|
+
};
|
@@ -8,4 +8,5 @@ import comp7 from './comp7';
|
|
8
8
|
import comp8 from './comp8';
|
9
9
|
import comp9 from './comp9';
|
10
10
|
import comp10 from './comp10';
|
11
|
-
|
11
|
+
import comp11 from './comp11';
|
12
|
+
export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11 };
|
@@ -3,7 +3,7 @@ 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
|
-
exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
6
|
+
exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
8
8
|
exports.comp1 = comp1_1.default;
|
9
9
|
const comp2_1 = __importDefault(require("./comp2"));
|
@@ -24,3 +24,5 @@ const comp9_1 = __importDefault(require("./comp9"));
|
|
24
24
|
exports.comp9 = comp9_1.default;
|
25
25
|
const comp10_1 = __importDefault(require("./comp10"));
|
26
26
|
exports.comp10 = comp10_1.default;
|
27
|
+
const comp11_1 = __importDefault(require("./comp11"));
|
28
|
+
exports.comp11 = comp11_1.default;
|
@@ -21,6 +21,7 @@ export default class RadioComponent extends ListComponent {
|
|
21
21
|
get isRadio(): boolean;
|
22
22
|
get optionSelectedClass(): string;
|
23
23
|
get listData(): any;
|
24
|
+
get selectMetadata(): any;
|
24
25
|
templateData: {} | undefined;
|
25
26
|
triggerUpdate: ((...args: any[]) => any) | undefined;
|
26
27
|
itemsLoadedResolve: ((value: any) => void) | undefined;
|
@@ -109,6 +109,12 @@ class RadioComponent extends ListComponent_1.default {
|
|
109
109
|
const listData = lodash_1.default.get(this.root, 'submission.metadata.listData', {});
|
110
110
|
return lodash_1.default.get(listData, this.path);
|
111
111
|
}
|
112
|
+
get selectMetadata() {
|
113
|
+
return super.selectData;
|
114
|
+
}
|
115
|
+
get selectData() {
|
116
|
+
return this.selectMetadata || this.component.selectData;
|
117
|
+
}
|
112
118
|
init() {
|
113
119
|
super.init();
|
114
120
|
this.templateData = {};
|
@@ -244,12 +250,15 @@ class RadioComponent extends ListComponent_1.default {
|
|
244
250
|
else if (!lodash_1.default.isString(value)) {
|
245
251
|
value = lodash_1.default.toString(value);
|
246
252
|
}
|
247
|
-
const
|
248
|
-
|
253
|
+
const shouldUseSelectData = (options.modalPreview || this.inDataTable)
|
254
|
+
&& this.component.dataSrc === 'url' && (this.loadedOptions.length || this.selectData);
|
255
|
+
if (this.component.dataSrc !== 'values' && !shouldUseSelectData) {
|
249
256
|
return value;
|
250
257
|
}
|
251
|
-
const values =
|
252
|
-
const option =
|
258
|
+
const values = shouldUseSelectData ? this.loadedOptions : this.component.values;
|
259
|
+
const option = !(values === null || values === void 0 ? void 0 : values.length) && shouldUseSelectData ? {
|
260
|
+
label: this.itemTemplate(this.selectData),
|
261
|
+
} : lodash_1.default.find(values, (v) => v.value === value);
|
253
262
|
if (!value) {
|
254
263
|
return lodash_1.default.get(option, 'label', '');
|
255
264
|
}
|
@@ -1563,8 +1563,8 @@ class SelectComponent extends ListComponent_1.default {
|
|
1563
1563
|
super.detach();
|
1564
1564
|
}
|
1565
1565
|
focus() {
|
1566
|
+
super.focus.call(this);
|
1566
1567
|
if (this.focusableElement) {
|
1567
|
-
super.focus.call(this);
|
1568
1568
|
this.focusableElement.focus();
|
1569
1569
|
}
|
1570
1570
|
}
|