@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
@@ -3,7 +3,6 @@ import Component from '../_classes/component/Component';
|
|
3
3
|
import { Formio } from '../../Formio';
|
4
4
|
import _get from 'lodash/get';
|
5
5
|
import _debounce from 'lodash/debounce';
|
6
|
-
import NativePromise from 'native-promise-only';
|
7
6
|
export default class ReCaptchaComponent extends Component {
|
8
7
|
static schema(...extend) {
|
9
8
|
return Component.schema({
|
@@ -61,7 +60,7 @@ export default class ReCaptchaComponent extends Component {
|
|
61
60
|
this.recaptchaApiReady = Formio.requireLibrary('googleRecaptcha', 'grecaptcha', recaptchaApiScriptUrl, true);
|
62
61
|
}
|
63
62
|
if (this.recaptchaApiReady) {
|
64
|
-
this.recaptchaVerifiedPromise = new
|
63
|
+
this.recaptchaVerifiedPromise = new Promise((resolve, reject) => {
|
65
64
|
this.recaptchaApiReady
|
66
65
|
.then(() => {
|
67
66
|
if (!this.isLoading) {
|
@@ -117,13 +116,13 @@ export default class ReCaptchaComponent extends Component {
|
|
117
116
|
const componentData = row[this.component.key];
|
118
117
|
if (!componentData || !componentData.token) {
|
119
118
|
this.setCustomValidity('ReCAPTCHA: Token is not specified in submission');
|
120
|
-
return
|
119
|
+
return Promise.resolve(false);
|
121
120
|
}
|
122
121
|
if (!componentData.success) {
|
123
122
|
this.setCustomValidity('ReCAPTCHA: Token validation error');
|
124
|
-
return
|
123
|
+
return Promise.resolve(false);
|
125
124
|
}
|
126
|
-
return this.hook('validateReCaptcha', componentData.token, () =>
|
125
|
+
return this.hook('validateReCaptcha', componentData.token, () => Promise.resolve(true))
|
127
126
|
.then((success) => success)
|
128
127
|
.catch((err) => {
|
129
128
|
this.setCustomValidity(err.message || err);
|
@@ -5,7 +5,7 @@ export default [
|
|
5
5
|
type: 'htmlelement',
|
6
6
|
tag: 'div',
|
7
7
|
className: 'alert alert-danger',
|
8
|
-
content: '
|
8
|
+
content: 'This component has been deprecated and will be removed in a future version of Formio.js.',
|
9
9
|
},
|
10
10
|
{
|
11
11
|
type: 'select',
|
@@ -7,11 +7,15 @@ export default class SelectComponent extends ListComponent {
|
|
7
7
|
documentation: string;
|
8
8
|
schema: any;
|
9
9
|
};
|
10
|
+
static get serverConditionSettings(): {
|
11
|
+
valueComponent(classComp: any): any;
|
12
|
+
operators: string[];
|
13
|
+
};
|
10
14
|
templateData: {} | undefined;
|
11
15
|
triggerUpdate: ((...args: any[]) => any) | undefined;
|
12
16
|
set itemsLoaded(arg: any);
|
13
17
|
get itemsLoaded(): any;
|
14
|
-
itemsLoadedResolve: any;
|
18
|
+
itemsLoadedResolve: ((value: any) => void) | undefined;
|
15
19
|
isFromSearch: boolean | undefined;
|
16
20
|
searchServerCount: any;
|
17
21
|
defaultServerCount: any;
|
@@ -19,6 +23,7 @@ export default class SelectComponent extends ListComponent {
|
|
19
23
|
searchDownloadedResources: any;
|
20
24
|
defaultDownloadedResources: any;
|
21
25
|
activated: boolean | undefined;
|
26
|
+
get dataReady(): any;
|
22
27
|
get emptyValue(): {};
|
23
28
|
get valueProperty(): any;
|
24
29
|
get inputInfo(): {
|
@@ -55,11 +60,7 @@ export default class SelectComponent extends ListComponent {
|
|
55
60
|
set downloadedResources(arg: any);
|
56
61
|
get downloadedResources(): any;
|
57
62
|
getSingleItemValueForHTMLMode(data: any): any;
|
58
|
-
getTemplateKeys(): void;
|
59
|
-
templateKeys: any[] | undefined;
|
60
63
|
get loadingError(): boolean | undefined;
|
61
|
-
get selectData(): any;
|
62
|
-
get shouldLoad(): any;
|
63
64
|
loadItems(url: any, search: any, headers: any, options: any, method: any, body: any): void;
|
64
65
|
getCustomItems(): any;
|
65
66
|
asyncValues: boolean | undefined;
|
@@ -79,6 +80,7 @@ export default class SelectComponent extends ListComponent {
|
|
79
80
|
render(): any;
|
80
81
|
wrapElement(element: any): any;
|
81
82
|
choicesOptions(): any;
|
83
|
+
attach(element: any): Promise<void> | undefined;
|
82
84
|
focusableElement: any;
|
83
85
|
choices: Choices | null | undefined;
|
84
86
|
scrollList: any;
|
@@ -2,7 +2,6 @@ import _ from 'lodash';
|
|
2
2
|
import { Formio } from '../../Formio';
|
3
3
|
import ListComponent from '../_classes/list/ListComponent';
|
4
4
|
import Form from '../../Form';
|
5
|
-
import NativePromise from 'native-promise-only';
|
6
5
|
import { getRandomComponentId, boolValue, isPromise } from '../../utils/utils';
|
7
6
|
import Choices from '../../utils/ChoicesWrapper';
|
8
7
|
export default class SelectComponent extends ListComponent {
|
@@ -54,6 +53,14 @@ export default class SelectComponent extends ListComponent {
|
|
54
53
|
schema: SelectComponent.schema()
|
55
54
|
};
|
56
55
|
}
|
56
|
+
static get serverConditionSettings() {
|
57
|
+
return {
|
58
|
+
...super.serverConditionSettings,
|
59
|
+
valueComponent(classComp) {
|
60
|
+
return { ...classComp, type: 'select' };
|
61
|
+
},
|
62
|
+
};
|
63
|
+
}
|
57
64
|
init() {
|
58
65
|
super.init();
|
59
66
|
this.templateData = {};
|
@@ -69,7 +76,7 @@ export default class SelectComponent extends ListComponent {
|
|
69
76
|
if (typeof this.itemsLoadedResolve === 'function') {
|
70
77
|
this.itemsLoadedResolve();
|
71
78
|
}
|
72
|
-
this.itemsLoaded = new
|
79
|
+
this.itemsLoaded = new Promise((resolve) => {
|
73
80
|
this.itemsLoadedResolve = resolve;
|
74
81
|
});
|
75
82
|
if (args.length) {
|
@@ -89,7 +96,7 @@ export default class SelectComponent extends ListComponent {
|
|
89
96
|
}
|
90
97
|
// If this component has been activated.//
|
91
98
|
this.activated = false;
|
92
|
-
this.itemsLoaded = new
|
99
|
+
this.itemsLoaded = new Promise((resolve) => {
|
93
100
|
this.itemsLoadedResolve = resolve;
|
94
101
|
});
|
95
102
|
if (this.isHtmlRenderMode()) {
|
@@ -104,7 +111,7 @@ export default class SelectComponent extends ListComponent {
|
|
104
111
|
if (this.root &&
|
105
112
|
this.root.submissionSet &&
|
106
113
|
!this.attached) {
|
107
|
-
return
|
114
|
+
return Promise.resolve();
|
108
115
|
}
|
109
116
|
return this.itemsLoaded;
|
110
117
|
}
|
@@ -189,7 +196,7 @@ export default class SelectComponent extends ListComponent {
|
|
189
196
|
const value = (typeof itemLabel === 'string') ? this.t(itemLabel, { _userInput: true }) : itemLabel;
|
190
197
|
return this.sanitize(value, this.shouldSanitizeValue);
|
191
198
|
}
|
192
|
-
if (this.component.multiple ? this.dataValue.find((val) => value === val) : (this.dataValue === value)) {
|
199
|
+
if (this.component.multiple && _.isArray(this.dataValue) ? this.dataValue.find((val) => value === val) : (this.dataValue === value)) {
|
193
200
|
const selectData = this.selectData;
|
194
201
|
if (selectData) {
|
195
202
|
const templateValue = this.component.reference && value?._id ? value._id.toString() : value;
|
@@ -434,48 +441,9 @@ export default class SelectComponent extends ListComponent {
|
|
434
441
|
}
|
435
442
|
return defaultValue;
|
436
443
|
}
|
437
|
-
getTemplateKeys() {
|
438
|
-
this.templateKeys = [];
|
439
|
-
if (this.options.readOnly && this.component.template) {
|
440
|
-
const keys = this.component.template.match(/({{\s*(.*?)\s*}})/g);
|
441
|
-
if (keys) {
|
442
|
-
keys.forEach((key) => {
|
443
|
-
const propKey = key.match(/{{\s*item\.(.*?)\s*}}/);
|
444
|
-
if (propKey && propKey.length > 1) {
|
445
|
-
this.templateKeys.push(propKey[1]);
|
446
|
-
}
|
447
|
-
});
|
448
|
-
}
|
449
|
-
}
|
450
|
-
}
|
451
444
|
get loadingError() {
|
452
445
|
return !this.component.refreshOn && !this.component.refreshOnBlur && this.networkError;
|
453
446
|
}
|
454
|
-
get selectData() {
|
455
|
-
const selectData = _.get(this.root, 'submission.metadata.selectData', {});
|
456
|
-
return _.get(selectData, this.path);
|
457
|
-
}
|
458
|
-
get shouldLoad() {
|
459
|
-
if (this.loadingError) {
|
460
|
-
return false;
|
461
|
-
}
|
462
|
-
// Live forms should always load.
|
463
|
-
if (!this.options.readOnly) {
|
464
|
-
return true;
|
465
|
-
}
|
466
|
-
// If there are template keys, then we need to see if we have the data.
|
467
|
-
if (this.templateKeys && this.templateKeys.length) {
|
468
|
-
// See if we already have the data we need.
|
469
|
-
const dataValue = this.dataValue;
|
470
|
-
const selectData = this.selectData;
|
471
|
-
return this.templateKeys.reduce((shouldLoad, key) => {
|
472
|
-
const hasValue = _.has(dataValue, key) || _.has(selectData, key);
|
473
|
-
return shouldLoad || !hasValue;
|
474
|
-
}, false);
|
475
|
-
}
|
476
|
-
// Return that we should load.
|
477
|
-
return true;
|
478
|
-
}
|
479
447
|
loadItems(url, search, headers, options, method, body) {
|
480
448
|
options = options || {};
|
481
449
|
// See if we should load items or not.
|
@@ -937,7 +905,7 @@ export default class SelectComponent extends ListComponent {
|
|
937
905
|
const items = this.choices._store.activeItems;
|
938
906
|
if (!items.length) {
|
939
907
|
this.choices._addItem({
|
940
|
-
value:
|
908
|
+
value: '',
|
941
909
|
label: placeholderValue,
|
942
910
|
choiceId: 0,
|
943
911
|
groupId: -1,
|
@@ -1107,7 +1075,7 @@ export default class SelectComponent extends ListComponent {
|
|
1107
1075
|
if (this.component.multiple) {
|
1108
1076
|
templateData = {};
|
1109
1077
|
const dataValue = this.dataValue;
|
1110
|
-
if (dataValue && dataValue.length) {
|
1078
|
+
if (dataValue && _.isArray(dataValue) && dataValue.length) {
|
1111
1079
|
dataValue.forEach((dataValueItem) => {
|
1112
1080
|
const dataValueItemValue = this.component.reference ? dataValueItem._id.toString() : dataValueItem;
|
1113
1081
|
templateData[dataValueItemValue] = this.templateData[dataValueItemValue];
|
@@ -1175,7 +1143,7 @@ export default class SelectComponent extends ListComponent {
|
|
1175
1143
|
}
|
1176
1144
|
setValue(value, flags = {}) {
|
1177
1145
|
const previousValue = this.dataValue;
|
1178
|
-
if (this.component.widget === 'html5' && (_.isEqual(value, previousValue) || _.isEqual(previousValue, {}) && _.isEqual(flags, {}))) {
|
1146
|
+
if (this.component.widget === 'html5' && (_.isEqual(value, previousValue) || _.isEqual(previousValue, {}) && _.isEqual(flags, {})) && !flags.fromSubmission) {
|
1179
1147
|
return false;
|
1180
1148
|
}
|
1181
1149
|
const changed = this.updateValue(value, flags);
|
@@ -1251,7 +1219,8 @@ export default class SelectComponent extends ListComponent {
|
|
1251
1219
|
else {
|
1252
1220
|
if (hasValue) {
|
1253
1221
|
const values = Array.isArray(value) ? value : [value];
|
1254
|
-
if (!_.isEqual(this.dataValue, this.defaultValue) && this.selectOptions.length < 2
|
1222
|
+
if (!_.isEqual(this.dataValue, this.defaultValue) && this.selectOptions.length < 2
|
1223
|
+
|| (this.selectData && flags.fromSubmission)) {
|
1255
1224
|
const { value, label } = this.selectValueAndLabel(this.dataValue);
|
1256
1225
|
this.addOption(value, label);
|
1257
1226
|
}
|
@@ -1279,7 +1248,7 @@ export default class SelectComponent extends ListComponent {
|
|
1279
1248
|
}
|
1280
1249
|
}
|
1281
1250
|
get itemsLoaded() {
|
1282
|
-
return this._itemsLoaded ||
|
1251
|
+
return this._itemsLoaded || Promise.resolve();
|
1283
1252
|
}
|
1284
1253
|
set itemsLoaded(promise) {
|
1285
1254
|
this._itemsLoaded = promise;
|
@@ -1,4 +1,16 @@
|
|
1
1
|
export default class SelectBoxesComponent extends RadioComponent {
|
2
|
+
static get serverConditionSettings(): {
|
3
|
+
valueComponent(classComp: any): {
|
4
|
+
type: string;
|
5
|
+
dataSrc: string;
|
6
|
+
valueProperty: string;
|
7
|
+
valueType: string;
|
8
|
+
data: {
|
9
|
+
custom: string;
|
10
|
+
};
|
11
|
+
};
|
12
|
+
operators: string[];
|
13
|
+
};
|
2
14
|
constructor(...args: any[]);
|
3
15
|
validators: string[];
|
4
16
|
get emptyValue(): any;
|
@@ -19,6 +19,22 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
19
19
|
schema: SelectBoxesComponent.schema()
|
20
20
|
};
|
21
21
|
}
|
22
|
+
static get serverConditionSettings() {
|
23
|
+
return {
|
24
|
+
...super.serverConditionSettings,
|
25
|
+
valueComponent(classComp) {
|
26
|
+
return {
|
27
|
+
type: 'select',
|
28
|
+
dataSrc: 'custom',
|
29
|
+
valueProperty: 'value',
|
30
|
+
valueType: 'string',
|
31
|
+
data: {
|
32
|
+
custom: `values = ${classComp && classComp.values ? JSON.stringify(classComp.values) : []}`
|
33
|
+
},
|
34
|
+
};
|
35
|
+
}
|
36
|
+
};
|
37
|
+
}
|
22
38
|
constructor(...args) {
|
23
39
|
super(...args);
|
24
40
|
this.validators = this.validators.concat('minSelectedCount', 'maxSelectedCount', 'availableValueProperty');
|
@@ -104,6 +120,16 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
104
120
|
value[val] = true;
|
105
121
|
});
|
106
122
|
}
|
123
|
+
const checkedValues = _.keys(_.pickBy(value, (val) => val));
|
124
|
+
if (this.isSelectURL && this.templateData && _.every(checkedValues, (val) => this.templateData[val])) {
|
125
|
+
const submission = this.root.submission;
|
126
|
+
if (!submission.metadata.selectData) {
|
127
|
+
submission.metadata.selectData = {};
|
128
|
+
}
|
129
|
+
const selectData = [];
|
130
|
+
checkedValues.forEach((value) => selectData.push(this.templateData[value]));
|
131
|
+
_.set(submission.metadata.selectData, this.path, selectData);
|
132
|
+
}
|
107
133
|
return value;
|
108
134
|
}
|
109
135
|
/**
|
@@ -134,6 +160,9 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
134
160
|
if (!value) {
|
135
161
|
return '';
|
136
162
|
}
|
163
|
+
if (this.isSelectURL) {
|
164
|
+
return _(value).pickBy((val) => val).keys().join(', ');
|
165
|
+
}
|
137
166
|
return _(this.component.values || [])
|
138
167
|
.filter((v) => value[v.value])
|
139
168
|
.map('label')
|
@@ -151,7 +180,7 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
151
180
|
key = valuesKeys.find((k) => input?.value.toString() === k);
|
152
181
|
}
|
153
182
|
const isChecked = value[key];
|
154
|
-
if (isChecked && key) {
|
183
|
+
if ((isChecked && key) || (this.isSelectURL && !this.shouldLoad && this.listData && _.findIndex(this.selectData, this.listData[index]) !== -1)) {
|
155
184
|
//add class to container when selected
|
156
185
|
this.addClass(wrapper, this.optionSelectedClass);
|
157
186
|
//change "checked" attribute
|
@@ -176,31 +205,33 @@ export default class SelectBoxesComponent extends RadioComponent {
|
|
176
205
|
checkComponentValidity(data, dirty, rowData, options) {
|
177
206
|
const minCount = this.component.validate.minSelectedCount;
|
178
207
|
const maxCount = this.component.validate.maxSelectedCount;
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
208
|
+
if (!this.shouldSkipValidation(data, dirty, rowData)) {
|
209
|
+
const isValid = this.isValid(data, dirty);
|
210
|
+
if ((maxCount || minCount)) {
|
211
|
+
const count = Object.keys(this.validationValue).reduce((total, key) => {
|
212
|
+
if (this.validationValue[key]) {
|
213
|
+
total++;
|
214
|
+
}
|
215
|
+
return total;
|
216
|
+
}, 0);
|
217
|
+
// Disable the rest of inputs if the max amount is already checked
|
218
|
+
if (maxCount && count >= maxCount) {
|
219
|
+
this.setInputsDisabled(true, true);
|
220
|
+
}
|
221
|
+
else if (maxCount && !this.shouldDisabled) {
|
222
|
+
this.setInputsDisabled(false);
|
223
|
+
}
|
224
|
+
if (!isValid && maxCount && count > maxCount) {
|
225
|
+
const message = this.t(this.component.maxSelectedCountMessage || 'You can only select up to {{maxCount}} items.', { maxCount });
|
226
|
+
this.setCustomValidity(message, dirty);
|
227
|
+
return false;
|
228
|
+
}
|
229
|
+
else if (!isValid && minCount && count < minCount) {
|
230
|
+
this.setInputsDisabled(false);
|
231
|
+
const message = this.t(this.component.minSelectedCountMessage || 'You must select at least {{minCount}} items.', { minCount });
|
232
|
+
this.setCustomValidity(message, dirty);
|
233
|
+
return false;
|
184
234
|
}
|
185
|
-
return total;
|
186
|
-
}, 0);
|
187
|
-
// Disable the rest of inputs if the max amount is already checked
|
188
|
-
if (maxCount && count >= maxCount) {
|
189
|
-
this.setInputsDisabled(true, true);
|
190
|
-
}
|
191
|
-
else if (maxCount && !this.shouldDisabled) {
|
192
|
-
this.setInputsDisabled(false);
|
193
|
-
}
|
194
|
-
if (!isValid && maxCount && count > maxCount) {
|
195
|
-
const message = this.t(this.component.maxSelectedCountMessage || 'You can only select up to {{maxCount}} items.', { maxCount });
|
196
|
-
this.setCustomValidity(message, dirty);
|
197
|
-
return false;
|
198
|
-
}
|
199
|
-
else if (!isValid && minCount && count < minCount) {
|
200
|
-
this.setInputsDisabled(false);
|
201
|
-
const message = this.t(this.component.minSelectedCountMessage || 'You must select at least {{minCount}} items.', { minCount });
|
202
|
-
this.setCustomValidity(message, dirty);
|
203
|
-
return false;
|
204
235
|
}
|
205
236
|
}
|
206
237
|
return super.checkComponentValidity(data, dirty, rowData, options);
|
@@ -11,39 +11,46 @@ declare namespace _default {
|
|
11
11
|
key: string;
|
12
12
|
type: string;
|
13
13
|
input: boolean;
|
14
|
-
optionsLabelPosition?: undefined;
|
15
|
-
defaultValue?: undefined;
|
16
|
-
values?: undefined;
|
17
|
-
validate?: undefined;
|
18
14
|
conditional?: undefined;
|
19
|
-
|
15
|
+
components?: undefined;
|
20
16
|
disableOnInvalid?: undefined;
|
21
17
|
} | {
|
22
18
|
label: string;
|
23
|
-
optionsLabelPosition: string;
|
24
19
|
tableView: boolean;
|
25
|
-
defaultValue: {
|
26
|
-
'1': boolean;
|
27
|
-
'2': boolean;
|
28
|
-
'3': boolean;
|
29
|
-
};
|
30
|
-
values: {
|
31
|
-
label: string;
|
32
|
-
value: string;
|
33
|
-
shortcut: string;
|
34
|
-
}[];
|
35
|
-
validate: {
|
36
|
-
minSelectedCount: number;
|
37
|
-
};
|
38
20
|
key: string;
|
39
21
|
conditional: {
|
40
22
|
show: boolean;
|
41
|
-
|
42
|
-
|
23
|
+
conjunction: string;
|
24
|
+
conditions: {
|
25
|
+
component: string;
|
26
|
+
operator: string;
|
27
|
+
value: boolean;
|
28
|
+
}[];
|
43
29
|
};
|
44
30
|
type: string;
|
45
31
|
input: boolean;
|
46
|
-
|
32
|
+
components: {
|
33
|
+
label: string;
|
34
|
+
optionsLabelPosition: string;
|
35
|
+
tableView: boolean;
|
36
|
+
defaultValue: {
|
37
|
+
'1': boolean;
|
38
|
+
'2': boolean;
|
39
|
+
'3': boolean;
|
40
|
+
};
|
41
|
+
values: {
|
42
|
+
label: string;
|
43
|
+
value: string;
|
44
|
+
shortcut: string;
|
45
|
+
}[];
|
46
|
+
validate: {
|
47
|
+
minSelectedCount: number;
|
48
|
+
};
|
49
|
+
key: string;
|
50
|
+
type: string;
|
51
|
+
input: boolean;
|
52
|
+
inputType: string;
|
53
|
+
}[];
|
47
54
|
disableOnInvalid?: undefined;
|
48
55
|
} | {
|
49
56
|
type: string;
|
@@ -52,12 +59,8 @@ declare namespace _default {
|
|
52
59
|
disableOnInvalid: boolean;
|
53
60
|
input: boolean;
|
54
61
|
tableView: boolean;
|
55
|
-
optionsLabelPosition?: undefined;
|
56
|
-
defaultValue?: undefined;
|
57
|
-
values?: undefined;
|
58
|
-
validate?: undefined;
|
59
62
|
conditional?: undefined;
|
60
|
-
|
63
|
+
components?: undefined;
|
61
64
|
})[];
|
62
65
|
}
|
63
66
|
export default _default;
|
@@ -14,43 +14,58 @@ export default {
|
|
14
14
|
input: true
|
15
15
|
},
|
16
16
|
{
|
17
|
-
label: '
|
18
|
-
optionsLabelPosition: 'right',
|
17
|
+
label: 'Container',
|
19
18
|
tableView: false,
|
20
|
-
|
21
|
-
'1': false,
|
22
|
-
'2': false,
|
23
|
-
'3': false
|
24
|
-
},
|
25
|
-
values: [
|
26
|
-
{
|
27
|
-
label: '1',
|
28
|
-
value: '1',
|
29
|
-
shortcut: ''
|
30
|
-
},
|
31
|
-
{
|
32
|
-
label: '2',
|
33
|
-
value: '2',
|
34
|
-
shortcut: ''
|
35
|
-
},
|
36
|
-
{
|
37
|
-
label: '3',
|
38
|
-
value: '3',
|
39
|
-
shortcut: ''
|
40
|
-
}
|
41
|
-
],
|
42
|
-
validate: {
|
43
|
-
minSelectedCount: 1
|
44
|
-
},
|
45
|
-
key: 'selectBoxes1',
|
19
|
+
key: 'container',
|
46
20
|
conditional: {
|
47
21
|
show: true,
|
48
|
-
|
49
|
-
|
22
|
+
conjunction: 'all',
|
23
|
+
conditions: [
|
24
|
+
{
|
25
|
+
component: 'checkbox',
|
26
|
+
operator: 'isEqual',
|
27
|
+
value: true
|
28
|
+
}
|
29
|
+
]
|
50
30
|
},
|
51
|
-
type: '
|
31
|
+
type: 'container',
|
52
32
|
input: true,
|
53
|
-
|
33
|
+
components: [
|
34
|
+
{
|
35
|
+
label: 'Select Boxes',
|
36
|
+
optionsLabelPosition: 'right',
|
37
|
+
tableView: false,
|
38
|
+
defaultValue: {
|
39
|
+
'1': false,
|
40
|
+
'2': false,
|
41
|
+
'3': false
|
42
|
+
},
|
43
|
+
values: [
|
44
|
+
{
|
45
|
+
label: '1',
|
46
|
+
value: '1',
|
47
|
+
shortcut: ''
|
48
|
+
},
|
49
|
+
{
|
50
|
+
label: '2',
|
51
|
+
value: '2',
|
52
|
+
shortcut: ''
|
53
|
+
},
|
54
|
+
{
|
55
|
+
label: '3',
|
56
|
+
value: '3',
|
57
|
+
shortcut: ''
|
58
|
+
}
|
59
|
+
],
|
60
|
+
validate: {
|
61
|
+
minSelectedCount: 1
|
62
|
+
},
|
63
|
+
key: 'selectBoxes',
|
64
|
+
type: 'selectboxes',
|
65
|
+
input: true,
|
66
|
+
inputType: 'checkbox'
|
67
|
+
}
|
68
|
+
]
|
54
69
|
},
|
55
70
|
{
|
56
71
|
type: 'button',
|
@@ -0,0 +1,14 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
const label: string;
|
3
|
+
const dataSrc: string;
|
4
|
+
namespace data {
|
5
|
+
const url: string;
|
6
|
+
}
|
7
|
+
const valueProperty: string;
|
8
|
+
const template: string;
|
9
|
+
const key: string;
|
10
|
+
const type: string;
|
11
|
+
const input: boolean;
|
12
|
+
const inputType: string;
|
13
|
+
}
|
14
|
+
export default _default;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export default {
|
2
|
+
label: 'Select Boxes',
|
3
|
+
dataSrc: 'url',
|
4
|
+
data: {
|
5
|
+
url: 'https://cdn.rawgit.com/mshafrir/2646763/raw/states_titlecase.json'
|
6
|
+
},
|
7
|
+
valueProperty: 'abbreviation',
|
8
|
+
template: '<span>{{ item.name }}</span>',
|
9
|
+
key: 'selectBoxes',
|
10
|
+
type: 'selectboxes',
|
11
|
+
input: true,
|
12
|
+
inputType: 'checkbox',
|
13
|
+
};
|
@@ -17,7 +17,7 @@ export default class SignatureComponent extends Input {
|
|
17
17
|
checkSize(force: any, scale: any): void;
|
18
18
|
signaturePad: SignaturePad | null | undefined;
|
19
19
|
observer: _ResizeObserver | null | undefined;
|
20
|
-
getValueAsString(value: any): "Yes" | "No";
|
20
|
+
getValueAsString(value: any): "" | "Yes" | "No";
|
21
21
|
focus(): void;
|
22
22
|
setDataToSigaturePad(): void;
|
23
23
|
}
|
@@ -28,11 +28,16 @@ export default class SignatureComponent extends Input {
|
|
28
28
|
schema: SignatureComponent.schema()
|
29
29
|
};
|
30
30
|
}
|
31
|
+
static get serverConditionSettings() {
|
32
|
+
return {
|
33
|
+
...super.serverConditionSettings,
|
34
|
+
operators: ['isEmpty', 'isNotEmpty'],
|
35
|
+
};
|
36
|
+
}
|
31
37
|
init() {
|
32
38
|
super.init();
|
33
39
|
this.currentWidth = 0;
|
34
40
|
this.scale = 1;
|
35
|
-
this.ratio = 1;
|
36
41
|
if (!this.component.width) {
|
37
42
|
this.component.width = '100%';
|
38
43
|
}
|
@@ -129,9 +134,9 @@ export default class SignatureComponent extends Input {
|
|
129
134
|
this.scale = force ? scale : this.scale;
|
130
135
|
this.currentWidth = this.refs.padBody.offsetWidth;
|
131
136
|
const width = this.currentWidth * this.scale;
|
132
|
-
this.refs.canvas.width = width;
|
133
137
|
const height = this.ratio ? width / this.ratio : this.refs.padBody.offsetHeight * this.scale;
|
134
|
-
const maxHeight = this.refs.padBody.offsetHeight * this.scale;
|
138
|
+
const maxHeight = this.ratio ? height : this.refs.padBody.offsetHeight * this.scale;
|
139
|
+
this.refs.canvas.width = width;
|
135
140
|
this.refs.canvas.height = height > maxHeight ? maxHeight : height;
|
136
141
|
this.refs.canvas.style.maxWidth = `${this.currentWidth * this.scale}px`;
|
137
142
|
this.refs.canvas.style.maxHeight = `${maxHeight}px`;
|
@@ -225,6 +230,9 @@ export default class SignatureComponent extends Input {
|
|
225
230
|
super.detach();
|
226
231
|
}
|
227
232
|
getValueAsString(value) {
|
233
|
+
if (_.isUndefined(value) && this.inDataTable) {
|
234
|
+
return '';
|
235
|
+
}
|
228
236
|
return value ? 'Yes' : 'No';
|
229
237
|
}
|
230
238
|
focus() {
|