@formio/js 5.1.0-dev.6048.569bfc1 → 5.1.0-dev.6049.6110ca0
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/Changelog.md +99 -310
- package/README.md +7 -0
- package/dist/formio.builder.css +1 -0
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.form.css +1 -0
- package/dist/formio.form.js +658 -669
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -1
- package/dist/formio.full.css +1 -0
- package/dist/formio.full.js +685 -696
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -1
- package/dist/formio.js +90 -68
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +103 -81
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +3 -1
- package/lib/cjs/Element.d.ts +2 -1
- package/lib/cjs/Element.js +18 -39
- package/lib/cjs/EventEmitter.js +2 -25
- package/lib/cjs/Form.js +2 -25
- package/lib/cjs/PDF.js +1 -1
- package/lib/cjs/PDFBuilder.d.ts +1 -0
- package/lib/cjs/PDFBuilder.js +10 -11
- package/lib/cjs/Webform.d.ts +2 -2
- package/lib/cjs/Webform.js +14 -15
- package/lib/cjs/WebformBuilder.d.ts +2 -1
- package/lib/cjs/WebformBuilder.js +62 -20
- package/lib/cjs/Wizard.d.ts +2 -2
- package/lib/cjs/Wizard.js +40 -26
- package/lib/cjs/WizardBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +44 -13
- package/lib/cjs/components/_classes/component/Component.js +156 -95
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +19 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/cjs/components/_classes/input/Input.js +1 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +3 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.js +15 -8
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -12
- package/lib/cjs/components/address/Address.d.ts +8 -0
- package/lib/cjs/components/address/Address.js +32 -9
- package/lib/cjs/components/address/editForm/Address.edit.display.d.ts +4 -0
- package/lib/cjs/components/address/editForm/Address.edit.display.js +1 -0
- package/lib/cjs/components/address/editForm/Address.edit.provider.js +8 -8
- package/lib/cjs/components/alert/Alert.js +1 -1
- package/lib/cjs/components/button/Button.d.ts +1 -1
- package/lib/cjs/components/button/Button.js +7 -11
- package/lib/cjs/components/checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/container/Container.js +1 -1
- package/lib/cjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/cjs/components/currency/Currency.js +1 -1
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +12 -0
- package/lib/cjs/components/datagrid/DataGrid.js +5 -1
- package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/cjs/components/datetime/DateTime.js +15 -13
- 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/day/Day.js +2 -2
- package/lib/cjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/cjs/components/editgrid/EditGrid.js +4 -2
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/cjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/cjs/components/file/File.js +6 -2
- package/lib/cjs/components/file/editForm/File.edit.file.d.ts +13 -0
- package/lib/cjs/components/file/editForm/File.edit.file.js +1 -0
- package/lib/cjs/components/form/Form.d.ts +0 -1
- package/lib/cjs/components/form/Form.js +31 -23
- package/lib/cjs/components/form/editForm/Form.edit.form.js +4 -3
- package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/cjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/cjs/components/number/Number.js +1 -1
- package/lib/cjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/cjs/components/panel/Panel.js +1 -1
- package/lib/cjs/components/password/editForm/Password.edit.display.js +13 -1
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +9 -1
- package/lib/cjs/components/radio/Radio.d.ts +8 -0
- package/lib/cjs/components/radio/Radio.js +16 -6
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/cjs/components/select/Select.d.ts +1 -0
- package/lib/cjs/components/select/Select.js +21 -5
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +68 -110
- package/lib/cjs/components/select/editForm/Select.edit.data.js +2 -37
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +6 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +7 -1
- package/lib/cjs/components/signature/Signature.js +1 -1
- package/lib/cjs/components/survey/Survey.js +2 -2
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/cjs/components/tags/Tags.js +1 -1
- package/lib/cjs/components/textarea/TextArea.js +10 -2
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/cjs/components/textfield/TextField.js +9 -32
- package/lib/cjs/components/time/Time.js +1 -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/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/cjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/cjs/formio.form.js +5 -5
- package/lib/cjs/providers/storage/uploadAdapter.js +8 -6
- package/lib/cjs/translations/en.d.ts +1 -234
- package/lib/cjs/translations/en.js +4 -2
- package/lib/cjs/utils/Evaluator.d.ts +20 -6
- package/lib/cjs/utils/Evaluator.js +38 -15
- package/lib/cjs/utils/builder.js +5 -5
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/index.d.ts +169 -2
- package/lib/cjs/utils/index.js +22 -2
- package/lib/cjs/utils/utils.d.ts +31 -37
- package/lib/cjs/utils/utils.js +80 -135
- package/lib/cjs/widgets/CalendarWidget.d.ts +1 -8
- package/lib/cjs/widgets/CalendarWidget.js +19 -40
- package/lib/mjs/Element.d.ts +2 -1
- package/lib/mjs/Element.js +11 -9
- package/lib/mjs/EventEmitter.js +2 -2
- package/lib/mjs/Form.js +1 -1
- package/lib/mjs/PDF.js +1 -1
- package/lib/mjs/PDFBuilder.d.ts +1 -0
- package/lib/mjs/PDFBuilder.js +9 -10
- package/lib/mjs/Webform.d.ts +2 -2
- package/lib/mjs/Webform.js +12 -13
- package/lib/mjs/WebformBuilder.d.ts +2 -1
- package/lib/mjs/WebformBuilder.js +53 -13
- package/lib/mjs/Wizard.d.ts +2 -2
- package/lib/mjs/Wizard.js +38 -24
- package/lib/mjs/WizardBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +44 -13
- package/lib/mjs/components/_classes/component/Component.js +129 -45
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +19 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/mjs/components/_classes/input/Input.js +1 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +3 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.js +15 -8
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -12
- package/lib/mjs/components/address/Address.d.ts +8 -0
- package/lib/mjs/components/address/Address.js +32 -9
- package/lib/mjs/components/address/editForm/Address.edit.display.d.ts +4 -0
- package/lib/mjs/components/address/editForm/Address.edit.display.js +1 -0
- package/lib/mjs/components/address/editForm/Address.edit.provider.js +8 -8
- package/lib/mjs/components/alert/Alert.js +1 -1
- package/lib/mjs/components/button/Button.d.ts +1 -1
- package/lib/mjs/components/button/Button.js +7 -10
- package/lib/mjs/components/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/container/Container.js +1 -1
- package/lib/mjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/mjs/components/currency/Currency.js +1 -1
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +12 -0
- package/lib/mjs/components/datagrid/DataGrid.js +5 -1
- package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/mjs/components/datetime/DateTime.js +15 -13
- 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/day/Day.js +2 -2
- package/lib/mjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/mjs/components/editgrid/EditGrid.js +4 -2
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/mjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/mjs/components/file/File.js +6 -2
- package/lib/mjs/components/file/editForm/File.edit.file.d.ts +13 -0
- package/lib/mjs/components/file/editForm/File.edit.file.js +1 -0
- package/lib/mjs/components/form/Form.d.ts +0 -1
- package/lib/mjs/components/form/Form.js +30 -23
- package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -2
- package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/mjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/mjs/components/number/Number.js +1 -1
- package/lib/mjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/mjs/components/panel/Panel.js +1 -1
- package/lib/mjs/components/password/editForm/Password.edit.display.js +13 -1
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +9 -1
- package/lib/mjs/components/radio/Radio.d.ts +8 -0
- package/lib/mjs/components/radio/Radio.js +16 -6
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/mjs/components/select/Select.d.ts +1 -0
- package/lib/mjs/components/select/Select.js +21 -5
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +68 -110
- package/lib/mjs/components/select/editForm/Select.edit.data.js +2 -37
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +6 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +7 -1
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/lib/mjs/components/survey/Survey.js +2 -2
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/mjs/components/tags/Tags.js +1 -1
- package/lib/mjs/components/textarea/TextArea.js +10 -2
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/mjs/components/textfield/TextField.js +3 -3
- package/lib/mjs/components/time/Time.js +1 -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/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/mjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/mjs/formio.form.js +3 -3
- package/lib/mjs/providers/storage/uploadAdapter.js +8 -6
- package/lib/mjs/translations/en.d.ts +1 -234
- package/lib/mjs/translations/en.js +6 -47
- package/lib/mjs/utils/Evaluator.d.ts +20 -6
- package/lib/mjs/utils/Evaluator.js +31 -13
- package/lib/mjs/utils/builder.js +1 -1
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/index.d.ts +169 -2
- package/lib/mjs/utils/index.js +18 -1
- package/lib/mjs/utils/utils.d.ts +31 -37
- package/lib/mjs/utils/utils.js +72 -109
- package/lib/mjs/widgets/CalendarWidget.d.ts +1 -8
- package/lib/mjs/widgets/CalendarWidget.js +19 -40
- package/package.json +8 -6
- package/lib/cjs/i18n.d.ts +0 -13
- package/lib/cjs/i18n.js +0 -19
- package/lib/cjs/utils/i18n.d.ts +0 -19
- package/lib/cjs/utils/i18n.js +0 -120
- package/lib/mjs/i18n.d.ts +0 -13
- package/lib/mjs/i18n.js +0 -14
- package/lib/mjs/utils/i18n.d.ts +0 -19
- package/lib/mjs/utils/i18n.js +0 -112
@@ -8,6 +8,7 @@ declare const _default: ({
|
|
8
8
|
customConditional: ({ data }: {
|
9
9
|
data: any;
|
10
10
|
}) => boolean;
|
11
|
+
defaultValue?: undefined;
|
11
12
|
placeholder?: undefined;
|
12
13
|
validate?: undefined;
|
13
14
|
} | {
|
@@ -15,6 +16,7 @@ declare const _default: ({
|
|
15
16
|
type: string;
|
16
17
|
input: boolean;
|
17
18
|
key: string;
|
19
|
+
defaultValue: string;
|
18
20
|
label: string;
|
19
21
|
placeholder: string;
|
20
22
|
tooltip: string;
|
@@ -32,6 +34,7 @@ declare const _default: ({
|
|
32
34
|
label: string;
|
33
35
|
tooltip: string;
|
34
36
|
customConditional?: undefined;
|
37
|
+
defaultValue?: undefined;
|
35
38
|
placeholder?: undefined;
|
36
39
|
validate?: undefined;
|
37
40
|
} | {
|
@@ -45,6 +48,7 @@ declare const _default: ({
|
|
45
48
|
customConditional: ({ data }: {
|
46
49
|
data: any;
|
47
50
|
}) => any;
|
51
|
+
defaultValue?: undefined;
|
48
52
|
validate?: undefined;
|
49
53
|
})[];
|
50
54
|
export default _default;
|
@@ -13,6 +13,7 @@ export default [
|
|
13
13
|
type: 'textfield',
|
14
14
|
input: true,
|
15
15
|
key: 'switchToManualModeLabel',
|
16
|
+
defaultValue: 'Can\'t find address? Switch to manual mode.',
|
16
17
|
label: 'Switch To Manual Mode Label',
|
17
18
|
placeholder: 'Switch To Manual Mode Label',
|
18
19
|
tooltip: 'The label for the checkbox used to switch to manual mode.',
|
@@ -26,7 +26,7 @@ export default [
|
|
26
26
|
{
|
27
27
|
type: 'textfield',
|
28
28
|
input: true,
|
29
|
-
key: "
|
29
|
+
key: "subscriptionKey",
|
30
30
|
label: 'Subscription Key',
|
31
31
|
placeholder: 'Enter Subscription Key',
|
32
32
|
weight: 10,
|
@@ -41,7 +41,7 @@ export default [
|
|
41
41
|
{
|
42
42
|
type: 'textfield',
|
43
43
|
input: true,
|
44
|
-
key: '
|
44
|
+
key: 'url',
|
45
45
|
label: 'Url',
|
46
46
|
placeholder: 'Enter Url',
|
47
47
|
weight: 10,
|
@@ -56,7 +56,7 @@ export default [
|
|
56
56
|
{
|
57
57
|
type: 'textfield',
|
58
58
|
input: true,
|
59
|
-
key: '
|
59
|
+
key: 'queryProperty',
|
60
60
|
label: 'Query Property',
|
61
61
|
defaultValue: 'query',
|
62
62
|
placeholder: 'Enter Query Property',
|
@@ -69,7 +69,7 @@ export default [
|
|
69
69
|
{
|
70
70
|
type: 'textfield',
|
71
71
|
input: true,
|
72
|
-
key: '
|
72
|
+
key: 'responseProperty',
|
73
73
|
label: 'Response Property',
|
74
74
|
placeholder: 'Enter Response Property',
|
75
75
|
weight: 30,
|
@@ -81,7 +81,7 @@ export default [
|
|
81
81
|
{
|
82
82
|
type: 'textfield',
|
83
83
|
input: true,
|
84
|
-
key: '
|
84
|
+
key: 'displayValueProperty',
|
85
85
|
label: 'Display Value Property',
|
86
86
|
placeholder: 'Display Value Property',
|
87
87
|
weight: 40,
|
@@ -93,7 +93,7 @@ export default [
|
|
93
93
|
{
|
94
94
|
type: 'textarea',
|
95
95
|
input: true,
|
96
|
-
key: '
|
96
|
+
key: 'params',
|
97
97
|
label: 'Params',
|
98
98
|
placeholder: '{ ... }',
|
99
99
|
weight: 50,
|
@@ -108,7 +108,7 @@ export default [
|
|
108
108
|
{
|
109
109
|
type: 'textfield',
|
110
110
|
input: true,
|
111
|
-
key: '
|
111
|
+
key: 'apiKey',
|
112
112
|
label: 'API Key',
|
113
113
|
placeholder: 'Enter API Key',
|
114
114
|
weight: 10,
|
@@ -123,7 +123,7 @@ export default [
|
|
123
123
|
{
|
124
124
|
type: 'textarea',
|
125
125
|
input: true,
|
126
|
-
key: '
|
126
|
+
key: 'autocompleteOptions',
|
127
127
|
label: 'Provider options',
|
128
128
|
placeholder: 'Enter provider options as JSON object',
|
129
129
|
defaultValue: {},
|
@@ -9,7 +9,7 @@ export default class ButtonComponent extends Field {
|
|
9
9
|
};
|
10
10
|
static savedValueTypes(schema: any): string[];
|
11
11
|
constructor(component: any, options: any, data: any);
|
12
|
-
filesUploading:
|
12
|
+
filesUploading: number;
|
13
13
|
get inputInfo(): any;
|
14
14
|
get labelInfo(): {
|
15
15
|
hidden: boolean;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import Field from '../_classes/field/Field';
|
3
3
|
import Input from '../_classes/input/Input';
|
4
|
-
import { componentValueTypes, eachComponent, getArrayFromComponentPath, getComponentSavedTypes } from '../../utils
|
4
|
+
import { componentValueTypes, eachComponent, getArrayFromComponentPath, getComponentSavedTypes } from '../../utils';
|
5
5
|
export default class ButtonComponent extends Field {
|
6
6
|
static schema(...extend) {
|
7
7
|
return Input.schema({
|
@@ -34,7 +34,7 @@ export default class ButtonComponent extends Field {
|
|
34
34
|
}
|
35
35
|
constructor(component, options, data) {
|
36
36
|
super(component, options, data);
|
37
|
-
this.filesUploading =
|
37
|
+
this.filesUploading = 0;
|
38
38
|
}
|
39
39
|
get defaultSchema() {
|
40
40
|
return ButtonComponent.schema();
|
@@ -142,16 +142,13 @@ export default class ButtonComponent extends Field {
|
|
142
142
|
this.addClass(this.refs.buttonMessageContainer, 'has-error');
|
143
143
|
this.setContent(this.refs.buttonMessage, resultMessage);
|
144
144
|
}, true);
|
145
|
-
this.on('fileUploadingStart', (
|
146
|
-
this.filesUploading
|
145
|
+
this.on('fileUploadingStart', () => {
|
146
|
+
this.filesUploading++;
|
147
147
|
this.disabled = true;
|
148
148
|
this.setDisabled(this.refs.button, this.disabled);
|
149
149
|
}, true);
|
150
|
-
this.on('fileUploadingEnd', (
|
151
|
-
|
152
|
-
if (index !== -1) {
|
153
|
-
this.filesUploading.splice(index, 1);
|
154
|
-
}
|
150
|
+
this.on('fileUploadingEnd', () => {
|
151
|
+
this.filesUploading--;
|
155
152
|
this.disabled = this.shouldDisabled ? true : false;
|
156
153
|
this.setDisabled(this.refs.button, this.disabled);
|
157
154
|
}, true);
|
@@ -247,7 +244,7 @@ export default class ButtonComponent extends Field {
|
|
247
244
|
}
|
248
245
|
}
|
249
246
|
get shouldDisabled() {
|
250
|
-
return super.shouldDisabled ||
|
247
|
+
return super.shouldDisabled || this.filesUploading > 0 || this.isDisabledOnInvalid;
|
251
248
|
}
|
252
249
|
attach(element) {
|
253
250
|
this.loadRefs(element, {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import _ from 'lodash';
|
2
|
-
import { componentValueTypes, getComponentSavedTypes } from '../../utils
|
2
|
+
import { componentValueTypes, getComponentSavedTypes } from '../../utils';
|
3
3
|
import Field from '../_classes/field/Field';
|
4
4
|
export default class CheckBoxComponent extends Field {
|
5
5
|
static schema(...extend) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import _ from 'lodash';
|
2
|
-
import { componentValueTypes, getComponentSavedTypes, getFocusableElements } from '../../utils
|
2
|
+
import { componentValueTypes, getComponentSavedTypes, getFocusableElements } from '../../utils';
|
3
3
|
import Component from '../_classes/component/Component';
|
4
4
|
import Field from '../_classes/field/Field';
|
5
5
|
import NestedDataComponent from '../_classes/nesteddata/NestedDataComponent';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { createNumberMask } from '@formio/text-mask-addons';
|
2
2
|
import { maskInput } from '@formio/vanilla-text-mask';
|
3
3
|
import _ from 'lodash';
|
4
|
-
import { getCurrencyAffixes } from '../../utils
|
4
|
+
import { getCurrencyAffixes } from '../../utils';
|
5
5
|
import NumberComponent from '../number/Number';
|
6
6
|
export default class CurrencyComponent extends NumberComponent {
|
7
7
|
static schema(...extend) {
|
@@ -7,6 +7,18 @@ export default [
|
|
7
7
|
key: 'allowMultipleMasks',
|
8
8
|
ignore: true
|
9
9
|
},
|
10
|
+
{
|
11
|
+
key: 'inputMasks',
|
12
|
+
ignore: true
|
13
|
+
},
|
14
|
+
{
|
15
|
+
key: 'widget.type',
|
16
|
+
ignore: true
|
17
|
+
},
|
18
|
+
{
|
19
|
+
key: 'widget',
|
20
|
+
ignore: true
|
21
|
+
},
|
10
22
|
{
|
11
23
|
key: 'showWordCount',
|
12
24
|
ignore: true
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import NestedArrayComponent from '../_classes/nestedarray/NestedArrayComponent';
|
3
|
-
import { fastCloneDeep, getFocusableElements } from '../../utils
|
3
|
+
import { fastCloneDeep, getFocusableElements, getComponent } from '../../utils';
|
4
4
|
export default class DataGridComponent extends NestedArrayComponent {
|
5
5
|
static schema(...extend) {
|
6
6
|
return NestedArrayComponent.schema({
|
@@ -488,6 +488,10 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
488
488
|
options.row = `${rowIndex}-${colIndex}`;
|
489
489
|
options.rowIndex = rowIndex;
|
490
490
|
options.onChange = (flags, changed, modified) => {
|
491
|
+
if (changed.component.type === 'form') {
|
492
|
+
const formComp = getComponent(this.component.components, changed.component.key);
|
493
|
+
_.set(formComp, 'components', changed.component.components);
|
494
|
+
}
|
491
495
|
this.triggerChange({ modified });
|
492
496
|
};
|
493
497
|
let columnComponent;
|
@@ -17,7 +17,7 @@ export default class DateTimeComponent extends Input {
|
|
17
17
|
};
|
18
18
|
static savedValueTypes(schema: any): string[];
|
19
19
|
get emptyValue(): string;
|
20
|
-
get
|
20
|
+
get dayjsFormat(): string;
|
21
21
|
createWrapper(): boolean;
|
22
22
|
checkValidity(data: any, dirty: any, rowData: any): boolean;
|
23
23
|
getValueAsString(value: any, options: any): any;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _ from 'lodash';
|
2
|
-
import
|
2
|
+
import dayjs from 'dayjs';
|
3
3
|
import FormioUtils from '../../utils';
|
4
|
-
import { componentValueTypes, fastCloneDeep, getComponentSavedTypes } from '../../utils
|
4
|
+
import { componentValueTypes, fastCloneDeep, getComponentSavedTypes } from '../../utils';
|
5
5
|
import Input from '../_classes/input/Input';
|
6
6
|
export default class DateTimeComponent extends Input {
|
7
7
|
static schema(...extend) {
|
@@ -147,8 +147,8 @@ export default class DateTimeComponent extends Input {
|
|
147
147
|
get emptyValue() {
|
148
148
|
return '';
|
149
149
|
}
|
150
|
-
get
|
151
|
-
return FormioUtils.
|
150
|
+
get dayjsFormat() {
|
151
|
+
return FormioUtils.convertFormatToDayjs(this.component.format);
|
152
152
|
}
|
153
153
|
isEmpty(value = this.dataValue) {
|
154
154
|
if (value && (value.toString() === 'Invalid Date')) {
|
@@ -157,12 +157,14 @@ export default class DateTimeComponent extends Input {
|
|
157
157
|
return super.isEmpty(value);
|
158
158
|
}
|
159
159
|
formatValue(input) {
|
160
|
-
|
161
|
-
|
160
|
+
if (dayjs(input).isValid()) {
|
161
|
+
return dayjs.utc(input).toISOString();
|
162
|
+
}
|
163
|
+
return input;
|
162
164
|
}
|
163
165
|
isEqual(valueA, valueB = this.dataValue) {
|
164
166
|
return (this.isEmpty(valueA) && this.isEmpty(valueB))
|
165
|
-
||
|
167
|
+
|| dayjs.utc(valueA).format(this.dayjsFormat) === dayjs.utc(valueB).format(this.dayjsFormat);
|
166
168
|
}
|
167
169
|
createWrapper() {
|
168
170
|
return false;
|
@@ -178,18 +180,18 @@ export default class DateTimeComponent extends Input {
|
|
178
180
|
return super.checkValidity(data, dirty, rowData);
|
179
181
|
}
|
180
182
|
getValueAsString(value, options) {
|
181
|
-
let format = FormioUtils.
|
182
|
-
format += format.match(/z$/) ? '' : ' z';
|
183
|
+
let format = FormioUtils.convertFormatToDayjs(this.component.format);
|
183
184
|
const timezone = this.timezone;
|
184
185
|
if (value && !this.attached && timezone) {
|
186
|
+
format += format.match(/z$/) ? '' : ' z';
|
185
187
|
if (Array.isArray(value) && this.component.multiple) {
|
186
|
-
return value.map(item => _.trim(FormioUtils.
|
188
|
+
return value.map(item => _.trim(FormioUtils.dayjsDate(item, format, timezone, options).format(format))).join(', ');
|
187
189
|
}
|
188
|
-
return _.trim(FormioUtils.
|
190
|
+
return _.trim(FormioUtils.dayjsDate(value, format, timezone, options).format(format));
|
189
191
|
}
|
190
192
|
if (Array.isArray(value) && this.component.multiple) {
|
191
|
-
return value.map(item => _.trim(
|
193
|
+
return value.map(item => _.trim(dayjs(item).format(format))).join(', ');
|
192
194
|
}
|
193
|
-
return (value ? _.trim(
|
195
|
+
return (value ? _.trim(dayjs(value).format(format)) : value) || '';
|
194
196
|
}
|
195
197
|
}
|
@@ -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
|
];
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import moment from 'moment';
|
3
3
|
import Field from '../_classes/field/Field';
|
4
|
-
import { boolValue, componentValueTypes, getComponentSavedTypes, getLocaleDateFormatInfo } from '../../utils
|
4
|
+
import { boolValue, componentValueTypes, getComponentSavedTypes, getLocaleDateFormatInfo } from '../../utils';
|
5
5
|
import { getDayFormat } from '@formio/core';
|
6
6
|
export default class DayComponent extends Field {
|
7
7
|
static schema(...extend) {
|
@@ -53,7 +53,7 @@ export default class DayComponent extends Field {
|
|
53
53
|
// Empty value used before 9.3.x
|
54
54
|
static oldEmptyValue = '00/00/0000';
|
55
55
|
constructor(component, options, data) {
|
56
|
-
if (!options.inFormBuilder && !options.building) {
|
56
|
+
if (options && !options.inFormBuilder && !options.building) {
|
57
57
|
if (component.maxDate && component.maxDate.indexOf('moment(') === -1) {
|
58
58
|
component.maxDate = moment(component.maxDate, 'YYYY-MM-DD').toISOString();
|
59
59
|
}
|
@@ -4,7 +4,7 @@ import { editgrid as templates } from '@formio/bootstrap/components';
|
|
4
4
|
import NestedArrayComponent from '../_classes/nestedarray/NestedArrayComponent';
|
5
5
|
import Component from '../_classes/component/Component';
|
6
6
|
import Alert from '../alert/Alert';
|
7
|
-
import { fastCloneDeep, Evaluator, getArrayFromComponentPath, eachComponent } from '../../utils
|
7
|
+
import { fastCloneDeep, Evaluator, getArrayFromComponentPath, eachComponent } from '../../utils';
|
8
8
|
const EditRowState = {
|
9
9
|
New: 'new',
|
10
10
|
Editing: 'editing',
|
@@ -1099,7 +1099,9 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1099
1099
|
errors.push(...this._errors);
|
1100
1100
|
return false;
|
1101
1101
|
}
|
1102
|
-
|
1102
|
+
// TODO: this is the only place invalidMessage gets called, and it's not clear why it's needed - we already validate the editGrid
|
1103
|
+
// component above with super.checkComponentValidity
|
1104
|
+
const message = this.invalid || this.invalidMessage(data, dirty, false, row, options);
|
1103
1105
|
if (allRowErrors.length && this.root?.submitted && !message) {
|
1104
1106
|
this._errors = this.setCustomValidity(message, dirty);
|
1105
1107
|
errors.push(...this._errors);
|
@@ -7,6 +7,18 @@ export default [
|
|
7
7
|
key: 'allowMultipleMasks',
|
8
8
|
ignore: true,
|
9
9
|
},
|
10
|
+
{
|
11
|
+
key: 'inputMasks',
|
12
|
+
ignore: true
|
13
|
+
},
|
14
|
+
{
|
15
|
+
key: 'widget.type',
|
16
|
+
ignore: true
|
17
|
+
},
|
18
|
+
{
|
19
|
+
key: 'widget',
|
20
|
+
ignore: true
|
21
|
+
},
|
10
22
|
{
|
11
23
|
key: 'showWordCount',
|
12
24
|
ignore: true
|