@slickgrid-universal/composite-editor-component 0.19.2 → 1.2.1

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 CHANGED
@@ -3,14 +3,60 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [0.19.2](https://github.com/ghiscoding/slickgrid-universal/compare/v0.19.1...v0.19.2) (2021-11-19)
6
+ ## [1.2.1](https://github.com/ghiscoding/slickgrid-universal/compare/v1.2.0...v1.2.1) (2022-01-18)
7
7
 
8
- **Note:** Version bump only for package @slickgrid-universal/composite-editor-component
9
8
 
9
+ ### Bug Fixes
10
10
 
11
+ * **memory:** clear & dispose of grid to avoid mem leaks & detached elm ([7035db5](https://github.com/ghiscoding/slickgrid-universal/commit/7035db5f878187f6fb8b9d2effacb7443f25e2c9))
11
12
 
12
13
 
13
14
 
15
+
16
+
17
+ # [1.2.0](https://github.com/ghiscoding/slickgrid-universal/compare/v1.1.1...v1.2.0) (2022-01-06)
18
+
19
+
20
+ ### Features
21
+
22
+ * **composite:** add new `validateMassUpdateChange` callback & bug fixes ([#603](https://github.com/ghiscoding/slickgrid-universal/issues/603)) ([2c1559b](https://github.com/ghiscoding/slickgrid-universal/commit/2c1559b7a3b0b1a642a664e59a025ce78a747946))
23
+
24
+
25
+
26
+
27
+
28
+ ## [1.1.1](https://github.com/ghiscoding/slickgrid-universal/compare/v1.1.0...v1.1.1) (2021-12-11)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **build:** bump version manually bcoz of previous force push ([5e9a610](https://github.com/ghiscoding/slickgrid-universal/commit/5e9a610ad01d752673856591f9b5de73b0ece0e9))
34
+
35
+
36
+
37
+
38
+
39
+ # [1.1.0](https://github.com/ghiscoding/slickgrid-universal/compare/v0.19.2...v1.1.0) (2021-12-11)
40
+
41
+
42
+ ### Features
43
+
44
+ * **plugins:** move Row Detail View plugin to universal ([9700ff4](https://github.com/ghiscoding/slickgrid-universal/commit/9700ff49132e9408b808f916f634976d80e12579))
45
+ * **utils:** replace ext lib `assign-deep` by local `deepMerge` util ([2f56bd3](https://github.com/ghiscoding/slickgrid-universal/commit/2f56bd3571d9c5fb689a09d21cfb3813f5b70e89))
46
+
47
+
48
+
49
+
50
+
51
+
52
+ ## [0.19.2](https://github.com/ghiscoding/slickgrid-universal/compare/v0.19.1...v0.19.2) (2021-11-19)
53
+
54
+ **Note:** Version bump only for package @slickgrid-universal/composite-editor-component
55
+
56
+
57
+
58
+
59
+
14
60
 
15
61
  ## [0.19.1](https://github.com/ghiscoding/slickgrid-universal/compare/v0.19.0...v0.19.1) (2021-11-15)
16
62
 
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020-2021, Ghislain B. - Slickgrid-Universal
1
+ Copyright (c) 2020-2022, Ghislain B. - Slickgrid-Universal
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -15,15 +15,12 @@
15
15
  Vanilla Bundle implementation of a Composite Editor Modal Window which can do the following
16
16
  - Create
17
17
  - Clone (allows you to clone & edit a row, it's like a copy+edit in a single action)
18
- - Update
18
+ - Edit / Update
19
19
  - Mass Update Changes
20
20
  - Mass Selection Changes (similar to Mass Update but only for the selected items/rows)
21
21
 
22
22
  ### Internal Dependencies
23
23
  - [@slickgrid-universal/common](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/common)
24
24
 
25
- ### External Dependencies
26
- - [assign-deep](https://github.com/jonschlinkert/assign-deep) to deeply assign Object properties/values
27
-
28
25
  ### Installation
29
26
  Follow the instruction provided in the main [README](https://github.com/ghiscoding/slickgrid-universal#installation).
@@ -45,16 +45,16 @@ function CompositeEditor(columns, containers, options) {
45
45
  /* no operation (empty) function */
46
46
  const noop = () => { };
47
47
  const getContainerBox = (i) => {
48
- var _a, _b, _c, _d;
48
+ var _a, _b, _c, _d, _e, _f;
49
49
  const container = containers[i];
50
50
  const offset = (0, common_1.getHtmlElementOffset)(container);
51
- const width = container.clientWidth || 0;
52
- const height = container.clientHeight || 0;
51
+ const width = (_a = container === null || container === void 0 ? void 0 : container.clientWidth) !== null && _a !== void 0 ? _a : 0;
52
+ const height = (_b = container === null || container === void 0 ? void 0 : container.clientHeight) !== null && _b !== void 0 ? _b : 0;
53
53
  return {
54
- top: (_a = offset === null || offset === void 0 ? void 0 : offset.top) !== null && _a !== void 0 ? _a : 0,
55
- left: (_b = offset === null || offset === void 0 ? void 0 : offset.left) !== null && _b !== void 0 ? _b : 0,
56
- bottom: ((_c = offset === null || offset === void 0 ? void 0 : offset.top) !== null && _c !== void 0 ? _c : 0) + height,
57
- right: ((_d = offset === null || offset === void 0 ? void 0 : offset.left) !== null && _d !== void 0 ? _d : 0) + width,
54
+ top: (_c = offset === null || offset === void 0 ? void 0 : offset.top) !== null && _c !== void 0 ? _c : 0,
55
+ left: (_d = offset === null || offset === void 0 ? void 0 : offset.left) !== null && _d !== void 0 ? _d : 0,
56
+ bottom: ((_e = offset === null || offset === void 0 ? void 0 : offset.top) !== null && _e !== void 0 ? _e : 0) + height,
57
+ right: ((_f = offset === null || offset === void 0 ? void 0 : offset.left) !== null && _f !== void 0 ? _f : 0) + width,
58
58
  width,
59
59
  height,
60
60
  visible: true
@@ -97,13 +97,20 @@ function CompositeEditor(columns, containers, options) {
97
97
  };
98
98
  context.destroy = () => {
99
99
  var _a;
100
- let idx = 0;
101
- while (idx < editors.length) {
102
- editors[idx].destroy();
103
- idx++;
100
+ let tmpEditor = editors.pop();
101
+ while (tmpEditor) {
102
+ tmpEditor === null || tmpEditor === void 0 ? void 0 : tmpEditor.destroy();
103
+ tmpEditor = editors.pop();
104
+ }
105
+ let tmpContainer = containers.pop();
106
+ while (tmpContainer) {
107
+ (0, common_1.emptyElement)(tmpContainer);
108
+ tmpContainer === null || tmpContainer === void 0 ? void 0 : tmpContainer.remove();
109
+ tmpContainer = containers.pop();
104
110
  }
105
111
  (_a = options === null || options === void 0 ? void 0 : options.destroy) === null || _a === void 0 ? void 0 : _a.call(options);
106
112
  editors = [];
113
+ containers = null;
107
114
  };
108
115
  context.focus = () => {
109
116
  // if validation has failed, set the focus to the first invalid editor
@@ -1 +1 @@
1
- {"version":3,"file":"compositeEditor.factory.js","sourceRoot":"","sources":["../../src/compositeEditor.factory.ts"],"names":[],"mappings":";;;AAAA,wDAUqC;AASrC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,eAAe,CAAY,OAAiB,EAAE,UAAiC,EAAE,OAA8B;IAC7H,IAAI,kBAAiC,CAAC;IACtC,MAAM,cAAc,GAAG;QACrB,SAAS,EAAE,MAAM;QACjB,mBAAmB,EAAE,2CAA2C;QAChE,mBAAmB,EAAE,IAAI;QACzB,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,EAAE;QACd,OAAO,EAAE,EAAE;KACwB,CAAC;IACtC,OAAO,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,OAAO,EAAE,CAAC;IAE5C,mCAAmC;IACnC,MAAM,IAAI,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;IAEvB,MAAM,eAAe,GAAG,CAAC,CAAS,EAAmB,EAAE;;QACrD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,MAAM,GAAG,IAAA,6BAAoB,EAAC,SAAS,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,SAAS,CAAC,WAAW,IAAI,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,SAAS,CAAC,YAAY,IAAI,CAAC,CAAC;QAE3C,OAAO;YACL,GAAG,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,mCAAI,CAAC;YACrB,IAAI,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAA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AAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,+CAAjB,OAAO,EAAa,GAAG,CAAC,CAAC;QAC3B,CAAC,CAAC;QAEF,4BAA4B;QAC5B,IAAI,EAAE,CAAC;IACT,CAAC;IAED,qFAAqF;IACrF,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,eAAe,GAAG,MAAa,CAAC;IACtC,OAAO,MAAM,CAAC;AAChB,CAAC;AAlOD,0CAkOC"}
@@ -4,7 +4,11 @@ declare type ApplyChangesCallbackFn = (formValues: {
4
4
  } | null, selection: {
5
5
  gridRowIndexes: number[];
6
6
  dataContextIds: Array<number | string>;
7
- }) => void;
7
+ }, applyToDataview?: boolean) => any[] | void | undefined;
8
+ declare type DataSelection = {
9
+ gridRowIndexes: number[];
10
+ dataContextIds: Array<number | string>;
11
+ };
8
12
  export declare class SlickCompositeEditorComponent implements ExternalResource {
9
13
  protected _bindEventService: BindingEventService;
10
14
  protected _columnDefinitions: Column[];
@@ -91,12 +95,9 @@ export declare class SlickCompositeEditorComponent implements ExternalResource {
91
95
  /** Show a Validation Summary text (as a <div>) when a validation fails or simply hide it when there's no error */
92
96
  showValidationSummaryText(isShowing: boolean, errorMsg?: string): void;
93
97
  /** Apply Mass Update Changes (form values) to the entire dataset */
94
- protected applySaveMassUpdateChanges(formValues: any): void;
98
+ protected applySaveMassUpdateChanges(formValues: any, _selection: DataSelection, applyToDataview?: boolean): any[];
95
99
  /** Apply Mass Changes to the Selected rows in the grid (form values) */
96
- protected applySaveMassSelectionChanges(formValues: any, selection: {
97
- gridRowIndexes: number[];
98
- dataContextIds: Array<number | string>;
99
- }): void;
100
+ protected applySaveMassSelectionChanges(formValues: any, selection: DataSelection, applyToDataview?: boolean): any[];
100
101
  /**
101
102
  * Auto-Calculate how many columns to display in the view layout (1, 2, or 3).
102
103
  * We'll display a 1 column layout for 8 or less Editors, 2 columns layout for less than 15 Editors or 3 columns when more than 15 Editors
@@ -127,7 +128,7 @@ export declare class SlickCompositeEditorComponent implements ExternalResource {
127
128
  * @param {Function} applyChangesCallback - first callback to apply the changes into the grid (this could be a user custom callback)
128
129
  * @param {Function} executePostCallback - second callback to execute right after the "onSave"
129
130
  * @param {Function} beforeClosingCallback - third and last callback to execute after Saving but just before closing the modal window
130
- * @param {Object} itemDataContext - item data context, only provided for modal type (create/clone/edit)
131
+ * @param {Object} itemDataContext - item data context when modal type is (create/clone/edit)
131
132
  */
132
133
  protected executeOnSave(applyChangesCallback: ApplyChangesCallbackFn, executePostCallback: PlainFunc, beforeClosingCallback?: PlainFunc, itemDataContext?: any): Promise<void>;
133
134
  protected focusOnFirstColumnCellWithEditor(columns: Column[], dataContext: any, columnIndex: number, rowIndex: number, isWithMassChange: boolean): boolean;
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SlickCompositeEditorComponent = void 0;
4
- const assign_ = require("assign-deep");
5
- const assign = assign_['default'] || assign_;
6
4
  const common_1 = require("@slickgrid-universal/common");
7
5
  const compositeEditor_factory_1 = require("./compositeEditor.factory");
8
6
  const DEFAULT_ON_ERROR = (error) => console.log(error.message);
@@ -68,12 +66,16 @@ class SlickCompositeEditorComponent {
68
66
  }
69
67
  /** Dispose of the Component without unsubscribing any events */
70
68
  disposeComponent() {
71
- var _a;
72
- if (typeof ((_a = this._modalElm) === null || _a === void 0 ? void 0 : _a.remove) === 'function') {
69
+ var _a, _b, _c;
70
+ // protected _editorContainers!: Array<HTMLElement | null>;
71
+ (_a = this._modalBodyTopValidationElm) === null || _a === void 0 ? void 0 : _a.remove();
72
+ (_b = this._modalSaveButtonElm) === null || _b === void 0 ? void 0 : _b.remove();
73
+ if (typeof ((_c = this._modalElm) === null || _c === void 0 ? void 0 : _c.remove) === 'function') {
73
74
  this._modalElm.remove();
74
75
  // remove the body backdrop click listener, every other listeners will be dropped automatically since we destroy the component
75
76
  document.body.classList.remove('slick-modal-open');
76
77
  }
78
+ this._editorContainers = [];
77
79
  }
78
80
  /**
79
81
  * Dynamically change value of an input from the Composite Editor form.
@@ -146,7 +148,7 @@ class SlickCompositeEditorComponent {
146
148
  else {
147
149
  this._formValues = { ...this._formValues, [columnId]: newValue };
148
150
  }
149
- this._formValues = assign({}, this._itemDataContext, this._formValues);
151
+ this._formValues = (0, common_1.deepMerge)({}, this._itemDataContext, this._formValues);
150
152
  }
151
153
  /**
152
154
  * Dynamically change an Editor option of the Composite Editor form
@@ -285,46 +287,37 @@ class SlickCompositeEditorComponent {
285
287
  // for example {{title}} => display the item title, or even complex object works {{product.name}} => display item product name
286
288
  const parsedHeaderTitle = headerTitle.replace(/\{\{(.*?)\}\}/g, (_match, group) => (0, common_1.getDescendantProperty)(dataContext, group));
287
289
  const layoutColCount = viewColumnLayout === 'auto' ? this.autoCalculateLayoutColumnCount(modalColumns.length) : viewColumnLayout;
288
- this._modalElm = document.createElement('div');
289
- this._modalElm.className = `slick-editor-modal ${gridUid}`;
290
- const modalContentElm = document.createElement('div');
291
- modalContentElm.className = 'slick-editor-modal-content';
290
+ this._modalElm = (0, common_1.createDomElement)('div', { className: `slick-editor-modal ${gridUid}` });
291
+ const modalContentElm = (0, common_1.createDomElement)('div', { className: 'slick-editor-modal-content' });
292
292
  if (viewColumnLayout > 1 || (viewColumnLayout === 'auto' && layoutColCount > 1)) {
293
293
  const splitClassName = layoutColCount === 2 ? 'split-view' : 'triple-split-view';
294
294
  modalContentElm.classList.add(splitClassName);
295
295
  }
296
- const modalHeaderTitleElm = document.createElement('div');
297
- modalHeaderTitleElm.className = 'slick-editor-modal-title';
298
- modalHeaderTitleElm.innerHTML = (0, common_1.sanitizeTextByAvailableSanitizer)(this.gridOptions, parsedHeaderTitle);
299
- const modalCloseButtonElm = document.createElement('button');
300
- modalCloseButtonElm.type = 'button';
301
- modalCloseButtonElm.textContent = '×';
302
- modalCloseButtonElm.className = 'close';
303
- modalCloseButtonElm.dataset.action = 'close';
296
+ const modalHeaderTitleElm = (0, common_1.createDomElement)('div', {
297
+ className: 'slick-editor-modal-title',
298
+ innerHTML: (0, common_1.sanitizeTextByAvailableSanitizer)(this.gridOptions, parsedHeaderTitle),
299
+ });
300
+ const modalCloseButtonElm = (0, common_1.createDomElement)('button', { type: 'button', textContent: '×', className: 'close', dataset: { action: 'close' } });
304
301
  modalCloseButtonElm.setAttribute('aria-label', 'Close');
305
302
  if (this._options.showCloseButtonOutside) {
306
303
  (_j = modalHeaderTitleElm === null || modalHeaderTitleElm === void 0 ? void 0 : modalHeaderTitleElm.classList) === null || _j === void 0 ? void 0 : _j.add('outside');
307
304
  (_k = modalCloseButtonElm === null || modalCloseButtonElm === void 0 ? void 0 : modalCloseButtonElm.classList) === null || _k === void 0 ? void 0 : _k.add('outside');
308
305
  }
309
- const modalHeaderElm = document.createElement('div');
310
- modalHeaderElm.className = 'slick-editor-modal-header';
306
+ const modalHeaderElm = (0, common_1.createDomElement)('div', { className: 'slick-editor-modal-header' });
311
307
  modalHeaderElm.setAttribute('aria-label', 'Close');
312
308
  modalHeaderElm.appendChild(modalHeaderTitleElm);
313
309
  modalHeaderElm.appendChild(modalCloseButtonElm);
314
- const modalBodyElm = document.createElement('div');
315
- modalBodyElm.className = 'slick-editor-modal-body';
316
- this._modalBodyTopValidationElm = document.createElement('div');
317
- this._modalBodyTopValidationElm.className = 'validation-summary';
318
- this._modalBodyTopValidationElm.style.display = 'none';
310
+ const modalBodyElm = (0, common_1.createDomElement)('div', { className: 'slick-editor-modal-body' });
311
+ this._modalBodyTopValidationElm = (0, common_1.createDomElement)('div', { className: 'validation-summary', style: { display: 'none' } });
319
312
  modalBodyElm.appendChild(this._modalBodyTopValidationElm);
320
- const modalFooterElm = document.createElement('div');
321
- modalFooterElm.className = 'slick-editor-modal-footer';
322
- const modalCancelButtonElm = document.createElement('button');
323
- modalCancelButtonElm.type = 'button';
324
- modalCancelButtonElm.className = 'btn btn-cancel btn-default btn-sm';
325
- modalCancelButtonElm.dataset.action = 'cancel';
313
+ const modalFooterElm = (0, common_1.createDomElement)('div', { className: 'slick-editor-modal-footer' });
314
+ const modalCancelButtonElm = (0, common_1.createDomElement)('button', {
315
+ type: 'button',
316
+ className: 'btn btn-cancel btn-default btn-sm',
317
+ textContent: this.getLabelText('cancelButton', 'TEXT_CANCEL', 'Cancel'),
318
+ dataset: { action: 'cancel' },
319
+ });
326
320
  modalCancelButtonElm.setAttribute('aria-label', this.getLabelText('cancelButton', 'TEXT_CANCEL', 'Cancel'));
327
- modalCancelButtonElm.textContent = this.getLabelText('cancelButton', 'TEXT_CANCEL', 'Cancel');
328
321
  let leftFooterText = '';
329
322
  let saveButtonText = '';
330
323
  switch (modalType) {
@@ -344,18 +337,17 @@ class SlickCompositeEditorComponent {
344
337
  default:
345
338
  saveButtonText = this.getLabelText('saveButton', 'TEXT_SAVE', 'Save');
346
339
  }
347
- const selectionCounterElm = document.createElement('div');
348
- selectionCounterElm.className = 'footer-status-text';
349
- selectionCounterElm.textContent = leftFooterText;
350
- this._modalSaveButtonElm = document.createElement('button');
351
- this._modalSaveButtonElm.type = 'button';
352
- this._modalSaveButtonElm.className = 'btn btn-save btn-primary btn-sm';
353
- this._modalSaveButtonElm.dataset.action = (modalType === 'create' || modalType === 'edit') ? 'save' : modalType;
354
- this._modalSaveButtonElm.dataset.ariaLabel = saveButtonText;
355
- this._modalSaveButtonElm.textContent = saveButtonText;
340
+ const selectionCounterElm = (0, common_1.createDomElement)('div', { className: 'footer-status-text', textContent: leftFooterText });
341
+ this._modalSaveButtonElm = (0, common_1.createDomElement)('button', {
342
+ type: 'button', className: 'btn btn-save btn-primary btn-sm',
343
+ textContent: saveButtonText,
344
+ dataset: {
345
+ action: (modalType === 'create' || modalType === 'edit') ? 'save' : modalType,
346
+ ariaLabel: saveButtonText
347
+ }
348
+ });
356
349
  this._modalSaveButtonElm.setAttribute('aria-label', saveButtonText);
357
- const footerContainerElm = document.createElement('div');
358
- footerContainerElm.className = 'footer-buttons';
350
+ const footerContainerElm = (0, common_1.createDomElement)('div', { className: 'footer-buttons' });
359
351
  if (modalType === 'mass-update' || modalType === 'mass-selection') {
360
352
  modalFooterElm.appendChild(selectionCounterElm);
361
353
  }
@@ -368,22 +360,22 @@ class SlickCompositeEditorComponent {
368
360
  this._modalElm.appendChild(modalContentElm);
369
361
  for (const columnDef of modalColumns) {
370
362
  if (columnDef.editor) {
371
- const itemContainer = document.createElement('div');
372
- itemContainer.className = `item-details-container editor-${columnDef.id}`;
363
+ const itemContainer = (0, common_1.createDomElement)('div', { className: `item-details-container editor-${columnDef.id}` });
373
364
  if (layoutColCount === 1) {
374
365
  itemContainer.classList.add('slick-col-medium-12');
375
366
  }
376
367
  else {
377
368
  itemContainer.classList.add('slick-col-medium-6', `slick-col-xlarge-${12 / layoutColCount}`);
378
369
  }
379
- const templateItemLabelElm = document.createElement('div');
380
- templateItemLabelElm.className = `item-details-label editor-${columnDef.id}`;
381
- templateItemLabelElm.textContent = this.getColumnLabel(columnDef) || 'n/a';
382
- const templateItemEditorElm = document.createElement('div');
383
- templateItemEditorElm.className = 'item-details-editor-container slick-cell';
384
- templateItemEditorElm.dataset.editorid = `${columnDef.id}`;
385
- const templateItemValidationElm = document.createElement('div');
386
- templateItemValidationElm.className = `item-details-validation editor-${columnDef.id}`;
370
+ const templateItemLabelElm = (0, common_1.createDomElement)('div', {
371
+ className: `item-details-label editor-${columnDef.id}`,
372
+ innerHTML: (0, common_1.sanitizeTextByAvailableSanitizer)(this.gridOptions, this.getColumnLabel(columnDef) || 'n/a')
373
+ });
374
+ const templateItemEditorElm = (0, common_1.createDomElement)('div', {
375
+ className: 'item-details-editor-container slick-cell',
376
+ dataset: { editorid: `${columnDef.id}` },
377
+ });
378
+ const templateItemValidationElm = (0, common_1.createDomElement)('div', { className: `item-details-validation editor-${columnDef.id}` });
387
379
  // optionally add a reset button beside each editor
388
380
  if ((_l = this._options) === null || _l === void 0 ? void 0 : _l.showResetButtonOnEachEditor) {
389
381
  const editorResetButtonElm = this.createEditorResetButtonElement(`${columnDef.id}`);
@@ -420,13 +412,9 @@ class SlickCompositeEditorComponent {
420
412
  this._bindEventService.bind(this._modalElm, 'focusout', this.validateCurrentEditor.bind(this));
421
413
  this._bindEventService.bind(this._modalElm, 'blur', this.validateCurrentEditor.bind(this));
422
414
  // when any of the input of the composite editor form changes, we'll add/remove a "modified" CSS className for styling purposes
423
- const onCompositeEditorChangeHandler = this.grid.onCompositeEditorChange;
424
- this._eventHandler
425
- .subscribe(onCompositeEditorChangeHandler, this.handleOnCompositeEditorChange.bind(this));
415
+ this._eventHandler.subscribe(this.grid.onCompositeEditorChange, this.handleOnCompositeEditorChange.bind(this));
426
416
  // when adding a new row to the grid, we need to invalidate that row and re-render the grid
427
- const onAddNewRowHandler = this.grid.onAddNewRow;
428
- this._eventHandler
429
- .subscribe(onAddNewRowHandler, (_e, args) => {
417
+ this._eventHandler.subscribe(this.grid.onAddNewRow, (_e, args) => {
430
418
  this.insertNewItemInDataView(args.item);
431
419
  this._originalDataContext = args.item; // this becomes the new data context
432
420
  this.dispose();
@@ -479,41 +467,52 @@ class SlickCompositeEditorComponent {
479
467
  // protected methods
480
468
  // ----------------
481
469
  /** Apply Mass Update Changes (form values) to the entire dataset */
482
- applySaveMassUpdateChanges(formValues) {
483
- const data = this.dataView.getItems();
470
+ applySaveMassUpdateChanges(formValues, _selection, applyToDataview = true) {
471
+ // not applying to dataView means that we're doing a preview of dataset and we should use a deep copy of it instead of applying changes directly to it
472
+ const data = applyToDataview ? this.dataView.getItems() : (0, common_1.deepCopy)(this.dataView.getItems());
484
473
  // from the "lastCompositeEditor" object that we kept as reference, it contains all the changes inside the "formValues" property
485
474
  // we can loop through these changes and apply them on the selected row indexes
486
475
  for (const itemProp in formValues) {
487
476
  if (itemProp in formValues) {
488
- data.forEach(dataContext => {
489
- if (itemProp in formValues) {
477
+ data.forEach((dataContext) => {
478
+ var _a;
479
+ if (itemProp in formValues && (((_a = this._options) === null || _a === void 0 ? void 0 : _a.validateMassUpdateChange) === undefined || this._options.validateMassUpdateChange(itemProp, dataContext, formValues) !== false)) {
490
480
  dataContext[itemProp] = formValues[itemProp];
491
481
  }
492
482
  });
493
483
  }
494
484
  }
495
485
  // change the entire dataset with our updated dataset
496
- this.dataView.setItems(data, this.gridOptions.datasetIdPropertyName);
497
- this.grid.invalidate();
486
+ if (applyToDataview) {
487
+ this.dataView.setItems(data, this.gridOptions.datasetIdPropertyName);
488
+ this.grid.invalidate();
489
+ }
490
+ return data;
498
491
  }
499
492
  /** Apply Mass Changes to the Selected rows in the grid (form values) */
500
- applySaveMassSelectionChanges(formValues, selection) {
493
+ applySaveMassSelectionChanges(formValues, selection, applyToDataview = true) {
501
494
  var _a, _b;
502
495
  const selectedItemIds = (_a = selection === null || selection === void 0 ? void 0 : selection.dataContextIds) !== null && _a !== void 0 ? _a : [];
503
- const selectedItems = selectedItemIds.map(itemId => this.dataView.getItemById(itemId));
496
+ const selectedTmpItems = selectedItemIds.map(itemId => this.dataView.getItemById(itemId));
497
+ // not applying to dataView means that we're doing a preview of dataset and we should use a deep copy of it instead of applying changes directly to it
498
+ const selectedItems = applyToDataview ? selectedTmpItems : (0, common_1.deepCopy)(selectedTmpItems);
504
499
  // from the "lastCompositeEditor" object that we kept as reference, it contains all the changes inside the "formValues" property
505
500
  // we can loop through these changes and apply them on the selected row indexes
506
501
  for (const itemProp in formValues) {
507
502
  if (itemProp in formValues) {
508
- selectedItems.forEach(dataContext => {
509
- if (itemProp in formValues) {
503
+ selectedItems.forEach((dataContext) => {
504
+ var _a;
505
+ if (itemProp in formValues && (((_a = this._options) === null || _a === void 0 ? void 0 : _a.validateMassUpdateChange) === undefined || this._options.validateMassUpdateChange(itemProp, dataContext, formValues) !== false)) {
510
506
  dataContext[itemProp] = formValues[itemProp];
511
507
  }
512
508
  });
513
509
  }
514
510
  }
515
511
  // update all items in the grid with the grid service
516
- (_b = this.gridService) === null || _b === void 0 ? void 0 : _b.updateItems(selectedItems);
512
+ if (applyToDataview) {
513
+ (_b = this.gridService) === null || _b === void 0 ? void 0 : _b.updateItems(selectedItems);
514
+ }
515
+ return selectedItems;
517
516
  }
518
517
  /**
519
518
  * Auto-Calculate how many columns to display in the view layout (1, 2, or 3).
@@ -537,11 +536,11 @@ class SlickCompositeEditorComponent {
537
536
  */
538
537
  createEditorResetButtonElement(columnId) {
539
538
  var _a, _b, _c, _d, _f;
540
- const resetButtonElm = document.createElement('button');
541
- resetButtonElm.type = 'button';
542
- resetButtonElm.name = columnId;
543
- resetButtonElm.title = (_c = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b.resetFormButton) !== null && _c !== void 0 ? _c : 'Reset Form Input';
544
- resetButtonElm.className = 'btn btn-xs btn-editor-reset';
539
+ const resetButtonElm = (0, common_1.createDomElement)('button', {
540
+ type: 'button', name: columnId,
541
+ title: (_c = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b.resetFormButton) !== null && _c !== void 0 ? _c : 'Reset Form Input',
542
+ className: 'btn btn-xs btn-editor-reset'
543
+ });
545
544
  resetButtonElm.setAttribute('aria-label', 'Reset');
546
545
  if ((_d = this._options) === null || _d === void 0 ? void 0 : _d.resetEditorButtonCssClass) {
547
546
  const resetBtnClasses = (_f = this._options) === null || _f === void 0 ? void 0 : _f.resetEditorButtonCssClass.split(' ');
@@ -558,13 +557,9 @@ class SlickCompositeEditorComponent {
558
557
  */
559
558
  createFormResetButtonElement() {
560
559
  var _a, _b;
561
- const resetButtonContainerElm = document.createElement('div');
562
- resetButtonContainerElm.className = 'reset-container';
563
- const resetButtonElm = document.createElement('button');
564
- resetButtonElm.type = 'button';
565
- resetButtonElm.className = 'btn btn-sm reset-form';
566
- const resetIconSpanElm = document.createElement('span');
567
- resetIconSpanElm.className = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.resetFormButtonIconCssClass) !== null && _b !== void 0 ? _b : '';
560
+ const resetButtonContainerElm = (0, common_1.createDomElement)('div', { className: 'reset-container' });
561
+ const resetButtonElm = (0, common_1.createDomElement)('button', { type: 'button', className: 'btn btn-sm reset-form' });
562
+ const resetIconSpanElm = (0, common_1.createDomElement)('span', { className: (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.resetFormButtonIconCssClass) !== null && _b !== void 0 ? _b : '' });
568
563
  resetButtonElm.appendChild(resetIconSpanElm);
569
564
  resetButtonElm.appendChild(document.createTextNode(' Reset Form'));
570
565
  resetButtonContainerElm.appendChild(resetButtonElm);
@@ -585,10 +580,10 @@ class SlickCompositeEditorComponent {
585
580
  * @param {Function} applyChangesCallback - first callback to apply the changes into the grid (this could be a user custom callback)
586
581
  * @param {Function} executePostCallback - second callback to execute right after the "onSave"
587
582
  * @param {Function} beforeClosingCallback - third and last callback to execute after Saving but just before closing the modal window
588
- * @param {Object} itemDataContext - item data context, only provided for modal type (create/clone/edit)
583
+ * @param {Object} itemDataContext - item data context when modal type is (create/clone/edit)
589
584
  */
590
585
  async executeOnSave(applyChangesCallback, executePostCallback, beforeClosingCallback, itemDataContext) {
591
- var _a, _b, _c, _d, _f;
586
+ var _a, _b, _c, _d, _f, _g;
592
587
  try {
593
588
  this.showValidationSummaryText(false, '');
594
589
  const validationResults = this.validateCompositeEditors();
@@ -596,10 +591,17 @@ class SlickCompositeEditorComponent {
596
591
  this._modalSaveButtonElm.classList.add('saving');
597
592
  this._modalSaveButtonElm.disabled = true;
598
593
  if (typeof ((_a = this._options) === null || _a === void 0 ? void 0 : _a.onSave) === 'function') {
594
+ const isMassChange = (this._options.modalType === 'mass-update' || this._options.modalType === 'mass-selection');
595
+ // apply the changes in the grid early when that option is enabled (that is before the await of `onSave`)
596
+ let updatedDataset;
597
+ if (isMassChange && ((_b = this._options) === null || _b === void 0 ? void 0 : _b.shouldPreviewMassChangeDataset)) {
598
+ updatedDataset = applyChangesCallback(this.formValues, this.getCurrentRowSelections(), false);
599
+ }
599
600
  // call the custon onSave callback when defined and note that the item data context will only be filled for create/clone/edit
600
- const successful = await ((_b = this._options) === null || _b === void 0 ? void 0 : _b.onSave(this.formValues, this.getCurrentRowSelections(), itemDataContext));
601
+ const dataContextOrUpdatedDatasetPreview = isMassChange ? updatedDataset : itemDataContext;
602
+ const successful = await ((_c = this._options) === null || _c === void 0 ? void 0 : _c.onSave(this.formValues, this.getCurrentRowSelections(), dataContextOrUpdatedDatasetPreview));
601
603
  if (successful) {
602
- // apply the changes in the grid
604
+ // apply the changes in the grid (if it's not yet applied)
603
605
  applyChangesCallback(this.formValues, this.getCurrentRowSelections());
604
606
  // once we're done doing the mass update, we can cancel the current editor since we don't want to add any new row
605
607
  // that will also destroy/close the modal window
@@ -619,7 +621,7 @@ class SlickCompositeEditorComponent {
619
621
  }
620
622
  }
621
623
  catch (error) {
622
- const errorMsg = (typeof error === 'string') ? error : ((_f = (_c = error === null || error === void 0 ? void 0 : error.message) !== null && _c !== void 0 ? _c : (_d = error === null || error === void 0 ? void 0 : error.body) === null || _d === void 0 ? void 0 : _d.message) !== null && _f !== void 0 ? _f : '');
624
+ const errorMsg = (typeof error === 'string') ? error : ((_g = (_d = error === null || error === void 0 ? void 0 : error.message) !== null && _d !== void 0 ? _d : (_f = error === null || error === void 0 ? void 0 : error.body) === null || _f === void 0 ? void 0 : _f.message) !== null && _g !== void 0 ? _g : '');
623
625
  this.showValidationSummaryText(true, errorMsg);
624
626
  }
625
627
  }