@formio/js 5.0.0-dev.5613.3476921 → 5.0.0-dev.5614.ea3660d
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.form.js +18 -18
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +20 -20
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.utils.js +1 -1
- package/dist/formio.utils.min.js +1 -1
- package/lib/cjs/Element.d.ts +1 -2
- package/lib/cjs/Element.js +8 -17
- package/lib/cjs/Form.js +1 -15
- package/lib/cjs/PDF.js +1 -8
- package/lib/cjs/PDFBuilder.js +3 -3
- package/lib/cjs/Webform.d.ts +1 -0
- package/lib/cjs/Webform.js +12 -17
- package/lib/cjs/WebformBuilder.d.ts +1 -0
- package/lib/cjs/WebformBuilder.js +10 -5
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/addons/FormioAddon.d.ts +0 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +4 -7
- package/lib/cjs/components/_classes/component/Component.js +8 -45
- package/lib/cjs/components/_classes/input/Input.js +1 -16
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +2 -2
- package/lib/cjs/components/_classes/nested/NestedComponent.js +7 -8
- package/lib/cjs/components/columns/Columns.js +2 -2
- package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -1
- package/lib/cjs/components/editgrid/EditGrid.js +7 -21
- package/lib/cjs/components/file/File.d.ts +0 -1
- package/lib/cjs/components/file/File.js +2 -2
- package/lib/cjs/components/form/Form.js +3 -3
- package/lib/cjs/components/select/Select.js +2 -4
- package/lib/cjs/components/table/Table.d.ts +1 -0
- package/lib/cjs/components/table/Table.js +1 -1
- package/lib/cjs/components/tags/Tags.js +2 -4
- package/lib/cjs/translations/en.d.ts +0 -1
- package/lib/cjs/translations/en.js +0 -1
- package/lib/cjs/utils/utils.d.ts +1 -1
- package/lib/cjs/utils/utils.js +2 -14
- package/lib/cjs/widgets/CalendarWidget.js +2 -2
- package/lib/mjs/Element.d.ts +1 -2
- package/lib/mjs/Element.js +8 -17
- package/lib/mjs/Form.js +1 -15
- package/lib/mjs/PDF.js +1 -8
- package/lib/mjs/PDFBuilder.js +3 -3
- package/lib/mjs/Webform.d.ts +1 -0
- package/lib/mjs/Webform.js +12 -17
- package/lib/mjs/WebformBuilder.d.ts +1 -0
- package/lib/mjs/WebformBuilder.js +9 -5
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/addons/FormioAddon.d.ts +0 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +4 -7
- package/lib/mjs/components/_classes/component/Component.js +8 -45
- package/lib/mjs/components/_classes/input/Input.js +1 -16
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +2 -2
- package/lib/mjs/components/_classes/nested/NestedComponent.js +7 -8
- package/lib/mjs/components/columns/Columns.js +2 -2
- package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +7 -20
- package/lib/mjs/components/file/File.d.ts +0 -1
- package/lib/mjs/components/file/File.js +2 -2
- package/lib/mjs/components/form/Form.js +3 -3
- package/lib/mjs/components/select/Select.js +2 -4
- package/lib/mjs/components/table/Table.d.ts +1 -0
- package/lib/mjs/components/table/Table.js +1 -1
- package/lib/mjs/components/tags/Tags.js +2 -4
- package/lib/mjs/translations/en.d.ts +0 -1
- package/lib/mjs/translations/en.js +0 -1
- package/lib/mjs/utils/utils.d.ts +1 -1
- package/lib/mjs/utils/utils.js +1 -2
- package/lib/mjs/widgets/CalendarWidget.js +2 -2
- package/package.json +1 -1
package/lib/cjs/Element.d.ts
CHANGED
|
@@ -117,11 +117,10 @@ export default class Element {
|
|
|
117
117
|
removeEventListener(obj: any, type: any, func?: null): this | undefined;
|
|
118
118
|
removeEventListeners(): void;
|
|
119
119
|
removeAllEvents(includeExternal: any): void;
|
|
120
|
-
teardown(): void;
|
|
121
120
|
/**
|
|
122
121
|
* Removes all event listeners attached to this component.
|
|
123
122
|
*/
|
|
124
|
-
destroy(
|
|
123
|
+
destroy(): void;
|
|
125
124
|
/**
|
|
126
125
|
* Append an HTML DOM element to a container.
|
|
127
126
|
*
|
package/lib/cjs/Element.js
CHANGED
|
@@ -259,29 +259,20 @@ class Element {
|
|
|
259
259
|
this.eventHandlers = [];
|
|
260
260
|
}
|
|
261
261
|
removeAllEvents(includeExternal) {
|
|
262
|
-
|
|
263
|
-
lodash_1.default.each(
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
});
|
|
262
|
+
lodash_1.default.each(this.events._events, (events, type) => {
|
|
263
|
+
lodash_1.default.each(events, (listener) => {
|
|
264
|
+
if (listener && (this.id === listener.id) && (includeExternal || listener.internal)) {
|
|
265
|
+
this.events.off(type, listener);
|
|
266
|
+
}
|
|
269
267
|
});
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
teardown() {
|
|
273
|
-
delete this.i18next;
|
|
274
|
-
delete this.events;
|
|
268
|
+
});
|
|
275
269
|
}
|
|
276
270
|
/**
|
|
277
271
|
* Removes all event listeners attached to this component.
|
|
278
272
|
*/
|
|
279
|
-
destroy(
|
|
273
|
+
destroy() {
|
|
280
274
|
this.removeEventListeners();
|
|
281
275
|
this.removeAllEvents();
|
|
282
|
-
if (all) {
|
|
283
|
-
this.teardown();
|
|
284
|
-
}
|
|
285
276
|
}
|
|
286
277
|
/**
|
|
287
278
|
* Append an HTML DOM element to a container.
|
|
@@ -426,7 +417,7 @@ class Element {
|
|
|
426
417
|
* @param {Object} params - The i18n parameters to use for translation.
|
|
427
418
|
*/
|
|
428
419
|
t(text, ...args) {
|
|
429
|
-
return this.i18next
|
|
420
|
+
return this.i18next.t(text, ...args);
|
|
430
421
|
}
|
|
431
422
|
/**
|
|
432
423
|
* Alias to create a text node.
|
package/lib/cjs/Form.js
CHANGED
|
@@ -63,9 +63,6 @@ class Form extends Element_1.default {
|
|
|
63
63
|
});
|
|
64
64
|
this.instance = null;
|
|
65
65
|
if (args[0] instanceof HTMLElement) {
|
|
66
|
-
if (this.element) {
|
|
67
|
-
delete this.element.component;
|
|
68
|
-
}
|
|
69
66
|
this.element = args[0];
|
|
70
67
|
this.options = args[2] || {};
|
|
71
68
|
this.options.events = this.events;
|
|
@@ -157,7 +154,7 @@ class Form extends Element_1.default {
|
|
|
157
154
|
* @return {*}
|
|
158
155
|
*/
|
|
159
156
|
set form(formParam) {
|
|
160
|
-
this.setForm(formParam);
|
|
157
|
+
return this.setForm(formParam);
|
|
161
158
|
}
|
|
162
159
|
errorForm(err) {
|
|
163
160
|
return {
|
|
@@ -255,9 +252,6 @@ class Form extends Element_1.default {
|
|
|
255
252
|
}
|
|
256
253
|
// A redraw has occurred so save off the new element in case of a setDisplay causing a rebuild.
|
|
257
254
|
return result.then(() => {
|
|
258
|
-
if (this.element) {
|
|
259
|
-
delete this.element.component;
|
|
260
|
-
}
|
|
261
255
|
this.element = this.instance.element;
|
|
262
256
|
return this.instance;
|
|
263
257
|
});
|
|
@@ -378,9 +372,6 @@ class Form extends Element_1.default {
|
|
|
378
372
|
if (!this.instance) {
|
|
379
373
|
return Promise.reject('Form not ready. Use form.ready promise');
|
|
380
374
|
}
|
|
381
|
-
if (this.element) {
|
|
382
|
-
delete this.element.component;
|
|
383
|
-
}
|
|
384
375
|
this.element = element;
|
|
385
376
|
return this.instance.attach(this.element)
|
|
386
377
|
.then((param) => {
|
|
@@ -388,11 +379,6 @@ class Form extends Element_1.default {
|
|
|
388
379
|
return param;
|
|
389
380
|
});
|
|
390
381
|
}
|
|
391
|
-
teardown() {
|
|
392
|
-
super.teardown();
|
|
393
|
-
delete this.instance;
|
|
394
|
-
delete this.ready;
|
|
395
|
-
}
|
|
396
382
|
}
|
|
397
383
|
exports.default = Form;
|
|
398
384
|
// Allow simple embedding.
|
package/lib/cjs/PDF.js
CHANGED
|
@@ -62,15 +62,8 @@ class PDF extends Webform_1.default {
|
|
|
62
62
|
this.postMessage({ name: 'redraw' });
|
|
63
63
|
return this.builderMode ? Promise.resolve() : super.redraw();
|
|
64
64
|
}
|
|
65
|
-
destroy(all = false) {
|
|
66
|
-
if (this.iframeElement) {
|
|
67
|
-
delete this.iframeElement.formioComponent;
|
|
68
|
-
this.iframeElement.formioComponent = null;
|
|
69
|
-
}
|
|
70
|
-
super.destroy(all);
|
|
71
|
-
}
|
|
72
65
|
rebuild() {
|
|
73
|
-
if (this.
|
|
66
|
+
if (this.builderMode && this.component.components) {
|
|
74
67
|
this.destroyComponents();
|
|
75
68
|
this.addComponents();
|
|
76
69
|
return Promise.resolve();
|
package/lib/cjs/PDFBuilder.js
CHANGED
|
@@ -257,9 +257,9 @@ class PDFBuilder extends WebformBuilder_1.default {
|
|
|
257
257
|
});
|
|
258
258
|
return this.webform;
|
|
259
259
|
}
|
|
260
|
-
destroy(
|
|
261
|
-
super.destroy(
|
|
262
|
-
this.webform.destroy(
|
|
260
|
+
destroy(deleteFromGlobal) {
|
|
261
|
+
super.destroy(deleteFromGlobal);
|
|
262
|
+
this.webform.destroy(deleteFromGlobal);
|
|
263
263
|
}
|
|
264
264
|
// d8b 8888888888 888
|
|
265
265
|
// Y8P 888 888
|
package/lib/cjs/Webform.d.ts
CHANGED
|
@@ -382,6 +382,7 @@ declare class Webform extends NestedDataComponent {
|
|
|
382
382
|
*/
|
|
383
383
|
init(): Promise<any>;
|
|
384
384
|
executeFormController(): false | undefined;
|
|
385
|
+
destroy(deleteFromGlobal?: boolean): void;
|
|
385
386
|
build(element: any): Promise<any>;
|
|
386
387
|
getClassName(): string;
|
|
387
388
|
render(): any;
|
package/lib/cjs/Webform.js
CHANGED
|
@@ -170,7 +170,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
172
|
};
|
|
173
|
-
this.
|
|
173
|
+
this.element = element;
|
|
174
174
|
// Keep track of all available forms globally.
|
|
175
175
|
Formio_1.Formio.forms[this.id] = this;
|
|
176
176
|
// Set the base url.
|
|
@@ -359,12 +359,10 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
359
359
|
* @return {*}
|
|
360
360
|
*/
|
|
361
361
|
addLanguage(code, lang, active = false) {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
this.language = code;
|
|
367
|
-
}
|
|
362
|
+
var translations = lodash_1.default.assign((0, utils_1.fastCloneDeep)(i18n_1.default.resources.en.translation), lang);
|
|
363
|
+
this.i18next.addResourceBundle(code, 'translation', translations, true, true);
|
|
364
|
+
if (active) {
|
|
365
|
+
this.language = code;
|
|
368
366
|
}
|
|
369
367
|
}
|
|
370
368
|
keyboardCatchableElement(element) {
|
|
@@ -911,21 +909,18 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
911
909
|
});
|
|
912
910
|
});
|
|
913
911
|
}
|
|
914
|
-
|
|
915
|
-
this.emit('formDelete', this.id);
|
|
916
|
-
delete Formio_1.Formio.forms[this.id];
|
|
917
|
-
delete this.executeShortcuts;
|
|
918
|
-
delete this.triggerSaveDraft;
|
|
919
|
-
super.teardown();
|
|
920
|
-
}
|
|
921
|
-
destroy(all = false) {
|
|
912
|
+
destroy(deleteFromGlobal = false) {
|
|
922
913
|
this.off('submitButton');
|
|
923
914
|
this.off('checkValidity');
|
|
924
915
|
this.off('requestUrl');
|
|
925
916
|
this.off('resetForm');
|
|
926
917
|
this.off('deleteSubmission');
|
|
927
918
|
this.off('refreshData');
|
|
928
|
-
|
|
919
|
+
if (deleteFromGlobal) {
|
|
920
|
+
this.emit('formDelete', this.id);
|
|
921
|
+
delete Formio_1.Formio.forms[this.id];
|
|
922
|
+
}
|
|
923
|
+
return super.destroy();
|
|
929
924
|
}
|
|
930
925
|
build(element) {
|
|
931
926
|
if (element || this.element) {
|
|
@@ -959,7 +954,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
959
954
|
return this.attach(this.element);
|
|
960
955
|
}
|
|
961
956
|
attach(element) {
|
|
962
|
-
this.
|
|
957
|
+
this.element = element;
|
|
963
958
|
this.loadRefs(element, { webform: 'single' });
|
|
964
959
|
const childPromise = this.attachComponents(this.refs.webform);
|
|
965
960
|
this.addEventListener(document, 'keydown', this.executeShortcuts);
|
|
@@ -118,6 +118,7 @@ export default class WebformBuilder extends Component {
|
|
|
118
118
|
isParentSaveChildMethod(parentComp: any): boolean;
|
|
119
119
|
getParentElement(element: any): any;
|
|
120
120
|
addBuilderComponentInfo(component: any): any;
|
|
121
|
+
destroy(deleteFromGlobal: any): void;
|
|
121
122
|
addBuilderGroup(name: any, group: any): void;
|
|
122
123
|
updateBuilderGroup(name: any, group: any): void;
|
|
123
124
|
generateKey(info: any): any;
|
|
@@ -50,7 +50,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
50
50
|
this.stopMoving(this.selectedComponent);
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
this.
|
|
53
|
+
this.element = element;
|
|
54
54
|
this.dragulaLib = dragula_1.default;
|
|
55
55
|
this.builderHeight = 0;
|
|
56
56
|
this.schemas = {};
|
|
@@ -1119,11 +1119,16 @@ class WebformBuilder extends Component_1.default {
|
|
|
1119
1119
|
const repeatablePaths = this.findRepeatablePaths();
|
|
1120
1120
|
let hasInvalidComponents = false;
|
|
1121
1121
|
this.webform.everyComponent((comp) => {
|
|
1122
|
+
var _a;
|
|
1122
1123
|
const path = comp.path;
|
|
1124
|
+
const errors = comp.visibleErrors || [];
|
|
1123
1125
|
if (repeatablePaths.includes(path)) {
|
|
1124
|
-
comp.setCustomValidity(
|
|
1126
|
+
comp.setCustomValidity(`API Key is not unique: ${comp.key}`);
|
|
1125
1127
|
hasInvalidComponents = true;
|
|
1126
1128
|
}
|
|
1129
|
+
else if (errors.length && ((_a = errors[0].message) === null || _a === void 0 ? void 0 : _a.startsWith('API Key is not unique'))) {
|
|
1130
|
+
comp.setCustomValidity('');
|
|
1131
|
+
}
|
|
1127
1132
|
});
|
|
1128
1133
|
this.emit('builderFormValidityChange', hasInvalidComponents);
|
|
1129
1134
|
}
|
|
@@ -1576,11 +1581,11 @@ class WebformBuilder extends Component_1.default {
|
|
|
1576
1581
|
this.webform.clear();
|
|
1577
1582
|
}
|
|
1578
1583
|
}
|
|
1579
|
-
destroy(
|
|
1584
|
+
destroy(deleteFromGlobal) {
|
|
1580
1585
|
if (this.webform.initialized) {
|
|
1581
|
-
this.webform.destroy(
|
|
1586
|
+
this.webform.destroy(deleteFromGlobal);
|
|
1582
1587
|
}
|
|
1583
|
-
super.destroy(
|
|
1588
|
+
super.destroy(deleteFromGlobal);
|
|
1584
1589
|
}
|
|
1585
1590
|
addBuilderGroup(name, group) {
|
|
1586
1591
|
if (!this.groups[name]) {
|
package/lib/cjs/Wizard.js
CHANGED
|
@@ -335,6 +335,7 @@ declare class Component extends Element {
|
|
|
335
335
|
createComponentModal(element: any, modalShouldBeOpened: any, currentValue: any): ComponentModal;
|
|
336
336
|
attach(element: any): Promise<void>;
|
|
337
337
|
componentModal: any;
|
|
338
|
+
element: any;
|
|
338
339
|
restoreFocus(): void;
|
|
339
340
|
addShortcut(element: any, shortcut: any): void;
|
|
340
341
|
removeShortcut(element: any, shortcut: any): void;
|
|
@@ -363,8 +364,6 @@ declare class Component extends Element {
|
|
|
363
364
|
*/
|
|
364
365
|
inContext(component: any): boolean;
|
|
365
366
|
get viewOnly(): any;
|
|
366
|
-
setElement(element: any): void;
|
|
367
|
-
element: any;
|
|
368
367
|
createViewOnlyElement(): any;
|
|
369
368
|
get defaultViewOnlyValue(): string;
|
|
370
369
|
/**
|
|
@@ -492,12 +491,10 @@ declare class Component extends Element {
|
|
|
492
491
|
/**
|
|
493
492
|
* Add a new input error to this element.
|
|
494
493
|
*
|
|
495
|
-
* @param
|
|
494
|
+
* @param message
|
|
495
|
+
* @param dirty
|
|
496
496
|
*/
|
|
497
|
-
addMessages(messages:
|
|
498
|
-
level: string;
|
|
499
|
-
message: string;
|
|
500
|
-
}[]): void;
|
|
497
|
+
addMessages(messages: any): void;
|
|
501
498
|
setErrorClasses(elements: any, dirty: any, hasErrors: any, hasMessages: any, element?: any): void;
|
|
502
499
|
setElementInvalid(element: any, invalid: any): void;
|
|
503
500
|
clearOnHide(): void;
|
|
@@ -529,30 +529,10 @@ class Component extends Element_1.default {
|
|
|
529
529
|
}
|
|
530
530
|
return addon;
|
|
531
531
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
delete this.element.component;
|
|
535
|
-
delete this.element;
|
|
536
|
-
}
|
|
537
|
-
delete this._currentForm;
|
|
538
|
-
delete this.parent;
|
|
539
|
-
delete this.root;
|
|
540
|
-
delete this.triggerChange;
|
|
541
|
-
delete this.triggerRedraw;
|
|
542
|
-
if (this.options) {
|
|
543
|
-
delete this.options.root;
|
|
544
|
-
delete this.options.parent;
|
|
545
|
-
delete this.options.i18next;
|
|
546
|
-
}
|
|
547
|
-
super.teardown();
|
|
548
|
-
}
|
|
549
|
-
destroy(all = false) {
|
|
550
|
-
super.destroy(all);
|
|
532
|
+
destroy() {
|
|
533
|
+
super.destroy();
|
|
551
534
|
this.detach();
|
|
552
535
|
this.addons.forEach((addon) => addon.destroy());
|
|
553
|
-
if (all) {
|
|
554
|
-
this.teardown();
|
|
555
|
-
}
|
|
556
536
|
}
|
|
557
537
|
get shouldDisabled() {
|
|
558
538
|
return this.options.readOnly || this.component.disabled || (this.options.hasOwnProperty('disabled') && this.options.disabled[this.key]);
|
|
@@ -1106,7 +1086,7 @@ class Component extends Element_1.default {
|
|
|
1106
1086
|
this.setOpenModalElement(openModalTemplate);
|
|
1107
1087
|
}
|
|
1108
1088
|
this.attached = true;
|
|
1109
|
-
this.
|
|
1089
|
+
this.element = element;
|
|
1110
1090
|
element.component = this;
|
|
1111
1091
|
// If this already has an id, get it from the dom. If SSR, it could be different from the initiated id.
|
|
1112
1092
|
if (this.element.id) {
|
|
@@ -1165,17 +1145,6 @@ class Component extends Element_1.default {
|
|
|
1165
1145
|
* Remove all event handlers.
|
|
1166
1146
|
*/
|
|
1167
1147
|
detach() {
|
|
1168
|
-
// First iterate through each ref and delete the component so there are no dangling component references.
|
|
1169
|
-
lodash_1.default.each(this.refs, (ref) => {
|
|
1170
|
-
if (typeof ref === NodeList) {
|
|
1171
|
-
ref.forEach((elem) => {
|
|
1172
|
-
delete elem.component;
|
|
1173
|
-
});
|
|
1174
|
-
}
|
|
1175
|
-
else if (ref) {
|
|
1176
|
-
delete ref.component;
|
|
1177
|
-
}
|
|
1178
|
-
});
|
|
1179
1148
|
this.refs = {};
|
|
1180
1149
|
this.removeEventListeners();
|
|
1181
1150
|
this.detachLogic();
|
|
@@ -1263,17 +1232,10 @@ class Component extends Element_1.default {
|
|
|
1263
1232
|
get viewOnly() {
|
|
1264
1233
|
return this.options.readOnly && this.options.viewAsHtml;
|
|
1265
1234
|
}
|
|
1266
|
-
setElement(element) {
|
|
1267
|
-
if (this.element) {
|
|
1268
|
-
delete this.element.component;
|
|
1269
|
-
delete this.element;
|
|
1270
|
-
}
|
|
1271
|
-
this.element = element;
|
|
1272
|
-
}
|
|
1273
1235
|
createViewOnlyElement() {
|
|
1274
|
-
this.
|
|
1236
|
+
this.element = this.ce('dl', {
|
|
1275
1237
|
id: this.id
|
|
1276
|
-
})
|
|
1238
|
+
});
|
|
1277
1239
|
if (this.element) {
|
|
1278
1240
|
// Ensure you can get the component info from the element.
|
|
1279
1241
|
this.element.component = this;
|
|
@@ -1592,7 +1554,7 @@ class Component extends Element_1.default {
|
|
|
1592
1554
|
const parent = this.element.parentNode;
|
|
1593
1555
|
const index = Array.prototype.indexOf.call(parent.children, this.element);
|
|
1594
1556
|
this.element.outerHTML = this.sanitize(this.render());
|
|
1595
|
-
this.
|
|
1557
|
+
this.element = parent.children[index];
|
|
1596
1558
|
return this.attach(this.element);
|
|
1597
1559
|
}
|
|
1598
1560
|
rebuild() {
|
|
@@ -1831,7 +1793,8 @@ class Component extends Element_1.default {
|
|
|
1831
1793
|
/**
|
|
1832
1794
|
* Add a new input error to this element.
|
|
1833
1795
|
*
|
|
1834
|
-
* @param
|
|
1796
|
+
* @param message
|
|
1797
|
+
* @param dirty
|
|
1835
1798
|
*/
|
|
1836
1799
|
addMessages(messages) {
|
|
1837
1800
|
if (!messages) {
|
|
@@ -272,22 +272,8 @@ class Input extends Multivalue_1.default {
|
|
|
272
272
|
widget.on('redraw', () => this.redraw(), true);
|
|
273
273
|
return widget;
|
|
274
274
|
}
|
|
275
|
-
teardown() {
|
|
276
|
-
if (this.element && this.element.widget) {
|
|
277
|
-
this.element.widget.destroy();
|
|
278
|
-
delete this.element.widget;
|
|
279
|
-
}
|
|
280
|
-
if (this.refs && this.refs.input) {
|
|
281
|
-
for (let i = 0; i <= this.refs.input.length; i++) {
|
|
282
|
-
const widget = this.getWidget(i);
|
|
283
|
-
if (widget) {
|
|
284
|
-
widget.destroy();
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
super.teardown();
|
|
289
|
-
}
|
|
290
275
|
detach() {
|
|
276
|
+
super.detach();
|
|
291
277
|
if (this.refs && this.refs.input) {
|
|
292
278
|
for (let i = 0; i <= this.refs.input.length; i++) {
|
|
293
279
|
const widget = this.getWidget(i);
|
|
@@ -297,7 +283,6 @@ class Input extends Multivalue_1.default {
|
|
|
297
283
|
}
|
|
298
284
|
}
|
|
299
285
|
this.refs.input = [];
|
|
300
|
-
super.detach();
|
|
301
286
|
}
|
|
302
287
|
}
|
|
303
288
|
exports.default = Input;
|
|
@@ -82,7 +82,7 @@ export default class NestedComponent extends Field {
|
|
|
82
82
|
* @param {Component} component - The component to remove from the components.
|
|
83
83
|
* @param {Array<Component>} components - An array of components to remove this component from.
|
|
84
84
|
*/
|
|
85
|
-
removeComponent(component: Component, components: Array<Component
|
|
85
|
+
removeComponent(component: Component, components: Array<Component>): void;
|
|
86
86
|
/**
|
|
87
87
|
* Removes a component provided the API key of that component.
|
|
88
88
|
*
|
|
@@ -140,7 +140,7 @@ export default class NestedComponent extends Field {
|
|
|
140
140
|
checkAsyncValidity(data: any, dirty: any, row: any, silentCheck: any): Promise<any>;
|
|
141
141
|
setPristine(pristine: any): void;
|
|
142
142
|
get isPristine(): any;
|
|
143
|
-
destroyComponents(
|
|
143
|
+
destroyComponents(): void;
|
|
144
144
|
get visibleErrors(): any;
|
|
145
145
|
get errors(): any;
|
|
146
146
|
get dataReady(): Promise<any[]>;
|
|
@@ -329,7 +329,6 @@ class NestedComponent extends Field_1.default {
|
|
|
329
329
|
*/
|
|
330
330
|
addComponents(data, options) {
|
|
331
331
|
data = data || this.data;
|
|
332
|
-
this.components = this.components || [];
|
|
333
332
|
options = options || this.options;
|
|
334
333
|
if (options.components) {
|
|
335
334
|
this.components = options.components;
|
|
@@ -441,9 +440,9 @@ class NestedComponent extends Field_1.default {
|
|
|
441
440
|
* @param {Component} component - The component to remove from the components.
|
|
442
441
|
* @param {Array<Component>} components - An array of components to remove this component from.
|
|
443
442
|
*/
|
|
444
|
-
removeComponent(component, components
|
|
443
|
+
removeComponent(component, components) {
|
|
445
444
|
components = components || this.components;
|
|
446
|
-
component.destroy(
|
|
445
|
+
component.destroy();
|
|
447
446
|
lodash_1.default.remove(components, { id: component.id });
|
|
448
447
|
if (this.componentsMap[component.path]) {
|
|
449
448
|
delete this.componentsMap[component.path];
|
|
@@ -668,13 +667,13 @@ class NestedComponent extends Field_1.default {
|
|
|
668
667
|
});
|
|
669
668
|
super.clear();
|
|
670
669
|
}
|
|
671
|
-
destroy(
|
|
672
|
-
this.destroyComponents(
|
|
673
|
-
super.destroy(
|
|
670
|
+
destroy() {
|
|
671
|
+
this.destroyComponents();
|
|
672
|
+
super.destroy();
|
|
674
673
|
}
|
|
675
|
-
destroyComponents(
|
|
674
|
+
destroyComponents() {
|
|
676
675
|
const components = this.getComponents().slice();
|
|
677
|
-
components.forEach((comp) => this.removeComponent(comp, this.components
|
|
676
|
+
components.forEach((comp) => this.removeComponent(comp, this.components));
|
|
678
677
|
this.components = [];
|
|
679
678
|
}
|
|
680
679
|
get visibleErrors() {
|
|
@@ -52,7 +52,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
52
52
|
renderRow(row: any, rowIndex: any): any;
|
|
53
53
|
eachComponent(fn: any, rowIndex: any): void;
|
|
54
54
|
flattenComponents(rowIndex: any): {};
|
|
55
|
-
destroyComponents(
|
|
55
|
+
destroyComponents(rowIndex: any): void;
|
|
56
56
|
createRow(dataObj: any, rowIndex: any): {
|
|
57
57
|
components: any;
|
|
58
58
|
data: any;
|
|
@@ -570,25 +570,20 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
570
570
|
return result;
|
|
571
571
|
}
|
|
572
572
|
getComponents(rowIndex) {
|
|
573
|
-
var _a;
|
|
574
573
|
// Ensure editrows is set.
|
|
575
574
|
this.editRows = this.editRows || [];
|
|
576
575
|
return this.builderMode
|
|
577
576
|
? super.getComponents()
|
|
578
577
|
: lodash_1.default.isNumber(rowIndex)
|
|
579
|
-
? (
|
|
578
|
+
? (this.editRows[rowIndex].components || [])
|
|
580
579
|
: this.editRows.reduce((result, row) => result.concat(row.components || []), []);
|
|
581
580
|
}
|
|
582
|
-
|
|
583
|
-
this.calculatedValue = undefined;
|
|
584
|
-
super.destroy(all);
|
|
585
|
-
}
|
|
586
|
-
destroyComponents(all = false, rowIndex = 0) {
|
|
581
|
+
destroyComponents(rowIndex) {
|
|
587
582
|
if (this.builderMode) {
|
|
588
|
-
return super.destroyComponents(
|
|
583
|
+
return super.destroyComponents();
|
|
589
584
|
}
|
|
590
585
|
const components = this.getComponents(rowIndex).slice();
|
|
591
|
-
components.forEach((comp) => this.removeComponent(comp, this.components
|
|
586
|
+
components.forEach((comp) => this.removeComponent(comp, this.components));
|
|
592
587
|
}
|
|
593
588
|
createRow(dataObj, rowIndex) {
|
|
594
589
|
const editRow = {
|
|
@@ -761,7 +756,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
761
756
|
case EditRowState.New: {
|
|
762
757
|
editRow.state = EditRowState.Removed;
|
|
763
758
|
this.clearErrors(rowIndex);
|
|
764
|
-
this.destroyComponents(
|
|
759
|
+
this.destroyComponents(rowIndex);
|
|
765
760
|
if (this.inlineEditMode) {
|
|
766
761
|
this.splice(rowIndex);
|
|
767
762
|
}
|
|
@@ -880,7 +875,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
880
875
|
baseRemoveRow(rowIndex) {
|
|
881
876
|
const editRow = this.editRows[rowIndex];
|
|
882
877
|
editRow.state = EditRowState.Removed;
|
|
883
|
-
this.destroyComponents(
|
|
878
|
+
this.destroyComponents(rowIndex);
|
|
884
879
|
return editRow;
|
|
885
880
|
}
|
|
886
881
|
removeRow(rowIndex, modified) {
|
|
@@ -903,15 +898,6 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
903
898
|
this.redraw();
|
|
904
899
|
}
|
|
905
900
|
createRowComponents(row, rowIndex, recreatePartially) {
|
|
906
|
-
// Iterate through existing components and destroy the ones with the same rowIndex.
|
|
907
|
-
if (this.components) {
|
|
908
|
-
for (let i = 0; i < this.components.length; i++) {
|
|
909
|
-
if (this.components[i].rowIndex === rowIndex) {
|
|
910
|
-
this.components[i].destroy();
|
|
911
|
-
this.components.splice(i, 1);
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
901
|
const currentRowComponents = lodash_1.default.get(this.editRows, `[${rowIndex}].components`, null);
|
|
916
902
|
return this.component.components.map((col, colIndex) => {
|
|
917
903
|
var _a;
|
|
@@ -1193,7 +1179,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
1193
1179
|
});
|
|
1194
1180
|
}
|
|
1195
1181
|
emptyRows() {
|
|
1196
|
-
this.editRows.forEach((editRow, index) => this.destroyComponents(
|
|
1182
|
+
this.editRows.forEach((editRow, index) => this.destroyComponents(index));
|
|
1197
1183
|
this.editRows = [];
|
|
1198
1184
|
}
|
|
1199
1185
|
resetValue() {
|
|
@@ -332,13 +332,13 @@ class FormComponent extends Component_1.default {
|
|
|
332
332
|
&& lodash_1.default.isNumber(this.formObj._vid)
|
|
333
333
|
&& this.formObj._vid !== this.subFormRevision;
|
|
334
334
|
}
|
|
335
|
-
destroy(
|
|
335
|
+
destroy() {
|
|
336
336
|
if (this.subForm) {
|
|
337
|
-
this.subForm.destroy(
|
|
337
|
+
this.subForm.destroy();
|
|
338
338
|
this.subForm = null;
|
|
339
339
|
this.subFormReady = null;
|
|
340
340
|
}
|
|
341
|
-
super.destroy(
|
|
341
|
+
super.destroy();
|
|
342
342
|
}
|
|
343
343
|
redraw() {
|
|
344
344
|
if (this.subForm) {
|
|
@@ -811,9 +811,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
811
811
|
}
|
|
812
812
|
const tabIndex = input.tabIndex;
|
|
813
813
|
this.addPlaceholder();
|
|
814
|
-
|
|
815
|
-
input.setAttribute('dir', this.i18next.dir());
|
|
816
|
-
}
|
|
814
|
+
input.setAttribute('dir', this.i18next.dir());
|
|
817
815
|
if ((_c = (_b = (_a = this.choices) === null || _a === void 0 ? void 0 : _a.containerOuter) === null || _b === void 0 ? void 0 : _b.element) === null || _c === void 0 ? void 0 : _c.parentNode) {
|
|
818
816
|
this.choices.destroy();
|
|
819
817
|
}
|
|
@@ -1546,6 +1544,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1546
1544
|
}
|
|
1547
1545
|
detach() {
|
|
1548
1546
|
var _a, _b;
|
|
1547
|
+
super.detach();
|
|
1549
1548
|
this.off('blur');
|
|
1550
1549
|
if (this.choices) {
|
|
1551
1550
|
if ((_b = (_a = this.choices.containerOuter) === null || _a === void 0 ? void 0 : _a.element) === null || _b === void 0 ? void 0 : _b.parentNode) {
|
|
@@ -1553,7 +1552,6 @@ class SelectComponent extends ListComponent_1.default {
|
|
|
1553
1552
|
}
|
|
1554
1553
|
this.choices = null;
|
|
1555
1554
|
}
|
|
1556
|
-
super.detach();
|
|
1557
1555
|
}
|
|
1558
1556
|
focus() {
|
|
1559
1557
|
if (this.focusableElement) {
|