@den4ik92/ng2-smart-table 19.3.1 → 19.4.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 (42) hide show
  1. package/README.md +16 -17
  2. package/fesm2022/den4ik92-ng2-smart-table.mjs +1277 -1499
  3. package/fesm2022/den4ik92-ng2-smart-table.mjs.map +1 -1
  4. package/lib/components/cell/cell-edit-mode/edit-cell.component.d.ts +1 -2
  5. package/lib/components/cell/cell-editors/base-editor.component.d.ts +2 -3
  6. package/lib/components/cell/cell-view-mode/custom-view.component.d.ts +1 -1
  7. package/lib/components/cell/cell-view-mode/view-cell.component.d.ts +1 -1
  8. package/lib/components/cell/cell.component.d.ts +2 -3
  9. package/lib/components/filter/filter-types/checkbox-filter.component.d.ts +5 -6
  10. package/lib/components/filter/filter.component.d.ts +2 -5
  11. package/lib/components/table-columns-editor/column-editor.directive.d.ts +2 -2
  12. package/lib/components/tbody/create-cancel/create-cancel.component.d.ts +13 -0
  13. package/lib/components/tbody/row-actions/row-actions.component.d.ts +23 -0
  14. package/lib/components/tbody/tbody.component.d.ts +16 -18
  15. package/lib/components/tbody/trow/trow.component.d.ts +23 -0
  16. package/lib/components/thead/cells/actions-title.component.d.ts +1 -1
  17. package/lib/components/thead/cells/add-button.component.d.ts +3 -5
  18. package/lib/components/thead/cells/checkbox-select-all.component.d.ts +1 -1
  19. package/lib/components/thead/cells/title/title.component.d.ts +5 -7
  20. package/lib/components/thead/rows/thead-filters-row.component.d.ts +3 -2
  21. package/lib/components/thead/thead.component.d.ts +13 -5
  22. package/lib/lib/data-set/cell.d.ts +7 -11
  23. package/lib/lib/data-set/column.d.ts +2 -1
  24. package/lib/lib/data-set/data-set.d.ts +8 -8
  25. package/lib/lib/data-set/row.d.ts +6 -9
  26. package/lib/lib/data-source/data-source.d.ts +6 -6
  27. package/lib/lib/data-source/local/local.data-source.d.ts +1 -3
  28. package/lib/lib/data-source/local/local.filter.d.ts +2 -2
  29. package/lib/lib/data-source/local/local.sorter.d.ts +1 -1
  30. package/lib/lib/data-source/server/server.data-source.d.ts +0 -2
  31. package/lib/lib/grid.d.ts +3 -5
  32. package/lib/lib/helpers.d.ts +2 -1
  33. package/lib/lib/interfaces/smart-table.models.d.ts +52 -30
  34. package/lib/ng2-smart-table.component.d.ts +36 -18
  35. package/package.json +1 -1
  36. package/public-api.d.ts +1 -1
  37. package/lib/components/tbody/cells/create-cancel.component.d.ts +0 -16
  38. package/lib/components/tbody/cells/custom.component.d.ts +0 -15
  39. package/lib/components/tbody/cells/edit-delete.component.d.ts +0 -25
  40. package/lib/components/thead/cells/actions.component.d.ts +0 -10
  41. package/lib/components/thead/cells/column-title.component.d.ts +0 -9
  42. package/lib/components/thead/rows/thead-form-row.component.d.ts +0 -14
@@ -1,26 +1,25 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, Component, output, signal, effect, computed, inject, ElementRef, Directive, ViewContainerRef, ViewChild, ChangeDetectionStrategy, Input, ChangeDetectorRef, DestroyRef } from '@angular/core';
2
+ import { input, computed, Component, ChangeDetectionStrategy, output, signal, effect, inject, ElementRef, Directive, ViewContainerRef, ViewChild } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { UntypedFormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
- import { distinctUntilChanged, debounceTime, takeUntil, switchMap, map } from 'rxjs/operators';
5
+ import { distinctUntilChanged, debounceTime, takeUntil, switchMap, take } from 'rxjs/operators';
6
6
  import { Overlay, OverlayConfig } from '@angular/cdk/overlay';
7
7
  import { ComponentPortal } from '@angular/cdk/portal';
8
8
  import { Subject } from 'rxjs';
9
9
  import { moveItemInArray, CdkDropList, CdkDrag, CdkDragPlaceholder } from '@angular/cdk/drag-drop';
10
10
  import { NgComponentOutlet, NgTemplateOutlet } from '@angular/common';
11
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
12
11
 
13
12
  class BaseEditorComponent {
14
13
  constructor() {
15
14
  this.cell = input.required();
16
- this.inputClass = input('');
15
+ this.inputClass = computed(() => this.cell().column.editorInputClass);
17
16
  }
18
17
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
19
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: BaseEditorComponent, isStandalone: true, selector: "ng2-editor-base-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 }); }
18
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: BaseEditorComponent, isStandalone: true, selector: "ng2-editor-base-component", inputs: { cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
20
19
  }
21
20
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseEditorComponent, decorators: [{
22
21
  type: Component,
23
- args: [{ template: '', selector: 'ng2-editor-base-component' }]
22
+ args: [{ template: '', selector: 'ng2-editor-base-component', changeDetection: ChangeDetectionStrategy.OnPush }]
24
23
  }] });
25
24
 
