@den4ik92/ng2-smart-table 19.1.6 → 19.2.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 (50) hide show
  1. package/fesm2022/den4ik92-ng2-smart-table.mjs +704 -1212
  2. package/fesm2022/den4ik92-ng2-smart-table.mjs.map +1 -1
  3. package/lib/components/cell/cell-edit-mode/build-in-editor.component.d.ts +8 -0
  4. package/lib/components/cell/cell-edit-mode/custom-edit.component.d.ts +2 -2
  5. package/lib/components/cell/cell-edit-mode/edit-cell.component.d.ts +2 -2
  6. package/lib/components/cell/cell-editors/base-editor.component.d.ts +13 -0
  7. package/lib/components/cell/cell-editors/checkbox-editor.component.d.ts +2 -2
  8. package/lib/components/cell/cell-editors/input-editor.component.d.ts +2 -3
  9. package/lib/components/cell/cell-editors/select-editor.component.d.ts +2 -3
  10. package/lib/components/cell/cell-editors/textarea-editor.component.d.ts +2 -3
  11. package/lib/components/filter/build-in-filter.component.d.ts +11 -0
  12. package/lib/components/filter/custom-filter.component.d.ts +13 -6
  13. package/lib/components/filter/filter-types/base-filter.component.d.ts +31 -0
  14. package/lib/components/filter/filter-types/checkbox-filter.component.d.ts +7 -6
  15. package/lib/components/filter/filter-types/input-filter.component.d.ts +2 -8
  16. package/lib/components/filter/filter-types/select-filter.component.d.ts +2 -7
  17. package/lib/components/filter/filter.component.d.ts +12 -7
  18. package/lib/components/pager/pager.component.d.ts +17 -32
  19. package/lib/components/table-columns-editor/column-editor.directive.d.ts +1 -1
  20. package/lib/components/tbody/cells/custom.component.d.ts +2 -2
  21. package/lib/components/tbody/cells/edit-delete.component.d.ts +2 -2
  22. package/lib/components/tbody/tbody.component.d.ts +2 -4
  23. package/lib/components/thead/cells/actions-title.component.d.ts +1 -1
  24. package/lib/components/thead/cells/actions.component.d.ts +2 -2
  25. package/lib/components/thead/cells/add-button.component.d.ts +2 -2
  26. package/lib/components/thead/cells/column-title.component.d.ts +3 -4
  27. package/lib/components/thead/cells/title/title.component.d.ts +11 -15
  28. package/lib/components/thead/rows/thead-filters-row.component.d.ts +4 -7
  29. package/lib/components/thead/rows/thead-titles-row.component.d.ts +4 -7
  30. package/lib/components/thead/thead.component.d.ts +4 -6
  31. package/lib/lib/data-set/cell.d.ts +1 -1
  32. package/lib/lib/data-set/column.d.ts +6 -12
  33. package/lib/lib/data-set/data-set.d.ts +8 -7
  34. package/lib/lib/data-set/row.d.ts +5 -5
  35. package/lib/lib/data-source/data-source.d.ts +25 -28
  36. package/lib/lib/data-source/local/local.data-source.d.ts +8 -45
  37. package/lib/lib/data-source/local/local.filter.d.ts +2 -4
  38. package/lib/lib/data-source/local/local.pager.d.ts +1 -3
  39. package/lib/lib/data-source/server/server.data-source.d.ts +25 -0
  40. package/lib/lib/grid.d.ts +7 -15
  41. package/lib/lib/interfaces/smart-table.models.d.ts +41 -26
  42. package/lib/ng2-smart-table.component.d.ts +6 -7
  43. package/package.json +1 -1
  44. package/public-api.d.ts +12 -11
  45. package/lib/components/cell/cell-edit-mode/default-edit.component.d.ts +0 -9
  46. package/lib/components/cell/cell-edit-mode/edit-cell-default.d.ts +0 -8
  47. package/lib/components/cell/cell-editors/default-editor.d.ts +0 -13
  48. package/lib/components/filter/default-filter.component.d.ts +0 -6
  49. package/lib/components/filter/filter-default.d.ts +0 -13
  50. package/lib/components/filter/filter-types/default-filter.d.ts +0 -27
@@ -1,53 +1,66 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, Component, output, Input, signal, effect, computed, inject, ElementRef, Directive, ViewContainerRef, ViewChild, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
2
+ import { input, Component, output, signal, effect, computed, inject, ElementRef, Directive, ViewContainerRef, ViewChild, ChangeDetectionStrategy, Input, ChangeDetectorRef, DestroyRef } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { UntypedFormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
+ import { distinctUntilChanged, debounceTime, takeUntil, switchMap, map } from 'rxjs/operators';
3
6
  import { Overlay, OverlayConfig } from '@angular/cdk/overlay';
4
7
  import { ComponentPortal } from '@angular/cdk/portal';
5
8
  import { Subject } from 'rxjs';
6
- import { takeUntil, debounceTime, distinctUntilChanged, skip } from 'rxjs/operators';
7
9
  import { moveItemInArray, CdkDropList, CdkDrag, CdkDragPlaceholder } from '@angular/cdk/drag-drop';
8
- import * as i1 from '@angular/forms';
9
- import { FormsModule, UntypedFormControl, ReactiveFormsModule, NgControl } from '@angular/forms';
10
+ import { SmartTableOnChangedEventName as SmartTableOnChangedEventName$1, BaseEditorComponent as BaseEditorComponent$1 } from 'ng2-smart-table';
10
11
  import { NgComponentOutlet, NgTemplateOutlet } from '@angular/common';
12
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
11
13
 
12
- class DefaultEditor {
14
+ class BaseEditorComponent {
13
15
  constructor() {
14
16
  this.cell = input.required();
15
- this.inputClass = input("");
17
+ this.inputClass = input('');
16
18
  }
17
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultEditor, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
18
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: DefaultEditor, isStandalone: true, selector: "ng2-default-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 }); }
19
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
20
+ 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 }); }
19
21
  }
20
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultEditor, decorators: [{
22
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseEditorComponent, decorators: [{
21
23
  type: Component,
22
- args: [{ template: "", selector: 'ng2-default-editor-base-component' }]
24
+ args: [{ template: '', selector: 'ng2-editor-base-component' }]
23
25
  }] });
24
26
 
25
- class DefaultFilter {
27
+ class BaseFilterComponent {
26
28
  constructor() {
27
29
  this.delay = 300;
28
- this.query = '';
30
+ this.query = input('');
29
31
  this.inputClass = input('');
30
32
  this.source = input.required();
31
33
  this.column = input.required();
32
34
  this.filter = output();
35
+ this.inputControl = new UntypedFormControl();
33
36
  }
34
37
  ngOnDestroy() {
35
38
  if (this.changesSubscription) {
36
39
  this.changesSubscription.unsubscribe();
37
40
  }
38
41
  }
39
- setFilter() {
40
- this.filter.emit(this.query);
42
+ ngOnInit() {
43
+ this.changesSubscription = this.inputControl.valueChanges
44
+ .pipe(distinctUntilChanged(), debounceTime(this.delay))
45
+ .subscribe((value) => {
46
+ this.setFilter(value);
47
+ });
48
+ }
49
+ ngOnChanges({ query }) {
50
+ if (query) {
51
+ this.inputControl.setValue(query.currentValue, { emitEvent: false });
52
+ }
41
53
  }
42
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultFilter, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
43
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: DefaultFilter, isStandalone: true, selector: "ng2-default-base-filter-component", inputs: { query: { classPropertyName: "query", publicName: "query", isSignal: false, 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: '', isInline: true }); }
54
+ setFilter(query) {
55
+ this.filter.emit(query);
56
+ }
57
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
58
+ 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 }); }
44
59
  }
45
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultFilter, decorators: [{
60
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BaseFilterComponent, decorators: [{
46
61
  type: Component,
47
- args: [{ template: '', selector: 'ng2-default-base-filter-component' }]
48
- }], propDecorators: { query: [{
49
- type: Input
50
- }] } });
62
+ args: [{ template: '', selector: 'ng2-base-filter-component' }]
63
+ }] });
51
64
 
