@taiga-ui/addon-table 4.66.0 → 5.0.0-canary.856b30d

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 (98) hide show
  1. package/README.md +2 -2
  2. package/components/reorder/reorder.component.d.ts +7 -10
  3. package/components/reorder/reorder.options.d.ts +1 -3
  4. package/components/table/directives/cell.directive.d.ts +2 -2
  5. package/components/table/directives/head.directive.d.ts +2 -2
  6. package/components/table/directives/resized.directive.d.ts +2 -1
  7. package/components/table/directives/sort-by.directive.d.ts +6 -11
  8. package/components/table/directives/sortable.directive.d.ts +6 -8
  9. package/components/table/directives/table.directive.d.ts +9 -23
  10. package/components/table/index.d.ts +0 -2
  11. package/components/table/pipes/table-sort.pipe.d.ts +6 -5
  12. package/components/table/table-expand/table-expand.component.d.ts +4 -6
  13. package/components/table/table.d.ts +1 -2
  14. package/components/table/table.options.d.ts +1 -19
  15. package/components/table/tbody/tbody.component.d.ts +5 -8
  16. package/components/table/td/td.component.d.ts +3 -2
  17. package/components/table/th/th.component.d.ts +8 -8
  18. package/components/table/th-group/th-group.component.d.ts +4 -7
  19. package/components/table/tr/tr.component.d.ts +3 -7
  20. package/components/table-pagination/table-pagination.component.d.ts +14 -19
  21. package/components/table-pagination/table-pagination.options.d.ts +1 -3
  22. package/directives/table-control/checkbox-row.directive.d.ts +2 -2
  23. package/directives/table-control/checkbox-table.directive.d.ts +2 -1
  24. package/directives/table-filters/abstract-table-filter.d.ts +2 -1
  25. package/directives/table-filters/generic-filter.directive.d.ts +2 -2
  26. package/directives/table-filters/table-filter.directive.d.ts +3 -3
  27. package/fesm2022/taiga-ui-addon-table-components-reorder.mjs +37 -50
  28. package/fesm2022/taiga-ui-addon-table-components-reorder.mjs.map +1 -1
  29. package/fesm2022/taiga-ui-addon-table-components-table-pagination.mjs +36 -77
  30. package/fesm2022/taiga-ui-addon-table-components-table-pagination.mjs.map +1 -1
  31. package/fesm2022/taiga-ui-addon-table-components-table.mjs +212 -406
  32. package/fesm2022/taiga-ui-addon-table-components-table.mjs.map +1 -1
  33. package/fesm2022/taiga-ui-addon-table-directives-table-control.mjs +26 -28
  34. package/fesm2022/taiga-ui-addon-table-directives-table-control.mjs.map +1 -1
  35. package/fesm2022/taiga-ui-addon-table-directives-table-filters.mjs +24 -32
  36. package/fesm2022/taiga-ui-addon-table-directives-table-filters.mjs.map +1 -1
  37. package/fesm2022/taiga-ui-addon-table-tokens.mjs.map +1 -1
  38. package/package.json +13 -30
  39. package/tokens/i18n.d.ts +2 -2
  40. package/components/table/directives/direction-order.directive.d.ts +0 -11
  41. package/components/table/providers/table.provider.d.ts +0 -5
  42. package/esm2022/components/index.mjs +0 -4
  43. package/esm2022/components/reorder/index.mjs +0 -3
  44. package/esm2022/components/reorder/reorder.component.mjs +0 -112
  45. package/esm2022/components/reorder/reorder.options.mjs +0 -16
  46. package/esm2022/components/reorder/taiga-ui-addon-table-components-reorder.mjs +0 -5
  47. package/esm2022/components/table/caption/caption.component.mjs +0 -12
  48. package/esm2022/components/table/directives/cell.directive.mjs +0 -21
  49. package/esm2022/components/table/directives/direction-order.directive.mjs +0 -33
  50. package/esm2022/components/table/directives/head.directive.mjs +0 -22
  51. package/esm2022/components/table/directives/resized.directive.mjs +0 -30
  52. package/esm2022/components/table/directives/sort-by.directive.mjs +0 -59
  53. package/esm2022/components/table/directives/sortable.directive.mjs +0 -51
  54. package/esm2022/components/table/directives/stuck.directive.mjs +0 -37
  55. package/esm2022/components/table/directives/table.directive.mjs +0 -133
  56. package/esm2022/components/table/directives/thead.directive.mjs +0 -30
  57. package/esm2022/components/table/index.mjs +0 -21
  58. package/esm2022/components/table/pipes/table-sort.pipe.mjs +0 -31
  59. package/esm2022/components/table/providers/table.provider.mjs +0 -18
  60. package/esm2022/components/table/table-expand/table-expand.component.mjs +0 -66
  61. package/esm2022/components/table/table.mjs +0 -35
  62. package/esm2022/components/table/table.options.mjs +0 -26
  63. package/esm2022/components/table/taiga-ui-addon-table-components-table.mjs +0 -5
  64. package/esm2022/components/table/tbody/tbody.component.mjs +0 -47
  65. package/esm2022/components/table/td/td.component.mjs +0 -22
  66. package/esm2022/components/table/th/th.component.mjs +0 -87
  67. package/esm2022/components/table/th-group/th-group.component.mjs +0 -33
  68. package/esm2022/components/table/tr/tr.component.mjs +0 -40
  69. package/esm2022/components/table-pagination/index.mjs +0 -3
  70. package/esm2022/components/table-pagination/table-pagination.component.mjs +0 -99
  71. package/esm2022/components/table-pagination/table-pagination.options.mjs +0 -21
  72. package/esm2022/components/table-pagination/taiga-ui-addon-table-components-table-pagination.mjs +0 -5
  73. package/esm2022/components/taiga-ui-addon-table-components.mjs +0 -5
  74. package/esm2022/directives/index.mjs +0 -3
  75. package/esm2022/directives/table-control/checkbox-row.directive.mjs +0 -45
  76. package/esm2022/directives/table-control/checkbox-table.directive.mjs +0 -30
  77. package/esm2022/directives/table-control/index.mjs +0 -5
  78. package/esm2022/directives/table-control/table-control.directive.mjs +0 -32
  79. package/esm2022/directives/table-control/table-control.mjs +0 -9
  80. package/esm2022/directives/table-control/taiga-ui-addon-table-directives-table-control.mjs +0 -5
  81. package/esm2022/directives/table-filters/abstract-table-filter.mjs +0 -3
  82. package/esm2022/directives/table-filters/generic-filter.directive.mjs +0 -26
  83. package/esm2022/directives/table-filters/index.mjs +0 -7
  84. package/esm2022/directives/table-filters/table-filter.directive.mjs +0 -44
  85. package/esm2022/directives/table-filters/table-filter.mjs +0 -2
  86. package/esm2022/directives/table-filters/table-filters.directive.mjs +0 -37
  87. package/esm2022/directives/table-filters/table-filters.mjs +0 -11
  88. package/esm2022/directives/table-filters/table-filters.pipe.mjs +0 -22
  89. package/esm2022/directives/table-filters/taiga-ui-addon-table-directives-table-filters.mjs +0 -5
  90. package/esm2022/directives/taiga-ui-addon-table-directives.mjs +0 -5
  91. package/esm2022/index.mjs +0 -4
  92. package/esm2022/taiga-ui-addon-table.mjs +0 -5
  93. package/esm2022/tokens/i18n.mjs +0 -15
  94. package/esm2022/tokens/index.mjs +0 -2
  95. package/esm2022/tokens/taiga-ui-addon-table-tokens.mjs +0 -5
  96. package/esm2022/types/comparator.mjs +0 -2
  97. package/esm2022/types/index.mjs +0 -2
  98. package/esm2022/types/taiga-ui-addon-table-types.mjs +0 -5
@@ -1,54 +1,85 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ViewEncapsulation, ChangeDetectionStrategy, inject, TemplateRef, Directive, Input, InjectionToken, ChangeDetectorRef, EventEmitter, signal, Output, forwardRef, ContentChildren, Pipe, SkipSelf, PLATFORM_ID, computed, ViewChild, ContentChild } from '@angular/core';
3
- import { map, distinctUntilChanged, catchError, EMPTY, combineLatest, debounceTime, Subject, switchMap, takeUntil, delay, filter, timer, of, ReplaySubject, startWith } from 'rxjs';
4
- import { tuiProvideOptions, tuiWithStyles, tuiProvide, tuiDefaultSort, tuiPure } from '@taiga-ui/cdk/utils/miscellaneous';
2
+ import { ChangeDetectionStrategy, ViewEncapsulation, Component, input, inject, TemplateRef, Directive, computed, effect, model, output, signal, forwardRef, untracked, contentChildren, Pipe, viewChild, PLATFORM_ID, contentChild } from '@angular/core';
3
+ import { DOCUMENT, NgTemplateOutlet, isPlatformServer } from '@angular/common';
4
+ import { outputFromObservable, toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
+ import { EMPTY_CLIENT_RECT } from '@taiga-ui/cdk/constants';
6
+ import { tuiTypedFromEvent, tuiPreventDefault, tuiWatch } from '@taiga-ui/cdk/observables';
7
+ import { tuiInjectElement } from '@taiga-ui/cdk/utils/dom';
8
+ import { switchMap, distinctUntilChanged, map, takeUntil, catchError, EMPTY, Subject, timer, of } from 'rxjs';
9
+ import { coerceBooleanProperty } from '@angular/cdk/coercion';
10
+ import { tuiWithStyles, tuiDefaultSort } from '@taiga-ui/cdk/utils/miscellaneous';
11
+ import { TuiIcon } from '@taiga-ui/core/components/icon';
5
12
  import { IntersectionObserverService, WA_INTERSECTION_THRESHOLD, WA_INTERSECTION_ROOT_MARGIN } from '@ng-web-apis/intersection-observer';
13
+ import { tuiCreateOptions, tuiProvide } from '@taiga-ui/cdk/utils/di';
6
14
  import { tuiButtonOptionsProvider } from '@taiga-ui/core/components/button';
7
15
  import { TUI_TEXTFIELD_OPTIONS, TuiTextfieldComponent } from '@taiga-ui/core/components/textfield';
8
16
  import { tuiBadgeOptionsProvider } from '@taiga-ui/kit/components/badge';
9
17
  import { tuiChipOptionsProvider } from '@taiga-ui/kit/components/chip';
10
18
  import { tuiProgressOptionsProvider } from '@taiga-ui/kit/components/progress';
11
- import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
12
- import { tuiWatch, tuiTypedFromEvent, tuiPreventDefault, tuiZoneOptimized, tuiQueryListChanges } from '@taiga-ui/cdk/observables';
13
- import { DOCUMENT, AsyncPipe, NgIf, NgTemplateOutlet, isPlatformServer, NgForOf } from '@angular/common';
14
- import { EMPTY_CLIENT_RECT, EMPTY_QUERY } from '@taiga-ui/cdk/constants';
15
- import { tuiInjectElement } from '@taiga-ui/cdk/utils/dom';
16
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
17
- import { TuiIcon } from '@taiga-ui/core/components/icon';
18
- import { __decorate } from 'tslib';
19
19
  import * as i1 from '@taiga-ui/kit/directives/present';
20
20
  import { TuiPresent } from '@taiga-ui/kit/directives/present';
21
21
  import { TuiChevron } from '@taiga-ui/kit/directives/chevron';
22
22
  import { PolymorpheusOutlet } from '@taiga-ui/polymorpheus';
23
- import { WaResizeObserverService } from '@ng-web-apis/resize-observer';
24
23
  import { TuiControl } from '@taiga-ui/cdk/classes';
25
24
 
26
25
  class TuiTableCaption {
27
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableCaption, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
28
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableCaption, isStandalone: true, selector: "caption[tuiCaption]", ngImport: i0, template: '<ng-content/>', isInline: true, styles: ["caption[tuiCaption]{caption-side:bottom;text-align:start;padding:.75rem 0;color:var(--tui-text-secondary)}caption[tuiCaption]>*:not(:first-child){margin-inline-start:.5rem}caption[tuiCaption] tui-pagination:not(:first-child),caption[tuiCaption] tui-pager:not(:first-child){display:inline-flex;vertical-align:middle}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
26
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableCaption, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
27
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: TuiTableCaption, isStandalone: true, selector: "caption[tuiCaption]", ngImport: i0, template: '<ng-content/>', isInline: true, styles: ["caption[tuiCaption]{caption-side:bottom;text-align:start;padding:.75rem 0;color:var(--tui-text-secondary)}caption[tuiCaption]>*{vertical-align:middle}caption[tuiCaption]>*:not(:first-child){margin-inline-start:.5rem}caption[tuiCaption] tui-pagination:not(:first-child),caption[tuiCaption] tui-pager:not(:first-child){display:inline-flex;vertical-align:middle}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
29
28
  }
30
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableCaption, decorators: [{
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableCaption, decorators: [{
31
30
  type: Component,
32
- args: [{ standalone: true, selector: 'caption[tuiCaption]', template: '<ng-content/>', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["caption[tuiCaption]{caption-side:bottom;text-align:start;padding:.75rem 0;color:var(--tui-text-secondary)}caption[tuiCaption]>*:not(:first-child){margin-inline-start:.5rem}caption[tuiCaption] tui-pagination:not(:first-child),caption[tuiCaption] tui-pager:not(:first-child){display:inline-flex;vertical-align:middle}\n"] }]
31
+ args: [{ selector: 'caption[tuiCaption]', template: '<ng-content/>', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["caption[tuiCaption]{caption-side:bottom;text-align:start;padding:.75rem 0;color:var(--tui-text-secondary)}caption[tuiCaption]>*{vertical-align:middle}caption[tuiCaption]>*:not(:first-child){margin-inline-start:.5rem}caption[tuiCaption] tui-pagination:not(:first-child),caption[tuiCaption] tui-pager:not(:first-child){display:inline-flex;vertical-align:middle}\n"] }]
33
32
  }] });
34
33
 
35
34
  class TuiTableCell {
36
35
  constructor() {
37
- this.tuiCell = '';
36
+ this.tuiCell = input('');
38
37
  this.template = inject((TemplateRef));
39
38
  }
40
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableCell, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
41
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableCell, isStandalone: true, selector: "ng-template[tuiCell]", inputs: { tuiCell: "tuiCell" }, ngImport: i0 }); }
39
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableCell, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
40
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.17", type: TuiTableCell, isStandalone: true, selector: "ng-template[tuiCell]", inputs: { tuiCell: { classPropertyName: "tuiCell", publicName: "tuiCell", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
42
41
  }
