@formio/js 5.1.0-dev.6048.569bfc1 → 5.1.0-dev.6049.6110ca0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +99 -310
- package/README.md +7 -0
- package/dist/formio.builder.css +1 -0
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.form.css +1 -0
- package/dist/formio.form.js +658 -669
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -1
- package/dist/formio.full.css +1 -0
- package/dist/formio.full.js +685 -696
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -1
- package/dist/formio.js +90 -68
- package/dist/formio.min.js +1 -1
- package/dist/formio.utils.js +103 -81
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +3 -1
- package/lib/cjs/Element.d.ts +2 -1
- package/lib/cjs/Element.js +18 -39
- package/lib/cjs/EventEmitter.js +2 -25
- package/lib/cjs/Form.js +2 -25
- package/lib/cjs/PDF.js +1 -1
- package/lib/cjs/PDFBuilder.d.ts +1 -0
- package/lib/cjs/PDFBuilder.js +10 -11
- package/lib/cjs/Webform.d.ts +2 -2
- package/lib/cjs/Webform.js +14 -15
- package/lib/cjs/WebformBuilder.d.ts +2 -1
- package/lib/cjs/WebformBuilder.js +62 -20
- package/lib/cjs/Wizard.d.ts +2 -2
- package/lib/cjs/Wizard.js +40 -26
- package/lib/cjs/WizardBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +44 -13
- package/lib/cjs/components/_classes/component/Component.js +156 -95
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +19 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/cjs/components/_classes/input/Input.js +1 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +3 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.js +15 -8
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -12
- package/lib/cjs/components/address/Address.d.ts +8 -0
- package/lib/cjs/components/address/Address.js +32 -9
- package/lib/cjs/components/address/editForm/Address.edit.display.d.ts +4 -0
- package/lib/cjs/components/address/editForm/Address.edit.display.js +1 -0
- package/lib/cjs/components/address/editForm/Address.edit.provider.js +8 -8
- package/lib/cjs/components/alert/Alert.js +1 -1
- package/lib/cjs/components/button/Button.d.ts +1 -1
- package/lib/cjs/components/button/Button.js +7 -11
- package/lib/cjs/components/checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/container/Container.js +1 -1
- package/lib/cjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/cjs/components/currency/Currency.js +1 -1
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +12 -0
- package/lib/cjs/components/datagrid/DataGrid.js +5 -1
- package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/cjs/components/datetime/DateTime.js +15 -13
- package/lib/cjs/components/datetime/editForm/DateTime.edit.validation.d.ts +66 -15
- package/lib/cjs/components/datetime/editForm/DateTime.edit.validation.js +68 -47
- package/lib/cjs/components/day/Day.js +2 -2
- package/lib/cjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/cjs/components/editgrid/EditGrid.js +4 -2
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/cjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/cjs/components/file/File.js +6 -2
- package/lib/cjs/components/file/editForm/File.edit.file.d.ts +13 -0
- package/lib/cjs/components/file/editForm/File.edit.file.js +1 -0
- package/lib/cjs/components/form/Form.d.ts +0 -1
- package/lib/cjs/components/form/Form.js +31 -23
- package/lib/cjs/components/form/editForm/Form.edit.form.js +4 -3
- package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/cjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/cjs/components/number/Number.js +1 -1
- package/lib/cjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/cjs/components/panel/Panel.js +1 -1
- package/lib/cjs/components/password/editForm/Password.edit.display.js +13 -1
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +9 -1
- package/lib/cjs/components/radio/Radio.d.ts +8 -0
- package/lib/cjs/components/radio/Radio.js +16 -6
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/cjs/components/select/Select.d.ts +1 -0
- package/lib/cjs/components/select/Select.js +21 -5
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +68 -110
- package/lib/cjs/components/select/editForm/Select.edit.data.js +2 -37
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +6 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +7 -1
- package/lib/cjs/components/signature/Signature.js +1 -1
- package/lib/cjs/components/survey/Survey.js +2 -2
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/cjs/components/tags/Tags.js +1 -1
- package/lib/cjs/components/textarea/TextArea.js +10 -2
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/cjs/components/textfield/TextField.js +9 -32
- package/lib/cjs/components/time/Time.js +1 -1
- package/lib/cjs/components/unknown/Unknown.form.d.ts +2 -1
- package/lib/cjs/components/unknown/Unknown.form.js +13 -9
- package/lib/cjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/cjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/cjs/formio.form.js +5 -5
- package/lib/cjs/providers/storage/uploadAdapter.js +8 -6
- package/lib/cjs/translations/en.d.ts +1 -234
- package/lib/cjs/translations/en.js +4 -2
- package/lib/cjs/utils/Evaluator.d.ts +20 -6
- package/lib/cjs/utils/Evaluator.js +38 -15
- package/lib/cjs/utils/builder.js +5 -5
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/index.d.ts +169 -2
- package/lib/cjs/utils/index.js +22 -2
- package/lib/cjs/utils/utils.d.ts +31 -37
- package/lib/cjs/utils/utils.js +80 -135
- package/lib/cjs/widgets/CalendarWidget.d.ts +1 -8
- package/lib/cjs/widgets/CalendarWidget.js +19 -40
- package/lib/mjs/Element.d.ts +2 -1
- package/lib/mjs/Element.js +11 -9
- package/lib/mjs/EventEmitter.js +2 -2
- package/lib/mjs/Form.js +1 -1
- package/lib/mjs/PDF.js +1 -1
- package/lib/mjs/PDFBuilder.d.ts +1 -0
- package/lib/mjs/PDFBuilder.js +9 -10
- package/lib/mjs/Webform.d.ts +2 -2
- package/lib/mjs/Webform.js +12 -13
- package/lib/mjs/WebformBuilder.d.ts +2 -1
- package/lib/mjs/WebformBuilder.js +53 -13
- package/lib/mjs/Wizard.d.ts +2 -2
- package/lib/mjs/Wizard.js +38 -24
- package/lib/mjs/WizardBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +44 -13
- package/lib/mjs/components/_classes/component/Component.js +129 -45
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +19 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -1
- package/lib/mjs/components/_classes/input/Input.js +1 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +3 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.js +15 -8
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -12
- package/lib/mjs/components/address/Address.d.ts +8 -0
- package/lib/mjs/components/address/Address.js +32 -9
- package/lib/mjs/components/address/editForm/Address.edit.display.d.ts +4 -0
- package/lib/mjs/components/address/editForm/Address.edit.display.js +1 -0
- package/lib/mjs/components/address/editForm/Address.edit.provider.js +8 -8
- package/lib/mjs/components/alert/Alert.js +1 -1
- package/lib/mjs/components/button/Button.d.ts +1 -1
- package/lib/mjs/components/button/Button.js +7 -10
- package/lib/mjs/components/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/container/Container.js +1 -1
- package/lib/mjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/mjs/components/currency/Currency.js +1 -1
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +12 -0
- package/lib/mjs/components/datagrid/DataGrid.js +5 -1
- package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
- package/lib/mjs/components/datetime/DateTime.js +15 -13
- package/lib/mjs/components/datetime/editForm/DateTime.edit.validation.d.ts +66 -15
- package/lib/mjs/components/datetime/editForm/DateTime.edit.validation.js +68 -47
- package/lib/mjs/components/day/Day.js +2 -2
- package/lib/mjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/mjs/components/editgrid/EditGrid.js +4 -2
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/mjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/mjs/components/file/File.js +6 -2
- package/lib/mjs/components/file/editForm/File.edit.file.d.ts +13 -0
- package/lib/mjs/components/file/editForm/File.edit.file.js +1 -0
- package/lib/mjs/components/form/Form.d.ts +0 -1
- package/lib/mjs/components/form/Form.js +30 -23
- package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -2
- package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/mjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/mjs/components/number/Number.js +1 -1
- package/lib/mjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/mjs/components/panel/Panel.js +1 -1
- package/lib/mjs/components/password/editForm/Password.edit.display.js +13 -1
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +9 -1
- package/lib/mjs/components/radio/Radio.d.ts +8 -0
- package/lib/mjs/components/radio/Radio.js +16 -6
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
- package/lib/mjs/components/select/Select.d.ts +1 -0
- package/lib/mjs/components/select/Select.js +21 -5
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +68 -110
- package/lib/mjs/components/select/editForm/Select.edit.data.js +2 -37
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +6 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +7 -1
- package/lib/mjs/components/signature/Signature.js +1 -1
- package/lib/mjs/components/survey/Survey.js +2 -2
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/mjs/components/tags/Tags.js +1 -1
- package/lib/mjs/components/textarea/TextArea.js +10 -2
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/mjs/components/textfield/TextField.js +3 -3
- package/lib/mjs/components/time/Time.js +1 -1
- package/lib/mjs/components/unknown/Unknown.form.d.ts +2 -1
- package/lib/mjs/components/unknown/Unknown.form.js +13 -9
- package/lib/mjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/mjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/mjs/formio.form.js +3 -3
- package/lib/mjs/providers/storage/uploadAdapter.js +8 -6
- package/lib/mjs/translations/en.d.ts +1 -234
- package/lib/mjs/translations/en.js +6 -47
- package/lib/mjs/utils/Evaluator.d.ts +20 -6
- package/lib/mjs/utils/Evaluator.js +31 -13
- package/lib/mjs/utils/builder.js +1 -1
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/index.d.ts +169 -2
- package/lib/mjs/utils/index.js +18 -1
- package/lib/mjs/utils/utils.d.ts +31 -37
- package/lib/mjs/utils/utils.js +72 -109
- package/lib/mjs/widgets/CalendarWidget.d.ts +1 -8
- package/lib/mjs/widgets/CalendarWidget.js +19 -40
- package/package.json +8 -6
- package/lib/cjs/i18n.d.ts +0 -13
- package/lib/cjs/i18n.js +0 -19
- package/lib/cjs/utils/i18n.d.ts +0 -19
- package/lib/cjs/utils/i18n.js +0 -120
- package/lib/mjs/i18n.d.ts +0 -13
- package/lib/mjs/i18n.js +0 -14
- package/lib/mjs/utils/i18n.d.ts +0 -19
- package/lib/mjs/utils/i18n.js +0 -112
@@ -11,6 +11,19 @@ const Components_1 = __importDefault(require("../../Components"));
|
|
11
11
|
*/
|
12
12
|
function default_1(...extend) {
|
13
13
|
return Components_1.default.baseEditForm([
|
14
|
+
{
|
15
|
+
key: 'display',
|
16
|
+
components: [
|
17
|
+
{
|
18
|
+
key: 'labelWidth',
|
19
|
+
ignore: true
|
20
|
+
},
|
21
|
+
{
|
22
|
+
key: 'labelMargin',
|
23
|
+
ignore: true
|
24
|
+
}
|
25
|
+
]
|
26
|
+
},
|
14
27
|
{
|
15
28
|
key: 'data',
|
16
29
|
ignore: true
|
@@ -7,7 +7,7 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
7
7
|
const Field_1 = __importDefault(require("../field/Field"));
|
8
8
|
const Components_1 = __importDefault(require("../../Components"));
|
9
9
|
'';
|
10
|
-
const utils_1 = require("../../../utils
|
10
|
+
const utils_1 = __importDefault(require("../../../utils"));
|
11
11
|
const process_1 = require("@formio/core/process");
|
12
12
|
/**
|
13
13
|
* NestedComponent class.
|
@@ -209,7 +209,7 @@ class NestedComponent extends Field_1.default {
|
|
209
209
|
set rowIndex(value) {
|
210
210
|
var _a, _b;
|
211
211
|
this._rowIndex = value;
|
212
|
-
this.paths =
|
212
|
+
this.paths = utils_1.default.getComponentPaths(this.component, (_a = this.parent) === null || _a === void 0 ? void 0 : _a.component, Object.assign(Object.assign({}, (((_b = this.parent) === null || _b === void 0 ? void 0 : _b.paths) || {})), { dataIndex: value }));
|
213
213
|
this.eachComponent((component) => {
|
214
214
|
component.rowIndex = value;
|
215
215
|
});
|
@@ -311,7 +311,7 @@ class NestedComponent extends Field_1.default {
|
|
311
311
|
*/
|
312
312
|
getComponent(path) {
|
313
313
|
var _a;
|
314
|
-
path =
|
314
|
+
path = utils_1.default.getStringFromComponentPath(path);
|
315
315
|
const matches = {
|
316
316
|
path: undefined,
|
317
317
|
fullPath: undefined,
|
@@ -324,7 +324,7 @@ class NestedComponent extends Field_1.default {
|
|
324
324
|
this.everyComponent((component) => {
|
325
325
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
326
326
|
// All searches are relative to this component so replace this path from the child paths.
|
327
|
-
|
327
|
+
utils_1.default.componentMatches(component.component, {
|
328
328
|
path: (_b = (_a = component.paths) === null || _a === void 0 ? void 0 : _a.path) === null || _b === void 0 ? void 0 : _b.replace(new RegExp(`^${(_c = this.paths) === null || _c === void 0 ? void 0 : _c.path}\\.?`), ''),
|
329
329
|
fullPath: (_e = (_d = component.paths) === null || _d === void 0 ? void 0 : _d.fullPath) === null || _e === void 0 ? void 0 : _e.replace(new RegExp(`^${(_f = this.paths) === null || _f === void 0 ? void 0 : _f.fullPath}\\.?`), ''),
|
330
330
|
localPath: (_h = (_g = component.paths) === null || _g === void 0 ? void 0 : _g.localPath) === null || _h === void 0 ? void 0 : _h.replace(new RegExp(`^${(_j = this.paths) === null || _j === void 0 ? void 0 : _j.localPath}\\.?`), ''),
|
@@ -336,7 +336,7 @@ class NestedComponent extends Field_1.default {
|
|
336
336
|
return match;
|
337
337
|
});
|
338
338
|
});
|
339
|
-
return (_a =
|
339
|
+
return (_a = utils_1.default.getBestMatch(matches)) === null || _a === void 0 ? void 0 : _a.instance;
|
340
340
|
}
|
341
341
|
/**
|
342
342
|
* Return a component provided the Id of the component.
|
@@ -378,7 +378,7 @@ class NestedComponent extends Field_1.default {
|
|
378
378
|
options.localRoot = this.localRoot;
|
379
379
|
options.skipInit = true;
|
380
380
|
if (!(options.display === 'pdf' && this.builderMode)) {
|
381
|
-
component.id =
|
381
|
+
component.id = utils_1.default.getRandomComponentId();
|
382
382
|
}
|
383
383
|
const comp = Components_1.default.create(component, options, data, true);
|
384
384
|
comp.init();
|
@@ -664,7 +664,7 @@ class NestedComponent extends Field_1.default {
|
|
664
664
|
validationProcessor({ scope, data, row, instance, paths }, flags) {
|
665
665
|
var _a;
|
666
666
|
const { dirty } = flags;
|
667
|
-
if (this.root.
|
667
|
+
if (this.root.hasSubWizards && this.page !== this.root.page) {
|
668
668
|
instance = ((_a = this.componentsMap) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(paths.dataPath))
|
669
669
|
? this.componentsMap[paths.dataPath]
|
670
670
|
: this.getComponent(paths.dataPath);
|
@@ -821,7 +821,7 @@ class NestedComponent extends Field_1.default {
|
|
821
821
|
else if (value && component.hasValue(value)) {
|
822
822
|
return component.setValue(lodash_1.default.get(value, component.key), flags);
|
823
823
|
}
|
824
|
-
else if ((!this.rootPristine || component.visible) && component.shouldAddDefaultValue) {
|
824
|
+
else if ((!this.rootPristine || component.visible) && (flags.resetValue || component.shouldAddDefaultValue)) {
|
825
825
|
flags.noValidate = !flags.dirty;
|
826
826
|
flags.resetValue = true;
|
827
827
|
return component.setValue(component.defaultValue, flags);
|
@@ -831,6 +831,13 @@ class NestedComponent extends Field_1.default {
|
|
831
831
|
if (!value) {
|
832
832
|
return false;
|
833
833
|
}
|
834
|
+
// If the value is equal to the empty value, then this means we need to reset the values.
|
835
|
+
if (lodash_1.default.isEqual(value, this.emptyValue)) {
|
836
|
+
// TO-DO: For a future major release, we need to investigate removing the need for the
|
837
|
+
// "resetValue" flag. This seems like a hack that is no longer necessary and the renderer
|
838
|
+
// may behave more deterministically without it.
|
839
|
+
flags.resetValue = true;
|
840
|
+
}
|
834
841
|
return this.getComponents().reduce((changed, component) => {
|
835
842
|
return this.setNestedValue(component, value, flags, changed) || changed;
|
836
843
|
}, false);
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const utils_1 = require("@formio/core/utils");
|
8
8
|
const { getComponentPaths } = utils_1.Utils;
|
9
|
-
const utils_2 = require("../../../utils
|
9
|
+
const utils_2 = require("../../../utils");
|
10
10
|
const Component_1 = __importDefault(require("../component/Component"));
|
11
11
|
const NestedDataComponent_1 = __importDefault(require("../nesteddata/NestedDataComponent"));
|
12
12
|
class NestedArrayComponent extends NestedDataComponent_1.default {
|
@@ -3,11 +3,9 @@ export default class NestedDataComponent extends NestedComponent {
|
|
3
3
|
hasChanged(newValue: any, oldValue: any): boolean;
|
4
4
|
get allowData(): boolean;
|
5
5
|
get emptyValue(): {};
|
6
|
-
get shouldAddDefaultValue(): boolean;
|
7
6
|
componentContext(): any;
|
8
7
|
getValueAsString(value: any, options: any): string;
|
9
8
|
getDataValueAsTable(value: any, options: any): string;
|
10
|
-
everyComponent(fn: any, options?: {}): void;
|
11
9
|
/**
|
12
10
|
* Get the value of this component.
|
13
11
|
* @returns {any} - Return the value of this component.
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Component_1 = __importDefault(require("../component/Component"));
|
7
7
|
const NestedComponent_1 = __importDefault(require("../nested/NestedComponent"));
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
9
|
-
const utils_1 = require("../../../utils
|
9
|
+
const utils_1 = require("../../../utils");
|
10
10
|
class NestedDataComponent extends NestedComponent_1.default {
|
11
11
|
hasChanged(newValue, oldValue) {
|
12
12
|
// If we do not have a value and are getting set to anything other than undefined or null, then we changed.
|
@@ -88,17 +88,6 @@ class NestedDataComponent extends NestedComponent_1.default {
|
|
88
88
|
`);
|
89
89
|
return result;
|
90
90
|
}
|
91
|
-
everyComponent(fn, options = {}) {
|
92
|
-
if (options === null || options === void 0 ? void 0 : options.email) {
|
93
|
-
if (options.fromRoot) {
|
94
|
-
delete options.fromRoot;
|
95
|
-
}
|
96
|
-
else {
|
97
|
-
return;
|
98
|
-
}
|
99
|
-
}
|
100
|
-
return super.everyComponent(fn, options);
|
101
|
-
}
|
102
91
|
/**
|
103
92
|
* Get the value of this component.
|
104
93
|
* @returns {any} - Return the value of this component.
|
@@ -43,6 +43,14 @@ export default class AddressComponent extends ContainerComponent {
|
|
43
43
|
isValueInLegacyFormat(value: any): any;
|
44
44
|
normalizeValue(value: any): any;
|
45
45
|
get modeSwitcher(): any;
|
46
|
+
get providerOptions(): {
|
47
|
+
params: any;
|
48
|
+
url: any;
|
49
|
+
queryProperty: any;
|
50
|
+
responseProperty: any;
|
51
|
+
displayValueProperty: any;
|
52
|
+
autocompleteOptions: any;
|
53
|
+
};
|
46
54
|
get removeValueIcon(): any;
|
47
55
|
get searchInput(): any;
|
48
56
|
get addRowButton(): any;
|
@@ -11,7 +11,7 @@ const GoogleAddressProvider_1 = require("../../providers/address/GoogleAddressPr
|
|
11
11
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
12
12
|
const NestedComponent_1 = __importDefault(require("../_classes/nested/NestedComponent"));
|
13
13
|
const Container_1 = __importDefault(require("../container/Container"));
|
14
|
-
const utils_1 = require("../../utils
|
14
|
+
const utils_1 = require("../../utils");
|
15
15
|
exports.AddressComponentMode = {
|
16
16
|
Autocomplete: 'autocomplete',
|
17
17
|
Manual: 'manual',
|
@@ -26,7 +26,6 @@ class AddressComponent extends Container_1.default {
|
|
26
26
|
key: 'address',
|
27
27
|
switchToManualModeLabel: 'Can\'t find address? Switch to manual mode.',
|
28
28
|
provider: '',
|
29
|
-
providerOptions: {},
|
30
29
|
manualModeViewString: '',
|
31
30
|
hideLabel: false,
|
32
31
|
disableClearIcon: false,
|
@@ -116,20 +115,33 @@ class AddressComponent extends Container_1.default {
|
|
116
115
|
NestedComponent_1.default.prototype.addComponents.call(this, this.manualMode ? this.address : {});
|
117
116
|
}
|
118
117
|
Field_1.default.prototype.init.call(this);
|
118
|
+
// Added for backwards compatibility
|
119
|
+
if (this.component.providerOptions) {
|
120
|
+
const { params, url, queryProperty, responseProperty, displayValueProperty } = this.component.providerOptions;
|
121
|
+
const key = params === null || params === void 0 ? void 0 : params.key;
|
122
|
+
const autocompleteOptions = params === null || params === void 0 ? void 0 : params.autocompleteOptions;
|
123
|
+
delete this.component.providerOptions;
|
124
|
+
this.component.url = url;
|
125
|
+
this.component.queryProperty = queryProperty;
|
126
|
+
this.component.responseProperty = responseProperty;
|
127
|
+
this.component.displayValueProperty = displayValueProperty;
|
128
|
+
this.component.apiKey = key;
|
129
|
+
this.component.autocompleteOptions = autocompleteOptions;
|
130
|
+
}
|
131
|
+
let provider = this.component.provider;
|
132
|
+
const providerOptions = this.providerOptions;
|
133
|
+
const map = this.component.map;
|
119
134
|
if (!this.builderMode) {
|
120
|
-
if (
|
121
|
-
const { provider, providerOptions, } = this.component;
|
135
|
+
if (provider) {
|
122
136
|
if (lodash_1.default.get(providerOptions, 'params.subscriptionKey')) {
|
123
137
|
lodash_1.default.set(providerOptions, "params['subscription-key']", lodash_1.default.get(providerOptions, 'params.subscriptionKey'));
|
124
138
|
lodash_1.default.unset(providerOptions, 'params.subscriptionKey');
|
125
139
|
}
|
126
140
|
this.provider = this.initializeProvider(provider, providerOptions);
|
127
141
|
}
|
128
|
-
else if (
|
142
|
+
else if (map) {
|
129
143
|
// Fallback to legacy version where Google Maps was the only provider.
|
130
|
-
this.component.provider = GoogleAddressProvider_1.GoogleAddressProvider.name;
|
131
|
-
this.component.providerOptions = this.component.providerOptions || {};
|
132
|
-
const { map, provider, providerOptions, } = this.component;
|
144
|
+
provider = this.component.provider = GoogleAddressProvider_1.GoogleAddressProvider.name;
|
133
145
|
const { key, region, } = map;
|
134
146
|
if (key) {
|
135
147
|
lodash_1.default.set(providerOptions, 'params.key', key);
|
@@ -262,6 +274,16 @@ class AddressComponent extends Container_1.default {
|
|
262
274
|
? (this.refs[AddressComponent.modeSwitcherRef] || null)
|
263
275
|
: null;
|
264
276
|
}
|
277
|
+
get providerOptions() {
|
278
|
+
return {
|
279
|
+
params: Object.assign({ subscriptionKey: this.component.subscriptionKey, key: this.component.apiKey }, this.component.params),
|
280
|
+
url: this.component.url,
|
281
|
+
queryProperty: this.component.queryProperty,
|
282
|
+
responseProperty: this.component.responseProperty,
|
283
|
+
displayValueProperty: this.component.displayValueProperty,
|
284
|
+
autocompleteOptions: this.component.autocompleteOptions
|
285
|
+
};
|
286
|
+
}
|
265
287
|
get removeValueIcon() {
|
266
288
|
return this.refs
|
267
289
|
? (this.refs[AddressComponent.removeValueIconRef] || null)
|
@@ -375,7 +397,8 @@ class AddressComponent extends Container_1.default {
|
|
375
397
|
const result = ((this.builderMode || this.manualMode) ? super.attach : Field_1.default.prototype.attach).call(this, element);
|
376
398
|
if (!this.builderMode) {
|
377
399
|
if (!this.provider && this.component.provider) {
|
378
|
-
const
|
400
|
+
const provider = this.component.provider;
|
401
|
+
const providerOptions = this.providerOptions;
|
379
402
|
this.provider = this.initializeProvider(provider, providerOptions);
|
380
403
|
}
|
381
404
|
}
|
@@ -8,6 +8,7 @@ declare const _default: ({
|
|
8
8
|
customConditional: ({ data }: {
|
9
9
|
data: any;
|
10
10
|
}) => boolean;
|
11
|
+
defaultValue?: undefined;
|
11
12
|
placeholder?: undefined;
|
12
13
|
validate?: undefined;
|
13
14
|
} | {
|
@@ -15,6 +16,7 @@ declare const _default: ({
|
|
15
16
|
type: string;
|
16
17
|
input: boolean;
|
17
18
|
key: string;
|
19
|
+
defaultValue: string;
|
18
20
|
label: string;
|
19
21
|
placeholder: string;
|
20
22
|
tooltip: string;
|
@@ -32,6 +34,7 @@ declare const _default: ({
|
|
32
34
|
label: string;
|
33
35
|
tooltip: string;
|
34
36
|
customConditional?: undefined;
|
37
|
+
defaultValue?: undefined;
|
35
38
|
placeholder?: undefined;
|
36
39
|
validate?: undefined;
|
37
40
|
} | {
|
@@ -45,6 +48,7 @@ declare const _default: ({
|
|
45
48
|
customConditional: ({ data }: {
|
46
49
|
data: any;
|
47
50
|
}) => any;
|
51
|
+
defaultValue?: undefined;
|
48
52
|
validate?: undefined;
|
49
53
|
})[];
|
50
54
|
export default _default;
|
@@ -15,6 +15,7 @@ exports.default = [
|
|
15
15
|
type: 'textfield',
|
16
16
|
input: true,
|
17
17
|
key: 'switchToManualModeLabel',
|
18
|
+
defaultValue: 'Can\'t find address? Switch to manual mode.',
|
18
19
|
label: 'Switch To Manual Mode Label',
|
19
20
|
placeholder: 'Switch To Manual Mode Label',
|
20
21
|
tooltip: 'The label for the checkbox used to switch to manual mode.',
|
@@ -31,7 +31,7 @@ exports.default = [
|
|
31
31
|
{
|
32
32
|
type: 'textfield',
|
33
33
|
input: true,
|
34
|
-
key: "
|
34
|
+
key: "subscriptionKey",
|
35
35
|
label: 'Subscription Key',
|
36
36
|
placeholder: 'Enter Subscription Key',
|
37
37
|
weight: 10,
|
@@ -46,7 +46,7 @@ exports.default = [
|
|
46
46
|
{
|
47
47
|
type: 'textfield',
|
48
48
|
input: true,
|
49
|
-
key: '
|
49
|
+
key: 'url',
|
50
50
|
label: 'Url',
|
51
51
|
placeholder: 'Enter Url',
|
52
52
|
weight: 10,
|
@@ -61,7 +61,7 @@ exports.default = [
|
|
61
61
|
{
|
62
62
|
type: 'textfield',
|
63
63
|
input: true,
|
64
|
-
key: '
|
64
|
+
key: 'queryProperty',
|
65
65
|
label: 'Query Property',
|
66
66
|
defaultValue: 'query',
|
67
67
|
placeholder: 'Enter Query Property',
|
@@ -74,7 +74,7 @@ exports.default = [
|
|
74
74
|
{
|
75
75
|
type: 'textfield',
|
76
76
|
input: true,
|
77
|
-
key: '
|
77
|
+
key: 'responseProperty',
|
78
78
|
label: 'Response Property',
|
79
79
|
placeholder: 'Enter Response Property',
|
80
80
|
weight: 30,
|
@@ -86,7 +86,7 @@ exports.default = [
|
|
86
86
|
{
|
87
87
|
type: 'textfield',
|
88
88
|
input: true,
|
89
|
-
key: '
|
89
|
+
key: 'displayValueProperty',
|
90
90
|
label: 'Display Value Property',
|
91
91
|
placeholder: 'Display Value Property',
|
92
92
|
weight: 40,
|
@@ -98,7 +98,7 @@ exports.default = [
|
|
98
98
|
{
|
99
99
|
type: 'textarea',
|
100
100
|
input: true,
|
101
|
-
key: '
|
101
|
+
key: 'params',
|
102
102
|
label: 'Params',
|
103
103
|
placeholder: '{ ... }',
|
104
104
|
weight: 50,
|
@@ -113,7 +113,7 @@ exports.default = [
|
|
113
113
|
{
|
114
114
|
type: 'textfield',
|
115
115
|
input: true,
|
116
|
-
key: '
|
116
|
+
key: 'apiKey',
|
117
117
|
label: 'API Key',
|
118
118
|
placeholder: 'Enter API Key',
|
119
119
|
weight: 10,
|
@@ -128,7 +128,7 @@ exports.default = [
|
|
128
128
|
{
|
129
129
|
type: 'textarea',
|
130
130
|
input: true,
|
131
|
-
key: '
|
131
|
+
key: 'autocompleteOptions',
|
132
132
|
label: 'Provider options',
|
133
133
|
placeholder: 'Enter provider options as JSON object',
|
134
134
|
defaultValue: {},
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
|
-
const utils_1 = require("../../utils
|
7
|
+
const utils_1 = require("../../utils");
|
8
8
|
class Alert {
|
9
9
|
constructor(container, component) {
|
10
10
|
this.container = container;
|
@@ -9,7 +9,7 @@ export default class ButtonComponent extends Field {
|
|
9
9
|
};
|
10
10
|
static savedValueTypes(schema: any): string[];
|
11
11
|
constructor(component: any, options: any, data: any);
|
12
|
-
filesUploading:
|
12
|
+
filesUploading: number;
|
13
13
|
get inputInfo(): any;
|
14
14
|
get labelInfo(): {
|
15
15
|
hidden: boolean;
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
8
8
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
9
|
-
const utils_1 = require("../../utils
|
9
|
+
const utils_1 = require("../../utils");
|
10
10
|
class ButtonComponent extends Field_1.default {
|
11
11
|
static schema(...extend) {
|
12
12
|
return Input_1.default.schema({
|
@@ -39,7 +39,7 @@ class ButtonComponent extends Field_1.default {
|
|
39
39
|
}
|
40
40
|
constructor(component, options, data) {
|
41
41
|
super(component, options, data);
|
42
|
-
this.filesUploading =
|
42
|
+
this.filesUploading = 0;
|
43
43
|
}
|
44
44
|
get defaultSchema() {
|
45
45
|
return ButtonComponent.schema();
|
@@ -147,16 +147,13 @@ class ButtonComponent extends Field_1.default {
|
|
147
147
|
this.addClass(this.refs.buttonMessageContainer, 'has-error');
|
148
148
|
this.setContent(this.refs.buttonMessage, resultMessage);
|
149
149
|
}, true);
|
150
|
-
this.on('fileUploadingStart', (
|
151
|
-
this.filesUploading
|
150
|
+
this.on('fileUploadingStart', () => {
|
151
|
+
this.filesUploading++;
|
152
152
|
this.disabled = true;
|
153
153
|
this.setDisabled(this.refs.button, this.disabled);
|
154
154
|
}, true);
|
155
|
-
this.on('fileUploadingEnd', (
|
156
|
-
|
157
|
-
if (index !== -1) {
|
158
|
-
this.filesUploading.splice(index, 1);
|
159
|
-
}
|
155
|
+
this.on('fileUploadingEnd', () => {
|
156
|
+
this.filesUploading--;
|
160
157
|
this.disabled = this.shouldDisabled ? true : false;
|
161
158
|
this.setDisabled(this.refs.button, this.disabled);
|
162
159
|
}, true);
|
@@ -252,8 +249,7 @@ class ButtonComponent extends Field_1.default {
|
|
252
249
|
}
|
253
250
|
}
|
254
251
|
get shouldDisabled() {
|
255
|
-
|
256
|
-
return super.shouldDisabled || !!((_a = this.filesUploading) === null || _a === void 0 ? void 0 : _a.length) || this.isDisabledOnInvalid;
|
252
|
+
return super.shouldDisabled || this.filesUploading > 0 || this.isDisabledOnInvalid;
|
257
253
|
}
|
258
254
|
attach(element) {
|
259
255
|
this.loadRefs(element, {
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
|
-
const utils_1 = require("../../utils
|
7
|
+
const utils_1 = require("../../utils");
|
8
8
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
9
9
|
class CheckBoxComponent extends Field_1.default {
|
10
10
|
static schema(...extend) {
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
|
-
const utils_1 = require("../../utils
|
7
|
+
const utils_1 = require("../../utils");
|
8
8
|
const Component_1 = __importDefault(require("../_classes/component/Component"));
|
9
9
|
const Field_1 = __importDefault(require("../_classes/field/Field"));
|
10
10
|
const NestedDataComponent_1 = __importDefault(require("../_classes/nesteddata/NestedDataComponent"));
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const text_mask_addons_1 = require("@formio/text-mask-addons");
|
7
7
|
const vanilla_text_mask_1 = require("@formio/vanilla-text-mask");
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
9
|
-
const utils_1 = require("../../utils
|
9
|
+
const utils_1 = require("../../utils");
|
10
10
|
const Number_1 = __importDefault(require("../number/Number"));
|
11
11
|
class CurrencyComponent extends Number_1.default {
|
12
12
|
static schema(...extend) {
|
@@ -9,6 +9,18 @@ exports.default = [
|
|
9
9
|
key: 'allowMultipleMasks',
|
10
10
|
ignore: true
|
11
11
|
},
|
12
|
+
{
|
13
|
+
key: 'inputMasks',
|
14
|
+
ignore: true
|
15
|
+
},
|
16
|
+
{
|
17
|
+
key: 'widget.type',
|
18
|
+
ignore: true
|
19
|
+
},
|
20
|
+
{
|
21
|
+
key: 'widget',
|
22
|
+
ignore: true
|
23
|
+
},
|
12
24
|
{
|
13
25
|
key: 'showWordCount',
|
14
26
|
ignore: true
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const NestedArrayComponent_1 = __importDefault(require("../_classes/nestedarray/NestedArrayComponent"));
|
8
|
-
const utils_1 = require("../../utils
|
8
|
+
const utils_1 = require("../../utils");
|
9
9
|
class DataGridComponent extends NestedArrayComponent_1.default {
|
10
10
|
static schema(...extend) {
|
11
11
|
return NestedArrayComponent_1.default.schema({
|
@@ -492,6 +492,10 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
492
492
|
options.row = `${rowIndex}-${colIndex}`;
|
493
493
|
options.rowIndex = rowIndex;
|
494
494
|
options.onChange = (flags, changed, modified) => {
|
495
|
+
if (changed.component.type === 'form') {
|
496
|
+
const formComp = (0, utils_1.getComponent)(this.component.components, changed.component.key);
|
497
|
+
lodash_1.default.set(formComp, 'components', changed.component.components);
|
498
|
+
}
|
495
499
|
this.triggerChange({ modified });
|
496
500
|
};
|
497
501
|
let columnComponent;
|
@@ -17,7 +17,7 @@ export default class DateTimeComponent extends Input {
|
|
17
17
|
};
|
18
18
|
static savedValueTypes(schema: any): string[];
|
19
19
|
get emptyValue(): string;
|
20
|
-
get
|
20
|
+
get dayjsFormat(): string;
|
21
21
|
createWrapper(): boolean;
|
22
22
|
checkValidity(data: any, dirty: any, rowData: any): boolean;
|
23
23
|
getValueAsString(value: any, options: any): any;
|
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
|
-
const
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
8
8
|
const utils_1 = __importDefault(require("../../utils"));
|
9
|
-
const utils_2 = require("../../utils
|
9
|
+
const utils_2 = require("../../utils");
|
10
10
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
11
11
|
class DateTimeComponent extends Input_1.default {
|
12
12
|
static schema(...extend) {
|
@@ -123,8 +123,8 @@ class DateTimeComponent extends Input_1.default {
|
|
123
123
|
get emptyValue() {
|
124
124
|
return '';
|
125
125
|
}
|
126
|
-
get
|
127
|
-
return utils_1.default.
|
126
|
+
get dayjsFormat() {
|
127
|
+
return utils_1.default.convertFormatToDayjs(this.component.format);
|
128
128
|
}
|
129
129
|
isEmpty(value = this.dataValue) {
|
130
130
|
if (value && (value.toString() === 'Invalid Date')) {
|
@@ -133,12 +133,14 @@ class DateTimeComponent extends Input_1.default {
|
|
133
133
|
return super.isEmpty(value);
|
134
134
|
}
|
135
135
|
formatValue(input) {
|
136
|
-
|
137
|
-
|
136
|
+
if ((0, dayjs_1.default)(input).isValid()) {
|
137
|
+
return dayjs_1.default.utc(input).toISOString();
|
138
|
+
}
|
139
|
+
return input;
|
138
140
|
}
|
139
141
|
isEqual(valueA, valueB = this.dataValue) {
|
140
142
|
return (this.isEmpty(valueA) && this.isEmpty(valueB))
|
141
|
-
||
|
143
|
+
|| dayjs_1.default.utc(valueA).format(this.dayjsFormat) === dayjs_1.default.utc(valueB).format(this.dayjsFormat);
|
142
144
|
}
|
143
145
|
createWrapper() {
|
144
146
|
return false;
|
@@ -154,19 +156,19 @@ class DateTimeComponent extends Input_1.default {
|
|
154
156
|
return super.checkValidity(data, dirty, rowData);
|
155
157
|
}
|
156
158
|
getValueAsString(value, options) {
|
157
|
-
let format = utils_1.default.
|
158
|
-
format += format.match(/z$/) ? '' : ' z';
|
159
|
+
let format = utils_1.default.convertFormatToDayjs(this.component.format);
|
159
160
|
const timezone = this.timezone;
|
160
161
|
if (value && !this.attached && timezone) {
|
162
|
+
format += format.match(/z$/) ? '' : ' z';
|
161
163
|
if (Array.isArray(value) && this.component.multiple) {
|
162
|
-
return value.map(item => lodash_1.default.trim(utils_1.default.
|
164
|
+
return value.map(item => lodash_1.default.trim(utils_1.default.dayjsDate(item, format, timezone, options).format(format))).join(', ');
|
163
165
|
}
|
164
|
-
return lodash_1.default.trim(utils_1.default.
|
166
|
+
return lodash_1.default.trim(utils_1.default.dayjsDate(value, format, timezone, options).format(format));
|
165
167
|
}
|
166
168
|
if (Array.isArray(value) && this.component.multiple) {
|
167
|
-
return value.map(item => lodash_1.default.trim((0,
|
169
|
+
return value.map(item => lodash_1.default.trim((0, dayjs_1.default)(item).format(format))).join(', ');
|
168
170
|
}
|
169
|
-
return (value ? lodash_1.default.trim((0,
|
171
|
+
return (value ? lodash_1.default.trim((0, dayjs_1.default)(value).format(format)) : value) || '';
|
170
172
|
}
|
171
173
|
}
|
172
174
|
exports.default = DateTimeComponent;
|