@ng-nest/ui 20.3.0 → 20.3.2

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 (106) hide show
  1. package/attachments/index.d.ts +4 -5
  2. package/auto-complete/index.d.ts +52 -15
  3. package/base-form/index.d.ts +8 -9
  4. package/bubble/index.d.ts +12 -7
  5. package/cascade/index.d.ts +8 -9
  6. package/checkbox/index.d.ts +5 -6
  7. package/color-picker/index.d.ts +8 -9
  8. package/contextmenu/index.d.ts +176 -0
  9. package/core/index.d.ts +37 -1
  10. package/coversations/index.d.ts +4 -5
  11. package/date-picker/index.d.ts +16 -18
  12. package/dialog/index.d.ts +182 -102
  13. package/divider/index.d.ts +113 -0
  14. package/fesm2022/ng-nest-ui-auto-complete.mjs +65 -17
  15. package/fesm2022/ng-nest-ui-auto-complete.mjs.map +1 -1
  16. package/fesm2022/ng-nest-ui-base-form.mjs +27 -46
  17. package/fesm2022/ng-nest-ui-base-form.mjs.map +1 -1
  18. package/fesm2022/ng-nest-ui-bubble.mjs +141 -129
  19. package/fesm2022/ng-nest-ui-bubble.mjs.map +1 -1
  20. package/fesm2022/ng-nest-ui-cascade.mjs +1 -1
  21. package/fesm2022/ng-nest-ui-cascade.mjs.map +1 -1
  22. package/fesm2022/ng-nest-ui-color-picker.mjs +3 -3
  23. package/fesm2022/ng-nest-ui-color-picker.mjs.map +1 -1
  24. package/fesm2022/ng-nest-ui-contextmenu.mjs +445 -0
  25. package/fesm2022/ng-nest-ui-contextmenu.mjs.map +1 -0
  26. package/fesm2022/ng-nest-ui-core.mjs +2 -2
  27. package/fesm2022/ng-nest-ui-core.mjs.map +1 -1
  28. package/fesm2022/ng-nest-ui-date-picker.mjs +2 -2
  29. package/fesm2022/ng-nest-ui-date-picker.mjs.map +1 -1
  30. package/fesm2022/ng-nest-ui-dialog.mjs +51 -46
  31. package/fesm2022/ng-nest-ui-dialog.mjs.map +1 -1
  32. package/fesm2022/ng-nest-ui-divider.mjs +124 -0
  33. package/fesm2022/ng-nest-ui-divider.mjs.map +1 -0
  34. package/fesm2022/ng-nest-ui-find.mjs.map +1 -1
  35. package/fesm2022/ng-nest-ui-form.mjs +26 -20
  36. package/fesm2022/ng-nest-ui-form.mjs.map +1 -1
  37. package/fesm2022/ng-nest-ui-i18n.mjs +19 -18
  38. package/fesm2022/ng-nest-ui-i18n.mjs.map +1 -1
  39. package/fesm2022/ng-nest-ui-image.mjs +108 -69
  40. package/fesm2022/ng-nest-ui-image.mjs.map +1 -1
  41. package/fesm2022/ng-nest-ui-input-number.mjs +1 -1
  42. package/fesm2022/ng-nest-ui-input-number.mjs.map +1 -1
  43. package/fesm2022/ng-nest-ui-input.mjs +1 -1
  44. package/fesm2022/ng-nest-ui-input.mjs.map +1 -1
  45. package/fesm2022/ng-nest-ui-menu.mjs +16 -4
  46. package/fesm2022/ng-nest-ui-menu.mjs.map +1 -1
  47. package/fesm2022/ng-nest-ui-message-box.mjs.map +1 -1
  48. package/fesm2022/ng-nest-ui-message.mjs.map +1 -1
  49. package/fesm2022/ng-nest-ui-notification.mjs.map +1 -1
  50. package/fesm2022/ng-nest-ui-scrollable.mjs +81 -9
  51. package/fesm2022/ng-nest-ui-scrollable.mjs.map +1 -1
  52. package/fesm2022/ng-nest-ui-select.mjs +1 -1
  53. package/fesm2022/ng-nest-ui-select.mjs.map +1 -1
  54. package/fesm2022/ng-nest-ui-sender.mjs +1 -1
  55. package/fesm2022/ng-nest-ui-sender.mjs.map +1 -1
  56. package/fesm2022/ng-nest-ui-slider-select.mjs +0 -1
  57. package/fesm2022/ng-nest-ui-slider-select.mjs.map +1 -1
  58. package/fesm2022/ng-nest-ui-splitter.mjs +407 -0
  59. package/fesm2022/ng-nest-ui-splitter.mjs.map +1 -0
  60. package/fesm2022/ng-nest-ui-table-view.mjs +277 -248
  61. package/fesm2022/ng-nest-ui-table-view.mjs.map +1 -1
  62. package/fesm2022/ng-nest-ui-table.mjs +18 -6
  63. package/fesm2022/ng-nest-ui-table.mjs.map +1 -1
  64. package/fesm2022/ng-nest-ui-textarea.mjs +1 -1
  65. package/fesm2022/ng-nest-ui-textarea.mjs.map +1 -1
  66. package/fesm2022/ng-nest-ui-time-picker.mjs +40 -21
  67. package/fesm2022/ng-nest-ui-time-picker.mjs.map +1 -1
  68. package/fesm2022/ng-nest-ui-tree-select.mjs +1 -1
  69. package/fesm2022/ng-nest-ui-tree-select.mjs.map +1 -1
  70. package/fesm2022/ng-nest-ui-tree.mjs +16 -4
  71. package/fesm2022/ng-nest-ui-tree.mjs.map +1 -1
  72. package/fesm2022/ng-nest-ui-watermark.mjs +378 -0
  73. package/fesm2022/ng-nest-ui-watermark.mjs.map +1 -0
  74. package/fesm2022/ng-nest-ui.mjs +4 -0
  75. package/fesm2022/ng-nest-ui.mjs.map +1 -1
  76. package/find/index.d.ts +6 -7
  77. package/form/index.d.ts +24 -13
  78. package/i18n/index.d.ts +29 -28
  79. package/image/index.d.ts +30 -14
  80. package/index.d.ts +4 -0
  81. package/input/index.d.ts +8 -9
  82. package/input-number/index.d.ts +8 -9
  83. package/list/index.d.ts +4 -5
  84. package/menu/index.d.ts +15 -3
  85. package/message/index.d.ts +15 -3
  86. package/message-box/index.d.ts +18 -5
  87. package/notification/index.d.ts +15 -3
  88. package/package.json +91 -75
  89. package/radio/index.d.ts +5 -6
  90. package/rate/index.d.ts +4 -5
  91. package/scrollable/index.d.ts +14 -2
  92. package/select/index.d.ts +8 -9
  93. package/sender/index.d.ts +6 -7
  94. package/slider-select/index.d.ts +4 -6
  95. package/splitter/index.d.ts +163 -0
  96. package/switch/index.d.ts +4 -5
  97. package/table/index.d.ts +60 -5
  98. package/table-view/index.d.ts +99 -65
  99. package/textarea/index.d.ts +8 -9
  100. package/theme/index.d.ts +4 -5
  101. package/time-picker/index.d.ts +15 -14
  102. package/transfer/index.d.ts +4 -5
  103. package/tree/index.d.ts +29 -3
  104. package/tree-select/index.d.ts +8 -9
  105. package/upload/index.d.ts +4 -5
  106. package/watermark/index.d.ts +267 -0