43
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableCell, decorators: [{
42
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableCell, decorators: [{
44
43
  type: Directive,
45
44
  args: [{
46
- standalone: true,
47
45
  selector: 'ng-template[tuiCell]',
48
46
  }]
49
- }], propDecorators: { tuiCell: [{
50
- type: Input
51
- }] } });
47
+ }] });
48
+
49
+ class TuiTableHead {
50
+ constructor() {
51
+ this.tuiHead = input.required();
52
+ this.template = inject((TemplateRef));
53
+ }
54
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableHead, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
55
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.17", type: TuiTableHead, isStandalone: true, selector: "[tuiHead]", inputs: { tuiHead: { classPropertyName: "tuiHead", publicName: "tuiHead", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
56
+ }
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableHead, decorators: [{
58
+ type: Directive,
59
+ args: [{
60
+ selector: '[tuiHead]',
61
+ }]
62
+ }] });
63
+
64
+ class TuiTableResized {
65
+ constructor() {
66
+ this.doc = inject(DOCUMENT);
67
+ this.el = tuiInjectElement();
68
+ this.tuiResized$ = tuiTypedFromEvent(this.el, 'mousedown').pipe(tuiPreventDefault(), switchMap(() => {
69
+ const { width, right } = this.el.closest('th')?.getBoundingClientRect() || EMPTY_CLIENT_RECT;
70
+ return tuiTypedFromEvent(this.doc, 'mousemove').pipe(distinctUntilChanged(), map(({ clientX }) => width + clientX - right), takeUntil(tuiTypedFromEvent(this.doc, 'mouseup')));
71
+ }));
72
+ this.tuiResized = outputFromObservable(this.tuiResized$);
73
+ }
74
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableResized, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
75
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: TuiTableResized, isStandalone: true, selector: "[tuiResized]", outputs: { tuiResized: "tuiResized" }, ngImport: i0 }); }
76
+ }
77
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableResized, decorators: [{
78
+ type: Directive,
79
+ args: [{
80
+ selector: '[tuiResized]',
81
+ }]
82
+ }] });
52
83
 
53
84
  const TuiSortDirection = {
54
85
  Asc: 1,
@@ -67,20 +98,15 @@ const TUI_TABLE_DEFAULT_OPTIONS = {
67
98
  off: '@tui.chevrons-up-down',
68
99
  },
69
100
  };
70
- const TUI_TABLE_OPTIONS = new InjectionToken(ngDevMode ? 'TUI_TABLE_OPTIONS' : '', {
71
- factory: () => TUI_TABLE_DEFAULT_OPTIONS,
72
- });
73
- function tuiTableOptionsProvider(options) {
74
- return tuiProvideOptions(TUI_TABLE_OPTIONS, options, TUI_TABLE_DEFAULT_OPTIONS);
75
- }
101
+ const [TUI_TABLE_OPTIONS, tuiTableOptionsProvider] = tuiCreateOptions(TUI_TABLE_DEFAULT_OPTIONS);
76
102
 
77
103
  // TODO: Consider making universal and moving to CDK
78
104
  class TuiStuck {
79
105
  constructor() {
80
106
  this.stuck = toSignal(inject(IntersectionObserverService).pipe(map((entries) => (entries[entries.length - 1]?.intersectionRatio ?? 0) < 1), distinctUntilChanged(), tuiWatch(), catchError(() => EMPTY)));
81
107
  }
82
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiStuck, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
83
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiStuck, isStandalone: true, selector: "tui-stuck:never", host: { properties: { "class._stuck": "stuck()" } }, providers: [
108
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiStuck, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
109
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: TuiStuck, isStandalone: true, selector: "tui-stuck:never", host: { properties: { "class._stuck": "stuck()" } }, providers: [
84
110
  IntersectionObserverService,
85
111
  {
86
112
  provide: WA_INTERSECTION_THRESHOLD,
@@ -88,10 +114,9 @@ class TuiStuck {
88
114
  },
89
115
  ], ngImport: i0 }); }
90
116
  }
