@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,7 +2,6 @@
|
|
2
2
|
import _ from 'lodash';
|
3
3
|
import Field from '../field/Field';
|
4
4
|
import Components from '../../Components';
|
5
|
-
import NativePromise from 'native-promise-only';
|
6
5
|
import { getArrayFromComponentPath, getStringFromComponentPath, getRandomComponentId } from '../../../utils/utils';
|
7
6
|
export default class NestedComponent extends Field {
|
8
7
|
static schema(...extend) {
|
@@ -46,8 +45,8 @@ export default class NestedComponent extends Field {
|
|
46
45
|
const visibilityChanged = this._visible !== value;
|
47
46
|
this._visible = value;
|
48
47
|
const isVisible = this.visible;
|
49
|
-
const forceShow = this.
|
50
|
-
const forceHide = this.
|
48
|
+
const forceShow = this.shouldForceShow();
|
49
|
+
const forceHide = this.shouldForceHide();
|
51
50
|
this.components.forEach(component => {
|
52
51
|
// Set the parent visibility first since we may have nested components within nested components
|
53
52
|
// and they need to be able to determine their visibility based on the parent visibility.
|
@@ -96,7 +95,7 @@ export default class NestedComponent extends Field {
|
|
96
95
|
return super.parentDisabled;
|
97
96
|
}
|
98
97
|
get ready() {
|
99
|
-
return
|
98
|
+
return Promise.all(this.getComponents().map(component => component.ready));
|
100
99
|
}
|
101
100
|
get currentForm() {
|
102
101
|
return super.currentForm;
|
@@ -401,7 +400,7 @@ export default class NestedComponent extends Field {
|
|
401
400
|
collapsed: this.collapsed,
|
402
401
|
[this.nestedKey]: 'single',
|
403
402
|
});
|
404
|
-
let childPromise =
|
403
|
+
let childPromise = Promise.resolve();
|
405
404
|
if (this.refs[this.nestedKey]) {
|
406
405
|
childPromise = this.attachComponents(this.refs[this.nestedKey]);
|
407
406
|
}
|
@@ -419,7 +418,7 @@ export default class NestedComponent extends Field {
|
|
419
418
|
}
|
420
419
|
});
|
421
420
|
}
|
422
|
-
return
|
421
|
+
return Promise.all([
|
423
422
|
superPromise,
|
424
423
|
childPromise,
|
425
424
|
]);
|
@@ -439,7 +438,7 @@ export default class NestedComponent extends Field {
|
|
439
438
|
element = this.hook('attachComponents', element, components, container, this);
|
440
439
|
if (!element) {
|
441
440
|
// Return a non-resolving promise.
|
442
|
-
return (new
|
441
|
+
return (new Promise(() => { }));
|
443
442
|
}
|
444
443
|
let index = 0;
|
445
444
|
const promises = [];
|
@@ -449,7 +448,7 @@ export default class NestedComponent extends Field {
|
|
449
448
|
index++;
|
450
449
|
}
|
451
450
|
});
|
452
|
-
return
|
451
|
+
return Promise.all(promises);
|
453
452
|
}
|
454
453
|
/**
|
455
454
|
* Remove a component from the components array.
|
@@ -560,7 +559,7 @@ export default class NestedComponent extends Field {
|
|
560
559
|
* @return {*}
|
561
560
|
*/
|
562
561
|
beforePage(next) {
|
563
|
-
return
|
562
|
+
return Promise.all(this.getComponents().map((comp) => comp.beforePage(next)));
|
564
563
|
}
|
565
564
|
/**
|
566
565
|
* Allow components to hook into the submission to provide their own async data.
|
@@ -568,7 +567,7 @@ export default class NestedComponent extends Field {
|
|
568
567
|
* @return {*}
|
569
568
|
*/
|
570
569
|
beforeSubmit() {
|
571
|
-
return
|
570
|
+
return Promise.all(this.getComponents().map((comp) => comp.beforeSubmit()));
|
572
571
|
}
|
573
572
|
calculateValue(data, flags, row) {
|
574
573
|
// Do not iterate into children and calculateValues if this nested component is conditionally hidden.
|
@@ -599,7 +598,7 @@ export default class NestedComponent extends Field {
|
|
599
598
|
return this.ready.then(() => {
|
600
599
|
const promises = [super.checkAsyncValidity(data, dirty, row, silentCheck)];
|
601
600
|
this.eachComponent((component) => promises.push(component.checkAsyncValidity(data, dirty, row, silentCheck)));
|
602
|
-
return
|
601
|
+
return Promise.all(promises).then((results) => results.reduce((valid, result) => (valid && result), true));
|
603
602
|
});
|
604
603
|
}
|
605
604
|
setPristine(pristine) {
|
@@ -648,7 +647,7 @@ export default class NestedComponent extends Field {
|
|
648
647
|
this.setPristine(true);
|
649
648
|
}
|
650
649
|
get dataReady() {
|
651
|
-
return
|
650
|
+
return Promise.all(this.getComponents().map((component) => component.dataReady));
|
652
651
|
}
|
653
652
|
setNestedValue(component, value, flags = {}) {
|
654
653
|
component._data = this.componentContext(component);
|
@@ -3,6 +3,14 @@ export namespace AddressComponentMode {
|
|
3
3
|
const Manual: string;
|
4
4
|
}
|
5
5
|
export default class AddressComponent extends ContainerComponent {
|
6
|
+
static get builderInfo(): {
|
7
|
+
title: string;
|
8
|
+
group: string;
|
9
|
+
icon: string;
|
10
|
+
documentation: string;
|
11
|
+
weight: number;
|
12
|
+
schema: any;
|
13
|
+
};
|
6
14
|
static get modeSwitcherRef(): string;
|
7
15
|
static get removeValueIconRef(): string;
|
8
16
|
static get searchInputRef(): string;
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import _ from 'lodash';
|
2
|
-
import NativePromise from 'native-promise-only';
|
3
2
|
import Field from '../_classes/field/Field';
|
4
3
|
import Input from '../_classes/input/Input';
|
5
4
|
import { eachComponent, getArrayFromComponentPath } from '../../utils/utils';
|
@@ -354,7 +353,7 @@ export default class ButtonComponent extends Field {
|
|
354
353
|
let params = {
|
355
354
|
response_type: 'code',
|
356
355
|
client_id: settings.clientId,
|
357
|
-
redirect_uri: settings.redirectURI || window.location.origin || `${window.location.protocol}//${window.location.host}`,
|
356
|
+
redirect_uri: (settings.redirectURI && this.interpolate(settings.redirectURI)) || window.location.origin || `${window.location.protocol}//${window.location.host}`,
|
358
357
|
state: settings.state,
|
359
358
|
scope: settings.scope
|
360
359
|
};
|
@@ -393,7 +392,7 @@ export default class ButtonComponent extends Field {
|
|
393
392
|
return;
|
394
393
|
}
|
395
394
|
// Depending on where the settings came from, submit to either the submission endpoint (old) or oauth endpoint (new).
|
396
|
-
let requestPromise =
|
395
|
+
let requestPromise = Promise.resolve();
|
397
396
|
if (_.has(this, 'root.form.config.oauth') && this.root.form.config.oauth[this.component.oauthProvider]) {
|
398
397
|
params.provider = settings.provider;
|
399
398
|
params.redirectURI = originalRedirectUri;
|
@@ -7,6 +7,19 @@ export default class CheckBoxComponent extends Field {
|
|
7
7
|
weight: number;
|
8
8
|
schema: any;
|
9
9
|
};
|
10
|
+
static get serverConditionSettings(): {
|
11
|
+
operators: string[];
|
12
|
+
valueComponent(): {
|
13
|
+
valueType: string;
|
14
|
+
data: {
|
15
|
+
values: {
|
16
|
+
label: string;
|
17
|
+
value: string;
|
18
|
+
}[];
|
19
|
+
};
|
20
|
+
type: string;
|
21
|
+
};
|
22
|
+
};
|
10
23
|
get labelClass(): string;
|
11
24
|
get inputInfo(): {
|
12
25
|
type: string;
|
@@ -23,14 +23,27 @@ export default class CheckBoxComponent extends Field {
|
|
23
23
|
schema: CheckBoxComponent.schema()
|
24
24
|
};
|
25
25
|
}
|
26
|
+
static get serverConditionSettings() {
|
27
|
+
return {
|
28
|
+
...super.serverConditionSettings,
|
29
|
+
operators: ['isEqual'],
|
30
|
+
valueComponent() {
|
31
|
+
return {
|
32
|
+
valueType: 'boolean',
|
33
|
+
data: {
|
34
|
+
values: [
|
35
|
+
{ label: 'Checked', value: 'true' },
|
36
|
+
{ label: 'Not Checked', value: 'false' },
|
37
|
+
]
|
38
|
+
},
|
39
|
+
type: 'select',
|
40
|
+
};
|
41
|
+
},
|
42
|
+
};
|
43
|
+
}
|
26
44
|
get defaultSchema() {
|
27
45
|
return CheckBoxComponent.schema();
|
28
46
|
}
|
29
|
-
get defaultValue() {
|
30
|
-
const { name } = this.component;
|
31
|
-
const defaultValue = super.defaultValue;
|
32
|
-
return name ? (this.component[name] || this.emptyValue) : (defaultValue || this.component.defaultValue || false).toString() === 'true';
|
33
|
-
}
|
34
47
|
get labelClass() {
|
35
48
|
let className = '';
|
36
49
|
if (this.isInputComponent
|
@@ -163,6 +176,9 @@ export default class CheckBoxComponent extends Field {
|
|
163
176
|
getValueAsString(value) {
|
164
177
|
const { name: componentName, value: componentValue } = this.component;
|
165
178
|
const hasValue = componentName ? _.isEqual(value, componentValue) : value;
|
179
|
+
if (_.isUndefined(value) && this.inDataTable) {
|
180
|
+
return '';
|
181
|
+
}
|
166
182
|
return this.t(hasValue ? 'Yes' : 'No');
|
167
183
|
}
|
168
184
|
updateValue(value, flags) {
|
@@ -22,6 +22,7 @@ export default class ContainerComponent extends NestedDataComponent {
|
|
22
22
|
icon: 'folder-open',
|
23
23
|
group: 'data',
|
24
24
|
documentation: '/userguide/form-building/data-components#container',
|
25
|
+
showPreview: false,
|
25
26
|
weight: 10,
|
26
27
|
schema: ContainerComponent.schema()
|
27
28
|
};
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import Component from '../_classes/component/Component';
|
2
2
|
import _ from 'lodash';
|
3
|
-
import NativePromise from 'native-promise-only';
|
4
3
|
export default class ContentComponent extends Component {
|
5
4
|
static schema(...extend) {
|
6
5
|
return Component.schema({
|
@@ -45,7 +44,7 @@ export default class ContentComponent extends Component {
|
|
45
44
|
}));
|
46
45
|
}
|
47
46
|
get dataReady() {
|
48
|
-
return this.root?.submissionReady ||
|
47
|
+
return this.root?.submissionReady || Promise.resolve();
|
49
48
|
}
|
50
49
|
attach(element) {
|
51
50
|
this.loadRefs(element, { html: 'single' });
|
@@ -1,4 +1,15 @@
|
|
1
|
-
declare const _default: {
|
1
|
+
declare const _default: ({
|
2
|
+
key: string;
|
3
|
+
ignore: boolean;
|
4
|
+
type?: undefined;
|
5
|
+
input?: undefined;
|
6
|
+
weight?: undefined;
|
7
|
+
label?: undefined;
|
8
|
+
tooltip?: undefined;
|
9
|
+
defaultValue?: undefined;
|
10
|
+
dataSrc?: undefined;
|
11
|
+
data?: undefined;
|
12
|
+
} | {
|
2
13
|
type: string;
|
3
14
|
input: boolean;
|
4
15
|
weight: number;
|
@@ -13,5 +24,6 @@ declare const _default: {
|
|
13
24
|
value: string;
|
14
25
|
}[];
|
15
26
|
};
|
16
|
-
|
27
|
+
ignore?: undefined;
|
28
|
+
})[];
|
17
29
|
export default _default;
|
@@ -19,6 +19,7 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
19
19
|
icon: 'th',
|
20
20
|
group: 'data',
|
21
21
|
documentation: '/userguide/form-building/data-components#data-grid',
|
22
|
+
showPreview: false,
|
22
23
|
weight: 30,
|
23
24
|
schema: DataGridComponent.schema()
|
24
25
|
};
|
@@ -510,7 +511,13 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
510
511
|
(col.checkConditions(data, flags, dataValue[rowIndex]) && col.type !== 'hidden');
|
511
512
|
if (col.component.logic && firstRowCheck) {
|
512
513
|
const compIndex = _.findIndex(this.columns, ['key', key]);
|
513
|
-
|
514
|
+
const equalColumns = _.isEqualWith(this.columns[compIndex], col.component, (col1, col2, key) => {
|
515
|
+
// Don't compare columns by their auto-generated ids.
|
516
|
+
if (key === 'id') {
|
517
|
+
return true;
|
518
|
+
}
|
519
|
+
});
|
520
|
+
if (!equalColumns) {
|
514
521
|
logicRebuild = true;
|
515
522
|
this.columns[compIndex] = col.component;
|
516
523
|
}
|
@@ -7,6 +7,10 @@ export default class DateTimeComponent 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
|
get emptyValue(): string;
|
11
15
|
get momentFormat(): string;
|
12
16
|
createWrapper(): boolean;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import moment from 'moment';
|
3
|
-
import Input from '../_classes/input/Input';
|
4
3
|
import FormioUtils from '../../utils';
|
4
|
+
import Input from '../_classes/input/Input';
|
5
5
|
export default class DateTimeComponent extends Input {
|
6
6
|
static schema(...extend) {
|
7
7
|
return Input.schema({
|
@@ -50,6 +50,27 @@ export default class DateTimeComponent extends Input {
|
|
50
50
|
schema: DateTimeComponent.schema()
|
51
51
|
};
|
52
52
|
}
|
53
|
+
static get serverConditionSettings() {
|
54
|
+
return {
|
55
|
+
...super.serverConditionSettings,
|
56
|
+
operators: [
|
57
|
+
'isDateEqual',
|
58
|
+
'isNotDateEqual',
|
59
|
+
'isEmpty',
|
60
|
+
'isNotEmpty',
|
61
|
+
'dateLessThan',
|
62
|
+
'dateGreaterThan',
|
63
|
+
'dateLessThanOrEqual',
|
64
|
+
'dateGreaterThanOrEqual',
|
65
|
+
],
|
66
|
+
valueComponent(classComp) {
|
67
|
+
return {
|
68
|
+
...classComp,
|
69
|
+
type: 'datetime',
|
70
|
+
};
|
71
|
+
},
|
72
|
+
};
|
73
|
+
}
|
53
74
|
constructor(component, options, data) {
|
54
75
|
super(component, options, data);
|
55
76
|
const timezone = (this.component.timezone || this.options.timezone);
|
@@ -58,9 +79,15 @@ export default class DateTimeComponent extends Input {
|
|
58
79
|
if (!this.component.enableDate) {
|
59
80
|
this.component.format = this.component.format.replace(/yyyy-MM-dd /g, '');
|
60
81
|
}
|
82
|
+
else if (this.component.enableDate && !/[yMd]/.test(this.component.format) && this.builderMode) {
|
83
|
+
this.component.format = `yyyy-MM-dd ${this.component.format}`;
|
84
|
+
}
|
61
85
|
if (!this.component.enableTime) {
|
62
86
|
this.component.format = this.component.format.replace(/ hh:mm a$/g, '');
|
63
87
|
}
|
88
|
+
else if (this.component.enableTime && !/[mhH]/.test(this.component.format) && this.builderMode) {
|
89
|
+
this.component.format = `${this.component.format} hh:mm a`;
|
90
|
+
}
|
64
91
|
else if (time24hr) {
|
65
92
|
this.component.format = this.component.format.replace(/hh:mm a$/g, 'HH:mm');
|
66
93
|
}
|
@@ -7,6 +7,7 @@ export default class DayComponent extends Field {
|
|
7
7
|
weight: number;
|
8
8
|
schema: any;
|
9
9
|
};
|
10
|
+
constructor(component: any, options: any, data: any);
|
10
11
|
/**
|
11
12
|
* The empty value for day component.
|
12
13
|
*
|
@@ -122,7 +123,6 @@ export default class DayComponent extends Field {
|
|
122
123
|
* @returns {Date}
|
123
124
|
*/
|
124
125
|
get date(): Date;
|
125
|
-
normalizeMinMaxDates(): any[];
|
126
126
|
/**
|
127
127
|
* Return the raw value.
|
128
128
|
*
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import _ from 'lodash';
|
2
|
+
import moment from 'moment';
|
2
3
|
import Field from '../_classes/field/Field';
|
3
4
|
import { boolValue, getLocaleDateFormatInfo } from '../../utils/utils';
|
4
5
|
export default class DayComponent extends Field {
|
@@ -37,6 +38,30 @@ export default class DayComponent extends Field {
|
|
37
38
|
schema: DayComponent.schema()
|
38
39
|
};
|
39
40
|
}
|
41
|
+
constructor(component, options, data) {
|
42
|
+
if (component.maxDate) {
|
43
|
+
component.maxDate = moment(component.maxDate, 'YYYY-MM-DD').toISOString();
|
44
|
+
}
|
45
|
+
if (component.minDate) {
|
46
|
+
component.minDate = moment(component.minDate, 'YYYY-MM-DD').toISOString();
|
47
|
+
}
|
48
|
+
super(component, options, data);
|
49
|
+
}
|
50
|
+
static get serverConditionSettings() {
|
51
|
+
return {
|
52
|
+
...super.serverConditionSettings,
|
53
|
+
operators: [
|
54
|
+
'isDateEqual',
|
55
|
+
'isNotDateEqual',
|
56
|
+
'isEmpty',
|
57
|
+
'isNotEmpty',
|
58
|
+
'dateLessThan',
|
59
|
+
'dateGreaterThan',
|
60
|
+
'dateLessThanOrEqual',
|
61
|
+
'dateGreaterThanOrEqual',
|
62
|
+
],
|
63
|
+
};
|
64
|
+
}
|
40
65
|
/**
|
41
66
|
* The empty value for day component.
|
42
67
|
*
|
@@ -459,18 +484,12 @@ export default class DayComponent extends Field {
|
|
459
484
|
get date() {
|
460
485
|
return this.getDate();
|
461
486
|
}
|
462
|
-
normalizeMinMaxDates() {
|
463
|
-
return [this.component.minDate, this.component.maxDate]
|
464
|
-
.map(date => date ? date.split('-').reverse().join('/') : date);
|
465
|
-
}
|
466
487
|
/**
|
467
488
|
* Return the raw value.
|
468
489
|
*
|
469
490
|
* @returns {Date}
|
470
491
|
*/
|
471
492
|
get validationValue() {
|
472
|
-
[this.component.minDate, this.component.maxDate] = this.dayFirst ? this.normalizeMinMaxDates()
|
473
|
-
: [this.component.minDate, this.component.maxDate];
|
474
493
|
return this.dataValue;
|
475
494
|
}
|
476
495
|
getValue() {
|
@@ -4,6 +4,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
4
4
|
icon: string;
|
5
5
|
group: string;
|
6
6
|
documentation: string;
|
7
|
+
showPreview: boolean;
|
7
8
|
weight: number;
|
8
9
|
schema: any;
|
9
10
|
};
|
@@ -68,10 +69,10 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
68
69
|
error: null;
|
69
70
|
rowIndex: any;
|
70
71
|
} | undefined;
|
71
|
-
addRowModal(rowIndex: any): any
|
72
|
+
addRowModal(rowIndex: any): Promise<any>;
|
72
73
|
alert: Alert | null | undefined;
|
73
|
-
showDialog(rowIndex: any): any
|
74
|
-
editRow(rowIndex: any): any
|
74
|
+
showDialog(rowIndex: any): Promise<any>;
|
75
|
+
editRow(rowIndex: any): Promise<any>;
|
75
76
|
clearErrors(rowIndex: any): void;
|
76
77
|
cancelRow(rowIndex: any): void;
|
77
78
|
saveRow(rowIndex: any, modified: any): boolean | undefined;
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import _ from 'lodash';
|
2
|
-
import NativePromise from 'native-promise-only';
|
3
2
|
import NestedArrayComponent from '../_classes/nestedarray/NestedArrayComponent';
|
4
3
|
import Component from '../_classes/component/Component';
|
5
4
|
import Alert from '../alert/Alert';
|
@@ -43,6 +42,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
43
42
|
icon: 'tasks',
|
44
43
|
group: 'data',
|
45
44
|
documentation: '/userguide/form-building/data-components#edit-grid',
|
45
|
+
showPreview: false,
|
46
46
|
weight: 30,
|
47
47
|
schema: EditGridComponent.schema(),
|
48
48
|
};
|
@@ -208,7 +208,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
208
208
|
return !this.inlineEditMode;
|
209
209
|
}
|
210
210
|
get minLength() {
|
211
|
-
return _.get(this.component, 'validate.minLength', 0);
|
211
|
+
return this.builderMode ? 0 : _.get(this.component, 'validate.minLength', 0);
|
212
212
|
}
|
213
213
|
get data() {
|
214
214
|
return this._data;
|
@@ -467,7 +467,12 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
467
467
|
].forEach(({ className, event, action, }) => {
|
468
468
|
const elements = row.getElementsByClassName(className);
|
469
469
|
Array.prototype.forEach.call(elements, (element) => {
|
470
|
-
this.
|
470
|
+
if (this.options.readOnly && _.intersection(element.classList, ['editRow', 'removeRow']).length) {
|
471
|
+
element.style.display = 'none';
|
472
|
+
}
|
473
|
+
else {
|
474
|
+
this.addEventListener(element, event, action);
|
475
|
+
}
|
471
476
|
});
|
472
477
|
});
|
473
478
|
}
|
@@ -664,7 +669,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
664
669
|
showDialog(rowIndex) {
|
665
670
|
const editRow = this.editRows[rowIndex];
|
666
671
|
if (_.isEqual(editRow.backup, editRow.data)) {
|
667
|
-
return
|
672
|
+
return Promise.resolve();
|
668
673
|
}
|
669
674
|
const wrapper = this.ce('div', { ref: 'confirmationDialog' });
|
670
675
|
const dialogContent = this.component.dialogTemplate || this.defaultDialogTemplate;
|
@@ -682,7 +687,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
682
687
|
dialog.close();
|
683
688
|
};
|
684
689
|
let dialogResult;
|
685
|
-
const promise = new
|
690
|
+
const promise = new Promise((resolve, reject) => {
|
686
691
|
dialogResult = { resolve, reject };
|
687
692
|
});
|
688
693
|
this.addEventListener(wrapper.refs.dialogYesButton, 'click', (event) => {
|
@@ -700,7 +705,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
700
705
|
const editRow = this.editRows[rowIndex];
|
701
706
|
const isAlreadyEditing = editRow.state === EditRowState.Editing || editRow.state === EditRowState.New;
|
702
707
|
if (!editRow || isAlreadyEditing) {
|
703
|
-
return
|
708
|
+
return Promise.resolve();
|
704
709
|
}
|
705
710
|
editRow.prevState = editRow.state;
|
706
711
|
editRow.state = this.options.readOnly ? EditRowState.Viewing : EditRowState.Editing;
|