@den4ik92/ng2-smart-table 19.0.5 → 19.1.0

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.
Files changed (36) hide show
  1. package/fesm2022/den4ik92-ng2-smart-table.mjs +1273 -1435
  2. package/fesm2022/den4ik92-ng2-smart-table.mjs.map +1 -1
  3. package/lib/components/cell/cell-edit-mode/custom-edit.component.d.ts +5 -5
  4. package/lib/components/cell/cell-edit-mode/default-edit.component.d.ts +2 -2
  5. package/lib/components/cell/cell-edit-mode/edit-cell-default.d.ts +5 -9
  6. package/lib/components/cell/cell-edit-mode/edit-cell.component.d.ts +3 -5
  7. package/lib/components/cell/cell-editors/checkbox-editor.component.d.ts +2 -0
  8. package/lib/components/cell/cell-editors/default-editor.d.ts +7 -13
  9. package/lib/components/cell/cell-view-mode/custom-view.component.d.ts +2 -2
  10. package/lib/components/cell/cell-view-mode/view-cell.component.d.ts +2 -2
  11. package/lib/components/cell/cell.component.d.ts +4 -15
  12. package/lib/components/filter/custom-filter.component.d.ts +4 -3
  13. package/lib/components/filter/filter-default.d.ts +4 -4
  14. package/lib/components/filter/filter-types/default-filter.d.ts +6 -6
  15. package/lib/components/table-columns-editor/column-editor.directive.d.ts +4 -3
  16. package/lib/components/table-columns-editor/table-columns-editor.component.d.ts +5 -5
  17. package/lib/components/tbody/cells/create-cancel.component.d.ts +9 -10
  18. package/lib/components/tbody/cells/edit-delete.component.d.ts +9 -10
  19. package/lib/components/tbody/tbody.component.d.ts +9 -19
  20. package/lib/components/thead/cells/actions-title.component.d.ts +4 -8
  21. package/lib/components/thead/cells/actions.component.d.ts +5 -7
  22. package/lib/components/thead/cells/add-button.component.d.ts +5 -11
  23. package/lib/components/thead/rows/thead-filters-row.component.d.ts +7 -12
  24. package/lib/components/thead/rows/thead-form-row.component.d.ts +6 -12
  25. package/lib/components/thead/rows/thead-titles-row.component.d.ts +5 -10
  26. package/lib/components/thead/thead.component.d.ts +9 -10
  27. package/lib/lib/data-set/data-set.d.ts +10 -10
  28. package/lib/lib/data-set/row.d.ts +1 -1
  29. package/lib/lib/data-source/local/local.data-source.d.ts +1 -1
  30. package/lib/lib/grid.d.ts +9 -9
  31. package/lib/lib/helpers.d.ts +1 -0
  32. package/lib/lib/interfaces/smart-table.models.d.ts +10 -8
  33. package/lib/ng2-smart-table.component.d.ts +6 -10
  34. package/package.json +1 -1
  35. package/public-api.d.ts +0 -1
  36. package/lib/components/cell/cell-view-mode/view-cell.d.ts +0 -4
@@ -1,155 +1,33 @@
1
1
  import * as i0 from '@angular/core';
2
- import { output, Component, Input, input, signal, effect, computed, inject, ElementRef, Directive, ViewContainerRef, ViewChild, ChangeDetectionStrategy } from '@angular/core';
2
+ import { input, Component, output, Input, signal, effect, computed, inject, ElementRef, Directive, ViewContainerRef, ViewChild, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
3
3
  import { Overlay, OverlayConfig } from '@angular/cdk/overlay';
4
4
  import { ComponentPortal } from '@angular/cdk/portal';
5
- import { moveItemInArray, CdkDropList, CdkDrag, CdkDragPlaceholder } from '@angular/cdk/drag-drop';
6
5
  import { Subject } from 'rxjs';
6
+ import { takeUntil, debounceTime, distinctUntilChanged, skip } from 'rxjs/operators';
7
+ import { moveItemInArray, CdkDropList, CdkDrag, CdkDragPlaceholder } from '@angular/cdk/drag-drop';
7
8
  import * as i1 from '@angular/forms';
8
9
  import { FormsModule, UntypedFormControl, ReactiveFormsModule, NgControl } from '@angular/forms';
9
- import { NgComponentOutlet } from '@angular/common';
10
- import { debounceTime, distinctUntilChanged, skip } from 'rxjs/operators';
11
-
12
- function prepareValue(value) { return value; }
13
- class Cell {
14
- static { this.PREPARE = prepareValue; }
15
- constructor(value, row, column, dataSet) {
16
- this.value = value;
17
- this.row = row;
18
- this.column = column;
19
- this.dataSet = dataSet;
20
- this.newValue = '';
21
- this.newValue = value;
22
- }
23
- getColumn() {
24
- return this.column;
25
- }
26
- getColumnClass() {
27
- return this.column.class;
28
- }
29
- getRow() {
30
- return this.row;
31
- }
32
- getValue() {
33
- const prepare = this.column.getValuePrepareFunction() || Cell.PREPARE;
34
- return prepare.call(null, this.value, this.row.getData(), this);
35
- }
36
- setValue(value) {
37
- this.newValue = value;
38
- }
39
- getId() {
40
- return this.getColumn().id;
41
- }
42
- getTitle() {
43
- return this.getColumn().title;
44
- }
45
- isEditable() {
46
- if (this.getRow().index === -1) {
47
- return this.getColumn().isAddable;
48
- }
49
- else {
50
- return this.getColumn().isEditable;
51
- }
52
- }
53
- }
10
+ import { NgComponentOutlet, NgTemplateOutlet } from '@angular/common';
54
11
 
55
12
  class DefaultEditor {
56
13
  constructor() {
57
- this.inputClass = '';
58
- this.onStopEditing = output();
59
- this.onEdited = output();
60
- this.onClick = output();
14
+ this.cell = input.required();
15
+ this.inputClass = input("");
61
16
  }
62
17
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultEditor, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
63
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: DefaultEditor, isStandalone: true, selector: "ng-component", inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { onStopEditing: "onStopEditing", onEdited: "onEdited", onClick: "onClick" }, ngImport: i0, template: '', isInline: true }); }
18
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: DefaultEditor, isStandalone: true, selector: "ng-component", inputs: { cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: true, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "", isInline: true }); }
64
19
  }
65
20
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultEditor, decorators: [{
66
21
  type: Component,
67
- args: [{ template: '' }]
68
- }], propDecorators: { cell: [{
69
- type: Input
70
- }], inputClass: [{
71
- type: Input
72
- }] } });
73
-
74
- class Column {
75
- constructor(id, settings, dataSet) {
76
- this.id = id;
77
- this.settings = settings;
78
- this.dataSet = dataSet;
79
- this.title = '';
80
- this.type = 'text';
81
- this.class = '';
82
- this.width = '';
83
- this.hide = false;
84
- this.isSortable = false;
85
- this.isEditable = true;
86
- this.isAddable = true;
87
- this.isFilterable = false;
88
- this.sortDirection = 'asc';
89
- this.defaultSortDirection = false;
90
- this.editor = false;
91
- this.filter = false;
92
- this.process(this.settings);
93
- }
94
- getCompareFunction() {
95
- return this.compareFunction;
96
- }
97
- getValuePrepareFunction() {
98
- return this.valuePrepareFunction;
99
- }
100
- getFilterFunction() {
101
- return this.filterFunction;
102
- }
103
- getConfig() {
104
- if (this.editor && (this.editor.type === 'checkbox' || this.editor.type === 'custom' || this.editor.type === 'list')) {
105
- return this.editor?.config;
106
- }
107
- return false;
108
- }
109
- getFilterType() {
110
- return this.filter && this.filter.type;
111
- }
112
- getFilterConfig() {
113
- if (this.filter && (this.filter.type === 'checkbox' || this.filter.type === 'custom' || this.filter.type === 'list')) {
114
- return this.filter?.config;
115
- }
116
- return false;
117
- }
118
- process(settings) {
119
- this.title = settings.title;
120
- this.class = settings.class || '';
121
- this.width = settings.width || '';
122
- this.hide = !!settings.hide;
123
- this.type = settings.type;
124
- if (settings?.editor) {
125
- this.editor = settings.editor;
126
- }
127
- if (settings?.filter) {
128
- this.filter = settings.filter;
129
- }
130
- if (settings.type === 'custom' && settings.renderComponent) {
131
- this.renderComponent = settings.renderComponent;
132
- }
133
- this.isFilterable = typeof settings.filter === 'undefined' ? true : !!settings['filter'];
134
- this.defaultSortDirection = settings?.sortDirection || false;
135
- this.isSortable = typeof settings.sort === 'undefined' ? true : settings.sort;
136
- this.isEditable = typeof settings.editable === 'undefined' ? true : settings.editable;
137
- this.isAddable = typeof settings.addable === 'undefined' ? true : settings.addable;
138
- this.sortDirection = this.prepareSortDirection();
139
- this.compareFunction = settings.compareFunction;
140
- this.valuePrepareFunction = settings.valuePrepareFunction;
141
- this.filterFunction = settings.filterFunction;
142
- }
143
- prepareSortDirection() {
144
- return this.defaultSortDirection === 'desc' ? 'desc' : 'asc';
145
- }
146
- }
22
+ args: [{ template: "" }]
23
+ }] });
147
24
 
148
25
  class DefaultFilter {
149
26
  constructor() {
150
27
  this.delay = 300;
151
28
  this.query = '';
152
- this.inputClass = '';
29
+ this.inputClass = input('');
30
+ this.column = input.required();
153
31
  this.filter = output();
154
32
  }
155
33
  ngOnDestroy() {
@@ -161,17 +39,13 @@ class DefaultFilter {
161
39
  this.filter.emit(this.query);
162
40
  }
163
41
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultFilter, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
164
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: DefaultFilter, isStandalone: true, selector: "ng-component", inputs: { query: "query", inputClass: "inputClass", column: "column" }, outputs: { filter: "filter" }, ngImport: i0, template: '', isInline: true }); }
42
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: DefaultFilter, isStandalone: true, selector: "ng-component", inputs: { query: { classPropertyName: "query", publicName: "query", isSignal: false, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { filter: "filter" }, ngImport: i0, template: '', isInline: true }); }
165
43
  }
166
44
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultFilter, decorators: [{
167
45
  type: Component,
168
46
  args: [{ template: '' }]
169
47
  }], propDecorators: { query: [{
170
48
  type: Input
171
- }], inputClass: [{
172
- type: Input
173
- }], column: [{
174
- type: Input
175
49
  }] } });
176
50
 
177
51
  /**
@@ -184,15 +58,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
184
58
  * deepExtend({}, yourObj_1, [yourObj_N]);
185
59
  */
186
60
  const deepExtend = function (...objects) {
187
- if (arguments.length < 1 || typeof arguments[0] !== 'object') {
61
+ if (objects.length < 1 || typeof objects[0] !== 'object') {
188
62
  return false;
189
63
  }
190
- if (arguments.length < 2) {
191
- return arguments[0];
64
+ if (objects.length < 2) {
65
+ return objects[0];
192
66
  }
193
- const target = arguments[0];
67
+ const target = objects[0];
194
68
  // convert arguments to array and cut off target object
195
- const args = Array.prototype.slice.call(arguments, 1);
69
+ const args = Array.prototype.slice.call(objects, 1);
196
70
  let val, src;
197
71
  args.forEach((obj) => {
198
72
  // skip argument if it is array or isn't object
@@ -253,7 +127,11 @@ function getDeepFromObject(object = {}, name, defaultValue = null) {
253
127
  if (level && typeof level[k] !== 'undefined') {
254
128
  level = level[k];
255
129
  }
130
+ else {
131
+ level = defaultValue;
132
+ }
256
133
  });
134
+ return level ?? defaultValue;
257
135
  }
258
136
  catch {
259
137
  return defaultValue;
@@ -266,6 +144,9 @@ function getPageForRowIndex(index, perPage) {
266
144
  function cloneArrayOfObject(array) {
267
145
  return array.map((obj) => Object.assign({}, obj));
268
146
  }
147
+ function getRandomId(prefix = '', suffix = '') {
148
+ return `${prefix ? `${prefix}-` : ''}${Math.random().toString(16).slice(2)}${suffix ? `-${suffix}` : ''}`;
149
+ }
269
150
  function setLocalStorage(key, value) {
270
151
  localStorage.setItem(key, JSON.stringify(value));
271
152
  }
@@ -285,16 +166,16 @@ function getLocalStorage(key) {
285
166
  class TableColumnsEditorComponent {
286
167
  constructor() {
287
168
  this.infoText = "You can drag and drop columns as you wish and also disable unnecessary ones.";
288
- this.grid = input.required();
169
+ this.grid = input();
289
170
  this.close = input.required();
290
171
  this.currentState = [];
291
172
  this.stateHasChanged = signal(false);
292
173
  effect(() => {
293
- this.currentState = cloneArrayOfObject(this.grid().currentColumnsSortState).filter((column) => !column.sortDisabled);
174
+ this.currentState = cloneArrayOfObject(this.grid()?.currentColumnsSortState || []);
294
175
  });
295
176
  }
296
177
  resetChanges() {
297
- this.currentState = cloneArrayOfObject(this.grid().currentColumnsSortState);
178
+ this.currentState = cloneArrayOfObject(this.grid()?.currentColumnsSortState || []);
298
179
  this.stateHasChanged.set(false);
299
180
  }
300
181
  drop(event) {
@@ -306,32 +187,35 @@ class TableColumnsEditorComponent {
306
187
  this.updateChangedState();
307
188
  }
308
189
  setAndUpdate() {
309
- this.grid().applyColumnsSortState(this.currentState);
190
+ this.grid()?.applyColumnsSortState(this.currentState);
310
191
  this.close()();
311
192
  this.stateHasChanged.set(false);
312
193
  }
313
194
  updateChangedState() {
314
- this.stateHasChanged.set(JSON.stringify(this.grid().currentColumnsSortState) !== JSON.stringify(this.currentState));
195
+ this.stateHasChanged.set(JSON.stringify(this.grid()?.currentColumnsSortState) !== JSON.stringify(this.currentState));
315
196
  }
316
197
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TableColumnsEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
317
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TableColumnsEditorComponent, isStandalone: true, selector: "ngx-table-columns-editor", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, close: { classPropertyName: "close", publicName: "close", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div class=\"sort-card\">\n <div class=\"sort-card-header\">\n <h5>Table columns setup</h5>\n <svg\n width=\"14px\"\n height=\"14px\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M12 17.75C12.4142 17.75 12.75 17.4142 12.75 17V11C12.75 10.5858 12.4142 10.25 12 10.25C11.5858 10.25 11.25 10.5858 11.25 11V17C11.25 17.4142 11.5858 17.75 12 17.75Z\"\n fill=\"#1C274C\"\n />\n <path\n d=\"M12 7C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9C11.4477 9 11 8.55228 11 8C11 7.44772 11.4477 7 12 7Z\"\n fill=\"#1C274C\"\n />\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M1.25 12C1.25 6.06294 6.06294 1.25 12 1.25C17.9371 1.25 22.75 6.06294 22.75 12C22.75 17.9371 17.9371 22.75 12 22.75C6.06294 22.75 1.25 17.9371 1.25 12ZM12 2.75C6.89137 2.75 2.75 6.89137 2.75 12C2.75 17.1086 6.89137 21.25 12 21.25C17.1086 21.25 21.25 17.1086 21.25 12C21.25 6.89137 17.1086 2.75 12 2.75Z\"\n fill=\"#1C274C\"\n />\n </svg>\n </div>\n <div class=\"sort-card-body\">\n <div\n class=\"list\"\n cdkDropList\n [cdkDropListData]=\"currentState\"\n (cdkDropListDropped)=\"drop($event)\"\n >\n @for (column of currentState; track column.key; let i = $index) {\n\n <div\n cdkDrag\n [cdkDragLockAxis]=\"'y'\"\n [cdkDragStartDelay]=\"300\"\n class=\"drag-row\"\n #dragRow\n [style.--drag-row-height]=\"50\"\n >\n <div class=\"drag-placeholder\" *cdkDragPlaceholder></div>\n <div class=\"index-cell\">\n {{ i + 1 }}\n </div>\n <label class=\"sort-column-checkbox-wrap\" [for]=\"'sort-column-checkbox-' + i\">\n <span></span>\n <input\n [id]=\"'sort-column-checkbox-' + i\"\n title=\"Active state. If checked the column will be displayed\"\n type=\"checkbox\"\n class=\"sort-column-checkbox-input\"\n [checked]=\"!column.hide\"\n (change)=\"setVisibility(i)\"\n />\n <span></span>\n </label>\n {{ column.title }}\n </div>\n }\n </div>\n </div>\n @if (stateHasChanged()) {\n <div class=\"sort-card-footer\">\n <button class=\"reset-button\" (click)=\"resetChanges()\">reset</button>\n <button class=\"update-button\" (click)=\"setAndUpdate()\">Update</button>\n </div>\n }\n</div>\n", styles: [".list{overflow:auto;display:flex;flex-direction:column;gap:.3rem;max-height:100%}.drag-row{border:solid 1px var(--drag-row-border-color, #ccc);border-radius:.3rem;display:flex;align-items:center;box-sizing:border-box;cursor:grab;background:var(--drag-row-background, #ffffff);box-shadow:0 0 6px 1px #ebebeb33}.drag-row .index-cell{min-width:2.2rem;border-right:1px solid var(--drag-row-border-color, #ccc)}.drag-row>div{padding:.3rem}.drag-row .sort-column-checkbox-wrap{margin:0 .5rem}.cdk-drag-preview{box-sizing:border-box;border-radius:.3rem;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.list.cdk-drop-list-dragging .drag-row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.drag-placeholder{background:var(--drag-placeholder-background, #ccc);border:dotted 3px #999;min-height:var(--drag-row-heightpx, 2.5rem);transition:transform .25s cubic-bezier(0,0,.2,1)}.overlay-card nb-card-body{padding:.25rem;max-height:100%}.sort-card{box-shadow:0 0 6px 1px #0003;min-width:18rem;padding:.25rem;max-height:80dvh;background:var(--sort-card-background, #ffffff);border-radius:.5rem}.sort-card .sort-card-header{display:flex;align-items:center;gap:1rem;padding:1rem;border-bottom:1px solid var(--sort-card-header-divider-color, #edf1f7)}.sort-card .sort-card-header h5{margin:0}.sort-card .sort-card-body{padding:.5rem 0}.sort-card .sort-card-footer{border-top:1px solid var(--sort-card-header-divider-color, #edf1f7);display:flex;align-items:center;justify-content:end;gap:1rem;padding:1rem}.sort-card .sort-card-footer .update-button,.sort-card .sort-card-footer .reset-button{border-radius:.3rem;padding:.4rem 1rem;border:none;color:#fff;font-size:.875rem;font-weight:700;text-transform:uppercase}.sort-card .sort-card-footer .update-button{background-color:#36f}.sort-card .sort-card-footer .update-button:hover{background-color:#598bff}.sort-card .sort-card-footer .reset-button{background-color:#ff3d71}.sort-card .sort-card-footer .reset-button:hover{background-color:#ff708d}\n"], dependencies: [{ kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: CdkDragPlaceholder, selector: "ng-template[cdkDragPlaceholder]", inputs: ["data"] }] }); }
198
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TableColumnsEditorComponent, isStandalone: true, selector: "ngx-table-columns-editor", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: false, transformFunction: null }, close: { classPropertyName: "close", publicName: "close", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div class=\"sort-card\">\n <div class=\"sort-card-header\">\n <h6>Table columns setup</h6>\n </div>\n <div class=\"sort-card-body\">\n <div\n class=\"list\"\n cdkDropList\n [cdkDropListData]=\"currentState\"\n (cdkDropListDropped)=\"drop($event)\"\n >\n @for (column of currentState; track column.key; let i = $index) {\n\n <div\n cdkDrag\n [cdkDragLockAxis]=\"'y'\"\n [cdkDragStartDelay]=\"300\"\n [cdkDragDisabled]=\"column.moveDisabled\"\n class=\"drag-row\"\n #dragRow\n [style.--drag-row-height]=\"50\"\n >\n <div class=\"drag-placeholder\" *cdkDragPlaceholder></div>\n <div class=\"index-cell\">\n {{ i + 1 }}\n </div>\n <label class=\"sort-column-checkbox-wrap\" [for]=\"'sort-column-checkbox-' + i\">\n <span></span>\n <input\n [disabled]=\"column.moveDisabled\"\n [id]=\"'sort-column-checkbox-' + i\"\n title=\"Active state. If checked the column will be displayed\"\n type=\"checkbox\"\n class=\"sort-column-checkbox-input\"\n [checked]=\"!column.hide\"\n (change)=\"setVisibility(i)\"\n />\n <span></span>\n </label>\n {{ column.title }}\n </div>\n }\n </div>\n </div>\n @if (stateHasChanged()) {\n <div class=\"sort-card-footer\">\n <button class=\"reset-button\" (click)=\"resetChanges()\">reset</button>\n <button class=\"update-button\" (click)=\"setAndUpdate()\">Update</button>\n </div>\n }\n</div>\n", styles: [".list{overflow:auto;display:flex;flex-direction:column;gap:.3rem;max-height:100%}.drag-row{border:solid 1px var(--drag-row-border-color, #ccc);border-radius:.3rem;display:flex;align-items:center;box-sizing:border-box;cursor:grab;background:var(--drag-row-background, #ffffff);box-shadow:0 0 6px 1px #ebebeb33}.drag-row.cdk-drag-disabled{filter:opacity(.5);cursor:not-allowed}.drag-row .index-cell{min-width:2.2rem;border-right:1px solid var(--drag-row-border-color, #ccc)}.drag-row>div{padding:.3rem}.drag-row .sort-column-checkbox-wrap{margin:0 .5rem}.cdk-drag-preview{box-sizing:border-box;border-radius:.3rem;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.list.cdk-drop-list-dragging .drag-row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.drag-placeholder{background:var(--drag-placeholder-background, #ccc);border:dotted 3px #999;min-height:var(--drag-row-heightpx, 2.5rem);transition:transform .25s cubic-bezier(0,0,.2,1)}.overlay-card nb-card-body{padding:.25rem;max-height:100%}.sort-card{box-shadow:0 0 6px 1px #0003;min-width:18rem;padding:.25rem;max-height:80dvh;background:var(--sort-card-background, #ffffff);border-radius:.5rem}.sort-card .sort-card-header{display:flex;align-items:center;gap:1rem;padding:1rem;border-bottom:1px solid var(--sort-card-header-divider-color, #edf1f7)}.sort-card .sort-card-header h6{margin:0}.sort-card .sort-card-body{padding:.5rem 0}.sort-card .sort-card-footer{border-top:1px solid var(--sort-card-header-divider-color, #edf1f7);display:flex;align-items:center;justify-content:end;gap:1rem;padding:1rem}.sort-card .sort-card-footer .update-button,.sort-card .sort-card-footer .reset-button{border-radius:.3rem;padding:.4rem 1rem;border:none;color:#fff;font-size:.875rem;font-weight:700;text-transform:uppercase}.sort-card .sort-card-footer .update-button{background-color:#36f}.sort-card .sort-card-footer .update-button:hover{background-color:#598bff}.sort-card .sort-card-footer .reset-button{background-color:#ff3d71}.sort-card .sort-card-footer .reset-button:hover{background-color:#ff708d}\n"], dependencies: [{ kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: CdkDragPlaceholder, selector: "ng-template[cdkDragPlaceholder]", inputs: ["data"] }] }); }
318
199
  }
319
200
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TableColumnsEditorComponent, decorators: [{
320
201
  type: Component,
321
- args: [{ selector: "ngx-table-columns-editor", imports: [CdkDropList, CdkDrag, CdkDragPlaceholder], template: "<div class=\"sort-card\">\n <div class=\"sort-card-header\">\n <h5>Table columns setup</h5>\n <svg\n width=\"14px\"\n height=\"14px\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M12 17.75C12.4142 17.75 12.75 17.4142 12.75 17V11C12.75 10.5858 12.4142 10.25 12 10.25C11.5858 10.25 11.25 10.5858 11.25 11V17C11.25 17.4142 11.5858 17.75 12 17.75Z\"\n fill=\"#1C274C\"\n />\n <path\n d=\"M12 7C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9C11.4477 9 11 8.55228 11 8C11 7.44772 11.4477 7 12 7Z\"\n fill=\"#1C274C\"\n />\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M1.25 12C1.25 6.06294 6.06294 1.25 12 1.25C17.9371 1.25 22.75 6.06294 22.75 12C22.75 17.9371 17.9371 22.75 12 22.75C6.06294 22.75 1.25 17.9371 1.25 12ZM12 2.75C6.89137 2.75 2.75 6.89137 2.75 12C2.75 17.1086 6.89137 21.25 12 21.25C17.1086 21.25 21.25 17.1086 21.25 12C21.25 6.89137 17.1086 2.75 12 2.75Z\"\n fill=\"#1C274C\"\n />\n </svg>\n </div>\n <div class=\"sort-card-body\">\n <div\n class=\"list\"\n cdkDropList\n [cdkDropListData]=\"currentState\"\n (cdkDropListDropped)=\"drop($event)\"\n >\n @for (column of currentState; track column.key; let i = $index) {\n\n <div\n cdkDrag\n [cdkDragLockAxis]=\"'y'\"\n [cdkDragStartDelay]=\"300\"\n class=\"drag-row\"\n #dragRow\n [style.--drag-row-height]=\"50\"\n >\n <div class=\"drag-placeholder\" *cdkDragPlaceholder></div>\n <div class=\"index-cell\">\n {{ i + 1 }}\n </div>\n <label class=\"sort-column-checkbox-wrap\" [for]=\"'sort-column-checkbox-' + i\">\n <span></span>\n <input\n [id]=\"'sort-column-checkbox-' + i\"\n title=\"Active state. If checked the column will be displayed\"\n type=\"checkbox\"\n class=\"sort-column-checkbox-input\"\n [checked]=\"!column.hide\"\n (change)=\"setVisibility(i)\"\n />\n <span></span>\n </label>\n {{ column.title }}\n </div>\n }\n </div>\n </div>\n @if (stateHasChanged()) {\n <div class=\"sort-card-footer\">\n <button class=\"reset-button\" (click)=\"resetChanges()\">reset</button>\n <button class=\"update-button\" (click)=\"setAndUpdate()\">Update</button>\n </div>\n }\n</div>\n", styles: [".list{overflow:auto;display:flex;flex-direction:column;gap:.3rem;max-height:100%}.drag-row{border:solid 1px var(--drag-row-border-color, #ccc);border-radius:.3rem;display:flex;align-items:center;box-sizing:border-box;cursor:grab;background:var(--drag-row-background, #ffffff);box-shadow:0 0 6px 1px #ebebeb33}.drag-row .index-cell{min-width:2.2rem;border-right:1px solid var(--drag-row-border-color, #ccc)}.drag-row>div{padding:.3rem}.drag-row .sort-column-checkbox-wrap{margin:0 .5rem}.cdk-drag-preview{box-sizing:border-box;border-radius:.3rem;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.list.cdk-drop-list-dragging .drag-row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.drag-placeholder{background:var(--drag-placeholder-background, #ccc);border:dotted 3px #999;min-height:var(--drag-row-heightpx, 2.5rem);transition:transform .25s cubic-bezier(0,0,.2,1)}.overlay-card nb-card-body{padding:.25rem;max-height:100%}.sort-card{box-shadow:0 0 6px 1px #0003;min-width:18rem;padding:.25rem;max-height:80dvh;background:var(--sort-card-background, #ffffff);border-radius:.5rem}.sort-card .sort-card-header{display:flex;align-items:center;gap:1rem;padding:1rem;border-bottom:1px solid var(--sort-card-header-divider-color, #edf1f7)}.sort-card .sort-card-header h5{margin:0}.sort-card .sort-card-body{padding:.5rem 0}.sort-card .sort-card-footer{border-top:1px solid var(--sort-card-header-divider-color, #edf1f7);display:flex;align-items:center;justify-content:end;gap:1rem;padding:1rem}.sort-card .sort-card-footer .update-button,.sort-card .sort-card-footer .reset-button{border-radius:.3rem;padding:.4rem 1rem;border:none;color:#fff;font-size:.875rem;font-weight:700;text-transform:uppercase}.sort-card .sort-card-footer .update-button{background-color:#36f}.sort-card .sort-card-footer .update-button:hover{background-color:#598bff}.sort-card .sort-card-footer .reset-button{background-color:#ff3d71}.sort-card .sort-card-footer .reset-button:hover{background-color:#ff708d}\n"] }]
202
+ args: [{ selector: "ngx-table-columns-editor", imports: [CdkDropList, CdkDrag, CdkDragPlaceholder], template: "<div class=\"sort-card\">\n <div class=\"sort-card-header\">\n <h6>Table columns setup</h6>\n </div>\n <div class=\"sort-card-body\">\n <div\n class=\"list\"\n cdkDropList\n [cdkDropListData]=\"currentState\"\n (cdkDropListDropped)=\"drop($event)\"\n >\n @for (column of currentState; track column.key; let i = $index) {\n\n <div\n cdkDrag\n [cdkDragLockAxis]=\"'y'\"\n [cdkDragStartDelay]=\"300\"\n [cdkDragDisabled]=\"column.moveDisabled\"\n class=\"drag-row\"\n #dragRow\n [style.--drag-row-height]=\"50\"\n >\n <div class=\"drag-placeholder\" *cdkDragPlaceholder></div>\n <div class=\"index-cell\">\n {{ i + 1 }}\n </div>\n <label class=\"sort-column-checkbox-wrap\" [for]=\"'sort-column-checkbox-' + i\">\n <span></span>\n <input\n [disabled]=\"column.moveDisabled\"\n [id]=\"'sort-column-checkbox-' + i\"\n title=\"Active state. If checked the column will be displayed\"\n type=\"checkbox\"\n class=\"sort-column-checkbox-input\"\n [checked]=\"!column.hide\"\n (change)=\"setVisibility(i)\"\n />\n <span></span>\n </label>\n {{ column.title }}\n </div>\n }\n </div>\n </div>\n @if (stateHasChanged()) {\n <div class=\"sort-card-footer\">\n <button class=\"reset-button\" (click)=\"resetChanges()\">reset</button>\n <button class=\"update-button\" (click)=\"setAndUpdate()\">Update</button>\n </div>\n }\n</div>\n", styles: [".list{overflow:auto;display:flex;flex-direction:column;gap:.3rem;max-height:100%}.drag-row{border:solid 1px var(--drag-row-border-color, #ccc);border-radius:.3rem;display:flex;align-items:center;box-sizing:border-box;cursor:grab;background:var(--drag-row-background, #ffffff);box-shadow:0 0 6px 1px #ebebeb33}.drag-row.cdk-drag-disabled{filter:opacity(.5);cursor:not-allowed}.drag-row .index-cell{min-width:2.2rem;border-right:1px solid var(--drag-row-border-color, #ccc)}.drag-row>div{padding:.3rem}.drag-row .sort-column-checkbox-wrap{margin:0 .5rem}.cdk-drag-preview{box-sizing:border-box;border-radius:.3rem;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.list.cdk-drop-list-dragging .drag-row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.drag-placeholder{background:var(--drag-placeholder-background, #ccc);border:dotted 3px #999;min-height:var(--drag-row-heightpx, 2.5rem);transition:transform .25s cubic-bezier(0,0,.2,1)}.overlay-card nb-card-body{padding:.25rem;max-height:100%}.sort-card{box-shadow:0 0 6px 1px #0003;min-width:18rem;padding:.25rem;max-height:80dvh;background:var(--sort-card-background, #ffffff);border-radius:.5rem}.sort-card .sort-card-header{display:flex;align-items:center;gap:1rem;padding:1rem;border-bottom:1px solid var(--sort-card-header-divider-color, #edf1f7)}.sort-card .sort-card-header h6{margin:0}.sort-card .sort-card-body{padding:.5rem 0}.sort-card .sort-card-footer{border-top:1px solid var(--sort-card-header-divider-color, #edf1f7);display:flex;align-items:center;justify-content:end;gap:1rem;padding:1rem}.sort-card .sort-card-footer .update-button,.sort-card .sort-card-footer .reset-button{border-radius:.3rem;padding:.4rem 1rem;border:none;color:#fff;font-size:.875rem;font-weight:700;text-transform:uppercase}.sort-card .sort-card-footer .update-button{background-color:#36f}.sort-card .sort-card-footer .update-button:hover{background-color:#598bff}.sort-card .sort-card-footer .reset-button{background-color:#ff3d71}.sort-card .sort-card-footer .reset-button:hover{background-color:#ff708d}\n"] }]
322
203
  }], ctorParameters: () => [] });