91
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiStuck, decorators: [{
117
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiStuck, decorators: [{
92
118
  type: Directive,
93
119
  args: [{
94
- standalone: true,
95
120
  selector: 'tui-stuck:never',
96
121
  providers: [
97
122
  IntersectionObserverService,
@@ -105,53 +130,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
105
130
  }] });
106
131
 
107
132
  const EMPTY_COMPARATOR = () => 0;
108
- class TuiTableStyles {
109
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableStyles, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
110
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableStyles, isStandalone: true, selector: "ng-component", host: { classAttribute: "tui-table" }, ngImport: i0, template: '', isInline: true, styles: ["table[tuiTable]{border-collapse:separate;border-spacing:0}table[tuiTable] [tuiCell]{padding:0}table[tuiTable] [tuiTitle]{white-space:nowrap}table[tuiTable] [tuiTitle] tui-icon{font-size:1rem}table[tuiTable] [tuiSubtitle]{color:var(--tui-text-secondary)}table[tuiTable] [tuiTh] [tuiCell],table[tuiTable] [tuiTh] [tuiTitle]{font:inherit;color:inherit}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
133
+ class Styles {
134
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: Styles, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
135
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: Styles, isStandalone: true, selector: "ng-component", host: { classAttribute: "tui-table" }, ngImport: i0, template: '', isInline: true, styles: ["table[tuiTable]{border-collapse:separate;border-spacing:0;isolation:isolate}table[tuiTable] [tuiCell]{padding:0}table[tuiTable] [tuiTitle]{white-space:nowrap}table[tuiTable] [tuiTitle] tui-icon{font-size:1rem}table[tuiTable] [tuiSubtitle]{color:var(--tui-text-secondary)}table[tuiTable] [tuiTh] [tuiCell],table[tuiTable] [tuiTh] [tuiTitle]{font:inherit;color:inherit}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
111
136
  }
112
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableStyles, decorators: [{
137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: Styles, decorators: [{
113
138
  type: Component,
114
- args: [{ standalone: true, template: '', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
115
- class: 'tui-table',
116
- }, styles: ["table[tuiTable]{border-collapse:separate;border-spacing:0}table[tuiTable] [tuiCell]{padding:0}table[tuiTable] [tuiTitle]{white-space:nowrap}table[tuiTable] [tuiTitle] tui-icon{font-size:1rem}table[tuiTable] [tuiSubtitle]{color:var(--tui-text-secondary)}table[tuiTable] [tuiTh] [tuiCell],table[tuiTable] [tuiTh] [tuiTitle]{font:inherit;color:inherit}\n"] }]
139
+ args: [{ template: '', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'tui-table' }, styles: ["table[tuiTable]{border-collapse:separate;border-spacing:0;isolation:isolate}table[tuiTable] [tuiCell]{padding:0}table[tuiTable] [tuiTitle]{white-space:nowrap}table[tuiTable] [tuiTitle] tui-icon{font-size:1rem}table[tuiTable] [tuiSubtitle]{color:var(--tui-text-secondary)}table[tuiTable] [tuiTh] [tuiCell],table[tuiTable] [tuiTh] [tuiTitle]{font:inherit;color:inherit}\n"] }]
117
140
  }] });
118
141
  class TuiTableDirective {
119
142
  constructor() {
120
143
  this.options = inject(TUI_TABLE_OPTIONS);
121
- this.cdr = inject(ChangeDetectorRef);
122
- this.nothing = tuiWithStyles(TuiTableStyles);
123
- this.columns = [];
124
- this.direction = this.options.direction;
125
- this.sorter = EMPTY_COMPARATOR;
126
- /**
127
- * @deprecated: use sortChange
128
- */
129
- this.directionChange = new EventEmitter();
130
- /**
131
- * @deprecated: use sortChange
132
- */
133
- this.sorterChange = new EventEmitter();
134
- this.sortChange = combineLatest([
135
- this.sorterChange,
136
- this.directionChange,
137
- ]).pipe(debounceTime(0), map(([sortComparator, sortDirection]) => ({
138
- sortBy: sortComparator,
139
- orderBy: sortDirection,
140
- sortComparator,
141
- sortDirection,
142
- })));
144
+ this.nothing = tuiWithStyles(Styles);
145
+ this.computedSortChange = computed(() => ({
146
+ sortComparator: this.sorter(),
147
+ sortDirection: this.direction(),
148
+ }));
149
+ this.sortChangeOutput = effect(() => this.sortChange.emit(this.computedSortChange()));
150
+ this.columns = input([]);
151
+ this.size = input(this.options.size);
152
+ this.direction = model(this.options.direction);
153
+ this.sorter = model(EMPTY_COMPARATOR);
154
+ this.sortChange = output();
143
155
  this.appearance = signal('table');
144
- this.size = signal(this.options.size);
145
156
  this.cleaner = signal(false);
146
- // TODO: refactor to signal inputs after Angular update
147
- this.change$ = new Subject();
148
- }
149
- set sizeSetter(size) {
150
- this.size.set(size);
151
157
  }
152
158
  updateSorterAndDirection(sorter) {
153
- if (this.sorter === sorter) {
154
- this.updateSorter(this.sorter, this.direction === TuiSortDirection.Asc
159
+ if (this.sorter() === sorter) {
160
+ this.updateSorter(this.sorter(), this.direction() === TuiSortDirection.Asc
155
161
  ? TuiSortDirection.Desc
156
162
  : TuiSortDirection.Asc);
157
163
  }
@@ -159,21 +165,12 @@ class TuiTableDirective {
159
165
  this.updateSorter(sorter);
160
166
  }
161
167
  }
162
- ngOnChanges() {
163
- this.change$.next();
164
- }
165
- ngAfterViewInit() {
166
- this.cdr.detectChanges();
167
- }
168
168
  updateSorter(sorter, direction = TuiSortDirection.Asc) {
169
- this.sorter = sorter || EMPTY_COMPARATOR.bind({});
170
- this.direction = direction;
171
- this.sorterChange.emit(sorter);
172
- this.directionChange.emit(this.direction);
173
- this.change$.next();
169
+ this.sorter.set(sorter || EMPTY_COMPARATOR.bind({}));
170
+ this.direction.set(direction);
174
171
  }
175
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
176
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableDirective, isStandalone: true, selector: "table[tuiTable]", inputs: { columns: "columns", direction: "direction", sorter: "sorter", sizeSetter: ["size", "sizeSetter"] }, outputs: { directionChange: "directionChange", sorterChange: "sorterChange", sortChange: "sortChange" }, host: { properties: { "attr.data-size": "size()" } }, providers: [
172
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
173
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.17", type: TuiTableDirective, isStandalone: true, selector: "table[tuiTable]", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, sorter: { classPropertyName: "sorter", publicName: "sorter", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { direction: "directionChange", sorter: "sorterChange", sortChange: "sortChange" }, host: { attributes: { "tuiTable": "" }, properties: { "attr.data-size": "size()" } }, providers: [
177
174
  {
178
175
  provide: WA_INTERSECTION_ROOT_MARGIN,
179
176
  useValue: '10000px 10000px 10000px 0px',
@@ -183,12 +180,11 @@ class TuiTableDirective {
183
180
  tuiBadgeOptionsProvider({ size: 'm', appearance: 'neutral' }),
184
181
  tuiChipOptionsProvider({ size: 'xxs', appearance: 'neutral' }),
185
182
  tuiProgressOptionsProvider({ size: 's', color: 'var(--tui-text-action)' }),
186
- ], usesOnChanges: true, hostDirectives: [{ directive: TuiStuck }], ngImport: i0 }); }
183
+ ], hostDirectives: [{ directive: TuiStuck }], ngImport: i0 }); }
187
184
  }
188
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableDirective, decorators: [{
185
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableDirective, decorators: [{
189
186
  type: Directive,
190
187
  args: [{
191
- standalone: true,
192
188
  selector: 'table[tuiTable]',
193
189
  providers: [
194
190
  {
@@ -203,95 +199,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
203
199
  ],
204
200
  hostDirectives: [TuiStuck],
205
201
  host: {
202
+ tuiTable: '',
206
203
  '[attr.data-size]': 'size()',
207
204
  },
208
205
  }]
209
- }], propDecorators: { columns: [{
210
- type: Input
211
- }], direction: [{
212
- type: Input
213
- }], sorter: [{
214
- type: Input
215
- }], directionChange: [{
216
- type: Output
217
- }], sorterChange: [{
218
- type: Output
219
- }], sortChange: [{
220
- type: Output
221
- }], sizeSetter: [{
222
- type: Input,
223
- args: ['size']
224
- }] } });
225
-
226
- class TuiTableDirectionOrder {
227
- constructor() {
228
- this.table = inject((TuiTableDirective));
229
- /**
230
- * @deprecated: use tuiSortChange
231
- */
232
- this.directionOrderChange = this.table.directionChange.pipe(map((dir) => (dir === 1 ? 'asc' : 'desc')));
233
- }
234
- set directionOrder(order) {
235
- this.table.direction =
236
- order === 'asc' ? TuiSortDirection.Asc : TuiSortDirection.Desc;
237
- }
238
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableDirectionOrder, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
239
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableDirectionOrder, isStandalone: true, selector: "table[tuiTable][tuiDirectionOrder]", inputs: { directionOrder: "directionOrder" }, outputs: { directionOrderChange: "directionOrderChange" }, ngImport: i0 }); }
240
- }
241
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableDirectionOrder, decorators: [{
242
- type: Directive,
243
- args: [{
244
- standalone: true,
245
- selector: 'table[tuiTable][tuiDirectionOrder]',
246
- }]
247
- }], propDecorators: { directionOrderChange: [{
248
- type: Output
249
- }], directionOrder: [{
250
- type: Input
251
- }] } });
252
-
253
- class TuiTableHead {
254
- constructor() {
255
- this.tuiHead = '';
256
- this.template = inject((TemplateRef));
257
- }
258
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableHead, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
259
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableHead, isStandalone: true, selector: "[tuiHead]", inputs: { tuiHead: "tuiHead" }, ngImport: i0 }); }
260
- }
261
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableHead, decorators: [{
262
- type: Directive,
263
- args: [{
264
- standalone: true,
265
- selector: '[tuiHead]',
266
- }]
267
- }], propDecorators: { tuiHead: [{
268
- type: Input,
269
- args: [{ required: true }]
270
- }] } });
271
-
272
- class TuiTableResized {
273
- constructor() {
274
- this.doc = inject(DOCUMENT);
275
- this.el = tuiInjectElement();
276
- this.tuiResized = tuiTypedFromEvent(this.el, 'mousedown').pipe(tuiPreventDefault(), switchMap(() => {
277
- const { width, right } = this.el.closest('th')?.getBoundingClientRect() || EMPTY_CLIENT_RECT;
278
- return tuiTypedFromEvent(this.doc, 'mousemove').pipe(distinctUntilChanged(), map(({ clientX }) => width + clientX - right), takeUntil(tuiTypedFromEvent(this.doc, 'mouseup')));
279
- }));
280
- }
281
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableResized, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
282
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableResized, isStandalone: true, selector: "[tuiResized]", outputs: { tuiResized: "tuiResized" }, ngImport: i0 }); }
283
- }
284
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableResized, decorators: [{
285
- type: Directive,
286
- args: [{
287
- standalone: true,
288
- selector: '[tuiResized]',
289
- }]
290
- }], propDecorators: { tuiResized: [{
291
- type: Output
292
- }] } });
206
+ }] });
293
207
 
294
- /// <reference types="@taiga-ui/tsconfig/ng-dev-mode" />
295
208
  /// <reference types="@taiga-ui/tsconfig/ng-dev-mode" />
