@formio/js 5.0.0-rc.18 → 5.0.0-rc.20
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/formio.builder.css +14 -22
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.embed.css +1 -2
- package/dist/formio.embed.js +2 -2
- package/dist/formio.embed.min.css +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.css +10 -2
- package/dist/formio.form.js +333 -361
- 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 -8
- package/dist/formio.full.css +14 -22
- package/dist/formio.full.js +353 -370
- 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 -8
- package/dist/formio.js +208 -121
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +2 -7
- package/dist/formio.utils.js +220 -13
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -7
- package/lib/cjs/CDN.js +1 -1
- package/lib/cjs/Element.js +7 -2
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/Form.d.ts +8 -5
- package/lib/cjs/Form.js +52 -10
- package/lib/cjs/PDF.d.ts +11 -3
- package/lib/cjs/PDF.js +4 -5
- package/lib/cjs/PDFBuilder.js +2 -3
- package/lib/cjs/Webform.d.ts +4 -7
- package/lib/cjs/Webform.js +40 -119
- package/lib/cjs/WebformBuilder.d.ts +6 -1
- package/lib/cjs/WebformBuilder.js +104 -64
- package/lib/cjs/Wizard.d.ts +8 -5
- package/lib/cjs/Wizard.js +14 -14
- package/lib/cjs/WizardBuilder.d.ts +6 -4
- package/lib/cjs/WizardBuilder.js +20 -3
- package/lib/cjs/addons/FormioAddon.d.ts +1 -1
- package/lib/cjs/addons/FormioAddon.js +1 -2
- package/lib/cjs/components/_classes/component/Component.d.ts +17 -8
- package/lib/cjs/components/_classes/component/Component.js +52 -18
- package/lib/cjs/components/_classes/input/Input.d.ts +1 -1
- package/lib/cjs/components/_classes/input/Input.js +1 -2
- package/lib/cjs/components/_classes/list/ListComponent.d.ts +4 -0
- package/lib/cjs/components/_classes/list/ListComponent.js +43 -6
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -0
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +10 -4
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +5 -2
- package/lib/cjs/components/_classes/nested/NestedComponent.js +11 -12
- package/lib/cjs/components/address/Address.d.ts +8 -0
- package/lib/cjs/components/button/Button.js +2 -3
- package/lib/cjs/components/checkbox/Checkbox.d.ts +13 -0
- package/lib/cjs/components/checkbox/Checkbox.js +17 -5
- package/lib/cjs/components/columns/Columns.d.ts +1 -0
- package/lib/cjs/components/columns/Columns.js +1 -0
- package/lib/cjs/components/container/Container.d.ts +1 -0
- package/lib/cjs/components/container/Container.js +1 -0
- package/lib/cjs/components/content/Content.d.ts +1 -0
- package/lib/cjs/components/content/Content.js +1 -2
- package/lib/cjs/components/currency/editForm/Currency.edit.data.d.ts +14 -2
- package/lib/cjs/components/currency/editForm/Currency.edit.data.js +4 -0
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +4 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -0
- package/lib/cjs/components/datagrid/DataGrid.js +8 -1
- package/lib/cjs/components/datamap/DataMap.js +1 -0
- package/lib/cjs/components/datetime/DateTime.d.ts +4 -0
- package/lib/cjs/components/datetime/DateTime.js +21 -1
- package/lib/cjs/components/day/Day.d.ts +1 -1
- package/lib/cjs/components/day/Day.js +22 -6
- package/lib/cjs/components/day/fixtures/comp3.js +2 -2
- package/lib/cjs/components/editgrid/EditGrid.d.ts +4 -3
- package/lib/cjs/components/editgrid/EditGrid.js +11 -6
- package/lib/cjs/components/editgrid/fixtures/comp-with-custom-default-value.d.ts +190 -0
- package/lib/cjs/components/editgrid/fixtures/comp-with-custom-default-value.js +227 -0
- package/lib/cjs/components/editgrid/fixtures/comp15.d.ts +54 -0
- package/lib/cjs/components/editgrid/fixtures/comp15.js +51 -0
- package/lib/cjs/components/editgrid/fixtures/index.d.ts +3 -1
- package/lib/cjs/components/editgrid/fixtures/index.js +5 -1
- package/lib/cjs/components/fieldset/Fieldset.d.ts +1 -0
- package/lib/cjs/components/fieldset/Fieldset.js +1 -0
- package/lib/cjs/components/file/File.d.ts +7 -5
- package/lib/cjs/components/file/File.js +26 -9
- package/lib/cjs/components/file/editForm/File.edit.file.d.ts +62 -0
- package/lib/cjs/components/file/editForm/File.edit.file.js +29 -2
- package/lib/cjs/components/form/Form.d.ts +3 -0
- package/lib/cjs/components/form/Form.js +9 -10
- package/lib/cjs/components/hidden/Hidden.d.ts +1 -0
- package/lib/cjs/components/hidden/Hidden.js +1 -0
- package/lib/cjs/components/html/HTML.d.ts +1 -0
- package/lib/cjs/components/html/HTML.js +1 -0
- package/lib/cjs/components/number/Number.d.ts +5 -1
- package/lib/cjs/components/number/Number.js +24 -7
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +9 -0
- package/lib/cjs/components/radio/Radio.d.ts +5 -3
- package/lib/cjs/components/radio/Radio.js +59 -18
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.js +4 -5
- package/lib/cjs/components/resource/Resource.d.ts +7 -0
- package/lib/cjs/components/resource/Resource.js +0 -1
- package/lib/cjs/components/resource/editForm/Resource.edit.display.js +1 -1
- package/lib/cjs/components/select/Select.d.ts +7 -5
- package/lib/cjs/components/select/Select.js +15 -49
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +12 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +53 -25
- package/lib/cjs/components/selectboxes/fixtures/comp4.d.ts +30 -27
- package/lib/cjs/components/selectboxes/fixtures/comp4.js +47 -32
- package/lib/cjs/components/selectboxes/fixtures/comp6.d.ts +14 -0
- package/lib/cjs/components/selectboxes/fixtures/comp6.js +15 -0
- package/lib/cjs/components/selectboxes/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/selectboxes/fixtures/index.js +3 -1
- package/lib/cjs/components/signature/Signature.d.ts +1 -1
- package/lib/cjs/components/signature/Signature.js +8 -3
- package/lib/cjs/components/survey/Survey.js +3 -0
- package/lib/cjs/components/table/Table.d.ts +1 -0
- package/lib/cjs/components/table/Table.js +1 -0
- package/lib/cjs/components/tabs/Tabs.d.ts +1 -0
- package/lib/cjs/components/tabs/Tabs.js +1 -0
- package/lib/cjs/components/tags/Tags.js +3 -0
- package/lib/cjs/components/textarea/TextArea.d.ts +3 -2
- package/lib/cjs/components/textarea/TextArea.js +4 -5
- package/lib/cjs/components/textarea/fixtures/comp4.d.ts +30 -0
- package/lib/cjs/components/textarea/fixtures/comp4.js +27 -0
- package/lib/cjs/components/textarea/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/textarea/fixtures/index.js +3 -1
- package/lib/cjs/components/textfield/TextField.d.ts +1 -0
- package/lib/cjs/components/textfield/TextField.js +5 -3
- package/lib/cjs/components/time/Time.d.ts +4 -0
- package/lib/cjs/components/time/Time.js +6 -1
- package/lib/cjs/components/tree/Tree.d.ts +5 -4
- package/lib/cjs/components/tree/Tree.form.js +5 -0
- package/lib/cjs/components/tree/Tree.js +8 -9
- package/lib/cjs/components/tree/editForm/Tree.edit.display.d.ts +9 -0
- package/lib/cjs/components/tree/editForm/Tree.edit.display.js +12 -0
- package/lib/cjs/components/well/Well.d.ts +1 -0
- package/lib/cjs/components/well/Well.js +1 -0
- package/lib/cjs/providers/Providers.d.ts +31 -11
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +2 -2
- package/lib/cjs/providers/address/GoogleAddressProvider.js +2 -3
- package/lib/cjs/providers/processor/fileProcessor.d.ts +1 -1
- package/lib/cjs/providers/processor/fileProcessor.js +1 -5
- package/lib/cjs/providers/storage/azure.d.ts +10 -1
- package/lib/cjs/providers/storage/azure.js +7 -2
- package/lib/cjs/providers/storage/base64.d.ts +2 -2
- package/lib/cjs/providers/storage/base64.js +2 -6
- package/lib/cjs/providers/storage/dropbox.d.ts +2 -2
- package/lib/cjs/providers/storage/dropbox.js +2 -6
- package/lib/cjs/providers/storage/googleDrive.d.ts +3 -2
- package/lib/cjs/providers/storage/googleDrive.js +6 -6
- package/lib/cjs/providers/storage/indexeddb.d.ts +3 -3
- package/lib/cjs/providers/storage/indexeddb.js +9 -13
- package/lib/cjs/providers/storage/s3.d.ts +11 -1
- package/lib/cjs/providers/storage/s3.js +5 -2
- package/lib/cjs/providers/storage/uploadAdapter.js +1 -5
- package/lib/cjs/providers/storage/url.d.ts +2 -2
- package/lib/cjs/providers/storage/url.js +12 -8
- package/lib/cjs/providers/storage/xhr.d.ts +1 -1
- package/lib/cjs/providers/storage/xhr.js +1 -2
- package/lib/cjs/templates/index.d.ts +226 -1
- package/lib/cjs/utils/Evaluator.js +4 -33
- package/lib/cjs/utils/i18n.d.ts +16 -0
- package/lib/cjs/utils/i18n.js +88 -0
- package/lib/cjs/utils/utils.d.ts +1 -1
- package/lib/cjs/utils/utils.js +8 -9
- package/lib/cjs/validator/Validator.d.ts +30 -2
- package/lib/cjs/validator/Validator.js +32 -9
- package/lib/cjs/validator/rules/Select.js +1 -2
- package/lib/cjs/validator/rules/Unique.d.ts +1 -1
- package/lib/cjs/validator/rules/Unique.js +1 -2
- package/lib/cjs/widgets/CalendarWidget.d.ts +1 -0
- package/lib/cjs/widgets/InputWidget.d.ts +1 -1
- package/lib/cjs/widgets/InputWidget.js +1 -2
- package/lib/mjs/CDN.js +1 -1
- package/lib/mjs/Element.js +6 -2
- package/lib/mjs/Embed.js +4 -1
- package/lib/mjs/Form.d.ts +8 -5
- package/lib/mjs/Form.js +52 -10
- package/lib/mjs/PDF.d.ts +11 -3
- package/lib/mjs/PDF.js +4 -5
- package/lib/mjs/PDFBuilder.js +2 -3
- package/lib/mjs/Webform.d.ts +4 -7
- package/lib/mjs/Webform.js +40 -122
- package/lib/mjs/WebformBuilder.d.ts +6 -1
- package/lib/mjs/WebformBuilder.js +102 -64
- package/lib/mjs/Wizard.d.ts +8 -5
- package/lib/mjs/Wizard.js +14 -14
- package/lib/mjs/WizardBuilder.d.ts +6 -4
- package/lib/mjs/WizardBuilder.js +20 -3
- package/lib/mjs/addons/FormioAddon.d.ts +1 -1
- package/lib/mjs/addons/FormioAddon.js +1 -2
- package/lib/mjs/components/_classes/component/Component.d.ts +17 -8
- package/lib/mjs/components/_classes/component/Component.js +52 -18
- package/lib/mjs/components/_classes/input/Input.d.ts +1 -1
- package/lib/mjs/components/_classes/input/Input.js +1 -2
- package/lib/mjs/components/_classes/list/ListComponent.d.ts +4 -0
- package/lib/mjs/components/_classes/list/ListComponent.js +43 -5
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -0
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +10 -4
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +5 -2
- package/lib/mjs/components/_classes/nested/NestedComponent.js +11 -12
- package/lib/mjs/components/address/Address.d.ts +8 -0
- package/lib/mjs/components/button/Button.js +2 -3
- package/lib/mjs/components/checkbox/Checkbox.d.ts +13 -0
- package/lib/mjs/components/checkbox/Checkbox.js +21 -5
- package/lib/mjs/components/columns/Columns.d.ts +1 -0
- package/lib/mjs/components/columns/Columns.js +1 -0
- package/lib/mjs/components/container/Container.d.ts +1 -0
- package/lib/mjs/components/container/Container.js +1 -0
- package/lib/mjs/components/content/Content.d.ts +1 -0
- package/lib/mjs/components/content/Content.js +1 -2
- package/lib/mjs/components/currency/editForm/Currency.edit.data.d.ts +14 -2
- package/lib/mjs/components/currency/editForm/Currency.edit.data.js +4 -0
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +4 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -0
- package/lib/mjs/components/datagrid/DataGrid.js +8 -1
- package/lib/mjs/components/datamap/DataMap.js +1 -0
- package/lib/mjs/components/datetime/DateTime.d.ts +4 -0
- package/lib/mjs/components/datetime/DateTime.js +28 -1
- package/lib/mjs/components/day/Day.d.ts +1 -1
- package/lib/mjs/components/day/Day.js +25 -6
- package/lib/mjs/components/day/fixtures/comp3.js +2 -2
- package/lib/mjs/components/editgrid/EditGrid.d.ts +4 -3
- package/lib/mjs/components/editgrid/EditGrid.js +11 -6
- package/lib/mjs/components/editgrid/fixtures/comp-with-custom-default-value.d.ts +190 -0
- package/lib/mjs/components/editgrid/fixtures/comp-with-custom-default-value.js +225 -0
- package/lib/mjs/components/editgrid/fixtures/comp15.d.ts +54 -0
- package/lib/mjs/components/editgrid/fixtures/comp15.js +49 -0
- package/lib/mjs/components/editgrid/fixtures/index.d.ts +3 -1
- package/lib/mjs/components/editgrid/fixtures/index.js +3 -1
- package/lib/mjs/components/fieldset/Fieldset.d.ts +1 -0
- package/lib/mjs/components/fieldset/Fieldset.js +1 -0
- package/lib/mjs/components/file/File.d.ts +7 -5
- package/lib/mjs/components/file/File.js +29 -9
- package/lib/mjs/components/file/editForm/File.edit.file.d.ts +62 -0
- package/lib/mjs/components/file/editForm/File.edit.file.js +29 -2
- package/lib/mjs/components/form/Form.d.ts +3 -0
- package/lib/mjs/components/form/Form.js +9 -10
- package/lib/mjs/components/hidden/Hidden.d.ts +1 -0
- package/lib/mjs/components/hidden/Hidden.js +1 -0
- package/lib/mjs/components/html/HTML.d.ts +1 -0
- package/lib/mjs/components/html/HTML.js +1 -0
- package/lib/mjs/components/number/Number.d.ts +5 -1
- package/lib/mjs/components/number/Number.js +24 -7
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +9 -0
- package/lib/mjs/components/radio/Radio.d.ts +5 -3
- package/lib/mjs/components/radio/Radio.js +59 -18
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.js +4 -5
- package/lib/mjs/components/resource/Resource.d.ts +7 -0
- package/lib/mjs/components/resource/Resource.js +0 -1
- package/lib/mjs/components/resource/editForm/Resource.edit.display.js +1 -1
- package/lib/mjs/components/select/Select.d.ts +7 -5
- package/lib/mjs/components/select/Select.js +18 -49
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +12 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +56 -25
- package/lib/mjs/components/selectboxes/fixtures/comp4.d.ts +30 -27
- package/lib/mjs/components/selectboxes/fixtures/comp4.js +47 -32
- package/lib/mjs/components/selectboxes/fixtures/comp6.d.ts +14 -0
- package/lib/mjs/components/selectboxes/fixtures/comp6.js +13 -0
- package/lib/mjs/components/selectboxes/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/selectboxes/fixtures/index.js +2 -1
- package/lib/mjs/components/signature/Signature.d.ts +1 -1
- package/lib/mjs/components/signature/Signature.js +11 -3
- package/lib/mjs/components/survey/Survey.js +6 -0
- package/lib/mjs/components/table/Table.d.ts +1 -0
- package/lib/mjs/components/table/Table.js +1 -0
- package/lib/mjs/components/tabs/Tabs.d.ts +1 -0
- package/lib/mjs/components/tabs/Tabs.js +1 -0
- package/lib/mjs/components/tags/Tags.js +6 -0
- package/lib/mjs/components/textarea/TextArea.d.ts +3 -2
- package/lib/mjs/components/textarea/TextArea.js +4 -5
- package/lib/mjs/components/textarea/fixtures/comp4.d.ts +30 -0
- package/lib/mjs/components/textarea/fixtures/comp4.js +25 -0
- package/lib/mjs/components/textarea/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/textarea/fixtures/index.js +2 -1
- package/lib/mjs/components/textfield/TextField.d.ts +1 -0
- package/lib/mjs/components/textfield/TextField.js +8 -3
- package/lib/mjs/components/time/Time.d.ts +4 -0
- package/lib/mjs/components/time/Time.js +12 -1
- package/lib/mjs/components/tree/Tree.d.ts +5 -4
- package/lib/mjs/components/tree/Tree.form.js +5 -0
- package/lib/mjs/components/tree/Tree.js +8 -9
- package/lib/mjs/components/tree/editForm/Tree.edit.display.d.ts +9 -0
- package/lib/mjs/components/tree/editForm/Tree.edit.display.js +10 -0
- package/lib/mjs/components/well/Well.d.ts +1 -0
- package/lib/mjs/components/well/Well.js +1 -0
- package/lib/mjs/providers/Providers.d.ts +31 -11
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +2 -2
- package/lib/mjs/providers/address/GoogleAddressProvider.js +2 -3
- package/lib/mjs/providers/processor/fileProcessor.d.ts +1 -1
- package/lib/mjs/providers/processor/fileProcessor.js +1 -2
- package/lib/mjs/providers/storage/azure.d.ts +10 -1
- package/lib/mjs/providers/storage/azure.js +7 -2
- package/lib/mjs/providers/storage/base64.d.ts +2 -2
- package/lib/mjs/providers/storage/base64.js +2 -3
- package/lib/mjs/providers/storage/dropbox.d.ts +2 -2
- package/lib/mjs/providers/storage/dropbox.js +2 -3
- package/lib/mjs/providers/storage/googleDrive.d.ts +3 -2
- package/lib/mjs/providers/storage/googleDrive.js +6 -3
- package/lib/mjs/providers/storage/indexeddb.d.ts +3 -3
- package/lib/mjs/providers/storage/indexeddb.js +9 -10
- package/lib/mjs/providers/storage/s3.d.ts +11 -1
- package/lib/mjs/providers/storage/s3.js +5 -2
- package/lib/mjs/providers/storage/uploadAdapter.js +1 -2
- package/lib/mjs/providers/storage/url.d.ts +2 -2
- package/lib/mjs/providers/storage/url.js +12 -5
- package/lib/mjs/providers/storage/xhr.d.ts +1 -1
- package/lib/mjs/providers/storage/xhr.js +1 -2
- package/lib/mjs/templates/index.d.ts +226 -1
- package/lib/mjs/utils/Evaluator.js +4 -33
- package/lib/mjs/utils/i18n.d.ts +16 -0
- package/lib/mjs/utils/i18n.js +81 -0
- package/lib/mjs/utils/utils.d.ts +1 -1
- package/lib/mjs/utils/utils.js +8 -9
- package/lib/mjs/validator/Validator.d.ts +30 -2
- package/lib/mjs/validator/Validator.js +31 -9
- package/lib/mjs/validator/rules/Select.js +1 -2
- package/lib/mjs/validator/rules/Unique.d.ts +1 -1
- package/lib/mjs/validator/rules/Unique.js +1 -2
- package/lib/mjs/widgets/CalendarWidget.d.ts +1 -0
- package/lib/mjs/widgets/InputWidget.d.ts +1 -1
- package/lib/mjs/widgets/InputWidget.js +1 -2
- package/package.json +24 -25
@@ -2,11 +2,10 @@ import Field from '../_classes/field/Field';
|
|
2
2
|
import { uniqueName } from '../../utils/utils';
|
3
3
|
import download from 'downloadjs';
|
4
4
|
import _ from 'lodash';
|
5
|
-
import NativePromise from 'native-promise-only';
|
6
5
|
import fileProcessor from '../../providers/processor/fileProcessor';
|
7
6
|
import BMF from 'browser-md5-file';
|
8
7
|
let Camera;
|
9
|
-
let webViewCamera = navigator.camera
|
8
|
+
let webViewCamera = 'undefined' !== typeof window ? navigator.camera : Camera;
|
10
9
|
// canvas.toBlob polyfill.
|
11
10
|
let htmlCanvasElement;
|
12
11
|
if (typeof window !== 'undefined') {
|
@@ -54,6 +53,12 @@ export default class FileComponent extends Field {
|
|
54
53
|
schema: FileComponent.schema(),
|
55
54
|
};
|
56
55
|
}
|
56
|
+
static get serverConditionSettings() {
|
57
|
+
return {
|
58
|
+
...super.serverConditionSettings,
|
59
|
+
operators: ['isEmpty', 'isNotEmpty'],
|
60
|
+
};
|
61
|
+
}
|
57
62
|
init() {
|
58
63
|
super.init();
|
59
64
|
webViewCamera = navigator.camera || Camera;
|
@@ -71,7 +76,7 @@ export default class FileComponent extends Field {
|
|
71
76
|
this.fileDropHidden = false;
|
72
77
|
}
|
73
78
|
get dataReady() {
|
74
|
-
return this.filesReady ||
|
79
|
+
return this.filesReady || Promise.resolve();
|
75
80
|
}
|
76
81
|
get defaultSchema() {
|
77
82
|
return FileComponent.schema();
|
@@ -138,7 +143,7 @@ export default class FileComponent extends Field {
|
|
138
143
|
videoStream.getVideoTracks().forEach((track) => track.stop());
|
139
144
|
}
|
140
145
|
getFrame(videoPlayer) {
|
141
|
-
return new
|
146
|
+
return new Promise((resolve) => {
|
142
147
|
const canvas = document.createElement('canvas');
|
143
148
|
canvas.height = videoPlayer.videoHeight;
|
144
149
|
canvas.width = videoPlayer.videoWidth;
|
@@ -192,7 +197,7 @@ export default class FileComponent extends Field {
|
|
192
197
|
});
|
193
198
|
}
|
194
199
|
browseFiles(attrs = {}) {
|
195
|
-
return new
|
200
|
+
return new Promise((resolve) => {
|
196
201
|
const fileInput = this.ce('input', {
|
197
202
|
type: 'file',
|
198
203
|
style: 'height: 0; width: 0; visibility: hidden;',
|
@@ -237,9 +242,12 @@ export default class FileComponent extends Field {
|
|
237
242
|
if (this.component.multiple) {
|
238
243
|
options.multiple = true;
|
239
244
|
}
|
245
|
+
if (this.component.capture) {
|
246
|
+
options.capture = this.component.capture;
|
247
|
+
}
|
240
248
|
//use "accept" attribute only for desktop devices because of its limited support by mobile browsers
|
249
|
+
const filePattern = this.component.filePattern.trim() || '';
|
241
250
|
if (!this.isMobile.any) {
|
242
|
-
const filePattern = this.component.filePattern.trim() || '';
|
243
251
|
const imagesPattern = 'image/*';
|
244
252
|
if (this.imageUpload && (!filePattern || filePattern === '*')) {
|
245
253
|
options.accept = imagesPattern;
|
@@ -251,11 +259,23 @@ export default class FileComponent extends Field {
|
|
251
259
|
options.accept = filePattern;
|
252
260
|
}
|
253
261
|
}
|
262
|
+
// if input capture is set, we need the "accept" attribute to determine which device to launch
|
263
|
+
else if (this.component.capture) {
|
264
|
+
if (filePattern.includes('video')) {
|
265
|
+
options.accept = 'video/*';
|
266
|
+
}
|
267
|
+
else if (filePattern.includes('audio')) {
|
268
|
+
options.accept = 'audio/*';
|
269
|
+
}
|
270
|
+
else {
|
271
|
+
options.accept = 'image/*';
|
272
|
+
}
|
273
|
+
}
|
254
274
|
return options;
|
255
275
|
}
|
256
276
|
deleteFile(fileInfo) {
|
257
277
|
const { options = {} } = this.component;
|
258
|
-
if (fileInfo && (['url', 'indexeddb'].includes(this.component.storage))) {
|
278
|
+
if (fileInfo && (['url', 'indexeddb', 's3', 'googledrive', 'azure'].includes(this.component.storage))) {
|
259
279
|
const { fileService } = this;
|
260
280
|
if (fileService && typeof fileService.deleteFile === 'function') {
|
261
281
|
fileService.deleteFile(fileInfo, options);
|
@@ -412,7 +432,7 @@ export default class FileComponent extends Field {
|
|
412
432
|
const fileService = this.fileService;
|
413
433
|
if (fileService) {
|
414
434
|
const loadingImages = [];
|
415
|
-
this.filesReady = new
|
435
|
+
this.filesReady = new Promise((resolve, reject) => {
|
416
436
|
this.filesReadyResolve = resolve;
|
417
437
|
this.filesReadyReject = reject;
|
418
438
|
});
|
@@ -420,7 +440,7 @@ export default class FileComponent extends Field {
|
|
420
440
|
loadingImages.push(this.loadImage(this.dataValue[index]).then((url) => (image.src = url)));
|
421
441
|
});
|
422
442
|
if (loadingImages.length) {
|
423
|
-
|
443
|
+
Promise.all(loadingImages).then(() => {
|
424
444
|
this.filesReadyResolve();
|
425
445
|
}).catch(() => this.filesReadyReject());
|
426
446
|
}
|
@@ -14,6 +14,10 @@ declare const _default: ({
|
|
14
14
|
conditional?: undefined;
|
15
15
|
rows?: undefined;
|
16
16
|
editor?: undefined;
|
17
|
+
optionsLabelPosition?: undefined;
|
18
|
+
inline?: undefined;
|
19
|
+
defaultValue?: undefined;
|
20
|
+
values?: undefined;
|
17
21
|
components?: undefined;
|
18
22
|
} | {
|
19
23
|
type: string;
|
@@ -38,6 +42,10 @@ declare const _default: ({
|
|
38
42
|
data?: undefined;
|
39
43
|
rows?: undefined;
|
40
44
|
editor?: undefined;
|
45
|
+
optionsLabelPosition?: undefined;
|
46
|
+
inline?: undefined;
|
47
|
+
defaultValue?: undefined;
|
48
|
+
values?: undefined;
|
41
49
|
components?: undefined;
|
42
50
|
} | {
|
43
51
|
type: string;
|
@@ -62,6 +70,10 @@ declare const _default: ({
|
|
62
70
|
data?: undefined;
|
63
71
|
rows?: undefined;
|
64
72
|
editor?: undefined;
|
73
|
+
optionsLabelPosition?: undefined;
|
74
|
+
inline?: undefined;
|
75
|
+
defaultValue?: undefined;
|
76
|
+
values?: undefined;
|
65
77
|
components?: undefined;
|
66
78
|
} | {
|
67
79
|
type: string;
|
@@ -86,6 +98,10 @@ declare const _default: ({
|
|
86
98
|
valueProperty?: undefined;
|
87
99
|
dataSrc?: undefined;
|
88
100
|
data?: undefined;
|
101
|
+
optionsLabelPosition?: undefined;
|
102
|
+
inline?: undefined;
|
103
|
+
defaultValue?: undefined;
|
104
|
+
values?: undefined;
|
89
105
|
components?: undefined;
|
90
106
|
} | {
|
91
107
|
type: string;
|
@@ -110,6 +126,10 @@ declare const _default: ({
|
|
110
126
|
data?: undefined;
|
111
127
|
rows?: undefined;
|
112
128
|
editor?: undefined;
|
129
|
+
optionsLabelPosition?: undefined;
|
130
|
+
inline?: undefined;
|
131
|
+
defaultValue?: undefined;
|
132
|
+
values?: undefined;
|
113
133
|
components?: undefined;
|
114
134
|
} | {
|
115
135
|
type: string;
|
@@ -125,6 +145,10 @@ declare const _default: ({
|
|
125
145
|
conditional?: undefined;
|
126
146
|
rows?: undefined;
|
127
147
|
editor?: undefined;
|
148
|
+
optionsLabelPosition?: undefined;
|
149
|
+
inline?: undefined;
|
150
|
+
defaultValue?: undefined;
|
151
|
+
values?: undefined;
|
128
152
|
components?: undefined;
|
129
153
|
} | {
|
130
154
|
type: string;
|
@@ -140,6 +164,10 @@ declare const _default: ({
|
|
140
164
|
conditional?: undefined;
|
141
165
|
rows?: undefined;
|
142
166
|
editor?: undefined;
|
167
|
+
optionsLabelPosition?: undefined;
|
168
|
+
inline?: undefined;
|
169
|
+
defaultValue?: undefined;
|
170
|
+
values?: undefined;
|
143
171
|
components?: undefined;
|
144
172
|
} | {
|
145
173
|
type: string;
|
@@ -164,6 +192,10 @@ declare const _default: ({
|
|
164
192
|
data?: undefined;
|
165
193
|
rows?: undefined;
|
166
194
|
editor?: undefined;
|
195
|
+
optionsLabelPosition?: undefined;
|
196
|
+
inline?: undefined;
|
197
|
+
defaultValue?: undefined;
|
198
|
+
values?: undefined;
|
167
199
|
components?: undefined;
|
168
200
|
} | {
|
169
201
|
type: string;
|
@@ -188,6 +220,32 @@ declare const _default: ({
|
|
188
220
|
data?: undefined;
|
189
221
|
rows?: undefined;
|
190
222
|
editor?: undefined;
|
223
|
+
optionsLabelPosition?: undefined;
|
224
|
+
inline?: undefined;
|
225
|
+
defaultValue?: undefined;
|
226
|
+
values?: undefined;
|
227
|
+
components?: undefined;
|
228
|
+
} | {
|
229
|
+
type: string;
|
230
|
+
input: boolean;
|
231
|
+
key: string;
|
232
|
+
label: string;
|
233
|
+
tooltip: string;
|
234
|
+
optionsLabelPosition: string;
|
235
|
+
inline: boolean;
|
236
|
+
defaultValue: boolean;
|
237
|
+
values: {
|
238
|
+
label: string;
|
239
|
+
value: string;
|
240
|
+
}[];
|
241
|
+
placeholder?: undefined;
|
242
|
+
weight?: undefined;
|
243
|
+
valueProperty?: undefined;
|
244
|
+
dataSrc?: undefined;
|
245
|
+
data?: undefined;
|
246
|
+
conditional?: undefined;
|
247
|
+
rows?: undefined;
|
248
|
+
editor?: undefined;
|
191
249
|
components?: undefined;
|
192
250
|
} | {
|
193
251
|
type: string;
|
@@ -209,5 +267,9 @@ declare const _default: ({
|
|
209
267
|
conditional?: undefined;
|
210
268
|
rows?: undefined;
|
211
269
|
editor?: undefined;
|
270
|
+
optionsLabelPosition?: undefined;
|
271
|
+
inline?: undefined;
|
272
|
+
defaultValue?: undefined;
|
273
|
+
values?: undefined;
|
212
274
|
})[];
|
213
275
|
export default _default;
|
@@ -78,8 +78,11 @@ export default [
|
|
78
78
|
input: true,
|
79
79
|
weight: 15,
|
80
80
|
placeholder: `{
|
81
|
-
|
82
|
-
|
81
|
+
"withCredentials": true,
|
82
|
+
"headers": {
|
83
|
+
"Authorization": "Basic <key>"
|
84
|
+
}
|
85
|
+
}`,
|
83
86
|
conditional: {
|
84
87
|
json: {
|
85
88
|
'===': [{
|
@@ -204,6 +207,30 @@ export default [
|
|
204
207
|
json: { '==': [{ var: 'data.webcam' }, true] }
|
205
208
|
}
|
206
209
|
},
|
210
|
+
{
|
211
|
+
type: 'radio',
|
212
|
+
input: true,
|
213
|
+
key: 'capture',
|
214
|
+
label: 'Enable device capture',
|
215
|
+
tooltip: 'This will allow a mobile device to open the camera or microphone directly in capture mode.',
|
216
|
+
optionsLabelPosition: 'right',
|
217
|
+
inline: true,
|
218
|
+
defaultValue: false,
|
219
|
+
values: [
|
220
|
+
{
|
221
|
+
label: 'Disabled',
|
222
|
+
value: 'false'
|
223
|
+
},
|
224
|
+
{
|
225
|
+
label: 'Environment (rear camera)',
|
226
|
+
value: 'environment'
|
227
|
+
},
|
228
|
+
{
|
229
|
+
label: 'User (front camera)',
|
230
|
+
value: 'user'
|
231
|
+
}
|
232
|
+
]
|
233
|
+
},
|
207
234
|
{
|
208
235
|
type: 'datagrid',
|
209
236
|
input: true,
|
@@ -12,9 +12,11 @@ export default class FormComponent extends Component {
|
|
12
12
|
valueChanged: boolean | undefined;
|
13
13
|
subForm: any;
|
14
14
|
formSrc: any;
|
15
|
+
get dataReady(): any;
|
15
16
|
get emptyValue(): {
|
16
17
|
data: {};
|
17
18
|
};
|
19
|
+
get ready(): any;
|
18
20
|
get useOriginalRevision(): any;
|
19
21
|
setFormRevision(rev: any): void;
|
20
22
|
subFormRevision: any;
|
@@ -26,6 +28,7 @@ export default class FormComponent extends Component {
|
|
26
28
|
* Prints out the value of form components as a datagrid value.
|
27
29
|
*/
|
28
30
|
getValueAsString(value: any): any;
|
31
|
+
attach(element: any): Promise<any>;
|
29
32
|
get hasLoadedForm(): any;
|
30
33
|
get isRevisionChanged(): any;
|
31
34
|
subFormReady: any;
|
@@ -2,7 +2,6 @@ import _ from 'lodash';
|
|
2
2
|
import Component from '../_classes/component/Component';
|
3
3
|
import ComponentModal from '../_classes/componentModal/ComponentModal';
|
4
4
|
import EventEmitter from 'eventemitter3';
|
5
|
-
import NativePromise from 'native-promise-only';
|
6
5
|
import { isMongoId, eachComponent, getStringFromComponentPath, getArrayFromComponentPath } from '../../utils/utils';
|
7
6
|
import { Formio } from '../../Formio';
|
8
7
|
import Form from '../../Form';
|
@@ -94,7 +93,7 @@ export default class FormComponent extends Component {
|
|
94
93
|
return this.createSubForm();
|
95
94
|
}
|
96
95
|
get dataReady() {
|
97
|
-
return this.subFormReady ||
|
96
|
+
return this.subFormReady || Promise.resolve();
|
98
97
|
}
|
99
98
|
get defaultValue() {
|
100
99
|
// Not not provide a default value unless the subform is ready so that it will initialize correctly.
|
@@ -107,7 +106,7 @@ export default class FormComponent extends Component {
|
|
107
106
|
return { data: {} };
|
108
107
|
}
|
109
108
|
get ready() {
|
110
|
-
return this.subFormReady ||
|
109
|
+
return this.subFormReady || Promise.resolve();
|
111
110
|
}
|
112
111
|
get useOriginalRevision() {
|
113
112
|
return this.component?.useOriginalRevision && !!this.formObj?.revisions;
|
@@ -381,14 +380,14 @@ export default class FormComponent extends Component {
|
|
381
380
|
*/
|
382
381
|
loadSubForm(fromAttach) {
|
383
382
|
if (this.builderMode || this.isHidden() || (this.isSubFormLazyLoad() && !fromAttach)) {
|
384
|
-
return
|
383
|
+
return Promise.resolve();
|
385
384
|
}
|
386
|
-
if (this.hasLoadedForm && !this.isRevisionChanged
|
385
|
+
if (this.hasLoadedForm && !this.isRevisionChanged) {
|
387
386
|
// Pass config down to sub forms.
|
388
387
|
if (this.root && this.root.form && this.root.form.config && !this.formObj.config) {
|
389
388
|
this.formObj.config = this.root.form.config;
|
390
389
|
}
|
391
|
-
return
|
390
|
+
return Promise.resolve(this.formObj);
|
392
391
|
}
|
393
392
|
else if (this.formSrc) {
|
394
393
|
this.subFormLoading = true;
|
@@ -403,7 +402,7 @@ export default class FormComponent extends Component {
|
|
403
402
|
return null;
|
404
403
|
});
|
405
404
|
}
|
406
|
-
return
|
405
|
+
return Promise.resolve();
|
407
406
|
}
|
408
407
|
get subFormData() {
|
409
408
|
return this.dataValue?.data || {};
|
@@ -465,7 +464,7 @@ export default class FormComponent extends Component {
|
|
465
464
|
return this.subForm.getSubmission();
|
466
465
|
}
|
467
466
|
else {
|
468
|
-
return
|
467
|
+
return Promise.resolve(this.dataValue);
|
469
468
|
}
|
470
469
|
}
|
471
470
|
/**
|
@@ -490,7 +489,7 @@ export default class FormComponent extends Component {
|
|
490
489
|
this.subForm.showAllErrors = true;
|
491
490
|
if (rejectOnError) {
|
492
491
|
this.subForm.onSubmissionError(err);
|
493
|
-
return
|
492
|
+
return Promise.reject(err);
|
494
493
|
}
|
495
494
|
else {
|
496
495
|
return {};
|
@@ -519,7 +518,7 @@ export default class FormComponent extends Component {
|
|
519
518
|
// This submission has already been submitted, so just return the reference data.
|
520
519
|
if (isAlreadySubmitted && !this.subForm?.wizard) {
|
521
520
|
this.dataValue = submission;
|
522
|
-
return
|
521
|
+
return Promise.resolve(this.dataValue);
|
523
522
|
}
|
524
523
|
return this.submitSubForm(false)
|
525
524
|
.then(() => {
|
@@ -7,11 +7,15 @@ export default class NumberComponent extends Input {
|
|
7
7
|
weight: number;
|
8
8
|
schema: any;
|
9
9
|
};
|
10
|
+
static get serverConditionSettings(): {
|
11
|
+
operators: string[];
|
12
|
+
valueComponent(classComp: any): any;
|
13
|
+
};
|
10
14
|
constructor(...args: any[]);
|
11
15
|
validators: string[];
|
12
|
-
decimalSeparator: any;
|
13
16
|
delimiter: any;
|
14
17
|
decimalLimit: any;
|
18
|
+
decimalSeparator: any;
|
15
19
|
numberMask: any;
|
16
20
|
/**
|
17
21
|
* Creates the number mask for normal numbers.
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { maskInput, conformToMask } from '@formio/vanilla-text-mask';
|
2
|
-
import _ from 'lodash';
|
3
1
|
import { createNumberMask } from '@formio/text-mask-addons';
|
2
|
+
import { conformToMask, maskInput } from '@formio/vanilla-text-mask';
|
3
|
+
import _ from 'lodash';
|
4
|
+
import { getNumberDecimalLimit, getNumberSeparators } from '../../utils/utils';
|
4
5
|
import Input from '../_classes/input/Input';
|
5
|
-
import { getNumberSeparators, getNumberDecimalLimit } from '../../utils/utils';
|
6
6
|
export default class NumberComponent extends Input {
|
7
7
|
static schema(...extend) {
|
8
8
|
return Input.schema({
|
@@ -27,13 +27,28 @@ export default class NumberComponent extends Input {
|
|
27
27
|
schema: NumberComponent.schema()
|
28
28
|
};
|
29
29
|
}
|
30
|
+
static get serverConditionSettings() {
|
31
|
+
return {
|
32
|
+
operators: [
|
33
|
+
'isEqual',
|
34
|
+
'isNotEqual',
|
35
|
+
'isEmpty',
|
36
|
+
'isNotEmpty',
|
37
|
+
'greaterThan',
|
38
|
+
'greaterThanOrEqual',
|
39
|
+
'lessThan',
|
40
|
+
'lessThanOrEqual',
|
41
|
+
],
|
42
|
+
valueComponent(classComp) {
|
43
|
+
return { ...classComp, type: 'number' };
|
44
|
+
},
|
45
|
+
};
|
46
|
+
}
|
30
47
|
constructor(...args) {
|
31
48
|
super(...args);
|
32
49
|
this.validators = this.validators.concat(['min', 'max']);
|
33
50
|
const separators = getNumberSeparators(this.options.language || navigator.language);
|
34
|
-
|
35
|
-
|| this.options.properties?.decimalSeparator
|
36
|
-
|| separators.decimalSeparator;
|
51
|
+
const requireDecimal = _.get(this.component, 'requireDecimal', false);
|
37
52
|
if (this.component.delimiter) {
|
38
53
|
if (this.options.hasOwnProperty('thousandsSeparator')) {
|
39
54
|
console.warn("Property 'thousandsSeparator' is deprecated. Please use i18n to specify delimiter.");
|
@@ -43,8 +58,10 @@ export default class NumberComponent extends Input {
|
|
43
58
|
else {
|
44
59
|
this.delimiter = '';
|
45
60
|
}
|
46
|
-
const requireDecimal = _.get(this.component, 'requireDecimal', false);
|
47
61
|
this.decimalLimit = getNumberDecimalLimit(this.component, requireDecimal ? 2 : 20);
|
62
|
+
this.decimalSeparator = this.decimalLimit !== 0 ?
|
63
|
+
this.options.decimalSeparator || this.options.properties?.decimalSeparator || separators.decimalSeparator :
|
64
|
+
'';
|
48
65
|
// Currencies to override BrowserLanguage Config. Object key {}
|
49
66
|
if (_.has(this.options, `languageOverride.${this.options.language}`)) {
|
50
67
|
const override = _.get(this.options, `languageOverride.${this.options.language}`);
|
@@ -23,11 +23,12 @@ export default class RadioComponent extends ListComponent {
|
|
23
23
|
get emptyValue(): string;
|
24
24
|
get isRadio(): boolean;
|
25
25
|
get optionSelectedClass(): string;
|
26
|
+
get listData(): any;
|
26
27
|
templateData: {} | undefined;
|
27
28
|
triggerUpdate: ((...args: any[]) => any) | undefined;
|
28
|
-
itemsLoaded: any;
|
29
|
-
itemsLoadedResolve: any;
|
30
|
-
|
29
|
+
itemsLoaded: Promise<any> | undefined;
|
30
|
+
itemsLoadedResolve: ((value: any) => void) | undefined;
|
31
|
+
optionsLoaded: boolean | undefined;
|
31
32
|
loadedOptions: any[] | undefined;
|
32
33
|
render(): any;
|
33
34
|
detach(element: any): void;
|
@@ -36,6 +37,7 @@ export default class RadioComponent extends ListComponent {
|
|
36
37
|
getValueAsString(value: any): any;
|
37
38
|
setValueAt(index: any, value: any): void;
|
38
39
|
loadItems(url: any, search: any, headers: any, options: any, method: any, body: any): void;
|
40
|
+
loadItemsFromMetadata(): void;
|
39
41
|
setItems(items: any): void;
|
40
42
|
setSelectedClasses(): void;
|
41
43
|
updateValue(value: any, flags: any): boolean;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import ListComponent from '../_classes/list/ListComponent';
|
3
|
-
import NativePromise from 'native-promise-only';
|
4
3
|
import { Formio } from '../../Formio';
|
5
4
|
import { boolValue } from '../../utils/utils';
|
6
5
|
export default class RadioComponent extends ListComponent {
|
@@ -58,6 +57,10 @@ export default class RadioComponent extends ListComponent {
|
|
58
57
|
get optionSelectedClass() {
|
59
58
|
return 'radio-selected';
|
60
59
|
}
|
60
|
+
get listData() {
|
61
|
+
const listData = _.get(this.root, 'submission.metadata.listData', {});
|
62
|
+
return _.get(listData, this.path);
|
63
|
+
}
|
61
64
|
init() {
|
62
65
|
super.init();
|
63
66
|
this.templateData = {};
|
@@ -73,7 +76,7 @@ export default class RadioComponent extends ListComponent {
|
|
73
76
|
if (typeof this.itemsLoadedResolve === 'function') {
|
74
77
|
this.itemsLoadedResolve();
|
75
78
|
}
|
76
|
-
this.itemsLoaded = new
|
79
|
+
this.itemsLoaded = new Promise((resolve) => {
|
77
80
|
this.itemsLoadedResolve = resolve;
|
78
81
|
});
|
79
82
|
if (args.length) {
|
@@ -81,11 +84,13 @@ export default class RadioComponent extends ListComponent {
|
|
81
84
|
}
|
82
85
|
return triggerUpdate(...updateArgs);
|
83
86
|
};
|
84
|
-
this.itemsLoaded = new
|
87
|
+
this.itemsLoaded = new Promise((resolve) => {
|
85
88
|
this.itemsLoadedResolve = resolve;
|
86
89
|
});
|
87
|
-
this.
|
90
|
+
this.optionsLoaded = false;
|
88
91
|
this.loadedOptions = [];
|
92
|
+
// Get the template keys for this radio component.
|
93
|
+
this.getTemplateKeys();
|
89
94
|
}
|
90
95
|
render() {
|
91
96
|
return super.render(this.renderTemplate('radio', {
|
@@ -185,6 +190,13 @@ export default class RadioComponent extends ListComponent {
|
|
185
190
|
}
|
186
191
|
}
|
187
192
|
loadItems(url, search, headers, options, method, body) {
|
193
|
+
if (this.optionsLoaded) {
|
194
|
+
return;
|
195
|
+
}
|
196
|
+
if (!this.shouldLoad) {
|
197
|
+
this.loadItemsFromMetadata();
|
198
|
+
return;
|
199
|
+
}
|
188
200
|
// Ensure we have a method and remove any body if method is get
|
189
201
|
method = method || 'GET';
|
190
202
|
if (method.toUpperCase() === 'GET') {
|
@@ -194,33 +206,55 @@ export default class RadioComponent extends ListComponent {
|
|
194
206
|
options.ignoreCache = this.component.ignoreCache;
|
195
207
|
// Make the request.
|
196
208
|
options.header = headers;
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
209
|
+
this.loading = true;
|
210
|
+
Formio.makeRequest(this.options.formio, 'select', url, method, body, options)
|
211
|
+
.then((response) => {
|
212
|
+
this.loading = false;
|
213
|
+
this.error = null;
|
214
|
+
this.setItems(response);
|
215
|
+
this.optionsLoaded = true;
|
216
|
+
this.redraw();
|
217
|
+
})
|
218
|
+
.catch((err) => {
|
219
|
+
this.handleLoadingError(err);
|
220
|
+
});
|
221
|
+
}
|
222
|
+
loadItemsFromMetadata() {
|
223
|
+
this.listData.forEach((item, i) => {
|
224
|
+
this.loadedOptions[i] = {
|
225
|
+
label: this.itemTemplate(item)
|
226
|
+
};
|
227
|
+
if (_.isEqual(item, this.selectData)) {
|
228
|
+
this.loadedOptions[i].value = this.dataValue;
|
229
|
+
}
|
230
|
+
});
|
231
|
+
this.optionsLoaded = true;
|
232
|
+
this.redraw();
|
211
233
|
}
|
212
234
|
setItems(items) {
|
235
|
+
const listData = [];
|
213
236
|
items?.forEach((item, i) => {
|
214
237
|
this.loadedOptions[i] = {
|
215
238
|
value: item[this.component.valueProperty],
|
216
239
|
label: this.itemTemplate(item, item[this.component.valueProperty])
|
217
240
|
};
|
241
|
+
listData.push(this.templateData[item[this.component.valueProperty]]);
|
218
242
|
if (_.isUndefined(item[this.component.valueProperty]) ||
|
219
243
|
_.isObject(item[this.component.valueProperty]) ||
|
220
244
|
(!this.isRadio && _.isBoolean(item[this.component.valueProperty]))) {
|
221
245
|
this.loadedOptions[i].invalid = true;
|
222
246
|
}
|
223
247
|
});
|
248
|
+
if (this.isSelectURL) {
|
249
|
+
const submission = this.root.submission;
|
250
|
+
if (!submission.metadata) {
|
251
|
+
submission.metadata = {};
|
252
|
+
}
|
253
|
+
if (!submission.metadata.listData) {
|
254
|
+
submission.metadata.listData = {};
|
255
|
+
}
|
256
|
+
_.set(submission.metadata.listData, this.path, listData);
|
257
|
+
}
|
224
258
|
}
|
225
259
|
setSelectedClasses() {
|
226
260
|
if (this.refs.wrapper) {
|
@@ -283,6 +317,13 @@ export default class RadioComponent extends ListComponent {
|
|
283
317
|
if (value === 'false') {
|
284
318
|
value = false;
|
285
319
|
}
|
320
|
+
if (this.isSelectURL && this.templateData && this.templateData[value]) {
|
321
|
+
const submission = this.root.submission;
|
322
|
+
if (!submission.metadata.selectData) {
|
323
|
+
submission.metadata.selectData = {};
|
324
|
+
}
|
325
|
+
_.set(submission.metadata.selectData, this.path, this.templateData[value]);
|
326
|
+
}
|
286
327
|
return super.normalizeValue(value);
|
287
328
|
}
|
288
329
|
}
|
@@ -13,7 +13,7 @@ export default class ReCaptchaComponent extends Component {
|
|
13
13
|
recaptchaApiReady: any;
|
14
14
|
createLabel(): void;
|
15
15
|
verify(actionName: any): void;
|
16
|
-
recaptchaVerifiedPromise:
|
16
|
+
recaptchaVerifiedPromise: Promise<void> | undefined;
|
17
17
|
isLoading: boolean | undefined;
|
18
18
|
sendVerificationRequest(token: any): any;
|
19
19
|
checkComponentValidity(data: any, dirty: any, row: any, options?: {}): any;
|