26
25
  class BaseFilterComponent {
@@ -54,11 +53,11 @@ class BaseFilterComponent {
54
53
  this.filter.emit(query);
55
54
  }
56
55
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
57
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: BaseFilterComponent, isStandalone: true, selector: "ng2-base-filter-component", inputs: { query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { filter: "filter" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
56
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: BaseFilterComponent, isStandalone: true, selector: "ng2-base-filter-component", inputs: { query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { filter: "filter" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
58
57
  }
59
58
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseFilterComponent, decorators: [{
60
59
  type: Component,
61
- args: [{ template: '', selector: 'ng2-base-filter-component' }]
60
+ args: [{ template: '', selector: 'ng2-base-filter-component', changeDetection: ChangeDetectionStrategy.OnPush }]
62
61
  }] });
63
62
 
64
63
  /**
@@ -175,12 +174,26 @@ function getLocalStorage(key) {
175
174
  return null;
176
175
  }
177
176
  }
178
- function promiseDelay(time) {
179
- return new Promise((resolve) => {
180
- setTimeout(() => {
181
- resolve();
182
- }, time);
183
- });
177
+ function compareObjectsAsJSON(a, b) {
178
+ return JSON.stringify(a) === JSON.stringify(b);
179
+ }
180
+ function isObjectsIdentical(a, b) {
181
+ let compareIdKey = null;
182
+ if ('uuid' in a) {
183
+ compareIdKey = 'uuid';
184
+ }
185
+ else if ('id' in a) {
186
+ compareIdKey = 'id';
187
+ }
188
+ if (!compareIdKey) {
189
+ return compareObjectsAsJSON(a, b);
190
+ }
191
+ try {
192
+ return a[compareIdKey] === b[compareIdKey];
193
+ }
194
+ catch {
195
+ return compareObjectsAsJSON(a, b);
196
+ }
184
197
  }
185
198
 
186
199
  class TableColumnsEditorComponent {
@@ -215,11 +228,11 @@ class TableColumnsEditorComponent {
215
228
  this.stateHasChanged.set(JSON.stringify(this.grid()?.currentColumnsSortState) !== JSON.stringify(this.currentState));
216
229
  }
217
230
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TableColumnsEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
218
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TableColumnsEditorComponent, isStandalone: true, selector: "ng2-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 + i; 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"] }] }); }
231
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TableColumnsEditorComponent, isStandalone: true, selector: "ng2-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 + i; 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
219
232
  }
220
233
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TableColumnsEditorComponent, decorators: [{
221
234
  type: Component,
222
- args: [{ selector: 'ng2-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 + i; 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"] }]
235
+ args: [{ selector: 'ng2-table-columns-editor', imports: [CdkDropList, CdkDrag, CdkDragPlaceholder], changeDetection: ChangeDetectionStrategy.OnPush, 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 + i; 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"] }]
223
236
  }], ctorParameters: () => [] });
224
237
 
225
238
  class SmartTableColumnEditorDirective {
@@ -253,7 +266,7 @@ class SmartTableColumnEditorDirective {
253
266
  this.overlayRef?.dispose();
254
267
  this.destroy$.next();
255
268
  }
256
- buttclicked() {
269
+ buttonClicked() {
257
270
  this.showDropdown();
258
271
  }
259
272
  getOverlayConfig() {
@@ -306,40 +319,37 @@ class SmartTableColumnEditorDirective {
306
319
  });
307
320
  }
308
321
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SmartTableColumnEditorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
309
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.3", type: SmartTableColumnEditorDirective, isStandalone: true, selector: "[ng2SmartTableColumnEditor]", inputs: { tableComponent: { classPropertyName: "tableComponent", publicName: "tableComponent", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "buttclicked()" } }, ngImport: i0 }); }
322
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.3", type: SmartTableColumnEditorDirective, isStandalone: true, selector: "[ng2SmartTableColumnEditor]", inputs: { tableComponent: { classPropertyName: "tableComponent", publicName: "tableComponent", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "buttonClicked()" } }, ngImport: i0 }); }
310
323
  }
311
324
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SmartTableColumnEditorDirective, decorators: [{
312
325
  type: Directive,
313
326
  args: [{
314
327
  selector: '[ng2SmartTableColumnEditor]',
315
328
  host: {
316
- '(click)': 'buttclicked()',
329
+ '(click)': 'buttonClicked()',
317
330
  },
318
331
  }]
319
332
  }] });
320
333
 
321
334
  class Cell {
322
- constructor(value, row, column, dataSet) {
335
+ constructor(value, row, column) {
323
336
  this.value = value;
324
337
  this.row = row;
325
338
  this.column = column;
326
- this.dataSet = dataSet;
327
- this.prepareValue = (value) => value;
328
339
  this.newValue = '';
340
+ this.columnClass = '';
341
+ this.styles = '';
342
+ this.title = '';
343
+ this.id = '';
344
+ this.columnClass = column.class;
329
345
  this.newValue = value;
330
- }
331
- getColumn() {
332
- return this.column;
333
- }
334
- getColumnClass() {
335
- return this.column.class;
336
- }
337
- getRow() {
338
- return this.row;
346
+ this.styles = column.styles;
347
+ this.title = column.title;
348
+ this.id = column.id;
339
349
  }
340
350
  getValue() {
341
- const prepare = this.column.valuePrepareFunction || this.prepareValue;
342
- return prepare.call(null, this.value, this.row.getData(), this);
351
+ const prepare = this.column.valuePrepareFunction;
352
+ return !prepare ? this.value : prepare.call(null, this.value, this.row.rowData, this);
343
353
  }
344
354
  getNotPrepareValue() {
345
355
  return this.value;
@@ -347,18 +357,12 @@ class Cell {
347
357
  setValue(value) {
348
358
  this.newValue = value;
349
359
  }
350
- getId() {
351
- return this.getColumn().id;
352
- }
353
- getTitle() {
354
- return this.getColumn().title;
355
- }
356
360
  isEditable() {
357
- if (this.getRow().index === -1) {
358
- return this.getColumn().isAddable;
361
+ if (this.row.index === -1) {
362
+ return this.column.isAddable;
359
363
  }
360
364
  else {
361
- return this.getColumn().isEditable;
365
+ return this.column.isEditable;
362
366
  }
363
367
  }
364
368
  }
@@ -371,7 +375,7 @@ class Column {
371
375
  this.title = '';
372
376
  this.type = 'text';
373
377
  this.class = '';
374
- this.width = '';
378
+ this.editorInputClass = '';
375
379
  this.hide = false;
376
380
  this.isSortable = false;
377
381
  this.isEditable = true;
@@ -380,9 +384,10 @@ class Column {
380
384
  this.sortDirection = 'asc';
381
385
  this.editor = false;
382
386
  this.filter = false;
387
+ this.editorInputClass = dataSet.editorInputClass;
383
388
  this.title = settings.title;
384
389
  this.class = settings.class || '';
385
- this.width = settings.width || '';
390
+ this.styles = settings.style || '';
386
391
  this.hide = !!settings.hide;
387
392
  this.type = settings.type;
388
393
  if (settings?.editor) {
@@ -397,7 +402,7 @@ class Column {
397
402
  this.isFilterable = typeof settings.filter === 'undefined' ? true : !!settings['filter'];
398
403
  this.isSortable = settings.sort ?? true;
399
404
  this.isEditable = settings.editable ?? true;
400
- this.isAddable = settings.addable ?? false;
405
+ this.isAddable = settings.addable ?? true;
401
406
  this.sortDirection = settings.sortDirection || 'asc';
402
407
  this.compareFunction = settings.compareFunction;
403
408
  this.valuePrepareFunction = settings.valuePrepareFunction;
@@ -421,43 +426,33 @@ class Column {
421
426
  }
422
427
 
423
428
  class Row {
424
- constructor(index, data, _dataSet) {
429
+ constructor(index, rowData, columns) {
425
430
  this.index = index;
426
- this.data = data;
427
- this._dataSet = _dataSet;
431
+ this.rowData = rowData;
432
+ this.columns = columns;
428
433
  this.pending = signal(false);
429
434
  this.isSelected = signal(false);
430
435
  this.isInEditing = signal(false);
431
436
  this.cells = signal([]);
432
- this.visibleCells = computed(() => this.cells().filter((cell) => !cell.getColumn().hide));
437
+ this.visibleCells = computed(() => this.cells().filter((cell) => !cell.column.hide));
433
438
  this.process();
434
439
  }
435
- getCell(column) {
436
- return this.cells().find((el) => el.getColumn() === column);
437
- }
438
- getData() {
439
- return this.data;
440
- }
441
440
  getNewData() {
442
- const values = Object.assign({}, this.data);
443
- this.cells().forEach((cell) => (values[cell.getColumn().id] = cell.newValue));
441
+ const values = Object.assign({}, this.rowData);
442
+ this.cells().forEach((cell) => (values[cell.column.id] = cell.newValue));
444
443
  return values;
445
444
  }
446
- setData(data) {
447
- this.data = data;
445
+ setData(rowData) {
446
+ this.rowData = rowData;
448
447
  this.process();
449
448
  }
450
449
  process() {
451
- const cells = this._dataSet
452
- .getColumns()
453
- .map((column) => this.createCell(column));
450
+ const cells = this.columns.map((column) => this.createCell(column));
454
451
  this.cells.set(cells);
455
452
  }
456
453
  createCell(column) {
457
- const value = typeof this.data[column.id] === "undefined"
458
- ? ""
459
- : this.data[column.id];
460
- return new Cell(value, this, column, this._dataSet);
454
+ const value = typeof this.rowData[column.id] === 'undefined' ? '' : this.rowData[column.id];
455
+ return new Cell(value, this, column);
461
456
  }
462
457
  }
463
458
 
@@ -481,8 +476,8 @@ var SmartTableOnChangedEventName;
481
476
  class DataSource {
482
477
  constructor() {
483
478
  this.onChangedSource = new Subject();
484
- this.sortConf = { field: '', direction: 'asc' };
485
- this.filters = [];
479
+ this.sortConf = signal({ field: '', title: '', direction: 'desc' });
480
+ this.filters = signal([]);
486
481
  this.pagingConf = signal({
487
482
  page: 1,
488
483
  perPage: 100,
@@ -491,6 +486,8 @@ class DataSource {
491
486
  perPageSelect: [],
492
487
  });
493
488
  this.data = signal([]);
489
+ this.getSort = computed(() => this.sortConf());
490
+ this.getFilters = computed(() => this.filters());
494
491
  }
495
492
  refresh() {
496
493
  this.emitOnChanged({ action: SmartTableOnChangedEventName.refresh });
@@ -507,12 +504,12 @@ class DataSource {
507
504
  return Promise.resolve(true);
508
505
  }
509
506
  async appendMany(elements) {
510
- this.data.update((old) => [...old, ...elements,]);
507
+ this.data.update((old) => [...old, ...elements]);
511
508
  this.emitOnChanged({ action: SmartTableOnChangedEventName.appendMany, newItems: elements });
512
509
  return Promise.resolve(true);
513
510
  }
514
511
  async add(element) {
515
- this.data.update((old) => [...old, element,]);
512
+ this.data.update((old) => [...old, element]);
516
513
  this.emitOnChanged({ action: SmartTableOnChangedEventName.add, newItems: [element] });
517
514
  return Promise.resolve(true);
518
515
  }
@@ -532,7 +529,7 @@ class DataSource {
532
529
  return Promise.resolve(true);
533
530
  }
534
531
  setSort(conf, doEmit = true) {
535
- this.sortConf = conf;
532
+ this.sortConf.set(conf);
536
533
  this.pagingConf.update((old) => ({ ...old, page: 1 }));
537
534
  if (doEmit) {
538
535
  this.emitOnChanged({ action: SmartTableOnChangedEventName.sort });
@@ -542,19 +539,21 @@ class DataSource {
542
539
  if (!newFilter.field) {
543
540
  return;
544
541
  }
545
- const foundIndex = this.filters.findIndex((filter) => filter.field === newFilter.field);
542
+ const foundIndex = this.filters().findIndex((filter) => filter.field === newFilter.field);
546
543
  if (foundIndex === -1) {
547
544
  if (newFilter.search) {
548
- this.filters.push(newFilter);
545
+ this.filters.set([...this.filters(), newFilter]);
549
546
  }
550
547
  }
551
548
  else {
549
+ const filtersTemp = this.filters();
552
550
  if (newFilter.search) {
553
- this.filters[foundIndex].search = newFilter.search;
551
+ filtersTemp[foundIndex].search = newFilter.search;
554
552
  }
555
553
  else {
556
- this.filters.splice(foundIndex, 1);
554
+ filtersTemp.splice(foundIndex, 1);
557
555
  }
556
+ this.filters.set([...filtersTemp]);
558
557
  }
559
558
  this.pagingConf.update((old) => ({ ...old, page: 1 }));
560
559
  if (doEmit) {
@@ -562,7 +561,7 @@ class DataSource {
562
561
  }
563
562
  }
564
563
  setFilters(newFilters, doEmit = true) {
565
- this.filters = [...newFilters];
564
+ this.filters.set([...newFilters]);
566
565
  this.pagingConf.update((old) => ({ ...old, page: 1 }));
567
566
  if (doEmit) {
568
567
  this.emitOnChanged({ action: SmartTableOnChangedEventName.filter });
@@ -629,7 +628,7 @@ function compareValues(direction, a, b) {
629
628
  }
630
629
  class LocalSorter {
631
630
  static async sort(data, field, direction, customCompare) {
632
- const dir = direction === "asc" ? 1 : -1;
631
+ const dir = direction === 'asc' ? 1 : -1;
633
632
  const compare = customCompare ? customCompare : compareValues;
634
633
  return data.sort((a, b) => {
635
634
  return compare.call(null, dir, a[field], b[field]);
@@ -667,24 +666,18 @@ class LocalDataSource extends DataSource {
667
666
  }
668
667
  reset(silent = false) {
669
668
  if (silent) {
670
- this.filters = [];
671
- this.sortConf = { field: '', direction: 'asc' };
669
+ this.filters.set([]);
670
+ this.sortConf.set({ field: '', title: '', direction: 'asc' });
672
671
  this.pagingConf.update((old) => ({ ...old, page: 1 }));
673
672
  }
674
673
  else {
675
674
  this.setFilters([], false);
676
- this.setSort({ field: '', direction: 'asc' }, false);
675
+ this.setSort({ field: '', title: '', direction: 'asc' }, false);
677
676
  if (this.pagingConf().display) {
678
677
  this.setPage(1);
679
678
  }
680
679
  }
681
680
  }
682
- getSort() {
683
- return this.sortConf;
684
- }
685
- getFilters() {
686
- return this.filters;
687
- }
688
681
  async emitOnChanged(event, newElements) {
689
682
  let renderData = this.filteredAndSorted().slice(0);
690
683
  const action = event.action;
@@ -707,8 +700,8 @@ class LocalDataSource extends DataSource {
707
700
  }
708
701
  }
709
702
  async sort(data) {
710
- if (this.sortConf) {
711
- return LocalSorter.sort(data, this.sortConf.field, this.sortConf.direction, this.sortConf.compare);
703
+ if (this.sortConf()) {
704
+ return LocalSorter.sort(data, this.sortConf().field, this.sortConf().direction, this.sortConf().compare);
712
705
  }
713
706
  return data;
714
707
  }
@@ -718,7 +711,7 @@ class LocalDataSource extends DataSource {
718
711
  }
719
712
  const filtered = [];
720
713
  await Promise.all(data.map(async (element) => {
721
- if (await isElementSatisfied(element, this.filters)) {
714
+ if (await isElementSatisfied(element, this.filters())) {
722
715
  filtered.push(element);
723
716
  }
724
717
  }));
@@ -748,12 +741,6 @@ class ServerDataSource extends DataSource {
748
741
  getAll() {
749
742
  return Promise.resolve(this.data());
750
743
  }
751
- getSort() {
752
- return this.sortConf;
753
- }
754
- getFilters() {
755
- return this.filters;
756
- }
757
744
  emitOnChanged(eventData, newElements) {
758
745
  if ([
759
746
  SmartTableOnChangedEventName.filter,
@@ -763,12 +750,12 @@ class ServerDataSource extends DataSource {
763
750
  SmartTableOnChangedEventName.refresh,
764
751
  ].includes(eventData.action)) {
765
752
  this.paramPrepareFunction({
766
- sort: this.sortConf,
767
- filters: this.filters,
753
+ sort: this.sortConf(),
754
+ filters: this.filters(),
768
755
  page: this.pagingConf().page,
769
756
  limit: this.pagingConf().perPage,
770
757
  })
771
- .pipe(switchMap((params) => this.requestFunction(params)))
758
+ .pipe(switchMap((params) => this.requestFunction(params)), take(1))
772
759
  .subscribe((res) => {
773
760
  this.data.set(res.data);
774
761
  this.pagingConf.update((old) => ({ ...old, total: res.total }));
@@ -833,21 +820,21 @@ class PagerComponent {
833
820
  this.source().setPaging(1, +target.value);
834
821
  }
835
822
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: PagerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
836
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: PagerComponent, isStandalone: true, selector: "ng2-smart-table-pager", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@if (shouldShow()) {\n<div class=\"ng2-smart-pagination-wrap\">\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <div></div>\n }\n <nav class=\"ng2-smart-pagination-nav\">\n <ul class=\"ng2-smart-pagination pagination\">\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"currentPage() === 1 ? false : paginate(1)\"\n aria-label=\"First\">\n <span aria-hidden=\"true\">&laquo;</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link page-link-prev\"\n href=\"#\"\n (click)=\"currentPage() === 1 ? false : prev()\"\n aria-label=\"Prev\">\n <span aria-hidden=\"true\">&lt;</span>\n </a>\n </li>\n @for (page of pages(); track $index) {\n <li class=\"ng2-smart-page-item page-item\" [class.active]=\"currentPage() === page\">\n @if (currentPage() === page || isString(page)) {\n <span class=\"ng2-smart-page-link page-link\">{{ page }}</span>\n } @else {\n <a class=\"ng2-smart-page-link page-link\" href=\"#\" (click)=\"paginate(page)\">{{ page }}</a>\n }\n </li>\n }\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link page-link-next\"\n href=\"#\"\n (click)=\"currentPage() === lastPage() ? false : next()\"\n aria-label=\"Next\">\n <span aria-hidden=\"true\">&gt;</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"currentPage() === lastPage() ? false : paginate(lastPage())\"\n aria-label=\"Last\">\n <span aria-hidden=\"true\">&raquo;</span>\n </a>\n </li>\n </ul>\n </nav>\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <nav class=\"ng2-smart-pagination-per-page\">\n <label for=\"per-page\"> Per Page: </label>\n <select (change)=\"onChangePerPage($any($event.target))\" [ngModel]=\"currentPerPage()\" id=\"per-page\">\n @for (item of pagingConf().perPageSelect; track $index) {\n <option [value]=\"item\">{{ item }}</option>\n }\n </select>\n </nav>\n }\n</div>\n\n}\n", styles: [".ng2-smart-pagination{display:inline-flex;align-items:center;font-size:.875em;padding:0}.ng2-smart-pagination .ng2-smart-page-item{display:inline;padding:.2rem}.ng2-smart-pagination .page-link-next,.ng2-smart-pagination .page-link-prev{font-size:10px}.ng2-smart-pagination-nav{margin:0 auto}.ng2-smart-pagination-wrap{display:flex;align-items:center;justify-content:space-between}\n"], 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"] }] }); }
823
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: PagerComponent, isStandalone: true, selector: "ng2-smart-table-pager", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@if (shouldShow()) {\n<div class=\"ng2-smart-pagination-wrap\">\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <div></div>\n }\n <nav class=\"ng2-smart-pagination-nav\">\n <ul class=\"ng2-smart-pagination pagination\">\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"currentPage() === 1 ? false : paginate(1)\"\n aria-label=\"First\">\n <span aria-hidden=\"true\">&laquo;</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link page-link-prev\"\n href=\"#\"\n (click)=\"currentPage() === 1 ? false : prev()\"\n aria-label=\"Prev\">\n <span aria-hidden=\"true\">&lt;</span>\n </a>\n </li>\n @for (page of pages(); track $index) {\n <li class=\"ng2-smart-page-item page-item\" [class.active]=\"currentPage() === page\">\n @if (currentPage() === page || isString(page)) {\n <span class=\"ng2-smart-page-link page-link\">{{ page }}</span>\n } @else {\n <a class=\"ng2-smart-page-link page-link\" href=\"#\" (click)=\"paginate(page)\">{{ page }}</a>\n }\n </li>\n }\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link page-link-next\"\n href=\"#\"\n (click)=\"currentPage() === lastPage() ? false : next()\"\n aria-label=\"Next\">\n <span aria-hidden=\"true\">&gt;</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"currentPage() === lastPage() ? false : paginate(lastPage())\"\n aria-label=\"Last\">\n <span aria-hidden=\"true\">&raquo;</span>\n </a>\n </li>\n </ul>\n </nav>\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <nav class=\"ng2-smart-pagination-per-page\">\n <label for=\"per-page\"> Per Page: </label>\n <select (change)=\"onChangePerPage($any($event.target))\" [ngModel]=\"currentPerPage()\" id=\"per-page\">\n @for (item of pagingConf().perPageSelect; track $index) {\n <option [value]=\"item\">{{ item }}</option>\n }\n </select>\n </nav>\n }\n</div>\n\n}\n", styles: [".ng2-smart-pagination{display:inline-flex;align-items:center;font-size:.875em;padding:0}.ng2-smart-pagination .ng2-smart-page-item{display:inline;padding:.2rem}.ng2-smart-pagination .page-link-next,.ng2-smart-pagination .page-link-prev{font-size:10px}.ng2-smart-pagination-nav{margin:0 auto}.ng2-smart-pagination-wrap{display:flex;align-items:center;justify-content:space-between}\n"], 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
837
824
  }
838
825
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: PagerComponent, decorators: [{
839
826
  type: Component,
840
- args: [{ selector: 'ng2-smart-table-pager', standalone: true, imports: [FormsModule], template: "@if (shouldShow()) {\n<div class=\"ng2-smart-pagination-wrap\">\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <div></div>\n }\n <nav class=\"ng2-smart-pagination-nav\">\n <ul class=\"ng2-smart-pagination pagination\">\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"currentPage() === 1 ? false : paginate(1)\"\n aria-label=\"First\">\n <span aria-hidden=\"true\">&laquo;</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link page-link-prev\"\n href=\"#\"\n (click)=\"currentPage() === 1 ? false : prev()\"\n aria-label=\"Prev\">\n <span aria-hidden=\"true\">&lt;</span>\n </a>\n </li>\n @for (page of pages(); track $index) {\n <li class=\"ng2-smart-page-item page-item\" [class.active]=\"currentPage() === page\">\n @if (currentPage() === page || isString(page)) {\n <span class=\"ng2-smart-page-link page-link\">{{ page }}</span>\n } @else {\n <a class=\"ng2-smart-page-link page-link\" href=\"#\" (click)=\"paginate(page)\">{{ page }}</a>\n }\n </li>\n }\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link page-link-next\"\n href=\"#\"\n (click)=\"currentPage() === lastPage() ? false : next()\"\n aria-label=\"Next\">\n <span aria-hidden=\"true\">&gt;</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"currentPage() === lastPage() ? false : paginate(lastPage())\"\n aria-label=\"Last\">\n <span aria-hidden=\"true\">&raquo;</span>\n </a>\n </li>\n </ul>\n </nav>\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <nav class=\"ng2-smart-pagination-per-page\">\n <label for=\"per-page\"> Per Page: </label>\n <select (change)=\"onChangePerPage($any($event.target))\" [ngModel]=\"currentPerPage()\" id=\"per-page\">\n @for (item of pagingConf().perPageSelect; track $index) {\n <option [value]=\"item\">{{ item }}</option>\n }\n </select>\n </nav>\n }\n</div>\n\n}\n", styles: [".ng2-smart-pagination{display:inline-flex;align-items:center;font-size:.875em;padding:0}.ng2-smart-pagination .ng2-smart-page-item{display:inline;padding:.2rem}.ng2-smart-pagination .page-link-next,.ng2-smart-pagination .page-link-prev{font-size:10px}.ng2-smart-pagination-nav{margin:0 auto}.ng2-smart-pagination-wrap{display:flex;align-items:center;justify-content:space-between}\n"] }]
827
+ args: [{ selector: 'ng2-smart-table-pager', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule], template: "@if (shouldShow()) {\n<div class=\"ng2-smart-pagination-wrap\">\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <div></div>\n }\n <nav class=\"ng2-smart-pagination-nav\">\n <ul class=\"ng2-smart-pagination pagination\">\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"currentPage() === 1 ? false : paginate(1)\"\n aria-label=\"First\">\n <span aria-hidden=\"true\">&laquo;</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === 1\">\n <a\n class=\"ng2-smart-page-link page-link page-link-prev\"\n href=\"#\"\n (click)=\"currentPage() === 1 ? false : prev()\"\n aria-label=\"Prev\">\n <span aria-hidden=\"true\">&lt;</span>\n </a>\n </li>\n @for (page of pages(); track $index) {\n <li class=\"ng2-smart-page-item page-item\" [class.active]=\"currentPage() === page\">\n @if (currentPage() === page || isString(page)) {\n <span class=\"ng2-smart-page-link page-link\">{{ page }}</span>\n } @else {\n <a class=\"ng2-smart-page-link page-link\" href=\"#\" (click)=\"paginate(page)\">{{ page }}</a>\n }\n </li>\n }\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link page-link-next\"\n href=\"#\"\n (click)=\"currentPage() === lastPage() ? false : next()\"\n aria-label=\"Next\">\n <span aria-hidden=\"true\">&gt;</span>\n </a>\n </li>\n <li class=\"ng2-smart-page-item page-item\" [class.disabled]=\"currentPage() === lastPage()\">\n <a\n class=\"ng2-smart-page-link page-link\"\n href=\"#\"\n (click)=\"currentPage() === lastPage() ? false : paginate(lastPage())\"\n aria-label=\"Last\">\n <span aria-hidden=\"true\">&raquo;</span>\n </a>\n </li>\n </ul>\n </nav>\n @if ((pagingConf().perPageSelect?.length || 0) > 0) {\n <nav class=\"ng2-smart-pagination-per-page\">\n <label for=\"per-page\"> Per Page: </label>\n <select (change)=\"onChangePerPage($any($event.target))\" [ngModel]=\"currentPerPage()\" id=\"per-page\">\n @for (item of pagingConf().perPageSelect; track $index) {\n <option [value]=\"item\">{{ item }}</option>\n }\n </select>\n </nav>\n }\n</div>\n\n}\n", styles: [".ng2-smart-pagination{display:inline-flex;align-items:center;font-size:.875em;padding:0}.ng2-smart-pagination .ng2-smart-page-item{display:inline;padding:.2rem}.ng2-smart-pagination .page-link-next,.ng2-smart-pagination .page-link-prev{font-size:10px}.ng2-smart-pagination-nav{margin:0 auto}.ng2-smart-pagination-wrap{display:flex;align-items:center;justify-content:space-between}\n"] }]
841
828
  }] });
842
829
 
843
830
  class CheckboxEditorComponent extends BaseEditorComponent {
844
831
  constructor() {
845
832
  super();
846
833
  this.trueVal = computed(() => {
847
- return this.cell().getColumn().getEditorConfig()?.true || true;
834
+ return this.cell().column.getEditorConfig()?.true || true;
848
835
  });
849
836
  this.falseVal = computed(() => {
850
- return this.cell().getColumn().getEditorConfig()?.false || false;
837
+ return this.cell().column.getEditorConfig()?.false || false;
851
838
  });
852
839
  }
853
840
  onChange(event) {
@@ -859,11 +846,11 @@ class CheckboxEditorComponent extends BaseEditorComponent {
859
846
  [class]="inputClass()"
860
847
  type="checkbox"
861
848
  class="form-control"
862
- [name]="cell().getId()"
849
+ [name]="cell().id"
863
850
  [disabled]="!cell().isEditable()"
864
851
  (change)="onChange($event)"
865
852
  [checked]="cell().getValue() === trueVal()" />
866
- `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }); }
853
+ `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
867
854
  }
868
855
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxEditorComponent, decorators: [{
869
856
  type: Component,
@@ -872,11 +859,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
872
859
  [class]="inputClass()"
873
860
  type="checkbox"
874
861
  class="form-control"
875
- [name]="cell().getId()"
862
+ [name]="cell().id"
876
863
  [disabled]="!cell().isEditable()"
877
864
  (change)="onChange($event)"
878
865
  [checked]="cell().getValue() === trueVal()" />
879
- `, standalone: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
866
+ `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
880
867
  }], ctorParameters: () => [] });
881
868
 
882
869
  class InputEditorComponent extends BaseEditorComponent {
@@ -886,10 +873,10 @@ class InputEditorComponent extends BaseEditorComponent {
886
873
  [class]="inputClass()"
887
874
  class="form-control"
888
875
  [(ngModel)]="cell().newValue"
889
- [name]="cell().getId()"
890
- [placeholder]="cell().getTitle()"
876
+ [name]="cell().id"
877
+ [placeholder]="cell().title"
891
878
  [disabled]="!cell().isEditable()" />
892
- `, 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"] }] }); }
879
+ `, 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
893
880
  }
894
881
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputEditorComponent, decorators: [{
895
882
  type: Component,
@@ -898,10 +885,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
898
885
  [class]="inputClass()"
899
886
  class="form-control"
900
887
  [(ngModel)]="cell().newValue"
901
- [name]="cell().getId()"
902
- [placeholder]="cell().getTitle()"
888
+ [name]="cell().id"
889
+ [placeholder]="cell().title"
903
890
  [disabled]="!cell().isEditable()" />
904
- `, standalone: true, imports: [FormsModule], styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
891
+ `, changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule], styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
905
892
  }] });
906
893
 
907
894
  class SelectEditorComponent extends BaseEditorComponent {
@@ -911,15 +898,15 @@ class SelectEditorComponent extends BaseEditorComponent {
911
898
  [class]="inputClass()"
912
899
  class="form-control"
913
900
  [(ngModel)]="cell().newValue"
914
- [name]="cell().getId()"
901
+ [name]="cell().id"
915
902
  [disabled]="!cell().isEditable()">
916
- @for (option of cell().getColumn().getEditorConfig()?.list; track $index) {
917
- <option [value]="option.value" [selected]="option.value === cell().getValue()">
918
- {{ option.title }}
919
- </option>
903
+ @for (option of cell().column.getEditorConfig()?.list; track $index) {
904
+ <option [value]="option.value" [selected]="option.value === cell().getValue()">
905
+ {{ option.title }}
906
+ </option>
920
907
  }
921
908
  </select>
922
- `, 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"] }] }); }
909
+ `, 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
923
910
  }
924
911
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectEditorComponent, decorators: [{
925
912
  type: Component,
@@ -930,16 +917,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
930
917
  [class]="inputClass()"
931
918
  class="form-control"
932
919
  [(ngModel)]="cell().newValue"
933
- [name]="cell().getId()"
920
+ [name]="cell().id"
934
921
  [disabled]="!cell().isEditable()">
935
- @for (option of cell().getColumn().getEditorConfig()?.list; track $index) {
936
- <option [value]="option.value" [selected]="option.value === cell().getValue()">
937
- {{ option.title }}
938
- </option>
922
+ @for (option of cell().column.getEditorConfig()?.list; track $index) {
923
+ <option [value]="option.value" [selected]="option.value === cell().getValue()">
924
+ {{ option.title }}
925
+ </option>
939
926
  }
940
927
  </select>
941
928
  `,
942
- standalone: true,
929
+ changeDetection: ChangeDetectionStrategy.OnPush,
943
930
  imports: [FormsModule],
944
931
  }]
945
932
  }] });
@@ -951,11 +938,11 @@ class TextareaEditorComponent extends BaseEditorComponent {
951
938
  [class]="inputClass()"
952
939
  class="form-control"
953
940
  [(ngModel)]="cell().newValue"
954
- [name]="cell().getId()"
941
+ [name]="cell().id"
955
942
  [disabled]="!cell().isEditable()"
956
- [placeholder]="cell().getTitle()">
943
+ [placeholder]="cell().title">
957
944
  </textarea>
958
- `, 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"] }] }); }
945
+ `, 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
959
946
  }
960
947
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TextareaEditorComponent, decorators: [{
961
948
  type: Component,
@@ -964,18 +951,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
964
951
  [class]="inputClass()"
965
952
  class="form-control"
966
953
  [(ngModel)]="cell().newValue"
967
- [name]="cell().getId()"
954
+ [name]="cell().id"
968
955
  [disabled]="!cell().isEditable()"
969
- [placeholder]="cell().getTitle()">
956
+ [placeholder]="cell().title">
970
957
  </textarea>
971
- `, standalone: true, imports: [FormsModule], styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
958
+ `, changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule], styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
972
959
  }] });
973
960
 
974
961
  class BuildInEditorComponent extends BaseEditorComponent {
975
962
  constructor() {
976
963
  super(...arguments);
977
964
  this.editorType = computed(() => {
978
- const editor = this.cell().getColumn().editor;
965
+ const editor = this.cell().column.editor;
979
966
  if (editor) {
980
967
  return editor.type || 'text';
981
968
  }
@@ -983,16 +970,16 @@ class BuildInEditorComponent extends BaseEditorComponent {
983
970
  });
984
971
  }
985
972
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BuildInEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
986
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: BuildInEditorComponent, isStandalone: true, selector: "ng2-table-cell-build-in-editor", usesInheritance: true, ngImport: i0, template: "<div role=\"none\" (click)=\"$event.stopPropagation()\">\n @switch (editorType()) {\n @case ('list') {\n <ng2-select-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-select-editor>\n }\n @case ('textarea') {\n <ng2-textarea-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-textarea-editor>\n }\n @case ('checkbox') {\n <ng2-checkbox-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-checkbox-editor>\n }\n @default {\n <ng2-input-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-input-editor>\n }\n}\n</div>", dependencies: [{ kind: "component", type: SelectEditorComponent, selector: "ng2-select-editor" }, { kind: "component", type: TextareaEditorComponent, selector: "ng2-textarea-editor" }, { kind: "component", type: CheckboxEditorComponent, selector: "ng2-checkbox-editor" }, { kind: "component", type: InputEditorComponent, selector: "ng2-input-editor" }] }); }
973
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: BuildInEditorComponent, isStandalone: true, selector: "ng2-table-cell-build-in-editor", usesInheritance: true, ngImport: i0, template: "<div role=\"none\" (click)=\"$event.stopPropagation()\">\n @switch (editorType()) {\n @case ('list') {\n <ng2-select-editor [cell]=\"cell()\"> </ng2-select-editor>\n }\n @case ('textarea') {\n <ng2-textarea-editor [cell]=\"cell()\"> </ng2-textarea-editor>\n }\n @case ('checkbox') {\n <ng2-checkbox-editor [cell]=\"cell()\"> </ng2-checkbox-editor>\n }\n @default {\n <ng2-input-editor [cell]=\"cell()\"> </ng2-input-editor>\n }\n }\n</div>\n", dependencies: [{ kind: "component", type: SelectEditorComponent, selector: "ng2-select-editor" }, { kind: "component", type: TextareaEditorComponent, selector: "ng2-textarea-editor" }, { kind: "component", type: CheckboxEditorComponent, selector: "ng2-checkbox-editor" }, { kind: "component", type: InputEditorComponent, selector: "ng2-input-editor" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
987
974
  }
988
975
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BuildInEditorComponent, decorators: [{
989
976
  type: Component,
990
- args: [{ selector: 'ng2-table-cell-build-in-editor', imports: [SelectEditorComponent, TextareaEditorComponent, CheckboxEditorComponent, InputEditorComponent], standalone: true, template: "<div role=\"none\" (click)=\"$event.stopPropagation()\">\n @switch (editorType()) {\n @case ('list') {\n <ng2-select-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-select-editor>\n }\n @case ('textarea') {\n <ng2-textarea-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-textarea-editor>\n }\n @case ('checkbox') {\n <ng2-checkbox-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-checkbox-editor>\n }\n @default {\n <ng2-input-editor\n [cell]=\"cell()\"\n [inputClass]=\"inputClass()\">\n </ng2-input-editor>\n }\n}\n</div>" }]
977
+ args: [{ selector: 'ng2-table-cell-build-in-editor', imports: [SelectEditorComponent, TextareaEditorComponent, CheckboxEditorComponent, InputEditorComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div role=\"none\" (click)=\"$event.stopPropagation()\">\n @switch (editorType()) {\n @case ('list') {\n <ng2-select-editor [cell]=\"cell()\"> </ng2-select-editor>\n }\n @case ('textarea') {\n <ng2-textarea-editor [cell]=\"cell()\"> </ng2-textarea-editor>\n }\n @case ('checkbox') {\n <ng2-checkbox-editor [cell]=\"cell()\"> </ng2-checkbox-editor>\n }\n @default {\n <ng2-input-editor [cell]=\"cell()\"> </ng2-input-editor>\n }\n }\n</div>\n" }]
991
978
  }] });
992
979
 
993
980
  class CustomEditComponent extends BaseEditorComponent {
994
981
  ngOnChanges(changes) {
995
- const editor = this.cell().getColumn().editor;
982
+ const editor = this.cell().column.editor;
996
983
  if (this.customComponent) {
997
984
  if (this.customComponent?.instance && 'ngOnChanges' in this.customComponent.instance) {
998
985
  try {
@@ -1008,7 +995,6 @@ class CustomEditComponent extends BaseEditorComponent {
1008
995
  if (this.cell() && !this.customComponent && editor && editor.type == 'custom') {
1009
996
  this.customComponent = this.dynamicTarget?.createComponent(editor.component);
1010
997
  this.customComponent?.setInput('cell', this.cell());
1011
- this.customComponent?.setInput('inputClass', this.inputClass());
1012
998
  }
1013
999
  }
1014
1000
  ngOnDestroy() {
@@ -1017,14 +1003,14 @@ class CustomEditComponent extends BaseEditorComponent {
1017
1003
  }
1018
1004
  }
1019
1005
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1020
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: CustomEditComponent, isStandalone: true, selector: "ng2-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 }); }
1006
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: CustomEditComponent, isStandalone: true, selector: "ng2-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, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1021
1007
  }
1022
1008
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, decorators: [{
1023
1009
  type: Component,
1024
1010
  args: [{
1025
1011
  selector: 'ng2-table-cell-custom-editor',
1026
1012
  template: ` <ng-template #dynamicTarget></ng-template> `,
1027
- standalone: true,
1013
+ changeDetection: ChangeDetectionStrategy.OnPush,
1028
1014
  }]
1029
1015
  }], propDecorators: { dynamicTarget: [{
1030
1016
  type: ViewChild,
@@ -1034,25 +1020,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
1034
1020
  class EditCellComponent {
1035
1021
  constructor() {
1036
1022
  this.cell = input.required();
1037
- this.inputClass = input('');
1038
1023
  }
1024
+ // readonly inputClass = input('');
1039
1025
  getEditorType() {
1040
- const editor = this.cell().getColumn().editor;
1026
+ const editor = this.cell().column.editor;
1041
1027
  if (editor) {
1042
1028
  return editor.type;
1043
1029
  }
1044
1030
  return 'text';
1045
1031
  }
1046
1032
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1047
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: EditCellComponent, isStandalone: true, selector: "ng2-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: `
1033
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: EditCellComponent, isStandalone: true, selector: "ng2-table-cell-edit-mode", inputs: { cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
1048
1034
  <div>
1049
- @switch (getEditorType()) { @case ('custom') {
1050
- <ng2-table-cell-custom-editor [cell]="cell()" [inputClass]="inputClass()"> </ng2-table-cell-custom-editor>
1051
- } @default {
1052
- <ng2-table-cell-build-in-editor [cell]="cell()" [inputClass]="inputClass()"> </ng2-table-cell-build-in-editor>
1053
- } }
1035
+ @switch (getEditorType()) {
1036
+ @case ('custom') {
1037
+ <ng2-table-cell-custom-editor [cell]="cell()"> </ng2-table-cell-custom-editor>
1038
+ }
1039
+ @default {
1040
+ <ng2-table-cell-build-in-editor [cell]="cell()"> </ng2-table-cell-build-in-editor>
1041
+ }
1042
+ }
1054
1043
  </div>
1055
- `, isInline: true, dependencies: [{ kind: "component", type: CustomEditComponent, selector: "ng2-table-cell-custom-editor" }, { kind: "component", type: BuildInEditorComponent, selector: "ng2-table-cell-build-in-editor" }] }); }
1044
+ `, isInline: true, dependencies: [{ kind: "component", type: CustomEditComponent, selector: "ng2-table-cell-custom-editor" }, { kind: "component", type: BuildInEditorComponent, selector: "ng2-table-cell-build-in-editor" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1056
1045
  }
1057
1046
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellComponent, decorators: [{
1058
1047
  type: Component,
@@ -1060,14 +1049,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
1060
1049
  selector: 'ng2-table-cell-edit-mode',
1061
1050
  template: `
1062
1051
  <div>
1063
- @switch (getEditorType()) { @case ('custom') {
1064
- <ng2-table-cell-custom-editor [cell]="cell()" [inputClass]="inputClass()"> </ng2-table-cell-custom-editor>
1065
- } @default {
1066
- <ng2-table-cell-build-in-editor [cell]="cell()" [inputClass]="inputClass()"> </ng2-table-cell-build-in-editor>
1067
- } }
1052
+ @switch (getEditorType()) {
1053
+ @case ('custom') {
1054
+ <ng2-table-cell-custom-editor [cell]="cell()"> </ng2-table-cell-custom-editor>
1055
+ }
1056
+ @default {
1057
+ <ng2-table-cell-build-in-editor [cell]="cell()"> </ng2-table-cell-build-in-editor>
1058
+ }
1059
+ }
1068
1060
  </div>
1069
1061
  `,
1070
- standalone: true,
1062
+ changeDetection: ChangeDetectionStrategy.OnPush,
1071
1063
  imports: [CustomEditComponent, BuildInEditorComponent],
1072
1064
  }]
1073
1065
  }] });
@@ -1079,23 +1071,21 @@ class CustomViewComponent {
1079
1071
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1080
1072
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: CustomViewComponent, isStandalone: true, selector: "ng2-custom-view-component", inputs: { cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `<ng-template
1081
1073
  *ngComponentOutlet="
1082
- cell().getColumn().renderComponent;
1083
- inputs: { rowData: cell().getRow().getData(), value: cell().getValue() }
1084
- "
1085
- ></ng-template>`, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }] }); }
1074
+ cell().column.renderComponent;
1075
+ inputs: { rowData: cell().row.rowData, value: cell().getValue() }
1076
+ "></ng-template>`, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1086
1077
  }
1087
1078
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomViewComponent, decorators: [{
1088
1079
  type: Component,
1089
1080
  args: [{
1090
- selector: "ng2-custom-view-component",
1081
+ selector: 'ng2-custom-view-component',
1091
1082
  template: `<ng-template
1092
1083
  *ngComponentOutlet="
1093
- cell().getColumn().renderComponent;
1094
- inputs: { rowData: cell().getRow().getData(), value: cell().getValue() }
1095
- "
1096
- ></ng-template>`,
1084
+ cell().column.renderComponent;
1085
+ inputs: { rowData: cell().row.rowData, value: cell().getValue() }
1086
+ "></ng-template>`,
1097
1087
  imports: [NgComponentOutlet],
1098
- standalone: true,
1088
+ changeDetection: ChangeDetectionStrategy.OnPush,
1099
1089
  }]
1100
1090
  }] });
1101
1091
 
@@ -1106,33 +1096,40 @@ class ViewCellComponent {
1106
1096
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ViewCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1107
1097
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: ViewCellComponent, isStandalone: true, selector: "ng2-table-cell-view-mode", inputs: { cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
1108
1098
  <div>
1109
- @switch (cell().getColumn().type) { @case ('custom') {
1110
- <ng2-custom-view-component [cell]="cell()"></ng2-custom-view-component>
1111
- } @case ('html') {
1112
- <div [innerHTML]="cell().getValue()"></div>
1113
- } @default {
1114
- <div>{{ cell().getValue() }}</div>
1115
- } }
1099
+ @switch (cell().column.type) {
1100
+ @case ('custom') {
1101
+ <ng2-custom-view-component [cell]="cell()"></ng2-custom-view-component>
1102
+ }
1103
+ @case ('html') {
1104
+ <div [innerHTML]="cell().getValue()"></div>
1105
+ }
1106
+ @default {
1107
+ <div>{{ cell().getValue() }}</div>
1108
+ }
1109
+ }
1116
1110
  </div>
1117
1111
  `, isInline: true, dependencies: [{ kind: "component", type: CustomViewComponent, selector: "ng2-custom-view-component", inputs: ["cell"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1118
1112
  }
1119
1113
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ViewCellComponent, decorators: [{
1120
1114
  type: Component,
1121
1115
  args: [{
1122
- selector: "ng2-table-cell-view-mode",
1123
- changeDetection: ChangeDetectionStrategy.OnPush,
1116
+ selector: 'ng2-table-cell-view-mode',
1124
1117
  template: `
1125
1118
  <div>
1126
- @switch (cell().getColumn().type) { @case ('custom') {
1127
- <ng2-custom-view-component [cell]="cell()"></ng2-custom-view-component>
1128
- } @case ('html') {
1129
- <div [innerHTML]="cell().getValue()"></div>
1130
- } @default {
1131
- <div>{{ cell().getValue() }}</div>
1132
- } }
1119
+ @switch (cell().column.type) {
1120
+ @case ('custom') {
1121
+ <ng2-custom-view-component [cell]="cell()"></ng2-custom-view-component>
1122
+ }
1123
+ @case ('html') {
1124
+ <div [innerHTML]="cell().getValue()"></div>
1125
+ }
1126
+ @default {
1127
+ <div>{{ cell().getValue() }}</div>
1128
+ }
1129
+ }
1133
1130
  </div>
1134
1131
  `,
1135
- standalone: true,
1132
+ changeDetection: ChangeDetectionStrategy.OnPush,
1136
1133
  imports: [CustomViewComponent],
1137
1134
  }]
1138
1135
  }] });
@@ -1140,38 +1137,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
1140
1137
  class CellComponent {
1141
1138
  constructor() {
1142
1139
  this.cell = input.required();
1143
- this.inputClass = input('');
1144
1140
  this.isInEditing = input(false);
1145
1141
  }
1146
1142
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1147
- 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: `
1143
+ 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 }, isInEditing: { classPropertyName: "isInEditing", publicName: "isInEditing", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1148
1144
  @if (!isInEditing()) {
1149
- <ng2-table-cell-view-mode [cell]="cell()"></ng2-table-cell-view-mode>
1145
+ <ng2-table-cell-view-mode [cell]="cell()"></ng2-table-cell-view-mode>
1150
1146
  } @else {
1151
- <ng2-table-cell-edit-mode
1152
- [cell]="cell()"
1153
- [inputClass]="inputClass()"
1154
- >
1155
- </ng2-table-cell-edit-mode>
1147
+ <ng2-table-cell-edit-mode [cell]="cell()"> </ng2-table-cell-edit-mode>
1156
1148
  }
1157
- `, isInline: true, dependencies: [{ kind: "component", type: ViewCellComponent, selector: "ng2-table-cell-view-mode", inputs: ["cell"] }, { kind: "component", type: EditCellComponent, selector: "ng2-table-cell-edit-mode", inputs: ["cell", "inputClass"] }] }); }
1149
+ `, isInline: true, dependencies: [{ kind: "component", type: ViewCellComponent, selector: "ng2-table-cell-view-mode", inputs: ["cell"] }, { kind: "component", type: EditCellComponent, selector: "ng2-table-cell-edit-mode", inputs: ["cell"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1158
1150
  }
1159
1151
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CellComponent, decorators: [{
1160
1152
  type: Component,
1161
1153
  args: [{
1162
- selector: "ng2-smart-table-cell",
1154
+ selector: 'ng2-smart-table-cell',
1163
1155
  template: `
1164
1156
  @if (!isInEditing()) {
1165
- <ng2-table-cell-view-mode [cell]="cell()"></ng2-table-cell-view-mode>
1157
+ <ng2-table-cell-view-mode [cell]="cell()"></ng2-table-cell-view-mode>
1166
1158
  } @else {
1167
- <ng2-table-cell-edit-mode
1168
- [cell]="cell()"
1169
- [inputClass]="inputClass()"
1170
- >
1171
- </ng2-table-cell-edit-mode>
1159
+ <ng2-table-cell-edit-mode [cell]="cell()"> </ng2-table-cell-edit-mode>
1172
1160
  }
1173
1161
  `,
1174
- standalone: true,
1162
+ changeDetection: ChangeDetectionStrategy.OnPush,
1175
1163
  imports: [ViewCellComponent, EditCellComponent],
1176
1164
  }]
1177
1165
  }] });
@@ -1179,806 +1167,353 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
1179
1167
  class TbodyCreateCancelComponent {
1180
1168
  constructor() {
1181
1169
  this.grid = input.required();
1182
- this.row = input.required();
1183
- this.editConfirm = input.required();
1184
- this.editCancel = input.required();
1170
+ this.rowIndex = input();
1171
+ this.rowPending = input(false);
1172
+ this.save = output();
1173
+ this.cancelEdit = output();
1185
1174
  this.cancelButtonContent = computed(() => {
1186
1175
  const edit = this.grid().settings().edit;
1187
- return edit ? edit.cancelButtonContent || "Cancel" : "Cancel";
1176
+ return edit ? edit.cancelButtonContent || 'Cancel' : 'Cancel';
1188
1177
  });
1189
1178
  this.saveButtonContent = computed(() => {
1190
1179
  const edit = this.grid().settings().edit;
1191
- return edit ? edit.saveButtonContent || "Update" : "Update";
1180
+ return edit ? edit.saveButtonContent || 'Save' : 'Save';
1181
+ });
1182
+ }
1183
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyCreateCancelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1184
+ 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 }, rowIndex: { classPropertyName: "rowIndex", publicName: "rowIndex", isSignal: true, isRequired: false, transformFunction: null }, rowPending: { classPropertyName: "rowPending", publicName: "rowPending", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { save: "save", cancelEdit: "cancelEdit" }, ngImport: i0, template: "<div class=\"buttons-wrap\">\n @if (!rowPending()) {\n <a\n href=\"#\"\n [id]=\"'row-' + rowIndex() + '_editing-confirm-button'\"\n class=\"ng2-smart-action ng2-smart-action-edit-save\"\n [innerHTML]=\"saveButtonContent()\"\n (click)=\"$event.preventDefault(); save.emit($event)\"></a>\n <a\n href=\"#\"\n [id]=\"'row-' + rowIndex() + '_editing-cancel-button'\"\n class=\"ng2-smart-action ng2-smart-action-edit-cancel\"\n [innerHTML]=\"cancelButtonContent()\"\n (click)=\"$event.preventDefault(); cancelEdit.emit($event)\"></a>\n } @else {\n <div style=\"display: flex; gap:0.5rem\">\n <ng-container [ngTemplateOutlet]=\"spinner\"></ng-container>\n <ng-container [ngTemplateOutlet]=\"spinner\"></ng-container>\n </div>\n }\n</div>\n\n\n<ng-template #spinner>\n <svg\n role=\"none\"\n (click)=\"$event.stopPropagation()\"\n style=\"height: 2rem; width: 2rem\"\n version=\"1.1\"\n id=\"L9\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 100 100\"\n enable-background=\"new 0 0 0 0\"\n xml:space=\"preserve\">\n <path\n fill=\"#e9e9e9\"\n 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\">\n <animateTransform\n attributeName=\"transform\"\n attributeType=\"XML\"\n type=\"rotate\"\n dur=\"1s\"\n from=\"0 50 50\"\n to=\"360 50 50\"\n repeatCount=\"indefinite\" />\n </path>\n </svg>\n</ng-template>", styles: [".buttons-wrap{display:flex;gap:.5rem}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1185
+ }
1186
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyCreateCancelComponent, decorators: [{
1187
+ type: Component,
1188
+ args: [{ selector: 'ng2-st-tbody-create-cancel', imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"buttons-wrap\">\n @if (!rowPending()) {\n <a\n href=\"#\"\n [id]=\"'row-' + rowIndex() + '_editing-confirm-button'\"\n class=\"ng2-smart-action ng2-smart-action-edit-save\"\n [innerHTML]=\"saveButtonContent()\"\n (click)=\"$event.preventDefault(); save.emit($event)\"></a>\n <a\n href=\"#\"\n [id]=\"'row-' + rowIndex() + '_editing-cancel-button'\"\n class=\"ng2-smart-action ng2-smart-action-edit-cancel\"\n [innerHTML]=\"cancelButtonContent()\"\n (click)=\"$event.preventDefault(); cancelEdit.emit($event)\"></a>\n } @else {\n <div style=\"display: flex; gap:0.5rem\">\n <ng-container [ngTemplateOutlet]=\"spinner\"></ng-container>\n <ng-container [ngTemplateOutlet]=\"spinner\"></ng-container>\n </div>\n }\n</div>\n\n\n<ng-template #spinner>\n <svg\n role=\"none\"\n (click)=\"$event.stopPropagation()\"\n style=\"height: 2rem; width: 2rem\"\n version=\"1.1\"\n id=\"L9\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 100 100\"\n enable-background=\"new 0 0 0 0\"\n xml:space=\"preserve\">\n <path\n fill=\"#e9e9e9\"\n 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\">\n <animateTransform\n attributeName=\"transform\"\n attributeType=\"XML\"\n type=\"rotate\"\n dur=\"1s\"\n from=\"0 50 50\"\n to=\"360 50 50\"\n repeatCount=\"indefinite\" />\n </path>\n </svg>\n</ng-template>", styles: [".buttons-wrap{display:flex;gap:.5rem}\n"] }]
1189
+ }] });
1190
+
1191
+ class RowActionsComponent {
1192
+ constructor() {
1193
+ this.grid = input.required();
1194
+ this.row = input.required();
1195
+ this.editEmitter = output();
1196
+ this.deleteEmitter = output();
1197
+ this.customActionEmitter = output();
1198
+ this.customActions = computed(() => {
1199
+ const { actions } = this.grid().settings();
1200
+ if (!actions || !actions.custom) {
1201
+ return [];
1202
+ }
1203
+ const list = actions.custom.filter((action) => !action.hasPermissionFunction ? true : action.hasPermissionFunction(this.row().rowData));
1204
+ return list;
1205
+ });
1206
+ this.isActionEditActive = computed(() => {
1207
+ const actions = this.grid().settings().actions;
1208
+ const editConfig = this.grid().settings().edit;
1209
+ if (!actions || !actions.edit) {
1210
+ return false;
1211
+ }
1212
+ if (!editConfig || !editConfig.hasPermissionFunction) {
1213
+ return true;
1214
+ }
1215
+ return editConfig.hasPermissionFunction(this.row().rowData);
1216
+ });
1217
+ this.isActionDeleteActive = computed(() => {
1218
+ const actions = this.grid().settings().actions;
1219
+ const deleteConfig = this.grid().settings().delete;
1220
+ if (!actions || !actions.delete) {
1221
+ return false;
1222
+ }
1223
+ if (!deleteConfig || !deleteConfig.hasPermissionFunction) {
1224
+ return true;
1225
+ }
1226
+ return deleteConfig.hasPermissionFunction(this.row().rowData);
1227
+ });
1228
+ this.isExternalMode = computed(() => {
1229
+ return this.grid().settings().mode === 'external';
1230
+ });
1231
+ this.editRowButtonContent = computed(() => {
1232
+ const edit = this.grid().settings().edit;
1233
+ return edit ? edit.editButtonContent || 'Edit' : 'Edit';
1192
1234
  });
1235
+ this.deleteRowButtonContent = computed(() => {
1236
+ const deleteConfig = this.grid().settings().delete;
1237
+ return deleteConfig ? deleteConfig.deleteButtonContent || 'Delete' : 'Delete';
1238
+ });
1239
+ this.allActionsCountArray = computed(() => {
1240
+ let length = this.customActions().length;
1241
+ length += this.isActionDeleteActive() ? 1 : 0;
1242
+ length += this.isActionEditActive() ? 1 : 0;
1243
+ return new Array(length).fill('');
1244
+ });
1245
+ }
1246
+ onCustom(action) {
1247
+ this.customActionEmitter.emit(action.name);
1193
1248
  }
1194
- onSave(event) {
1249
+ onEdit(event) {
1195
1250
  event.preventDefault();
1196
1251
  event.stopPropagation();
1197
- this.grid().save(this.row(), this.editConfirm());
1252
+ this.editEmitter.emit();
1198
1253
  }
1199
- onCancelEdit(event) {
1254
+ onDelete(event) {
1200
1255
  event.preventDefault();
1201
1256
  event.stopPropagation();
1202
- this.editCancel().emit(true);
1203
- this.row().isInEditing.set(false);
1257
+ this.deleteEmitter.emit();
1204
1258
  }
1205
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyCreateCancelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1206
- 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: `
1207
- @if (!row().pending()) {
1208
- <a
1209
- href="#"
1210
- [id]="'row-' + row().index + '_editing-confirm-button'"
1211
- class="ng2-smart-action ng2-smart-action-edit-save"
1212
- [innerHTML]="saveButtonContent()"
1213
- (click)="onSave($event)"
1214
- ></a>
1215
- <a
1216
- href="#"
1217
- [id]="'row-' + row().index + '_editing-cancel-button'"
1218
- class="ng2-smart-action ng2-smart-action-edit-cancel"
1219
- [innerHTML]="cancelButtonContent()"
1220
- (click)="onCancelEdit($event)"
1221
- ></a>
1222
- } @else {
1223
- <div style="display: flex;">
1224
- <svg
1225
- role="none"
1226
- (click)="$event.stopPropagation()"
1227
- style="height: 2rem; width: 2rem;"
1228
- version="1.1"
1229
- id="L9"
1230
- xmlns="http://www.w3.org/2000/svg"
1231
- xmlns:xlink="http://www.w3.org/1999/xlink"
1232
- x="0px"
1233
- y="0px"
1234
- viewBox="0 0 100 100"
1235
- enable-background="new 0 0 0 0"
1236
- xml:space="preserve"
1237
- >
1238
- <path
1239
- fill="#e9e9e9"
1240
- 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"
1241
- >
1242
- <animateTransform
1243
- attributeName="transform"
1244
- attributeType="XML"
1245
- type="rotate"
1246
- dur="1s"
1247
- from="0 50 50"
1248
- to="360 50 50"
1249
- repeatCount="indefinite"
1250
- />
1251
- </path>
1252
- </svg>
1253
- <svg
1254
- role="none"
1255
- (click)="$event.stopPropagation()"
1256
- style="height: 2rem; width: 2rem; "
1257
- version="1.1"
1258
- id="L9"
1259
- xmlns="http://www.w3.org/2000/svg"
1260
- xmlns:xlink="http://www.w3.org/1999/xlink"
1261
- x="0px"
1262
- y="0px"
1263
- viewBox="0 0 100 100"
1264
- enable-background="new 0 0 0 0"
1265
- xml:space="preserve"
1266
- >
1267
- <path
1268
- fill="#e9e9e9"
1269
- 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"
1270
- >
1271
- <animateTransform
1272
- attributeName="transform"
1273
- attributeType="XML"
1274
- type="rotate"
1275
- dur="1s"
1276
- from="0 50 50"
1277
- to="360 50 50"
1278
- repeatCount="indefinite"
1279
- />
1280
- </path>
1281
- </svg>
1282
- </div>
1259
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: RowActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1260
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: RowActionsComponent, isStandalone: true, selector: "ng2-row-actions", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { editEmitter: "editEmitter", deleteEmitter: "deleteEmitter", customActionEmitter: "customActionEmitter" }, ngImport: i0, template: "@if (!row().pending()) {\n @if (isActionEditActive()) {\n <a\n href=\"#\"\n [id]=\"'row-' + row().index + '_action-edit-button'\"\n class=\"ng2-smart-action ng2-smart-action-edit-edit\"\n [innerHTML]=\"editRowButtonContent()\"\n (click)=\"onEdit($event)\"></a>\n }\n @if (isActionDeleteActive()) {\n <a\n href=\"#\"\n [id]=\"'row-' + row().index + '_action-delete-button'\"\n class=\"ng2-smart-action ng2-smart-action-delete-delete\"\n [innerHTML]=\"deleteRowButtonContent()\"\n (click)=\"onDelete($event)\"></a>\n }\n @for (action of customActions(); track action.name) {\n <a\n [id]=\"'row-' + row().index + '_action-' + action.name + '-button'\"\n href=\"#\"\n class=\"ng2-smart-action ng2-smart-action-custom-custom\"\n [innerHTML]=\"action.title\"\n (click)=\"$event.stopPropagation(); $event.preventDefault(); onCustom(action)\"></a>\n }\n} @else {\n @for (item of allActionsCountArray(); track $index) {\n <ng-container [ngTemplateOutlet]=\"spinner\"></ng-container>\n }\n}\n\n<ng-template #spinner>\n <svg\n role=\"none\"\n (click)=\"$event.stopPropagation()\"\n style=\"height: 2rem; width: 2rem\"\n version=\"1.1\"\n id=\"L9\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 100 100\"\n enable-background=\"new 0 0 0 0\"\n xml:space=\"preserve\">\n <path\n fill=\"#e9e9e9\"\n 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\">\n <animateTransform\n attributeName=\"transform\"\n attributeType=\"XML\"\n type=\"rotate\"\n dur=\"1s\"\n from=\"0 50 50\"\n to=\"360 50 50\"\n repeatCount=\"indefinite\" />\n </path>\n </svg>\n</ng-template>\n", styles: ["a~a{margin-left:.5rem}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1261
+ }
1262
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: RowActionsComponent, decorators: [{
1263
+ type: Component,
1264
+ args: [{ selector: 'ng2-row-actions', imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (!row().pending()) {\n @if (isActionEditActive()) {\n <a\n href=\"#\"\n [id]=\"'row-' + row().index + '_action-edit-button'\"\n class=\"ng2-smart-action ng2-smart-action-edit-edit\"\n [innerHTML]=\"editRowButtonContent()\"\n (click)=\"onEdit($event)\"></a>\n }\n @if (isActionDeleteActive()) {\n <a\n href=\"#\"\n [id]=\"'row-' + row().index + '_action-delete-button'\"\n class=\"ng2-smart-action ng2-smart-action-delete-delete\"\n [innerHTML]=\"deleteRowButtonContent()\"\n (click)=\"onDelete($event)\"></a>\n }\n @for (action of customActions(); track action.name) {\n <a\n [id]=\"'row-' + row().index + '_action-' + action.name + '-button'\"\n href=\"#\"\n class=\"ng2-smart-action ng2-smart-action-custom-custom\"\n [innerHTML]=\"action.title\"\n (click)=\"$event.stopPropagation(); $event.preventDefault(); onCustom(action)\"></a>\n }\n} @else {\n @for (item of allActionsCountArray(); track $index) {\n <ng-container [ngTemplateOutlet]=\"spinner\"></ng-container>\n }\n}\n\n<ng-template #spinner>\n <svg\n role=\"none\"\n (click)=\"$event.stopPropagation()\"\n style=\"height: 2rem; width: 2rem\"\n version=\"1.1\"\n id=\"L9\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 100 100\"\n enable-background=\"new 0 0 0 0\"\n xml:space=\"preserve\">\n <path\n fill=\"#e9e9e9\"\n 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\">\n <animateTransform\n attributeName=\"transform\"\n attributeType=\"XML\"\n type=\"rotate\"\n dur=\"1s\"\n from=\"0 50 50\"\n to=\"360 50 50\"\n repeatCount=\"indefinite\" />\n </path>\n </svg>\n</ng-template>\n", styles: ["a~a{margin-left:.5rem}\n"] }]
1265
+ }] });
1266
+
1267
+ class TrowComponent {
1268
+ constructor() {
1269
+ this.grid = input.required();
1270
+ this.source = input.required();
1271
+ this.row = input.required();
1272
+ this.isMobileView = input(false);
1273
+ this.isCreateRow = input(false);
1274
+ this.edit = output();
1275
+ this.editCancel = output();
1276
+ this.editConfirmed = output();
1277
+ this.deleteEmitter = output();
1278
+ this.createConfirmed = output();
1279
+ this.customActionEmitter = output();
1280
+ this.userClickedRow = output();
1281
+ this.multipleSelectRow = output();
1282
+ }
1283
+ onSave() {
1284
+ if (this.isCreateRow()) {
1285
+ this.createConfirmed.emit();
1286
+ }
1287
+ else {
1288
+ this.editConfirmed.emit();
1289
+ }
1290
+ }
1291
+ onCancelEdit() {
1292
+ if (this.isCreateRow()) {
1293
+ this.grid().createFormShown.set(false);
1294
+ return;
1295
+ }
1296
+ this.editCancel.emit();
1297
+ this.row()?.isInEditing.set(false);
1298
+ }
1299
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TrowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1300
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TrowComponent, isStandalone: true, selector: "[ng2-st-trow]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null }, isMobileView: { classPropertyName: "isMobileView", publicName: "isMobileView", isSignal: true, isRequired: false, transformFunction: null }, isCreateRow: { classPropertyName: "isCreateRow", publicName: "isCreateRow", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { edit: "edit", editCancel: "editCancel", editConfirmed: "editConfirmed", deleteEmitter: "deleteEmitter", createConfirmed: "createConfirmed", customActionEmitter: "customActionEmitter", userClickedRow: "userClickedRow", multipleSelectRow: "multipleSelectRow" }, host: { properties: { "class.ng2-smart-card": "isMobileView()" } }, ngImport: i0, template: "@if (isMobileView()) {\n <td colspan=\"50\">\n <div class=\"ng2-smart-card-header\">\n <ng-container [ngTemplateOutlet]=\"multiselectCheckbox\"></ng-container>\n <div class=\"ng2-smart-card-actions\">\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n </div>\n </div>\n <div class=\"ng2-smart-card-content\">\n @for (cell of row().visibleCells(); track cell.id + $index) {\n <div class=\"ng2-smart-card-field\">\n <div class=\"ng2-smart-card-field-label\">{{ cell.title }}</div>\n <div class=\"ng2-smart-card-field-value\">\n <ng2-smart-table-cell [cell]=\"cell\" [isInEditing]=\"!!row().isInEditing()\"> </ng2-smart-table-cell>\n </div>\n </div>\n }\n </div>\n </td>\n} @else {\n <ng-container [ngTemplateOutlet]=\"multiselectCheckbox\"></ng-container>\n @if (grid().actionIsOnLeft()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n }\n @for (cell of row().visibleCells(); track cell.id + $index) {\n <td\n [class]=\"cell.columnClass\"\n [style]=\"cell.styles\">\n <ng2-smart-table-cell [cell]=\"cell\" [isInEditing]=\"!!row().isInEditing()\"> </ng2-smart-table-cell>\n </td>\n }\n @if (grid().actionIsOnRight()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n }\n}\n\n<ng-template #actions>\n @if (isCreateRow() || row().isInEditing()) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid()\"\n [rowIndex]=\"row().index || 0\"\n (cancelEdit)=\"onCancelEdit()\"\n (save)=\"onSave()\"\n [rowPending]=\"!!row().pending()\"></ng2-st-tbody-create-cancel>\n </td>\n } @else {\n @if (grid().isActionsVisible()) {\n <td class=\"ng2-smart-actions\" (click)=\"$event.stopPropagation()\">\n <ng2-row-actions\n [grid]=\"grid()\"\n [row]=\"row()\"\n (customActionEmitter)=\"customActionEmitter.emit($event)\"\n (editEmitter)=\"edit.emit()\"\n (deleteEmitter)=\"deleteEmitter.emit()\"></ng2-row-actions>\n </td>\n }\n }\n</ng-template>\n\n<ng-template #multiselectCheckbox>\n @if (grid().isMultiSelectVisible() && !isCreateRow()) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row())\">\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row().index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row().isSelected()\" />\n </td>\n } @else {\n <p></p>\n }\n</ng-template>\n", styles: [":host .ng2-smart-action-multiple-select{margin-right:.5rem}:host.ng2-smart-card{display:block;margin-bottom:1rem;border-radius:.5rem;overflow:hidden;box-shadow:var(--table-card-shadow, 0 0 8px 5px rgba(215, 215, 215, .568627451));background-color:var(--table-card-background-color, #ffffff)}:host.ng2-smart-card td{display:block;padding:0;border:none}:host.ng2-smart-card td .ng2-smart-card-header{display:flex;align-items:center;gap:.5rem;justify-content:space-between;padding:.5rem}:host.ng2-smart-card td .ng2-smart-card-content{padding:1rem;display:grid;gap:.75rem}@media (min-width: 400px){:host.ng2-smart-card td .ng2-smart-card-content{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}}:host.ng2-smart-card td .ng2-smart-card-content .ng2-smart-card-field .ng2-smart-card-field-label{font-weight:600;color:inherit;margin-bottom:.35rem;font-size:.9em}:host.ng2-smart-card td .ng2-smart-card-content .ng2-smart-card-field .ng2-smart-card-field-value{word-break:break-word}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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: CellComponent, selector: "ng2-smart-table-cell", inputs: ["cell", "isInEditing"] }, { kind: "component", type: RowActionsComponent, selector: "ng2-row-actions", inputs: ["grid", "row"], outputs: ["editEmitter", "deleteEmitter", "customActionEmitter"] }, { kind: "component", type: TbodyCreateCancelComponent, selector: "ng2-st-tbody-create-cancel", inputs: ["grid", "rowIndex", "rowPending"], outputs: ["save", "cancelEdit"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1301
+ }
1302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TrowComponent, decorators: [{
1303
+ type: Component,
1304
+ args: [{ selector: '[ng2-st-trow]', imports: [NgTemplateOutlet, FormsModule, CellComponent, RowActionsComponent, TbodyCreateCancelComponent], host: {
1305
+ '[class.ng2-smart-card]': 'isMobileView()',
1306
+ }, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (isMobileView()) {\n <td colspan=\"50\">\n <div class=\"ng2-smart-card-header\">\n <ng-container [ngTemplateOutlet]=\"multiselectCheckbox\"></ng-container>\n <div class=\"ng2-smart-card-actions\">\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n </div>\n </div>\n <div class=\"ng2-smart-card-content\">\n @for (cell of row().visibleCells(); track cell.id + $index) {\n <div class=\"ng2-smart-card-field\">\n <div class=\"ng2-smart-card-field-label\">{{ cell.title }}</div>\n <div class=\"ng2-smart-card-field-value\">\n <ng2-smart-table-cell [cell]=\"cell\" [isInEditing]=\"!!row().isInEditing()\"> </ng2-smart-table-cell>\n </div>\n </div>\n }\n </div>\n </td>\n} @else {\n <ng-container [ngTemplateOutlet]=\"multiselectCheckbox\"></ng-container>\n @if (grid().actionIsOnLeft()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n }\n @for (cell of row().visibleCells(); track cell.id + $index) {\n <td\n [class]=\"cell.columnClass\"\n [style]=\"cell.styles\">\n <ng2-smart-table-cell [cell]=\"cell\" [isInEditing]=\"!!row().isInEditing()\"> </ng2-smart-table-cell>\n </td>\n }\n @if (grid().actionIsOnRight()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n }\n}\n\n<ng-template #actions>\n @if (isCreateRow() || row().isInEditing()) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid()\"\n [rowIndex]=\"row().index || 0\"\n (cancelEdit)=\"onCancelEdit()\"\n (save)=\"onSave()\"\n [rowPending]=\"!!row().pending()\"></ng2-st-tbody-create-cancel>\n </td>\n } @else {\n @if (grid().isActionsVisible()) {\n <td class=\"ng2-smart-actions\" (click)=\"$event.stopPropagation()\">\n <ng2-row-actions\n [grid]=\"grid()\"\n [row]=\"row()\"\n (customActionEmitter)=\"customActionEmitter.emit($event)\"\n (editEmitter)=\"edit.emit()\"\n (deleteEmitter)=\"deleteEmitter.emit()\"></ng2-row-actions>\n </td>\n }\n }\n</ng-template>\n\n<ng-template #multiselectCheckbox>\n @if (grid().isMultiSelectVisible() && !isCreateRow()) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row())\">\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row().index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row().isSelected()\" />\n </td>\n } @else {\n <p></p>\n }\n</ng-template>\n", styles: [":host .ng2-smart-action-multiple-select{margin-right:.5rem}:host.ng2-smart-card{display:block;margin-bottom:1rem;border-radius:.5rem;overflow:hidden;box-shadow:var(--table-card-shadow, 0 0 8px 5px rgba(215, 215, 215, .568627451));background-color:var(--table-card-background-color, #ffffff)}:host.ng2-smart-card td{display:block;padding:0;border:none}:host.ng2-smart-card td .ng2-smart-card-header{display:flex;align-items:center;gap:.5rem;justify-content:space-between;padding:.5rem}:host.ng2-smart-card td .ng2-smart-card-content{padding:1rem;display:grid;gap:.75rem}@media (min-width: 400px){:host.ng2-smart-card td .ng2-smart-card-content{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}}:host.ng2-smart-card td .ng2-smart-card-content .ng2-smart-card-field .ng2-smart-card-field-label{font-weight:600;color:inherit;margin-bottom:.35rem;font-size:.9em}:host.ng2-smart-card td .ng2-smart-card-content .ng2-smart-card-field .ng2-smart-card-field-value{word-break:break-word}\n"] }]
1307
+ }] });
1308
+
1309
+ class Ng2SmartTableTbodyComponent {
1310
+ constructor() {
1311
+ this.grid = input.required();
1312
+ this.source = input.required();
1313
+ this.rowClassFunction = input(() => '');
1314
+ this.isMobileView = input(false);
1315
+ this.edit = output();
1316
+ this.editConfirmed = output();
1317
+ this.editCancel = output();
1318
+ this.createConfirmed = output();
1319
+ this.deleteEmitter = output();
1320
+ this.customActionEmitter = output();
1321
+ this.userClickedRow = output();
1322
+ this.multipleSelectRow = output();
1323
+ // readonly editInputClass = computed<string>(() => {
1324
+ // const editOptions = this.grid().settings().edit;
1325
+ // if (!editOptions) {
1326
+ // return '';
1327
+ // }
1328
+ // return editOptions.inputClass || '';
1329
+ // });
1330
+ this.noDataMessage = computed(() => {
1331
+ return this.grid().settings().noDataMessage || 'No data found';
1332
+ });
1333
+ }
1334
+ customActionEmitted(actionName, row) {
1335
+ this.customActionEmitter.emit({
1336
+ source: this.source(),
1337
+ data: row.rowData,
1338
+ action: actionName,
1339
+ });
1340
+ }
1341
+ trackByIdOrIndex(index, item) {
1342
+ return item?.id || index;
1343
+ }
1344
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTbodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1345
+ 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 }, rowClassFunction: { classPropertyName: "rowClassFunction", publicName: "rowClassFunction", isSignal: true, isRequired: false, transformFunction: null }, isMobileView: { classPropertyName: "isMobileView", publicName: "isMobileView", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { edit: "edit", editConfirmed: "editConfirmed", editCancel: "editCancel", createConfirmed: "createConfirmed", deleteEmitter: "deleteEmitter", customActionEmitter: "customActionEmitter", userClickedRow: "userClickedRow", multipleSelectRow: "multipleSelectRow" }, ngImport: i0, template: "@if (grid().createFormShown()) {\n <tr\n ng2-st-trow\n class=\"ng2-smart-row\"\n [grid]=\"grid()\"\n [row]=\"grid().getNewRow()\"\n [isCreateRow]=\"true\"\n [source]=\"source()\"\n [isMobileView]=\"isMobileView()\"\n (createConfirmed)=\"createConfirmed.emit()\"\n ></tr>\n}\n@for (row of grid().dataSet.getRows(); track trackByIdOrIndex($index, row)) {\n <tr\n ng2-st-trow\n class=\"ng2-smart-row\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n [row]=\"row\"\n [class]=\"rowClassFunction()(row.rowData)\"\n [isMobileView]=\"isMobileView()\"\n [class.selected]=\"row.isSelected()\"\n (click)=\"userClickedRow.emit(row)\"\n (edit)=\"edit.emit(row)\"\n (editConfirmed)=\"editConfirmed.emit(row)\"\n (editCancel)=\"editCancel.emit(row)\"\n (deleteEmitter)=\"deleteEmitter.emit(row)\"\n (customActionEmitter)=\"customActionEmitted($event, row)\"\n (multipleSelectRow)=\"multipleSelectRow.emit($event)\"></tr>\n} @empty {\n <tr>\n <td colspan=\"50\">\n {{ noDataMessage() }}\n </td>\n </tr>\n}\n", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "component", type: TrowComponent, selector: "[ng2-st-trow]", inputs: ["grid", "source", "row", "isMobileView", "isCreateRow"], outputs: ["edit", "editCancel", "editConfirmed", "deleteEmitter", "createConfirmed", "customActionEmitter", "userClickedRow", "multipleSelectRow"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1346
+ }
1347
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTbodyComponent, decorators: [{
1348
+ type: Component,
1349
+ args: [{ selector: '[ng2-st-tbody]', imports: [FormsModule, TrowComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (grid().createFormShown()) {\n <tr\n ng2-st-trow\n class=\"ng2-smart-row\"\n [grid]=\"grid()\"\n [row]=\"grid().getNewRow()\"\n [isCreateRow]=\"true\"\n [source]=\"source()\"\n [isMobileView]=\"isMobileView()\"\n (createConfirmed)=\"createConfirmed.emit()\"\n ></tr>\n}\n@for (row of grid().dataSet.getRows(); track trackByIdOrIndex($index, row)) {\n <tr\n ng2-st-trow\n class=\"ng2-smart-row\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n [row]=\"row\"\n [class]=\"rowClassFunction()(row.rowData)\"\n [isMobileView]=\"isMobileView()\"\n [class.selected]=\"row.isSelected()\"\n (click)=\"userClickedRow.emit(row)\"\n (edit)=\"edit.emit(row)\"\n (editConfirmed)=\"editConfirmed.emit(row)\"\n (editCancel)=\"editCancel.emit(row)\"\n (deleteEmitter)=\"deleteEmitter.emit(row)\"\n (customActionEmitter)=\"customActionEmitted($event, row)\"\n (multipleSelectRow)=\"multipleSelectRow.emit($event)\"></tr>\n} @empty {\n <tr>\n <td colspan=\"50\">\n {{ noDataMessage() }}\n </td>\n </tr>\n}\n" }]
1350
+ }] });
1351
+
1352
+ class AddButtonComponent {
1353
+ constructor() {
1354
+ this.grid = input.required();
1355
+ this.create = output();
1356
+ this.isActionAdd = computed(() => {
1357
+ const actions = this.grid().settings().actions;
1358
+ if (!actions) {
1359
+ return false;
1360
+ }
1361
+ return !!actions.add;
1362
+ });
1363
+ this.addNewButtonContent = computed(() => {
1364
+ const addParams = this.grid().settings()?.add;
1365
+ if (!addParams) {
1366
+ return 'Add New';
1367
+ }
1368
+ return addParams?.addButtonContent || 'Add New';
1369
+ });
1370
+ }
1371
+ onAdd(event) {
1372
+ event.preventDefault();
1373
+ event.stopPropagation();
1374
+ this.create.emit();
1375
+ }
1376
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AddButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1377
+ 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: `
1378
+ @if (isActionAdd()) {
1379
+ <a
1380
+ href="#"
1381
+ class="ng2-smart-action ng2-smart-action-add-add"
1382
+ [innerHTML]="addNewButtonContent()"
1383
+ (click)="onAdd($event)"></a>
1283
1384
  }
1284
1385
  `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1285
1386
  }
1286
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyCreateCancelComponent, decorators: [{
1387
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AddButtonComponent, decorators: [{
1287
1388
  type: Component,
1288
1389
  args: [{
1289
- selector: "ng2-st-tbody-create-cancel",
1390
+ selector: '[ng2-st-add-button]',
1290
1391
  template: `
1291
- @if (!row().pending()) {
1292
- <a
1293
- href="#"
1294
- [id]="'row-' + row().index + '_editing-confirm-button'"
1295
- class="ng2-smart-action ng2-smart-action-edit-save"
1296
- [innerHTML]="saveButtonContent()"
1297
- (click)="onSave($event)"
1298
- ></a>
1299
- <a
1300
- href="#"
1301
- [id]="'row-' + row().index + '_editing-cancel-button'"
1302
- class="ng2-smart-action ng2-smart-action-edit-cancel"
1303
- [innerHTML]="cancelButtonContent()"
1304
- (click)="onCancelEdit($event)"
1305
- ></a>
1306
- } @else {
1307
- <div style="display: flex;">
1308
- <svg
1309
- role="none"
1310
- (click)="$event.stopPropagation()"
1311
- style="height: 2rem; width: 2rem;"
1312
- version="1.1"
1313
- id="L9"
1314
- xmlns="http://www.w3.org/2000/svg"
1315
- xmlns:xlink="http://www.w3.org/1999/xlink"
1316
- x="0px"
1317
- y="0px"
1318
- viewBox="0 0 100 100"
1319
- enable-background="new 0 0 0 0"
1320
- xml:space="preserve"
1321
- >
1322
- <path
1323
- fill="#e9e9e9"
1324
- 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"
1325
- >
1326
- <animateTransform
1327
- attributeName="transform"
1328
- attributeType="XML"
1329
- type="rotate"
1330
- dur="1s"
1331
- from="0 50 50"
1332
- to="360 50 50"
1333
- repeatCount="indefinite"
1334
- />
1335
- </path>
1336
- </svg>
1337
- <svg
1338
- role="none"
1339
- (click)="$event.stopPropagation()"
1340
- style="height: 2rem; width: 2rem; "
1341
- version="1.1"
1342
- id="L9"
1343
- xmlns="http://www.w3.org/2000/svg"
1344
- xmlns:xlink="http://www.w3.org/1999/xlink"
1345
- x="0px"
1346
- y="0px"
1347
- viewBox="0 0 100 100"
1348
- enable-background="new 0 0 0 0"
1349
- xml:space="preserve"
1350
- >
1351
- <path
1352
- fill="#e9e9e9"
1353
- 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"
1354
- >
1355
- <animateTransform
1356
- attributeName="transform"
1357
- attributeType="XML"
1358
- type="rotate"
1359
- dur="1s"
1360
- from="0 50 50"
1361
- to="360 50 50"
1362
- repeatCount="indefinite"
1363
- />
1364
- </path>
1365
- </svg>
1366
- </div>
1392
+ @if (isActionAdd()) {
1393
+ <a
1394
+ href="#"
1395
+ class="ng2-smart-action ng2-smart-action-add-add"
1396
+ [innerHTML]="addNewButtonContent()"
1397
+ (click)="onAdd($event)"></a>
1367
1398
  }
1368
1399
  `,
1369
- standalone: true,
1400
+ host: {
1401
+ class: 'ng2-smart-actions-title ng2-smart-actions-title-add',
1402
+ },
1370
1403
  changeDetection: ChangeDetectionStrategy.OnPush,
1371
1404
  }]
1372
1405
  }] });
1373
1406
 
1374
- class DataSet {
1375
- constructor(data = [], columnSettings) {
1376
- this.columnSettings = columnSettings;
1377
- this.data = signal([]);
1378
- this.columns = signal([]);
1379
- this.rows = signal([]);
1380
- this.selectedRows = new Set();
1381
- this.getColumns = computed(() => this.columns());
1382
- this.getVisibleColumns = computed(() => this.columns().filter((column) => !column.hide));
1383
- this.getRows = computed(() => {
1384
- return this.rows();
1407
+ class ColumnTitleComponent {
1408
+ constructor() {
1409
+ this.source = input.required();
1410
+ this.column = input.required();
1411
+ this.currentSortDirection = computed(() => {
1412
+ const { field, direction } = this.source().getSort();
1413
+ return this.column().id === field ? direction : null;
1385
1414
  });
1386
- this.isAllSelected = computed(() => this.rows().every((row) => row.isSelected()));
1387
- this.createColumns(columnSettings);
1388
- this.setData(data);
1389
- this.createNewRow();
1390
- }
1391
- setData(data) {
1392
- this.data.set(data);
1393
- this.createRows();
1394
- }
1395
- setColumnsConfig(columnSettings) {
1396
- this.columnSettings = columnSettings;
1397
- this.createColumns(columnSettings);
1398
- this.createRows();
1399
- }
1400
- getFirstRow() {
1401
- return this.rows()[0];
1402
- }
1403
- getLastRow() {
1404
- return this.rows()[this.rows().length - 1];
1405
- }
1406
- findRowByData(data) {
1407
- return this.rows().find((row) => row.getData() === data);
1408
- }
1409
- setSelectAll(state) {
1410
- this.rows().forEach((row) => {
1411
- row.isSelected.set(state);
1412
- this.storeSelectedRow(row);
1415
+ this.currentSortDirectionSymbol = computed(() => {
1416
+ return !this.currentSortDirection() ? '' : this.currentSortDirection() === 'asc' ? '↑' : '↓';
1413
1417
  });
1414
1418
  }
1415
- deselectAll() {
1416
- this.rows().forEach((row) => {
1417
- row.isSelected.set(false);
1419
+ _sort(event) {
1420
+ event.preventDefault();
1421
+ const { id: field, title } = this.column();
1422
+ this.source().setSort({
1423
+ field,
1424
+ title,
1425
+ direction: this.currentSortDirection() === 'desc' ? 'asc' : 'desc',
1426
+ compare: this.column().compareFunction,
1418
1427
  });
1419
- // we need to clear selectedRow field because no one row selected
1420
- this.selectedRows.clear();
1421
1428
  }
1422
- selectRow(row, state) {
1423
- row.isSelected.set(state);
1424
- this.storeSelectedRow(row);
1429
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ColumnTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1430
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: ColumnTitleComponent, isStandalone: true, selector: "ng2-st-column-title", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
1431
+ @if (column().isSortable) {
1432
+ <a href="#" (click)="_sort($event)" class="ng2-smart-sort-link sort">
1433
+ {{ column().title }}
1434
+ <span class="sort-direction">{{ currentSortDirectionSymbol() }}</span>
1435
+ </a>
1436
+ } @else {
1437
+ <span class="ng2-smart-sort">{{ column().title }}</span>
1425
1438
  }
1426
- multipleSelectRow(row) {
1427
- row.isSelected.set(!row.isSelected());
1428
- this.storeSelectedRow(row);
1429
- return row;
1439
+ `, isInline: true, styles: ["a.sort{white-space:nowrap}a.sort.asc,a.sort.desc{font-weight:700}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1440
+ }
1441
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ColumnTitleComponent, decorators: [{
1442
+ type: Component,
1443
+ args: [{ selector: 'ng2-st-column-title', template: `
1444
+ @if (column().isSortable) {
1445
+ <a href="#" (click)="_sort($event)" class="ng2-smart-sort-link sort">
1446
+ {{ column().title }}
1447
+ <span class="sort-direction">{{ currentSortDirectionSymbol() }}</span>
1448
+ </a>
1449
+ } @else {
1450
+ <span class="ng2-smart-sort">{{ column().title }}</span>
1430
1451
  }
1431
- getSelectedRowsData() {
1432
- return [...this.selectedRows];
1452
+ `, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["a.sort{white-space:nowrap}a.sort.asc,a.sort.desc{font-weight:700}\n"] }]
1453
+ }] });
1454
+
1455
+ class CheckboxFilterComponent extends BaseFilterComponent {
1456
+ constructor() {
1457
+ super();
1458
+ this.filterIsActive = computed(() => this.query() !== null);
1459
+ this.currentState = computed(() => {
1460
+ const valuesConfig = this.getValuesConfig(this.column().getFilterConfig());
1461
+ return this.query() === valuesConfig.trueVal ? true : this.query() === valuesConfig.falseVal ? false : false;
1462
+ });
1433
1463
  }
1434
- createNewRow() {
1435
- this.newRow = new Row(-1, {}, this);
1436
- this.newRow.isInEditing.set(true);
1464
+ getValuesConfig(filterConfig) {
1465
+ try {
1466
+ const { true: trueVal, false: falseVal } = filterConfig;
1467
+ return { trueVal: trueVal || true, falseVal: falseVal ?? false };
1468
+ }
1469
+ catch {
1470
+ return { trueVal: true, falseVal: false };
1471
+ }
1437
1472
  }
1438
- /**
1439
- * Create columns by mapping from the settings
1440
- * @param settings
1441
- * @private
1442
- */
1443
- createColumns(columnsParams) {
1444
- const columns = columnsParams.map((params) => new Column(params.key, params, this));
1445
- this.columns.set(columns);
1446
- }
1447
- /**
1448
- * Create rows based on current data prepared in data source
1449
- * @private
1450
- */
1451
- createRows() {
1452
- const rows = this.data().map((el, index) => {
1453
- const row = new Row(index, el, this);
1454
- row.isSelected.set(this.selectedRows.has(row.getData()));
1455
- return row;
1456
- });
1457
- this.rows.set(rows);
1458
- }
1459
- storeSelectedRow(row) {
1460
- if (row.isSelected()) {
1461
- this.selectedRows.add(row.getData());
1462
- }
1463
- else {
1464
- this.selectedRows.delete(row.getData());
1465
- }
1466
- }
1467
- }
1468
-
1469
- class Grid {
1470
- constructor(source, settings) {
1471
- this.createFormShown = false;
1472
- this.currentColumnsSortState = [];
1473
- this.settings = signal({});
1474
- this.isMultiSelectVisible = computed(() => {
1475
- return this.settings().selectMode === 'multi';
1476
- });
1477
- this.isActionsVisible = computed(() => {
1478
- const actions = this.settings().actions;
1479
- if (!actions)
1480
- return false;
1481
- return actions.add || actions.edit || actions.delete || !!actions?.custom?.length;
1482
- });
1483
- this.actionIsOnLeft = computed(() => {
1484
- return (this.settings().actionsPosition || 'left') === 'left';
1485
- });
1486
- this.actionIsOnRight = computed(() => {
1487
- return this.settings().actionsPosition === 'right';
1488
- });
1489
- this.setSource(source, settings);
1490
- this.setSettings(settings);
1491
- }
1492
- setColumnsSortedEmitter(emitter) {
1493
- this.columnsSortedEmitter = emitter;
1494
- }
1495
- detach() {
1496
- if (this.sourceOnChangedSubscription) {
1497
- this.sourceOnChangedSubscription.unsubscribe();
1498
- }
1499
- if (this.sourceOnUpdatedSubscription) {
1500
- this.sourceOnUpdatedSubscription.unsubscribe();
1501
- }
1502
- }
1503
- getNewRow() {
1504
- return this.dataSet.newRow;
1505
- }
1506
- setSettings(settings) {
1507
- this.updateSettingsAndDataSet(settings);
1508
- if (settings.columnSort) {
1509
- this.setColumnsSortState(settings.columns);
1510
- }
1511
- }
1512
- getDataSet() {
1513
- return this.dataSet;
1514
- }
1515
- getSetting(name, defaultValue) {
1516
- return getDeepFromObject(this.settings(), name, defaultValue);
1517
- }
1518
- selectRow(row, state) {
1519
- this.dataSet.selectRow(row, state);
1520
- }
1521
- multipleSelectRow(row) {
1522
- this.dataSet.multipleSelectRow(row);
1523
- }
1524
- edit(row) {
1525
- row.isInEditing.set(true);
1526
- }
1527
- create(row, confirmEmitter) {
1528
- row.pending.set(true);
1529
- const deferred = new Deferred();
1530
- deferred.promise
1531
- .then((newData) => {
1532
- row.pending.set(false);
1533
- newData = newData || row.getNewData();
1534
- this.source.prepend(newData).then(() => {
1535
- this.createFormShown = false;
1536
- this.dataSet.createNewRow();
1537
- });
1538
- })
1539
- .catch((err) => {
1540
- row.pending.set(false);
1541
- });
1542
- if (this.getSetting('add.confirmCreate', false)) {
1543
- confirmEmitter.emit({
1544
- newData: row.getNewData(),
1545
- source: this.source,
1546
- confirm: deferred,
1547
- });
1548
- }
1549
- else {
1550
- deferred.resolve(false);
1551
- row.pending.set(false);
1552
- }
1553
- }
1554
- save(row, confirmEmitter) {
1555
- row.pending.set(true);
1556
- const deferred = new Deferred();
1557
- deferred.promise
1558
- .then((newData) => {
1559
- row.pending.set(false);
1560
- newData = newData || row.getNewData();
1561
- this.source.update(row.getData(), newData).then(() => {
1562
- row.isInEditing.set(false);
1563
- });
1564
- })
1565
- .catch(() => {
1566
- row.pending.set(false);
1567
- row.isInEditing.set(false);
1568
- });
1569
- if (this.getSetting('edit.confirmSave', false)) {
1570
- confirmEmitter.emit({
1571
- data: row.getData(),
1572
- newData: row.getNewData(),
1573
- source: this.source,
1574
- confirm: deferred,
1575
- });
1576
- }
1577
- else {
1578
- deferred.resolve(false);
1579
- row.pending.set(false);
1580
- }
1581
- }
1582
- delete(row, confirmEmitter) {
1583
- row.pending.set(true);
1584
- const deferred = new Deferred();
1585
- deferred.promise
1586
- .then(() => {
1587
- row.pending.set(false);
1588
- this.source.remove(row.getData());
1589
- })
1590
- .catch(() => {
1591
- row.pending.set(false);
1592
- // doing nothing
1593
- });
1594
- if (this.getSetting('delete.confirmDelete', true)) {
1595
- confirmEmitter.emit({
1596
- data: row.getData(),
1597
- source: this.source,
1598
- confirm: deferred,
1599
- });
1600
- }
1601
- else {
1602
- deferred.resolve(false);
1603
- row.pending.set(false);
1604
- }
1605
- if (row.isSelected()) {
1606
- this.dataSet.selectRow(row, false);
1607
- }
1608
- }
1609
- processDataChange(event) {
1610
- if (event.action === 'load') {
1611
- this.dataSet.deselectAll();
1612
- }
1613
- if (event.action === 'update') {
1614
- const changedRow = this.dataSet.findRowByData(event.oldItem);
1615
- if (changedRow) {
1616
- changedRow.setData(event.newItem || event.oldItem);
1617
- }
1618
- return;
1619
- }
1620
- this.dataSet.setData(event.elements);
1621
- }
1622
- prepareSource(source, initialSort, initialPaging) {
1623
- const preparedSource = source || new LocalDataSource();
1624
- if (initialSort && !source?.getSort().field) {
1625
- preparedSource.setSort(initialSort, false);
1626
- }
1627
- if (initialPaging && initialPaging?.display) {
1628
- preparedSource.pagingConf.update((old) => ({
1629
- ...old,
1630
- ...initialPaging,
1631
- }));
1632
- }
1633
- return preparedSource;
1634
- }
1635
- getInitialSort(columns) {
1636
- if (!columns || !columns.length) {
1637
- return false;
1638
- }
1639
- const defaultSortColumn = columns?.find((column) => column.sortDirection);
1640
- if (!defaultSortColumn) {
1641
- return false;
1642
- }
1643
- return {
1644
- field: defaultSortColumn.key,
1645
- direction: defaultSortColumn.sortDirection || 'asc',
1646
- compare: defaultSortColumn.compareFunction,
1647
- };
1648
- }
1649
- getSelectedRowsData() {
1650
- return this.dataSet.getSelectedRowsData();
1651
- }
1652
- selectAllRows(status) {
1653
- this.dataSet.setSelectAll(status);
1654
- }
1655
- getFirstRow() {
1656
- return this.dataSet.getFirstRow();
1657
- }
1658
- getLastRow() {
1659
- return this.dataSet.getLastRow();
1660
- }
1661
- updateSettingsAndDataSet(settings, emittedEvent = 'refresh') {
1662
- this.settings.set(settings);
1663
- if (this.dataSet) {
1664
- this.dataSet.setColumnsConfig(settings.columns);
1665
- }
1666
- else {
1667
- this.dataSet = new DataSet([], settings.columns);
1668
- }
1669
- if (this.source) {
1670
- this.source.pagingConf.update((old) => ({
1671
- ...old,
1672
- display: this.getSetting('pager.display'),
1673
- }));
1674
- if (emittedEvent === 'columnRefresh') {
1675
- this.source.columnRefresh();
1676
- }
1677
- else {
1678
- this.source.refresh();
1679
- }
1680
- }
1681
- }
1682
- setSource(source, settings) {
1683
- const initialSort = this.getInitialSort(settings?.columns);
1684
- this.source = this.prepareSource(source, initialSort, settings?.pager || false);
1685
- this.detach();
1686
- this.sourceOnChangedSubscription = this.source.onChanged().subscribe((changes) => this.processDataChange(changes));
1687
- }
1688
- // ------------------------------- column sort
1689
- async getSortedTableColumns(newState, columns) {
1690
- const sortedArray = [];
1691
- newState.forEach((item2) => {
1692
- const index = columns.findIndex((item1) => item1.key === item2.key && item1.title === item2.title);
1693
- if (index > -1) {
1694
- sortedArray.push({ ...columns[index], hide: !!item2.hide });
1695
- }
1696
- });
1697
- return Promise.resolve(sortedArray);
1698
- }
1699
- async applyColumnsSortState(state, emitEvent = true) {
1700
- this.currentColumnsSortState = this.getMergedColumnStates(state);
1701
- this.updateSettingsAndDataSet({
1702
- ...this.settings(),
1703
- columns: await this.getSortedTableColumns(this.currentColumnsSortState, this.settings()?.columns),
1704
- }, 'columnRefresh');
1705
- if (this.columnStateStorageKey) {
1706
- setLocalStorage(this.columnStateStorageKey, this.currentColumnsSortState);
1707
- }
1708
- if (emitEvent) {
1709
- this.columnsSortedEmitter.emit(this.currentColumnsSortState);
1710
- }
1711
- }
1712
- setColumnsSortState(columns) {
1713
- const columnsState = this.getColumnsStateFromSettings(columns);
1714
- if (this.columnStateStorageKey) {
1715
- const storageState = getLocalStorage(this.columnStateStorageKey);
1716
- if (!storageState) {
1717
- this.currentColumnsSortState = columnsState;
1718
- setLocalStorage(this.columnStateStorageKey, columnsState);
1719
- return;
1720
- }
1721
- const merged = this.getMergedColumnStates(storageState, columnsState);
1722
- this.applyColumnsSortState(merged, false);
1723
- return;
1724
- }
1725
- this.applyColumnsSortState(columnsState, false);
1726
- }
1727
- getColumnsStateFromSettings(columns) {
1728
- return (columns || this.settings().columns || []).map((column) => ({
1729
- key: column.key,
1730
- title: column.title,
1731
- hide: !!column.hide,
1732
- moveDisabled: !!column.moveDisabled,
1733
- }));
1734
- }
1735
- getMergedColumnStates(newState, columnsState) {
1736
- const columnsSettings = columnsState || this.getColumnsStateFromSettings();
1737
- // merge new columns state with state from storage
1738
- const filtered = [];
1739
- newState.forEach((state) => {
1740
- const fined = columnsSettings.find((column) => column.title === state.title && column.key === state.key);
1741
- if (fined) {
1742
- filtered.push({ ...fined, hide: fined.moveDisabled ? fined.hide : state.hide });
1743
- }
1744
- });
1745
- // find new columns witch not exist in storage state
1746
- const newColumns = columnsSettings.filter((state) => {
1747
- return !filtered.some((column) => column.title === state.title && column.key === state.key);
1748
- });
1749
- return [...filtered, ...newColumns];
1750
- }
1751
- get columnStateStorageKey() {
1752
- return this.settings().columnSortStorageKey;
1753
- }
1754
- }
1755
-
1756
- class TbodyCustomComponent {
1757
- constructor() {
1758
- this.custom = output();
1759
- }
1760
- onCustom(action) {
1761
- this.custom.emit({
1762
- action: action.name,
1763
- data: this.row.getData(),
1764
- source: this.source,
1765
- });
1766
- }
1767
- customActions() {
1768
- return this.grid.getSetting('actions.custom');
1769
- }
1770
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyCustomComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1771
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TbodyCustomComponent, isStandalone: true, selector: "ng2-st-tbody-custom", inputs: { grid: "grid", row: "row", source: "source" }, outputs: { custom: "custom" }, ngImport: i0, template: `
1772
- @for (action of customActions(); track $index) { @if(!action.hasPermissionFunction ? true :
1773
- action.hasPermissionFunction(row.getData())) {
1774
- <a
1775
- [id]="'row-' + row.index + '_action-' + action.name + '-button'"
1776
- href="#"
1777
- class="ng2-smart-action ng2-smart-action-custom-custom"
1778
- [innerHTML]="action.title"
1779
- (click)="$event.stopPropagation(); $event.preventDefault(); onCustom(action)"></a>
1780
- } }
1781
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1782
- }
1783
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyCustomComponent, decorators: [{
1784
- type: Component,
1785
- args: [{
1786
- selector: 'ng2-st-tbody-custom',
1787
- changeDetection: ChangeDetectionStrategy.OnPush,
1788
- template: `
1789
- @for (action of customActions(); track $index) { @if(!action.hasPermissionFunction ? true :
1790
- action.hasPermissionFunction(row.getData())) {
1791
- <a
1792
- [id]="'row-' + row.index + '_action-' + action.name + '-button'"
1793
- href="#"
1794
- class="ng2-smart-action ng2-smart-action-custom-custom"
1795
- [innerHTML]="action.title"
1796
- (click)="$event.stopPropagation(); $event.preventDefault(); onCustom(action)"></a>
1797
- } }
1798
- `,
1799
- standalone: true,
1800
- }]
1801
- }], propDecorators: { grid: [{
1802
- type: Input
1803
- }], row: [{
1804
- type: Input
1805
- }], source: [{
1806
- type: Input
1807
- }] } });
1808
-
1809
- class TbodyEditDeleteComponent {
1810
- constructor() {
1811
- this.cdr = inject(ChangeDetectorRef);
1812
- this.grid = input.required();
1813
- this.row = input.required();
1814
- this.source = input.required();
1815
- this.deleteConfirm = input.required();
1816
- this.edit = output();
1817
- this.delete = output();
1818
- this.isActionEdit = computed(() => {
1819
- const actions = this.grid().settings().actions;
1820
- return actions ? !!actions.edit : false;
1821
- });
1822
- this.isActionDelete = computed(() => {
1823
- const actions = this.grid().settings().actions;
1824
- return actions ? !!actions.delete : false;
1825
- });
1826
- this.isExternalMode = computed(() => {
1827
- return this.grid().settings().mode === 'external';
1828
- });
1829
- this.canDeleteFunction = computed(() => {
1830
- const deleteConfig = this.grid().settings().delete;
1831
- return deleteConfig ? deleteConfig.hasPermissionFunction || ((data) => true) : (data) => true;
1832
- });
1833
- this.canEditFunction = computed(() => {
1834
- const edit = this.grid().settings().edit;
1835
- return edit ? edit.hasPermissionFunction || ((data) => true) : (data) => true;
1836
- });
1837
- this.editRowButtonContent = computed(() => {
1838
- const edit = this.grid().settings().edit;
1839
- return edit ? edit.editButtonContent || 'Edit' : 'Edit';
1840
- });
1841
- this.deleteRowButtonContent = computed(() => {
1842
- const deleteConfig = this.grid().settings().delete;
1843
- return deleteConfig ? deleteConfig.deleteButtonContent || 'Delete' : 'Delete';
1844
- });
1845
- }
1846
- onEdit(event) {
1847
- event.preventDefault();
1848
- event.stopPropagation();
1849
- this.edit.emit({
1850
- data: this.row().getData(),
1851
- source: this.source,
1852
- });
1853
- if (!this.isExternalMode()) {
1854
- this.grid().edit(this.row());
1855
- }
1856
- }
1857
- onDelete(event) {
1858
- event.preventDefault();
1859
- event.stopPropagation();
1860
- if (this.isExternalMode()) {
1861
- this.delete.emit({
1862
- data: this.row().getData(),
1863
- source: this.source(),
1864
- });
1865
- }
1866
- else {
1867
- this.grid().delete(this.row(), this.deleteConfirm());
1868
- }
1869
- }
1870
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyEditDeleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1871
- 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: "@if (!row().pending()) { @if (isActionEdit() && canEditFunction()(row().getData())) {\n<a\n href=\"#\"\n [id]=\"'row-' + row().index + '_action-edit-button'\"\n class=\"ng2-smart-action ng2-smart-action-edit-edit\"\n [innerHTML]=\"editRowButtonContent()\"\n (click)=\"onEdit($event)\"></a>\n} @if (isActionDelete() && canDeleteFunction()(row().getData())) {\n<a\n href=\"#\"\n [id]=\"'row-' + row().index + '_action-delete-button'\"\n class=\"ng2-smart-action ng2-smart-action-delete-delete\"\n [innerHTML]=\"deleteRowButtonContent()\"\n (click)=\"onDelete($event)\"></a>\n} } @else {\n<div style=\"display: flex\">\n @if (isActionEdit()) {\n <svg\n role=\"none\"\n (click)=\"$event.stopPropagation()\"\n style=\"height: 2rem; width: 2rem\"\n version=\"1.1\"\n id=\"L9\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 100 100\"\n enable-background=\"new 0 0 0 0\"\n xml:space=\"preserve\">\n <path\n fill=\"#e9e9e9\"\n 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\">\n <animateTransform\n attributeName=\"transform\"\n attributeType=\"XML\"\n type=\"rotate\"\n dur=\"1s\"\n from=\"0 50 50\"\n to=\"360 50 50\"\n repeatCount=\"indefinite\" />\n </path>\n </svg>\n } @if (isActionDelete()) {\n <svg\n role=\"none\"\n (click)=\"$event.stopPropagation()\"\n style=\"height: 2rem; width: 2rem\"\n version=\"1.1\"\n id=\"L9\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 100 100\"\n enable-background=\"new 0 0 0 0\"\n xml:space=\"preserve\">\n <path\n fill=\"#e9e9e9\"\n 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\">\n <animateTransform\n attributeName=\"transform\"\n attributeType=\"XML\"\n type=\"rotate\"\n dur=\"1s\"\n from=\"0 50 50\"\n to=\"360 50 50\"\n repeatCount=\"indefinite\" />\n </path>\n </svg>\n }\n</div>\n}\n", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1872
- }
1873
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TbodyEditDeleteComponent, decorators: [{
1874
- type: Component,
1875
- args: [{ selector: 'ng2-st-tbody-edit-delete', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (!row().pending()) { @if (isActionEdit() && canEditFunction()(row().getData())) {\n<a\n href=\"#\"\n [id]=\"'row-' + row().index + '_action-edit-button'\"\n class=\"ng2-smart-action ng2-smart-action-edit-edit\"\n [innerHTML]=\"editRowButtonContent()\"\n (click)=\"onEdit($event)\"></a>\n} @if (isActionDelete() && canDeleteFunction()(row().getData())) {\n<a\n href=\"#\"\n [id]=\"'row-' + row().index + '_action-delete-button'\"\n class=\"ng2-smart-action ng2-smart-action-delete-delete\"\n [innerHTML]=\"deleteRowButtonContent()\"\n (click)=\"onDelete($event)\"></a>\n} } @else {\n<div style=\"display: flex\">\n @if (isActionEdit()) {\n <svg\n role=\"none\"\n (click)=\"$event.stopPropagation()\"\n style=\"height: 2rem; width: 2rem\"\n version=\"1.1\"\n id=\"L9\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 100 100\"\n enable-background=\"new 0 0 0 0\"\n xml:space=\"preserve\">\n <path\n fill=\"#e9e9e9\"\n 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\">\n <animateTransform\n attributeName=\"transform\"\n attributeType=\"XML\"\n type=\"rotate\"\n dur=\"1s\"\n from=\"0 50 50\"\n to=\"360 50 50\"\n repeatCount=\"indefinite\" />\n </path>\n </svg>\n } @if (isActionDelete()) {\n <svg\n role=\"none\"\n (click)=\"$event.stopPropagation()\"\n style=\"height: 2rem; width: 2rem\"\n version=\"1.1\"\n id=\"L9\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 100 100\"\n enable-background=\"new 0 0 0 0\"\n xml:space=\"preserve\">\n <path\n fill=\"#e9e9e9\"\n 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\">\n <animateTransform\n attributeName=\"transform\"\n attributeType=\"XML\"\n type=\"rotate\"\n dur=\"1s\"\n from=\"0 50 50\"\n to=\"360 50 50\"\n repeatCount=\"indefinite\" />\n </path>\n </svg>\n }\n</div>\n}\n" }]
1876
- }] });
1877
-
1878
- class Ng2SmartTableTbodyComponent {
1879
- constructor() {
1880
- this.grid = input.required();
1881
- this.source = input.required();
1882
- this.deleteConfirm = input.required();
1883
- this.createConfirm = input.required();
1884
- this.editConfirm = input.required();
1885
- this.rowClassFunction = input(() => '');
1886
- this.save = output();
1887
- this.edit = output();
1888
- this.editCancel = output();
1889
- this.delete = output();
1890
- this.custom = output();
1891
- this.edited = output();
1892
- this.userSelectRow = output();
1893
- this.userClickedRow = output();
1894
- this.multipleSelectRow = output();
1895
- this.editInputClass = computed(() => {
1896
- const editOptions = this.grid().settings().edit;
1897
- if (!editOptions) {
1898
- return '';
1899
- }
1900
- return editOptions.inputClass || '';
1901
- });
1902
- this.noDataMessage = computed(() => {
1903
- return this.grid().settings().noDataMessage || 'No data found';
1904
- });
1905
- }
1906
- trackByIdOrIndex(index, item) {
1907
- return item?.id || index;
1908
- }
1909
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTbodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1910
- 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().dataSet.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 @if (grid().isMultiSelectVisible()) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\">\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected()\" />\n </td>\n } @if (grid().actionIsOnLeft()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n } @for (cell of row.visibleCells(); track cell.getId() + $index) {\n <td [class]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell [cell]=\"cell\" [inputClass]=\"editInputClass()\" [isInEditing]=\"row.isInEditing()\">\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\"></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()\"></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 </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"] }] }); }
1911
- }
1912
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTbodyComponent, decorators: [{
1913
- type: Component,
1914
- args: [{ selector: '[ng2-st-tbody]', standalone: true, imports: [
1915
- FormsModule,
1916
- TbodyCustomComponent,
1917
- TbodyEditDeleteComponent,
1918
- TbodyCreateCancelComponent,
1919
- NgTemplateOutlet,
1920
- CellComponent,
1921
- ], template: "@for (row of grid().dataSet.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 @if (grid().isMultiSelectVisible()) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\">\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected()\" />\n </td>\n } @if (grid().actionIsOnLeft()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n } @for (cell of row.visibleCells(); track cell.getId() + $index) {\n <td [class]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell [cell]=\"cell\" [inputClass]=\"editInputClass()\" [isInEditing]=\"row.isInEditing()\">\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\"></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()\"></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 </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"] }]
1922
- }] });
1923
-
1924
- class CheckboxFilterComponent extends BaseFilterComponent {
1925
- constructor() {
1926
- super();
1927
- this.filterActive = false;
1928
- this.trueVal = true;
1929
- this.falseVal = false;
1930
- }
1931
- ngOnInit() {
1932
- const filterConfig = this.column().getFilterConfig();
1933
- try {
1934
- const { true: trueVal, false: falseVal } = filterConfig;
1935
- this.trueVal = trueVal ?? true;
1936
- this.falseVal = falseVal ?? false;
1937
- }
1938
- catch {
1939
- // do nothing
1940
- }
1941
- this.changesSubscription = this.inputControl.valueChanges
1942
- .pipe(distinctUntilChanged(), debounceTime(this.delay))
1943
- .subscribe((checked) => {
1944
- this.filterActive = true;
1945
- const value = checked ? this.trueVal : this.falseVal;
1946
- this.setFilter(value);
1947
- });
1948
- }
1949
- ngOnChanges({ query }) {
1950
- if (query) {
1951
- this.inputControl?.setValue(query.currentValue === this.trueVal, { emitEvent: false });
1952
- }
1473
+ setCheckFilter(state) {
1474
+ const { trueVal, falseVal } = this.getValuesConfig(this.column().getFilterConfig());
1475
+ const value = state ? trueVal : falseVal;
1476
+ this.setFilter(value);
1953
1477
  }
1954
1478
  resetFilter(event) {
1955
1479
  event.preventDefault();
1956
1480
  event.stopPropagation();
1957
- this.inputControl.setValue(false, { emitEvent: false });
1958
- this.filterActive = false;
1959
1481
  this.setFilter(null);
1960
1482
  }
1961
1483
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1962
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: CheckboxFilterComponent, isStandalone: true, selector: "ng2-checkbox-filter", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
1963
- <input type="checkbox" [formControl]="inputControl" [class]="inputClass()" class="form-control" />
1964
- @if (filterActive) {
1965
- <a href="#" (click)="resetFilter($event)">{{ column().getFilterConfig()?.resetText || 'reset' }}</a>
1966
- }
1967
- `, 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"] }] }); }
1484
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: CheckboxFilterComponent, isStandalone: true, selector: "ng2-checkbox-filter", usesInheritance: true, ngImport: i0, template: `
1485
+ <div class="checkbox-filter-wrapper">
1486
+ <input
1487
+ [id]="column().id"
1488
+ type="checkbox"
1489
+ [ngModel]="currentState()"
1490
+ (ngModelChange)="setCheckFilter($event)"
1491
+ [class]="inputClass()"
1492
+ class="form-control" />
1493
+ <label [for]="column().id">{{ column().title }}</label>
1494
+ @if (filterIsActive()) {
1495
+ <a href="#" (click)="resetFilter($event)">{{ column().getFilterConfig()?.resetText || 'reset' }}</a>
1496
+ }
1497
+ </div>
1498
+ `, isInline: true, styles: [".checkbox-filter-wrapper{display:flex;align-items:center;justify-content:flex-start;gap:.5rem}.checkbox-filter-wrapper input{width:auto}\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: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1968
1499
  }
1969
1500
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxFilterComponent, decorators: [{
1970
1501
  type: Component,
1971
- args: [{
1972
- selector: 'ng2-checkbox-filter',
1973
- template: `
1974
- <input type="checkbox" [formControl]="inputControl" [class]="inputClass()" class="form-control" />
1975
- @if (filterActive) {
1976
- <a href="#" (click)="resetFilter($event)">{{ column().getFilterConfig()?.resetText || 'reset' }}</a>
1977
- }
1978
- `,
1979
- standalone: true,
1980
- imports: [FormsModule, ReactiveFormsModule],
1981
- }]
1502
+ args: [{ selector: 'ng2-checkbox-filter', template: `
1503
+ <div class="checkbox-filter-wrapper">
1504
+ <input
1505
+ [id]="column().id"
1506
+ type="checkbox"
1507
+ [ngModel]="currentState()"
1508
+ (ngModelChange)="setCheckFilter($event)"
1509
+ [class]="inputClass()"
1510
+ class="form-control" />
1511
+ <label [for]="column().id">{{ column().title }}</label>
1512
+ @if (filterIsActive()) {
1513
+ <a href="#" (click)="resetFilter($event)">{{ column().getFilterConfig()?.resetText || 'reset' }}</a>
1514
+ }
1515
+ </div>
1516
+ `, changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, ReactiveFormsModule], styles: [".checkbox-filter-wrapper{display:flex;align-items:center;justify-content:flex-start;gap:.5rem}.checkbox-filter-wrapper input{width:auto}\n"] }]
1982
1517
  }], ctorParameters: () => [] });
