@formio/js 5.2.1-rc.1 → 5.2.1-rc.11
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 +29 -40
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +31 -42
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +19 -30
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +17 -28
- 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/PDFBuilder.js +8 -6
- package/lib/cjs/Webform.js +9 -1
- package/lib/cjs/WebformBuilder.js +11 -3
- package/lib/cjs/Wizard.js +5 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.js +4 -0
- package/lib/cjs/components/datagrid/DataGrid.js +8 -1
- package/lib/cjs/components/radio/Radio.js +1 -1
- package/lib/cjs/components/select/Select.d.ts +1 -0
- package/lib/cjs/components/select/Select.js +14 -3
- package/lib/cjs/components/tags/Tags.js +7 -0
- package/lib/cjs/utils/formUtils.d.ts +3 -3
- package/lib/cjs/utils/index.d.ts +3 -3
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDFBuilder.js +8 -6
- package/lib/mjs/Webform.js +9 -1
- package/lib/mjs/WebformBuilder.js +11 -3
- package/lib/mjs/Wizard.js +5 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.js +3 -0
- package/lib/mjs/components/datagrid/DataGrid.js +7 -1
- package/lib/mjs/components/radio/Radio.js +1 -1
- package/lib/mjs/components/select/Select.d.ts +1 -0
- package/lib/mjs/components/select/Select.js +14 -3
- package/lib/mjs/components/tags/Tags.js +7 -0
- package/lib/mjs/utils/formUtils.d.ts +3 -3
- package/lib/mjs/utils/index.d.ts +3 -3
- package/package.json +3 -3
@@ -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.2.1-rc.
|
23
|
+
/*! formiojs v5.2.1-rc.11 | https://unpkg.com/formiojs@5.2.1-rc.11/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.2.1-rc.
|
421
|
+
Formio.version = '5.2.1-rc.11';
|
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.2.1-rc.
|
14
|
+
sdk_1.Formio.version = '5.2.1-rc.11';
|
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) {
|
package/lib/cjs/PDFBuilder.js
CHANGED
@@ -454,18 +454,20 @@ class PDFBuilder extends WebformBuilder_1.default {
|
|
454
454
|
const repeatablePathsComps = this.findComponentsWithRepeatablePaths();
|
455
455
|
// update elements which path was duplicated if any pathes have been changed
|
456
456
|
if (!lodash_1.default.isEqual(this.repeatablePathsComps, repeatablePathsComps)) {
|
457
|
-
(
|
458
|
-
|
459
|
-
this.
|
460
|
-
|
461
|
-
|
457
|
+
if (!lodash_1.default.isEmpty(this.repeatablePathsComps)) {
|
458
|
+
(0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
|
459
|
+
if (this.repeatablePathsComps.includes(comp.component)) {
|
460
|
+
this.webform.postMessage({ name: 'updateElement', data: comp.component });
|
461
|
+
}
|
462
|
+
});
|
463
|
+
}
|
462
464
|
this.repeatablePathsComps = repeatablePathsComps;
|
463
465
|
}
|
464
466
|
if (!repeatablePathsComps.length) {
|
465
467
|
return;
|
466
468
|
}
|
467
469
|
(0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
|
468
|
-
if (this.repeatablePathsComps.includes(comp)) {
|
470
|
+
if (this.repeatablePathsComps.includes(comp.component)) {
|
469
471
|
this.webform.postMessage({
|
470
472
|
name: 'showBuilderErrors',
|
471
473
|
data: {
|
package/lib/cjs/Webform.js
CHANGED
@@ -351,6 +351,14 @@ class Webform extends NestedDataComponent_1.default {
|
|
351
351
|
get shadowRoot() {
|
352
352
|
return this.options.shadowRoot;
|
353
353
|
}
|
354
|
+
// Webforms have no default value setting, so this should be always false
|
355
|
+
// I does not affect setting default value to nested forms
|
356
|
+
get shouldAddDefaultValue() {
|
357
|
+
return false;
|
358
|
+
}
|
359
|
+
get componentsMap() {
|
360
|
+
return this.childComponentsMap || {};
|
361
|
+
}
|
354
362
|
/**
|
355
363
|
* Add a language for translations
|
356
364
|
* @param {string} code - The language code for the language being added.
|
@@ -1114,7 +1122,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
1114
1122
|
const componentErrors = {};
|
1115
1123
|
errors.forEach((err) => {
|
1116
1124
|
var _a, _b;
|
1117
|
-
const path = err.path || ((_a = err.context) === null || _a === void 0 ? void 0 : _a.path) || ((_b = err.component) === null || _b === void 0 ? void 0 : _b.key);
|
1125
|
+
const path = (0, utils_1.getStringFromComponentPath)(err.path) || ((_a = err.context) === null || _a === void 0 ? void 0 : _a.path) || ((_b = err.component) === null || _b === void 0 ? void 0 : _b.key);
|
1118
1126
|
if (!componentErrors[path]) {
|
1119
1127
|
componentErrors[path] = [];
|
1120
1128
|
}
|
@@ -83,8 +83,16 @@ class WebformBuilder extends Component_1.default {
|
|
83
83
|
}
|
84
84
|
this.groupOrder = this.groupOrder
|
85
85
|
.filter(group => group && !group.ignore)
|
86
|
-
.sort((a, b) => a.weight - b.weight)
|
87
|
-
|
86
|
+
.sort((a, b) => a.weight - b.weight);
|
87
|
+
const defaultOpenedGroup = this.groupOrder.find(x => x.key !== 'basic' && x.default);
|
88
|
+
if (defaultOpenedGroup) {
|
89
|
+
this.groupOrder.forEach(x => {
|
90
|
+
if ('default' in x && x.key !== defaultOpenedGroup.key) {
|
91
|
+
x.default = false;
|
92
|
+
}
|
93
|
+
});
|
94
|
+
}
|
95
|
+
this.groupOrder = this.groupOrder.map(group => group.key);
|
88
96
|
for (const type in Components_1.default.components) {
|
89
97
|
const component = Components_1.default.components[type];
|
90
98
|
if (component.builderInfo && component.builderInfo.schema) {
|
@@ -1100,7 +1108,7 @@ class WebformBuilder extends Component_1.default {
|
|
1100
1108
|
const newComp = parentComponent.addComponent(defaultValueComponent.component, defaultValueComponent.data, sibling);
|
1101
1109
|
lodash_1.default.pull(newComp.validators, 'required');
|
1102
1110
|
parentComponent.tabs[tabIndex].splice(index, 1, newComp);
|
1103
|
-
newComp.
|
1111
|
+
newComp.processOwnValidation = true;
|
1104
1112
|
newComp.build(defaultValueComponent.element);
|
1105
1113
|
if (this.preview && !this.preview.defaultChanged) {
|
1106
1114
|
const defaultValue = lodash_1.default.get(this.preview._data, this.editForm._data.key);
|
package/lib/cjs/Wizard.js
CHANGED
@@ -821,6 +821,11 @@ class Wizard extends Webform_1.default {
|
|
821
821
|
}
|
822
822
|
}
|
823
823
|
setValue(submission, flags = {}, ignoreEstablishment) {
|
824
|
+
if (!submission || !submission.data) {
|
825
|
+
submission = {
|
826
|
+
data: {},
|
827
|
+
};
|
828
|
+
}
|
824
829
|
const changed = this.getPages({ all: true }).reduce((changed, page) => {
|
825
830
|
return this.setNestedValue(page, submission.data, flags, changed) || changed;
|
826
831
|
}, false);
|
@@ -558,12 +558,16 @@ class NestedComponent extends Field_1.default {
|
|
558
558
|
* @param {boolean} [all] - If set to TRUE will cascade remove all components.
|
559
559
|
*/
|
560
560
|
removeComponent(component, components, all = false) {
|
561
|
+
var _a, _b;
|
561
562
|
components = components || this.components;
|
562
563
|
component.destroy(all);
|
563
564
|
lodash_1.default.remove(components, { id: component.id });
|
564
565
|
if (this.componentsMap[component.path]) {
|
565
566
|
delete this.componentsMap[component.path];
|
566
567
|
}
|
568
|
+
if ((_a = this.root) === null || _a === void 0 ? void 0 : _a.componentsMap[component.path]) {
|
569
|
+
(_b = this.root) === null || _b === void 0 ? true : delete _b.componentsMap[component.path];
|
570
|
+
}
|
567
571
|
}
|
568
572
|
/**
|
569
573
|
* Removes a component provided the API key of that component.
|
@@ -477,11 +477,18 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
477
477
|
options.row = `${rowIndex}-${colIndex}`;
|
478
478
|
options.rowIndex = rowIndex;
|
479
479
|
options.onChange = (flags, changed, modified) => {
|
480
|
+
var _a, _b;
|
480
481
|
if (changed.component.type === 'form') {
|
481
482
|
const formComp = (0, utils_1.getComponent)(this.component.components, changed.component.key);
|
482
483
|
lodash_1.default.set(formComp, 'components', changed.component.components);
|
483
484
|
}
|
484
|
-
|
485
|
+
// If we're in a nested form we need to ensure our changes are triggered upstream
|
486
|
+
if (((_a = changed.instance.root) === null || _a === void 0 ? void 0 : _a.id) && (((_b = this.root) === null || _b === void 0 ? void 0 : _b.id) !== changed.instance.root.id)) {
|
487
|
+
changed.instance.root.triggerChange(flags, changed, modified);
|
488
|
+
}
|
489
|
+
else {
|
490
|
+
this.triggerChange({ modified });
|
491
|
+
}
|
485
492
|
};
|
486
493
|
let columnComponent;
|
487
494
|
if (this.builderMode) {
|
@@ -142,7 +142,7 @@ class RadioComponent extends ListComponent_1.default {
|
|
142
142
|
});
|
143
143
|
this.optionsLoaded = !this.component.dataSrc || this.component.dataSrc === 'values';
|
144
144
|
this.loadedOptions = [];
|
145
|
-
if (!this.visible) {
|
145
|
+
if (!this.visible || this.optionsLoaded) {
|
146
146
|
this.itemsLoadedResolve();
|
147
147
|
}
|
148
148
|
// Get the template keys for this radio component.
|
@@ -89,6 +89,7 @@ export default class SelectComponent extends ListComponent {
|
|
89
89
|
disableInfiniteScroll(): void;
|
90
90
|
set serverCount(value: any);
|
91
91
|
get serverCount(): any;
|
92
|
+
shouldResetChoicesItems(items: any): boolean;
|
92
93
|
setItems(items: any, fromSearch: any): void;
|
93
94
|
selectItems: any;
|
94
95
|
set downloadedResources(value: any);
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const Formio_1 = require("../../Formio");
|
8
8
|
const ListComponent_1 = __importDefault(require("../_classes/list/ListComponent"));
|
9
|
-
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
10
9
|
const Form_1 = __importDefault(require("../../Form"));
|
11
10
|
const utils_1 = require("../../utils");
|
12
11
|
const ChoicesWrapper_1 = __importDefault(require("../../utils/ChoicesWrapper"));
|
@@ -356,6 +355,18 @@ class SelectComponent extends ListComponent_1.default {
|
|
356
355
|
this.downloadedResources.serverCount = this.downloadedResources.length;
|
357
356
|
this.serverCount = this.downloadedResources.length;
|
358
357
|
}
|
358
|
+
shouldResetChoicesItems(items) {
|
359
|
+
if (this.choices._store.choices.length !== items.length) {
|
360
|
+
return true;
|
361
|
+
}
|
362
|
+
for (let item of items) {
|
363
|
+
const choicesItem = this.choices._store.choices.find((i) => i.label === item.label);
|
364
|
+
if (!choicesItem) {
|
365
|
+
return true;
|
366
|
+
}
|
367
|
+
}
|
368
|
+
return false;
|
369
|
+
}
|
359
370
|
/* eslint-disable max-statements */
|
360
371
|
setItems(items, fromSearch) {
|
361
372
|
var _a, _b;
|
@@ -442,7 +453,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
442
453
|
this.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, lodash_1.default.get(item, this.component.idPath, String(index)));
|
443
454
|
});
|
444
455
|
if (this.choices) {
|
445
|
-
this.choices.setChoices(this.selectOptions, 'value', 'label', true);
|
456
|
+
this.choices.setChoices(this.selectOptions, 'value', 'label', true, true, !fromSearch && this.shouldResetChoicesItems(this.selectOptions));
|
446
457
|
}
|
447
458
|
else if (this.loading) {
|
448
459
|
// Re-attach select input.
|
@@ -837,7 +848,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
837
848
|
this.choices.containerOuter.element.setAttribute('tabIndex', '-1');
|
838
849
|
this.addEventListener(this.choices.containerOuter.element, 'focus', () => this.focusableElement.focus());
|
839
850
|
}
|
840
|
-
|
851
|
+
this.addFocusBlurEvents(this.choices.input.element);
|
841
852
|
if (this.itemsFromUrl && !this.component.noRefreshOnScroll) {
|
842
853
|
this.scrollList = this.choices.choiceList.element;
|
843
854
|
this.addEventListener(this.scrollList, 'scroll', () => this.onScroll());
|
@@ -160,6 +160,13 @@ class TagsComponent extends Input_1.default {
|
|
160
160
|
this.refs.input[0].parentNode.lastChild.focus();
|
161
161
|
}
|
162
162
|
}
|
163
|
+
getValue() {
|
164
|
+
if (this.choices) {
|
165
|
+
const value = this.choices.getValue(true);
|
166
|
+
return value.join(`${this.delimiter}`);
|
167
|
+
}
|
168
|
+
return super.getValue();
|
169
|
+
}
|
163
170
|
getValueAsString(value) {
|
164
171
|
if (!value) {
|
165
172
|
return '';
|
@@ -26,10 +26,10 @@ export const getBestMatch: typeof Utils.getBestMatch;
|
|
26
26
|
export const getComponentFromPath: typeof Utils.getComponentFromPath;
|
27
27
|
export const getComponentValue: typeof Utils.getComponentValue;
|
28
28
|
export const findComponents: typeof Utils.findComponents;
|
29
|
-
export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => Promise<void>;
|
30
|
-
export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => void;
|
29
|
+
export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataAsyncCallback | undefined) => Promise<void>;
|
30
|
+
export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataCallback | undefined) => void;
|
31
31
|
export const getComponentKey: typeof Utils.getComponentKey;
|
32
|
-
export const getContextualRowPath:
|
32
|
+
export const getContextualRowPath: any;
|
33
33
|
export const getContextualRowData: typeof Utils.getContextualRowData;
|
34
34
|
export const componentInfo: typeof Utils.componentInfo;
|
35
35
|
export const eachComponent: typeof Utils.eachComponent;
|
package/lib/cjs/utils/index.d.ts
CHANGED
@@ -37,10 +37,10 @@ declare const FormioUtils: {
|
|
37
37
|
getComponentFromPath: typeof import("@formio/core/lib/utils/formUtil").getComponentFromPath;
|
38
38
|
getComponentValue: typeof import("@formio/core/lib/utils/formUtil").getComponentValue;
|
39
39
|
findComponents: typeof import("@formio/core/lib/utils/formUtil").findComponents;
|
40
|
-
eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => Promise<void>;
|
41
|
-
eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => void;
|
40
|
+
eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataAsyncCallback | undefined) => Promise<void>;
|
41
|
+
eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataCallback | undefined) => void;
|
42
42
|
getComponentKey: typeof import("@formio/core/lib/utils/formUtil").getComponentKey;
|
43
|
-
getContextualRowPath:
|
43
|
+
getContextualRowPath: any;
|
44
44
|
getContextualRowData: typeof import("@formio/core/lib/utils/formUtil").getContextualRowData;
|
45
45
|
componentInfo: typeof import("@formio/core/lib/utils/formUtil").componentInfo;
|
46
46
|
eachComponent: typeof import("@formio/core/lib/utils/formUtil").eachComponent;
|
package/lib/mjs/Embed.js
CHANGED
@@ -14,7 +14,7 @@ export class Formio {
|
|
14
14
|
Formio._formioReady = ready;
|
15
15
|
Formio._formioReadyReject = reject;
|
16
16
|
});
|
17
|
-
static version = '5.2.1-rc.
|
17
|
+
static version = '5.2.1-rc.11';
|
18
18
|
static setLicense(license, norecurse = false) {
|
19
19
|
Formio.license = license;
|
20
20
|
if (!norecurse && Formio.FormioClass) {
|
package/lib/mjs/Formio.js
CHANGED
@@ -4,7 +4,7 @@ import CDN from './CDN';
|
|
4
4
|
import Providers from './providers';
|
5
5
|
FormioCore.cdn = new CDN();
|
6
6
|
FormioCore.Providers = Providers;
|
7
|
-
FormioCore.version = '5.2.1-rc.
|
7
|
+
FormioCore.version = '5.2.1-rc.11';
|
8
8
|
CDN.defaultCDN = FormioCore.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
|
9
9
|
const isNil = (val) => val === null || val === undefined;
|
10
10
|
FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
|
package/lib/mjs/PDFBuilder.js
CHANGED
@@ -447,18 +447,20 @@ export default class PDFBuilder extends WebformBuilder {
|
|
447
447
|
const repeatablePathsComps = this.findComponentsWithRepeatablePaths();
|
448
448
|
// update elements which path was duplicated if any pathes have been changed
|
449
449
|
if (!_.isEqual(this.repeatablePathsComps, repeatablePathsComps)) {
|
450
|
-
|
451
|
-
|
452
|
-
this.
|
453
|
-
|
454
|
-
|
450
|
+
if (!_.isEmpty(this.repeatablePathsComps)) {
|
451
|
+
eachComponent(this.webform.getComponents(), (comp) => {
|
452
|
+
if (this.repeatablePathsComps.includes(comp.component)) {
|
453
|
+
this.webform.postMessage({ name: 'updateElement', data: comp.component });
|
454
|
+
}
|
455
|
+
});
|
456
|
+
}
|
455
457
|
this.repeatablePathsComps = repeatablePathsComps;
|
456
458
|
}
|
457
459
|
if (!repeatablePathsComps.length) {
|
458
460
|
return;
|
459
461
|
}
|
460
462
|
eachComponent(this.webform.getComponents(), (comp) => {
|
461
|
-
if (this.repeatablePathsComps.includes(comp)) {
|
463
|
+
if (this.repeatablePathsComps.includes(comp.component)) {
|
462
464
|
this.webform.postMessage({
|
463
465
|
name: 'showBuilderErrors',
|
464
466
|
data: {
|
package/lib/mjs/Webform.js
CHANGED
@@ -323,6 +323,14 @@ export default class Webform extends NestedDataComponent {
|
|
323
323
|
get shadowRoot() {
|
324
324
|
return this.options.shadowRoot;
|
325
325
|
}
|
326
|
+
// Webforms have no default value setting, so this should be always false
|
327
|
+
// I does not affect setting default value to nested forms
|
328
|
+
get shouldAddDefaultValue() {
|
329
|
+
return false;
|
330
|
+
}
|
331
|
+
get componentsMap() {
|
332
|
+
return this.childComponentsMap || {};
|
333
|
+
}
|
326
334
|
/**
|
327
335
|
* Add a language for translations
|
328
336
|
* @param {string} code - The language code for the language being added.
|
@@ -1116,7 +1124,7 @@ export default class Webform extends NestedDataComponent {
|
|
1116
1124
|
// Mark any components as invalid if in a custom message.
|
1117
1125
|
const componentErrors = {};
|
1118
1126
|
errors.forEach((err) => {
|
1119
|
-
const path = err.path || err.context?.path || err.component?.key;
|
1127
|
+
const path = getStringFromComponentPath(err.path) || err.context?.path || err.component?.key;
|
1120
1128
|
if (!componentErrors[path]) {
|
1121
1129
|
componentErrors[path] = [];
|
1122
1130
|
}
|
@@ -63,8 +63,16 @@ export default class WebformBuilder extends Component {
|
|
63
63
|
}
|
64
64
|
this.groupOrder = this.groupOrder
|
65
65
|
.filter(group => group && !group.ignore)
|
66
|
-
.sort((a, b) => a.weight - b.weight)
|
67
|
-
|
66
|
+
.sort((a, b) => a.weight - b.weight);
|
67
|
+
const defaultOpenedGroup = this.groupOrder.find(x => x.key !== 'basic' && x.default);
|
68
|
+
if (defaultOpenedGroup) {
|
69
|
+
this.groupOrder.forEach(x => {
|
70
|
+
if ('default' in x && x.key !== defaultOpenedGroup.key) {
|
71
|
+
x.default = false;
|
72
|
+
}
|
73
|
+
});
|
74
|
+
}
|
75
|
+
this.groupOrder = this.groupOrder.map(group => group.key);
|
68
76
|
for (const type in Components.components) {
|
69
77
|
const component = Components.components[type];
|
70
78
|
if (component.builderInfo && component.builderInfo.schema) {
|
@@ -1084,7 +1092,7 @@ export default class WebformBuilder extends Component {
|
|
1084
1092
|
const newComp = parentComponent.addComponent(defaultValueComponent.component, defaultValueComponent.data, sibling);
|
1085
1093
|
_.pull(newComp.validators, 'required');
|
1086
1094
|
parentComponent.tabs[tabIndex].splice(index, 1, newComp);
|
1087
|
-
newComp.
|
1095
|
+
newComp.processOwnValidation = true;
|
1088
1096
|
newComp.build(defaultValueComponent.element);
|
1089
1097
|
if (this.preview && !this.preview.defaultChanged) {
|
1090
1098
|
const defaultValue = _.get(this.preview._data, this.editForm._data.key);
|
package/lib/mjs/Wizard.js
CHANGED
@@ -810,6 +810,11 @@ export default class Wizard extends Webform {
|
|
810
810
|
}
|
811
811
|
}
|
812
812
|
setValue(submission, flags = {}, ignoreEstablishment) {
|
813
|
+
if (!submission || !submission.data) {
|
814
|
+
submission = {
|
815
|
+
data: {},
|
816
|
+
};
|
817
|
+
}
|
813
818
|
const changed = this.getPages({ all: true }).reduce((changed, page) => {
|
814
819
|
return this.setNestedValue(page, submission.data, flags, changed) || changed;
|
815
820
|
}, false);
|
@@ -560,6 +560,9 @@ export default class NestedComponent extends Field {
|
|
560
560
|
if (this.componentsMap[component.path]) {
|
561
561
|
delete this.componentsMap[component.path];
|
562
562
|
}
|
563
|
+
if (this.root?.componentsMap[component.path]) {
|
564
|
+
delete this.root?.componentsMap[component.path];
|
565
|
+
}
|
563
566
|
}
|
564
567
|
/**
|
565
568
|
* Removes a component provided the API key of that component.
|
@@ -477,7 +477,13 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
477
477
|
const formComp = getComponent(this.component.components, changed.component.key);
|
478
478
|
_.set(formComp, 'components', changed.component.components);
|
479
479
|
}
|
480
|
-
|
480
|
+
// If we're in a nested form we need to ensure our changes are triggered upstream
|
481
|
+
if (changed.instance.root?.id && (this.root?.id !== changed.instance.root.id)) {
|
482
|
+
changed.instance.root.triggerChange(flags, changed, modified);
|
483
|
+
}
|
484
|
+
else {
|
485
|
+
this.triggerChange({ modified });
|
486
|
+
}
|
481
487
|
};
|
482
488
|
let columnComponent;
|
483
489
|
if (this.builderMode) {
|
@@ -142,7 +142,7 @@ export default class RadioComponent extends ListComponent {
|
|
142
142
|
});
|
143
143
|
this.optionsLoaded = !this.component.dataSrc || this.component.dataSrc === 'values';
|
144
144
|
this.loadedOptions = [];
|
145
|
-
if (!this.visible) {
|
145
|
+
if (!this.visible || this.optionsLoaded) {
|
146
146
|
this.itemsLoadedResolve();
|
147
147
|
}
|
148
148
|
// Get the template keys for this radio component.
|
@@ -89,6 +89,7 @@ export default class SelectComponent extends ListComponent {
|
|
89
89
|
disableInfiniteScroll(): void;
|
90
90
|
set serverCount(value: any);
|
91
91
|
get serverCount(): any;
|
92
|
+
shouldResetChoicesItems(items: any): boolean;
|
92
93
|
setItems(items: any, fromSearch: any): void;
|
93
94
|
selectItems: any;
|
94
95
|
set downloadedResources(value: any);
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import { Formio } from '../../Formio';
|
3
3
|
import ListComponent from '../_classes/list/ListComponent';
|
4
|
-
import Input from '../_classes/input/Input';
|
5
4
|
import Form from '../../Form';
|
6
5
|
import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes, isSelectResourceWithObjectValue, removeHTML } from '../../utils';
|
7
6
|
import Choices from '../../utils/ChoicesWrapper';
|
@@ -360,6 +359,18 @@ export default class SelectComponent extends ListComponent {
|
|
360
359
|
this.downloadedResources.serverCount = this.downloadedResources.length;
|
361
360
|
this.serverCount = this.downloadedResources.length;
|
362
361
|
}
|
362
|
+
shouldResetChoicesItems(items) {
|
363
|
+
if (this.choices._store.choices.length !== items.length) {
|
364
|
+
return true;
|
365
|
+
}
|
366
|
+
for (let item of items) {
|
367
|
+
const choicesItem = this.choices._store.choices.find((i) => i.label === item.label);
|
368
|
+
if (!choicesItem) {
|
369
|
+
return true;
|
370
|
+
}
|
371
|
+
}
|
372
|
+
return false;
|
373
|
+
}
|
363
374
|
/* eslint-disable max-statements */
|
364
375
|
setItems(items, fromSearch) {
|
365
376
|
this.selectItems = items;
|
@@ -445,7 +456,7 @@ export default class SelectComponent extends ListComponent {
|
|
445
456
|
this.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, _.get(item, this.component.idPath, String(index)));
|
446
457
|
});
|
447
458
|
if (this.choices) {
|
448
|
-
this.choices.setChoices(this.selectOptions, 'value', 'label', true);
|
459
|
+
this.choices.setChoices(this.selectOptions, 'value', 'label', true, true, !fromSearch && this.shouldResetChoicesItems(this.selectOptions));
|
449
460
|
}
|
450
461
|
else if (this.loading) {
|
451
462
|
// Re-attach select input.
|
@@ -869,7 +880,7 @@ export default class SelectComponent extends ListComponent {
|
|
869
880
|
this.choices.containerOuter.element.setAttribute('tabIndex', '-1');
|
870
881
|
this.addEventListener(this.choices.containerOuter.element, 'focus', () => this.focusableElement.focus());
|
871
882
|
}
|
872
|
-
|
883
|
+
this.addFocusBlurEvents(this.choices.input.element);
|
873
884
|
if (this.itemsFromUrl && !this.component.noRefreshOnScroll) {
|
874
885
|
this.scrollList = this.choices.choiceList.element;
|
875
886
|
this.addEventListener(this.scrollList, 'scroll', () => this.onScroll());
|
@@ -158,6 +158,13 @@ export default class TagsComponent extends Input {
|
|
158
158
|
this.refs.input[0].parentNode.lastChild.focus();
|
159
159
|
}
|
160
160
|
}
|
161
|
+
getValue() {
|
162
|
+
if (this.choices) {
|
163
|
+
const value = this.choices.getValue(true);
|
164
|
+
return value.join(`${this.delimiter}`);
|
165
|
+
}
|
166
|
+
return super.getValue();
|
167
|
+
}
|
161
168
|
getValueAsString(value) {
|
162
169
|
if (!value) {
|
163
170
|
return '';
|
@@ -26,10 +26,10 @@ export const getBestMatch: typeof Utils.getBestMatch;
|
|
26
26
|
export const getComponentFromPath: typeof Utils.getComponentFromPath;
|
27
27
|
export const getComponentValue: typeof Utils.getComponentValue;
|
28
28
|
export const findComponents: typeof Utils.findComponents;
|
29
|
-
export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => Promise<void>;
|
30
|
-
export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => void;
|
29
|
+
export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataAsyncCallback | undefined) => Promise<void>;
|
30
|
+
export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataCallback | undefined) => void;
|
31
31
|
export const getComponentKey: typeof Utils.getComponentKey;
|
32
|
-
export const getContextualRowPath:
|
32
|
+
export const getContextualRowPath: any;
|
33
33
|
export const getContextualRowData: typeof Utils.getContextualRowData;
|
34
34
|
export const componentInfo: typeof Utils.componentInfo;
|
35
35
|
export const eachComponent: typeof Utils.eachComponent;
|
package/lib/mjs/utils/index.d.ts
CHANGED
@@ -37,10 +37,10 @@ declare const FormioUtils: {
|
|
37
37
|
getComponentFromPath: typeof import("@formio/core/lib/utils/formUtil").getComponentFromPath;
|
38
38
|
getComponentValue: typeof import("@formio/core/lib/utils/formUtil").getComponentValue;
|
39
39
|
findComponents: typeof import("@formio/core/lib/utils/formUtil").findComponents;
|
40
|
-
eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => Promise<void>;
|
41
|
-
eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => void;
|
40
|
+
eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataAsyncCallback | undefined) => Promise<void>;
|
41
|
+
eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined, afterFn?: import("@formio/core").EachComponentDataCallback | undefined) => void;
|
42
42
|
getComponentKey: typeof import("@formio/core/lib/utils/formUtil").getComponentKey;
|
43
|
-
getContextualRowPath:
|
43
|
+
getContextualRowPath: any;
|
44
44
|
getContextualRowData: typeof import("@formio/core/lib/utils/formUtil").getContextualRowData;
|
45
45
|
componentInfo: typeof import("@formio/core/lib/utils/formUtil").componentInfo;
|
46
46
|
eachComponent: typeof import("@formio/core/lib/utils/formUtil").eachComponent;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.2.1-rc.
|
3
|
+
"version": "5.2.1-rc.11",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"exports": {
|
@@ -79,8 +79,8 @@
|
|
79
79
|
},
|
80
80
|
"homepage": "https://github.com/formio/formio.js#readme",
|
81
81
|
"dependencies": {
|
82
|
-
"@formio/bootstrap": "3.1.2-rc.
|
83
|
-
"@formio/core": "2.5.1-rc.
|
82
|
+
"@formio/bootstrap": "3.1.2-rc.3",
|
83
|
+
"@formio/core": "2.5.1-rc.8",
|
84
84
|
"@formio/text-mask-addons": "^3.8.0-formio.4",
|
85
85
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
86
86
|
"abortcontroller-polyfill": "^1.7.5",
|