52
65
  /**
53
66
  * Extending object that entered in first argument.
@@ -316,7 +329,7 @@ class Cell {
316
329
  return this.row;
317
330
  }
318
331
  getValue() {
319
- const prepare = this.column.getValuePrepareFunction() || this.prepareValue;
332
+ const prepare = this.column.valuePrepareFunction || this.prepareValue;
320
333
  return prepare.call(null, this.value, this.row.getData(), this);
321
334
  }
322
335
  getNotPrepareValue() {
@@ -356,36 +369,8 @@ class Column {
356
369
  this.isAddable = true;
357
370
  this.isFilterable = false;
358
371
  this.sortDirection = 'asc';
359
- this.defaultSortDirection = false;
360
372
  this.editor = false;
361
373
  this.filter = false;
362
- this.process(this.settings);
363
- }
364
- getCompareFunction() {
365
- return this.compareFunction;
366
- }
367
- getValuePrepareFunction() {
368
- return this.valuePrepareFunction;
369
- }
370
- getFilterFunction() {
371
- return this.filterFunction;
372
- }
373
- getConfig() {
374
- if (this.editor && (this.editor.type === 'checkbox' || this.editor.type === 'custom' || this.editor.type === 'list')) {
375
- return this.editor?.config;
376
- }
377
- return false;
378
- }
379
- getFilterType() {
380
- return this.filter && this.filter.type;
381
- }
382
- getFilterConfig() {
383
- if (this.filter && (this.filter.type === 'checkbox' || this.filter.type === 'custom' || this.filter.type === 'list')) {
384
- return this.filter?.config;
385
- }
386
- return false;
387
- }
388
- process(settings) {
389
374
  this.title = settings.title;
390
375
  this.class = settings.class || '';
391
376
  this.width = settings.width || '';
@@ -401,17 +386,28 @@ class Column {
401
386
  this.renderComponent = settings.renderComponent;
402
387
  }
403
388
  this.isFilterable = typeof settings.filter === 'undefined' ? true : !!settings['filter'];
404
- this.defaultSortDirection = settings?.sortDirection || false;
405
- this.isSortable = typeof settings.sort === 'undefined' ? true : settings.sort;
406
- this.isEditable = typeof settings.editable === 'undefined' ? true : settings.editable;
407
- this.isAddable = typeof settings.addable === 'undefined' ? true : settings.addable;
408
- this.sortDirection = this.prepareSortDirection();
389
+ this.isSortable = settings.sort ?? true;
390
+ this.isEditable = settings.editable ?? true;
391
+ this.isAddable = settings.addable ?? false;
392
+ this.sortDirection = settings.sortDirection || 'asc';
409
393
  this.compareFunction = settings.compareFunction;
410
394
  this.valuePrepareFunction = settings.valuePrepareFunction;
411
395
  this.filterFunction = settings.filterFunction;
412
396
  }
413
- prepareSortDirection() {
414
- return this.defaultSortDirection === 'desc' ? 'desc' : 'asc';
397
+ getEditorConfig() {
398
+ if (this.editor) {
399
+ return this.editor?.config;
400
+ }
401
+ return false;
402
+ }
403
+ getFilterType() {
404
+ return this.filter && this.filter.type;
405
+ }
406
+ getFilterConfig() {
407
+ if (this.filter) {
408
+ return this.filter?.config;
409
+ }
410
+ return false;
415
411
  }
416
412
  }
417
413
 
@@ -423,21 +419,19 @@ class Row {
423
419
  this.pending = signal(false);
424
420
  this.isSelected = signal(false);
425
421
  this.isInEditing = signal(false);
426
- this.cells = [];
422
+ this.cells = signal([]);
423
+ this.visibleCells = computed(() => this.cells().filter((cell) => !cell.getColumn().hide));
427
424
  this.process();
428
425
  }
429
426
  getCell(column) {
430
- return this.cells.find(el => el.getColumn() === column);
431
- }
432
- getCells() {
433
- return this.cells;
427
+ return this.cells().find((el) => el.getColumn() === column);
434
428
  }
435
429
  getData() {
436
430
  return this.data;
437
431
  }
438
432
  getNewData() {
439
433
  const values = Object.assign({}, this.data);
440
- this.getCells().forEach((cell) => values[cell.getColumn().id] = cell.newValue);
434
+ this.cells().forEach((cell) => (values[cell.getColumn().id] = cell.newValue));
441
435
  return values;
442
436
  }
443
437
  setData(data) {
@@ -445,15 +439,15 @@ class Row {
445
439
  this.process();
446
440
  }
447
441
  process() {
448
- this.cells = [];
449
- this._dataSet.getColumns().forEach((column) => {
450
- const cell = this.createCell(column);
451
- this.cells.push(cell);
452
- });
442
+ const cells = this._dataSet
443
+ .getColumns()
444
+ .map((column) => this.createCell(column));
445
+ this.cells.set(cells);
453
446
  }
454
447
  createCell(column) {
455
- const defValue = column.settings.defaultValue ? column.settings.defaultValue : '';
456
- const value = typeof this.data[column.id] === 'undefined' ? defValue : this.data[column.id];
448
+ const value = typeof this.data[column.id] === "undefined"
449
+ ? ""
450
+ : this.data[column.id];
457
451
  return new Cell(value, this, column, this._dataSet);
458
452
  }
459
453
  }
@@ -470,117 +464,161 @@ var SmartTableOnChangedEventName;
470
464
  SmartTableOnChangedEventName["add"] = "add";
471
465
  SmartTableOnChangedEventName["remove"] = "remove";
472
466
  SmartTableOnChangedEventName["append"] = "append";
467
+ SmartTableOnChangedEventName["appendMany"] = "appendMany";
473
468
  SmartTableOnChangedEventName["prepend"] = "prepend";
474
469
  SmartTableOnChangedEventName["refresh"] = "refresh";
470
+ SmartTableOnChangedEventName["columnRefresh"] = "columnRefresh";
475
471
  })(SmartTableOnChangedEventName || (SmartTableOnChangedEventName = {}));
476
472
 
477
473
  class DataSource {
478
474
  constructor() {
479
475
  this.onChangedSource = new Subject();
480
- this.onAddedSource = new Subject();
481
- this.onUpdatedSource = new Subject();
482
- this.onRemovedSource = new Subject();
476
+ this.sortConf = { field: '', direction: 'asc' };
477
+ this.filters = [];
478
+ this.pagingConf = signal({
479
+ page: 1,
480
+ perPage: 100,
481
+ total: 0,
482
+ display: false,
483
+ perPageSelect: [],
484
+ });
485
+ this.data = [];
483
486
  }
484
487
  refresh() {
485
- this.emitOnChanged(SmartTableOnChangedEventName.refresh);
488
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.refresh });
486
489
  }
487
- loadEmit() {
488
- this.emitOnChanged(SmartTableOnChangedEventName.load);
489
- return Promise.resolve(true);
490
+ columnRefresh() {
491
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.columnRefresh });
490
492
  }
491
493
  onChanged() {
492
494
  return this.onChangedSource.asObservable();
493
495
  }
494
- onAdded() {
495
- return this.onAddedSource.asObservable();
496
- }
497
- onUpdated() {
498
- return this.onUpdatedSource.asObservable();
499
- }
500
- onRemoved() {
501
- return this.onRemovedSource.asObservable();
502
- }
503
- prependEmit(element) {
504
- this.emitOnAdded(element);
505
- this.emitOnChanged(SmartTableOnChangedEventName.prepend);
496
+ prepend(element) {
497
+ this.data.unshift(element);
498
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.prepend, newItems: [element] });
506
499
  return Promise.resolve(true);
507
500
  }
508
- appendEmit(element) {
509
- this.emitOnAdded(element);
510
- this.emitOnChanged(SmartTableOnChangedEventName.append);
501
+ appendMany(elements) {
502
+ this.data = [...this.data, ...elements];
503
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.appendMany, newItems: elements }, this.data);
511
504
  return Promise.resolve(true);
512
505
  }
513
- addEmit(element) {
514
- this.emitOnAdded(element);
515
- this.emitOnChanged(SmartTableOnChangedEventName.add);
506
+ append(element) {
507
+ this.data.push(element);
508
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.append, newItems: [element] });
516
509
  return Promise.resolve(true);
517
510
  }
518
- removeEmit(element) {
519
- this.emitOnRemoved(element);
520
- this.emitOnChanged(SmartTableOnChangedEventName.remove);
511
+ add(element) {
512
+ this.data.push(element);
513
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.add, newItems: [element] });
521
514
  return Promise.resolve(true);
522
515
  }
523
- updateEmit(element) {
524
- this.emitOnUpdated(element);
525
- this.emitOnChanged(SmartTableOnChangedEventName.update);
516
+ remove(element) {
517
+ this.data = this.data.filter((el) => el !== element);
518
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.remove, item: element }, this.data);
526
519
  return Promise.resolve(true);
527
520
  }
528
- emptyEmit() {
529
- this.emitOnChanged(SmartTableOnChangedEventName.empty);
521
+ update(oldItem, newItem) {
522
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.update, oldItem, newItem });
530
523
  return Promise.resolve(true);
531
524
  }
532
- setSortEmit() {
533
- this.emitOnChanged(SmartTableOnChangedEventName.sort);
534
- }
535
- setFilterEmit() {
536
- this.emitOnChanged(SmartTableOnChangedEventName.filter);
537
- }
538
- addFilterEmit() {
539
- this.emitOnChanged(SmartTableOnChangedEventName.filter);
540
- }
541
- setPagingEmit() {
542
- this.emitOnChanged(SmartTableOnChangedEventName.paging);
525
+ empty() {
526
+ this.data = [];
527
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.empty });
528
+ return Promise.resolve(true);
543
529
  }
544
- setPageEmit() {
545
- this.emitOnChanged(SmartTableOnChangedEventName.page);
530
+ setSort(conf, doEmit = true) {
531
+ this.sortConf = conf;
532
+ this.pagingConf.update((old) => ({ ...old, page: 1 }));
533
+ if (doEmit) {
534
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.sort });
535
+ }
546
536
  }
547
- emitOnRemoved(element) {
548
- this.onRemovedSource.next(element);
537
+ addFilter(newFilter, doEmit = true) {
538
+ if (!newFilter.field) {
539
+ return;
540
+ }
541
+ const foundIndex = this.filters.findIndex((filter) => filter.field === newFilter.field);
542
+ if (foundIndex === -1) {
543
+ if (newFilter.search) {
544
+ this.filters.push(newFilter);
545
+ }
546
+ }
547
+ else {
548
+ if (newFilter.search) {
549
+ this.filters[foundIndex].search = newFilter.search;
550
+ }
551
+ else {
552
+ this.filters.splice(foundIndex, 1);
553
+ }
554
+ }
555
+ this.pagingConf.update((old) => ({ ...old, page: 1 }));
556
+ if (doEmit) {
557
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.filter });
558
+ }
549
559
  }
550
- emitOnUpdated(element) {
551
- this.onUpdatedSource.next(element);
560
+ setFilters(newFilters, doEmit = true) {
561
+ this.filters = [...newFilters];
562
+ this.pagingConf.update((old) => ({ ...old, page: 1 }));
563
+ if (doEmit) {
564
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.filter });
565
+ }
552
566
  }
553
- emitOnAdded(element) {
554
- this.onAddedSource.next(element);
567
+ setPaging(page = 1, perPage, doEmit = true) {
568
+ this.pagingConf.update((old) => ({ ...old, page: page, perPage: perPage }));
569
+ if (doEmit) {
570
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.paging });
571
+ }
555
572
  }
556
- emitOnChanged(action) {
557
- this.getElements().then((elements) => this.onChangedSource.next({
558
- action: action,
559
- elements: elements,
560
- paging: this.getPaging(),
561
- filter: this.getFilter(),
562
- sort: this.getSort(),
563
- }));
573
+ setPage(page, doEmit = true) {
574
+ this.pagingConf.update((old) => ({ ...old, page: page }));
575
+ if (doEmit) {
576
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.page });
577
+ }
578
+ }
579
+ emitOnChanged(eventData, newElements) {
580
+ const actionData = () => {
581
+ const elements = newElements || this.data;
582
+ const emitData = {
583
+ ...eventData,
584
+ elements,
585
+ paging: this.pagingConf(),
586
+ filters: this.getFilters(),
587
+ sort: this.getSort(),
588
+ };
589
+ if (eventData.action === SmartTableOnChangedEventName.remove) {
590
+ return {
591
+ ...emitData,
592
+ elements: elements.filter((el) => el !== eventData.item),
593
+ };
594
+ }
595
+ return emitData;
596
+ };
597
+ this.onChangedSource.next(actionData());
564
598
  }
565
599
  }
566
600
 
567
601
  function filterValues(value, search) {
568
602
  return value.toString().toLowerCase().includes(search.toString().toLowerCase());
569
603
  }
570
- class LocalFilter {
571
- static filter(data, field, search, customFilter) {
572
- const filter = customFilter ? customFilter : filterValues;
573
- return data.filter((el) => {
574
- const value = typeof el[field] === 'undefined' || el[field] === null ? '' : el[field];
575
- return filter.call(null, value, search);
576
- });
577
- }
604
+ function isElementSatisfied(element, filters) {
605
+ return filters.every((filter) => {
606
+ if (!filter.search?.length) {
607
+ return true;
608
+ }
609
+ const filterFunction = filter.filter || filterValues;
610
+ try {
611
+ const value = element[filter.field];
612
+ return filterFunction(value, filter.search);
613
+ }
614
+ catch {
615
+ return false;
616
+ }
617
+ });
578
618
  }
579
619
 
580
- class LocalPager {
581
- static paginate(data, page, perPage) {
582
- return data.slice(perPage * (page - 1), perPage * page);
583
- }
620
+ function paginateList(data, page, perPage) {
621
+ return [...data].slice(perPage * (page - 1), perPage * page);
584
622
  }
585
623
 
586
624
  function compareValues(direction, a, b) {
@@ -605,66 +643,26 @@ class LocalSorter {
605
643
  class LocalDataSource extends DataSource {
606
644
  constructor(data = []) {
607
645
  super();
608
- this.data = [];
609
- this.filteredAndSorted = [];
610
- this.sortConf = [];
611
- this.filterConf = {
612
- filters: [],
613
- andOperator: true,
614
- };
615
- this.pagingConf = false;
646
+ this.filteredAndSorted = signal([]);
647
+ this.count = computed(() => this.filteredAndSorted().length);
616
648
  this.data = data;
617
649
  }
618
650
  load(data) {
619
651
  this.data = data;
620
- return super.loadEmit();
652
+ this.emitOnChanged({ action: SmartTableOnChangedEventName.load });
653
+ return Promise.resolve(true);
621
654
  }
622
655
  prepend(element) {
623
656
  this.reset(true);
624
- this.data.unshift(element);
625
- return super.prependEmit(element);
657
+ return super.prepend(element);
626
658
  }
627
659
  appendMany(elements) {
628
660
  this.reset(true);
629
- this.data = [...this.data, ...elements];
630
- return super.loadEmit();
661
+ return super.appendMany(elements);
631
662
  }
632
663
  append(element) {
633
664
  this.reset(true);
634
- this.data.push(element);
635
- return super.appendEmit(element);
636
- }
637
- add(element) {
638
- this.data.push(element);
639
- return super.addEmit(element);
640
- }
641
- remove(element) {
642
- this.data = this.data.filter(el => el !== element);
643
- return super.removeEmit(element);
644
- }
645
- update(element, values) {
646
- return new Promise((resolve, reject) => {
647
- this.find(element).then((found) => {
648
- found = deepExtend(found, values);
649
- super.updateEmit(found).then(resolve).catch(reject);
650
- }).catch(reject);
651
- });
652
- }
653
- find(element) {
654
- const found = this.data.find(el => el === element);
655
- if (found) {
656
- return Promise.resolve(found);
657
- }
658
- return Promise.reject(new Error('Element was not found in the dataset'));
659
- }
660
- getElements() {
661
- const data = this.data.slice(0);
662
- return Promise.resolve(this.prepareData(data));
663
- }
664
- getFilteredAndSorted() {
665
- const data = this.data.slice(0);
666
- this.prepareData(data);
667
- return Promise.resolve(this.filteredAndSorted);
665
+ return super.append(element);
668
666
  }
669
667
  getAll() {
670
668
  const data = this.data.slice(0);
@@ -672,552 +670,183 @@ class LocalDataSource extends DataSource {
672
670
  }
673
671
  reset(silent = false) {
674
672
  if (silent) {
675
- this.filterConf = {
676
- filters: [],
677
- andOperator: true,
678
- };
679
- this.sortConf = [];
680
- if (this.pagingConf) {
681
- this.pagingConf.page = 1;
682
- }
673
+ this.filters = [];
674
+ this.sortConf = { field: '', direction: 'asc' };
675
+ this.pagingConf.update((old) => ({ ...old, page: 1 }));
683
676
  }
684
677
  else {
685
- this.setFilter([], true, false);
686
- this.setSort([], false);
687
- if (this.pagingConf) {
678
+ this.setFilters([], false);
679
+ this.setSort({ field: '', direction: 'asc' }, false);
680
+ if (this.pagingConf().display) {
688
681
  this.setPage(1);
689
682
  }
690
683
  }
691
684
  }
692
- empty() {
693
- this.data = [];
694
- return super.emptyEmit();
695
- }
696
- count() {
697
- return this.filteredAndSorted.length;
698
- }
699
- /**
700
- *
701
- * Array of conf objects
702
- * [
703
- * {field: string, direction: asc|desc|null, compare: Function|null},
704
- * ]
705
- * @param conf
706
- * @param doEmit
707
- * @returns {LocalDataSource}
708
- */
709
- setSort(conf, doEmit = true) {
710
- if (conf !== null) {
711
- conf.forEach((fieldConf) => {
712
- if (!fieldConf.field || typeof fieldConf.direction === 'undefined') {
713
- throw new Error('Sort configuration object is not valid');
714
- }
715
- });
716
- this.sortConf = conf;
717
- }
718
- if (doEmit) {
719
- super.setSortEmit();
720
- }
721
- return this;
722
- }
723
- /**
724
- *
725
- * Array of conf objects
726
- * [
727
- * {field: string, search: string, filter: Function|null},
728
- * ]
729
- * @param conf
730
- * @param andOperator
731
- * @param doEmit
732
- * @returns {LocalDataSource}
733
- */
734
- setFilter(conf, andOperator = true, doEmit = true) {
735
- if (conf && conf.length > 0) {
736
- conf.forEach((fieldConf) => {
737
- this.addFilter(fieldConf, andOperator, false);
738
- });
739
- }
740
- else {
741
- this.filterConf = {
742
- filters: [],
743
- andOperator: true,
744
- };
745
- }
746
- this.filterConf.andOperator = andOperator;
747
- if (this.pagingConf) {
748
- this.pagingConf.page = 1;
749
- }
750
- if (doEmit) {
751
- super.setFilterEmit();
752
- }
753
- return this;
685
+ getSort() {
686
+ return this.sortConf;
754
687
  }
755
- addFilter(fieldConf, andOperator = true, doEmit = true) {
756
- if (!fieldConf.field || typeof fieldConf.search === 'undefined') {
757
- throw new Error('Filter configuration object is not valid');
758
- }
759
- let found = false;
760
- this.filterConf.filters.forEach((currentFieldConf, index) => {
761
- if (currentFieldConf.field === fieldConf.field) {
762
- this.filterConf.filters[index] = fieldConf;
763
- found = true;
764
- }
765
- });
766
- if (!found) {
767
- this.filterConf.filters.push(fieldConf);
768
- }
769
- this.filterConf.andOperator = andOperator;
770
- if (doEmit) {
771
- super.addFilterEmit();
772
- }
773
- return this;
688
+ getFilters() {
689
+ return this.filters;
774
690
  }
775
- setPaging(page = 1, perPage, doEmit = true) {
776
- if (this.pagingConf) {
777
- this.pagingConf.page = page;
778
- this.pagingConf.perPage = perPage;
691
+ emitOnChanged(event) {
692
+ let renderData = this.filteredAndSorted();
693
+ const action = event.action;
694
+ if (['filter', 'refresh', 'load'].includes(action)) {
695
+ renderData = this.filter(this.data.slice(0));
696
+ this.filteredAndSorted.set(this.sort(renderData));
697
+ renderData = this.filteredAndSorted();
779
698
  }
780
- else {
781
- this.pagingConf = {
782
- page, perPage
783
- };
699
+ if (['sort', 'filter', 'refresh', 'load'].includes(action)) {
700
+ this.filteredAndSorted.update((list) => this.sort(list));
701
+ renderData = this.filteredAndSorted();
784
702
  }
785
- if (doEmit) {
786
- super.setPagingEmit();
703
+ if (this.pagingConf().display &&
704
+ ['page', 'paging', 'refresh', 'load', 'sort', 'filter'].includes(action)) {
705
+ renderData = this.paginate(this.filteredAndSorted());
787
706
  }
788
- return;
789
- }
790
- setPage(page, doEmit = true) {
791
- if (!this.pagingConf) {
792
- return;
793
- }
794
- this.pagingConf.page = page;
795
- if (doEmit) {
796
- super.setPageEmit();
707
+ super.emitOnChanged(event, renderData);
708
+ if (this.pagingConf().display && this.isPageOutOfBounce()) {
709
+ this.setPage(this.pagingConf().page - 1);
797
710
  }
798
- return;
799
- }
800
- getSort() {
801
- return this.sortConf;
802
- }
803
- getFilter() {
804
- return this.filterConf;
805
- }
806
- getPaging() {
807
- return this.pagingConf;
808
- }
809
- prepareData(data) {
810
- data = this.filter(data);
811
- data = this.sort(data);
812
- this.filteredAndSorted = data.slice(0);
813
- if (this.pagingConf) {
814
- return this.paginate(data);
815
- }
816
- else
817
- return data;
818
711
  }
819
712
  sort(data) {
820
713
  if (this.sortConf) {
821
- this.sortConf.forEach((fieldConf) => {
822
- data = LocalSorter
823
- .sort(data, fieldConf.field, fieldConf.direction, fieldConf.compare);
824
- });
714
+ data = LocalSorter.sort(data, this.sortConf.field, this.sortConf.direction, this.sortConf.compare);
825
715
  }
826
716
  return data;
827
717
  }
828
- // TODO: refactor?
829
718
  filter(data) {
830
- if (this.filterConf.filters) {
831
- if (this.filterConf.andOperator) {
832
- this.filterConf.filters.forEach((fieldConf) => {
833
- if (fieldConf.search?.length > 0) {
834
- data = LocalFilter
835
- .filter(data, fieldConf.field, fieldConf.search, fieldConf.filter);
836
- }
837
- });
838
- }
839
- else {
840
- let mergedData = [];
841
- this.filterConf.filters.forEach((fieldConf) => {
842
- if (fieldConf.search?.length > 0) {
843
- mergedData = mergedData.concat(LocalFilter
844
- .filter(data, fieldConf.field, fieldConf.search, fieldConf.filter));
845
- }
846
- });
847
- // remove non unique items
848
- data = mergedData.filter((elem, pos, arr) => {
849
- return arr.indexOf(elem) === pos;
850
- });
851
- }
719
+ if (this.filters.length > 0) {
720
+ return data.filter((item) => {
721
+ return isElementSatisfied(item, this.filters);
722
+ });
852
723
  }
853
724
  return data;
854
725
  }
855
726
  paginate(data) {
856
- if (this.pagingConf && this.pagingConf.page && this.pagingConf.perPage) {
857
- data = LocalPager.paginate(data, this.pagingConf.page, this.pagingConf.perPage);
727
+ if (this.pagingConf().display) {
728
+ return paginateList(data, this.pagingConf().page, this.pagingConf().perPage);
858
729
  }
859
730
  return data;
860
731
  }
732
+ isPageOutOfBounce() {
733
+ const { page, perPage } = this.pagingConf();
734
+ return page * perPage >= this.count() + perPage && page > 1;
735
+ }
861
736
  }
862
737
 
863
- class PagerComponent {
864
- constructor() {
865
- this.perPageSelect = [];
866
- this.changePage = output();
867
- this.currentPerPage = 0;
868
- this.pages = [];
869
- this.page = 1;
870
- this.count = 0;
871
- this.perPage = 0;
738
+ class ServerDataSource extends DataSource {
739
+ constructor(paramPrepareFunction, requestFunction, initPagingConf) {
740
+ super();
741
+ this.initPagingConf = initPagingConf;
742
+ this.count = computed(() => this.pagingConf().total);
743
+ this.pagingConf.update((old) => ({ ...old, ...this.initPagingConf }));
744
+ this.paramPrepareFunction = paramPrepareFunction;
745
+ this.requestFunction = requestFunction;
872
746
  }
873
- ngOnChanges(changes) {
874
- if (changes["source"]) {
875
- if (!changes["source"].firstChange && this.dataChangedSub) {
876
- this.dataChangedSub.unsubscribe();
877
- }
878
- this.dataChangedSub = this.source.onChanged().subscribe((dataChanges) => {
879
- const paging = this.source.getPaging();
880
- if (paging) {
881
- this.page = paging.page;
882
- this.perPage = paging.perPage;
883
- }
884
- this.currentPerPage = this.perPage;
885
- this.count = this.source.count();
886
- if (this.isPageOutOfBounce()) {
887
- this.source.setPage(--this.page);
888
- }
889
- this.processPageChange(dataChanges);
890
- this.initPages();
891
- });
892
- }
747
+ getAll() {
748
+ return Promise.resolve(this.data);
893
749
  }
894
- /**
895
- * We change the page here depending on the action performed against data source
896
- * if a new element was added to the end of the table - then change the page to the last
897
- * if a new element was added to the beginning of the table - then to the first page
898
- * @param changes
899
- */
900
- processPageChange(changes) {
901
- if (changes["action"] === "prepend") {
902
- this.source.setPage(1);
750
+ getSort() {
751
+ return this.sortConf;
752
+ }
753
+ getFilters() {
754
+ return this.filters;
755
+ }
756
+ emitOnChanged(eventData, newElements) {
757
+ if ([
758
+ SmartTableOnChangedEventName$1.filter,
759
+ SmartTableOnChangedEventName$1.sort,
760
+ SmartTableOnChangedEventName$1.page,
761
+ SmartTableOnChangedEventName$1.paging,
762
+ SmartTableOnChangedEventName$1.refresh,
763
+ ].includes(eventData.action)) {
764
+ this.paramPrepareFunction({
765
+ sort: this.sortConf,
766
+ filters: this.filters,
767
+ page: this.pagingConf().page,
768
+ limit: this.pagingConf().perPage,
769
+ })
770
+ .pipe(switchMap((params) => this.requestFunction(params)))
771
+ .subscribe((res) => {
772
+ this.data = res.data;
773
+ this.pagingConf.update((old) => ({ ...old, total: res.total }));
774
+ super.emitOnChanged(eventData, res.data);
775
+ });
903
776
  }
904
- if (changes["action"] === "append") {
905
- this.source.setPage(this.getLast());
777
+ else {
778
+ super.emitOnChanged(eventData, newElements);
906
779
  }
907
780
  }
908
- shouldShow() {
909
- return this.source.count() > this.perPage;
781
+ }
782
+
783
+ class PagerComponent {
784
+ constructor() {
785
+ this.source = input.required();
786
+ this.pagingConf = computed(() => this.source().pagingConf());
787
+ this.currentPerPage = computed(() => this.pagingConf().perPage);
788
+ this.currentPage = computed(() => this.pagingConf().page);
789
+ this.count = computed(() => this.source().count());
790
+ this.shouldShow = computed(() => this.pagingConf().display && this.count() > this.currentPerPage());
791
+ this.lastPage = computed(() => Math.ceil(this.count() / this.currentPerPage()));
792
+ this.pages = computed(() => this.getPages(this.currentPage(), this.lastPage()));
910
793
  }
911
794
  paginate(page) {
912
- this.source.setPage(page);
913
- this.page = page;
914
- this.changePage.emit({ page });
915
- return false;
795
+ this.source().setPage(page);
916
796
  }
917
797
  next() {
918
- return this.paginate(this.getPage() + 1);
798
+ this.paginate(this.currentPage() + 1);
919
799
  }
920
800
  prev() {
921
- return this.paginate(this.getPage() - 1);
801
+ this.paginate(this.currentPage() - 1);
922
802
  }
923
- getPage() {
924
- return this.page;
803
+ isString(value) {
804
+ return typeof value === 'string';
925
805
  }
926
- getPages() {
927
- return this.pages;
928
- }
929
- getLast() {
930
- return Math.ceil(this.count / this.perPage);
931
- }
932
- isPageOutOfBounce() {
933
- return (this.page * this.perPage >= this.count + this.perPage && this.page > 1);
934
- }
935
- initPages() {
936
- const pagesCount = this.getLast();
937
- let showPagesCount = 4;
938
- showPagesCount = pagesCount < showPagesCount ? pagesCount : showPagesCount;
939
- this.pages = [];
940
- if (this.shouldShow()) {
941
- let middleOne = Math.ceil(showPagesCount / 2);
942
- middleOne = this.page >= middleOne ? this.page : middleOne;
943
- let lastOne = middleOne + Math.floor(showPagesCount / 2);
944
- lastOne = lastOne >= pagesCount ? pagesCount : lastOne;
945
- const firstOne = lastOne - showPagesCount + 1;
946
- for (let i = firstOne; i <= lastOne; i++) {
947
- this.pages.push(i);
806
+ getPages(current, last) {
807
+ const delta = 2, left = current - delta, right = current + delta + 1, range = [], rangeWithDots = [];
808
+ let l;
809
+ for (let i = 1; i <= last; i++) {
810
+ if (i == 1 || i == last || (i >= left && i < right)) {
811
+ range.push(i);
948
812
  }
949
813
  }
950
- }
951
- onChangePerPage() {
952
- const paging = this.source.getPaging();
953
- if (paging) {
954
- paging.perPage = this.currentPerPage * 1;
814
+ for (const i of range) {
815
+ if (l) {
816
+ if (i - l === 2) {
817
+ rangeWithDots.push(l + 1);
818
+ }
819
+ else if (i - l !== 1) {
820
+ rangeWithDots.push('...');
821
+ }
822
+ }
823
+ rangeWithDots.push(i);
824
+ l = i;
955
825
  }
956
- this.source.refresh();
957
- this.initPages();
826
+ return rangeWithDots;
958
827
  }
959
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: PagerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
960
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: PagerComponent, isStandalone: true, selector: "ng2-smart-table-pager", inputs: { source: "source", perPageSelect: "perPageSelect" }, outputs: { changePage: "changePage" }, usesOnChanges: true, ngImport: i0, template: `
961
- @if (shouldShow()) {
962
- <nav class="ng2-smart-pagination-nav">
963
- <ul class="ng2-smart-pagination pagination">
964
- <li
965
- class="ng2-smart-page-item page-item"
966
- [class.disabled]="getPage() === 1"
967
- >
968
- <a
969
- class="ng2-smart-page-link page-link"
970
- href="#"
971
- (click)="getPage() === 1 ? false : paginate(1)"
972
- aria-label="First"
973
- >
974
- <span aria-hidden="true">&laquo;</span>
975
- <span class="sr-only">First</span>
976
- </a>
977
- </li>
978
- <li
979
- class="ng2-smart-page-item page-item"
980
- [class.disabled]="getPage() === 1"
981
- >
982
- <a
983
- class="ng2-smart-page-link page-link page-link-prev"
984
- href="#"
985
- (click)="getPage() === 1 ? false : prev()"
986
- aria-label="Prev"
987
- >
988
- <span aria-hidden="true">&lt;</span>
989
- <span class="sr-only">Prev</span>
990
- </a>
991
- </li>
992
- @for (page of getPages(); track page) {
993
- <li
994
- class="ng2-smart-page-item page-item"
995
- [class.active]="getPage() === page"
996
- >
997
- @if (getPage() === page) {
998
- <span class="ng2-smart-page-link page-link"
999
- >{{ page }} <span class="sr-only">(current)</span></span
1000
- >
1001
- } @if (getPage() !== page) {
1002
- <a
1003
- class="ng2-smart-page-link page-link"
1004
- href="#"
1005
- (click)="paginate(page)"
1006
- >{{ page }}</a
1007
- >
1008
- }
1009
- </li>
1010
- }
1011
- <li
1012
- class="ng2-smart-page-item page-item"
1013
- [class.disabled]="getPage() === getLast()"
1014
- >
1015
- <a
1016
- class="ng2-smart-page-link page-link page-link-next"
1017
- href="#"
1018
- (click)="getPage() === getLast() ? false : next()"
1019
- aria-label="Next"
1020
- >
1021
- <span aria-hidden="true">&gt;</span>
1022
- <span class="sr-only">Next</span>
1023
- </a>
1024
- </li>
1025
- <li
1026
- class="ng2-smart-page-item page-item"
1027
- [class.disabled]="getPage() === getLast()"
1028
- >
1029
- <a
1030
- class="ng2-smart-page-link page-link"
1031
- href="#"
1032
- (click)="getPage() === getLast() ? false : paginate(getLast())"
1033
- aria-label="Last"
1034
- >
1035
- <span aria-hidden="true">&raquo;</span>
1036
- <span class="sr-only">Last</span>
1037
- </a>
1038
- </li>
1039
- </ul>
1040
- </nav>
1041
- } @if (perPageSelect && perPageSelect.length > 0) {
1042
- <nav class="ng2-smart-pagination-per-page">
1043
- <label for="per-page"> Per Page: </label>
1044
- <select
1045
- (change)="onChangePerPage()"
1046
- [(ngModel)]="currentPerPage"
1047
- id="per-page"
1048
- >
1049
- @for (item of perPageSelect; track $index) {
1050
- <option [value]="item">{{ item }}</option>
828
+ onChangePerPage(target) {
829
+ if (!target.value) {
830
+ return;
1051
831
  }
1052
- </select>
1053
- </nav>
832
+ this.source().setPaging(1, +target.value);
1054
833
  }
1055
- `, isInline: true, styles: [".ng2-smart-pagination{display:inline-flex;font-size:.875em;padding:0}.ng2-smart-pagination .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.ng2-smart-pagination .ng2-smart-page-item{display:inline}.ng2-smart-pagination .page-link-next,.ng2-smart-pagination .page-link-prev{font-size:10px}:host{display:flex;justify-content:space-between}:host select{margin:1rem 0 1rem 1rem}:host label{margin:1rem 0 1rem 1rem;line-height:2.5rem}\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"] }] }); }
834
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: PagerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
835
+ 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"] }] }); }
1056
836
  }
1057
837
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: PagerComponent, decorators: [{
1058
838
  type: Component,
1059
- args: [{ selector: "ng2-smart-table-pager", template: `
1060
- @if (shouldShow()) {
1061
- <nav class="ng2-smart-pagination-nav">
1062
- <ul class="ng2-smart-pagination pagination">
1063
- <li
1064
- class="ng2-smart-page-item page-item"
1065
- [class.disabled]="getPage() === 1"
1066
- >
1067
- <a
1068
- class="ng2-smart-page-link page-link"
1069
- href="#"
1070
- (click)="getPage() === 1 ? false : paginate(1)"
1071
- aria-label="First"
1072
- >
1073
- <span aria-hidden="true">&laquo;</span>
1074
- <span class="sr-only">First</span>
1075
- </a>
1076
- </li>
1077
- <li
1078
- class="ng2-smart-page-item page-item"
1079
- [class.disabled]="getPage() === 1"
1080
- >
1081
- <a
1082
- class="ng2-smart-page-link page-link page-link-prev"
1083
- href="#"
1084
- (click)="getPage() === 1 ? false : prev()"
1085
- aria-label="Prev"
1086
- >
1087
- <span aria-hidden="true">&lt;</span>
1088
- <span class="sr-only">Prev</span>
1089
- </a>
1090
- </li>
1091
- @for (page of getPages(); track page) {
1092
- <li
1093
- class="ng2-smart-page-item page-item"
1094
- [class.active]="getPage() === page"
1095
- >
1096
- @if (getPage() === page) {
1097
- <span class="ng2-smart-page-link page-link"
1098
- >{{ page }} <span class="sr-only">(current)</span></span
1099
- >
1100
- } @if (getPage() !== page) {
1101
- <a
1102
- class="ng2-smart-page-link page-link"
1103
- href="#"
1104
- (click)="paginate(page)"
1105
- >{{ page }}</a
1106
- >
1107
- }
1108
- </li>
1109
- }
1110
- <li
1111
- class="ng2-smart-page-item page-item"
1112
- [class.disabled]="getPage() === getLast()"
1113
- >
1114
- <a
1115
- class="ng2-smart-page-link page-link page-link-next"
1116
- href="#"
1117
- (click)="getPage() === getLast() ? false : next()"
1118
- aria-label="Next"
1119
- >
1120
- <span aria-hidden="true">&gt;</span>
1121
- <span class="sr-only">Next</span>
1122
- </a>
1123
- </li>
1124
- <li
1125
- class="ng2-smart-page-item page-item"
1126
- [class.disabled]="getPage() === getLast()"
1127
- >
1128
- <a
1129
- class="ng2-smart-page-link page-link"
1130
- href="#"
1131
- (click)="getPage() === getLast() ? false : paginate(getLast())"
1132
- aria-label="Last"
1133
- >
1134
- <span aria-hidden="true">&raquo;</span>
1135
- <span class="sr-only">Last</span>
1136
- </a>
1137
- </li>
1138
- </ul>
1139
- </nav>
1140
- } @if (perPageSelect && perPageSelect.length > 0) {
1141
- <nav class="ng2-smart-pagination-per-page">
1142
- <label for="per-page"> Per Page: </label>
1143
- <select
1144
- (change)="onChangePerPage()"
1145
- [(ngModel)]="currentPerPage"
1146
- id="per-page"
1147
- >
1148
- @for (item of perPageSelect; track $index) {
1149
- <option [value]="item">{{ item }}</option>
1150
- }
1151
- </select>
1152
- </nav>
1153
- }
1154
- `, standalone: true, imports: [FormsModule], styles: [".ng2-smart-pagination{display:inline-flex;font-size:.875em;padding:0}.ng2-smart-pagination .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.ng2-smart-pagination .ng2-smart-page-item{display:inline}.ng2-smart-pagination .page-link-next,.ng2-smart-pagination .page-link-prev{font-size:10px}:host{display:flex;justify-content:space-between}:host select{margin:1rem 0 1rem 1rem}:host label{margin:1rem 0 1rem 1rem;line-height:2.5rem}\n"] }]
1155
- }], propDecorators: { source: [{
1156
- type: Input
1157
- }], perPageSelect: [{
1158
- type: Input
1159
- }] } });
1160
-
1161
- class EditCellDefaultComponent {
1162
- constructor() {
1163
- this.cell = input.required();
1164
- this.inputClass = input('');
1165
- }
1166
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellDefaultComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1167
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: EditCellDefaultComponent, isStandalone: true, selector: "ng2-edit-cell-default-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 }); }
1168
- }
1169
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellDefaultComponent, decorators: [{
1170
- type: Component,
1171
- args: [{ template: '', selector: 'ng2-edit-cell-default-base-component' }]
839
+ 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"] }]
1172
840
  }] });
1173
841
 
1174
- class CustomEditComponent extends EditCellDefaultComponent {
1175
- ngOnChanges(changes) {
1176
- const editor = this.cell().getColumn().editor;
1177
- if (this.customComponent) {
1178
- if (this.customComponent?.instance && 'ngOnChanges' in this.customComponent.instance) {
1179
- const onChanges = this.customComponent.instance.ngOnChanges;
1180
- onChanges(changes);
1181
- }
1182
- return;
1183
- }
1184
- if (this.cell() &&
1185
- !this.customComponent &&
1186
- editor &&
1187
- editor.type == "custom") {
1188
- this.customComponent = this.dynamicTarget?.createComponent(editor.component);
1189
- this.customComponent?.setInput('cell', this.cell());
1190
- this.customComponent?.setInput('inputClass', this.inputClass());
1191
- }
1192
- }
1193
- ngOnDestroy() {
1194
- if (this.customComponent) {
1195
- this.customComponent.destroy();
1196
- }
1197
- }
1198
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1199
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: CustomEditComponent, isStandalone: true, selector: "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 }); }
1200
- }
1201
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, decorators: [{
1202
- type: Component,
1203
- args: [{
1204
- selector: "ng2-table-cell-custom-editor",
1205
- template: ` <ng-template #dynamicTarget></ng-template> `,
1206
- standalone: true,
1207
- }]
1208
- }], propDecorators: { dynamicTarget: [{
1209
- type: ViewChild,
1210
- args: ["dynamicTarget", { read: ViewContainerRef, static: true }]
1211
- }] } });
1212
-
1213
- class CheckboxEditorComponent extends DefaultEditor {
842
+ class CheckboxEditorComponent extends BaseEditorComponent {
1214
843
  constructor() {
1215
844
  super();
1216
845
  this.trueVal = computed(() => {
1217
- return this.cell().getColumn().getConfig()?.true || true;
846
+ return this.cell().getColumn().getEditorConfig()?.true || true;
1218
847
  });
1219
848
  this.falseVal = computed(() => {
1220
- return this.cell().getColumn().getConfig()?.false || false;
849
+ return this.cell().getColumn().getEditorConfig()?.false || false;
1221
850
  });
1222
851
  }
1223
852
  onChange(event) {
@@ -1232,15 +861,12 @@ class CheckboxEditorComponent extends DefaultEditor {
1232
861
  [name]="cell().getId()"
1233
862
  [disabled]="!cell().isEditable()"
1234
863
  (change)="onChange($event)"
1235
- [checked]="
1236
- cell().getValue() === trueVal()
1237
- "
1238
- />
864
+ [checked]="cell().getValue() === trueVal()" />
1239
865
  `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }); }
1240
866
  }
1241
867
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxEditorComponent, decorators: [{
1242
868
  type: Component,
1243
- args: [{ selector: "ng2-checkbox-editor", template: `
869
+ args: [{ selector: 'ng2-checkbox-editor', template: `
1244
870
  <input
1245
871
  [class]="inputClass()"
1246
872
  type="checkbox"
@@ -1248,18 +874,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
1248
874
  [name]="cell().getId()"
1249
875
  [disabled]="!cell().isEditable()"
1250
876
  (change)="onChange($event)"
1251
- [checked]="
1252
- cell().getValue() === trueVal()
1253
- "
1254
- />
877
+ [checked]="cell().getValue() === trueVal()" />
1255
878
  `, standalone: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
1256
879
  }], ctorParameters: () => [] });
1257
880
 
1258
- class InputEditorComponent extends DefaultEditor {
1259
- constructor() {
1260
- super();
1261
- }
1262
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
881
+ class InputEditorComponent extends BaseEditorComponent {
882
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1263
883
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: InputEditorComponent, isStandalone: true, selector: "ng2-input-editor", usesInheritance: true, ngImport: i0, template: `
1264
884
  <input
1265
885
  [class]="inputClass()"
@@ -1267,42 +887,33 @@ class InputEditorComponent extends DefaultEditor {
1267
887
  [(ngModel)]="cell().newValue"
1268
888
  [name]="cell().getId()"
1269
889
  [placeholder]="cell().getTitle()"
1270
- [disabled]="!cell().isEditable()"
1271
- />
890
+ [disabled]="!cell().isEditable()" />
1272
891
  `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1273
892
  }
1274
893
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputEditorComponent, decorators: [{
1275
894
  type: Component,
1276
- args: [{ selector: "ng2-input-editor", template: `
895
+ args: [{ selector: 'ng2-input-editor', template: `
1277
896
  <input
1278
897
  [class]="inputClass()"
1279
898
  class="form-control"
1280
899
  [(ngModel)]="cell().newValue"
1281
900
  [name]="cell().getId()"
1282
901
  [placeholder]="cell().getTitle()"
1283
- [disabled]="!cell().isEditable()"
1284
- />
902
+ [disabled]="!cell().isEditable()" />
1285
903
  `, standalone: true, imports: [FormsModule], styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
1286
- }], ctorParameters: () => [] });
904
+ }] });
1287
905
 
1288
- class SelectEditorComponent extends DefaultEditor {
1289
- constructor() {
1290
- super();
1291
- }
1292
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
906
+ class SelectEditorComponent extends BaseEditorComponent {
907
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1293
908
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: SelectEditorComponent, isStandalone: true, selector: "ng2-select-editor", usesInheritance: true, ngImport: i0, template: `
1294
909
  <select
1295
910
  [class]="inputClass()"
1296
911
  class="form-control"
1297
912
  [(ngModel)]="cell().newValue"
1298
913
  [name]="cell().getId()"
1299
- [disabled]="!cell().isEditable()"
1300
- >
1301
- @for (option of cell().getColumn().getConfig()?.list; track $index) {
1302
- <option
1303
- [value]="option.value"
1304
- [selected]="option.value === cell().getValue()"
1305
- >
914
+ [disabled]="!cell().isEditable()">
915
+ @for (option of cell().getColumn().getEditorConfig()?.list; track $index) {
916
+ <option [value]="option.value" [selected]="option.value === cell().getValue()">
1306
917
  {{ option.title }}
1307
918
  </option>
1308
919
  }
@@ -1312,20 +923,16 @@ class SelectEditorComponent extends DefaultEditor {
1312
923
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectEditorComponent, decorators: [{
1313
924
  type: Component,
1314
925
  args: [{
1315
- selector: "ng2-select-editor",
926
+ selector: 'ng2-select-editor',
1316
927
  template: `
1317
928
  <select
1318
929
  [class]="inputClass()"
1319
930
  class="form-control"
1320
931
  [(ngModel)]="cell().newValue"
1321
932
  [name]="cell().getId()"
1322
- [disabled]="!cell().isEditable()"
1323
- >
1324
- @for (option of cell().getColumn().getConfig()?.list; track $index) {
1325
- <option
1326
- [value]="option.value"
1327
- [selected]="option.value === cell().getValue()"
1328
- >
933
+ [disabled]="!cell().isEditable()">
934
+ @for (option of cell().getColumn().getEditorConfig()?.list; track $index) {
935
+ <option [value]="option.value" [selected]="option.value === cell().getValue()">
1329
936
  {{ option.title }}
1330
937
  </option>
1331
938
  }
@@ -1334,13 +941,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
1334
941
  standalone: true,
1335
942
  imports: [FormsModule],
1336
943
  }]
1337
- }], ctorParameters: () => [] });
944
+ }] });
1338
945
 
1339
- class TextareaEditorComponent extends DefaultEditor {
1340
- constructor() {
1341
- super();
1342
- }
1343
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TextareaEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
946
+ class TextareaEditorComponent extends BaseEditorComponent {
947
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TextareaEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1344
948
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: TextareaEditorComponent, isStandalone: true, selector: "ng2-textarea-editor", usesInheritance: true, ngImport: i0, template: `
1345
949
  <textarea
1346
950
  [class]="inputClass()"
@@ -1348,98 +952,120 @@ class TextareaEditorComponent extends DefaultEditor {
1348
952
  [(ngModel)]="cell().newValue"
1349
953
  [name]="cell().getId()"
1350
954
  [disabled]="!cell().isEditable()"
1351
- [placeholder]="cell().getTitle()"
1352
- >
955
+ [placeholder]="cell().getTitle()">
1353
956
  </textarea>
1354
957
  `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
1355
958
  }
1356
959
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TextareaEditorComponent, decorators: [{
1357
960
  type: Component,
1358
- args: [{ selector: "ng2-textarea-editor", template: `
961
+ args: [{ selector: 'ng2-textarea-editor', template: `
1359
962
  <textarea
1360
963
  [class]="inputClass()"
1361
964
  class="form-control"
1362
965
  [(ngModel)]="cell().newValue"
1363
966
  [name]="cell().getId()"
1364
967
  [disabled]="!cell().isEditable()"
1365
- [placeholder]="cell().getTitle()"
1366
- >
968
+ [placeholder]="cell().getTitle()">
1367
969
  </textarea>
1368
970
  `, standalone: true, imports: [FormsModule], styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
1369
- }], ctorParameters: () => [] });
971
+ }] });
1370
972
 
1371
- class DefaultEditComponent extends EditCellDefaultComponent {
973
+ class BuildInEditorComponent extends BaseEditorComponent$1 {
1372
974
  constructor() {
1373
- super();
975
+ super(...arguments);
976
+ this.editorType = computed(() => {
977
+ const editor = this.cell().getColumn().editor;
978
+ if (editor) {
979
+ return editor.type || 'text';
980
+ }
981
+ return 'text';
982
+ });
1374
983
  }
1375
- getEditorType() {
984
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BuildInEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
985
+ 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" }] }); }
986
+ }
987
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BuildInEditorComponent, decorators: [{
988
+ type: Component,
989
+ 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>" }]
990
+ }] });
991
+
992
+ class CustomEditComponent extends BaseEditorComponent$1 {
993
+ ngOnChanges(changes) {
1376
994
  const editor = this.cell().getColumn().editor;
1377
- if (editor) {
1378
- return editor.type || "text";
995
+ if (this.customComponent) {
996
+ if (this.customComponent?.instance && 'ngOnChanges' in this.customComponent.instance) {
997
+ const onChanges = this.customComponent.instance.ngOnChanges;
998
+ onChanges(changes);
999
+ }
1000
+ return;
1001
+ }
1002
+ if (this.cell() &&
1003
+ !this.customComponent &&
1004
+ editor &&
1005
+ editor.type == "custom") {
1006
+ this.customComponent = this.dynamicTarget?.createComponent(editor.component);
1007
+ this.customComponent?.setInput('cell', this.cell());
1008
+ this.customComponent?.setInput('inputClass', this.inputClass());
1009
+ }
1010
+ }
1011
+ ngOnDestroy() {
1012
+ if (this.customComponent) {
1013
+ this.customComponent.destroy();
1379
1014
  }
1380
- return "text";
1381
1015
  }
1382
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultEditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1383
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: DefaultEditComponent, isStandalone: true, selector: "ng2-table-cell-default-editor", usesInheritance: true, ngImport: i0, template: "<div role=\"none\" (click)=\"$event.stopPropagation()\">\n @switch (getEditorType()) {\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" }] }); }
1016
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1017
+ 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 }); }
1384
1018
  }
1385
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultEditComponent, decorators: [{
1019
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomEditComponent, decorators: [{
1386
1020
  type: Component,
1387
- args: [{ selector: "ng2-table-cell-default-editor", imports: [
1388
- SelectEditorComponent,
1389
- TextareaEditorComponent,
1390
- CheckboxEditorComponent,
1391
- InputEditorComponent,
1392
- ], standalone: true, template: "<div role=\"none\" (click)=\"$event.stopPropagation()\">\n @switch (getEditorType()) {\n @case ('list') {\n <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>" }]
1393
- }], ctorParameters: () => [] });
1021
+ args: [{
1022
+ selector: "ng2-table-cell-custom-editor",
1023
+ template: ` <ng-template #dynamicTarget></ng-template> `,
1024
+ standalone: true,
1025
+ }]
1026
+ }], propDecorators: { dynamicTarget: [{
1027
+ type: ViewChild,
1028
+ args: ["dynamicTarget", { read: ViewContainerRef, static: true }]
1029
+ }] } });
1394
1030
 
1395
1031
  class EditCellComponent {
1396
1032
  constructor() {
1397
1033
  this.cell = input.required();
1398
- this.inputClass = input("");
1034
+ this.inputClass = input('');
1399
1035
  }
1400
1036
  getEditorType() {
1401
1037
  const editor = this.cell().getColumn().editor;
1402
1038
  if (editor) {
1403
1039
  return editor.type;
1404
1040
  }
1405
- return "text";
1041
+ return 'text';
1406
1042
  }
1407
1043
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1408
1044
  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: `
1409
1045
  <div>
1410
1046
  @switch (getEditorType()) { @case ('custom') {
1411
- <ng2-table-cell-custom-editor [cell]="cell()" [inputClass]="inputClass()">
1412
- </ng2-table-cell-custom-editor>
1047
+ <ng2-table-cell-custom-editor [cell]="cell()" [inputClass]="inputClass()"> </ng2-table-cell-custom-editor>
1413
1048
  } @default {
1414
- <ng2-table-cell-default-editor
1415
- [cell]="cell()"
1416
- [inputClass]="inputClass()"
1417
- >
1418
- </ng2-table-cell-default-editor>
1049
+ <ng2-table-cell-build-in-editor [cell]="cell()" [inputClass]="inputClass()"> </ng2-table-cell-build-in-editor>
1419
1050
  } }
1420
1051
  </div>
1421
- `, isInline: true, dependencies: [{ kind: "component", type: CustomEditComponent, selector: "ng2-table-cell-custom-editor" }, { kind: "component", type: DefaultEditComponent, selector: "ng2-table-cell-default-editor" }] }); }
1052
+ `, isInline: true, dependencies: [{ kind: "component", type: CustomEditComponent, selector: "ng2-table-cell-custom-editor" }, { kind: "component", type: BuildInEditorComponent, selector: "ng2-table-cell-build-in-editor" }] }); }
1422
1053
  }
1423
1054
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: EditCellComponent, decorators: [{
1424
1055
  type: Component,
1425
1056
  args: [{
1426
- selector: "ng2-table-cell-edit-mode",
1057
+ selector: 'ng2-table-cell-edit-mode',
1427
1058
  template: `
1428
1059
  <div>
1429
1060
  @switch (getEditorType()) { @case ('custom') {
1430
- <ng2-table-cell-custom-editor [cell]="cell()" [inputClass]="inputClass()">
1431
- </ng2-table-cell-custom-editor>
1061
+ <ng2-table-cell-custom-editor [cell]="cell()" [inputClass]="inputClass()"> </ng2-table-cell-custom-editor>
1432
1062
  } @default {
1433
- <ng2-table-cell-default-editor
1434
- [cell]="cell()"
1435
- [inputClass]="inputClass()"
1436
- >
1437
- </ng2-table-cell-default-editor>
1063
+ <ng2-table-cell-build-in-editor [cell]="cell()" [inputClass]="inputClass()"> </ng2-table-cell-build-in-editor>
1438
1064
  } }
1439
1065
  </div>
1440
1066
  `,
1441
1067
  standalone: true,
1442
- imports: [CustomEditComponent, DefaultEditComponent],
1068
+ imports: [CustomEditComponent, BuildInEditorComponent],
1443
1069
  }]
1444
1070
  }] });
1445
1071
 
@@ -1745,41 +1371,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
1745
1371
  class DataSet {
1746
1372
  constructor(data = [], columnSettings) {
1747
1373
  this.columnSettings = columnSettings;
1748
- this.data = [];
1749
- this.columns = [];
1750
- this.rows = [];
1374
+ this.data = signal([]);
1375
+ this.columns = signal([]);
1376
+ this.rows = signal([]);
1751
1377
  this.selectedRows = new Set();
1378
+ this.getColumns = computed(() => this.columns());
1379
+ this.getVisibleColumns = computed(() => this.columns().filter((column) => !column.hide));
1380
+ this.getRows = computed(() => {
1381
+ return this.rows();
1382
+ });
1383
+ this.isAllSelected = computed(() => this.rows().every((row) => row.isSelected()));
1752
1384
  this.createColumns(columnSettings);
1753
1385
  this.setData(data);
1754
1386
  this.createNewRow();
1755
1387
  }
1756
1388
  setData(data) {
1757
- this.data = data;
1389
+ this.data.set(data);
1758
1390
  this.createRows();
1759
1391
  }
1760
- getColumns() {
1761
- return this.columns;
1762
- }
1763
- getRows() {
1764
- return this.rows;
1765
- }
1766
1392
  getFirstRow() {
1767
- return this.rows[0];
1393
+ return this.rows()[0];
1768
1394
  }
1769
1395
  getLastRow() {
1770
- return this.rows[this.rows.length - 1];
1396
+ return this.rows()[this.rows().length - 1];
1771
1397
  }
1772
1398
  findRowByData(data) {
1773
- return this.rows.find((row) => row.getData() === data);
1399
+ return this.rows().find((row) => row.getData() === data);
1774
1400
  }
1775
1401
  setSelectAll(state) {
1776
- this.rows.forEach((row) => {
1402
+ this.rows().forEach((row) => {
1777
1403
  row.isSelected.set(state);
1778
1404
  this.storeSelectedRow(row);
1779
1405
  });
1780
1406
  }
1781
1407
  deselectAll() {
1782
- this.rows.forEach((row) => {
1408
+ this.rows().forEach((row) => {
1783
1409
  row.isSelected.set(false);
1784
1410
  });
1785
1411
  // we need to clear selectedRow field because no one row selected
@@ -1807,24 +1433,20 @@ class DataSet {
1807
1433
  * @private
1808
1434
  */
1809
1435
  createColumns(columnsParams) {
1810
- columnsParams.forEach((params) => {
1811
- this.columns.push(new Column(params.key, params, this));
1812
- });
1436
+ const columns = columnsParams.map((params) => new Column(params.key, params, this));
1437
+ this.columns.set(columns);
1813
1438
  }
1814
1439
  /**
1815
1440
  * Create rows based on current data prepared in data source
1816
1441
  * @private
1817
1442
  */
1818
1443
  createRows() {
1819
- this.rows = [];
1820
- this.data.forEach((el, index) => {
1444
+ const rows = this.data().map((el, index) => {
1821
1445
  const row = new Row(index, el, this);
1822
1446
  row.isSelected.set(this.selectedRows.has(row.getData()));
1823
- this.rows.push(row);
1447
+ return row;
1824
1448
  });
1825
- }
1826
- get isAllSelected() {
1827
- return this.rows.every((row) => row.isSelected());
1449
+ this.rows.set(rows);
1828
1450
  }
1829
1451
  storeSelectedRow(row) {
1830
1452
  if (row.isSelected()) {
@@ -1839,12 +1461,10 @@ class DataSet {
1839
1461
  class Grid {
1840
1462
  constructor(source, settings) {
1841
1463
  this.createFormShown = false;
1842
- this.onSelectRowSource = new Subject();
1843
- this.onDeselectRowSource = new Subject();
1844
1464
  this.currentColumnsSortState = [];
1845
1465
  this.settings = signal({});
1846
1466
  this.isMultiSelectVisible = computed(() => {
1847
- return this.settings().selectMode === "multi";
1467
+ return this.settings().selectMode === 'multi';
1848
1468
  });
1849
1469
  this.isActionsVisible = computed(() => {
1850
1470
  const actions = this.settings().actions;
@@ -1858,8 +1478,8 @@ class Grid {
1858
1478
  this.actionIsOnRight = computed(() => {
1859
1479
  return this.settings().actionsPosition === 'right';
1860
1480
  });
1481
+ this.setSource(source, settings);
1861
1482
  this.setSettings(settings);
1862
- this.setSource(source);
1863
1483
  }
1864
1484
  setColumnsSortedEmitter(emitter) {
1865
1485
  this.columnsSortedEmitter = emitter;
@@ -1877,7 +1497,7 @@ class Grid {
1877
1497
  }
1878
1498
  setSettings(settings) {
1879
1499
  this.updateSettingsAndDataSet(settings);
1880
- if (this.getSetting('columnSort', false)) {
1500
+ if (settings.columnSort) {
1881
1501
  this.setColumnsSortState(settings.columns);
1882
1502
  }
1883
1503
  }
@@ -1887,24 +1507,12 @@ class Grid {
1887
1507
  getSetting(name, defaultValue) {
1888
1508
  return getDeepFromObject(this.settings(), name, defaultValue);
1889
1509
  }
1890
- getColumns() {
1891
- return this.dataSet.getColumns();
1892
- }
1893
- getRows() {
1894
- return this.dataSet.getRows();
1895
- }
1896
1510
  selectRow(row, state) {
1897
1511
  this.dataSet.selectRow(row, state);
1898
1512
  }
1899
1513
  multipleSelectRow(row) {
1900
1514
  this.dataSet.multipleSelectRow(row);
1901
1515
  }
1902
- onSelectRow() {
1903
- return this.onSelectRowSource.asObservable();
1904
- }
1905
- onDeselectRow() {
1906
- return this.onDeselectRowSource.asObservable();
1907
- }
1908
1516
  edit(row) {
1909
1517
  row.isInEditing.set(true);
1910
1518
  }
@@ -1923,7 +1531,7 @@ class Grid {
1923
1531
  .catch((err) => {
1924
1532
  row.pending.set(false);
1925
1533
  });
1926
- if (this.getSetting("add.confirmCreate", false)) {
1534
+ if (this.getSetting('add.confirmCreate', false)) {
1927
1535
  confirmEmitter.emit({
1928
1536
  newData: row.getNewData(),
1929
1537
  source: this.source,
@@ -1950,7 +1558,7 @@ class Grid {
1950
1558
  row.pending.set(false);
1951
1559
  row.isInEditing.set(false);
1952
1560
  });
1953
- if (this.getSetting("edit.confirmSave", false)) {
1561
+ if (this.getSetting('edit.confirmSave', false)) {
1954
1562
  confirmEmitter.emit({
1955
1563
  data: row.getData(),
1956
1564
  newData: row.getNewData(),
@@ -1975,7 +1583,7 @@ class Grid {
1975
1583
  row.pending.set(false);
1976
1584
  // doing nothing
1977
1585
  });
1978
- if (this.getSetting("delete.confirmDelete")) {
1586
+ if (this.getSetting('delete.confirmDelete', true)) {
1979
1587
  confirmEmitter.emit({
1980
1588
  data: row.getData(),
1981
1589
  source: this.source,
@@ -1990,39 +1598,49 @@ class Grid {
1990
1598
  this.dataSet.selectRow(row, false);
1991
1599
  }
1992
1600
  }
1993
- processDataChange({ action, elements }) {
1994
- if (action === "load") {
1601
+ processDataChange(event) {
1602
+ if (event.action === 'load') {
1995
1603
  this.dataSet.deselectAll();
1996
1604
  }
1997
- if (action !== "update") {
1998
- this.dataSet.setData(elements);
1605
+ if (event.action !== 'update') {
1606
+ this.dataSet.setData(event.elements);
1607
+ }
1608
+ else {
1609
+ const changedRow = this.dataSet.findRowByData(event.oldItem);
1610
+ if (changedRow) {
1611
+ changedRow.setData(event.newItem || event.oldItem);
1612
+ }
1999
1613
  }
2000
1614
  }
2001
- prepareSource(source) {
1615
+ prepareSource(source, initialSort, initialPaging) {
2002
1616
  const preparedSource = source || new LocalDataSource();
2003
- const initialSort = this.getInitialSort();
2004
1617
  if (initialSort) {
2005
- preparedSource.setSort([initialSort], false);
1618
+ preparedSource.setSort(initialSort, false);
2006
1619
  }
2007
- if (this.getSetting("pager.display", false) === true) {
2008
- preparedSource.setPaging(1, this.getSetting("pager.perPage"), false);
1620
+ if (initialPaging && initialPaging?.display) {
1621
+ preparedSource.pagingConf.update((old) => ({
1622
+ ...old,
1623
+ ...initialPaging,
1624
+ }));
2009
1625
  }
2010
- preparedSource.refresh();
2011
1626
  return preparedSource;
2012
1627
  }
2013
- getInitialSort() {
2014
- const defaultSortColumn = this.getColumns().find((column) => column.isSortable && column.defaultSortDirection);
1628
+ getInitialSort(columns) {
1629
+ if (!columns || !columns.length) {
1630
+ return false;
1631
+ }
1632
+ const defaultSortColumn = columns?.find((column) => column.sortDirection);
2015
1633
  if (!defaultSortColumn) {
2016
1634
  return false;
2017
1635
  }
2018
1636
  return {
2019
- field: defaultSortColumn.id,
2020
- direction: defaultSortColumn.defaultSortDirection || "asc",
2021
- compare: defaultSortColumn.getCompareFunction(),
1637
+ field: defaultSortColumn.key,
1638
+ direction: defaultSortColumn.sortDirection || 'asc',
1639
+ compare: defaultSortColumn.compareFunction,
2022
1640
  };
2023
1641
  }
2024
1642
  getSelectedRowsData() {
2025
- return this.dataSet.getRows();
1643
+ return this.dataSet.getSelectedRowsData();
2026
1644
  }
2027
1645
  selectAllRows(status) {
2028
1646
  this.dataSet.setSelectAll(status);
@@ -2033,27 +1651,28 @@ class Grid {
2033
1651
  getLastRow() {
2034
1652
  return this.dataSet.getLastRow();
2035
1653
  }
2036
- updateSettingsAndDataSet(settings) {
1654
+ updateSettingsAndDataSet(settings, emittedEvent = 'refresh') {
2037
1655
  this.settings.set(settings);
2038
1656
  this.dataSet = new DataSet([], settings.columns);
2039
1657
  if (this.source) {
2040
- this.source.refresh();
1658
+ console.log('updateSettingsAndDataSet', emittedEvent);
1659
+ this.source.pagingConf.update((old) => ({
1660
+ ...old,
1661
+ display: this.getSetting('pager.display'),
1662
+ }));
1663
+ if (emittedEvent === 'columnRefresh') {
1664
+ this.source.columnRefresh();
1665
+ }
1666
+ else {
1667
+ this.source.refresh();
1668
+ }
2041
1669
  }
2042
1670
  }
2043
- setSource(source) {
2044
- this.source = this.prepareSource(source);
1671
+ setSource(source, settings) {
1672
+ const initialSort = this.getInitialSort(settings?.columns);
1673
+ this.source = this.prepareSource(source, initialSort, settings?.pager || false);
2045
1674
  this.detach();
2046
- this.sourceOnChangedSubscription = this.source
2047
- .onChanged()
2048
- .subscribe((changes) => this.processDataChange(changes));
2049
- this.sourceOnUpdatedSubscription = this.source
2050
- .onUpdated()
2051
- .subscribe((data) => {
2052
- const changedRow = this.dataSet.findRowByData(data);
2053
- if (changedRow) {
2054
- changedRow.setData(data);
2055
- }
2056
- });
1675
+ this.sourceOnChangedSubscription = this.source.onChanged().subscribe((changes) => this.processDataChange(changes));
2057
1676
  }
2058
1677
  // ------------------------------- column sort
2059
1678
  async getSortedTableColumns(newState, columns) {
@@ -2071,7 +1690,7 @@ class Grid {
2071
1690
  this.updateSettingsAndDataSet({
2072
1691
  ...this.settings(),
2073
1692
  columns: await this.getSortedTableColumns(this.currentColumnsSortState, this.settings()?.columns),
2074
- });
1693
+ }, 'columnRefresh');
2075
1694
  if (this.columnStateStorageKey) {
2076
1695
  setLocalStorage(this.columnStateStorageKey, this.currentColumnsSortState);
2077
1696
  }
@@ -2440,14 +2059,11 @@ class Ng2SmartTableTbodyComponent {
2440
2059
  return this.grid().settings().noDataMessage || "No data found";
2441
2060
  });
2442
2061
  }
2443
- getVisibleCells(cells) {
2444
- return (cells || []).filter((cell) => !cell.getColumn().hide);
2445
- }
2446
2062
  trackByIdOrIndex(index, item) {
2447
2063
  return item?.id || index;
2448
2064
  }
2449
2065
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTbodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2450
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableTbodyComponent, isStandalone: true, selector: "[ng2-st-tbody]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, deleteConfirm: { classPropertyName: "deleteConfirm", publicName: "deleteConfirm", isSignal: true, isRequired: true, transformFunction: null }, createConfirm: { classPropertyName: "createConfirm", publicName: "createConfirm", isSignal: true, isRequired: true, transformFunction: null }, editConfirm: { classPropertyName: "editConfirm", publicName: "editConfirm", isSignal: true, isRequired: true, transformFunction: null }, rowClassFunction: { classPropertyName: "rowClassFunction", publicName: "rowClassFunction", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { save: "save", edit: "edit", editCancel: "editCancel", delete: "delete", custom: "custom", edited: "edited", userSelectRow: "userSelectRow", userClickedRow: "userClickedRow", multipleSelectRow: "multipleSelectRow" }, ngImport: i0, template: "@for (row of grid().getRows(); track trackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [class]=\"rowClassFunction()(row)\"\n [class.selected]=\"row.isSelected()\"\n>\n @if (grid().isMultiSelectVisible()) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\"\n >\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected()\"\n />\n </td>\n } @if (grid().actionIsOnLeft()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n } @for (cell of getVisibleCells(row.cells); track cell.getId() + $index) {\n <td [class]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell\n [cell]=\"cell\"\n [inputClass]=\"editInputClass()\"\n [isInEditing]=\"row.isInEditing()\"\n >\n </ng2-smart-table-cell>\n </td>\n } @if (grid().actionIsOnRight()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n }\n</tr>\n\n<ng-template #actions>\n @if (row.isInEditing()) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid()\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm()\"\n [editCancel]=\"editCancel\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @if (!row.isInEditing() && grid().isActionsVisible() ) {\n <td class=\"ng2-smart-actions\" (click)=\"$event.stopPropagation()\">\n <ng2-st-tbody-custom\n [grid]=\"grid()\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source()\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid()\"\n [deleteConfirm]=\"deleteConfirm()\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n [row]=\"row\"\n [source]=\"source()\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n }\n</ng-template>\n} @empty {\n<tr>\n <td colspan=\"50\">\n {{ noDataMessage() }}\n </td>\n</tr>\n}\n", styles: [":host .ng2-smart-row.selected{background:#0000000d}:host .ng2-smart-row .ng2-smart-actions.ng2-smart-action-multiple-select{text-align:center}:host ::ng-deep ng2-st-tbody-edit-delete a:first-child,:host ::ng-deep ng2-st-tbody-create-cancel a:first-child{margin-right:.25rem}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: TbodyCustomComponent, selector: "ng2-st-tbody-custom", inputs: ["grid", "row", "source"], outputs: ["custom"] }, { kind: "component", type: TbodyEditDeleteComponent, selector: "ng2-st-tbody-edit-delete", inputs: ["grid", "row", "source", "deleteConfirm"], outputs: ["edit", "delete"] }, { kind: "component", type: TbodyCreateCancelComponent, selector: "ng2-st-tbody-create-cancel", inputs: ["grid", "row", "editConfirm", "editCancel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: CellComponent, selector: "ng2-smart-table-cell", inputs: ["cell", "inputClass", "isInEditing"] }] }); }
2066
+ 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"] }] }); }
2451
2067
  }
2452
2068
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTbodyComponent, decorators: [{
2453
2069
  type: Component,
@@ -2458,133 +2074,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2458
2074
  TbodyCreateCancelComponent,
2459
2075
  NgTemplateOutlet,
2460
2076
  CellComponent,
2461
- ], template: "@for (row of grid().getRows(); track trackByIdOrIndex($index, row)) {\n<tr\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [class]=\"rowClassFunction()(row)\"\n [class.selected]=\"row.isSelected()\"\n>\n @if (grid().isMultiSelectVisible()) {\n <td\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"$event.stopPropagation(); multipleSelectRow.emit(row)\"\n >\n <input\n type=\"checkbox\"\n [id]=\"'row-' + row.index + '_select-checkbox'\"\n class=\"form-control\"\n [ngModel]=\"row.isSelected()\"\n />\n </td>\n } @if (grid().actionIsOnLeft()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n } @for (cell of getVisibleCells(row.cells); track cell.getId() + $index) {\n <td [class]=\"cell.getColumnClass()\">\n <ng2-smart-table-cell\n [cell]=\"cell\"\n [inputClass]=\"editInputClass()\"\n [isInEditing]=\"row.isInEditing()\"\n >\n </ng2-smart-table-cell>\n </td>\n } @if (grid().actionIsOnRight()) {\n <ng-container [ngTemplateOutlet]=\"actions\"></ng-container>\n }\n</tr>\n\n<ng-template #actions>\n @if (row.isInEditing()) {\n <td class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid()\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm()\"\n [editCancel]=\"editCancel\"\n ></ng2-st-tbody-create-cancel>\n </td>\n } @if (!row.isInEditing() && grid().isActionsVisible() ) {\n <td class=\"ng2-smart-actions\" (click)=\"$event.stopPropagation()\">\n <ng2-st-tbody-custom\n [grid]=\"grid()\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source()\"\n ></ng2-st-tbody-custom>\n <ng2-st-tbody-edit-delete\n [grid]=\"grid()\"\n [deleteConfirm]=\"deleteConfirm()\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n [row]=\"row\"\n [source]=\"source()\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n }\n</ng-template>\n} @empty {\n<tr>\n <td colspan=\"50\">\n {{ noDataMessage() }}\n </td>\n</tr>\n}\n", styles: [":host .ng2-smart-row.selected{background:#0000000d}:host .ng2-smart-row .ng2-smart-actions.ng2-smart-action-multiple-select{text-align:center}:host ::ng-deep ng2-st-tbody-edit-delete a:first-child,:host ::ng-deep ng2-st-tbody-create-cancel a:first-child{margin-right:.25rem}\n"] }]
2077
+ ], 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"] }]
2462
2078
  }] });
2463
2079
 
2464
- class FilterDefault {
2465
- constructor() {
2466
- this.column = input.required();
2467
- this.source = input.required();
2468
- this.inputClass = input('');
2469
- this.query = '';
2470
- this.filter = output();
2471
- }
2472
- onFilter(query) {
2473
- this.source().addFilter({
2474
- field: this.column().id,
2475
- search: query,
2476
- filter: this.column().getFilterFunction(),
2477
- });
2478
- }
2479
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterDefault, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2480
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.3", type: FilterDefault, isStandalone: true, selector: "ng2-filter-default-component", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { filter: "filter" }, ngImport: i0, template: '', isInline: true }); }
2481
- }
2482
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterDefault, decorators: [{
2483
- type: Component,
2484
- args: [{ template: '', selector: 'ng2-filter-default-component' }]
2485
- }], propDecorators: { query: [{
2486
- type: Input
2487
- }] } });
2488
-
2489
- class CustomFilterComponent extends FilterDefault {
2490
- ngOnChanges(changes) {
2491
- if (this.customComponent) {
2492
- if (this.customComponent?.instance &&
2493
- "ngOnChanges" in this.customComponent.instance) {
2494
- const onChanges = this.customComponent.instance.ngOnChanges;
2495
- onChanges(changes);
2496
- }
2497
- return;
2498
- }
2499
- const columnFilter = this.column().filter;
2500
- if (columnFilter && columnFilter.type === "custom") {
2501
- this.customComponent = this.dynamicTarget?.createComponent(columnFilter?.component);
2502
- // set @Inputs and @Outputs of custom component
2503
- this.customComponent?.setInput("query", this.query);
2504
- this.customComponent?.setInput("column", this.column());
2505
- this.customComponent?.setInput("source", this.source());
2506
- this.customComponent?.setInput("inputClass", this.inputClass());
2507
- this.customComponent?.instance.filter.subscribe((event) => this.onFilter(event));
2508
- }
2509
- }
2510
- ngOnDestroy() {
2511
- if (this.customComponent) {
2512
- this.customComponent.destroy();
2513
- }
2514
- }
2515
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2516
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: CustomFilterComponent, isStandalone: true, selector: "ng2-custom-table-filter", 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 }); }
2517
- }
2518
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomFilterComponent, decorators: [{
2519
- type: Component,
2520
- args: [{
2521
- selector: "ng2-custom-table-filter",
2522
- template: `<ng-template #dynamicTarget></ng-template>`,
2523
- standalone: true,
2524
- }]
2525
- }], propDecorators: { dynamicTarget: [{
2526
- type: ViewChild,
2527
- args: ["dynamicTarget", { read: ViewContainerRef, static: true }]
2528
- }] } });
2529
-
2530
- class CheckboxFilterComponent extends DefaultFilter {
2080
+ class CheckboxFilterComponent extends BaseFilterComponent {
2531
2081
  constructor() {
2532
2082
  super();
2533
2083
  this.filterActive = false;
2534
- this.inputControl = new UntypedFormControl();
2084
+ this.trueVal = true;
2085
+ this.falseVal = false;
2535
2086
  }
2536
2087
  ngOnInit() {
2088
+ const filterConfig = this.column().getFilterConfig();
2089
+ try {
2090
+ const { true: trueVal, false: falseVal } = filterConfig;
2091
+ this.trueVal = trueVal ?? true;
2092
+ this.falseVal = falseVal ?? false;
2093
+ }
2094
+ catch {
2095
+ // do nothing
2096
+ }
2537
2097
  this.changesSubscription = this.inputControl.valueChanges
2538
- .pipe(debounceTime(this.delay))
2098
+ .pipe(distinctUntilChanged(), debounceTime(this.delay))
2539
2099
  .subscribe((checked) => {
2540
2100
  this.filterActive = true;
2541
- const trueVal = (this.column().getFilterConfig() &&
2542
- this.column().getFilterConfig().true) ||
2543
- true;
2544
- const falseVal = (this.column().getFilterConfig() &&
2545
- this.column().getFilterConfig().false) ||
2546
- false;
2547
- this.query = checked ? trueVal : falseVal;
2548
- this.setFilter();
2101
+ const value = checked ? this.trueVal : this.falseVal;
2102
+ this.setFilter(value);
2549
2103
  });
2550
2104
  }
2105
+ ngOnChanges({ query }) {
2106
+ if (query) {
2107
+ this.inputControl.setValue(query.currentValue === this.trueVal, { emitEvent: false });
2108
+ }
2109
+ }
2551
2110
  resetFilter(event) {
2552
2111
  event.preventDefault();
2553
- this.query = "";
2112
+ event.stopPropagation();
2554
2113
  this.inputControl.setValue(false, { emitEvent: false });
2555
2114
  this.filterActive = false;
2556
- this.setFilter();
2115
+ this.setFilter(null);
2557
2116
  }
2558
2117
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2559
- 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: `
2560
- <input
2561
- type="checkbox"
2562
- [formControl]="inputControl"
2563
- [class]="inputClass()"
2564
- class="form-control"
2565
- />
2118
+ 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: `
2119
+ <input type="checkbox" [formControl]="inputControl" [class]="inputClass()" class="form-control" />
2566
2120
  @if (filterActive) {
2567
- <a href="#" (click)="resetFilter($event)">{{
2568
- column().getFilterConfig()?.resetText || "reset"
2569
- }}</a>
2121
+ <a href="#" (click)="resetFilter($event)">{{ column().getFilterConfig()?.resetText || 'reset' }}</a>
2570
2122
  }
2571
2123
  `, 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"] }] }); }
2572
2124
  }
2573
2125
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxFilterComponent, decorators: [{
2574
2126
  type: Component,
2575
2127
  args: [{
2576
- selector: "ng2-checkbox-filter",
2128
+ selector: 'ng2-checkbox-filter',
2577
2129
  template: `
2578
- <input
2579
- type="checkbox"
2580
- [formControl]="inputControl"
2581
- [class]="inputClass()"
2582
- class="form-control"
2583
- />
2130
+ <input type="checkbox" [formControl]="inputControl" [class]="inputClass()" class="form-control" />
2584
2131
  @if (filterActive) {
2585
- <a href="#" (click)="resetFilter($event)">{{
2586
- column().getFilterConfig()?.resetText || "reset"
2587
- }}</a>
2132
+ <a href="#" (click)="resetFilter($event)">{{ column().getFilterConfig()?.resetText || 'reset' }}</a>
2588
2133
  }
2589
2134
  `,
2590
2135
  standalone: true,
@@ -2592,264 +2137,269 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2592
2137
  }]
2593
2138
  }], ctorParameters: () => [] });
2594
2139
 
2595
- class InputFilterComponent extends DefaultFilter {
2596
- constructor() {
2597
- super();
2598
- this.inputControl = new UntypedFormControl();
2599
- }
2600
- ngOnInit() {
2601
- if (this.query) {
2602
- this.inputControl.setValue(this.query);
2603
- }
2604
- this.inputControl.valueChanges
2605
- .pipe(distinctUntilChanged(), debounceTime(this.delay))
2606
- .subscribe((value) => {
2607
- this.query = this.inputControl.value;
2608
- this.setFilter();
2609
- });
2610
- }
2611
- ngOnChanges(changes) {
2612
- if (changes?.["query"]) {
2613
- this.inputControl.setValue(this.query);
2614
- }
2615
- }
2616
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2617
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: InputFilterComponent, isStandalone: true, selector: "ng2-input-filter", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
2140
+ class InputFilterComponent extends BaseFilterComponent {
2141
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2142
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: InputFilterComponent, isStandalone: true, selector: "ng2-input-filter", usesInheritance: true, ngImport: i0, template: `
2618
2143
  <input
2619
2144
  [class]="inputClass()"
2620
2145
  [formControl]="inputControl"
2621
2146
  class="form-control"
2622
2147
  type="text"
2623
- placeholder="{{ column().title }}"
2624
- />
2148
+ placeholder="{{ column().title }}" />
2625
2149
  `, 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"] }] }); }
2626
2150
  }
2627
2151
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: InputFilterComponent, decorators: [{
2628
2152
  type: Component,
2629
2153
  args: [{
2630
- selector: "ng2-input-filter",
2154
+ selector: 'ng2-input-filter',
2631
2155
  template: `
2632
2156
  <input
2633
2157
  [class]="inputClass()"
2634
2158
  [formControl]="inputControl"
2635
2159
  class="form-control"
2636
2160
  type="text"
2637
- placeholder="{{ column().title }}"
2638
- />
2161
+ placeholder="{{ column().title }}" />
2639
2162
  `,
2640
2163
  standalone: true,
2641
2164
  imports: [FormsModule, ReactiveFormsModule],
2642
2165
  }]
2643
- }], ctorParameters: () => [] });
2644
-
2645
- class SelectFilterComponent extends DefaultFilter {
2646
- constructor() {
2647
- super();
2648
- }
2649
- ngOnInit() {
2650
- if (this.inputControl.valueChanges) {
2651
- this.inputControl.valueChanges
2652
- .pipe(skip(1), distinctUntilChanged(), debounceTime(this.delay))
2653
- .subscribe((value) => this.setFilter());
2654
- }
2655
- }
2656
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2657
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: SelectFilterComponent, isStandalone: true, selector: "ng2-select-filter", viewQueries: [{ propertyName: "inputControl", first: true, predicate: ["inputControl"], descendants: true, read: NgControl, static: true }], usesInheritance: true, ngImport: i0, template: `
2658
- <select [class]="inputClass()"
2659
- class="form-control"
2660
- #inputControl
2661
- [(ngModel)]="query">
2166
+ }] });
2662
2167
 
