@formio/js 5.1.0-rc.24 → 5.1.0-rc.26
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/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +12 -12
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +16 -16
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +2 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +1 -1
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/WebformBuilder.js +4 -0
- package/lib/cjs/Wizard.d.ts +1 -0
- package/lib/cjs/Wizard.js +23 -3
- package/lib/cjs/components/_classes/component/Component.d.ts +11 -1
- package/lib/cjs/components/_classes/component/Component.js +37 -11
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +0 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +8 -12
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +0 -11
- package/lib/cjs/components/address/Address.d.ts +9 -0
- package/lib/cjs/components/address/Address.js +18 -8
- package/lib/cjs/components/address/editForm/Address.edit.provider.js +8 -8
- package/lib/cjs/components/datagrid/DataGrid.js +0 -3
- package/lib/cjs/components/editgrid/EditGrid.js +0 -8
- 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.js +4 -0
- package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.js +3 -0
- package/lib/cjs/utils/utils.d.ts +0 -8
- package/lib/cjs/utils/utils.js +1 -22
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/WebformBuilder.js +4 -0
- package/lib/mjs/Wizard.d.ts +1 -0
- package/lib/mjs/Wizard.js +22 -2
- package/lib/mjs/components/_classes/component/Component.d.ts +11 -1
- package/lib/mjs/components/_classes/component/Component.js +38 -12
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +0 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +8 -12
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +0 -11
- package/lib/mjs/components/address/Address.d.ts +9 -0
- package/lib/mjs/components/address/Address.js +18 -8
- package/lib/mjs/components/address/editForm/Address.edit.provider.js +8 -8
- package/lib/mjs/components/datagrid/DataGrid.js +0 -3
- package/lib/mjs/components/editgrid/EditGrid.js +0 -7
- 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.js +4 -0
- package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.js +3 -0
- package/lib/mjs/utils/utils.d.ts +0 -8
- package/lib/mjs/utils/utils.js +0 -20
- package/package.json +2 -2
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
|
22
22
|
|
23
|
-
/*! formiojs v5.1.0-rc.
|
23
|
+
/*! formiojs v5.1.0-rc.26 | https://unpkg.com/formiojs@5.1.0-rc.26/LICENSE.txt */
|
24
24
|
|
25
25
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
26
26
|
|
package/lib/cjs/Embed.js
CHANGED
@@ -418,7 +418,7 @@ Formio.formioReady = new Promise((ready, reject) => {
|
|
418
418
|
_a._formioReady = ready;
|
419
419
|
_a._formioReadyReject = reject;
|
420
420
|
});
|
421
|
-
Formio.version = '5.1.0-rc.
|
421
|
+
Formio.version = '5.1.0-rc.26';
|
422
422
|
// Create a report.
|
423
423
|
Formio.Report = {
|
424
424
|
create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
package/lib/cjs/Formio.js
CHANGED
@@ -11,7 +11,7 @@ const CDN_1 = __importDefault(require("./CDN"));
|
|
11
11
|
const providers_1 = __importDefault(require("./providers"));
|
12
12
|
sdk_1.Formio.cdn = new CDN_1.default();
|
13
13
|
sdk_1.Formio.Providers = providers_1.default;
|
14
|
-
sdk_1.Formio.version = '5.1.0-rc.
|
14
|
+
sdk_1.Formio.version = '5.1.0-rc.26';
|
15
15
|
CDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
|
16
16
|
const isNil = (val) => val === null || val === undefined;
|
17
17
|
sdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
|
@@ -1634,6 +1634,10 @@ class WebformBuilder extends Component_1.default {
|
|
1634
1634
|
info.type);
|
1635
1635
|
}
|
1636
1636
|
hasEditTabs(type) {
|
1637
|
+
// If the component type does not exist then it has no edit tabs
|
1638
|
+
if (!Components_1.default.components[type]) {
|
1639
|
+
return false;
|
1640
|
+
}
|
1637
1641
|
const editTabs = (0, formUtils_1.getComponent)(Components_1.default.components[type === 'custom' ? 'unknown' : type].editForm().components, 'tabs', true).components;
|
1638
1642
|
const hiddenEditTabs = lodash_1.default.filter(lodash_1.default.get(this.options, `editForm.${type}`, []), 'ignore');
|
1639
1643
|
return lodash_1.default.intersectionBy(editTabs, hiddenEditTabs, 'key').length !== editTabs.length;
|
package/lib/cjs/Wizard.d.ts
CHANGED
@@ -106,6 +106,7 @@ declare class Wizard extends Webform {
|
|
106
106
|
onChange(flags: any, changed: any, modified: any, changes: any): void;
|
107
107
|
checkValidity(data: any, dirty: any, row: any, currentPageOnly: any, childErrors?: any[]): any;
|
108
108
|
focusOnComponent(key: any): void | Promise<void>;
|
109
|
+
triggerButtonCaptcha(page: any): void;
|
109
110
|
}
|
110
111
|
declare namespace Wizard {
|
111
112
|
let setBaseUrl: any;
|
package/lib/cjs/Wizard.js
CHANGED
@@ -602,7 +602,7 @@ class Wizard extends Webform_1.default {
|
|
602
602
|
}
|
603
603
|
this.redraw().then(() => {
|
604
604
|
this.checkData(this.submission.data);
|
605
|
-
this.triggerCaptcha(this.
|
605
|
+
this.triggerCaptcha(this.currentPage.components);
|
606
606
|
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
607
607
|
if (this.alert) {
|
608
608
|
this.showErrors(errors, true, true);
|
@@ -670,6 +670,7 @@ class Wizard extends Webform_1.default {
|
|
670
670
|
beforeSubmit() {
|
671
671
|
const pages = this.getPages({ all: true });
|
672
672
|
return Promise.all(pages.map((page) => {
|
673
|
+
this.triggerButtonCaptcha(page);
|
673
674
|
page.options.beforeSubmit = true;
|
674
675
|
return page.beforeSubmit();
|
675
676
|
}));
|
@@ -726,10 +727,13 @@ class Wizard extends Webform_1.default {
|
|
726
727
|
}
|
727
728
|
}
|
728
729
|
validateCurrentPage(flags = {}) {
|
729
|
-
var _a, _b;
|
730
|
+
var _a, _b, _c, _d;
|
730
731
|
const components = (_a = this.currentPage) === null || _a === void 0 ? void 0 : _a.components.map((component) => component.component);
|
731
732
|
// Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
|
732
|
-
|
733
|
+
if ((_b = this.currentPage) === null || _b === void 0 ? void 0 : _b.parent) {
|
734
|
+
return (_c = this.currentPage) === null || _c === void 0 ? void 0 : _c.parent.validateComponents(components, this.root.data, flags);
|
735
|
+
}
|
736
|
+
return (_d = this.currentPage) === null || _d === void 0 ? void 0 : _d.validateComponents(components, this.root ? this.root.data : this.data, flags);
|
733
737
|
}
|
734
738
|
emitPrevPage() {
|
735
739
|
this.emit('prevPage', { page: this.page, submission: this.submission });
|
@@ -942,6 +946,22 @@ class Wizard extends Webform_1.default {
|
|
942
946
|
}
|
943
947
|
return super.focusOnComponent(key);
|
944
948
|
}
|
949
|
+
triggerButtonCaptcha(page) {
|
950
|
+
if (!page.components) {
|
951
|
+
return;
|
952
|
+
}
|
953
|
+
let captchaComponent;
|
954
|
+
page.eachComponent((component) => {
|
955
|
+
if (/^(re)?captcha$/.test(component.component.type) &&
|
956
|
+
component.component.eventType === 'buttonClick' &&
|
957
|
+
component.component.buttonKey === 'submit') {
|
958
|
+
captchaComponent = component;
|
959
|
+
}
|
960
|
+
});
|
961
|
+
if (captchaComponent) {
|
962
|
+
captchaComponent.verify(`submitClick`);
|
963
|
+
}
|
964
|
+
}
|
945
965
|
}
|
946
966
|
exports.default = Wizard;
|
947
967
|
Wizard.setBaseUrl = Formio_1.Formio.setBaseUrl;
|
@@ -778,6 +778,10 @@ declare class Component extends Element {
|
|
778
778
|
* @returns {void}
|
779
779
|
*/
|
780
780
|
setElementInvalid(element: HTMLElement, invalid: boolean): void;
|
781
|
+
/**
|
782
|
+
* Clear any conditionally hidden components for this component only.
|
783
|
+
*/
|
784
|
+
clearComponentOnHide(): void;
|
781
785
|
/**
|
782
786
|
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
783
787
|
*/
|
@@ -881,7 +885,12 @@ declare class Component extends Element {
|
|
881
885
|
*/
|
882
886
|
deleteValue(): void;
|
883
887
|
getCustomDefaultValue(defaultValue: any): any;
|
884
|
-
|
888
|
+
/**
|
889
|
+
* Returns if a component has a default value set.
|
890
|
+
* @returns {boolean} - TRUE if a default value is set.
|
891
|
+
*/
|
892
|
+
get hasDefaultValue(): boolean;
|
893
|
+
get shouldAddDefaultValue(): boolean;
|
885
894
|
get defaultValue(): any;
|
886
895
|
/**
|
887
896
|
* Get the input value of this component.
|
@@ -1055,6 +1064,7 @@ declare class Component extends Element {
|
|
1055
1064
|
* @returns {void|boolean} - TRUE if no check should be performed on the component.
|
1056
1065
|
*/
|
1057
1066
|
checkData(data?: any, flags?: any, row?: any): void | boolean;
|
1067
|
+
checkingData: boolean | undefined;
|
1058
1068
|
checkModal(errors?: any[], dirty?: boolean): void;
|
1059
1069
|
get validationValue(): any;
|
1060
1070
|
isEmpty(value?: any): any;
|
@@ -1940,7 +1940,7 @@ class Component extends Element_1.default {
|
|
1940
1940
|
if (this.visible !== visible) {
|
1941
1941
|
this.visible = visible;
|
1942
1942
|
}
|
1943
|
-
this.
|
1943
|
+
this.clearComponentOnHide();
|
1944
1944
|
return visible;
|
1945
1945
|
}
|
1946
1946
|
/**
|
@@ -2200,16 +2200,11 @@ class Component extends Element_1.default {
|
|
2200
2200
|
element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
2201
2201
|
}
|
2202
2202
|
/**
|
2203
|
-
*
|
2203
|
+
* Clear any conditionally hidden components for this component only.
|
2204
2204
|
*/
|
2205
|
-
|
2205
|
+
clearComponentOnHide() {
|
2206
2206
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
2207
|
-
if (
|
2208
|
-
// if change happens inside EditGrid's row, it doesn't trigger change on the root level, so rootPristine will be true
|
2209
|
-
(!this.rootPristine || this.options.server || (0, utils_1.isInsideScopingComponent)(this)) &&
|
2210
|
-
this.component.clearOnHide !== false &&
|
2211
|
-
!this.options.readOnly &&
|
2212
|
-
!this.options.showHiddenFields) {
|
2207
|
+
if (this.component.clearOnHide !== false && !this.options.readOnly && !this.options.showHiddenFields) {
|
2213
2208
|
if (this.conditionallyHidden()) {
|
2214
2209
|
this.deleteValue();
|
2215
2210
|
}
|
@@ -2221,6 +2216,12 @@ class Component extends Element_1.default {
|
|
2221
2216
|
}
|
2222
2217
|
}
|
2223
2218
|
}
|
2219
|
+
/**
|
2220
|
+
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
2221
|
+
*/
|
2222
|
+
clearOnHide() {
|
2223
|
+
this.clearComponentOnHide();
|
2224
|
+
}
|
2224
2225
|
/**
|
2225
2226
|
* Triggers a debounced onChange event for the root component (usually Webform).
|
2226
2227
|
* @param {...any} args - The arguments to pass to the onChange event.
|
@@ -2512,12 +2513,27 @@ class Component extends Element_1.default {
|
|
2512
2513
|
}
|
2513
2514
|
getCustomDefaultValue(defaultValue) {
|
2514
2515
|
if (this.component.customDefaultValue && !this.options.preview) {
|
2515
|
-
defaultValue = this.evaluate(this.component.customDefaultValue, { value:
|
2516
|
+
defaultValue = this.evaluate(this.component.customDefaultValue, { value: this.dataValue }, 'value');
|
2516
2517
|
}
|
2517
2518
|
return defaultValue;
|
2518
2519
|
}
|
2520
|
+
/**
|
2521
|
+
* Returns if a component has a default value set.
|
2522
|
+
* @returns {boolean} - TRUE if a default value is set.
|
2523
|
+
*/
|
2524
|
+
get hasDefaultValue() {
|
2525
|
+
return this.component.customDefaultValue || (this.component.hasOwnProperty('defaultValue') &&
|
2526
|
+
(this.component.defaultValue !== null) &&
|
2527
|
+
(this.component.defaultValue !== undefined));
|
2528
|
+
}
|
2519
2529
|
get shouldAddDefaultValue() {
|
2520
|
-
|
2530
|
+
// It should add a default value if...
|
2531
|
+
// 1.) Ensure they have not set "noDefaults". If that is true, then will always return false. AND
|
2532
|
+
// 2.) The component is pristine (user has not manually modified it). AND
|
2533
|
+
// 3.) There is a default value setting present and it is not NULL or UNDEFINED.
|
2534
|
+
return !this.options.noDefaults && this.pristine && (this.hasDefaultValue ||
|
2535
|
+
// Empty strings and booleans are allowed primitives whose defaults are automatically added.
|
2536
|
+
(this.emptyValue === '' || (typeof this.emptyValue === 'boolean')));
|
2521
2537
|
}
|
2522
2538
|
get defaultValue() {
|
2523
2539
|
let defaultValue = this.emptyValue;
|
@@ -3112,6 +3128,14 @@ class Component extends Element_1.default {
|
|
3112
3128
|
data = data || this.rootValue;
|
3113
3129
|
flags = flags || {};
|
3114
3130
|
row = row || this.data;
|
3131
|
+
// Some components (for legacy reasons) have calls to "checkData" in inappropriate places such
|
3132
|
+
// as setValue. Historically, this was bypassed by a series of cached states around the data model
|
3133
|
+
// which caused its own problems. We need to ensure that premium and custom components do not fall into
|
3134
|
+
// an infinite loop by only checking this component once.
|
3135
|
+
if (this.checkingData) {
|
3136
|
+
return;
|
3137
|
+
}
|
3138
|
+
this.checkingData = true;
|
3115
3139
|
// Needs for Nextgen Rules Engine
|
3116
3140
|
this.resetCaches();
|
3117
3141
|
// Do not trigger refresh if change was triggered on blur event since components with Refresh on Blur have their own listeners
|
@@ -3125,6 +3149,8 @@ class Component extends Element_1.default {
|
|
3125
3149
|
if (this.id !== flags.triggeredComponentId) {
|
3126
3150
|
this.calculateComponentValue(data, flags, row);
|
3127
3151
|
}
|
3152
|
+
// We are done checking data.
|
3153
|
+
this.checkingData = false;
|
3128
3154
|
}
|
3129
3155
|
checkModal(errors = [], dirty = false) {
|
3130
3156
|
const messages = errors.filter(error => !error.fromServer);
|
@@ -181,7 +181,6 @@ export default class NestedComponent extends Field {
|
|
181
181
|
checkData(data: any, flags: any, row: any, components: any): true | undefined;
|
182
182
|
checkConditions(data: any, flags: any, row: any): boolean;
|
183
183
|
clearOnHide(show: any): void;
|
184
|
-
restoreComponentsContext(): void;
|
185
184
|
/**
|
186
185
|
* Allow components to hook into the next page trigger to perform their own logic.
|
187
186
|
* @param {Function} next - The callback to continue to the next page.
|
@@ -631,19 +631,8 @@ class NestedComponent extends Field_1.default {
|
|
631
631
|
}
|
632
632
|
clearOnHide(show) {
|
633
633
|
super.clearOnHide(show);
|
634
|
-
if (this.component.clearOnHide) {
|
635
|
-
if (this.allowData && !this.hasValue() && !this.conditionallyHidden()) {
|
636
|
-
this.dataValue = this.defaultValue;
|
637
|
-
}
|
638
|
-
if (this.hasValue()) {
|
639
|
-
this.restoreComponentsContext();
|
640
|
-
}
|
641
|
-
}
|
642
634
|
this.getComponents().forEach(component => component.clearOnHide(show));
|
643
635
|
}
|
644
|
-
restoreComponentsContext() {
|
645
|
-
this.getComponents().forEach((component) => component.data = this.dataValue);
|
646
|
-
}
|
647
636
|
/**
|
648
637
|
* Allow components to hook into the next page trigger to perform their own logic.
|
649
638
|
* @param {Function} next - The callback to continue to the next page.
|
@@ -832,7 +821,7 @@ class NestedComponent extends Field_1.default {
|
|
832
821
|
else if (value && component.hasValue(value)) {
|
833
822
|
return component.setValue(lodash_1.default.get(value, component.key), flags);
|
834
823
|
}
|
835
|
-
else if ((!this.rootPristine || component.visible) && component.shouldAddDefaultValue) {
|
824
|
+
else if ((!this.rootPristine || component.visible) && (flags.resetValue || component.shouldAddDefaultValue)) {
|
836
825
|
flags.noValidate = !flags.dirty;
|
837
826
|
flags.resetValue = true;
|
838
827
|
return component.setValue(component.defaultValue, flags);
|
@@ -842,6 +831,13 @@ class NestedComponent extends Field_1.default {
|
|
842
831
|
if (!value) {
|
843
832
|
return false;
|
844
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
|
+
}
|
845
841
|
return this.getComponents().reduce((changed, component) => {
|
846
842
|
return this.setNestedValue(component, value, flags, changed) || changed;
|
847
843
|
}, false);
|
@@ -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.
|
@@ -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.
|
@@ -36,12 +36,21 @@ export default class AddressComponent extends ContainerComponent {
|
|
36
36
|
get autocompleteMode(): boolean;
|
37
37
|
get manualMode(): boolean;
|
38
38
|
get manualModeEnabled(): boolean;
|
39
|
+
restoreComponentsContext(): void;
|
39
40
|
get isMultiple(): boolean;
|
40
41
|
set address(value: any);
|
41
42
|
get address(): any;
|
42
43
|
isValueInLegacyFormat(value: any): any;
|
43
44
|
normalizeValue(value: any): any;
|
44
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
|
+
};
|
45
54
|
get removeValueIcon(): any;
|
46
55
|
get searchInput(): any;
|
47
56
|
get addRowButton(): any;
|
@@ -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,20 @@ 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
|
+
let provider = this.component.provider;
|
119
|
+
const providerOptions = this.providerOptions;
|
120
|
+
const map = this.component.map;
|
119
121
|
if (!this.builderMode) {
|
120
|
-
if (
|
121
|
-
const { provider, providerOptions, } = this.component;
|
122
|
+
if (provider) {
|
122
123
|
if (lodash_1.default.get(providerOptions, 'params.subscriptionKey')) {
|
123
124
|
lodash_1.default.set(providerOptions, "params['subscription-key']", lodash_1.default.get(providerOptions, 'params.subscriptionKey'));
|
124
125
|
lodash_1.default.unset(providerOptions, 'params.subscriptionKey');
|
125
126
|
}
|
126
127
|
this.provider = this.initializeProvider(provider, providerOptions);
|
127
128
|
}
|
128
|
-
else if (
|
129
|
+
else if (map) {
|
129
130
|
// 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;
|
131
|
+
provider = this.component.provider = GoogleAddressProvider_1.GoogleAddressProvider.name;
|
133
132
|
const { key, region, } = map;
|
134
133
|
if (key) {
|
135
134
|
lodash_1.default.set(providerOptions, 'params.key', key);
|
@@ -262,6 +261,16 @@ class AddressComponent extends Container_1.default {
|
|
262
261
|
? (this.refs[AddressComponent.modeSwitcherRef] || null)
|
263
262
|
: null;
|
264
263
|
}
|
264
|
+
get providerOptions() {
|
265
|
+
return {
|
266
|
+
params: Object.assign({ subscriptionKey: this.component.subscriptionKey, key: this.component.apiKey }, this.component.params),
|
267
|
+
url: this.component.url,
|
268
|
+
queryProperty: this.component.queryProperty,
|
269
|
+
responseProperty: this.component.responseProperty,
|
270
|
+
displayValueProperty: this.component.displayValueProperty,
|
271
|
+
autocompleteOptions: this.component.autocompleteOptions
|
272
|
+
};
|
273
|
+
}
|
265
274
|
get removeValueIcon() {
|
266
275
|
return this.refs
|
267
276
|
? (this.refs[AddressComponent.removeValueIconRef] || null)
|
@@ -375,7 +384,8 @@ class AddressComponent extends Container_1.default {
|
|
375
384
|
const result = ((this.builderMode || this.manualMode) ? super.attach : Field_1.default.prototype.attach).call(this, element);
|
376
385
|
if (!this.builderMode) {
|
377
386
|
if (!this.provider && this.component.provider) {
|
378
|
-
const
|
387
|
+
const provider = this.component.provider;
|
388
|
+
const providerOptions = this.providerOptions;
|
379
389
|
this.provider = this.initializeProvider(provider, providerOptions);
|
380
390
|
}
|
381
391
|
}
|
@@ -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: {},
|
@@ -598,9 +598,6 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
598
598
|
this.updateOnChange(flags, changed);
|
599
599
|
return changed;
|
600
600
|
}
|
601
|
-
restoreComponentsContext() {
|
602
|
-
this.rows.forEach((row, index) => lodash_1.default.forIn(row, (component) => component.data = this.dataValue[index]));
|
603
|
-
}
|
604
601
|
toggleGroup(element, index) {
|
605
602
|
element.classList.toggle('collapsed');
|
606
603
|
lodash_1.default.each(this.refs.chunks[index], row => {
|
@@ -550,14 +550,6 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
550
550
|
}
|
551
551
|
});
|
552
552
|
}
|
553
|
-
restoreComponentsContext() {
|
554
|
-
this.getComponents().forEach((component) => {
|
555
|
-
var _a;
|
556
|
-
const rowData = this.dataValue[component.rowIndex];
|
557
|
-
const editRowData = (_a = this.editRows[component.rowIndex]) === null || _a === void 0 ? void 0 : _a.data;
|
558
|
-
component.data = rowData || editRowData;
|
559
|
-
});
|
560
|
-
}
|
561
553
|
flattenComponents(rowIndex) {
|
562
554
|
const result = {};
|
563
555
|
this.everyComponent((component) => {
|
@@ -16,6 +16,7 @@ declare const _default: ({
|
|
16
16
|
components?: undefined;
|
17
17
|
rows?: undefined;
|
18
18
|
editor?: undefined;
|
19
|
+
as?: undefined;
|
19
20
|
optionsLabelPosition?: undefined;
|
20
21
|
inline?: undefined;
|
21
22
|
defaultValue?: undefined;
|
@@ -45,6 +46,7 @@ declare const _default: ({
|
|
45
46
|
components?: undefined;
|
46
47
|
rows?: undefined;
|
47
48
|
editor?: undefined;
|
49
|
+
as?: undefined;
|
48
50
|
optionsLabelPosition?: undefined;
|
49
51
|
inline?: undefined;
|
50
52
|
defaultValue?: undefined;
|
@@ -91,6 +93,7 @@ declare const _default: ({
|
|
91
93
|
data?: undefined;
|
92
94
|
rows?: undefined;
|
93
95
|
editor?: undefined;
|
96
|
+
as?: undefined;
|
94
97
|
optionsLabelPosition?: undefined;
|
95
98
|
inline?: undefined;
|
96
99
|
defaultValue?: undefined;
|
@@ -120,6 +123,7 @@ declare const _default: ({
|
|
120
123
|
components?: undefined;
|
121
124
|
rows?: undefined;
|
122
125
|
editor?: undefined;
|
126
|
+
as?: undefined;
|
123
127
|
optionsLabelPosition?: undefined;
|
124
128
|
inline?: undefined;
|
125
129
|
defaultValue?: undefined;
|
@@ -149,6 +153,7 @@ declare const _default: ({
|
|
149
153
|
components?: undefined;
|
150
154
|
rows?: undefined;
|
151
155
|
editor?: undefined;
|
156
|
+
as?: undefined;
|
152
157
|
optionsLabelPosition?: undefined;
|
153
158
|
inline?: undefined;
|
154
159
|
defaultValue?: undefined;
|
@@ -160,6 +165,7 @@ declare const _default: ({
|
|
160
165
|
tooltip: string;
|
161
166
|
rows: number;
|
162
167
|
editor: string;
|
168
|
+
as: string;
|
163
169
|
input: boolean;
|
164
170
|
weight: number;
|
165
171
|
placeholder: string;
|
@@ -207,6 +213,7 @@ declare const _default: ({
|
|
207
213
|
components?: undefined;
|
208
214
|
rows?: undefined;
|
209
215
|
editor?: undefined;
|
216
|
+
as?: undefined;
|
210
217
|
optionsLabelPosition?: undefined;
|
211
218
|
inline?: undefined;
|
212
219
|
defaultValue?: undefined;
|
@@ -227,6 +234,7 @@ declare const _default: ({
|
|
227
234
|
components?: undefined;
|
228
235
|
rows?: undefined;
|
229
236
|
editor?: undefined;
|
237
|
+
as?: undefined;
|
230
238
|
optionsLabelPosition?: undefined;
|
231
239
|
inline?: undefined;
|
232
240
|
defaultValue?: undefined;
|
@@ -247,6 +255,7 @@ declare const _default: ({
|
|
247
255
|
components?: undefined;
|
248
256
|
rows?: undefined;
|
249
257
|
editor?: undefined;
|
258
|
+
as?: undefined;
|
250
259
|
optionsLabelPosition?: undefined;
|
251
260
|
inline?: undefined;
|
252
261
|
defaultValue?: undefined;
|
@@ -276,6 +285,7 @@ declare const _default: ({
|
|
276
285
|
components?: undefined;
|
277
286
|
rows?: undefined;
|
278
287
|
editor?: undefined;
|
288
|
+
as?: undefined;
|
279
289
|
optionsLabelPosition?: undefined;
|
280
290
|
inline?: undefined;
|
281
291
|
defaultValue?: undefined;
|
@@ -305,6 +315,7 @@ declare const _default: ({
|
|
305
315
|
components?: undefined;
|
306
316
|
rows?: undefined;
|
307
317
|
editor?: undefined;
|
318
|
+
as?: undefined;
|
308
319
|
optionsLabelPosition?: undefined;
|
309
320
|
inline?: undefined;
|
310
321
|
defaultValue?: undefined;
|
@@ -332,6 +343,7 @@ declare const _default: ({
|
|
332
343
|
components?: undefined;
|
333
344
|
rows?: undefined;
|
334
345
|
editor?: undefined;
|
346
|
+
as?: undefined;
|
335
347
|
} | {
|
336
348
|
type: string;
|
337
349
|
input: boolean;
|
@@ -353,6 +365,7 @@ declare const _default: ({
|
|
353
365
|
tableView?: undefined;
|
354
366
|
rows?: undefined;
|
355
367
|
editor?: undefined;
|
368
|
+
as?: undefined;
|
356
369
|
optionsLabelPosition?: undefined;
|
357
370
|
inline?: undefined;
|
358
371
|
defaultValue?: undefined;
|
@@ -114,6 +114,10 @@ class FormComponent extends Component_1.default {
|
|
114
114
|
get emptyValue() {
|
115
115
|
return { data: {} };
|
116
116
|
}
|
117
|
+
// In order for the subform values to set properly, we must always say that nested forms have a default value.
|
118
|
+
get hasDefaultValue() {
|
119
|
+
return true;
|
120
|
+
}
|
117
121
|
get ready() {
|
118
122
|
return this.subFormReady || Promise.resolve();
|
119
123
|
}
|
@@ -64,6 +64,9 @@ class SelectBoxesComponent extends Radio_1.default {
|
|
64
64
|
info.attr.class = 'form-check-input';
|
65
65
|
return info;
|
66
66
|
}
|
67
|
+
get hasDefaultValue() {
|
68
|
+
return true;
|
69
|
+
}
|
67
70
|
get emptyValue() {
|
68
71
|
return this.component.values.reduce((prev, value) => {
|
69
72
|
if (value.value) {
|
package/lib/cjs/utils/utils.d.ts
CHANGED
@@ -478,14 +478,6 @@ export function getDataParentComponent(componentInstance: Component): Component
|
|
478
478
|
* @returns {boolean} - TRUE if the value is a promise; FALSE otherwise
|
479
479
|
*/
|
480
480
|
export function isPromise(value: any): boolean;
|
481
|
-
/**
|
482
|
-
* Determines if the component has a scoping parent in tree (a component which scopes its children and manages its
|
483
|
-
* changes by itself, e.g. EditGrid)
|
484
|
-
* @param {Component} componentInstance - The component to check for the scoping parent.
|
485
|
-
* @param {boolean} firstPass - Whether it is the first pass of the function
|
486
|
-
* @returns {boolean|*} - TRUE if the component has a scoping parent; FALSE otherwise
|
487
|
-
*/
|
488
|
-
export function isInsideScopingComponent(componentInstance: Component, firstPass?: boolean): boolean | any;
|
489
481
|
/**
|
490
482
|
* Returns all the focusable elements within the provided dom element.
|
491
483
|
* @param {HTMLElement} element - The element to get the focusable elements from.
|