1983
1518
 
1984
1519
  class InputFilterComponent extends BaseFilterComponent {
@@ -1990,7 +1525,7 @@ class InputFilterComponent extends BaseFilterComponent {
1990
1525
  class="form-control"
1991
1526
  type="text"
1992
1527
  placeholder="{{ column().title }}" />
1993
- `, 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"] }] }); }
1528
+ `, 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1994
1529
  }
1995
1530
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputFilterComponent, decorators: [{
1996
1531
  type: Component,
@@ -2004,7 +1539,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2004
1539
  type="text"
2005
1540
  placeholder="{{ column().title }}" />
2006
1541
  `,
2007
- standalone: true,
1542
+ changeDetection: ChangeDetectionStrategy.OnPush,
2008
1543
  imports: [FormsModule, ReactiveFormsModule],
2009
1544
  }]
2010
1545
  }] });
@@ -2015,12 +1550,12 @@ class SelectFilterComponent extends BaseFilterComponent {
2015
1550
  <select [class]="inputClass()" class="form-control" [formControl]="inputControl">
2016
1551
  <option value="">{{ column().getFilterConfig().selectText }}</option>
2017
1552
  @for (option of column().getFilterConfig().list; track $index) {
2018
- <option [value]="option.value">
2019
- {{ option.title }}
2020
- </option>
1553
+ <option [value]="option.value">
1554
+ {{ option.title }}
1555
+ </option>
2021
1556
  }
2022
1557
  </select>
2023
- `, 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: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
1558
+ `, 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: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2024
1559
  }
2025
1560
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectFilterComponent, decorators: [{
2026
1561
  type: Component,
@@ -2030,13 +1565,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2030
1565
  <select [class]="inputClass()" class="form-control" [formControl]="inputControl">
2031
1566
  <option value="">{{ column().getFilterConfig().selectText }}</option>
2032
1567
  @for (option of column().getFilterConfig().list; track $index) {
2033
- <option [value]="option.value">
2034
- {{ option.title }}
2035
- </option>
1568
+ <option [value]="option.value">
1569
+ {{ option.title }}
1570
+ </option>
2036
1571
  }
2037
1572
  </select>
2038
1573
  `,
2039
- standalone: true,
1574
+ changeDetection: ChangeDetectionStrategy.OnPush,
2040
1575
  imports: [FormsModule, ReactiveFormsModule],
2041
1576
  }]
2042
1577
  }] });