2168
+ class SelectFilterComponent extends BaseFilterComponent {
2169
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2170
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: SelectFilterComponent, isStandalone: true, selector: "ng2-select-filter", usesInheritance: true, ngImport: i0, template: `
2171
+ <select [class]="inputClass()" class="form-control" [formControl]="inputControl">
2663
2172
  <option value="">{{ column().getFilterConfig().selectText }}</option>
2664
2173
  @for (option of column().getFilterConfig().list; track $index) {
2665
- <option [value]="option.value">
2666
- {{ option.title }}
2667
- </option>
2174
+ <option [value]="option.value">
2175
+ {{ option.title }}
2176
+ </option>
2668
2177
  }
2669
2178
  </select>
2670
- `, 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"] }] }); }
2179
+ `, 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"] }] }); }
2671
2180
  }
2672
2181
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SelectFilterComponent, decorators: [{
2673
2182
  type: Component,
2674
2183
  args: [{
2675
2184
  selector: 'ng2-select-filter',
2676
2185
  template: `
2677
- <select [class]="inputClass()"
2678
- class="form-control"
2679
- #inputControl
2680
- [(ngModel)]="query">
2681
-
2186
+ <select [class]="inputClass()" class="form-control" [formControl]="inputControl">
2682
2187
  <option value="">{{ column().getFilterConfig().selectText }}</option>
2683
2188
  @for (option of column().getFilterConfig().list; track $index) {
2684
- <option [value]="option.value">
2685
- {{ option.title }}
2686
- </option>
2189
+ <option [value]="option.value">
2190
+ {{ option.title }}
2191
+ </option>
2687
2192
  }
2688
2193
  </select>
2689
- `,
2194
+ `,
2690
2195
  standalone: true,
2691
- imports: [FormsModule]
2196
+ imports: [FormsModule, ReactiveFormsModule],
2692
2197
  }]