296
209
  class TuiTableTh {
297
210
  constructor() {
@@ -299,69 +212,55 @@ class TuiTableTh {
299
212
  this.head = inject(TuiTableHead, {
300
213
  optional: true,
301
214
  });
302
- this.width = null;
215
+ this.width = signal(null);
303
216
  this.table = inject(forwardRef(() => TuiTableDirective), { optional: true });
304
- this.minWidth = -Infinity;
305
- this.maxWidth = Infinity;
306
- this.sorter = this.head
307
- ? (a, b) => tuiDefaultSort(a[this.key], b[this.key])
308
- : null;
309
- this.resizable = this.options.resizable;
310
- this.sticky = this.options.sticky;
311
- this.requiredSort = this.options.requiredSort;
217
+ this.minWidth = input(-Infinity);
218
+ this.maxWidth = input(Infinity);
219
+ this.sorter = model(this.head ? (a, b) => tuiDefaultSort(a[this.key], b[this.key]) : null);
220
+ this.resizable = input(this.options.resizable);
221
+ this.sticky = input(this.options.sticky);
222
+ this.requiredSort = input(this.options.requiredSort);
312
223
  }
313
224
  get key() {
314
225
  if (!this.head) {
315
226
  throw new TuiTableSortKeyException();
316
227
  }
317
- return this.head.tuiHead;
228
+ return this.head.tuiHead();
318
229
  }
319
230
  get isCurrent() {
320
- return !!this.sorter && !!this.table && this.sorter === this.table.sorter;
231
+ return !!this.sorter && !!this.table && this.sorter() === this.table.sorter();
321
232
  }
322
233
  get icon() {
323
234
  if (this.isCurrent) {
324
- return this.table?.direction === TuiSortDirection.Asc
235
+ return this.table?.direction() === TuiSortDirection.Asc
325
236
  ? this.options.sortIcons.asc
326
237
  : this.options.sortIcons.desc;
327
238
  }
328
239
  return this.options.sortIcons.off;
329
240
  }
330
241
  updateSorterAndDirection() {
331
- const sorter = this.requiredSort ? this.sorter : null;
332
- this.table?.updateSorterAndDirection(this.isCurrentAndDescDirection ? sorter : this.sorter);
242
+ const sorter = this.requiredSort() ? this.sorter() : null;
243
+ this.table?.updateSorterAndDirection(this.isCurrentAndDescDirection ? sorter : this.sorter());
333
244
  }
334
245
  onResized(width) {
335
- this.width = Math.min(Math.max(width, this.minWidth), this.maxWidth);
246
+ this.width.set(Math.min(Math.max(width, this.minWidth()), this.maxWidth()));
336
247
  }
337
248
  get isCurrentAndDescDirection() {
338
- return (this.sorter === this.table?.sorter &&
339
- this.table?.direction === TuiSortDirection.Desc);
249
+ return (this.sorter() === this.table?.sorter() &&
250
+ this.table?.direction() === TuiSortDirection.Desc);
340
251
  }
341
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableTh, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
342
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableTh, isStandalone: true, selector: "th[tuiTh]", inputs: { minWidth: "minWidth", maxWidth: "maxWidth", sorter: "sorter", resizable: "resizable", sticky: "sticky", requiredSort: "requiredSort" }, host: { properties: { "style.min-width.px": "width || minWidth", "style.width.px": "width || minWidth", "style.max-width.px": "width || maxWidth", "class._sticky": "sticky" } }, ngImport: i0, template: "<button\n *ngIf=\"sorter && table; else content\"\n type=\"button\"\n class=\"t-sort\"\n [class.t-sort_sorted]=\"isCurrent\"\n (click)=\"updateSorterAndDirection()\"\n>\n <ng-container [ngTemplateOutlet]=\"content\" />\n {{ table && table.change$ | async }}\n <tui-icon\n class=\"t-icon\"\n [icon]=\"icon\"\n />\n</button>\n<ng-template #content>\n <ng-content />\n</ng-template>\n<div\n *ngIf=\"resizable\"\n class=\"t-bar\"\n (tuiResized)=\"onResized($event)\"\n></div>\n", styles: [":host{transition-property:box-shadow;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:relative;top:0;block-size:var(--tui-height-m);font:var(--tui-font-text-s);text-align:start;font-weight:700;color:var(--tui-text-secondary);background:var(--tui-background-base);cursor:default;padding:0 .75rem;box-sizing:border-box;box-shadow:0 .3125rem #ededed00;border:1px solid var(--tui-border-normal);filter:opacity(1)}@supports (-webkit-hyphens: none){:host{transform:translateZ(0)}}:host:not(:first-child){border-inline-start:none}:host._sticky,:host-context(._stuck) :host._sticky{position:sticky;z-index:30}:host._sticky:first-child,:host-context(._stuck) :host._sticky:first-child{left:0}:host._sticky:after,:host-context(._stuck) :host._sticky:after{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:\"\";position:absolute;top:0;left:100%;bottom:0;inline-size:.3125rem;pointer-events:none;background:#edededb3;opacity:0}:host-context(._stuck) :host{z-index:20}:host-context(tr:not(:first-child)){border-block-start:none}:host-context(table[data-size=\"l\"]){block-size:var(--tui-height-l);font:var(--tui-font-text-m);font-weight:700;padding:0 1rem}:host-context(table[data-size=\"s\"]){block-size:var(--tui-height-s);font:var(--tui-font-text-s);font-weight:700;padding:0 .5rem}:host-context(thead[tuiThead]){position:sticky}:host-context(table._stuck)._sticky:after{opacity:1}:host-context(thead[tuiThead]._stuck){box-shadow:0 .3125rem #edededb3}:host-context([tuiTheme=\"dark\"])._sticky:after{background:#3c3c3ce6}:host-context([tuiTheme=\"dark\"] thead[tuiThead]._stuck){box-shadow:0 .3125rem #3c3c3ce6}:host-context([tuiTheme=\"dark\"] thead[tuiThead]._stuck):first-child{box-shadow:.0625rem .3125rem #3c3c3ce6}:host-context(table[data-size=\"l\"] thead[tuiThead] tr:nth-child(2)){top:var(--tui-height-l)}:host-context(table[data-size=\"m\"] thead[tuiThead] tr:nth-child(2)){top:var(--tui-height-m)}:host-context(table[data-size=\"s\"] thead[tuiThead] tr:nth-child(2)){top:var(--tui-height-s)}.t-sort{transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;line-height:inherit;text-decoration:none;display:inline-flex;vertical-align:top;flex-direction:inherit;align-items:center;outline:none;font:inherit;text-transform:inherit;color:inherit;cursor:pointer}.t-sort_sorted{color:var(--tui-text-primary)}.t-sort:focus-visible{background:var(--tui-service-selection-background)}.t-sort:hover{color:var(--tui-text-primary)}.t-bar{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:0;bottom:0;right:-1px;inline-size:.1875rem;justify-self:flex-end;border-inline-start:2px solid transparent;background:var(--tui-status-warning);background-clip:content-box;cursor:ew-resize;opacity:0}.t-bar:hover,.t-bar:active{opacity:1}.t-icon{border-width:.25rem}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TuiIcon, selector: "tui-icon", inputs: ["icon", "background"] }, { kind: "directive", type: TuiTableResized, selector: "[tuiResized]", outputs: ["tuiResized"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
252
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableTh, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
253
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: TuiTableTh, isStandalone: true, selector: "th[tuiTh]", inputs: { minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, sorter: { classPropertyName: "sorter", publicName: "sorter", isSignal: true, isRequired: false, transformFunction: null }, resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, sticky: { classPropertyName: "sticky", publicName: "sticky", isSignal: true, isRequired: false, transformFunction: null }, requiredSort: { classPropertyName: "requiredSort", publicName: "requiredSort", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sorter: "sorterChange" }, host: { properties: { "style.min-width.px": "width() || minWidth()", "style.width.px": "width() || minWidth()", "style.max-width.px": "width() || maxWidth()", "class._sticky": "sticky()" } }, ngImport: i0, template: "@if (sorter() && table) {\n <button\n type=\"button\"\n class=\"t-sort\"\n [class.t-sort_sorted]=\"isCurrent\"\n (click)=\"updateSorterAndDirection()\"\n >\n <ng-container [ngTemplateOutlet]=\"content\" />\n <tui-icon\n class=\"t-icon\"\n [icon]=\"icon\"\n />\n </button>\n} @else {\n <ng-container [ngTemplateOutlet]=\"content\" />\n}\n<ng-template #content>\n <ng-content />\n</ng-template>\n@if (resizable()) {\n <div\n class=\"t-bar\"\n (tuiResized)=\"onResized($event)\"\n ></div>\n}\n", styles: [":host{transition-property:box-shadow;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:relative;top:0;block-size:var(--tui-height-m);font:var(--tui-font-body-s);text-align:start;font-weight:700;color:var(--tui-text-secondary);background:var(--tui-background-base);cursor:default;padding:0 .75rem;box-sizing:border-box;box-shadow:0 .3125rem #ededed00;border:1px solid var(--tui-border-normal);filter:opacity(1)}@supports (-webkit-hyphens: none){:host{transform:translateZ(0)}}:host:not(:first-child){border-inline-start:none}:host._sticky,:host-context(._stuck) :host._sticky{position:sticky;z-index:3000}:host._sticky:first-child,:host-context(._stuck) :host._sticky:first-child{left:0}:host._sticky:after,:host-context(._stuck) :host._sticky:after{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:\"\";position:absolute;top:0;left:100%;bottom:0;inline-size:.3125rem;pointer-events:none;background:#edededb3;opacity:0}:host-context(._stuck) :host{z-index:2000}:host-context(tr:not(:first-child)){border-block-start:none}:host-context(table[data-size=\"l\"]){block-size:var(--tui-height-l);font:var(--tui-font-body-m);font-weight:700;padding:0 1rem}:host-context(table[data-size=\"s\"]){block-size:var(--tui-height-s);font:var(--tui-font-body-s);font-weight:700;padding:0 .5rem}:host-context(thead[tuiThead]){position:sticky}:host-context(table._stuck)._sticky:after{opacity:1}:host-context(thead[tuiThead]._stuck){box-shadow:0 .3125rem #edededb3}:host-context([tuiTheme=\"dark\"])._sticky:after{background:#3c3c3ce6}:host-context([tuiTheme=\"dark\"] thead[tuiThead]._stuck){box-shadow:0 .3125rem #3c3c3ce6}:host-context([tuiTheme=\"dark\"] thead[tuiThead]._stuck):first-child{box-shadow:.0625rem .3125rem #3c3c3ce6}:host-context(table[data-size=\"l\"] thead[tuiThead] tr:nth-child(2)){top:var(--tui-height-l)}:host-context(table[data-size=\"m\"] thead[tuiThead] tr:nth-child(2)){top:var(--tui-height-m)}:host-context(table[data-size=\"s\"] thead[tuiThead] tr:nth-child(2)){top:var(--tui-height-s)}.t-sort{transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;line-height:inherit;text-decoration:none;display:inline-flex;vertical-align:top;flex-direction:inherit;align-items:center;outline:none;font:inherit;text-transform:inherit;color:inherit;cursor:pointer}.t-sort_sorted{color:var(--tui-text-primary)}.t-sort:focus-visible{background:var(--tui-service-selection-background)}.t-sort:hover{color:var(--tui-text-primary)}.t-bar{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:0;bottom:0;right:-1px;inline-size:.1875rem;justify-self:flex-end;border-inline-start:2px solid transparent;background:var(--tui-status-warning);background-clip:content-box;cursor:ew-resize;opacity:0}.t-bar:hover,.t-bar:active{opacity:1}.t-icon:before{font-size:1rem}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TuiIcon, selector: "tui-icon:not([tuiBadge])", inputs: ["background"] }, { kind: "directive", type: TuiTableResized, selector: "[tuiResized]", outputs: ["tuiResized"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
343
254
  }
344
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableTh, decorators: [{
255
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableTh, decorators: [{
345
256
  type: Component,
346
- args: [{ standalone: true, selector: 'th[tuiTh]', imports: [AsyncPipe, NgIf, NgTemplateOutlet, TuiIcon, TuiTableResized], changeDetection: ChangeDetectionStrategy.OnPush, host: {
347
- '[style.min-width.px]': 'width || minWidth',
348
- '[style.width.px]': 'width || minWidth',
349
- '[style.max-width.px]': 'width || maxWidth',
350
- '[class._sticky]': 'sticky',
351
- }, template: "<button\n *ngIf=\"sorter && table; else content\"\n type=\"button\"\n class=\"t-sort\"\n [class.t-sort_sorted]=\"isCurrent\"\n (click)=\"updateSorterAndDirection()\"\n>\n <ng-container [ngTemplateOutlet]=\"content\" />\n {{ table && table.change$ | async }}\n <tui-icon\n class=\"t-icon\"\n [icon]=\"icon\"\n />\n</button>\n<ng-template #content>\n <ng-content />\n</ng-template>\n<div\n *ngIf=\"resizable\"\n class=\"t-bar\"\n (tuiResized)=\"onResized($event)\"\n></div>\n", styles: [":host{transition-property:box-shadow;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:relative;top:0;block-size:var(--tui-height-m);font:var(--tui-font-text-s);text-align:start;font-weight:700;color:var(--tui-text-secondary);background:var(--tui-background-base);cursor:default;padding:0 .75rem;box-sizing:border-box;box-shadow:0 .3125rem #ededed00;border:1px solid var(--tui-border-normal);filter:opacity(1)}@supports (-webkit-hyphens: none){:host{transform:translateZ(0)}}:host:not(:first-child){border-inline-start:none}:host._sticky,:host-context(._stuck) :host._sticky{position:sticky;z-index:30}:host._sticky:first-child,:host-context(._stuck) :host._sticky:first-child{left:0}:host._sticky:after,:host-context(._stuck) :host._sticky:after{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:\"\";position:absolute;top:0;left:100%;bottom:0;inline-size:.3125rem;pointer-events:none;background:#edededb3;opacity:0}:host-context(._stuck) :host{z-index:20}:host-context(tr:not(:first-child)){border-block-start:none}:host-context(table[data-size=\"l\"]){block-size:var(--tui-height-l);font:var(--tui-font-text-m);font-weight:700;padding:0 1rem}:host-context(table[data-size=\"s\"]){block-size:var(--tui-height-s);font:var(--tui-font-text-s);font-weight:700;padding:0 .5rem}:host-context(thead[tuiThead]){position:sticky}:host-context(table._stuck)._sticky:after{opacity:1}:host-context(thead[tuiThead]._stuck){box-shadow:0 .3125rem #edededb3}:host-context([tuiTheme=\"dark\"])._sticky:after{background:#3c3c3ce6}:host-context([tuiTheme=\"dark\"] thead[tuiThead]._stuck){box-shadow:0 .3125rem #3c3c3ce6}:host-context([tuiTheme=\"dark\"] thead[tuiThead]._stuck):first-child{box-shadow:.0625rem .3125rem #3c3c3ce6}:host-context(table[data-size=\"l\"] thead[tuiThead] tr:nth-child(2)){top:var(--tui-height-l)}:host-context(table[data-size=\"m\"] thead[tuiThead] tr:nth-child(2)){top:var(--tui-height-m)}:host-context(table[data-size=\"s\"] thead[tuiThead] tr:nth-child(2)){top:var(--tui-height-s)}.t-sort{transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;line-height:inherit;text-decoration:none;display:inline-flex;vertical-align:top;flex-direction:inherit;align-items:center;outline:none;font:inherit;text-transform:inherit;color:inherit;cursor:pointer}.t-sort_sorted{color:var(--tui-text-primary)}.t-sort:focus-visible{background:var(--tui-service-selection-background)}.t-sort:hover{color:var(--tui-text-primary)}.t-bar{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:0;bottom:0;right:-1px;inline-size:.1875rem;justify-self:flex-end;border-inline-start:2px solid transparent;background:var(--tui-status-warning);background-clip:content-box;cursor:ew-resize;opacity:0}.t-bar:hover,.t-bar:active{opacity:1}.t-icon{border-width:.25rem}\n"] }]
352
- }], propDecorators: { minWidth: [{
353
- type: Input
354
- }], maxWidth: [{
355
- type: Input
356
- }], sorter: [{
357
- type: Input
358
- }], resizable: [{
359
- type: Input
360
- }], sticky: [{
361
- type: Input
362
- }], requiredSort: [{
363
- type: Input
364
- }] } });
257
+ args: [{ selector: 'th[tuiTh]', imports: [NgTemplateOutlet, TuiIcon, TuiTableResized], changeDetection: ChangeDetectionStrategy.OnPush, host: {
258
+ '[style.min-width.px]': 'width() || minWidth()',
259
+ '[style.width.px]': 'width() || minWidth()',
260
+ '[style.max-width.px]': 'width() || maxWidth()',
261
+ '[class._sticky]': 'sticky()',
262
+ }, template: "@if (sorter() && table) {\n <button\n type=\"button\"\n class=\"t-sort\"\n [class.t-sort_sorted]=\"isCurrent\"\n (click)=\"updateSorterAndDirection()\"\n >\n <ng-container [ngTemplateOutlet]=\"content\" />\n <tui-icon\n class=\"t-icon\"\n [icon]=\"icon\"\n />\n </button>\n} @else {\n <ng-container [ngTemplateOutlet]=\"content\" />\n}\n<ng-template #content>\n <ng-content />\n</ng-template>\n@if (resizable()) {\n <div\n class=\"t-bar\"\n (tuiResized)=\"onResized($event)\"\n ></div>\n}\n", styles: [":host{transition-property:box-shadow;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:relative;top:0;block-size:var(--tui-height-m);font:var(--tui-font-body-s);text-align:start;font-weight:700;color:var(--tui-text-secondary);background:var(--tui-background-base);cursor:default;padding:0 .75rem;box-sizing:border-box;box-shadow:0 .3125rem #ededed00;border:1px solid var(--tui-border-normal);filter:opacity(1)}@supports (-webkit-hyphens: none){:host{transform:translateZ(0)}}:host:not(:first-child){border-inline-start:none}:host._sticky,:host-context(._stuck) :host._sticky{position:sticky;z-index:3000}:host._sticky:first-child,:host-context(._stuck) :host._sticky:first-child{left:0}:host._sticky:after,:host-context(._stuck) :host._sticky:after{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:\"\";position:absolute;top:0;left:100%;bottom:0;inline-size:.3125rem;pointer-events:none;background:#edededb3;opacity:0}:host-context(._stuck) :host{z-index:2000}:host-context(tr:not(:first-child)){border-block-start:none}:host-context(table[data-size=\"l\"]){block-size:var(--tui-height-l);font:var(--tui-font-body-m);font-weight:700;padding:0 1rem}:host-context(table[data-size=\"s\"]){block-size:var(--tui-height-s);font:var(--tui-font-body-s);font-weight:700;padding:0 .5rem}:host-context(thead[tuiThead]){position:sticky}:host-context(table._stuck)._sticky:after{opacity:1}:host-context(thead[tuiThead]._stuck){box-shadow:0 .3125rem #edededb3}:host-context([tuiTheme=\"dark\"])._sticky:after{background:#3c3c3ce6}:host-context([tuiTheme=\"dark\"] thead[tuiThead]._stuck){box-shadow:0 .3125rem #3c3c3ce6}:host-context([tuiTheme=\"dark\"] thead[tuiThead]._stuck):first-child{box-shadow:.0625rem .3125rem #3c3c3ce6}:host-context(table[data-size=\"l\"] thead[tuiThead] tr:nth-child(2)){top:var(--tui-height-l)}:host-context(table[data-size=\"m\"] thead[tuiThead] tr:nth-child(2)){top:var(--tui-height-m)}:host-context(table[data-size=\"s\"] thead[tuiThead] tr:nth-child(2)){top:var(--tui-height-s)}.t-sort{transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;line-height:inherit;text-decoration:none;display:inline-flex;vertical-align:top;flex-direction:inherit;align-items:center;outline:none;font:inherit;text-transform:inherit;color:inherit;cursor:pointer}.t-sort_sorted{color:var(--tui-text-primary)}.t-sort:focus-visible{background:var(--tui-service-selection-background)}.t-sort:hover{color:var(--tui-text-primary)}.t-bar{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:0;bottom:0;right:-1px;inline-size:.1875rem;justify-self:flex-end;border-inline-start:2px solid transparent;background:var(--tui-status-warning);background-clip:content-box;cursor:ew-resize;opacity:0}.t-bar:hover,.t-bar:active{opacity:1}.t-icon:before{font-size:1rem}\n"] }]
263
+ }] });
365
264
  class TuiTableSortKeyException extends Error {
366
265
  constructor() {
367
266
  super(ngDevMode ? 'Trying to sort with no key' : '');
@@ -373,110 +272,81 @@ class TuiTableSortable {
373
272
  this.table = inject((TuiTableDirective));
374
273
  this.th = inject((TuiTableTh));
375
274
  this.sortBy = inject(forwardRef(() => TuiTableSortBy));
376
- this.sorter = () => 0;
275
+ this.sortable = input(undefined, {
276
+ alias: 'tuiSortable',
277
+ transform: coerceBooleanProperty,
278
+ });
279
+ this.setThSorter = effect(() => {
280
+ this.th.sorter.set(this.sortable() ? this.sorter() : null);
281
+ });
282
+ this.setTableSorter = effect(() => {
283
+ if (this.match && untracked(this.table.sorter) !== this.sorter()) {
284
+ this.table.updateSorter(this.sorter());
285
+ }
286
+ });
287
+ this.sorter = computed(() => this.sortable() && untracked(() => this.match)
288
+ ? untracked(this.table.sorter)
289
+ : () => 0);
377
290
  }
378
291
  get key() {
379
292
  return this.th.key;
380
293
  }
381
- ngOnChanges() {
382
- if (this.sortable) {
383
- this.sorter = this.match ? this.table.sorter : this.sorter;
384
- this.th.sorter = this.sorter;
385
- }
386
- else {
387
- this.th.sorter = null;
388
- }
389
- }
390
- check() {
391
- if (this.match && this.table.sorter !== this.sorter) {
392
- this.table.updateSorter(this.sorter);
393
- }
394
- }
395
294
  get match() {
396
- return this.sortBy.tuiSortBy === this.key;
295
+ return this.sortBy.tuiSortBy() === this.key;
397
296
  }
398
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableSortable, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
399
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "16.2.12", type: TuiTableSortable, isStandalone: true, selector: "th[tuiTh][tuiSortable]", inputs: { sortable: ["tuiSortable", "sortable", coerceBooleanProperty] }, usesOnChanges: true, ngImport: i0 }); }
297
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableSortable, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
298
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.17", type: TuiTableSortable, isStandalone: true, selector: "th[tuiTh][tuiSortable]", inputs: { sortable: { classPropertyName: "sortable", publicName: "tuiSortable", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
400
299
  }