@@ -1,7 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, inject, Component, booleanAttribute, Directive, signal, HostBinding, ViewEncapsulation, ChangeDetectionStrategy, ElementRef, viewChild, contentChild, contentChildren, Input, HostListener, NgModule } from '@angular/core';
3
- import { CdkTable, CdkHeaderRowDef, CdkFooterRowDef, CdkRowDef, CdkHeaderRow, CdkCellOutlet, CdkFooterRow, CdkRow, CdkNoDataRow, HeaderRowOutlet, DataRowOutlet, NoDataRowOutlet, FooterRowOutlet, CDK_TABLE, STICKY_POSITIONING_LISTENER, CdkCellDef, CdkHeaderCellDef, CdkFooterCellDef, CdkColumnDef, CdkHeaderCell, CdkFooterCell, CdkCell, CdkTextColumn, CdkTableModule } from '@angular/cdk/table';
4
- import { _DisposeViewRepeaterStrategy, _VIEW_REPEATER_STRATEGY } from '@angular/cdk/collections';
2
+ import { Injectable, InjectionToken, Directive, Input, inject, ElementRef, HostListener, HostBinding, booleanAttribute, signal, ViewEncapsulation, ChangeDetectionStrategy, Component, viewChild, contentChild, contentChildren, NgModule } from '@angular/core';
3
+ import { CdkCellDef, CdkHeaderCellDef, CdkFooterCellDef, CdkColumnDef, CdkHeaderCell, CdkFooterCell, CdkCell, CdkHeaderRowDef, CdkFooterRowDef, CdkRowDef, CdkHeaderRow, CdkCellOutlet, CdkFooterRow, CdkRow, CdkNoDataRow, CdkTable, HeaderRowOutlet, DataRowOutlet, NoDataRowOutlet, FooterRowOutlet, CDK_TABLE, STICKY_POSITIONING_LISTENER, CdkTextColumn, CdkTableModule } from '@angular/cdk/table';
5
4
  import { XConfigService } from '@ng-nest/ui/core';
6
5
 
7
6
  class XTableViewService {
@@ -19,31 +18,235 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImpor
19
18
  type: Injectable
20
19
  }] });
21
20
 