@@ -2051,65 +1586,73 @@ class BuildInFilterComponent {
2051
1586
  }
2052
1587
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BuildInFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2053
1588
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: BuildInFilterComponent, isStandalone: true, selector: "ng2-build-in-table-filter", inputs: { query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { filter: "filter" }, ngImport: i0, template: `
2054
- @switch (column().getFilterType()) { @case ('list') {
2055
- <ng2-select-filter
2056
- [query]="query()"
2057
- [class]="inputClass()"
2058
- [source]="source()"
2059
- [column]="column()"
2060
- (filter)="filter.emit($event)">
2061
- </ng2-select-filter>
2062
- } @case ('checkbox') {
2063
- <ng2-checkbox-filter
2064
- [query]="query()"
2065
- [source]="source()"
2066
- [class]="inputClass()"
2067
- [column]="column()"
2068
- (filter)="filter.emit($event)">
2069
- </ng2-checkbox-filter>
2070
- } @default {
2071
- <ng2-input-filter
2072
- [query]="query()"
2073
- [source]="source()"
2074
- [class]="inputClass()"
2075
- [column]="column()"
2076
- (filter)="filter.emit($event)">
2077
- </ng2-input-filter>
2078
- } }
2079
- `, isInline: true, dependencies: [{ kind: "component", type: SelectFilterComponent, selector: "ng2-select-filter" }, { kind: "component", type: CheckboxFilterComponent, selector: "ng2-checkbox-filter" }, { kind: "component", type: InputFilterComponent, selector: "ng2-input-filter" }] }); }
1589
+ @switch (column().getFilterType()) {
1590
+ @case ('list') {
1591
+ <ng2-select-filter
1592
+ [query]="query()"
1593
+ [class]="inputClass()"
1594
+ [source]="source()"
1595
+ [column]="column()"
1596
+ (filter)="filter.emit($event)">
1597
+ </ng2-select-filter>
1598
+ }
1599
+ @case ('checkbox') {
1600
+ <ng2-checkbox-filter
1601
+ [query]="query()"
1602
+ [source]="source()"
1603
+ [class]="inputClass()"
1604
+ [column]="column()"
1605
+ (filter)="filter.emit($event)">
1606
+ </ng2-checkbox-filter>
1607
+ }
1608
+ @default {
1609
+ <ng2-input-filter
1610
+ [query]="query()"
1611
+ [source]="source()"
1612
+ [class]="inputClass()"
1613
+ [column]="column()"
1614
+ (filter)="filter.emit($event)">
1615
+ </ng2-input-filter>
1616
+ }
1617
+ }
1618
+ `, isInline: true, dependencies: [{ kind: "component", type: SelectFilterComponent, selector: "ng2-select-filter" }, { kind: "component", type: CheckboxFilterComponent, selector: "ng2-checkbox-filter" }, { kind: "component", type: InputFilterComponent, selector: "ng2-input-filter" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2080
1619
  }
2081
1620
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BuildInFilterComponent, decorators: [{
2082
1621
  type: Component,
2083
1622
  args: [{
2084
1623
  selector: 'ng2-build-in-table-filter',
2085
1624
  template: `
