@sixbell-telco/sdk 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -0
- package/README.md +183 -70
- package/_index.css +132 -53
- package/components/data-table/expandable/expandable.component.d.ts +129 -0
- package/components/data-table/index.d.ts +5 -0
- package/components/data-table/public-api.d.ts +7 -0
- package/components/data-table/selection/selection.component.d.ts +41 -0
- package/components/data-table/sortable-header/sortable-header.component.d.ts +61 -0
- package/components/data-table/src/data-table-context.service.d.ts +18 -0
- package/components/data-table/src/data-table.component.d.ts +158 -0
- package/components/data-table/src/models.d.ts +58 -0
- package/components/data-table/sub-component-toggle/index.d.ts +1 -0
- package/components/data-table/sub-component-toggle/sub-component-toggle.component.d.ts +12 -0
- package/components/dropdown/dropdown-group/dropdown-group.component.d.ts +1 -1
- package/components/dropdown/dropdown-item-checkbox/dropdown-item-checkbox.component.d.ts +2 -2
- package/components/dropdown/dropdown-item-radio/dropdown-item-radio.component.d.ts +2 -2
- package/components/dropdown-menu/bar/dropdown-menu-bar-item-checkbox/dropdown-menu-bar-item-checkbox.component.d.ts +2 -2
- package/components/dropdown-menu/bar/dropdown-menu-bar-item-radio/dropdown-menu-bar-item-radio.component.d.ts +2 -2
- package/components/forms/datepicker/constants/datepicker.constants.d.ts +5 -0
- package/components/forms/datepicker/public-api.d.ts +2 -1
- package/components/forms/datepicker/src/datepicker.component.d.ts +155 -44
- package/components/forms/datepicker/types/datepicker.types.d.ts +7 -0
- package/components/overlay/index.d.ts +5 -0
- package/components/overlay/overlay-content/overlay-content.component.d.ts +23 -0
- package/components/overlay/overlay-trigger/overlay-trigger.component.d.ts +48 -0
- package/components/overlay/public-api.d.ts +3 -0
- package/components/overlay/src/overlay.component.d.ts +158 -0
- package/components/paginator/components/pagination-item/pagination-item.component.d.ts +8 -3
- package/components/paginator/pipes/pagination.pipe.d.ts +40 -0
- package/components/paginator/public-api.d.ts +1 -0
- package/components/paginator/src/paginator.component.d.ts +14 -12
- package/components/table/src/table.component.d.ts +9 -6
- package/fesm2022/sixbell-telco-sdk-components-data-table-sub-component-toggle.mjs +103 -0
- package/fesm2022/sixbell-telco-sdk-components-data-table-sub-component-toggle.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-data-table.mjs +1091 -0
- package/fesm2022/sixbell-telco-sdk-components-data-table.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs +6 -6
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs +12 -10
- package/fesm2022/sixbell-telco-sdk-components-dropdown.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs +4 -5
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs +439 -164
- package/fesm2022/sixbell-telco-sdk-components-forms-datepicker.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs +2 -2
- package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs +3 -3
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-overlay.mjs +408 -0
- package/fesm2022/sixbell-telco-sdk-components-overlay.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-components-paginator.mjs +150 -35
- package/fesm2022/sixbell-telco-sdk-components-paginator.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-table.mjs +15 -6
- package/fesm2022/sixbell-telco-sdk-components-table.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-utils-date.mjs +154 -0
- package/fesm2022/sixbell-telco-sdk-utils-date.mjs.map +1 -0
- package/fesm2022/sixbell-telco-sdk-utils-sync.mjs +84 -0
- package/fesm2022/sixbell-telco-sdk-utils-sync.mjs.map +1 -0
- package/package.json +56 -35
- package/utils/date/index.d.ts +5 -0
- package/utils/date/public-api.d.ts +1 -0
- package/utils/date/src/date-utils.d.ts +81 -0
- package/utils/sync/index.d.ts +5 -0
- package/utils/sync/public-api.d.ts +1 -0
- package/utils/sync/src/sync.d.ts +37 -0
- package/components/forms/datepicker/src/datepicker-format-month.pipe.d.ts +0 -10
|
@@ -0,0 +1,1091 @@
|
|
|
1
|
+
import { injectFlexRenderContext } from '@tanstack/angular-table';
|
|
2
|
+
export * from '@tanstack/angular-table';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { signal, Injectable, inject, computed, ChangeDetectionStrategy, Component, input, output, effect } from '@angular/core';
|
|
6
|
+
import { ButtonComponent } from '@sixbell-telco/sdk/components/button';
|
|
7
|
+
import { IconComponent } from '@sixbell-telco/sdk/components/icon';
|
|
8
|
+
import { matKeyboardArrowDown, matSwapVert, matArrowUpward, matInfo } from '@sixbell-telco/sdk/components/icon/material/baseline';
|
|
9
|
+
import { CheckboxComponent } from '@sixbell-telco/sdk/components/forms/checkbox';
|
|
10
|
+
import { heroDocumentText, heroXCircle } from '@ng-icons/heroicons/outline';
|
|
11
|
+
import { SelectComponent } from '@sixbell-telco/sdk/components/forms/select';
|
|
12
|
+
import { PaginatorComponent } from '@sixbell-telco/sdk/components/paginator';
|
|
13
|
+
import { TypographyDirective } from '@sixbell-telco/sdk/directives/typography';
|
|
14
|
+
import { cn } from '@sixbell-telco/sdk/utils/cn';
|
|
15
|
+
import { TranslateService, TranslatePipe } from '@sixbell-telco/sdk/utils/translation';
|
|
16
|
+
import { cva } from 'class-variance-authority';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Context service to share data table configuration with sub-components
|
|
20
|
+
* This allows sub-components to automatically sync their sizes with the parent data table
|
|
21
|
+
*/
|
|
22
|
+
class DataTableContextService {
|
|
23
|
+
/**
|
|
24
|
+
* Current table size that sub-components can subscribe to
|
|
25
|
+
*/
|
|
26
|
+
size = signal('sm');
|
|
27
|
+
/**
|
|
28
|
+
* Update the table size - called by the main data table component
|
|
29
|
+
*/
|
|
30
|
+
setSize(size) {
|
|
31
|
+
this.size.set(size);
|
|
32
|
+
}
|
|
33
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableContextService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
34
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableContextService });
|
|
35
|
+
}
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableContextService, decorators: [{
|
|
37
|
+
type: Injectable
|
|
38
|
+
}] });
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Expandable cell component that shows row data and expand/collapse toggle
|
|
42
|
+
*/
|
|
43
|
+
class DataTableExpandableCellComponent {
|
|
44
|
+
/**
|
|
45
|
+
* TanStack Table context injected by flexRender
|
|
46
|
+
*/
|
|
47
|
+
context = injectFlexRenderContext();
|
|
48
|
+
/**
|
|
49
|
+
* Data table context for size synchronization
|
|
50
|
+
*/
|
|
51
|
+
dataTableContext = inject(DataTableContextService);
|
|
52
|
+
/**
|
|
53
|
+
* Get the row instance from context
|
|
54
|
+
*/
|
|
55
|
+
get row() {
|
|
56
|
+
return this.context.row;
|
|
57
|
+
}
|
|
58
|
+
/** @internal */
|
|
59
|
+
iconChevronDown = matKeyboardArrowDown;
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
* Computes button size based on data table size
|
|
63
|
+
*/
|
|
64
|
+
buttonSize = computed(() => {
|
|
65
|
+
switch (this.dataTableContext.size()) {
|
|
66
|
+
case 'xs':
|
|
67
|
+
return 'xs';
|
|
68
|
+
case 'sm':
|
|
69
|
+
return 'xs';
|
|
70
|
+
case 'md':
|
|
71
|
+
return 'sm';
|
|
72
|
+
case 'lg':
|
|
73
|
+
return 'sm';
|
|
74
|
+
case 'xl':
|
|
75
|
+
return 'md';
|
|
76
|
+
default:
|
|
77
|
+
return 'xs';
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
/**
|
|
81
|
+
* @internal
|
|
82
|
+
* Computes icon size based on data table size
|
|
83
|
+
*/
|
|
84
|
+
iconSize = computed(() => {
|
|
85
|
+
switch (this.dataTableContext.size()) {
|
|
86
|
+
case 'xs':
|
|
87
|
+
return 'xs';
|
|
88
|
+
case 'sm':
|
|
89
|
+
return 'xs';
|
|
90
|
+
case 'md':
|
|
91
|
+
return 'sm';
|
|
92
|
+
case 'lg':
|
|
93
|
+
return 'sm';
|
|
94
|
+
case 'xl':
|
|
95
|
+
return 'md';
|
|
96
|
+
default:
|
|
97
|
+
return 'xs';
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableExpandableCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
101
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.0", type: DataTableExpandableCellComponent, isStandalone: true, selector: "st-data-table-expandable-cell", ngImport: i0, template: `
|
|
102
|
+
<div [style.--depth]="row.depth">
|
|
103
|
+
<div>
|
|
104
|
+
@if (row.getCanExpand()) {
|
|
105
|
+
<st-button
|
|
106
|
+
variant="base"
|
|
107
|
+
[size]="buttonSize()"
|
|
108
|
+
[square]="true"
|
|
109
|
+
[link]="true"
|
|
110
|
+
class="group"
|
|
111
|
+
(click)="row.getToggleExpandedHandler()()"
|
|
112
|
+
[attr.aria-expanded]="row.getIsExpanded()"
|
|
113
|
+
>
|
|
114
|
+
<st-icon
|
|
115
|
+
class="transition-transform duration-300 ease-in-out group-aria-[expanded=false]:rotate-0 group-aria-[expanded=true]:rotate-180"
|
|
116
|
+
[icon]="iconChevronDown"
|
|
117
|
+
[size]="iconSize()"
|
|
118
|
+
></st-icon>
|
|
119
|
+
</st-button>
|
|
120
|
+
} @else {
|
|
121
|
+
<span> </span>
|
|
122
|
+
}
|
|
123
|
+
{{ context.getValue() }}
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
`, isInline: true, styles: [":host>div{padding-left:calc(2rem * var(--depth, 1))}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "icon"] }, { kind: "component", type: ButtonComponent, selector: "st-button", inputs: ["variant", "ghost", "outline", "link", "soft", "dash", "wide", "circle", "square", "glass", "block", "loader", "size", "shadow", "focusable", "icon", "iconPosition", "type", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
127
|
+
}
|
|
128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableExpandableCellComponent, decorators: [{
|
|
129
|
+
type: Component,
|
|
130
|
+
args: [{ standalone: true, selector: 'st-data-table-expandable-cell', imports: [CommonModule, IconComponent, ButtonComponent], template: `
|
|
131
|
+
<div [style.--depth]="row.depth">
|
|
132
|
+
<div>
|
|
133
|
+
@if (row.getCanExpand()) {
|
|
134
|
+
<st-button
|
|
135
|
+
variant="base"
|
|
136
|
+
[size]="buttonSize()"
|
|
137
|
+
[square]="true"
|
|
138
|
+
[link]="true"
|
|
139
|
+
class="group"
|
|
140
|
+
(click)="row.getToggleExpandedHandler()()"
|
|
141
|
+
[attr.aria-expanded]="row.getIsExpanded()"
|
|
142
|
+
>
|
|
143
|
+
<st-icon
|
|
144
|
+
class="transition-transform duration-300 ease-in-out group-aria-[expanded=false]:rotate-0 group-aria-[expanded=true]:rotate-180"
|
|
145
|
+
[icon]="iconChevronDown"
|
|
146
|
+
[size]="iconSize()"
|
|
147
|
+
></st-icon>
|
|
148
|
+
</st-button>
|
|
149
|
+
} @else {
|
|
150
|
+
<span> </span>
|
|
151
|
+
}
|
|
152
|
+
{{ context.getValue() }}
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host>div{padding-left:calc(2rem * var(--depth, 1))}\n"] }]
|
|
156
|
+
}] });
|
|
157
|
+
/**
|
|
158
|
+
* Expandable header cell component with sorting capability and expand all functionality
|
|
159
|
+
*/
|
|
160
|
+
class DataTableExpandableHeaderCellComponent {
|
|
161
|
+
/**
|
|
162
|
+
* TanStack Table context injected by flexRender
|
|
163
|
+
*/
|
|
164
|
+
context = injectFlexRenderContext();
|
|
165
|
+
/**
|
|
166
|
+
* Data table context for size synchronization
|
|
167
|
+
*/
|
|
168
|
+
dataTableContext = inject(DataTableContextService);
|
|
169
|
+
/**
|
|
170
|
+
* Display label for the column
|
|
171
|
+
*/
|
|
172
|
+
label = input.required();
|
|
173
|
+
/**
|
|
174
|
+
* Whether this column can be sorted
|
|
175
|
+
*/
|
|
176
|
+
canSort = input(false);
|
|
177
|
+
/**
|
|
178
|
+
* Current sort state of the column
|
|
179
|
+
*/
|
|
180
|
+
sortState = input(false);
|
|
181
|
+
/**
|
|
182
|
+
* Event emitted when sort toggle is requested
|
|
183
|
+
*/
|
|
184
|
+
sortToggle = output();
|
|
185
|
+
/**
|
|
186
|
+
* Get the table instance from context
|
|
187
|
+
*/
|
|
188
|
+
get table() {
|
|
189
|
+
return this.context.table;
|
|
190
|
+
}
|
|
191
|
+
/** @internal */
|
|
192
|
+
iconChevronDown = matKeyboardArrowDown;
|
|
193
|
+
/** @internal */
|
|
194
|
+
iconDefaultSort = matSwapVert;
|
|
195
|
+
/** @internal */
|
|
196
|
+
iconAscending = matArrowUpward;
|
|
197
|
+
/**
|
|
198
|
+
* @internal
|
|
199
|
+
* Computes button size based on data table size
|
|
200
|
+
*/
|
|
201
|
+
buttonSize = computed(() => {
|
|
202
|
+
switch (this.dataTableContext.size()) {
|
|
203
|
+
case 'xs':
|
|
204
|
+
return 'xs';
|
|
205
|
+
case 'sm':
|
|
206
|
+
return 'xs';
|
|
207
|
+
case 'md':
|
|
208
|
+
return 'sm';
|
|
209
|
+
case 'lg':
|
|
210
|
+
return 'sm';
|
|
211
|
+
case 'xl':
|
|
212
|
+
return 'md';
|
|
213
|
+
default:
|
|
214
|
+
return 'xs';
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
/**
|
|
218
|
+
* @internal
|
|
219
|
+
* Computes icon size based on data table size
|
|
220
|
+
*/
|
|
221
|
+
iconSize = computed(() => {
|
|
222
|
+
switch (this.dataTableContext.size()) {
|
|
223
|
+
case 'xs':
|
|
224
|
+
return 'xs';
|
|
225
|
+
case 'sm':
|
|
226
|
+
return 'xs';
|
|
227
|
+
case 'md':
|
|
228
|
+
return 'sm';
|
|
229
|
+
case 'lg':
|
|
230
|
+
return 'sm';
|
|
231
|
+
case 'xl':
|
|
232
|
+
return 'md';
|
|
233
|
+
default:
|
|
234
|
+
return 'xs';
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
/**
|
|
238
|
+
* @internal
|
|
239
|
+
* Computes the appropriate icon based on current sort state
|
|
240
|
+
*/
|
|
241
|
+
currentSortIcon = computed(() => {
|
|
242
|
+
switch (this.sortState()) {
|
|
243
|
+
case 'asc':
|
|
244
|
+
case 'desc':
|
|
245
|
+
return this.iconAscending;
|
|
246
|
+
default:
|
|
247
|
+
return this.iconDefaultSort;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
/**
|
|
251
|
+
* @internal
|
|
252
|
+
* Computes aria-sort attribute for accessibility
|
|
253
|
+
*/
|
|
254
|
+
computedAriaSortAttribute = computed(() => {
|
|
255
|
+
switch (this.sortState()) {
|
|
256
|
+
case 'asc':
|
|
257
|
+
return 'ascending';
|
|
258
|
+
case 'desc':
|
|
259
|
+
return 'descending';
|
|
260
|
+
default:
|
|
261
|
+
return 'none';
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableExpandableHeaderCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
265
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.0", type: DataTableExpandableHeaderCellComponent, isStandalone: true, selector: "st-data-table-expandable-header-cell", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, canSort: { classPropertyName: "canSort", publicName: "canSort", isSignal: true, isRequired: false, transformFunction: null }, sortState: { classPropertyName: "sortState", publicName: "sortState", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sortToggle: "sortToggle" }, ngImport: i0, template: `
|
|
266
|
+
<div class="inline-flex items-center gap-1">
|
|
267
|
+
<st-button
|
|
268
|
+
variant="base"
|
|
269
|
+
[size]="buttonSize()"
|
|
270
|
+
[square]="true"
|
|
271
|
+
[link]="true"
|
|
272
|
+
(click)="context.table.getToggleAllRowsExpandedHandler()($event)"
|
|
273
|
+
class="group"
|
|
274
|
+
[attr.aria-expanded]="context.table.getIsAllRowsExpanded()"
|
|
275
|
+
>
|
|
276
|
+
<st-icon
|
|
277
|
+
class="transition-transform duration-300 ease-in-out group-aria-[expanded=false]:rotate-0 group-aria-[expanded=true]:rotate-180"
|
|
278
|
+
[icon]="iconChevronDown"
|
|
279
|
+
[size]="iconSize()"
|
|
280
|
+
></st-icon>
|
|
281
|
+
</st-button>
|
|
282
|
+
<!-- Column Label -->
|
|
283
|
+
<span class="font-bold">{{ label() }}</span>
|
|
284
|
+
<!-- Button for sorting -->
|
|
285
|
+
@if (canSort()) {
|
|
286
|
+
<st-button
|
|
287
|
+
variant="secondary"
|
|
288
|
+
[size]="buttonSize()"
|
|
289
|
+
[square]="true"
|
|
290
|
+
[ghost]="true"
|
|
291
|
+
(click)="sortToggle.emit(); $event.stopPropagation()"
|
|
292
|
+
class="group"
|
|
293
|
+
[attr.aria-label]="'Sort by ' + label()"
|
|
294
|
+
[attr.aria-sort]="computedAriaSortAttribute()"
|
|
295
|
+
>
|
|
296
|
+
<st-icon
|
|
297
|
+
class="transition-transform duration-300 ease-in-out group-aria-[sort=ascending]:rotate-0 group-aria-[sort=descending]:rotate-180"
|
|
298
|
+
[icon]="currentSortIcon()"
|
|
299
|
+
[size]="iconSize()"
|
|
300
|
+
></st-icon>
|
|
301
|
+
</st-button>
|
|
302
|
+
}
|
|
303
|
+
</div>
|
|
304
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "icon"] }, { kind: "component", type: ButtonComponent, selector: "st-button", inputs: ["variant", "ghost", "outline", "link", "soft", "dash", "wide", "circle", "square", "glass", "block", "loader", "size", "shadow", "focusable", "icon", "iconPosition", "type", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
305
|
+
}
|
|
306
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableExpandableHeaderCellComponent, decorators: [{
|
|
307
|
+
type: Component,
|
|
308
|
+
args: [{
|
|
309
|
+
standalone: true,
|
|
310
|
+
selector: 'st-data-table-expandable-header-cell',
|
|
311
|
+
imports: [CommonModule, IconComponent, ButtonComponent],
|
|
312
|
+
template: `
|
|
313
|
+
<div class="inline-flex items-center gap-1">
|
|
314
|
+
<st-button
|
|
315
|
+
variant="base"
|
|
316
|
+
[size]="buttonSize()"
|
|
317
|
+
[square]="true"
|
|
318
|
+
[link]="true"
|
|
319
|
+
(click)="context.table.getToggleAllRowsExpandedHandler()($event)"
|
|
320
|
+
class="group"
|
|
321
|
+
[attr.aria-expanded]="context.table.getIsAllRowsExpanded()"
|
|
322
|
+
>
|
|
323
|
+
<st-icon
|
|
324
|
+
class="transition-transform duration-300 ease-in-out group-aria-[expanded=false]:rotate-0 group-aria-[expanded=true]:rotate-180"
|
|
325
|
+
[icon]="iconChevronDown"
|
|
326
|
+
[size]="iconSize()"
|
|
327
|
+
></st-icon>
|
|
328
|
+
</st-button>
|
|
329
|
+
<!-- Column Label -->
|
|
330
|
+
<span class="font-bold">{{ label() }}</span>
|
|
331
|
+
<!-- Button for sorting -->
|
|
332
|
+
@if (canSort()) {
|
|
333
|
+
<st-button
|
|
334
|
+
variant="secondary"
|
|
335
|
+
[size]="buttonSize()"
|
|
336
|
+
[square]="true"
|
|
337
|
+
[ghost]="true"
|
|
338
|
+
(click)="sortToggle.emit(); $event.stopPropagation()"
|
|
339
|
+
class="group"
|
|
340
|
+
[attr.aria-label]="'Sort by ' + label()"
|
|
341
|
+
[attr.aria-sort]="computedAriaSortAttribute()"
|
|
342
|
+
>
|
|
343
|
+
<st-icon
|
|
344
|
+
class="transition-transform duration-300 ease-in-out group-aria-[sort=ascending]:rotate-0 group-aria-[sort=descending]:rotate-180"
|
|
345
|
+
[icon]="currentSortIcon()"
|
|
346
|
+
[size]="iconSize()"
|
|
347
|
+
></st-icon>
|
|
348
|
+
</st-button>
|
|
349
|
+
}
|
|
350
|
+
</div>
|
|
351
|
+
`,
|
|
352
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
353
|
+
}]
|
|
354
|
+
}] });
|
|
355
|
+
/**
|
|
356
|
+
* Sub-component toggle cell for controlling custom sub-component visibility
|
|
357
|
+
*/
|
|
358
|
+
class DataTableSubToggleCellComponent {
|
|
359
|
+
/**
|
|
360
|
+
* The table row instance
|
|
361
|
+
*/
|
|
362
|
+
row = input.required();
|
|
363
|
+
/**
|
|
364
|
+
* Whether the sub-component is currently expanded
|
|
365
|
+
*/
|
|
366
|
+
isExpanded = input(false);
|
|
367
|
+
/**
|
|
368
|
+
* Whether this row can toggle a sub-component
|
|
369
|
+
*/
|
|
370
|
+
canToggleSubComponent = input(false);
|
|
371
|
+
/**
|
|
372
|
+
* Event emitted when toggle is clicked
|
|
373
|
+
*/
|
|
374
|
+
toggled = output();
|
|
375
|
+
/** @internal */
|
|
376
|
+
expandIcon = matKeyboardArrowDown;
|
|
377
|
+
/** @internal */
|
|
378
|
+
infoIcon = matInfo;
|
|
379
|
+
/**
|
|
380
|
+
* @internal
|
|
381
|
+
* Handles the toggle click
|
|
382
|
+
*/
|
|
383
|
+
handleToggle() {
|
|
384
|
+
this.toggled.emit(this.row().id);
|
|
385
|
+
}
|
|
386
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableSubToggleCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
387
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.0", type: DataTableSubToggleCellComponent, isStandalone: true, selector: "st-data-table-sub-toggle-cell", inputs: { row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null }, isExpanded: { classPropertyName: "isExpanded", publicName: "isExpanded", isSignal: true, isRequired: false, transformFunction: null }, canToggleSubComponent: { classPropertyName: "canToggleSubComponent", publicName: "canToggleSubComponent", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { toggled: "toggled" }, ngImport: i0, template: `
|
|
388
|
+
@if (canToggleSubComponent()) {
|
|
389
|
+
<st-button
|
|
390
|
+
variant="secondary"
|
|
391
|
+
size="xs"
|
|
392
|
+
[circle]="true"
|
|
393
|
+
[ghost]="true"
|
|
394
|
+
class="group"
|
|
395
|
+
(click)="handleToggle(); $event.stopPropagation()"
|
|
396
|
+
[attr.aria-expanded]="isExpanded()"
|
|
397
|
+
[attr.title]="isExpanded() ? 'Hide Details' : 'Show Details'"
|
|
398
|
+
>
|
|
399
|
+
<st-icon
|
|
400
|
+
class="transition-transform duration-300 ease-in-out group-aria-[expanded=false]:rotate-0 group-aria-[expanded=true]:rotate-180"
|
|
401
|
+
[icon]="expandIcon"
|
|
402
|
+
size="sm"
|
|
403
|
+
></st-icon>
|
|
404
|
+
<span class="sr-only">{{ isExpanded() ? 'Hide Details' : 'Show Details' }}</span>
|
|
405
|
+
</st-button>
|
|
406
|
+
} @else {
|
|
407
|
+
<!-- Display an informational icon if a sub-component cannot be shown for this row -->
|
|
408
|
+
<st-button
|
|
409
|
+
variant="secondary"
|
|
410
|
+
size="xs"
|
|
411
|
+
[circle]="true"
|
|
412
|
+
[ghost]="true"
|
|
413
|
+
[attr.aria-expanded]="isExpanded()"
|
|
414
|
+
[attr.title]="isExpanded() ? 'Hide Details' : 'Show Details'"
|
|
415
|
+
[disabled]="true"
|
|
416
|
+
>
|
|
417
|
+
<st-icon [icon]="infoIcon" size="sm"></st-icon>
|
|
418
|
+
<span class="sr-only">{{ isExpanded() ? 'Hide Details' : 'Show Details' }}</span>
|
|
419
|
+
</st-button>
|
|
420
|
+
}
|
|
421
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "icon"] }, { kind: "component", type: ButtonComponent, selector: "st-button", inputs: ["variant", "ghost", "outline", "link", "soft", "dash", "wide", "circle", "square", "glass", "block", "loader", "size", "shadow", "focusable", "icon", "iconPosition", "type", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
422
|
+
}
|
|
423
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableSubToggleCellComponent, decorators: [{
|
|
424
|
+
type: Component,
|
|
425
|
+
args: [{
|
|
426
|
+
standalone: true,
|
|
427
|
+
selector: 'st-data-table-sub-toggle-cell',
|
|
428
|
+
imports: [CommonModule, IconComponent, ButtonComponent],
|
|
429
|
+
template: `
|
|
430
|
+
@if (canToggleSubComponent()) {
|
|
431
|
+
<st-button
|
|
432
|
+
variant="secondary"
|
|
433
|
+
size="xs"
|
|
434
|
+
[circle]="true"
|
|
435
|
+
[ghost]="true"
|
|
436
|
+
class="group"
|
|
437
|
+
(click)="handleToggle(); $event.stopPropagation()"
|
|
438
|
+
[attr.aria-expanded]="isExpanded()"
|
|
439
|
+
[attr.title]="isExpanded() ? 'Hide Details' : 'Show Details'"
|
|
440
|
+
>
|
|
441
|
+
<st-icon
|
|
442
|
+
class="transition-transform duration-300 ease-in-out group-aria-[expanded=false]:rotate-0 group-aria-[expanded=true]:rotate-180"
|
|
443
|
+
[icon]="expandIcon"
|
|
444
|
+
size="sm"
|
|
445
|
+
></st-icon>
|
|
446
|
+
<span class="sr-only">{{ isExpanded() ? 'Hide Details' : 'Show Details' }}</span>
|
|
447
|
+
</st-button>
|
|
448
|
+
} @else {
|
|
449
|
+
<!-- Display an informational icon if a sub-component cannot be shown for this row -->
|
|
450
|
+
<st-button
|
|
451
|
+
variant="secondary"
|
|
452
|
+
size="xs"
|
|
453
|
+
[circle]="true"
|
|
454
|
+
[ghost]="true"
|
|
455
|
+
[attr.aria-expanded]="isExpanded()"
|
|
456
|
+
[attr.title]="isExpanded() ? 'Hide Details' : 'Show Details'"
|
|
457
|
+
[disabled]="true"
|
|
458
|
+
>
|
|
459
|
+
<st-icon [icon]="infoIcon" size="sm"></st-icon>
|
|
460
|
+
<span class="sr-only">{{ isExpanded() ? 'Hide Details' : 'Show Details' }}</span>
|
|
461
|
+
</st-button>
|
|
462
|
+
}
|
|
463
|
+
`,
|
|
464
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
465
|
+
}]
|
|
466
|
+
}] });
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Header checkbox component for selecting/deselecting all rows on current page
|
|
470
|
+
*/
|
|
471
|
+
class DataTableHeadSelectionComponent {
|
|
472
|
+
/**
|
|
473
|
+
* TanStack Table context injected by flexRender
|
|
474
|
+
*/
|
|
475
|
+
context = injectFlexRenderContext();
|
|
476
|
+
/**
|
|
477
|
+
* Data table context for size synchronization
|
|
478
|
+
*/
|
|
479
|
+
dataTableContext = inject(DataTableContextService);
|
|
480
|
+
/**
|
|
481
|
+
* Computed checkbox size based on table size
|
|
482
|
+
*/
|
|
483
|
+
checkboxSize = computed(() => {
|
|
484
|
+
const tableSize = this.dataTableContext.size();
|
|
485
|
+
switch (tableSize) {
|
|
486
|
+
case 'xs':
|
|
487
|
+
return 'xs';
|
|
488
|
+
case 'sm':
|
|
489
|
+
return 'sm';
|
|
490
|
+
case 'md':
|
|
491
|
+
return 'md';
|
|
492
|
+
case 'lg':
|
|
493
|
+
return 'lg';
|
|
494
|
+
case 'xl':
|
|
495
|
+
return 'lg';
|
|
496
|
+
default:
|
|
497
|
+
return 'sm';
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableHeadSelectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
501
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.0", type: DataTableHeadSelectionComponent, isStandalone: true, selector: "st-data-table-head-selection", ngImport: i0, template: `
|
|
502
|
+
<st-checkbox
|
|
503
|
+
[value]="context.table.getIsAllPageRowsSelected()"
|
|
504
|
+
(valueUpdated)="context.table.toggleAllPageRowsSelected()"
|
|
505
|
+
[size]="checkboxSize()"
|
|
506
|
+
></st-checkbox>
|
|
507
|
+
`, isInline: true, dependencies: [{ kind: "component", type: CheckboxComponent, selector: "st-checkbox", inputs: ["variant", "size", "label", "name", "value", "disabled"], outputs: ["valueChange", "valueUpdated", "disabledChange"] }, { kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
508
|
+
}
|
|
509
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableHeadSelectionComponent, decorators: [{
|
|
510
|
+
type: Component,
|
|
511
|
+
args: [{
|
|
512
|
+
standalone: true,
|
|
513
|
+
selector: 'st-data-table-head-selection',
|
|
514
|
+
imports: [CheckboxComponent, CommonModule],
|
|
515
|
+
template: `
|
|
516
|
+
<st-checkbox
|
|
517
|
+
[value]="context.table.getIsAllPageRowsSelected()"
|
|
518
|
+
(valueUpdated)="context.table.toggleAllPageRowsSelected()"
|
|
519
|
+
[size]="checkboxSize()"
|
|
520
|
+
></st-checkbox>
|
|
521
|
+
`,
|
|
522
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
523
|
+
}]
|
|
524
|
+
}] });
|
|
525
|
+
/**
|
|
526
|
+
* Row checkbox component for individual row selection
|
|
527
|
+
*/
|
|
528
|
+
class DataTableRowSelectionComponent {
|
|
529
|
+
/**
|
|
530
|
+
* TanStack Table context injected by flexRender
|
|
531
|
+
*/
|
|
532
|
+
context = injectFlexRenderContext();
|
|
533
|
+
/**
|
|
534
|
+
* Data table context for size synchronization
|
|
535
|
+
*/
|
|
536
|
+
dataTableContext = inject(DataTableContextService);
|
|
537
|
+
/**
|
|
538
|
+
* Computed checkbox size based on table size
|
|
539
|
+
*/
|
|
540
|
+
checkboxSize = computed(() => {
|
|
541
|
+
const tableSize = this.dataTableContext.size();
|
|
542
|
+
switch (tableSize) {
|
|
543
|
+
case 'xs':
|
|
544
|
+
return 'xs';
|
|
545
|
+
case 'sm':
|
|
546
|
+
return 'sm';
|
|
547
|
+
case 'md':
|
|
548
|
+
return 'md';
|
|
549
|
+
case 'lg':
|
|
550
|
+
return 'lg';
|
|
551
|
+
case 'xl':
|
|
552
|
+
return 'lg';
|
|
553
|
+
default:
|
|
554
|
+
return 'sm';
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableRowSelectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
558
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.0", type: DataTableRowSelectionComponent, isStandalone: true, selector: "st-data-table-row-selection", ngImport: i0, template: `
|
|
559
|
+
<st-checkbox
|
|
560
|
+
[value]="context.row.getIsSelected()"
|
|
561
|
+
[disabled]="!context.row.getCanSelect()"
|
|
562
|
+
(valueUpdated)="context.row.toggleSelected()"
|
|
563
|
+
[size]="checkboxSize()"
|
|
564
|
+
></st-checkbox>
|
|
565
|
+
`, isInline: true, dependencies: [{ kind: "component", type: CheckboxComponent, selector: "st-checkbox", inputs: ["variant", "size", "label", "name", "value", "disabled"], outputs: ["valueChange", "valueUpdated", "disabledChange"] }, { kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
566
|
+
}
|
|
567
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableRowSelectionComponent, decorators: [{
|
|
568
|
+
type: Component,
|
|
569
|
+
args: [{
|
|
570
|
+
standalone: true,
|
|
571
|
+
selector: 'st-data-table-row-selection',
|
|
572
|
+
imports: [CheckboxComponent, CommonModule],
|
|
573
|
+
template: `
|
|
574
|
+
<st-checkbox
|
|
575
|
+
[value]="context.row.getIsSelected()"
|
|
576
|
+
[disabled]="!context.row.getCanSelect()"
|
|
577
|
+
(valueUpdated)="context.row.toggleSelected()"
|
|
578
|
+
[size]="checkboxSize()"
|
|
579
|
+
></st-checkbox>
|
|
580
|
+
`,
|
|
581
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
582
|
+
}]
|
|
583
|
+
}] });
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Sortable header component for data table columns
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* ```typescript
|
|
590
|
+
* flexRenderComponent(DataTableSortableHeaderComponent, {
|
|
591
|
+
* inputs: {
|
|
592
|
+
* label: 'Column Name',
|
|
593
|
+
* sortState: column.getIsSorted(),
|
|
594
|
+
* },
|
|
595
|
+
* outputs: {
|
|
596
|
+
* sortToggle: () => column.toggleSorting(),
|
|
597
|
+
* },
|
|
598
|
+
* })
|
|
599
|
+
* ```
|
|
600
|
+
*/
|
|
601
|
+
class DataTableSortableHeaderComponent {
|
|
602
|
+
dataTableContext = inject(DataTableContextService);
|
|
603
|
+
/**
|
|
604
|
+
* Display label for the column
|
|
605
|
+
*/
|
|
606
|
+
label = input.required();
|
|
607
|
+
/**
|
|
608
|
+
* Current sort state of the column
|
|
609
|
+
*/
|
|
610
|
+
sortState = input(false);
|
|
611
|
+
/**
|
|
612
|
+
* Event emitted when sort toggle is requested
|
|
613
|
+
*/
|
|
614
|
+
sortToggle = output();
|
|
615
|
+
/** @internal */
|
|
616
|
+
iconDefaultSort = matSwapVert;
|
|
617
|
+
/** @internal */
|
|
618
|
+
iconAscending = matArrowUpward;
|
|
619
|
+
/**
|
|
620
|
+
* @internal
|
|
621
|
+
* Computes button size based on data table size
|
|
622
|
+
*/
|
|
623
|
+
buttonSize = computed(() => {
|
|
624
|
+
switch (this.dataTableContext.size()) {
|
|
625
|
+
case 'xs':
|
|
626
|
+
return 'xs';
|
|
627
|
+
case 'sm':
|
|
628
|
+
return 'xs';
|
|
629
|
+
case 'md':
|
|
630
|
+
return 'sm';
|
|
631
|
+
case 'lg':
|
|
632
|
+
return 'sm';
|
|
633
|
+
case 'xl':
|
|
634
|
+
return 'md';
|
|
635
|
+
default:
|
|
636
|
+
return 'xs';
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
/**
|
|
640
|
+
* @internal
|
|
641
|
+
* Computes icon size based on data table size
|
|
642
|
+
*/
|
|
643
|
+
iconSize = computed(() => {
|
|
644
|
+
switch (this.dataTableContext.size()) {
|
|
645
|
+
case 'xs':
|
|
646
|
+
return 'xs';
|
|
647
|
+
case 'sm':
|
|
648
|
+
return 'xs';
|
|
649
|
+
case 'md':
|
|
650
|
+
return 'sm';
|
|
651
|
+
case 'lg':
|
|
652
|
+
return 'sm';
|
|
653
|
+
case 'xl':
|
|
654
|
+
return 'md';
|
|
655
|
+
default:
|
|
656
|
+
return 'xs';
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
/**
|
|
660
|
+
* @internal
|
|
661
|
+
* Computes the appropriate icon based on current sort state
|
|
662
|
+
*/
|
|
663
|
+
currentSortIcon = computed(() => {
|
|
664
|
+
switch (this.sortState()) {
|
|
665
|
+
case 'asc':
|
|
666
|
+
case 'desc':
|
|
667
|
+
return this.iconAscending;
|
|
668
|
+
default:
|
|
669
|
+
return this.iconDefaultSort;
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
/**
|
|
673
|
+
* @internal
|
|
674
|
+
* Computes aria-sort attribute for accessibility
|
|
675
|
+
*/
|
|
676
|
+
computedAriaSortAttribute = computed(() => {
|
|
677
|
+
switch (this.sortState()) {
|
|
678
|
+
case 'asc':
|
|
679
|
+
return 'ascending';
|
|
680
|
+
case 'desc':
|
|
681
|
+
return 'descending';
|
|
682
|
+
default:
|
|
683
|
+
return 'none';
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableSortableHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
687
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.0", type: DataTableSortableHeaderComponent, isStandalone: true, selector: "st-data-table-sortable-header", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, sortState: { classPropertyName: "sortState", publicName: "sortState", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sortToggle: "sortToggle" }, ngImport: i0, template: `
|
|
688
|
+
<div class="inline-flex items-center gap-1">
|
|
689
|
+
<span class="font-bold">{{ label() }}</span>
|
|
690
|
+
<st-button
|
|
691
|
+
variant="secondary"
|
|
692
|
+
[size]="buttonSize()"
|
|
693
|
+
[square]="true"
|
|
694
|
+
[ghost]="true"
|
|
695
|
+
(click)="sortToggle.emit(); $event.stopPropagation()"
|
|
696
|
+
class="group"
|
|
697
|
+
[attr.aria-label]="'Sort by ' + label()"
|
|
698
|
+
[attr.aria-sort]="computedAriaSortAttribute()"
|
|
699
|
+
>
|
|
700
|
+
<st-icon
|
|
701
|
+
class="transition-transform duration-300 ease-in-out group-aria-[sort=ascending]:rotate-0 group-aria-[sort=descending]:rotate-180"
|
|
702
|
+
[icon]="currentSortIcon()"
|
|
703
|
+
[size]="iconSize()"
|
|
704
|
+
></st-icon>
|
|
705
|
+
</st-button>
|
|
706
|
+
</div>
|
|
707
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "icon"] }, { kind: "component", type: ButtonComponent, selector: "st-button", inputs: ["variant", "ghost", "outline", "link", "soft", "dash", "wide", "circle", "square", "glass", "block", "loader", "size", "shadow", "focusable", "icon", "iconPosition", "type", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
708
|
+
}
|
|
709
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableSortableHeaderComponent, decorators: [{
|
|
710
|
+
type: Component,
|
|
711
|
+
args: [{
|
|
712
|
+
standalone: true,
|
|
713
|
+
selector: 'st-data-table-sortable-header',
|
|
714
|
+
imports: [CommonModule, IconComponent, ButtonComponent],
|
|
715
|
+
template: `
|
|
716
|
+
<div class="inline-flex items-center gap-1">
|
|
717
|
+
<span class="font-bold">{{ label() }}</span>
|
|
718
|
+
<st-button
|
|
719
|
+
variant="secondary"
|
|
720
|
+
[size]="buttonSize()"
|
|
721
|
+
[square]="true"
|
|
722
|
+
[ghost]="true"
|
|
723
|
+
(click)="sortToggle.emit(); $event.stopPropagation()"
|
|
724
|
+
class="group"
|
|
725
|
+
[attr.aria-label]="'Sort by ' + label()"
|
|
726
|
+
[attr.aria-sort]="computedAriaSortAttribute()"
|
|
727
|
+
>
|
|
728
|
+
<st-icon
|
|
729
|
+
class="transition-transform duration-300 ease-in-out group-aria-[sort=ascending]:rotate-0 group-aria-[sort=descending]:rotate-180"
|
|
730
|
+
[icon]="currentSortIcon()"
|
|
731
|
+
[size]="iconSize()"
|
|
732
|
+
></st-icon>
|
|
733
|
+
</st-button>
|
|
734
|
+
</div>
|
|
735
|
+
`,
|
|
736
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
737
|
+
}]
|
|
738
|
+
}] });
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* @internal
|
|
742
|
+
* Generates data table classes with size and height variants
|
|
743
|
+
*/
|
|
744
|
+
const dataTableContent = cva([
|
|
745
|
+
'table',
|
|
746
|
+
'relative',
|
|
747
|
+
'text-pretty',
|
|
748
|
+
'[&_tbody]:font-body',
|
|
749
|
+
'[&_thead]:font-heading',
|
|
750
|
+
'[&_thead]:leading-normal',
|
|
751
|
+
'[&_tbody]:leading-tight',
|
|
752
|
+
'[&_th]:bg-neutral [&_th]:text-neutral-content',
|
|
753
|
+
'[&_th]:px-4',
|
|
754
|
+
'[&_td]:px-4',
|
|
755
|
+
'[&_tbody_tr]:border-transparent',
|
|
756
|
+
'rounded-t-box',
|
|
757
|
+
'[&_tbody_tr]:border-transparent',
|
|
758
|
+
], {
|
|
759
|
+
variants: {
|
|
760
|
+
size: {
|
|
761
|
+
xs: ['table-xs'],
|
|
762
|
+
sm: ['table-sm'],
|
|
763
|
+
md: ['table-md'],
|
|
764
|
+
lg: ['table-lg'],
|
|
765
|
+
xl: ['table-xl'],
|
|
766
|
+
},
|
|
767
|
+
},
|
|
768
|
+
defaultVariants: {
|
|
769
|
+
size: 'sm',
|
|
770
|
+
},
|
|
771
|
+
});
|
|
772
|
+
/**
|
|
773
|
+
* A styled container component for data tables - provides styling shell only
|
|
774
|
+
*
|
|
775
|
+
* This component is similar to st-table but with additional data table specific styling.
|
|
776
|
+
* Users should compose their own table structure using TanStack Table and SDK components.
|
|
777
|
+
*
|
|
778
|
+
* @example
|
|
779
|
+
* ```html
|
|
780
|
+
* <st-data-table-container size="md" height="lg">
|
|
781
|
+
* <table>
|
|
782
|
+
* <thead>
|
|
783
|
+
* <tr>
|
|
784
|
+
* <th><st-data-table-sortable-header>Name</st-data-table-sortable-header></th>
|
|
785
|
+
* </tr>
|
|
786
|
+
* </thead>
|
|
787
|
+
* <tbody>
|
|
788
|
+
* <tr>
|
|
789
|
+
* <td>John Doe</td>
|
|
790
|
+
* </tr>
|
|
791
|
+
* </tbody>
|
|
792
|
+
* </table>
|
|
793
|
+
* </st-data-table-container>
|
|
794
|
+
* ```
|
|
795
|
+
*/
|
|
796
|
+
class DataTableContainerComponent {
|
|
797
|
+
translationService = inject(TranslateService);
|
|
798
|
+
dataTableContext = inject(DataTableContextService);
|
|
799
|
+
// Icon references for template
|
|
800
|
+
noDataIcon = heroDocumentText;
|
|
801
|
+
noResultsIcon = heroXCircle;
|
|
802
|
+
/**
|
|
803
|
+
* Table size variant
|
|
804
|
+
* @defaultValue 'sm'
|
|
805
|
+
*/
|
|
806
|
+
size = input('sm');
|
|
807
|
+
constructor() {
|
|
808
|
+
// Update context when size changes
|
|
809
|
+
effect(() => {
|
|
810
|
+
this.dataTableContext.setSize(this.size());
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Enable sticky header row
|
|
815
|
+
* @defaultValue false
|
|
816
|
+
*/
|
|
817
|
+
pinRows = input(false);
|
|
818
|
+
/**
|
|
819
|
+
* Enable sticky first column
|
|
820
|
+
* @defaultValue false
|
|
821
|
+
*/
|
|
822
|
+
pinColumns = input(false);
|
|
823
|
+
/**
|
|
824
|
+
* Apply zebra-striping to rows
|
|
825
|
+
* @defaultValue false
|
|
826
|
+
*/
|
|
827
|
+
zebra = input(false);
|
|
828
|
+
/**
|
|
829
|
+
* Pagination control display variant
|
|
830
|
+
* @defaultValue 'default'
|
|
831
|
+
*/
|
|
832
|
+
paginatorType = input('default');
|
|
833
|
+
/**
|
|
834
|
+
* Total number of items across all pages
|
|
835
|
+
* @defaultValue 0
|
|
836
|
+
*/
|
|
837
|
+
totalItems = input(0);
|
|
838
|
+
/**
|
|
839
|
+
* Pagination configuration
|
|
840
|
+
* @defaultValue { id: 'paginator', currentPage: 1, itemsPerPage: 10, search: '', sortColumn: null, sortDirection: null, filters: {} }
|
|
841
|
+
*/
|
|
842
|
+
pagination = input({
|
|
843
|
+
id: 'paginator',
|
|
844
|
+
currentPage: 1,
|
|
845
|
+
itemsPerPage: 10,
|
|
846
|
+
search: '',
|
|
847
|
+
sortColumn: null,
|
|
848
|
+
sortDirection: null,
|
|
849
|
+
filters: {},
|
|
850
|
+
});
|
|
851
|
+
/**
|
|
852
|
+
* Maximum number of pagination buttons to display
|
|
853
|
+
* @defaultValue 4
|
|
854
|
+
*/
|
|
855
|
+
maxSize = input(4);
|
|
856
|
+
/** Event emitted when page changes */
|
|
857
|
+
pageChanged = output();
|
|
858
|
+
/** Event emitted when page size changes */
|
|
859
|
+
pageSizeChanged = output();
|
|
860
|
+
ENTRIES = [5, 10, 20, 50, 100];
|
|
861
|
+
entriesPerPageOptions = computed(() => {
|
|
862
|
+
return this.ENTRIES.map((n) => {
|
|
863
|
+
const translatedText = this.translationService.instant('sdk.dataTable.perPage', { count: n });
|
|
864
|
+
// Fallback if translation fails
|
|
865
|
+
const fallbackText = `${n} / page`;
|
|
866
|
+
return {
|
|
867
|
+
value: n,
|
|
868
|
+
text: translatedText && translatedText !== 'sdk.dataTable.perPage' ? translatedText : fallbackText,
|
|
869
|
+
};
|
|
870
|
+
});
|
|
871
|
+
});
|
|
872
|
+
/**
|
|
873
|
+
* Computed total number of pages for the internal paginator.
|
|
874
|
+
* Calculated from totalItems and itemsPerPage.
|
|
875
|
+
*/
|
|
876
|
+
totalPages = computed(() => {
|
|
877
|
+
const itemsPerPage = this.pagination().itemsPerPage || 1;
|
|
878
|
+
const totalItems = this.totalItems();
|
|
879
|
+
return Math.ceil(totalItems / itemsPerPage);
|
|
880
|
+
});
|
|
881
|
+
/**
|
|
882
|
+
* Computed display range for current page entries
|
|
883
|
+
* @example "1-10" of 100 entries
|
|
884
|
+
*/
|
|
885
|
+
paginationRange = computed(() => {
|
|
886
|
+
const start = this.pagination().currentPage * this.pagination().itemsPerPage - this.pagination().itemsPerPage + 1;
|
|
887
|
+
const end = Math.min(this.pagination().currentPage * this.pagination().itemsPerPage, this.totalItems());
|
|
888
|
+
return `${start}-${end}`;
|
|
889
|
+
});
|
|
890
|
+
/**
|
|
891
|
+
* Function to determine if any filters are currently active
|
|
892
|
+
* This allows the parent component to define what constitutes an "active filter"
|
|
893
|
+
*/
|
|
894
|
+
hasActiveFiltersCallback = input();
|
|
895
|
+
/**
|
|
896
|
+
* Computed boolean indicating if any filters are currently active
|
|
897
|
+
*/
|
|
898
|
+
hasActiveFilters = computed(() => {
|
|
899
|
+
const callback = this.hasActiveFiltersCallback();
|
|
900
|
+
if (callback) {
|
|
901
|
+
return callback();
|
|
902
|
+
}
|
|
903
|
+
// Fallback: check for basic search term only
|
|
904
|
+
const pagination = this.pagination();
|
|
905
|
+
return !!pagination.search?.trim();
|
|
906
|
+
});
|
|
907
|
+
/**
|
|
908
|
+
* Computed boolean indicating if we should show "no results" vs "no data"
|
|
909
|
+
*/
|
|
910
|
+
hasNoResults = computed(() => {
|
|
911
|
+
return this.totalItems() === 0 && this.hasActiveFilters();
|
|
912
|
+
});
|
|
913
|
+
/**
|
|
914
|
+
* Computed boolean indicating if we should show "no data" state
|
|
915
|
+
*/
|
|
916
|
+
hasNoData = computed(() => {
|
|
917
|
+
return this.totalItems() === 0 && !this.hasActiveFilters();
|
|
918
|
+
});
|
|
919
|
+
/**
|
|
920
|
+
* Handles page navigation events
|
|
921
|
+
* @param page - New page number
|
|
922
|
+
*/
|
|
923
|
+
handlePageChange(page) {
|
|
924
|
+
this.pageChanged.emit(page);
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Handles page size changes
|
|
928
|
+
* @param size - New items per page value
|
|
929
|
+
*/
|
|
930
|
+
handlePageSizeChange(size) {
|
|
931
|
+
let resolved;
|
|
932
|
+
if (typeof size === 'number') {
|
|
933
|
+
resolved = size;
|
|
934
|
+
}
|
|
935
|
+
else if (size && typeof size === 'object' && 'value' in size) {
|
|
936
|
+
const v = size['value'];
|
|
937
|
+
const safeStringify = (x) => (['string', 'number', 'boolean'].includes(typeof x) ? String(x) : '0');
|
|
938
|
+
resolved = typeof v === 'number' ? v : Number(safeStringify(v));
|
|
939
|
+
}
|
|
940
|
+
else {
|
|
941
|
+
const safeStringify = (x) => (['string', 'number', 'boolean'].includes(typeof x) ? String(x) : '0');
|
|
942
|
+
resolved = Number(safeStringify(size)) || undefined;
|
|
943
|
+
}
|
|
944
|
+
const s = Number(resolved || 1);
|
|
945
|
+
this.pageSizeChanged.emit(s);
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* @internal
|
|
949
|
+
* Computes typography variant for paginator text based on table size
|
|
950
|
+
*/
|
|
951
|
+
paginatorTextSize = computed(() => {
|
|
952
|
+
switch (this.size()) {
|
|
953
|
+
case 'xs':
|
|
954
|
+
return 'body-xxs';
|
|
955
|
+
case 'sm':
|
|
956
|
+
return 'body-xs';
|
|
957
|
+
case 'md':
|
|
958
|
+
return 'body-sm';
|
|
959
|
+
case 'lg':
|
|
960
|
+
return 'body';
|
|
961
|
+
case 'xl':
|
|
962
|
+
return 'body';
|
|
963
|
+
default:
|
|
964
|
+
return 'body-xs';
|
|
965
|
+
}
|
|
966
|
+
});
|
|
967
|
+
/**
|
|
968
|
+
* @internal
|
|
969
|
+
* Computes table element classes based on current configuration
|
|
970
|
+
*/
|
|
971
|
+
tableClass = computed(() => cn(dataTableContent({
|
|
972
|
+
size: this.size(),
|
|
973
|
+
}), {
|
|
974
|
+
'table-pin-rows': this.pinRows(),
|
|
975
|
+
'table-pin-cols': this.pinColumns(),
|
|
976
|
+
'table-zebra': this.zebra(),
|
|
977
|
+
}));
|
|
978
|
+
/**
|
|
979
|
+
* @internal
|
|
980
|
+
* Computes table container classes based on height input
|
|
981
|
+
*/
|
|
982
|
+
tableContainerClass = computed(() => cn('w-full flex-grow'));
|
|
983
|
+
/**
|
|
984
|
+
* @internal
|
|
985
|
+
* Computes outer container classes based on size
|
|
986
|
+
*/
|
|
987
|
+
containerClass = computed(() => cn('rounded-box border-neutral flex flex-col overflow-x-auto border border-solid gap-3 @container'));
|
|
988
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
989
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.0", type: DataTableContainerComponent, isStandalone: true, selector: "st-data-table", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, pinRows: { classPropertyName: "pinRows", publicName: "pinRows", isSignal: true, isRequired: false, transformFunction: null }, pinColumns: { classPropertyName: "pinColumns", publicName: "pinColumns", isSignal: true, isRequired: false, transformFunction: null }, zebra: { classPropertyName: "zebra", publicName: "zebra", isSignal: true, isRequired: false, transformFunction: null }, paginatorType: { classPropertyName: "paginatorType", publicName: "paginatorType", isSignal: true, isRequired: false, transformFunction: null }, totalItems: { classPropertyName: "totalItems", publicName: "totalItems", isSignal: true, isRequired: false, transformFunction: null }, pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: false, transformFunction: null }, maxSize: { classPropertyName: "maxSize", publicName: "maxSize", isSignal: true, isRequired: false, transformFunction: null }, hasActiveFiltersCallback: { classPropertyName: "hasActiveFiltersCallback", publicName: "hasActiveFiltersCallback", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { pageChanged: "pageChanged", pageSizeChanged: "pageSizeChanged" }, providers: [DataTableContextService], ngImport: i0, template: "<div [class]=\"containerClass()\">\n\t<!-- Table container -->\n\t<div [class]=\"tableContainerClass()\">\n\t\t<div class=\"w-full flex-grow overflow-x-auto\">\n\t\t\t@if (hasNoData()) {\n\t\t\t\t<!-- No data state -->\n\t\t\t\t<div class=\"flex flex-col items-center justify-center py-12 text-center\">\n\t\t\t\t\t<div class=\"text-base-content/40 mb-3\">\n\t\t\t\t\t\t<st-icon [icon]=\"noDataIcon\" size=\"lg\" color=\"base-content\" class=\"mx-auto opacity-40\"></st-icon>\n\t\t\t\t\t</div>\n\t\t\t\t\t<h3 typography tyVariant=\"h6\" class=\"text-base-content/60 mb-2\">{{ 'sdk.dataTable.noData.title' | translate }}</h3>\n\t\t\t\t\t<p typography tyVariant=\"body-sm\" class=\"text-base-content/40\">{{ 'sdk.dataTable.noData.message' | translate }}</p>\n\t\t\t\t</div>\n\t\t\t} @else if (hasNoResults()) {\n\t\t\t\t<!-- No results from filters state -->\n\t\t\t\t<div class=\"flex flex-col items-center justify-center py-12 text-center\">\n\t\t\t\t\t<div class=\"text-base-content/40 mb-3\">\n\t\t\t\t\t\t<st-icon [icon]=\"noResultsIcon\" size=\"xl\" color=\"base-content\" class=\"mx-auto opacity-40\"></st-icon>\n\t\t\t\t\t</div>\n\t\t\t\t\t<h3 typography tyVariant=\"h6\" class=\"text-base-content/60 mb-2\">{{ 'sdk.dataTable.noResults.title' | translate }}</h3>\n\t\t\t\t\t<p typography tyVariant=\"body-sm\" class=\"text-base-content/40\">{{ 'sdk.dataTable.noResults.message' | translate }}</p>\n\t\t\t\t</div>\n\t\t\t} @else {\n\t\t\t\t<table [class]=\"tableClass()\">\n\t\t\t\t\t<ng-content></ng-content>\n\t\t\t\t</table>\n\t\t\t}\n\t\t</div>\n\t</div>\n\n\t<!-- Pagination from showcase -->\n\t<div class=\"@container flex w-full flex-col gap-4 overflow-x-auto pb-3\">\n\t\t<!-- Divider -->\n\t\t<div class=\"divider divider-neutral my-0 h-[0.0625rem] px-4 before:h-[0.0625rem] after:h-[0.0625rem]\"></div>\n\t\t<!-- Paginator Container -->\n\t\t<div\n\t\t\tclass=\"flex flex-col items-center gap-4 px-4 @2xl:flex-row @2xl:justify-between @2xl:gap-2 @4xl:grid @4xl:grid-cols-[auto_1fr_auto] @4xl:items-center\"\n\t\t>\n\t\t\t<!-- Entries range text -->\n\t\t\t<div class=\"flex items-center justify-end\">\n\t\t\t\t<span typography [tyVariant]=\"paginatorTextSize()\" [tyColor]=\"'inherit'\">{{\n\t\t\t\t\t'sdk.dataTable.entriesRange' | translate: { range: paginationRange(), total: totalItems() }\n\t\t\t\t}}</span>\n\t\t\t</div>\n\n\t\t\t<!-- Paginator -->\n\t\t\t<div class=\"flex justify-center\">\n\t\t\t\t<st-paginator\n\t\t\t\t\t[pages]=\"totalPages()\"\n\t\t\t\t\t[currentPage]=\"pagination().currentPage\"\n\t\t\t\t\t[maxSize]=\"maxSize()\"\n\t\t\t\t\ttype=\"default\"\n\t\t\t\t\t(pageChanged)=\"handlePageChange($event)\"\n\t\t\t\t></st-paginator>\n\t\t\t</div>\n\n\t\t\t<!-- Entries per page dropdown -->\n\t\t\t<st-select\n\t\t\t\t[options]=\"entriesPerPageOptions()\"\n\t\t\t\t[value]=\"pagination().itemsPerPage\"\n\t\t\t\tvalueKey=\"value\"\n\t\t\t\tdisplayKey=\"text\"\n\t\t\t\tsize=\"sm\"\n\t\t\t\t(valueUpdated)=\"handlePageSizeChange($event)\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\t[allowClear]=\"false\"\n\t\t\t></st-select>\n\t\t</div>\n\t</div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: PaginatorComponent, selector: "st-paginator", inputs: ["paginatorId", "maxSize", "type", "pages", "currentPage"], outputs: ["pageChanged", "currentPageChange"] }, { kind: "directive", type: TypographyDirective, selector: "[typography]", inputs: ["tyVariant", "tyColor", "tyFontWeight", "tyTextOverflow"] }, { kind: "component", type: SelectComponent, selector: "st-select", inputs: ["variant", "size", "ghost", "name", "placeholder", "label", "value", "options", "displayKey", "valueKey", "allowClear", "parentForm", "formControlName", "disabled"], outputs: ["valueChange", "disabledChange", "blurred", "valueUpdated"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
990
|
+
}
|
|
991
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableContainerComponent, decorators: [{
|
|
992
|
+
type: Component,
|
|
993
|
+
args: [{ selector: 'st-data-table', imports: [CommonModule, PaginatorComponent, TypographyDirective, SelectComponent, TranslatePipe, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, providers: [DataTableContextService], template: "<div [class]=\"containerClass()\">\n\t<!-- Table container -->\n\t<div [class]=\"tableContainerClass()\">\n\t\t<div class=\"w-full flex-grow overflow-x-auto\">\n\t\t\t@if (hasNoData()) {\n\t\t\t\t<!-- No data state -->\n\t\t\t\t<div class=\"flex flex-col items-center justify-center py-12 text-center\">\n\t\t\t\t\t<div class=\"text-base-content/40 mb-3\">\n\t\t\t\t\t\t<st-icon [icon]=\"noDataIcon\" size=\"lg\" color=\"base-content\" class=\"mx-auto opacity-40\"></st-icon>\n\t\t\t\t\t</div>\n\t\t\t\t\t<h3 typography tyVariant=\"h6\" class=\"text-base-content/60 mb-2\">{{ 'sdk.dataTable.noData.title' | translate }}</h3>\n\t\t\t\t\t<p typography tyVariant=\"body-sm\" class=\"text-base-content/40\">{{ 'sdk.dataTable.noData.message' | translate }}</p>\n\t\t\t\t</div>\n\t\t\t} @else if (hasNoResults()) {\n\t\t\t\t<!-- No results from filters state -->\n\t\t\t\t<div class=\"flex flex-col items-center justify-center py-12 text-center\">\n\t\t\t\t\t<div class=\"text-base-content/40 mb-3\">\n\t\t\t\t\t\t<st-icon [icon]=\"noResultsIcon\" size=\"xl\" color=\"base-content\" class=\"mx-auto opacity-40\"></st-icon>\n\t\t\t\t\t</div>\n\t\t\t\t\t<h3 typography tyVariant=\"h6\" class=\"text-base-content/60 mb-2\">{{ 'sdk.dataTable.noResults.title' | translate }}</h3>\n\t\t\t\t\t<p typography tyVariant=\"body-sm\" class=\"text-base-content/40\">{{ 'sdk.dataTable.noResults.message' | translate }}</p>\n\t\t\t\t</div>\n\t\t\t} @else {\n\t\t\t\t<table [class]=\"tableClass()\">\n\t\t\t\t\t<ng-content></ng-content>\n\t\t\t\t</table>\n\t\t\t}\n\t\t</div>\n\t</div>\n\n\t<!-- Pagination from showcase -->\n\t<div class=\"@container flex w-full flex-col gap-4 overflow-x-auto pb-3\">\n\t\t<!-- Divider -->\n\t\t<div class=\"divider divider-neutral my-0 h-[0.0625rem] px-4 before:h-[0.0625rem] after:h-[0.0625rem]\"></div>\n\t\t<!-- Paginator Container -->\n\t\t<div\n\t\t\tclass=\"flex flex-col items-center gap-4 px-4 @2xl:flex-row @2xl:justify-between @2xl:gap-2 @4xl:grid @4xl:grid-cols-[auto_1fr_auto] @4xl:items-center\"\n\t\t>\n\t\t\t<!-- Entries range text -->\n\t\t\t<div class=\"flex items-center justify-end\">\n\t\t\t\t<span typography [tyVariant]=\"paginatorTextSize()\" [tyColor]=\"'inherit'\">{{\n\t\t\t\t\t'sdk.dataTable.entriesRange' | translate: { range: paginationRange(), total: totalItems() }\n\t\t\t\t}}</span>\n\t\t\t</div>\n\n\t\t\t<!-- Paginator -->\n\t\t\t<div class=\"flex justify-center\">\n\t\t\t\t<st-paginator\n\t\t\t\t\t[pages]=\"totalPages()\"\n\t\t\t\t\t[currentPage]=\"pagination().currentPage\"\n\t\t\t\t\t[maxSize]=\"maxSize()\"\n\t\t\t\t\ttype=\"default\"\n\t\t\t\t\t(pageChanged)=\"handlePageChange($event)\"\n\t\t\t\t></st-paginator>\n\t\t\t</div>\n\n\t\t\t<!-- Entries per page dropdown -->\n\t\t\t<st-select\n\t\t\t\t[options]=\"entriesPerPageOptions()\"\n\t\t\t\t[value]=\"pagination().itemsPerPage\"\n\t\t\t\tvalueKey=\"value\"\n\t\t\t\tdisplayKey=\"text\"\n\t\t\t\tsize=\"sm\"\n\t\t\t\t(valueUpdated)=\"handlePageSizeChange($event)\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\t[allowClear]=\"false\"\n\t\t\t></st-select>\n\t\t</div>\n\t</div>\n</div>\n" }]
|
|
994
|
+
}], ctorParameters: () => [] });
|
|
995
|
+
|
|
996
|
+
class DataTableSubComponentToggleCellComponent {
|
|
997
|
+
row = input.required();
|
|
998
|
+
isExpanded = input.required(); // Current state of the sub-component for this row
|
|
999
|
+
toggled = output(); // Emits row.id when clicked to trigger parent component update
|
|
1000
|
+
// Input to determine if this specific row is eligible to display a sub-component
|
|
1001
|
+
canToggleSubComponent = input(false);
|
|
1002
|
+
iconChevronDown = matKeyboardArrowDown;
|
|
1003
|
+
iconInfo = matInfo;
|
|
1004
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableSubComponentToggleCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1005
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.0", type: DataTableSubComponentToggleCellComponent, isStandalone: true, selector: "st-data-table-sub-component-toggle-cell", inputs: { row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null }, isExpanded: { classPropertyName: "isExpanded", publicName: "isExpanded", isSignal: true, isRequired: true, transformFunction: null }, canToggleSubComponent: { classPropertyName: "canToggleSubComponent", publicName: "canToggleSubComponent", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { toggled: "toggled" }, ngImport: i0, template: `
|
|
1006
|
+
@if (canToggleSubComponent()) {
|
|
1007
|
+
<st-button
|
|
1008
|
+
variant="secondary"
|
|
1009
|
+
size="xs"
|
|
1010
|
+
[circle]="true"
|
|
1011
|
+
[ghost]="true"
|
|
1012
|
+
class="group"
|
|
1013
|
+
(click)="toggled.emit(row().id)"
|
|
1014
|
+
[attr.aria-expanded]="isExpanded()"
|
|
1015
|
+
title="{{ isExpanded() ? 'Hide Details' : 'Show Details' }}"
|
|
1016
|
+
>
|
|
1017
|
+
<st-icon
|
|
1018
|
+
class="transition-transform duration-300 ease-in-out group-aria-[expanded=false]:rotate-0 group-aria-[expanded=true]:rotate-180"
|
|
1019
|
+
[icon]="iconChevronDown"
|
|
1020
|
+
size="sm"
|
|
1021
|
+
></st-icon>
|
|
1022
|
+
<span class="sr-only">{{ isExpanded() ? 'Hide Details' : 'Show Details' }}</span>
|
|
1023
|
+
</st-button>
|
|
1024
|
+
} @else {
|
|
1025
|
+
<!-- Display an informational icon if a sub-component cannot be shown for this row -->
|
|
1026
|
+
<st-button
|
|
1027
|
+
variant="secondary"
|
|
1028
|
+
size="xs"
|
|
1029
|
+
[circle]="true"
|
|
1030
|
+
[ghost]="true"
|
|
1031
|
+
[attr.aria-expanded]="isExpanded()"
|
|
1032
|
+
title="{{ isExpanded() ? 'Hide Details' : 'Show Details' }}"
|
|
1033
|
+
[disabled]="true"
|
|
1034
|
+
>
|
|
1035
|
+
<st-icon [icon]="iconInfo" size="sm"></st-icon>
|
|
1036
|
+
<span class="sr-only">{{ isExpanded() ? 'Hide Details' : 'Show Details' }}</span>
|
|
1037
|
+
</st-button>
|
|
1038
|
+
}
|
|
1039
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "icon"] }, { kind: "component", type: ButtonComponent, selector: "st-button", inputs: ["variant", "ghost", "outline", "link", "soft", "dash", "wide", "circle", "square", "glass", "block", "loader", "size", "shadow", "focusable", "icon", "iconPosition", "type", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1040
|
+
}
|
|
1041
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0", ngImport: i0, type: DataTableSubComponentToggleCellComponent, decorators: [{
|
|
1042
|
+
type: Component,
|
|
1043
|
+
args: [{
|
|
1044
|
+
standalone: true,
|
|
1045
|
+
selector: 'st-data-table-sub-component-toggle-cell',
|
|
1046
|
+
imports: [CommonModule, IconComponent, ButtonComponent],
|
|
1047
|
+
template: `
|
|
1048
|
+
@if (canToggleSubComponent()) {
|
|
1049
|
+
<st-button
|
|
1050
|
+
variant="secondary"
|
|
1051
|
+
size="xs"
|
|
1052
|
+
[circle]="true"
|
|
1053
|
+
[ghost]="true"
|
|
1054
|
+
class="group"
|
|
1055
|
+
(click)="toggled.emit(row().id)"
|
|
1056
|
+
[attr.aria-expanded]="isExpanded()"
|
|
1057
|
+
title="{{ isExpanded() ? 'Hide Details' : 'Show Details' }}"
|
|
1058
|
+
>
|
|
1059
|
+
<st-icon
|
|
1060
|
+
class="transition-transform duration-300 ease-in-out group-aria-[expanded=false]:rotate-0 group-aria-[expanded=true]:rotate-180"
|
|
1061
|
+
[icon]="iconChevronDown"
|
|
1062
|
+
size="sm"
|
|
1063
|
+
></st-icon>
|
|
1064
|
+
<span class="sr-only">{{ isExpanded() ? 'Hide Details' : 'Show Details' }}</span>
|
|
1065
|
+
</st-button>
|
|
1066
|
+
} @else {
|
|
1067
|
+
<!-- Display an informational icon if a sub-component cannot be shown for this row -->
|
|
1068
|
+
<st-button
|
|
1069
|
+
variant="secondary"
|
|
1070
|
+
size="xs"
|
|
1071
|
+
[circle]="true"
|
|
1072
|
+
[ghost]="true"
|
|
1073
|
+
[attr.aria-expanded]="isExpanded()"
|
|
1074
|
+
title="{{ isExpanded() ? 'Hide Details' : 'Show Details' }}"
|
|
1075
|
+
[disabled]="true"
|
|
1076
|
+
>
|
|
1077
|
+
<st-icon [icon]="iconInfo" size="sm"></st-icon>
|
|
1078
|
+
<span class="sr-only">{{ isExpanded() ? 'Hide Details' : 'Show Details' }}</span>
|
|
1079
|
+
</st-button>
|
|
1080
|
+
}
|
|
1081
|
+
`,
|
|
1082
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1083
|
+
}]
|
|
1084
|
+
}] });
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* Generated bundle index. Do not edit.
|
|
1088
|
+
*/
|
|
1089
|
+
|
|
1090
|
+
export { DataTableContainerComponent, DataTableExpandableCellComponent, DataTableExpandableHeaderCellComponent, DataTableHeadSelectionComponent, DataTableRowSelectionComponent, DataTableSortableHeaderComponent, DataTableSubComponentToggleCellComponent, DataTableSubToggleCellComponent, dataTableContent };
|
|
1091
|
+
//# sourceMappingURL=sixbell-telco-sdk-components-data-table.mjs.map
|