22
- /**
23
- * Table view
24
- * @selector x-table-view
25
- * @decorator component
26
- */
27
- const XTableViewPrefix = 'x-table-view';
28
- const X_TABLE_VIEW_CONFIG_NAME = 'tableView';
29
- /**
30
- * Table view Property
31
- */
32
- class XTableViewProperty extends CdkTable {
21
+ const X_TABLE_VIEW_CONTEXT = new InjectionToken('X_TABLE_VIEW_CONTEXT');
22
+
23
+ class XTableViewCellDef extends CdkCellDef {
24
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableViewCellDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
25
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableViewCellDef, isStandalone: true, selector: "[xTableCellDef]", providers: [{ provide: CdkCellDef, useExisting: XTableViewCellDef }], usesInheritance: true, ngImport: i0 }); }
26
+ }
27
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableViewCellDef, decorators: [{
28
+ type: Directive,
29
+ args: [{
30
+ selector: '[xTableCellDef]',
31
+ providers: [{ provide: CdkCellDef, useExisting: XTableViewCellDef }]
32
+ }]
33
+ }] });
34
+ class XTableHeaderCellDef extends CdkHeaderCellDef {
35
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableHeaderCellDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
36
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableHeaderCellDef, isStandalone: true, selector: "[xTableHeaderCellDef]", providers: [{ provide: CdkHeaderCellDef, useExisting: XTableHeaderCellDef }], usesInheritance: true, ngImport: i0 }); }
37
+ }
38
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableHeaderCellDef, decorators: [{
39
+ type: Directive,
40
+ args: [{
41
+ selector: '[xTableHeaderCellDef]',
42
+ providers: [{ provide: CdkHeaderCellDef, useExisting: XTableHeaderCellDef }]
43
+ }]
44
+ }] });
45
+ class XTableFooterCellDef extends CdkFooterCellDef {
46
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableFooterCellDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
47
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableFooterCellDef, isStandalone: true, selector: "[xTableFooterCellDef]", providers: [{ provide: CdkFooterCellDef, useExisting: XTableFooterCellDef }], usesInheritance: true, ngImport: i0 }); }
48
+ }
49
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableFooterCellDef, decorators: [{
50
+ type: Directive,
51
+ args: [{
52
+ selector: '[xTableFooterCellDef]',
53
+ providers: [{ provide: CdkFooterCellDef, useExisting: XTableFooterCellDef }]
54
+ }]
55
+ }] });
56
+ class XTableColumnDef extends CdkColumnDef {
57
+ get name() {
58
+ return this._name;
59
+ }
60
+ set name(name) {
61
+ this._setNameInput(name);
62
+ }
63
+ _updateColumnCssClassName() {
64
+ super._updateColumnCssClassName();
65
+ this._columnCssClassName.push(`x-table-column-${this.cssClassFriendlyName}`);
66
+ }
67
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableColumnDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
68
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableColumnDef, isStandalone: true, selector: "[xTableColumnDef]", inputs: { name: ["xTableColumnDef", "name"] }, providers: [{ provide: CdkColumnDef, useExisting: XTableColumnDef }], usesInheritance: true, ngImport: i0 }); }
69
+ }
70
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableColumnDef, decorators: [{
71
+ type: Directive,
72
+ args: [{
73
+ selector: '[xTableColumnDef]',
74
+ providers: [{ provide: CdkColumnDef, useExisting: XTableColumnDef }]
75
+ }]
76
+ }], propDecorators: { name: [{
77
+ type: Input,
78
+ args: ['xTableColumnDef']
79
+ }] } });
80
+ class XTableHeaderCell extends CdkHeaderCell {
33
81
  constructor() {
34
82
  super(...arguments);
35
- this.config = inject(XConfigService).getConfigForComponent(X_TABLE_VIEW_CONFIG_NAME);
83
+ this.tableViewService = inject(XTableViewService, { optional: true });
84
+ this.tableView = inject(X_TABLE_VIEW_CONTEXT, { optional: true });
85
+ this.elementRef = inject(ElementRef);
36
86
  }
37
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableViewProperty, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
38
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.5", type: XTableViewProperty, isStandalone: true, selector: "x-table-view-property", usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
87
+ get isActived() {
88
+ return this.tableViewService.activedHeaderCells.includes(this);
89
+ }
90
+ onClick() {
91
+ this.tableViewService.activedHeaderCells = [this];
92
+ const headerCells = this.tableView?.getHeaderCells() ?? [];
93
+ const index = headerCells.indexOf(this);
94
+ const cells = this.tableView?.getCells() ?? [];
95
+ const columnsCount = (this.tableView?.getHeaderRowRef()?.getColumns()).length ?? 0;
96
+ const rowsCount = this.tableView?.getRows().length ?? 0;
97
+ if (columnsCount === 0 || rowsCount === 0) {
98
+ return;
99
+ }
100
+ const columnCells = [];
101
+ for (let i = 0; i < rowsCount; i++) {
102
+ const cellIndex = index * rowsCount + i;
103
+ if (cellIndex < cells.length) {
104
+ columnCells.push(cells[cellIndex]);
105
+ }
106
+ }
107
+ this.tableViewService.selectedCells = [];
108
+ for (let cell of columnCells) {
109
+ this.tableViewService.selectedCells.push(cell);
110
+ cell.setActivedRow(cell);
111
+ }
112
+ }
113
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableHeaderCell, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
114
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableHeaderCell, isStandalone: true, selector: "x-table-header-cell, th[x-table-header-cell]", host: { attributes: { "role": "columnheader" }, listeners: { "click": "onClick()" }, properties: { "class.x-table-header-cell-actived": "this.isActived" }, classAttribute: "x-table-header-cell" }, usesInheritance: true, ngImport: i0 }); }
39
115
  }
40
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableViewProperty, decorators: [{
41
- type: Component,
42
- args: [{ selector: `${XTableViewPrefix}-property`, template: '' }]
116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableHeaderCell, decorators: [{
117
+ type: Directive,
118
+ args: [{
119
+ selector: 'x-table-header-cell, th[x-table-header-cell]',
120
+ host: {
121
+ class: 'x-table-header-cell',
122
+ role: 'columnheader'
123
+ }
124
+ }]
125
+ }], propDecorators: { isActived: [{
126
+ type: HostBinding,
127
+ args: ['class.x-table-header-cell-actived']
128
+ }], onClick: [{
129
+ type: HostListener,
130
+ args: ['click']
131
+ }] } });
132
+ class XTableFooterCell extends CdkFooterCell {
133
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableFooterCell, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
134
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableFooterCell, isStandalone: true, selector: "x-table-footer-cell, td[x-table-footer-cell]", host: { classAttribute: "x-table-footer-cell" }, usesInheritance: true, ngImport: i0 }); }
135
+ }
136
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableFooterCell, decorators: [{
137
+ type: Directive,
138
+ args: [{
139
+ selector: 'x-table-footer-cell, td[x-table-footer-cell]',
140
+ host: {
141
+ class: 'x-table-footer-cell'
142
+ }
143
+ }]
43
144
  }] });