2086
- @switch (column().getFilterType()) { @case ('list') {
2087
- <ng2-select-filter
2088
- [query]="query()"
2089
- [class]="inputClass()"
2090
- [source]="source()"
2091
- [column]="column()"
2092
- (filter)="filter.emit($event)">
2093
- </ng2-select-filter>
2094
- } @case ('checkbox') {
2095
- <ng2-checkbox-filter
2096
- [query]="query()"
2097
- [source]="source()"
2098
- [class]="inputClass()"
2099
- [column]="column()"
2100
- (filter)="filter.emit($event)">
2101
- </ng2-checkbox-filter>
2102
- } @default {
2103
- <ng2-input-filter
2104
- [query]="query()"
2105
- [source]="source()"
2106
- [class]="inputClass()"
2107
- [column]="column()"
2108
- (filter)="filter.emit($event)">
2109
- </ng2-input-filter>
2110
- } }
1625
+ @switch (column().getFilterType()) {
1626
+ @case ('list') {
1627
+ <ng2-select-filter
1628
+ [query]="query()"
1629
+ [class]="inputClass()"
1630
+ [source]="source()"
1631
+ [column]="column()"
1632
+ (filter)="filter.emit($event)">
1633
+ </ng2-select-filter>
1634
+ }
1635
+ @case ('checkbox') {
1636
+ <ng2-checkbox-filter
1637
+ [query]="query()"
1638
+ [source]="source()"
1639
+ [class]="inputClass()"
1640
+ [column]="column()"
1641
+ (filter)="filter.emit($event)">
1642
+ </ng2-checkbox-filter>
1643
+ }
1644
+ @default {
1645
+ <ng2-input-filter
1646
+ [query]="query()"
1647
+ [source]="source()"
1648
+ [class]="inputClass()"
1649
+ [column]="column()"
1650
+ (filter)="filter.emit($event)">
1651
+ </ng2-input-filter>
1652
+ }
1653
+ }
2111
1654
  `,
2112
- standalone: true,
1655
+ changeDetection: ChangeDetectionStrategy.OnPush,
2113
1656
  imports: [SelectFilterComponent, CheckboxFilterComponent, InputFilterComponent],
2114
1657
  }]
2115
1658
  }] });
@@ -2155,14 +1698,14 @@ class CustomFilterComponent {
2155
1698
  }
2156
1699
  }
2157
1700
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2158
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: CustomFilterComponent, isStandalone: true, selector: "ng2-custom-table-filter", inputs: { query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { filter: "filter" }, viewQueries: [{ propertyName: "dynamicTarget", first: true, predicate: ["dynamicTarget"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: `<ng-template #dynamicTarget></ng-template>`, isInline: true }); }
1701
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: CustomFilterComponent, isStandalone: true, selector: "ng2-custom-table-filter", inputs: { query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { filter: "filter" }, viewQueries: [{ propertyName: "dynamicTarget", first: true, predicate: ["dynamicTarget"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: `<ng-template #dynamicTarget></ng-template>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2159
1702
  }
2160
1703
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomFilterComponent, decorators: [{
2161
1704
  type: Component,
2162
1705
  args: [{
2163
1706
  selector: 'ng2-custom-table-filter',
2164
1707
  template: `<ng-template #dynamicTarget></ng-template>`,
2165
- standalone: true,
1708
+ changeDetection: ChangeDetectionStrategy.OnPush,
2166
1709
  }]
2167
1710
  }], propDecorators: { dynamicTarget: [{
2168
1711
  type: ViewChild,
@@ -2171,540 +1714,685 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2171
1714
 
2172
1715
  class FilterComponent {
2173
1716
  constructor() {
2174
- this.query = signal('');
1717
+ this.query = computed(() => {
1718
+ const columnFilter = this.source()
1719
+ .getFilters()
1720
+ .find((filter) => filter.field === this.column().id);
1721
+ return columnFilter?.search ?? null;
1722
+ });
2175
1723
  this.column = input.required();
2176
1724
  this.source = input.required();
2177
1725
  this.inputClass = input('');
2178
- this.destroyRef = inject(DestroyRef);
2179
1726
  }
2180
- ngOnInit() {
2181
- this.source()
2182
- .onChanged()
2183
- .pipe(takeUntilDestroyed(this.destroyRef))
2184
- .subscribe(({ filters }) => {
2185
- if (!filters.length) {
2186
- return;
1727
+ onFilter(query) {
1728
+ this.source().addFilter({
1729
+ field: this.column().id,
1730
+ search: query,
1731
+ filter: this.column().filterFunction,
1732
+ });
1733
+ }
1734
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1735
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: FilterComponent, isStandalone: true, selector: "ng2-smart-table-filter", 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 } }, ngImport: i0, template: `
1736
+ @if (column().isFilterable) {
1737
+ <div class="ng2-smart-filter">
1738
+ @switch (column().getFilterType()) {
1739
+ @case ('custom') {
1740
+ <ng2-custom-table-filter
1741
+ [query]="query()"
1742
+ [column]="column()"
1743
+ [source]="source()"
1744
+ [inputClass]="inputClass()"
1745
+ (filter)="onFilter($event)">
1746
+ </ng2-custom-table-filter>
1747
+ }
1748
+ @default {
1749
+ <ng2-build-in-table-filter
1750
+ [query]="query()"
1751
+ [column]="column()"
1752
+ [source]="source()"
1753
+ [inputClass]="inputClass()"
1754
+ (filter)="onFilter($event)">
1755
+ </ng2-build-in-table-filter>
1756
+ }
1757
+ }
1758
+ </div>
1759
+ }
1760
+ `, isInline: true, styles: [":host .ng2-smart-filter ::ng-deep input,:host .ng2-smart-filter ::ng-deep select{width:100%;line-height:normal;padding:.375em .75em;font-weight:400}:host .ng2-smart-filter ::ng-deep input[type=search]{box-sizing:inherit}:host .ng2-smart-filter ::ng-deep .completer-dropdown-holder{font-weight:400}:host .ng2-smart-filter ::ng-deep a{font-weight:400}\n"], dependencies: [{ kind: "component", type: CustomFilterComponent, selector: "ng2-custom-table-filter", inputs: ["query", "inputClass", "source", "column"], outputs: ["filter"] }, { kind: "component", type: BuildInFilterComponent, selector: "ng2-build-in-table-filter", inputs: ["query", "inputClass", "source", "column"], outputs: ["filter"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1761
+ }
1762
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterComponent, decorators: [{
1763
+ type: Component,
1764
+ args: [{ selector: 'ng2-smart-table-filter', template: `
1765
+ @if (column().isFilterable) {
1766
+ <div class="ng2-smart-filter">
1767
+ @switch (column().getFilterType()) {
1768
+ @case ('custom') {
1769
+ <ng2-custom-table-filter
1770
+ [query]="query()"
1771
+ [column]="column()"
1772
+ [source]="source()"
1773
+ [inputClass]="inputClass()"
1774
+ (filter)="onFilter($event)">
1775
+ </ng2-custom-table-filter>
1776
+ }
1777
+ @default {
1778
+ <ng2-build-in-table-filter
1779
+ [query]="query()"
1780
+ [column]="column()"
1781
+ [source]="source()"
1782
+ [inputClass]="inputClass()"
1783
+ (filter)="onFilter($event)">
1784
+ </ng2-build-in-table-filter>
1785
+ }
1786
+ }
1787
+ </div>
1788
+ }
1789
+ `, changeDetection: ChangeDetectionStrategy.OnPush, imports: [CustomFilterComponent, BuildInFilterComponent], styles: [":host .ng2-smart-filter ::ng-deep input,:host .ng2-smart-filter ::ng-deep select{width:100%;line-height:normal;padding:.375em .75em;font-weight:400}:host .ng2-smart-filter ::ng-deep input[type=search]{box-sizing:inherit}:host .ng2-smart-filter ::ng-deep .completer-dropdown-holder{font-weight:400}:host .ng2-smart-filter ::ng-deep a{font-weight:400}\n"] }]
1790
+ }] });
1791
+
1792
+ class TheadFiltersRowComponent {
1793
+ constructor() {
1794
+ this.grid = input.required();
1795
+ this.source = input.required();
1796
+ this.withoutCreateButton = input(false);
1797
+ this.create = output();
1798
+ this.filterInputClass = computed(() => {
1799
+ const filterOptions = this.grid().settings()?.filter;
1800
+ if (!filterOptions) {
1801
+ return '';
2187
1802
  }
2188
- const columnFilter = filters.find((filter) => filter.field === this.column().id);
2189
- if (!columnFilter) {
2190
- return;
1803
+ return filterOptions.inputClass || '';
1804
+ });
1805
+ }
1806
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFiltersRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1807
+ 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 }, withoutCreateButton: { classPropertyName: "withoutCreateButton", publicName: "withoutCreateButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { create: "create" }, ngImport: i0, template: `
1808
+ @if (grid().isMultiSelectVisible()) {
1809
+ <th></th>
1810
+ }
1811
+ @if (grid().actionIsOnLeft() && grid().isActionsVisible() && !withoutCreateButton()) {
1812
+ <th ng2-st-add-button [grid]="grid()" (create)="create.emit()"></th>
1813
+ }
1814
+ @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
1815
+ <th class="ng2-smart-th {{ column.id }}">
1816
+ <ng2-smart-table-filter [source]="source()" [column]="column" [inputClass]="filterInputClass()">
1817
+ </ng2-smart-table-filter>
1818
+ </th>
1819
+ }
1820
+ @if (grid().actionIsOnRight() && grid().isActionsVisible() && !withoutCreateButton()) {
1821
+ <th ng2-st-add-button [grid]="grid()" (create)="create.emit()"></th>
1822
+ }
1823
+ `, 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", inputs: ["column", "source", "inputClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1824
+ }
1825
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFiltersRowComponent, decorators: [{
1826
+ type: Component,
1827
+ args: [{
1828
+ selector: '[ng2-st-thead-filters-row]',
1829
+ template: `
1830
+ @if (grid().isMultiSelectVisible()) {
1831
+ <th></th>
1832
+ }
1833
+ @if (grid().actionIsOnLeft() && grid().isActionsVisible() && !withoutCreateButton()) {
1834
+ <th ng2-st-add-button [grid]="grid()" (create)="create.emit()"></th>
1835
+ }
1836
+ @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
1837
+ <th class="ng2-smart-th {{ column.id }}">
1838
+ <ng2-smart-table-filter [source]="source()" [column]="column" [inputClass]="filterInputClass()">
1839
+ </ng2-smart-table-filter>
1840
+ </th>
1841
+ }
1842
+ @if (grid().actionIsOnRight() && grid().isActionsVisible() && !withoutCreateButton()) {
1843
+ <th ng2-st-add-button [grid]="grid()" (create)="create.emit()"></th>
1844
+ }
1845
+ `,
1846
+ changeDetection: ChangeDetectionStrategy.OnPush,
1847
+ imports: [AddButtonComponent, FilterComponent],
1848
+ }]
1849
+ }] });
1850
+
1851
+ class ActionsTitleComponent {
1852
+ constructor() {
1853
+ this.grid = input.required();
1854
+ this.actionsColumnTitle = computed(() => {
1855
+ const actions = this.grid().settings().actions;
1856
+ if (!actions) {
1857
+ return 'Actions';
1858
+ }
1859
+ return actions.columnTitle || 'Actions';
1860
+ });
1861
+ }
1862
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ActionsTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1863
+ 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, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1864
+ }
1865
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ActionsTitleComponent, decorators: [{
1866
+ type: Component,
1867
+ args: [{
1868
+ selector: '[ng2-st-actions-title]',
1869
+ template: ` <div class="ng2-smart-title">{{ actionsColumnTitle() }}</div> `,
1870
+ changeDetection: ChangeDetectionStrategy.OnPush,
1871
+ host: {
1872
+ class: 'ng2-smart-actions',
1873
+ },
1874
+ }]
1875
+ }] });
1876
+
1877
+ class CheckboxSelectAllComponent {
1878
+ constructor() {
1879
+ this.grid = input.required();
1880
+ }
1881
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxSelectAllComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1882
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: CheckboxSelectAllComponent, isStandalone: true, selector: "[ng2-st-checkbox-select-all]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: ` <input type="checkbox" [ngModel]="this.grid().dataSet.isAllSelected()" /> `, 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: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1883
+ }
1884
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxSelectAllComponent, decorators: [{
1885
+ type: Component,
1886
+ args: [{
1887
+ selector: '[ng2-st-checkbox-select-all]',
1888
+ template: ` <input type="checkbox" [ngModel]="this.grid().dataSet.isAllSelected()" /> `,
1889
+ changeDetection: ChangeDetectionStrategy.OnPush,
1890
+ imports: [FormsModule],
1891
+ }]
1892
+ }] });
1893
+
1894
+ class TheadTitlesRowComponent {
1895
+ constructor() {
1896
+ this.grid = input.required();
1897
+ this.source = input.required();
1898
+ this.selectAllRows = output();
1899
+ }
1900
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadTitlesRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1901
+ 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: { selectAllRows: "selectAllRows" }, ngImport: i0, template: `
1902
+ @if (grid().isMultiSelectVisible()) {
1903
+ <th ng2-st-checkbox-select-all [grid]="grid()" (click)="selectAllRows.emit()"></th>
1904
+ }
1905
+ @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
1906
+ <th ng2-st-actions-title [grid]="grid()"></th>
1907
+ }
1908
+ @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
1909
+ <th class="ng2-smart-th {{ column.id }}" [class]="column.class">
1910
+ <ng2-st-column-title [source]="source()" [column]="column"></ng2-st-column-title>
1911
+ </th>
1912
+ }
1913
+ @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
1914
+ <th ng2-st-actions-title [grid]="grid()"></th>
1915
+ }
1916
+ `, isInline: true, dependencies: [{ kind: "component", type: CheckboxSelectAllComponent, selector: "[ng2-st-checkbox-select-all]", inputs: ["grid"] }, { kind: "component", type: ActionsTitleComponent, selector: "[ng2-st-actions-title]", inputs: ["grid"] }, { kind: "component", type: ColumnTitleComponent, selector: "ng2-st-column-title", inputs: ["source", "column"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1917
+ }
1918
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadTitlesRowComponent, decorators: [{
1919
+ type: Component,
1920
+ args: [{
1921
+ selector: '[ng2-st-thead-titles-row]',
1922
+ template: `
1923
+ @if (grid().isMultiSelectVisible()) {
1924
+ <th ng2-st-checkbox-select-all [grid]="grid()" (click)="selectAllRows.emit()"></th>
1925
+ }
1926
+ @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
1927
+ <th ng2-st-actions-title [grid]="grid()"></th>
1928
+ }
1929
+ @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
1930
+ <th class="ng2-smart-th {{ column.id }}" [class]="column.class">
1931
+ <ng2-st-column-title [source]="source()" [column]="column"></ng2-st-column-title>
1932
+ </th>
1933
+ }
1934
+ @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
1935
+ <th ng2-st-actions-title [grid]="grid()"></th>
1936
+ }
1937
+ `,
1938
+ changeDetection: ChangeDetectionStrategy.OnPush,
1939
+ imports: [CheckboxSelectAllComponent, ActionsTitleComponent, ColumnTitleComponent],
1940
+ }]
1941
+ }] });
1942
+
1943
+ class Ng2SmartTableTheadComponent {
1944
+ constructor() {
1945
+ this.grid = input.required();
1946
+ this.source = input.required();
1947
+ this.isMobileView = input(false);
1948
+ this.selectAllRows = output();
1949
+ this.create = output();
1950
+ this.isHideHeader = computed(() => {
1951
+ return this.grid().settings()?.hideHeader || false;
1952
+ });
1953
+ this.isHideSubHeader = computed(() => {
1954
+ return this.grid().settings()?.hideSubHeader || false;
1955
+ });
1956
+ this.columnsWithSort = computed(() => this.grid()
1957
+ .dataSet.getColumns()
1958
+ .filter((column) => column.isSortable));
1959
+ this.currentSortConfig = computed(() => this.source().getSort());
1960
+ this.dropdown = signal(null);
1961
+ }
1962
+ toggleDropdown(type) {
1963
+ this.dropdown.update((value) => {
1964
+ if (value === type) {
1965
+ return null;
2191
1966
  }
2192
- this.query.set(columnFilter.search);
1967
+ return type;
1968
+ });
1969
+ }
1970
+ clearAllFilters() {
1971
+ this.source().setFilters([]);
1972
+ }
1973
+ sortByColumn(column) {
1974
+ const sort = this.currentSortConfig();
1975
+ const { id: field, title } = column || { id: sort.field, title: sort.title };
1976
+ const direction = field === sort.field ? (sort.direction === 'asc' ? 'desc' : 'asc') : 'asc';
1977
+ this.source().setSort({
1978
+ field,
1979
+ title,
1980
+ direction: direction,
1981
+ });
1982
+ this.dropdown.set(null);
1983
+ }
1984
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTheadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1985
+ 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 }, isMobileView: { classPropertyName: "isMobileView", publicName: "isMobileView", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectAllRows: "selectAllRows", create: "create" }, ngImport: i0, template: "@if (isMobileView()) {\n <tr class=\"ng2-smart-titles mobile-header mobile-header-top-row\">\n <th colspan=\"50\">\n <div class=\"mobile-header-content\">\n <div ng2-st-add-button [grid]=\"grid()\" (create)=\"create.emit($event)\"></div>\n <div class=\"current-column-title\">\n <a href=\"#\" (click)=\"$event.preventDefault(); sortByColumn()\" class=\"ng2-smart-sort-link sort\">\n {{ currentSortConfig().title }}\n <span class=\"sort-direction\">{{ currentSortConfig().direction === 'asc' ? '\u2191' : '\u2193' }}</span>\n </a>\n <button\n class=\"sort-dropdown-toggle-button\"\n (click)=\"toggleDropdown('sort')\"\n [class.active]=\"dropdown() === 'sort'\"\n aria-label=\"Toggle sort options\">\n <span class=\"sort-icon\">\u25BC</span>\n </button>\n </div>\n <div class=\"header-actions\">\n <button class=\"filter-toggle\" (click)=\"toggleDropdown('filters')\" aria-label=\"Toggle filters\">\n <svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\">\n <g id=\"SVGRepo_bgCarrier\" stroke-width=\"0\"></g>\n <g id=\"SVGRepo_tracerCarrier\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></g>\n <g id=\"SVGRepo_iconCarrier\">\n <path\n stroke=\"#000000\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M20 4H4v2l6 6v8.5l4-2.5v-6l6-6V4z\"></path>\n </g>\n </svg>\n </button>\n </div>\n </div>\n </th>\n </tr>\n <tr class=\"mobile-header-bottom-row\">\n <th colspan=\"50\" [class.dialog-active]=\"dropdown()\">\n <div class=\"overlay\" (click)=\"toggleDropdown(null)\"></div>\n <div class=\"dropdown\">\n <div class=\"dropdown-header\">\n @if (dropdown() === 'filters') {\n <button type=\"button\" (click)=\"clearAllFilters()\" aria-label=\"Close filters\">\n reset all\n </button>\n } @else {\n <p></p>\n }\n <button type=\"button\" class=\"close-dialog-button\" (click)=\"toggleDropdown(null)\" aria-label=\"Close filters\">\n <span></span>\n </button>\n </div>\n <div class=\"dropdown-content\">\n @if (dropdown() === 'sort') {\n @for (column of columnsWithSort(); track $index) {\n <th class=\"titles\">\n <ng2-st-column-title class=\"sort-option\" [column]=\"column\" [source]=\"source()\"></ng2-st-column-title>\n </th>\n }\n }\n @if (dropdown() === 'filters') {\n <ng-container [ngTemplateOutlet]=\"filtersRow\"></ng-container>\n }\n </div>\n </div>\n </th>\n </tr>\n} @else {\n <!-- Desktop view header -->\n @if (!isHideHeader()) {\n <tr\n ng2-st-thead-titles-row\n class=\"ng2-smart-titles\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (selectAllRows)=\"selectAllRows.emit()\"></tr>\n }\n\n @if (!isHideSubHeader()) {\n <ng-container [ngTemplateOutlet]=\"filtersRow\"></ng-container>\n }\n}\n\n<!-- Template for filters row to be used in mobile dialog -->\n<ng-template #filtersRow>\n <tr\n ng2-st-thead-filters-row\n class=\"ng2-smart-filters\"\n [grid]=\"grid()\"\n [withoutCreateButton]=\"isMobileView()\"\n [source]=\"source()\"\n (create)=\"create.emit()\"></tr>\n</ng-template>\n", styles: ["tr.mobile-header-top-row .mobile-header-content{display:flex;align-items:center;justify-content:space-between}tr.mobile-header-top-row .mobile-header-content .current-column-title{font-weight:700;flex:1;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}tr.mobile-header-top-row .mobile-header-content button.sort-dropdown-toggle-button{transition:transform .2s ease}tr.mobile-header-top-row .mobile-header-content button.sort-dropdown-toggle-button.active{transform:rotate(180deg)}tr.mobile-header-top-row .mobile-header-content .filter-toggle svg{height:1rem;width:1rem}tr.mobile-header-bottom-row{position:relative}tr.mobile-header-bottom-row .dropdown{position:absolute;opacity:0;pointer-events:none;top:1rem;left:50%;translate:-50%;padding:.8rem 1rem;border:none;border-radius:.5rem;background:var(--table-header-dropdown-background, #fff);box-shadow:var(--table-card-shadow, 0 0 8px 5px rgba(215, 215, 215, .568627451));z-index:10;max-height:var(--table-header-dropdown-max-height, 60dvh);width:var(--table-header-dropdown-width, 80dvw);max-width:30rem;overflow:auto;transition:opacity .3s ease}tr.mobile-header-bottom-row .dialog-active .dropdown{opacity:1;pointer-events:all}tr.mobile-header-bottom-row .dropdown-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:.5rem}tr.mobile-header-bottom-row .dropdown-content{display:flex;flex-direction:column}tr.mobile-header-bottom-row .dropdown-content ::ng-deep tr{display:flex;flex-direction:column;gap:.3rem}tr.mobile-header-bottom-row .dropdown-content ::ng-deep th.titles a{display:block;width:100%;padding:.3rem;color:inherit;border-bottom:1px solid var(--table-border-primary, #d5d5d5)}tr.mobile-header-bottom-row .close-dialog-button{display:flex;align-items:center;justify-content:center;border:none;background:none;width:2rem;height:2rem;padding:.5rem;border-radius:50%}tr.mobile-header-bottom-row .close-dialog-button:hover{box-shadow:0 0 5px 4px #dadada91}tr.mobile-header-bottom-row .close-dialog-button:after,tr.mobile-header-bottom-row .close-dialog-button:before{content:\"\";display:block;background-color:var(--table-header-dropdown-close-button-color, #000);height:2px;width:1rem;border-radius:2px}tr.mobile-header-bottom-row .close-dialog-button:before{rotate:45deg}tr.mobile-header-bottom-row .close-dialog-button:after{position:absolute;rotate:-45deg}.overlay{position:fixed;background:var(--table-header-dropdown-overlay-background, rgba(203, 203, 203, .3254901961));inset:0;z-index:-20}.dialog-active .overlay{z-index:2}.dropdown{z-index:1}\n"], dependencies: [{ kind: "component", type: TheadTitlesRowComponent, selector: "[ng2-st-thead-titles-row]", inputs: ["grid", "source"], outputs: ["selectAllRows"] }, { kind: "component", type: AddButtonComponent, selector: "[ng2-st-add-button]", inputs: ["grid"], outputs: ["create"] }, { kind: "component", type: ColumnTitleComponent, selector: "ng2-st-column-title", inputs: ["source", "column"] }, { kind: "component", type: TheadFiltersRowComponent, selector: "[ng2-st-thead-filters-row]", inputs: ["grid", "source", "withoutCreateButton"], outputs: ["create"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1986
+ }
1987
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTheadComponent, decorators: [{
1988
+ type: Component,
1989
+ args: [{ selector: '[ng2-st-thead]', imports: [
1990
+ TheadTitlesRowComponent,
1991
+ AddButtonComponent,
1992
+ ColumnTitleComponent,
1993
+ TheadFiltersRowComponent,
1994
+ NgTemplateOutlet,
1995
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (isMobileView()) {\n <tr class=\"ng2-smart-titles mobile-header mobile-header-top-row\">\n <th colspan=\"50\">\n <div class=\"mobile-header-content\">\n <div ng2-st-add-button [grid]=\"grid()\" (create)=\"create.emit($event)\"></div>\n <div class=\"current-column-title\">\n <a href=\"#\" (click)=\"$event.preventDefault(); sortByColumn()\" class=\"ng2-smart-sort-link sort\">\n {{ currentSortConfig().title }}\n <span class=\"sort-direction\">{{ currentSortConfig().direction === 'asc' ? '\u2191' : '\u2193' }}</span>\n </a>\n <button\n class=\"sort-dropdown-toggle-button\"\n (click)=\"toggleDropdown('sort')\"\n [class.active]=\"dropdown() === 'sort'\"\n aria-label=\"Toggle sort options\">\n <span class=\"sort-icon\">\u25BC</span>\n </button>\n </div>\n <div class=\"header-actions\">\n <button class=\"filter-toggle\" (click)=\"toggleDropdown('filters')\" aria-label=\"Toggle filters\">\n <svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\">\n <g id=\"SVGRepo_bgCarrier\" stroke-width=\"0\"></g>\n <g id=\"SVGRepo_tracerCarrier\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></g>\n <g id=\"SVGRepo_iconCarrier\">\n <path\n stroke=\"#000000\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M20 4H4v2l6 6v8.5l4-2.5v-6l6-6V4z\"></path>\n </g>\n </svg>\n </button>\n </div>\n </div>\n </th>\n </tr>\n <tr class=\"mobile-header-bottom-row\">\n <th colspan=\"50\" [class.dialog-active]=\"dropdown()\">\n <div class=\"overlay\" (click)=\"toggleDropdown(null)\"></div>\n <div class=\"dropdown\">\n <div class=\"dropdown-header\">\n @if (dropdown() === 'filters') {\n <button type=\"button\" (click)=\"clearAllFilters()\" aria-label=\"Close filters\">\n reset all\n </button>\n } @else {\n <p></p>\n }\n <button type=\"button\" class=\"close-dialog-button\" (click)=\"toggleDropdown(null)\" aria-label=\"Close filters\">\n <span></span>\n </button>\n </div>\n <div class=\"dropdown-content\">\n @if (dropdown() === 'sort') {\n @for (column of columnsWithSort(); track $index) {\n <th class=\"titles\">\n <ng2-st-column-title class=\"sort-option\" [column]=\"column\" [source]=\"source()\"></ng2-st-column-title>\n </th>\n }\n }\n @if (dropdown() === 'filters') {\n <ng-container [ngTemplateOutlet]=\"filtersRow\"></ng-container>\n }\n </div>\n </div>\n </th>\n </tr>\n} @else {\n <!-- Desktop view header -->\n @if (!isHideHeader()) {\n <tr\n ng2-st-thead-titles-row\n class=\"ng2-smart-titles\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (selectAllRows)=\"selectAllRows.emit()\"></tr>\n }\n\n @if (!isHideSubHeader()) {\n <ng-container [ngTemplateOutlet]=\"filtersRow\"></ng-container>\n }\n}\n\n<!-- Template for filters row to be used in mobile dialog -->\n<ng-template #filtersRow>\n <tr\n ng2-st-thead-filters-row\n class=\"ng2-smart-filters\"\n [grid]=\"grid()\"\n [withoutCreateButton]=\"isMobileView()\"\n [source]=\"source()\"\n (create)=\"create.emit()\"></tr>\n</ng-template>\n", styles: ["tr.mobile-header-top-row .mobile-header-content{display:flex;align-items:center;justify-content:space-between}tr.mobile-header-top-row .mobile-header-content .current-column-title{font-weight:700;flex:1;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}tr.mobile-header-top-row .mobile-header-content button.sort-dropdown-toggle-button{transition:transform .2s ease}tr.mobile-header-top-row .mobile-header-content button.sort-dropdown-toggle-button.active{transform:rotate(180deg)}tr.mobile-header-top-row .mobile-header-content .filter-toggle svg{height:1rem;width:1rem}tr.mobile-header-bottom-row{position:relative}tr.mobile-header-bottom-row .dropdown{position:absolute;opacity:0;pointer-events:none;top:1rem;left:50%;translate:-50%;padding:.8rem 1rem;border:none;border-radius:.5rem;background:var(--table-header-dropdown-background, #fff);box-shadow:var(--table-card-shadow, 0 0 8px 5px rgba(215, 215, 215, .568627451));z-index:10;max-height:var(--table-header-dropdown-max-height, 60dvh);width:var(--table-header-dropdown-width, 80dvw);max-width:30rem;overflow:auto;transition:opacity .3s ease}tr.mobile-header-bottom-row .dialog-active .dropdown{opacity:1;pointer-events:all}tr.mobile-header-bottom-row .dropdown-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:.5rem}tr.mobile-header-bottom-row .dropdown-content{display:flex;flex-direction:column}tr.mobile-header-bottom-row .dropdown-content ::ng-deep tr{display:flex;flex-direction:column;gap:.3rem}tr.mobile-header-bottom-row .dropdown-content ::ng-deep th.titles a{display:block;width:100%;padding:.3rem;color:inherit;border-bottom:1px solid var(--table-border-primary, #d5d5d5)}tr.mobile-header-bottom-row .close-dialog-button{display:flex;align-items:center;justify-content:center;border:none;background:none;width:2rem;height:2rem;padding:.5rem;border-radius:50%}tr.mobile-header-bottom-row .close-dialog-button:hover{box-shadow:0 0 5px 4px #dadada91}tr.mobile-header-bottom-row .close-dialog-button:after,tr.mobile-header-bottom-row .close-dialog-button:before{content:\"\";display:block;background-color:var(--table-header-dropdown-close-button-color, #000);height:2px;width:1rem;border-radius:2px}tr.mobile-header-bottom-row .close-dialog-button:before{rotate:45deg}tr.mobile-header-bottom-row .close-dialog-button:after{position:absolute;rotate:-45deg}.overlay{position:fixed;background:var(--table-header-dropdown-overlay-background, rgba(203, 203, 203, .3254901961));inset:0;z-index:-20}.dialog-active .overlay{z-index:2}.dropdown{z-index:1}\n"] }]
1996
+ }] });
1997
+
1998
+ class DataSet {
1999
+ constructor(data = [], columnSettings, editorInputClass) {
2000
+ this.columnSettings = columnSettings;
2001
+ this.editorInputClass = editorInputClass;
2002
+ this.data = signal([]);
2003
+ this.columns = signal([]);
2004
+ this.rows = signal([]);
2005
+ this.selectedRowsData = [];
2006
+ this.getColumns = computed(() => this.columns());
2007
+ this.getVisibleColumns = computed(() => this.columns().filter((column) => !column.hide));
2008
+ this.getRows = computed(() => {
2009
+ return this.rows();
2010
+ });
2011
+ this.isAllSelected = computed(() => this.rows().every((row) => row.isSelected()));
2012
+ this.createColumns(columnSettings);
2013
+ this.setData(data);
2014
+ this.createNewRow();
2015
+ }
2016
+ setData(data) {
2017
+ this.data.set(data);
2018
+ this.createRows();
2019
+ }
2020
+ setColumnsConfig(columnSettings) {
2021
+ this.columnSettings = columnSettings;
2022
+ this.createColumns(columnSettings);
2023
+ this.createRows();
2024
+ }
2025
+ findRowByData(data) {
2026
+ return this.rows().find((row) => isObjectsIdentical(row.rowData, data));
2027
+ }
2028
+ setSelectAll(state) {
2029
+ this.rows().forEach((row) => {
2030
+ row.isSelected.set(state);
2031
+ this.storeSelectedRow(row);
2032
+ });
2033
+ }
2034
+ resetAllSelection() {
2035
+ this.rows().forEach((row) => {
2036
+ row.isSelected.set(false);
2193
2037
  });
2038
+ // we need to clear selectedRow field because no one row selected
2039
+ this.selectedRowsData = [];
2040
+ }
2041
+ selectRow(row, state) {
2042
+ row.isSelected.set(state);
2043
+ this.storeSelectedRow(row);
2044
+ }
2045
+ multipleSelectRow(row) {
2046
+ row.isSelected.set(!row.isSelected());
2047
+ this.storeSelectedRow(row);
2048
+ return row;
2049
+ }
2050
+ getSelectedRowsData() {
2051
+ return this.selectedRowsData;
2052
+ }
2053
+ createNewRow() {
2054
+ this.newRow = new Row(-1, {}, this.getColumns());
2055
+ this.newRow.isInEditing.set(true);
2056
+ }
2057
+ /**
2058
+ * Create columns by mapping from the settings
2059
+ * @param settings
2060
+ * @private
2061
+ */
2062
+ createColumns(columnsParams) {
2063
+ const columns = columnsParams.map((params) => new Column(params.key, params, this));
2064
+ this.columns.set(columns);
2194
2065
  }
2195
- onFilter(query) {
2196
- this.source().addFilter({
2197
- field: this.column().id,
2198
- search: query,
2199
- filter: this.column().filterFunction,
2066
+ /**
2067
+ * Create rows based on current data prepared in data source
2068
+ * @private
2069
+ */
2070
+ createRows() {
2071
+ const rows = this.data().map((el, index) => {
2072
+ const row = new Row(index, el, this.getColumns());
2073
+ row.isSelected.set(this.isSelectedHasRow(el));
2074
+ return row;
2200
2075
  });
2076
+ this.rows.set(rows);
2201
2077
  }
2202
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2203
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: FilterComponent, isStandalone: true, selector: "ng2-smart-table-filter", 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 } }, ngImport: i0, template: `
2204
- @if (column().isFilterable) {
2205
- <div class="ng2-smart-filter">
2206
- @switch (column().getFilterType()) { @case ('custom') {
2207
- <ng2-custom-table-filter
2208
- [query]="query()"
2209
- [column]="column()"
2210
- [source]="source()"
2211
- [inputClass]="inputClass()"
2212
- (filter)="onFilter($event)">
2213
- </ng2-custom-table-filter>
2214
- } @default {
2215
- <ng2-build-in-table-filter
2216
- [query]="query()"
2217
- [column]="column()"
2218
- [source]="source()"
2219
- [inputClass]="inputClass()"
2220
- (filter)="onFilter($event)">
2221
- </ng2-build-in-table-filter>
2222
- } }
2223
- </div>
2078
+ isSelectedHasRow(data) {
2079
+ return this.selectedRowsData.some((rowData) => isObjectsIdentical(rowData, data));
2224
2080
  }
2225
- `, isInline: true, styles: [":host .ng2-smart-filter ::ng-deep input,:host .ng2-smart-filter ::ng-deep select{width:100%;line-height:normal;padding:.375em .75em;font-weight:400}:host .ng2-smart-filter ::ng-deep input[type=search]{box-sizing:inherit}:host .ng2-smart-filter ::ng-deep .completer-dropdown-holder{font-weight:400}:host .ng2-smart-filter ::ng-deep a{font-weight:400}\n"], dependencies: [{ kind: "component", type: CustomFilterComponent, selector: "ng2-custom-table-filter", inputs: ["query", "inputClass", "source", "column"], outputs: ["filter"] }, { kind: "component", type: BuildInFilterComponent, selector: "ng2-build-in-table-filter", inputs: ["query", "inputClass", "source", "column"], outputs: ["filter"] }] }); }
2226
- }
2227
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterComponent, decorators: [{
2228
- type: Component,
2229
- args: [{ selector: 'ng2-smart-table-filter', template: `
2230
- @if (column().isFilterable) {
2231
- <div class="ng2-smart-filter">
2232
- @switch (column().getFilterType()) { @case ('custom') {
2233
- <ng2-custom-table-filter
2234
- [query]="query()"
2235
- [column]="column()"
2236
- [source]="source()"
2237
- [inputClass]="inputClass()"
2238
- (filter)="onFilter($event)">
2239
- </ng2-custom-table-filter>
2240
- } @default {
2241
- <ng2-build-in-table-filter
2242
- [query]="query()"
2243
- [column]="column()"
2244
- [source]="source()"
2245
- [inputClass]="inputClass()"
2246
- (filter)="onFilter($event)">
2247
- </ng2-build-in-table-filter>
2248
- } }
2249
- </div>
2081
+ storeSelectedRow(row) {
2082
+ if (row.isSelected()) {
2083
+ if (this.isSelectedHasRow(row.rowData)) {
2084
+ //check if row already in selected array to prevent duplicate
2085
+ return;
2086
+ }
2087
+ this.selectedRowsData.push(row.rowData);
2088
+ }
2089
+ else {
2090
+ const index = this.selectedRowsData.findIndex((rowData) => isObjectsIdentical(rowData, row));
2091
+ this.selectedRowsData.splice(index, 1);
2092
+ }
2250
2093
  }
2251
- `, standalone: true, imports: [CustomFilterComponent, BuildInFilterComponent], styles: [":host .ng2-smart-filter ::ng-deep input,:host .ng2-smart-filter ::ng-deep select{width:100%;line-height:normal;padding:.375em .75em;font-weight:400}:host .ng2-smart-filter ::ng-deep input[type=search]{box-sizing:inherit}:host .ng2-smart-filter ::ng-deep .completer-dropdown-holder{font-weight:400}:host .ng2-smart-filter ::ng-deep a{font-weight:400}\n"] }]
2252
- }] });
2094
+ }
2253
2095
 
2254
- class AddButtonComponent {
2255
- constructor() {
2256
- this.grid = input.required();
2257
- this.source = input.required();
2258
- this.create = output();
2259
- this.isActionAdd = computed(() => {
2260
- const actions = this.grid().settings().actions;
2261
- if (!actions) {
2096
+ class Grid {
2097
+ constructor(source, settings) {
2098
+ this.currentColumnsSortState = [];
2099
+ this.settings = signal({});
2100
+ this.createFormShown = signal(false);
2101
+ this.isMultiSelectVisible = computed(() => {
2102
+ return this.settings().selectMode === 'multi';
2103
+ });
2104
+ this.isActionsVisible = computed(() => {
2105
+ const actions = this.settings().actions;
2106
+ if (!actions)
2262
2107
  return false;
2263
- }
2264
- return !!actions.add;
2108
+ return actions.edit || actions.delete || !!actions?.custom?.length;
2265
2109
  });
2266
- this.addNewButtonContent = computed(() => {
2267
- const addParams = this.grid().settings()?.add;
2268
- if (!addParams) {
2269
- return 'Add New';
2270
- }
2271
- return addParams?.addButtonContent || 'Add New';
2110
+ this.actionIsOnLeft = computed(() => {
2111
+ return (this.settings().actionsPosition || 'left') === 'left';
2112
+ });
2113
+ this.actionIsOnRight = computed(() => {
2114
+ return this.settings().actionsPosition === 'right';
2272
2115
  });
2116
+ this.setSource(source, settings);
2117
+ this.setSettings(settings);
2273
2118
  }
2274
- onAdd(event) {
2275
- event.preventDefault();
2276
- event.stopPropagation();
2277
- if (this.grid().getSetting('mode') === 'external') {
2278
- this.create.emit({
2279
- source: this.source(),
2280
- });
2119
+ setColumnsSortedEmitter(emitter) {
2120
+ this.columnsSortedEmitter = emitter;
2121
+ }
2122
+ detach() {
2123
+ if (this.sourceOnChangedSubscription) {
2124
+ this.sourceOnChangedSubscription.unsubscribe();
2281
2125
  }
2282
- else {
2283
- this.grid().createFormShown = true;
2126
+ if (this.sourceOnUpdatedSubscription) {
2127
+ this.sourceOnUpdatedSubscription.unsubscribe();
2284
2128
  }
2285
2129
  }
2286
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AddButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2287
- 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 }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { create: "create" }, host: { classAttribute: "ng2-smart-actions-title ng2-smart-actions-title-add" }, ngImport: i0, template: `
2288
- @if (isActionAdd()) {
2289
- <a
2290
- href="#"
2291
- class="ng2-smart-action ng2-smart-action-add-add"
2292
- [innerHTML]="addNewButtonContent()"
2293
- (click)="onAdd($event)"></a>
2130
+ getNewRow() {
2131
+ return this.dataSet.newRow;
2294
2132
  }
2295
- `, isInline: true }); }
2296
- }
2297
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AddButtonComponent, decorators: [{
2298
- type: Component,
2299
- args: [{
2300
- selector: '[ng2-st-add-button]',
2301
- template: `
2302
- @if (isActionAdd()) {
2303
- <a
2304
- href="#"
2305
- class="ng2-smart-action ng2-smart-action-add-add"
2306
- [innerHTML]="addNewButtonContent()"
2307
- (click)="onAdd($event)"></a>
2133
+ setSettings(settings) {
2134
+ this.updateSettingsAndDataSet(settings);
2135
+ if (settings.columnSort) {
2136
+ this.setColumnsSortState(settings.columns);
2137
+ }
2308
2138
  }
2309
- `,
2310
- host: {
2311
- class: 'ng2-smart-actions-title ng2-smart-actions-title-add',
2312
- },
2313
- standalone: true,
2314
- }]
2315
- }] });
2316
-
2317
- class TheadFiltersRowComponent {
2318
- constructor() {
2319
- this.grid = input.required();
2320
- this.source = input.required();
2321
- this.create = output();
2322
- this.filterInputClass = computed(() => {
2323
- const filterOptions = this.grid().settings()?.filter;
2324
- if (!filterOptions) {
2325
- return '';
2326
- }
2327
- return filterOptions.inputClass || '';
2328
- });
2139
+ getDataSet() {
2140
+ return this.dataSet;
2329
2141
  }
2330
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFiltersRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2331
- 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" }, ngImport: i0, template: `
2332
- @if (grid().isMultiSelectVisible()) {
2333
- <th></th>
2334
- } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
2335
- <th ng2-st-add-button [source]="source()" [grid]="grid()" (create)="create.emit($event)"></th>
2336
- } @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
2337
- <th class="ng2-smart-th {{ column.id }}">
2338
- <ng2-smart-table-filter [source]="source()" [column]="column" [inputClass]="filterInputClass()">
2339
- </ng2-smart-table-filter>
2340
- </th>
2341
- } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
2342
- <th ng2-st-add-button [grid]="grid()" [source]="source()" (create)="create.emit($event)"></th>
2343
- }
2344
- `, 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", inputs: ["column", "source", "inputClass"] }] }); }
2345
- }
2346
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFiltersRowComponent, decorators: [{
2347
- type: Component,
2348
- args: [{
2349
- selector: '[ng2-st-thead-filters-row]',
2350
- template: `
2351
- @if (grid().isMultiSelectVisible()) {
2352
- <th></th>
2353
- } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
2354
- <th ng2-st-add-button [source]="source()" [grid]="grid()" (create)="create.emit($event)"></th>
2355
- } @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
2356
- <th class="ng2-smart-th {{ column.id }}">
2357
- <ng2-smart-table-filter [source]="source()" [column]="column" [inputClass]="filterInputClass()">
2358
- </ng2-smart-table-filter>
2359
- </th>
2360
- } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
2361
- <th ng2-st-add-button [grid]="grid()" [source]="source()" (create)="create.emit($event)"></th>
2142
+ getSetting(name, defaultValue) {
2143
+ return getDeepFromObject(this.settings(), name, defaultValue);
2362
2144
  }