323
204
 
324
205
  class SmartTableColumnEditorDirective {
325
206
  constructor() {
326
- this.tableComponent = input.required();
207
+ this.tableComponent = input();
327
208
  this.grid = computed(() => {
328
- return this.tableComponent().grid;
209
+ return this.tableComponent()?.grid;
329
210
  });
330
211
  this.overlay = inject(Overlay);
331
212
  this.elementRef = inject(ElementRef);
213
+ this.destroy$ = new Subject();
332
214
  }
333
215
  ngOnDestroy() {
334
216
  this.overlayRef?.dispose();
217
+ this.destroy$.next();
218
+ this.destroy$.complete();
335
219
  }
336
220
  showDropdown() {
337
221
  this.overlayRef = this.overlay.create(this.getOverlayConfig());
@@ -339,13 +223,14 @@ class SmartTableColumnEditorDirective {
339
223
  const dropdownRef = this.overlayRef.attach(componentPortal);
340
224
  dropdownRef.setInput("grid", this.grid());
341
225
  dropdownRef.setInput("close", this.hide.bind(this));
342
- this.overlayRef?.backdropClick().subscribe(() => this.hide());
226
+ this.overlayRef?.backdropClick().pipe(takeUntil(this.destroy$)).subscribe(() => this.hide());
343
227
  }
344
228
  hide() {
345
229
  this.overlayRef?.detach();
346
230
  this.overlayRef?.dispose();
231
+ this.destroy$.next();
347
232
  }
348
- buttonClick() {
233
+ buttclicked() {
349
234
  this.showDropdown();
350
235
  }
351
236
  getOverlayConfig() {
@@ -398,18 +283,135 @@ class SmartTableColumnEditorDirective {
398
283
  });
399
284
  }
400
285
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SmartTableColumnEditorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
401
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.3", type: SmartTableColumnEditorDirective, isStandalone: true, selector: "[smartTableColumnEditor]", inputs: { tableComponent: { classPropertyName: "tableComponent", publicName: "tableComponent", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "buttonClick()" } }, ngImport: i0 }); }
286
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.3", type: SmartTableColumnEditorDirective, isStandalone: true, selector: "[smartTableColumnEditor]", inputs: { tableComponent: { classPropertyName: "tableComponent", publicName: "tableComponent", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "buttclicked()" } }, ngImport: i0 }); }
402
287
  }
403
288
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SmartTableColumnEditorDirective, decorators: [{
404
289
  type: Directive,
405
290
  args: [{
406
291
  selector: "[smartTableColumnEditor]",
407
292
  host: {
408
- "(click)": "buttonClick()",
293
+ "(click)": "buttclicked()",
409
294
  },
410
295
  }]
411
296
  }] });
412
297
 
298
+ function prepareValue(value) { return value; }
299
+ class Cell {
300
+ static { this.PREPARE = prepareValue; }
301
+ constructor(value, row, column, dataSet) {
302
+ this.value = value;
303
+ this.row = row;
304
+ this.column = column;
305
+ this.dataSet = dataSet;
306
+ this.newValue = '';
307
+ this.newValue = value;
308
+ }
309
+ getColumn() {
310
+ return this.column;
311
+ }
312
+ getColumnClass() {
313
+ return this.column.class;
314
+ }
315
+ getRow() {
316
+ return this.row;
317
+ }
318
+ getValue() {
319
+ const prepare = this.column.getValuePrepareFunction() || Cell.PREPARE;
320
+ return prepare.call(null, this.value, this.row.getData(), this);
321
+ }
322
+ setValue(value) {
323
+ this.newValue = value;
324
+ }
325
+ getId() {
326
+ return this.getColumn().id;
327
+ }
328
+ getTitle() {
329
+ return this.getColumn().title;
330
+ }
331
+ isEditable() {
332
+ if (this.getRow().index === -1) {
333
+ return this.getColumn().isAddable;
334
+ }
335
+ else {
336
+ return this.getColumn().isEditable;
337
+ }
338
+ }
339
+ }
340
+
341
+ class Column {
342
+ constructor(id, settings, dataSet) {
343
+ this.id = id;
344
+ this.settings = settings;
345
+ this.dataSet = dataSet;
346
+ this.title = '';
347
+ this.type = 'text';
348
+ this.class = '';
349
+ this.width = '';
350
+ this.hide = false;
351
+ this.isSortable = false;
352
+ this.isEditable = true;
353
+ this.isAddable = true;
354
+ this.isFilterable = false;
355
+ this.sortDirection = 'asc';
356
+ this.defaultSortDirection = false;
357
+ this.editor = false;
358
+ this.filter = false;
359
+ this.process(this.settings);
360
+ }
361
+ getCompareFunction() {
362
+ return this.compareFunction;
363
+ }
364
+ getValuePrepareFunction() {
365
+ return this.valuePrepareFunction;
366
+ }
367
+ getFilterFunction() {
368
+ return this.filterFunction;
369
+ }
370
+ getConfig() {
371
+ if (this.editor && (this.editor.type === 'checkbox' || this.editor.type === 'custom' || this.editor.type === 'list')) {
372
+ return this.editor?.config;
373
+ }
374
+ return false;
375
+ }
376
+ getFilterType() {
377
+ return this.filter && this.filter.type;
378
+ }
379
+ getFilterConfig() {
380
+ if (this.filter && (this.filter.type === 'checkbox' || this.filter.type === 'custom' || this.filter.type === 'list')) {
381
+ return this.filter?.config;
382
+ }
383
+ return false;
384
+ }
385
+ process(settings) {
386
+ this.title = settings.title;
387
+ this.class = settings.class || '';
388
+ this.width = settings.width || '';
389
+ this.hide = !!settings.hide;
390
+ this.type = settings.type;
391
+ if (settings?.editor) {
392
+ this.editor = settings.editor;
393
+ }
394
+ if (settings?.filter) {
395
+ this.filter = settings.filter;
396
+ }
397
+ if (settings.type === 'custom' && settings.renderComponent) {
398
+ this.renderComponent = settings.renderComponent;
399
+ }
400
+ this.isFilterable = typeof settings.filter === 'undefined' ? true : !!settings['filter'];
401
+ this.defaultSortDirection = settings?.sortDirection || false;
402
+ this.isSortable = typeof settings.sort === 'undefined' ? true : settings.sort;
403
+ this.isEditable = typeof settings.editable === 'undefined' ? true : settings.editable;
404
+ this.isAddable = typeof settings.addable === 'undefined' ? true : settings.addable;
405
+ this.sortDirection = this.prepareSortDirection();
406
+ this.compareFunction = settings.compareFunction;
407
+ this.valuePrepareFunction = settings.valuePrepareFunction;
408
+ this.filterFunction = settings.filterFunction;
409
+ }
410
+ prepareSortDirection() {
411
+ return this.defaultSortDirection === 'desc' ? 'desc' : 'asc';
412
+ }
413
+ }
414
+
413
415
  class Row {
414
416
  constructor(index, data, _dataSet) {
415
417
  this.index = index;
@@ -562,25 +564,6 @@ class DataSource {
562
564
  }
563
565
  }
564
566
 
565
- function compareValues(direction, a, b) {
566
- if (a < b) {
567
- return -1 * direction;
568
- }
569
- if (a > b) {
570
- return direction;
571
- }
572
- return 0;
573
- }
574
- class LocalSorter {
575
- static sort(data, field, direction, customCompare) {
576
- const dir = (direction === 'asc') ? 1 : -1;
577
- const compare = customCompare ? customCompare : compareValues;
578
- return data.sort((a, b) => {
579
- return compare.call(null, dir, a[field], b[field]);
580
- });
581
- }
582
- }
583
-
584
567
  function filterValues(value, search) {
585
568
  return value.toString().toLowerCase().includes(search.toString().toLowerCase());
586
569
  }
@@ -600,6 +583,25 @@ class LocalPager {
600
583
  }
601
584
  }
602
585
 
586
+ function compareValues(direction, a, b) {
587
+ if (a < b) {
588
+ return -1 * direction;
589
+ }
590
+ if (a > b) {
591
+ return direction;
592
+ }
593
+ return 0;
594
+ }
595
+ class LocalSorter {
596
+ static sort(data, field, direction, customCompare) {
597
+ const dir = (direction === 'asc') ? 1 : -1;
598
+ const compare = customCompare ? customCompare : compareValues;
599
+ return data.sort((a, b) => {
600
+ return compare.call(null, dir, a[field], b[field]);
601
+ });
602
+ }
603
+ }
604
+
603
605
  class LocalDataSource extends DataSource {
604
606
  constructor(data = []) {
605
607
  super();
@@ -660,7 +662,7 @@ class LocalDataSource extends DataSource {
660
662
  return Promise.resolve(this.prepareData(data));
661
663
  }
662
664
  getFilteredAndSorted() {
663
- let data = this.data.slice(0);
665
+ const data = this.data.slice(0);
664
666
  this.prepareData(data);
665
667
  return Promise.resolve(this.filteredAndSorted);
666
668
  }
@@ -1156,182 +1158,773 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
1156
1158
  type: Input
1157
1159
  }] } });
1158
1160
 
