@den4ik92/ng2-smart-table 19.6.42 → 19.6.45

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, computed, ChangeDetectionStrategy, Component, signal, effect, inject, ElementRef, Directive, untracked, ViewContainerRef, ViewChild, output, viewChild } from '@angular/core';
2
+ import { input, computed, ChangeDetectionStrategy, Component, effect, signal, inject, ElementRef, Directive, untracked, ViewContainerRef, ViewChild, output, viewChild } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { UntypedFormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
5
  import { distinctUntilChanged, debounceTime, takeUntil, switchMap, take, finalize } from 'rxjs/operators';
@@ -27,12 +27,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
27
27
  class BaseFilterComponent {
28
28
  constructor() {
29
29
  this.delay = 300;
30
- this.query = input('');
30
+ this.query = input(null);
31
31
  this.inputClass = input('');
32
32
  this.source = input.required();
33
33
  this.column = input.required();
34
34
  this.filterEmitter = input.required();
35
35
  this.inputControl = new UntypedFormControl();
36
+ this.placeholder = '';
37
+ effect(() => {
38
+ this.inputControl?.setValue(this.query(), { emitEvent: false });
39
+ });
36
40
  }
37
41
  ngOnDestroy() {
38
42
  if (this.changesSubscription) {
@@ -45,22 +49,18 @@ class BaseFilterComponent {
45
49
  .subscribe((value) => {
46
50
  this.setFilter(value);
47
51
  });
48
- }
49
- ngOnChanges({ query }) {
50
- if (query) {
51
- this.inputControl?.setValue(query.currentValue, { emitEvent: false });
52
- }
52
+ this.placeholder = this.column()?.getFilterConfig()?.placeholder || this.column()?.getFilterConfig()?.selectText;
53
53
  }
54
54
  setFilter(query) {
55
55
  this.filterEmitter().emit(query);
56
56
  }
57
57
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: BaseFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
58
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", 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 }, filterEmitter: { classPropertyName: "filterEmitter", publicName: "filterEmitter", isSignal: true, isRequired: true, transformFunction: null } }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
58
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.14", 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 }, filterEmitter: { classPropertyName: "filterEmitter", publicName: "filterEmitter", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
59
59
  }
60
60
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: BaseFilterComponent, decorators: [{
61
61
  type: Component,
62
62
  args: [{ template: '', selector: 'ng2-base-filter-component', changeDetection: ChangeDetectionStrategy.OnPush }]
63
- }] });
63
+ }], ctorParameters: () => [] });
64
64
 