2363
- `,
2364
- standalone: true,
2365
- imports: [AddButtonComponent, FilterComponent],
2366
- }]
2367
- }] });
2368
-
2369
- class ActionsComponent {
2370
- constructor() {
2371
- this.grid = input.required();
2372
- this.create = output();
2373
- this.createButtonContent = computed(() => {
2374
- const addOptions = this.grid().settings().add;
2375
- if (!addOptions) {
2376
- return "Create";
2377
- }
2378
- return addOptions?.createButtonContent || "Create";
2379
- });
2380
- this.cancelButtonContent = computed(() => {
2381
- const addOptions = this.grid().settings().add;
2382
- if (!addOptions) {
2383
- return "Cancel";
2384
- }
2385
- return addOptions?.cancelButtonContent || "Cancel";
2145
+ selectRow(row, state) {
2146
+ this.dataSet.selectRow(row, state);
2147
+ }
2148
+ multipleSelectRow(row) {
2149
+ this.dataSet.multipleSelectRow(row);
2150
+ }
2151
+ edit(row) {
2152
+ row.isInEditing.set(true);
2153
+ }
2154
+ create(row, confirmEmitter) {
2155
+ row.pending.set(true);
2156
+ const deferred = new Deferred();
2157
+ deferred.promise
2158
+ .then((newData) => {
2159
+ row.pending.set(false);
2160
+ newData = newData || row.getNewData();
2161
+ this.source.prepend(newData).then(() => {
2162
+ this.createFormShown.set(false);
2163
+ this.dataSet.createNewRow();
2164
+ });
2165
+ })
2166
+ .catch(() => {
2167
+ row.pending.set(false);
2386
2168
  });
2169
+ if (this.getSetting('add.confirmCreate', false)) {
2170
+ confirmEmitter.emit({
2171
+ newData: row.getNewData(),
2172
+ source: this.source,
2173
+ confirm: deferred,
2174
+ });
2175
+ }
2176
+ else {
2177
+ deferred.resolve();
2178
+ row.pending.set(false);
2179
+ }
2387
2180
  }
2388
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2389
- 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: `
2390
- <a
2391
- href="#"
2392
- class="ng2-smart-action ng2-smart-action-add-create"
2393
- [innerHTML]="createButtonContent()"
2394
- (click)="$event.preventDefault(); create.emit($event)"
2395
- ></a>
2396
- <a
2397
- href="#"
2398
- class="ng2-smart-action ng2-smart-action-add-cancel"
2399
- [innerHTML]="cancelButtonContent()"
2400
- (click)="$event.preventDefault(); grid().createFormShown = false"
2401
- ></a>
2402
- `, isInline: true }); }
2403
- }
2404
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ActionsComponent, decorators: [{
2405
- type: Component,
2406
- args: [{
2407
- selector: "ng2-st-actions",
2408
- template: `
2409
- <a
2410
- href="#"
2411
- class="ng2-smart-action ng2-smart-action-add-create"
2412
- [innerHTML]="createButtonContent()"
2413
- (click)="$event.preventDefault(); create.emit($event)"
2414
- ></a>
2415
- <a
2416
- href="#"
2417
- class="ng2-smart-action ng2-smart-action-add-cancel"
2418
- [innerHTML]="cancelButtonContent()"
2419
- (click)="$event.preventDefault(); grid().createFormShown = false"
2420
- ></a>
2421
- `,
2422
- standalone: true,
2423
- }]
2424
- }] });
2425
-
2426
- class TheadFormRowComponent {
2427
- constructor() {
2428
- this.grid = input.required();
2429
- this.create = output();
2430
- this.addInputClass = computed(() => {
2431
- const addOptions = this.grid().settings()?.add;
2432
- if (!addOptions) {
2433
- return '';
2434
- }
2435
- return addOptions.inputClass || '';
2181
+ save(row, confirmEmitter) {
2182
+ row.pending.set(true);
2183
+ const deferred = new Deferred();
2184
+ deferred.promise
2185
+ .then((newData) => {
2186
+ row.pending.set(false);
2187
+ newData = newData || row.getNewData();
2188
+ this.source.update(row.rowData, newData).then(() => {
2189
+ row.isInEditing.set(false);
2190
+ });
2191
+ })
2192
+ .catch(() => {
2193
+ row.pending.set(false);
2194
+ row.isInEditing.set(false);
2436
2195
  });
2196
+ if (this.getSetting('edit.confirmSave', false)) {
2197
+ confirmEmitter.emit({
2198
+ data: row.rowData,
2199
+ newData: row.getNewData(),
2200
+ source: this.source,
2201
+ confirm: deferred,
2202
+ });
2203
+ }
2204
+ else {
2205
+ deferred.resolve();
2206
+ row.pending.set(false);
2207
+ }
2437
2208
  }
2438
- onCreate(event) {
2439
- event.stopPropagation();
2440
- this.grid().create(this.grid().getNewRow(), this.createConfirm);
2209
+ delete(row, confirmEmitter) {
2210
+ row.pending.set(true);
2211
+ const deferred = new Deferred();
2212
+ deferred.promise
2213
+ .then(() => {
2214
+ row.pending.set(false);
2215
+ this.source.remove(row.rowData);
2216
+ })
2217
+ .catch(() => {
2218
+ row.pending.set(false);
2219
+ // doing nothing
2220
+ });
2221
+ if (this.getSetting('delete.confirmDelete', true)) {
2222
+ confirmEmitter.emit({
2223
+ data: row.rowData,
2224
+ source: this.source,
2225
+ confirm: deferred,
2226
+ });
2227
+ }
2228
+ else {
2229
+ deferred.resolve(null);
2230
+ row.pending.set(false);
2231
+ }
2232
+ if (row.isSelected()) {
2233
+ this.dataSet.selectRow(row, false);
2234
+ }
2441
2235
  }
2442
- getVisibleCells() {
2443
- return (this.grid().getNewRow().cells() || []).filter((cell) => !cell.getColumn().hide);
2236
+ processDataChange(event) {
2237
+ if (event.action === 'load') {
2238
+ this.dataSet.resetAllSelection();
2239
+ }
2240
+ if (event.action === 'update') {
2241
+ const changedRow = this.dataSet.findRowByData(event.oldItem);
2242
+ if (changedRow) {
2243
+ changedRow.setData(event.newItem || event.oldItem);
2244
+ }
2245
+ return;
2246
+ }
2247
+ this.dataSet.setData(event.elements);
2444
2248
  }
2445
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFormRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2446
- 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: `
2447
- @if (grid().isMultiSelectVisible()) {
2448
- <td></td>
2449
- } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
2450
- <td class="ng2-smart-actions">
2451
- <ng2-st-actions [grid]="grid()" (create)="onCreate($event)"></ng2-st-actions>
2452
- </td>
2453
- } @for (cell of getVisibleCells(); track cell.getId()+ $index) {
2454
- <td>
2455
- <ng2-smart-table-cell
2456
- [cell]="cell"
2457
- [inputClass]="addInputClass()"
2458
- [isInEditing]="grid().getNewRow().isInEditing()">
2459
- </ng2-smart-table-cell>
2460
- </td>
2461
- } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
2462
- <td class="ng2-smart-actions">
2463
- <ng2-st-actions [grid]="grid()" (create)="onCreate($event)"></ng2-st-actions>
2464
- </td>
2465
- }
2466
- `, 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"] }] }); }
2467
- }
2468
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFormRowComponent, decorators: [{
2469
- type: Component,
2470
- args: [{
2471
- selector: '[ng2-st-thead-form-row]',
2472
- template: `
2473
- @if (grid().isMultiSelectVisible()) {
2474
- <td></td>
2475
- } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
2476
- <td class="ng2-smart-actions">
2477
- <ng2-st-actions [grid]="grid()" (create)="onCreate($event)"></ng2-st-actions>
2478
- </td>
2479
- } @for (cell of getVisibleCells(); track cell.getId()+ $index) {
2480
- <td>
2481
- <ng2-smart-table-cell
2482
- [cell]="cell"
2483
- [inputClass]="addInputClass()"
2484
- [isInEditing]="grid().getNewRow().isInEditing()">
2485
- </ng2-smart-table-cell>
2486
- </td>
2487
- } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
2488
- <td class="ng2-smart-actions">
2489
- <ng2-st-actions [grid]="grid()" (create)="onCreate($event)"></ng2-st-actions>
2490
- </td>
2249
+ prepareSource(source, initialSort, initialPaging) {
2250
+ const preparedSource = source || new LocalDataSource();
2251
+ if (initialSort && !source?.getSort().field) {
2252
+ preparedSource.setSort(initialSort, false);
2253
+ }
2254
+ if (initialPaging && initialPaging?.display) {
2255
+ preparedSource.pagingConf.update((old) => ({
2256
+ ...old,
2257
+ ...initialPaging,
2258
+ }));
2259
+ }
2260
+ return preparedSource;
2491
2261
  }