1159
- class DataSet {
1160
- constructor(data = [], columnSettings) {
1161
- this.columnSettings = columnSettings;
1162
- this.data = [];
1163
- this.columns = [];
1164
- this.rows = [];
1165
- this.selectedRows = new Set();
1166
- this.createColumns(columnSettings);
1167
- this.setData(data);
1168
- this.createNewRow();
1169
- }
1170
- setData(data) {
1171
- this.data = data;
1172
- this.createRows();
1173
- }
1174
- getColumns() {
1175
- return this.columns;
1176
- }
1177
- getRows() {
1178
- return this.rows;
1179
- }
1180
- getFirstRow() {
1181
- return this.rows[0];
1161
+ class EditCellDefaultComponent {
1162
+ constructor() {
1163
+ this.cell = input.required();
1164
+ this.inputClass = input('');
1182
1165
  }
1183
- getLastRow() {
1184
- return this.rows[this.rows.length - 1];
1166
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellDefaultComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1167
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: EditCellDefaultComponent, isStandalone: true, selector: "ng-component", inputs: { cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: true, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: '', isInline: true }); }
1168
+ }
1169
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellDefaultComponent, decorators: [{
1170
+ type: Component,
1171
+ args: [{ template: '' }]
1172
+ }] });
1173
+
1174
+ class CustomEditComponent extends EditCellDefaultComponent {
1175
+ ngOnChanges(changes) {
1176
+ const editor = this.cell().getColumn().editor;
1177
+ if (this.customComponent) {
1178
+ if (this.customComponent?.instance && 'ngOnChanges' in this.customComponent.instance) {
1179
+ const onChanges = this.customComponent.instance.ngOnChanges;
1180
+ onChanges(changes);
1181
+ }
1182
+ return;
1183
+ }
1184
+ if (this.cell() &&
1185
+ !this.customComponent &&
1186
+ editor &&
1187
+ editor.type == "custom") {
1188
+ this.customComponent = this.dynamicTarget?.createComponent(editor.component);
1189
+ this.customComponent?.setInput('cell', this.cell());
1190
+ this.customComponent?.setInput('inputClass', this.inputClass());
1191
+ }
1185
1192
  }
1186
- findRowByData(data) {
1187
- return this.rows.find((row) => row.getData() === data);
1193
+ ngOnDestroy() {
1194
+ if (this.customComponent) {
1195
+ this.customComponent.destroy();
1196
+ }
1188
1197
  }
1189
- setSelectAll(state) {
1190
- this.rows.forEach((row) => {
1191
- row.isSelected = state;
1192
- this.storeSelectedRow(row);
1198
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1199
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: CustomEditComponent, isStandalone: true, selector: "table-cell-custom-editor", viewQueries: [{ propertyName: "dynamicTarget", first: true, predicate: ["dynamicTarget"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: ` <ng-template #dynamicTarget></ng-template> `, isInline: true }); }
1200
+ }
1201
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, decorators: [{
1202
+ type: Component,
1203
+ args: [{
1204
+ selector: "table-cell-custom-editor",
1205
+ template: ` <ng-template #dynamicTarget></ng-template> `,
1206
+ standalone: true,
1207
+ }]
1208
+ }], propDecorators: { dynamicTarget: [{
1209
+ type: ViewChild,
1210
+ args: ["dynamicTarget", { read: ViewContainerRef, static: true }]
1211
+ }] } });
1212
+
1213
+ class CheckboxEditorComponent extends DefaultEditor {
1214
+ constructor() {
1215
+ super();
1216
+ this.trueVal = computed(() => {
1217
+ return this.cell().getColumn().getConfig()?.true || true;
1193
1218
  });
1194
- }
1195
- deselectAll() {
1196
- this.rows.forEach((row) => {
1197
- row.isSelected = false;
1219
+ this.falseVal = computed(() => {
1220
+ return this.cell().getColumn().getConfig()?.false || false;
1198
1221
  });
1199
- // we need to clear selectedRow field because no one row selected
1200
- this.selectedRows.clear();
1201
- }
1202
- selectRow(row, state) {
1203
- row.isSelected = state;
1204
- this.storeSelectedRow(row);
1205
- }
1206
- multipleSelectRow(row) {
1207
- row.isSelected = !row.isSelected;
1208
- this.storeSelectedRow(row);
1209
- return row;
1210
1222
  }
1211
- getSelectedRowsData() {
1212
- return [...this.selectedRows];
1223
+ onChange(event) {
1224
+ this.cell().newValue = event.target.checked ? this.trueVal() : this.falseVal();
1213
1225
  }
1214
- createNewRow() {
1215
- this.newRow = new Row(-1, {}, this);
1216
- this.newRow.isInEditing = true;
1226
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1227
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: CheckboxEditorComponent, isStandalone: true, selector: "checkbox-editor", usesInheritance: true, ngImport: i0, template: `
1228
+ <input
1229
+ [class]="inputClass()"
1230
+ type="checkbox"
1231
+ class="form-control"
1232
+ [name]="cell().getId()"
1233
+ [disabled]="!cell().isEditable()"
1234
+ (change)="onChange($event)"
1235
+ [checked]="
1236
+ cell().getValue() === trueVal()
1237
+ "
1238
+ />
1239
+ `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }); }
1240
+ }
1241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxEditorComponent, decorators: [{
1242
+ type: Component,
1243
+ args: [{ selector: "checkbox-editor", template: `
1244
+ <input
1245
+ [class]="inputClass()"
1246
+ type="checkbox"
1247
+ class="form-control"
1248
+ [name]="cell().getId()"
1249
+ [disabled]="!cell().isEditable()"
1250
+ (change)="onChange($event)"
1251
+ [checked]="
1252
+ cell().getValue() === trueVal()
1253
+ "
1254
+ />
1255
+ `, standalone: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
1256
+ }], ctorParameters: () => [] });
1257
+
1258
+ class InputEditorComponent extends DefaultEditor {
1259
+ constructor() {
1260
+ super();
1217
1261
  }
1218
- /**
1219
- * Create columns by mapping from the settings
1220
- * @param settings
1221
- * @private
1222
- */
1223
- createColumns(settings) {
1224
- settings.forEach((columnSettings) => {
1225
- this.columns.push(new Column(columnSettings.key, columnSettings, this));
1226
- });
1262
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1263
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: InputEditorComponent, isStandalone: true, selector: "input-editor", usesInheritance: true, ngImport: i0, template: `
1264
+ <input
1265
+ [class]="inputClass()"
1266
+ class="form-control"
1267
+ [(ngModel)]="cell().newValue"
1268
+ [name]="cell().getId()"
1269
+ [placeholder]="cell().getTitle()"
1270
+ [disabled]="!cell().isEditable()"
1271
+ />
1272
+ `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1273
+ }
1274
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputEditorComponent, decorators: [{
1275
+ type: Component,
1276
+ args: [{ selector: "input-editor", template: `
1277
+ <input
1278
+ [class]="inputClass()"
1279
+ class="form-control"
1280
+ [(ngModel)]="cell().newValue"
1281
+ [name]="cell().getId()"
1282
+ [placeholder]="cell().getTitle()"
1283
+ [disabled]="!cell().isEditable()"
1284
+ />
1285
+ `, standalone: true, imports: [FormsModule], styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
1286
+ }], ctorParameters: () => [] });
1287
+
1288
+ class SelectEditorComponent extends DefaultEditor {
1289
+ constructor() {
1290
+ super();
1227
1291
  }
1228
- /**
1229
- * Create rows based on current data prepared in data source
1230
- * @private
1231
- */
1232
- createRows() {
1233
- this.rows = [];
1234
- this.data.forEach((el, index) => {
1235
- const row = new Row(index, el, this);
1236
- row.isSelected = this.selectedRows.has(row.getData());
1237
- this.rows.push(row);
1238
- });
1292
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1293
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: SelectEditorComponent, isStandalone: true, selector: "select-editor", usesInheritance: true, ngImport: i0, template: `
1294
+ <select
1295
+ [class]="inputClass()"
1296
+ class="form-control"
1297
+ [(ngModel)]="cell().newValue"
1298
+ [name]="cell().getId()"
1299
+ [disabled]="!cell().isEditable()"
1300
+ >
1301
+ @for (option of cell().getColumn().getConfig()?.list; track option.value) {
1302
+ <option
1303
+ [value]="option.value"
1304
+ [selected]="option.value === cell().getValue()"
1305
+ >
1306
+ {{ option.title }}
1307
+ </option>
1308
+ }
1309
+ </select>
1310
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1311
+ }
1312
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectEditorComponent, decorators: [{
1313
+ type: Component,
1314
+ args: [{
1315
+ selector: "select-editor",
1316
+ template: `
1317
+ <select
1318
+ [class]="inputClass()"
1319
+ class="form-control"
1320
+ [(ngModel)]="cell().newValue"
1321
+ [name]="cell().getId()"
1322
+ [disabled]="!cell().isEditable()"
1323
+ >
1324
+ @for (option of cell().getColumn().getConfig()?.list; track option.value) {
1325
+ <option
1326
+ [value]="option.value"
1327
+ [selected]="option.value === cell().getValue()"
1328
+ >
1329
+ {{ option.title }}
1330
+ </option>
1331
+ }
1332
+ </select>
1333
+ `,
1334
+ standalone: true,
1335
+ imports: [FormsModule],
1336
+ }]
1337
+ }], ctorParameters: () => [] });
1338
+
1339
+ class TextareaEditorComponent extends DefaultEditor {
1340
+ constructor() {
1341
+ super();
1239
1342
  }
1240
- get isAllSelected() {
1241
- return this.rows.every((row) => row.isSelected);
1343
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TextareaEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1344
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: TextareaEditorComponent, isStandalone: true, selector: "textarea-editor", usesInheritance: true, ngImport: i0, template: `
1345
+ <textarea
1346
+ [class]="inputClass()"
1347
+ class="form-control"
1348
+ [(ngModel)]="cell().newValue"
1349
+ [name]="cell().getId()"
1350
+ [disabled]="!cell().isEditable()"
1351
+ [placeholder]="cell().getTitle()"
1352
+ >
1353
+ </textarea>
1354
+ `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1355
+ }
1356
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TextareaEditorComponent, decorators: [{
1357
+ type: Component,
1358
+ args: [{ selector: "textarea-editor", template: `
1359
+ <textarea
1360
+ [class]="inputClass()"
1361
+ class="form-control"
1362
+ [(ngModel)]="cell().newValue"
1363
+ [name]="cell().getId()"
1364
+ [disabled]="!cell().isEditable()"
1365
+ [placeholder]="cell().getTitle()"
1366
+ >
1367
+ </textarea>
1368
+ `, standalone: true, imports: [FormsModule], styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
1369
+ }], ctorParameters: () => [] });
1370
+
1371
+ class DefaultEditComponent extends EditCellDefaultComponent {
1372
+ constructor() {
1373
+ super();
1242
1374
  }
1243
- storeSelectedRow(row) {
1244
- if (row.isSelected) {
1245
- this.selectedRows.add(row.getData());
1246
- }
1247
- else {
1248
- this.selectedRows.delete(row.getData());
1375
+ getEditorType() {
1376
+ const editor = this.cell().getColumn().editor;
1377
+ if (editor) {
1378
+ return editor.type || "text";
1249
1379
  }
1380
+ return "text";
1250
1381
  }
1382
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultEditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1383
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: DefaultEditComponent, isStandalone: true, selector: "table-cell-default-editor", usesInheritance: true, ngImport: i0, template: "<div role=\"none\" (click)=\"$event.stopPropagation()\">\n @switch (getEditorType()) {\n @case ('list') {\n <select-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </select-editor>\n }\n @case ('textarea') {\n <textarea-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </textarea-editor>\n }\n @case ('checkbox') {\n <checkbox-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </checkbox-editor>\n }\n @default {\n <input-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </input-editor>\n }\n}\n</div>", dependencies: [{ kind: "component", type: SelectEditorComponent, selector: "select-editor" }, { kind: "component", type: TextareaEditorComponent, selector: "textarea-editor" }, { kind: "component", type: CheckboxEditorComponent, selector: "checkbox-editor" }, { kind: "component", type: InputEditorComponent, selector: "input-editor" }] }); }
1251
1384
  }
1252
-
1253
- class Grid {
1254
- constructor(source, settings) {
1255
- this.createFormShown = false;
1256
- this.onSelectRowSource = new Subject();
1257
- this.onDeselectRowSource = new Subject();
1258
- this.currentColumnsSortState = [];
1259
- this.setSettings(settings);
1260
- this.setSource(source);
1261
- }
1262
- setColumnsSortedEmitter(emitter) {
1263
- this.columnsSortedEmitter = emitter;
1385
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultEditComponent, decorators: [{
1386
+ type: Component,
1387
+ args: [{ selector: "table-cell-default-editor", imports: [
1388
+ SelectEditorComponent,
1389
+ TextareaEditorComponent,
1390
+ CheckboxEditorComponent,
1391
+ InputEditorComponent,
1392
+ ], standalone: true, template: "<div role=\"none\" (click)=\"$event.stopPropagation()\">\n @switch (getEditorType()) {\n @case ('list') {\n <select-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </select-editor>\n }\n @case ('textarea') {\n <textarea-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </textarea-editor>\n }\n @case ('checkbox') {\n <checkbox-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </checkbox-editor>\n }\n @default {\n <input-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </input-editor>\n }\n}\n</div>" }]
1393
+ }], ctorParameters: () => [] });
1394
+
1395
+ class EditCellComponent {
1396
+ constructor() {
1397
+ this.cell = input.required();
1398
+ this.inputClass = input("");
1264
1399
  }
1265
- detach() {
1266
- if (this.sourceOnChangedSubscription) {
1267
- this.sourceOnChangedSubscription.unsubscribe();
1268
- }
1269
- if (this.sourceOnUpdatedSubscription) {
1270
- this.sourceOnUpdatedSubscription.unsubscribe();
1400
+ getEditorType() {
1401
+ const editor = this.cell().getColumn().editor;
1402
+ if (editor) {
1403
+ return editor.type;
1271
1404
  }
1405
+ return "text";
1272
1406
  }
1273
- showActionColumn(position) {
1274
- return this.isCurrentActionsPosition(position) && this.isActionsVisible();
1275
- }
1276
- isCurrentActionsPosition(position) {
1277
- return position == this.getSetting("actions.position");
1278
- }
1279
- isActionsVisible() {
1280
- return (this.getSetting("actions.add", false) ||
1281
- this.getSetting("actions.edit", false) ||
1282
- this.getSetting("actions.delete", false) ||
1283
- !!this.getSetting("actions.custom", [])?.length);
1284
- }
1285
- isMultiSelectVisible() {
1286
- return this.getSetting("selectMode") === "multi";
1407
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1408
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: EditCellComponent, isStandalone: true, selector: "table-cell-edit-mode", inputs: { cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: true, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1409
+ <div>
1410
+ @switch (getEditorType()) { @case ('custom') {
1411
+ <table-cell-custom-editor
1412
+ [cell]="cell()"
1413
+ [inputClass]="inputClass()"
1414
+ >
1415
+ </table-cell-custom-editor>
1416
+ } @default {
1417
+ <table-cell-default-editor
1418
+ [cell]="cell()"
1419
+ [inputClass]="inputClass()"
1420
+ >
1421
+ </table-cell-default-editor>
1422
+ } }
1423
+ </div>
1424
+ `, isInline: true, dependencies: [{ kind: "component", type: CustomEditComponent, selector: "table-cell-custom-editor" }, { kind: "component", type: DefaultEditComponent, selector: "table-cell-default-editor" }] }); }
1425
+ }
1426
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellComponent, decorators: [{
1427
+ type: Component,
1428
+ args: [{
1429
+ selector: "table-cell-edit-mode",
1430
+ template: `
1431
+ <div>
1432
+ @switch (getEditorType()) { @case ('custom') {
1433
+ <table-cell-custom-editor
1434
+ [cell]="cell()"
1435
+ [inputClass]="inputClass()"
1436
+ >
1437
+ </table-cell-custom-editor>
1438
+ } @default {
1439
+ <table-cell-default-editor
1440
+ [cell]="cell()"
1441
+ [inputClass]="inputClass()"
1442
+ >
1443
+ </table-cell-default-editor>
1444
+ } }
1445
+ </div>
1446
+ `,
1447
+ standalone: true,
1448
+ imports: [CustomEditComponent, DefaultEditComponent],
1449
+ }]
1450
+ }] });
1451
+
1452
+ class CustomViewComponent {
1453
+ constructor() {
1454
+ this.cell = input.required();
1287
1455
  }
1288
- getNewRow() {
1289
- return this.dataSet.newRow;
1456
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1457
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: CustomViewComponent, isStandalone: true, selector: "custom-view-component", inputs: { cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `<ng-template
1458
+ *ngComponentOutlet="
1459
+ cell().getColumn().renderComponent;
1460
+ inputs: { rowData: cell().getRow().getData(), value: cell().getValue() }
1461
+ "
1462
+ ></ng-template>`, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }] }); }
1463
+ }
1464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomViewComponent, decorators: [{
1465
+ type: Component,
1466
+ args: [{
1467
+ selector: "custom-view-component",
1468
+ template: `<ng-template
1469
+ *ngComponentOutlet="
1470
+ cell().getColumn().renderComponent;
1471
+ inputs: { rowData: cell().getRow().getData(), value: cell().getValue() }
1472
+ "
1473
+ ></ng-template>`,
1474
+ imports: [NgComponentOutlet],
1475
+ standalone: true,
1476
+ }]
1477
+ }] });
1478
+
1479
+ class ViewCellComponent {
1480
+ constructor() {
1481
+ this.cell = input.required();
1290
1482
  }
1291
- setSettings(settings) {
1292
- this.updateSettingsAndDataSet(settings);
1293
- if (this.getSetting('withColumnSort', false)) {
1294
- this.setColumnsSortState(settings.columns);
1295
- }
1483
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ViewCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1484
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: ViewCellComponent, isStandalone: true, selector: "table-cell-view-mode", inputs: { cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
1485
+ <div>
1486
+ @switch (cell().getColumn().type) { @case ('custom') {
1487
+ <custom-view-component [cell]="cell()"></custom-view-component>
1488
+ } @case ('html') {
1489
+ <div [innerHTML]="cell().getValue()"></div>
1490
+ } @default {
1491
+ <div>{{ cell().getValue() }}</div>
1492
+ } }
1493
+ </div>
1494
+ `, isInline: true, dependencies: [{ kind: "component", type: CustomViewComponent, selector: "custom-view-component", inputs: ["cell"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1495
+ }
1496
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ViewCellComponent, decorators: [{
1497
+ type: Component,
1498
+ args: [{
1499
+ selector: "table-cell-view-mode",
1500
+ changeDetection: ChangeDetectionStrategy.OnPush,
1501
+ template: `
1502
+ <div>
1503
+ @switch (cell().getColumn().type) { @case ('custom') {
1504
+ <custom-view-component [cell]="cell()"></custom-view-component>
1505
+ } @case ('html') {
1506
+ <div [innerHTML]="cell().getValue()"></div>
1507
+ } @default {
1508
+ <div>{{ cell().getValue() }}</div>
1509
+ } }
1510
+ </div>
1511
+ `,
1512
+ standalone: true,
1513
+ imports: [CustomViewComponent],
1514
+ }]
1515
+ }] });
1516
+
1517
+ class CellComponent {
1518
+ constructor() {
1519
+ this.cell = input.required();
1520
+ this.inputClass = input('');
1521
+ this.isInEditing = input(false);
1296
1522
  }
1297
- updateSettingsAndDataSet(settings) {
1298
- this.settings = settings;
1299
- this.dataSet = new DataSet([], this.getSetting("columns"));
1300
- if (this.source) {
1301
- this.source.refresh();
1302
- }
1523
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1524
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: CellComponent, isStandalone: true, selector: "ng2-smart-table-cell", inputs: { cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: true, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, isInEditing: { classPropertyName: "isInEditing", publicName: "isInEditing", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1525
+ @if (!isInEditing()) {
1526
+ <table-cell-view-mode [cell]="cell()"></table-cell-view-mode>
1527
+ } @else {
1528
+ <table-cell-edit-mode
1529
+ [cell]="cell()"
1530
+ [inputClass]="inputClass()"
1531
+ >
1532
+ </table-cell-edit-mode>
1303
1533
  }
1304
- getDataSet() {
1305
- return this.dataSet;
1534
+ `, isInline: true, dependencies: [{ kind: "component", type: ViewCellComponent, selector: "table-cell-view-mode", inputs: ["cell"] }, { kind: "component", type: EditCellComponent, selector: "table-cell-edit-mode", inputs: ["cell", "inputClass"] }] }); }
1535
+ }
1536
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CellComponent, decorators: [{
1537
+ type: Component,
1538
+ args: [{
1539
+ selector: "ng2-smart-table-cell",
1540
+ template: `
1541
+ @if (!isInEditing()) {
1542
+ <table-cell-view-mode [cell]="cell()"></table-cell-view-mode>
1543
+ } @else {
1544
+ <table-cell-edit-mode
1545
+ [cell]="cell()"
1546
+ [inputClass]="inputClass()"
1547
+ >
1548
+ </table-cell-edit-mode>
1306
1549
  }
1307
- setSource(source) {
1308
- this.source = this.prepareSource(source);
1309
- this.detach();
1310
- this.sourceOnChangedSubscription = this.source
1311
- .onChanged()
1312
- .subscribe((changes) => this.processDataChange(changes));
1313
- this.sourceOnUpdatedSubscription = this.source
1314
- .onUpdated()
1315
- .subscribe((data) => {
1316
- const changedRow = this.dataSet.findRowByData(data);
1317
- if (changedRow) {
1318
- changedRow.setData(data);
1319
- }
1550
+ `,
1551
+ standalone: true,
1552
+ imports: [ViewCellComponent, EditCellComponent],
1553
+ }]
1554
+ }] });
1555
+
1556
+ class TbodyCreateCancelComponent {
1557
+ constructor() {
1558
+ this.grid = input.required();
1559
+ this.row = input.required();
1560
+ this.editConfirm = input.required();
1561
+ this.editCancel = input.required();
1562
+ this.cancelButtonContent = computed(() => {
1563
+ const edit = this.grid().settings().edit;
1564
+ return edit ? edit.cancelButtonContent || "Cancel" : "Cancel";
1565
+ });
1566
+ this.saveButtonContent = computed(() => {
1567
+ const edit = this.grid().settings().edit;
1568
+ return edit ? edit.saveButtonContent || "Update" : "Update";
1320
1569
  });
1321
1570
  }
1322
- getSetting(name, defaultValue) {
1323
- return getDeepFromObject(this.settings, name, defaultValue);
1324
- }
1325
- getColumns() {
1326
- return this.dataSet.getColumns();
1571
+ onSave(event) {
1572
+ event.preventDefault();
1573
+ event.stopPropagation();
1574
+ this.grid().save(this.row(), this.editConfirm());
1327
1575
  }
1328
- getRows() {
1329
- return this.dataSet.getRows();
1576
+ onCancelEdit(event) {
1577
+ event.preventDefault();
1578
+ event.stopPropagation();
1579
+ this.editCancel().emit(true);
1580
+ this.row().isInEditing = false;
1330
1581
  }
1331
- selectRow(row, state) {
1332
- this.dataSet.selectRow(row, state);
1582
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyCreateCancelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1583
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TbodyCreateCancelComponent, isStandalone: true, selector: "ng2-st-tbody-create-cancel", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null }, editConfirm: { classPropertyName: "editConfirm", publicName: "editConfirm", isSignal: true, isRequired: true, transformFunction: null }, editCancel: { classPropertyName: "editCancel", publicName: "editCancel", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
1584
+ @if (!row().pending) {
1585
+ <a
1586
+ href="#"
1587
+ [id]="'row-' + row().index + '_editing-confirm-button'"
1588
+ class="ng2-smart-action ng2-smart-action-edit-save"
1589
+ [innerHTML]="saveButtonContent()"
1590
+ (click)="onSave($event)"
1591
+ ></a>
1592
+ <a
1593
+ href="#"
1594
+ [id]="'row-' + row().index + '_editing-cancel-button'"
1595
+ class="ng2-smart-action ng2-smart-action-edit-cancel"
1596
+ [innerHTML]="cancelButtonContent()"
1597
+ (click)="onCancelEdit($event)"
1598
+ ></a>
1599
+ } @else {
1600
+ <div style="display: flex;">
1601
+ <svg
1602
+ role="none"
1603
+ (click)="$event.stopPropagation()"
1604
+ style="height: 2rem; width: 2rem;"
1605
+ version="1.1"
1606
+ id="L9"
1607
+ xmlns="http://www.w3.org/2000/svg"
1608
+ xmlns:xlink="http://www.w3.org/1999/xlink"
1609
+ x="0px"
1610
+ y="0px"
1611
+ viewBox="0 0 100 100"
1612
+ enable-background="new 0 0 0 0"
1613
+ xml:space="preserve"
1614
+ >
1615
+ <path
1616
+ fill="#e9e9e9"
1617
+ d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
1618
+ >
1619
+ <animateTransform
1620
+ attributeName="transform"
1621
+ attributeType="XML"
1622
+ type="rotate"
1623
+ dur="1s"
1624
+ from="0 50 50"
1625
+ to="360 50 50"
1626
+ repeatCount="indefinite"
1627
+ />
1628
+ </path>
1629
+ </svg>
1630
+ <svg
1631
+ role="none"
1632
+ (click)="$event.stopPropagation()"
1633
+ style="height: 2rem; width: 2rem; "
1634
+ version="1.1"
1635
+ id="L9"
1636
+ xmlns="http://www.w3.org/2000/svg"
1637
+ xmlns:xlink="http://www.w3.org/1999/xlink"
1638
+ x="0px"
1639
+ y="0px"
1640
+ viewBox="0 0 100 100"
1641
+ enable-background="new 0 0 0 0"
1642
+ xml:space="preserve"
1643
+ >
1644
+ <path
1645
+ fill="#e9e9e9"
1646
+ d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
1647
+ >
1648
+ <animateTransform
1649
+ attributeName="transform"
1650
+ attributeType="XML"
1651
+ type="rotate"
1652
+ dur="1s"
1653
+ from="0 50 50"
1654
+ to="360 50 50"
1655
+ repeatCount="indefinite"
1656
+ />
1657
+ </path>
1658
+ </svg>
1659
+ </div>
1333
1660
  }
1334
- multipleSelectRow(row) {
1661
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1662
+ }
1663
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyCreateCancelComponent, decorators: [{
1664
+ type: Component,
1665
+ args: [{
1666
+ selector: "ng2-st-tbody-create-cancel",
1667
+ template: `
1668
+ @if (!row().pending) {
1669
+ <a
1670
+ href="#"
1671
+ [id]="'row-' + row().index + '_editing-confirm-button'"
1672
+ class="ng2-smart-action ng2-smart-action-edit-save"
1673
+ [innerHTML]="saveButtonContent()"
1674
+ (click)="onSave($event)"
1675
+ ></a>
1676
+ <a
1677
+ href="#"
1678
+ [id]="'row-' + row().index + '_editing-cancel-button'"
1679
+ class="ng2-smart-action ng2-smart-action-edit-cancel"
1680
+ [innerHTML]="cancelButtonContent()"
1681
+ (click)="onCancelEdit($event)"
1682
+ ></a>
1683
+ } @else {
1684
+ <div style="display: flex;">
1685
+ <svg
1686
+ role="none"
1687
+ (click)="$event.stopPropagation()"
1688
+ style="height: 2rem; width: 2rem;"
1689
+ version="1.1"
1690
+ id="L9"
1691
+ xmlns="http://www.w3.org/2000/svg"
1692
+ xmlns:xlink="http://www.w3.org/1999/xlink"
1693
+ x="0px"
1694
+ y="0px"
1695
+ viewBox="0 0 100 100"
1696
+ enable-background="new 0 0 0 0"
1697
+ xml:space="preserve"
1698
+ >
1699
+ <path
1700
+ fill="#e9e9e9"
1701
+ d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
1702
+ >
1703
+ <animateTransform
1704
+ attributeName="transform"
1705
+ attributeType="XML"
1706
+ type="rotate"
1707
+ dur="1s"
1708
+ from="0 50 50"
1709
+ to="360 50 50"
1710
+ repeatCount="indefinite"
1711
+ />
1712
+ </path>
1713
+ </svg>
1714
+ <svg
1715
+ role="none"
1716
+ (click)="$event.stopPropagation()"
1717
+ style="height: 2rem; width: 2rem; "
1718
+ version="1.1"
1719
+ id="L9"
1720
+ xmlns="http://www.w3.org/2000/svg"
1721
+ xmlns:xlink="http://www.w3.org/1999/xlink"
1722
+ x="0px"
1723
+ y="0px"
1724
+ viewBox="0 0 100 100"
1725
+ enable-background="new 0 0 0 0"
1726
+ xml:space="preserve"
1727
+ >
1728
+ <path
1729
+ fill="#e9e9e9"
1730
+ d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
1731
+ >
1732
+ <animateTransform
1733
+ attributeName="transform"
1734
+ attributeType="XML"
1735
+ type="rotate"
1736
+ dur="1s"
1737
+ from="0 50 50"
1738
+ to="360 50 50"
1739
+ repeatCount="indefinite"
1740
+ />
1741
+ </path>
1742
+ </svg>
1743
+ </div>
1744
+ }
1745
+ `,
1746
+ standalone: true,
1747
+ changeDetection: ChangeDetectionStrategy.OnPush,
1748
+ }]
1749
+ }] });
1750
+
1751
+ class DataSet {
1752
+ constructor(data = [], columnSettings) {
1753
+ this.columnSettings = columnSettings;
1754
+ this.data = [];
1755
+ this.columns = [];
1756
+ this.rows = [];
1757
+ this.selectedRows = new Set();
1758
+ this.createColumns(columnSettings);
1759
+ this.setData(data);
1760
+ this.createNewRow();
1761
+ }
1762
+ setData(data) {
1763
+ this.data = data;
1764
+ this.createRows();
1765
+ }
1766
+ getColumns() {
1767
+ return this.columns;
1768
+ }
1769
+ getRows() {
1770
+ return this.rows;
1771
+ }
1772
+ getFirstRow() {
1773
+ return this.rows[0];
1774
+ }
1775
+ getLastRow() {
1776
+ return this.rows[this.rows.length - 1];
1777
+ }
1778
+ findRowByData(data) {
1779
+ return this.rows.find((row) => row.getData() === data);
1780
+ }
1781
+ setSelectAll(state) {
1782
+ this.rows.forEach((row) => {
1783
+ row.isSelected = state;
1784
+ this.storeSelectedRow(row);
1785
+ });
1786
+ }
1787
+ deselectAll() {
1788
+ this.rows.forEach((row) => {
1789
+ row.isSelected = false;
1790
+ });
1791
+ // we need to clear selectedRow field because no one row selected
1792
+ this.selectedRows.clear();
1793
+ }
1794
+ selectRow(row, state) {
1795
+ row.isSelected = state;
1796
+ this.storeSelectedRow(row);
1797
+ }
1798
+ multipleSelectRow(row) {
1799
+ row.isSelected = !row.isSelected;
1800
+ this.storeSelectedRow(row);
1801
+ return row;
1802
+ }
1803
+ getSelectedRowsData() {
1804
+ return [...this.selectedRows];
1805
+ }
1806
+ createNewRow() {
1807
+ this.newRow = new Row(-1, {}, this);
1808
+ this.newRow.isInEditing = true;
1809
+ }
1810
+ /**
1811
+ * Create columns by mapping from the settings
1812
+ * @param settings
1813
+ * @private
1814
+ */
1815
+ createColumns(settings) {
1816
+ settings.forEach((columnSettings) => {
1817
+ this.columns.push(new Column(columnSettings.key, columnSettings, this));
1818
+ });
1819
+ }
1820
+ /**
1821
+ * Create rows based on current data prepared in data source
1822
+ * @private
1823
+ */
1824
+ createRows() {
1825
+ this.rows = [];
1826
+ this.data.forEach((el, index) => {
1827
+ const row = new Row(index, el, this);
1828
+ row.isSelected = this.selectedRows.has(row.getData());
1829
+ this.rows.push(row);
1830
+ });
1831
+ }
1832
+ get isAllSelected() {
1833
+ return this.rows.every((row) => row.isSelected);
1834
+ }
1835
+ storeSelectedRow(row) {
1836
+ if (row.isSelected) {
1837
+ this.selectedRows.add(row.getData());
1838
+ }
1839
+ else {
1840
+ this.selectedRows.delete(row.getData());
1841
+ }
1842
+ }
1843
+ }
1844
+
1845
+ class Grid {
1846
+ constructor(source, settings) {
1847
+ this.createFormShown = false;
1848
+ this.onSelectRowSource = new Subject();
1849
+ this.onDeselectRowSource = new Subject();
1850
+ this.currentColumnsSortState = [];
1851
+ this.settings = signal({});
1852
+ this.isMultiSelectVisible = computed(() => {
1853
+ return this.settings().selectMode === "multi";
1854
+ });
1855
+ this.isActionsVisible = computed(() => {
1856
+ const actions = this.settings().actions;
1857
+ if (!actions)
1858
+ return false;
1859
+ return actions.add || actions.edit || actions.delete || !!actions?.custom?.length;
1860
+ });
1861
+ this.actionIsOnLeft = computed(() => {
1862
+ return (this.settings().actionsPosition || 'left') === 'left';
1863
+ });
1864
+ this.actionIsOnRight = computed(() => {
1865
+ return this.settings().actionsPosition === 'right';
1866
+ });
1867
+ this.setSettings(settings);
1868
+ this.setSource(source);
1869
+ }
1870
+ setColumnsSortedEmitter(emitter) {
1871
+ this.columnsSortedEmitter = emitter;
1872
+ }
1873
+ detach() {
1874
+ if (this.sourceOnChangedSubscription) {
1875
+ this.sourceOnChangedSubscription.unsubscribe();
1876
+ }
1877
+ if (this.sourceOnUpdatedSubscription) {
1878
+ this.sourceOnUpdatedSubscription.unsubscribe();
1879
+ }
1880
+ }
1881
+ getNewRow() {
1882
+ return this.dataSet.newRow;
1883
+ }
1884
+ setSettings(settings) {
1885
+ this.updateSettingsAndDataSet(settings);
1886
+ if (this.getSetting('columnSort', false)) {
1887
+ this.setColumnsSortState(settings.columns);
1888
+ }
1889
+ }
1890
+ updateSettingsAndDataSet(settings) {
1891
+ this.settings.set(settings);
1892
+ this.dataSet = new DataSet([], settings.columns);
1893
+ if (this.source) {
1894
+ this.source.refresh();
1895
+ }
1896
+ }
1897
+ getDataSet() {
1898
+ return this.dataSet;
1899
+ }
1900
+ setSource(source) {
1901
+ this.source = this.prepareSource(source);
1902
+ this.detach();
1903
+ this.sourceOnChangedSubscription = this.source
1904
+ .onChanged()
1905
+ .subscribe((changes) => this.processDataChange(changes));
1906
+ this.sourceOnUpdatedSubscription = this.source
1907
+ .onUpdated()
1908
+ .subscribe((data) => {
1909
+ const changedRow = this.dataSet.findRowByData(data);
1910
+ if (changedRow) {
1911
+ changedRow.setData(data);
1912
+ }
1913
+ });
1914
+ }
1915
+ getSetting(name, defaultValue) {
1916
+ return getDeepFromObject(this.settings(), name, defaultValue);
1917
+ }
1918
+ getColumns() {
1919
+ return this.dataSet.getColumns();
1920
+ }
1921
+ getRows() {
1922
+ return this.dataSet.getRows();
1923
+ }
1924
+ selectRow(row, state) {
1925
+ this.dataSet.selectRow(row, state);
1926
+ }
1927
+ multipleSelectRow(row) {
1335
1928
  this.dataSet.multipleSelectRow(row);
1336
1929
  }
1337
1930
  onSelectRow() {
@@ -1349,7 +1942,7 @@ class Grid {
1349
1942
  deferred.promise
1350
1943
  .then((newData) => {
1351
1944
  row.pending = false;
1352
- newData = newData ? newData : row.getNewData();
1945
+ newData = newData || row.getNewData();
1353
1946
  this.source.prepend(newData).then(() => {
1354
1947
  this.createFormShown = false;
1355
1948
  this.dataSet.createNewRow();
@@ -1375,7 +1968,7 @@ class Grid {
1375
1968
  deferred.promise
1376
1969
  .then((newData) => {
1377
1970
  row.pending = false;
1378
- newData = newData ? newData : row.getNewData();
1971
+ newData = newData || row.getNewData();
1379
1972
  this.source.update(row.getData(), newData).then(() => {
1380
1973
  row.isInEditing = false;
1381
1974
  });
@@ -1383,7 +1976,7 @@ class Grid {
1383
1976
  .catch((err) => {
1384
1977
  row.pending = false;
1385
1978
  });
1386
- if (this.getSetting("edit.confirmSave")) {
1979
+ if (this.getSetting("edit.confirmSave", false)) {
1387
1980
  confirmEmitter.emit({
1388
1981
  data: row.getData(),
1389
1982
  newData: row.getNewData(),
@@ -1487,8 +2080,8 @@ class Grid {
1487
2080
  async applyColumnsSortState(state, emitEvent = true) {
1488
2081
  this.currentColumnsSortState = this.getMergedColumnStates(state);
1489
2082
  this.updateSettingsAndDataSet({
1490
- ...this.settings,
1491
- columns: await this.getSortedTableColumns(this.currentColumnsSortState, this.settings?.columns),
2083
+ ...this.settings(),
2084
+ columns: await this.getSortedTableColumns(this.currentColumnsSortState, this.settings()?.columns),
1492
2085
  });
1493
2086
  if (this.columnStateStorageKey) {
1494
2087
  setLocalStorage(this.columnStateStorageKey, this.currentColumnsSortState);
@@ -1510,697 +2103,36 @@ class Grid {
1510
2103
  this.applyColumnsSortState(merged, false);
1511
2104
  return;
1512
2105
  }
1513
- this.applyColumnsSortState(columnsState, false);
1514
- }
1515
- getColumnsStateFromSettings(columns) {
1516
- return (columns || this.settings.columns || []).map((column) => ({
1517
- key: column.key,
1518
- title: column.title,
1519
- hide: !!column.hide,
1520
- sortDisabled: !!column.sortDisabled,
1521
- }));
1522
- }
1523
- getMergedColumnStates(newState, columnsState) {
1524
- const columnsSettings = columnsState || this.getColumnsStateFromSettings();
1525
- // merge new columns state with state from storage
1526
- const filtered = [];
1527
- newState.forEach((state) => {
1528
- const fined = columnsSettings.find((column) => column.title === state.title && column.key === state.key);
1529
- if (fined) {
1530
- filtered.push({ ...fined, hide: fined.sortDisabled ? fined.hide : state.hide });
1531
- }
1532
- });
1533
- // find new columns witch not exist in storage state
1534
- const newColumns = columnsSettings.filter((state) => {
1535
- return !filtered.some((column) => column.title === state.title && column.key === state.key);
1536
- });
1537
- return [...filtered, ...newColumns];
1538
- }
1539
- get columnStateStorageKey() {
1540
- return this.settings.columnSortStorageKey;
1541
- }
1542
- }
1543
-
1544
- class EditCellDefault {
1545
- constructor() {
1546
- this.inputClass = '';
1547
- this.edited = output();
1548
- }
1549
- onEdited(event) {
1550
- this.edited.emit(event);
1551
- return false;
1552
- }
1553
- onStopEditing() {
1554
- this.cell.getRow().isInEditing = false;
1555
- return false;
1556
- }
1557
- onClick(event) {
1558
- event.stopPropagation();
1559
- }
1560
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellDefault, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1561
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: EditCellDefault, isStandalone: true, selector: "ng-component", inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { edited: "edited" }, ngImport: i0, template: '', isInline: true }); }
1562
- }
1563
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellDefault, decorators: [{
1564
- type: Component,
1565
- args: [{ template: '' }]
1566
- }], propDecorators: { cell: [{
1567
- type: Input
1568
- }], inputClass: [{
1569
- type: Input
1570
- }] } });
1571
-
1572
- class CustomEditComponent extends EditCellDefault {
1573
- ngOnChanges(changes) {
1574
- const editor = this.cell.getColumn().editor;
1575
- if (this.customComponent) {
1576
- if (this.customComponent.instance?.ngOnChanges) {
1577
- this.customComponent.instance.ngOnChanges(changes);
1578
- }
1579
- return;
1580
- }
1581
- if (this.cell &&
1582
- !this.customComponent &&
1583
- editor &&
1584
- editor.type == "custom") {
1585
- this.customComponent = this.dynamicTarget.createComponent(editor.component);
1586
- // set @Inputs and @Outputs of custom component
1587
- this.customComponent.instance.cell = this.cell;
1588
- this.customComponent.instance.inputClass = this.inputClass;
1589
- this.customComponent.instance.onStopEditing.subscribe(() => this.onStopEditing());
1590
- this.customComponent.instance.onEdited.subscribe((event) => this.onEdited(event));
1591
- this.customComponent.instance.onClick.subscribe((event) => this.onClick(event));
1592
- }
1593
- }
1594
- ngOnDestroy() {
1595
- if (this.customComponent) {
1596
- this.customComponent.destroy();
1597
- }
1598
- }
1599
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1600
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: CustomEditComponent, isStandalone: true, selector: "table-cell-custom-editor", viewQueries: [{ propertyName: "dynamicTarget", first: true, predicate: ["dynamicTarget"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: ` <ng-template #dynamicTarget></ng-template> `, isInline: true }); }
1601
- }
1602
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, decorators: [{
1603
- type: Component,
1604
- args: [{
1605
- selector: "table-cell-custom-editor",
1606
- template: ` <ng-template #dynamicTarget></ng-template> `,
1607
- standalone: true,
1608
- }]
1609
- }], propDecorators: { dynamicTarget: [{
1610
- type: ViewChild,
1611
- args: ["dynamicTarget", { read: ViewContainerRef, static: true }]
1612
- }] } });
1613
-
1614
- class CheckboxEditorComponent extends DefaultEditor {
1615
- constructor() {
1616
- super();
1617
- }
1618
- onChange(event) {
1619
- const config = this.cell.getColumn().getConfig();
1620
- const trueVal = (config && config?.true) || true;
1621
- const falseVal = (config && config?.false) || false;
1622
- this.cell.newValue = event.target.checked ? trueVal : falseVal;
1623
- }
1624
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1625
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: CheckboxEditorComponent, isStandalone: true, selector: "checkbox-editor", usesInheritance: true, ngImport: i0, template: `
1626
- <input
1627
- [class]="inputClass"
1628
- type="checkbox"
1629
- class="form-control"
1630
- [name]="cell.getId()"
1631
- [disabled]="!cell.isEditable()"
1632
- [checked]="
1633
- cell.getValue() === (cell.getColumn().getConfig()?.true || true)
1634
- "
1635
- (click)="onClick.emit($event)"
1636
- (change)="onChange($event)"
1637
- />
1638
- `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }); }
1639
- }
1640
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxEditorComponent, decorators: [{
1641
- type: Component,
1642
- args: [{ selector: "checkbox-editor", template: `
1643
- <input
1644
- [class]="inputClass"
1645
- type="checkbox"
1646
- class="form-control"
1647
- [name]="cell.getId()"
1648
- [disabled]="!cell.isEditable()"
1649
- [checked]="
1650
- cell.getValue() === (cell.getColumn().getConfig()?.true || true)
1651
- "
1652
- (click)="onClick.emit($event)"
1653
- (change)="onChange($event)"
1654
- />
1655
- `, standalone: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
1656
- }], ctorParameters: () => [] });
1657
-
1658
- class InputEditorComponent extends DefaultEditor {
1659
- constructor() {
1660
- super();
1661
- }
1662
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1663
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: InputEditorComponent, isStandalone: true, selector: "input-editor", usesInheritance: true, ngImport: i0, template: `
1664
- <input
1665
- [class]="inputClass"
1666
- class="form-control"
1667
- [(ngModel)]="cell.newValue"
1668
- [name]="cell.getId()"
1669
- [placeholder]="cell.getTitle()"
1670
- [disabled]="!cell.isEditable()"
1671
- (click)="onClick.emit($event)"
1672
- (keydown.enter)="onEdited.emit($event)"
1673
- (keydown.esc)="onStopEditing.emit('')"
1674
- />
1675
- `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1676
- }
1677
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputEditorComponent, decorators: [{
1678
- type: Component,
1679
- args: [{ selector: "input-editor", template: `
1680
- <input
1681
- [class]="inputClass"
1682
- class="form-control"
1683
- [(ngModel)]="cell.newValue"
1684
- [name]="cell.getId()"
1685
- [placeholder]="cell.getTitle()"
1686
- [disabled]="!cell.isEditable()"
1687
- (click)="onClick.emit($event)"
1688
- (keydown.enter)="onEdited.emit($event)"
1689
- (keydown.esc)="onStopEditing.emit('')"
1690
- />
1691
- `, standalone: true, imports: [FormsModule], styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
1692
- }], ctorParameters: () => [] });
1693
-
1694
- class SelectEditorComponent extends DefaultEditor {
1695
- constructor() {
1696
- super();
1697
- }
1698
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1699
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: SelectEditorComponent, isStandalone: true, selector: "select-editor", usesInheritance: true, ngImport: i0, template: `
1700
- <select
1701
- [class]="inputClass"
1702
- class="form-control"
1703
- [(ngModel)]="cell.newValue"
1704
- [name]="cell.getId()"
1705
- [disabled]="!cell.isEditable()"
1706
- (click)="onClick.emit($event)"
1707
- (keydown.enter)="onEdited.emit($event)"
1708
- (keydown.esc)="onStopEditing.emit('')"
1709
- >
1710
- @for (option of cell.getColumn().getConfig()?.list; track option.value) {
1711
- <option
1712
- [value]="option.value"
1713
- [selected]="option.value === cell.getValue()"
1714
- >
1715
- {{ option.title }}
1716
- </option>
1717
- }
1718
- </select>
1719
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1720
- }
1721
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectEditorComponent, decorators: [{
1722
- type: Component,
1723
- args: [{
1724
- selector: "select-editor",
1725
- template: `
1726
- <select
1727
- [class]="inputClass"
1728
- class="form-control"
1729
- [(ngModel)]="cell.newValue"
1730
- [name]="cell.getId()"
1731
- [disabled]="!cell.isEditable()"
1732
- (click)="onClick.emit($event)"
1733
- (keydown.enter)="onEdited.emit($event)"
1734
- (keydown.esc)="onStopEditing.emit('')"
1735
- >
1736
- @for (option of cell.getColumn().getConfig()?.list; track option.value) {
1737
- <option
1738
- [value]="option.value"
1739
- [selected]="option.value === cell.getValue()"
1740
- >
1741
- {{ option.title }}
1742
- </option>
1743
- }
1744
- </select>
1745
- `,
1746
- standalone: true,
1747
- imports: [FormsModule],
1748
- }]
1749
- }], ctorParameters: () => [] });
1750
-
1751
- class TextareaEditorComponent extends DefaultEditor {
1752
- constructor() {
1753
- super();
1754
- }
1755
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TextareaEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1756
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: TextareaEditorComponent, isStandalone: true, selector: "textarea-editor", usesInheritance: true, ngImport: i0, template: `
1757
- <textarea
1758
- [class]="inputClass"
1759
- class="form-control"
1760
- [(ngModel)]="cell.newValue"
1761
- [name]="cell.getId()"
1762
- [disabled]="!cell.isEditable()"
1763
- [placeholder]="cell.getTitle()"
1764
- (click)="onClick.emit($event)"
1765
- (keydown.enter)="onEdited.emit($event)"
1766
- (keydown.esc)="onStopEditing.emit('')"
1767
- >
1768
- </textarea>
1769
- `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1770
- }
1771
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TextareaEditorComponent, decorators: [{
1772
- type: Component,
1773
- args: [{ selector: "textarea-editor", template: `
1774
- <textarea
1775
- [class]="inputClass"
1776
- class="form-control"
1777
- [(ngModel)]="cell.newValue"
1778
- [name]="cell.getId()"
1779
- [disabled]="!cell.isEditable()"
1780
- [placeholder]="cell.getTitle()"
1781
- (click)="onClick.emit($event)"
1782
- (keydown.enter)="onEdited.emit($event)"
1783
- (keydown.esc)="onStopEditing.emit('')"
1784
- >
1785
- </textarea>
1786
- `, standalone: true, imports: [FormsModule], styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
1787
- }], ctorParameters: () => [] });
1788
-
1789
- class DefaultEditComponent extends EditCellDefault {
1790
- constructor() {
1791
- super();
1792
- }
1793
- getEditorType() {
1794
- const editor = this.cell.getColumn().editor;
1795
- if (editor) {
1796
- return editor.type;
1797
- }
1798
- return "text";
1799
- }
1800
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultEditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1801
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: DefaultEditComponent, isStandalone: true, selector: "table-cell-default-editor", usesInheritance: true, ngImport: i0, template: "<div>\n @switch (getEditorType()) {\n @case ('list') {\n <select-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </select-editor>\n }\n @case ('textarea') {\n <textarea-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </textarea-editor>\n }\n @case ('checkbox') {\n <checkbox-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\">\n </checkbox-editor>\n }\n @default {\n <input-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </input-editor>\n }\n}\n</div>", dependencies: [{ kind: "component", type: SelectEditorComponent, selector: "select-editor" }, { kind: "component", type: TextareaEditorComponent, selector: "textarea-editor" }, { kind: "component", type: CheckboxEditorComponent, selector: "checkbox-editor" }, { kind: "component", type: InputEditorComponent, selector: "input-editor" }] }); }
1802
- }
1803
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultEditComponent, decorators: [{
1804
- type: Component,
1805
- args: [{ selector: "table-cell-default-editor", imports: [
1806
- SelectEditorComponent,
1807
- TextareaEditorComponent,
1808
- CheckboxEditorComponent,
1809
- InputEditorComponent,
1810
- ], standalone: true, template: "<div>\n @switch (getEditorType()) {\n @case ('list') {\n <select-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </select-editor>\n }\n @case ('textarea') {\n <textarea-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </textarea-editor>\n }\n @case ('checkbox') {\n <checkbox-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\">\n </checkbox-editor>\n }\n @default {\n <input-editor\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </input-editor>\n }\n}\n</div>" }]
1811
- }], ctorParameters: () => [] });
1812
-
1813
- class EditCellComponent {
1814
- constructor() {
1815
- this.inputClass = "";
1816
- this.edited = output();
1817
- }
1818
- onEdited(event) {
1819
- this.edited.emit(event);
1820
- return false;
1821
- }
1822
- getEditorType() {
1823
- const editor = this.cell.getColumn().editor;
1824
- if (editor) {
1825
- return editor.type;
1826
- }
1827
- return "text";
1828
- }
1829
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1830
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: EditCellComponent, isStandalone: true, selector: "table-cell-edit-mode", inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { edited: "edited" }, ngImport: i0, template: `
1831
- <div>
1832
- @switch (getEditorType()) { @case ('custom') {
1833
- <table-cell-custom-editor
1834
- [cell]="cell"
1835
- [inputClass]="inputClass"
1836
- (edited)="onEdited($event)"
1837
- >
1838
- </table-cell-custom-editor>
1839
- } @default {
1840
- <table-cell-default-editor
1841
- [cell]="cell"
1842
- [inputClass]="inputClass"
1843
- (edited)="onEdited($event)"
1844
- >
1845
- </table-cell-default-editor>
1846
- } }
1847
- </div>
1848
- `, isInline: true, dependencies: [{ kind: "component", type: CustomEditComponent, selector: "table-cell-custom-editor" }, { kind: "component", type: DefaultEditComponent, selector: "table-cell-default-editor" }] }); }
1849
- }
1850
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellComponent, decorators: [{
1851
- type: Component,
1852
- args: [{
1853
- selector: "table-cell-edit-mode",
1854
- template: `
1855
- <div>
1856
- @switch (getEditorType()) { @case ('custom') {
1857
- <table-cell-custom-editor
1858
- [cell]="cell"
1859
- [inputClass]="inputClass"
1860
- (edited)="onEdited($event)"
1861
- >
1862
- </table-cell-custom-editor>
1863
- } @default {
1864
- <table-cell-default-editor
1865
- [cell]="cell"
1866
- [inputClass]="inputClass"
1867
- (edited)="onEdited($event)"
1868
- >
1869
- </table-cell-default-editor>
1870
- } }
1871
- </div>
1872
- `,
1873
- standalone: true,
1874
- imports: [CustomEditComponent, DefaultEditComponent],
1875
- }]
1876
- }], propDecorators: { cell: [{
1877
- type: Input
1878
- }], inputClass: [{
1879
- type: Input
1880
- }] } });
1881
-
1882
- class CustomViewComponent {
1883
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1884
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: CustomViewComponent, isStandalone: true, selector: "custom-view-component", inputs: { cell: "cell" }, ngImport: i0, template: `<ng-template
1885
- *ngComponentOutlet="
1886
- cell.getColumn().renderComponent;
1887
- inputs: { rowData: cell.getRow().getData(), value: cell.getValue() }
1888
- "
1889
- ></ng-template>`, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }] }); }
1890
- }
1891
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomViewComponent, decorators: [{
1892
- type: Component,
1893
- args: [{
1894
- selector: "custom-view-component",
1895
- template: `<ng-template
1896
- *ngComponentOutlet="
1897
- cell.getColumn().renderComponent;
1898
- inputs: { rowData: cell.getRow().getData(), value: cell.getValue() }
1899
- "
1900
- ></ng-template>`,
1901
- imports: [NgComponentOutlet],
1902
- standalone: true,
1903
- }]
1904
- }], propDecorators: { cell: [{
1905
- type: Input
1906
- }] } });
1907
-
1908
- class ViewCellComponent {
1909
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ViewCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1910
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: ViewCellComponent, isStandalone: true, selector: "table-cell-view-mode", inputs: { cell: "cell" }, ngImport: i0, template: `
1911
- <div>
1912
- @switch (cell.getColumn().type) { @case ('custom') {
1913
- <custom-view-component [cell]="cell"></custom-view-component>
1914
- } @case ('html') {
1915
- <div [innerHTML]="cell.getValue()"></div>
1916
- } @default {
1917
- <div>{{ cell.getValue() }}</div>
1918
- } }
1919
- </div>
1920
- `, isInline: true, dependencies: [{ kind: "component", type: CustomViewComponent, selector: "custom-view-component", inputs: ["cell"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1921
- }
1922
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ViewCellComponent, decorators: [{
1923
- type: Component,
1924
- args: [{
1925
- selector: "table-cell-view-mode",
1926
- changeDetection: ChangeDetectionStrategy.OnPush,
1927
- template: `
1928
- <div>
1929
- @switch (cell.getColumn().type) { @case ('custom') {
1930
- <custom-view-component [cell]="cell"></custom-view-component>
1931
- } @case ('html') {
1932
- <div [innerHTML]="cell.getValue()"></div>
1933
- } @default {
1934
- <div>{{ cell.getValue() }}</div>
1935
- } }
1936
- </div>
1937
- `,
1938
- standalone: true,
1939
- imports: [CustomViewComponent],
1940
- }]
1941
- }], propDecorators: { cell: [{
1942
- type: Input
1943
- }] } });
1944
-
1945
- class CellComponent {
1946
- constructor() {
1947
- this.inputClass = "";
1948
- this.mode = "inline";
1949
- this.isInEditing = false;
1950
- this.edited = output();
1951
- }
1952
- onEdited(event) {
1953
- if (this.isNew) {
1954
- this.grid.create(this.grid.getNewRow(), this.createConfirm);
1955
- }
1956
- else {
1957
- this.grid.save(this.row, this.editConfirm);
1958
- }
1959
- }
1960
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1961
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: CellComponent, isStandalone: true, selector: "ng2-smart-table-cell", inputs: { grid: "grid", row: "row", editConfirm: "editConfirm", createConfirm: "createConfirm", isNew: "isNew", cell: "cell", inputClass: "inputClass", mode: "mode", isInEditing: "isInEditing" }, outputs: { edited: "edited" }, ngImport: i0, template: `
1962
- @if (!isInEditing) {
1963
- <table-cell-view-mode [cell]="cell"></table-cell-view-mode>
1964
- } @else {
1965
- <table-cell-edit-mode
1966
- [cell]="cell"
1967
- [inputClass]="inputClass"
1968
- (edited)="onEdited($event)"
1969
- >
1970
- </table-cell-edit-mode>
1971
- }
1972
- `, isInline: true, dependencies: [{ kind: "component", type: ViewCellComponent, selector: "table-cell-view-mode", inputs: ["cell"] }, { kind: "component", type: EditCellComponent, selector: "table-cell-edit-mode", inputs: ["cell", "inputClass"], outputs: ["edited"] }] }); }
1973
- }
1974
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CellComponent, decorators: [{
1975
- type: Component,
1976
- args: [{
1977
- selector: "ng2-smart-table-cell",
1978
- template: `
1979
- @if (!isInEditing) {
1980
- <table-cell-view-mode [cell]="cell"></table-cell-view-mode>
1981
- } @else {
1982
- <table-cell-edit-mode
1983
- [cell]="cell"
1984
- [inputClass]="inputClass"
1985
- (edited)="onEdited($event)"
1986
- >
1987
- </table-cell-edit-mode>
1988
- }
1989
- `,
1990
- standalone: true,
1991
- imports: [ViewCellComponent, EditCellComponent],
1992
- }]
1993
- }], propDecorators: { grid: [{
1994
- type: Input
1995
- }], row: [{
1996
- type: Input
1997
- }], editConfirm: [{
1998
- type: Input
1999
- }], createConfirm: [{
2000
- type: Input
2001
- }], isNew: [{
2002
- type: Input
2003
- }], cell: [{
2004
- type: Input
2005
- }], inputClass: [{
2006
- type: Input
2007
- }], mode: [{
2008
- type: Input
2009
- }], isInEditing: [{
2010
- type: Input
2011
- }] } });
2012
-
2013
- class TbodyCreateCancelComponent {
2014
- constructor() {
2015
- this.cancelButtonContent = "";
2016
- this.saveButtonContent = "";
2017
- }
2018
- onSave(event) {
2019
- event.preventDefault();
2020
- event.stopPropagation();
2021
- this.grid.save(this.row, this.editConfirm);
2022
- }
2023
- onCancelEdit(event) {
2024
- event.preventDefault();
2025
- event.stopPropagation();
2026
- this.editCancel.emit(true);
2027
- this.row.isInEditing = false;
2028
- }
2029
- ngOnChanges() {
2030
- this.saveButtonContent = this.grid.getSetting("edit.saveButtonContent", "save");
2031
- this.cancelButtonContent = this.grid.getSetting("edit.cancelButtonContent", "cancel");
2032
- }
2033
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyCreateCancelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2034
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TbodyCreateCancelComponent, isStandalone: true, selector: "ng2-st-tbody-create-cancel", inputs: { grid: "grid", row: "row", editConfirm: "editConfirm", editCancel: "editCancel" }, usesOnChanges: true, ngImport: i0, template: `
2035
- @if (!row.pending) {
2036
- <a
2037
- href="#"
2038
- [id]="'row-' + row.index + '_editing-confirm-button'"
2039
- class="ng2-smart-action ng2-smart-action-edit-save"
2040
- [innerHTML]="saveButtonContent"
2041
- (click)="onSave($event)"
2042
- ></a>
2043
- <a
2044
- href="#"
2045
- [id]="'row-' + row.index + '_editing-cancel-button'"
2046
- class="ng2-smart-action ng2-smart-action-edit-cancel"
2047
- [innerHTML]="cancelButtonContent"
2048
- (click)="onCancelEdit($event)"
2049
- ></a>
2050
- } @else {
2051
- <div style="display: flex;">
2052
- <svg
2053
- (click)="$event.stopPropagation()"
2054
- style="height: 2rem; width: 2rem;"
2055
- version="1.1"
2056
- id="L9"
2057
- xmlns="http://www.w3.org/2000/svg"
2058
- xmlns:xlink="http://www.w3.org/1999/xlink"
2059
- x="0px"
2060
- y="0px"
2061
- viewBox="0 0 100 100"
2062
- enable-background="new 0 0 0 0"
2063
- xml:space="preserve"
2064
- >
2065
- <path
2066
- fill="#e9e9e9"
2067
- d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
2068
- >
2069
- <animateTransform
2070
- attributeName="transform"
2071
- attributeType="XML"
2072
- type="rotate"
2073
- dur="1s"
2074
- from="0 50 50"
2075
- to="360 50 50"
2076
- repeatCount="indefinite"
2077
- />
2078
- </path>
2079
- </svg>
2080
- <svg
2081
- (click)="$event.stopPropagation()"
2082
- style="height: 2rem; width: 2rem; "
2083
- version="1.1"
2084
- id="L9"
2085
- xmlns="http://www.w3.org/2000/svg"
2086
- xmlns:xlink="http://www.w3.org/1999/xlink"
2087
- x="0px"
2088
- y="0px"
2089
- viewBox="0 0 100 100"
2090
- enable-background="new 0 0 0 0"
2091
- xml:space="preserve"
2092
- >
2093
- <path
2094
- fill="#e9e9e9"
2095
- d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
2096
- >
2097
- <animateTransform
2098
- attributeName="transform"
2099
- attributeType="XML"
2100
- type="rotate"
2101
- dur="1s"
2102
- from="0 50 50"
2103
- to="360 50 50"
2104
- repeatCount="indefinite"
2105
- />
2106
- </path>
2107
- </svg>
2108
- </div>
2106
+ this.applyColumnsSortState(columnsState, false);
2109
2107
  }
2110
- `, isInline: true }); }
2111
- }
2112
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyCreateCancelComponent, decorators: [{
2113
- type: Component,
2114
- args: [{
2115
- selector: "ng2-st-tbody-create-cancel",
2116
- template: `
2117
- @if (!row.pending) {
2118
- <a
2119
- href="#"
2120
- [id]="'row-' + row.index + '_editing-confirm-button'"
2121
- class="ng2-smart-action ng2-smart-action-edit-save"
2122
- [innerHTML]="saveButtonContent"
2123
- (click)="onSave($event)"
2124
- ></a>
2125
- <a
2126
- href="#"
2127
- [id]="'row-' + row.index + '_editing-cancel-button'"
2128
- class="ng2-smart-action ng2-smart-action-edit-cancel"
2129
- [innerHTML]="cancelButtonContent"
2130
- (click)="onCancelEdit($event)"
2131
- ></a>
2132
- } @else {
2133
- <div style="display: flex;">
2134
- <svg
2135
- (click)="$event.stopPropagation()"
2136
- style="height: 2rem; width: 2rem;"
2137
- version="1.1"
2138
- id="L9"
2139
- xmlns="http://www.w3.org/2000/svg"
2140
- xmlns:xlink="http://www.w3.org/1999/xlink"
2141
- x="0px"
2142
- y="0px"
2143
- viewBox="0 0 100 100"
2144
- enable-background="new 0 0 0 0"
2145
- xml:space="preserve"
2146
- >
2147
- <path
2148
- fill="#e9e9e9"
2149
- d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
2150
- >
2151
- <animateTransform
2152
- attributeName="transform"
2153
- attributeType="XML"
2154
- type="rotate"
2155
- dur="1s"
2156
- from="0 50 50"
2157
- to="360 50 50"
2158
- repeatCount="indefinite"
2159
- />
2160
- </path>
2161
- </svg>
2162
- <svg
2163
- (click)="$event.stopPropagation()"
2164
- style="height: 2rem; width: 2rem; "
2165
- version="1.1"
2166
- id="L9"
2167
- xmlns="http://www.w3.org/2000/svg"
2168
- xmlns:xlink="http://www.w3.org/1999/xlink"
2169
- x="0px"
2170
- y="0px"
2171
- viewBox="0 0 100 100"
2172
- enable-background="new 0 0 0 0"
2173
- xml:space="preserve"
2174
- >
2175
- <path
2176
- fill="#e9e9e9"
2177
- d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"
2178
- >
2179
- <animateTransform
2180
- attributeName="transform"
2181
- attributeType="XML"
2182
- type="rotate"
2183
- dur="1s"
2184
- from="0 50 50"
2185
- to="360 50 50"
2186
- repeatCount="indefinite"
2187
- />
2188
- </path>
2189
- </svg>
2190
- </div>
2108
+ getColumnsStateFromSettings(columns) {
2109
+ return (columns || this.settings().columns || []).map((column) => ({
2110
+ key: column.key,
2111
+ title: column.title,
2112
+ hide: !!column.hide,
2113
+ moveDisabled: !!column.moveDisabled,
2114
+ }));
2191
2115
  }
2192
- `,
2193
- standalone: true,
2194
- }]
2195
- }], propDecorators: { grid: [{
2196
- type: Input
2197
- }], row: [{
2198
- type: Input
2199
- }], editConfirm: [{
2200
- type: Input
2201
- }], editCancel: [{
2202
- type: Input
2203
- }] } });
2116
+ getMergedColumnStates(newState, columnsState) {
2117
+ const columnsSettings = columnsState || this.getColumnsStateFromSettings();
2118
+ // merge new columns state with state from storage
2119
+ const filtered = [];
2120
+ newState.forEach((state) => {
2121
+ const fined = columnsSettings.find((column) => column.title === state.title && column.key === state.key);
2122
+ if (fined) {
2123
+ filtered.push({ ...fined, hide: fined.moveDisabled ? fined.hide : state.hide });
2124
+ }
2125
+ });
2126
+ // find new columns witch not exist in storage state
2127
+ const newColumns = columnsSettings.filter((state) => {
2128
+ return !filtered.some((column) => column.title === state.title && column.key === state.key);
2129
+ });
2130
+ return [...filtered, ...newColumns];
2131
+ }
2132
+ get columnStateStorageKey() {
2133
+ return this.settings().columnSortStorageKey;
2134
+ }
2135
+ }
2204
2136
 
2205
2137
  class TbodyCustomComponent {
2206
2138
  constructor() {
@@ -2261,51 +2193,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2261
2193
 
2262
2194
  class TbodyEditDeleteComponent {
2263
2195
  constructor() {
2196
+ this.cdr = inject(ChangeDetectorRef);
2197
+ this.grid = input.required();
2198
+ this.row = input.required();
2199
+ this.source = input.required();
2200
+ this.deleteConfirm = input.required();
2264
2201
  this.edit = output();
2265
2202
  this.delete = output();
2266
- this.editRowSelect = output();
2267
2203
  this.isActionEdit = false;
2268
2204
  this.isActionDelete = false;
2269
- this.editRowButtonContent = "";
2270
- this.deleteRowButtonContent = "";
2205
+ this.editRowButtonContent = "Edit";
2206
+ this.deleteRowButtonContent = "Delete";
2207
+ effect(() => {
2208
+ const settings = this.grid().settings();
2209
+ const actions = settings.actions;
2210
+ if (!actions)
2211
+ return;
2212
+ this.isActionDelete = !!actions.delete;
2213
+ this.isActionEdit = !!actions.edit;
2214
+ this.editRowButtonContent = settings.edit ? settings.edit.editButtonContent || "Edit" : "Edit";
2215
+ this.deleteRowButtonContent = settings.delete ? settings.delete.deleteButtonContent || "Delete" : "Delete";
2216
+ this.cdr.detectChanges();
2217
+ });
2271
2218
  }
2272
2219
  onEdit(event) {
2273
2220
  event.preventDefault();
2274
2221
  event.stopPropagation();
2275
- this.editRowSelect.emit(this.row);
2276
2222
  this.edit.emit({
2277
- data: this.row.getData(),
2223
+ data: this.row().getData(),
2278
2224
  source: this.source,
2279
2225
  });
2280
- if (this.grid.getSetting("mode") !== "external") {
2281
- this.grid.edit(this.row);
2282
- }
2226
+ this.grid().edit(this.row());
2283
2227
  }
2284
2228
  onDelete(event) {
2285
2229
  event.preventDefault();
2286
2230
  event.stopPropagation();
2287
- if (this.grid.getSetting("mode") === "external") {
2288
- this.delete.emit({
2289
- data: this.row.getData(),
2290
- source: this.source,
2291
- });
2292
- }
2293
- else {
2294
- this.grid.delete(this.row, this.deleteConfirm);
2295
- }
2296
- }
2297
- ngOnChanges() {
2298
- this.isActionEdit = this.grid.getSetting("actions.edit");
2299
- this.isActionDelete = this.grid.getSetting("actions.delete");
2300
- this.editRowButtonContent = this.grid.getSetting("edit.editButtonContent");
2301
- this.deleteRowButtonContent = this.grid.getSetting("delete.deleteButtonContent");
2231
+ this.grid().delete(this.row(), this.deleteConfirm());
2302
2232
  }
2303
2233
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyEditDeleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2304
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TbodyEditDeleteComponent, isStandalone: true, selector: "ng2-st-tbody-edit-delete", inputs: { grid: "grid", row: "row", source: "source", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm" }, outputs: { edit: "edit", delete: "delete", editRowSelect: "editRowSelect" }, usesOnChanges: true, ngImport: i0, template: `
2305
- @if (!row.pending) { @if (isActionEdit) {
2234
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TbodyEditDeleteComponent, isStandalone: true, selector: "ng2-st-tbody-edit-delete", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, deleteConfirm: { classPropertyName: "deleteConfirm", publicName: "deleteConfirm", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { edit: "edit", delete: "delete" }, ngImport: i0, template: `
2235
+ @if (!row().pending) { @if (isActionEdit) {
2306
2236
  <a
2307
2237
  href="#"
2308
- [id]="'row-' + row.index + '_action-edit-button'"
2238
+ [id]="'row-' + row().index + '_action-edit-button'"
2309
2239
  class="ng2-smart-action ng2-smart-action-edit-edit"
2310
2240
  [innerHTML]="editRowButtonContent"
2311
2241
  (click)="onEdit($event)"
@@ -2313,7 +2243,7 @@ class TbodyEditDeleteComponent {
2313
2243
  } @if (isActionDelete) {
2314
2244
  <a
2315
2245
  href="#"
2316
- [id]="'row-' + row.index + '_action-delete-button'"
2246
+ [id]="'row-' + row().index + '_action-delete-button'"
2317
2247
  class="ng2-smart-action ng2-smart-action-delete-delete"
2318
2248
  [innerHTML]="deleteRowButtonContent"
2319
2249
  (click)="onDelete($event)"
@@ -2322,6 +2252,7 @@ class TbodyEditDeleteComponent {
2322
2252
  <div style="display: flex;">
2323
2253
  @if (isActionEdit) {
2324
2254
  <svg
2255
+ role="none"
2325
2256
  (click)="$event.stopPropagation()"
2326
2257
  style="height: 2rem; width: 2rem;"
2327
2258
  version="1.1"
@@ -2351,6 +2282,7 @@ class TbodyEditDeleteComponent {
2351
2282
  </svg>
2352
2283
  } @if (isActionDelete) {
2353
2284
  <svg
2285
+ role="none"
2354
2286
  (click)="$event.stopPropagation()"
2355
2287
  style="height: 2rem; width: 2rem;"
2356
2288
  version="1.1"
@@ -2381,17 +2313,17 @@ class TbodyEditDeleteComponent {
2381
2313
  }
2382
2314
  </div>
2383
2315
  }
2384
- `, isInline: true }); }
2316
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2385
2317
  }
2386
2318
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyEditDeleteComponent, decorators: [{
2387
2319
  type: Component,
2388
2320
  args: [{
2389
2321
  selector: "ng2-st-tbody-edit-delete",
2390
2322
  template: `
2391
- @if (!row.pending) { @if (isActionEdit) {
2323
+ @if (!row().pending) { @if (isActionEdit) {
2392
2324
  <a
2393
2325
  href="#"
2394
- [id]="'row-' + row.index + '_action-edit-button'"
2326
+ [id]="'row-' + row().index + '_action-edit-button'"
2395
2327
  class="ng2-smart-action ng2-smart-action-edit-edit"
2396
2328
  [innerHTML]="editRowButtonContent"
2397
2329
  (click)="onEdit($event)"
@@ -2399,7 +2331,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2399
2331
  } @if (isActionDelete) {
2400
2332
  <a
2401
2333
  href="#"
2402
- [id]="'row-' + row.index + '_action-delete-button'"
2334
+ [id]="'row-' + row().index + '_action-delete-button'"
2403
2335
  class="ng2-smart-action ng2-smart-action-delete-delete"
2404
2336
  [innerHTML]="deleteRowButtonContent"
2405
2337
  (click)="onDelete($event)"
@@ -2408,6 +2340,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2408
2340
  <div style="display: flex;">
2409
2341
  @if (isActionEdit) {
2410
2342
  <svg
2343
+ role="none"
2411
2344
  (click)="$event.stopPropagation()"
2412
2345
  style="height: 2rem; width: 2rem;"
2413
2346
  version="1.1"
@@ -2437,6 +2370,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2437
2370
  </svg>
2438
2371
  } @if (isActionDelete) {
2439
2372
  <svg
2373
+ role="none"
2440
2374
  (click)="$event.stopPropagation()"
2441
2375
  style="height: 2rem; width: 2rem;"
2442
2376
  version="1.1"
@@ -2469,24 +2403,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2469
2403
  }
2470
2404
  `,
2471
2405
  standalone: true,
2406
+ changeDetection: ChangeDetectionStrategy.OnPush,
2472
2407
  }]
2473
- }], propDecorators: { grid: [{
2474
- type: Input
2475
- }], row: [{
2476
- type: Input
2477
- }], source: [{
2478
- type: Input
2479
- }], deleteConfirm: [{
2480
- type: Input
2481
- }], editConfirm: [{
2482
- type: Input
2483
- }] } });
2408
+ }], ctorParameters: () => [] });
2484
2409
 
2485
2410
  class Ng2SmartTableTbodyComponent {
2486
2411
  constructor() {
2487
- this.rowClassFunction = () => "";
2412
+ this.grid = input.required();
2413
+ this.source = input.required();
2414
+ this.deleteConfirm = input.required();
2415
+ this.createConfirm = input.required();
2416
+ this.editConfirm = input.required();
2417
+ this.rowClassFunction = input(() => "");
2488
2418
  this.save = output();
2489
- this.cancel = output();
2490
2419
  this.edit = output();
2491
2420
  this.editCancel = output();
2492
2421
  this.delete = output();
@@ -2494,32 +2423,17 @@ class Ng2SmartTableTbodyComponent {
2494
2423
  this.edited = output();
2495
2424
  this.userSelectRow = output();
2496
2425
  this.userClickedRow = output();
2497
- this.editRowSelect = output();
2498
2426
  this.multipleSelectRow = output();
2499
- this.isMultiSelectVisible = false;
2500
- this.showActionColumnLeft = false;
2501
- this.showActionColumnRight = false;
2502
- this.mode = "inline";
2503
- this.editInputClass = "";
2504
- this.isActionAdd = false;
2505
- this.isActionEdit = false;
2506
- this.isActionDelete = false;
2507
- this.noDataMessage = false;
2508
- }
2509
- get tableColumnsCount() {
2510
- const actionColumns = this.isActionAdd || this.isActionEdit || this.isActionDelete ? 1 : 0;
2511
- return this.grid.getColumns().length + actionColumns;
2512
- }
2513
- ngOnChanges() {
2514
- this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
2515
- this.showActionColumnLeft = this.grid.showActionColumn("left");
2516
- this.mode = this.grid.getSetting("mode", "inline");
2517
- this.editInputClass = this.grid.getSetting("edit.inputClass", "");
2518
- this.showActionColumnRight = this.grid.showActionColumn("right");
2519
- this.isActionAdd = this.grid.getSetting("actions.add", false);
2520
- this.isActionEdit = this.grid.getSetting("actions.edit", false);
2521
- this.isActionDelete = this.grid.getSetting("actions.delete", false);
2522
- this.noDataMessage = this.grid.getSetting("noDataMessage");
2427
+ this.editInputClass = computed(() => {
2428
+ const editOptions = this.grid().settings().edit;
2429
+ if (!editOptions) {
2430
+ return '';
2431
+ }
2432
+ return editOptions.inputClass || '';
2433
+ });
2434
+ this.noDataMessage = computed(() => {
2435
+ return this.grid().settings().noDataMessage || "No data found";
2436
+ });
2523
2437
  }
2524
2438
  getVisibleCells(cells) {
2525
2439
  return (cells || []).filter((cell) => !cell.getColumn().hide);
@@ -2528,7 +2442,7 @@ class Ng2SmartTableTbodyComponent {
2528
2442
  return item?.id || index;
2529
2443
  }
2530
2444
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTbodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2531
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableTbodyComponent, isStandalone: true, selector: "[ng2-st-tbody]", inputs: { grid: "grid", source: "source", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm", rowClassFunction: "rowClassFunction" }, outputs: { save: "save", cancel: "cancel", edit: "edit", editCancel: "editCancel", delete: "delete", custom: "custom", edited: "edited", userSelectRow: "userSelectRow", userClickedRow: "userClickedRow", editRowSelect: "editRowSelect", multipleSelectRow: "multipleSelectRow" }, usesOnChanges: true, ngImport: i0, template: "@if (grid.getRows().length) { @for (row of grid.getRows(); track\ntrackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [class]=\"rowClassFunction(row)\"\n [class.selected]=\"row.isSelected\"\n>\n @if (isMultiSelectVisible) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\"\n >\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected\"\n />\n </td>\n } @if (!row.isInEditing && showActionColumnLeft) {\n <td class=\"ng2-smart-actions\" (click)=\"$event.stopPropagation()\">\n <ng2-st-tbody-custom\n [grid]=\"grid\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n } @if (row.isInEditing && showActionColumnLeft) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n [editCancel]=\"editCancel\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @for (cell of getVisibleCells(row.cells); track cell.getId()) {\n <td [class]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell\n [cell]=\"cell\"\n [grid]=\"grid\"\n [row]=\"row\"\n [isNew]=\"false\"\n [mode]=\"mode\"\n [editConfirm]=\"editConfirm\"\n [inputClass]=\"editInputClass\"\n [isInEditing]=\"row.isInEditing\"\n >\n </ng2-smart-table-cell>\n </td>\n } @if (row.isInEditing && showActionColumnRight) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @if (!row.isInEditing && showActionColumnRight) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-custom\n [grid]=\"grid\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [row]=\"row\"\n [source]=\"source\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n }\n</tr>\n} } @else {\n<tr>\n <td [attr.colspan]=\"tableColumnsCount\">\n {{ noDataMessage }}\n </td>\n</tr>\n}\n", styles: [":host .ng2-smart-row.selected{background:#0000000d}:host .ng2-smart-row .ng2-smart-actions.ng2-smart-action-multiple-select{text-align:center}:host ::ng-deep ng2-st-tbody-edit-delete a:first-child,:host ::ng-deep ng2-st-tbody-create-cancel a:first-child{margin-right:.25rem}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: TbodyCustomComponent, selector: "ng2-st-tbody-custom", inputs: ["grid", "row", "source"], outputs: ["custom"] }, { kind: "component", type: TbodyEditDeleteComponent, selector: "ng2-st-tbody-edit-delete", inputs: ["grid", "row", "source", "deleteConfirm", "editConfirm"], outputs: ["edit", "delete", "editRowSelect"] }, { kind: "component", type: TbodyCreateCancelComponent, selector: "ng2-st-tbody-create-cancel", inputs: ["grid", "row", "editConfirm", "editCancel"] }, { kind: "component", type: CellComponent, selector: "ng2-smart-table-cell", inputs: ["grid", "row", "editConfirm", "createConfirm", "isNew", "cell", "inputClass", "mode", "isInEditing"], outputs: ["edited"] }] }); }
2445
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableTbodyComponent, isStandalone: true, selector: "[ng2-st-tbody]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, deleteConfirm: { classPropertyName: "deleteConfirm", publicName: "deleteConfirm", isSignal: true, isRequired: true, transformFunction: null }, createConfirm: { classPropertyName: "createConfirm", publicName: "createConfirm", isSignal: true, isRequired: true, transformFunction: null }, editConfirm: { classPropertyName: "editConfirm", publicName: "editConfirm", isSignal: true, isRequired: true, transformFunction: null }, rowClassFunction: { classPropertyName: "rowClassFunction", publicName: "rowClassFunction", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { save: "save", edit: "edit", editCancel: "editCancel", delete: "delete", custom: "custom", edited: "edited", userSelectRow: "userSelectRow", userClickedRow: "userClickedRow", multipleSelectRow: "multipleSelectRow" }, ngImport: i0, template: "@for (row of grid().getRows(); track trackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [class]=\"rowClassFunction()(row)\"\n [class.selected]=\"row.isSelected\"\n>\n @if (grid().isMultiSelectVisible()) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\"\n >\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected\"\n />\n </td>\n } @if (grid().actionIsOnLeft()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n } @for (cell of getVisibleCells(row.cells); track cell.getId()) {\n <td [class]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell\n [cell]=\"cell\"\n [inputClass]=\"editInputClass()\"\n [isInEditing]=\"row.isInEditing\"\n >\n </ng2-smart-table-cell>\n </td>\n } @if (grid().actionIsOnRight()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n }\n</tr>\n\n<ng-template #actions>\n @if (row.isInEditing) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid()\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm()\"\n [editCancel]=\"editCancel\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @if (!row.isInEditing && grid().isActionsVisible() ) {\n <td class=\"ng2-smart-actions\" (click)=\"$event.stopPropagation()\">\n <ng2-st-tbody-custom\n [grid]=\"grid()\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source()\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid()\"\n [deleteConfirm]=\"deleteConfirm()\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n [row]=\"row\"\n [source]=\"source()\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n }\n</ng-template>\n} @empty {\n<tr>\n <td colspan=\"50\">\n {{ noDataMessage() }}\n </td>\n</tr>\n}\n", styles: [":host .ng2-smart-row.selected{background:#0000000d}:host .ng2-smart-row .ng2-smart-actions.ng2-smart-action-multiple-select{text-align:center}:host ::ng-deep ng2-st-tbody-edit-delete a:first-child,:host ::ng-deep ng2-st-tbody-create-cancel a:first-child{margin-right:.25rem}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: TbodyCustomComponent, selector: "ng2-st-tbody-custom", inputs: ["grid", "row", "source"], outputs: ["custom"] }, { kind: "component", type: TbodyEditDeleteComponent, selector: "ng2-st-tbody-edit-delete", inputs: ["grid", "row", "source", "deleteConfirm"], outputs: ["edit", "delete"] }, { kind: "component", type: TbodyCreateCancelComponent, selector: "ng2-st-tbody-create-cancel", inputs: ["grid", "row", "editConfirm", "editCancel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CellComponent, selector: "ng2-smart-table-cell", inputs: ["cell", "inputClass", "isInEditing"] }] }); }
2532
2446
  }
2533
2447
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTbodyComponent, decorators: [{
2534
2448
  type: Component,
@@ -2537,66 +2451,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2537
2451
  TbodyCustomComponent,
2538
2452
  TbodyEditDeleteComponent,
2539
2453
  TbodyCreateCancelComponent,
2454
+ NgTemplateOutlet,
2540
2455
  CellComponent,
2541
- ], template: "@if (grid.getRows().length) { @for (row of grid.getRows(); track\ntrackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [class]=\"rowClassFunction(row)\"\n [class.selected]=\"row.isSelected\"\n>\n @if (isMultiSelectVisible) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\"\n >\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected\"\n />\n </td>\n } @if (!row.isInEditing && showActionColumnLeft) {\n <td class=\"ng2-smart-actions\" (click)=\"$event.stopPropagation()\">\n <ng2-st-tbody-custom\n [grid]=\"grid\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n } @if (row.isInEditing && showActionColumnLeft) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n [editCancel]=\"editCancel\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @for (cell of getVisibleCells(row.cells); track cell.getId()) {\n <td [class]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell\n [cell]=\"cell\"\n [grid]=\"grid\"\n [row]=\"row\"\n [isNew]=\"false\"\n [mode]=\"mode\"\n [editConfirm]=\"editConfirm\"\n [inputClass]=\"editInputClass\"\n [isInEditing]=\"row.isInEditing\"\n >\n </ng2-smart-table-cell>\n </td>\n } @if (row.isInEditing && showActionColumnRight) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @if (!row.isInEditing && showActionColumnRight) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-custom\n [grid]=\"grid\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [row]=\"row\"\n [source]=\"source\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n }\n</tr>\n} } @else {\n<tr>\n <td [attr.colspan]=\"tableColumnsCount\">\n {{ noDataMessage }}\n </td>\n</tr>\n}\n", styles: [":host .ng2-smart-row.selected{background:#0000000d}:host .ng2-smart-row .ng2-smart-actions.ng2-smart-action-multiple-select{text-align:center}:host ::ng-deep ng2-st-tbody-edit-delete a:first-child,:host ::ng-deep ng2-st-tbody-create-cancel a:first-child{margin-right:.25rem}\n"] }]
2542
- }], propDecorators: { grid: [{
2543
- type: Input
2544
- }], source: [{
2545
- type: Input
2546
- }], deleteConfirm: [{
2547
- type: Input
2548
- }], editConfirm: [{
2549
- type: Input
2550
- }], rowClassFunction: [{
2551
- type: Input
2552
- }] } });
2456
+ ], template: "@for (row of grid().getRows(); track trackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [class]=\"rowClassFunction()(row)\"\n [class.selected]=\"row.isSelected\"\n>\n @if (grid().isMultiSelectVisible()) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\"\n >\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected\"\n />\n </td>\n } @if (grid().actionIsOnLeft()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n } @for (cell of getVisibleCells(row.cells); track cell.getId()) {\n <td [class]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell\n [cell]=\"cell\"\n [inputClass]=\"editInputClass()\"\n [isInEditing]=\"row.isInEditing\"\n >\n </ng2-smart-table-cell>\n </td>\n } @if (grid().actionIsOnRight()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n }\n</tr>\n\n<ng-template #actions>\n @if (row.isInEditing) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid()\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm()\"\n [editCancel]=\"editCancel\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @if (!row.isInEditing && grid().isActionsVisible() ) {\n <td class=\"ng2-smart-actions\" (click)=\"$event.stopPropagation()\">\n <ng2-st-tbody-custom\n [grid]=\"grid()\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source()\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid()\"\n [deleteConfirm]=\"deleteConfirm()\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n [row]=\"row\"\n [source]=\"source()\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n }\n</ng-template>\n} @empty {\n<tr>\n <td colspan=\"50\">\n {{ noDataMessage() }}\n </td>\n</tr>\n}\n", styles: [":host .ng2-smart-row.selected{background:#0000000d}:host .ng2-smart-row .ng2-smart-actions.ng2-smart-action-multiple-select{text-align:center}:host ::ng-deep ng2-st-tbody-edit-delete a:first-child,:host ::ng-deep ng2-st-tbody-create-cancel a:first-child{margin-right:.25rem}\n"] }]
2457
+ }] });
2553
2458
 