401
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableSortable, decorators: [{
300
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableSortable, decorators: [{
402
301
  type: Directive,
403
302
  args: [{
404
- standalone: true,
405
303
  selector: 'th[tuiTh][tuiSortable]',
406
304
  }]
407
- }], propDecorators: { sortable: [{
408
- type: Input,
409
- args: [{
410
- alias: 'tuiSortable',
411
- transform: coerceBooleanProperty,
412
- }]
413
- }] } });
305
+ }] });
414
306
 
415
307
  class TuiTableSortBy {
416
308
  constructor() {
417
- this.sortables = EMPTY_QUERY;
418
309
  this.table = inject((TuiTableDirective));
419
- /**
420
- * @deprecated: use tuiSortChange
421
- */
422
- this.tuiSortByChange = this.table.sorterChange.pipe(
423
- // delay is for getting actual ContentChildren (sortables) https://github.com/angular/angular/issues/38976
424
- delay(0), filter(() => !!this.sortables.length), map((sorter) => this.getKey(sorter)));
425
- this.tuiSortChange = combineLatest([
426
- this.tuiSortByChange,
427
- this.table.directionChange,
428
- ]).pipe(debounceTime(0), map(([sortKey, sortDirection]) => ({
429
- sortBy: sortKey,
430
- orderBy: sortDirection,
431
- sortKey,
432
- sortDirection,
433
- })));
434
- this.tuiSortBy = null;
435
- }
436
- set sortBy(sortBy) {
437
- this.tuiSortBy = sortBy;
438
- this.checkSortables();
439
- }
440
- checkSortables() {
441
- this.sortables.forEach((s) => s.check());
310
+ this.sortables = contentChildren(TuiTableSortable, {
311
+ descendants: true,
312
+ });
313
+ this.sortChange = computed(() => ({
314
+ sortKey: this.sortables().length ? this.getKey(this.table.sorter()) : null,
315
+ sortDirection: this.table.direction(),
316
+ }));
317
+ this.sortOutput = effect(() => {
318
+ if (this.sortables().length) {
319
+ this.tuiSortChange.emit(this.sortChange());
320
+ }
321
+ });
322
+ this.tuiSortChange = output();
323
+ this.tuiSortBy = input(null);
442
324
  }
443
325
  getKey(sorter) {
444
- return this.sortables.find((s) => s.sorter === sorter)?.key || null;
326
+ return this.sortables().find((s) => s.sorter() === sorter)?.key || null;
445
327
  }
446
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableSortBy, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
447
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableSortBy, isStandalone: true, selector: "table[tuiTable][tuiSortBy]", inputs: { sortBy: ["tuiSortBy", "sortBy"] }, outputs: { tuiSortByChange: "tuiSortByChange", tuiSortChange: "tuiSortChange" }, queries: [{ propertyName: "sortables", predicate: TuiTableSortable, descendants: true }], ngImport: i0 }); }
328
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableSortBy, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
329
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.17", type: TuiTableSortBy, isStandalone: true, selector: "table[tuiTable][tuiSortBy]", inputs: { tuiSortBy: { classPropertyName: "tuiSortBy", publicName: "tuiSortBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { tuiSortChange: "tuiSortChange" }, queries: [{ propertyName: "sortables", predicate: TuiTableSortable, descendants: true, isSignal: true }], ngImport: i0 }); }
448
330
  }
449
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableSortBy, decorators: [{
331
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableSortBy, decorators: [{
450
332
  type: Directive,
451
333
  args: [{
452
- standalone: true,
453
334
  selector: 'table[tuiTable][tuiSortBy]',
454
335
  }]
455
- }], propDecorators: { sortables: [{
456
- type: ContentChildren,
457
- args: [TuiTableSortable, { descendants: true }]
458
- }], tuiSortByChange: [{
459
- type: Output
460
- }], tuiSortChange: [{
461
- type: Output
462
- }], sortBy: [{
463
- type: Input,
464
- args: ['tuiSortBy']
465
- }] } });
336
+ }] });
466
337
 
467
338
  class TuiTableThead {
468
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableThead, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
469
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableThead, isStandalone: true, selector: "thead[tuiThead]", providers: [
339
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableThead, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
340
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: TuiTableThead, isStandalone: true, selector: "thead[tuiThead]", providers: [
470
341
  {
471
342
  provide: WA_INTERSECTION_ROOT_MARGIN,
472
343
  useValue: '0px 10000px 10000px 10000px',
473
344
  },
474
345
  ], hostDirectives: [{ directive: TuiStuck }], ngImport: i0 }); }
475
346
  }
476
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableThead, decorators: [{
347
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableThead, decorators: [{
477
348
  type: Directive,
478
349
  args: [{
479
- standalone: true,
480
350
  selector: 'thead[tuiThead]',
481
351
  providers: [
482
352
  {
@@ -491,198 +361,135 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
491
361
  class TuiTableSortPipe {
492
362
  constructor() {
493
363
  this.table = inject((TuiTableDirective));
364
+ this.data = signal([]);
365
+ this.sorted = computed((direction = this.table.direction(), sorter = this.table.sorter()) => [...this.data()].sort((a, b) => direction * sorter(a, b)));
494
366
  }
495
367
  transform(data) {
496
- return this.sort(data ?? [], this.table.sorter, this.table.direction);
497
- }
498
- sort(data, sorter, direction) {
499
- return [...data].sort((a, b) => direction * sorter(a, b));
368
+ untracked(() => this.data.set(data ?? []));
369
+ return this.sorted();
500
370
  }
501
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableSortPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
502
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: TuiTableSortPipe, isStandalone: true, name: "tuiTableSort", pure: false }); }
371
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableSortPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
372
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: TuiTableSortPipe, isStandalone: true, name: "tuiTableSort", pure: false }); }
503
373
  }
504
- __decorate([
505
- tuiPure
506
- ], TuiTableSortPipe.prototype, "sort", null);
507
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableSortPipe, decorators: [{
374
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableSortPipe, decorators: [{
508
375
  type: Pipe,
509
376
  args: [{
510
- standalone: true,
511
377
  name: 'tuiTableSort',
512
378
  pure: false,
513
379
  }]
514
- }], propDecorators: { sort: [] } });
515
-
516
- /**
517
- * @deprecated TODO: drop after Angular update and signal inputs
518
- */
519
- const TUI_TABLE_PROVIDER = [
520
- {
521
- provide: TuiTableDirective,
522
- deps: [[new SkipSelf(), TuiTableDirective]],
523
- useFactory: (controller) => {
524
- controller.change$.pipe(tuiWatch(), takeUntilDestroyed()).subscribe();
525
- return controller;
526
- },
527
- },
528
- ];
380
+ }] });
529
381
 