2492
- `,
2493
- standalone: true,
2494
- imports: [ActionsComponent, CellComponent],
2495
- }]
2496
- }], propDecorators: { createConfirm: [{
2497
- type: Input
2498
- }] } });
2499
-
2500
- class ActionsTitleComponent {
2501
- constructor() {
2502
- this.grid = input.required();
2503
- this.actionsColumnTitle = computed(() => {
2504
- const actions = this.grid().settings().actions;
2505
- if (!actions) {
2506
- return "Actions";
2507
- }
2508
- return actions.columnTitle || "Actions";
2509
- });
2262
+ getInitialSort(columns) {
2263
+ if (!columns || !columns.length) {
2264
+ return false;
2265
+ }
2266
+ const defaultSortColumn = columns?.find((column) => column.sortDirection);
2267
+ if (!defaultSortColumn) {
2268
+ return false;
2269
+ }
2270
+ return {
2271
+ field: defaultSortColumn.key,
2272
+ title: defaultSortColumn.title,
2273
+ direction: defaultSortColumn.sortDirection || 'asc',
2274
+ compare: defaultSortColumn.compareFunction,
2275
+ };
2510
2276
  }
2511
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ActionsTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2512
- 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 }); }
2513
- }
2514
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ActionsTitleComponent, decorators: [{
2515
- type: Component,
2516
- args: [{
2517
- selector: "[ng2-st-actions-title]",
2518
- template: ` <div class="ng2-smart-title">{{ actionsColumnTitle() }}</div> `,
2519
- standalone: true,
2520
- host: {
2521
- class: "ng2-smart-actions",
2522
- },
2523
- }]
2524
- }] });
2525
-
2526
- class CheckboxSelectAllComponent {
2527
- constructor() {
2528
- this.grid = input.required();
2277
+ getSelectedRowsData() {
2278
+ return this.dataSet.getSelectedRowsData();
2529
2279
  }
2530
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxSelectAllComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2531
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: CheckboxSelectAllComponent, isStandalone: true, selector: "[ng2-st-checkbox-select-all]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
2532
- <input type="checkbox" [ngModel]="this.grid().dataSet.isAllSelected()" />
2533
- `, 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: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
2534
- }
2535
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxSelectAllComponent, decorators: [{
2536
- type: Component,
2537
- args: [{
2538
- selector: "[ng2-st-checkbox-select-all]",
2539
- template: `
2540
- <input type="checkbox" [ngModel]="this.grid().dataSet.isAllSelected()" />
2541
- `,
2542
- standalone: true,
2543
- imports: [FormsModule],
2544
- }]
2545
- }] });
2546
-
2547
- class TitleComponent {
2548
- constructor() {
2549
- this.source = input.required();
2550
- this.column = input.required();
2551
- this.destroyRef = inject(DestroyRef);
2552
- this.currentSortDirection = signal('');
2280
+ selectAllRows(status) {
2281
+ this.dataSet.setSelectAll(status);
2553
2282
  }
2554
- ngOnInit() {
2555
- this.source()
2556
- .onChanged()
2557
- .pipe(map(({ sort }) => {
2558
- if (sort.field === this.column().id) {
2559
- return sort.direction;
2283
+ updateSettingsAndDataSet(settings, emittedEvent = 'refresh') {
2284
+ this.settings.set(settings);
2285
+ if (this.dataSet) {
2286
+ this.dataSet.setColumnsConfig(settings.columns);
2287
+ }
2288
+ else {
2289
+ const editorInputClass = settings.edit ? settings.edit.inputClass || '' : '';
2290
+ this.dataSet = new DataSet([], settings.columns, editorInputClass);
2291
+ }
2292
+ if (this.source) {
2293
+ this.source.pagingConf.update((old) => ({
2294
+ ...old,
2295
+ display: this.getSetting('pager.display'),
2296
+ }));
2297
+ if (emittedEvent === 'columnRefresh') {
2298
+ this.source.columnRefresh();
2560
2299
  }
2561
2300
  else {
2562
- return '';
2301
+ this.source.refresh();
2563
2302
  }
2564
- }), takeUntilDestroyed(this.destroyRef))
2565
- .subscribe(this.currentSortDirection.set);
2566
- }
2567
- _sort(event) {
2568
- event.preventDefault();
2569
- this.source().setSort({
2570
- field: this.column().id,
2571
- direction: this.currentSortDirection() === 'desc' ? 'asc' : 'desc',
2572
- compare: this.column().compareFunction,
2573
- });
2303
+ }
2574
2304
  }
2575
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2576
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TitleComponent, isStandalone: true, selector: "ng2-smart-table-title", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
2577
- @if (column().isSortable) {
2578
- <a href="#" (click)="_sort($event)" class="ng2-smart-sort-link sort" [class]="currentSortDirection()">
2579
- {{ column().title }}
2580
- </a>
2581
- } @else {
2582
- <span class="ng2-smart-sort">{{ column().title }}</span>
2305
+ setSource(source, settings) {
2306
+ const initialSort = this.getInitialSort(settings?.columns);
2307
+ this.source = this.prepareSource(source, initialSort, settings?.pager || false);
2308
+ this.detach();
2309
+ this.sourceOnChangedSubscription = this.source.onChanged().subscribe((changes) => this.processDataChange(changes));
2583
2310
  }
2584
- `, isInline: true, styles: ["a.sort{white-space:nowrap}a.sort.asc,a.sort.desc{font-weight:700}a.sort.asc:after,a.sort.desc:after{content:\"\";display:inline-block;width:0;height:0;border-bottom:4px solid rgba(0,0,0,.3);border-top:4px solid transparent;border-left:4px solid transparent;border-right:4px solid transparent;margin-bottom:2px}a.sort.desc:after{-webkit-transform:rotate(-180deg);transform:rotate(-180deg);margin-bottom:-2px}\n"] }); }
2585
- }
2586
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TitleComponent, decorators: [{
2587
- type: Component,
2588
- args: [{ selector: 'ng2-smart-table-title', template: `
2589
- @if (column().isSortable) {
2590
- <a href="#" (click)="_sort($event)" class="ng2-smart-sort-link sort" [class]="currentSortDirection()">
2591
- {{ column().title }}
2592
- </a>
2593
- } @else {
2594
- <span class="ng2-smart-sort">{{ column().title }}</span>
2311
+ // ------------------------------- column sort
2312
+ async getSortedTableColumns(newState, columns) {
2313
+ const sortedArray = [];
2314
+ newState.forEach((item2) => {
2315
+ const index = columns.findIndex((item1) => item1.key === item2.key && item1.title === item2.title);
2316
+ if (index > -1) {
2317
+ sortedArray.push({ ...columns[index], hide: !!item2.hide });
2318
+ }
2319
+ });
2320
+ return Promise.resolve(sortedArray);
2595
2321
  }
2596
- `, standalone: true, styles: ["a.sort{white-space:nowrap}a.sort.asc,a.sort.desc{font-weight:700}a.sort.asc:after,a.sort.desc:after{content:\"\";display:inline-block;width:0;height:0;border-bottom:4px solid rgba(0,0,0,.3);border-top:4px solid transparent;border-left:4px solid transparent;border-right:4px solid transparent;margin-bottom:2px}a.sort.desc:after{-webkit-transform:rotate(-180deg);transform:rotate(-180deg);margin-bottom:-2px}\n"] }]
2597
- }] });
2598
-
2599
- class ColumnTitleComponent {
2600
- constructor() {
2601
- this.source = input.required();
2602
- this.column = input.required();
2322
+ async applyColumnsSortState(state, emitEvent = true) {
2323
+ this.currentColumnsSortState = this.getMergedColumnStates(state);
2324
+ this.updateSettingsAndDataSet({
2325
+ ...this.settings(),
2326
+ columns: await this.getSortedTableColumns(this.currentColumnsSortState, this.settings()?.columns),
2327
+ }, 'columnRefresh');
2328
+ if (this.columnStateStorageKey) {
2329
+ setLocalStorage(this.columnStateStorageKey, this.currentColumnsSortState);
2330
+ }
2331
+ if (emitEvent) {
2332
+ this.columnsSortedEmitter.emit(this.currentColumnsSortState);
2333
+ }
2603
2334
  }
2604
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ColumnTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2605
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: ColumnTitleComponent, isStandalone: true, selector: "ng2-st-column-title", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
2606
- <div class="ng2-smart-title">
2607
- <ng2-smart-table-title [source]="source()" [column]="column()"></ng2-smart-table-title>
2608
- </div>
2609
- `, isInline: true, dependencies: [{ kind: "component", type: TitleComponent, selector: "ng2-smart-table-title", inputs: ["source", "column"] }] }); }
2610
- }
2611
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ColumnTitleComponent, decorators: [{
2612
- type: Component,
2613
- args: [{
2614
- selector: 'ng2-st-column-title',
2615
- template: `
2616
- <div class="ng2-smart-title">
2617
- <ng2-smart-table-title [source]="source()" [column]="column()"></ng2-smart-table-title>
2618
- </div>
2619
- `,
2620
- standalone: true,
2621
- imports: [TitleComponent],
2622
- }]
2623
- }] });
2624
-
2625
- class TheadTitlesRowComponent {
2626
- constructor() {
2627
- this.grid = input.required();
2628
- this.source = input.required();
2629
- this.selectAllRows = output();
2335
+ setColumnsSortState(columns) {
2336
+ const columnsState = this.getColumnsStateFromSettings(columns);
2337
+ if (this.columnStateStorageKey) {
2338
+ const storageState = getLocalStorage(this.columnStateStorageKey);
2339
+ if (!storageState) {
2340
+ this.currentColumnsSortState = columnsState;
2341
+ setLocalStorage(this.columnStateStorageKey, columnsState);
2342
+ return;
2343
+ }
2344
+ const merged = this.getMergedColumnStates(storageState, columnsState);
2345
+ this.applyColumnsSortState(merged, false);
2346
+ return;
2347
+ }
2348
+ this.applyColumnsSortState(columnsState, false);
2630
2349
  }
2631
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadTitlesRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2632
- 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: { selectAllRows: "selectAllRows" }, ngImport: i0, template: `
2633
- @if (grid().isMultiSelectVisible()) {
2634
- <th ng2-st-checkbox-select-all [grid]="grid()" (click)="selectAllRows.emit()"></th>
2635
- } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
2636
-
2637
- <th ng2-st-actions-title [grid]="grid()"></th>
2638
- } @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
2639
- <th class="ng2-smart-th {{ column.id }}" [class]="column.class" [style.width]="column.width">
2640
- <ng2-st-column-title [source]="source()" [column]="column"></ng2-st-column-title>
2641
- </th>
2642
- } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
2643
- <th ng2-st-actions-title [grid]="grid()"></th>
2644
- }
2645
- `, isInline: true, dependencies: [{ kind: "component", type: CheckboxSelectAllComponent, selector: "[ng2-st-checkbox-select-all]", inputs: ["grid"] }, { kind: "component", type: ActionsTitleComponent, selector: "[ng2-st-actions-title]", inputs: ["grid"] }, { kind: "component", type: ColumnTitleComponent, selector: "ng2-st-column-title", inputs: ["source", "column"] }] }); }
2646
- }
2647
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadTitlesRowComponent, decorators: [{
2648
- type: Component,
2649
- args: [{
2650
- selector: '[ng2-st-thead-titles-row]',
2651
- template: `
2652
- @if (grid().isMultiSelectVisible()) {
2653
- <th ng2-st-checkbox-select-all [grid]="grid()" (click)="selectAllRows.emit()"></th>
2654
- } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
2655
-
2656
- <th ng2-st-actions-title [grid]="grid()"></th>
2657
- } @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
2658
- <th class="ng2-smart-th {{ column.id }}" [class]="column.class" [style.width]="column.width">
2659
- <ng2-st-column-title [source]="source()" [column]="column"></ng2-st-column-title>
2660
- </th>
2661
- } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
2662
- <th ng2-st-actions-title [grid]="grid()"></th>
2350
+ getColumnsStateFromSettings(columns) {
2351
+ return (columns || this.settings().columns || []).map((column) => ({
2352
+ key: column.key,
2353
+ title: column.title,
2354
+ hide: !!column.hide,
2355
+ moveDisabled: !!column.moveDisabled,
2356
+ }));
2663
2357
  }
2664
- `,
2665
- standalone: true,
2666
- imports: [CheckboxSelectAllComponent, ActionsTitleComponent, ColumnTitleComponent],
2667
- }]
2668
- }] });
2669
-
2670
- class Ng2SmartTableTheadComponent {
2671
- constructor() {
2672
- this.grid = input.required();
2673
- this.source = input.required();
2674
- this.selectAllRows = output();
2675
- this.create = output();
2676
- this.isHideHeader = computed(() => {
2677
- return this.grid().settings()?.hideHeader || false;
2358
+ getMergedColumnStates(newState, columnsState) {
2359
+ const columnsSettings = columnsState || this.getColumnsStateFromSettings();
2360
+ // merge new columns state with state from storage
2361
+ const filtered = [];
2362
+ newState.forEach((state) => {
2363
+ const fined = columnsSettings.find((column) => column.title === state.title && column.key === state.key);
2364
+ if (fined) {
2365
+ filtered.push({ ...fined, hide: fined.moveDisabled ? fined.hide : state.hide });
2366
+ }
2678
2367
  });
2679
- this.isHideSubHeader = computed(() => {
2680
- return this.grid().settings()?.hideSubHeader || false;
2368
+ // find new columns witch not exist in storage state
2369
+ const newColumns = columnsSettings.filter((state) => {
2370
+ return !filtered.some((column) => column.title === state.title && column.key === state.key);
2681
2371
  });
2372
+ return [...filtered, ...newColumns];
2373
+ }
2374
+ get columnStateStorageKey() {
2375
+ return this.settings().columnSortStorageKey;
2682
2376
  }
2683
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTheadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2684
- 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: { selectAllRows: "selectAllRows", create: "create" }, ngImport: i0, template: "@if (!isHideHeader()) {\n <tr ng2-st-thead-titles-row\n class=\"ng2-smart-titles\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (selectAllRows)=\"selectAllRows.emit()\">\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 </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: ["selectAllRows"] }, { kind: "component", type: TheadFiltersRowComponent, selector: "[ng2-st-thead-filters-row]", inputs: ["grid", "source"], outputs: ["create"] }, { kind: "component", type: TheadFormRowComponent, selector: "[ng2-st-thead-form-row]", inputs: ["grid", "createConfirm"], outputs: ["create"] }] }); }
2685
2377
  }
2686
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTheadComponent, decorators: [{
2687
- type: Component,
2688
- args: [{ selector: '[ng2-st-thead]', standalone: true, imports: [TheadTitlesRowComponent, TheadFiltersRowComponent, TheadFormRowComponent], template: "@if (!isHideHeader()) {\n <tr ng2-st-thead-titles-row\n class=\"ng2-smart-titles\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (selectAllRows)=\"selectAllRows.emit()\">\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 </tr>\n}\n\n@if (grid().createFormShown) {\n <tr ng2-st-thead-form-row\n [grid]=\"grid()\"\n [createConfirm]=\"createConfirm\">\n </tr>\n}\n" }]
2689
- }], propDecorators: { createConfirm: [{
2690
- type: Input
2691
- }] } });
2692
2378
 
2693
2379
  class Ng2SmartTableComponent {
2694
- constructor() {
2380
+ constructor(elementRef, ngZone) {
2381
+ this.elementRef = elementRef;
2382
+ this.ngZone = ngZone;
2695
2383
  this.source = input.required();
2696
2384
  this.settings = input.required();
2697
2385
  this.multiRowSelect = output();
2698
2386
  this.rowClicked = output();
2699
2387
  this.columnsSorted = output();
2700
- this.delete = output();
2388
+ this.deleteEmitter = output();
2389
+ this.deleteConfirm = output();
2701
2390
  this.edit = output();
2391
+ this.editConfirm = output();
2702
2392
  this.editCancel = output();
2703
2393
  this.create = output();
2704
- this.custom = output();
2705
- this.deleteConfirm = output();
2706
- this.editConfirm = output();
2707
2394
  this.createConfirm = output();
2395
+ this.custom = output();
2708
2396
  this.tableClass = computed(() => {
2709
2397
  return this.settings().attr?.class || '';
2710
2398
  });
@@ -2716,8 +2404,18 @@ class Ng2SmartTableComponent {
2716
2404
  return pager ? pager.display : false;
2717
2405
  });
2718
2406
  this.rowClassFunction = computed(() => {
2719
- return this.settings().rowClassFunction || (() => '');
2407
+ const settings = this.settings();
2408
+ return settings.rowClassFunction ? (rowData) => settings.rowClassFunction(rowData) : () => '';
2409
+ });
2410
+ this.isMobileView = signal(false);
2411
+ this.tableWidthMobileBreakpoint = computed(() => {
2412
+ return this.settings().tableWidthMobileBreakpoint;
2720
2413
  });
2414
+ this.isExternalMode = computed(() => {
2415
+ return this.grid.settings().mode === 'external';
2416
+ });
2417
+ this.resizeObserver = null;
2418
+ this.resizeDebounceTimer = null;
2721
2419
  }
2722
2420
  ngOnChanges({ settings }) {
2723
2421
  if (this.grid) {
@@ -2729,8 +2427,12 @@ class Ng2SmartTableComponent {
2729
2427
  this.initGrid();
2730
2428
  }
2731
2429
  }
2430
+ ngAfterViewInit() {
2431
+ this.setupResizeObserver();
2432
+ }
2732
2433
  ngOnDestroy() {
2733
2434
  this.grid.detach();
2435
+ this.destroyResizeObserver();
2734
2436
  }
2735
2437
  multipleSelectRow(row) {
2736
2438
  this.grid.multipleSelectRow(row);
@@ -2745,29 +2447,105 @@ class Ng2SmartTableComponent {
2745
2447
  }
2746
2448
  emitUserRowClicked(row) {
2747
2449
  this.rowClicked.emit({
2748
- data: row ? row.getData() : null,
2450
+ data: row ? row.rowData : null,
2749
2451
  source: this.source(),
2750
2452
  });
2751
2453
  }
2454
+ customActionEmitted(event) {
2455
+ this.custom.emit(event);
2456
+ }
2457
+ editEmitted(row) {
2458
+ if (this.isExternalMode()) {
2459
+ this.edit.emit({
2460
+ data: row.rowData,
2461
+ source: this.source(),
2462
+ });
2463
+ return;
2464
+ }
2465
+ row.isInEditing.set(true);
2466
+ }
2467
+ editConfirmed(row) {
2468
+ this.grid.save(row, this.editConfirm);
2469
+ }
2470
+ editCanceled(row) {
2471
+ this.editCancel.emit({ data: row.rowData, source: this.source() });
2472
+ }
2473
+ createEmitted() {
2474
+ if (this.isExternalMode()) {
2475
+ this.create.emit({ data: this.grid.getNewRow().getNewData(), source: this.source() });
2476
+ }
2477
+ else {
2478
+ this.grid.createFormShown.set(true);
2479
+ }
2480
+ }
2481
+ createConfirmed() {
2482
+ this.grid.create(this.grid.getNewRow(), this.createConfirm);
2483
+ }
2484
+ deleEmitted(row) {
2485
+ if (this.isExternalMode()) {
2486
+ this.deleteEmitter.emit({
2487
+ data: row.rowData,
2488
+ source: this.source(),
2489
+ });
2490
+ }
2491
+ else {
2492
+ this.grid.delete(row, this.deleteConfirm);
2493
+ }
2494
+ }
2752
2495
  initGrid() {
2753
2496
  this.grid = new Grid(this.source(), this.settings());
2754
2497
  this.grid.setColumnsSortedEmitter(this.columnsSorted);
2755
2498
  }
2756
2499
  emitUserSelectRow(row) {
2757
2500
  this.multiRowSelect.emit({
2758
- data: row ? row.getData() : null,
2501
+ data: row ? row.rowData : null,
2759
2502
  isSelected: row ? row.isSelected() : false,
2760
2503
  source: this.source(),
2761
2504
  selected: this.grid.dataSet.getSelectedRowsData(),
2762
2505
  });
2763
2506
  }
2764
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2765
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableComponent, isStandalone: true, selector: "ng2-smart-table", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: true, transformFunction: null } }, 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()\">\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: ["selectAllRows", "create"] }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2507
+ setupResizeObserver() {
2508
+ if (typeof ResizeObserver === 'undefined' || !this.tableWidthMobileBreakpoint()) {
2509
+ return;
2510
+ }
2511
+ this.resizeObserver = new ResizeObserver((entries) => {
2512
+ if (this.resizeDebounceTimer) {
2513
+ clearTimeout(this.resizeDebounceTimer);
2514
+ }
2515
+ this.resizeDebounceTimer = setTimeout(() => {
2516
+ this.ngZone.run(() => {
2517
+ for (const entry of entries) {
2518
+ const breakpoint = this.tableWidthMobileBreakpoint();
2519
+ if (breakpoint) {
2520
+ const containerWidth = entry.contentRect.width;
2521
+ this.isMobileView.set(containerWidth < breakpoint);
2522
+ }
2523
+ }
2524
+ });
2525
+ }, 20);
2526
+ });
2527
+ const hostElement = this.elementRef.nativeElement;
2528
+ if (hostElement) {
2529
+ this.resizeObserver.observe(hostElement);
2530
+ }
2531
+ }
2532
+ destroyResizeObserver() {
2533
+ if (this.resizeObserver) {
2534
+ this.resizeObserver.disconnect();
2535
+ this.resizeObserver = null;
2536
+ }
2537
+ if (this.resizeDebounceTimer) {
2538
+ clearTimeout(this.resizeDebounceTimer);
2539
+ this.resizeDebounceTimer = null;
2540
+ }
2541
+ }
2542
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
2543
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableComponent, isStandalone: true, selector: "ng2-smart-table", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { multiRowSelect: "multiRowSelect", rowClicked: "rowClicked", columnsSorted: "columnsSorted", deleteEmitter: "deleteEmitter", deleteConfirm: "deleteConfirm", edit: "edit", editConfirm: "editConfirm", editCancel: "editCancel", create: "create", createConfirm: "createConfirm", custom: "custom" }, usesOnChanges: true, ngImport: i0, template: "<table [id]=\"tableId()\" [class]=\"tableClass()\" [class.mobile-view]=\"isMobileView()\">\n <thead\n ng2-st-thead\n [grid]=\"grid\"\n [source]=\"source()\"\n [isMobileView]=\"isMobileView()\"\n (create)=\"createEmitted()\"\n (selectAllRows)=\"onSelectAllRows()\"></thead>\n\n <tbody\n ng2-st-tbody\n [grid]=\"grid\"\n [source]=\"source()\"\n [rowClassFunction]=\"rowClassFunction()\"\n [isMobileView]=\"isMobileView()\"\n (deleteEmitter)=\"deleEmitted($event)\"\n (edit)=\"editEmitted($event)\"\n (editConfirmed)=\"editConfirmed($event)\"\n (editCancel)=\"editCanceled($event)\"\n (createConfirmed)=\"createConfirmed()\"\n (customActionEmitter)=\"customActionEmitted($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\"></tbody>\n</table>\n\n@if (isPagerDisplay()) {\n <ng2-smart-table-pager [source]=\"source()\"> </ng2-smart-table-pager>\n}\n", styles: [":host{max-width:100%;display:block}:host table{width:100%}\n"], dependencies: [{ kind: "component", type: Ng2SmartTableTheadComponent, selector: "[ng2-st-thead]", inputs: ["grid", "source", "isMobileView"], outputs: ["selectAllRows", "create"] }, { kind: "component", type: Ng2SmartTableTbodyComponent, selector: "[ng2-st-tbody]", inputs: ["grid", "source", "rowClassFunction", "isMobileView"], outputs: ["edit", "editConfirmed", "editCancel", "createConfirmed", "deleteEmitter", "customActionEmitter", "userClickedRow", "multipleSelectRow"] }, { kind: "component", type: PagerComponent, selector: "ng2-smart-table-pager", inputs: ["source"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2766
2544
  }
2767
2545
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableComponent, decorators: [{
2768
2546
  type: Component,
2769
- args: [{ selector: 'ng2-smart-table', standalone: true, imports: [Ng2SmartTableTheadComponent, Ng2SmartTableTbodyComponent, PagerComponent], changeDetection: ChangeDetectionStrategy.OnPush, 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()\">\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"] }]
2770
- }] });
2547
+ args: [{ selector: 'ng2-smart-table', imports: [Ng2SmartTableTheadComponent, Ng2SmartTableTbodyComponent, PagerComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<table [id]=\"tableId()\" [class]=\"tableClass()\" [class.mobile-view]=\"isMobileView()\">\n <thead\n ng2-st-thead\n [grid]=\"grid\"\n [source]=\"source()\"\n [isMobileView]=\"isMobileView()\"\n (create)=\"createEmitted()\"\n (selectAllRows)=\"onSelectAllRows()\"></thead>\n\n <tbody\n ng2-st-tbody\n [grid]=\"grid\"\n [source]=\"source()\"\n [rowClassFunction]=\"rowClassFunction()\"\n [isMobileView]=\"isMobileView()\"\n (deleteEmitter)=\"deleEmitted($event)\"\n (edit)=\"editEmitted($event)\"\n (editConfirmed)=\"editConfirmed($event)\"\n (editCancel)=\"editCanceled($event)\"\n (createConfirmed)=\"createConfirmed()\"\n (customActionEmitter)=\"customActionEmitted($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\"></tbody>\n</table>\n\n@if (isPagerDisplay()) {\n <ng2-smart-table-pager [source]=\"source()\"> </ng2-smart-table-pager>\n}\n", styles: [":host{max-width:100%;display:block}:host table{width:100%}\n"] }]
2548
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.NgZone }] });
2771
2549
 
2772
2550
  /**
2773
2551
  * Generated bundle index. Do not edit.