@formio/js 5.0.0-dev.5614.ea3660d → 5.0.0-dev.5620.dedc19b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +4 -2
- package/dist/formio.form.js +31 -21
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -0
- package/dist/formio.full.js +34 -24
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -0
- package/dist/formio.utils.js +13 -3
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -0
- package/lib/cjs/Element.d.ts +2 -1
- package/lib/cjs/Element.js +17 -8
- package/lib/cjs/Form.js +15 -1
- package/lib/cjs/PDF.js +8 -1
- package/lib/cjs/PDFBuilder.js +3 -3
- package/lib/cjs/Webform.d.ts +0 -1
- package/lib/cjs/Webform.js +17 -12
- package/lib/cjs/WebformBuilder.d.ts +0 -1
- package/lib/cjs/WebformBuilder.js +4 -4
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/addons/FormioAddon.d.ts +1 -0
- package/lib/cjs/components/_classes/component/Component.d.ts +2 -1
- package/lib/cjs/components/_classes/component/Component.js +46 -8
- package/lib/cjs/components/_classes/input/Input.js +16 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +2 -2
- package/lib/cjs/components/_classes/nested/NestedComponent.js +8 -7
- 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 +21 -7
- package/lib/cjs/components/file/File.d.ts +1 -0
- package/lib/cjs/components/file/File.js +2 -2
- package/lib/cjs/components/form/Form.js +3 -3
- package/lib/cjs/components/radio/Radio.d.ts +1 -1
- package/lib/cjs/components/radio/Radio.js +5 -3
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.d.ts +5 -0
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +3 -0
- package/lib/cjs/components/select/Select.js +10 -3
- package/lib/cjs/components/select/fixtures/comp23.d.ts +47 -0
- package/lib/cjs/components/select/fixtures/comp23.js +40 -0
- package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/select/fixtures/index.js +3 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.js +4 -1
- package/lib/cjs/components/table/Table.d.ts +0 -1
- package/lib/cjs/components/table/Table.js +1 -1
- package/lib/cjs/components/tags/Tags.js +4 -2
- package/lib/cjs/utils/utils.d.ts +7 -1
- package/lib/cjs/utils/utils.js +29 -3
- package/lib/cjs/widgets/CalendarWidget.js +2 -2
- package/lib/mjs/Element.d.ts +2 -1
- package/lib/mjs/Element.js +17 -8
- package/lib/mjs/Form.js +15 -1
- package/lib/mjs/PDF.js +8 -1
- package/lib/mjs/PDFBuilder.js +3 -3
- package/lib/mjs/Webform.d.ts +0 -1
- package/lib/mjs/Webform.js +17 -12
- package/lib/mjs/WebformBuilder.d.ts +0 -1
- package/lib/mjs/WebformBuilder.js +4 -4
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/addons/FormioAddon.d.ts +1 -0
- package/lib/mjs/components/_classes/component/Component.d.ts +2 -1
- package/lib/mjs/components/_classes/component/Component.js +47 -9
- package/lib/mjs/components/_classes/input/Input.js +16 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +2 -2
- package/lib/mjs/components/_classes/nested/NestedComponent.js +8 -7
- 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 +20 -7
- package/lib/mjs/components/file/File.d.ts +1 -0
- package/lib/mjs/components/file/File.js +2 -2
- package/lib/mjs/components/form/Form.js +3 -3
- package/lib/mjs/components/radio/Radio.d.ts +1 -1
- package/lib/mjs/components/radio/Radio.js +5 -3
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.d.ts +5 -0
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +3 -0
- package/lib/mjs/components/select/Select.js +10 -3
- package/lib/mjs/components/select/fixtures/comp23.d.ts +47 -0
- package/lib/mjs/components/select/fixtures/comp23.js +38 -0
- package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/select/fixtures/index.js +2 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.js +4 -1
- package/lib/mjs/components/table/Table.d.ts +0 -1
- package/lib/mjs/components/table/Table.js +1 -1
- package/lib/mjs/components/tags/Tags.js +4 -2
- package/lib/mjs/utils/utils.d.ts +7 -1
- package/lib/mjs/utils/utils.js +15 -1
- package/lib/mjs/widgets/CalendarWidget.js +2 -2
- package/package.json +2 -2
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
/*! @license DOMPurify 3.1.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.0/LICENSE */
|
|
14
14
|
|
|
15
|
+
/*! @license DOMPurify 3.1.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.1.4/LICENSE */
|
|
16
|
+
|
|
15
17
|
/*! formiojs v5.0.0-rc.43 | https://unpkg.com/formiojs@5.0.0-rc.43/LICENSE.txt */
|
|
16
18
|
|
|
17
19
|
/**
|
package/lib/cjs/Element.d.ts
CHANGED
|
@@ -117,10 +117,11 @@ 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;
|
|
120
121
|
/**
|
|
121
122
|
* Removes all event listeners attached to this component.
|
|
122
123
|
*/
|
|
123
|
-
destroy(): void;
|
|
124
|
+
destroy(all?: boolean): void;
|
|
124
125
|
/**
|
|
125
126
|
* Append an HTML DOM element to a container.
|
|
126
127
|
*
|
package/lib/cjs/Element.js
CHANGED
|
@@ -259,20 +259,29 @@ class Element {
|
|
|
259
259
|
this.eventHandlers = [];
|
|
260
260
|
}
|
|
261
261
|
removeAllEvents(includeExternal) {
|
|
262
|
-
|
|
263
|
-
lodash_1.default.each(events, (
|
|
264
|
-
|
|
265
|
-
this.
|
|
266
|
-
|
|
262
|
+
if (this.events) {
|
|
263
|
+
lodash_1.default.each(this.events._events, (events, type) => {
|
|
264
|
+
lodash_1.default.each(events, (listener) => {
|
|
265
|
+
if (listener && (this.id === listener.id) && (includeExternal || listener.internal)) {
|
|
266
|
+
this.events.off(type, listener);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
267
269
|
});
|
|
268
|
-
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
teardown() {
|
|
273
|
+
delete this.i18next;
|
|
274
|
+
delete this.events;
|
|
269
275
|
}
|
|
270
276
|
/**
|
|
271
277
|
* Removes all event listeners attached to this component.
|
|
272
278
|
*/
|
|
273
|
-
destroy() {
|
|
279
|
+
destroy(all = false) {
|
|
274
280
|
this.removeEventListeners();
|
|
275
281
|
this.removeAllEvents();
|
|
282
|
+
if (all) {
|
|
283
|
+
this.teardown();
|
|
284
|
+
}
|
|
276
285
|
}
|
|
277
286
|
/**
|
|
278
287
|
* Append an HTML DOM element to a container.
|
|
@@ -417,7 +426,7 @@ class Element {
|
|
|
417
426
|
* @param {Object} params - The i18n parameters to use for translation.
|
|
418
427
|
*/
|
|
419
428
|
t(text, ...args) {
|
|
420
|
-
return this.i18next.t(text, ...args);
|
|
429
|
+
return this.i18next ? this.i18next.t(text, ...args) : text;
|
|
421
430
|
}
|
|
422
431
|
/**
|
|
423
432
|
* Alias to create a text node.
|
package/lib/cjs/Form.js
CHANGED
|
@@ -63,6 +63,9 @@ 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
|
+
}
|
|
66
69
|
this.element = args[0];
|
|
67
70
|
this.options = args[2] || {};
|
|
68
71
|
this.options.events = this.events;
|
|
@@ -154,7 +157,7 @@ class Form extends Element_1.default {
|
|
|
154
157
|
* @return {*}
|
|
155
158
|
*/
|
|
156
159
|
set form(formParam) {
|
|
157
|
-
|
|
160
|
+
this.setForm(formParam);
|
|
158
161
|
}
|
|
159
162
|
errorForm(err) {
|
|
160
163
|
return {
|
|
@@ -252,6 +255,9 @@ class Form extends Element_1.default {
|
|
|
252
255
|
}
|
|
253
256
|
// A redraw has occurred so save off the new element in case of a setDisplay causing a rebuild.
|
|
254
257
|
return result.then(() => {
|
|
258
|
+
if (this.element) {
|
|
259
|
+
delete this.element.component;
|
|
260
|
+
}
|
|
255
261
|
this.element = this.instance.element;
|
|
256
262
|
return this.instance;
|
|
257
263
|
});
|
|
@@ -372,6 +378,9 @@ class Form extends Element_1.default {
|
|
|
372
378
|
if (!this.instance) {
|
|
373
379
|
return Promise.reject('Form not ready. Use form.ready promise');
|
|
374
380
|
}
|
|
381
|
+
if (this.element) {
|
|
382
|
+
delete this.element.component;
|
|
383
|
+
}
|
|
375
384
|
this.element = element;
|
|
376
385
|
return this.instance.attach(this.element)
|
|
377
386
|
.then((param) => {
|
|
@@ -379,6 +388,11 @@ class Form extends Element_1.default {
|
|
|
379
388
|
return param;
|
|
380
389
|
});
|
|
381
390
|
}
|
|
391
|
+
teardown() {
|
|
392
|
+
super.teardown();
|
|
393
|
+
delete this.instance;
|
|
394
|
+
delete this.ready;
|
|
395
|
+
}
|
|
382
396
|
}
|
|
383
397
|
exports.default = Form;
|
|
384
398
|
// Allow simple embedding.
|
package/lib/cjs/PDF.js
CHANGED
|
@@ -62,8 +62,15 @@ 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
|
+
}
|
|
65
72
|
rebuild() {
|
|
66
|
-
if (this.builderMode && this.component.components) {
|
|
73
|
+
if (this.attached && this.builderMode && this.component.components) {
|
|
67
74
|
this.destroyComponents();
|
|
68
75
|
this.addComponents();
|
|
69
76
|
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(all = false) {
|
|
261
|
+
super.destroy(all);
|
|
262
|
+
this.webform.destroy(all);
|
|
263
263
|
}
|
|
264
264
|
// d8b 8888888888 888
|
|
265
265
|
// Y8P 888 888
|
package/lib/cjs/Webform.d.ts
CHANGED
|
@@ -382,7 +382,6 @@ declare class Webform extends NestedDataComponent {
|
|
|
382
382
|
*/
|
|
383
383
|
init(): Promise<any>;
|
|
384
384
|
executeFormController(): false | undefined;
|
|
385
|
-
destroy(deleteFromGlobal?: boolean): void;
|
|
386
385
|
build(element: any): Promise<any>;
|
|
387
386
|
getClassName(): string;
|
|
388
387
|
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.element
|
|
173
|
+
this.setElement(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,10 +359,12 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
359
359
|
* @return {*}
|
|
360
360
|
*/
|
|
361
361
|
addLanguage(code, lang, active = false) {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
362
|
+
if (this.i18next) {
|
|
363
|
+
var translations = lodash_1.default.assign((0, utils_1.fastCloneDeep)(i18n_1.default.resources.en.translation), lang);
|
|
364
|
+
this.i18next.addResourceBundle(code, 'translation', translations, true, true);
|
|
365
|
+
if (active) {
|
|
366
|
+
this.language = code;
|
|
367
|
+
}
|
|
366
368
|
}
|
|
367
369
|
}
|
|
368
370
|
keyboardCatchableElement(element) {
|
|
@@ -909,18 +911,21 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
909
911
|
});
|
|
910
912
|
});
|
|
911
913
|
}
|
|
912
|
-
|
|
914
|
+
teardown() {
|
|
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) {
|
|
913
922
|
this.off('submitButton');
|
|
914
923
|
this.off('checkValidity');
|
|
915
924
|
this.off('requestUrl');
|
|
916
925
|
this.off('resetForm');
|
|
917
926
|
this.off('deleteSubmission');
|
|
918
927
|
this.off('refreshData');
|
|
919
|
-
|
|
920
|
-
this.emit('formDelete', this.id);
|
|
921
|
-
delete Formio_1.Formio.forms[this.id];
|
|
922
|
-
}
|
|
923
|
-
return super.destroy();
|
|
928
|
+
return super.destroy(all);
|
|
924
929
|
}
|
|
925
930
|
build(element) {
|
|
926
931
|
if (element || this.element) {
|
|
@@ -954,7 +959,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
954
959
|
return this.attach(this.element);
|
|
955
960
|
}
|
|
956
961
|
attach(element) {
|
|
957
|
-
this.element
|
|
962
|
+
this.setElement(element);
|
|
958
963
|
this.loadRefs(element, { webform: 'single' });
|
|
959
964
|
const childPromise = this.attachComponents(this.refs.webform);
|
|
960
965
|
this.addEventListener(document, 'keydown', this.executeShortcuts);
|
|
@@ -118,7 +118,6 @@ 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;
|
|
122
121
|
addBuilderGroup(name: any, group: any): void;
|
|
123
122
|
updateBuilderGroup(name: any, group: any): void;
|
|
124
123
|
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.element
|
|
53
|
+
this.setElement(element);
|
|
54
54
|
this.dragulaLib = dragula_1.default;
|
|
55
55
|
this.builderHeight = 0;
|
|
56
56
|
this.schemas = {};
|
|
@@ -1581,11 +1581,11 @@ class WebformBuilder extends Component_1.default {
|
|
|
1581
1581
|
this.webform.clear();
|
|
1582
1582
|
}
|
|
1583
1583
|
}
|
|
1584
|
-
destroy(
|
|
1584
|
+
destroy(all = false) {
|
|
1585
1585
|
if (this.webform.initialized) {
|
|
1586
|
-
this.webform.destroy(
|
|
1586
|
+
this.webform.destroy(all);
|
|
1587
1587
|
}
|
|
1588
|
-
super.destroy(
|
|
1588
|
+
super.destroy(all);
|
|
1589
1589
|
}
|
|
1590
1590
|
addBuilderGroup(name, group) {
|
|
1591
1591
|
if (!this.groups[name]) {
|
package/lib/cjs/Wizard.js
CHANGED
|
@@ -335,7 +335,6 @@ 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;
|
|
339
338
|
restoreFocus(): void;
|
|
340
339
|
addShortcut(element: any, shortcut: any): void;
|
|
341
340
|
removeShortcut(element: any, shortcut: any): void;
|
|
@@ -364,6 +363,8 @@ declare class Component extends Element {
|
|
|
364
363
|
*/
|
|
365
364
|
inContext(component: any): boolean;
|
|
366
365
|
get viewOnly(): any;
|
|
366
|
+
setElement(element: any): void;
|
|
367
|
+
element: any;
|
|
367
368
|
createViewOnlyElement(): any;
|
|
368
369
|
get defaultViewOnlyValue(): string;
|
|
369
370
|
/**
|
|
@@ -529,10 +529,30 @@ class Component extends Element_1.default {
|
|
|
529
529
|
}
|
|
530
530
|
return addon;
|
|
531
531
|
}
|
|
532
|
-
|
|
533
|
-
|
|
532
|
+
teardown() {
|
|
533
|
+
if (this.element) {
|
|
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);
|
|
534
551
|
this.detach();
|
|
535
552
|
this.addons.forEach((addon) => addon.destroy());
|
|
553
|
+
if (all) {
|
|
554
|
+
this.teardown();
|
|
555
|
+
}
|
|
536
556
|
}
|
|
537
557
|
get shouldDisabled() {
|
|
538
558
|
return this.options.readOnly || this.component.disabled || (this.options.hasOwnProperty('disabled') && this.options.disabled[this.key]);
|
|
@@ -1086,7 +1106,7 @@ class Component extends Element_1.default {
|
|
|
1086
1106
|
this.setOpenModalElement(openModalTemplate);
|
|
1087
1107
|
}
|
|
1088
1108
|
this.attached = true;
|
|
1089
|
-
this.element
|
|
1109
|
+
this.setElement(element);
|
|
1090
1110
|
element.component = this;
|
|
1091
1111
|
// If this already has an id, get it from the dom. If SSR, it could be different from the initiated id.
|
|
1092
1112
|
if (this.element.id) {
|
|
@@ -1145,6 +1165,17 @@ class Component extends Element_1.default {
|
|
|
1145
1165
|
* Remove all event handlers.
|
|
1146
1166
|
*/
|
|
1147
1167
|
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
|
+
});
|
|
1148
1179
|
this.refs = {};
|
|
1149
1180
|
this.removeEventListeners();
|
|
1150
1181
|
this.detachLogic();
|
|
@@ -1232,10 +1263,17 @@ class Component extends Element_1.default {
|
|
|
1232
1263
|
get viewOnly() {
|
|
1233
1264
|
return this.options.readOnly && this.options.viewAsHtml;
|
|
1234
1265
|
}
|
|
1266
|
+
setElement(element) {
|
|
1267
|
+
if (this.element) {
|
|
1268
|
+
delete this.element.component;
|
|
1269
|
+
delete this.element;
|
|
1270
|
+
}
|
|
1271
|
+
this.element = element;
|
|
1272
|
+
}
|
|
1235
1273
|
createViewOnlyElement() {
|
|
1236
|
-
this.
|
|
1274
|
+
this.setElement(this.ce('dl', {
|
|
1237
1275
|
id: this.id
|
|
1238
|
-
});
|
|
1276
|
+
}));
|
|
1239
1277
|
if (this.element) {
|
|
1240
1278
|
// Ensure you can get the component info from the element.
|
|
1241
1279
|
this.element.component = this;
|
|
@@ -1554,7 +1592,7 @@ class Component extends Element_1.default {
|
|
|
1554
1592
|
const parent = this.element.parentNode;
|
|
1555
1593
|
const index = Array.prototype.indexOf.call(parent.children, this.element);
|
|
1556
1594
|
this.element.outerHTML = this.sanitize(this.render());
|
|
1557
|
-
this.
|
|
1595
|
+
this.setElement(parent.children[index]);
|
|
1558
1596
|
return this.attach(this.element);
|
|
1559
1597
|
}
|
|
1560
1598
|
rebuild() {
|
|
@@ -3219,7 +3257,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3219
3257
|
}.bind(Component.externalLibraries[name]);
|
|
3220
3258
|
}
|
|
3221
3259
|
// See if the plugin already exists.
|
|
3222
|
-
const plugin =
|
|
3260
|
+
const plugin = (0, utils_1.getScriptPlugin)(property);
|
|
3223
3261
|
if (plugin) {
|
|
3224
3262
|
Component.externalLibraries[name].resolve(plugin);
|
|
3225
3263
|
}
|
|
@@ -3262,7 +3300,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3262
3300
|
// if no callback is provided, then check periodically for the script.
|
|
3263
3301
|
if (polling) {
|
|
3264
3302
|
setTimeout(function checkLibrary() {
|
|
3265
|
-
const plugin =
|
|
3303
|
+
const plugin = (0, utils_1.getScriptPlugin)(property);
|
|
3266
3304
|
if (plugin) {
|
|
3267
3305
|
Component.externalLibraries[name].resolve(plugin);
|
|
3268
3306
|
}
|
|
@@ -272,8 +272,22 @@ 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
|
+
}
|
|
275
290
|
detach() {
|
|
276
|
-
super.detach();
|
|
277
291
|
if (this.refs && this.refs.input) {
|
|
278
292
|
for (let i = 0; i <= this.refs.input.length; i++) {
|
|
279
293
|
const widget = this.getWidget(i);
|
|
@@ -283,6 +297,7 @@ class Input extends Multivalue_1.default {
|
|
|
283
297
|
}
|
|
284
298
|
}
|
|
285
299
|
this.refs.input = [];
|
|
300
|
+
super.detach();
|
|
286
301
|
}
|
|
287
302
|
}
|
|
288
303
|
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>, all?: boolean): 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(): void;
|
|
143
|
+
destroyComponents(all?: boolean): void;
|
|
144
144
|
get visibleErrors(): any;
|
|
145
145
|
get errors(): any;
|
|
146
146
|
get dataReady(): Promise<any[]>;
|
|
@@ -329,6 +329,7 @@ class NestedComponent extends Field_1.default {
|
|
|
329
329
|
*/
|
|
330
330
|
addComponents(data, options) {
|
|
331
331
|
data = data || this.data;
|
|
332
|
+
this.components = this.components || [];
|
|
332
333
|
options = options || this.options;
|
|
333
334
|
if (options.components) {
|
|
334
335
|
this.components = options.components;
|
|
@@ -440,9 +441,9 @@ class NestedComponent extends Field_1.default {
|
|
|
440
441
|
* @param {Component} component - The component to remove from the components.
|
|
441
442
|
* @param {Array<Component>} components - An array of components to remove this component from.
|
|
442
443
|
*/
|
|
443
|
-
removeComponent(component, components) {
|
|
444
|
+
removeComponent(component, components, all = false) {
|
|
444
445
|
components = components || this.components;
|
|
445
|
-
component.destroy();
|
|
446
|
+
component.destroy(all);
|
|
446
447
|
lodash_1.default.remove(components, { id: component.id });
|
|
447
448
|
if (this.componentsMap[component.path]) {
|
|
448
449
|
delete this.componentsMap[component.path];
|
|
@@ -667,13 +668,13 @@ class NestedComponent extends Field_1.default {
|
|
|
667
668
|
});
|
|
668
669
|
super.clear();
|
|
669
670
|
}
|
|
670
|
-
destroy() {
|
|
671
|
-
this.destroyComponents();
|
|
672
|
-
super.destroy();
|
|
671
|
+
destroy(all = false) {
|
|
672
|
+
this.destroyComponents(all);
|
|
673
|
+
super.destroy(all);
|
|
673
674
|
}
|
|
674
|
-
destroyComponents() {
|
|
675
|
+
destroyComponents(all = false) {
|
|
675
676
|
const components = this.getComponents().slice();
|
|
676
|
-
components.forEach((comp) => this.removeComponent(comp, this.components));
|
|
677
|
+
components.forEach((comp) => this.removeComponent(comp, this.components, all));
|
|
677
678
|
this.components = [];
|
|
678
679
|
}
|
|
679
680
|
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(rowIndex
|
|
55
|
+
destroyComponents(all?: boolean, rowIndex?: number): void;
|
|
56
56
|
createRow(dataObj: any, rowIndex: any): {
|
|
57
57
|
components: any;
|
|
58
58
|
data: any;
|
|
@@ -570,20 +570,25 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
570
570
|
return result;
|
|
571
571
|
}
|
|
572
572
|
getComponents(rowIndex) {
|
|
573
|
+
var _a;
|
|
573
574
|
// Ensure editrows is set.
|
|
574
575
|
this.editRows = this.editRows || [];
|
|
575
576
|
return this.builderMode
|
|
576
577
|
? super.getComponents()
|
|
577
578
|
: lodash_1.default.isNumber(rowIndex)
|
|
578
|
-
? (this.editRows[rowIndex].components || [])
|
|
579
|
+
? (((_a = this.editRows[rowIndex]) === null || _a === void 0 ? void 0 : _a.components) || [])
|
|
579
580
|
: this.editRows.reduce((result, row) => result.concat(row.components || []), []);
|
|
580
581
|
}
|
|
581
|
-
|
|
582
|
+
destroy(all = false) {
|
|
583
|
+
this.calculatedValue = undefined;
|
|
584
|
+
super.destroy(all);
|
|
585
|
+
}
|
|
586
|
+
destroyComponents(all = false, rowIndex = 0) {
|
|
582
587
|
if (this.builderMode) {
|
|
583
|
-
return super.destroyComponents();
|
|
588
|
+
return super.destroyComponents(all);
|
|
584
589
|
}
|
|
585
590
|
const components = this.getComponents(rowIndex).slice();
|
|
586
|
-
components.forEach((comp) => this.removeComponent(comp, this.components));
|
|
591
|
+
components.forEach((comp) => this.removeComponent(comp, this.components, all));
|
|
587
592
|
}
|
|
588
593
|
createRow(dataObj, rowIndex) {
|
|
589
594
|
const editRow = {
|
|
@@ -756,7 +761,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
756
761
|
case EditRowState.New: {
|
|
757
762
|
editRow.state = EditRowState.Removed;
|
|
758
763
|
this.clearErrors(rowIndex);
|
|
759
|
-
this.destroyComponents(rowIndex);
|
|
764
|
+
this.destroyComponents(false, rowIndex);
|
|
760
765
|
if (this.inlineEditMode) {
|
|
761
766
|
this.splice(rowIndex);
|
|
762
767
|
}
|
|
@@ -875,7 +880,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
875
880
|
baseRemoveRow(rowIndex) {
|
|
876
881
|
const editRow = this.editRows[rowIndex];
|
|
877
882
|
editRow.state = EditRowState.Removed;
|
|
878
|
-
this.destroyComponents(rowIndex);
|
|
883
|
+
this.destroyComponents(false, rowIndex);
|
|
879
884
|
return editRow;
|
|
880
885
|
}
|
|
881
886
|
removeRow(rowIndex, modified) {
|
|
@@ -898,6 +903,15 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
898
903
|
this.redraw();
|
|
899
904
|
}
|
|
900
905
|
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
|
+
}
|
|
901
915
|
const currentRowComponents = lodash_1.default.get(this.editRows, `[${rowIndex}].components`, null);
|
|
902
916
|
return this.component.components.map((col, colIndex) => {
|
|
903
917
|
var _a;
|
|
@@ -1179,7 +1193,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
1179
1193
|
});
|
|
1180
1194
|
}
|
|
1181
1195
|
emptyRows() {
|
|
1182
|
-
this.editRows.forEach((editRow, index) => this.destroyComponents(index));
|
|
1196
|
+
this.editRows.forEach((editRow, index) => this.destroyComponents(false, index));
|
|
1183
1197
|
this.editRows = [];
|
|
1184
1198
|
}
|
|
1185
1199
|
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(all = false) {
|
|
336
336
|
if (this.subForm) {
|
|
337
|
-
this.subForm.destroy();
|
|
337
|
+
this.subForm.destroy(all);
|
|
338
338
|
this.subForm = null;
|
|
339
339
|
this.subFormReady = null;
|
|
340
340
|
}
|
|
341
|
-
super.destroy();
|
|
341
|
+
super.destroy(all);
|
|
342
342
|
}
|
|
343
343
|
redraw() {
|
|
344
344
|
if (this.subForm) {
|
|
@@ -71,7 +71,7 @@ export default class RadioComponent extends ListComponent {
|
|
|
71
71
|
detach(element: any): void;
|
|
72
72
|
validateValueProperty(): boolean;
|
|
73
73
|
validateValueAvailability(setting: any, value: any): boolean;
|
|
74
|
-
getValueAsString(value: any): any;
|
|
74
|
+
getValueAsString(value: any, options?: {}): any;
|
|
75
75
|
setValueAt(index: any, value: any): void;
|
|
76
76
|
loadItems(url: any, search: any, headers: any, options: any, method: any, body: any): void;
|
|
77
77
|
loadItemsFromMetadata(): void;
|
|
@@ -226,17 +226,19 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
226
226
|
}
|
|
227
227
|
return false;
|
|
228
228
|
}
|
|
229
|
-
getValueAsString(value) {
|
|
229
|
+
getValueAsString(value, options = {}) {
|
|
230
230
|
if (lodash_1.default.isObject(value)) {
|
|
231
231
|
value = JSON.stringify(value);
|
|
232
232
|
}
|
|
233
233
|
else if (!lodash_1.default.isString(value)) {
|
|
234
234
|
value = lodash_1.default.toString(value);
|
|
235
235
|
}
|
|
236
|
-
|
|
236
|
+
const isModalPreviewWithUrlDataSource = options.modalPreview && this.component.dataSrc === 'url';
|
|
237
|
+
if (this.component.dataSrc !== 'values' && !isModalPreviewWithUrlDataSource) {
|
|
237
238
|
return value;
|
|
238
239
|
}
|
|
239
|
-
const
|
|
240
|
+
const values = isModalPreviewWithUrlDataSource ? this.loadedOptions : this.component.values;
|
|
241
|
+
const option = lodash_1.default.find(values, (v) => v.value === value);
|
|
240
242
|
if (!value) {
|
|
241
243
|
return lodash_1.default.get(option, 'label', '');
|
|
242
244
|
}
|