530
382
  class TuiTableExpand {
531
383
  constructor() {
384
+ this.content = viewChild('content');
532
385
  this.el = tuiInjectElement();
533
386
  this.server = isPlatformServer(inject(PLATFORM_ID));
534
387
  this.transitioning = signal(false);
535
- this.contentHeight = computed((_ = this.expanded()) => this.update());
388
+ this.contentHeight = computed((_ = this.expanded()) => this.update(this.content()));
536
389
  this.visible$ = new Subject();
537
390
  this.sub = this.visible$
538
391
  .pipe(switchMap((v) => (v ? timer(500).pipe(map(() => v)) : of(v))), takeUntilDestroyed())
539
392
  .subscribe((visible) => this.el.classList.toggle('_visible', visible));
540
- this.expandedChange = new EventEmitter();
541
- this.expanded = signal(inject(TUI_TABLE_OPTIONS).open);
542
- }
543
- set expandedSetter(open) {
544
- this.expanded.set(open);
545
- this.transitioning.set(true);
393
+ this.expanded = model(inject(TUI_TABLE_OPTIONS).open);
394
+ this.transitioningEffect = effect((_, __ = this.expanded()) => this.transitioning.set(true));
546
395
  }
547
396
  toggle() {
548
397
  this.expanded.set(!this.expanded());
549
- this.transitioning.set(true);
550
- this.expandedChange.emit(this.expanded());
551
398
  }
552
- update() {
553
- if (!this.content || this.server) {
399
+ update(content) {
400
+ if (!content || this.server) {
554
401
  return 0;
555
402
  }
556
- const el = this.content.nativeElement;
403
+ const el = content.nativeElement;
557
404
  el.style.setProperty('display', 'block');
558
405
  const height = el.getBoundingClientRect().height;
559
406
  el.style.removeProperty('display');
560
407
  return height;
561
408
  }
562
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableExpand, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
563
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableExpand, isStandalone: true, selector: "tui-table-expand", inputs: { expandedSetter: ["expanded", "expandedSetter"] }, outputs: { expandedChange: "expandedChange" }, host: { attributes: { "ngSkipHydration": "true" }, listeners: { "tuiPresentChange": "visible$.next($event)" } }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, static: true }], hostDirectives: [{ directive: i1.TuiPresent, outputs: ["tuiPresentChange", "tuiPresentChange"] }], ngImport: i0, template: "<div\n #content\n class=\"t-content\"\n [class.t-content_open]=\"expanded() && !transitioning()\"\n>\n <ng-content />\n</div>\n\n<div\n class=\"t-filler\"\n [class.t-filler_open]=\"expanded()\"\n [style.--t-height.px]=\"contentHeight()\"\n (animationcancel)=\"transitioning.set(false)\"\n (animationend)=\"transitioning.set(false)\"\n (animationstart)=\"transitioning.set(true)\"\n></div>\n", styles: ["@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes open{0%{block-size:0}to{block-size:var(--t-height)}}@keyframes close{0%{block-size:var(--t-height)}to{block-size:0}}:host{display:contents}:host:not(._visible){--tui-duration: 0ms}.t-content{display:none}.t-content_open{display:contents}.t-content_open ::ng-deep tr{animation:fade-in var(--tui-duration)}.t-filler{animation:close calc(var(--tui-duration) + 1ms)}.t-filler_open{animation:open calc(var(--tui-duration) + 1ms)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
409
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableExpand, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
410
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.17", type: TuiTableExpand, isStandalone: true, selector: "tui-table-expand", inputs: { expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expanded: "expandedChange" }, host: { attributes: { "ngSkipHydration": "true" }, listeners: { "tuiPresent": "visible$.next($event)" } }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.TuiPresent, outputs: ["tuiPresent", "tuiPresent"] }], ngImport: i0, template: "<div\n #content\n class=\"t-content\"\n [class.t-content_open]=\"expanded() && !transitioning()\"\n>\n <ng-content />\n</div>\n\n<div\n class=\"t-filler\"\n [class.t-filler_open]=\"expanded()\"\n [style.--t-height.px]=\"contentHeight()\"\n (animationcancel)=\"transitioning.set(false)\"\n (animationend)=\"transitioning.set(false)\"\n (animationstart)=\"transitioning.set(true)\"\n></div>\n", styles: ["@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes open{0%{block-size:0}to{block-size:var(--t-height)}}@keyframes close{0%{block-size:var(--t-height)}to{block-size:0}}:host{display:contents}:host:not(._visible){--tui-duration: 0ms}.t-content{display:none}.t-content_open{display:contents}.t-content_open ::ng-deep tr{animation:fade-in var(--tui-duration)}.t-filler{animation:close calc(var(--tui-duration) + 1ms)}.t-filler_open{animation:open calc(var(--tui-duration) + 1ms)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
564
411
  }
565
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableExpand, decorators: [{
412
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableExpand, decorators: [{
566
413
  type: Component,
567
- args: [{ standalone: true, selector: 'tui-table-expand', changeDetection: ChangeDetectionStrategy.OnPush, hostDirectives: [
414
+ args: [{ selector: 'tui-table-expand', changeDetection: ChangeDetectionStrategy.OnPush, hostDirectives: [
568
415
  {
569
416
  directive: TuiPresent,
570
- outputs: ['tuiPresentChange'],
417
+ outputs: ['tuiPresent'],
571
418
  },
572
419
  ], host: {
573
420
  ngSkipHydration: 'true',
574
- '(tuiPresentChange)': 'visible$.next($event)',
421
+ '(tuiPresent)': 'visible$.next($event)',
575
422
  }, template: "<div\n #content\n class=\"t-content\"\n [class.t-content_open]=\"expanded() && !transitioning()\"\n>\n <ng-content />\n</div>\n\n<div\n class=\"t-filler\"\n [class.t-filler_open]=\"expanded()\"\n [style.--t-height.px]=\"contentHeight()\"\n (animationcancel)=\"transitioning.set(false)\"\n (animationend)=\"transitioning.set(false)\"\n (animationstart)=\"transitioning.set(true)\"\n></div>\n", styles: ["@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes open{0%{block-size:0}to{block-size:var(--t-height)}}@keyframes close{0%{block-size:var(--t-height)}to{block-size:0}}:host{display:contents}:host:not(._visible){--tui-duration: 0ms}.t-content{display:none}.t-content_open{display:contents}.t-content_open ::ng-deep tr{animation:fade-in var(--tui-duration)}.t-filler{animation:close calc(var(--tui-duration) + 1ms)}.t-filler_open{animation:open calc(var(--tui-duration) + 1ms)}\n"] }]
576
- }], propDecorators: { content: [{
577
- type: ViewChild,
578
- args: ['content', { static: true }]
579
- }], expandedChange: [{
580
- type: Output
581
- }], expandedSetter: [{
582
- type: Input,
583
- args: ['expanded']
584
- }] } });
423
+ }] });
585
424
 
586
425
  class TuiTableTd {
587
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableTd, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
588
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableTd, isStandalone: true, selector: "th[tuiTd], td[tuiTd]", host: { properties: { "class._editable": "control || textfield" } }, queries: [{ propertyName: "control", first: true, predicate: TuiControl, descendants: true }, { propertyName: "textfield", first: true, predicate: TuiTextfieldComponent, descendants: true }], ngImport: i0, template: '<ng-content />', isInline: true, styles: [":host{position:relative;text-align:start;background:var(--tui-background-base);border:1px solid var(--tui-border-normal);border-block-start:none;box-sizing:border-box;filter:opacity(1)}@supports (-webkit-hyphens: none){:host{transform:translateZ(0)}}:host:first-child{left:0}:host:not(:first-child){border-inline-start:none}:host._editable:focus-within{z-index:1}:host._editable{padding:0!important;vertical-align:top}:host(th){position:sticky;z-index:1}:host(th):after{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:\"\";position:absolute;top:0;bottom:0;left:100%;inline-size:.3125rem;pointer-events:none;background:#edededb3;opacity:0}:host(th):focus-within:not(:disabled){z-index:11}:host-context([tuiTheme=\"dark\"]):after{background:#3c3c3ce6}:host-context(table._stuck){z-index:10}:host-context(table._stuck):last-of-type:after{opacity:1}:host-context(table[data-size=\"l\"]){block-size:var(--tui-height-l);font:var(--tui-font-text-m);padding:1rem}:host-context(table[data-size=\"m\"]){block-size:var(--tui-height-m);font:var(--tui-font-text-s);padding:.75rem}:host-context(table[data-size=\"s\"]){block-size:var(--tui-height-s);font:var(--tui-font-text-s);padding:.25rem .5rem}:host(td):focus-within{z-index:1}:host(td):not(:focus-within){z-index:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
426
+ constructor() {
427
+ this.control = contentChild((TuiControl));
428
+ this.textfield = contentChild((TuiTextfieldComponent));
429
+ }
430
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableTd, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
431
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.17", type: TuiTableTd, isStandalone: true, selector: "th[tuiTd], td[tuiTd]", host: { properties: { "class._editable": "control() || textfield()" } }, queries: [{ propertyName: "control", first: true, predicate: (TuiControl), descendants: true, isSignal: true }, { propertyName: "textfield", first: true, predicate: (TuiTextfieldComponent), descendants: true, isSignal: true }], ngImport: i0, template: '<ng-content />', isInline: true, styles: [":host{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:relative;text-align:start;background:var(--tui-background-base);border:1px solid var(--tui-border-normal);border-block-start:none;box-sizing:border-box;filter:opacity(1)}@supports (-webkit-hyphens: none){:host{transform:translateZ(0)}}:host:first-child{left:0}:host:not(:first-child){border-inline-start:none}:host._editable{padding:0!important;vertical-align:top}:host(th){position:sticky;z-index:100}:host(th):after{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:\"\";position:absolute;top:0;bottom:0;left:100%;inline-size:.3125rem;pointer-events:none;background:#edededb3;opacity:0}:host(th):focus-within:not(:disabled){z-index:1100}:host-context([tuiTheme=\"dark\"]):after{background:#3c3c3ce6}:host-context(table._stuck){z-index:1000}:host-context(table._stuck):last-of-type:after{opacity:1}:host-context(table[data-size=\"l\"]){block-size:var(--tui-height-l);font:var(--tui-font-body-m);padding:calc(1rem - 1px) 1rem 1rem}:host-context(table[data-size=\"m\"]){block-size:var(--tui-height-m);font:var(--tui-font-body-s);padding:calc(.75rem - 1px) .75rem .75rem}:host-context(table[data-size=\"s\"]){block-size:var(--tui-height-s);font:var(--tui-font-body-s);padding:calc(.25rem - 1px) .5rem .25rem}:host(td):focus-within{z-index:100!important}:host(td):not(:focus-within){z-index:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
589
432
  }
590
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableTd, decorators: [{
433
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableTd, decorators: [{
591
434
  type: Component,
592
- args: [{ standalone: true, selector: 'th[tuiTd], td[tuiTd]', template: '<ng-content />', changeDetection: ChangeDetectionStrategy.OnPush, host: {
593
- '[class._editable]': 'control || textfield',
594
- }, styles: [":host{position:relative;text-align:start;background:var(--tui-background-base);border:1px solid var(--tui-border-normal);border-block-start:none;box-sizing:border-box;filter:opacity(1)}@supports (-webkit-hyphens: none){:host{transform:translateZ(0)}}:host:first-child{left:0}:host:not(:first-child){border-inline-start:none}:host._editable:focus-within{z-index:1}:host._editable{padding:0!important;vertical-align:top}:host(th){position:sticky;z-index:1}:host(th):after{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:\"\";position:absolute;top:0;bottom:0;left:100%;inline-size:.3125rem;pointer-events:none;background:#edededb3;opacity:0}:host(th):focus-within:not(:disabled){z-index:11}:host-context([tuiTheme=\"dark\"]):after{background:#3c3c3ce6}:host-context(table._stuck){z-index:10}:host-context(table._stuck):last-of-type:after{opacity:1}:host-context(table[data-size=\"l\"]){block-size:var(--tui-height-l);font:var(--tui-font-text-m);padding:1rem}:host-context(table[data-size=\"m\"]){block-size:var(--tui-height-m);font:var(--tui-font-text-s);padding:.75rem}:host-context(table[data-size=\"s\"]){block-size:var(--tui-height-s);font:var(--tui-font-text-s);padding:.25rem .5rem}:host(td):focus-within{z-index:1}:host(td):not(:focus-within){z-index:0}\n"] }]
595
- }], propDecorators: { control: [{
596
- type: ContentChild,
597
- args: [TuiControl]
598
- }], textfield: [{
599
- type: ContentChild,
600
- args: [TuiTextfieldComponent]
601
- }] } });
435
+ args: [{ selector: 'th[tuiTd], td[tuiTd]', template: '<ng-content />', changeDetection: ChangeDetectionStrategy.OnPush, host: {
436
+ '[class._editable]': 'control() || textfield()',
437
+ }, styles: [":host{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:relative;text-align:start;background:var(--tui-background-base);border:1px solid var(--tui-border-normal);border-block-start:none;box-sizing:border-box;filter:opacity(1)}@supports (-webkit-hyphens: none){:host{transform:translateZ(0)}}:host:first-child{left:0}:host:not(:first-child){border-inline-start:none}:host._editable{padding:0!important;vertical-align:top}:host(th){position:sticky;z-index:100}:host(th):after{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:\"\";position:absolute;top:0;bottom:0;left:100%;inline-size:.3125rem;pointer-events:none;background:#edededb3;opacity:0}:host(th):focus-within:not(:disabled){z-index:1100}:host-context([tuiTheme=\"dark\"]):after{background:#3c3c3ce6}:host-context(table._stuck){z-index:1000}:host-context(table._stuck):last-of-type:after{opacity:1}:host-context(table[data-size=\"l\"]){block-size:var(--tui-height-l);font:var(--tui-font-body-m);padding:calc(1rem - 1px) 1rem 1rem}:host-context(table[data-size=\"m\"]){block-size:var(--tui-height-m);font:var(--tui-font-body-s);padding:calc(.75rem - 1px) .75rem .75rem}:host-context(table[data-size=\"s\"]){block-size:var(--tui-height-s);font:var(--tui-font-body-s);padding:calc(.25rem - 1px) .5rem .25rem}:host(td):focus-within{z-index:100!important}:host(td):not(:focus-within){z-index:0}\n"] }]
438
+ }] });
602
439
 