145
+ class XTableViewCell extends CdkCell {
146
+ constructor() {
147
+ super(...arguments);
148
+ this.tableViewService = inject(XTableViewService, { optional: true });
149
+ this.tableView = inject(X_TABLE_VIEW_CONTEXT, { optional: true });
150
+ this.elementRef = inject(ElementRef);
151
+ }
152
+ get isSelected() {
153
+ return this.tableViewService.selectedCells.includes(this);
154
+ }
155
+ onClick() {
156
+ this.tableViewService.selectedCells = [this];
157
+ this.tableViewService.activedRows = [];
158
+ this.setActivedRow(this);
159
+ this.setActivedColumn(this);
160
+ }
161
+ setActivedRow(cell) {
162
+ const rows = this.tableView?.getRows() ?? [];
163
+ if (rows.length > 0) {
164
+ const rowIndex = this.getRowIndex(cell);
165
+ if (rowIndex >= 0 && rowIndex < rows.length) {
166
+ const currentRow = rows[rowIndex];
167
+ this.tableViewService.activedRows.push(currentRow);
168
+ }
169
+ }
170
+ }
171
+ setActivedColumn(cell) {
172
+ const headerCells = (this.tableView?.getHeaderCells() ?? []);
173
+ const headerRowRefs = this.tableView?.getHeaderRowRefs() ?? [];
174
+ const headerCellsArray = this.convertToColumnBasedArray(headerCells, headerRowRefs.length);
175
+ const activedHeaderCells = [];
176
+ for (let cells of headerCellsArray) {
177
+ if (cells.length > 0) {
178
+ const columnIndex = this.getColumnIndex(cell);
179
+ if (columnIndex >= 0 && columnIndex < cells.length) {
180
+ activedHeaderCells.push(cells[columnIndex]);
181
+ }
182
+ }
183
+ }
184
+ this.tableViewService.activedHeaderCells = activedHeaderCells;
185
+ }
186
+ convertToColumnBasedArray(input, columnsPerRow) {
187
+ const result = [];
188
+ for (let i = 0; i < columnsPerRow; i++) {
189
+ result.push([]);
190
+ }
191
+ for (let i = 0; i < input.length; i++) {
192
+ const columnIndex = i % columnsPerRow;
193
+ result[columnIndex].push(input[i]);
194
+ }
195
+ return result;
196
+ }
197
+ getColumnIndex(cell) {
198
+ if (!this.tableView || !this.tableView.getCells())
199
+ return -1;
200
+ const cellsArray = this.tableView.getCells();
201
+ const selectedIndex = cellsArray.indexOf(cell);
202
+ if (selectedIndex === -1)
203
+ return -1;
204
+ const columnsPerRow = (this.tableView.getHeaderRowRef()?.getColumns()).length ?? 0;
205
+ const rowsCount = this.tableView.getRows().length;
206
+ if (columnsPerRow === 0 || rowsCount === 0)
207
+ return -1;
208
+ return Math.floor(selectedIndex / rowsCount);
209
+ }
210
+ getRowIndex(cell) {
211
+ if (!this.tableView || !this.tableView.getCells())
212
+ return -1;
213
+ const cellsArray = this.tableView.getCells();
214
+ const selectedIndex = cellsArray.indexOf(cell);
215
+ if (selectedIndex === -1)
216
+ return -1;
217
+ const columnsPerRow = (this.tableView.getHeaderRowRef()?.getColumns()).length ?? 0;
218
+ const rowsCount = this.tableView.getRows().length;
219
+ if (columnsPerRow === 0 || rowsCount === 0)
220
+ return -1;
221
+ return selectedIndex % rowsCount;
222
+ }
223
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableViewCell, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
224
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableViewCell, isStandalone: true, selector: "x-table-cell, td[x-table-cell]", host: { listeners: { "click": "onClick()" }, properties: { "class.x-table-cell-selected": "this.isSelected" }, classAttribute: "x-table-cell" }, usesInheritance: true, ngImport: i0 }); }
225
+ }
226
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableViewCell, decorators: [{
227
+ type: Directive,
228
+ args: [{
229
+ selector: 'x-table-cell, td[x-table-cell]',
230
+ host: {
231
+ class: 'x-table-cell'
232
+ }
233
+ }]
234
+ }], propDecorators: { isSelected: [{
235
+ type: HostBinding,
236
+ args: ['class.x-table-cell-selected']
237
+ }], onClick: [{
238
+ type: HostListener,
239
+ args: ['click']
240
+ }] } });
44
241
 
45
242
  const ROW_TEMPLATE = `<ng-container cdkCellOutlet></ng-container>`;
46
243
  class XTableHeaderRowDef extends CdkHeaderRowDef {
244
+ getSticky() {
245
+ return this.sticky;
246
+ }
247
+ getColumns() {
248
+ return this.columns;
249
+ }
47
250
  /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableHeaderRowDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
48
251
  /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.3.5", type: XTableHeaderRowDef, isStandalone: true, selector: "[xTableHeaderRowDef]", inputs: { columns: ["xTableHeaderRowDef", "columns"], sticky: ["xTableHeaderRowDefSticky", "sticky", booleanAttribute] }, providers: [{ provide: CdkHeaderRowDef, useExisting: XTableHeaderRowDef }], usesInheritance: true, ngImport: i0 }); }
49
252
  }
@@ -91,7 +294,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImpor
91
294
  class XTableHeaderRow extends CdkHeaderRow {
92
295
  constructor() {
93
296
  super(...arguments);
94
- this.tableView = inject(XTableView, { optional: true });
297
+ this.tableView = inject(X_TABLE_VIEW_CONTEXT, { optional: true });
95
298
  this.tableViewService = inject(XTableViewService, { optional: true });
96
299
  this.sticking = signal(false, ...(ngDevMode ? [{ debugName: "sticking" }] : []));
97
300
  }
@@ -102,16 +305,16 @@ class XTableHeaderRow extends CdkHeaderRow {
102
305
  this.listenerSticky();
103
306
  }
104
307
  listenerSticky() {
105
- const index = this.tableView?.headerRows().findIndex((x) => x === this);
308
+ const index = this.tableView?.getHeaderRows().findIndex((x) => x === this);
106
309
  if (index === undefined || index < 0)
107
310
  return;
108
- const rowLen = this.tableView?.headerRowRefs()?.length ?? 0;
311
+ const rowLen = this.tableView?.getHeaderRowRefs()?.length ?? 0;
109
312
  if (rowLen === 0 || rowLen < index)
110
313
  return;
111
- const sticky = this.tableView?.headerRowRefs()[index].sticky;
314
+ const sticky = this.tableView?.getHeaderRowRefs()[index].getSticky();
112
315
  if (!sticky)
113
316
  return;
114
- const sentinel = this.tableView?.sentinelTop().nativeElement;
317
+ const sentinel = this.tableView?.getSentinelTop()?.nativeElement;
115
318
  const observer = new IntersectionObserver(([entry]) => {
116
319
  const sticking = !entry.isIntersecting;
117
320
  if (sticking) {
@@ -216,6 +419,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImpor
216
419
  }]
217
420
  }] });
