@formio/js 5.1.0-dev.6073.1f3d9c8 → 5.1.0-dev.6074.9c916f1
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 +540 -529
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +541 -530
- 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/list/ListComponent.js +2 -2
- package/lib/cjs/components/datetime/editForm/DateTime.edit.validation.d.ts +66 -15
- package/lib/cjs/components/datetime/editForm/DateTime.edit.validation.js +68 -47
- package/lib/cjs/components/textarea/TextArea.js +9 -1
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/utils.js +2 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +2 -2
- package/lib/mjs/components/datetime/editForm/DateTime.edit.validation.d.ts +66 -15
- package/lib/mjs/components/datetime/editForm/DateTime.edit.validation.js +68 -47
- package/lib/mjs/components/textarea/TextArea.js +9 -1
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/utils.js +2 -1
- package/package.json +2 -2
@@ -29,9 +29,9 @@ class ListComponent extends Field_1.default {
|
|
29
29
|
get dataReady() {
|
30
30
|
// If the root submission has been set, and we are still not attached, then assume
|
31
31
|
// that our data is ready.
|
32
|
-
if (this.root &&
|
32
|
+
if ((this.root &&
|
33
33
|
this.root.submissionSet &&
|
34
|
-
!this.attached) {
|
34
|
+
!this.attached) || !this.visible) {
|
35
35
|
return Promise.resolve();
|
36
36
|
}
|
37
37
|
return this.itemsLoaded;
|
@@ -6,36 +6,87 @@ declare const _default: ({
|
|
6
6
|
persistent: boolean;
|
7
7
|
weight: number;
|
8
8
|
tooltip: string;
|
9
|
+
applyMaskOn?: undefined;
|
10
|
+
logic?: undefined;
|
9
11
|
skipMerge?: undefined;
|
10
|
-
|
12
|
+
tableView?: undefined;
|
13
|
+
validateWhenHidden?: undefined;
|
11
14
|
enableTime?: undefined;
|
12
15
|
} | {
|
16
|
+
label: string;
|
17
|
+
tooltip: string;
|
18
|
+
applyMaskOn: string;
|
19
|
+
key: string;
|
20
|
+
logic: ({
|
21
|
+
name: string;
|
22
|
+
trigger: {
|
23
|
+
type: string;
|
24
|
+
javascript: string;
|
25
|
+
event?: undefined;
|
26
|
+
};
|
27
|
+
actions: {
|
28
|
+
name: string;
|
29
|
+
type: string;
|
30
|
+
schemaDefinition: string;
|
31
|
+
}[];
|
32
|
+
} | {
|
33
|
+
name: string;
|
34
|
+
trigger: {
|
35
|
+
type: string;
|
36
|
+
event: string;
|
37
|
+
javascript?: undefined;
|
38
|
+
};
|
39
|
+
actions: {
|
40
|
+
name: string;
|
41
|
+
type: string;
|
42
|
+
customAction: string;
|
43
|
+
}[];
|
44
|
+
})[];
|
13
45
|
type: string;
|
14
46
|
input: boolean;
|
15
|
-
key: string;
|
16
|
-
label: string;
|
17
47
|
skipMerge: boolean;
|
18
48
|
weight: number;
|
19
|
-
tooltip: string;
|
20
|
-
customConditional({ data, component }: {
|
21
|
-
data: any;
|
22
|
-
component: any;
|
23
|
-
}): boolean;
|
24
49
|
persistent?: undefined;
|
50
|
+
tableView?: undefined;
|
51
|
+
validateWhenHidden?: undefined;
|
25
52
|
enableTime?: undefined;
|
26
53
|
} | {
|
54
|
+
label: string;
|
55
|
+
tooltip: string;
|
56
|
+
applyMaskOn: string;
|
57
|
+
tableView: boolean;
|
58
|
+
validateWhenHidden: boolean;
|
59
|
+
key: string;
|
60
|
+
logic: ({
|
61
|
+
name: string;
|
62
|
+
trigger: {
|
63
|
+
type: string;
|
64
|
+
javascript: string;
|
65
|
+
event?: undefined;
|
66
|
+
};
|
67
|
+
actions: {
|
68
|
+
name: string;
|
69
|
+
type: string;
|
70
|
+
schemaDefinition: string;
|
71
|
+
}[];
|
72
|
+
} | {
|
73
|
+
name: string;
|
74
|
+
trigger: {
|
75
|
+
type: string;
|
76
|
+
event: string;
|
77
|
+
javascript?: undefined;
|
78
|
+
};
|
79
|
+
actions: {
|
80
|
+
name: string;
|
81
|
+
type: string;
|
82
|
+
customAction: string;
|
83
|
+
}[];
|
84
|
+
})[];
|
27
85
|
type: string;
|
28
86
|
input: boolean;
|
29
87
|
enableTime: boolean;
|
30
|
-
key: string;
|
31
88
|
skipMerge: boolean;
|
32
|
-
label: string;
|
33
89
|
weight: number;
|
34
|
-
tooltip: string;
|
35
|
-
customConditional({ data, component }: {
|
36
|
-
data: any;
|
37
|
-
component: any;
|
38
|
-
}): any;
|
39
90
|
persistent?: undefined;
|
40
91
|
})[];
|
41
92
|
export default _default;
|
@@ -11,35 +11,44 @@ exports.default = [
|
|
11
11
|
tooltip: 'Enables to use input for moment functions instead of calendar.'
|
12
12
|
},
|
13
13
|
{
|
14
|
-
|
15
|
-
|
14
|
+
label: 'Minimum Date',
|
15
|
+
tooltip: "The minimum date that can be picked. You can also use Moment.js functions. For example: moment().subtract(10, 'days')",
|
16
|
+
applyMaskOn: 'change',
|
16
17
|
key: 'datePicker.minDate',
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
18
|
+
logic: [
|
19
|
+
{
|
20
|
+
name: 'check input mode',
|
21
|
+
trigger: {
|
22
|
+
type: 'javascript',
|
23
|
+
javascript: "if (component.datePicker && component.datePicker.minDate && component.datePicker.minDate.indexOf('moment') !== -1) {\r\n result = false;\r\n}\r\nelse {\r\n result = !data.enableMinDateInput;\r\n}",
|
24
|
+
},
|
25
|
+
actions: [
|
26
|
+
{
|
27
|
+
name: 'change component',
|
28
|
+
type: 'mergeComponentSchema',
|
29
|
+
schemaDefinition: "schema = {\n type: 'datetime',\n label: 'Use calendar to set minDate',\n enableDate: true,\n enableTime: true,\n tooltip: 'Enables to use calendar to set date.',\n widget: {\n type: 'calendar',\n displayInTimezone: 'viewer',\n locale: 'en',\n useLocaleSettings: false,\n allowInput: true,\n mode: 'single',\n enableTime: true,\n noCalendar: false,\n format: 'yyyy-MM-dd hh:mm a',\n hourIncrement: 1,\n minuteIncrement: 1,\n time_24hr: false,\n disableWeekends: false,\n disableWeekdays: false,\n maxDate: null,\n },\n};",
|
30
|
+
},
|
31
|
+
],
|
32
|
+
},
|
33
|
+
{
|
34
|
+
name: 'clear value',
|
35
|
+
trigger: {
|
36
|
+
type: 'event',
|
37
|
+
event: 'componentChange',
|
38
|
+
},
|
39
|
+
actions: [
|
40
|
+
{
|
41
|
+
name: 'reset value',
|
42
|
+
type: 'customAction',
|
43
|
+
customAction: "var isDateInput = instance.component?.type === 'datetime';\nvar enableInput = data.enableMinDateInput;\nvar allowReset = result[0].component && result[0].component.key === 'enableMinDateInput' && !result[0].flags?.fromSubmission;\nif(((enableInput && isDateInput) || (!enableInput && !isDateInput)) && allowReset) {\n instance.resetValue()\n}\n",
|
44
|
+
},
|
45
|
+
],
|
46
|
+
},
|
47
|
+
],
|
29
48
|
type: 'textfield',
|
30
49
|
input: true,
|
31
|
-
enableTime: false,
|
32
|
-
key: 'datePicker.minDate',
|
33
50
|
skipMerge: true,
|
34
|
-
label: 'Minimum Date',
|
35
51
|
weight: 10,
|
36
|
-
tooltip: 'The minimum date that can be picked. You can also use Moment.js functions. For example: \n \n moment().subtract(10, \'days\')',
|
37
|
-
customConditional({ data, component }) {
|
38
|
-
if (component.datePicker && component.datePicker.minDate && component.datePicker.minDate.indexOf('moment') !== -1) {
|
39
|
-
return true;
|
40
|
-
}
|
41
|
-
return data.enableMinDateInput;
|
42
|
-
},
|
43
52
|
},
|
44
53
|
{
|
45
54
|
type: 'checkbox',
|
@@ -51,34 +60,46 @@ exports.default = [
|
|
51
60
|
tooltip: 'Enables to use input for moment functions instead of calendar.'
|
52
61
|
},
|
53
62
|
{
|
54
|
-
|
55
|
-
|
63
|
+
label: 'Maximum Date',
|
64
|
+
tooltip: "The maximum date that can be picked. You can also use Moment.js functions. For example: moment().add(10, 'days')",
|
65
|
+
applyMaskOn: 'change',
|
66
|
+
tableView: true,
|
67
|
+
validateWhenHidden: false,
|
56
68
|
key: 'datePicker.maxDate',
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
+
logic: [
|
70
|
+
{
|
71
|
+
name: 'check input mode',
|
72
|
+
trigger: {
|
73
|
+
type: 'javascript',
|
74
|
+
javascript: "if (component.datePicker && component.datePicker.maxDate && component.datePicker.maxDate.indexOf('moment') !== -1) {\r\n result = false;\r\n}\r\nelse {\r\n result = !data.enableMaxDateInput;\r\n}",
|
75
|
+
},
|
76
|
+
actions: [
|
77
|
+
{
|
78
|
+
name: 'change component',
|
79
|
+
type: 'mergeComponentSchema',
|
80
|
+
schemaDefinition: "schema = {\n type: 'datetime',\n label: 'Use calendar to set maxDate',\n enableDate: true,\n enableTime: true,\n tooltip: 'Enables to use calendar to set date.',\n widget: {\n type: 'calendar',\n displayInTimezone: 'viewer',\n locale: 'en',\n useLocaleSettings: false,\n allowInput: true,\n mode: 'single',\n enableTime: true,\n noCalendar: false,\n format: 'yyyy-MM-dd hh:mm a',\n hourIncrement: 1,\n minuteIncrement: 1,\n time_24hr: false,\n disableWeekends: false,\n disableWeekdays: false,\n maxDate: null,\n },\n};",
|
81
|
+
},
|
82
|
+
],
|
83
|
+
},
|
84
|
+
{
|
85
|
+
name: 'clear value',
|
86
|
+
trigger: {
|
87
|
+
type: 'event',
|
88
|
+
event: 'componentChange',
|
89
|
+
},
|
90
|
+
actions: [
|
91
|
+
{
|
92
|
+
name: 'reset value',
|
93
|
+
type: 'customAction',
|
94
|
+
customAction: "var isDateInput = instance.component?.type === 'datetime';\nvar enableInput = data.enableMaxDateInput;\nvar allowReset = result[0].component && result[0].component.key === 'enableMaxDateInput' && !result[0].flags?.fromSubmission;\nif(((enableInput && isDateInput) || (!enableInput && !isDateInput)) && allowReset) {\n instance.resetValue()\n}\n",
|
95
|
+
},
|
96
|
+
],
|
97
|
+
},
|
98
|
+
],
|
69
99
|
type: 'textfield',
|
70
100
|
input: true,
|
71
101
|
enableTime: false,
|
72
|
-
key: 'datePicker.maxDate',
|
73
102
|
skipMerge: true,
|
74
|
-
label: 'Maximum Date',
|
75
|
-
tooltip: 'The maximum date that can be picked. You can also use Moment.js functions. For example: \n \n moment().add(10, \'days\')',
|
76
103
|
weight: 20,
|
77
|
-
customConditional({ data, component }) {
|
78
|
-
if (component.datePicker && component.datePicker.maxDate && component.datePicker.maxDate.indexOf('moment') !== -1) {
|
79
|
-
return true;
|
80
|
-
}
|
81
|
-
return data.enableMaxDateInput;
|
82
|
-
},
|
83
104
|
}
|
84
105
|
];
|
@@ -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,
|
@@ -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;
|
@@ -24,9 +24,9 @@ export default class ListComponent extends Field {
|
|
24
24
|
get dataReady() {
|
25
25
|
// If the root submission has been set, and we are still not attached, then assume
|
26
26
|
// that our data is ready.
|
27
|
-
if (this.root &&
|
27
|
+
if ((this.root &&
|
28
28
|
this.root.submissionSet &&
|
29
|
-
!this.attached) {
|
29
|
+
!this.attached) || !this.visible) {
|
30
30
|
return Promise.resolve();
|
31
31
|
}
|
32
32
|
return this.itemsLoaded;
|
@@ -6,36 +6,87 @@ declare const _default: ({
|
|
6
6
|
persistent: boolean;
|
7
7
|
weight: number;
|
8
8
|
tooltip: string;
|
9
|
+
applyMaskOn?: undefined;
|
10
|
+
logic?: undefined;
|
9
11
|
skipMerge?: undefined;
|
10
|
-
|
12
|
+
tableView?: undefined;
|
13
|
+
validateWhenHidden?: undefined;
|
11
14
|
enableTime?: undefined;
|
12
15
|
} | {
|
16
|
+
label: string;
|
17
|
+
tooltip: string;
|
18
|
+
applyMaskOn: string;
|
19
|
+
key: string;
|
20
|
+
logic: ({
|
21
|
+
name: string;
|
22
|
+
trigger: {
|
23
|
+
type: string;
|
24
|
+
javascript: string;
|
25
|
+
event?: undefined;
|
26
|
+
};
|
27
|
+
actions: {
|
28
|
+
name: string;
|
29
|
+
type: string;
|
30
|
+
schemaDefinition: string;
|
31
|
+
}[];
|
32
|
+
} | {
|
33
|
+
name: string;
|
34
|
+
trigger: {
|
35
|
+
type: string;
|
36
|
+
event: string;
|
37
|
+
javascript?: undefined;
|
38
|
+
};
|
39
|
+
actions: {
|
40
|
+
name: string;
|
41
|
+
type: string;
|
42
|
+
customAction: string;
|
43
|
+
}[];
|
44
|
+
})[];
|
13
45
|
type: string;
|
14
46
|
input: boolean;
|
15
|
-
key: string;
|
16
|
-
label: string;
|
17
47
|
skipMerge: boolean;
|
18
48
|
weight: number;
|
19
|
-
tooltip: string;
|
20
|
-
customConditional({ data, component }: {
|
21
|
-
data: any;
|
22
|
-
component: any;
|
23
|
-
}): boolean;
|
24
49
|
persistent?: undefined;
|
50
|
+
tableView?: undefined;
|
51
|
+
validateWhenHidden?: undefined;
|
25
52
|
enableTime?: undefined;
|
26
53
|
} | {
|
54
|
+
label: string;
|
55
|
+
tooltip: string;
|
56
|
+
applyMaskOn: string;
|
57
|
+
tableView: boolean;
|
58
|
+
validateWhenHidden: boolean;
|
59
|
+
key: string;
|
60
|
+
logic: ({
|
61
|
+
name: string;
|
62
|
+
trigger: {
|
63
|
+
type: string;
|
64
|
+
javascript: string;
|
65
|
+
event?: undefined;
|
66
|
+
};
|
67
|
+
actions: {
|
68
|
+
name: string;
|
69
|
+
type: string;
|
70
|
+
schemaDefinition: string;
|
71
|
+
}[];
|
72
|
+
} | {
|
73
|
+
name: string;
|
74
|
+
trigger: {
|
75
|
+
type: string;
|
76
|
+
event: string;
|
77
|
+
javascript?: undefined;
|
78
|
+
};
|
79
|
+
actions: {
|
80
|
+
name: string;
|
81
|
+
type: string;
|
82
|
+
customAction: string;
|
83
|
+
}[];
|
84
|
+
})[];
|
27
85
|
type: string;
|
28
86
|
input: boolean;
|
29
87
|
enableTime: boolean;
|
30
|
-
key: string;
|
31
88
|
skipMerge: boolean;
|
32
|
-
label: string;
|
33
89
|
weight: number;
|
34
|
-
tooltip: string;
|
35
|
-
customConditional({ data, component }: {
|
36
|
-
data: any;
|
37
|
-
component: any;
|
38
|
-
}): any;
|
39
90
|
persistent?: undefined;
|
40
91
|
})[];
|
41
92
|
export default _default;
|
@@ -9,35 +9,44 @@ export default [
|
|
9
9
|
tooltip: 'Enables to use input for moment functions instead of calendar.'
|
10
10
|
},
|
11
11
|
{
|
12
|
-
|
13
|
-
|
12
|
+
label: 'Minimum Date',
|
13
|
+
tooltip: "The minimum date that can be picked. You can also use Moment.js functions. For example: moment().subtract(10, 'days')",
|
14
|
+
applyMaskOn: 'change',
|
14
15
|
key: 'datePicker.minDate',
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
logic: [
|
17
|
+
{
|
18
|
+
name: 'check input mode',
|
19
|
+
trigger: {
|
20
|
+
type: 'javascript',
|
21
|
+
javascript: "if (component.datePicker && component.datePicker.minDate && component.datePicker.minDate.indexOf('moment') !== -1) {\r\n result = false;\r\n}\r\nelse {\r\n result = !data.enableMinDateInput;\r\n}",
|
22
|
+
},
|
23
|
+
actions: [
|
24
|
+
{
|
25
|
+
name: 'change component',
|
26
|
+
type: 'mergeComponentSchema',
|
27
|
+
schemaDefinition: "schema = {\n type: 'datetime',\n label: 'Use calendar to set minDate',\n enableDate: true,\n enableTime: true,\n tooltip: 'Enables to use calendar to set date.',\n widget: {\n type: 'calendar',\n displayInTimezone: 'viewer',\n locale: 'en',\n useLocaleSettings: false,\n allowInput: true,\n mode: 'single',\n enableTime: true,\n noCalendar: false,\n format: 'yyyy-MM-dd hh:mm a',\n hourIncrement: 1,\n minuteIncrement: 1,\n time_24hr: false,\n disableWeekends: false,\n disableWeekdays: false,\n maxDate: null,\n },\n};",
|
28
|
+
},
|
29
|
+
],
|
30
|
+
},
|
31
|
+
{
|
32
|
+
name: 'clear value',
|
33
|
+
trigger: {
|
34
|
+
type: 'event',
|
35
|
+
event: 'componentChange',
|
36
|
+
},
|
37
|
+
actions: [
|
38
|
+
{
|
39
|
+
name: 'reset value',
|
40
|
+
type: 'customAction',
|
41
|
+
customAction: "var isDateInput = instance.component?.type === 'datetime';\nvar enableInput = data.enableMinDateInput;\nvar allowReset = result[0].component && result[0].component.key === 'enableMinDateInput' && !result[0].flags?.fromSubmission;\nif(((enableInput && isDateInput) || (!enableInput && !isDateInput)) && allowReset) {\n instance.resetValue()\n}\n",
|
42
|
+
},
|
43
|
+
],
|
44
|
+
},
|
45
|
+
],
|
27
46
|
type: 'textfield',
|
28
47
|
input: true,
|
29
|
-
enableTime: false,
|
30
|
-
key: 'datePicker.minDate',
|
31
48
|
skipMerge: true,
|
32
|
-
label: 'Minimum Date',
|
33
49
|
weight: 10,
|
34
|
-
tooltip: 'The minimum date that can be picked. You can also use Moment.js functions. For example: \n \n moment().subtract(10, \'days\')',
|
35
|
-
customConditional({ data, component }) {
|
36
|
-
if (component.datePicker && component.datePicker.minDate && component.datePicker.minDate.indexOf('moment') !== -1) {
|
37
|
-
return true;
|
38
|
-
}
|
39
|
-
return data.enableMinDateInput;
|
40
|
-
},
|
41
50
|
},
|
42
51
|
{
|
43
52
|
type: 'checkbox',
|
@@ -49,34 +58,46 @@ export default [
|
|
49
58
|
tooltip: 'Enables to use input for moment functions instead of calendar.'
|
50
59
|
},
|
51
60
|
{
|
52
|
-
|
53
|
-
|
61
|
+
label: 'Maximum Date',
|
62
|
+
tooltip: "The maximum date that can be picked. You can also use Moment.js functions. For example: moment().add(10, 'days')",
|
63
|
+
applyMaskOn: 'change',
|
64
|
+
tableView: true,
|
65
|
+
validateWhenHidden: false,
|
54
66
|
key: 'datePicker.maxDate',
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
+
logic: [
|
68
|
+
{
|
69
|
+
name: 'check input mode',
|
70
|
+
trigger: {
|
71
|
+
type: 'javascript',
|
72
|
+
javascript: "if (component.datePicker && component.datePicker.maxDate && component.datePicker.maxDate.indexOf('moment') !== -1) {\r\n result = false;\r\n}\r\nelse {\r\n result = !data.enableMaxDateInput;\r\n}",
|
73
|
+
},
|
74
|
+
actions: [
|
75
|
+
{
|
76
|
+
name: 'change component',
|
77
|
+
type: 'mergeComponentSchema',
|
78
|
+
schemaDefinition: "schema = {\n type: 'datetime',\n label: 'Use calendar to set maxDate',\n enableDate: true,\n enableTime: true,\n tooltip: 'Enables to use calendar to set date.',\n widget: {\n type: 'calendar',\n displayInTimezone: 'viewer',\n locale: 'en',\n useLocaleSettings: false,\n allowInput: true,\n mode: 'single',\n enableTime: true,\n noCalendar: false,\n format: 'yyyy-MM-dd hh:mm a',\n hourIncrement: 1,\n minuteIncrement: 1,\n time_24hr: false,\n disableWeekends: false,\n disableWeekdays: false,\n maxDate: null,\n },\n};",
|
79
|
+
},
|
80
|
+
],
|
81
|
+
},
|
82
|
+
{
|
83
|
+
name: 'clear value',
|
84
|
+
trigger: {
|
85
|
+
type: 'event',
|
86
|
+
event: 'componentChange',
|
87
|
+
},
|
88
|
+
actions: [
|
89
|
+
{
|
90
|
+
name: 'reset value',
|
91
|
+
type: 'customAction',
|
92
|
+
customAction: "var isDateInput = instance.component?.type === 'datetime';\nvar enableInput = data.enableMaxDateInput;\nvar allowReset = result[0].component && result[0].component.key === 'enableMaxDateInput' && !result[0].flags?.fromSubmission;\nif(((enableInput && isDateInput) || (!enableInput && !isDateInput)) && allowReset) {\n instance.resetValue()\n}\n",
|
93
|
+
},
|
94
|
+
],
|
95
|
+
},
|
96
|
+
],
|
67
97
|
type: 'textfield',
|
68
98
|
input: true,
|
69
99
|
enableTime: false,
|
70
|
-
key: 'datePicker.maxDate',
|
71
100
|
skipMerge: true,
|
72
|
-
label: 'Maximum Date',
|
73
|
-
tooltip: 'The maximum date that can be picked. You can also use Moment.js functions. For example: \n \n moment().add(10, \'days\')',
|
74
101
|
weight: 20,
|
75
|
-
customConditional({ data, component }) {
|
76
|
-
if (component.datePicker && component.datePicker.maxDate && component.datePicker.maxDate.indexOf('moment') !== -1) {
|
77
|
-
return true;
|
78
|
-
}
|
79
|
-
return data.enableMaxDateInput;
|
80
|
-
},
|
81
102
|
}
|
82
103
|
];
|
@@ -57,7 +57,15 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
57
57
|
info.content = value;
|
58
58
|
if ((this.options.readOnly || this.disabled) && !this.isHtmlRenderMode()) {
|
59
59
|
const elementStyle = this.info.attr.style || '';
|
60
|
-
const children =
|
60
|
+
const children = `
|
61
|
+
<div ${this._referenceAttributeName}="input"
|
62
|
+
class="formio-editor-read-only-content"
|
63
|
+
${elementStyle ? `style='${elementStyle}'` : ''}
|
64
|
+
role="textbox"
|
65
|
+
aria-multiline="true"
|
66
|
+
aria-readonly="true"
|
67
|
+
>
|
68
|
+
</div>`;
|
61
69
|
return this.renderTemplate('well', {
|
62
70
|
children,
|
63
71
|
nestedKey: this.key,
|
@@ -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/mjs/utils/utils.js
CHANGED
@@ -8,6 +8,7 @@ import dompurify from 'dompurify';
|
|
8
8
|
import { getValue } from './formUtils';
|
9
9
|
import { Evaluator } from './Evaluator';
|
10
10
|
import ConditionOperators from './conditionOperators';
|
11
|
+
import { convertShowToBoolean } from '@formio/core';
|
11
12
|
const interpolate = Evaluator.interpolate;
|
12
13
|
export * from './formUtils';
|
13
14
|
// Configure JsonLogic
|
@@ -236,7 +237,7 @@ export function checkSimpleConditional(component, condition, row, data, instance
|
|
236
237
|
default:
|
237
238
|
result = _.every(conditionsResult.flat(), res => !!res);
|
238
239
|
}
|
239
|
-
return show ? result : !result;
|
240
|
+
return convertShowToBoolean(show) ? result : !result;
|
240
241
|
}
|
241
242
|
}
|
242
243
|
/**
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.1.0-dev.
|
3
|
+
"version": "5.1.0-dev.6074.9c916f1",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"exports": {
|
@@ -81,7 +81,7 @@
|
|
81
81
|
"homepage": "https://github.com/formio/formio.js#readme",
|
82
82
|
"dependencies": {
|
83
83
|
"@formio/bootstrap": "v3.0.0-dev.121.085d187",
|
84
|
-
"@formio/core": "v2.4.0-dev.
|
84
|
+
"@formio/core": "v2.4.0-dev.232.d91b1e4",
|
85
85
|
"@formio/text-mask-addons": "3.8.0-formio.4",
|
86
86
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
87
87
|
"abortcontroller-polyfill": "^1.7.5",
|