603
440
  class TuiTableTr {
604
441
  constructor() {
605
- this.cells = EMPTY_QUERY;
442
+ this.cells = contentChildren(forwardRef(() => TuiTableCell));
606
443
  this.body = inject(forwardRef(() => TuiTableTbody));
607
- this.contentReady$ = new ReplaySubject(1);
608
444
  this.table = inject(forwardRef(() => TuiTableDirective));
609
- this.height = toSignal(inject(WaResizeObserverService, { self: true }).pipe(map(([entry]) => entry?.contentRect.height ?? 0), distinctUntilChanged(), tuiZoneOptimized()), { initialValue: 0 });
610
- this.cells$ = this.contentReady$.pipe(switchMap(() => tuiQueryListChanges(this.cells)), map((cells) => cells.reduce((record, item) => ({ ...record, [item.tuiCell]: item }), {})));
611
- this.item$ = this.contentReady$.pipe(switchMap(() => tuiQueryListChanges(this.body.rows)), map((rows) => this.body.data[rows.findIndex((row) => row === this)]));
612
- }
613
- ngAfterContentInit() {
614
- Promise.resolve().then(() => this.contentReady$.next(true));
445
+ this.items = computed(() => this.cells().reduce((record, item) => ({ ...record, [item.tuiCell()]: item }), {}));
446
+ this.item = computed(() => this.body.data()[this.body.rows().findIndex((row) => row === this)]);
615
447
  }
616
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableTr, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
617
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableTr, isStandalone: true, selector: "tr[tuiTr]", host: { properties: { "style.--t-row-height.px": "height()" } }, providers: [TUI_TABLE_PROVIDER, WaResizeObserverService], queries: [{ propertyName: "cells", predicate: i0.forwardRef(function () { return TuiTableCell; }) }], ngImport: i0, template: "<ng-container *ngIf=\"cells$ | async as items; else dummy\">\n <ng-container\n *ngFor=\"let key of table.columns\"\n [ngTemplateOutlet]=\"(items[key] && items[key].template) || plain\"\n >\n <ng-template #plain>\n <td\n *ngIf=\"item$ | async as item\"\n tuiTd\n >\n {{ item[key] }}\n </td>\n </ng-template>\n </ng-container>\n</ng-container>\n<ng-template #dummy>\n <td></td>\n</ng-template>\n<ng-content />\n", dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TuiTableTd, selector: "th[tuiTd], td[tuiTd]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
448
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableTr, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
449
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: TuiTableTr, isStandalone: true, selector: "tr[tuiTr]", queries: [{ propertyName: "cells", predicate: i0.forwardRef(() => TuiTableCell), isSignal: true }], ngImport: i0, template: "@if (items(); as items) {\n @for (key of table.columns(); track key) {\n <ng-container [ngTemplateOutlet]=\"(items[key] && items[key].template) || plain\">\n <ng-template #plain>\n <td tuiTd>\n {{ item()[key] }}\n </td>\n </ng-template>\n </ng-container>\n }\n} @else {\n <td></td>\n}\n<ng-content />\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TuiTableTd, selector: "th[tuiTd], td[tuiTd]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
618
450
  }
619
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableTr, decorators: [{
451
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableTr, decorators: [{
620
452
  type: Component,
621
- args: [{ standalone: true, selector: 'tr[tuiTr]', imports: [AsyncPipe, NgForOf, NgIf, NgTemplateOutlet, TuiTableTd], changeDetection: ChangeDetectionStrategy.OnPush, providers: [TUI_TABLE_PROVIDER, WaResizeObserverService], host: {
622
- '[style.--t-row-height.px]': 'height()',
623
- }, template: "<ng-container *ngIf=\"cells$ | async as items; else dummy\">\n <ng-container\n *ngFor=\"let key of table.columns\"\n [ngTemplateOutlet]=\"(items[key] && items[key].template) || plain\"\n >\n <ng-template #plain>\n <td\n *ngIf=\"item$ | async as item\"\n tuiTd\n >\n {{ item[key] }}\n </td>\n </ng-template>\n </ng-container>\n</ng-container>\n<ng-template #dummy>\n <td></td>\n</ng-template>\n<ng-content />\n" }]
624
- }], propDecorators: { cells: [{
625
- type: ContentChildren,
626
- args: [forwardRef(() => TuiTableCell)]
627
- }] } });
453
+ args: [{ selector: 'tr[tuiTr]', imports: [NgTemplateOutlet, TuiTableTd], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (items(); as items) {\n @for (key of table.columns(); track key) {\n <ng-container [ngTemplateOutlet]=\"(items[key] && items[key].template) || plain\">\n <ng-template #plain>\n <td tuiTd>\n {{ item()[key] }}\n </td>\n </ng-template>\n </ng-container>\n }\n} @else {\n <td></td>\n}\n<ng-content />\n" }]
454
+ }] });
628
455
 