2693
- }], ctorParameters: () => [], propDecorators: { inputControl: [{
2694
- type: ViewChild,
2695
- args: ['inputControl', { read: NgControl, static: true }]
2696
- }] } });
2198
+ }] });
2697
2199
 
2698
- class DefaultFilterComponent extends FilterDefault {
2699
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2700
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: DefaultFilterComponent, isStandalone: true, selector: "ng2-default-table-filter", usesInheritance: true, ngImport: i0, template: `
2200
+ class BuildInFilterComponent {
2201
+ constructor() {
2202
+ this.query = input('');
2203
+ this.inputClass = input('');
2204
+ this.source = input.required();
2205
+ this.column = input.required();
2206
+ this.filter = output();
2207
+ }
2208
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BuildInFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2209
+ 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: `
2701
2210
  @switch (column().getFilterType()) { @case ('list') {
2702
2211
  <ng2-select-filter
2703
- [query]="query"
2212
+ [query]="query()"
2704
2213
  [class]="inputClass()"
2705
2214
  [source]="source()"
2706
2215
  [column]="column()"
2707
- (filter)="onFilter($event)"
2708
- >
2216
+ (filter)="filter.emit($event)">
2709
2217
  </ng2-select-filter>
2710
2218
  } @case ('checkbox') {
2711
2219
  <ng2-checkbox-filter
2712
- [query]="query"
2220
+ [query]="query()"
2713
2221
  [source]="source()"
2714
2222
  [class]="inputClass()"
2715
2223
  [column]="column()"
2716
- (filter)="onFilter($event)"
2717
- >
2224
+ (filter)="filter.emit($event)">
2718
2225
  </ng2-checkbox-filter>
2719
2226
  } @default {
2720
2227
  <ng2-input-filter
2721
- [query]="query"
2228
+ [query]="query()"
2722
2229
  [source]="source()"
2723
2230
  [class]="inputClass()"
2724
2231
  [column]="column()"
2725
- (filter)="onFilter($event)"
2726
- >
2232
+ (filter)="filter.emit($event)">
2727
2233
  </ng2-input-filter>
2728
2234
  } }
2729
2235
  `, 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" }] }); }
2730
2236
  }
2731
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: DefaultFilterComponent, decorators: [{
2237
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: BuildInFilterComponent, decorators: [{
2732
2238
  type: Component,
2733
2239
  args: [{
2734
- selector: "ng2-default-table-filter",
2240
+ selector: 'ng2-build-in-table-filter',
2735
2241
  template: `
2736
2242
  @switch (column().getFilterType()) { @case ('list') {
2737
2243
  <ng2-select-filter
2738
- [query]="query"
2244
+ [query]="query()"
2739
2245
  [class]="inputClass()"
2740
2246
  [source]="source()"
2741
2247
  [column]="column()"
2742
- (filter)="onFilter($event)"
2743
- >
2248
+ (filter)="filter.emit($event)">
2744
2249
  </ng2-select-filter>
2745
2250
  } @case ('checkbox') {
2746
2251
  <ng2-checkbox-filter
2747
- [query]="query"
2252
+ [query]="query()"
2748
2253
  [source]="source()"
2749
2254
  [class]="inputClass()"
2750
2255
  [column]="column()"
2751
- (filter)="onFilter($event)"
2752
- >
2256
+ (filter)="filter.emit($event)">
2753
2257
  </ng2-checkbox-filter>
2754
2258
  } @default {
2755
2259
  <ng2-input-filter
2756
- [query]="query"
2260
+ [query]="query()"
2757
2261
  [source]="source()"
2758
2262
  [class]="inputClass()"
2759
2263
  [column]="column()"
2760
- (filter)="onFilter($event)"
2761
- >
2264
+ (filter)="filter.emit($event)">
2762
2265
  </ng2-input-filter>
2763
2266
  } }
2764
2267
  `,
2765
2268
  standalone: true,
2766
- imports: [
2767
- SelectFilterComponent,
2768
- CheckboxFilterComponent,
2769
- InputFilterComponent,
2770
- ],
2269
+ imports: [SelectFilterComponent, CheckboxFilterComponent, InputFilterComponent],
2771
2270
  }]
2772
2271
  }] });
2773
2272
 
2774
- class FilterComponent extends FilterDefault {
2273
+ class CustomFilterComponent {
2274
+ constructor() {
2275
+ this.query = input('');
2276
+ this.inputClass = input('');
2277
+ this.source = input.required();
2278
+ this.column = input.required();
2279
+ this.filter = output();
2280
+ }
2775
2281
  ngOnChanges(changes) {
2776
- if (changes['source']) {
2777
- if (!changes['source'].firstChange && this.dataChangedSub) {
2778
- this.dataChangedSub.unsubscribe();
2282
+ if (this.customComponent) {
2283
+ if (this.customComponent?.instance && 'ngOnChanges' in this.customComponent.instance) {
2284
+ const onChanges = this.customComponent.instance.ngOnChanges;
2285
+ onChanges(changes);
2779
2286
  }
2780
- this.dataChangedSub = this.source().onChanged().subscribe((dataChanges) => {
2781
- const filterConf = this.source().getFilter();
2782
- if (filterConf && filterConf.filters && filterConf.filters.length === 0) {
2783
- this.query = '';
2784
- // add a check for existing filters an set the query if one exists for this column
2785
- // this covers instances where the filter is set by user code while maintaining existing functionality
2786
- }
2787
- else if (filterConf && filterConf.filters && filterConf.filters.length > 0) {
2788
- filterConf.filters.forEach((k, v) => {
2789
- if (k.field == this.column().id) {
2790
- this.query = k.search;
2791
- }
2792
- });
2793
- }
2794
- });
2287
+ return;
2288
+ }
2289
+ const columnFilter = this.column().filter;
2290
+ if (columnFilter && columnFilter.type === 'custom') {
2291
+ this.customComponent = this.dynamicTarget?.createComponent(columnFilter?.component);
2292
+ // set @Inputs and @Outputs of custom component
2293
+ this.customComponent?.setInput('query', this.query());
2294
+ this.customComponent?.setInput('column', this.column());
2295
+ this.customComponent?.setInput('source', this.source());
2296
+ this.customComponent?.setInput('inputClass', this.inputClass());
2297
+ this.filterSubscription = this.customComponent?.instance.filter.subscribe((event) => this.filter.emit(event));
2298
+ }
2299
+ }
2300
+ ngOnDestroy() {
2301
+ if (this.customComponent) {
2302
+ this.customComponent.destroy();
2303
+ }
2304
+ if (this.filterSubscription) {
2305
+ this.filterSubscription.unsubscribe();
2795
2306
  }
2796
2307
  }
2797
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2798
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: FilterComponent, isStandalone: true, selector: "ng2-smart-table-filter", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
2799
- @if (column().isFilterable) {
2800
- <div class="ng2-smart-filter">
2801
- @switch (column().getFilterType()) {
2802
- @case ('custom') {
2803
- <ng2-custom-table-filter
2804
- [query]="query"
2805
- [column]="column()"
2806
- [source]="source()"
2807
- [inputClass]="inputClass()"
2808
- (filter)="onFilter($event)">
2809
- </ng2-custom-table-filter>
2308
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2309
+ 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 }); }
2310
+ }
2311
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CustomFilterComponent, decorators: [{
2312
+ type: Component,
2313
+ args: [{
2314
+ selector: 'ng2-custom-table-filter',
2315
+ template: `<ng-template #dynamicTarget></ng-template>`,
2316
+ standalone: true,
2317
+ }]
2318
+ }], propDecorators: { dynamicTarget: [{
2319
+ type: ViewChild,
2320
+ args: ['dynamicTarget', { read: ViewContainerRef, static: true }]
2321
+ }] } });
2322
+
2323
+ class FilterComponent {
2324
+ constructor() {
2325
+ this.query = signal('');
2326
+ this.column = input.required();
2327
+ this.source = input.required();
2328
+ this.inputClass = input('');
2329
+ this.destroyRef = inject(DestroyRef);
2330
+ }
2331
+ ngOnInit() {
2332
+ this.source()
2333
+ .onChanged()
2334
+ .pipe(takeUntilDestroyed(this.destroyRef))
2335
+ .subscribe(({ filters }) => {
2336
+ if (!filters.length) {
2337
+ return;
2810
2338
  }
2811
- @default {
2812
- <ng2-default-table-filter
2813
- [query]="query"
2814
- [column]="column()"
2815
- [source]="source()"
2816
- [inputClass]="inputClass()"
2817
- (filter)="onFilter($event)">
2818
- </ng2-default-table-filter>
2339
+ const columnFilter = filters.find((filter) => filter.field === this.column().id);
2340
+ if (!columnFilter) {
2341
+ return;
2819
2342
  }
2820
- }
2821
- </div>
2822
- }
2823
- `, 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" }, { kind: "component", type: DefaultFilterComponent, selector: "ng2-default-table-filter" }] }); }
2343
+ this.query.set(columnFilter.search);
2344
+ });
2345
+ }
2346
+ onFilter(query) {
2347
+ this.source().addFilter({
2348
+ field: this.column().id,
2349
+ search: query,
2350
+ filter: this.column().filterFunction,
2351
+ });
2352
+ }
2353
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2354
+ 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: `
2355
+ @if (column().isFilterable) {
2356
+ <div class="ng2-smart-filter">
2357
+ @switch (column().getFilterType()) { @case ('custom') {
2358
+ <ng2-custom-table-filter
2359
+ [query]="query()"
2360
+ [column]="column()"
2361
+ [source]="source()"
2362
+ [inputClass]="inputClass()"
2363
+ (filter)="onFilter($event)">
2364
+ </ng2-custom-table-filter>
2365
+ } @default {
2366
+ <ng2-build-in-table-filter
2367
+ [query]="query()"
2368
+ [column]="column()"
2369
+ [source]="source()"
2370
+ [inputClass]="inputClass()"
2371
+ (filter)="onFilter($event)">
2372
+ </ng2-build-in-table-filter>
2373
+ } }
2374
+ </div>
2375
+ }
2376
+ `, 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"] }] }); }
2824
2377
  }
2825
2378
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FilterComponent, decorators: [{
2826
2379
  type: Component,
2827
2380
  args: [{ selector: 'ng2-smart-table-filter', template: `
2828
- @if (column().isFilterable) {
2829
- <div class="ng2-smart-filter">
2830
- @switch (column().getFilterType()) {
2831
- @case ('custom') {
2832
- <ng2-custom-table-filter
2833
- [query]="query"
2834
- [column]="column()"
2835
- [source]="source()"
2836
- [inputClass]="inputClass()"
2837
- (filter)="onFilter($event)">
2838
- </ng2-custom-table-filter>
2839
- }
2840
- @default {
2841
- <ng2-default-table-filter
2842
- [query]="query"
2843
- [column]="column()"
2844
- [source]="source()"
2845
- [inputClass]="inputClass()"
2846
- (filter)="onFilter($event)">
2847
- </ng2-default-table-filter>
2848
- }
2849
- }
2850
- </div>
2851
- }
2852
- `, standalone: true, imports: [CustomFilterComponent, DefaultFilterComponent], 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"] }]
2381
+ @if (column().isFilterable) {
2382
+ <div class="ng2-smart-filter">
2383
+ @switch (column().getFilterType()) { @case ('custom') {
2384
+ <ng2-custom-table-filter
2385
+ [query]="query()"
2386
+ [column]="column()"
2387
+ [source]="source()"
2388
+ [inputClass]="inputClass()"
2389
+ (filter)="onFilter($event)">
2390
+ </ng2-custom-table-filter>
2391
+ } @default {
2392
+ <ng2-build-in-table-filter
2393
+ [query]="query()"
2394
+ [column]="column()"
2395
+ [source]="source()"
2396
+ [inputClass]="inputClass()"
2397
+ (filter)="onFilter($event)">
2398
+ </ng2-build-in-table-filter>
2399
+ } }
2400
+ </div>
2401
+ }
2402
+ `, 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"] }]
2853
2403
  }] });