65
65
  /**
66
66
  * Extending object that entered in first argument.
@@ -411,8 +411,8 @@ class Column {
411
411
  if (settings.type === 'custom' && settings.renderComponent) {
412
412
  this.renderComponent = settings.renderComponent;
413
413
  }
414
- if (settings.type === 'custom' && settings.renderComponentInputs) {
415
- this.renderComponentInputs = settings.renderComponentInputs;
414
+ if (settings.type === 'custom' && settings.inputs) {
415
+ this.renderComponentInputs = settings.inputs;
416
416
  }
417
417
  this.isFilterable = !!settings['filter'];
418
418
  this.isSortable = settings.sort ?? false;
@@ -426,7 +426,7 @@ class Column {
426
426
  if (this.editor) {
427
427
  return this.editor?.config;
428
428
  }
429
- return false;
429
+ return undefined;
430
430
  }
431
431
  getFilterType() {
432
432
  return this.filter && this.filter.type;
@@ -435,7 +435,7 @@ class Column {
435
435
  if (this.filter) {
436
436
  return this.filter?.config;
437
437
  }
438
- return false;
438
+ return undefined;
439
439
  }
440
440
  }
441
441
 
@@ -498,8 +498,8 @@ class DataSource {
498
498
  perPageSelect: [],
499
499
  });
500
500
  this.data = signal([]);
501
- this.getSort = computed(() => this.sortConf());
502
- this.getFilters = computed(() => this.filters());
501
+ this.getSort = this.sortConf;
502
+ this.getFilters = this.filters;
503
503
  }
504
504
  refresh() {
505
505
  this.emitOnChanged({ action: SmartTableOnChangedEventName.refresh });
@@ -560,7 +560,9 @@ class DataSource {
560
560
  return;
561
561
  }
562
562
  const foundIndex = this.filters().findIndex((filter) => filter.field === newFilter.field);
563
- const newSearchString = typeof newFilter.search === 'undefined' || newFilter.search === null ? '' : `${newFilter.search}`;
563
+ const newSearchString = typeof newFilter.search === 'undefined' || newFilter.search === null || newFilter.search === 'null'
564
+ ? ''
565
+ : `${newFilter.search}`;
564
566
  if (foundIndex === -1) {
565
567
  if (newSearchString?.length) {
566
568
  this.filters.set([...this.filters(), newFilter]);
@@ -861,18 +863,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
861
863
 
862
864
  class CheckboxEditorComponent extends BaseEditorComponent {
863
865
  constructor() {
864
- super();
865
- this.trueVal = computed(() => {
866
- return this.cell().column.getEditorConfig()?.true || true;
867
- });
868
- this.falseVal = computed(() => {
869
- return this.cell().column.getEditorConfig()?.false || false;
870
- });
866
+ super(...arguments);
867
+ this.trueVal = true;
868
+ this.falseVal = false;
869
+ }
870
+ ngOnInit() {
871
+ this.trueVal = this.cell().column.getEditorConfig()?.true || true;
872
+ this.falseVal = this.cell().column.getEditorConfig()?.false || false;
871
873
  }
872
874
  onChange(event) {
873
- this.cell().setNewValue(event.target.checked ? this.trueVal() : this.falseVal());
875
+ this.cell().setNewValue(event.target.checked ? this.trueVal : this.falseVal);
874
876
  }
875
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
877
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
876
878
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: CheckboxEditorComponent, isStandalone: true, selector: "ng2-checkbox-editor", usesInheritance: true, ngImport: i0, template: `
877
879
  <input
878
880
  [class]="inputClass()"
@@ -881,7 +883,7 @@ class CheckboxEditorComponent extends BaseEditorComponent {
881
883
  [name]="cell().id"
882
884
  [disabled]="!cell().isEditable()"
883
885
  (change)="onChange($event)"
884
- [checked]="cell().getValue() === trueVal()" />
886
+ [checked]="cell().getValue() === trueVal" />
885
887
  `, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
886
888
  }
887
889
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxEditorComponent, decorators: [{
@@ -894,9 +896,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
894
896
  [name]="cell().id"
895
897
  [disabled]="!cell().isEditable()"
896
898
  (change)="onChange($event)"
897
- [checked]="cell().getValue() === trueVal()" />
899
+ [checked]="cell().getValue() === trueVal" />
898
900
  `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
899
- }], ctorParameters: () => [] });
901
+ }] });
900
902
 
901
903
  class InputEditorComponent extends BaseEditorComponent {
902
904
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InputEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
@@ -905,7 +907,7 @@ class InputEditorComponent extends BaseEditorComponent {
905
907
  type="text"
906
908
  [class]="inputClass()"
907
909
  class="form-control"
908
- [ngModel]="cell().getValue()"
910
+ [ngModel]="cell().newValue()"
909
911
  (ngModelChange)="cell().setNewValue($event)"
910
912
  [name]="cell().id"
911
913
  [placeholder]="cell().title"
@@ -919,7 +921,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
919
921
  type="text"
920
922
  [class]="inputClass()"
921
923
  class="form-control"
922
- [ngModel]="cell().getValue()"
924
+ [ngModel]="cell().newValue()"
923
925
  (ngModelChange)="cell().setNewValue($event)"
924
926
  [name]="cell().id"
925
927
  [placeholder]="cell().title"
@@ -933,7 +935,7 @@ class SelectEditorComponent extends BaseEditorComponent {
933
935
  <select
934
936
  [class]="inputClass()"
935
937
  class="form-control"
936
- [ngModel]="cell().getValue()"
938
+ [ngModel]="cell().newValue()"
937
939
  (ngModelChange)="cell().setNewValue($event)"
938
940
  [name]="cell().id"
939
941
  [disabled]="!cell().isEditable()">
@@ -953,7 +955,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
953
955
  <select
954
956
  [class]="inputClass()"
955
957
  class="form-control"
956
- [ngModel]="cell().getValue()"
958
+ [ngModel]="cell().newValue()"
957
959
  (ngModelChange)="cell().setNewValue($event)"
958
960
  [name]="cell().id"
959
961
  [disabled]="!cell().isEditable()">
@@ -975,7 +977,7 @@ class TextareaEditorComponent extends BaseEditorComponent {
975
977
  <textarea
976
978
  [class]="inputClass()"
977
979
  class="form-control"
978
- [ngModel]="cell().getValue()"
980
+ [ngModel]="cell().newValue()"
979
981
  (ngModelChange)="cell().setNewValue($event)"
980
982
  [name]="cell().id"
981
983
  [disabled]="!cell().isEditable()"
@@ -989,7 +991,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
989
991
  <textarea
990
992
  [class]="inputClass()"
991
993
  class="form-control"
992
- [ngModel]="cell().getValue()"
994
+ [ngModel]="cell().newValue()"
993
995
  (ngModelChange)="cell().setNewValue($event)"
994
996
  [name]="cell().id"
995
997
  [disabled]="!cell().isEditable()"
@@ -1061,7 +1063,6 @@ class EditCellComponent {
1061
1063
  constructor() {
1062
1064
  this.cell = input.required();
1063
1065
  }
1064
- // readonly inputClass = input('');
1065
1066
  getEditorType() {
1066
1067
  const editor = this.cell().column.editor;
1067
1068
  if (editor) {
@@ -1503,7 +1504,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1503
1504
 
1504
1505
  class CheckboxFilterComponent extends BaseFilterComponent {
1505
1506
  constructor() {
1506
- super();
1507
+ super(...arguments);
1507
1508
  this.filterIsActive = computed(() => this.query() !== null);
1508
1509
  this.currentState = computed(() => {
1509
1510
  const valuesConfig = this.getValuesConfig(this.column().getFilterConfig());
@@ -1529,7 +1530,7 @@ class CheckboxFilterComponent extends BaseFilterComponent {
1529
1530
  event.stopPropagation();
1530
1531
  this.setFilter(null);
1531
1532
  }
1532
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1533
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1533
1534
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: CheckboxFilterComponent, isStandalone: true, selector: "ng2-checkbox-filter", usesInheritance: true, ngImport: i0, template: `
1534
1535
  <div class="checkbox-filter-wrapper">
1535
1536
  <input
@@ -1545,7 +1546,7 @@ class CheckboxFilterComponent extends BaseFilterComponent {
1545
1546
  }}</a>
1546
1547
  }
1547
1548
  </div>
1548
- `, isInline: true, styles: [".checkbox-filter-wrapper{display:flex;align-items:center;justify-content:flex-start;gap:.5rem}.checkbox-filter-wrapper input{width:auto}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1549
+ `, isInline: true, styles: [".checkbox-filter-wrapper{display:flex;align-items:center;justify-content:flex-start;gap:.5rem}.checkbox-filter-wrapper input{width:auto}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1549
1550
  }
1550
1551
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CheckboxFilterComponent, decorators: [{
1551
1552
  type: Component,
@@ -1564,8 +1565,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1564
1565
  }}</a>
1565
1566
  }
1566
1567
  </div>
1567
- `, changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, ReactiveFormsModule], styles: [".checkbox-filter-wrapper{display:flex;align-items:center;justify-content:flex-start;gap:.5rem}.checkbox-filter-wrapper input{width:auto}\n"] }]
1568
- }], ctorParameters: () => [] });
1568
+ `, changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule], styles: [".checkbox-filter-wrapper{display:flex;align-items:center;justify-content:flex-start;gap:.5rem}.checkbox-filter-wrapper input{width:auto}\n"] }]
1569
+ }] });
1569
1570
 
1570
1571
  class InputFilterComponent extends BaseFilterComponent {
1571
1572
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InputFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
@@ -1575,8 +1576,8 @@ class InputFilterComponent extends BaseFilterComponent {
1575
1576
  [formControl]="inputControl"
1576
1577
  class="form-control"
1577
1578
  type="text"
1578
- placeholder="{{ column().title }}" />
1579
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1579
+ placeholder="{{ placeholder || column().title }}" />
1580
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { 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.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1580
1581
  }
1581
1582
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InputFilterComponent, decorators: [{
1582
1583
  type: Component,
@@ -1588,25 +1589,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1588
1589
  [formControl]="inputControl"
1589
1590
  class="form-control"
1590
1591
  type="text"
1591
- placeholder="{{ column().title }}" />
1592
+ placeholder="{{ placeholder || column().title }}" />
1592
1593
  `,
1593
1594
  changeDetection: ChangeDetectionStrategy.OnPush,
1594
- imports: [FormsModule, ReactiveFormsModule],
1595
+ imports: [ReactiveFormsModule],
1595
1596
  }]
1596
1597
  }] });
1597
1598
 
1598
1599
  class SelectFilterComponent extends BaseFilterComponent {
1600
+ constructor() {
1601
+ super(...arguments);
1602
+ this.optionsList = signal([]);
1603
+ }
1604
+ ngOnInit() {
1605
+ super.ngOnInit();
1606
+ const config = this.column().getFilterConfig();
1607
+ this.optionsList.set(config?.list || []);
1608
+ }
1599
1609
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1600
1610
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: SelectFilterComponent, isStandalone: true, selector: "ng2-select-filter", usesInheritance: true, ngImport: i0, template: `
1601
1611
  <select [class]="inputClass()" class="form-control" [formControl]="inputControl">
1602
- <option value="">{{ column().getFilterConfig().selectText || 'all' }}</option>
1603
- @for (option of column().getFilterConfig().list; track $index) {
1612
+ <option [value]="null">{{ placeholder || 'all' }}</option>
1613
+ @for (option of optionsList(); track $index) {
1604
1614
  <option [value]="option.value">
1605
1615
  {{ option.title }}
1606
1616
  </option>
1607
1617
  }
1608
1618
  </select>
1609
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1619
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { 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.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1610
1620
  }
1611
1621
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SelectFilterComponent, decorators: [{
1612
1622
  type: Component,
@@ -1614,8 +1624,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1614
1624
  selector: 'ng2-select-filter',
1615
1625
  template: `
1616
1626
  <select [class]="inputClass()" class="form-control" [formControl]="inputControl">
1617
- <option value="">{{ column().getFilterConfig().selectText || 'all' }}</option>
1618
- @for (option of column().getFilterConfig().list; track $index) {
1627
+ <option [value]="null">{{ placeholder || 'all' }}</option>
1628
+ @for (option of optionsList(); track $index) {
1619
1629
  <option [value]="option.value">
1620
1630
  {{ option.title }}
1621
1631
  </option>
@@ -1623,13 +1633,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1623
1633
  </select>
1624
1634
  `,
1625
1635
  changeDetection: ChangeDetectionStrategy.OnPush,
1626
- imports: [FormsModule, ReactiveFormsModule],
1636
+ imports: [ReactiveFormsModule],
1627
1637
  }]
1628
1638
  }] });
1629
1639
 
1630
1640
  class BuildInFilterComponent {
1631
1641
  constructor() {
1632
- this.query = input('');
1642
+ this.query = input(null);
1633
1643
  this.inputClass = input('');
1634
1644
  this.source = input.required();
1635
1645
  this.column = input.required();
@@ -1710,33 +1720,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1710
1720
 
1711
1721
  class CustomFilterComponent {
1712
1722
  constructor() {
1713
- this.customFilterComponent = computed(() => {
1714
- const columnFilter = this.column().filter;
1715
- if (!columnFilter || columnFilter.type !== 'custom') {
1716
- return null;
1717
- }
1718
- return columnFilter.component;
1719
- });
1720
- this.query = input('');
1723
+ this.query = input(null);
1721
1724
  this.inputClass = input('');
1722
1725
  this.source = input.required();
1723
1726
  this.column = input.required();
1724
1727
  this.filter = output();
1728
+ this.componentInputs = computed(() => {
1729
+ let inputs = {
1730
+ query: this.query(),
1731
+ inputClass: this.inputClass(),
1732
+ source: this.source(),
1733
+ column: this.column(),
1734
+ filterEmitter: this.filter,
1735
+ };
1736
+ const columnFilter = this.column().filter;
1737
+ if (columnFilter && columnFilter.type === 'custom') {
1738
+ if (columnFilter.config?.inputs) {
1739
+ inputs = { ...inputs, ...columnFilter.config?.inputs };
1740
+ }
1741
+ }
1742
+ return inputs;
1743
+ });
1744
+ }
1745
+ ngOnInit() {
1746
+ const columnFilter = this.column().filter;
1747
+ if (columnFilter && columnFilter.type === 'custom') {
1748
+ this.customFilterComponent = columnFilter.component;
1749
+ }
1725
1750
  }
1726
1751
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: CustomFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1727
1752
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", 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" }, ngImport: i0, template: `
1728
- @if (customFilterComponent(); as component) {
1729
- <ng-template
1730
- *ngComponentOutlet="
1731
- component;
1732
- inputs: {
1733
- query: query(),
1734
- inputClass: inputClass(),
1735
- source: source(),
1736
- column: column(),
1737
- filterEmitter: filter,
1738
- }
1739
- "></ng-template>
1753
+ @if (customFilterComponent) {
1754
+ <ng-template *ngComponentOutlet="customFilterComponent; inputs: componentInputs()"></ng-template>
1740
1755
  }
1741
1756
  `, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1742
1757
  }
@@ -1746,18 +1761,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1746
1761
  selector: 'ng2-custom-table-filter',
1747
1762
  imports: [NgComponentOutlet],
1748
1763
  template: `
1749
- @if (customFilterComponent(); as component) {
1750
- <ng-template
1751
- *ngComponentOutlet="
1752
- component;
1753
- inputs: {
1754
- query: query(),
1755
- inputClass: inputClass(),
1756
- source: source(),
1757
- column: column(),
1758
- filterEmitter: filter,
1759
- }
1760
- "></ng-template>
1764
+ @if (customFilterComponent) {
1765
+ <ng-template *ngComponentOutlet="customFilterComponent; inputs: componentInputs()"></ng-template>
1761
1766
  }
1762
1767
  `,
1763
1768
  changeDetection: ChangeDetectionStrategy.OnPush,
@@ -1766,15 +1771,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
1766
1771
 
1767
1772
  class FilterComponent {
1768
1773
  constructor() {
1774
+ this.column = input.required();
1775
+ this.source = input.required();
1776
+ this.inputClass = input('');
1769
1777
  this.query = computed(() => {
1770
1778
  const columnFilter = this.source()
1771
1779
  .getFilters()
1772
1780
  .find((filter) => filter.field === this.column().id);
1773
1781
  return columnFilter?.search ?? null;
1774
1782
  });
1775
- this.column = input.required();
1776
- this.source = input.required();
1777
- this.inputClass = input('');
1778
1783
  }
1779
1784
  onFilter(query) {
1780
1785
  const columnFilter = this.column().filter;
@@ -2537,7 +2542,7 @@ class Ng2SmartTableComponent {
2537
2542
  * <div #paginationSlot>
2538
2543
  * </div>
2539
2544
  * inside component
2540
- * readonly paginationContainerRef = viewChild<'paginationSlot', ViewContainerRef>('paginationSlot', {
2545
+ * readonly paginationContainerRef = viewChild('paginationSlot', {
2541
2546
  * read: ViewContainerRef,
2542
2547
  * });
2543
2548
  */