218
421
 
422
+ /**
423
+ * Table view
424
+ * @selector x-table-view
425
+ * @decorator component
426
+ */
427
+ const XTableViewPrefix = 'x-table-view';
428
+ const X_TABLE_VIEW_CONFIG_NAME = 'tableView';
429
+ /**
430
+ * Table view Property
431
+ */
432
+ class XTableViewProperty extends CdkTable {
433
+ constructor() {
434
+ super(...arguments);
435
+ this.config = inject(XConfigService).getConfigForComponent(X_TABLE_VIEW_CONFIG_NAME);
436
+ }
437
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableViewProperty, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
438
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.5", type: XTableViewProperty, isStandalone: true, selector: "x-table-view-property", usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
439
+ }
440
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableViewProperty, decorators: [{
441
+ type: Component,
442
+ args: [{ selector: `${XTableViewPrefix}-property`, template: '' }]
443
+ }] });
444
+
219
445
  class XTableView extends XTableViewProperty {
220
446
  constructor() {
221
447
  super(...arguments);
@@ -233,13 +459,33 @@ class XTableView extends XTableViewProperty {
233
459
  /** Overrides the need to add position: sticky on every sticky cell element in `CdkTable`. */
234
460
  this.needsPositionStickyOnElement = false;
235
461
  }
462
+ getHeaderRows() {
463
+ return this.headerRows();
464
+ }
465
+ getHeaderRowRefs() {
466
+ return this.headerRowRefs();
467
+ }
468
+ getSentinelTop() {
469
+ return this.sentinelTop();
470
+ }
471
+ getHeaderCells() {
472
+ return this.headerCells();
473
+ }
474
+ getCells() {
475
+ return this.cells();
476
+ }
477
+ getRows() {
478
+ return this.rows();
479
+ }
236
480
  /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableView, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
237
481
  /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.5", type: XTableView, isStandalone: true, selector: "x-table-view, table[x-table-view]", host: { properties: { "class.x-table-fixed-layout": "fixedLayout" }, classAttribute: "x-table-view" }, providers: [
238
482
  { provide: CdkTable, useExisting: XTableView },
239
483
  { provide: CDK_TABLE, useExisting: XTableView },
240
- // Prevent nested tables from seeing this table's StickyPositioningListener.
241
- { provide: _VIEW_REPEATER_STRATEGY, useClass: _DisposeViewRepeaterStrategy },
242
484
  { provide: STICKY_POSITIONING_LISTENER, useValue: null },
485
+ {
486
+ provide: X_TABLE_VIEW_CONTEXT,
487
+ useExisting: XTableView
488
+ },
243
489
  XTableViewService
244
490
  ], queries: [{ propertyName: "headerRowRef", first: true, predicate: XTableHeaderRowDef, descendants: true, isSignal: true }, { propertyName: "headerRowRefs", predicate: XTableHeaderRowDef, isSignal: true }, { propertyName: "headerRows", predicate: XTableHeaderRow, isSignal: true }, { propertyName: "columnDefs", predicate: XTableColumnDef, isSignal: true }, { propertyName: "headerCells", predicate: XTableHeaderCell, isSignal: true }, { propertyName: "cells", predicate: XTableViewCell, isSignal: true }, { propertyName: "rows", predicate: XTableViewRow, isSignal: true }], viewQueries: [{ propertyName: "sentinelTop", first: true, predicate: ["sentinelTop"], descendants: true, isSignal: true }], exportAs: ["xTableView"], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"caption\" />\r\n<ng-content select=\"colgroup, col\" />\r\n\r\n<!--\r\n Unprojected content throws a hydration error so we need this to capture it.\r\n It gets removed on the client so it doesn't affect the layout.\r\n -->\r\n@if (_isServer) {\r\n <ng-content />\r\n}\r\n<div class=\"x-table-sentinel-top\" #sentinelTop></div>\r\n@if (_isNativeHtmlTable) {\r\n <thead>\r\n <ng-container headerRowOutlet />\r\n </thead>\r\n <tbody>\r\n <ng-container rowOutlet />\r\n <ng-container noDataRowOutlet />\r\n </tbody>\r\n <tfoot>\r\n <ng-container footerRowOutlet />\r\n </tfoot>\r\n} @else {\r\n <ng-container headerRowOutlet />\r\n <ng-container rowOutlet />\r\n <ng-container noDataRowOutlet />\r\n <ng-container footerRowOutlet />\r\n}\r\n", styles: [".x-table-view{margin:0;padding:0}.x-table-view{position:relative;border-collapse:separate;border-spacing:0}.x-table-view .x-table-header-cell,.x-table-view .x-table-footer-cell{padding:0 .5rem;text-align:left;font-weight:500;color:var(--x-text);border-top:var(--x-border-width) var(--x-border-style) var(--x-border);border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border);border-right:var(--x-border-width) var(--x-border-style) var(--x-border);cursor:default;background-color:var(--x-background);white-space:nowrap}.x-table-view .x-table-header-cell:first-child,.x-table-view .x-table-footer-cell:first-child{border-left:var(--x-border-width) var(--x-border-style) var(--x-border)}.x-table-view .x-table-header-cell.x-table-header-cell-actived,.x-table-view .x-table-footer-cell.x-table-header-cell-actived{background-color:var(--x-background-a100)}.x-table-view .x-table-sticky{position:sticky;background-color:var(--x-background-a200)}.x-table-view .x-table-sentinel-top{visibility:hidden;position:absolute;top:0}.x-table-view .x-table-row-actived .x-table-cell:not(.x-table-cell-selected){background-color:var(--x-background-a100)}.x-table-view .x-table-cell{padding:0 .5rem;text-align:left;font-weight:500;color:var(--x-text);border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border);border-right:var(--x-border-width) var(--x-border-style) var(--x-border);cursor:default;white-space:nowrap;background-color:var(--x-background)}.x-table-view .x-table-cell:first-child{border-left:var(--x-border-width) var(--x-border-style) var(--x-border)}.x-table-view .x-table-cell.x-table-cell-selected{border-color:var(--x-border-a200);background-color:var(--x-primary-900)}.x-table-view .x-table-cell.x-table-sticky:not(.x-table-cell-selected){background-color:var(--x-background-a200)}.x-table-view .x-table-sticky-border-elem-top{border-bottom-style:solid;border-bottom-width:calc(2 * var(--x-border-width));border-bottom-color:var(--x-border-a900)}.x-table-view .x-table-sticky-border-elem-bottom{border-top-style:solid;border-top-width:calc(2 * var(--x-border-width));border-top-color:var(--x-border-a900)}.x-table-view .x-table-sticky-border-elem-left{border-right-style:solid;border-right-width:calc(2 * var(--x-border-width));border-right-color:var(--x-border-a900)}.x-table-view .x-table-sticky-border-elem-right{border-left-style:solid;border-left-width:calc(2 * var(--x-border-width));border-left-color:var(--x-border-a900)}\n"], dependencies: [{ kind: "directive", type: HeaderRowOutlet, selector: "[headerRowOutlet]" }, { kind: "directive", type: DataRowOutlet, selector: "[rowOutlet]" }, { kind: "directive", type: NoDataRowOutlet, selector: "[noDataRowOutlet]" }, { kind: "directive", type: FooterRowOutlet, selector: "[footerRowOutlet]" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
245
491
  }
@@ -251,232 +497,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImpor
251
497
  }, providers: [
252
498
  { provide: CdkTable, useExisting: XTableView },
253
499
  { provide: CDK_TABLE, useExisting: XTableView },
254
- // Prevent nested tables from seeing this table's StickyPositioningListener.
255
- { provide: _VIEW_REPEATER_STRATEGY, useClass: _DisposeViewRepeaterStrategy },
256
500
  { provide: STICKY_POSITIONING_LISTENER, useValue: null },
501
+ {
502
+ provide: X_TABLE_VIEW_CONTEXT,
503
+ useExisting: XTableView
504
+ },
257
505
  XTableViewService
258
506
  ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, imports: [HeaderRowOutlet, DataRowOutlet, NoDataRowOutlet, FooterRowOutlet], template: "<ng-content select=\"caption\" />\r\n<ng-content select=\"colgroup, col\" />\r\n\r\n<!--\r\n Unprojected content throws a hydration error so we need this to capture it.\r\n It gets removed on the client so it doesn't affect the layout.\r\n -->\r\n@if (_isServer) {\r\n <ng-content />\r\n}\r\n<div class=\"x-table-sentinel-top\" #sentinelTop></div>\r\n@if (_isNativeHtmlTable) {\r\n <thead>\r\n <ng-container headerRowOutlet />\r\n </thead>\r\n <tbody>\r\n <ng-container rowOutlet />\r\n <ng-container noDataRowOutlet />\r\n </tbody>\r\n <tfoot>\r\n <ng-container footerRowOutlet />\r\n </tfoot>\r\n} @else {\r\n <ng-container headerRowOutlet />\r\n <ng-container rowOutlet />\r\n <ng-container noDataRowOutlet />\r\n <ng-container footerRowOutlet />\r\n}\r\n", styles: [".x-table-view{margin:0;padding:0}.x-table-view{position:relative;border-collapse:separate;border-spacing:0}.x-table-view .x-table-header-cell,.x-table-view .x-table-footer-cell{padding:0 .5rem;text-align:left;font-weight:500;color:var(--x-text);border-top:var(--x-border-width) var(--x-border-style) var(--x-border);border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border);border-right:var(--x-border-width) var(--x-border-style) var(--x-border);cursor:default;background-color:var(--x-background);white-space:nowrap}.x-table-view .x-table-header-cell:first-child,.x-table-view .x-table-footer-cell:first-child{border-left:var(--x-border-width) var(--x-border-style) var(--x-border)}.x-table-view .x-table-header-cell.x-table-header-cell-actived,.x-table-view .x-table-footer-cell.x-table-header-cell-actived{background-color:var(--x-background-a100)}.x-table-view .x-table-sticky{position:sticky;background-color:var(--x-background-a200)}.x-table-view .x-table-sentinel-top{visibility:hidden;position:absolute;top:0}.x-table-view .x-table-row-actived .x-table-cell:not(.x-table-cell-selected){background-color:var(--x-background-a100)}.x-table-view .x-table-cell{padding:0 .5rem;text-align:left;font-weight:500;color:var(--x-text);border-bottom:var(--x-border-width) var(--x-border-style) var(--x-border);border-right:var(--x-border-width) var(--x-border-style) var(--x-border);cursor:default;white-space:nowrap;background-color:var(--x-background)}.x-table-view .x-table-cell:first-child{border-left:var(--x-border-width) var(--x-border-style) var(--x-border)}.x-table-view .x-table-cell.x-table-cell-selected{border-color:var(--x-border-a200);background-color:var(--x-primary-900)}.x-table-view .x-table-cell.x-table-sticky:not(.x-table-cell-selected){background-color:var(--x-background-a200)}.x-table-view .x-table-sticky-border-elem-top{border-bottom-style:solid;border-bottom-width:calc(2 * var(--x-border-width));border-bottom-color:var(--x-border-a900)}.x-table-view .x-table-sticky-border-elem-bottom{border-top-style:solid;border-top-width:calc(2 * var(--x-border-width));border-top-color:var(--x-border-a900)}.x-table-view .x-table-sticky-border-elem-left{border-right-style:solid;border-right-width:calc(2 * var(--x-border-width));border-right-color:var(--x-border-a900)}.x-table-view .x-table-sticky-border-elem-right{border-left-style:solid;border-left-width:calc(2 * var(--x-border-width));border-left-color:var(--x-border-a900)}\n"] }]