2854
2404
 
2855
2405
  class AddButtonComponent {
@@ -2922,7 +2472,6 @@ class TheadFiltersRowComponent {
2922
2472
  this.grid = input.required();
2923
2473
  this.source = input.required();
2924
2474
  this.create = output();
2925
- this.filter = output();
2926
2475
  this.filterInputClass = computed(() => {
2927
2476
  const filterOptions = this.grid().settings()?.filter;
2928
2477
  if (!filterOptions) {
@@ -2931,11 +2480,8 @@ class TheadFiltersRowComponent {
2931
2480
  return filterOptions.inputClass || "";
2932
2481
  });
2933
2482
  }
2934
- getVisibleColumns() {
2935
- return (this.grid().getColumns() || []).filter((column) => !column.hide);
2936
- }
2937
2483
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFiltersRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2938
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TheadFiltersRowComponent, isStandalone: true, selector: "[ng2-st-thead-filters-row]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { create: "create", filter: "filter" }, ngImport: i0, template: `
2484
+ 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: `
2939
2485
  @if (grid().isMultiSelectVisible()) {
2940
2486
  <th></th>
2941
2487
  } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
@@ -2945,13 +2491,12 @@ class TheadFiltersRowComponent {
2945
2491
  [grid]="grid()"
2946
2492
  (create)="create.emit($event)"
2947
2493
  ></th>
2948
- } @for (column of getVisibleColumns(); track column.id + $index) {
2494
+ } @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
2949
2495
  <th class="ng2-smart-th {{ column.id }}">
2950
2496
  <ng2-smart-table-filter
2951
2497
  [source]="source()"
2952
2498
  [column]="column"
2953
2499
  [inputClass]="filterInputClass()"
2954
- (filter)="filter.emit($event)"
2955
2500
  >
2956
2501
  </ng2-smart-table-filter>
2957
2502
  </th>
@@ -2963,7 +2508,7 @@ class TheadFiltersRowComponent {
2963
2508
  (create)="create.emit($event)"
2964
2509
  ></th>
2965
2510
  }
2966
- `, 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" }] }); }
2511
+ `, 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"] }] }); }
2967
2512
  }
2968
2513
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFiltersRowComponent, decorators: [{
2969
2514
  type: Component,
@@ -2979,13 +2524,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
2979
2524
  [grid]="grid()"
2980
2525
  (create)="create.emit($event)"
2981
2526
  ></th>
2982
- } @for (column of getVisibleColumns(); track column.id + $index) {
2527
+ } @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
2983
2528
  <th class="ng2-smart-th {{ column.id }}">
2984
2529
  <ng2-smart-table-filter
2985
2530
  [source]="source()"
2986
2531
  [column]="column"
2987
2532
  [inputClass]="filterInputClass()"
2988
- (filter)="filter.emit($event)"
2989
2533
  >
2990
2534
  </ng2-smart-table-filter>
2991
2535
  </th>
@@ -3077,7 +2621,7 @@ class TheadFormRowComponent {
3077
2621
  this.grid().create(this.grid().getNewRow(), this.createConfirm);
3078
2622
  }
3079
2623
  getVisibleCells() {
3080
- return (this.grid().getNewRow().getCells() || []).filter((cell) => !cell.getColumn().hide);
2624
+ return (this.grid().getNewRow().cells() || []).filter((cell) => !cell.getColumn().hide);
3081
2625
  }
3082
2626
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadFormRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3083
2627
  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: `
@@ -3180,7 +2724,7 @@ class CheckboxSelectAllComponent {
3180
2724
  }
3181
2725
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxSelectAllComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3182
2726
  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: `
3183
- <input type="checkbox" [ngModel]="this.grid().dataSet.isAllSelected" />
2727
+ <input type="checkbox" [ngModel]="this.grid().dataSet.isAllSelected()" />
3184
2728
  `, 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"] }] }); }
3185
2729
  }
3186
2730
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: CheckboxSelectAllComponent, decorators: [{
@@ -3188,7 +2732,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3188
2732
  args: [{
3189
2733
  selector: "[ng2-st-checkbox-select-all]",
3190
2734
  template: `
3191
- <input type="checkbox" [ngModel]="this.grid().dataSet.isAllSelected" />
2735
+ <input type="checkbox" [ngModel]="this.grid().dataSet.isAllSelected()" />
3192
2736
  `,
3193
2737
  standalone: true,
3194
2738
  imports: [FormsModule],
@@ -3197,105 +2741,70 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3197
2741
 
3198
2742
  class TitleComponent {
3199
2743
  constructor() {
3200
- this.currentDirection = "";
3201
2744
  this.source = input.required();
3202
2745
  this.column = input.required();
3203
- this.sort = output();
3204
- this.dataChangedSub = false;
2746
+ this.destroyRef = inject(DestroyRef);
2747
+ this.currentSortDirection = signal('');
3205
2748
  }
3206
- ngOnChanges(changes) {
3207
- if (changes["source"]) {
3208
- if (!changes["source"].firstChange && this.dataChangedSub) {
3209
- this.dataChangedSub.unsubscribe();
2749
+ ngOnInit() {
2750
+ this.source()
2751
+ .onChanged()
2752
+ .pipe(map(({ sort }) => {
2753
+ if (sort.field === this.column().id) {
2754
+ return sort.direction;
3210
2755
  }
3211
- this.dataChangedSub = this.source().onChanged().subscribe((dataChanges) => {
3212
- const sortConf = this.source().getSort();
3213
- if (sortConf.length > 0 && sortConf[0]["field"] === this.column().id) {
3214
- this.currentDirection = sortConf[0]["direction"];
3215
- }
3216
- else {
3217
- this.currentDirection = "";
3218
- }
3219
- });
3220
- }
3221
- }
3222
- ngOnDestroy() {
3223
- if (this.dataChangedSub) {
3224
- this.dataChangedSub?.unsubscribe();
3225
- }
2756
+ else {
2757
+ return '';
2758
+ }
2759
+ }), takeUntilDestroyed(this.destroyRef))
2760
+ .subscribe(this.currentSortDirection.set);
3226
2761
  }
3227
2762
  _sort(event) {
3228
2763
  event.preventDefault();
3229
- this.changeSortDirection();
3230
- this.source().setSort([
3231
- {
3232
- field: this.column().id,
3233
- direction: this.currentDirection === "desc" ? "desc" : "asc",
3234
- compare: this.column().getCompareFunction(),
3235
- },
3236
- ]);
3237
- this.sort.emit(null);
3238
- }
3239
- changeSortDirection() {
3240
- if (this.currentDirection) {
3241
- const newDirection = this.currentDirection === "asc" ? "desc" : "asc";
3242
- this.currentDirection = newDirection;
3243
- }
3244
- else {
3245
- this.currentDirection = this.column().sortDirection;
3246
- }
3247
- return this.currentDirection;
2764
+ this.source().setSort({
2765
+ field: this.column().id,
2766
+ direction: this.currentSortDirection() === 'desc' ? 'asc' : 'desc',
2767
+ compare: this.column().compareFunction,
2768
+ });
3248
2769
  }
3249
2770
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3250
- 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 } }, outputs: { sort: "sort" }, usesOnChanges: true, ngImport: i0, template: `
2771
+ 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: `
3251
2772
  @if (column().isSortable) {
3252
- <a
3253
- href="#"
3254
- (click)="_sort($event)"
3255
- class="ng2-smart-sort-link sort"
3256
- [class]="currentDirection"
3257
- >
2773
+ <a href="#" (click)="_sort($event)" class="ng2-smart-sort-link sort" [class]="currentSortDirection()">
3258
2774
  {{ column().title }}
3259
2775
  </a>
3260
2776
  } @else {
3261
2777
  <span class="ng2-smart-sort">{{ column().title }}</span>
3262
2778
  }
3263
- `, isInline: true, styles: ["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"] }); }
2779
+ `, 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"] }); }
3264
2780
  }
3265
2781
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TitleComponent, decorators: [{
3266
2782
  type: Component,
3267
- args: [{ selector: "ng2-smart-table-title", template: `
2783
+ args: [{ selector: 'ng2-smart-table-title', template: `
3268
2784
  @if (column().isSortable) {
3269
- <a
3270
- href="#"
3271
- (click)="_sort($event)"
3272
- class="ng2-smart-sort-link sort"
3273
- [class]="currentDirection"
3274
- >
2785
+ <a href="#" (click)="_sort($event)" class="ng2-smart-sort-link sort" [class]="currentSortDirection()">
3275
2786
  {{ column().title }}
3276
2787
  </a>
3277
2788
  } @else {
3278
2789
  <span class="ng2-smart-sort">{{ column().title }}</span>
3279
2790
  }
3280
- `, standalone: true, styles: ["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"] }]
2791
+ `, 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"] }]
3281
2792
  }] });
3282
2793
 
3283
2794
  class ColumnTitleComponent {
3284
2795
  constructor() {
3285
2796
  this.source = input.required();
3286
2797
  this.column = input.required();
3287
- this.sort = output();
3288
2798
  }
3289
2799
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ColumnTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3290
- 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 } }, outputs: { sort: "sort" }, ngImport: i0, template: `
2800
+ 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: `
3291
2801
  <div class="ng2-smart-title">
3292
2802
  <ng2-smart-table-title
3293
2803
  [source]="source()"
3294
2804
  [column]="column()"
3295
- (sort)="sort.emit($event)"
3296
2805
  ></ng2-smart-table-title>
3297
2806
  </div>
3298
- `, isInline: true, dependencies: [{ kind: "component", type: TitleComponent, selector: "ng2-smart-table-title", inputs: ["source", "column"], outputs: ["sort"] }] }); }
2807
+ `, isInline: true, dependencies: [{ kind: "component", type: TitleComponent, selector: "ng2-smart-table-title", inputs: ["source", "column"] }] }); }
3299
2808
  }
3300
2809
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ColumnTitleComponent, decorators: [{
3301
2810
  type: Component,
@@ -3306,7 +2815,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3306
2815
  <ng2-smart-table-title
3307
2816
  [source]="source()"
3308
2817
  [column]="column()"
3309
- (sort)="sort.emit($event)"
3310
2818
  ></ng2-smart-table-title>
3311
2819
  </div>
3312
2820
  `,
@@ -3319,24 +2827,20 @@ class TheadTitlesRowComponent {
3319
2827
  constructor() {
3320
2828
  this.grid = input.required();
3321
2829
  this.source = input.required();
3322
- this.sort = output();
3323
2830
  this.selectAllRows = output();
3324
2831
  }
3325
- getVisibleColumns() {
3326
- return (this.grid().getColumns() || []).filter((column) => !column.hide);
3327
- }
3328
2832
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadTitlesRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3329
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: TheadTitlesRowComponent, isStandalone: true, selector: "[ng2-st-thead-titles-row]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { sort: "sort", selectAllRows: "selectAllRows" }, ngImport: i0, template: `
2833
+ 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: `
3330
2834
  @if (grid().isMultiSelectVisible()) {
3331
2835
  <th
3332
2836
  ng2-st-checkbox-select-all
3333
2837
  [grid]="grid()"
3334
- (click)="selectAllRows.emit($event)"
2838
+ (click)="selectAllRows.emit()"
3335
2839
  ></th>
3336
2840
  } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
3337
2841
 
3338
2842
  <th ng2-st-actions-title [grid]="grid()"></th>
3339
- } @for (column of getVisibleColumns(); track column.id + $index) {
2843
+ } @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
3340
2844
  <th
3341
2845
  class="ng2-smart-th {{ column.id }}"
3342
2846
  [class]="column.class"
@@ -3345,13 +2849,12 @@ class TheadTitlesRowComponent {
3345
2849
  <ng2-st-column-title
3346
2850
  [source]="source()"
3347
2851
  [column]="column"
3348
- (sort)="sort.emit($event)"
3349
2852
  ></ng2-st-column-title>
3350
2853
  </th>
3351
2854
  } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
3352
2855
  <th ng2-st-actions-title [grid]="grid()"></th>
3353
2856
  }
3354
- `, 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"], outputs: ["sort"] }] }); }
2857
+ `, 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"] }] }); }
3355
2858
  }
3356
2859
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: TheadTitlesRowComponent, decorators: [{
3357
2860
  type: Component,
@@ -3362,12 +2865,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3362
2865
  <th
3363
2866
  ng2-st-checkbox-select-all
3364
2867
  [grid]="grid()"
3365
- (click)="selectAllRows.emit($event)"
2868
+ (click)="selectAllRows.emit()"
3366
2869
  ></th>
3367
2870
  } @if (grid().actionIsOnLeft() && grid().isActionsVisible()) {
3368
2871
 
3369
2872
  <th ng2-st-actions-title [grid]="grid()"></th>
3370
- } @for (column of getVisibleColumns(); track column.id + $index) {
2873
+ } @for (column of grid().dataSet.getVisibleColumns(); track column.id + $index) {
3371
2874
  <th
3372
2875
  class="ng2-smart-th {{ column.id }}"
3373
2876
  [class]="column.class"
@@ -3376,7 +2879,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3376
2879
  <ng2-st-column-title
3377
2880
  [source]="source()"
3378
2881
  [column]="column"
3379
- (sort)="sort.emit($event)"
3380
2882
  ></ng2-st-column-title>
3381
2883
  </th>
3382
2884
  } @if (grid().actionIsOnRight() && grid().isActionsVisible()) {
@@ -3396,10 +2898,8 @@ class Ng2SmartTableTheadComponent {
3396
2898
  constructor() {
3397
2899
  this.grid = input.required();
3398
2900
  this.source = input.required();
3399
- this.sort = output();
3400
2901
  this.selectAllRows = output();
3401
2902
  this.create = output();
3402
- this.filter = output();
3403
2903
  this.isHideHeader = computed(() => {
3404
2904
  return this.grid().settings()?.hideHeader || false;
3405
2905
  });
@@ -3408,7 +2908,7 @@ class Ng2SmartTableTheadComponent {
3408
2908
  });
3409
2909
  }
3410
2910
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTheadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3411
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: Ng2SmartTableTheadComponent, isStandalone: true, selector: "[ng2-st-thead]", inputs: { grid: { classPropertyName: "grid", publicName: "grid", isSignal: true, isRequired: true, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, createConfirm: { classPropertyName: "createConfirm", publicName: "createConfirm", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { sort: "sort", selectAllRows: "selectAllRows", create: "create", filter: "filter" }, ngImport: i0, template: "@if (!isHideHeader()) {\n <tr ng2-st-thead-titles-row\n class=\"ng2-smart-titles\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (sort)=\"sort.emit($event)\"\n (selectAllRows)=\"selectAllRows.emit($event)\">\n </tr>\n}\n\n@if (!isHideSubHeader()) {\n <tr ng2-st-thead-filters-row\n class=\"ng2-smart-filters\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (create)=\"create.emit($event)\"\n (filter)=\"filter.emit($event)\">\n </tr>\n}\n\n@if (grid().createFormShown) {\n <tr ng2-st-thead-form-row\n [grid]=\"grid()\"\n [createConfirm]=\"createConfirm\">\n </tr>\n}\n", dependencies: [{ kind: "component", type: TheadTitlesRowComponent, selector: "[ng2-st-thead-titles-row]", inputs: ["grid", "source"], outputs: ["sort", "selectAllRows"] }, { kind: "component", type: TheadFiltersRowComponent, selector: "[ng2-st-thead-filters-row]", inputs: ["grid", "source"], outputs: ["create", "filter"] }, { kind: "component", type: TheadFormRowComponent, selector: "[ng2-st-thead-form-row]", inputs: ["grid", "createConfirm"], outputs: ["create"] }] }); }
2911
+ 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"] }] }); }
3412
2912
  }
3413
2913
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableTheadComponent, decorators: [{
3414
2914
  type: Component,
@@ -3416,7 +2916,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3416
2916
  TheadTitlesRowComponent,
3417
2917
  TheadFiltersRowComponent,
3418
2918
  TheadFormRowComponent,
3419
- ], template: "@if (!isHideHeader()) {\n <tr ng2-st-thead-titles-row\n class=\"ng2-smart-titles\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (sort)=\"sort.emit($event)\"\n (selectAllRows)=\"selectAllRows.emit($event)\">\n </tr>\n}\n\n@if (!isHideSubHeader()) {\n <tr ng2-st-thead-filters-row\n class=\"ng2-smart-filters\"\n [grid]=\"grid()\"\n [source]=\"source()\"\n (create)=\"create.emit($event)\"\n (filter)=\"filter.emit($event)\">\n </tr>\n}\n\n@if (grid().createFormShown) {\n <tr ng2-st-thead-form-row\n [grid]=\"grid()\"\n [createConfirm]=\"createConfirm\">\n </tr>\n}\n" }]
2919
+ ], 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" }]
3420
2920
  }], propDecorators: { createConfirm: [{
3421
2921
  type: Input
3422
2922
  }] } });
@@ -3437,21 +2937,17 @@ class Ng2SmartTableComponent {
3437
2937
  this.editConfirm = output();
3438
2938
  this.createConfirm = output();
3439
2939
  this.tableClass = computed(() => {
3440
- return this.settings().attr?.class || "";
2940
+ return this.settings().attr?.class || '';
3441
2941
  });
3442
2942
  this.tableId = computed(() => {
3443
2943
  return this.settings().attr?.id || getRandomId();
3444
2944
  });
3445
- this.perPageSelect = computed(() => {
3446
- const { pager } = this.settings();
3447
- return pager ? pager.perPageSelect || [] : [];
3448
- });
3449
2945
  this.isPagerDisplay = computed(() => {
3450
2946
  const { pager } = this.settings();
3451
2947
  return pager ? pager.display : false;
3452
2948
  });
3453
2949
  this.rowClassFunction = computed(() => {
3454
- return this.settings().rowClassFunction || (() => "");
2950
+ return this.settings().rowClassFunction || (() => '');
3455
2951
  });
3456
2952
  }
3457
2953
  ngOnChanges({ settings }) {
@@ -3472,7 +2968,7 @@ class Ng2SmartTableComponent {
3472
2968
  this.emitUserSelectRow(row);
3473
2969
  }
3474
2970
  onSelectAllRows() {
3475
- this.grid.selectAllRows(!this.grid.dataSet.isAllSelected);
2971
+ this.grid.selectAllRows(!this.grid.dataSet.isAllSelected());
3476
2972
  this.emitUserSelectRow(null);
3477
2973
  }
3478
2974
  onSelectRow(row, state) {
@@ -3497,20 +2993,16 @@ class Ng2SmartTableComponent {
3497
2993
  });
3498
2994
  }
3499
2995
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3500
- 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()\" [perPageSelect]=\"perPageSelect()\">\n</ng2-smart-table-pager>\n}\n", styles: [":host{font-size:1rem}:host ::ng-deep *{box-sizing:border-box}:host ::ng-deep button,:host ::ng-deep input,:host ::ng-deep optgroup,:host ::ng-deep select,:host ::ng-deep textarea{color:inherit;font:inherit;margin:0}:host ::ng-deep table{line-height:1.5em;border-collapse:collapse;border-spacing:0;display:table;width:100%;max-width:100%;word-break:normal;word-break:keep-all;overflow:auto}:host ::ng-deep table tr th{font-weight:700}:host ::ng-deep table tr section{font-size:.75em;font-weight:700}:host ::ng-deep table tr td,:host ::ng-deep table tr th{font-size:.875em;margin:0;padding:.5em 1em}:host ::ng-deep a{color:#1e6bb8;text-decoration:none}:host ::ng-deep a:hover{text-decoration:underline}\n"], dependencies: [{ kind: "component", type: Ng2SmartTableTheadComponent, selector: "[ng2-st-thead]", inputs: ["grid", "source", "createConfirm"], outputs: ["sort", "selectAllRows", "create", "filter"] }, { kind: "component", type: Ng2SmartTableTbodyComponent, selector: "[ng2-st-tbody]", inputs: ["grid", "source", "deleteConfirm", "createConfirm", "editConfirm", "rowClassFunction"], outputs: ["save", "edit", "editCancel", "delete", "custom", "edited", "userSelectRow", "userClickedRow", "multipleSelectRow"] }, { kind: "component", type: PagerComponent, selector: "ng2-smart-table-pager", inputs: ["source", "perPageSelect"], outputs: ["changePage"] }] }); }
2996
+ 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 }); }
3501
2997
  }
3502
2998
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: Ng2SmartTableComponent, decorators: [{
3503
2999
  type: Component,
3504
- args: [{ selector: "ng2-smart-table", standalone: true, imports: [
3505
- Ng2SmartTableTheadComponent,
3506
- Ng2SmartTableTbodyComponent,
3507
- PagerComponent,
3508
- ], template: "<table [id]=\"tableId()\" [class]=\"tableClass()\">\n <thead\n ng2-st-thead\n [grid]=\"grid\"\n [source]=\"source()\"\n [createConfirm]=\"createConfirm\"\n (create)=\"create.emit($event)\"\n (selectAllRows)=\"onSelectAllRows()\"\n ></thead>\n\n <tbody\n ng2-st-tbody\n [grid]=\"grid\"\n [source]=\"source()\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [createConfirm]=\"createConfirm\"\n [rowClassFunction]=\"rowClassFunction()\"\n (edit)=\"edit.emit($event)\"\n (editCancel)=\"editCancel.emit($event)\"\n (delete)=\"delete.emit($event)\"\n (custom)=\"custom.emit($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\"\n ></tbody>\n</table>\n\n@if (isPagerDisplay()) {\n<ng2-smart-table-pager [source]=\"source()\" [perPageSelect]=\"perPageSelect()\">\n</ng2-smart-table-pager>\n}\n", styles: [":host{font-size:1rem}:host ::ng-deep *{box-sizing:border-box}:host ::ng-deep button,:host ::ng-deep input,:host ::ng-deep optgroup,:host ::ng-deep select,:host ::ng-deep textarea{color:inherit;font:inherit;margin:0}:host ::ng-deep table{line-height:1.5em;border-collapse:collapse;border-spacing:0;display:table;width:100%;max-width:100%;word-break:normal;word-break:keep-all;overflow:auto}:host ::ng-deep table tr th{font-weight:700}:host ::ng-deep table tr section{font-size:.75em;font-weight:700}:host ::ng-deep table tr td,:host ::ng-deep table tr th{font-size:.875em;margin:0;padding:.5em 1em}:host ::ng-deep a{color:#1e6bb8;text-decoration:none}:host ::ng-deep a:hover{text-decoration:underline}\n"] }]
3000
+ 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"] }]
3509
3001
  }] });
3510
3002
 
3511
3003
  /**
3512
3004
  * Generated bundle index. Do not edit.
3513
3005
  */
3514
3006
 
3515
- export { Cell, Column, DataSource, DefaultEditor, DefaultFilter, Deferred, LocalDataSource, Ng2SmartTableComponent, Row, SmartTableColumnEditorDirective, SmartTableOnChangedEventName };
3007
+ export { BaseEditorComponent, BaseFilterComponent, Cell, Column, DataSource, Deferred, LocalDataSource, Ng2SmartTableComponent, Row, ServerDataSource, SmartTableColumnEditorDirective, SmartTableOnChangedEventName };
3516
3008
  //# sourceMappingURL=den4ik92-ng2-smart-table.mjs.map