2554
2459
  class FilterDefault {
2555
2460
  constructor() {
2556
- this.inputClass = '';
2461
+ this.column = input.required();
2462
+ this.source = input.required();
2463
+ this.inputClass = input('');
2557
2464
  this.query = '';
2558
2465
  this.filter = output();
2559
2466
  }
2560
2467
  onFilter(query) {
2561
- this.source.addFilter({
2562
- field: this.column.id,
2468
+ this.source().addFilter({
2469
+ field: this.column().id,
2563
2470
  search: query,
2564
- filter: this.column.getFilterFunction(),
2471
+ filter: this.column().getFilterFunction(),
2565
2472
  });
2566
2473
  }
2567
2474
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterDefault, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2568
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: FilterDefault, isStandalone: true, selector: "ng-component", inputs: { column: "column", source: "source", inputClass: "inputClass", query: "query" }, outputs: { filter: "filter" }, ngImport: i0, template: '', isInline: true }); }
2475
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: FilterDefault, isStandalone: true, selector: "ng-component", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { filter: "filter" }, ngImport: i0, template: '', isInline: true }); }
2569
2476
  }
2570
2477
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterDefault, decorators: [{
2571
2478
  type: Component,
2572
2479
  args: [{ template: '' }]
2573
- }], propDecorators: { column: [{
2574
- type: Input
2575
- }], source: [{
2576
- type: Input
2577
- }], inputClass: [{
2578
- type: Input
2579
- }], query: [{
2480
+ }], propDecorators: { query: [{
2580
2481
  type: Input
2581
2482
  }] } });