259
507
  }], propDecorators: { sentinelTop: [{ type: i0.ViewChild, args: ['sentinelTop', { isSignal: true }] }], headerRowRef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => XTableHeaderRowDef), { isSignal: true }] }], headerRowRefs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => XTableHeaderRowDef), { isSignal: true }] }], headerRows: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => XTableHeaderRow), { isSignal: true }] }], columnDefs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => XTableColumnDef), { isSignal: true }] }], headerCells: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => XTableHeaderCell), { isSignal: true }] }], cells: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => XTableViewCell), { isSignal: true }] }], rows: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => XTableViewRow), { isSignal: true }] }] } });
260
508
 
261
- class XTableViewCellDef extends CdkCellDef {
262
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableViewCellDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
263
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableViewCellDef, isStandalone: true, selector: "[xTableCellDef]", providers: [{ provide: CdkCellDef, useExisting: XTableViewCellDef }], usesInheritance: true, ngImport: i0 }); }
264
- }
265
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableViewCellDef, decorators: [{
266
- type: Directive,
267
- args: [{
268
- selector: '[xTableCellDef]',
269
- providers: [{ provide: CdkCellDef, useExisting: XTableViewCellDef }]
270
- }]
271
- }] });
272
- class XTableHeaderCellDef extends CdkHeaderCellDef {
273
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableHeaderCellDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
274
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableHeaderCellDef, isStandalone: true, selector: "[xTableHeaderCellDef]", providers: [{ provide: CdkHeaderCellDef, useExisting: XTableHeaderCellDef }], usesInheritance: true, ngImport: i0 }); }
275
- }
276
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableHeaderCellDef, decorators: [{
277
- type: Directive,
278
- args: [{
279
- selector: '[xTableHeaderCellDef]',
280
- providers: [{ provide: CdkHeaderCellDef, useExisting: XTableHeaderCellDef }]
281
- }]
282
- }] });
283
- class XTableFooterCellDef extends CdkFooterCellDef {
284
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableFooterCellDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
285
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableFooterCellDef, isStandalone: true, selector: "[xTableFooterCellDef]", providers: [{ provide: CdkFooterCellDef, useExisting: XTableFooterCellDef }], usesInheritance: true, ngImport: i0 }); }
286
- }
287
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableFooterCellDef, decorators: [{
288
- type: Directive,
289
- args: [{
290
- selector: '[xTableFooterCellDef]',
291
- providers: [{ provide: CdkFooterCellDef, useExisting: XTableFooterCellDef }]
292
- }]
293
- }] });
294
- class XTableColumnDef extends CdkColumnDef {
295
- get name() {
296
- return this._name;
297
- }
298
- set name(name) {
299
- this._setNameInput(name);
300
- }
301
- _updateColumnCssClassName() {
302
- super._updateColumnCssClassName();
303
- this._columnCssClassName.push(`x-table-column-${this.cssClassFriendlyName}`);
304
- }
305
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableColumnDef, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
306
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableColumnDef, isStandalone: true, selector: "[xTableColumnDef]", inputs: { name: ["xTableColumnDef", "name"] }, providers: [{ provide: CdkColumnDef, useExisting: XTableColumnDef }], usesInheritance: true, ngImport: i0 }); }
307
- }
308
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableColumnDef, decorators: [{
309
- type: Directive,
310
- args: [{
311
- selector: '[xTableColumnDef]',
312
- providers: [{ provide: CdkColumnDef, useExisting: XTableColumnDef }]
313
- }]
314
- }], propDecorators: { name: [{
315
- type: Input,
316
- args: ['xTableColumnDef']
317
- }] } });
318
- class XTableHeaderCell extends CdkHeaderCell {
319
- constructor() {
320
- super(...arguments);
321
- this.tableViewService = inject(XTableViewService, { optional: true });
322
- this.tableView = inject(XTableView, { optional: true });
323
- this.elementRef = inject(ElementRef);
324
- }
325
- get isActived() {
326
- return this.tableViewService.activedHeaderCells.includes(this);
327
- }
328
- onClick() {
329
- this.tableViewService.activedHeaderCells = [this];
330
- const headerCells = this.tableView?.headerCells() ?? [];
331
- const index = headerCells.indexOf(this);
332
- const cells = this.tableView?.cells() ?? [];
333
- const columnsCount = (this.tableView?.headerRowRef()?.columns).length ?? 0;
334
- const rowsCount = this.tableView?.rows().length ?? 0;
335
- if (columnsCount === 0 || rowsCount === 0) {
336
- return;
337
- }
338
- const columnCells = [];
339
- for (let i = 0; i < rowsCount; i++) {
340
- const cellIndex = index * rowsCount + i;
341
- if (cellIndex < cells.length) {
342
- columnCells.push(cells[cellIndex]);
343
- }
344
- }
345
- this.tableViewService.selectedCells = [];
346
- for (let cell of columnCells) {
347
- this.tableViewService.selectedCells.push(cell);
348
- cell.setActivedRow(cell);
349
- }
350
- }
351
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableHeaderCell, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
352
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableHeaderCell, isStandalone: true, selector: "x-table-header-cell, th[x-table-header-cell]", host: { attributes: { "role": "columnheader" }, listeners: { "click": "onClick()" }, properties: { "class.x-table-header-cell-actived": "this.isActived" }, classAttribute: "x-table-header-cell" }, usesInheritance: true, ngImport: i0 }); }
353
- }
354
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableHeaderCell, decorators: [{
355
- type: Directive,
356
- args: [{
357
- selector: 'x-table-header-cell, th[x-table-header-cell]',
358
- host: {
359
- class: 'x-table-header-cell',
360
- role: 'columnheader'
361
- }
362
- }]
363
- }], propDecorators: { isActived: [{
364
- type: HostBinding,
365
- args: ['class.x-table-header-cell-actived']
366
- }], onClick: [{
367
- type: HostListener,
368
- args: ['click']
369
- }] } });
370
- class XTableFooterCell extends CdkFooterCell {
371
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableFooterCell, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
372
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableFooterCell, isStandalone: true, selector: "x-table-footer-cell, td[x-table-footer-cell]", host: { classAttribute: "x-table-footer-cell" }, usesInheritance: true, ngImport: i0 }); }
373
- }
374
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableFooterCell, decorators: [{
375
- type: Directive,
376
- args: [{
377
- selector: 'x-table-footer-cell, td[x-table-footer-cell]',
378
- host: {
379
- class: 'x-table-footer-cell'
380
- }
381
- }]
382
- }] });
383
- class XTableViewCell extends CdkCell {
384
- constructor() {
385
- super(...arguments);
386
- this.tableViewService = inject(XTableViewService, { optional: true });
387
- this.tableView = inject(XTableView, { optional: true });
388
- this.elementRef = inject(ElementRef);
389
- }
390
- get isSelected() {
391
- return this.tableViewService.selectedCells.includes(this);
392
- }
393
- onClick() {
394
- this.tableViewService.selectedCells = [this];
395
- this.tableViewService.activedRows = [];
396
- this.setActivedRow(this);
397
- this.setActivedColumn(this);
398
- }
399
- setActivedRow(cell) {
400
- const rows = this.tableView?.rows() ?? [];
401
- if (rows.length > 0) {
402
- const rowIndex = this.getRowIndex(cell);
403
- if (rowIndex >= 0 && rowIndex < rows.length) {
404
- const currentRow = rows[rowIndex];
405
- this.tableViewService.activedRows.push(currentRow);
406
- }
407
- }
408
- }
409
- setActivedColumn(cell) {
410
- const headerCells = (this.tableView?.headerCells() ?? []);
411
- const headerRowRefs = this.tableView?.headerRowRefs() ?? [];
412
- const headerCellsArray = this.convertToColumnBasedArray(headerCells, headerRowRefs.length);
413
- const activedHeaderCells = [];
414
- for (let cells of headerCellsArray) {
415
- if (cells.length > 0) {
416
- const columnIndex = this.getColumnIndex(cell);
417
- if (columnIndex >= 0 && columnIndex < cells.length) {
418
- activedHeaderCells.push(cells[columnIndex]);
419
- }
420
- }
421
- }
422
- this.tableViewService.activedHeaderCells = activedHeaderCells;
423
- }
424
- convertToColumnBasedArray(input, columnsPerRow) {
425
- const result = [];
426
- for (let i = 0; i < columnsPerRow; i++) {
427
- result.push([]);
428
- }
429
- for (let i = 0; i < input.length; i++) {
430
- const columnIndex = i % columnsPerRow;
431
- result[columnIndex].push(input[i]);
432
- }
433
- return result;
434
- }
435
- getColumnIndex(cell) {
436
- if (!this.tableView || !this.tableView.cells())
437
- return -1;
438
- const cellsArray = this.tableView.cells();
439
- const selectedIndex = cellsArray.indexOf(cell);
440
- if (selectedIndex === -1)
441
- return -1;
442
- const columnsPerRow = (this.tableView.headerRowRef()?.columns).length ?? 0;
443
- const rowsCount = this.tableView.rows().length;
444
- if (columnsPerRow === 0 || rowsCount === 0)
445
- return -1;
446
- return Math.floor(selectedIndex / rowsCount);
447
- }
448
- getRowIndex(cell) {
449
- if (!this.tableView || !this.tableView.cells())
450
- return -1;
451
- const cellsArray = this.tableView.cells();
452
- const selectedIndex = cellsArray.indexOf(cell);
453
- if (selectedIndex === -1)
454
- return -1;
455
- const columnsPerRow = (this.tableView.headerRowRef()?.columns).length ?? 0;
456
- const rowsCount = this.tableView.rows().length;
457
- if (columnsPerRow === 0 || rowsCount === 0)
458
- return -1;
459
- return selectedIndex % rowsCount;
460
- }
461
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableViewCell, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
462
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.5", type: XTableViewCell, isStandalone: true, selector: "x-table-cell, td[x-table-cell]", host: { listeners: { "click": "onClick()" }, properties: { "class.x-table-cell-selected": "this.isSelected" }, classAttribute: "x-table-cell" }, usesInheritance: true, ngImport: i0 }); }
463
- }
464
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableViewCell, decorators: [{
465
- type: Directive,
466
- args: [{
467
- selector: 'x-table-cell, td[x-table-cell]',
468
- host: {
469
- class: 'x-table-cell'
470
- }
471
- }]
472
- }], propDecorators: { isSelected: [{
473
- type: HostBinding,
474
- args: ['class.x-table-cell-selected']
475
- }], onClick: [{
476
- type: HostListener,
477
- args: ['click']
478
- }] } });
479
-
480
509
  class XTableTextColumn extends CdkTextColumn {
481
510
  /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XTableTextColumn, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
482
511
  /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.5", type: XTableTextColumn, isStandalone: true, selector: "x-table-text-column", usesInheritance: true, ngImport: i0, template: `