629
456
  class TuiTableTbody {
630
457
  constructor() {
631
458
  this.options = inject(TUI_TABLE_OPTIONS);
632
459
  this.table = inject(forwardRef(() => TuiTableDirective));
633
- this.rows = EMPTY_QUERY;
634
- this.data = [];
460
+ this.rows = contentChildren(forwardRef(() => TuiTableTr));
461
+ this.data = input([]);
635
462
  /** @deprecated: drop in v5.0, use TuiTableExpand */
636
- this.open = this.options.open;
463
+ this.heading = input();
637
464
  /** @deprecated: drop in v5.0, use TuiTableExpand */
638
- this.openChange = new EventEmitter();
465
+ this.open = model(this.options.open);
639
466
  /** @deprecated: drop in v5.0, use TuiTableExpand */
640
467
  this.onClick = () => {
641
- this.open = !this.open;
642
- this.openChange.emit(this.open);
468
+ this.open.set(!this.open());
643
469
  };
644
470
  }
645
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableTbody, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
646
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableTbody, isStandalone: true, selector: "tbody[tuiTbody]", inputs: { data: "data", heading: "heading", open: "open" }, outputs: { openChange: "openChange" }, providers: TUI_TABLE_PROVIDER, queries: [{ propertyName: "rows", predicate: i0.forwardRef(function () { return TuiTableTr; }) }], ngImport: i0, template: "<tr *ngIf=\"heading\">\n <th\n class=\"t-heading\"\n [colSpan]=\"table.columns.length\"\n >\n <button\n type=\"button\"\n class=\"t-expand\"\n (click)=\"onClick()\"\n >\n <span class=\"t-name\">\n <ng-container *polymorpheusOutlet=\"heading as text\">\n {{ text }}\n </ng-container>\n </span>\n <tui-icon\n class=\"t-chevron\"\n [tuiChevron]=\"open\"\n />\n </button>\n </th>\n</tr>\n<ng-container *ngIf=\"open\">\n <ng-content />\n</ng-container>\n", styles: [":host{border-color:var(--tui-border-normal)}:host tr{border-color:inherit}.t-expand{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font:inherit;line-height:inherit;text-decoration:none;display:flex;inline-size:100%;block-size:100%;align-items:center;box-sizing:border-box;outline:none;font-weight:700;cursor:pointer;border-color:inherit}.t-expand:focus-visible .t-name{background:var(--tui-service-selection-background)}.t-expand:before,.t-expand:after{content:\"\";position:sticky;block-size:100%;border-inline-start:1px solid;border-color:inherit}.t-expand:before{left:0}.t-expand:after{right:0}.t-heading{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;block-size:var(--tui-height-m);font:var(--tui-font-text-s);padding:0;background:var(--tui-background-neutral-1);border-block-end:1px solid var(--tui-border-normal);border-color:inherit}.t-heading:hover{background:var(--tui-background-neutral-1-hover)}:host-context(table[data-size=\"l\"]) .t-heading{font:var(--tui-font-text-m);block-size:var(--tui-height-l)}.t-name{position:sticky;left:.75rem;display:inline-block}:host-context(table[data-size=\"l\"]) .t-name{left:1rem}.t-chevron{position:sticky;right:.75rem;margin:0 .6875rem 0 auto}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "directive", type: TuiChevron, selector: "[tuiChevron]", inputs: ["tuiChevron"] }, { kind: "component", type: TuiIcon, selector: "tui-icon", inputs: ["icon", "background"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
471
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableTbody, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
472
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: TuiTableTbody, isStandalone: true, selector: "tbody[tuiTbody]", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange" }, queries: [{ propertyName: "rows", predicate: i0.forwardRef(() => TuiTableTr), isSignal: true }], ngImport: i0, template: "@if (heading()) {\n <tr>\n <th\n class=\"t-heading\"\n [colSpan]=\"table.columns().length\"\n >\n <button\n type=\"button\"\n class=\"t-expand\"\n (click)=\"onClick()\"\n >\n <span class=\"t-name\">\n <ng-container *polymorpheusOutlet=\"heading() as text\">\n {{ text }}\n </ng-container>\n </span>\n <tui-icon\n class=\"t-chevron\"\n [tuiChevron]=\"open()\"\n />\n </button>\n </th>\n </tr>\n}\n@if (open()) {\n <ng-content />\n}\n", styles: [":host{border-color:var(--tui-border-normal)}:host tr{border-color:inherit}.t-expand{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font:inherit;line-height:inherit;text-decoration:none;display:flex;inline-size:100%;block-size:100%;align-items:center;box-sizing:border-box;outline:none;font-weight:700;cursor:pointer;border-color:inherit}.t-expand:focus-visible .t-name{background:var(--tui-service-selection-background)}.t-expand:before,.t-expand:after{content:\"\";position:sticky;block-size:100%;border-inline-start:1px solid;border-color:inherit}.t-expand:before{left:0}.t-expand:after{right:0}.t-heading{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;block-size:var(--tui-height-m);font:var(--tui-font-body-s);padding:0;background:var(--tui-background-neutral-1);border-block-end:1px solid var(--tui-border-normal);border-color:inherit}.t-heading:hover{background:var(--tui-background-neutral-1-hover)}:host-context(table[data-size=\"l\"]) .t-heading{font:var(--tui-font-body-m);block-size:var(--tui-height-l)}.t-name{position:sticky;left:.75rem;display:inline-block}:host-context(table[data-size=\"l\"]) .t-name{left:1rem}.t-chevron{position:sticky;right:.75rem;margin:0 .6875rem 0 auto}\n"], dependencies: [{ kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "directive", type: TuiChevron, selector: "[tuiChevron]", inputs: ["tuiChevron"] }, { kind: "component", type: TuiIcon, selector: "tui-icon:not([tuiBadge])", inputs: ["background"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
647
473
  }
648
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableTbody, decorators: [{
474
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableTbody, decorators: [{
649
475
  type: Component,
650
- args: [{ standalone: true, selector: 'tbody[tuiTbody]', imports: [NgIf, PolymorpheusOutlet, TuiChevron, TuiIcon], changeDetection: ChangeDetectionStrategy.OnPush, providers: TUI_TABLE_PROVIDER, template: "<tr *ngIf=\"heading\">\n <th\n class=\"t-heading\"\n [colSpan]=\"table.columns.length\"\n >\n <button\n type=\"button\"\n class=\"t-expand\"\n (click)=\"onClick()\"\n >\n <span class=\"t-name\">\n <ng-container *polymorpheusOutlet=\"heading as text\">\n {{ text }}\n </ng-container>\n </span>\n <tui-icon\n class=\"t-chevron\"\n [tuiChevron]=\"open\"\n />\n </button>\n </th>\n</tr>\n<ng-container *ngIf=\"open\">\n <ng-content />\n</ng-container>\n", styles: [":host{border-color:var(--tui-border-normal)}:host tr{border-color:inherit}.t-expand{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font:inherit;line-height:inherit;text-decoration:none;display:flex;inline-size:100%;block-size:100%;align-items:center;box-sizing:border-box;outline:none;font-weight:700;cursor:pointer;border-color:inherit}.t-expand:focus-visible .t-name{background:var(--tui-service-selection-background)}.t-expand:before,.t-expand:after{content:\"\";position:sticky;block-size:100%;border-inline-start:1px solid;border-color:inherit}.t-expand:before{left:0}.t-expand:after{right:0}.t-heading{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;block-size:var(--tui-height-m);font:var(--tui-font-text-s);padding:0;background:var(--tui-background-neutral-1);border-block-end:1px solid var(--tui-border-normal);border-color:inherit}.t-heading:hover{background:var(--tui-background-neutral-1-hover)}:host-context(table[data-size=\"l\"]) .t-heading{font:var(--tui-font-text-m);block-size:var(--tui-height-l)}.t-name{position:sticky;left:.75rem;display:inline-block}:host-context(table[data-size=\"l\"]) .t-name{left:1rem}.t-chevron{position:sticky;right:.75rem;margin:0 .6875rem 0 auto}\n"] }]
651
- }], propDecorators: { rows: [{
652
- type: ContentChildren,
653
- args: [forwardRef(() => TuiTableTr)]
654
- }], data: [{
655
- type: Input
656
- }], heading: [{
657
- type: Input
658
- }], open: [{
659
- type: Input
660
- }], openChange: [{
661
- type: Output
662
- }] } });
476
+ args: [{ selector: 'tbody[tuiTbody]', imports: [PolymorpheusOutlet, TuiChevron, TuiIcon], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (heading()) {\n <tr>\n <th\n class=\"t-heading\"\n [colSpan]=\"table.columns().length\"\n >\n <button\n type=\"button\"\n class=\"t-expand\"\n (click)=\"onClick()\"\n >\n <span class=\"t-name\">\n <ng-container *polymorpheusOutlet=\"heading() as text\">\n {{ text }}\n </ng-container>\n </span>\n <tui-icon\n class=\"t-chevron\"\n [tuiChevron]=\"open()\"\n />\n </button>\n </th>\n </tr>\n}\n@if (open()) {\n <ng-content />\n}\n", styles: [":host{border-color:var(--tui-border-normal)}:host tr{border-color:inherit}.t-expand{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font:inherit;line-height:inherit;text-decoration:none;display:flex;inline-size:100%;block-size:100%;align-items:center;box-sizing:border-box;outline:none;font-weight:700;cursor:pointer;border-color:inherit}.t-expand:focus-visible .t-name{background:var(--tui-service-selection-background)}.t-expand:before,.t-expand:after{content:\"\";position:sticky;block-size:100%;border-inline-start:1px solid;border-color:inherit}.t-expand:before{left:0}.t-expand:after{right:0}.t-heading{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;block-size:var(--tui-height-m);font:var(--tui-font-body-s);padding:0;background:var(--tui-background-neutral-1);border-block-end:1px solid var(--tui-border-normal);border-color:inherit}.t-heading:hover{background:var(--tui-background-neutral-1-hover)}:host-context(table[data-size=\"l\"]) .t-heading{font:var(--tui-font-body-m);block-size:var(--tui-height-l)}.t-name{position:sticky;left:.75rem;display:inline-block}:host-context(table[data-size=\"l\"]) .t-name{left:1rem}.t-chevron{position:sticky;right:.75rem;margin:0 .6875rem 0 auto}\n"] }]
477
+ }] });
663
478
 
664
479
  class TuiTableThGroup {
665
480
  constructor() {
666
- this.heads = EMPTY_QUERY;
667
- this.heads$ = null;
481
+ this.th = contentChild(forwardRef(() => TuiTableTh));
482
+ this.heads = contentChildren(forwardRef(() => TuiTableHead));
483
+ this.computedHeads = computed(() => this.heads().reduce((record, item) => ({ ...record, [item.tuiHead()]: item }), {}));
668
484
  this.table = inject(forwardRef(() => TuiTableDirective));
669
485
  }
670
- ngAfterContentInit() {
671
- this.heads$ = this.heads.changes.pipe(startWith(null), map(() => this.heads.reduce((record, item) => ({ ...record, [item.tuiHead]: item }), {})));
672
- }
673
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableThGroup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
674
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTableThGroup, isStandalone: true, selector: "tr[tuiThGroup]", providers: [TUI_TABLE_PROVIDER], queries: [{ propertyName: "th", first: true, predicate: i0.forwardRef(function () { return TuiTableTh; }), descendants: true }, { propertyName: "heads", predicate: i0.forwardRef(function () { return TuiTableHead; }) }], ngImport: i0, template: "<ng-content />\n<ng-container *ngIf=\"heads$ | async as headings\">\n <ng-container\n *ngFor=\"let key of table.columns\"\n [ngTemplateOutlet]=\"headings?.[key]?.template || plain\"\n [ngTemplateOutletContext]=\"{$implicit: key}\"\n />\n <ng-template\n #plain\n let-key\n >\n <th\n *ngIf=\"!th && !heads.length\"\n tuiTh\n >\n {{ key.toString() }}\n </th>\n </ng-template>\n</ng-container>\n", dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TuiTableTh, selector: "th[tuiTh]", inputs: ["minWidth", "maxWidth", "sorter", "resizable", "sticky", "requiredSort"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
486
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableThGroup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
487
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: TuiTableThGroup, isStandalone: true, selector: "tr[tuiThGroup]", queries: [{ propertyName: "th", first: true, predicate: i0.forwardRef(() => TuiTableTh), descendants: true, isSignal: true }, { propertyName: "heads", predicate: i0.forwardRef(() => TuiTableHead), isSignal: true }], ngImport: i0, template: "<ng-content />\n@if (computedHeads(); as headings) {\n @for (key of table.columns(); track key) {\n <ng-container\n [ngTemplateOutlet]=\"headings?.[key]?.template || plain\"\n [ngTemplateOutletContext]=\"{$implicit: key}\"\n />\n }\n <ng-template\n #plain\n let-key\n >\n @if (!th() && !heads().length) {\n <th tuiTh>\n {{ key.toString() }}\n </th>\n }\n </ng-template>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TuiTableTh, selector: "th[tuiTh]", inputs: ["minWidth", "maxWidth", "sorter", "resizable", "sticky", "requiredSort"], outputs: ["sorterChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
675
488
  }
676
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTableThGroup, decorators: [{
489
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiTableThGroup, decorators: [{
677
490
  type: Component,
678
- args: [{ standalone: true, selector: 'tr[tuiThGroup]', imports: [AsyncPipe, NgForOf, NgIf, NgTemplateOutlet, TuiTableTh], changeDetection: ChangeDetectionStrategy.OnPush, providers: [TUI_TABLE_PROVIDER], template: "<ng-content />\n<ng-container *ngIf=\"heads$ | async as headings\">\n <ng-container\n *ngFor=\"let key of table.columns\"\n [ngTemplateOutlet]=\"headings?.[key]?.template || plain\"\n [ngTemplateOutletContext]=\"{$implicit: key}\"\n />\n <ng-template\n #plain\n let-key\n >\n <th\n *ngIf=\"!th && !heads.length\"\n tuiTh\n >\n {{ key.toString() }}\n </th>\n </ng-template>\n</ng-container>\n" }]
679
- }], propDecorators: { th: [{
680
- type: ContentChild,
681
- args: [forwardRef(() => TuiTableTh)]
682
- }], heads: [{
683
- type: ContentChildren,
684
- args: [forwardRef(() => TuiTableHead)]
685
- }] } });
491
+ args: [{ selector: 'tr[tuiThGroup]', imports: [NgTemplateOutlet, TuiTableTh], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content />\n@if (computedHeads(); as headings) {\n @for (key of table.columns(); track key) {\n <ng-container\n [ngTemplateOutlet]=\"headings?.[key]?.template || plain\"\n [ngTemplateOutletContext]=\"{$implicit: key}\"\n />\n }\n <ng-template\n #plain\n let-key\n >\n @if (!th() && !heads().length) {\n <th tuiTh>\n {{ key.toString() }}\n </th>\n }\n </ng-template>\n}\n" }]
492
+ }] });
686
493
 
687
494
  const TuiTable = [
688
495
  TuiTableDirective,
@@ -699,7 +506,6 @@ const TuiTable = [
699
506
  TuiTableThead,
700
507
  TuiTableResized,
701
508
  TuiTableSortPipe,
702
- TuiTableDirectionOrder,
703
509
  TuiTableExpand,
704
510
  ];
705
511
 
@@ -707,5 +513,5 @@ const TuiTable = [
707
513
  * Generated bundle index. Do not edit.
708
514
  */
709
515
 
710
- export { TUI_TABLE_DEFAULT_OPTIONS, TUI_TABLE_OPTIONS, TUI_TABLE_PROVIDER, TuiSortDirection, TuiStuck, TuiTable, TuiTableCaption, TuiTableCell, TuiTableDirectionOrder, TuiTableDirective, TuiTableExpand, TuiTableHead, TuiTableResized, TuiTableSortBy, TuiTableSortKeyException, TuiTableSortPipe, TuiTableSortable, TuiTableTbody, TuiTableTd, TuiTableTh, TuiTableThGroup, TuiTableThead, TuiTableTr, tuiTableOptionsProvider };
516
+ export { TUI_TABLE_DEFAULT_OPTIONS, TUI_TABLE_OPTIONS, TuiSortDirection, TuiStuck, TuiTable, TuiTableCaption, TuiTableCell, TuiTableDirective, TuiTableExpand, TuiTableHead, TuiTableResized, TuiTableSortBy, TuiTableSortKeyException, TuiTableSortPipe, TuiTableSortable, TuiTableTbody, TuiTableTd, TuiTableTh, TuiTableThGroup, TuiTableThead, TuiTableTr, tuiTableOptionsProvider };
711
517
  //# sourceMappingURL=taiga-ui-addon-table-components-table.mjs.map