2582
2483
 
2583
2484
  class CustomFilterComponent extends FilterDefault {
2584
2485
  ngOnChanges(changes) {
2585
2486
  if (this.customComponent) {
2586
- if (this.customComponent.instance?.ngOnChanges) {
2587
- this.customComponent.instance?.ngOnChanges(changes);
2487
+ if (this.customComponent?.instance &&
2488
+ "ngOnChanges" in this.customComponent.instance) {
2489
+ const onChanges = this.customComponent.instance.ngOnChanges;
2490
+ onChanges(changes);
2588
2491
  }
2589
2492
  return;
2590
2493
  }
2591
- if (this.column.filter && this.column.filter.type === "custom") {
2592
- this.customComponent = this.dynamicTarget.createComponent(this.column.filter?.component);
2494
+ const columnFilter = this.column().filter;
2495
+ if (columnFilter && columnFilter.type === "custom") {
2496
+ this.customComponent = this.dynamicTarget?.createComponent(columnFilter?.component);
2497
+ // set @Inputs and @Outputs of custom component
2498
+ this.customComponent?.setInput("query", this.query);
2499
+ this.customComponent?.setInput("column", this.column());
2500
+ this.customComponent?.setInput("source", this.source());
2501
+ this.customComponent?.setInput("inputClass", this.inputClass());
2502
+ this.customComponent?.instance.filter.subscribe((event) => this.onFilter(event));
2593
2503
  }
2594
- // set @Inputs and @Outputs of custom component
2595
- this.customComponent.instance.query = this.query;
2596
- this.customComponent.instance.column = this.column;
2597
- this.customComponent.instance.source = this.source;
2598
- this.customComponent.instance.inputClass = this.inputClass;
2599
- this.customComponent.instance.filter.subscribe((event) => this.onFilter(event));
2600
2504
  }
2601
2505
  ngOnDestroy() {
2602
2506
  if (this.customComponent) {
@@ -2629,11 +2533,11 @@ class CheckboxFilterComponent extends DefaultFilter {
2629
2533
  .pipe(debounceTime(this.delay))
2630
2534
  .subscribe((checked) => {
2631
2535
  this.filterActive = true;
2632
- const trueVal = (this.column.getFilterConfig() &&
2633
- this.column.getFilterConfig().true) ||
2536
+ const trueVal = (this.column().getFilterConfig() &&
2537
+ this.column().getFilterConfig().true) ||
2634
2538
  true;
2635
- const falseVal = (this.column.getFilterConfig() &&
2636
- this.column.getFilterConfig().false) ||
2539
+ const falseVal = (this.column().getFilterConfig() &&
2540
+ this.column().getFilterConfig().false) ||
2637
2541
  false;
2638
2542
  this.query = checked ? trueVal : falseVal;
2639
2543
  this.setFilter();
@@ -2651,12 +2555,12 @@ class CheckboxFilterComponent extends DefaultFilter {
2651
2555
  <input
2652
2556
  type="checkbox"
2653
2557
  [formControl]="inputControl"
2654
- [class]="inputClass"
2558
+ [class]="inputClass()"
2655
2559
  class="form-control"
2656
2560
  />
2657
2561
  @if (filterActive) {
2658
2562
  <a href="#" (click)="resetFilter($event)">{{
2659
- column.getFilterConfig()?.resetText || "reset"
2563
+ column().getFilterConfig()?.resetText || "reset"
2660
2564
  }}</a>
2661
2565
  }
2662
2566
  `, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
@@ -2669,12 +2573,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2669
2573
  <input
2670
2574
  type="checkbox"
2671
2575
  [formControl]="inputControl"
2672
- [class]="inputClass"
2576
+ [class]="inputClass()"
2673
2577
  class="form-control"
2674
2578
  />
2675
2579
  @if (filterActive) {
2676
2580
  <a href="#" (click)="resetFilter($event)">{{
2677
- column.getFilterConfig()?.resetText || "reset"
2581
+ column().getFilterConfig()?.resetText || "reset"
2678
2582
  }}</a>
2679
2583
  }
2680
2584
  `,
@@ -2707,11 +2611,11 @@ class InputFilterComponent extends DefaultFilter {
2707
2611
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2708
2612
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: InputFilterComponent, isStandalone: true, selector: "input-filter", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
2709
2613
  <input
2710
- [class]="inputClass"
2614
+ [class]="inputClass()"
2711
2615
  [formControl]="inputControl"
2712
2616
  class="form-control"
2713
2617
  type="text"
2714
- placeholder="{{ column.title }}"
2618
+ placeholder="{{ column().title }}"
2715
2619
  />
2716
2620
  `, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
2717
2621
  }
@@ -2721,11 +2625,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2721
2625
  selector: "input-filter",
2722
2626
  template: `
2723
2627
  <input
2724
- [class]="inputClass"
2628
+ [class]="inputClass()"
2725
2629
  [formControl]="inputControl"
2726
2630
  class="form-control"
2727
2631
  type="text"
2728
- placeholder="{{ column.title }}"
2632
+ placeholder="{{ column().title }}"
2729
2633
  />
2730
2634
  `,
2731
2635
  standalone: true,
@@ -2746,13 +2650,13 @@ class SelectFilterComponent extends DefaultFilter {
2746
2650
  }
2747
2651
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2748
2652
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: SelectFilterComponent, isStandalone: true, selector: "select-filter", viewQueries: [{ propertyName: "inputControl", first: true, predicate: ["inputControl"], descendants: true, read: NgControl, static: true }], usesInheritance: true, ngImport: i0, template: `
2749
- <select [class]="inputClass"
2653
+ <select [class]="inputClass()"
2750
2654
  class="form-control"
2751
2655
  #inputControl
2752
2656
  [(ngModel)]="query">
2753
2657
 
2754
- <option value="">{{ column.getFilterConfig().selectText }}</option>
2755
- @for (option of column.getFilterConfig().list; track option.value) {
2658
+ <option value="">{{ column().getFilterConfig().selectText }}</option>
2659
+ @for (option of column().getFilterConfig().list; track option.value) {
2756
2660
  <option [value]="option.value">
2757
2661
  {{ option.title }}
2758
2662
  </option>
@@ -2765,13 +2669,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2765
2669
  args: [{
2766
2670
  selector: 'select-filter',
2767
2671
  template: `
2768
- <select [class]="inputClass"
2672
+ <select [class]="inputClass()"
2769
2673
  class="form-control"
2770
2674
  #inputControl
2771
2675
  [(ngModel)]="query">
2772
2676
 
2773
- <option value="">{{ column.getFilterConfig().selectText }}</option>
2774
- @for (option of column.getFilterConfig().list; track option.value) {
2677
+ <option value="">{{ column().getFilterConfig().selectText }}</option>
2678
+ @for (option of column().getFilterConfig().list; track option.value) {
2775
2679
  <option [value]="option.value">
2776
2680
  {{ option.title }}
2777
2681
  </option>
@@ -2789,27 +2693,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2789
2693
  class DefaultFilterComponent extends FilterDefault {
2790
2694
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2791
2695
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: DefaultFilterComponent, isStandalone: true, selector: "default-table-filter", usesInheritance: true, ngImport: i0, template: `
2792
- @switch (column.getFilterType()) { @case ('list') {
2696
+ @switch (column().getFilterType()) { @case ('list') {
2793
2697
  <select-filter
2794
2698
  [query]="query"
2795
- [class]="inputClass"
2796
- [column]="column"
2699
+ [class]="inputClass()"
2700
+ [column]="column()"
2797
2701
  (filter)="onFilter($event)"
2798
2702
  >
2799
2703
  </select-filter>
2800
2704
  } @case ('checkbox') {
2801
2705
  <checkbox-filter
2802
2706
  [query]="query"
2803
- [class]="inputClass"
2804
- [column]="column"
2707
+ [class]="inputClass()"
2708
+ [column]="column()"
2805
2709
  (filter)="onFilter($event)"
2806
2710
  >
2807
2711
  </checkbox-filter>
2808
2712
  } @default {
2809
2713
  <input-filter
2810
2714
  [query]="query"
2811
- [class]="inputClass"
2812
- [column]="column"
2715
+ [class]="inputClass()"
2716
+ [column]="column()"
2813
2717
  (filter)="onFilter($event)"
2814
2718
  >
2815
2719
  </input-filter>
@@ -2821,27 +2725,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2821
2725
  args: [{
2822
2726
  selector: "default-table-filter",
2823
2727
  template: `
2824
- @switch (column.getFilterType()) { @case ('list') {
2728
+ @switch (column().getFilterType()) { @case ('list') {
2825
2729
  <select-filter
2826
2730
  [query]="query"
2827
- [class]="inputClass"
2828
- [column]="column"
2731
+ [class]="inputClass()"
2732
+ [column]="column()"
2829
2733
  (filter)="onFilter($event)"
2830
2734
  >
2831
2735
  </select-filter>
2832
2736
  } @case ('checkbox') {
2833
2737
  <checkbox-filter
2834
2738
  [query]="query"
2835
- [class]="inputClass"
2836
- [column]="column"
2739
+ [class]="inputClass()"
2740
+ [column]="column()"
2837
2741
  (filter)="onFilter($event)"
2838
2742
  >
2839
2743
  </checkbox-filter>
2840
2744
  } @default {
2841
2745
  <input-filter
2842
2746
  [query]="query"
2843
- [class]="inputClass"
2844
- [column]="column"
2747
+ [class]="inputClass()"
2748
+ [column]="column()"
2845
2749
  (filter)="onFilter($event)"
2846
2750
  >
2847
2751
  </input-filter>
@@ -2862,8 +2766,8 @@ class FilterComponent extends FilterDefault {
2862
2766
  if (!changes['source'].firstChange && this.dataChangedSub) {
2863
2767
  this.dataChangedSub.unsubscribe();
2864
2768
  }
2865
- this.dataChangedSub = this.source.onChanged().subscribe((dataChanges) => {
2866
- const filterConf = this.source.getFilter();
2769
+ this.dataChangedSub = this.source().onChanged().subscribe((dataChanges) => {
2770
+ const filterConf = this.source().getFilter();
2867
2771
  if (filterConf && filterConf.filters && filterConf.filters.length === 0) {
2868
2772
  this.query = '';
2869
2773
  // add a check for existing filters an set the query if one exists for this column
@@ -2871,7 +2775,7 @@ class FilterComponent extends FilterDefault {
2871
2775
  }
2872
2776
  else if (filterConf && filterConf.filters && filterConf.filters.length > 0) {
2873
2777
  filterConf.filters.forEach((k, v) => {
2874
- if (k.field == this.column.id) {
2778
+ if (k.field == this.column().id) {
2875
2779
  this.query = k.search;
2876
2780
  }
2877
2781
  });
@@ -2881,24 +2785,24 @@ class FilterComponent extends FilterDefault {
2881
2785
  }
2882
2786
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2883
2787
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: FilterComponent, isStandalone: true, selector: "ng2-smart-table-filter", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
2884
- @if (column.isFilterable) {
2788
+ @if (column().isFilterable) {
2885
2789
  <div class="ng2-smart-filter">
2886
- @switch (column.getFilterType()) {
2790
+ @switch (column().getFilterType()) {
2887
2791
  @case ('custom') {
2888
2792
  <custom-table-filter
2889
2793
  [query]="query"
2890
- [column]="column"
2891
- [source]="source"
2892
- [inputClass]="inputClass"
2794
+ [column]="column()"
2795
+ [source]="source()"
2796
+ [inputClass]="inputClass()"
2893
2797
  (filter)="onFilter($event)">
2894
2798
  </custom-table-filter>
2895
2799
  }
2896
2800
  @default {
2897
2801
  <default-table-filter
2898
2802
  [query]="query"
2899
- [column]="column"
2900
- [source]="source"
2901
- [inputClass]="inputClass"
2803
+ [column]="column()"
2804
+ [source]="source()"
2805
+ [inputClass]="inputClass()"
2902
2806
  (filter)="onFilter($event)">
2903
2807
  </default-table-filter>
2904
2808
  }
@@ -2910,24 +2814,24 @@ class FilterComponent extends FilterDefault {
2910
2814
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterComponent, decorators: [{
2911
2815
  type: Component,
2912
2816
  args: [{ selector: 'ng2-smart-table-filter', template: `
2913
- @if (column.isFilterable) {
2817
+ @if (column().isFilterable) {
2914
2818
  <div class="ng2-smart-filter">
2915
- @switch (column.getFilterType()) {
2819
+ @switch (column().getFilterType()) {
2916
2820
  @case ('custom') {
2917
2821
  <custom-table-filter
2918
2822
  [query]="query"
2919
- [column]="column"
2920
- [source]="source"
2921
- [inputClass]="inputClass"
2823
+ [column]="column()"
2824
+ [source]="source()"
2825
+ [inputClass]="inputClass()"
2922
2826
  (filter)="onFilter($event)">
2923
2827
  </custom-table-filter>
2924
2828
  }
2925
2829
  @default {
2926
2830
  <default-table-filter
2927
2831
  [query]="query"
2928
- [column]="column"
2929
- [source]="source"
2930
- [inputClass]="inputClass"
2832
+ [column]="column()"
2833
+ [source]="source()"
2834
+ [inputClass]="inputClass()"
2931
2835
  (filter)="onFilter($event)">
2932
2836
  </default-table-filter>
2933
2837
  }
@@ -2939,37 +2843,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2939
2843
 
2940
2844
  class AddButtonComponent {
2941
2845
  constructor() {
2942
- this.ref = inject(ElementRef);
2846
+ this.grid = input.required();
2943
2847
  this.create = output();
2944
- this.isActionAdd = false;
2945
- this.addNewButtonContent = "";
2946
- }
2947
- ngAfterViewInit() {
2948
- this.ref.nativeElement.classList.add("ng2-smart-actions-title", "ng2-smart-actions-title-add");
2949
- }
2950
- ngOnChanges() {
2951
- this.isActionAdd = this.grid.getSetting("actions.add");
2952
- this.addNewButtonContent = this.grid.getSetting("add.addButtonContent");
2848
+ this.isActionAdd = computed(() => {
2849
+ const actions = this.grid().settings().actions;
2850
+ if (!actions) {
2851
+ return false;
2852
+ }
2853
+ return !!actions.add;
2854
+ });
2855
+ this.addNewButtonContent = computed(() => {
2856
+ const addParams = this.grid().settings()?.add;
2857
+ if (!addParams) {
2858
+ return "Add New";
2859
+ }
2860
+ return addParams?.addButtonContent || "Add New";
2861
+ });
2953
2862
  }
2954
2863
  onAdd(event) {
2955
2864
  event.preventDefault();
2956
2865
  event.stopPropagation();
2957
- if (this.grid.getSetting("mode") === "external") {
2958
- this.create.emit({
2959
- source: this.source,
2960
- });
2961
- }
2962
- else {
2963
- this.grid.createFormShown = true;
2964
- }
2866
+ // if (this.grid.getSetting("mode") === "external") {
2867
+ // this.create.emit({
2868
+ // source: this.source,
2869
+ // });
2870
+ // } else {
2871
+ this.grid().createFormShown = true;
2872
+ // }
2965
2873
  }
2966
2874
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AddButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2967
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: AddButtonComponent, isStandalone: true, selector: "[ng2-st-add-button]", inputs: { grid: "grid", source: "source" }, outputs: { create: "create" }, usesOnChanges: true, ngImport: i0, template: `
2968
- @if (isActionAdd) {
2875
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: AddButtonComponent, isStandalone: true, selector: "[ng2-st-add-button]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { create: "create" }, host: { classAttribute: "ng2-smart-actions-title ng2-smart-actions-title-add" }, ngImport: i0, template: `
2876
+ @if (isActionAdd()) {
2969
2877
  <a
2970
2878
  href="#"
2971
2879
  class="ng2-smart-action ng2-smart-action-add-add"
2972
- [innerHTML]="addNewButtonContent"
2880
+ [innerHTML]="addNewButtonContent()"
2973
2881
  (click)="onAdd($event)"
2974
2882
  ></a>
2975
2883
  }
@@ -2980,91 +2888,87 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2980
2888
  args: [{
2981
2889
  selector: "[ng2-st-add-button]",
2982
2890
  template: `
2983
- @if (isActionAdd) {
2891
+ @if (isActionAdd()) {
2984
2892
  <a
2985
2893
  href="#"
2986
2894
  class="ng2-smart-action ng2-smart-action-add-add"
2987
- [innerHTML]="addNewButtonContent"
2895
+ [innerHTML]="addNewButtonContent()"
2988
2896
  (click)="onAdd($event)"
2989
2897
  ></a>
2990
2898
  }
2991
2899
  `,
2900
+ host: {
2901
+ class: "ng2-smart-actions-title ng2-smart-actions-title-add",
2902
+ },
2992
2903
  standalone: true,
2993
2904
  }]
2994
- }], propDecorators: { grid: [{
2995
- type: Input
2996
- }], source: [{
2997
- type: Input
2998
- }] } });
2905
+ }] });
2999
2906
 
3000
- class TheadFitlersRowComponent {
2907
+ class TheadFiltersRowComponent {
3001
2908
  constructor() {
2909
+ this.grid = input.required();
2910
+ this.source = input.required();
3002
2911
  this.create = output();
3003
2912
  this.filter = output();
3004
- this.isMultiSelectVisible = false;
3005
- this.showActionColumnLeft = false;
3006
- this.showActionColumnRight = false;
3007
- this.filterInputClass = "";
3008
- }
3009
- ngOnChanges() {
3010
- this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
3011
- this.showActionColumnLeft = this.grid.showActionColumn("left");
3012
- this.showActionColumnRight = this.grid.showActionColumn("right");
3013
- this.filterInputClass = this.grid.getSetting("filter.inputClass", "");
3014
- }
3015
- getVisibleColumns(columns) {
3016
- return (columns || []).filter((column) => !column.hide);
3017
- }
3018
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFitlersRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3019
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TheadFitlersRowComponent, isStandalone: true, selector: "[ng2-st-thead-filters-row]", inputs: { grid: "grid", source: "source" }, outputs: { create: "create", filter: "filter" }, usesOnChanges: true, ngImport: i0, template: `
3020
- @if (isMultiSelectVisible) {
2913
+ this.filterInputClass = computed(() => {
2914
+ const filterOptions = this.grid().settings()?.filter;
2915
+ if (!filterOptions) {
2916
+ return "";
2917
+ }
2918
+ return filterOptions.inputClass || "";
2919
+ });
2920
+ }
2921
+ getVisibleColumns() {
2922
+ return (this.grid().getColumns() || []).filter((column) => !column.hide);
2923
+ }
2924
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFiltersRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2925
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TheadFiltersRowComponent, isStandalone: true, selector: "[ng2-st-thead-filters-row]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { create: "create", filter: "filter" }, ngImport: i0, template: `
2926
+ @if (grid().isMultiSelectVisible()) {
3021
2927
  <th></th>
3022
- } @if (showActionColumnLeft) {
3023
- <th ng2-st-add-button [grid]="grid" (create)="create.emit($event)"></th>
3024
- } @for (column of getVisibleColumns(grid.getColumns()); track column.id) {
2928
+ } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
2929
+ <th ng2-st-add-button [grid]="grid()" (create)="create.emit($event)"></th>
2930
+ } @for (column of getVisibleColumns(); track column.id) {
3025
2931
  <th class="ng2-smart-th {{ column.id }}">
3026
2932
  <ng2-smart-table-filter
3027
- [source]="source"
2933
+ [source]="source()"
3028
2934
  [column]="column"
3029
- [inputClass]="filterInputClass"
2935
+ [inputClass]="filterInputClass()"
3030
2936
  (filter)="filter.emit($event)"
3031
2937
  >
3032
2938
  </ng2-smart-table-filter>
3033
2939
  </th>
3034
- } @if (showActionColumnRight) {
2940
+ } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
3035
2941
  <th
3036
2942
  ng2-st-add-button
3037
- [grid]="grid"
3038
- [source]="source"
2943
+ [grid]="grid()"
3039
2944
  (create)="create.emit($event)"
3040
2945
  ></th>
3041
2946
  }
3042
- `, isInline: true, dependencies: [{ kind: "component", type: AddButtonComponent, selector: "[ng2-st-add-button]", inputs: ["grid", "source"], outputs: ["create"] }, { kind: "component", type: FilterComponent, selector: "ng2-smart-table-filter" }] }); }
2947
+ `, isInline: true, dependencies: [{ kind: "component", type: AddButtonComponent, selector: "[ng2-st-add-button]", inputs: ["grid"], outputs: ["create"] }, { kind: "component", type: FilterComponent, selector: "ng2-smart-table-filter" }] }); }
3043
2948
  }
3044
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFitlersRowComponent, decorators: [{
2949
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFiltersRowComponent, decorators: [{
3045
2950
  type: Component,
3046
2951
  args: [{
3047
2952
  selector: "[ng2-st-thead-filters-row]",
3048
2953
  template: `
3049
- @if (isMultiSelectVisible) {
2954
+ @if (grid().isMultiSelectVisible()) {
3050
2955
  <th></th>
3051
- } @if (showActionColumnLeft) {
3052
- <th ng2-st-add-button [grid]="grid" (create)="create.emit($event)"></th>
3053
- } @for (column of getVisibleColumns(grid.getColumns()); track column.id) {
2956
+ } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
2957
+ <th ng2-st-add-button [grid]="grid()" (create)="create.emit($event)"></th>
2958
+ } @for (column of getVisibleColumns(); track column.id) {
3054
2959
  <th class="ng2-smart-th {{ column.id }}">
3055
2960
  <ng2-smart-table-filter
3056
- [source]="source"
2961
+ [source]="source()"
3057
2962
  [column]="column"
3058
- [inputClass]="filterInputClass"
2963
+ [inputClass]="filterInputClass()"
3059
2964
  (filter)="filter.emit($event)"
3060
2965
  >
3061
2966
  </ng2-smart-table-filter>
3062
2967
  </th>
3063
- } @if (showActionColumnRight) {
2968
+ } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
3064
2969
  <th
3065
2970
  ng2-st-add-button
3066
- [grid]="grid"
3067
- [source]="source"
2971
+ [grid]="grid()"
3068
2972
  (create)="create.emit($event)"
3069
2973
  ></th>
3070
2974
  }
@@ -3072,35 +2976,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3072
2976
  standalone: true,
3073
2977
  imports: [AddButtonComponent, FilterComponent],
3074
2978
  }]
3075
- }], propDecorators: { grid: [{
3076
- type: Input
3077
- }], source: [{
3078
- type: Input
3079
- }] } });
2979
+ }] });
3080
2980
 
3081
2981
  class ActionsComponent {
3082
2982
  constructor() {
2983
+ this.grid = input.required();
3083
2984
  this.create = output();
3084
- this.createButtonContent = "";
3085
- this.cancelButtonContent = "";
3086
- }
3087
- ngOnChanges() {
3088
- this.createButtonContent = this.grid.getSetting("add.createButtonContent");
3089
- this.cancelButtonContent = this.grid.getSetting("add.cancelButtonContent");
2985
+ this.createButtonContent = computed(() => {
2986
+ const addOptions = this.grid().settings().add;
2987
+ if (!addOptions) {
2988
+ return "Create";
2989
+ }
2990
+ return addOptions?.createButtonContent || "Create";
2991
+ });
2992
+ this.cancelButtonContent = computed(() => {
2993
+ const addOptions = this.grid().settings().add;
2994
+ if (!addOptions) {
2995
+ return "Cancel";
2996
+ }
2997
+ return addOptions?.cancelButtonContent || "Cancel";
2998
+ });
3090
2999
  }
3091
3000
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3092
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: ActionsComponent, isStandalone: true, selector: "ng2-st-actions", inputs: { grid: "grid" }, outputs: { create: "create" }, usesOnChanges: true, ngImport: i0, template: `
3001
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: ActionsComponent, isStandalone: true, selector: "ng2-st-actions", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { create: "create" }, ngImport: i0, template: `
3093
3002
  <a
3094
3003
  href="#"
3095
3004
  class="ng2-smart-action ng2-smart-action-add-create"
3096
- [innerHTML]="createButtonContent"
3005
+ [innerHTML]="createButtonContent()"
3097
3006
  (click)="$event.preventDefault(); create.emit($event)"
3098
3007
  ></a>
3099
3008
  <a
3100
3009
  href="#"
3101
3010
  class="ng2-smart-action ng2-smart-action-add-cancel"
3102
- [innerHTML]="cancelButtonContent"
3103
- (click)="$event.preventDefault(); grid.createFormShown = false"
3011
+ [innerHTML]="cancelButtonContent()"
3012
+ (click)="$event.preventDefault(); grid().createFormShown = false"
3104
3013
  ></a>
3105
3014
  `, isInline: true }); }
3106
3015
  }
@@ -3112,110 +3021,96 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3112
3021
  <a
3113
3022
  href="#"
3114
3023
  class="ng2-smart-action ng2-smart-action-add-create"
3115
- [innerHTML]="createButtonContent"
3024
+ [innerHTML]="createButtonContent()"
3116
3025
  (click)="$event.preventDefault(); create.emit($event)"
3117
3026
  ></a>
3118
3027
  <a
3119
3028
  href="#"
3120
3029
  class="ng2-smart-action ng2-smart-action-add-cancel"
3121
- [innerHTML]="cancelButtonContent"
3122
- (click)="$event.preventDefault(); grid.createFormShown = false"
3030
+ [innerHTML]="cancelButtonContent()"
3031
+ (click)="$event.preventDefault(); grid().createFormShown = false"
3123
3032
  ></a>
3124
3033
  `,
3125
3034
  standalone: true,
3126
3035
  }]
3127
- }], propDecorators: { grid: [{
3128
- type: Input
3129
- }] } });
3036
+ }] });
3130
3037
 
3131
3038
  class TheadFormRowComponent {
3132
3039
  constructor() {
3040
+ this.grid = input.required();
3133
3041
  this.create = output();
3134
- this.isMultiSelectVisible = false;
3135
- this.showActionColumnLeft = false;
3136
- this.showActionColumnRight = false;
3137
- this.addInputClass = "";
3042
+ this.addInputClass = computed(() => {
3043
+ const addOptions = this.grid().settings()?.add;
3044
+ if (!addOptions) {
3045
+ return "";
3046
+ }
3047
+ return addOptions.inputClass || "";
3048
+ });
3138
3049
  }
3139
3050
  onCreate(event) {
3140
3051
  event.stopPropagation();
3141
- this.grid.create(this.grid.getNewRow(), this.createConfirm);
3052
+ this.grid().create(this.grid().getNewRow(), this.createConfirm);
3142
3053
  }
3143
- ngOnChanges() {
3144
- this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
3145
- this.showActionColumnLeft = this.grid.showActionColumn("left");
3146
- this.showActionColumnRight = this.grid.showActionColumn("right");
3147
- this.addInputClass = this.grid.getSetting("add.inputClass", "");
3148
- }
3149
- getVisibleCells(cells) {
3150
- return (cells || []).filter((cell) => !cell.getColumn().hide);
3054
+ getVisibleCells() {
3055
+ return (this.grid().getNewRow().getCells() || []).filter((cell) => !cell.getColumn().hide);
3151
3056
  }
3152
3057
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFormRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3153
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TheadFormRowComponent, isStandalone: true, selector: "[ng2-st-thead-form-row]", inputs: { grid: "grid", row: "row", createConfirm: "createConfirm" }, outputs: { create: "create" }, usesOnChanges: true, ngImport: i0, template: `
3154
- @if (grid.isMultiSelectVisible()) {
3058
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TheadFormRowComponent, isStandalone: true, selector: "[ng2-st-thead-form-row]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, createConfirm: { classPropertyName: "createConfirm", publicName: "createConfirm", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { create: "create" }, ngImport: i0, template: `
3059
+ @if (grid().isMultiSelectVisible()) {
3155
3060
  <td></td>
3156
- } @if (showActionColumnLeft) {
3061
+ } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
3157
3062
  <td class="ng2-smart-actions">
3158
3063
  <ng2-st-actions
3159
- [grid]="grid"
3064
+ [grid]="grid()"
3160
3065
  (create)="onCreate($event)"
3161
3066
  ></ng2-st-actions>
3162
3067
  </td>
3163
- } @for (cell of getVisibleCells(grid.getNewRow().getCells()); track
3164
- cell.getId()) {
3068
+ } @for (cell of getVisibleCells(); track cell.getId()) {
3165
3069
  <td>
3166
3070
  <ng2-smart-table-cell
3167
3071
  [cell]="cell"
3168
- [grid]="grid"
3169
- [isNew]="true"
3170
- [createConfirm]="createConfirm"
3171
- [inputClass]="addInputClass"
3172
- [isInEditing]="grid.getNewRow().isInEditing"
3173
- (edited)="onCreate($event)"
3072
+ [inputClass]="addInputClass()"
3073
+ [isInEditing]="grid().getNewRow().isInEditing"
3174
3074
  >
3175
3075
  </ng2-smart-table-cell>
3176
3076
  </td>
3177
- } @if (showActionColumnRight) {
3077
+ } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
3178
3078
  <td class="ng2-smart-actions">
3179
3079
  <ng2-st-actions
3180
- [grid]="grid"
3080
+ [grid]="grid()"
3181
3081
  (create)="onCreate($event)"
3182
3082
  ></ng2-st-actions>
3183
3083
  </td>
3184
3084
  }
3185
- `, isInline: true, dependencies: [{ kind: "component", type: ActionsComponent, selector: "ng2-st-actions", inputs: ["grid"], outputs: ["create"] }, { kind: "component", type: CellComponent, selector: "ng2-smart-table-cell", inputs: ["grid", "row", "editConfirm", "createConfirm", "isNew", "cell", "inputClass", "mode", "isInEditing"], outputs: ["edited"] }] }); }
3085
+ `, isInline: true, dependencies: [{ kind: "component", type: ActionsComponent, selector: "ng2-st-actions", inputs: ["grid"], outputs: ["create"] }, { kind: "component", type: CellComponent, selector: "ng2-smart-table-cell", inputs: ["cell", "inputClass", "isInEditing"] }] }); }
3186
3086
  }
3187
3087
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFormRowComponent, decorators: [{
3188
3088
  type: Component,
3189
3089
  args: [{
3190
3090
  selector: "[ng2-st-thead-form-row]",
3191
3091
  template: `
3192
- @if (grid.isMultiSelectVisible()) {
3092
+ @if (grid().isMultiSelectVisible()) {
3193
3093
  <td></td>
3194
- } @if (showActionColumnLeft) {
3094
+ } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
3195
3095
  <td class="ng2-smart-actions">
3196
3096
  <ng2-st-actions
3197
- [grid]="grid"
3097
+ [grid]="grid()"
3198
3098
  (create)="onCreate($event)"
3199
3099
  ></ng2-st-actions>
3200
3100
  </td>
3201
- } @for (cell of getVisibleCells(grid.getNewRow().getCells()); track
3202
- cell.getId()) {
3101
+ } @for (cell of getVisibleCells(); track cell.getId()) {
3203
3102
  <td>
3204
3103
  <ng2-smart-table-cell
3205
3104
  [cell]="cell"
3206
- [grid]="grid"
3207
- [isNew]="true"
3208
- [createConfirm]="createConfirm"
3209
- [inputClass]="addInputClass"
3210
- [isInEditing]="grid.getNewRow().isInEditing"
3211
- (edited)="onCreate($event)"
3105
+ [inputClass]="addInputClass()"
3106
+ [isInEditing]="grid().getNewRow().isInEditing"
3212
3107
  >
3213
3108
  </ng2-smart-table-cell>
3214
3109
  </td>
3215
- } @if (showActionColumnRight) {
3110
+ } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
3216
3111
  <td class="ng2-smart-actions">
3217
3112
  <ng2-st-actions
3218
- [grid]="grid"
3113
+ [grid]="grid()"
3219
3114
  (create)="onCreate($event)"
3220
3115
  ></ng2-st-actions>
3221
3116
  </td>
@@ -3224,38 +3119,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3224
3119
  standalone: true,
3225
3120
  imports: [ActionsComponent, CellComponent],
3226
3121
  }]
3227
- }], propDecorators: { grid: [{
3228
- type: Input
3229
- }], row: [{
3230
- type: Input
3231
- }], createConfirm: [{
3122
+ }], propDecorators: { createConfirm: [{
3232
3123
  type: Input
3233
3124
  }] } });
3234
3125
 
3235
3126
  class ActionsTitleComponent {
3236
3127
  constructor() {
3237
- this.ref = inject(ElementRef);
3238
- this.actionsColumnTitle = "";
3239
- }
3240
- ngAfterViewInit() {
3241
- this.ref.nativeElement.classList.add("ng2-smart-actions");
3242
- }
3243
- ngOnChanges() {
3244
- this.actionsColumnTitle = this.grid.getSetting("actions.columnTitle");
3128
+ this.grid = input.required();
3129
+ this.actionsColumnTitle = computed(() => {
3130
+ const actions = this.grid().settings().actions;
3131
+ if (!actions) {
3132
+ return "Actions";
3133
+ }
3134
+ return actions.columnTitle || "Actions";
3135
+ });
3245
3136
  }
3246
3137
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ActionsTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3247
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: ActionsTitleComponent, isStandalone: true, selector: "[ng2-st-actions-title]", inputs: { grid: "grid" }, usesOnChanges: true, ngImport: i0, template: ` <div class="ng2-smart-title">{{ actionsColumnTitle }}</div> `, isInline: true }); }
3138
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: ActionsTitleComponent, isStandalone: true, selector: "[ng2-st-actions-title]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "ng2-smart-actions" }, ngImport: i0, template: ` <div class="ng2-smart-title">{{ actionsColumnTitle() }}</div> `, isInline: true }); }
3248
3139
  }
3249
3140
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ActionsTitleComponent, decorators: [{
3250
3141
  type: Component,
3251
3142
  args: [{
3252
3143
  selector: "[ng2-st-actions-title]",
3253
- template: ` <div class="ng2-smart-title">{{ actionsColumnTitle }}</div> `,
3144
+ template: ` <div class="ng2-smart-title">{{ actionsColumnTitle() }}</div> `,
3254
3145
  standalone: true,
3146
+ host: {
3147
+ class: "ng2-smart-actions",
3148
+ },
3255
3149
  }]
3256
- }], propDecorators: { grid: [{
3257
- type: Input
3258
- }] } });
3150
+ }] });
3259
3151
 
3260
3152
  class CheckboxSelectAllComponent {
3261
3153
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxSelectAllComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
@@ -3400,45 +3292,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3400
3292
 
3401
3293
  class TheadTitlesRowComponent {
3402
3294
  constructor() {
3295
+ this.grid = input.required();
3296
+ this.source = input.required();
3403
3297
  this.sort = output();
3404
3298
  this.selectAllRows = output();
3405
- this.isMultiSelectVisible = false;
3406
- this.showActionColumnLeft = false;
3407
- this.showActionColumnRight = false;
3408
- }
3409
- ngOnChanges() {
3410
- this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
3411
- this.showActionColumnLeft = this.grid.showActionColumn("left");
3412
- this.showActionColumnRight = this.grid.showActionColumn("right");
3413
3299
  }
3414
- getVisibleColumns(columns) {
3415
- return (columns || []).filter((column) => !column.hide);
3300
+ getVisibleColumns() {
3301
+ return (this.grid().getColumns() || []).filter((column) => !column.hide);
3416
3302
  }
3417
3303
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadTitlesRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3418
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TheadTitlesRowComponent, isStandalone: true, selector: "[ng2-st-thead-titles-row]", inputs: { grid: "grid", source: "source" }, outputs: { sort: "sort", selectAllRows: "selectAllRows" }, usesOnChanges: true, ngImport: i0, template: `
3419
- @if (isMultiSelectVisible) {
3304
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TheadTitlesRowComponent, isStandalone: true, selector: "[ng2-st-thead-titles-row]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { sort: "sort", selectAllRows: "selectAllRows" }, ngImport: i0, template: `
3305
+ @if (grid().isMultiSelectVisible()) {
3420
3306
  <th
3421
3307
  ng2-st-checkbox-select-all
3422
- [grid]="grid"
3423
- [source]="source"
3308
+ [grid]="grid()"
3309
+ [source]="source()"
3424
3310
  (click)="selectAllRows.emit($event)"
3425
3311
  ></th>
3426
- } @if (showActionColumnLeft) {
3427
- <th ng2-st-actions-title [grid]="grid"></th>
3428
- } @for (column of getVisibleColumns(grid.getColumns()); track column.id) {
3312
+ } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
3313
+
3314
+ <th ng2-st-actions-title [grid]="grid()"></th>
3315
+ } @for (column of getVisibleColumns(); track column.id) {
3429
3316
  <th
3430
3317
  class="ng2-smart-th {{ column.id }}"
3431
3318
  [class]="column.class"
3432
3319
  [style.width]="column.width"
3433
3320
  >
3434
3321
  <ng2-st-column-title
3435
- [source]="source"
3322
+ [source]="source()"
3436
3323
  [column]="column"
3437
3324
  (sort)="sort.emit($event)"
3438
3325
  ></ng2-st-column-title>
3439
3326
  </th>
3440
- } @if (showActionColumnRight) {
3441
- <th ng2-st-actions-title [grid]="grid"></th>
3327
+ } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
3328
+ <th ng2-st-actions-title [grid]="grid()"></th>
3442
3329
  }
3443
3330
  `, isInline: true, dependencies: [{ kind: "component", type: CheckboxSelectAllComponent, selector: "[ng2-st-checkbox-select-all]", inputs: ["grid", "source"] }, { kind: "component", type: ActionsTitleComponent, selector: "[ng2-st-actions-title]", inputs: ["grid"] }, { kind: "component", type: ColumnTitleComponent, selector: "ng2-st-column-title", inputs: ["column", "source"], outputs: ["sort"] }] }); }
3444
3331
  }
@@ -3447,29 +3334,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3447
3334
  args: [{
3448
3335
  selector: "[ng2-st-thead-titles-row]",
3449
3336
  template: `
3450
- @if (isMultiSelectVisible) {
3337
+ @if (grid().isMultiSelectVisible()) {
3451
3338
  <th
3452
3339
  ng2-st-checkbox-select-all
3453
- [grid]="grid"
3454
- [source]="source"
3340
+ [grid]="grid()"
3341
+ [source]="source()"
3455
3342
  (click)="selectAllRows.emit($event)"
3456
3343
  ></th>
3457
- } @if (showActionColumnLeft) {
3458
- <th ng2-st-actions-title [grid]="grid"></th>
3459
- } @for (column of getVisibleColumns(grid.getColumns()); track column.id) {
3344
+ } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
3345
+
3346
+ <th ng2-st-actions-title [grid]="grid()"></th>
3347
+ } @for (column of getVisibleColumns(); track column.id) {
3460
3348
  <th
3461
3349
  class="ng2-smart-th {{ column.id }}"
3462
3350
  [class]="column.class"
3463
3351
  [style.width]="column.width"
3464
3352
  >
3465
3353
  <ng2-st-column-title
3466
- [source]="source"
3354
+ [source]="source()"
3467
3355
  [column]="column"
3468
3356
  (sort)="sort.emit($event)"
3469
3357
  ></ng2-st-column-title>
3470
3358
  </th>
3471
- } @if (showActionColumnRight) {
3472
- <th ng2-st-actions-title [grid]="grid"></th>
3359
+ } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
3360
+ <th ng2-st-actions-title [grid]="grid()"></th>
3473
3361
  }
3474
3362
  `,
3475
3363
  standalone: true,
@@ -3479,36 +3367,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3479
3367
  ColumnTitleComponent,
3480
3368
  ],
3481
3369
  }]
3482
- }], propDecorators: { grid: [{
3483
- type: Input
3484
- }], source: [{
3485
- type: Input
3486
- }] } });
3370
+ }] });
3487
3371
 
3488
3372
  class Ng2SmartTableTheadComponent {
3489
3373
  constructor() {
3374
+ this.grid = input.required();
3375
+ this.source = input.required();
3490
3376
  this.sort = output();
3491
3377
  this.selectAllRows = output();
3492
3378
  this.create = output();
3493
3379
  this.filter = output();
3494
- this.isHideHeader = false;
3495
- this.isHideSubHeader = false;
3496
- }
3497
- ngOnChanges() {
3498
- this.isHideHeader = this.grid.getSetting('hideHeader', false);
3499
- this.isHideSubHeader = this.grid.getSetting('hideSubHeader', false);
3380
+ this.isHideHeader = computed(() => {
3381
+ return this.grid().settings()?.hideHeader || false;
3382
+ });
3383
+ this.isHideSubHeader = computed(() => {
3384
+ return this.grid().settings()?.hideSubHeader || false;
3385
+ });
3500
3386
  }
3501
3387
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTheadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3502
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableTheadComponent, isStandalone: true, selector: "[ng2-st-thead]", inputs: { grid: "grid", source: "source", createConfirm: "createConfirm" }, outputs: { sort: "sort", selectAllRows: "selectAllRows", create: "create", filter: "filter" }, usesOnChanges: true, ngImport: i0, template: "@if (!isHideHeader) {\n <tr ng2-st-thead-titles-row\n class=\"ng2-smart-titles\"\n [grid]=\"grid\"\n [source]=\"source\"\n (sort)=\"sort.emit($event)\"\n (selectAllRows)=\"selectAllRows.emit($event)\">\n </tr>\n}\n\n@if (!isHideSubHeader) {\n <tr ng2-st-thead-filters-row\n class=\"ng2-smart-filters\"\n [grid]=\"grid\"\n [source]=\"source\"\n (create)=\"create.emit($event)\"\n (filter)=\"filter.emit($event)\">\n </tr>\n}\n\n@if (grid.createFormShown) {\n <tr ng2-st-thead-form-row\n [grid]=\"grid\"\n [createConfirm]=\"createConfirm\">\n </tr>\n}\n", dependencies: [{ kind: "component", type: TheadTitlesRowComponent, selector: "[ng2-st-thead-titles-row]", inputs: ["grid", "source"], outputs: ["sort", "selectAllRows"] }, { kind: "component", type: TheadFitlersRowComponent, selector: "[ng2-st-thead-filters-row]", inputs: ["grid", "source"], outputs: ["create", "filter"] }, { kind: "component", type: TheadFormRowComponent, selector: "[ng2-st-thead-form-row]", inputs: ["grid", "row", "createConfirm"], outputs: ["create"] }] }); }
3388
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableTheadComponent, isStandalone: true, selector: "[ng2-st-thead]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, createConfirm: { classPropertyName: "createConfirm", publicName: "createConfirm", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { sort: "sort", selectAllRows: "selectAllRows", create: "create", filter: "filter" }, ngImport: i0, template: "@if (!isHideHeader()) {\n <tr ng2-st-thead-titles-row\n class=\"ng2-smart-titles\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (sort)=\"sort.emit($event)\"\n (selectAllRows)=\"selectAllRows.emit($event)\">\n </tr>\n}\n\n@if (!isHideSubHeader()) {\n <tr ng2-st-thead-filters-row\n class=\"ng2-smart-filters\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (create)=\"create.emit($event)\"\n (filter)=\"filter.emit($event)\">\n </tr>\n}\n\n@if (grid().createFormShown) {\n <tr ng2-st-thead-form-row\n [grid]=\"grid()\"\n [createConfirm]=\"createConfirm\">\n </tr>\n}\n", dependencies: [{ kind: "component", type: TheadTitlesRowComponent, selector: "[ng2-st-thead-titles-row]", inputs: ["grid", "source"], outputs: ["sort", "selectAllRows"] }, { kind: "component", type: TheadFiltersRowComponent, selector: "[ng2-st-thead-filters-row]", inputs: ["grid", "source"], outputs: ["create", "filter"] }, { kind: "component", type: TheadFormRowComponent, selector: "[ng2-st-thead-form-row]", inputs: ["grid", "createConfirm"], outputs: ["create"] }] }); }
3503
3389
  }
3504
3390
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTheadComponent, decorators: [{
3505
3391
  type: Component,
3506
- args: [{ selector: '[ng2-st-thead]', standalone: true, imports: [TheadTitlesRowComponent, TheadFitlersRowComponent, TheadFormRowComponent], template: "@if (!isHideHeader) {\n <tr ng2-st-thead-titles-row\n class=\"ng2-smart-titles\"\n [grid]=\"grid\"\n [source]=\"source\"\n (sort)=\"sort.emit($event)\"\n (selectAllRows)=\"selectAllRows.emit($event)\">\n </tr>\n}\n\n@if (!isHideSubHeader) {\n <tr ng2-st-thead-filters-row\n class=\"ng2-smart-filters\"\n [grid]=\"grid\"\n [source]=\"source\"\n (create)=\"create.emit($event)\"\n (filter)=\"filter.emit($event)\">\n </tr>\n}\n\n@if (grid.createFormShown) {\n <tr ng2-st-thead-form-row\n [grid]=\"grid\"\n [createConfirm]=\"createConfirm\">\n </tr>\n}\n" }]
3507
- }], propDecorators: { grid: [{
3508
- type: Input
3509
- }], source: [{
3510
- type: Input
3511
- }], createConfirm: [{
3392
+ args: [{ selector: "[ng2-st-thead]", standalone: true, imports: [
3393
+ TheadTitlesRowComponent,
3394
+ TheadFiltersRowComponent,
3395
+ TheadFormRowComponent,
3396
+ ], template: "@if (!isHideHeader()) {\n <tr ng2-st-thead-titles-row\n class=\"ng2-smart-titles\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (sort)=\"sort.emit($event)\"\n (selectAllRows)=\"selectAllRows.emit($event)\">\n </tr>\n}\n\n@if (!isHideSubHeader()) {\n <tr ng2-st-thead-filters-row\n class=\"ng2-smart-filters\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (create)=\"create.emit($event)\"\n (filter)=\"filter.emit($event)\">\n </tr>\n}\n\n@if (grid().createFormShown) {\n <tr ng2-st-thead-form-row\n [grid]=\"grid()\"\n [createConfirm]=\"createConfirm\">\n </tr>\n}\n" }]
3397
+ }], propDecorators: { createConfirm: [{
3512
3398
  type: Input
3513
3399
  }] } });
3514
3400
 
@@ -3525,66 +3411,26 @@ class Ng2SmartTableComponent {
3525
3411
  this.deleteConfirm = output();
3526
3412
  this.editConfirm = output();
3527
3413
  this.createConfirm = output();
3528
- this.rowHover = output();
3529
3414
  this.tableClass = "";
3530
3415
  this.tableId = "";
3531
3416
  this.perPageSelect = [];
3532
- this.isHideHeader = false;
3533
- this.isHideSubHeader = false;
3534
3417
  this.isPagerDisplay = false;
3535
- this.rowClassFunction = () => "";
3536
- this.defaultSettings = {
3537
- mode: "inline", // inline|external|click-to-edit
3538
- selectMode: "single", // single|multi
3539
- selectedRowIndex: -1,
3540
- switchPageToSelectedRowPage: false,
3541
- hideHeader: false,
3542
- hideSubHeader: false,
3543
- actions: {
3544
- columnTitle: "Actions",
3545
- add: true,
3546
- edit: true,
3547
- delete: true,
3548
- custom: [],
3549
- position: "left", // left|right
3550
- },
3551
- filter: {
3552
- inputClass: "",
3553
- },
3554
- edit: {
3555
- inputClass: "",
3556
- editButtonContent: "Edit",
3557
- saveButtonContent: "Update",
3558
- cancelButtonContent: "Cancel",
3559
- confirmSave: false,
3560
- },
3561
- add: {
3562
- inputClass: "",
3563
- addButtonContent: "Add New",
3564
- createButtonContent: "Create",
3565
- cancelButtonContent: "Cancel",
3566
- confirmCreate: false,
3567
- },
3568
- delete: {
3569
- deleteButtonContent: "Delete",
3570
- confirmDelete: false,
3571
- },
3572
- attr: {
3573
- id: "",
3574
- class: "",
3575
- },
3576
- noDataMessage: "No data found",
3577
- columns: [],
3578
- pager: false,
3579
- rowClassFunction: () => "",
3580
- };
3418
+ this.rowClassFunction = () => '';
3419
+ effect(() => {
3420
+ const settings = this.grid.settings();
3421
+ this.tableId = settings.attr?.id || getRandomId();
3422
+ this.tableClass = settings.attr?.class || '';
3423
+ this.isPagerDisplay = this.grid.getSetting("pager.display", false);
3424
+ this.perPageSelect = this.grid.getSetting("pager.perPageSelect");
3425
+ this.rowClassFunction = settings.rowClassFunction || (() => "");
3426
+ });
3581
3427
  }
3582
- ngOnChanges(changes) {
3428
+ ngOnChanges({ settings, source }) {
3583
3429
  if (this.grid) {
3584
- if (changes["settings"]) {
3585
- this.grid.setSettings(this.prepareSettings());
3430
+ if (settings) {
3431
+ this.grid.setSettings(this.settings);
3586
3432
  }
3587
- if (changes["source"]) {
3433
+ if (source) {
3588
3434
  this.source = this.prepareSource();
3589
3435
  this.grid.setSource(this.source);
3590
3436
  }
@@ -3592,13 +3438,6 @@ class Ng2SmartTableComponent {
3592
3438
  else {
3593
3439
  this.initGrid();
3594
3440
  }
3595
- this.tableId = this.grid.getSetting("attr.id");
3596
- this.tableClass = this.grid.getSetting("attr.class");
3597
- this.isHideHeader = this.grid.getSetting("hideHeader");
3598
- this.isHideSubHeader = this.grid.getSetting("hideSubHeader");
3599
- this.isPagerDisplay = this.grid.getSetting("pager.display", false);
3600
- this.perPageSelect = this.grid.getSetting("pager.perPageSelect");
3601
- this.rowClassFunction = this.grid.getSetting("rowClassFunction", () => "");
3602
3441
  }
3603
3442
  multipleSelectRow(row) {
3604
3443
  this.grid.multipleSelectRow(row);
@@ -3619,7 +3458,7 @@ class Ng2SmartTableComponent {
3619
3458
  }
3620
3459
  initGrid() {
3621
3460
  this.source = this.prepareSource();
3622
- this.grid = new Grid(this.source, this.prepareSettings());
3461
+ this.grid = new Grid(this.source, this.settings);
3623
3462
  this.grid.setColumnsSortedEmitter(this.columnsSorted);
3624
3463
  }
3625
3464
  prepareSource() {
@@ -3628,9 +3467,6 @@ class Ng2SmartTableComponent {
3628
3467
  }
3629
3468
  return new LocalDataSource();
3630
3469
  }
3631
- prepareSettings() {
3632
- return deepExtend({}, this.defaultSettings, this.settings);
3633
- }
3634
3470
  emitUserSelectRow(row) {
3635
3471
  this.multiRowSelect.emit({
3636
3472
  data: row ? row.getData() : null,
@@ -3640,7 +3476,7 @@ class Ng2SmartTableComponent {
3640
3476
  });
3641
3477
  }
3642
3478
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3643
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableComponent, isStandalone: true, selector: "ng2-smart-table", inputs: { source: "source", settings: "settings" }, outputs: { multiRowSelect: "multiRowSelect", rowClicked: "rowClicked", columnsSorted: "columnsSorted", delete: "delete", edit: "edit", editCancel: "editCancel", create: "create", custom: "custom", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm", createConfirm: "createConfirm", rowHover: "rowHover" }, usesOnChanges: true, ngImport: i0, template: "<table [id]=\"tableId\" [class]=\"tableClass\">\n\n @if (!isHideHeader || !isHideSubHeader) {\n <thead ng2-st-thead\n [grid]=\"grid\"\n [source]=\"source\"\n [createConfirm]=\"createConfirm\"\n (create)=\"create.emit($event)\"\n (selectAllRows)=\"onSelectAllRows()\">\n </thead>\n }\n\n <tbody ng2-st-tbody [grid]=\"grid\"\n [source]=\"source\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [rowClassFunction]=\"rowClassFunction\"\n (edit)=\"edit.emit($event)\"\n (editCancel)=\"editCancel.emit($event)\"\n (delete)=\"delete.emit($event)\"\n (custom)=\"custom.emit($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\">\n </tbody>\n\n</table>\n\n@if (isPagerDisplay) {\n <ng2-smart-table-pager\n [source]=\"source\"\n [perPageSelect]=\"perPageSelect\">\n </ng2-smart-table-pager>\n}\n", styles: [":host{font-size:1rem}:host ::ng-deep *{box-sizing:border-box}:host ::ng-deep button,:host ::ng-deep input,:host ::ng-deep optgroup,:host ::ng-deep select,:host ::ng-deep textarea{color:inherit;font:inherit;margin:0}:host ::ng-deep table{line-height:1.5em;border-collapse:collapse;border-spacing:0;display:table;width:100%;max-width:100%;word-break:normal;word-break:keep-all;overflow:auto}:host ::ng-deep table tr th{font-weight:700}:host ::ng-deep table tr section{font-size:.75em;font-weight:700}:host ::ng-deep table tr td,:host ::ng-deep table tr th{font-size:.875em;margin:0;padding:.5em 1em}:host ::ng-deep a{color:#1e6bb8;text-decoration:none}:host ::ng-deep a:hover{text-decoration:underline}\n"], dependencies: [{ kind: "component", type: Ng2SmartTableTheadComponent, selector: "[ng2-st-thead]", inputs: ["grid", "source", "createConfirm"], outputs: ["sort", "selectAllRows", "create", "filter"] }, { kind: "component", type: Ng2SmartTableTbodyComponent, selector: "[ng2-st-tbody]", inputs: ["grid", "source", "deleteConfirm", "editConfirm", "rowClassFunction"], outputs: ["save", "cancel", "edit", "editCancel", "delete", "custom", "edited", "userSelectRow", "userClickedRow", "editRowSelect", "multipleSelectRow"] }, { kind: "component", type: PagerComponent, selector: "ng2-smart-table-pager", inputs: ["source", "perPageSelect"], outputs: ["changePage"] }] }); }
3479
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableComponent, isStandalone: true, selector: "ng2-smart-table", inputs: { source: "source", settings: "settings" }, outputs: { multiRowSelect: "multiRowSelect", rowClicked: "rowClicked", columnsSorted: "columnsSorted", delete: "delete", edit: "edit", editCancel: "editCancel", create: "create", custom: "custom", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm", createConfirm: "createConfirm" }, usesOnChanges: true, ngImport: i0, template: "<table [id]=\"tableId\" [class]=\"tableClass\">\n <thead\n ng2-st-thead\n [grid]=\"grid\"\n [source]=\"source\"\n [createConfirm]=\"createConfirm\"\n (create)=\"create.emit($event)\"\n (selectAllRows)=\"onSelectAllRows()\"\n ></thead>\n\n <tbody\n ng2-st-tbody\n [grid]=\"grid\"\n [source]=\"source\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [createConfirm]=\"createConfirm\"\n [rowClassFunction]=\"rowClassFunction\"\n (edit)=\"edit.emit($event)\"\n (editCancel)=\"editCancel.emit($event)\"\n (delete)=\"delete.emit($event)\"\n (custom)=\"custom.emit($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\"\n ></tbody>\n</table>\n\n@if (isPagerDisplay) {\n<ng2-smart-table-pager [source]=\"source\" [perPageSelect]=\"perPageSelect\">\n</ng2-smart-table-pager>\n}\n", styles: [":host{font-size:1rem}:host ::ng-deep *{box-sizing:border-box}:host ::ng-deep button,:host ::ng-deep input,:host ::ng-deep optgroup,:host ::ng-deep select,:host ::ng-deep textarea{color:inherit;font:inherit;margin:0}:host ::ng-deep table{line-height:1.5em;border-collapse:collapse;border-spacing:0;display:table;width:100%;max-width:100%;word-break:normal;word-break:keep-all;overflow:auto}:host ::ng-deep table tr th{font-weight:700}:host ::ng-deep table tr section{font-size:.75em;font-weight:700}:host ::ng-deep table tr td,:host ::ng-deep table tr th{font-size:.875em;margin:0;padding:.5em 1em}:host ::ng-deep a{color:#1e6bb8;text-decoration:none}:host ::ng-deep a:hover{text-decoration:underline}\n"], dependencies: [{ kind: "component", type: Ng2SmartTableTheadComponent, selector: "[ng2-st-thead]", inputs: ["grid", "source", "createConfirm"], outputs: ["sort", "selectAllRows", "create", "filter"] }, { kind: "component", type: Ng2SmartTableTbodyComponent, selector: "[ng2-st-tbody]", inputs: ["grid", "source", "deleteConfirm", "createConfirm", "editConfirm", "rowClassFunction"], outputs: ["save", "edit", "editCancel", "delete", "custom", "edited", "userSelectRow", "userClickedRow", "multipleSelectRow"] }, { kind: "component", type: PagerComponent, selector: "ng2-smart-table-pager", inputs: ["source", "perPageSelect"], outputs: ["changePage"] }] }); }
3644
3480
  }
3645
3481
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableComponent, decorators: [{
3646
3482
  type: Component,
@@ -3648,11 +3484,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3648
3484
  Ng2SmartTableTheadComponent,
3649
3485
  Ng2SmartTableTbodyComponent,
3650
3486
  PagerComponent,
3651
- ], template: "<table [id]=\"tableId\" [class]=\"tableClass\">\n\n @if (!isHideHeader || !isHideSubHeader) {\n <thead ng2-st-thead\n [grid]=\"grid\"\n [source]=\"source\"\n [createConfirm]=\"createConfirm\"\n (create)=\"create.emit($event)\"\n (selectAllRows)=\"onSelectAllRows()\">\n </thead>\n }\n\n <tbody ng2-st-tbody [grid]=\"grid\"\n [source]=\"source\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [rowClassFunction]=\"rowClassFunction\"\n (edit)=\"edit.emit($event)\"\n (editCancel)=\"editCancel.emit($event)\"\n (delete)=\"delete.emit($event)\"\n (custom)=\"custom.emit($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\">\n </tbody>\n\n</table>\n\n@if (isPagerDisplay) {\n <ng2-smart-table-pager\n [source]=\"source\"\n [perPageSelect]=\"perPageSelect\">\n </ng2-smart-table-pager>\n}\n", styles: [":host{font-size:1rem}:host ::ng-deep *{box-sizing:border-box}:host ::ng-deep button,:host ::ng-deep input,:host ::ng-deep optgroup,:host ::ng-deep select,:host ::ng-deep textarea{color:inherit;font:inherit;margin:0}:host ::ng-deep table{line-height:1.5em;border-collapse:collapse;border-spacing:0;display:table;width:100%;max-width:100%;word-break:normal;word-break:keep-all;overflow:auto}:host ::ng-deep table tr th{font-weight:700}:host ::ng-deep table tr section{font-size:.75em;font-weight:700}:host ::ng-deep table tr td,:host ::ng-deep table tr th{font-size:.875em;margin:0;padding:.5em 1em}:host ::ng-deep a{color:#1e6bb8;text-decoration:none}:host ::ng-deep a:hover{text-decoration:underline}\n"] }]
3652
- }], propDecorators: { source: [{
3653
- type: Input
3487
+ ], template: "<table [id]=\"tableId\" [class]=\"tableClass\">\n <thead\n ng2-st-thead\n [grid]=\"grid\"\n [source]=\"source\"\n [createConfirm]=\"createConfirm\"\n (create)=\"create.emit($event)\"\n (selectAllRows)=\"onSelectAllRows()\"\n ></thead>\n\n <tbody\n ng2-st-tbody\n [grid]=\"grid\"\n [source]=\"source\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [createConfirm]=\"createConfirm\"\n [rowClassFunction]=\"rowClassFunction\"\n (edit)=\"edit.emit($event)\"\n (editCancel)=\"editCancel.emit($event)\"\n (delete)=\"delete.emit($event)\"\n (custom)=\"custom.emit($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\"\n ></tbody>\n</table>\n\n@if (isPagerDisplay) {\n<ng2-smart-table-pager [source]=\"source\" [perPageSelect]=\"perPageSelect\">\n</ng2-smart-table-pager>\n}\n", styles: [":host{font-size:1rem}:host ::ng-deep *{box-sizing:border-box}:host ::ng-deep button,:host ::ng-deep input,:host ::ng-deep optgroup,:host ::ng-deep select,:host ::ng-deep textarea{color:inherit;font:inherit;margin:0}:host ::ng-deep table{line-height:1.5em;border-collapse:collapse;border-spacing:0;display:table;width:100%;max-width:100%;word-break:normal;word-break:keep-all;overflow:auto}:host ::ng-deep table tr th{font-weight:700}:host ::ng-deep table tr section{font-size:.75em;font-weight:700}:host ::ng-deep table tr td,:host ::ng-deep table tr th{font-size:.875em;margin:0;padding:.5em 1em}:host ::ng-deep a{color:#1e6bb8;text-decoration:none}:host ::ng-deep a:hover{text-decoration:underline}\n"] }]
3488
+ }], ctorParameters: () => [], propDecorators: { source: [{
3489
+ type: Input,
3490
+ args: [{ required: true }]
3654
3491
  }], settings: [{
3655
- type: Input
3492
+ type: Input,
3493
+ args: [{ required: true }]
3656
3494
  }] } });
3657
3495
 
3658
3496
  /**