@sdcorejs/angular 19.2.3 → 19.2.5
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/README.md +11 -9
- package/components/card/index.d.ts +2 -0
- package/components/card/src/card-group.component.d.ts +28 -0
- package/components/card/src/card.component.d.ts +27 -0
- package/components/card/src/card.constants.d.ts +2 -0
- package/components/index.d.ts +1 -0
- package/components/modal/src/modal.component.d.ts +1 -0
- package/components/quick-action/src/quick-action.component.d.ts +3 -1
- package/components/table/index.d.ts +1 -0
- package/components/table/src/components/command/pipes/filter.pipe.d.ts +4 -5
- package/components/table/src/components/mobile-cards/mobile-action.model.d.ts +17 -0
- package/components/table/src/components/mobile-cards/mobile-actions.component.d.ts +30 -0
- package/components/table/src/components/mobile-cards/mobile-cards.component.d.ts +52 -0
- package/components/table/src/directives/index.d.ts +1 -0
- package/components/table/src/directives/sd-table-row-mobile-def.directive.d.ts +20 -0
- package/components/table/src/models/table-item.model.d.ts +3 -0
- package/components/table/src/models/table-option.model.d.ts +5 -0
- package/components/table/src/services/table-local/table-local-sort.util.d.ts +3 -0
- package/components/table/src/services/table-selection/selection-action.util.d.ts +6 -0
- package/components/table/src/table.component.d.ts +27 -4
- package/fesm2022/sdcorejs-angular-components-card.mjs +178 -0
- package/fesm2022/sdcorejs-angular-components-card.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-modal.mjs +16 -3
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs +4 -2
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +1442 -912
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components.mjs +1 -0
- package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +57 -7
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +85 -0
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-api.mjs +5 -0
- package/fesm2022/sdcorejs-angular-services-api.mjs.map +1 -1
- package/i18n/src/en.d.ts +17 -0
- package/package.json +11 -7
- package/components/table/src/pipes/selection-disabled.pipe.d.ts +0 -9
- package/components/table/src/pipes/selection-visible.pipe.d.ts +0 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, inject, TemplateRef, Directive, booleanAttribute,
|
|
2
|
+
import { input, inject, TemplateRef, Directive, booleanAttribute, output, signal, viewChild, computed, ElementRef, afterRenderEffect, untracked, ChangeDetectionStrategy, Component, Pipe, effect, model, isSignal, ChangeDetectorRef, InjectionToken, DestroyRef, Injectable, Input, ViewChild, afterNextRender, Renderer2, NgZone, isDevMode, contentChild, contentChildren } from '@angular/core';
|
|
3
3
|
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
4
4
|
import * as i4$1 from '@angular/material/paginator';
|
|
5
5
|
import { MatPaginatorIntl, MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
@@ -10,25 +10,32 @@ import { MatTable, MatTableModule } from '@angular/material/table';
|
|
|
10
10
|
import { SdStorageService, SdLoadingService, SdExcelService, SdNotifyService, SdConfirmService as SdConfirmService$1 } from '@sdcorejs/angular/services';
|
|
11
11
|
import { Subject, fromEvent, Subscription, isObservable, firstValueFrom } from 'rxjs';
|
|
12
12
|
import { debounceTime, startWith, map, switchMap } from 'rxjs/operators';
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
13
|
+
import * as i2 from '@angular/material/button';
|
|
14
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
15
|
+
import { SdQuickAction } from '@sdcorejs/angular/components/quick-action';
|
|
16
|
+
import { SdButton } from '@sdcorejs/angular/components/button';
|
|
17
|
+
import { SdModal } from '@sdcorejs/angular/components/modal';
|
|
18
|
+
import { I18nService, SdTranslatePipe } from '@sdcorejs/angular/i18n';
|
|
19
|
+
import { SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
20
|
+
import * as i1$1 from '@angular/common';
|
|
21
|
+
import { DOCUMENT, NgTemplateOutlet, NgStyle, CommonModule, DatePipe, DecimalPipe } from '@angular/common';
|
|
22
|
+
import * as i1 from '@angular/cdk/drag-drop';
|
|
23
|
+
import { DragDropModule, moveItemInArray } from '@angular/cdk/drag-drop';
|
|
24
|
+
import * as i3 from '@angular/material/checkbox';
|
|
22
25
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
23
|
-
import * as
|
|
26
|
+
import * as i4 from '@angular/material/radio';
|
|
24
27
|
import { MatRadioModule } from '@angular/material/radio';
|
|
25
|
-
import
|
|
28
|
+
import { SdSideDrawer } from '@sdcorejs/angular/components/side-drawer';
|
|
29
|
+
import { Utilities, StringUtilities, DateUtilities, BrowserUtilities, ArrayUtilities, NumberUtilities } from '@sdcorejs/utils/fns';
|
|
30
|
+
import { SdViewportService } from '@sdcorejs/angular/services/viewport';
|
|
31
|
+
import { CdkTableModule, CdkColumnDef } from '@angular/cdk/table';
|
|
32
|
+
import * as i2$2 from '@angular/forms';
|
|
33
|
+
import { FormGroup, FormsModule } from '@angular/forms';
|
|
34
|
+
import * as i3$1 from '@angular/material/menu';
|
|
26
35
|
import { MatMenuModule } from '@angular/material/menu';
|
|
27
36
|
import * as i7 from '@angular/material/progress-spinner';
|
|
28
37
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
29
|
-
import {
|
|
30
|
-
import { SdQuickAction } from '@sdcorejs/angular/components/quick-action';
|
|
31
|
-
import { SdTooltipDirective, SdScrollDirective, SdDesktopDirective, SdMobileDirective, SdHoverCopyDirective } from '@sdcorejs/angular/directives';
|
|
38
|
+
import { SdTooltipDirective, SdScrollDirective, SdHoverCopyDirective } from '@sdcorejs/angular/directives';
|
|
32
39
|
import { SdSafeHtmlPipe, SdFormatDatePipe, SdFormatDatetimePipe, SdFormatNumberPipe } from '@sdcorejs/angular/pipes';
|
|
33
40
|
import { SdBadge } from '@sdcorejs/angular/components/badge';
|
|
34
41
|
import { SdOperator } from '@sdcorejs/angular/components/operator';
|
|
@@ -42,16 +49,10 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
|
42
49
|
import { SdSection } from '@sdcorejs/angular/components/section';
|
|
43
50
|
import { SdCheckbox } from '@sdcorejs/angular/forms/checkbox';
|
|
44
51
|
import { SdDatetime } from '@sdcorejs/angular/forms/datetime';
|
|
45
|
-
import { SdTranslatePipe, I18nService } from '@sdcorejs/angular/i18n';
|
|
46
|
-
import { SdSideDrawer } from '@sdcorejs/angular/components/side-drawer';
|
|
47
|
-
import { SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
48
|
-
import { SdModal } from '@sdcorejs/angular/components/modal';
|
|
49
52
|
import { SdConfirmService } from '@sdcorejs/angular/services/confirm';
|
|
50
|
-
import * as
|
|
51
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
52
|
-
import * as i2 from '@angular/material/tooltip';
|
|
53
|
+
import * as i2$1 from '@angular/material/tooltip';
|
|
53
54
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
54
|
-
import * as i3$
|
|
55
|
+
import * as i3$2 from '@angular/material/chips';
|
|
55
56
|
import { MatChipsModule } from '@angular/material/chips';
|
|
56
57
|
|
|
57
58
|
class SdTableCellDefDirective {
|
|
@@ -70,6 +71,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
70
71
|
}]
|
|
71
72
|
}] });
|
|
72
73
|
|
|
74
|
+
class SdTableRowMobileDefDirective {
|
|
75
|
+
/** Optional type witness: bind the typed table option for strict row inference. */
|
|
76
|
+
sdTableRowMobileDef = input('');
|
|
77
|
+
templateRef = inject(TemplateRef);
|
|
78
|
+
static ngTemplateContextGuard(_directive, context) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableRowMobileDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
82
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.21", type: SdTableRowMobileDefDirective, isStandalone: true, selector: "ng-template[sdTableRowMobileDef]", inputs: { sdTableRowMobileDef: { classPropertyName: "sdTableRowMobileDef", publicName: "sdTableRowMobileDef", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
83
|
+
}
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableRowMobileDefDirective, decorators: [{
|
|
85
|
+
type: Directive,
|
|
86
|
+
args: [{ selector: 'ng-template[sdTableRowMobileDef]', standalone: true }]
|
|
87
|
+
}] });
|
|
88
|
+
|
|
73
89
|
/**
|
|
74
90
|
* Nội dung cho ô HEADER của cột command.
|
|
75
91
|
*
|
|
@@ -166,30 +182,825 @@ class SdTableGroupDefDirective {
|
|
|
166
182
|
static ngTemplateContextGuard(_dir, _ctx) {
|
|
167
183
|
return true;
|
|
168
184
|
}
|
|
169
|
-
templateRef = inject(TemplateRef);
|
|
170
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableGroupDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
171
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.21", type: SdTableGroupDefDirective, isStandalone: true, selector: "[sdTableGroupDef]", ngImport: i0 });
|
|
172
|
-
}
|
|
173
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableGroupDefDirective, decorators: [{
|
|
174
|
-
type: Directive,
|
|
175
|
-
args: [{ selector: '[sdTableGroupDef]' }]
|
|
176
|
-
}] });
|
|
177
|
-
|
|
178
|
-
class SdTableTitleDefDirective {
|
|
179
|
-
static ngTemplateContextGuard(_dir, _ctx) {
|
|
180
|
-
return true;
|
|
185
|
+
templateRef = inject(TemplateRef);
|
|
186
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableGroupDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
187
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.21", type: SdTableGroupDefDirective, isStandalone: true, selector: "[sdTableGroupDef]", ngImport: i0 });
|
|
188
|
+
}
|
|
189
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableGroupDefDirective, decorators: [{
|
|
190
|
+
type: Directive,
|
|
191
|
+
args: [{ selector: '[sdTableGroupDef]' }]
|
|
192
|
+
}] });
|
|
193
|
+
|
|
194
|
+
class SdTableTitleDefDirective {
|
|
195
|
+
static ngTemplateContextGuard(_dir, _ctx) {
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
sdTableTitleDef = input.required();
|
|
199
|
+
templateRef = inject(TemplateRef);
|
|
200
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableTitleDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
201
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.21", type: SdTableTitleDefDirective, isStandalone: true, selector: "[sdTableTitleDef]", inputs: { sdTableTitleDef: { classPropertyName: "sdTableTitleDef", publicName: "sdTableTitleDef", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
202
|
+
}
|
|
203
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableTitleDefDirective, decorators: [{
|
|
204
|
+
type: Directive,
|
|
205
|
+
args: [{
|
|
206
|
+
selector: '[sdTableTitleDef]',
|
|
207
|
+
}]
|
|
208
|
+
}] });
|
|
209
|
+
|
|
210
|
+
class SdTableMobileActionsComponent {
|
|
211
|
+
actions = input.required();
|
|
212
|
+
title = input.required();
|
|
213
|
+
selection = input(false);
|
|
214
|
+
count = input(0);
|
|
215
|
+
autoOpen = input(true);
|
|
216
|
+
autoId = input();
|
|
217
|
+
end = output();
|
|
218
|
+
busy = signal(false);
|
|
219
|
+
error = signal('');
|
|
220
|
+
sheet = viewChild('sheet');
|
|
221
|
+
sheetOpen = computed(() => this.sheet()?.isOpened() ?? false);
|
|
222
|
+
#host = inject(ElementRef);
|
|
223
|
+
#i18n = inject(I18nService);
|
|
224
|
+
#destroyed = false;
|
|
225
|
+
#pending;
|
|
226
|
+
// why: flat actions wrap in the toolbar; groups keep their declaration order in More.
|
|
227
|
+
direct = computed(() => {
|
|
228
|
+
const result = [];
|
|
229
|
+
for (const action of this.actions()) {
|
|
230
|
+
if (action.children || action.htmlTemplate)
|
|
231
|
+
break;
|
|
232
|
+
result.push(action);
|
|
233
|
+
}
|
|
234
|
+
return result;
|
|
235
|
+
});
|
|
236
|
+
overflow = computed(() => this.actions().slice(this.direct().length));
|
|
237
|
+
sheetActions = computed(() => (this.selection() ? this.overflow() : this.actions()));
|
|
238
|
+
constructor() {
|
|
239
|
+
// why: opening a newly created SdModal requires its title/dismiss bindings to be rendered first.
|
|
240
|
+
afterRenderEffect(() => {
|
|
241
|
+
const actions = this.actions();
|
|
242
|
+
const selection = this.selection();
|
|
243
|
+
const autoOpen = this.autoOpen();
|
|
244
|
+
const sheet = this.sheet();
|
|
245
|
+
untracked(() => {
|
|
246
|
+
if (!selection && autoOpen && actions.length)
|
|
247
|
+
sheet?.open();
|
|
248
|
+
else
|
|
249
|
+
sheet?.close();
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
openMore() {
|
|
254
|
+
if (!this.sheetOpen() && this.sheetActions().length)
|
|
255
|
+
this.sheet()?.open();
|
|
256
|
+
}
|
|
257
|
+
closeSheet() {
|
|
258
|
+
this.sheet()?.close();
|
|
259
|
+
}
|
|
260
|
+
onSheetClosed() {
|
|
261
|
+
if (this.#destroyed)
|
|
262
|
+
return;
|
|
263
|
+
const pending = this.#pending;
|
|
264
|
+
this.#pending = undefined;
|
|
265
|
+
if (pending)
|
|
266
|
+
void this.run(pending);
|
|
267
|
+
if (!this.selection() && this.autoOpen())
|
|
268
|
+
this.end.emit();
|
|
269
|
+
}
|
|
270
|
+
async runSheet(action) {
|
|
271
|
+
if (this.busy() || action.disabled)
|
|
272
|
+
return;
|
|
273
|
+
// why: finish closing before another drawer/dialog takes focus and overlay ownership.
|
|
274
|
+
if (action.closeBeforeRun) {
|
|
275
|
+
this.#pending = action;
|
|
276
|
+
this.closeSheet();
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
await this.run(action);
|
|
280
|
+
if (!this.error())
|
|
281
|
+
this.closeSheet();
|
|
282
|
+
}
|
|
283
|
+
async run(action) {
|
|
284
|
+
if (this.busy() || action.disabled || action.children || !action.run)
|
|
285
|
+
return;
|
|
286
|
+
this.error.set('');
|
|
287
|
+
try {
|
|
288
|
+
const result = action.run();
|
|
289
|
+
if (result && typeof result.then === 'function') {
|
|
290
|
+
this.busy.set(true);
|
|
291
|
+
await result;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
catch (error) {
|
|
295
|
+
console.error(error);
|
|
296
|
+
if (!this.#destroyed)
|
|
297
|
+
this.error.set(this.#i18n.t('core.component.table.error-occurred'));
|
|
298
|
+
}
|
|
299
|
+
finally {
|
|
300
|
+
if (!this.#destroyed)
|
|
301
|
+
this.busy.set(false);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
ngOnDestroy() {
|
|
305
|
+
this.#destroyed = true;
|
|
306
|
+
this.#pending = undefined;
|
|
307
|
+
const wasOpen = this.sheetOpen();
|
|
308
|
+
this.sheet()?.forceClose();
|
|
309
|
+
const owner = this.#host.nativeElement.closest('sd-table');
|
|
310
|
+
if (wasOpen && owner?.isConnected)
|
|
311
|
+
owner.focus();
|
|
312
|
+
}
|
|
313
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableMobileActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
314
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdTableMobileActionsComponent, isStandalone: true, selector: "sd-table-mobile-actions", inputs: { actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: true, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: false, transformFunction: null }, autoOpen: { classPropertyName: "autoOpen", publicName: "autoOpen", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { end: "end" }, viewQueries: [{ propertyName: "sheet", first: true, predicate: ["sheet"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _busy = busy();\n@let _error = error();\n@let _autoId = autoId();\n@let _title = title();\n@let _selection = selection();\n@if (_selection) {\n <div class=\"sd-mobile-actions\" role=\"region\" [attr.aria-label]=\"_title\">\n <sd-quick-action opened contained class=\"sd-mobile-quick-action\">\n <span sdMessage class=\"sd-mobile-selection-summary\" [attr.aria-label]=\"_title\">\n <span class=\"sd-mobile-selection-count T14M\">{{ count() }}</span>\n </span>\n <div sdAction class=\"sd-mobile-action-buttons\">\n <div class=\"sd-mobile-action-list\">\n @for (action of direct(); track action.key) {\n <span class=\"sd-mobile-action-direct\">\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-mobile-action-' + action.key : null\"\n [title]=\"action.title\"\n [prefixIcon]=\"action.icon\"\n [fontSet]=\"action.fontSet\"\n [color]=\"action.color\"\n size=\"sm\"\n [type]=\"action.type || 'text'\"\n [disabled]=\"_busy || action.disabled\"\n (click)=\"run(action)\"></sd-button>\n </span>\n }\n @if (overflow().length) {\n <button\n mat-button\n type=\"button\"\n class=\"sd-mobile-more\"\n [disabled]=\"_busy\"\n aria-haspopup=\"dialog\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-mobile-more' : null\"\n (click)=\"openMore()\">\n <sd-icon name=\"more_horiz\"></sd-icon><span>{{ 'core.component.table.mobile.more' | sdTranslate }}</span>\n </button>\n }\n </div>\n <button\n type=\"button\"\n class=\"sd-mobile-end sd-mobile-clear\"\n [attr.aria-label]=\"'core.component.table.clear-selection' | sdTranslate\"\n (click)=\"end.emit()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-mobile-end' : null\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </div>\n </sd-quick-action>\n @if (_error; as message) {\n <p role=\"alert\">{{ message }}</p>\n }\n </div>\n}\n<sd-modal\n #sheet\n [autoId]=\"_autoId ? _autoId + '-mobile-sheet' : undefined\"\n [title]=\"_title\"\n view=\"bottom-sheet\"\n [disableBackdropClose]=\"false\"\n modalClass=\"sd-table-mobile-sheet-panel\"\n (sdClosed)=\"onSheetClosed()\">\n <div class=\"sd-mobile-sheet\">\n @for (action of sheetActions(); track action.key) {\n @if (action.children; as children) {\n <section [attr.aria-label]=\"action.title\" class=\"sd-mobile-action-group\">\n <h3 class=\"T12M\">{{ action.title }}</h3>\n @for (child of children; track child.key) {\n <button\n mat-button\n type=\"button\"\n class=\"sd-mobile-sheet-action\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-mobile-' + child.key : null\"\n [disabled]=\"_busy || action.disabled || child.disabled\"\n (click)=\"runSheet(child)\">\n <sd-icon [name]=\"child.icon || 'chevron_right'\" [fontSet]=\"child.fontSet\" [color]=\"child.color\"></sd-icon>\n <span class=\"sd-mobile-sheet-label\"\n >{{ child.title }}\n @if (child.htmlTemplate) {\n <span [innerHTML]=\"child.htmlTemplate\"></span>\n }\n </span>\n </button>\n }\n </section>\n } @else {\n <button\n mat-button\n type=\"button\"\n class=\"sd-mobile-sheet-action\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-mobile-' + action.key : null\"\n [disabled]=\"_busy || action.disabled\"\n (click)=\"runSheet(action)\">\n <sd-icon [name]=\"action.icon || 'chevron_right'\" [fontSet]=\"action.fontSet\" [color]=\"action.color\"></sd-icon>\n <span class=\"sd-mobile-sheet-label\"\n >{{ action.title }}\n @if (action.htmlTemplate) {\n <span [innerHTML]=\"action.htmlTemplate\"></span>\n }\n </span>\n </button>\n }\n }\n @if (_error; as message) {\n <p role=\"alert\">{{ message }}</p>\n }\n </div>\n</sd-modal>\n", styles: [":host{display:block;min-width:0}.sd-mobile-actions{min-width:0;padding:4px 0 max(4px,env(safe-area-inset-bottom))}.sd-mobile-selection-summary{display:flex;align-items:center}.sd-mobile-selection-count{display:inline-flex;align-items:center;justify-content:center;min-width:28px;height:28px;padding:0 6px;border-radius:8px;background:var(--sd-primary);color:var(--mat-sys-on-primary, var(--sd-primary-contrast, #fff));font-variant-numeric:tabular-nums}.sd-mobile-action-buttons{display:grid;grid-template-columns:minmax(0,1fr) 40px;align-items:center;width:100%;min-width:0;gap:8px}.sd-mobile-action-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,72px),1fr));grid-auto-rows:minmax(40px,1fr);gap:4px 8px;min-width:0}.sd-mobile-action-direct{min-width:0}.sd-mobile-action-direct sd-button{width:100%;height:100%}.sd-mobile-more{display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:0 6px;min-width:0;height:100%}.sd-mobile-end{display:grid;place-items:center;padding:0;width:40px;height:40px;border:0;border-radius:50%;background:transparent;color:var(--sd-text);line-height:0;cursor:pointer}.sd-mobile-end:hover{background:color-mix(in srgb,var(--sd-text) 8%,transparent)}button{min-height:40px;white-space:normal}button:focus-visible{outline:2px solid var(--sd-primary);outline-offset:2px}:host ::ng-deep .sd-mobile-quick-action .c-quick-action.contained{flex-wrap:nowrap;gap:8px;padding:4px 16px;border-radius:12px}:host ::ng-deep .sd-mobile-quick-action .c-quick-action-message{flex:0 0 auto}:host ::ng-deep .sd-mobile-quick-action .c-quick-action-action{flex:1 1 auto}:host ::ng-deep .sd-mobile-quick-action .sd-mobile-more .mdc-button__label{display:inline-flex;align-items:center;gap:4px}:host ::ng-deep .sd-mobile-quick-action .sd-mobile-action-direct button{width:100%;height:100%;min-height:40px;padding:4px 6px!important;white-space:normal}:host ::ng-deep .sd-mobile-quick-action .sd-mobile-action-direct .c-title{white-space:normal;overflow:visible;overflow-wrap:anywhere;text-overflow:clip;line-height:18px}:host ::ng-deep .sd-mobile-quick-action .mat-mdc-button-touch-target{height:40px}:host ::ng-deep .sd-mobile-quick-action sd-icon,:host ::ng-deep .sd-mobile-quick-action sd-icon mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}:host ::ng-deep .sd-mobile-quick-action .sd-mobile-action-direct sd-icon mat-icon{width:16px;height:16px;font-size:16px;line-height:16px}.sd-mobile-sheet{padding:0 12px max(12px,env(safe-area-inset-bottom));overflow-wrap:anywhere}.sd-mobile-action-group{padding:8px 0;border-top:1px solid var(--sd-border)}.sd-mobile-action-group:first-child{border-top:0;padding-top:0}.sd-mobile-action-group h3{margin:8px 12px 4px;color:var(--sd-text-secondary)}.sd-mobile-sheet-action{display:flex;align-items:center;justify-content:flex-start;gap:12px;width:100%;min-height:48px;padding:12px;text-align:start;border-radius:10px}.sd-mobile-sheet-label{min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.4}.sd-mobile-sheet-action sd-icon{flex:0 0 20px;display:inline-flex;align-items:center;justify-content:center}::ng-deep .sd-table-mobile-sheet-panel .sd-mobile-sheet-action .mdc-button__label{display:flex;align-items:center;gap:12px;width:100%}::ng-deep .sd-table-mobile-sheet-panel .sd-modal-title{overflow-wrap:anywhere;font-size:16px;line-height:1.4}::ng-deep .sd-table-mobile-sheet-panel .sd-modal-header{min-height:64px;padding:12px 20px}::ng-deep .sd-table-mobile-sheet-panel .sd-modal-close-btn{width:40px;height:40px}\n"], dependencies: [{ kind: "component", type: SdQuickAction, selector: "sd-quick-action", inputs: ["opened", "contained"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdModal, selector: "sd-modal", inputs: ["autoId", "title", "color", "width", "height", "view", "modalClass", "lazyLoadContent", "hideClose", "disableBackdropClose", "beforeClose"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
315
|
+
}
|
|
316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableMobileActionsComponent, decorators: [{
|
|
317
|
+
type: Component,
|
|
318
|
+
args: [{ selector: 'sd-table-mobile-actions', changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdQuickAction, SdButton, SdModal, MatButtonModule, SdIcon, SdTranslatePipe], template: "@let _busy = busy();\n@let _error = error();\n@let _autoId = autoId();\n@let _title = title();\n@let _selection = selection();\n@if (_selection) {\n <div class=\"sd-mobile-actions\" role=\"region\" [attr.aria-label]=\"_title\">\n <sd-quick-action opened contained class=\"sd-mobile-quick-action\">\n <span sdMessage class=\"sd-mobile-selection-summary\" [attr.aria-label]=\"_title\">\n <span class=\"sd-mobile-selection-count T14M\">{{ count() }}</span>\n </span>\n <div sdAction class=\"sd-mobile-action-buttons\">\n <div class=\"sd-mobile-action-list\">\n @for (action of direct(); track action.key) {\n <span class=\"sd-mobile-action-direct\">\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-mobile-action-' + action.key : null\"\n [title]=\"action.title\"\n [prefixIcon]=\"action.icon\"\n [fontSet]=\"action.fontSet\"\n [color]=\"action.color\"\n size=\"sm\"\n [type]=\"action.type || 'text'\"\n [disabled]=\"_busy || action.disabled\"\n (click)=\"run(action)\"></sd-button>\n </span>\n }\n @if (overflow().length) {\n <button\n mat-button\n type=\"button\"\n class=\"sd-mobile-more\"\n [disabled]=\"_busy\"\n aria-haspopup=\"dialog\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-mobile-more' : null\"\n (click)=\"openMore()\">\n <sd-icon name=\"more_horiz\"></sd-icon><span>{{ 'core.component.table.mobile.more' | sdTranslate }}</span>\n </button>\n }\n </div>\n <button\n type=\"button\"\n class=\"sd-mobile-end sd-mobile-clear\"\n [attr.aria-label]=\"'core.component.table.clear-selection' | sdTranslate\"\n (click)=\"end.emit()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-mobile-end' : null\">\n <sd-icon name=\"close\"></sd-icon>\n </button>\n </div>\n </sd-quick-action>\n @if (_error; as message) {\n <p role=\"alert\">{{ message }}</p>\n }\n </div>\n}\n<sd-modal\n #sheet\n [autoId]=\"_autoId ? _autoId + '-mobile-sheet' : undefined\"\n [title]=\"_title\"\n view=\"bottom-sheet\"\n [disableBackdropClose]=\"false\"\n modalClass=\"sd-table-mobile-sheet-panel\"\n (sdClosed)=\"onSheetClosed()\">\n <div class=\"sd-mobile-sheet\">\n @for (action of sheetActions(); track action.key) {\n @if (action.children; as children) {\n <section [attr.aria-label]=\"action.title\" class=\"sd-mobile-action-group\">\n <h3 class=\"T12M\">{{ action.title }}</h3>\n @for (child of children; track child.key) {\n <button\n mat-button\n type=\"button\"\n class=\"sd-mobile-sheet-action\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-mobile-' + child.key : null\"\n [disabled]=\"_busy || action.disabled || child.disabled\"\n (click)=\"runSheet(child)\">\n <sd-icon [name]=\"child.icon || 'chevron_right'\" [fontSet]=\"child.fontSet\" [color]=\"child.color\"></sd-icon>\n <span class=\"sd-mobile-sheet-label\"\n >{{ child.title }}\n @if (child.htmlTemplate) {\n <span [innerHTML]=\"child.htmlTemplate\"></span>\n }\n </span>\n </button>\n }\n </section>\n } @else {\n <button\n mat-button\n type=\"button\"\n class=\"sd-mobile-sheet-action\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-mobile-' + action.key : null\"\n [disabled]=\"_busy || action.disabled\"\n (click)=\"runSheet(action)\">\n <sd-icon [name]=\"action.icon || 'chevron_right'\" [fontSet]=\"action.fontSet\" [color]=\"action.color\"></sd-icon>\n <span class=\"sd-mobile-sheet-label\"\n >{{ action.title }}\n @if (action.htmlTemplate) {\n <span [innerHTML]=\"action.htmlTemplate\"></span>\n }\n </span>\n </button>\n }\n }\n @if (_error; as message) {\n <p role=\"alert\">{{ message }}</p>\n }\n </div>\n</sd-modal>\n", styles: [":host{display:block;min-width:0}.sd-mobile-actions{min-width:0;padding:4px 0 max(4px,env(safe-area-inset-bottom))}.sd-mobile-selection-summary{display:flex;align-items:center}.sd-mobile-selection-count{display:inline-flex;align-items:center;justify-content:center;min-width:28px;height:28px;padding:0 6px;border-radius:8px;background:var(--sd-primary);color:var(--mat-sys-on-primary, var(--sd-primary-contrast, #fff));font-variant-numeric:tabular-nums}.sd-mobile-action-buttons{display:grid;grid-template-columns:minmax(0,1fr) 40px;align-items:center;width:100%;min-width:0;gap:8px}.sd-mobile-action-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,72px),1fr));grid-auto-rows:minmax(40px,1fr);gap:4px 8px;min-width:0}.sd-mobile-action-direct{min-width:0}.sd-mobile-action-direct sd-button{width:100%;height:100%}.sd-mobile-more{display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:0 6px;min-width:0;height:100%}.sd-mobile-end{display:grid;place-items:center;padding:0;width:40px;height:40px;border:0;border-radius:50%;background:transparent;color:var(--sd-text);line-height:0;cursor:pointer}.sd-mobile-end:hover{background:color-mix(in srgb,var(--sd-text) 8%,transparent)}button{min-height:40px;white-space:normal}button:focus-visible{outline:2px solid var(--sd-primary);outline-offset:2px}:host ::ng-deep .sd-mobile-quick-action .c-quick-action.contained{flex-wrap:nowrap;gap:8px;padding:4px 16px;border-radius:12px}:host ::ng-deep .sd-mobile-quick-action .c-quick-action-message{flex:0 0 auto}:host ::ng-deep .sd-mobile-quick-action .c-quick-action-action{flex:1 1 auto}:host ::ng-deep .sd-mobile-quick-action .sd-mobile-more .mdc-button__label{display:inline-flex;align-items:center;gap:4px}:host ::ng-deep .sd-mobile-quick-action .sd-mobile-action-direct button{width:100%;height:100%;min-height:40px;padding:4px 6px!important;white-space:normal}:host ::ng-deep .sd-mobile-quick-action .sd-mobile-action-direct .c-title{white-space:normal;overflow:visible;overflow-wrap:anywhere;text-overflow:clip;line-height:18px}:host ::ng-deep .sd-mobile-quick-action .mat-mdc-button-touch-target{height:40px}:host ::ng-deep .sd-mobile-quick-action sd-icon,:host ::ng-deep .sd-mobile-quick-action sd-icon mat-icon{width:18px;height:18px;font-size:18px;line-height:18px}:host ::ng-deep .sd-mobile-quick-action .sd-mobile-action-direct sd-icon mat-icon{width:16px;height:16px;font-size:16px;line-height:16px}.sd-mobile-sheet{padding:0 12px max(12px,env(safe-area-inset-bottom));overflow-wrap:anywhere}.sd-mobile-action-group{padding:8px 0;border-top:1px solid var(--sd-border)}.sd-mobile-action-group:first-child{border-top:0;padding-top:0}.sd-mobile-action-group h3{margin:8px 12px 4px;color:var(--sd-text-secondary)}.sd-mobile-sheet-action{display:flex;align-items:center;justify-content:flex-start;gap:12px;width:100%;min-height:48px;padding:12px;text-align:start;border-radius:10px}.sd-mobile-sheet-label{min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.4}.sd-mobile-sheet-action sd-icon{flex:0 0 20px;display:inline-flex;align-items:center;justify-content:center}::ng-deep .sd-table-mobile-sheet-panel .sd-mobile-sheet-action .mdc-button__label{display:flex;align-items:center;gap:12px;width:100%}::ng-deep .sd-table-mobile-sheet-panel .sd-modal-title{overflow-wrap:anywhere;font-size:16px;line-height:1.4}::ng-deep .sd-table-mobile-sheet-panel .sd-modal-header{min-height:64px;padding:12px 20px}::ng-deep .sd-table-mobile-sheet-panel .sd-modal-close-btn{width:40px;height:40px}\n"] }]
|
|
319
|
+
}], ctorParameters: () => [] });
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Resolves the bulk actions a selection is allowed to run.
|
|
323
|
+
*
|
|
324
|
+
* why: tách khỏi pipe để component đọc được cùng KẾT QUẢ trong `computed()` — quick-action chỉ
|
|
325
|
+
* được mở khi danh sách này KHÔNG rỗng, mà điều đó phải quyết định trong TS chứ không thể suy ra
|
|
326
|
+
* từ một pipe chỉ chạy trong template.
|
|
327
|
+
*/
|
|
328
|
+
function sdResolveTableActions(selectedItems, actions) {
|
|
329
|
+
const results = [];
|
|
330
|
+
if (!actions?.length || !selectedItems?.length) {
|
|
331
|
+
return [];
|
|
332
|
+
}
|
|
333
|
+
for (const action of actions) {
|
|
334
|
+
if ('children' in action) {
|
|
335
|
+
const children = [];
|
|
336
|
+
for (const childAction of action.children) {
|
|
337
|
+
const key = Utilities.hash(childAction);
|
|
338
|
+
if (selectedItems.every(e => e?.meta?.selector?.actions?.includes(key))) {
|
|
339
|
+
children.push(childAction);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (children.length > 0) {
|
|
343
|
+
results.push({ ...action, children });
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
const key = Utilities.hash(action);
|
|
348
|
+
if (selectedItems.every(e => e?.meta?.selector?.actions?.includes(key))) {
|
|
349
|
+
results.push(action);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return results.map(result => convertAction(result));
|
|
354
|
+
}
|
|
355
|
+
function convertAction(action) {
|
|
356
|
+
if ('children' in action) {
|
|
357
|
+
return {
|
|
358
|
+
variant: 'children',
|
|
359
|
+
title: action.title,
|
|
360
|
+
icon: action.icon,
|
|
361
|
+
fontSet: action.fontSet,
|
|
362
|
+
tooltip: action.tooltip,
|
|
363
|
+
color: action.color,
|
|
364
|
+
type: action.type,
|
|
365
|
+
children: action.children.map(e => ({
|
|
366
|
+
variant: 'normal',
|
|
367
|
+
title: e.title,
|
|
368
|
+
icon: e.icon,
|
|
369
|
+
color: e.color ?? action.color,
|
|
370
|
+
type: e.type ?? action.type,
|
|
371
|
+
fontSet: e.fontSet,
|
|
372
|
+
tooltip: e.tooltip,
|
|
373
|
+
click: e.click,
|
|
374
|
+
})),
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
return {
|
|
378
|
+
variant: 'normal',
|
|
379
|
+
title: action.title,
|
|
380
|
+
icon: action.icon,
|
|
381
|
+
color: action.color,
|
|
382
|
+
type: action.type,
|
|
383
|
+
fontSet: action.fontSet,
|
|
384
|
+
tooltip: action.tooltip,
|
|
385
|
+
click: action.click,
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
class ActionFilterPipe {
|
|
389
|
+
transform = (selectedItems, actions) => sdResolveTableActions(selectedItems, actions);
|
|
390
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ActionFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
391
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: ActionFilterPipe, isStandalone: true, name: "actionFilter" });
|
|
392
|
+
}
|
|
393
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ActionFilterPipe, decorators: [{
|
|
394
|
+
type: Pipe,
|
|
395
|
+
args: [{
|
|
396
|
+
name: 'actionFilter',
|
|
397
|
+
}]
|
|
398
|
+
}] });
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Filters visible commands and pre-resolves icon, title, and stable key for the current row.
|
|
402
|
+
*/
|
|
403
|
+
class CommandFilterPipe {
|
|
404
|
+
transform(item, commands) {
|
|
405
|
+
return sdResolveTableCommands(item, commands);
|
|
406
|
+
}
|
|
407
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: CommandFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
408
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: CommandFilterPipe, isStandalone: true, name: "filter" });
|
|
409
|
+
}
|
|
410
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: CommandFilterPipe, decorators: [{
|
|
411
|
+
type: Pipe,
|
|
412
|
+
args: [{ name: 'filter', standalone: true }]
|
|
413
|
+
}] });
|
|
414
|
+
async function sdResolveTableCommands(item, commands) {
|
|
415
|
+
const results = [];
|
|
416
|
+
if (!commands)
|
|
417
|
+
return results;
|
|
418
|
+
for (const command of commands) {
|
|
419
|
+
if (!(await visible(item, command)))
|
|
420
|
+
continue;
|
|
421
|
+
const icon = iconFor(item, command);
|
|
422
|
+
const title = titleFor(item, command);
|
|
423
|
+
if ('children' in command) {
|
|
424
|
+
const children = [];
|
|
425
|
+
for (const child of command.children) {
|
|
426
|
+
if (!(await visible(item, child)))
|
|
427
|
+
continue;
|
|
428
|
+
children.push({
|
|
429
|
+
...child,
|
|
430
|
+
type: 'normal',
|
|
431
|
+
icon: iconFor(item, child),
|
|
432
|
+
title: titleFor(item, child),
|
|
433
|
+
key: keyFor(item, child),
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
if (children.length > 0) {
|
|
437
|
+
results.push({
|
|
438
|
+
...command,
|
|
439
|
+
type: 'children',
|
|
440
|
+
icon,
|
|
441
|
+
title,
|
|
442
|
+
key: keyFor(item, command),
|
|
443
|
+
children,
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
results.push({
|
|
449
|
+
...command,
|
|
450
|
+
type: 'normal',
|
|
451
|
+
icon,
|
|
452
|
+
title,
|
|
453
|
+
key: keyFor(item, command),
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return results;
|
|
458
|
+
}
|
|
459
|
+
const visible = async (item, command) => {
|
|
460
|
+
const { hidden } = command;
|
|
461
|
+
if (hidden === undefined)
|
|
462
|
+
return true;
|
|
463
|
+
if (typeof hidden === 'boolean')
|
|
464
|
+
return !hidden;
|
|
465
|
+
const result = hidden(item.data);
|
|
466
|
+
return !(result instanceof Promise ? await result : result);
|
|
467
|
+
};
|
|
468
|
+
const iconFor = (item, command) => {
|
|
469
|
+
if (!command?.icon)
|
|
470
|
+
return 'more_vert';
|
|
471
|
+
return typeof command.icon === 'string' ? command.icon : command.icon(item.data);
|
|
472
|
+
};
|
|
473
|
+
const titleFor = (item, command) => {
|
|
474
|
+
if (!command?.title)
|
|
475
|
+
return '';
|
|
476
|
+
return typeof command.title === 'string' ? command.title : command.title(item.data);
|
|
477
|
+
};
|
|
478
|
+
// Stable autoId key generated from resolved icon and title.
|
|
479
|
+
const keyFor = (item, command) => {
|
|
480
|
+
const icon = iconFor(item, command);
|
|
481
|
+
const title = titleFor(item, command);
|
|
482
|
+
return `${icon || 'noicon'}-${StringUtilities.changeAliasLowerCase(title) || 'notitle'}`;
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Resolves command metadata for the current row once, then lets the template reuse it with `@let`.
|
|
487
|
+
*/
|
|
488
|
+
class CommandPipe {
|
|
489
|
+
transform(item, command) {
|
|
490
|
+
return {
|
|
491
|
+
disabled: this.#disabled(item, command),
|
|
492
|
+
title: this.#title(item, command),
|
|
493
|
+
icon: this.#icon(item, command),
|
|
494
|
+
htmlTemplate: this.#htmlTemplate(item, command),
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
#disabled = (item, command) => {
|
|
498
|
+
const d = command?.disabled;
|
|
499
|
+
if (d == null)
|
|
500
|
+
return false;
|
|
501
|
+
return typeof d === 'boolean' ? d : d(item.data);
|
|
502
|
+
};
|
|
503
|
+
#title = (item, command) => {
|
|
504
|
+
if (!command?.title)
|
|
505
|
+
return '';
|
|
506
|
+
return typeof command.title === 'string' ? command.title : command.title(item.data);
|
|
507
|
+
};
|
|
508
|
+
#icon = (item, command) => {
|
|
509
|
+
if (!command?.icon)
|
|
510
|
+
return '';
|
|
511
|
+
return typeof command.icon === 'string' ? command.icon : command.icon(item.data);
|
|
512
|
+
};
|
|
513
|
+
// Only child commands can provide htmlTemplate.
|
|
514
|
+
#htmlTemplate = (item, command) => {
|
|
515
|
+
const tpl = command?.htmlTemplate;
|
|
516
|
+
return typeof tpl === 'function' ? tpl(item.data) : undefined;
|
|
517
|
+
};
|
|
518
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: CommandPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
519
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: CommandPipe, isStandalone: true, name: "command" });
|
|
520
|
+
}
|
|
521
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: CommandPipe, decorators: [{
|
|
522
|
+
type: Pipe,
|
|
523
|
+
args: [{ name: 'command', standalone: true }]
|
|
524
|
+
}] });
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Type-guard: tree có nạp children lười (lazy) hay không.
|
|
528
|
+
* Dùng để narrow discriminated union `SdTableOptionTree` một cách an toàn —
|
|
529
|
+
* thay vì truy cập `option.onExpandChildren` trực tiếp trên union (chỉ tồn tại
|
|
530
|
+
* ở nhánh lazy).
|
|
531
|
+
*/
|
|
532
|
+
const isLazyTree = (option) => option?.loadType === 'lazy';
|
|
533
|
+
/**
|
|
534
|
+
* Key chứa mảng children trên object row.
|
|
535
|
+
* - `static`: lấy `childrenKey` đã cấu hình, mặc định `'children'`.
|
|
536
|
+
* - `lazy`: không có `childrenKey` riêng → luôn dùng `'children'` làm nơi lưu
|
|
537
|
+
* kết quả nạp lười.
|
|
538
|
+
*/
|
|
539
|
+
const getChildrenKey = (option) => (option?.loadType === 'static' ? option.childrenKey : undefined) ?? 'children';
|
|
540
|
+
const getChildrenFromData = (data, option) => {
|
|
541
|
+
const key = getChildrenKey(option);
|
|
542
|
+
const raw = data?.[key];
|
|
543
|
+
return Array.isArray(raw) ? raw : [];
|
|
544
|
+
};
|
|
545
|
+
/**
|
|
546
|
+
* Trạng thái bung mặc định cho một cấp.
|
|
547
|
+
* Chỉ `static` mới có `defaultExpanded`; lazy luôn trả `false` (không thể bung
|
|
548
|
+
* mặc định nhánh chưa nạp).
|
|
549
|
+
*/
|
|
550
|
+
const resolveDefaultExpanded = (level, option) => {
|
|
551
|
+
const def = option?.loadType === 'static' ? (option.defaultExpanded ?? false) : false;
|
|
552
|
+
if (def === true)
|
|
553
|
+
return true;
|
|
554
|
+
if (def === false)
|
|
555
|
+
return false;
|
|
556
|
+
if (typeof def === 'number')
|
|
557
|
+
return level < def;
|
|
558
|
+
return false;
|
|
559
|
+
};
|
|
560
|
+
/**
|
|
561
|
+
* Row có khả năng có children hay không (để hiện nút bung).
|
|
562
|
+
* - Có children embedded → true.
|
|
563
|
+
* - Lazy tree: dùng `hasChildren(row.data)` nếu được cấu hình; không thì luôn
|
|
564
|
+
* true (chưa biết cho tới khi nạp).
|
|
565
|
+
*/
|
|
566
|
+
const resolveHasChildren = (row, option) => {
|
|
567
|
+
const embedded = getChildrenFromData(row.data, option);
|
|
568
|
+
if (embedded.length > 0)
|
|
569
|
+
return true;
|
|
570
|
+
if (isLazyTree(option))
|
|
571
|
+
return option.hasChildren ? option.hasChildren(row.data) : true;
|
|
572
|
+
return false;
|
|
573
|
+
};
|
|
574
|
+
/** Row cần nạp lười (lazy) khi bung: là lazy tree và chưa có children embedded. */
|
|
575
|
+
const hasLazyChildren = (row, option) => {
|
|
576
|
+
if (!isLazyTree(option))
|
|
577
|
+
return false;
|
|
578
|
+
return getChildrenFromData(row.data, option).length === 0;
|
|
579
|
+
};
|
|
580
|
+
/**
|
|
581
|
+
* True nếu `data` HOẶC bất kỳ hậu duệ nào (theo `childrenKey`) thoả `predicate`.
|
|
582
|
+
*
|
|
583
|
+
* Dùng cho search ở cấp con (static tree, table `type: 'local'`): một nhánh
|
|
584
|
+
* gốc được giữ lại trong kết quả lọc nếu subtree của nó có ít nhất một node
|
|
585
|
+
* khớp từ khoá. `visited` chống đệ quy vô hạn khi data có circular reference.
|
|
586
|
+
*/
|
|
587
|
+
const subtreeMatches = (data, predicate, option, visited = new Set()) => {
|
|
588
|
+
if (data == null || visited.has(data))
|
|
589
|
+
return false;
|
|
590
|
+
visited.add(data);
|
|
591
|
+
if (predicate(data))
|
|
592
|
+
return true;
|
|
593
|
+
for (const child of getChildrenFromData(data, option)) {
|
|
594
|
+
if (subtreeMatches(child, predicate, option, visited))
|
|
595
|
+
return true;
|
|
596
|
+
}
|
|
597
|
+
return false;
|
|
598
|
+
};
|
|
599
|
+
/**
|
|
600
|
+
* Lọc mảng children: chỉ giữ child có subtree khớp `predicate`.
|
|
601
|
+
*
|
|
602
|
+
* Trả về MẢNG MỚI nhưng GIỮ NGUYÊN object reference của từng child (không clone)
|
|
603
|
+
* — nhờ vậy `meta.id` (bám theo identity của object data, hoặc theo `option.rowKey`)
|
|
604
|
+
* ổn định, selection / trạng thái bung không bị mất khi từ khoá search đổi. Đây là
|
|
605
|
+
* bước "prune" của tính năng search-con.
|
|
606
|
+
*/
|
|
607
|
+
const filterMatchingChildren = (children, predicate, option) => children.filter(child => subtreeMatches(child, predicate, option));
|
|
608
|
+
const getVisibleChildrenData = (data, option, predicate) => {
|
|
609
|
+
const children = getChildrenFromData(data, option);
|
|
610
|
+
return predicate ? filterMatchingChildren(children, predicate, option) : children;
|
|
611
|
+
};
|
|
612
|
+
const saveTreeExpandState = (rows, expandState) => {
|
|
613
|
+
for (const row of rows) {
|
|
614
|
+
if (row.meta.tree?.isExpanded) {
|
|
615
|
+
expandState.set(row.meta.id, true);
|
|
616
|
+
}
|
|
617
|
+
const children = row.meta.tree?.childItems;
|
|
618
|
+
if (children?.length) {
|
|
619
|
+
saveTreeExpandState(children, expandState);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
const clearTreeChildCache = (rows) => {
|
|
624
|
+
for (const row of rows) {
|
|
625
|
+
const children = row.meta.tree?.childItems;
|
|
626
|
+
if (children?.length) {
|
|
627
|
+
clearTreeChildCache(children);
|
|
628
|
+
row.meta.tree.childItems = undefined;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
const initTreeMeta = (rows, option, args = {}) => {
|
|
633
|
+
const { expandState, treeSearchPredicate, level = 0, parentId } = args;
|
|
634
|
+
const searchActive = !!treeSearchPredicate;
|
|
635
|
+
for (const row of rows) {
|
|
636
|
+
const saved = expandState?.get(row.meta.id);
|
|
637
|
+
const hasChildren = searchActive
|
|
638
|
+
? getVisibleChildrenData(row.data, option, treeSearchPredicate).length > 0
|
|
639
|
+
: resolveHasChildren(row, option);
|
|
640
|
+
row.meta.tree = {
|
|
641
|
+
...row.meta.tree,
|
|
642
|
+
level,
|
|
643
|
+
parentId,
|
|
644
|
+
hasChildren,
|
|
645
|
+
isExpanded: searchActive ? hasChildren : (saved ?? resolveDefaultExpanded(level, option)),
|
|
646
|
+
isExpanding: false,
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
const flattenTree = (roots, option, visited = new Set()) => {
|
|
651
|
+
if (!option)
|
|
652
|
+
return roots;
|
|
653
|
+
const maxDepth = option.maxDepth;
|
|
654
|
+
const result = [];
|
|
655
|
+
const walk = (rows, level, parentPath) => {
|
|
656
|
+
rows.forEach((row, siblingIdx) => {
|
|
657
|
+
if (visited.has(row.meta.id))
|
|
658
|
+
return;
|
|
659
|
+
visited.add(row.meta.id);
|
|
660
|
+
row.meta.tree ??= { level, hasChildren: false, isExpanded: false };
|
|
661
|
+
row.meta.tree.level = level;
|
|
662
|
+
// why: hierarchical numbering (1, 1.2, 1.2.1, ...) — STT template join('.').
|
|
663
|
+
const indexPath = [...parentPath, siblingIdx + 1];
|
|
664
|
+
row.meta.tree.indexPath = indexPath;
|
|
665
|
+
result.push(row);
|
|
666
|
+
const canDescend = row.meta.tree.isExpanded && row.meta.tree.hasChildren;
|
|
667
|
+
const depthOk = maxDepth === undefined || level < maxDepth;
|
|
668
|
+
if (!canDescend || !depthOk)
|
|
669
|
+
return;
|
|
670
|
+
const children = row.meta.tree.childItems ?? [];
|
|
671
|
+
walk(children, level + 1, indexPath);
|
|
672
|
+
});
|
|
673
|
+
};
|
|
674
|
+
walk(roots, 0, []);
|
|
675
|
+
return result;
|
|
676
|
+
};
|
|
677
|
+
/** Thu thập mọi SdTableItem đã format trong cây (kể cả node đang collapse). */
|
|
678
|
+
const collectFormattedTreeRows = (roots) => {
|
|
679
|
+
const result = [];
|
|
680
|
+
const walk = (rows) => {
|
|
681
|
+
for (const row of rows) {
|
|
682
|
+
result.push(row);
|
|
683
|
+
const children = row.meta.tree?.childItems;
|
|
684
|
+
if (children?.length)
|
|
685
|
+
walk(children);
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
walk(roots);
|
|
689
|
+
return result;
|
|
690
|
+
};
|
|
691
|
+
/** Flatten ALL nodes regardless of expand state — used for export */
|
|
692
|
+
const flattenTreeAll = (roots, option, visited = new Set()) => {
|
|
693
|
+
if (!option)
|
|
694
|
+
return roots;
|
|
695
|
+
const maxDepth = option.maxDepth;
|
|
696
|
+
const result = [];
|
|
697
|
+
const walk = (rows, level) => {
|
|
698
|
+
for (const row of rows) {
|
|
699
|
+
if (visited.has(row.meta.id))
|
|
700
|
+
continue;
|
|
701
|
+
visited.add(row.meta.id);
|
|
702
|
+
result.push(row);
|
|
703
|
+
const depthOk = maxDepth === undefined || level < maxDepth;
|
|
704
|
+
if (!depthOk)
|
|
705
|
+
continue;
|
|
706
|
+
const children = row.meta.tree?.childItems ?? [];
|
|
707
|
+
walk(children, level + 1);
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
walk(roots, 0);
|
|
711
|
+
return result;
|
|
712
|
+
};
|
|
713
|
+
/** Flatten raw data tree for export (ignores expand state) */
|
|
714
|
+
const flattenDataTree = (roots, option, visited = new Set()) => {
|
|
715
|
+
if (!option)
|
|
716
|
+
return roots;
|
|
717
|
+
const maxDepth = option.maxDepth;
|
|
718
|
+
const result = [];
|
|
719
|
+
const walk = (rows, level) => {
|
|
720
|
+
for (const row of rows) {
|
|
721
|
+
if (visited.has(row))
|
|
722
|
+
continue;
|
|
723
|
+
visited.add(row);
|
|
724
|
+
result.push(row);
|
|
725
|
+
const depthOk = maxDepth === undefined || level < maxDepth;
|
|
726
|
+
if (!depthOk)
|
|
727
|
+
continue;
|
|
728
|
+
walk(getChildrenFromData(row, option), level + 1);
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
walk(roots, 0);
|
|
732
|
+
return result;
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
const INTERACTIVE = 'a[href],button,input,select,textarea,summary,label,[contenteditable]:not([contenteditable="false"]),[role="button"],[role="link"],[role="checkbox"],[role="radio"],[role="switch"],[role="textbox"],[tabindex]:not([tabindex="-1"]),sd-button,sd-table,[cdkDragHandle]';
|
|
736
|
+
class SdTableMobileCardsComponent {
|
|
737
|
+
table = input.required();
|
|
738
|
+
rows = input.required();
|
|
739
|
+
groupTemplate = input.required();
|
|
740
|
+
#i18n = inject(I18nService);
|
|
741
|
+
#document = inject(DOCUMENT);
|
|
742
|
+
#element = inject(ElementRef);
|
|
743
|
+
#modal = inject(SdModal, { optional: true });
|
|
744
|
+
#drawer = inject(SdSideDrawer, { optional: true });
|
|
745
|
+
containerOpen = computed(() => (this.#modal?.isOpened() ?? true) && (this.#drawer?.isOpened() ?? true));
|
|
746
|
+
#commandMeta = new CommandPipe();
|
|
747
|
+
option = computed(() => this.table().tableOption());
|
|
748
|
+
selected = computed(() => this.table().selectedTableItems());
|
|
749
|
+
selectionMode = computed(() => !!this.option().selector?.visible && this.selected().length > 0);
|
|
750
|
+
active = signal(undefined);
|
|
751
|
+
resolvedCommands = signal(new Map());
|
|
752
|
+
#commandRevision = 0;
|
|
753
|
+
#focusOrigin;
|
|
754
|
+
#pointer;
|
|
755
|
+
#dragged = false;
|
|
756
|
+
cards = computed(() => {
|
|
757
|
+
const table = this.table();
|
|
758
|
+
table.selectedTableItems();
|
|
759
|
+
table.treeRevision();
|
|
760
|
+
table.expandRevision();
|
|
761
|
+
const option = this.option();
|
|
762
|
+
let index = 0;
|
|
763
|
+
return this.rows().map(row => {
|
|
764
|
+
const dataIndex = row.meta.group?.isGroupHeader ? -1 : index++;
|
|
765
|
+
if (row.meta.group?.isGroupHeader)
|
|
766
|
+
return {
|
|
767
|
+
row,
|
|
768
|
+
label: '',
|
|
769
|
+
selectLabel: '',
|
|
770
|
+
commandLabel: '',
|
|
771
|
+
expandLabel: '',
|
|
772
|
+
treeLabel: '',
|
|
773
|
+
reorderDisabled: true,
|
|
774
|
+
expandDisabled: true,
|
|
775
|
+
context: { item: row.data, index: -1, selected: false, selectionDisabled: true, autoId: undefined },
|
|
776
|
+
};
|
|
777
|
+
const rawKey = option.rowKey ? Utilities.getNestedValue(row.data, option.rowKey) : undefined;
|
|
778
|
+
const keyLabel = rawKey != null && ['string', 'number', 'bigint', 'boolean'].includes(typeof rawKey) ? String(rawKey) : '';
|
|
779
|
+
const label = option.mobile?.rowLabel?.(row.data)?.trim() ||
|
|
780
|
+
keyLabel ||
|
|
781
|
+
this.#i18n.t('core.component.table.mobile.row', { index: table.pageOffset() + dataIndex + 1 });
|
|
782
|
+
return {
|
|
783
|
+
row,
|
|
784
|
+
label,
|
|
785
|
+
context: {
|
|
786
|
+
item: row.data,
|
|
787
|
+
index: dataIndex,
|
|
788
|
+
selected: !!row.meta.selector?.isSelected,
|
|
789
|
+
selectionDisabled: !!row.meta.selector?.disabled || !row.meta.selector?.visible,
|
|
790
|
+
autoId: table.autoId() ? `${table.autoId()}-mobile-row-${row.meta.id}` : undefined,
|
|
791
|
+
},
|
|
792
|
+
selectLabel: this.#i18n.t('core.component.table.mobile.select-row', { row: label }),
|
|
793
|
+
commandLabel: this.#i18n.t('core.component.table.mobile.commands-for', { row: label }),
|
|
794
|
+
expandLabel: this.#i18n.t('core.component.table.mobile.expand-row', { row: label }),
|
|
795
|
+
treeLabel: this.#i18n.t('core.component.table.mobile.level', { level: (row.meta.tree?.level ?? 0) + 1 }),
|
|
796
|
+
reorderDisabled: table.isReorderDisabled(row) || (row.meta.tree?.level ?? 0) > 0,
|
|
797
|
+
expandDisabled: !!option.expand?.disabled?.(row.data),
|
|
798
|
+
};
|
|
799
|
+
});
|
|
800
|
+
});
|
|
801
|
+
selectionSummary = computed(() => {
|
|
802
|
+
const total = this.selected().length;
|
|
803
|
+
this.table().treeRevision();
|
|
804
|
+
// why: thu gọn nhánh không biến child đã tải thành selection ngoài trang.
|
|
805
|
+
const onPage = collectFormattedTreeRows(this.table().items());
|
|
806
|
+
const ids = new Set(onPage.map(row => row.meta.id));
|
|
807
|
+
const here = this.selected().filter(row => ids.has(row.meta.id)).length;
|
|
808
|
+
return this.#i18n.t(here < total ? 'core.component.table.mobile.selected-across-pages' : 'core.component.table.mobile.selected', {
|
|
809
|
+
count: total,
|
|
810
|
+
here,
|
|
811
|
+
});
|
|
812
|
+
});
|
|
813
|
+
// Keep B's action array stable when only A's async hidden predicate resolves.
|
|
814
|
+
activeCommands = computed(() => {
|
|
815
|
+
const active = this.active();
|
|
816
|
+
return active ? this.resolvedCommands().get(active.row) : undefined;
|
|
817
|
+
});
|
|
818
|
+
actions = computed(() => {
|
|
819
|
+
if (!this.containerOpen())
|
|
820
|
+
return [];
|
|
821
|
+
if (this.selectionMode()) {
|
|
822
|
+
const selected = this.selected();
|
|
823
|
+
return sdResolveTableActions(selected, this.option().selector?.actions).map((action, index) => this.#bulkAction(action, index, selected.map(row => row.data)));
|
|
824
|
+
}
|
|
825
|
+
const active = this.active();
|
|
826
|
+
if (!active)
|
|
827
|
+
return [];
|
|
828
|
+
return (this.activeCommands() ?? []).map((command, index) => this.#rowAction(command, active.row, index));
|
|
829
|
+
});
|
|
830
|
+
actionTitle = computed(() => this.selectionMode()
|
|
831
|
+
? this.selectionSummary()
|
|
832
|
+
: this.#i18n.t('core.component.table.mobile.row-commands', { row: this.active()?.label ?? '' }));
|
|
833
|
+
constructor() {
|
|
834
|
+
effect(onCleanup => {
|
|
835
|
+
const rows = this.rows();
|
|
836
|
+
this.table().dataRevision();
|
|
837
|
+
const commands = this.table().rowCommands();
|
|
838
|
+
const revision = ++this.#commandRevision;
|
|
839
|
+
untracked(() => {
|
|
840
|
+
this.closeCommand(false);
|
|
841
|
+
this.resolvedCommands.set(new Map());
|
|
842
|
+
});
|
|
843
|
+
for (const row of rows) {
|
|
844
|
+
if (row.meta.group?.isGroupHeader)
|
|
845
|
+
continue;
|
|
846
|
+
sdResolveTableCommands(row, commands)
|
|
847
|
+
.then(resolved => {
|
|
848
|
+
if (revision !== this.#commandRevision)
|
|
849
|
+
return;
|
|
850
|
+
this.resolvedCommands.update(current => new Map(current).set(row, resolved));
|
|
851
|
+
})
|
|
852
|
+
.catch(error => {
|
|
853
|
+
if (revision === this.#commandRevision)
|
|
854
|
+
console.error(error);
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
onCleanup(() => {
|
|
858
|
+
this.#commandRevision++;
|
|
859
|
+
});
|
|
860
|
+
});
|
|
861
|
+
effect(() => {
|
|
862
|
+
if (this.selectionMode() || this.table().loading() || !this.containerOpen())
|
|
863
|
+
untracked(() => this.closeCommand(false));
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
#actionTitle(title, index) {
|
|
867
|
+
return title || this.#i18n.t('core.component.table.mobile.action', { index: index + 1 });
|
|
868
|
+
}
|
|
869
|
+
#rowAction(command, row, index, parentDisabled = false) {
|
|
870
|
+
const meta = this.#commandMeta.transform(row, command);
|
|
871
|
+
const disabled = parentDisabled || meta.disabled;
|
|
872
|
+
return {
|
|
873
|
+
key: `${index}-${command.key}`,
|
|
874
|
+
title: this.#actionTitle(meta.title, index),
|
|
875
|
+
icon: meta.icon,
|
|
876
|
+
fontSet: command.fontSet,
|
|
877
|
+
color: 'color' in command ? command.color : undefined,
|
|
878
|
+
disabled,
|
|
879
|
+
htmlTemplate: meta.htmlTemplate,
|
|
880
|
+
...('children' in command
|
|
881
|
+
? { children: command.children.map((child, childIndex) => this.#rowAction(child, row, childIndex, disabled)) }
|
|
882
|
+
: { run: () => command.click(row.data) }),
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
#bulkAction(action, index, rows) {
|
|
886
|
+
return {
|
|
887
|
+
key: String(index),
|
|
888
|
+
title: this.#actionTitle(action.title, index),
|
|
889
|
+
icon: action.icon,
|
|
890
|
+
fontSet: action.fontSet ?? undefined,
|
|
891
|
+
color: action.color ?? undefined,
|
|
892
|
+
type: action.type,
|
|
893
|
+
...('children' in action
|
|
894
|
+
? { children: action.children.map((child, childIndex) => this.#bulkAction(child, childIndex, rows)) }
|
|
895
|
+
: { run: () => action.click(rows) }),
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
select(card) {
|
|
899
|
+
if (!this.option().selector?.visible || !card.row.meta.selector?.visible || card.row.meta.selector.disabled)
|
|
900
|
+
return;
|
|
901
|
+
const meta = card.row.meta.selector;
|
|
902
|
+
if (this.option().selector?.single && meta.isSelected)
|
|
903
|
+
return;
|
|
904
|
+
this.closeCommand(false);
|
|
905
|
+
meta.isSelected = this.option().selector?.single ? true : !meta.isSelected;
|
|
906
|
+
this.table().onSelect(card.row);
|
|
907
|
+
}
|
|
908
|
+
openCommand(card, event) {
|
|
909
|
+
if (this.selectionMode() || !this.resolvedCommands().get(card.row)?.length)
|
|
910
|
+
return;
|
|
911
|
+
this.#focusOrigin = event.currentTarget;
|
|
912
|
+
this.active.set(card);
|
|
913
|
+
}
|
|
914
|
+
closeCommand(restoreFocus = true) {
|
|
915
|
+
const wasActive = this.active();
|
|
916
|
+
this.active.set(undefined);
|
|
917
|
+
if (restoreFocus && wasActive) {
|
|
918
|
+
const fallback = this.#element.nativeElement.closest('sd-table');
|
|
919
|
+
(this.#focusOrigin?.isConnected ? this.#focusOrigin : fallback)?.focus();
|
|
920
|
+
}
|
|
921
|
+
this.#focusOrigin = undefined;
|
|
922
|
+
}
|
|
923
|
+
endActions() {
|
|
924
|
+
if (this.selectionMode())
|
|
925
|
+
this.table().onClearSelection();
|
|
926
|
+
else
|
|
927
|
+
this.closeCommand();
|
|
928
|
+
}
|
|
929
|
+
onCardClick(card, event) {
|
|
930
|
+
if (this.#dragged || this.#pointer?.moved || this.#isChildControl(event))
|
|
931
|
+
return;
|
|
932
|
+
const selectedText = this.#document.getSelection();
|
|
933
|
+
if (selectedText?.toString() && event.currentTarget.contains(selectedText.anchorNode))
|
|
934
|
+
return;
|
|
935
|
+
if (this.selectionMode() || !this.table().rowCommands().length)
|
|
936
|
+
this.select(card);
|
|
937
|
+
else
|
|
938
|
+
this.openCommand(card, event);
|
|
939
|
+
}
|
|
940
|
+
onCardKey(card, event) {
|
|
941
|
+
if (event.defaultPrevented)
|
|
942
|
+
return;
|
|
943
|
+
if (event.key === 'Escape') {
|
|
944
|
+
if (this.active()) {
|
|
945
|
+
event.preventDefault();
|
|
946
|
+
event.stopPropagation();
|
|
947
|
+
this.closeCommand();
|
|
948
|
+
}
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
if ((event.key !== 'Enter' && event.key !== ' ') || this.#isChildControl(event))
|
|
952
|
+
return;
|
|
953
|
+
event.preventDefault();
|
|
954
|
+
if (this.selectionMode() || !this.table().rowCommands().length)
|
|
955
|
+
this.select(card);
|
|
956
|
+
else
|
|
957
|
+
this.openCommand(card, event);
|
|
958
|
+
}
|
|
959
|
+
#isChildControl(event) {
|
|
960
|
+
for (const target of event.composedPath()) {
|
|
961
|
+
if (target === event.currentTarget)
|
|
962
|
+
break;
|
|
963
|
+
if (target instanceof Element && target.matches(INTERACTIVE))
|
|
964
|
+
return true;
|
|
965
|
+
}
|
|
966
|
+
return false;
|
|
181
967
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
968
|
+
pointerStart(event) {
|
|
969
|
+
this.#pointer = { x: event.clientX, y: event.clientY, moved: false };
|
|
970
|
+
this.#dragged = false;
|
|
971
|
+
}
|
|
972
|
+
pointerMove(event) {
|
|
973
|
+
if (this.#pointer && Math.hypot(event.clientX - this.#pointer.x, event.clientY - this.#pointer.y) > 8)
|
|
974
|
+
this.#pointer.moved = true;
|
|
975
|
+
}
|
|
976
|
+
cancelPointer() {
|
|
977
|
+
if (this.#pointer)
|
|
978
|
+
this.#pointer.moved = true;
|
|
979
|
+
}
|
|
980
|
+
dragStart() {
|
|
981
|
+
this.#dragged = true;
|
|
982
|
+
this.closeCommand(false);
|
|
983
|
+
}
|
|
984
|
+
ngOnDestroy() {
|
|
985
|
+
this.#commandRevision++;
|
|
986
|
+
}
|
|
987
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableMobileCardsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
988
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdTableMobileCardsComponent, isStandalone: true, selector: "sd-table-mobile-cards", inputs: { table: { classPropertyName: "table", publicName: "table", isSignal: true, isRequired: true, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: true, transformFunction: null }, groupTemplate: { classPropertyName: "groupTemplate", publicName: "groupTemplate", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@let _table = table();\n@let _option = option();\n@let _selectionMode = selectionMode();\n@let _autoId = _table.autoId();\n@let _commands = resolvedCommands();\n@let _actions = actions();\n@let _active = active();\n@let _expandTemplate = _table.sdSubInformation();\n\n@if (_option.selector?.visible) {\n <span class=\"sd-mobile-sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">{{ selectionSummary() }}</span>\n}\n\n<div\n class=\"sd-mobile-list\"\n role=\"list\"\n cdkDropList\n [cdkDropListData]=\"rows()\"\n [cdkDropListDisabled]=\"!_option.rowReorder?.enabled\"\n [cdkDropListSortPredicate]=\"_table.reorderSortPredicate\"\n (cdkDropListDropped)=\"_table.onReorderDrop($event)\">\n @for (card of cards(); track card.row.meta.id) {\n @let _row = card.row;\n @let _meta = _row.meta;\n @if (_meta.group?.isGroupHeader) {\n <div class=\"sd-mobile-group\" role=\"listitem\">\n <ng-container *ngTemplateOutlet=\"groupTemplate(); context: { item: _row }\"></ng-container>\n </div>\n } @else {\n <article\n class=\"sd-mobile-card\"\n role=\"listitem\"\n tabindex=\"0\"\n [attr.aria-label]=\"card.label\"\n [attr.data-autoid]=\"card.context.autoId\"\n [class.selected]=\"_meta.selector?.isSelected\"\n [class.sd-mobile-card-commandable]=\"!_selectionMode && _commands.get(_row)?.length\"\n [class.sd-mobile-card-active]=\"_active?.row === _row\"\n [ngStyle]=\"_meta.rowStyle\"\n [style.margin-inline-start.px]=\"_option.tree ? (_meta.tree?.level ?? 0) * (_option.tree?.indentSize ?? 20) : 0\"\n (click)=\"onCardClick(card, $event)\"\n (keydown)=\"onCardKey(card, $event)\"\n (pointerdown)=\"pointerStart($event)\"\n (pointermove)=\"pointerMove($event)\"\n (pointercancel)=\"cancelPointer()\"\n cdkDrag\n [cdkDragData]=\"_row\"\n [cdkDragDisabled]=\"!_option.rowReorder?.enabled || card.reorderDisabled\"\n (cdkDragStarted)=\"dragStart()\">\n <div class=\"sd-mobile-card-controls d-flex align-items-center gap-8\">\n @if (_option.selector?.visible && _meta.selector?.visible) {\n @if (_option.selector?.single) {\n <mat-radio-button\n class=\"sd-mobile-card-selector\"\n [checked]=\"_meta.selector?.isSelected\"\n [disabled]=\"_meta.selector?.disabled\"\n [aria-label]=\"card.selectLabel\"\n (change)=\"select(card)\"></mat-radio-button>\n } @else {\n <mat-checkbox\n class=\"sd-mobile-card-selector\"\n [checked]=\"_meta.selector?.isSelected\"\n [disabled]=\"_meta.selector?.disabled\"\n [aria-label]=\"card.selectLabel\"\n (change)=\"select(card)\"></mat-checkbox>\n }\n }\n @if (_option.tree) {\n <span class=\"sd-mobile-sr-only\">{{ card.treeLabel }}</span>\n @if (_meta.tree?.hasChildren) {\n <button\n mat-icon-button\n type=\"button\"\n [disabled]=\"_meta.tree?.isExpanding\"\n [attr.aria-label]=\"card.expandLabel\"\n [attr.aria-expanded]=\"_meta.tree?.isExpanded\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-tree-toggle-' + _meta.id : null\"\n (click)=\"_table.onTreeToggle(_row)\">\n <sd-icon\n [name]=\"_meta.tree?.isExpanding ? 'hourglass_empty' : _meta.tree?.isExpanded ? 'expand_more' : 'chevron_right'\"></sd-icon>\n </button>\n }\n @if (_option.index?.enabled) {\n <span>{{ _meta.tree?.indexPath?.join('.') }}</span>\n }\n }\n @if (_option.rowReorder?.enabled) {\n <button\n mat-icon-button\n type=\"button\"\n cdkDragHandle\n [disabled]=\"card.reorderDisabled\"\n [attr.aria-label]=\"'core.component.table.mobile.reorder' | sdTranslate\">\n <sd-icon [name]=\"_option.rowReorder?.icon || 'drag_indicator'\"></sd-icon>\n </button>\n }\n <span class=\"flex-1\"></span>\n </div>\n <div class=\"sd-mobile-card-body\">\n <ng-container *ngTemplateOutlet=\"_table.sdRowMobileDef()!.templateRef; context: card.context\"></ng-container>\n </div>\n @if ((_expandTemplate && !_option.expand?.always) || (!_selectionMode && _commands.get(_row)?.length)) {\n <div class=\"sd-mobile-card-actions\">\n @if (_expandTemplate && !_option.expand?.always) {\n <button\n mat-button\n type=\"button\"\n [disabled]=\"card.expandDisabled || _meta.expand?.isExpanding\"\n [attr.aria-expanded]=\"_meta.expand?.isExpanded\"\n [attr.aria-label]=\"card.expandLabel\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-expand-' + _meta.id : null\"\n (click)=\"_table.onExpand(_row)\">\n <sd-icon\n [name]=\"_meta.expand?.isExpanding ? 'hourglass_empty' : _meta.expand?.isExpanded ? 'expand_less' : 'expand_more'\"></sd-icon>\n {{ 'core.component.table.mobile.details' | sdTranslate }}\n </button>\n }\n @if (!_selectionMode && _commands.get(_row)?.length) {\n <button\n mat-icon-button\n type=\"button\"\n class=\"sd-mobile-command-trigger\"\n aria-haspopup=\"dialog\"\n (click)=\"openCommand(card, $event)\"\n [attr.aria-label]=\"card.commandLabel\"\n [attr.aria-expanded]=\"_active?.row === _row\"\n [attr.data-autoid]=\"card.context.autoId ? card.context.autoId + '-commands' : null\">\n <sd-icon name=\"more_horiz\"></sd-icon>\n </button>\n }\n </div>\n }\n @if (_expandTemplate && (_option.expand?.always || _meta.expand?.isExpanded)) {\n <div class=\"sd-mobile-expand\">\n <ng-container *ngTemplateOutlet=\"_expandTemplate.templateRef; context: { item: _row }\"></ng-container>\n </div>\n }\n </article>\n }\n }\n</div>\n@if (containerOpen() && (_actions.length || _selectionMode)) {\n <sd-table-mobile-actions\n [class.sd-mobile-floating]=\"_selectionMode\"\n [actions]=\"_actions\"\n [title]=\"actionTitle()\"\n [selection]=\"_selectionMode\"\n [autoId]=\"_autoId\"\n [count]=\"selected().length\"\n (end)=\"endActions()\"></sd-table-mobile-actions>\n}\n", styles: [":host{display:block;min-width:0}.sd-mobile-list{display:flex;flex-direction:column;gap:24px;padding:20px 20px 8px}.sd-mobile-card{position:relative;border:1px solid var(--sd-border);border-radius:8px;background:var(--sd-surface);color:var(--sd-text);min-width:0;padding:8px 12px;overflow-wrap:anywhere}.sd-mobile-card.selected{border-color:var(--sd-primary);background:color-mix(in srgb,var(--sd-primary) 10%,var(--sd-surface))}.sd-mobile-card-active{border-color:var(--sd-primary)}.sd-mobile-card:focus-visible,button:focus-visible{outline:2px solid var(--sd-primary);outline-offset:2px}.sd-mobile-card-commandable{min-height:76px}.sd-mobile-card-selector{position:absolute;z-index:1;top:-20px;inset-inline-end:-20px;width:40px;height:40px;display:flex;align-items:center;justify-content:center;--mdc-checkbox-state-layer-size: 40px;--mat-checkbox-state-layer-size: 40px;--mdc-radio-state-layer-size: 40px;--mat-radio-state-layer-size: 40px}.sd-mobile-card-selector:before{content:\"\";position:absolute;inset:8px;border:1px solid var(--sd-border);border-radius:50%;background:var(--sd-surface)}.sd-mobile-card-actions{display:flex;align-items:center;justify-content:space-between;gap:8px}.sd-mobile-command-trigger{flex:0 0 44px;margin-inline-start:auto;width:44px;height:44px}:host ::ng-deep .sd-mobile-card-selector .mdc-checkbox__background{width:14px;height:14px;top:13px;left:13px}:host ::ng-deep .sd-mobile-card-selector .mdc-radio__background{transform:scale(.7)}:host ::ng-deep .sd-mobile-card-selector .mat-mdc-checkbox-touch-target,:host ::ng-deep .sd-mobile-card-selector .mat-mdc-radio-touch-target{width:40px;height:40px}:host ::ng-deep .sd-mobile-card-selector .mdc-checkbox__ripple,:host ::ng-deep .sd-mobile-card-selector .mat-mdc-checkbox-ripple,:host ::ng-deep .sd-mobile-card-selector .mat-mdc-radio-ripple{width:24px;height:24px;inset:8px}.sd-mobile-card-body{padding:4px 0;min-width:0}.sd-mobile-group{overflow-wrap:anywhere}.sd-mobile-expand{padding:12px 0;border-top:1px solid var(--sd-border)}.sd-mobile-floating{position:sticky;bottom:0;padding-bottom:var(--sd-table-mobile-bottom-offset, 0px);z-index:2}button{min-width:44px;min-height:44px;height:auto}[cdkDragHandle]{touch-action:none;cursor:grab}.sd-mobile-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.cdk-drag-placeholder{opacity:.3}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i1.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i3.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "component", type: i4.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }, { kind: "component", type: SdTableMobileActionsComponent, selector: "sd-table-mobile-actions", inputs: ["actions", "title", "selection", "count", "autoOpen", "autoId"], outputs: ["end"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
186
989
|
}
|
|
187
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type:
|
|
188
|
-
type:
|
|
189
|
-
args: [{
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
990
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableMobileCardsComponent, decorators: [{
|
|
991
|
+
type: Component,
|
|
992
|
+
args: [{ selector: 'sd-table-mobile-cards', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
993
|
+
NgTemplateOutlet,
|
|
994
|
+
NgStyle,
|
|
995
|
+
DragDropModule,
|
|
996
|
+
MatButtonModule,
|
|
997
|
+
MatCheckboxModule,
|
|
998
|
+
MatRadioModule,
|
|
999
|
+
SdIcon,
|
|
1000
|
+
SdTranslatePipe,
|
|
1001
|
+
SdTableMobileActionsComponent,
|
|
1002
|
+
], template: "@let _table = table();\n@let _option = option();\n@let _selectionMode = selectionMode();\n@let _autoId = _table.autoId();\n@let _commands = resolvedCommands();\n@let _actions = actions();\n@let _active = active();\n@let _expandTemplate = _table.sdSubInformation();\n\n@if (_option.selector?.visible) {\n <span class=\"sd-mobile-sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">{{ selectionSummary() }}</span>\n}\n\n<div\n class=\"sd-mobile-list\"\n role=\"list\"\n cdkDropList\n [cdkDropListData]=\"rows()\"\n [cdkDropListDisabled]=\"!_option.rowReorder?.enabled\"\n [cdkDropListSortPredicate]=\"_table.reorderSortPredicate\"\n (cdkDropListDropped)=\"_table.onReorderDrop($event)\">\n @for (card of cards(); track card.row.meta.id) {\n @let _row = card.row;\n @let _meta = _row.meta;\n @if (_meta.group?.isGroupHeader) {\n <div class=\"sd-mobile-group\" role=\"listitem\">\n <ng-container *ngTemplateOutlet=\"groupTemplate(); context: { item: _row }\"></ng-container>\n </div>\n } @else {\n <article\n class=\"sd-mobile-card\"\n role=\"listitem\"\n tabindex=\"0\"\n [attr.aria-label]=\"card.label\"\n [attr.data-autoid]=\"card.context.autoId\"\n [class.selected]=\"_meta.selector?.isSelected\"\n [class.sd-mobile-card-commandable]=\"!_selectionMode && _commands.get(_row)?.length\"\n [class.sd-mobile-card-active]=\"_active?.row === _row\"\n [ngStyle]=\"_meta.rowStyle\"\n [style.margin-inline-start.px]=\"_option.tree ? (_meta.tree?.level ?? 0) * (_option.tree?.indentSize ?? 20) : 0\"\n (click)=\"onCardClick(card, $event)\"\n (keydown)=\"onCardKey(card, $event)\"\n (pointerdown)=\"pointerStart($event)\"\n (pointermove)=\"pointerMove($event)\"\n (pointercancel)=\"cancelPointer()\"\n cdkDrag\n [cdkDragData]=\"_row\"\n [cdkDragDisabled]=\"!_option.rowReorder?.enabled || card.reorderDisabled\"\n (cdkDragStarted)=\"dragStart()\">\n <div class=\"sd-mobile-card-controls d-flex align-items-center gap-8\">\n @if (_option.selector?.visible && _meta.selector?.visible) {\n @if (_option.selector?.single) {\n <mat-radio-button\n class=\"sd-mobile-card-selector\"\n [checked]=\"_meta.selector?.isSelected\"\n [disabled]=\"_meta.selector?.disabled\"\n [aria-label]=\"card.selectLabel\"\n (change)=\"select(card)\"></mat-radio-button>\n } @else {\n <mat-checkbox\n class=\"sd-mobile-card-selector\"\n [checked]=\"_meta.selector?.isSelected\"\n [disabled]=\"_meta.selector?.disabled\"\n [aria-label]=\"card.selectLabel\"\n (change)=\"select(card)\"></mat-checkbox>\n }\n }\n @if (_option.tree) {\n <span class=\"sd-mobile-sr-only\">{{ card.treeLabel }}</span>\n @if (_meta.tree?.hasChildren) {\n <button\n mat-icon-button\n type=\"button\"\n [disabled]=\"_meta.tree?.isExpanding\"\n [attr.aria-label]=\"card.expandLabel\"\n [attr.aria-expanded]=\"_meta.tree?.isExpanded\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-tree-toggle-' + _meta.id : null\"\n (click)=\"_table.onTreeToggle(_row)\">\n <sd-icon\n [name]=\"_meta.tree?.isExpanding ? 'hourglass_empty' : _meta.tree?.isExpanded ? 'expand_more' : 'chevron_right'\"></sd-icon>\n </button>\n }\n @if (_option.index?.enabled) {\n <span>{{ _meta.tree?.indexPath?.join('.') }}</span>\n }\n }\n @if (_option.rowReorder?.enabled) {\n <button\n mat-icon-button\n type=\"button\"\n cdkDragHandle\n [disabled]=\"card.reorderDisabled\"\n [attr.aria-label]=\"'core.component.table.mobile.reorder' | sdTranslate\">\n <sd-icon [name]=\"_option.rowReorder?.icon || 'drag_indicator'\"></sd-icon>\n </button>\n }\n <span class=\"flex-1\"></span>\n </div>\n <div class=\"sd-mobile-card-body\">\n <ng-container *ngTemplateOutlet=\"_table.sdRowMobileDef()!.templateRef; context: card.context\"></ng-container>\n </div>\n @if ((_expandTemplate && !_option.expand?.always) || (!_selectionMode && _commands.get(_row)?.length)) {\n <div class=\"sd-mobile-card-actions\">\n @if (_expandTemplate && !_option.expand?.always) {\n <button\n mat-button\n type=\"button\"\n [disabled]=\"card.expandDisabled || _meta.expand?.isExpanding\"\n [attr.aria-expanded]=\"_meta.expand?.isExpanded\"\n [attr.aria-label]=\"card.expandLabel\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-expand-' + _meta.id : null\"\n (click)=\"_table.onExpand(_row)\">\n <sd-icon\n [name]=\"_meta.expand?.isExpanding ? 'hourglass_empty' : _meta.expand?.isExpanded ? 'expand_less' : 'expand_more'\"></sd-icon>\n {{ 'core.component.table.mobile.details' | sdTranslate }}\n </button>\n }\n @if (!_selectionMode && _commands.get(_row)?.length) {\n <button\n mat-icon-button\n type=\"button\"\n class=\"sd-mobile-command-trigger\"\n aria-haspopup=\"dialog\"\n (click)=\"openCommand(card, $event)\"\n [attr.aria-label]=\"card.commandLabel\"\n [attr.aria-expanded]=\"_active?.row === _row\"\n [attr.data-autoid]=\"card.context.autoId ? card.context.autoId + '-commands' : null\">\n <sd-icon name=\"more_horiz\"></sd-icon>\n </button>\n }\n </div>\n }\n @if (_expandTemplate && (_option.expand?.always || _meta.expand?.isExpanded)) {\n <div class=\"sd-mobile-expand\">\n <ng-container *ngTemplateOutlet=\"_expandTemplate.templateRef; context: { item: _row }\"></ng-container>\n </div>\n }\n </article>\n }\n }\n</div>\n@if (containerOpen() && (_actions.length || _selectionMode)) {\n <sd-table-mobile-actions\n [class.sd-mobile-floating]=\"_selectionMode\"\n [actions]=\"_actions\"\n [title]=\"actionTitle()\"\n [selection]=\"_selectionMode\"\n [autoId]=\"_autoId\"\n [count]=\"selected().length\"\n (end)=\"endActions()\"></sd-table-mobile-actions>\n}\n", styles: [":host{display:block;min-width:0}.sd-mobile-list{display:flex;flex-direction:column;gap:24px;padding:20px 20px 8px}.sd-mobile-card{position:relative;border:1px solid var(--sd-border);border-radius:8px;background:var(--sd-surface);color:var(--sd-text);min-width:0;padding:8px 12px;overflow-wrap:anywhere}.sd-mobile-card.selected{border-color:var(--sd-primary);background:color-mix(in srgb,var(--sd-primary) 10%,var(--sd-surface))}.sd-mobile-card-active{border-color:var(--sd-primary)}.sd-mobile-card:focus-visible,button:focus-visible{outline:2px solid var(--sd-primary);outline-offset:2px}.sd-mobile-card-commandable{min-height:76px}.sd-mobile-card-selector{position:absolute;z-index:1;top:-20px;inset-inline-end:-20px;width:40px;height:40px;display:flex;align-items:center;justify-content:center;--mdc-checkbox-state-layer-size: 40px;--mat-checkbox-state-layer-size: 40px;--mdc-radio-state-layer-size: 40px;--mat-radio-state-layer-size: 40px}.sd-mobile-card-selector:before{content:\"\";position:absolute;inset:8px;border:1px solid var(--sd-border);border-radius:50%;background:var(--sd-surface)}.sd-mobile-card-actions{display:flex;align-items:center;justify-content:space-between;gap:8px}.sd-mobile-command-trigger{flex:0 0 44px;margin-inline-start:auto;width:44px;height:44px}:host ::ng-deep .sd-mobile-card-selector .mdc-checkbox__background{width:14px;height:14px;top:13px;left:13px}:host ::ng-deep .sd-mobile-card-selector .mdc-radio__background{transform:scale(.7)}:host ::ng-deep .sd-mobile-card-selector .mat-mdc-checkbox-touch-target,:host ::ng-deep .sd-mobile-card-selector .mat-mdc-radio-touch-target{width:40px;height:40px}:host ::ng-deep .sd-mobile-card-selector .mdc-checkbox__ripple,:host ::ng-deep .sd-mobile-card-selector .mat-mdc-checkbox-ripple,:host ::ng-deep .sd-mobile-card-selector .mat-mdc-radio-ripple{width:24px;height:24px;inset:8px}.sd-mobile-card-body{padding:4px 0;min-width:0}.sd-mobile-group{overflow-wrap:anywhere}.sd-mobile-expand{padding:12px 0;border-top:1px solid var(--sd-border)}.sd-mobile-floating{position:sticky;bottom:0;padding-bottom:var(--sd-table-mobile-bottom-offset, 0px);z-index:2}button{min-width:44px;min-height:44px;height:auto}[cdkDragHandle]{touch-action:none;cursor:grab}.sd-mobile-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.cdk-drag-placeholder{opacity:.3}\n"] }]
|
|
1003
|
+
}], ctorParameters: () => [] });
|
|
193
1004
|
|
|
194
1005
|
// why: `columns` nhận `SdTableColumnAnyRow[]` (= `SdTableColumn<never>[]`). Hàm chỉ đọc
|
|
195
1006
|
// `field` / `type` / `filter.operator.default` — không bao giờ chạm dữ liệu hàng — nên không cần generic
|
|
@@ -524,286 +1335,77 @@ class ColumnFilterComponent {
|
|
|
524
1335
|
// Chạy trước lần render đầu nên template thấy giá trị đã init — không cần markForCheck.
|
|
525
1336
|
effect(() => {
|
|
526
1337
|
const col = this.column();
|
|
527
|
-
const filter = this.columnFilter();
|
|
528
|
-
if (!col || !filter)
|
|
529
|
-
return;
|
|
530
|
-
if (col.type === 'date' || col.type === 'time' || col.type === 'datetime') {
|
|
531
|
-
if (col.filter?.type !== 'date') {
|
|
532
|
-
filter[col.field] = filter[col.field] || { from: null, to: null };
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
if (col.type === 'number' && col.filter?.type === 'split-number') {
|
|
536
|
-
filter[col.field] = filter[col.field] || { from: null, to: null };
|
|
537
|
-
}
|
|
538
|
-
this.#lastOnChangeValueHash = this.#filterValueHash(filter[col.field]);
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
|
-
// ==========================================
|
|
542
|
-
// 4. HANDLERS
|
|
543
|
-
// ==========================================
|
|
544
|
-
onFilterChange = () => {
|
|
545
|
-
this.#emitFilterOnChange();
|
|
546
|
-
this.filterChange.emit();
|
|
547
|
-
};
|
|
548
|
-
// Blur input: commit giá trị KHÔNG trigger reload.
|
|
549
|
-
onFilterCommit = () => {
|
|
550
|
-
this.#emitFilterOnChange();
|
|
551
|
-
this.filterCommit.emit();
|
|
552
|
-
};
|
|
553
|
-
#emitFilterOnChange = () => {
|
|
554
|
-
const col = this.column();
|
|
555
|
-
const filter = this.columnFilter();
|
|
556
|
-
if (!col?.filter?.onChange || !filter)
|
|
557
|
-
return;
|
|
558
|
-
const value = filter[col.field];
|
|
559
|
-
const hash = this.#filterValueHash(value);
|
|
560
|
-
if (hash === this.#lastOnChangeValueHash)
|
|
561
|
-
return;
|
|
562
|
-
this.#lastOnChangeValueHash = hash;
|
|
563
|
-
col.filter.onChange(value, col, filter);
|
|
564
|
-
};
|
|
565
|
-
#filterValueHash = (value) => Utilities.hash({ value });
|
|
566
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ColumnFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
567
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: ColumnFilterComponent, isStandalone: true, selector: "column-filter", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, columnFilter: { classPropertyName: "columnFilter", publicName: "columnFilter", isSignal: true, isRequired: false, transformFunction: null }, cacheValues: { classPropertyName: "cacheValues", publicName: "cacheValues", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, operator: { classPropertyName: "operator", publicName: "operator", isSignal: true, isRequired: false, transformFunction: null }, isMobile: { classPropertyName: "isMobile", publicName: "isMobile", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { operator: "operatorChange", filterChange: "filterChange", filterCommit: "filterCommit" }, ngImport: i0, template: "@let _column = column();\n@let _columnFilter = columnFilter();\n@let _autoId = autoId();\n@let _templateRef = templateRef();\n@let _operators = operators();\n@let _items = items();\n@let _label = label();\n@let _context = { columnFilter: _columnFilter, autoId: _autoId };\n\n<div class=\"d-flex c-inline-column align-items-center\" style=\"width: 100%; max-width: 100%\">\n @if (\n _column.type === 'string' ||\n _column.type === 'number' ||\n _column.type === 'boolean' ||\n _column.type === 'values' ||\n _column.type === 'lazy-values' ||\n _column.type === 'date' ||\n _column.type === 'datetime' ||\n _column.type === 'time'\n ) {\n <!-- Operator filter -->\n @if (_operators.length) {\n <sd-operator class=\"mr-4\" [(model)]=\"operator\" [operators]=\"operatorValues()\" />\n }\n\n <!-- N\u1EBFu filter nh\u1EADn v\u00E0o template -->\n @if (_templateRef) {\n <ng-container *ngTemplateOutlet=\"_templateRef; context: _context\"></ng-container>\n }\n <!-- M\u1EB7c \u0111\u1ECBnh theo type v\u00E0 gi\u00E1 tr\u1ECB values defined c\u1EE7a column -->\n @else {\n @if (_column.type === 'string') {\n <sd-input\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n type=\"text\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (keyupEnter)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n clearable\n hideInlineError>\n </sd-input>\n } @else if (_column.type === 'number') {\n @if (!_column.filter?.type) {\n <sd-input-number\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (keyupEnter)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n clearable\n hideInlineError>\n </sd-input-number>\n } @else if (_column.filter?.type === 'split-number') {\n <ng-container *ngTemplateOutlet=\"splitNumberTpl; context: { field: _column.field, disabled: _column.filter?.disabled }\">\n </ng-container>\n }\n } @else if (_column.type === 'boolean') {\n <sd-select\n minWidthPanel=\"200px\"\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n [style.width]=\"'100%'\"\n size=\"sm\"\n [label]=\"_label\"\n [items]=\"[\n { value: '1', display: _column.option?.displayOnTrue || 'True' },\n { value: '0', display: _column.option?.displayOnFalse || 'False' },\n ]\"\n valueField=\"value\"\n displayField=\"display\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n hideInlineError>\n <ng-template sdItemDef let-item=\"item\">\n @if (item.value === '1') {\n <sd-badge color=\"success\" [title]=\"_column.option?.displayOnTrue || 'True'\"> </sd-badge>\n } @else {\n <sd-badge color=\"error\" [title]=\"_column.option?.displayOnFalse || 'False'\"> </sd-badge>\n }\n </ng-template>\n </sd-select>\n } @else if (_column.type === 'values') {\n <sd-select\n minWidthPanel=\"200px\"\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n [style.width]=\"'100%'\"\n size=\"sm\"\n [label]=\"_label\"\n [items]=\"_items\"\n [valueField]=\"_column.option.valueField\"\n [displayField]=\"_column.option.displayField\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n [multiple]=\"_column.option.selection === 'MULTIPLE'\"\n hideInlineError>\n </sd-select>\n } @else if (_column.type === 'lazy-values') {\n <sd-select\n minWidthPanel=\"200px\"\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n [style.width]=\"'100%'\"\n size=\"sm\"\n [label]=\"_label\"\n [items]=\"_items\"\n [valueField]=\"_column.option.valueField\"\n [displayField]=\"_column.option.displayField\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n [multiple]=\"_column.option.selection === 'MULTIPLE'\"\n hideInlineError>\n </sd-select>\n } @else if (_column.type === 'date' || _column.type === 'datetime' || _column.type === 'time') {\n @if (!_column.filter?.type || _column.filter?.type === 'daterange') {\n <sd-date-range\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n hideInlineError>\n </sd-date-range>\n } @else if (_column.filter?.type === 'date') {\n <sd-date\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n type=\"date\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n clearable\n hideInlineError>\n </sd-date>\n } @else if (_column.filter?.type === 'split-date') {\n <ng-container *ngTemplateOutlet=\"splitDateTpl; context: { field: _column.field, disabled: _column.filter?.disabled }\">\n </ng-container>\n }\n }\n }\n } @else {\n <sd-input [autoId]=\"_autoId\" style=\"flex: 1 1 0%; min-width: 0\" type=\"text\" size=\"sm\" disabled></sd-input>\n }\n</div>\n\n<!-- ================================================ -->\n<!-- Split from/to templates (\u0111\u01B0a xu\u1ED1ng cu\u1ED1i file) -->\n<!-- ================================================ -->\n<ng-template #splitNumberTpl let-field=\"field\" let-disabled=\"disabled\">\n <div class=\"d-flex align-items-center\" style=\"flex: 1 1 0%; min-width: 0\">\n <sd-input-number\n [autoId]=\"_autoId + '-from'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[field].from\"\n (sdChange)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-input-number>\n <div class=\"mx-4\">-</div>\n <sd-input-number\n [autoId]=\"_autoId + '-to'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [(model)]=\"_columnFilter[field].to\"\n (sdChange)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-input-number>\n </div>\n</ng-template>\n\n<ng-template #splitDateTpl let-field=\"field\" let-disabled=\"disabled\">\n <div class=\"d-flex align-items-center\" style=\"flex: 1 1 0%; min-width: 0\">\n <sd-date\n [autoId]=\"_autoId + '-from'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n type=\"date\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[field].from\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-date>\n <div class=\"mx-4\">-</div>\n <sd-date\n [autoId]=\"_autoId + '-to'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n type=\"date\"\n size=\"sm\"\n [(model)]=\"_columnFilter[field].to\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-date>\n </div>\n</ng-template>\n", styles: [":host ::ng-deep .c-inline-column .mat-mdc-text-field-wrapper{background-color:#fff}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SdOperator, selector: "sd-operator", inputs: ["model", "operators", "disabled", "autoId"], outputs: ["modelChange"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "size", "form", "label", "helperText", "placeholder", "type", "mask", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdInputNumber, selector: "sd-input-number", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "type", "precision", "format", "min", "max", "validator", "inlineError", "hyperlink", "appearance", "floatLabel", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "hyperlink", "minWidthPanel", "hideInlineError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "items", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDateRange, selector: "sd-date-range", inputs: ["autoId", "name", "size", "form", "label", "helperText", "hideInlineError", "required", "disabled", "viewed", "clearable", "appearance", "floatLabel", "min", "max", "transform", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "component", type: SdBadge, selector: "sd-badge", inputs: ["type", "color", "primary", "secondary", "success", "info", "warning", "error", "fontSet", "title", "description", "tooltip", "icon", "size"], outputs: ["click"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
568
|
-
}
|
|
569
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ColumnFilterComponent, decorators: [{
|
|
570
|
-
type: Component,
|
|
571
|
-
args: [{ selector: 'column-filter', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [CommonModule, SdOperator, SdInput, SdInputNumber, SdSelect, SdDate, SdDateRange, SdBadge], template: "@let _column = column();\n@let _columnFilter = columnFilter();\n@let _autoId = autoId();\n@let _templateRef = templateRef();\n@let _operators = operators();\n@let _items = items();\n@let _label = label();\n@let _context = { columnFilter: _columnFilter, autoId: _autoId };\n\n<div class=\"d-flex c-inline-column align-items-center\" style=\"width: 100%; max-width: 100%\">\n @if (\n _column.type === 'string' ||\n _column.type === 'number' ||\n _column.type === 'boolean' ||\n _column.type === 'values' ||\n _column.type === 'lazy-values' ||\n _column.type === 'date' ||\n _column.type === 'datetime' ||\n _column.type === 'time'\n ) {\n <!-- Operator filter -->\n @if (_operators.length) {\n <sd-operator class=\"mr-4\" [(model)]=\"operator\" [operators]=\"operatorValues()\" />\n }\n\n <!-- N\u1EBFu filter nh\u1EADn v\u00E0o template -->\n @if (_templateRef) {\n <ng-container *ngTemplateOutlet=\"_templateRef; context: _context\"></ng-container>\n }\n <!-- M\u1EB7c \u0111\u1ECBnh theo type v\u00E0 gi\u00E1 tr\u1ECB values defined c\u1EE7a column -->\n @else {\n @if (_column.type === 'string') {\n <sd-input\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n type=\"text\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (keyupEnter)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n clearable\n hideInlineError>\n </sd-input>\n } @else if (_column.type === 'number') {\n @if (!_column.filter?.type) {\n <sd-input-number\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (keyupEnter)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n clearable\n hideInlineError>\n </sd-input-number>\n } @else if (_column.filter?.type === 'split-number') {\n <ng-container *ngTemplateOutlet=\"splitNumberTpl; context: { field: _column.field, disabled: _column.filter?.disabled }\">\n </ng-container>\n }\n } @else if (_column.type === 'boolean') {\n <sd-select\n minWidthPanel=\"200px\"\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n [style.width]=\"'100%'\"\n size=\"sm\"\n [label]=\"_label\"\n [items]=\"[\n { value: '1', display: _column.option?.displayOnTrue || 'True' },\n { value: '0', display: _column.option?.displayOnFalse || 'False' },\n ]\"\n valueField=\"value\"\n displayField=\"display\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n hideInlineError>\n <ng-template sdItemDef let-item=\"item\">\n @if (item.value === '1') {\n <sd-badge color=\"success\" [title]=\"_column.option?.displayOnTrue || 'True'\"> </sd-badge>\n } @else {\n <sd-badge color=\"error\" [title]=\"_column.option?.displayOnFalse || 'False'\"> </sd-badge>\n }\n </ng-template>\n </sd-select>\n } @else if (_column.type === 'values') {\n <sd-select\n minWidthPanel=\"200px\"\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n [style.width]=\"'100%'\"\n size=\"sm\"\n [label]=\"_label\"\n [items]=\"_items\"\n [valueField]=\"_column.option.valueField\"\n [displayField]=\"_column.option.displayField\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n [multiple]=\"_column.option.selection === 'MULTIPLE'\"\n hideInlineError>\n </sd-select>\n } @else if (_column.type === 'lazy-values') {\n <sd-select\n minWidthPanel=\"200px\"\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n [style.width]=\"'100%'\"\n size=\"sm\"\n [label]=\"_label\"\n [items]=\"_items\"\n [valueField]=\"_column.option.valueField\"\n [displayField]=\"_column.option.displayField\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n [multiple]=\"_column.option.selection === 'MULTIPLE'\"\n hideInlineError>\n </sd-select>\n } @else if (_column.type === 'date' || _column.type === 'datetime' || _column.type === 'time') {\n @if (!_column.filter?.type || _column.filter?.type === 'daterange') {\n <sd-date-range\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n hideInlineError>\n </sd-date-range>\n } @else if (_column.filter?.type === 'date') {\n <sd-date\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n type=\"date\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n clearable\n hideInlineError>\n </sd-date>\n } @else if (_column.filter?.type === 'split-date') {\n <ng-container *ngTemplateOutlet=\"splitDateTpl; context: { field: _column.field, disabled: _column.filter?.disabled }\">\n </ng-container>\n }\n }\n }\n } @else {\n <sd-input [autoId]=\"_autoId\" style=\"flex: 1 1 0%; min-width: 0\" type=\"text\" size=\"sm\" disabled></sd-input>\n }\n</div>\n\n<!-- ================================================ -->\n<!-- Split from/to templates (\u0111\u01B0a xu\u1ED1ng cu\u1ED1i file) -->\n<!-- ================================================ -->\n<ng-template #splitNumberTpl let-field=\"field\" let-disabled=\"disabled\">\n <div class=\"d-flex align-items-center\" style=\"flex: 1 1 0%; min-width: 0\">\n <sd-input-number\n [autoId]=\"_autoId + '-from'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[field].from\"\n (sdChange)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-input-number>\n <div class=\"mx-4\">-</div>\n <sd-input-number\n [autoId]=\"_autoId + '-to'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [(model)]=\"_columnFilter[field].to\"\n (sdChange)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-input-number>\n </div>\n</ng-template>\n\n<ng-template #splitDateTpl let-field=\"field\" let-disabled=\"disabled\">\n <div class=\"d-flex align-items-center\" style=\"flex: 1 1 0%; min-width: 0\">\n <sd-date\n [autoId]=\"_autoId + '-from'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n type=\"date\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[field].from\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-date>\n <div class=\"mx-4\">-</div>\n <sd-date\n [autoId]=\"_autoId + '-to'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n type=\"date\"\n size=\"sm\"\n [(model)]=\"_columnFilter[field].to\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-date>\n </div>\n</ng-template>\n", styles: [":host ::ng-deep .c-inline-column .mat-mdc-text-field-wrapper{background-color:#fff}\n"] }]
|
|
572
|
-
}], ctorParameters: () => [] });
|
|
573
|
-
|
|
574
|
-
// Đối với filter loại values, items có thể là 1 mảng, có thể là 1 hàm, do đó cần xử lý nếu là hàm có thể xử lý gọi API
|
|
575
|
-
class FilterValuesPipe {
|
|
576
|
-
constructor() { }
|
|
577
|
-
async transform(items) {
|
|
578
|
-
if (Array.isArray(items)) {
|
|
579
|
-
return items;
|
|
580
|
-
}
|
|
581
|
-
if (typeof items === 'function') {
|
|
582
|
-
const results = await items();
|
|
583
|
-
if (Array.isArray(results)) {
|
|
584
|
-
return results;
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
return [];
|
|
588
|
-
}
|
|
589
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FilterValuesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
590
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: FilterValuesPipe, isStandalone: true, name: "filterValues" });
|
|
591
|
-
}
|
|
592
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FilterValuesPipe, decorators: [{
|
|
593
|
-
type: Pipe,
|
|
594
|
-
args: [{
|
|
595
|
-
name: 'filterValues',
|
|
596
|
-
}]
|
|
597
|
-
}], ctorParameters: () => [] });
|
|
598
|
-
|
|
599
|
-
/**
|
|
600
|
-
* Type-guard: tree có nạp children lười (lazy) hay không.
|
|
601
|
-
* Dùng để narrow discriminated union `SdTableOptionTree` một cách an toàn —
|
|
602
|
-
* thay vì truy cập `option.onExpandChildren` trực tiếp trên union (chỉ tồn tại
|
|
603
|
-
* ở nhánh lazy).
|
|
604
|
-
*/
|
|
605
|
-
const isLazyTree = (option) => option?.loadType === 'lazy';
|
|
606
|
-
/**
|
|
607
|
-
* Key chứa mảng children trên object row.
|
|
608
|
-
* - `static`: lấy `childrenKey` đã cấu hình, mặc định `'children'`.
|
|
609
|
-
* - `lazy`: không có `childrenKey` riêng → luôn dùng `'children'` làm nơi lưu
|
|
610
|
-
* kết quả nạp lười.
|
|
611
|
-
*/
|
|
612
|
-
const getChildrenKey = (option) => (option?.loadType === 'static' ? option.childrenKey : undefined) ?? 'children';
|
|
613
|
-
const getChildrenFromData = (data, option) => {
|
|
614
|
-
const key = getChildrenKey(option);
|
|
615
|
-
const raw = data?.[key];
|
|
616
|
-
return Array.isArray(raw) ? raw : [];
|
|
617
|
-
};
|
|
618
|
-
/**
|
|
619
|
-
* Trạng thái bung mặc định cho một cấp.
|
|
620
|
-
* Chỉ `static` mới có `defaultExpanded`; lazy luôn trả `false` (không thể bung
|
|
621
|
-
* mặc định nhánh chưa nạp).
|
|
622
|
-
*/
|
|
623
|
-
const resolveDefaultExpanded = (level, option) => {
|
|
624
|
-
const def = option?.loadType === 'static' ? (option.defaultExpanded ?? false) : false;
|
|
625
|
-
if (def === true)
|
|
626
|
-
return true;
|
|
627
|
-
if (def === false)
|
|
628
|
-
return false;
|
|
629
|
-
if (typeof def === 'number')
|
|
630
|
-
return level < def;
|
|
631
|
-
return false;
|
|
632
|
-
};
|
|
633
|
-
/**
|
|
634
|
-
* Row có khả năng có children hay không (để hiện nút bung).
|
|
635
|
-
* - Có children embedded → true.
|
|
636
|
-
* - Lazy tree: dùng `hasChildren(row.data)` nếu được cấu hình; không thì luôn
|
|
637
|
-
* true (chưa biết cho tới khi nạp).
|
|
638
|
-
*/
|
|
639
|
-
const resolveHasChildren = (row, option) => {
|
|
640
|
-
const embedded = getChildrenFromData(row.data, option);
|
|
641
|
-
if (embedded.length > 0)
|
|
642
|
-
return true;
|
|
643
|
-
if (isLazyTree(option))
|
|
644
|
-
return option.hasChildren ? option.hasChildren(row.data) : true;
|
|
645
|
-
return false;
|
|
646
|
-
};
|
|
647
|
-
/** Row cần nạp lười (lazy) khi bung: là lazy tree và chưa có children embedded. */
|
|
648
|
-
const hasLazyChildren = (row, option) => {
|
|
649
|
-
if (!isLazyTree(option))
|
|
650
|
-
return false;
|
|
651
|
-
return getChildrenFromData(row.data, option).length === 0;
|
|
652
|
-
};
|
|
653
|
-
/**
|
|
654
|
-
* True nếu `data` HOẶC bất kỳ hậu duệ nào (theo `childrenKey`) thoả `predicate`.
|
|
655
|
-
*
|
|
656
|
-
* Dùng cho search ở cấp con (static tree, table `type: 'local'`): một nhánh
|
|
657
|
-
* gốc được giữ lại trong kết quả lọc nếu subtree của nó có ít nhất một node
|
|
658
|
-
* khớp từ khoá. `visited` chống đệ quy vô hạn khi data có circular reference.
|
|
659
|
-
*/
|
|
660
|
-
const subtreeMatches = (data, predicate, option, visited = new Set()) => {
|
|
661
|
-
if (data == null || visited.has(data))
|
|
662
|
-
return false;
|
|
663
|
-
visited.add(data);
|
|
664
|
-
if (predicate(data))
|
|
665
|
-
return true;
|
|
666
|
-
for (const child of getChildrenFromData(data, option)) {
|
|
667
|
-
if (subtreeMatches(child, predicate, option, visited))
|
|
668
|
-
return true;
|
|
669
|
-
}
|
|
670
|
-
return false;
|
|
671
|
-
};
|
|
672
|
-
/**
|
|
673
|
-
* Lọc mảng children: chỉ giữ child có subtree khớp `predicate`.
|
|
674
|
-
*
|
|
675
|
-
* Trả về MẢNG MỚI nhưng GIỮ NGUYÊN object reference của từng child (không clone)
|
|
676
|
-
* — nhờ vậy `meta.id` (bám theo identity của object data, hoặc theo `option.rowKey`)
|
|
677
|
-
* ổn định, selection / trạng thái bung không bị mất khi từ khoá search đổi. Đây là
|
|
678
|
-
* bước "prune" của tính năng search-con.
|
|
679
|
-
*/
|
|
680
|
-
const filterMatchingChildren = (children, predicate, option) => children.filter(child => subtreeMatches(child, predicate, option));
|
|
681
|
-
const getVisibleChildrenData = (data, option, predicate) => {
|
|
682
|
-
const children = getChildrenFromData(data, option);
|
|
683
|
-
return predicate ? filterMatchingChildren(children, predicate, option) : children;
|
|
684
|
-
};
|
|
685
|
-
const saveTreeExpandState = (rows, expandState) => {
|
|
686
|
-
for (const row of rows) {
|
|
687
|
-
if (row.meta.tree?.isExpanded) {
|
|
688
|
-
expandState.set(row.meta.id, true);
|
|
689
|
-
}
|
|
690
|
-
const children = row.meta.tree?.childItems;
|
|
691
|
-
if (children?.length) {
|
|
692
|
-
saveTreeExpandState(children, expandState);
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
};
|
|
696
|
-
const clearTreeChildCache = (rows) => {
|
|
697
|
-
for (const row of rows) {
|
|
698
|
-
const children = row.meta.tree?.childItems;
|
|
699
|
-
if (children?.length) {
|
|
700
|
-
clearTreeChildCache(children);
|
|
701
|
-
row.meta.tree.childItems = undefined;
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
};
|
|
705
|
-
const initTreeMeta = (rows, option, args = {}) => {
|
|
706
|
-
const { expandState, treeSearchPredicate, level = 0, parentId } = args;
|
|
707
|
-
const searchActive = !!treeSearchPredicate;
|
|
708
|
-
for (const row of rows) {
|
|
709
|
-
const saved = expandState?.get(row.meta.id);
|
|
710
|
-
const hasChildren = searchActive
|
|
711
|
-
? getVisibleChildrenData(row.data, option, treeSearchPredicate).length > 0
|
|
712
|
-
: resolveHasChildren(row, option);
|
|
713
|
-
row.meta.tree = {
|
|
714
|
-
...row.meta.tree,
|
|
715
|
-
level,
|
|
716
|
-
parentId,
|
|
717
|
-
hasChildren,
|
|
718
|
-
isExpanded: searchActive ? hasChildren : (saved ?? resolveDefaultExpanded(level, option)),
|
|
719
|
-
isExpanding: false,
|
|
720
|
-
};
|
|
721
|
-
}
|
|
722
|
-
};
|
|
723
|
-
const flattenTree = (roots, option, visited = new Set()) => {
|
|
724
|
-
if (!option)
|
|
725
|
-
return roots;
|
|
726
|
-
const maxDepth = option.maxDepth;
|
|
727
|
-
const result = [];
|
|
728
|
-
const walk = (rows, level, parentPath) => {
|
|
729
|
-
rows.forEach((row, siblingIdx) => {
|
|
730
|
-
if (visited.has(row.meta.id))
|
|
731
|
-
return;
|
|
732
|
-
visited.add(row.meta.id);
|
|
733
|
-
row.meta.tree ??= { level, hasChildren: false, isExpanded: false };
|
|
734
|
-
row.meta.tree.level = level;
|
|
735
|
-
// why: hierarchical numbering (1, 1.2, 1.2.1, ...) — STT template join('.').
|
|
736
|
-
const indexPath = [...parentPath, siblingIdx + 1];
|
|
737
|
-
row.meta.tree.indexPath = indexPath;
|
|
738
|
-
result.push(row);
|
|
739
|
-
const canDescend = row.meta.tree.isExpanded && row.meta.tree.hasChildren;
|
|
740
|
-
const depthOk = maxDepth === undefined || level < maxDepth;
|
|
741
|
-
if (!canDescend || !depthOk)
|
|
1338
|
+
const filter = this.columnFilter();
|
|
1339
|
+
if (!col || !filter)
|
|
742
1340
|
return;
|
|
743
|
-
|
|
744
|
-
|
|
1341
|
+
if (col.type === 'date' || col.type === 'time' || col.type === 'datetime') {
|
|
1342
|
+
if (col.filter?.type !== 'date') {
|
|
1343
|
+
filter[col.field] = filter[col.field] || { from: null, to: null };
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
if (col.type === 'number' && col.filter?.type === 'split-number') {
|
|
1347
|
+
filter[col.field] = filter[col.field] || { from: null, to: null };
|
|
1348
|
+
}
|
|
1349
|
+
this.#lastOnChangeValueHash = this.#filterValueHash(filter[col.field]);
|
|
745
1350
|
});
|
|
1351
|
+
}
|
|
1352
|
+
// ==========================================
|
|
1353
|
+
// 4. HANDLERS
|
|
1354
|
+
// ==========================================
|
|
1355
|
+
onFilterChange = () => {
|
|
1356
|
+
this.#emitFilterOnChange();
|
|
1357
|
+
this.filterChange.emit();
|
|
746
1358
|
};
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
const collectFormattedTreeRows = (roots) => {
|
|
752
|
-
const result = [];
|
|
753
|
-
const walk = (rows) => {
|
|
754
|
-
for (const row of rows) {
|
|
755
|
-
result.push(row);
|
|
756
|
-
const children = row.meta.tree?.childItems;
|
|
757
|
-
if (children?.length)
|
|
758
|
-
walk(children);
|
|
759
|
-
}
|
|
1359
|
+
// Blur input: commit giá trị KHÔNG trigger reload.
|
|
1360
|
+
onFilterCommit = () => {
|
|
1361
|
+
this.#emitFilterOnChange();
|
|
1362
|
+
this.filterCommit.emit();
|
|
760
1363
|
};
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
if (visited.has(row.meta.id))
|
|
773
|
-
continue;
|
|
774
|
-
visited.add(row.meta.id);
|
|
775
|
-
result.push(row);
|
|
776
|
-
const depthOk = maxDepth === undefined || level < maxDepth;
|
|
777
|
-
if (!depthOk)
|
|
778
|
-
continue;
|
|
779
|
-
const children = row.meta.tree?.childItems ?? [];
|
|
780
|
-
walk(children, level + 1);
|
|
781
|
-
}
|
|
1364
|
+
#emitFilterOnChange = () => {
|
|
1365
|
+
const col = this.column();
|
|
1366
|
+
const filter = this.columnFilter();
|
|
1367
|
+
if (!col?.filter?.onChange || !filter)
|
|
1368
|
+
return;
|
|
1369
|
+
const value = filter[col.field];
|
|
1370
|
+
const hash = this.#filterValueHash(value);
|
|
1371
|
+
if (hash === this.#lastOnChangeValueHash)
|
|
1372
|
+
return;
|
|
1373
|
+
this.#lastOnChangeValueHash = hash;
|
|
1374
|
+
col.filter.onChange(value, col, filter);
|
|
782
1375
|
};
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
};
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
const depthOk = maxDepth === undefined || level < maxDepth;
|
|
799
|
-
if (!depthOk)
|
|
800
|
-
continue;
|
|
801
|
-
walk(getChildrenFromData(row, option), level + 1);
|
|
1376
|
+
#filterValueHash = (value) => Utilities.hash({ value });
|
|
1377
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ColumnFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1378
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: ColumnFilterComponent, isStandalone: true, selector: "column-filter", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, columnFilter: { classPropertyName: "columnFilter", publicName: "columnFilter", isSignal: true, isRequired: false, transformFunction: null }, cacheValues: { classPropertyName: "cacheValues", publicName: "cacheValues", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, operator: { classPropertyName: "operator", publicName: "operator", isSignal: true, isRequired: false, transformFunction: null }, isMobile: { classPropertyName: "isMobile", publicName: "isMobile", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { operator: "operatorChange", filterChange: "filterChange", filterCommit: "filterCommit" }, ngImport: i0, template: "@let _column = column();\n@let _columnFilter = columnFilter();\n@let _autoId = autoId();\n@let _templateRef = templateRef();\n@let _operators = operators();\n@let _items = items();\n@let _label = label();\n@let _context = { columnFilter: _columnFilter, autoId: _autoId };\n\n<div class=\"d-flex c-inline-column align-items-center\" style=\"width: 100%; max-width: 100%\">\n @if (\n _column.type === 'string' ||\n _column.type === 'number' ||\n _column.type === 'boolean' ||\n _column.type === 'values' ||\n _column.type === 'lazy-values' ||\n _column.type === 'date' ||\n _column.type === 'datetime' ||\n _column.type === 'time'\n ) {\n <!-- Operator filter -->\n @if (_operators.length) {\n <sd-operator class=\"mr-4\" [(model)]=\"operator\" [operators]=\"operatorValues()\" />\n }\n\n <!-- N\u1EBFu filter nh\u1EADn v\u00E0o template -->\n @if (_templateRef) {\n <ng-container *ngTemplateOutlet=\"_templateRef; context: _context\"></ng-container>\n }\n <!-- M\u1EB7c \u0111\u1ECBnh theo type v\u00E0 gi\u00E1 tr\u1ECB values defined c\u1EE7a column -->\n @else {\n @if (_column.type === 'string') {\n <sd-input\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n type=\"text\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (keyupEnter)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n clearable\n hideInlineError>\n </sd-input>\n } @else if (_column.type === 'number') {\n @if (!_column.filter?.type) {\n <sd-input-number\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (keyupEnter)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n clearable\n hideInlineError>\n </sd-input-number>\n } @else if (_column.filter?.type === 'split-number') {\n <ng-container *ngTemplateOutlet=\"splitNumberTpl; context: { field: _column.field, disabled: _column.filter?.disabled }\">\n </ng-container>\n }\n } @else if (_column.type === 'boolean') {\n <sd-select\n minWidthPanel=\"200px\"\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n [style.width]=\"'100%'\"\n size=\"sm\"\n [label]=\"_label\"\n [items]=\"[\n { value: '1', display: _column.option?.displayOnTrue || 'True' },\n { value: '0', display: _column.option?.displayOnFalse || 'False' },\n ]\"\n valueField=\"value\"\n displayField=\"display\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n hideInlineError>\n <ng-template sdItemDef let-item=\"item\">\n @if (item.value === '1') {\n <sd-badge color=\"success\" [title]=\"_column.option?.displayOnTrue || 'True'\"> </sd-badge>\n } @else {\n <sd-badge color=\"error\" [title]=\"_column.option?.displayOnFalse || 'False'\"> </sd-badge>\n }\n </ng-template>\n </sd-select>\n } @else if (_column.type === 'values') {\n <sd-select\n minWidthPanel=\"200px\"\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n [style.width]=\"'100%'\"\n size=\"sm\"\n [label]=\"_label\"\n [items]=\"_items\"\n [valueField]=\"_column.option.valueField\"\n [displayField]=\"_column.option.displayField\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n [multiple]=\"_column.option.selection === 'MULTIPLE'\"\n hideInlineError>\n </sd-select>\n } @else if (_column.type === 'lazy-values') {\n <sd-select\n minWidthPanel=\"200px\"\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n [style.width]=\"'100%'\"\n size=\"sm\"\n [label]=\"_label\"\n [items]=\"_items\"\n [valueField]=\"_column.option.valueField\"\n [displayField]=\"_column.option.displayField\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n [multiple]=\"_column.option.selection === 'MULTIPLE'\"\n hideInlineError>\n </sd-select>\n } @else if (_column.type === 'date' || _column.type === 'datetime' || _column.type === 'time') {\n @if (!_column.filter?.type || _column.filter?.type === 'daterange') {\n <sd-date-range\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n hideInlineError>\n </sd-date-range>\n } @else if (_column.filter?.type === 'date') {\n <sd-date\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n type=\"date\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n clearable\n hideInlineError>\n </sd-date>\n } @else if (_column.filter?.type === 'split-date') {\n <ng-container *ngTemplateOutlet=\"splitDateTpl; context: { field: _column.field, disabled: _column.filter?.disabled }\">\n </ng-container>\n }\n }\n }\n } @else {\n <sd-input [autoId]=\"_autoId\" style=\"flex: 1 1 0%; min-width: 0\" type=\"text\" size=\"sm\" disabled></sd-input>\n }\n</div>\n\n<!-- ================================================ -->\n<!-- Split from/to templates (\u0111\u01B0a xu\u1ED1ng cu\u1ED1i file) -->\n<!-- ================================================ -->\n<ng-template #splitNumberTpl let-field=\"field\" let-disabled=\"disabled\">\n <div class=\"d-flex align-items-center\" style=\"flex: 1 1 0%; min-width: 0\">\n <sd-input-number\n [autoId]=\"_autoId + '-from'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[field].from\"\n (sdChange)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-input-number>\n <div class=\"mx-4\">-</div>\n <sd-input-number\n [autoId]=\"_autoId + '-to'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [(model)]=\"_columnFilter[field].to\"\n (sdChange)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-input-number>\n </div>\n</ng-template>\n\n<ng-template #splitDateTpl let-field=\"field\" let-disabled=\"disabled\">\n <div class=\"d-flex align-items-center\" style=\"flex: 1 1 0%; min-width: 0\">\n <sd-date\n [autoId]=\"_autoId + '-from'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n type=\"date\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[field].from\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-date>\n <div class=\"mx-4\">-</div>\n <sd-date\n [autoId]=\"_autoId + '-to'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n type=\"date\"\n size=\"sm\"\n [(model)]=\"_columnFilter[field].to\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-date>\n </div>\n</ng-template>\n", styles: [":host ::ng-deep .c-inline-column .mat-mdc-text-field-wrapper{background-color:#fff}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SdOperator, selector: "sd-operator", inputs: ["model", "operators", "disabled", "autoId"], outputs: ["modelChange"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "size", "form", "label", "helperText", "placeholder", "type", "mask", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdInputNumber, selector: "sd-input-number", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "type", "precision", "format", "min", "max", "validator", "inlineError", "hyperlink", "appearance", "floatLabel", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "hyperlink", "minWidthPanel", "hideInlineError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "items", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDateRange, selector: "sd-date-range", inputs: ["autoId", "name", "size", "form", "label", "helperText", "hideInlineError", "required", "disabled", "viewed", "clearable", "appearance", "floatLabel", "min", "max", "transform", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "component", type: SdBadge, selector: "sd-badge", inputs: ["type", "color", "primary", "secondary", "success", "info", "warning", "error", "fontSet", "title", "description", "tooltip", "icon", "size"], outputs: ["click"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1379
|
+
}
|
|
1380
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ColumnFilterComponent, decorators: [{
|
|
1381
|
+
type: Component,
|
|
1382
|
+
args: [{ selector: 'column-filter', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [CommonModule, SdOperator, SdInput, SdInputNumber, SdSelect, SdDate, SdDateRange, SdBadge], template: "@let _column = column();\n@let _columnFilter = columnFilter();\n@let _autoId = autoId();\n@let _templateRef = templateRef();\n@let _operators = operators();\n@let _items = items();\n@let _label = label();\n@let _context = { columnFilter: _columnFilter, autoId: _autoId };\n\n<div class=\"d-flex c-inline-column align-items-center\" style=\"width: 100%; max-width: 100%\">\n @if (\n _column.type === 'string' ||\n _column.type === 'number' ||\n _column.type === 'boolean' ||\n _column.type === 'values' ||\n _column.type === 'lazy-values' ||\n _column.type === 'date' ||\n _column.type === 'datetime' ||\n _column.type === 'time'\n ) {\n <!-- Operator filter -->\n @if (_operators.length) {\n <sd-operator class=\"mr-4\" [(model)]=\"operator\" [operators]=\"operatorValues()\" />\n }\n\n <!-- N\u1EBFu filter nh\u1EADn v\u00E0o template -->\n @if (_templateRef) {\n <ng-container *ngTemplateOutlet=\"_templateRef; context: _context\"></ng-container>\n }\n <!-- M\u1EB7c \u0111\u1ECBnh theo type v\u00E0 gi\u00E1 tr\u1ECB values defined c\u1EE7a column -->\n @else {\n @if (_column.type === 'string') {\n <sd-input\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n type=\"text\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (keyupEnter)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n clearable\n hideInlineError>\n </sd-input>\n } @else if (_column.type === 'number') {\n @if (!_column.filter?.type) {\n <sd-input-number\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (keyupEnter)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n clearable\n hideInlineError>\n </sd-input-number>\n } @else if (_column.filter?.type === 'split-number') {\n <ng-container *ngTemplateOutlet=\"splitNumberTpl; context: { field: _column.field, disabled: _column.filter?.disabled }\">\n </ng-container>\n }\n } @else if (_column.type === 'boolean') {\n <sd-select\n minWidthPanel=\"200px\"\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n [style.width]=\"'100%'\"\n size=\"sm\"\n [label]=\"_label\"\n [items]=\"[\n { value: '1', display: _column.option?.displayOnTrue || 'True' },\n { value: '0', display: _column.option?.displayOnFalse || 'False' },\n ]\"\n valueField=\"value\"\n displayField=\"display\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n hideInlineError>\n <ng-template sdItemDef let-item=\"item\">\n @if (item.value === '1') {\n <sd-badge color=\"success\" [title]=\"_column.option?.displayOnTrue || 'True'\"> </sd-badge>\n } @else {\n <sd-badge color=\"error\" [title]=\"_column.option?.displayOnFalse || 'False'\"> </sd-badge>\n }\n </ng-template>\n </sd-select>\n } @else if (_column.type === 'values') {\n <sd-select\n minWidthPanel=\"200px\"\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n [style.width]=\"'100%'\"\n size=\"sm\"\n [label]=\"_label\"\n [items]=\"_items\"\n [valueField]=\"_column.option.valueField\"\n [displayField]=\"_column.option.displayField\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n [multiple]=\"_column.option.selection === 'MULTIPLE'\"\n hideInlineError>\n </sd-select>\n } @else if (_column.type === 'lazy-values') {\n <sd-select\n minWidthPanel=\"200px\"\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n [style.width]=\"'100%'\"\n size=\"sm\"\n [label]=\"_label\"\n [items]=\"_items\"\n [valueField]=\"_column.option.valueField\"\n [displayField]=\"_column.option.displayField\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n [multiple]=\"_column.option.selection === 'MULTIPLE'\"\n hideInlineError>\n </sd-select>\n } @else if (_column.type === 'date' || _column.type === 'datetime' || _column.type === 'time') {\n @if (!_column.filter?.type || _column.filter?.type === 'daterange') {\n <sd-date-range\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n hideInlineError>\n </sd-date-range>\n } @else if (_column.filter?.type === 'date') {\n <sd-date\n [autoId]=\"_autoId\"\n style=\"flex: 1 1 0%; min-width: 0\"\n type=\"date\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[_column.field]\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"_column.filter?.disabled\"\n clearable\n hideInlineError>\n </sd-date>\n } @else if (_column.filter?.type === 'split-date') {\n <ng-container *ngTemplateOutlet=\"splitDateTpl; context: { field: _column.field, disabled: _column.filter?.disabled }\">\n </ng-container>\n }\n }\n }\n } @else {\n <sd-input [autoId]=\"_autoId\" style=\"flex: 1 1 0%; min-width: 0\" type=\"text\" size=\"sm\" disabled></sd-input>\n }\n</div>\n\n<!-- ================================================ -->\n<!-- Split from/to templates (\u0111\u01B0a xu\u1ED1ng cu\u1ED1i file) -->\n<!-- ================================================ -->\n<ng-template #splitNumberTpl let-field=\"field\" let-disabled=\"disabled\">\n <div class=\"d-flex align-items-center\" style=\"flex: 1 1 0%; min-width: 0\">\n <sd-input-number\n [autoId]=\"_autoId + '-from'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[field].from\"\n (sdChange)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-input-number>\n <div class=\"mx-4\">-</div>\n <sd-input-number\n [autoId]=\"_autoId + '-to'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n size=\"sm\"\n [(model)]=\"_columnFilter[field].to\"\n (sdChange)=\"onFilterChange()\"\n (sdBlur)=\"onFilterCommit()\"\n (cleared)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-input-number>\n </div>\n</ng-template>\n\n<ng-template #splitDateTpl let-field=\"field\" let-disabled=\"disabled\">\n <div class=\"d-flex align-items-center\" style=\"flex: 1 1 0%; min-width: 0\">\n <sd-date\n [autoId]=\"_autoId + '-from'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n type=\"date\"\n size=\"sm\"\n [label]=\"_label\"\n [(model)]=\"_columnFilter[field].from\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-date>\n <div class=\"mx-4\">-</div>\n <sd-date\n [autoId]=\"_autoId + '-to'\"\n style=\"flex: 1 1 0%; min-width: 0\"\n type=\"date\"\n size=\"sm\"\n [(model)]=\"_columnFilter[field].to\"\n (sdChange)=\"onFilterChange()\"\n [disabled]=\"disabled\"\n clearable\n hideInlineError>\n </sd-date>\n </div>\n</ng-template>\n", styles: [":host ::ng-deep .c-inline-column .mat-mdc-text-field-wrapper{background-color:#fff}\n"] }]
|
|
1383
|
+
}], ctorParameters: () => [] });
|
|
1384
|
+
|
|
1385
|
+
// Đối với filter loại values, items có thể là 1 mảng, có thể là 1 hàm, do đó cần xử lý nếu là hàm có thể xử lý gọi API
|
|
1386
|
+
class FilterValuesPipe {
|
|
1387
|
+
constructor() { }
|
|
1388
|
+
async transform(items) {
|
|
1389
|
+
if (Array.isArray(items)) {
|
|
1390
|
+
return items;
|
|
802
1391
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
1392
|
+
if (typeof items === 'function') {
|
|
1393
|
+
const results = await items();
|
|
1394
|
+
if (Array.isArray(results)) {
|
|
1395
|
+
return results;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
return [];
|
|
1399
|
+
}
|
|
1400
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FilterValuesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1401
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: FilterValuesPipe, isStandalone: true, name: "filterValues" });
|
|
1402
|
+
}
|
|
1403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: FilterValuesPipe, decorators: [{
|
|
1404
|
+
type: Pipe,
|
|
1405
|
+
args: [{
|
|
1406
|
+
name: 'filterValues',
|
|
1407
|
+
}]
|
|
1408
|
+
}], ctorParameters: () => [] });
|
|
807
1409
|
|
|
808
1410
|
class SdTreePipe {
|
|
809
1411
|
transform(items, treeOption, _revision = 0) {
|
|
@@ -944,7 +1546,7 @@ class ExternalFilterComponent {
|
|
|
944
1546
|
});
|
|
945
1547
|
};
|
|
946
1548
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ExternalFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
947
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: ExternalFilterComponent, isStandalone: true, selector: "external-filter", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, externalFilters: { classPropertyName: "externalFilters", publicName: "externalFilters", isSignal: true, isRequired: false, transformFunction: null }, filterRegister: { classPropertyName: "filterRegister", publicName: "filterRegister", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let _filter = filter();\n@let _autoId = autoId();\n@let _filterItems = filterItems();\n@let _externalFilter = externalFilter();\n@let _inlineExternal = inlineExternal();\n@let _filtered = filtered();\n@let _col = col();\n\n@if (!_filter?.disabled) {\n @if (!isMobileOrTablet && _filterItems.length) {\n <sd-section\n [hideHeader]=\"_filter?.hideExternalFilterToolbar\"\n icon=\"filter_alt\"\n iconColor=\"secondary\"\n [title]=\"'core.component.table.filter' | sdTranslate\"\n [collapsible]=\"_filter?.collapsible ?? true\">\n <div class=\"d-flex mr-4\" sdHeaderRight>\n <sd-button\n [autoId]=\"_autoId + 'clear'\"\n [disabled]=\"!_filtered\"\n type=\"text\"\n prefixIcon=\"cleaning_services\"\n [tooltip]=\"'core.component.table.clear-selection' | sdTranslate\"\n (click)=\"$event.stopPropagation(); clearFilter($event)\"></sd-button>\n <sd-button\n [autoId]=\"_autoId + 'setting'\"\n type=\"text\"\n prefixIcon=\"settings\"\n [tooltip]=\"'core.component.table.customize' | sdTranslate\"\n [matMenuTriggerFor]=\"menu\"\n (click)=\"$event.stopPropagation()\"></sd-button>\n <mat-menu #menu=\"matMenu\" class=\"sd-custom-panel-filter-configuration\" [attr.data-autoid]=\"_autoId + 'setting-menu'\">\n @for (externalFilter of _filterItems; track externalFilter.field) {\n <button\n [attr.data-autoid]=\"_autoId + 'setting-' + externalFilter.field\"\n mat-menu-item\n (click)=\"onCheckboxChange($event, externalFilter)\"\n [disabled]=\"externalFilter.required\">\n <sd-checkbox\n [autoId]=\"_autoId + 'setting-' + externalFilter.field + '-checkbox'\"\n [label]=\"externalFilter.title\"\n [model]=\"_inlineExternal[externalFilter.field]\"\n [disabled]=\"externalFilter.required\" />\n </button>\n }\n </mat-menu>\n </div>\n <div class=\"row mx-0\" style=\"row-gap: 16px\">\n @for (item of _filterItems; track item.field) {\n @if (_inlineExternal[item.field]) {\n <div class=\"col-md-3 col-sm-6 px-8\" [class.col-lg-2]=\"_col === 2\" [class.col-lg-3]=\"_col === 3\">\n @if (item.type === 'string') {\n <sd-input\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n type=\"text\"\n [(model)]=\"_externalFilter[item.field]\"\n (keyupEnter)=\"onKeyupEnter()\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n clearable\n hideInlineError>\n </sd-input>\n } @else if (item.type === 'number') {\n <sd-input-number\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [(model)]=\"_externalFilter[item.field]\"\n (keyupEnter)=\"onKeyupEnter()\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n clearable\n hideInlineError>\n </sd-input-number>\n } @else if (item.type === 'boolean') {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"[\n { value: true, display: item.option?.displayOnTrue || 'True' },\n { value: false, display: item.option?.displayOnFalse || 'False' },\n ]\"\n valueField=\"value\"\n displayField=\"display\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'date') {\n <sd-date\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n clearable\n hideInlineError>\n </sd-date>\n } @else if (item.type === 'datetime') {\n <sd-datetime\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n clearable\n hideInlineError>\n </sd-datetime>\n } @else if (item.type === 'daterange') {\n <sd-date-range\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n [form]=\"form\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n appearance=\"outline\"\n hideInlineError>\n </sd-date-range>\n } @else if (item.type === 'values') {\n @if (item.option.selection === 'MULTIPLE') {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"item.option.items | filterValues | async\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n multiple\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.option.selection === 'AUTOCOMPLETE') {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"item.option.items | filterValues | async\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.option.selection === 'MULTIPLEAUTOCOMPLETE') {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"item.option.items | filterValues | async\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n multiple\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"item.option.items | filterValues | async\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n }\n } @else if (item.type === 'lazy-values') {\n @if (item.option.selection === 'MULTIPLE') {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"item.option.items\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n multiple\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"item.option.items\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n }\n } @else if (item.type === 'custom' && item.filterDef) {\n <ng-container\n *ngTemplateOutlet=\"\n item.filterDef;\n context: { form: form, externalFilter: _externalFilter, autoId: _autoId + item.field }\n \">\n </ng-container>\n }\n </div>\n }\n }\n </div>\n @if (_filter?.manualFilter) {\n <div class=\"d-flex justify-content-end mt-16 px-8\">\n <sd-button\n [autoId]=\"_autoId + 'submit'\"\n [disabled]=\"form.invalid\"\n type=\"fill\"\n color=\"primary\"\n [title]=\"'core.component.table.search' | sdTranslate\"\n prefixIcon=\"filter_alt\"\n (click)=\"onSubmit()\">\n </sd-button>\n </div>\n }\n </sd-section>\n }\n}\n", styles: [":host{display:block;padding-left:0;padding-right:0}::ng-deep .sd-custom-panel-filter-configuration{width:240px;max-height:550px;overflow-y:auto}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i3.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i3.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i3.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: SdSection, selector: "sd-section", inputs: ["title", "subTitle", "icon", "iconColor", "collapsed", "collapsible", "hideHeader"], outputs: ["collapsedChange"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "size", "form", "label", "helperText", "placeholder", "type", "mask", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdInputNumber, selector: "sd-input-number", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "type", "precision", "format", "min", "max", "validator", "inlineError", "hyperlink", "appearance", "floatLabel", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "hyperlink", "minWidthPanel", "hideInlineError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "items", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDateRange, selector: "sd-date-range", inputs: ["autoId", "name", "size", "form", "label", "helperText", "hideInlineError", "required", "disabled", "viewed", "clearable", "appearance", "floatLabel", "min", "max", "transform", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "pipe", type: FilterValuesPipe, name: "filterValues" }, { kind: "component", type: SdCheckbox, selector: "sd-checkbox", inputs: ["autoId", "name", "form", "label", "color", "disabled", "viewed", "inlineError", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1549
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: ExternalFilterComponent, isStandalone: true, selector: "external-filter", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, externalFilters: { classPropertyName: "externalFilters", publicName: "externalFilters", isSignal: true, isRequired: false, transformFunction: null }, filterRegister: { classPropertyName: "filterRegister", publicName: "filterRegister", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let _filter = filter();\n@let _autoId = autoId();\n@let _filterItems = filterItems();\n@let _externalFilter = externalFilter();\n@let _inlineExternal = inlineExternal();\n@let _filtered = filtered();\n@let _col = col();\n\n@if (!_filter?.disabled) {\n @if (!isMobileOrTablet && _filterItems.length) {\n <sd-section\n [hideHeader]=\"_filter?.hideExternalFilterToolbar\"\n icon=\"filter_alt\"\n iconColor=\"secondary\"\n [title]=\"'core.component.table.filter' | sdTranslate\"\n [collapsible]=\"_filter?.collapsible ?? true\">\n <div class=\"d-flex mr-4\" sdHeaderRight>\n <sd-button\n [autoId]=\"_autoId + 'clear'\"\n [disabled]=\"!_filtered\"\n type=\"text\"\n prefixIcon=\"cleaning_services\"\n [tooltip]=\"'core.component.table.clear-selection' | sdTranslate\"\n (click)=\"$event.stopPropagation(); clearFilter($event)\"></sd-button>\n <sd-button\n [autoId]=\"_autoId + 'setting'\"\n type=\"text\"\n prefixIcon=\"settings\"\n [tooltip]=\"'core.component.table.customize' | sdTranslate\"\n [matMenuTriggerFor]=\"menu\"\n (click)=\"$event.stopPropagation()\"></sd-button>\n <mat-menu #menu=\"matMenu\" class=\"sd-custom-panel-filter-configuration\" [attr.data-autoid]=\"_autoId + 'setting-menu'\">\n @for (externalFilter of _filterItems; track externalFilter.field) {\n <button\n [attr.data-autoid]=\"_autoId + 'setting-' + externalFilter.field\"\n mat-menu-item\n (click)=\"onCheckboxChange($event, externalFilter)\"\n [disabled]=\"externalFilter.required\">\n <sd-checkbox\n [autoId]=\"_autoId + 'setting-' + externalFilter.field + '-checkbox'\"\n [label]=\"externalFilter.title\"\n [model]=\"_inlineExternal[externalFilter.field]\"\n [disabled]=\"externalFilter.required\" />\n </button>\n }\n </mat-menu>\n </div>\n <div class=\"row mx-0\" style=\"row-gap: 16px\">\n @for (item of _filterItems; track item.field) {\n @if (_inlineExternal[item.field]) {\n <div class=\"col-md-3 col-sm-6 px-8\" [class.col-lg-2]=\"_col === 2\" [class.col-lg-3]=\"_col === 3\">\n @if (item.type === 'string') {\n <sd-input\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n type=\"text\"\n [(model)]=\"_externalFilter[item.field]\"\n (keyupEnter)=\"onKeyupEnter()\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n clearable\n hideInlineError>\n </sd-input>\n } @else if (item.type === 'number') {\n <sd-input-number\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [(model)]=\"_externalFilter[item.field]\"\n (keyupEnter)=\"onKeyupEnter()\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n clearable\n hideInlineError>\n </sd-input-number>\n } @else if (item.type === 'boolean') {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"[\n { value: true, display: item.option?.displayOnTrue || 'True' },\n { value: false, display: item.option?.displayOnFalse || 'False' },\n ]\"\n valueField=\"value\"\n displayField=\"display\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'date') {\n <sd-date\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n clearable\n hideInlineError>\n </sd-date>\n } @else if (item.type === 'datetime') {\n <sd-datetime\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n clearable\n hideInlineError>\n </sd-datetime>\n } @else if (item.type === 'daterange') {\n <sd-date-range\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n [form]=\"form\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n appearance=\"outline\"\n hideInlineError>\n </sd-date-range>\n } @else if (item.type === 'values') {\n @if (item.option.selection === 'MULTIPLE') {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"item.option.items | filterValues | async\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n multiple\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.option.selection === 'AUTOCOMPLETE') {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"item.option.items | filterValues | async\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.option.selection === 'MULTIPLEAUTOCOMPLETE') {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"item.option.items | filterValues | async\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n multiple\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"item.option.items | filterValues | async\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n }\n } @else if (item.type === 'lazy-values') {\n @if (item.option.selection === 'MULTIPLE') {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"item.option.items\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n multiple\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else {\n <sd-select\n [autoId]=\"_autoId + item.field\"\n [label]=\"item.title\"\n [items]=\"item.option.items\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_externalFilter[item.field]\"\n (sdChange)=\"onFilter(item)\"\n appearance=\"outline\"\n [form]=\"form\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n }\n } @else if (item.type === 'custom' && item.filterDef) {\n <ng-container\n *ngTemplateOutlet=\"\n item.filterDef;\n context: { form: form, externalFilter: _externalFilter, autoId: _autoId + item.field }\n \">\n </ng-container>\n }\n </div>\n }\n }\n </div>\n @if (_filter?.manualFilter) {\n <div class=\"d-flex justify-content-end mt-16 px-8\">\n <sd-button\n [autoId]=\"_autoId + 'submit'\"\n [disabled]=\"form.invalid\"\n type=\"fill\"\n color=\"primary\"\n [title]=\"'core.component.table.search' | sdTranslate\"\n prefixIcon=\"filter_alt\"\n (click)=\"onSubmit()\">\n </sd-button>\n </div>\n }\n </sd-section>\n }\n}\n", styles: [":host{display:block;padding-left:0;padding-right:0}::ng-deep .sd-custom-panel-filter-configuration{width:240px;max-height:550px;overflow-y:auto}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i3$1.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i3$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i3$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: SdSection, selector: "sd-section", inputs: ["title", "subTitle", "icon", "iconColor", "collapsed", "collapsible", "hideHeader"], outputs: ["collapsedChange"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "size", "form", "label", "helperText", "placeholder", "type", "mask", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdInputNumber, selector: "sd-input-number", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "type", "precision", "format", "min", "max", "validator", "inlineError", "hyperlink", "appearance", "floatLabel", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "hyperlink", "minWidthPanel", "hideInlineError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "items", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDateRange, selector: "sd-date-range", inputs: ["autoId", "name", "size", "form", "label", "helperText", "hideInlineError", "required", "disabled", "viewed", "clearable", "appearance", "floatLabel", "min", "max", "transform", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "pipe", type: FilterValuesPipe, name: "filterValues" }, { kind: "component", type: SdCheckbox, selector: "sd-checkbox", inputs: ["autoId", "name", "form", "label", "color", "disabled", "viewed", "inlineError", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
948
1550
|
}
|
|
949
1551
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ExternalFilterComponent, decorators: [{
|
|
950
1552
|
type: Component,
|
|
@@ -988,154 +1590,75 @@ class MobileFilterComponent {
|
|
|
988
1590
|
externalFilters = input([]);
|
|
989
1591
|
columns = input([]);
|
|
990
1592
|
filterDefs = input([]);
|
|
991
|
-
filterRegister = input(undefined);
|
|
992
|
-
cacheValues = input(undefined);
|
|
993
|
-
// ==========================================
|
|
994
|
-
// 2. VIEW QUERY
|
|
995
|
-
// ==========================================
|
|
996
|
-
drawer = viewChild.required(SdSideDrawer);
|
|
997
|
-
// ==========================================
|
|
998
|
-
// 3. STATE — local working copies; chỉ flush khi Apply.
|
|
999
|
-
// ==========================================
|
|
1000
|
-
workingColumnFilter = signal({});
|
|
1001
|
-
workingColumnOperator = signal({});
|
|
1002
|
-
workingExternalFilter = signal({});
|
|
1003
|
-
// ==========================================
|
|
1004
|
-
// 4. COMPUTED
|
|
1005
|
-
// ==========================================
|
|
1006
|
-
autoId = computed(() => {
|
|
1007
|
-
const base = this.autoIdInput();
|
|
1008
|
-
return base ? `${base}-mobile-filter-` : '';
|
|
1009
|
-
});
|
|
1010
|
-
externalFilterItems = computed(() => this.externalFilters() || []);
|
|
1011
|
-
columnItems = computed(() => this.columns() || []);
|
|
1012
|
-
filterDefItems = computed(() => this.filterDefs() || []);
|
|
1013
|
-
// ==========================================
|
|
1014
|
-
// 5. PUBLIC API
|
|
1015
|
-
// ==========================================
|
|
1016
|
-
open = () => {
|
|
1017
|
-
const reg = this.filterRegister();
|
|
1018
|
-
const val = reg?.value.get();
|
|
1019
|
-
const cloned = (o) => (o ? JSON.parse(JSON.stringify(o)) : {});
|
|
1020
|
-
this.workingColumnFilter.set(cloned(val?.columnFilter));
|
|
1021
|
-
this.workingColumnOperator.set(cloned(val?.columnOperator));
|
|
1022
|
-
this.workingExternalFilter.set(cloned(val?.externalFilter));
|
|
1023
|
-
this.drawer().open();
|
|
1024
|
-
};
|
|
1025
|
-
close = () => this.drawer().close();
|
|
1026
|
-
// ==========================================
|
|
1027
|
-
// 6. HANDLERS
|
|
1028
|
-
// ==========================================
|
|
1029
|
-
onApply = () => {
|
|
1030
|
-
this.filterRegister()?.value.set({
|
|
1031
|
-
columnFilter: this.workingColumnFilter(),
|
|
1032
|
-
columnOperator: this.workingColumnOperator(),
|
|
1033
|
-
externalFilter: this.workingExternalFilter(),
|
|
1034
|
-
});
|
|
1035
|
-
this.drawer().close();
|
|
1036
|
-
};
|
|
1037
|
-
onCancel = () => {
|
|
1038
|
-
// Local working state — không ghi gì khi cancel, chỉ đóng drawer.
|
|
1039
|
-
this.drawer().close();
|
|
1040
|
-
};
|
|
1041
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: MobileFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1042
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: MobileFilterComponent, isStandalone: true, selector: "mobile-filter", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, externalFilters: { classPropertyName: "externalFilters", publicName: "externalFilters", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, filterDefs: { classPropertyName: "filterDefs", publicName: "filterDefs", isSignal: true, isRequired: false, transformFunction: null }, filterRegister: { classPropertyName: "filterRegister", publicName: "filterRegister", isSignal: true, isRequired: false, transformFunction: null }, cacheValues: { classPropertyName: "cacheValues", publicName: "cacheValues", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "drawer", first: true, predicate: SdSideDrawer, descendants: true, isSignal: true }], ngImport: i0, template: "@let _autoId = autoId();\n@let _externalFilterItems = externalFilterItems();\n@let _columnItems = columnItems();\n@let _filterDefItems = filterDefItems();\n@let _workingColumnFilter = workingColumnFilter();\n@let _workingColumnOperator = workingColumnOperator();\n@let _workingExternalFilter = workingExternalFilter();\n@let _cacheValues = cacheValues();\n\n<sd-side-drawer\n #drawer\n [title]=\"'core.component.table.filter' | sdTranslate\"\n width=\"90vw\">\n <div class=\"mobile-filter-body\">\n <!-- ============================ -->\n <!-- 1. External filters (inline) -->\n <!-- ============================ -->\n @if (_externalFilterItems.length) {\n <section class=\"mobile-filter-section\">\n @for (item of _externalFilterItems; track item.field) {\n <div class=\"mobile-filter-row\">\n @if (item.type === 'string') {\n <sd-input\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n type=\"text\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-input>\n } @else if (item.type === 'number') {\n <sd-input-number\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-input-number>\n } @else if (item.type === 'boolean') {\n <sd-select\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [items]=\"[\n { value: true, display: item.option?.displayOnTrue || 'True' },\n { value: false, display: item.option?.displayOnFalse || 'False' },\n ]\"\n valueField=\"value\"\n displayField=\"display\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'date') {\n <sd-date\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n hideInlineError>\n </sd-date>\n } @else if (item.type === 'datetime') {\n <sd-datetime\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n hideInlineError>\n </sd-datetime>\n } @else if (item.type === 'daterange') {\n <sd-date-range\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n appearance=\"outline\"\n hideInlineError>\n </sd-date-range>\n } @else if (item.type === 'values') {\n <sd-select\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [items]=\"item.option.items | filterValues | async\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [multiple]=\"item.option.selection === 'MULTIPLE' || item.option.selection === 'MULTIPLEAUTOCOMPLETE'\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'lazy-values') {\n <sd-select\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [items]=\"item.option.items\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [multiple]=\"item.option.selection === 'MULTIPLE'\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'custom' && item.filterDef) {\n <ng-container\n *ngTemplateOutlet=\"\n item.filterDef;\n context: { externalFilter: _workingExternalFilter, autoId: _autoId + 'ext-' + item.field }\n \">\n </ng-container>\n }\n </div>\n }\n </section>\n }\n\n <!-- ============================ -->\n <!-- 2. Custom filterDef templates -->\n <!-- ============================ -->\n @if (_filterDefItems.length) {\n <section class=\"mobile-filter-section\">\n @for (def of _filterDefItems; track def.sdTableFilterDef()) {\n <div class=\"mobile-filter-row\" [attr.data-autoid]=\"_autoId + 'def-' + def.sdTableFilterDef()\">\n <ng-container\n *ngTemplateOutlet=\"def.templateRef!; context: { externalFilter: _workingExternalFilter }\">\n </ng-container>\n </div>\n }\n </section>\n }\n\n <!-- ============================ -->\n <!-- 3. Column filters -->\n <!-- ============================ -->\n @if (_columnItems.length) {\n <section class=\"mobile-filter-section\">\n @for (column of _columnItems; track column.field) {\n <div class=\"mobile-filter-row\" [attr.data-autoid]=\"_autoId + 'col-' + column.field\">\n <column-filter\n [autoId]=\"_autoId + 'col'\"\n [column]=\"column\"\n [columnFilter]=\"_workingColumnFilter\"\n [operator]=\"$any(_workingColumnOperator[column.field])\"\n (operatorChange)=\"_workingColumnOperator[column.field] = $event!\"\n [cacheValues]=\"_cacheValues\"\n isMobile>\n </column-filter>\n </div>\n }\n </section>\n }\n </div>\n\n <ng-container sdFooterRight>\n <div class=\"mobile-filter-footer\">\n <sd-button\n [autoId]=\"_autoId + 'cancel'\"\n class=\"mobile-filter-action\"\n (click)=\"onCancel()\"\n [title]=\"'core.confirm.no' | sdTranslate\"\n type=\"text\"\n color=\"secondary\">\n </sd-button>\n <sd-button\n [autoId]=\"_autoId + 'apply'\"\n class=\"mobile-filter-action\"\n (click)=\"onApply()\"\n [title]=\"'core.confirm.yes' | sdTranslate\"\n type=\"fill\"\n color=\"primary\">\n </sd-button>\n </div>\n </ng-container>\n</sd-side-drawer>\n", styles: [".mobile-filter-body{display:flex;flex-direction:column;gap:16px;padding:8px 0}.mobile-filter-section{display:flex;flex-direction:column;gap:12px}.mobile-filter-row{display:flex;flex-direction:column}.mobile-filter-footer{display:flex;gap:8px;width:100%}.mobile-filter-action{flex:1 1 50%}.mobile-filter-action ::ng-deep button{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "component", type: SdSideDrawer, selector: "sd-side-drawer", inputs: ["title", "width", "hideClose", "disableBackdropClose", "beforeClose", "drawerClass", "autoId"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: ColumnFilterComponent, selector: "column-filter", inputs: ["autoId", "column", "columnFilter", "cacheValues", "value", "operator", "isMobile"], outputs: ["operatorChange", "filterChange", "filterCommit"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "size", "form", "label", "helperText", "placeholder", "type", "mask", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdInputNumber, selector: "sd-input-number", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "type", "precision", "format", "min", "max", "validator", "inlineError", "hyperlink", "appearance", "floatLabel", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "hyperlink", "minWidthPanel", "hideInlineError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "items", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDateRange, selector: "sd-date-range", inputs: ["autoId", "name", "size", "form", "label", "helperText", "hideInlineError", "required", "disabled", "viewed", "clearable", "appearance", "floatLabel", "min", "max", "transform", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "pipe", type: FilterValuesPipe, name: "filterValues" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1043
|
-
}
|
|
1044
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: MobileFilterComponent, decorators: [{
|
|
1045
|
-
type: Component,
|
|
1046
|
-
args: [{ selector: 'mobile-filter', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
1047
|
-
CommonModule,
|
|
1048
|
-
SdSideDrawer,
|
|
1049
|
-
SdButton,
|
|
1050
|
-
ColumnFilterComponent,
|
|
1051
|
-
SdInput,
|
|
1052
|
-
SdInputNumber,
|
|
1053
|
-
SdSelect,
|
|
1054
|
-
SdDate,
|
|
1055
|
-
SdDatetime,
|
|
1056
|
-
SdDateRange,
|
|
1057
|
-
FilterValuesPipe,
|
|
1058
|
-
SdTranslatePipe,
|
|
1059
|
-
], template: "@let _autoId = autoId();\n@let _externalFilterItems = externalFilterItems();\n@let _columnItems = columnItems();\n@let _filterDefItems = filterDefItems();\n@let _workingColumnFilter = workingColumnFilter();\n@let _workingColumnOperator = workingColumnOperator();\n@let _workingExternalFilter = workingExternalFilter();\n@let _cacheValues = cacheValues();\n\n<sd-side-drawer\n #drawer\n [title]=\"'core.component.table.filter' | sdTranslate\"\n width=\"90vw\">\n <div class=\"mobile-filter-body\">\n <!-- ============================ -->\n <!-- 1. External filters (inline) -->\n <!-- ============================ -->\n @if (_externalFilterItems.length) {\n <section class=\"mobile-filter-section\">\n @for (item of _externalFilterItems; track item.field) {\n <div class=\"mobile-filter-row\">\n @if (item.type === 'string') {\n <sd-input\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n type=\"text\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-input>\n } @else if (item.type === 'number') {\n <sd-input-number\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-input-number>\n } @else if (item.type === 'boolean') {\n <sd-select\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [items]=\"[\n { value: true, display: item.option?.displayOnTrue || 'True' },\n { value: false, display: item.option?.displayOnFalse || 'False' },\n ]\"\n valueField=\"value\"\n displayField=\"display\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'date') {\n <sd-date\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n hideInlineError>\n </sd-date>\n } @else if (item.type === 'datetime') {\n <sd-datetime\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n hideInlineError>\n </sd-datetime>\n } @else if (item.type === 'daterange') {\n <sd-date-range\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n appearance=\"outline\"\n hideInlineError>\n </sd-date-range>\n } @else if (item.type === 'values') {\n <sd-select\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [items]=\"item.option.items | filterValues | async\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [multiple]=\"item.option.selection === 'MULTIPLE' || item.option.selection === 'MULTIPLEAUTOCOMPLETE'\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'lazy-values') {\n <sd-select\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [items]=\"item.option.items\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [multiple]=\"item.option.selection === 'MULTIPLE'\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'custom' && item.filterDef) {\n <ng-container\n *ngTemplateOutlet=\"\n item.filterDef;\n context: { externalFilter: _workingExternalFilter, autoId: _autoId + 'ext-' + item.field }\n \">\n </ng-container>\n }\n </div>\n }\n </section>\n }\n\n <!-- ============================ -->\n <!-- 2. Custom filterDef templates -->\n <!-- ============================ -->\n @if (_filterDefItems.length) {\n <section class=\"mobile-filter-section\">\n @for (def of _filterDefItems; track def.sdTableFilterDef()) {\n <div class=\"mobile-filter-row\" [attr.data-autoid]=\"_autoId + 'def-' + def.sdTableFilterDef()\">\n <ng-container\n *ngTemplateOutlet=\"def.templateRef!; context: { externalFilter: _workingExternalFilter }\">\n </ng-container>\n </div>\n }\n </section>\n }\n\n <!-- ============================ -->\n <!-- 3. Column filters -->\n <!-- ============================ -->\n @if (_columnItems.length) {\n <section class=\"mobile-filter-section\">\n @for (column of _columnItems; track column.field) {\n <div class=\"mobile-filter-row\" [attr.data-autoid]=\"_autoId + 'col-' + column.field\">\n <column-filter\n [autoId]=\"_autoId + 'col'\"\n [column]=\"column\"\n [columnFilter]=\"_workingColumnFilter\"\n [operator]=\"$any(_workingColumnOperator[column.field])\"\n (operatorChange)=\"_workingColumnOperator[column.field] = $event!\"\n [cacheValues]=\"_cacheValues\"\n isMobile>\n </column-filter>\n </div>\n }\n </section>\n }\n </div>\n\n <ng-container sdFooterRight>\n <div class=\"mobile-filter-footer\">\n <sd-button\n [autoId]=\"_autoId + 'cancel'\"\n class=\"mobile-filter-action\"\n (click)=\"onCancel()\"\n [title]=\"'core.confirm.no' | sdTranslate\"\n type=\"text\"\n color=\"secondary\">\n </sd-button>\n <sd-button\n [autoId]=\"_autoId + 'apply'\"\n class=\"mobile-filter-action\"\n (click)=\"onApply()\"\n [title]=\"'core.confirm.yes' | sdTranslate\"\n type=\"fill\"\n color=\"primary\">\n </sd-button>\n </div>\n </ng-container>\n</sd-side-drawer>\n", styles: [".mobile-filter-body{display:flex;flex-direction:column;gap:16px;padding:8px 0}.mobile-filter-section{display:flex;flex-direction:column;gap:12px}.mobile-filter-row{display:flex;flex-direction:column}.mobile-filter-footer{display:flex;gap:8px;width:100%}.mobile-filter-action{flex:1 1 50%}.mobile-filter-action ::ng-deep button{width:100%}\n"] }]
|
|
1060
|
-
}] });
|
|
1061
|
-
|
|
1062
|
-
/**
|
|
1063
|
-
* Resolves the bulk actions a selection is allowed to run.
|
|
1064
|
-
*
|
|
1065
|
-
* why: tách khỏi pipe để component đọc được cùng KẾT QUẢ trong `computed()` — quick-action chỉ
|
|
1066
|
-
* được mở khi danh sách này KHÔNG rỗng, mà điều đó phải quyết định trong TS chứ không thể suy ra
|
|
1067
|
-
* từ một pipe chỉ chạy trong template.
|
|
1068
|
-
*/
|
|
1069
|
-
function sdResolveTableActions(selectedItems, actions) {
|
|
1070
|
-
const results = [];
|
|
1071
|
-
if (!actions?.length || !selectedItems?.length) {
|
|
1072
|
-
return [];
|
|
1073
|
-
}
|
|
1074
|
-
for (const action of actions) {
|
|
1075
|
-
if ('children' in action) {
|
|
1076
|
-
const children = [];
|
|
1077
|
-
for (const childAction of action.children) {
|
|
1078
|
-
const key = Utilities.hash(childAction);
|
|
1079
|
-
if (selectedItems.every(e => e?.meta?.selector?.actions?.includes(key))) {
|
|
1080
|
-
children.push(childAction);
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
if (children.length > 0) {
|
|
1084
|
-
results.push({ ...action, children });
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
else {
|
|
1088
|
-
const key = Utilities.hash(action);
|
|
1089
|
-
if (selectedItems.every(e => e?.meta?.selector?.actions?.includes(key))) {
|
|
1090
|
-
results.push(action);
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
return results.map(result => convertAction(result));
|
|
1095
|
-
}
|
|
1096
|
-
function convertAction(action) {
|
|
1097
|
-
if ('children' in action) {
|
|
1098
|
-
return {
|
|
1099
|
-
variant: 'children',
|
|
1100
|
-
title: action.title,
|
|
1101
|
-
icon: action.icon,
|
|
1102
|
-
fontSet: action.fontSet,
|
|
1103
|
-
tooltip: action.tooltip,
|
|
1104
|
-
color: action.color,
|
|
1105
|
-
type: action.type,
|
|
1106
|
-
children: action.children.map(e => ({
|
|
1107
|
-
variant: 'normal',
|
|
1108
|
-
title: e.title,
|
|
1109
|
-
icon: e.icon,
|
|
1110
|
-
color: action.color,
|
|
1111
|
-
type: action.type,
|
|
1112
|
-
fontSet: e.fontSet,
|
|
1113
|
-
tooltip: e.tooltip,
|
|
1114
|
-
click: e.click,
|
|
1115
|
-
})),
|
|
1116
|
-
};
|
|
1117
|
-
}
|
|
1118
|
-
return {
|
|
1119
|
-
variant: 'normal',
|
|
1120
|
-
title: action.title,
|
|
1121
|
-
icon: action.icon,
|
|
1122
|
-
color: action.color,
|
|
1123
|
-
type: action.type,
|
|
1124
|
-
fontSet: action.fontSet,
|
|
1125
|
-
tooltip: action.tooltip,
|
|
1126
|
-
click: action.click,
|
|
1593
|
+
filterRegister = input(undefined);
|
|
1594
|
+
cacheValues = input(undefined);
|
|
1595
|
+
// ==========================================
|
|
1596
|
+
// 2. VIEW QUERY
|
|
1597
|
+
// ==========================================
|
|
1598
|
+
drawer = viewChild.required(SdSideDrawer);
|
|
1599
|
+
// ==========================================
|
|
1600
|
+
// 3. STATE — local working copies; chỉ flush khi Apply.
|
|
1601
|
+
// ==========================================
|
|
1602
|
+
workingColumnFilter = signal({});
|
|
1603
|
+
workingColumnOperator = signal({});
|
|
1604
|
+
workingExternalFilter = signal({});
|
|
1605
|
+
// ==========================================
|
|
1606
|
+
// 4. COMPUTED
|
|
1607
|
+
// ==========================================
|
|
1608
|
+
autoId = computed(() => {
|
|
1609
|
+
const base = this.autoIdInput();
|
|
1610
|
+
return base ? `${base}-mobile-filter-` : '';
|
|
1611
|
+
});
|
|
1612
|
+
externalFilterItems = computed(() => this.externalFilters() || []);
|
|
1613
|
+
columnItems = computed(() => this.columns() || []);
|
|
1614
|
+
filterDefItems = computed(() => this.filterDefs() || []);
|
|
1615
|
+
// ==========================================
|
|
1616
|
+
// 5. PUBLIC API
|
|
1617
|
+
// ==========================================
|
|
1618
|
+
open = () => {
|
|
1619
|
+
const reg = this.filterRegister();
|
|
1620
|
+
const val = reg?.value.get();
|
|
1621
|
+
const cloned = (o) => (o ? JSON.parse(JSON.stringify(o)) : {});
|
|
1622
|
+
this.workingColumnFilter.set(cloned(val?.columnFilter));
|
|
1623
|
+
this.workingColumnOperator.set(cloned(val?.columnOperator));
|
|
1624
|
+
this.workingExternalFilter.set(cloned(val?.externalFilter));
|
|
1625
|
+
this.drawer().open();
|
|
1127
1626
|
};
|
|
1627
|
+
close = () => this.drawer().close();
|
|
1628
|
+
// ==========================================
|
|
1629
|
+
// 6. HANDLERS
|
|
1630
|
+
// ==========================================
|
|
1631
|
+
onApply = () => {
|
|
1632
|
+
this.filterRegister()?.value.set({
|
|
1633
|
+
columnFilter: this.workingColumnFilter(),
|
|
1634
|
+
columnOperator: this.workingColumnOperator(),
|
|
1635
|
+
externalFilter: this.workingExternalFilter(),
|
|
1636
|
+
});
|
|
1637
|
+
this.drawer().close();
|
|
1638
|
+
};
|
|
1639
|
+
onCancel = () => {
|
|
1640
|
+
// Local working state — không ghi gì khi cancel, chỉ đóng drawer.
|
|
1641
|
+
this.drawer().close();
|
|
1642
|
+
};
|
|
1643
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: MobileFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1644
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: MobileFilterComponent, isStandalone: true, selector: "mobile-filter", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, externalFilters: { classPropertyName: "externalFilters", publicName: "externalFilters", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, filterDefs: { classPropertyName: "filterDefs", publicName: "filterDefs", isSignal: true, isRequired: false, transformFunction: null }, filterRegister: { classPropertyName: "filterRegister", publicName: "filterRegister", isSignal: true, isRequired: false, transformFunction: null }, cacheValues: { classPropertyName: "cacheValues", publicName: "cacheValues", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "drawer", first: true, predicate: SdSideDrawer, descendants: true, isSignal: true }], ngImport: i0, template: "@let _autoId = autoId();\n@let _externalFilterItems = externalFilterItems();\n@let _columnItems = columnItems();\n@let _filterDefItems = filterDefItems();\n@let _workingColumnFilter = workingColumnFilter();\n@let _workingColumnOperator = workingColumnOperator();\n@let _workingExternalFilter = workingExternalFilter();\n@let _cacheValues = cacheValues();\n\n<sd-side-drawer\n #drawer\n [title]=\"'core.component.table.filter' | sdTranslate\"\n width=\"90vw\">\n <div class=\"mobile-filter-body\">\n <!-- ============================ -->\n <!-- 1. External filters (inline) -->\n <!-- ============================ -->\n @if (_externalFilterItems.length) {\n <section class=\"mobile-filter-section\">\n @for (item of _externalFilterItems; track item.field) {\n <div class=\"mobile-filter-row\">\n @if (item.type === 'string') {\n <sd-input\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n type=\"text\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-input>\n } @else if (item.type === 'number') {\n <sd-input-number\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-input-number>\n } @else if (item.type === 'boolean') {\n <sd-select\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [items]=\"[\n { value: true, display: item.option?.displayOnTrue || 'True' },\n { value: false, display: item.option?.displayOnFalse || 'False' },\n ]\"\n valueField=\"value\"\n displayField=\"display\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'date') {\n <sd-date\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n hideInlineError>\n </sd-date>\n } @else if (item.type === 'datetime') {\n <sd-datetime\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n hideInlineError>\n </sd-datetime>\n } @else if (item.type === 'daterange') {\n <sd-date-range\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n appearance=\"outline\"\n hideInlineError>\n </sd-date-range>\n } @else if (item.type === 'values') {\n <sd-select\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [items]=\"item.option.items | filterValues | async\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [multiple]=\"item.option.selection === 'MULTIPLE' || item.option.selection === 'MULTIPLEAUTOCOMPLETE'\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'lazy-values') {\n <sd-select\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [items]=\"item.option.items\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [multiple]=\"item.option.selection === 'MULTIPLE'\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'custom' && item.filterDef) {\n <ng-container\n *ngTemplateOutlet=\"\n item.filterDef;\n context: { externalFilter: _workingExternalFilter, autoId: _autoId + 'ext-' + item.field }\n \">\n </ng-container>\n }\n </div>\n }\n </section>\n }\n\n <!-- ============================ -->\n <!-- 2. Custom filterDef templates -->\n <!-- ============================ -->\n @if (_filterDefItems.length) {\n <section class=\"mobile-filter-section\">\n @for (def of _filterDefItems; track def.sdTableFilterDef()) {\n <div class=\"mobile-filter-row\" [attr.data-autoid]=\"_autoId + 'def-' + def.sdTableFilterDef()\">\n <ng-container\n *ngTemplateOutlet=\"def.templateRef!; context: { externalFilter: _workingExternalFilter }\">\n </ng-container>\n </div>\n }\n </section>\n }\n\n <!-- ============================ -->\n <!-- 3. Column filters -->\n <!-- ============================ -->\n @if (_columnItems.length) {\n <section class=\"mobile-filter-section\">\n @for (column of _columnItems; track column.field) {\n <div class=\"mobile-filter-row\" [attr.data-autoid]=\"_autoId + 'col-' + column.field\">\n <column-filter\n [autoId]=\"_autoId + 'col'\"\n [column]=\"column\"\n [columnFilter]=\"_workingColumnFilter\"\n [operator]=\"$any(_workingColumnOperator[column.field])\"\n (operatorChange)=\"_workingColumnOperator[column.field] = $event!\"\n [cacheValues]=\"_cacheValues\"\n isMobile>\n </column-filter>\n </div>\n }\n </section>\n }\n </div>\n\n <ng-container sdFooterRight>\n <div class=\"mobile-filter-footer\">\n <sd-button\n [autoId]=\"_autoId + 'cancel'\"\n class=\"mobile-filter-action\"\n (click)=\"onCancel()\"\n [title]=\"'core.confirm.no' | sdTranslate\"\n type=\"text\"\n color=\"secondary\">\n </sd-button>\n <sd-button\n [autoId]=\"_autoId + 'apply'\"\n class=\"mobile-filter-action\"\n (click)=\"onApply()\"\n [title]=\"'core.confirm.yes' | sdTranslate\"\n type=\"fill\"\n color=\"primary\">\n </sd-button>\n </div>\n </ng-container>\n</sd-side-drawer>\n", styles: [".mobile-filter-body{display:flex;flex-direction:column;gap:16px;padding:8px 0}.mobile-filter-section{display:flex;flex-direction:column;gap:12px}.mobile-filter-row{display:flex;flex-direction:column}.mobile-filter-footer{display:flex;gap:8px;width:100%}.mobile-filter-action{flex:1 1 50%}.mobile-filter-action ::ng-deep button{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "component", type: SdSideDrawer, selector: "sd-side-drawer", inputs: ["title", "width", "hideClose", "disableBackdropClose", "beforeClose", "drawerClass", "autoId"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: ColumnFilterComponent, selector: "column-filter", inputs: ["autoId", "column", "columnFilter", "cacheValues", "value", "operator", "isMobile"], outputs: ["operatorChange", "filterChange", "filterCommit"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "size", "form", "label", "helperText", "placeholder", "type", "mask", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdInputNumber, selector: "sd-input-number", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "type", "precision", "format", "min", "max", "validator", "inlineError", "hyperlink", "appearance", "floatLabel", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdSelect, selector: "sd-select", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "valueField", "displayField", "disabledField", "cacheChecksum", "limit", "hyperlink", "minWidthPanel", "hideInlineError", "required", "disabled", "viewed", "multiple", "showSelectAll", "clearable", "validator", "inlineError", "appearance", "floatLabel", "items", "model"], outputs: ["modelChange", "sdChange", "sdSelection"] }, { kind: "component", type: SdDate, selector: "sd-date", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDatetime, selector: "sd-datetime", inputs: ["autoId", "name", "size", "form", "label", "helperText", "placeholder", "hideInlineError", "required", "disabled", "viewed", "showSeconds", "clearable", "inlineError", "hyperlink", "appearance", "floatLabel", "min", "minDate", "max", "maxDate", "transform", "model"], outputs: ["modelChange", "sdChange", "sdFocus"] }, { kind: "component", type: SdDateRange, selector: "sd-date-range", inputs: ["autoId", "name", "size", "form", "label", "helperText", "hideInlineError", "required", "disabled", "viewed", "clearable", "appearance", "floatLabel", "min", "max", "transform", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "pipe", type: FilterValuesPipe, name: "filterValues" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1128
1645
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1646
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: MobileFilterComponent, decorators: [{
|
|
1647
|
+
type: Component,
|
|
1648
|
+
args: [{ selector: 'mobile-filter', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
1649
|
+
CommonModule,
|
|
1650
|
+
SdSideDrawer,
|
|
1651
|
+
SdButton,
|
|
1652
|
+
ColumnFilterComponent,
|
|
1653
|
+
SdInput,
|
|
1654
|
+
SdInputNumber,
|
|
1655
|
+
SdSelect,
|
|
1656
|
+
SdDate,
|
|
1657
|
+
SdDatetime,
|
|
1658
|
+
SdDateRange,
|
|
1659
|
+
FilterValuesPipe,
|
|
1660
|
+
SdTranslatePipe,
|
|
1661
|
+
], template: "@let _autoId = autoId();\n@let _externalFilterItems = externalFilterItems();\n@let _columnItems = columnItems();\n@let _filterDefItems = filterDefItems();\n@let _workingColumnFilter = workingColumnFilter();\n@let _workingColumnOperator = workingColumnOperator();\n@let _workingExternalFilter = workingExternalFilter();\n@let _cacheValues = cacheValues();\n\n<sd-side-drawer\n #drawer\n [title]=\"'core.component.table.filter' | sdTranslate\"\n width=\"90vw\">\n <div class=\"mobile-filter-body\">\n <!-- ============================ -->\n <!-- 1. External filters (inline) -->\n <!-- ============================ -->\n @if (_externalFilterItems.length) {\n <section class=\"mobile-filter-section\">\n @for (item of _externalFilterItems; track item.field) {\n <div class=\"mobile-filter-row\">\n @if (item.type === 'string') {\n <sd-input\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n type=\"text\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-input>\n } @else if (item.type === 'number') {\n <sd-input-number\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-input-number>\n } @else if (item.type === 'boolean') {\n <sd-select\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [items]=\"[\n { value: true, display: item.option?.displayOnTrue || 'True' },\n { value: false, display: item.option?.displayOnFalse || 'False' },\n ]\"\n valueField=\"value\"\n displayField=\"display\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'date') {\n <sd-date\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n hideInlineError>\n </sd-date>\n } @else if (item.type === 'datetime') {\n <sd-datetime\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n hideInlineError>\n </sd-datetime>\n } @else if (item.type === 'daterange') {\n <sd-date-range\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n [required]=\"item.required\"\n [min]=\"item.minDate\"\n [max]=\"item.maxDate\"\n appearance=\"outline\"\n hideInlineError>\n </sd-date-range>\n } @else if (item.type === 'values') {\n <sd-select\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [items]=\"item.option.items | filterValues | async\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [multiple]=\"item.option.selection === 'MULTIPLE' || item.option.selection === 'MULTIPLEAUTOCOMPLETE'\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'lazy-values') {\n <sd-select\n [autoId]=\"_autoId + 'ext-' + item.field\"\n size=\"sm\"\n [label]=\"item.title\"\n [items]=\"item.option.items\"\n [valueField]=\"item.option.valueField\"\n [displayField]=\"item.option.displayField\"\n [(model)]=\"_workingExternalFilter[item.field]\"\n appearance=\"outline\"\n [multiple]=\"item.option.selection === 'MULTIPLE'\"\n [required]=\"item.required\"\n hideInlineError>\n </sd-select>\n } @else if (item.type === 'custom' && item.filterDef) {\n <ng-container\n *ngTemplateOutlet=\"\n item.filterDef;\n context: { externalFilter: _workingExternalFilter, autoId: _autoId + 'ext-' + item.field }\n \">\n </ng-container>\n }\n </div>\n }\n </section>\n }\n\n <!-- ============================ -->\n <!-- 2. Custom filterDef templates -->\n <!-- ============================ -->\n @if (_filterDefItems.length) {\n <section class=\"mobile-filter-section\">\n @for (def of _filterDefItems; track def.sdTableFilterDef()) {\n <div class=\"mobile-filter-row\" [attr.data-autoid]=\"_autoId + 'def-' + def.sdTableFilterDef()\">\n <ng-container\n *ngTemplateOutlet=\"def.templateRef!; context: { externalFilter: _workingExternalFilter }\">\n </ng-container>\n </div>\n }\n </section>\n }\n\n <!-- ============================ -->\n <!-- 3. Column filters -->\n <!-- ============================ -->\n @if (_columnItems.length) {\n <section class=\"mobile-filter-section\">\n @for (column of _columnItems; track column.field) {\n <div class=\"mobile-filter-row\" [attr.data-autoid]=\"_autoId + 'col-' + column.field\">\n <column-filter\n [autoId]=\"_autoId + 'col'\"\n [column]=\"column\"\n [columnFilter]=\"_workingColumnFilter\"\n [operator]=\"$any(_workingColumnOperator[column.field])\"\n (operatorChange)=\"_workingColumnOperator[column.field] = $event!\"\n [cacheValues]=\"_cacheValues\"\n isMobile>\n </column-filter>\n </div>\n }\n </section>\n }\n </div>\n\n <ng-container sdFooterRight>\n <div class=\"mobile-filter-footer\">\n <sd-button\n [autoId]=\"_autoId + 'cancel'\"\n class=\"mobile-filter-action\"\n (click)=\"onCancel()\"\n [title]=\"'core.confirm.no' | sdTranslate\"\n type=\"text\"\n color=\"secondary\">\n </sd-button>\n <sd-button\n [autoId]=\"_autoId + 'apply'\"\n class=\"mobile-filter-action\"\n (click)=\"onApply()\"\n [title]=\"'core.confirm.yes' | sdTranslate\"\n type=\"fill\"\n color=\"primary\">\n </sd-button>\n </div>\n </ng-container>\n</sd-side-drawer>\n", styles: [".mobile-filter-body{display:flex;flex-direction:column;gap:16px;padding:8px 0}.mobile-filter-section{display:flex;flex-direction:column;gap:12px}.mobile-filter-row{display:flex;flex-direction:column}.mobile-filter-footer{display:flex;gap:8px;width:100%}.mobile-filter-action{flex:1 1 50%}.mobile-filter-action ::ng-deep button{width:100%}\n"] }]
|
|
1139
1662
|
}] });
|
|
1140
1663
|
|
|
1141
1664
|
class SelectorActionComponent {
|
|
@@ -1180,7 +1703,7 @@ class SelectorActionComponent {
|
|
|
1180
1703
|
}
|
|
1181
1704
|
};
|
|
1182
1705
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SelectorActionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1183
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SelectorActionComponent, isStandalone: true, selector: "selector-action", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, tableOption: { classPropertyName: "tableOption", publicName: "tableOption", isSignal: true, isRequired: false, transformFunction: null }, selectedTableItems: { classPropertyName: "selectedTableItems", publicName: "selectedTableItems", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { clear: "clear" }, ngImport: i0, template: "@let _actions = actions();\n@let _selectedTableItems = selectedTableItems();\n@let _autoId = autoId();\n\n<sd-quick-action [opened]=\"opened()\">\n <div class=\"d-flex align-items-center\" sdMessage>\n <div class=\"c-bg-length\">\n <span class=\"c-length\">{{ _selectedTableItems?.length }}</span>\n </div>\n <div class=\"c-message\">\n {{ message() }}\n </div>\n </div>\n\n <div class=\"d-flex align-items-center mr-8\" sdAction>\n @for (action of _actions; track $index) {\n @if (action.variant === 'normal') {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-action-' + $index : null\"\n class=\"ml-4\"\n [tooltip]=\"action.tooltip\"\n [prefixIcon]=\"action.icon\"\n [color]=\"action.color\"\n [type]=\"action.type || 'light'\"\n [fontSet]=\"action.fontSet\"\n [title]=\"action.title\"\n (click)=\"onClickAction(action)\"></sd-button>\n } @else if (action.variant === 'children') {\n @let _actionIndex = $index;\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-action-' + _actionIndex : null\"\n class=\"ml-4\"\n [tooltip]=\"action.tooltip\"\n [prefixIcon]=\"action.icon || 'more_vert'\"\n [color]=\"action.color || 'secondary'\"\n [type]=\"action.type || 'light'\"\n [fontSet]=\"action.fontSet\"\n [title]=\"action.title\"\n [matMenuTriggerFor]=\"menu\">\n </sd-button>\n <mat-menu #menu=\"matMenu\">\n <span>\n @for (child of action.children; track $index) {\n <button\n mat-menu-item\n [attr.data-autoid]=\"_autoId ? _autoId + '-action-' + _actionIndex + '-' + $index : null\"\n (click)=\"onClickAction(child)\">\n @if (child.icon) {\n <sd-icon [fontSet]=\"child.fontSet\" class=\"c-icon\" [name]=\"child.icon\"></sd-icon>\n }\n <span> {{ child.title }}</span>\n </button>\n }\n </span>\n </mat-menu>\n }\n }\n <!-- why: thanh n\u00E0y ch\u1EC9 m\u1EDF khi C\u00D3 action (xem `opened`), n\u00EAn n\u00FAt \u2715 lu\u00F4n \u0111i k\u00E8m \u00EDt nh\u1EA5t m\u1ED9t\n action \u2014 n\u00F3 l\u00E0 l\u1ED1i tho\u00E1t nhanh, kh\u00F4ng c\u00F2n l\u00E0 n\u1ED9i dung duy nh\u1EA5t c\u1EE7a thanh. -->\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-clear-selection' : null\"\n class=\"ml-4\"\n prefixIcon=\"close\"\n color=\"secondary\"\n type=\"outline\"\n (click)=\"onClear()\"\n width=\"35px\"></sd-button>\n </div>\n</sd-quick-action>\n", styles: [".c-bg-length{display:flex;flex-direction:column;align-items:flex-start;padding:12px 8px;position:static;width:auto;min-width:48px;height:48px;left:0;top:0;background:var(--sd-primary);border-radius:8px 0 0 8px}.c-bg-length .c-length{position:static;width:auto;min-width:32px;height:24px;left:8px;top:12px;font-family:Roboto;font-style:normal;font-weight:500;font-size:16px;line-height:24px;text-align:center;color:#fff}.c-message{position:static;min-width:200px;height:20px;left:0;top:6px;font-family:Roboto;font-style:normal;font-weight:400;font-size:14px;line-height:20px;color:#000;margin:0 0 0 8px}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i3.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i3.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i3.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdQuickAction, selector: "sd-quick-action", inputs: ["opened"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1706
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SelectorActionComponent, isStandalone: true, selector: "selector-action", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, tableOption: { classPropertyName: "tableOption", publicName: "tableOption", isSignal: true, isRequired: false, transformFunction: null }, selectedTableItems: { classPropertyName: "selectedTableItems", publicName: "selectedTableItems", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { clear: "clear" }, ngImport: i0, template: "@let _actions = actions();\n@let _selectedTableItems = selectedTableItems();\n@let _autoId = autoId();\n\n<sd-quick-action [opened]=\"opened()\">\n <div class=\"d-flex align-items-center\" sdMessage>\n <div class=\"c-bg-length\">\n <span class=\"c-length\">{{ _selectedTableItems?.length }}</span>\n </div>\n <div class=\"c-message\">\n {{ message() }}\n </div>\n </div>\n\n <div class=\"d-flex align-items-center mr-8\" sdAction>\n @for (action of _actions; track $index) {\n @if (action.variant === 'normal') {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-action-' + $index : null\"\n class=\"ml-4\"\n [tooltip]=\"action.tooltip\"\n [prefixIcon]=\"action.icon\"\n [color]=\"action.color\"\n [type]=\"action.type || 'light'\"\n [fontSet]=\"action.fontSet\"\n [title]=\"action.title\"\n (click)=\"onClickAction(action)\"></sd-button>\n } @else if (action.variant === 'children') {\n @let _actionIndex = $index;\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-action-' + _actionIndex : null\"\n class=\"ml-4\"\n [tooltip]=\"action.tooltip\"\n [prefixIcon]=\"action.icon || 'more_vert'\"\n [color]=\"action.color || 'secondary'\"\n [type]=\"action.type || 'light'\"\n [fontSet]=\"action.fontSet\"\n [title]=\"action.title\"\n [matMenuTriggerFor]=\"menu\">\n </sd-button>\n <mat-menu #menu=\"matMenu\">\n <span>\n @for (child of action.children; track $index) {\n <button\n mat-menu-item\n [attr.data-autoid]=\"_autoId ? _autoId + '-action-' + _actionIndex + '-' + $index : null\"\n (click)=\"onClickAction(child)\">\n @if (child.icon) {\n <sd-icon [fontSet]=\"child.fontSet\" class=\"c-icon\" [name]=\"child.icon\"></sd-icon>\n }\n <span> {{ child.title }}</span>\n </button>\n }\n </span>\n </mat-menu>\n }\n }\n <!-- why: thanh n\u00E0y ch\u1EC9 m\u1EDF khi C\u00D3 action (xem `opened`), n\u00EAn n\u00FAt \u2715 lu\u00F4n \u0111i k\u00E8m \u00EDt nh\u1EA5t m\u1ED9t\n action \u2014 n\u00F3 l\u00E0 l\u1ED1i tho\u00E1t nhanh, kh\u00F4ng c\u00F2n l\u00E0 n\u1ED9i dung duy nh\u1EA5t c\u1EE7a thanh. -->\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-clear-selection' : null\"\n class=\"ml-4\"\n prefixIcon=\"close\"\n color=\"secondary\"\n type=\"outline\"\n (click)=\"onClear()\"\n width=\"35px\"></sd-button>\n </div>\n</sd-quick-action>\n", styles: [".c-bg-length{display:flex;flex-direction:column;align-items:flex-start;padding:12px 8px;position:static;width:auto;min-width:48px;height:48px;left:0;top:0;background:var(--sd-primary);border-radius:8px 0 0 8px}.c-bg-length .c-length{position:static;width:auto;min-width:32px;height:24px;left:8px;top:12px;font-family:Roboto;font-style:normal;font-weight:500;font-size:16px;line-height:24px;text-align:center;color:#fff}.c-message{position:static;min-width:200px;height:20px;left:0;top:6px;font-family:Roboto;font-style:normal;font-weight:400;font-size:14px;line-height:20px;color:#000;margin:0 0 0 8px}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i3$1.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i3$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i3$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdQuickAction, selector: "sd-quick-action", inputs: ["opened", "contained"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1184
1707
|
}
|
|
1185
1708
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SelectorActionComponent, decorators: [{
|
|
1186
1709
|
type: Component,
|
|
@@ -1504,7 +2027,7 @@ class ConfigComponent {
|
|
|
1504
2027
|
this.dragDisabled = true;
|
|
1505
2028
|
}
|
|
1506
2029
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ConfigComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1507
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: ConfigComponent, isStandalone: true, selector: "config", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, tableOption: { classPropertyName: "tableOption", publicName: "tableOption", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { changes: "changes" }, providers: [ConfigService], viewQueries: [{ propertyName: "modal", first: true, predicate: SdModal, descendants: true, isSignal: true }, { propertyName: "table", first: true, predicate: MatTable, descendants: true, isSignal: true }], ngImport: i0, template: "@let _configuration = configuration();\n@let _autoId = autoId();\n@let _columns = ['invisible', 'title', 'width', 'fixed', 'truncate'];\n\n<sd-modal width=\"sm\" [title]=\"'core.component.table.setup' | sdTranslate\" #modal>\n @if (_configuration) {\n <div class=\"c-container sd-table-config\">\n <!-- why: drag handle l\u00E0 affordance duy nh\u1EA5t cho vi\u1EC7c \u0111\u1ED5i th\u1EE9 t\u1EF1 c\u1ED9t, v\u00E0 n\u00F3 kh\u00F4ng t\u1EF1 n\u00F3i ra\n \u0111i\u1EC1u \u0111\u00F3 \u2014 m\u1ED9t d\u00F2ng hint tr\u00E1nh vi\u1EC7c ng\u01B0\u1EDDi d\u00F9ng kh\u00F4ng bao gi\u1EDD ph\u00E1t hi\u1EC7n t\u00EDnh n\u0103ng.\n K\u00FD hi\u1EC7u \u283F n\u1EB1m S\u1EB4N trong chu\u1ED7i i18n (\u0111\u00FAng v\u1ECB tr\u00ED trong c\u00E2u), n\u00EAn kh\u00F4ng k\u00E8m icon ri\u00EAng. -->\n <p class=\"c-hint\">{{ 'core.component.table.config.drag-hint' | sdTranslate }}</p>\n\n <div class=\"c-table\">\n <table\n mat-table\n [dataSource]=\"_configuration.columns!\"\n cdkDropList\n [cdkDropListData]=\"_configuration.columns\"\n (cdkDropListDropped)=\"dropTable($event)\">\n <ng-container matColumnDef=\"invisible\">\n <th mat-header-cell class=\"c-th\" *matHeaderCellDef>\n {{ 'core.component.form-builder.display' | sdTranslate }}\n </th>\n <td mat-cell *matCellDef=\"let item\">\n <div class=\"c-display-cell\">\n <button\n type=\"button\"\n class=\"c-handle\"\n [title]=\"'core.component.table.config.drag-handle' | sdTranslate\"\n [attr.aria-label]=\"'core.component.table.config.drag-handle' | sdTranslate\"\n (mousedown)=\"handleMouseDown()\"\n (mouseup)=\"handleMouseUp()\">\n <sd-icon name=\"drag_indicator\" aria-hidden=\"true\"></sd-icon>\n </button>\n <!-- why: \u00F4 \"Hi\u1EC3n th\u1ECB\" KH\u00D4NG bao gi\u1EDD b\u1ECB kho\u00E1 \u2014 n\u00F3 l\u00E0 \u0111\u01B0\u1EDDng duy nh\u1EA5t \u0111\u1EC3 b\u1EADt l\u1EA1i m\u1ED9t\n c\u1ED9t \u0111\u00E3 t\u1EAFt. -->\n <sd-checkbox [model]=\"!item.invisible\" (modelChange)=\"item.invisible = !item.invisible\" />\n </div>\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"title\">\n <th mat-header-cell class=\"c-th\" *matHeaderCellDef>\n {{ 'core.component.table.column-header' | sdTranslate }}\n </th>\n <td mat-cell *matCellDef=\"let item\">\n <sd-input\n size=\"sm\"\n [placeholder]=\"item?.origin?.title\"\n [(model)]=\"item.title\"\n [disabled]=\"isRowDisabled(item)\"\n hideInlineError></sd-input>\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"width\">\n <th mat-header-cell class=\"c-th c-col-width\" *matHeaderCellDef>\n {{ 'core.component.table.width' | sdTranslate }}\n </th>\n <td mat-cell class=\"c-col-width\" *matCellDef=\"let item\">\n <sd-input\n size=\"sm\"\n [placeholder]=\"item?.origin?.width\"\n [(model)]=\"item.width\"\n [disabled]=\"isRowDisabled(item)\"\n hideInlineError></sd-input>\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"fixed\">\n <th mat-header-cell class=\"c-th c-col-toggle\" *matHeaderCellDef>\n {{ 'core.component.table.fixed' | sdTranslate }}\n </th>\n <td mat-cell class=\"c-col-toggle\" *matCellDef=\"let item\">\n <sd-checkbox [(model)]=\"item.fixed\" [disabled]=\"isRowDisabled(item)\" />\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"truncate\">\n <th mat-header-cell class=\"c-th c-col-toggle\" *matHeaderCellDef>\n {{ 'core.component.table.char-limit' | sdTranslate }}\n </th>\n <td mat-cell class=\"c-col-toggle\" *matCellDef=\"let item\">\n <sd-checkbox [(model)]=\"item.truncate\" [disabled]=\"isRowDisabled(item)\" />\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"_columns; sticky: true\"></tr>\n <tr\n mat-row\n *matRowDef=\"let row; columns: _columns\"\n [class.c-row-hidden]=\"isRowDisabled(row)\"\n cdkDrag\n [cdkDragData]=\"row\"\n cdkDragLockAxis=\"y\"\n [cdkDragDisabled]=\"dragDisabled\">\n </tr>\n </table>\n </div>\n </div>\n }\n <ng-container sdFooterRight>\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-config-skip' : null\"\n (click)=\"close()\"\n [title]=\"'core.component.table.skip' | sdTranslate\"\n color=\"secondary\">\n </sd-button>\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-config-reset' : null\"\n (click)=\"onReset()\"\n [title]=\"'core.component.form-builder.default' | sdTranslate\"\n color=\"primary\">\n </sd-button>\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-config-apply' : null\"\n (click)=\"onSave()\"\n [title]=\"'core.component.table.apply' | sdTranslate\"\n type=\"fill\"\n color=\"primary\">\n </sd-button>\n </ng-container>\n</sd-modal>\n", styles: [".c-container{position:relative;min-height:200px;padding:16px}.c-hint{margin:0 0 12px;color:var(--sd-text-secondary, #6b7280);font-size:12px;line-height:18px}.c-table{position:relative;overflow:auto;max-height:60vh;border:1px solid var(--mat-sys-outline-variant, rgba(0, 0, 0, .08));border-radius:8px}.c-table table{width:100%;background:transparent}.c-table .c-th{font-weight:500;font-size:13px;line-height:18px;color:var(--sd-text-secondary, #6b7280);background:var(--mat-sys-surface-container-low, #f7f8fa);white-space:nowrap}.c-table .mat-mdc-header-cell,.c-table .mat-mdc-cell{padding:8px 12px;border-bottom-color:var(--mat-sys-outline-variant, rgba(0, 0, 0, .08))}.c-table .mat-mdc-header-cell:first-of-type,.c-table .mat-mdc-cell:first-of-type{padding-left:12px}.c-table .mat-mdc-row:last-of-type .mat-mdc-cell{border-bottom:none}.c-table .mat-mdc-row:hover .mat-mdc-cell{background:var(--mat-sys-surface-container-low, rgba(0, 0, 0, .02))}.c-table .c-col-width{width:104px}.c-table .c-col-toggle{width:88px;text-align:center}.c-display-cell{display:flex;align-items:center;gap:8px}.c-handle{display:inline-flex;align-items:center;justify-content:center;padding:0;border:0;background:none;color:var(--sd-text-disabled, #b6bcc6);cursor:grab;transition:color .15s ease}.c-handle:hover,.c-handle:focus-visible{color:var(--sd-text-secondary, #6b7280);outline:none}.c-handle:active{cursor:grabbing}.c-row-hidden .mat-mdc-cell{background:var(--mat-sys-surface-container-low, rgba(0, 0, 0, .015))}.c-row-hidden sd-input,.c-row-hidden .c-col-toggle sd-checkbox{opacity:.55}.cdk-drag-preview{display:table;border-radius:8px;background:var(--mat-sys-surface, #fff);outline:1px solid var(--sd-primary, #2a66f4);box-shadow:0 12px 28px #00000029,0 2px 8px #00000014;opacity:.98}.cdk-drag-preview .mat-mdc-cell{border-bottom:none;padding:8px 12px}.cdk-drag-preview .c-handle{color:var(--sd-primary, #2a66f4);cursor:grabbing}.cdk-drag-placeholder .mat-mdc-cell{background:var(--sd-primary-light, rgba(42, 102, 244, .06));border-bottom:none;box-shadow:inset 0 1px 0 var(--sd-primary, #2a66f4),inset 0 -1px 0 var(--sd-primary, #2a66f4)}.cdk-drag-placeholder .mat-mdc-cell>*{visibility:hidden}.cdk-drag-animating,.c-table.cdk-drop-list-dragging .mat-mdc-row:not(.cdk-drag-placeholder){transition:transform .22s cubic-bezier(0,0,.2,1)}.c-table.cdk-drop-list-dragging .mat-mdc-row:hover .mat-mdc-cell{background:transparent}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i5.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i5.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i5.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: CdkTableModule }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i10.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i10.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdCheckbox, selector: "sd-checkbox", inputs: ["autoId", "name", "form", "label", "color", "disabled", "viewed", "inlineError", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "size", "form", "label", "helperText", "placeholder", "type", "mask", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdModal, selector: "sd-modal", inputs: ["autoId", "title", "color", "width", "height", "view", "modalClass", "lazyLoadContent", "hideClose", "disableBackdropClose", "beforeClose"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }] });
|
|
2030
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: ConfigComponent, isStandalone: true, selector: "config", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, tableOption: { classPropertyName: "tableOption", publicName: "tableOption", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { changes: "changes" }, providers: [ConfigService], viewQueries: [{ propertyName: "modal", first: true, predicate: SdModal, descendants: true, isSignal: true }, { propertyName: "table", first: true, predicate: MatTable, descendants: true, isSignal: true }], ngImport: i0, template: "@let _configuration = configuration();\n@let _autoId = autoId();\n@let _columns = ['invisible', 'title', 'width', 'fixed', 'truncate'];\n\n<sd-modal width=\"sm\" [title]=\"'core.component.table.setup' | sdTranslate\" #modal>\n @if (_configuration) {\n <div class=\"c-container sd-table-config\">\n <!-- why: drag handle l\u00E0 affordance duy nh\u1EA5t cho vi\u1EC7c \u0111\u1ED5i th\u1EE9 t\u1EF1 c\u1ED9t, v\u00E0 n\u00F3 kh\u00F4ng t\u1EF1 n\u00F3i ra\n \u0111i\u1EC1u \u0111\u00F3 \u2014 m\u1ED9t d\u00F2ng hint tr\u00E1nh vi\u1EC7c ng\u01B0\u1EDDi d\u00F9ng kh\u00F4ng bao gi\u1EDD ph\u00E1t hi\u1EC7n t\u00EDnh n\u0103ng.\n K\u00FD hi\u1EC7u \u283F n\u1EB1m S\u1EB4N trong chu\u1ED7i i18n (\u0111\u00FAng v\u1ECB tr\u00ED trong c\u00E2u), n\u00EAn kh\u00F4ng k\u00E8m icon ri\u00EAng. -->\n <p class=\"c-hint\">{{ 'core.component.table.config.drag-hint' | sdTranslate }}</p>\n\n <div class=\"c-table\">\n <table\n mat-table\n [dataSource]=\"_configuration.columns!\"\n cdkDropList\n [cdkDropListData]=\"_configuration.columns\"\n (cdkDropListDropped)=\"dropTable($event)\">\n <ng-container matColumnDef=\"invisible\">\n <th mat-header-cell class=\"c-th\" *matHeaderCellDef>\n {{ 'core.component.form-builder.display' | sdTranslate }}\n </th>\n <td mat-cell *matCellDef=\"let item\">\n <div class=\"c-display-cell\">\n <button\n type=\"button\"\n class=\"c-handle\"\n [title]=\"'core.component.table.config.drag-handle' | sdTranslate\"\n [attr.aria-label]=\"'core.component.table.config.drag-handle' | sdTranslate\"\n (mousedown)=\"handleMouseDown()\"\n (mouseup)=\"handleMouseUp()\">\n <sd-icon name=\"drag_indicator\" aria-hidden=\"true\"></sd-icon>\n </button>\n <!-- why: \u00F4 \"Hi\u1EC3n th\u1ECB\" KH\u00D4NG bao gi\u1EDD b\u1ECB kho\u00E1 \u2014 n\u00F3 l\u00E0 \u0111\u01B0\u1EDDng duy nh\u1EA5t \u0111\u1EC3 b\u1EADt l\u1EA1i m\u1ED9t\n c\u1ED9t \u0111\u00E3 t\u1EAFt. -->\n <sd-checkbox [model]=\"!item.invisible\" (modelChange)=\"item.invisible = !item.invisible\" />\n </div>\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"title\">\n <th mat-header-cell class=\"c-th\" *matHeaderCellDef>\n {{ 'core.component.table.column-header' | sdTranslate }}\n </th>\n <td mat-cell *matCellDef=\"let item\">\n <sd-input\n size=\"sm\"\n [placeholder]=\"item?.origin?.title\"\n [(model)]=\"item.title\"\n [disabled]=\"isRowDisabled(item)\"\n hideInlineError></sd-input>\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"width\">\n <th mat-header-cell class=\"c-th c-col-width\" *matHeaderCellDef>\n {{ 'core.component.table.width' | sdTranslate }}\n </th>\n <td mat-cell class=\"c-col-width\" *matCellDef=\"let item\">\n <sd-input\n size=\"sm\"\n [placeholder]=\"item?.origin?.width\"\n [(model)]=\"item.width\"\n [disabled]=\"isRowDisabled(item)\"\n hideInlineError></sd-input>\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"fixed\">\n <th mat-header-cell class=\"c-th c-col-toggle\" *matHeaderCellDef>\n {{ 'core.component.table.fixed' | sdTranslate }}\n </th>\n <td mat-cell class=\"c-col-toggle\" *matCellDef=\"let item\">\n <sd-checkbox [(model)]=\"item.fixed\" [disabled]=\"isRowDisabled(item)\" />\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"truncate\">\n <th mat-header-cell class=\"c-th c-col-toggle\" *matHeaderCellDef>\n {{ 'core.component.table.char-limit' | sdTranslate }}\n </th>\n <td mat-cell class=\"c-col-toggle\" *matCellDef=\"let item\">\n <sd-checkbox [(model)]=\"item.truncate\" [disabled]=\"isRowDisabled(item)\" />\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"_columns; sticky: true\"></tr>\n <tr\n mat-row\n *matRowDef=\"let row; columns: _columns\"\n [class.c-row-hidden]=\"isRowDisabled(row)\"\n cdkDrag\n [cdkDragData]=\"row\"\n cdkDragLockAxis=\"y\"\n [cdkDragDisabled]=\"dragDisabled\">\n </tr>\n </table>\n </div>\n </div>\n }\n <ng-container sdFooterRight>\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-config-skip' : null\"\n (click)=\"close()\"\n [title]=\"'core.component.table.skip' | sdTranslate\"\n color=\"secondary\">\n </sd-button>\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-config-reset' : null\"\n (click)=\"onReset()\"\n [title]=\"'core.component.form-builder.default' | sdTranslate\"\n color=\"primary\">\n </sd-button>\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-config-apply' : null\"\n (click)=\"onSave()\"\n [title]=\"'core.component.table.apply' | sdTranslate\"\n type=\"fill\"\n color=\"primary\">\n </sd-button>\n </ng-container>\n</sd-modal>\n", styles: [".c-container{position:relative;min-height:200px;padding:16px}.c-hint{margin:0 0 12px;color:var(--sd-text-secondary, #6b7280);font-size:12px;line-height:18px}.c-table{position:relative;overflow:auto;max-height:60vh;border:1px solid var(--mat-sys-outline-variant, rgba(0, 0, 0, .08));border-radius:8px}.c-table table{width:100%;background:transparent}.c-table .c-th{font-weight:500;font-size:13px;line-height:18px;color:var(--sd-text-secondary, #6b7280);background:var(--mat-sys-surface-container-low, #f7f8fa);white-space:nowrap}.c-table .mat-mdc-header-cell,.c-table .mat-mdc-cell{padding:8px 12px;border-bottom-color:var(--mat-sys-outline-variant, rgba(0, 0, 0, .08))}.c-table .mat-mdc-header-cell:first-of-type,.c-table .mat-mdc-cell:first-of-type{padding-left:12px}.c-table .mat-mdc-row:last-of-type .mat-mdc-cell{border-bottom:none}.c-table .mat-mdc-row:hover .mat-mdc-cell{background:var(--mat-sys-surface-container-low, rgba(0, 0, 0, .02))}.c-table .c-col-width{width:104px}.c-table .c-col-toggle{width:88px;text-align:center}.c-display-cell{display:flex;align-items:center;gap:8px}.c-handle{display:inline-flex;align-items:center;justify-content:center;padding:0;border:0;background:none;color:var(--sd-text-disabled, #b6bcc6);cursor:grab;transition:color .15s ease}.c-handle:hover,.c-handle:focus-visible{color:var(--sd-text-secondary, #6b7280);outline:none}.c-handle:active{cursor:grabbing}.c-row-hidden .mat-mdc-cell{background:var(--mat-sys-surface-container-low, rgba(0, 0, 0, .015))}.c-row-hidden sd-input,.c-row-hidden .c-col-toggle sd-checkbox{opacity:.55}.cdk-drag-preview{display:table;border-radius:8px;background:var(--mat-sys-surface, #fff);outline:1px solid var(--sd-primary, #2a66f4);box-shadow:0 12px 28px #00000029,0 2px 8px #00000014;opacity:.98}.cdk-drag-preview .mat-mdc-cell{border-bottom:none;padding:8px 12px}.cdk-drag-preview .c-handle{color:var(--sd-primary, #2a66f4);cursor:grabbing}.cdk-drag-placeholder .mat-mdc-cell{background:var(--sd-primary-light, rgba(42, 102, 244, .06));border-bottom:none;box-shadow:inset 0 1px 0 var(--sd-primary, #2a66f4),inset 0 -1px 0 var(--sd-primary, #2a66f4)}.cdk-drag-placeholder .mat-mdc-cell>*{visibility:hidden}.cdk-drag-animating,.c-table.cdk-drop-list-dragging .mat-mdc-row:not(.cdk-drag-placeholder){transition:transform .22s cubic-bezier(0,0,.2,1)}.c-table.cdk-drop-list-dragging .mat-mdc-row:hover .mat-mdc-cell{background:transparent}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i5.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i5.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i5.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: CdkTableModule }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdCheckbox, selector: "sd-checkbox", inputs: ["autoId", "name", "form", "label", "color", "disabled", "viewed", "inlineError", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "size", "form", "label", "helperText", "placeholder", "type", "mask", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdModal, selector: "sd-modal", inputs: ["autoId", "title", "color", "width", "height", "view", "modalClass", "lazyLoadContent", "hideClose", "disableBackdropClose", "beforeClose"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }] });
|
|
1508
2031
|
}
|
|
1509
2032
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: ConfigComponent, decorators: [{
|
|
1510
2033
|
type: Component,
|
|
@@ -1652,136 +2175,13 @@ class DesktopCellComponent {
|
|
|
1652
2175
|
});
|
|
1653
2176
|
};
|
|
1654
2177
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DesktopCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1655
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: DesktopCellComponent, isStandalone: true, selector: "desktop-cell", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null }, cellDef: { classPropertyName: "cellDef", publicName: "cellDef", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "contentContainer", first: true, predicate: ["contentContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _column = column();\n@let _item = item();\n@let _autoId = autoId();\n\n@let _truncateEnable = truncateEnable();\n@let _truncateWidth = truncateWidth();\n@let isExpandByMore = isOverflowing() && _column?.cell?.truncate?.type === 'more';\n@let isExpandByTooltip = isOverflowing() && _column?.cell?.truncate?.type === 'tooltip';\n\n@let _templateRef = templateRef();\n@let context =\n {\n item: _item.data,\n column: _column,\n autoId: _autoId,\n };\n\n@if (_templateRef) {\n <!-- N\u1EBFu column c\u00F3 b\u1EADt \"gi\u1EDBi h\u1EA1n k\u00FD t\u1EF1\" -->\n @if (_truncateEnable) {\n <div\n #contentContainer\n [style.max-width]=\"_truncateWidth\"\n [class.c-ellipsis-html]=\"isCollapsed()\"\n [sdTooltip]=\"isExpandByTooltip ? htmlTooltip : ''\">\n <ng-container *ngTemplateOutlet=\"_templateRef; context: context\" />\n </div>\n\n <!-- N\u1EBFu option xem full th\u00F4ng tin l\u00E0 \"tooltip\" -->\n <ng-template #htmlTooltip>\n <div\n [style.max-width]=\"'calc(' + _truncateWidth + ' * 1.5)'\"\n style=\"max-height: 200px; overflow-y: auto; scrollbar-width: thin\">\n <ng-container *ngTemplateOutlet=\"_templateRef; context: context\" />\n </div>\n </ng-template>\n\n <!-- N\u1EBFu option xem full th\u00F4ng tin l\u00E0 \"btn xem th\u00EAm\" -->\n @if (isExpandByMore) {\n <button (click)=\"toggle()\" class=\"c-collapse\">\n {{ isCollapsed() ? ('core.component.form-builder.show-more' | sdTranslate) : ('core.component.form-builder.show-less' | sdTranslate) }}\n </button>\n }\n } @else {\n <ng-container *ngTemplateOutlet=\"_templateRef; context: context\" />\n }\n} @else {\n <view [column]=\"column()\" [item]=\"item()\" [autoId]=\"context.autoId\" />\n}\n", styles: [".c-ellipsis-html{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;line-clamp:1;text-overflow:ellipsis;overflow:hidden}.c-collapse{background:none;color:#00e;border:none;padding:0;font-size:12px;cursor:pointer;outline:none}.c-collapse:focus-visible{outline:2px solid var(--sd-primary, #005cbb);outline-offset:2px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: SdTooltipDirective, selector: "[sdTooltip]", inputs: ["sdTooltip", "sdTooltipPosition", "sdTooltipDelay", "sdTooltipColor"] }, { kind: "component", type: ViewComponent, selector: "view", inputs: ["autoId", "column", "item"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2178
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: DesktopCellComponent, isStandalone: true, selector: "desktop-cell", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null }, cellDef: { classPropertyName: "cellDef", publicName: "cellDef", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "contentContainer", first: true, predicate: ["contentContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _column = column();\n@let _item = item();\n@let _autoId = autoId();\n\n@let _truncateEnable = truncateEnable();\n@let _truncateWidth = truncateWidth();\n@let isExpandByMore = isOverflowing() && _column?.cell?.truncate?.type === 'more';\n@let isExpandByTooltip = isOverflowing() && _column?.cell?.truncate?.type === 'tooltip';\n\n@let _templateRef = templateRef();\n@let context =\n {\n item: _item.data,\n column: _column,\n autoId: _autoId,\n };\n\n@if (_templateRef) {\n <!-- N\u1EBFu column c\u00F3 b\u1EADt \"gi\u1EDBi h\u1EA1n k\u00FD t\u1EF1\" -->\n @if (_truncateEnable) {\n <div\n #contentContainer\n [style.max-width]=\"_truncateWidth\"\n [class.c-ellipsis-html]=\"isCollapsed()\"\n [sdTooltip]=\"isExpandByTooltip ? htmlTooltip : ''\">\n <ng-container *ngTemplateOutlet=\"_templateRef; context: context\" />\n </div>\n\n <!-- N\u1EBFu option xem full th\u00F4ng tin l\u00E0 \"tooltip\" -->\n <ng-template #htmlTooltip>\n <div\n [style.max-width]=\"'calc(' + _truncateWidth + ' * 1.5)'\"\n style=\"max-height: 200px; overflow-y: auto; scrollbar-width: thin\">\n <ng-container *ngTemplateOutlet=\"_templateRef; context: context\" />\n </div>\n </ng-template>\n\n <!-- N\u1EBFu option xem full th\u00F4ng tin l\u00E0 \"btn xem th\u00EAm\" -->\n @if (isExpandByMore) {\n <button (click)=\"toggle()\" class=\"c-collapse\">\n {{ isCollapsed() ? ('core.component.form-builder.show-more' | sdTranslate) : ('core.component.form-builder.show-less' | sdTranslate) }}\n </button>\n }\n } @else {\n <ng-container *ngTemplateOutlet=\"_templateRef; context: context\" />\n }\n} @else {\n <view [column]=\"column()\" [item]=\"item()\" [autoId]=\"context.autoId\" />\n}\n", styles: [".c-ellipsis-html{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;line-clamp:1;text-overflow:ellipsis;overflow:hidden}.c-collapse{background:none;color:#00e;border:none;padding:0;font-size:12px;cursor:pointer;outline:none}.c-collapse:focus-visible{outline:2px solid var(--sd-primary, #005cbb);outline-offset:2px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: SdTooltipDirective, selector: "[sdTooltip]", inputs: ["sdTooltip", "sdTooltipPosition", "sdTooltipDelay", "sdTooltipColor"] }, { kind: "component", type: ViewComponent, selector: "view", inputs: ["autoId", "column", "item"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1656
2179
|
}
|
|
1657
2180
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DesktopCellComponent, decorators: [{
|
|
1658
2181
|
type: Component,
|
|
1659
2182
|
args: [{ selector: 'desktop-cell', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [CommonModule, SdTooltipDirective, ViewComponent, SdTranslatePipe], template: "@let _column = column();\n@let _item = item();\n@let _autoId = autoId();\n\n@let _truncateEnable = truncateEnable();\n@let _truncateWidth = truncateWidth();\n@let isExpandByMore = isOverflowing() && _column?.cell?.truncate?.type === 'more';\n@let isExpandByTooltip = isOverflowing() && _column?.cell?.truncate?.type === 'tooltip';\n\n@let _templateRef = templateRef();\n@let context =\n {\n item: _item.data,\n column: _column,\n autoId: _autoId,\n };\n\n@if (_templateRef) {\n <!-- N\u1EBFu column c\u00F3 b\u1EADt \"gi\u1EDBi h\u1EA1n k\u00FD t\u1EF1\" -->\n @if (_truncateEnable) {\n <div\n #contentContainer\n [style.max-width]=\"_truncateWidth\"\n [class.c-ellipsis-html]=\"isCollapsed()\"\n [sdTooltip]=\"isExpandByTooltip ? htmlTooltip : ''\">\n <ng-container *ngTemplateOutlet=\"_templateRef; context: context\" />\n </div>\n\n <!-- N\u1EBFu option xem full th\u00F4ng tin l\u00E0 \"tooltip\" -->\n <ng-template #htmlTooltip>\n <div\n [style.max-width]=\"'calc(' + _truncateWidth + ' * 1.5)'\"\n style=\"max-height: 200px; overflow-y: auto; scrollbar-width: thin\">\n <ng-container *ngTemplateOutlet=\"_templateRef; context: context\" />\n </div>\n </ng-template>\n\n <!-- N\u1EBFu option xem full th\u00F4ng tin l\u00E0 \"btn xem th\u00EAm\" -->\n @if (isExpandByMore) {\n <button (click)=\"toggle()\" class=\"c-collapse\">\n {{ isCollapsed() ? ('core.component.form-builder.show-more' | sdTranslate) : ('core.component.form-builder.show-less' | sdTranslate) }}\n </button>\n }\n } @else {\n <ng-container *ngTemplateOutlet=\"_templateRef; context: context\" />\n }\n} @else {\n <view [column]=\"column()\" [item]=\"item()\" [autoId]=\"context.autoId\" />\n}\n", styles: [".c-ellipsis-html{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;line-clamp:1;text-overflow:ellipsis;overflow:hidden}.c-collapse{background:none;color:#00e;border:none;padding:0;font-size:12px;cursor:pointer;outline:none}.c-collapse:focus-visible{outline:2px solid var(--sd-primary, #005cbb);outline-offset:2px}\n"] }]
|
|
1660
2183
|
}], ctorParameters: () => [] });
|
|
1661
2184
|
|
|
1662
|
-
/**
|
|
1663
|
-
* Resolves command metadata for the current row once, then lets the template reuse it with `@let`.
|
|
1664
|
-
*/
|
|
1665
|
-
class CommandPipe {
|
|
1666
|
-
transform(item, command) {
|
|
1667
|
-
return {
|
|
1668
|
-
disabled: this.#disabled(item, command),
|
|
1669
|
-
title: this.#title(item, command),
|
|
1670
|
-
icon: this.#icon(item, command),
|
|
1671
|
-
htmlTemplate: this.#htmlTemplate(item, command),
|
|
1672
|
-
};
|
|
1673
|
-
}
|
|
1674
|
-
#disabled = (item, command) => {
|
|
1675
|
-
const d = command?.disabled;
|
|
1676
|
-
if (d == null)
|
|
1677
|
-
return false;
|
|
1678
|
-
return typeof d === 'boolean' ? d : d(item.data);
|
|
1679
|
-
};
|
|
1680
|
-
#title = (item, command) => {
|
|
1681
|
-
if (!command?.title)
|
|
1682
|
-
return '';
|
|
1683
|
-
return typeof command.title === 'string' ? command.title : command.title(item.data);
|
|
1684
|
-
};
|
|
1685
|
-
#icon = (item, command) => {
|
|
1686
|
-
if (!command?.icon)
|
|
1687
|
-
return '';
|
|
1688
|
-
return typeof command.icon === 'string' ? command.icon : command.icon(item.data);
|
|
1689
|
-
};
|
|
1690
|
-
// Only child commands can provide htmlTemplate.
|
|
1691
|
-
#htmlTemplate = (item, command) => {
|
|
1692
|
-
const tpl = command?.htmlTemplate;
|
|
1693
|
-
return typeof tpl === 'function' ? tpl(item.data) : undefined;
|
|
1694
|
-
};
|
|
1695
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: CommandPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1696
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: CommandPipe, isStandalone: true, name: "command" });
|
|
1697
|
-
}
|
|
1698
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: CommandPipe, decorators: [{
|
|
1699
|
-
type: Pipe,
|
|
1700
|
-
args: [{ name: 'command', standalone: true }]
|
|
1701
|
-
}] });
|
|
1702
|
-
|
|
1703
|
-
/**
|
|
1704
|
-
* Filters visible commands and pre-resolves icon, title, and stable key for the current row.
|
|
1705
|
-
*/
|
|
1706
|
-
class CommandFilterPipe {
|
|
1707
|
-
async transform(item, commands) {
|
|
1708
|
-
const results = [];
|
|
1709
|
-
if (!commands)
|
|
1710
|
-
return results;
|
|
1711
|
-
for (const command of commands) {
|
|
1712
|
-
if (!(await this.#visible(item, command)))
|
|
1713
|
-
continue;
|
|
1714
|
-
const icon = this.#icon(item, command);
|
|
1715
|
-
const title = this.#title(item, command);
|
|
1716
|
-
if ('children' in command) {
|
|
1717
|
-
const children = [];
|
|
1718
|
-
for (const child of command.children) {
|
|
1719
|
-
if (!(await this.#visible(item, child)))
|
|
1720
|
-
continue;
|
|
1721
|
-
children.push({
|
|
1722
|
-
...child,
|
|
1723
|
-
type: 'normal',
|
|
1724
|
-
icon: this.#icon(item, child),
|
|
1725
|
-
title: this.#title(item, child),
|
|
1726
|
-
key: this.#key(item, child),
|
|
1727
|
-
});
|
|
1728
|
-
}
|
|
1729
|
-
if (children.length > 0) {
|
|
1730
|
-
results.push({
|
|
1731
|
-
...command,
|
|
1732
|
-
type: 'children',
|
|
1733
|
-
icon,
|
|
1734
|
-
title,
|
|
1735
|
-
key: this.#key(item, command),
|
|
1736
|
-
children,
|
|
1737
|
-
});
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
else {
|
|
1741
|
-
results.push({
|
|
1742
|
-
...command,
|
|
1743
|
-
type: 'normal',
|
|
1744
|
-
icon,
|
|
1745
|
-
title,
|
|
1746
|
-
key: this.#key(item, command),
|
|
1747
|
-
});
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
return results;
|
|
1751
|
-
}
|
|
1752
|
-
#visible = async (item, command) => {
|
|
1753
|
-
const { hidden } = command;
|
|
1754
|
-
if (hidden === undefined)
|
|
1755
|
-
return true;
|
|
1756
|
-
if (typeof hidden === 'boolean')
|
|
1757
|
-
return !hidden;
|
|
1758
|
-
const result = hidden(item.data);
|
|
1759
|
-
return !(result instanceof Promise ? await result : result);
|
|
1760
|
-
};
|
|
1761
|
-
#icon = (item, command) => {
|
|
1762
|
-
if (!command?.icon)
|
|
1763
|
-
return 'more_vert';
|
|
1764
|
-
return typeof command.icon === 'string' ? command.icon : command.icon(item.data);
|
|
1765
|
-
};
|
|
1766
|
-
#title = (item, command) => {
|
|
1767
|
-
if (!command?.title)
|
|
1768
|
-
return '';
|
|
1769
|
-
return typeof command.title === 'string' ? command.title : command.title(item.data);
|
|
1770
|
-
};
|
|
1771
|
-
// Stable autoId key generated from resolved icon and title.
|
|
1772
|
-
#key = (item, command) => {
|
|
1773
|
-
const icon = this.#icon(item, command);
|
|
1774
|
-
const title = this.#title(item, command);
|
|
1775
|
-
return `${icon || 'noicon'}-${StringUtilities.changeAliasLowerCase(title) || 'notitle'}`;
|
|
1776
|
-
};
|
|
1777
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: CommandFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1778
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: CommandFilterPipe, isStandalone: true, name: "filter" });
|
|
1779
|
-
}
|
|
1780
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: CommandFilterPipe, decorators: [{
|
|
1781
|
-
type: Pipe,
|
|
1782
|
-
args: [{ name: 'filter', standalone: true }]
|
|
1783
|
-
}] });
|
|
1784
|
-
|
|
1785
2185
|
class DesktopCommand {
|
|
1786
2186
|
autoIdInput = input(undefined, { alias: 'autoId' });
|
|
1787
2187
|
item = input.required();
|
|
@@ -1799,7 +2199,7 @@ class DesktopCommand {
|
|
|
1799
2199
|
});
|
|
1800
2200
|
_commands = computed(() => this.commands() || []);
|
|
1801
2201
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DesktopCommand, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1802
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: DesktopCommand, isStandalone: true, selector: "desktop-command", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null }, itemIndex: { classPropertyName: "itemIndex", publicName: "itemIndex", isSignal: true, isRequired: true, transformFunction: null }, commands: { classPropertyName: "commands", publicName: "commands", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-autoid": "autoId()" } }, ngImport: i0, template: "@let _autoId = autoId();\n@let _item = item();\n@let filteredCommands = _item | filter: _commands() | async;\n\n@if (filteredCommands?.length) {\n @for (command of filteredCommands; track command.key) {\n @let _meta = _item | command: command;\n @if (command.type === 'normal') {\n <!-- why: b\u1ECF aria-hidden=\"true\" \u2014 \u0111\u00E2y l\u00E0 <button> TH\u1EACT, v\u1EABn nh\u1EADn tab focus nh\u01B0ng screen reader\n kh\u00F4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c g\u00EC (n\u00FAt ch\u1EC9 c\u00F3 icon, kh\u00F4ng c\u00F3 text). Thay b\u1EB1ng aria-label l\u1EA5y t\u1EEB ch\u00EDnh\n ti\u00EAu \u0111\u1EC1 command \u0111ang hi\u1EC3n th\u1ECB \u1EDF tooltip. -->\n <button\n type=\"button\"\n [attr.data-autoid]=\"_autoId + '-' + command.key\"\n (click)=\"command.click(_item.data)\"\n [matTooltip]=\"_meta.title\"\n [attr.aria-label]=\"_meta.title\"\n [disabled]=\"_meta.disabled\"\n mat-icon-button>\n <sd-icon class=\"c-icon\" [color]=\"command.color || 'secondary'\" [fontSet]=\"command.fontSet\" [name]=\"_meta.icon\"></sd-icon>\n </button>\n } @else {\n <!-- why: n\u00FAt m\u1EDF menu con \u2014 c\u0169ng b\u1ECF aria-hidden v\u00E0 g\u1EAFn aria-label + aria-haspopup=\"menu\". -->\n <button\n type=\"button\"\n [attr.data-autoid]=\"_autoId + '-' + command.key\"\n [matMenuTriggerFor]=\"menu\"\n [attr.aria-label]=\"_meta.title\"\n aria-haspopup=\"menu\"\n mat-icon-button>\n @if (_meta.icon) {\n <sd-icon class=\"c-icon\" [fontSet]=\"command.fontSet\" [name]=\"_meta.icon\"></sd-icon>\n } @else {\n <sd-icon class=\"c-icon\" [fontSet]=\"command.fontSet\" name=\"more_vert\"></sd-icon>\n }\n </button>\n <mat-menu #menu=\"matMenu\" [attr.data-autoid]=\"_autoId + '-' + command.key + '-menu'\">\n <span>\n @for (childCommand of command.children; track childCommand.key) {\n @let _childMeta = _item | command: childCommand;\n <button\n [attr.data-autoid]=\"_autoId + '-' + command.key + '-' + childCommand.key\"\n mat-menu-item\n (click)=\"childCommand.click(_item.data)\"\n [disabled]=\"_childMeta.disabled\">\n @if (_childMeta.htmlTemplate) {\n <div [innerHTML]=\"_childMeta.htmlTemplate\"></div>\n } @else {\n <span class=\"sd-command-menu-item__content\">\n <sd-icon class=\"sd-command-menu-item__icon\"\n [color]=\"childCommand.color || 'secondary'\"\n [fontSet]=\"childCommand.fontSet\" [name]=\"_childMeta.icon\"></sd-icon>\n <span class=\"sd-command-menu-item__title\">{{ _childMeta.title }}</span>\n </span>\n }\n </button>\n }\n </span>\n </mat-menu>\n }\n }\n}\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-primary-contrast{color:var(--sd-primary-contrast)!important}.bg-primary-contrast{background:var(--sd-primary-contrast)!important}.border-primary-contrast{border-color:var(--sd-primary-contrast)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-secondary-contrast{color:var(--sd-secondary-contrast)!important}.bg-secondary-contrast{background:var(--sd-secondary-contrast)!important}.border-secondary-contrast{border-color:var(--sd-secondary-contrast)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-info-contrast{color:var(--sd-info-contrast)!important}.bg-info-contrast{background:var(--sd-info-contrast)!important}.border-info-contrast{border-color:var(--sd-info-contrast)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-success-contrast{color:var(--sd-success-contrast)!important}.bg-success-contrast{background:var(--sd-success-contrast)!important}.border-success-contrast{border-color:var(--sd-success-contrast)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-warning-contrast{color:var(--sd-warning-contrast)!important}.bg-warning-contrast{background:var(--sd-warning-contrast)!important}.border-warning-contrast{border-color:var(--sd-warning-contrast)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-error-contrast{color:var(--sd-error-contrast)!important}.bg-error-contrast{background:var(--sd-error-contrast)!important}.border-error-contrast{border-color:var(--sd-error-contrast)!important}.text-surface{color:var(--sd-surface)!important}.bg-surface{background:var(--sd-surface)!important}.border-surface{border-color:var(--sd-surface)!important}.text-surface-muted{color:var(--sd-surface-muted)!important}.bg-surface-muted{background:var(--sd-surface-muted)!important}.border-surface-muted{border-color:var(--sd-surface-muted)!important}.text-text{color:var(--sd-text)!important}.bg-text{background:var(--sd-text)!important}.border-text{border-color:var(--sd-text)!important}.text-text-secondary{color:var(--sd-text-secondary)!important}.bg-text-secondary{background:var(--sd-text-secondary)!important}.border-text-secondary{border-color:var(--sd-text-secondary)!important}.text-text-muted{color:var(--sd-text-muted)!important}.bg-text-muted{background:var(--sd-text-muted)!important}.border-text-muted{border-color:var(--sd-text-muted)!important}.text-border{color:var(--sd-border)!important}.bg-border{background:var(--sd-border)!important}.border-border{border-color:var(--sd-border)!important}.text-border-strong{color:var(--sd-border-strong)!important}.bg-border-strong{background:var(--sd-border-strong)!important}.border-border-strong{border-color:var(--sd-border-strong)!important}.text-disabled-bg{color:var(--sd-disabled-bg)!important}.bg-disabled-bg{background:var(--sd-disabled-bg)!important}.border-disabled-bg{border-color:var(--sd-disabled-bg)!important}.text-disabled-text{color:var(--sd-disabled-text)!important}.bg-disabled-text{background:var(--sd-disabled-text)!important}.border-disabled-text{border-color:var(--sd-disabled-text)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}.text-secondary{color:var(--sd-text-secondary)!important}.text-muted{color:var(--sd-text-muted)!important}.text-body{color:var(--sd-text)!important}.bg-muted{background:var(--sd-surface-muted)!important}:host{display:flex;align-items:center}button[mat-icon-button]{width:24px;height:24px;line-height:24px;padding:0}sd-icon.c-icon{color:var(--sd-text-secondary)!important;width:16px;height:16px;font-size:16px;line-height:16px}.sd-command-menu-item__content{display:inline-flex;align-items:center;gap:8px;min-width:0;width:100%}.sd-command-menu-item__icon{color:var(--sd-text-secondary)!important;width:24px;height:24px;font-size:18px;line-height:24px!important;flex:0 0 24px}.sd-command-menu-item__title{min-width:0;line-height:20px;white-space:nowrap}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i3.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i3.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i3.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "pipe", type: CommandPipe, name: "command" }, { kind: "pipe", type: CommandFilterPipe, name: "filter" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2202
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: DesktopCommand, isStandalone: true, selector: "desktop-command", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null }, itemIndex: { classPropertyName: "itemIndex", publicName: "itemIndex", isSignal: true, isRequired: true, transformFunction: null }, commands: { classPropertyName: "commands", publicName: "commands", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-autoid": "autoId()" } }, ngImport: i0, template: "@let _autoId = autoId();\n@let _item = item();\n@let filteredCommands = _item | filter: _commands() | async;\n\n@if (filteredCommands?.length) {\n @for (command of filteredCommands; track command.key) {\n @let _meta = _item | command: command;\n @if (command.type === 'normal') {\n <!-- why: b\u1ECF aria-hidden=\"true\" \u2014 \u0111\u00E2y l\u00E0 <button> TH\u1EACT, v\u1EABn nh\u1EADn tab focus nh\u01B0ng screen reader\n kh\u00F4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c g\u00EC (n\u00FAt ch\u1EC9 c\u00F3 icon, kh\u00F4ng c\u00F3 text). Thay b\u1EB1ng aria-label l\u1EA5y t\u1EEB ch\u00EDnh\n ti\u00EAu \u0111\u1EC1 command \u0111ang hi\u1EC3n th\u1ECB \u1EDF tooltip. -->\n <button\n type=\"button\"\n [attr.data-autoid]=\"_autoId + '-' + command.key\"\n (click)=\"command.click(_item.data)\"\n [matTooltip]=\"_meta.title\"\n [attr.aria-label]=\"_meta.title\"\n [disabled]=\"_meta.disabled\"\n mat-icon-button>\n <sd-icon class=\"c-icon\" [color]=\"command.color || 'secondary'\" [fontSet]=\"command.fontSet\" [name]=\"_meta.icon\"></sd-icon>\n </button>\n } @else {\n <!-- why: n\u00FAt m\u1EDF menu con \u2014 c\u0169ng b\u1ECF aria-hidden v\u00E0 g\u1EAFn aria-label + aria-haspopup=\"menu\". -->\n <button\n type=\"button\"\n [attr.data-autoid]=\"_autoId + '-' + command.key\"\n [matMenuTriggerFor]=\"menu\"\n [attr.aria-label]=\"_meta.title\"\n aria-haspopup=\"menu\"\n mat-icon-button>\n @if (_meta.icon) {\n <sd-icon class=\"c-icon\" [fontSet]=\"command.fontSet\" [name]=\"_meta.icon\"></sd-icon>\n } @else {\n <sd-icon class=\"c-icon\" [fontSet]=\"command.fontSet\" name=\"more_vert\"></sd-icon>\n }\n </button>\n <mat-menu #menu=\"matMenu\" [attr.data-autoid]=\"_autoId + '-' + command.key + '-menu'\">\n <span>\n @for (childCommand of command.children; track childCommand.key) {\n @let _childMeta = _item | command: childCommand;\n <button\n [attr.data-autoid]=\"_autoId + '-' + command.key + '-' + childCommand.key\"\n mat-menu-item\n (click)=\"childCommand.click(_item.data)\"\n [disabled]=\"_childMeta.disabled\">\n @if (_childMeta.htmlTemplate) {\n <div [innerHTML]=\"_childMeta.htmlTemplate\"></div>\n } @else {\n <span class=\"sd-command-menu-item__content\">\n <sd-icon class=\"sd-command-menu-item__icon\"\n [color]=\"childCommand.color || 'secondary'\"\n [fontSet]=\"childCommand.fontSet\" [name]=\"_childMeta.icon\"></sd-icon>\n <span class=\"sd-command-menu-item__title\">{{ _childMeta.title }}</span>\n </span>\n }\n </button>\n }\n </span>\n </mat-menu>\n }\n }\n}\n", styles: [".text-primary{color:var(--sd-primary)!important}.bg-primary{background:var(--sd-primary)!important}.border-primary{border-color:var(--sd-primary)!important}.text-primary-light{color:var(--sd-primary-light)!important}.bg-primary-light{background:var(--sd-primary-light)!important}.border-primary-light{border-color:var(--sd-primary-light)!important}.text-primary-dark{color:var(--sd-primary-dark)!important}.bg-primary-dark{background:var(--sd-primary-dark)!important}.border-primary-dark{border-color:var(--sd-primary-dark)!important}.text-primary-contrast{color:var(--sd-primary-contrast)!important}.bg-primary-contrast{background:var(--sd-primary-contrast)!important}.border-primary-contrast{border-color:var(--sd-primary-contrast)!important}.text-secondary{color:var(--sd-secondary)!important}.bg-secondary{background:var(--sd-secondary)!important}.border-secondary{border-color:var(--sd-secondary)!important}.text-secondary-light{color:var(--sd-secondary-light)!important}.bg-secondary-light{background:var(--sd-secondary-light)!important}.border-secondary-light{border-color:var(--sd-secondary-light)!important}.text-secondary-dark{color:var(--sd-secondary-dark)!important}.bg-secondary-dark{background:var(--sd-secondary-dark)!important}.border-secondary-dark{border-color:var(--sd-secondary-dark)!important}.text-secondary-contrast{color:var(--sd-secondary-contrast)!important}.bg-secondary-contrast{background:var(--sd-secondary-contrast)!important}.border-secondary-contrast{border-color:var(--sd-secondary-contrast)!important}.text-info{color:var(--sd-info)!important}.bg-info{background:var(--sd-info)!important}.border-info{border-color:var(--sd-info)!important}.text-info-light{color:var(--sd-info-light)!important}.bg-info-light{background:var(--sd-info-light)!important}.border-info-light{border-color:var(--sd-info-light)!important}.text-info-dark{color:var(--sd-info-dark)!important}.bg-info-dark{background:var(--sd-info-dark)!important}.border-info-dark{border-color:var(--sd-info-dark)!important}.text-info-contrast{color:var(--sd-info-contrast)!important}.bg-info-contrast{background:var(--sd-info-contrast)!important}.border-info-contrast{border-color:var(--sd-info-contrast)!important}.text-success{color:var(--sd-success)!important}.bg-success{background:var(--sd-success)!important}.border-success{border-color:var(--sd-success)!important}.text-success-light{color:var(--sd-success-light)!important}.bg-success-light{background:var(--sd-success-light)!important}.border-success-light{border-color:var(--sd-success-light)!important}.text-success-dark{color:var(--sd-success-dark)!important}.bg-success-dark{background:var(--sd-success-dark)!important}.border-success-dark{border-color:var(--sd-success-dark)!important}.text-success-contrast{color:var(--sd-success-contrast)!important}.bg-success-contrast{background:var(--sd-success-contrast)!important}.border-success-contrast{border-color:var(--sd-success-contrast)!important}.text-warning{color:var(--sd-warning)!important}.bg-warning{background:var(--sd-warning)!important}.border-warning{border-color:var(--sd-warning)!important}.text-warning-light{color:var(--sd-warning-light)!important}.bg-warning-light{background:var(--sd-warning-light)!important}.border-warning-light{border-color:var(--sd-warning-light)!important}.text-warning-dark{color:var(--sd-warning-dark)!important}.bg-warning-dark{background:var(--sd-warning-dark)!important}.border-warning-dark{border-color:var(--sd-warning-dark)!important}.text-warning-contrast{color:var(--sd-warning-contrast)!important}.bg-warning-contrast{background:var(--sd-warning-contrast)!important}.border-warning-contrast{border-color:var(--sd-warning-contrast)!important}.text-error{color:var(--sd-error)!important}.bg-error{background:var(--sd-error)!important}.border-error{border-color:var(--sd-error)!important}.text-error-light{color:var(--sd-error-light)!important}.bg-error-light{background:var(--sd-error-light)!important}.border-error-light{border-color:var(--sd-error-light)!important}.text-error-dark{color:var(--sd-error-dark)!important}.bg-error-dark{background:var(--sd-error-dark)!important}.border-error-dark{border-color:var(--sd-error-dark)!important}.text-error-contrast{color:var(--sd-error-contrast)!important}.bg-error-contrast{background:var(--sd-error-contrast)!important}.border-error-contrast{border-color:var(--sd-error-contrast)!important}.text-surface{color:var(--sd-surface)!important}.bg-surface{background:var(--sd-surface)!important}.border-surface{border-color:var(--sd-surface)!important}.text-surface-muted{color:var(--sd-surface-muted)!important}.bg-surface-muted{background:var(--sd-surface-muted)!important}.border-surface-muted{border-color:var(--sd-surface-muted)!important}.text-text{color:var(--sd-text)!important}.bg-text{background:var(--sd-text)!important}.border-text{border-color:var(--sd-text)!important}.text-text-secondary{color:var(--sd-text-secondary)!important}.bg-text-secondary{background:var(--sd-text-secondary)!important}.border-text-secondary{border-color:var(--sd-text-secondary)!important}.text-text-muted{color:var(--sd-text-muted)!important}.bg-text-muted{background:var(--sd-text-muted)!important}.border-text-muted{border-color:var(--sd-text-muted)!important}.text-border{color:var(--sd-border)!important}.bg-border{background:var(--sd-border)!important}.border-border{border-color:var(--sd-border)!important}.text-border-strong{color:var(--sd-border-strong)!important}.bg-border-strong{background:var(--sd-border-strong)!important}.border-border-strong{border-color:var(--sd-border-strong)!important}.text-disabled-bg{color:var(--sd-disabled-bg)!important}.bg-disabled-bg{background:var(--sd-disabled-bg)!important}.border-disabled-bg{border-color:var(--sd-disabled-bg)!important}.text-disabled-text{color:var(--sd-disabled-text)!important}.bg-disabled-text{background:var(--sd-disabled-text)!important}.border-disabled-text{border-color:var(--sd-disabled-text)!important}.text-white{color:#fff!important}.bg-white{background:#fff!important}.border-white{border-color:#fff!important}.text-black{color:#000!important}.bg-black{background:#000!important}.border-black{border-color:#000!important}.text-secondary{color:var(--sd-text-secondary)!important}.text-muted{color:var(--sd-text-muted)!important}.text-body{color:var(--sd-text)!important}.bg-muted{background:var(--sd-surface-muted)!important}:host{display:flex;align-items:center}button[mat-icon-button]{width:24px;height:24px;line-height:24px;padding:0}sd-icon.c-icon{color:var(--sd-text-secondary)!important;width:16px;height:16px;font-size:16px;line-height:16px}.sd-command-menu-item__content{display:inline-flex;align-items:center;gap:8px;min-width:0;width:100%}.sd-command-menu-item__icon{color:var(--sd-text-secondary)!important;width:24px;height:24px;font-size:18px;line-height:24px!important;flex:0 0 24px}.sd-command-menu-item__title{min-width:0;line-height:20px;white-space:nowrap}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i2$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i3$1.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i3$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i3$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "pipe", type: CommandPipe, name: "command" }, { kind: "pipe", type: CommandFilterPipe, name: "filter" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1803
2203
|
}
|
|
1804
2204
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: DesktopCommand, decorators: [{
|
|
1805
2205
|
type: Component,
|
|
@@ -2084,7 +2484,7 @@ class SdPopupExport {
|
|
|
2084
2484
|
return '';
|
|
2085
2485
|
};
|
|
2086
2486
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdPopupExport, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2087
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: SdPopupExport, isStandalone: true, selector: "sd-popup-export", inputs: { _tableOption: { classPropertyName: "_tableOption", publicName: "tableOption", isSignal: false, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { export: "export" }, viewQueries: [{ propertyName: "modal", first: true, predicate: ["modal"], descendants: true }, { propertyName: "listGroups", first: true, predicate: ["listGroups"], descendants: true }], ngImport: i0, template: "<sd-modal width=\"907px\" [title]=\"'Exported template'\" #modal>\n <div class=\"row\">\n <div *ngIf=\"!files?.length\" class=\"col-12\">\n <div class=\"c-empty\">\n <img class=\"sd-image-data-empty\" alt=\"empty-image\" />\n <div class=\"T14R\">{{ 'There are no exported templates' }}</div>\n </div>\n </div>\n <ng-container *ngIf=\"files?.length\">\n <div class=\"col-12\">\n <div class=\"c-table\" style=\"max-height: 50vh\">\n <table mat-table [dataSource]=\"files\">\n <ng-container matColumnDef=\"stt\">\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width: 50px\">#</th>\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item; let idx = index\">\n {{ idx + 1 }}\n </td>\n </ng-container>\n <ng-container matColumnDef=\"fileName\">\n <th mat-header-cell class=\"c-th px-5\" *matHeaderCellDef>\n {{ 'File name' }}\n </th>\n <td class=\"px-5\" mat-cell *matCellDef=\"let item\">\n {{ item.fileName }}\n </td>\n </ng-container>\n <ng-container matColumnDef=\"action\">\n <th mat-header-cell class=\"c-th px-5\" *matHeaderCellDef style=\"width: 80px\"></th>\n <td class=\"px-5\" mat-cell *matCellDef=\"let item\">\n <div class=\"d-flex\">\n <button mat-icon-button aria-label=\"delete\" (click)=\"removeFile(item)\">\n <sd-icon name=\"delete\"></sd-icon>\n </button>\n <button mat-icon-button aria-label=\"download\" (click)=\"onExport(item)\">\n <sd-icon name=\"download\"></sd-icon>\n </button>\n </div>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"['stt', 'fileName', 'action']; sticky: true\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: ['stt', 'fileName', 'action']\"></tr>\n </table>\n </div>\n </div>\n <div *ngIf=\"files.length < 5\" class=\"col-12 mt-10\">\n <sd-button class=\"mr-4\" [title]=\"'New template'\" (click)=\"enableCreating = true\" color=\"info\" [disabled]=\"enableCreating\">\n </sd-button>\n <sd-button *ngIf=\"exportOption?.enableUpload\" [title]=\"'Upload template'\" (click)=\"uploadTemplate()\" type=\"outline\">\n </sd-button>\n </div>\n </ng-container>\n <ng-container *ngIf=\"enableCreating || !files?.length\">\n <div class=\"col-12 mt-20\">\n <div class=\"T14R\">{{ 'Select columns for creating template' }}:</div>\n </div>\n <div class=\"col-12\">\n <mat-chip-listbox selectable=\"true\" multiple=\"true\">\n <ng-container *ngFor=\"let column of columns\">\n <mat-chip-option [selected]=\"selected[column.field]\" (click)=\"selected[column.field] = !selected[column.field]\">\n {{ column.title }}\n </mat-chip-option>\n </ng-container>\n </mat-chip-listbox>\n </div>\n <div class=\"col-12 row\">\n <div class=\"col-10\">\n <sd-input [form]=\"form\" [label]=\"'Template name'\" [(model)]=\"templateName\" [validator]=\"templateNameValidator\"></sd-input>\n </div>\n <div class=\"col-2 mt-8\">\n <sd-button width=\"100%\" [title]=\"'Save'\" color=\"info\" (click)=\"createTemplate()\"> </sd-button>\n </div>\n </div>\n </ng-container>\n </div>\n</sd-modal>\n", styles: [".c-radio-group{display:flex;flex-direction:column;margin:15px 0}.c-radio-button{margin:5px}.c-empty{display:flex;flex-direction:column;justify-content:center;align-items:center;position:static;height:116px;background:#f6f6f6;border-radius:4px}.c-table{position:relative;overflow:auto}.c-table table{width:100%}.c-table .c-th{font-weight:500;font-size:14px;line-height:20px;color:#000}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i5.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i5.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i5.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i3$
|
|
2487
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.21", type: SdPopupExport, isStandalone: true, selector: "sd-popup-export", inputs: { _tableOption: { classPropertyName: "_tableOption", publicName: "tableOption", isSignal: false, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { export: "export" }, viewQueries: [{ propertyName: "modal", first: true, predicate: ["modal"], descendants: true }, { propertyName: "listGroups", first: true, predicate: ["listGroups"], descendants: true }], ngImport: i0, template: "<sd-modal width=\"907px\" [title]=\"'Exported template'\" #modal>\n <div class=\"row\">\n <div *ngIf=\"!files?.length\" class=\"col-12\">\n <div class=\"c-empty\">\n <img class=\"sd-image-data-empty\" alt=\"empty-image\" />\n <div class=\"T14R\">{{ 'There are no exported templates' }}</div>\n </div>\n </div>\n <ng-container *ngIf=\"files?.length\">\n <div class=\"col-12\">\n <div class=\"c-table\" style=\"max-height: 50vh\">\n <table mat-table [dataSource]=\"files\">\n <ng-container matColumnDef=\"stt\">\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width: 50px\">#</th>\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item; let idx = index\">\n {{ idx + 1 }}\n </td>\n </ng-container>\n <ng-container matColumnDef=\"fileName\">\n <th mat-header-cell class=\"c-th px-5\" *matHeaderCellDef>\n {{ 'File name' }}\n </th>\n <td class=\"px-5\" mat-cell *matCellDef=\"let item\">\n {{ item.fileName }}\n </td>\n </ng-container>\n <ng-container matColumnDef=\"action\">\n <th mat-header-cell class=\"c-th px-5\" *matHeaderCellDef style=\"width: 80px\"></th>\n <td class=\"px-5\" mat-cell *matCellDef=\"let item\">\n <div class=\"d-flex\">\n <button mat-icon-button aria-label=\"delete\" (click)=\"removeFile(item)\">\n <sd-icon name=\"delete\"></sd-icon>\n </button>\n <button mat-icon-button aria-label=\"download\" (click)=\"onExport(item)\">\n <sd-icon name=\"download\"></sd-icon>\n </button>\n </div>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"['stt', 'fileName', 'action']; sticky: true\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: ['stt', 'fileName', 'action']\"></tr>\n </table>\n </div>\n </div>\n <div *ngIf=\"files.length < 5\" class=\"col-12 mt-10\">\n <sd-button class=\"mr-4\" [title]=\"'New template'\" (click)=\"enableCreating = true\" color=\"info\" [disabled]=\"enableCreating\">\n </sd-button>\n <sd-button *ngIf=\"exportOption?.enableUpload\" [title]=\"'Upload template'\" (click)=\"uploadTemplate()\" type=\"outline\">\n </sd-button>\n </div>\n </ng-container>\n <ng-container *ngIf=\"enableCreating || !files?.length\">\n <div class=\"col-12 mt-20\">\n <div class=\"T14R\">{{ 'Select columns for creating template' }}:</div>\n </div>\n <div class=\"col-12\">\n <mat-chip-listbox selectable=\"true\" multiple=\"true\">\n <ng-container *ngFor=\"let column of columns\">\n <mat-chip-option [selected]=\"selected[column.field]\" (click)=\"selected[column.field] = !selected[column.field]\">\n {{ column.title }}\n </mat-chip-option>\n </ng-container>\n </mat-chip-listbox>\n </div>\n <div class=\"col-12 row\">\n <div class=\"col-10\">\n <sd-input [form]=\"form\" [label]=\"'Template name'\" [(model)]=\"templateName\" [validator]=\"templateNameValidator\"></sd-input>\n </div>\n <div class=\"col-2 mt-8\">\n <sd-button width=\"100%\" [title]=\"'Save'\" color=\"info\" (click)=\"createTemplate()\"> </sd-button>\n </div>\n </div>\n </ng-container>\n </div>\n</sd-modal>\n", styles: [".c-radio-group{display:flex;flex-direction:column;margin:15px 0}.c-radio-button{margin:5px}.c-empty{display:flex;flex-direction:column;justify-content:center;align-items:center;position:static;height:116px;background:#f6f6f6;border-radius:4px}.c-table{position:relative;overflow:auto}.c-table table{width:100%}.c-table .c-th{font-weight:500;font-size:14px;line-height:20px;color:#000}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i5.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i5.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i5.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i3$2.MatChipListbox, selector: "mat-chip-listbox", inputs: ["multiple", "aria-orientation", "selectable", "compareWith", "required", "hideSingleSelectionIndicator", "value"], outputs: ["change"] }, { kind: "component", type: i3$2.MatChipOption, selector: "mat-basic-chip-option, [mat-basic-chip-option], mat-chip-option, [mat-chip-option]", inputs: ["selectable", "selected"], outputs: ["selectionChange"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdInput, selector: "sd-input", inputs: ["autoId", "name", "appearance", "floatLabel", "size", "form", "label", "helperText", "placeholder", "type", "mask", "hideInlineError", "blurOnEnter", "clearable", "required", "readonly", "disabled", "viewed", "minlength", "maxlength", "pattern", "patternErrorMessage", "validator", "inlineError", "hyperlink", "model"], outputs: ["modelChange", "sdChange", "sdFocus", "sdBlur", "keyupEnter", "cleared", "sdFocusForceBlur"] }, { kind: "component", type: SdModal, selector: "sd-modal", inputs: ["autoId", "title", "color", "width", "height", "view", "modalClass", "lazyLoadContent", "hideClose", "disableBackdropClose", "beforeClose"], outputs: ["sdClosed", "sdCloseError"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2088
2488
|
}
|
|
2089
2489
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdPopupExport, decorators: [{
|
|
2090
2490
|
type: Component,
|
|
@@ -2563,212 +2963,31 @@ class SdGroupPipe {
|
|
|
2563
2963
|
header.meta.id = `sd-group-${key}`;
|
|
2564
2964
|
header.meta.group = {
|
|
2565
2965
|
isGroupHeader: true,
|
|
2566
|
-
key,
|
|
2567
|
-
values: bucket.values,
|
|
2568
|
-
items: bucket.items,
|
|
2569
|
-
// why: precompute 1 lần — template/context không map lại mỗi CD pass nữa.
|
|
2570
|
-
data: bucket.items.map(i => i.data),
|
|
2571
|
-
isExpanded,
|
|
2572
|
-
};
|
|
2573
|
-
header.meta.selector.selectable = false;
|
|
2574
|
-
header.meta.group.context = buildGroupHeaderContext(header, host);
|
|
2575
|
-
syncGroupSelectionMeta(header);
|
|
2576
|
-
host?.headers.push(header);
|
|
2577
|
-
result.push(header);
|
|
2578
|
-
if (!collapsible || isExpanded) {
|
|
2579
|
-
for (const child of bucket.items)
|
|
2580
|
-
result.push(child);
|
|
2581
|
-
}
|
|
2582
|
-
});
|
|
2583
|
-
return result;
|
|
2584
|
-
}
|
|
2585
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdGroupPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2586
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: SdGroupPipe, isStandalone: true, name: "sdGroup" });
|
|
2587
|
-
}
|
|
2588
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdGroupPipe, decorators: [{
|
|
2589
|
-
type: Pipe,
|
|
2590
|
-
args: [{ name: 'sdGroup' }]
|
|
2591
|
-
}] });
|
|
2592
|
-
|
|
2593
|
-
class SdSelectionDisabledPipe {
|
|
2594
|
-
transform = (selectedItems, rowData, selection) => {
|
|
2595
|
-
const { disabled, actions } = selection;
|
|
2596
|
-
const selectedData = selectedItems.map(e => e.data);
|
|
2597
|
-
const setDisabled = (isDisabled) => {
|
|
2598
|
-
rowData.meta.selector.selectable = !isDisabled;
|
|
2599
|
-
return isDisabled;
|
|
2600
|
-
};
|
|
2601
|
-
if (rowData.meta.selector.isSelected) {
|
|
2602
|
-
return setDisabled(false);
|
|
2603
|
-
}
|
|
2604
|
-
// Kiểm tra có bị disabled theo function không
|
|
2605
|
-
// Dữ liệu chưa được check thì kiểm tra hàm disable nếu có
|
|
2606
|
-
if (disabled?.(rowData.data, selectedData)) {
|
|
2607
|
-
return setDisabled(true);
|
|
2608
|
-
}
|
|
2609
|
-
if (!actions?.length) {
|
|
2610
|
-
return setDisabled(false);
|
|
2611
|
-
}
|
|
2612
|
-
// Lọc các action theo selectedItems hiện tại
|
|
2613
|
-
const availableActions = actions.filter(action => {
|
|
2614
|
-
if ('children' in action) {
|
|
2615
|
-
for (const childAction of action.children) {
|
|
2616
|
-
const key = Utilities.hash(childAction);
|
|
2617
|
-
if (selectedItems.every(e => e.meta.selector?.actions?.includes(key))) {
|
|
2618
|
-
return true;
|
|
2619
|
-
}
|
|
2620
|
-
}
|
|
2621
|
-
return false;
|
|
2622
|
-
}
|
|
2623
|
-
else {
|
|
2624
|
-
const key = Utilities.hash(action);
|
|
2625
|
-
return selectedItems.every(e => e.meta.selector?.actions?.includes(key));
|
|
2626
|
-
}
|
|
2627
|
-
});
|
|
2628
|
-
// Kiểm tra rowData có action nào thỏa hay ko, nếu ko thì disabled
|
|
2629
|
-
for (const action of availableActions) {
|
|
2630
|
-
if ('children' in action) {
|
|
2631
|
-
for (const childAction of action.children) {
|
|
2632
|
-
if (rowData.meta.selector?.actions?.includes(Utilities.hash(childAction))) {
|
|
2633
|
-
return setDisabled(false);
|
|
2634
|
-
}
|
|
2635
|
-
}
|
|
2636
|
-
}
|
|
2637
|
-
else {
|
|
2638
|
-
if (rowData.meta.selector?.actions?.includes(Utilities.hash(action))) {
|
|
2639
|
-
return setDisabled(false);
|
|
2640
|
-
}
|
|
2641
|
-
}
|
|
2642
|
-
}
|
|
2643
|
-
return setDisabled(true);
|
|
2644
|
-
};
|
|
2645
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdSelectionDisabledPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2646
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: SdSelectionDisabledPipe, isStandalone: true, name: "selectionDisabled" });
|
|
2647
|
-
}
|
|
2648
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdSelectionDisabledPipe, decorators: [{
|
|
2649
|
-
type: Pipe,
|
|
2650
|
-
args: [{
|
|
2651
|
-
name: 'selectionDisabled',
|
|
2652
|
-
}]
|
|
2653
|
-
}] });
|
|
2654
|
-
|
|
2655
|
-
/** Một action hiển thị được với row này hay không (`hidden` có thể là cờ tĩnh hoặc predicate). */
|
|
2656
|
-
const isActionVisible = (hidden, data) => typeof hidden === 'function' ? !hidden(data) : !hidden;
|
|
2657
|
-
/**
|
|
2658
|
-
* Thu thập danh sách action key khả dụng cho MỘT row.
|
|
2659
|
-
*
|
|
2660
|
-
* why: ghi thẳng vào 2 mảng do caller cấp (in-place) thay vì `return` mảng mới —
|
|
2661
|
-
* hàm này chạy trong đường render (mỗi CD pass, mỗi row) nên không được cấp phát
|
|
2662
|
-
* mảng mới mỗi lần gọi. Caller reset độ dài mảng trước khi gọi.
|
|
2663
|
-
*
|
|
2664
|
-
* Key = `Utilities.hash(action)`, khớp với `ActionFilterPipe` để action bar lọc
|
|
2665
|
-
* đúng action chung của mọi item đang chọn.
|
|
2666
|
-
*/
|
|
2667
|
-
const collectRowActionKeys = (rowData, selection, actions, groupedActions) => {
|
|
2668
|
-
for (const action of selection?.actions ?? []) {
|
|
2669
|
-
if ('children' in action) {
|
|
2670
|
-
let flag = false;
|
|
2671
|
-
let hasGroup = false;
|
|
2672
|
-
for (const child of action.children) {
|
|
2673
|
-
const { hidden, isGrouped } = child;
|
|
2674
|
-
if (isGrouped) {
|
|
2675
|
-
hasGroup = true;
|
|
2676
|
-
}
|
|
2677
|
-
if (isActionVisible(hidden, rowData.data)) {
|
|
2678
|
-
flag = true;
|
|
2679
|
-
const key = Utilities.hash(child);
|
|
2680
|
-
actions.push(key);
|
|
2681
|
-
if (isGrouped) {
|
|
2682
|
-
groupedActions.push(key);
|
|
2683
|
-
}
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
if (flag) {
|
|
2687
|
-
const key = Utilities.hash(action);
|
|
2688
|
-
actions.push(key);
|
|
2689
|
-
if (hasGroup) {
|
|
2690
|
-
groupedActions.push(key);
|
|
2691
|
-
}
|
|
2692
|
-
}
|
|
2693
|
-
}
|
|
2694
|
-
else {
|
|
2695
|
-
const { hidden, isGrouped } = action;
|
|
2696
|
-
if (isActionVisible(hidden, rowData.data)) {
|
|
2697
|
-
const key = Utilities.hash(action);
|
|
2698
|
-
actions.push(key);
|
|
2699
|
-
if (isGrouped) {
|
|
2700
|
-
groupedActions.push(key);
|
|
2701
|
-
}
|
|
2966
|
+
key,
|
|
2967
|
+
values: bucket.values,
|
|
2968
|
+
items: bucket.items,
|
|
2969
|
+
// why: precompute 1 lần — template/context không map lại mỗi CD pass nữa.
|
|
2970
|
+
data: bucket.items.map(i => i.data),
|
|
2971
|
+
isExpanded,
|
|
2972
|
+
};
|
|
2973
|
+
header.meta.selector.selectable = false;
|
|
2974
|
+
header.meta.group.context = buildGroupHeaderContext(header, host);
|
|
2975
|
+
syncGroupSelectionMeta(header);
|
|
2976
|
+
host?.headers.push(header);
|
|
2977
|
+
result.push(header);
|
|
2978
|
+
if (!collapsible || isExpanded) {
|
|
2979
|
+
for (const child of bucket.items)
|
|
2980
|
+
result.push(child);
|
|
2702
2981
|
}
|
|
2703
|
-
}
|
|
2704
|
-
|
|
2705
|
-
};
|
|
2706
|
-
/**
|
|
2707
|
-
* Checkbox "chọn tất cả" ở header có hiển thị hay không.
|
|
2708
|
-
*
|
|
2709
|
-
* why: trước đây là pure pipe `async` với `await setTimeout(500)` bên trong. Sleep đó
|
|
2710
|
-
* che một vấn đề THỨ TỰ change-detection: pipe đọc `meta.selector.actions` — mảng do
|
|
2711
|
-
* `SdSelectionVisiblePipe` ghi ở cell BODY, mà CDK render header TRƯỚC body, nên ở pass
|
|
2712
|
-
* đầu mảng luôn rỗng. Hệ quả: checkbox hiện trễ 500ms và mỗi lần re-eval lại đẻ thêm
|
|
2713
|
-
* một timer không ai dọn. Ở đây tự tính key action từ `selection` nên không phụ thuộc
|
|
2714
|
-
* pipe nào chạy trước → quyết định được ngay trong pass hiện tại, không cần timer.
|
|
2715
|
-
*/
|
|
2716
|
-
const resolveSelectAllVisible = (items, selection) => {
|
|
2717
|
-
// Nếu chỉ chọn 1 thì không có select all
|
|
2718
|
-
if (selection?.single)
|
|
2719
|
-
return false;
|
|
2720
|
-
if (!items.length)
|
|
2721
|
-
return false;
|
|
2722
|
-
if (!selection?.actions?.length)
|
|
2723
|
-
return true;
|
|
2724
|
-
if (selection.actions.some(e => ('children' in e && e.children.some(e1 => e1.isGrouped)) || e.isGrouped))
|
|
2725
|
-
return false;
|
|
2726
|
-
const keysPerRow = [];
|
|
2727
|
-
for (const item of items) {
|
|
2728
|
-
const actions = [];
|
|
2729
|
-
collectRowActionKeys(item, selection, actions, []);
|
|
2730
|
-
if (actions.length)
|
|
2731
|
-
keysPerRow.push(actions);
|
|
2982
|
+
});
|
|
2983
|
+
return result;
|
|
2732
2984
|
}
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
// Có ít nhất 1 action chung cho MỌI row còn action → cho phép select all.
|
|
2736
|
-
return keysPerRow[0].some(action => keysPerRow.every(keys => keys.includes(action)));
|
|
2737
|
-
};
|
|
2738
|
-
|
|
2739
|
-
class SdSelectionVisiblePipe {
|
|
2740
|
-
transform = (rowData, selection) => {
|
|
2741
|
-
const selector = rowData.meta.selector;
|
|
2742
|
-
const actions = (selector.actions ??= []);
|
|
2743
|
-
if (!selection?.actions?.length) {
|
|
2744
|
-
selector.selectable = true;
|
|
2745
|
-
return selector.selectable;
|
|
2746
|
-
}
|
|
2747
|
-
// why: pipe là pure nhưng lại GHI vào chính input (`meta.selector.actions`). Bản cũ
|
|
2748
|
-
// chỉ `actions = actions || []` rồi push, không bao giờ reset — mỗi lần re-eval cho
|
|
2749
|
-
// cùng một row (mỗi CD pass) lại nối thêm bản sao của các key vào MẢNG CŨ, tăng vô
|
|
2750
|
-
// hạn; `selectable` và `ActionFilterPipe`/select-all sau đó đọc mảng đã nhiễm.
|
|
2751
|
-
// Reset TẠI CHỖ (giữ nguyên reference, không cấp phát mảng mới mỗi pass) rồi mới
|
|
2752
|
-
// tính lại → transform trở nên idempotent.
|
|
2753
|
-
actions.length = 0;
|
|
2754
|
-
const groupedActions = [];
|
|
2755
|
-
collectRowActionKeys(rowData, selection, actions, groupedActions);
|
|
2756
|
-
selector.selectable = !!actions.length;
|
|
2757
|
-
if (!selector.selectable || !groupedActions.length || rowData?.meta.group?.items?.length) {
|
|
2758
|
-
return selector.selectable;
|
|
2759
|
-
}
|
|
2760
|
-
// Đối với trường hợp grouped, tuy selectable là true nhưng vẫn ẩn đi checkbox
|
|
2761
|
-
// nếu các action đều thuộc groupedActions và rowData ko phải là dòng group
|
|
2762
|
-
return actions.some(action => !groupedActions.includes(action));
|
|
2763
|
-
};
|
|
2764
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdSelectionVisiblePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2765
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: SdSelectionVisiblePipe, isStandalone: true, name: "selectionVisible" });
|
|
2985
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdGroupPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2986
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: SdGroupPipe, isStandalone: true, name: "sdGroup" });
|
|
2766
2987
|
}
|
|
2767
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type:
|
|
2988
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdGroupPipe, decorators: [{
|
|
2768
2989
|
type: Pipe,
|
|
2769
|
-
args: [{
|
|
2770
|
-
name: 'selectionVisible',
|
|
2771
|
-
}]
|
|
2990
|
+
args: [{ name: 'sdGroup' }]
|
|
2772
2991
|
}] });
|
|
2773
2992
|
|
|
2774
2993
|
class TableExportService {
|
|
@@ -3274,6 +3493,32 @@ const buildColumnWidthMap = (column) => {
|
|
|
3274
3493
|
return result;
|
|
3275
3494
|
};
|
|
3276
3495
|
|
|
3496
|
+
const sortValue = (value, type) => {
|
|
3497
|
+
if (value === null || value === undefined || value === '')
|
|
3498
|
+
return null;
|
|
3499
|
+
if (type === 'number') {
|
|
3500
|
+
const number = typeof value === 'number' || typeof value === 'string' || typeof value === 'boolean' ? Number(value) : NaN;
|
|
3501
|
+
return Number.isNaN(number) ? null : number;
|
|
3502
|
+
}
|
|
3503
|
+
if (type === 'date' || type === 'datetime' || type === 'time') {
|
|
3504
|
+
const time = value instanceof Date ? value.getTime() : typeof value === 'string' || typeof value === 'number' ? new Date(value).getTime() : NaN;
|
|
3505
|
+
return Number.isNaN(time) ? null : time;
|
|
3506
|
+
}
|
|
3507
|
+
return String(value);
|
|
3508
|
+
};
|
|
3509
|
+
/** Internal local-sort comparison; intentionally not exported from the table entry point. */
|
|
3510
|
+
const compareLocalValues = (a, b, type, direction) => {
|
|
3511
|
+
const first = sortValue(a, type);
|
|
3512
|
+
const second = sortValue(b, type);
|
|
3513
|
+
// why: xếp rỗng trước khi xét chiều để DESC vẫn giữ rỗng ở cuối và không đảo các dòng bằng nhau.
|
|
3514
|
+
if (first === null)
|
|
3515
|
+
return second === null ? 0 : 1;
|
|
3516
|
+
if (second === null)
|
|
3517
|
+
return -1;
|
|
3518
|
+
const order = first < second ? -1 : first > second ? 1 : 0;
|
|
3519
|
+
return direction === 'DESC' ? -order : order;
|
|
3520
|
+
};
|
|
3521
|
+
|
|
3277
3522
|
const isTableItem = (item) => !!item && typeof item === 'object' && 'data' in item && 'meta' in item;
|
|
3278
3523
|
const resolveItemData = (item) => (isTableItem(item) ? item.data : item);
|
|
3279
3524
|
const hasActiveColumnFilter = (rawColumnFilter = {}, columns = []) => columns.some(col => {
|
|
@@ -3390,27 +3635,8 @@ const filterLocalItems = (localItems, option, filterInfo) => {
|
|
|
3390
3635
|
items.sort((tableItemCurrent, tableItemNext) => {
|
|
3391
3636
|
const dataVal = Utilities.getNestedValue(resolveItemData(tableItemCurrent), field);
|
|
3392
3637
|
const nextVal = Utilities.getNestedValue(resolveItemData(tableItemNext), field);
|
|
3393
|
-
|
|
3394
|
-
return (dataVal || 0) - (nextVal || 0);
|
|
3395
|
-
}
|
|
3396
|
-
if (type === 'date' || type === 'datetime' || type === 'time') {
|
|
3397
|
-
const d1 = new Date(dataVal || '').getTime();
|
|
3398
|
-
const d2 = new Date(nextVal || '').getTime();
|
|
3399
|
-
return d1 - d2;
|
|
3400
|
-
}
|
|
3401
|
-
const s1 = (dataVal || '').toString();
|
|
3402
|
-
const s2 = (nextVal || '').toString();
|
|
3403
|
-
if (s1 > s2) {
|
|
3404
|
-
return 1;
|
|
3405
|
-
}
|
|
3406
|
-
if (s1 < s2) {
|
|
3407
|
-
return -1;
|
|
3408
|
-
}
|
|
3409
|
-
return 0;
|
|
3638
|
+
return compareLocalValues(dataVal, nextVal, type, orderDirection);
|
|
3410
3639
|
});
|
|
3411
|
-
if (orderDirection === 'DESC') {
|
|
3412
|
-
items.reverse();
|
|
3413
|
-
}
|
|
3414
3640
|
}
|
|
3415
3641
|
}
|
|
3416
3642
|
return {
|
|
@@ -3494,6 +3720,130 @@ const reorderTableItems = ({ items, renderedItems, previousRenderedIndex, curren
|
|
|
3494
3720
|
};
|
|
3495
3721
|
};
|
|
3496
3722
|
|
|
3723
|
+
/** Một action hiển thị được với row này hay không (`hidden` có thể là cờ tĩnh hoặc predicate). */
|
|
3724
|
+
const isActionVisible = (hidden, data) => typeof hidden === 'function' ? !hidden(data) : !hidden;
|
|
3725
|
+
/**
|
|
3726
|
+
* Thu thập danh sách action key khả dụng cho MỘT row.
|
|
3727
|
+
*
|
|
3728
|
+
* why: ghi thẳng vào 2 mảng do caller cấp (in-place) thay vì `return` mảng mới —
|
|
3729
|
+
* hàm này chạy trong đường render (mỗi CD pass, mỗi row) nên không được cấp phát
|
|
3730
|
+
* mảng mới mỗi lần gọi. Caller reset độ dài mảng trước khi gọi.
|
|
3731
|
+
*
|
|
3732
|
+
* Key = `Utilities.hash(action)`, khớp với `ActionFilterPipe` để action bar lọc
|
|
3733
|
+
* đúng action chung của mọi item đang chọn.
|
|
3734
|
+
*/
|
|
3735
|
+
const collectRowActionKeys = (rowData, selection, actions, groupedActions) => {
|
|
3736
|
+
for (const action of selection?.actions ?? []) {
|
|
3737
|
+
if (!isActionVisible(action.hidden, rowData.data))
|
|
3738
|
+
continue;
|
|
3739
|
+
if ('children' in action) {
|
|
3740
|
+
let flag = false;
|
|
3741
|
+
let hasGroup = false;
|
|
3742
|
+
for (const child of action.children) {
|
|
3743
|
+
const { hidden, isGrouped } = child;
|
|
3744
|
+
if (isGrouped) {
|
|
3745
|
+
hasGroup = true;
|
|
3746
|
+
}
|
|
3747
|
+
if (isActionVisible(hidden, rowData.data)) {
|
|
3748
|
+
flag = true;
|
|
3749
|
+
const key = Utilities.hash(child);
|
|
3750
|
+
actions.push(key);
|
|
3751
|
+
if (isGrouped) {
|
|
3752
|
+
groupedActions.push(key);
|
|
3753
|
+
}
|
|
3754
|
+
}
|
|
3755
|
+
}
|
|
3756
|
+
if (flag) {
|
|
3757
|
+
const key = Utilities.hash(action);
|
|
3758
|
+
actions.push(key);
|
|
3759
|
+
if (hasGroup) {
|
|
3760
|
+
groupedActions.push(key);
|
|
3761
|
+
}
|
|
3762
|
+
}
|
|
3763
|
+
}
|
|
3764
|
+
else {
|
|
3765
|
+
const { hidden, isGrouped } = action;
|
|
3766
|
+
if (isActionVisible(hidden, rowData.data)) {
|
|
3767
|
+
const key = Utilities.hash(action);
|
|
3768
|
+
actions.push(key);
|
|
3769
|
+
if (isGrouped) {
|
|
3770
|
+
groupedActions.push(key);
|
|
3771
|
+
}
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
};
|
|
3776
|
+
/**
|
|
3777
|
+
* Checkbox "chọn tất cả" ở header có hiển thị hay không.
|
|
3778
|
+
*
|
|
3779
|
+
* why: trước đây là pure pipe `async` với `await setTimeout(500)` bên trong. Sleep đó
|
|
3780
|
+
* che một vấn đề THỨ TỰ change-detection: pipe đọc `meta.selector.actions` — mảng do
|
|
3781
|
+
* `SdSelectionVisiblePipe` ghi ở cell BODY, mà CDK render header TRƯỚC body, nên ở pass
|
|
3782
|
+
* đầu mảng luôn rỗng. Hệ quả: checkbox hiện trễ 500ms và mỗi lần re-eval lại đẻ thêm
|
|
3783
|
+
* một timer không ai dọn. Ở đây tự tính key action từ `selection` nên không phụ thuộc
|
|
3784
|
+
* pipe nào chạy trước → quyết định được ngay trong pass hiện tại, không cần timer.
|
|
3785
|
+
*/
|
|
3786
|
+
const resolveSelectAllVisible = (items, selection) => {
|
|
3787
|
+
// Nếu chỉ chọn 1 thì không có select all
|
|
3788
|
+
if (selection?.single)
|
|
3789
|
+
return false;
|
|
3790
|
+
if (!items.length)
|
|
3791
|
+
return false;
|
|
3792
|
+
if (!selection?.actions?.length)
|
|
3793
|
+
return true;
|
|
3794
|
+
if (selection.actions.some(e => ('children' in e && e.children.some(e1 => e1.isGrouped)) || e.isGrouped))
|
|
3795
|
+
return false;
|
|
3796
|
+
const keysPerRow = [];
|
|
3797
|
+
for (const item of items) {
|
|
3798
|
+
const actions = [];
|
|
3799
|
+
collectRowActionKeys(item, selection, actions, []);
|
|
3800
|
+
if (actions.length)
|
|
3801
|
+
keysPerRow.push(actions);
|
|
3802
|
+
}
|
|
3803
|
+
if (!keysPerRow.length)
|
|
3804
|
+
return false;
|
|
3805
|
+
// Có ít nhất 1 action chung cho MỌI row còn action → cho phép select all.
|
|
3806
|
+
const leafKeys = (selection.actions ?? []).flatMap(action => 'children' in action ? action.children.map(child => Utilities.hash(child)) : [Utilities.hash(action)]);
|
|
3807
|
+
return leafKeys.some(action => keysPerRow.every(keys => keys.includes(action)));
|
|
3808
|
+
};
|
|
3809
|
+
/** Same grouped-action visibility contract for both renderers and the legacy pipe. */
|
|
3810
|
+
function prepareRowSelectionVisibility(row, selection) {
|
|
3811
|
+
const meta = row.meta.selector;
|
|
3812
|
+
const keys = (meta.actions ??= []);
|
|
3813
|
+
keys.length = 0;
|
|
3814
|
+
const grouped = [];
|
|
3815
|
+
collectRowActionKeys(row, selection, keys, grouped);
|
|
3816
|
+
meta.selectable = !selection?.actions?.length || keys.length > 0;
|
|
3817
|
+
meta.visible =
|
|
3818
|
+
!!meta.isSelected ||
|
|
3819
|
+
(meta.selectable && (!grouped.length || !!row.meta.group?.items?.length || keys.some(key => !grouped.includes(key))));
|
|
3820
|
+
return meta.visible;
|
|
3821
|
+
}
|
|
3822
|
+
/** A selected row remains removable even if its eligibility changed after a reload. */
|
|
3823
|
+
function resolveRowSelectionDisabled(selected, row, selection) {
|
|
3824
|
+
if (row.meta.selector.isSelected)
|
|
3825
|
+
return false;
|
|
3826
|
+
if (selection?.disabled?.(row.data, selected.map(item => item.data)))
|
|
3827
|
+
return true;
|
|
3828
|
+
if (!selection?.actions?.length)
|
|
3829
|
+
return false;
|
|
3830
|
+
// why: chọn đơn thay thế lựa chọn cũ, không cần action chung với dòng cũ.
|
|
3831
|
+
const comparison = selection.single ? [] : selected;
|
|
3832
|
+
const leafKeys = selection.actions.flatMap(action => 'children' in action ? action.children.map(child => Utilities.hash(child)) : [Utilities.hash(action)]);
|
|
3833
|
+
return !leafKeys.some(key => row.meta.selector?.actions?.includes(key) && comparison.every(item => item.meta.selector?.actions?.includes(key)));
|
|
3834
|
+
}
|
|
3835
|
+
/** Prepare ALL action keys first so no row depends on another cell's rendering order. */
|
|
3836
|
+
function prepareTableSelection(rows, selected, selection) {
|
|
3837
|
+
const all = [...new Set([...rows, ...selected])];
|
|
3838
|
+
for (const row of all)
|
|
3839
|
+
prepareRowSelectionVisibility(row, selection);
|
|
3840
|
+
for (const row of all) {
|
|
3841
|
+
const meta = row.meta.selector;
|
|
3842
|
+
meta.disabled = resolveRowSelectionDisabled(selected, row, selection);
|
|
3843
|
+
meta.selectable = (!!meta.isSelected || !selection?.actions?.length || !!meta.actions?.length) && !meta.disabled;
|
|
3844
|
+
}
|
|
3845
|
+
}
|
|
3846
|
+
|
|
3497
3847
|
class SdTableFilterService {
|
|
3498
3848
|
storageService = inject(SdStorageService);
|
|
3499
3849
|
#destroyRef = inject(DestroyRef);
|
|
@@ -3753,6 +4103,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
3753
4103
|
type: Injectable
|
|
3754
4104
|
}], ctorParameters: () => [] });
|
|
3755
4105
|
|
|
4106
|
+
/** Internal title-only sort control. The semantic header cell owns aria-sort. */
|
|
4107
|
+
class SdTableSortHeaderDirective {
|
|
4108
|
+
id;
|
|
4109
|
+
start;
|
|
4110
|
+
disableClear;
|
|
4111
|
+
sort = inject(MatSort);
|
|
4112
|
+
ngOnInit() {
|
|
4113
|
+
this.sort.register(this);
|
|
4114
|
+
}
|
|
4115
|
+
ngOnDestroy() {
|
|
4116
|
+
this.sort.deregister(this);
|
|
4117
|
+
}
|
|
4118
|
+
activate() {
|
|
4119
|
+
if (!this.sort.disabled)
|
|
4120
|
+
this.sort.sort(this);
|
|
4121
|
+
}
|
|
4122
|
+
onKeydown(event) {
|
|
4123
|
+
if (event.key !== 'Enter' && event.key !== ' ')
|
|
4124
|
+
return;
|
|
4125
|
+
event.preventDefault();
|
|
4126
|
+
this.activate();
|
|
4127
|
+
}
|
|
4128
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableSortHeaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4129
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.21", type: SdTableSortHeaderDirective, isStandalone: true, selector: "[sdTableSortHeader]", inputs: { id: ["sdTableSortHeader", "id"] }, host: { attributes: { "role": "button" }, listeners: { "click": "activate()", "keydown": "onKeydown($event)" }, properties: { "attr.data-sort-id": "id", "attr.tabindex": "sort.disabled ? -1 : 0", "attr.aria-disabled": "sort.disabled ? \"true\" : null" }, classAttribute: "sd-table-sort-header" }, ngImport: i0 });
|
|
4130
|
+
}
|
|
4131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTableSortHeaderDirective, decorators: [{
|
|
4132
|
+
type: Directive,
|
|
4133
|
+
args: [{
|
|
4134
|
+
selector: '[sdTableSortHeader]',
|
|
4135
|
+
standalone: true,
|
|
4136
|
+
host: {
|
|
4137
|
+
class: 'sd-table-sort-header',
|
|
4138
|
+
role: 'button',
|
|
4139
|
+
'[attr.data-sort-id]': 'id',
|
|
4140
|
+
'[attr.tabindex]': 'sort.disabled ? -1 : 0',
|
|
4141
|
+
'[attr.aria-disabled]': 'sort.disabled ? "true" : null',
|
|
4142
|
+
'(click)': 'activate()',
|
|
4143
|
+
'(keydown)': 'onKeydown($event)',
|
|
4144
|
+
},
|
|
4145
|
+
}]
|
|
4146
|
+
}], propDecorators: { id: [{
|
|
4147
|
+
type: Input,
|
|
4148
|
+
args: [{ required: true, alias: 'sdTableSortHeader' }]
|
|
4149
|
+
}] } });
|
|
3756
4150
|
// why: tên cũ `MatPaginatorIntlCro` là vết copy-paste từ ví dụ locale Croatia — lớp này chỉ phục vụ
|
|
3757
4151
|
// nhãn phân trang của `<sd-table>` (VI/EN), không liên quan gì tới tiếng Croatia. Tên cũ lại còn
|
|
3758
4152
|
// mang tiền tố `Mat`, dễ bị hiểu nhầm là API của Angular Material thay vì export public của lib này.
|
|
@@ -3808,6 +4202,9 @@ class SdTable {
|
|
|
3808
4202
|
sdFooterDefs = contentChildren(SdMaterialFooterDefDirective);
|
|
3809
4203
|
sdFilterDefs = contentChildren(SdTableFilterDefDirective);
|
|
3810
4204
|
sdTitleDefs = contentChildren(SdTableTitleDefDirective);
|
|
4205
|
+
sdRowMobileDef = contentChild(SdTableRowMobileDefDirective, { descendants: false });
|
|
4206
|
+
isMobile = inject(SdViewportService).isMobile;
|
|
4207
|
+
mobileCards = computed(() => this.isMobile() && !!this.sdRowMobileDef());
|
|
3811
4208
|
// ==========================================
|
|
3812
4209
|
// 3. COMPUTED FROM QUERIES
|
|
3813
4210
|
// ==========================================
|
|
@@ -3830,6 +4227,15 @@ class SdTable {
|
|
|
3830
4227
|
return map;
|
|
3831
4228
|
});
|
|
3832
4229
|
hasFooter = computed(() => Object.keys(this.footerDef()).length > 0);
|
|
4230
|
+
mobileColumns = computed(() => {
|
|
4231
|
+
const config = this.configuration();
|
|
4232
|
+
return [...(config?.firstColumns ?? []), ...(config?.secondColumns ?? [])].filter(column => column.type !== 'children');
|
|
4233
|
+
});
|
|
4234
|
+
mobileFooterColumns = computed(() => {
|
|
4235
|
+
const config = this.configuration();
|
|
4236
|
+
const footers = this.footerDef();
|
|
4237
|
+
return [...(config?.firstColumns ?? []), ...(config?.secondColumns ?? [])].filter(column => !!footers[column.field] && config?.displayedFooters.includes(column.field));
|
|
4238
|
+
});
|
|
3833
4239
|
titleDef = computed(() => {
|
|
3834
4240
|
const map = {};
|
|
3835
4241
|
for (const def of this.sdTitleDefs()) {
|
|
@@ -3848,7 +4254,73 @@ class SdTable {
|
|
|
3848
4254
|
selectedTableItems = signal([]);
|
|
3849
4255
|
total = signal(undefined);
|
|
3850
4256
|
loading = signal(false);
|
|
4257
|
+
loadError = signal(false);
|
|
3851
4258
|
isSelectAll = signal(false);
|
|
4259
|
+
isSelectIndeterminate = signal(false);
|
|
4260
|
+
sortState = signal({ active: '', direction: '' });
|
|
4261
|
+
mobileSortColumns = computed(() => {
|
|
4262
|
+
const config = this.configuration();
|
|
4263
|
+
const state = this.sortState();
|
|
4264
|
+
return [...(config?.firstColumns ?? []), ...(config?.secondColumns ?? [])]
|
|
4265
|
+
.filter(column => column.type !== 'children' && column.sortable)
|
|
4266
|
+
.map(column => ({
|
|
4267
|
+
field: column.field,
|
|
4268
|
+
title: typeof column.title === 'string' ? column.title : column.title.title,
|
|
4269
|
+
direction: state.active === column.field ? state.direction : '',
|
|
4270
|
+
}));
|
|
4271
|
+
});
|
|
4272
|
+
mobileToolsActions = computed(() => {
|
|
4273
|
+
const option = this.tableOption();
|
|
4274
|
+
if (!option)
|
|
4275
|
+
return [];
|
|
4276
|
+
const t = (key) => this.#i18n.t('core.component.table.' + key);
|
|
4277
|
+
const actions = [];
|
|
4278
|
+
if (option.reload?.visible)
|
|
4279
|
+
actions.push({ key: 'tool-reload', title: t('reload'), icon: 'refresh', run: () => this.reload() });
|
|
4280
|
+
const exporting = option.export;
|
|
4281
|
+
if (exporting && this.items().length) {
|
|
4282
|
+
if (exporting.type === 'custom')
|
|
4283
|
+
actions.push({ key: 'tool-export', title: this.exportTitle(), icon: 'download', run: () => this.exportCustom() });
|
|
4284
|
+
else if (exporting.visible) {
|
|
4285
|
+
const children = [];
|
|
4286
|
+
if (exporting.visible === 'ALL' || exporting.visible === 'EXCEL')
|
|
4287
|
+
children.push({ key: 'tool-export-excel', title: t('export-excel'), icon: 'table_view', run: () => this.exportExcel() });
|
|
4288
|
+
if (exporting.visible === 'ALL' || exporting.visible === 'CSV')
|
|
4289
|
+
children.push({ key: 'tool-export-csv', title: t('export-csv'), icon: 'description', run: () => this.exportCSV() });
|
|
4290
|
+
actions.push({ key: 'tool-export', title: this.exportTitle(), disabled: this.exporting(), children });
|
|
4291
|
+
}
|
|
4292
|
+
}
|
|
4293
|
+
if (!option.filter?.disabled && this.mobileFilter())
|
|
4294
|
+
actions.push({
|
|
4295
|
+
key: 'tool-filter',
|
|
4296
|
+
title: t('filter'),
|
|
4297
|
+
icon: 'filter_alt',
|
|
4298
|
+
closeBeforeRun: true,
|
|
4299
|
+
run: () => this.mobileFilter()?.open(),
|
|
4300
|
+
});
|
|
4301
|
+
if (option.sort?.enable && this.mobileSortColumns().length)
|
|
4302
|
+
actions.push({
|
|
4303
|
+
key: 'tool-sort',
|
|
4304
|
+
title: t('mobile.sort'),
|
|
4305
|
+
children: this.mobileSortColumns().map(column => ({
|
|
4306
|
+
key: 'tool-sort-' + column.field,
|
|
4307
|
+
title: column.title,
|
|
4308
|
+
icon: column.direction === 'asc' ? 'arrow_upward' : column.direction === 'desc' ? 'arrow_downward' : 'sort',
|
|
4309
|
+
run: () => this.sort()?.sort({ id: column.field, start: 'asc', disableClear: false }),
|
|
4310
|
+
})),
|
|
4311
|
+
});
|
|
4312
|
+
if (this.configComponent())
|
|
4313
|
+
actions.push({
|
|
4314
|
+
key: 'tool-config',
|
|
4315
|
+
title: t('setup-short'),
|
|
4316
|
+
icon: 'settings',
|
|
4317
|
+
closeBeforeRun: true,
|
|
4318
|
+
run: () => this.configComponent()?.open(),
|
|
4319
|
+
});
|
|
4320
|
+
return actions;
|
|
4321
|
+
});
|
|
4322
|
+
pageRevision = signal(0);
|
|
4323
|
+
dataRevision = signal(0);
|
|
3852
4324
|
/**
|
|
3853
4325
|
* Checkbox "chọn tất cả" ở header có hiển thị không.
|
|
3854
4326
|
*
|
|
@@ -3860,7 +4332,11 @@ class SdTable {
|
|
|
3860
4332
|
* trả một Promise mới + đặt thêm một timer không ai dọn. Computed tự tính từ
|
|
3861
4333
|
* `items()` + `selector` nên không phụ thuộc pipe nào chạy trước → bỏ hẳn timer.
|
|
3862
4334
|
*/
|
|
3863
|
-
visibleSelectAll = computed(() =>
|
|
4335
|
+
visibleSelectAll = computed(() => {
|
|
4336
|
+
this.selectedTableItems();
|
|
4337
|
+
this.treeRevision();
|
|
4338
|
+
return resolveSelectAllVisible(this.#getSelectionRows().filter(row => row.meta.selector?.selectable), this.tableOption()?.selector);
|
|
4339
|
+
});
|
|
3864
4340
|
/**
|
|
3865
4341
|
* Danh sách command của row, memoize theo option.
|
|
3866
4342
|
* why: template cũ bind `_tableOption.command?.commands || _tableOption.commands || []`
|
|
@@ -3891,6 +4367,7 @@ class SdTable {
|
|
|
3891
4367
|
#itemIndexMap = new WeakMap();
|
|
3892
4368
|
#treeExpandState = new Map();
|
|
3893
4369
|
treeRevision = signal(0);
|
|
4370
|
+
expandRevision = signal(0);
|
|
3894
4371
|
// Search ở cấp con (static tree + type 'local'): predicate khớp 1 dòng theo
|
|
3895
4372
|
// column filter hiện hành. Set ở #filterLocal khi có filter active, đọc lại ở
|
|
3896
4373
|
// #render/#ensureChildItemsFormatted dùng predicate này để prune + auto-expand các
|
|
@@ -3900,6 +4377,7 @@ class SdTable {
|
|
|
3900
4377
|
#treeSearchActive = false;
|
|
3901
4378
|
// 1. Private Services
|
|
3902
4379
|
#ref = inject(ChangeDetectorRef);
|
|
4380
|
+
#destroyed = false;
|
|
3903
4381
|
#configService = inject(ConfigService);
|
|
3904
4382
|
#gridFilterService = inject(SdTableFilterService);
|
|
3905
4383
|
#notifyService = inject(SdNotifyService);
|
|
@@ -3953,22 +4431,35 @@ class SdTable {
|
|
|
3953
4431
|
});
|
|
3954
4432
|
}
|
|
3955
4433
|
});
|
|
3956
|
-
effect(
|
|
4434
|
+
effect(onCleanup => {
|
|
3957
4435
|
const paginator = this.paginator();
|
|
3958
4436
|
if (paginator) {
|
|
3959
4437
|
untracked(() => {
|
|
3960
|
-
|
|
4438
|
+
const subscription = paginator.page.subscribe(() => {
|
|
4439
|
+
this.pageRevision.update(n => n + 1);
|
|
4440
|
+
this.#requestReload(false);
|
|
4441
|
+
});
|
|
4442
|
+
onCleanup(() => subscription.unsubscribe());
|
|
3961
4443
|
});
|
|
3962
4444
|
}
|
|
3963
4445
|
});
|
|
3964
|
-
effect(
|
|
4446
|
+
effect(onCleanup => {
|
|
3965
4447
|
const sort = this.sort();
|
|
3966
4448
|
if (sort) {
|
|
3967
4449
|
untracked(() => {
|
|
3968
|
-
|
|
4450
|
+
const subscription = sort.sortChange.subscribe(state => {
|
|
4451
|
+
this.sortState.set(state);
|
|
4452
|
+
this.#ref.markForCheck();
|
|
4453
|
+
this.#requestReload(false);
|
|
4454
|
+
});
|
|
4455
|
+
onCleanup(() => subscription.unsubscribe());
|
|
3969
4456
|
});
|
|
3970
4457
|
}
|
|
3971
4458
|
});
|
|
4459
|
+
effect(() => {
|
|
4460
|
+
this.mobileCards();
|
|
4461
|
+
untracked(() => this.mobileFilter()?.close());
|
|
4462
|
+
});
|
|
3972
4463
|
effect(() => {
|
|
3973
4464
|
const items = this.items();
|
|
3974
4465
|
this.#itemIndexMap = new WeakMap();
|
|
@@ -4000,7 +4491,7 @@ class SdTable {
|
|
|
4000
4491
|
const result = await this.#load(filterInfo, !this.#loadCompleted || data.force);
|
|
4001
4492
|
if (data.revision !== this.#optionRevision)
|
|
4002
4493
|
return undefined;
|
|
4003
|
-
this.#loadCompleted =
|
|
4494
|
+
this.#loadCompleted = !this.loadError();
|
|
4004
4495
|
return {
|
|
4005
4496
|
result,
|
|
4006
4497
|
revision: data.revision,
|
|
@@ -4013,6 +4504,7 @@ class SdTable {
|
|
|
4013
4504
|
}));
|
|
4014
4505
|
}
|
|
4015
4506
|
ngOnDestroy() {
|
|
4507
|
+
this.#destroyed = true;
|
|
4016
4508
|
this.#subscription.unsubscribe();
|
|
4017
4509
|
}
|
|
4018
4510
|
// --- GIỮ NGUYÊN TẤT CẢ CÁC HÀM FILTER VÀ EXPORT CŨ CỦA BẠN ---
|
|
@@ -4049,6 +4541,10 @@ class SdTable {
|
|
|
4049
4541
|
this.total.set(undefined);
|
|
4050
4542
|
this.loading.set(false);
|
|
4051
4543
|
this.isSelectAll.set(false);
|
|
4544
|
+
this.isSelectIndeterminate.set(false);
|
|
4545
|
+
this.loadError.set(false);
|
|
4546
|
+
this.sortState.set({ active: '', direction: '' });
|
|
4547
|
+
this.pageRevision.update(n => n + 1);
|
|
4052
4548
|
this.isFiltered.set(false);
|
|
4053
4549
|
this.requireFiltered.set(false);
|
|
4054
4550
|
this.columnOperator = {};
|
|
@@ -4219,6 +4715,8 @@ class SdTable {
|
|
|
4219
4715
|
};
|
|
4220
4716
|
#load = async (filterReq, force = true) => {
|
|
4221
4717
|
this.loading.set(true);
|
|
4718
|
+
if (force || this.tableOption()?.type === 'server')
|
|
4719
|
+
this.loadError.set(false);
|
|
4222
4720
|
this.#ref.detectChanges();
|
|
4223
4721
|
this.#checkFilter(filterReq);
|
|
4224
4722
|
const opt = this.tableOption();
|
|
@@ -4244,7 +4742,10 @@ class SdTable {
|
|
|
4244
4742
|
columns: opt.columns,
|
|
4245
4743
|
externalFilters: opt.filter?.externalFilters,
|
|
4246
4744
|
});
|
|
4247
|
-
const data = await
|
|
4745
|
+
const data = await Promise.resolve()
|
|
4746
|
+
.then(() => items(filterReq, pagingReq))
|
|
4747
|
+
.catch(err => {
|
|
4748
|
+
this.loadError.set(true);
|
|
4248
4749
|
console.error(err);
|
|
4249
4750
|
return {
|
|
4250
4751
|
items: [],
|
|
@@ -4256,24 +4757,23 @@ class SdTable {
|
|
|
4256
4757
|
.format(data?.items, opt.columns, this.cacheValues, this.#cacheObjValues, opt.rowKey)
|
|
4257
4758
|
.finally(() => {
|
|
4258
4759
|
this.loading.set(false);
|
|
4259
|
-
this.#
|
|
4760
|
+
if (!this.#destroyed)
|
|
4761
|
+
this.#ref.detectChanges();
|
|
4260
4762
|
}),
|
|
4261
4763
|
total: data?.total || 0,
|
|
4262
4764
|
};
|
|
4263
4765
|
}
|
|
4264
4766
|
if (force) {
|
|
4265
4767
|
const { items } = opt;
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
data = await results.catch(err => {
|
|
4270
|
-
this.#notifyService.warning(this.#i18n.t('core.component.table.error-occurred'));
|
|
4271
|
-
console.error(err);
|
|
4272
|
-
return [];
|
|
4273
|
-
});
|
|
4768
|
+
let data;
|
|
4769
|
+
try {
|
|
4770
|
+
data = await items();
|
|
4274
4771
|
}
|
|
4275
|
-
|
|
4276
|
-
|
|
4772
|
+
catch (err) {
|
|
4773
|
+
this.loadError.set(true);
|
|
4774
|
+
this.#notifyService.warning(this.#i18n.t('core.component.table.error-occurred'));
|
|
4775
|
+
console.error(err);
|
|
4776
|
+
data = [];
|
|
4277
4777
|
}
|
|
4278
4778
|
if (!Array.isArray(data)) {
|
|
4279
4779
|
this.#notifyService.warning(this.#i18n.t('core.component.table.not-an-array'));
|
|
@@ -4282,10 +4782,13 @@ class SdTable {
|
|
|
4282
4782
|
this.#localItems = await this.#tableFormatService.format(data, opt.columns, this.cacheValues, this.#cacheObjValues, opt.rowKey);
|
|
4283
4783
|
}
|
|
4284
4784
|
this.loading.set(false);
|
|
4285
|
-
this.#
|
|
4785
|
+
if (!this.#destroyed)
|
|
4786
|
+
this.#ref.detectChanges();
|
|
4286
4787
|
return this.#filterLocal(this.#localItems, filterReq);
|
|
4287
4788
|
};
|
|
4288
4789
|
#render = async (args, scrollTop = true, additionArgs) => {
|
|
4790
|
+
if (this.#destroyed)
|
|
4791
|
+
return;
|
|
4289
4792
|
if (scrollTop) {
|
|
4290
4793
|
this.scroll()?.scrollTop();
|
|
4291
4794
|
}
|
|
@@ -4314,11 +4817,15 @@ class SdTable {
|
|
|
4314
4817
|
this.treeRevision.update(n => n + 1);
|
|
4315
4818
|
}
|
|
4316
4819
|
this.#treeSearchActive = searchNow;
|
|
4317
|
-
//
|
|
4318
|
-
// Phải chạy TRƯỚC applyDefaultSelected để user-selection ưu tiên hơn default.
|
|
4319
|
-
this.#restorePreservedSelection();
|
|
4320
|
-
// Áp dụng defaultSelected: pre-select các item thỏa predicate
|
|
4820
|
+
// why: lựa chọn được giữ qua các trang ưu tiên hơn default của lần tải mới.
|
|
4321
4821
|
this.#applyDefaultSelected();
|
|
4822
|
+
this.#restorePreservedSelection();
|
|
4823
|
+
if (this.tableOption()?.selector?.single) {
|
|
4824
|
+
const rows = collectFormattedTreeRows(this.items());
|
|
4825
|
+
const chosen = this.#preservedSelectedMap.values().next().value ?? rows.find(row => row.meta.selector?.isSelected);
|
|
4826
|
+
for (const row of rows)
|
|
4827
|
+
row.meta.selector.isSelected = row.meta.id === chosen?.meta.id;
|
|
4828
|
+
}
|
|
4322
4829
|
// Resolve style.rowCss 1 lần/row cho lần render này (xem #applyRowStyles).
|
|
4323
4830
|
this.#applyRowStyles();
|
|
4324
4831
|
await this.tableOption()?.reload?.onReload?.(this.items(), additionArgs);
|
|
@@ -4338,7 +4845,7 @@ class SdTable {
|
|
|
4338
4845
|
notReload: true,
|
|
4339
4846
|
});
|
|
4340
4847
|
const data = await this.#load(this.getFilterRequest(), force);
|
|
4341
|
-
this.#render(data, scrollTop, { fromSource: 'RELOAD' });
|
|
4848
|
+
await this.#render(data, scrollTop, { fromSource: 'RELOAD' });
|
|
4342
4849
|
};
|
|
4343
4850
|
#exportedItems = async (pageNumber = 0, pageSize = 100) => {
|
|
4344
4851
|
const opt = this.tableOption();
|
|
@@ -4457,6 +4964,8 @@ class SdTable {
|
|
|
4457
4964
|
// style của trạng thái đang mở.
|
|
4458
4965
|
this.#applyRowStyles();
|
|
4459
4966
|
this.treeRevision.update(n => n + 1);
|
|
4967
|
+
this.#updateSelectedItems();
|
|
4968
|
+
this.#syncSelectAllState();
|
|
4460
4969
|
this.#ref.markForCheck();
|
|
4461
4970
|
return;
|
|
4462
4971
|
}
|
|
@@ -4494,6 +5003,9 @@ class SdTable {
|
|
|
4494
5003
|
// Children mới format + level/isExpanded vừa đổi → refresh cache rowStyle.
|
|
4495
5004
|
this.#applyRowStyles();
|
|
4496
5005
|
this.treeRevision.update(n => n + 1);
|
|
5006
|
+
this.#restorePreservedSelection();
|
|
5007
|
+
this.#updateSelectedItems();
|
|
5008
|
+
this.#syncSelectAllState();
|
|
4497
5009
|
this.#ref.markForCheck();
|
|
4498
5010
|
}
|
|
4499
5011
|
};
|
|
@@ -4513,84 +5025,83 @@ class SdTable {
|
|
|
4513
5025
|
notReload: true,
|
|
4514
5026
|
});
|
|
4515
5027
|
};
|
|
4516
|
-
onExpand = async (
|
|
4517
|
-
const
|
|
4518
|
-
|
|
5028
|
+
onExpand = async (row) => {
|
|
5029
|
+
const option = this.tableOption()?.expand;
|
|
5030
|
+
const meta = row.meta.expand;
|
|
5031
|
+
if (option?.always || meta.isExpanding || option?.disabled?.(row.data))
|
|
4519
5032
|
return;
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
5033
|
+
if (meta.isExpanded) {
|
|
5034
|
+
meta.isExpanded = false;
|
|
5035
|
+
this.expandRevision.update(n => n + 1);
|
|
5036
|
+
this.#ref.markForCheck();
|
|
4523
5037
|
return;
|
|
4524
5038
|
}
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
this.items().forEach(item => (item.meta.expand.isExpanding = item.meta.expand.isExpanded = false));
|
|
5039
|
+
if (!option?.multiple) {
|
|
5040
|
+
collectFormattedTreeRows(this.items()).forEach(item => (item.meta.expand.isExpanded = false));
|
|
4528
5041
|
}
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
.finally(() => (rowData.meta.expand.isExpanding = false));
|
|
5042
|
+
try {
|
|
5043
|
+
const result = option?.onExpand?.(row.data);
|
|
5044
|
+
meta.isExpanding = result instanceof Promise;
|
|
5045
|
+
this.expandRevision.update(n => n + 1);
|
|
5046
|
+
this.#ref.markForCheck();
|
|
5047
|
+
meta.data = await result;
|
|
5048
|
+
meta.isExpanded = true;
|
|
4537
5049
|
}
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
5050
|
+
catch (error) {
|
|
5051
|
+
console.error(error);
|
|
5052
|
+
this.#notifyService.warning(this.#i18n.t('core.component.table.error-occurred'));
|
|
5053
|
+
}
|
|
5054
|
+
finally {
|
|
5055
|
+
meta.isExpanding = false;
|
|
5056
|
+
this.expandRevision.update(n => n + 1);
|
|
5057
|
+
this.#ref.markForCheck();
|
|
4541
5058
|
}
|
|
4542
5059
|
};
|
|
4543
5060
|
onSelect = (rowData) => {
|
|
4544
5061
|
const opt = this.tableOption();
|
|
4545
|
-
const selectedData = () => this.#getSelectedRowData();
|
|
4546
5062
|
if (rowData.meta.group?.items?.length) {
|
|
4547
|
-
|
|
4548
|
-
opt.selector?.onSelect?.(rowData.data,
|
|
4549
|
-
|
|
4550
|
-
this.#syncSelectAllState();
|
|
5063
|
+
this.onSelectGroup(rowData, !!rowData.meta.selector?.isSelected);
|
|
5064
|
+
opt.selector?.onSelect?.(rowData.data, this.selectedItems);
|
|
5065
|
+
return;
|
|
4551
5066
|
}
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
opt.selector?.onSelect?.(rowData.data, selectedData());
|
|
4564
|
-
this.isSelectAll.set(false);
|
|
4565
|
-
this.#updateSelectedItems();
|
|
4566
|
-
return;
|
|
4567
|
-
}
|
|
4568
|
-
opt.selector?.onSelect?.(rowData.data, selectedData());
|
|
4569
|
-
this.#updateSelectedItems();
|
|
4570
|
-
this.#syncSelectAllState();
|
|
5067
|
+
if (opt.selector?.single) {
|
|
5068
|
+
this.#getSelectionRows()
|
|
5069
|
+
.filter(row => row !== rowData)
|
|
5070
|
+
.forEach(row => (row.meta.selector.isSelected = false));
|
|
5071
|
+
this.#preservedSelectedMap.clear();
|
|
5072
|
+
}
|
|
5073
|
+
if (this.#preserveEnabled()) {
|
|
5074
|
+
if (rowData.meta.selector?.isSelected)
|
|
5075
|
+
this.#preservedSelectedMap.set(rowData.meta.id, rowData);
|
|
5076
|
+
else
|
|
5077
|
+
this.#preservedSelectedMap.delete(rowData.meta.id);
|
|
4571
5078
|
}
|
|
5079
|
+
this.#updateSelectedItems();
|
|
5080
|
+
this.#syncSelectAllState();
|
|
5081
|
+
opt.selector?.onSelect?.(rowData.data, this.selectedItems);
|
|
4572
5082
|
};
|
|
4573
5083
|
onSelectAll = () => {
|
|
4574
|
-
const
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
e.meta.selector.isSelected = isSelected;
|
|
5084
|
+
const checked = this.isSelectAll();
|
|
5085
|
+
this.#getSelectionRows().forEach(row => {
|
|
5086
|
+
if (row.meta.selector?.selectable || (!checked && row.meta.selector?.isSelected)) {
|
|
5087
|
+
row.meta.selector.isSelected = checked;
|
|
4579
5088
|
}
|
|
4580
5089
|
});
|
|
4581
|
-
opt?.selector?.onSelectAll?.(this.#getSelectedRowData());
|
|
4582
5090
|
this.#updateSelectedItems();
|
|
4583
5091
|
this.#syncSelectAllState();
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
this.
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
this.#preservedSelectedMap.
|
|
4592
|
-
|
|
5092
|
+
this.tableOption()?.selector?.onSelectAll?.(this.selectedItems);
|
|
5093
|
+
};
|
|
5094
|
+
onClearSelection = (_items) => {
|
|
5095
|
+
// why: clear is global, including cached tree children and rows outside this page.
|
|
5096
|
+
const rows = [
|
|
5097
|
+
...collectFormattedTreeRows(this.items()),
|
|
5098
|
+
...collectFormattedTreeRows(this.#localItems),
|
|
5099
|
+
...this.#preservedSelectedMap.values(),
|
|
5100
|
+
];
|
|
5101
|
+
rows.forEach(row => (row.meta.selector.isSelected = false));
|
|
5102
|
+
this.#preservedSelectedMap.clear();
|
|
4593
5103
|
this.#updateSelectedItems();
|
|
5104
|
+
this.#syncSelectAllState();
|
|
4594
5105
|
};
|
|
4595
5106
|
#getSelectionRows = () => {
|
|
4596
5107
|
return getSelectionRows(this.items(), this.tableOption()?.tree);
|
|
@@ -4600,7 +5111,10 @@ class SdTable {
|
|
|
4600
5111
|
applyDefaultSelected(this.items(), this.tableOption()?.tree, this.tableOption()?.selector?.defaultSelected);
|
|
4601
5112
|
};
|
|
4602
5113
|
#syncSelectAllState = () => {
|
|
4603
|
-
this
|
|
5114
|
+
const rows = this.#getSelectionRows().filter(row => row.meta.selector?.selectable);
|
|
5115
|
+
const all = resolveSelectAllState(rows);
|
|
5116
|
+
this.isSelectAll.set(all);
|
|
5117
|
+
this.isSelectIndeterminate.set(!all && rows.some(row => row.meta.selector?.isSelected));
|
|
4604
5118
|
};
|
|
4605
5119
|
// ==========================================
|
|
4606
5120
|
// GROUP HELPERS — sync selection + expand state cho group header rows
|
|
@@ -4629,9 +5143,9 @@ class SdTable {
|
|
|
4629
5143
|
const sel = this.#groupSelectableChildren(header);
|
|
4630
5144
|
sel.forEach(c => (c.meta.selector.isSelected = checked));
|
|
4631
5145
|
const opt = this.tableOption();
|
|
4632
|
-
opt?.selector?.onSelectAll?.(this.#getSelectedRowData());
|
|
4633
5146
|
this.#updateSelectedItems();
|
|
4634
5147
|
this.#syncSelectAllState();
|
|
5148
|
+
opt?.selector?.onSelectAll?.(this.selectedItems);
|
|
4635
5149
|
};
|
|
4636
5150
|
// Map<groupKey, isExpanded> — table own state, pass vào SdGroupPipe arg 3.
|
|
4637
5151
|
// why: pipe stateless, persist toggle qua các lần re-eval bằng Map external. Mutate Map
|
|
@@ -4753,8 +5267,6 @@ class SdTable {
|
|
|
4753
5267
|
};
|
|
4754
5268
|
#updateSelectedItems = () => {
|
|
4755
5269
|
const rows = this.#getSelectionRows();
|
|
4756
|
-
// Selection vừa đổi → cập nhật checkbox state cache của mọi group header.
|
|
4757
|
-
this.#syncGroupSelectionState();
|
|
4758
5270
|
if (this.#preserveEnabled()) {
|
|
4759
5271
|
// Sync map theo state visible: add nếu selected, remove nếu deselected.
|
|
4760
5272
|
// Off-page items giữ nguyên trong map (không bị visit ở đây).
|
|
@@ -4763,6 +5275,8 @@ class SdTable {
|
|
|
4763
5275
|
else {
|
|
4764
5276
|
this.selectedTableItems.set(rows.filter(item => item.meta.selector.isSelected));
|
|
4765
5277
|
}
|
|
5278
|
+
prepareTableSelection(collectFormattedTreeRows(this.items()), this.selectedTableItems(), this.tableOption()?.selector);
|
|
5279
|
+
this.#syncGroupSelectionState();
|
|
4766
5280
|
this.#ref.detectChanges();
|
|
4767
5281
|
};
|
|
4768
5282
|
clearFilter = () => {
|
|
@@ -4785,7 +5299,11 @@ class SdTable {
|
|
|
4785
5299
|
get selectedItems() {
|
|
4786
5300
|
return this.selectedTableItems().map(item => item.data);
|
|
4787
5301
|
}
|
|
4788
|
-
detectChanges = () =>
|
|
5302
|
+
detectChanges = () => {
|
|
5303
|
+
this.dataRevision.update(value => value + 1);
|
|
5304
|
+
this.#updateSelectedItems();
|
|
5305
|
+
this.#syncSelectAllState();
|
|
5306
|
+
};
|
|
4789
5307
|
onColumnResize = (field, width) => {
|
|
4790
5308
|
// persistColumnWidth ghi storage (silent) và emit widthChange$,
|
|
4791
5309
|
// subscriber trong constructor đã update configuration() signal đồng bộ.
|
|
@@ -4795,6 +5313,16 @@ class SdTable {
|
|
|
4795
5313
|
return;
|
|
4796
5314
|
onResize(field, width, buildColumnWidthMap(this.configuration()?.column));
|
|
4797
5315
|
};
|
|
5316
|
+
getSortAria = (field) => {
|
|
5317
|
+
const sort = this.sort();
|
|
5318
|
+
if (sort?.active !== field)
|
|
5319
|
+
return 'none';
|
|
5320
|
+
if (sort.direction === 'asc')
|
|
5321
|
+
return 'ascending';
|
|
5322
|
+
if (sort.direction === 'desc')
|
|
5323
|
+
return 'descending';
|
|
5324
|
+
return 'none';
|
|
5325
|
+
};
|
|
4798
5326
|
onOperatorChange = (column, operator) => {
|
|
4799
5327
|
if (operator == null)
|
|
4800
5328
|
return;
|
|
@@ -4806,6 +5334,7 @@ class SdTable {
|
|
|
4806
5334
|
// Offset STT theo paging — computed memoize, không tính lại trừ khi paginator đổi.
|
|
4807
5335
|
// Template chỉ cần đọc pageOffset() rồi cộng `i + 1` (rẻ hơn gọi function).
|
|
4808
5336
|
pageOffset = computed(() => {
|
|
5337
|
+
this.pageRevision();
|
|
4809
5338
|
const p = this.paginator();
|
|
4810
5339
|
return (p?.pageIndex ?? 0) * (p?.pageSize ?? 0);
|
|
4811
5340
|
});
|
|
@@ -4843,7 +5372,7 @@ class SdTable {
|
|
|
4843
5372
|
this.tableOption()?.rowReorder?.onChange?.(result.items.map(i => i.data), event.item.data.data, result.fromIndex, result.toIndex);
|
|
4844
5373
|
}
|
|
4845
5374
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4846
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdTable, isStandalone: true, selector: "sd-table", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "attr.data-autoid": "autoId()", "attr.data-loading": "loading() ? \"true\" : \"false\"" } }, providers: [
|
|
5375
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdTable, isStandalone: true, selector: "sd-table", inputs: { autoIdInput: { classPropertyName: "autoIdInput", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null }, option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "tabindex": "0" }, properties: { "attr.data-autoid": "autoId()", "attr.data-loading": "loading() ? \"true\" : \"false\"" } }, providers: [
|
|
4847
5376
|
DatePipe,
|
|
4848
5377
|
DecimalPipe,
|
|
4849
5378
|
CdkColumnDef,
|
|
@@ -4855,7 +5384,7 @@ class SdTable {
|
|
|
4855
5384
|
provide: MatPaginatorIntl,
|
|
4856
5385
|
useClass: SdTablePaginatorIntl,
|
|
4857
5386
|
},
|
|
4858
|
-
], queries: [{ propertyName: "sdSubInformation", first: true, predicate: SdTableExpandDefDirective, descendants: true, isSignal: true }, { propertyName: "sdGroupDef", first: true, predicate: SdTableGroupDefDirective, descendants: true, isSignal: true }, { propertyName: "sdCellDefs", predicate: SdTableCellDefDirective, isSignal: true }, { propertyName: "sdCommandHeaderDef", first: true, predicate: SdTableCommandHeaderDefDirective, descendants: true, isSignal: true }, { propertyName: "sdFooterDefs", predicate: SdMaterialFooterDefDirective, isSignal: true }, { propertyName: "sdFilterDefs", predicate: SdTableFilterDefDirective, isSignal: true }, { propertyName: "sdTitleDefs", predicate: SdTableTitleDefDirective, isSignal: true }], viewQueries: [{ propertyName: "table", first: true, predicate: MatTable, descendants: true, isSignal: true }, { propertyName: "configComponent", first: true, predicate: ConfigComponent, descendants: true, isSignal: true }, { propertyName: "sdPopupExport", first: true, predicate: SdPopupExport, descendants: true, isSignal: true }, { propertyName: "scroll", first: true, predicate: SdScrollDirective, descendants: true, isSignal: true }, { propertyName: "quickAction", first: true, predicate: SdQuickAction, descendants: true, isSignal: true }, { propertyName: "externalFilter", first: true, predicate: ExternalFilterComponent, descendants: true, isSignal: true }, { propertyName: "mobileFilter", first: true, predicate: MobileFilterComponent, descendants: true, isSignal: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, isSignal: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true, isSignal: true }], ngImport: i0, template: "@let _configuration = configuration();\n@let _tableOption = tableOption()!;\n@let _loading = loading();\n@let _items = items();\n@let _total = total();\n@let _isFiltered = isFiltered();\n@let _requireFiltered = requireFiltered();\n@let _export = _tableOption?.export;\n@let _exporting = exporting();\n@let _titleDef = titleDef();\n@let _autoId = autoId();\n@let _exportTitle = exportTitle();\n@let _cellDef = cellDef();\n@let _footerDef = footerDef();\n@let _sdSubInformation = sdSubInformation();\n@let _configComponent = configComponent();\n@let _mobileFilter = mobileFilter();\n@let _selectedTableItems = selectedTableItems();\n@let _rowCommands = rowCommands();\n<!-- why: tree kh\u00F4ng c\u00F2n c\u1ED9t ri\u00EAng \u2014 khi KH\u00D4NG c\u00F3 c\u1ED9t Index, icon expand nh\u00FAng v\u00E0o\n c\u1ED9t data \u0111\u1EA7u ti\u00EAn. \u0110\u00E2y l\u00E0 field c\u1EE7a c\u1ED9t \u0111\u00F3 (null n\u1EBFu c\u00F3 Index ho\u1EB7c kh\u00F4ng tree). -->\n@let _treeFirstField = _tableOption?.tree && !_tableOption.index?.enabled ? _configuration?.firstColumns?.[0]?.field : null;\n\n@if (_configuration) {\n @if (!_tableOption.filter?.disabled && !!_tableOption.filter?.externalFilters?.length && filterRegister) {\n <external-filter\n class=\"mb-16\"\n [autoId]=\"_autoId\"\n [filterRegister]=\"filterRegister\"\n [filter]=\"_tableOption.filter!\"\n [externalFilters]=\"_tableOption.filter?.externalFilters!\">\n </external-filter>\n }\n @let groupedItems = _items | sdTree: _tableOption.tree : treeRevision() | sdGroup: _tableOption : groupExpandState : groupHost;\n\n <!-- Tree toggle d\u00F9ng chung: indent (theo c\u1EA5p) + slot chevron/spinner. Nh\u00FAng v\u00E0o\n c\u1ED9t Index ho\u1EB7c c\u1ED9t data \u0111\u1EA7u qua *ngTemplateOutlet (context: { row }). -->\n <ng-template #sdTreeToggle let-row=\"row\">\n @let _tree = row?.meta?.tree;\n @if (_tree) {\n <span class=\"sd-tree-indent\" [style.width.px]=\"(_tree.level ?? 0) * (_tableOption.tree?.indentSize ?? 20)\"></span>\n <span class=\"sd-tree-toggle-slot\">\n @if (_tree.hasChildren) {\n @if (_tree.isExpanding) {\n <span class=\"lds-ring sd-tree-spinner\">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </span>\n } @else {\n @let _aid = _autoId;\n <button\n type=\"button\"\n class=\"sd-tree-toggle-btn\"\n [attr.data-autoid]=\"_aid ? _aid + '-tree-toggle-' + row.meta.id : null\"\n (click)=\"onTreeToggle(row); $event.stopPropagation()\">\n <sd-icon [name]=\"_tree.isExpanded ? 'expand_more' : 'chevron_right'\"></sd-icon>\n </button>\n }\n }\n </span>\n }\n </ng-template>\n\n <ng-content select=\"[sdTableTop]\"></ng-content>\n <div class=\"c-container\">\n <!-- why: b\u1EA3ng t\u1EA3i d\u1EEF li\u1EC7u B\u1EA4T \u0110\u1ED2NG B\u1ED8 nh\u01B0ng tr\u01B0\u1EDBc \u0111\u00E2y ch\u1EC9 c\u00F3 spinner thu\u1EA7n h\u00ECnh \u1EA3nh \u2014 screen\n reader kh\u00F4ng \u0111\u01B0\u1EE3c b\u00E1o g\u00EC c\u1EA3. role=\"status\" + aria-live=\"polite\" \u0111\u1ECDc tr\u1EA1ng th\u00E1i ngay khi\n spinner xu\u1EA5t hi\u1EC7n; aria-busy tr\u00EAn v\u00F9ng b\u1EA3ng cho bi\u1EBFt n\u1ED9i dung \u0111ang \u0111\u01B0\u1EE3c thay th\u1EBF. -->\n @if (_loading) {\n <div class=\"c-loading\" role=\"status\" aria-live=\"polite\" [attr.aria-label]=\"'core.component.table.loading' | sdTranslate\">\n <mat-spinner></mat-spinner>\n </div>\n }\n <div\n class=\"c-table\"\n sdScroll\n stickyShadow\n [attr.aria-busy]=\"_loading ? 'true' : null\"\n [style.max-height]=\"_tableOption.style?.maxHeight\"\n [style.min-height]=\"_tableOption.style?.minHeight\">\n <table\n mat-table\n [dataSource]=\"groupedItems\"\n [trackBy]=\"trackBy\"\n matSort\n [matSortDisabled]=\"!_tableOption.sort?.enable\"\n multiTemplateDataRows\n cdkDropList\n [cdkDropListData]=\"groupedItems\"\n [cdkDropListDisabled]=\"!_tableOption.rowReorder?.enabled\"\n [cdkDropListSortPredicate]=\"reorderSortPredicate\"\n (cdkDropListDropped)=\"onReorderDrop($event)\">\n @if (_tableOption.rowReorder?.enabled) {\n <ng-container matColumnDef=\"sdReorder\">\n <th mat-header-cell *matHeaderCellDef class=\"sd-reorder-header\" [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\"></th>\n <td mat-cell *matCellDef=\"let row\" class=\"sd-reorder-cell\">\n @if (!row.meta?.group?.items?.length) {\n <sd-icon cdkDragHandle [class.sd-reorder-disabled]=\"isReorderDisabled(row)\" [name]=\"_tableOption.rowReorder?.icon || 'drag_indicator'\"></sd-icon>\n }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n }\n\n <ng-container matColumnDef=\"sdSubInformation\" sticky>\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\" [attr.colspan]=\"_configuration.displayedColumns.length\">\n @if (_sdSubInformation?.templateRef) {\n @if (_tableOption.expand?.always) {\n <ng-container *ngTemplateOutlet=\"_sdSubInformation?.templateRef!; context: { item: item }\"> </ng-container>\n } @else {\n <div [@detailExpand]=\"item.isExpanded ? 'expanded' : 'collapsed'\">\n @if (item.isExpanded) {\n <ng-container *ngTemplateOutlet=\"_sdSubInformation?.templateRef!; context: { item: item }\"> </ng-container>\n }\n </div>\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n\n <ng-container matColumnDef=\"sdSubInformationAction\" stickyEnd>\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\" [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\"></th>\n <td mat-cell *matCellDef=\"let element\">\n @if (!element.isExpanding && !_tableOption.expand?.always) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-expand-' + element.meta.id : null\"\n type=\"text\"\n [prefixIcon]=\"element.isExpanded ? 'expand_less' : 'expand_more'\"\n (click)=\"onExpand(element)\"\n width=\"35px\">\n </sd-button>\n }\n @if (element.isExpanding) {\n <div class=\"lds-ring\">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n }\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"sdSelection\" sticky>\n <th class=\"sd-selection-cell p-0\" mat-header-cell *matHeaderCellDef [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\">\n @if (visibleSelectAll()) {\n <mat-checkbox\n class=\"c-selection px-8\"\n color=\"primary\"\n [ngModel]=\"isSelectAll()\"\n (ngModelChange)=\"isSelectAll.set($event)\"\n (change)=\"onSelectAll()\">\n </mat-checkbox>\n }\n </th>\n\n <td class=\"sd-selection-cell p-0\" mat-cell *matCellDef=\"let item\">\n @let visible = item | selectionVisible: _tableOption.selector;\n @if (visible) {\n @if (_tableOption.selector?.single) {\n <mat-radio-button\n class=\"c-selection px-8\"\n color=\"primary\"\n [checked]=\"item.meta.selector.isSelected\"\n (change)=\"item.meta.selector.isSelected = true; onSelect(item)\"\n [disabled]=\"_selectedTableItems | selectionDisabled: item : _tableOption.selector!\">\n </mat-radio-button>\n } @else {\n <mat-checkbox\n class=\"c-selection px-8\"\n color=\"primary\"\n [(ngModel)]=\"item.meta.selector.isSelected\"\n (change)=\"onSelect(item)\"\n [disabled]=\"_selectedTableItems | selectionDisabled: item : _tableOption.selector!\">\n </mat-checkbox>\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n @if (_tableOption.index?.enabled) {\n @let _pageOffset = pageOffset();\n @let _indexWidth = _tableOption.index?.width || '50px';\n <!-- why: khi tree, c\u1ED9t Index \"\u00F4m\" th\u00EAm chevron + indent. D\u00F9ng width:1px +\n nowrap (.sd-tree-index-cell) \u0111\u1EC3 c\u1ED9t co S\u00C1T n\u1ED9i dung, kh\u00F4ng chi\u1EBFm ch\u1ED7\n th\u1EEBa; header \"#\" canh tr\u00E1i l\u00F9i v\u00E0o (.sd-tree-index-header) cho th\u1EB3ng s\u1ED1. -->\n @let _treeIndex = !!_tableOption.tree;\n <ng-container matColumnDef=\"sdIndex\" sticky>\n <th\n [class.p-0]=\"!_treeIndex\"\n [class.text-center]=\"!_treeIndex\"\n [class.sd-tree-index-cell]=\"_treeIndex\"\n [class.sd-tree-index-header]=\"_treeIndex\"\n mat-header-cell\n *matHeaderCellDef\n [style.width]=\"_treeIndex ? '1px' : _indexWidth\"\n [style.min-width]=\"_treeIndex ? null : _indexWidth\"\n [style.max-width]=\"_treeIndex ? null : _indexWidth\"\n [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\">\n {{ _tableOption.index?.title || '#' }}\n </th>\n <td\n [class.px-4]=\"!_treeIndex\"\n [class.text-center]=\"!_treeIndex\"\n [class.sd-tree-index-cell]=\"_treeIndex\"\n mat-cell\n *matCellDef=\"let item; let i = dataIndex\"\n [style.width]=\"_treeIndex ? '1px' : null\"\n [style.min-width]=\"_treeIndex ? null : _indexWidth\"\n [style.max-width]=\"_treeIndex ? null : _indexWidth\">\n @if (!item?.meta?.group?.isGroupHeader) {\n @if (_treeIndex) {\n <!-- why: tree \u2192 chevron + indent + STT ph\u00E2n c\u1EA5p (1, 1.2, 1.2.1). T\u00F4 \u0111\u1EADm root (level 0). -->\n <span class=\"sd-tree-line\">\n <ng-container *ngTemplateOutlet=\"sdTreeToggle; context: { row: item }\"></ng-container>\n @if (item?.meta?.tree?.indexPath?.length) {\n <span class=\"sd-tree-stt\" [class.sd-stt-root]=\"(item.meta.tree.level ?? 0) === 0\">\n {{ item.meta.tree.indexPath.join('.') }}\n </span>\n }\n </span>\n } @else {\n {{ _pageOffset + i + 1 }}\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef [style.width]=\"_treeIndex ? '1px' : null\" [style.min-width]=\"_treeIndex ? null : _indexWidth\" [style.max-width]=\"_treeIndex ? null : _indexWidth\"></td>\n </ng-container>\n }\n <ng-container\n matColumnDef=\"sdCommand\"\n [sticky]=\"_tableOption.command?.align !== 'right'\"\n [stickyEnd]=\"_tableOption.command?.align === 'right'\">\n <!-- why: \u00F4 header c\u1EE7a c\u1ED9t command v\u1ED1n \u0111\u1EC3 tr\u1ED1ng. Cho consumer chi\u1EBFm ch\u1ED7 \u0111\u00F3 b\u1EB1ng\n `sdTableCommandHeaderDef` (th\u01B0\u1EDDng l\u00E0 n\u00FAt th\u00EAm d\u00F2ng) th\u00EC h\u00E0nh \u0111\u1ED9ng c\u1EA5p b\u1EA3ng n\u1EB1m ngay\n tr\u00EAn c\u1EE5m n\u00FAt c\u1EE7a t\u1EEBng d\u00F2ng, thay v\u00EC ph\u1EA3i d\u1EF1ng th\u00EAm m\u1ED9t d\u1EA3i ri\u00EAng d\u01B0\u1EDBi b\u1EA3ng. -->\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 50px\" [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\">\n @if (sdCommandHeaderDef(); as _commandHeaderDef) {\n <div class=\"sd-command-header d-flex align-items-center justify-content-center\">\n <ng-container *ngTemplateOutlet=\"_commandHeaderDef.templateRef\"></ng-container>\n </div>\n }\n </th>\n <!-- why: `dataIndex` do CDK c\u1EA5p s\u1EB5n. B\u1EA3n c\u0169 d\u00F9ng `groupedItems.indexOf(item)` \u2014\n qu\u00E9t to\u00E0n m\u1EA3ng cho M\u1ED6I d\u00F2ng render \u1EDF M\u1ED6I CD pass (O(n\u00B2) tr\u00EAn \u0111\u01B0\u1EDDng render),\n v\u00E0 c\u00F2n tr\u1EA3 sai index khi 2 d\u00F2ng tr\u00F9ng reference. -->\n <td class=\"px-8\" mat-cell *matCellDef=\"let item; let i = dataIndex\">\n <desktop-command [autoId]=\"_autoId\" [commands]=\"_rowCommands\" [item]=\"item\" [itemIndex]=\"i\"></desktop-command>\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n <!-- why: group header row d\u00F9ng matRowDef RI\u00CANG v\u1EDBi column list ['sdGroupHeader']\n qua predicate when:isGroupHeaderRow. Cell colspan = displayedColumns.length \u0111\u1EC3\n span TO\u00C0N B\u1ED8 width data row. Tr\u00E1nh colspan trick overflow row khi c\u00E1c TD kh\u00E1c render. -->\n <ng-container matColumnDef=\"sdGroupHeader\">\n <td\n class=\"p-0 sd-group-header-cell\"\n mat-cell\n *matCellDef=\"let item\"\n [attr.colspan]=\"sdGroupColspan()\">\n <div class=\"sd-group-row d-flex align-items-center py-8\">\n <!-- why: slot 42px kh\u1EDBp width v\u1EDBi sd-selection-cell data row \u2192 checkbox group c\u0103n TR\u1EE4C d\u1ECDc \u0111\u00FAng v\u1EDBi checkbox data. -->\n @if (_tableOption.selector?.visible && !_tableOption.selector?.single) {\n <div class=\"sd-group-selection-slot d-flex align-items-center justify-content-center\">\n <!-- why: PH\u1EA2I t\u00EDnh live, KH\u00D4NG \u0111\u1ECDc cache tr\u00EAn meta.group. `selector.selectable`\n m\u1EB7c \u0111\u1ECBnh l\u00E0 `false` (table-item.model.ts) v\u00E0 ch\u1EC9 \u0111\u01B0\u1EE3c `SdSelectionVisiblePipe`\n \u0111\u1EB7t \u0111\u00FAng khi cell BODY render \u2014 m\u00E0 CDK d\u1EF1ng header TR\u01AF\u1EDAC body. Cache do\n `SdGroupPipe` ghi l\u00FAc d\u1EF1ng header v\u00EC th\u1EBF lu\u00F4n th\u1EA5y `total = 0` v\u00E0 kho\u00E1 c\u1EE9ng\n checkbox \u1EDF tr\u1EA1ng th\u00E1i b\u1ECF ch\u1ECDn, k\u1EC3 c\u1EA3 khi defaultSelected/preserveSelection\n v\u1EEBa ch\u1ECDn h\u1EBFt. Pipe l\u00E0 pure n\u00EAn gi\u00E1 tr\u1ECB \u0111\u00F3 kh\u00F4ng bao gi\u1EDD t\u1EF1 s\u1EEDa.\n Ch\u1EC9 c\u00F3 M\u1ED8T group header m\u1ED7i group (kh\u00F4ng ph\u1EA3i m\u1ED7i row) n\u00EAn chi ph\u00ED duy\u1EC7t \u1EDF\n \u0111\u00E2y nh\u1ECF; ph\u1EA7n \u0111\u1EAFt (d\u1EF1ng object context + map data) v\u1EABn \u0111\u01B0\u1EE3c cache. -->\n <mat-checkbox\n class=\"c-selection\"\n color=\"primary\"\n [checked]=\"isGroupAllSelected(item)\"\n [indeterminate]=\"isGroupIndeterminate(item)\"\n (change)=\"onSelectGroup(item, $event.checked)\">\n </mat-checkbox>\n </div>\n } @else {\n <div class=\"sd-group-selection-slot\"></div>\n }\n @if (_tableOption.group?.collapsible) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-group-toggle-' + (item.meta.group?.key || item.meta.id) : null\"\n type=\"text\"\n [prefixIcon]=\"item.meta.group.isExpanded ? 'expand_more' : 'chevron_right'\"\n width=\"32px\"\n (click)=\"toggleGroupExpand(item)\">\n </sd-button>\n }\n @if (sdGroupDef()?.templateRef; as tpl) {\n <!-- why: groupContext() gi\u1EDD tr\u1EA3 context \u0111\u00E3 precompute tr\u00EAn meta.group (c\u00F9ng\n m\u1ED9t reference qua m\u1ECDi CD pass). B\u1EA3n c\u0169 d\u1EF1ng object m\u1EDBi + m\u1EA3ng\n `items.map(i => i.data)` m\u1EDBi m\u1ED7i pass \u2192 ngTemplateOutlet ph\u1EA3i d\u1EF1ng l\u1EA1i\n embedded view c\u1EE7a m\u1ECDi group row. -->\n <ng-container *ngTemplateOutlet=\"tpl; context: groupContext(item)\"></ng-container>\n } @else {\n <span class=\"T14R\">{{ item.meta.group.values | json }}</span>\n }\n </div>\n </td>\n </ng-container>\n <!-- why: filler column \u1EDF cu\u1ED1i h\u1EA5p th\u1EE5 leftover space khi t\u1ED5ng width c\u00E1c c\u1ED9t data < container \u2014 gi\u1EEF cho selection/STT/command kh\u00F4ng b\u1ECB d\u00E3n. -->\n <ng-container matColumnDef=\"sdFiller\">\n <th class=\"sd-filler-cell p-0\" mat-header-cell *matHeaderCellDef [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\"></th>\n <td class=\"sd-filler-cell p-0\" mat-cell *matCellDef=\"let item\"></td>\n <td class=\"sd-filler-cell p-0\" mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n @for (column of _configuration.firstColumns; track column.field) {\n <ng-container [matColumnDef]=\"column.field\" [sticky]=\"_configuration.fixedColumn[column.field]\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"px-8 py-8 c-th\"\n [sdColumnResize]=\"!!_tableOption.config?.resizable && column.type !== 'children'\"\n [minWidth]=\"column.minWidth\"\n [maxWidth]=\"column.maxWidth\"\n (resizeEnd)=\"onColumnResize(column.field, $event)\"\n [style.width]=\"column.width\"\n [style.min-width]=\"column.minWidth || column.width\"\n [style.max-width]=\"column.maxWidth\"\n [attr.rowspan]=\"_configuration.multipleHeader && column.type !== 'children' ? 2 : 1\"\n [attr.colspan]=\"column.type === 'children' ? column.children.length : 1\">\n <div>\n <!-- why: b\u1ECF aria-hidden=\"true\" kh\u1ECFi header. `mat-sort-header` t\u1EF1 g\u1EAFn role=\"button\",\n tabindex v\u00E0 aria-sort l\u00EAn ch\u00EDnh div n\u00E0y \u2014 aria-hidden khi\u1EBFn header v\u1EABn tab t\u1EDBi\n \u0111\u01B0\u1EE3c nh\u01B0ng kh\u00F4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c t\u00EAn c\u1ED9t l\u1EABn h\u01B0\u1EDBng s\u1EAFp x\u1EBFp, t\u1EE9c ng\u01B0\u1EDDi d\u00F9ng screen\n reader m\u1EA5t ho\u00E0n to\u00E0n kh\u1EA3 n\u0103ng s\u1EAFp x\u1EBFp b\u1EA3ng. -->\n @if (column.type === 'children') {\n <div\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n } @else {\n <div\n mat-sort-header\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\"\n [disabled]=\"!column.sortable\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n @let hideInlineFilter =\n _tableOption.filter?.disabled ||\n _tableOption.filter?.hideInlineFilter === true ||\n (_tableOption.filter?.hideInlineFilter === 'auto' && !_isFiltered && _total! <= 10);\n @if (!hideInlineFilter) {\n <ng-container *sdDesktop>\n <column-filter\n [autoId]=\"_autoId\"\n [value]=\"columnFilter?.[column.field!]!\"\n [operator]=\"columnOperator[column.field]\"\n (operatorChange)=\"columnOperator[column.field] = $event!; onOperatorChange(column, $event)\"\n [columnFilter]=\"columnFilter!\"\n [cacheValues]=\"cacheValues\"\n [column]=\"column\"\n (filterChange)=\"onFilterChange()\"\n (filterCommit)=\"onFilterCommit()\">\n </column-filter>\n </ng-container>\n }\n }\n </div>\n </th>\n <td\n class=\"c-td px-0\"\n [class.d-none]=\"column.type === 'children'\"\n mat-cell\n *matCellDef=\"let item\"\n [sdHoverCopy]=\"(item.data && item.data[column.field]) || ''\"\n [sdHoverCopyDisabled]=\"!column.cell?.copiable\">\n @if (column.type !== 'children' && !item?.meta?.group?.isGroupHeader) {\n @if (_treeFirstField && column.field === _treeFirstField) {\n <!-- why: kh\u00F4ng c\u00F3 c\u1ED9t Index \u2192 chevron + indent nh\u00FAng v\u00E0o c\u1ED9t data \u0111\u1EA7u (nh\u01B0 file explorer). -->\n <span class=\"sd-tree-line px-8\">\n <ng-container *ngTemplateOutlet=\"sdTreeToggle; context: { row: item }\"></ng-container>\n <desktop-cell class=\"d-block\" [column]=\"column\" [item]=\"item\" [cellDef]=\"_cellDef\"></desktop-cell>\n </span>\n } @else {\n <desktop-cell class=\"d-block px-8\" [column]=\"column\" [item]=\"item\" [cellDef]=\"_cellDef\"> </desktop-cell>\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef>\n <ng-container *ngIf=\"_footerDef[column.field]\">\n <ng-container *ngTemplateOutlet=\"_footerDef[column.field].templateRef; context: { items: _items, column: column }\">\n </ng-container>\n </ng-container>\n </td>\n </ng-container>\n }\n @for (column of _configuration.secondColumns; track column.field) {\n <ng-container [matColumnDef]=\"column.field\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"c-th px-8\"\n [style.width]=\"column.width\"\n [style.min-width]=\"column.minWidth || column.width\"\n [style.max-width]=\"column.maxWidth\">\n <div>\n <!-- why: xem ch\u00FA th\u00EDch \u1EDF header nh\u00F3m tr\u00EAn \u2014 mat-sort-header l\u00E0 control th\u1EADt,\n aria-hidden xo\u00E1 t\u00EAn c\u1ED9t + aria-sort kh\u1ECFi accessibility tree. -->\n <div\n mat-sort-header\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\"\n [disabled]=\"!column.sortable\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n @if (!_tableOption.filter?.disabled && !_tableOption.filter?.hideInlineFilter && columnOperator) {\n <ng-container *sdDesktop>\n <column-filter\n [autoId]=\"_autoId\"\n [value]=\"columnFilter?.[column.field!]!\"\n [operator]=\"columnOperator[column.field]\"\n [columnFilter]=\"columnFilter!\"\n [cacheValues]=\"cacheValues\"\n [column]=\"column\"\n (operatorChange)=\"columnOperator[column.field] = $event!; onOperatorChange(column, $event)\"\n (filterChange)=\"onFilterChange()\"\n (filterCommit)=\"onFilterCommit()\">\n </column-filter>\n </ng-container>\n }\n </div>\n </th>\n <td\n class=\"c-td px-0\"\n mat-cell\n *matCellDef=\"let item\"\n [sdHoverCopy]=\"item[column.field]\"\n [sdHoverCopyDisabled]=\"!column.cell?.copiable\">\n @if (column.type !== 'children') {\n <desktop-cell class=\"d-block px-8\" [column]=\"column\" [item]=\"item\" [cellDef]=\"_cellDef\"> </desktop-cell>\n }\n </td>\n <td mat-footer-cell *matFooterCellDef>\n <ng-container *ngIf=\"_footerDef[column.field]\">\n <ng-container *ngTemplateOutlet=\"_footerDef[column.field].templateRef; context: { items: _items, column: column }\">\n </ng-container>\n </ng-container>\n </td>\n </ng-container>\n }\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"_configuration.firstHeaders; sticky: true\"></tr>\n @if (!!_configuration.secondHeaders.length) {\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"_configuration.secondHeaders; sticky: true\"></tr>\n }\n <!-- Group header row \u2014 ch\u1EC9 1 cell sdGroupHeader colspan to\u00E0n width. -->\n <tr\n mat-row\n *matRowDef=\"let row; columns: ['sdGroupHeader']; when: isGroupHeaderRow\"\n class=\"c-group-row-tr\"></tr>\n\n <!-- Data row \u2014 d\u00F9ng displayedColumns \u0111\u1EA7y \u0111\u1EE7; when isDataRow \u0111\u1EC3 lo\u1EA1i tr\u1EEB group header. -->\n <!-- why: [ngStyle] \u0111\u1ECDc meta.rowStyle \u2014 style.rowCss \u0111\u00E3 \u0111\u01B0\u1EE3c resolve 1 l\u1EA7n m\u1ED7i l\u1EA7n\n render. B\u1EA3n c\u0169 g\u1ECDi rowStyle(row) ngay trong binding \u2192 ch\u1EA1y callback c\u1EE7a consumer\n cho T\u1EEANG d\u00F2ng \u1EDF M\u1ED6I CD pass, v\u00E0 v\u00EC tr\u1EA3 object M\u1EDAI n\u00EAn NgStyle ph\u1EA3i ch\u1EA1y l\u1EA1i\n KeyValueDiffer tr\u00EAn m\u1ECDi d\u00F2ng \u1EDF m\u1ECDi pass. -->\n <tr\n mat-row\n cdkDrag\n [cdkDragData]=\"row\"\n [cdkDragDisabled]=\"\n !_tableOption.rowReorder?.enabled ||\n !!row.meta?.group?.items?.length ||\n (row.meta?.tree?.level ?? 0) > 0 ||\n isReorderDisabled(row)\n \"\n *matRowDef=\"let row; columns: _configuration.displayedColumns; when: isDataRow\"\n matRipple\n class=\"c-row\"\n [class.sd-tree-row]=\"!!_tableOption.tree\"\n [ngClass]=\"_tableOption.tree ? 'sd-tree-level-' + (row.meta?.tree?.level ?? 0) : null\"\n [ngStyle]=\"row.meta.rowStyle\"\n [class.selected]=\"row.meta.selector.isSelected\"></tr>\n\n <!-- Sub-information row \u2014 also gated b\u1EDFi isDataRow \u0111\u1EC3 KH\u00D4NG render empty expand row d\u01B0\u1EDBi group header. -->\n <tr mat-row *matRowDef=\"let row; columns: ['sdSubInformation']; when: isDataRow\" class=\"c-detail-row\"></tr>\n @if (hasFooter() && !!_configuration.displayedFooters.length) {\n <tr mat-footer-row *matFooterRowDef=\"_configuration.displayedFooters; sticky: true\"></tr>\n }\n </table>\n <!-- why: tr\u1EA1ng th\u00E1i r\u1ED7ng c\u0169ng xu\u1EA5t hi\u1EC7n B\u1EA4T \u0110\u1ED2NG B\u1ED8 sau khi fetch xong; kh\u00F4ng c\u00F3 live region\n th\u00EC ng\u01B0\u1EDDi d\u00F9ng screen reader ch\u1EDD m\u00E3i m\u00E0 kh\u00F4ng bi\u1EBFt b\u1EA3ng \u0111\u00E3 tr\u1EA3 v\u1EC1 0 d\u00F2ng. -->\n @if (!_loading && !_total) {\n <div class=\"c-no-data-row\" role=\"status\" aria-live=\"polite\">\n @if (_isFiltered) {\n @if (tableConfiguration?.images?.filterEmpty) {\n <img class=\"c-image\" [src]=\"tableConfiguration!.images!.filterEmpty\" alt=\"filter-empty\" />\n } @else {\n <img class=\"c-image sd-image-filter-empty\" alt=\"filter-empty\" />\n }\n <div class=\"T16M\">{{ 'core.component.table.no-results' | sdTranslate }}</div>\n <div class=\"T16R text-secondary\">{{ 'core.component.table.no-results-hint' | sdTranslate }}</div>\n } @else {\n @if (_requireFiltered) {\n @if (tableConfiguration?.images?.filterRequired) {\n <img class=\"c-image\" [src]=\"tableConfiguration!.images!.filterRequired\" alt=\"filter-required\" />\n } @else {\n <img class=\"c-image sd-image-filter-required\" alt=\"filter-required\" />\n }\n <div class=\"T16R text-secondary\">{{ 'core.component.table.choose-filter-hint' | sdTranslate }}</div>\n } @else {\n @if (tableConfiguration?.images?.dataEmpty) {\n <img class=\"c-image\" [src]=\"tableConfiguration!.images!.dataEmpty\" alt=\"data-empty\" />\n } @else {\n <img class=\"c-image sd-image-data-empty\" alt=\"data-empty\" />\n }\n <div class=\"T16R text-secondary\">{{ 'core.component.table.no-data' | sdTranslate }}</div>\n }\n }\n </div>\n }\n </div>\n <div class=\"c-paginator\">\n <div class=\"c-action\">\n <ng-container *sdDesktop>\n @if (_tableOption.reload?.visible) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-reload' : null\"\n class=\"mr-8\"\n [title]=\"'core.component.table.reload' | sdTranslate\"\n prefixIcon=\"refresh\"\n (click)=\"reload()\"\n type=\"text\">\n </sd-button>\n }\n </ng-container>\n @if (_export && _items.length) {\n @if (_export.type === 'custom') {\n <sd-button [autoId]=\"_autoId ? _autoId + '-export' : null\" class=\"mr-8\" [title]=\"_exportTitle\" prefixIcon=\"get_app\" (click)=\"exportCustom()\" type=\"text\"> </sd-button>\n } @else {\n @if (_export.visible) {\n @if (_exporting) {\n <sd-button [autoId]=\"_autoId ? _autoId + '-export' : null\" class=\"mr-8\" [loading]=\"_exporting\" [title]=\"_exportTitle\" prefixIcon=\"get_app\" type=\"text\"> </sd-button>\n } @else {\n @if (_export.visible === 'ALL' || !_export.visible) {\n <sd-button [autoId]=\"_autoId ? _autoId + '-export' : null\" class=\"mr-8\" [title]=\"_exportTitle\" prefixIcon=\"get_app\" [matMenuTriggerFor]=\"menu\" type=\"text\"> </sd-button>\n <mat-menu #menu=\"matMenu\">\n <button mat-menu-item [attr.data-autoid]=\"_autoId ? _autoId + '-export-excel' : null\" (click)=\"exportExcel()\" type=\"button\">\n <sd-icon name=\"file_download\"></sd-icon>\n <span> {{ 'core.component.table.export-excel' | sdTranslate }}</span>\n </button>\n <button mat-menu-item [attr.data-autoid]=\"_autoId ? _autoId + '-export-csv' : null\" (click)=\"exportCSV()\" type=\"button\">\n <sd-icon name=\"file_download\"></sd-icon>\n <span> {{ 'core.component.table.export-csv' | sdTranslate }}</span>\n </button>\n </mat-menu>\n } @else if (_export.visible === 'EXCEL') {\n <sd-button [autoId]=\"_autoId ? _autoId + '-export-excel' : null\" class=\"mr-8\" [title]=\"_exportTitle\" prefixIcon=\"get_app\" (click)=\"exportExcel()\" type=\"text\"> </sd-button>\n } @else if (_export.visible === 'CSV') {\n <sd-button [autoId]=\"_autoId ? _autoId + '-export-csv' : null\" class=\"mr-8\" [title]=\"_exportTitle\" prefixIcon=\"get_app\" (click)=\"exportCSV()\" type=\"text\"> </sd-button>\n }\n }\n }\n }\n }\n\n <ng-container *sdDesktop>\n @if (_configComponent) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-config' : null\"\n class=\"mr-8\"\n [title]=\"'core.component.table.setup-short' | sdTranslate\"\n prefixIcon=\"settings\"\n (click)=\"_configComponent.open()\"\n type=\"text\">\n </sd-button>\n }\n </ng-container>\n <!-- Mobile: n\u00FAt Filter m\u1EDF mobile-filter drawer (inline filter \u1EA9n tr\u00EAn mobile) -->\n <ng-container *sdMobile>\n @if (!_tableOption.filter?.disabled && _mobileFilter) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-mobile-filter-open' : null\"\n class=\"mr-8\"\n prefixIcon=\"filter_alt\"\n (click)=\"_mobileFilter.open()\"\n type=\"text\">\n </sd-button>\n }\n </ng-container>\n </div>\n @let hidePaginator = !_tableOption.paginate?.pageSize || _total === undefined || _total <= _tableOption.paginate?.pageSize!;\n <!-- Desktop paginator: full config (pageSize dropdown, first/last buttons) -->\n <ng-container *sdDesktop>\n <mat-paginator\n [class.d-none]=\"_tableOption.paginate?.hidden || hidePaginator\"\n [length]=\"_total\"\n [pageSize]=\"_tableOption.paginate?.pageSize\"\n [pageSizeOptions]=\"_tableOption.paginate?.pages!\"\n [showFirstLastButtons]=\"_tableOption.paginate?.showFirstLastButtons\"\n [hidePageSize]=\"_tableOption.paginate?.hidePageSize\"></mat-paginator>\n </ng-container>\n <!-- Mobile paginator: \u1EA9n pageSize dropdown + first/last buttons \u0111\u1EC3 ti\u1EBFt ki\u1EC7m kh\u00F4ng gian -->\n <ng-container *sdMobile>\n <mat-paginator\n [class.d-none]=\"_tableOption.paginate?.hidden || hidePaginator\"\n [length]=\"_total\"\n [pageSize]=\"_tableOption.paginate?.pageSize\"\n [showFirstLastButtons]=\"false\"\n hidePageSize></mat-paginator>\n </ng-container>\n <!-- \"\u0110ang hi\u1EC3n th\u1ECB...\" ch\u1EC9 desktop -->\n <ng-container *sdDesktop>\n @if (!_tableOption.paginate?.hidden && hidePaginator && _total !== undefined && _total > 0) {\n <div class=\"T14R c-summary\">\n {{ 'core.component.table.showing' | sdTranslate }} <span class=\"T14M ml-2\">1-{{ _total }}/{{ _total }}</span>\n </div>\n }\n </ng-container>\n </div>\n </div>\n <selector-action [autoId]=\"_autoId\" [tableOption]=\"_tableOption\" [selectedTableItems]=\"_selectedTableItems\" (clear)=\"onClearSelection(groupedItems)\" />\n @if (_tableOption.config?.visible) {\n <config [autoId]=\"_autoId\" [tableOption]=\"_tableOption\" />\n }\n <!-- Mobile filter drawer \u2014 ch\u1EC9 instantiate khi c\u1EA7n render tr\u00EAn mobile -->\n @if (!_tableOption.filter?.disabled && filterRegister) {\n <mobile-filter\n [autoId]=\"_autoId\"\n [filter]=\"_tableOption.filter!\"\n [externalFilters]=\"_tableOption.filter?.externalFilters!\"\n [columns]=\"_configuration.firstColumns\"\n [filterDefs]=\"sdFilterDefs()\"\n [filterRegister]=\"filterRegister\"\n [cacheValues]=\"cacheValues\">\n </mobile-filter>\n }\n}\n", styles: [":host{display:flex;flex-direction:column;overflow:auto;width:100%;height:100%}:host .c-header-title{height:40px;display:flex;align-items:center}:host .c-container{position:relative;min-height:50px;display:flex;flex-direction:column;flex:1}:host .c-container .c-table{position:relative;flex:1;display:flex;flex-direction:column}:host .c-container .c-table table{border-collapse:separate;width:100%}:host .c-container .c-table table tr.c-first-header.mat-mdc-header-row{height:40px}:host .c-container .c-table table tr.c-second-header.mat-mdc-header-row{height:40px}:host .c-container .c-table table tr.c-detail-row{height:0}:host .c-container .c-table table tr.c-row.activated{background-color:#e5ecff}:host .c-container .c-table table tr.c-row.selected{background-color:#eef2ff}:host .c-container .c-table table tr.c-row:not(.selected):not(.activated):hover{background-color:#f5f5f5}:host .c-container .c-table table tr.c-row td{border-bottom-width:0}:host .c-container .c-table table tr.c-row.c-expandable{cursor:pointer}:host .c-container .c-table table tr.c-row.c-expandable:hover{background:#f5f5f5}:host .c-container .c-table table th.mat-mdc-header-cell{background-color:#f2f3f4;border-bottom:0!important}:host .c-container .c-table table td.mat-mdc-cell,:host .c-container .c-table table td.mat-mdc-footer-cell,:host .c-container .c-table table th.mat-mdc-header-cell{border-bottom-color:#f2f2f2!important}:host .c-container .c-table .c-th{vertical-align:middle;font-weight:500;font-size:14px;line-height:20px;color:#212121}:host .c-container .c-table .c-th.sd-col-resize-host{position:relative}:host .c-container .c-table .c-th.sd-resizing{-webkit-user-select:none;user-select:none}:host .c-container .c-table .c-th .sd-col-resize-handle{position:absolute;top:0;right:0;width:6px;height:100%;cursor:col-resize;-webkit-user-select:none;user-select:none;z-index:2}:host .c-container .c-table .c-th .sd-col-resize-handle:hover{background:#00000014}:host .c-container .c-table .c-td:first{padding-left:10px}:host .c-container .c-table .c-no-data-row{flex:1;width:100%;position:sticky;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center}:host .c-container .c-table .c-no-data-row .c-image{margin-bottom:16px;width:96px}:host .c-container .c-loading{position:absolute;inset:0 0 56px;background:#00000026;z-index:2;display:flex;align-items:center;justify-content:center}:host .c-container .c-paginator{display:flex;flex-direction:row;justify-content:space-between;align-items:center;background-color:#fff}:host .c-container .c-paginator .mat-mdc-paginator{background:transparent;--mat-paginator-container-size: 40px;--mdc-icon-button-state-layer-size: 32px;--mdc-icon-button-icon-size: 20px}:host .c-container .c-paginator .c-action{padding:0}:host .c-container .c-paginator .c-action sd-button{margin:8px 5px}:host .c-container .c-paginator .c-summary{padding:8px 16px}:host .c-container .c-empty{text-align:center;background-color:#fff;border:none!important}:host .c-container .c-empty sd-icon{font-size:150px;margin-top:30px;margin-bottom:30px;opacity:.2;width:auto;height:auto}:host button.c-btn-add{background-color:#fff;box-shadow:0 2px 4px #2f313629}:host .lds-ring{display:inline-block;position:relative;width:40px;height:40px}:host .lds-ring div{box-sizing:border-box;display:block;position:absolute;width:32px;height:32px;margin:4px;border:4px solid #cef;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#cef transparent transparent transparent}:host .lds-ring div:nth-child(1){animation-delay:-.45s}:host .lds-ring div:nth-child(2){animation-delay:-.3s}:host .lds-ring div:nth-child(3){animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host .sd-reorder-header,:host .sd-reorder-cell{width:40px;min-width:40px;padding:0 4px;box-sizing:border-box}:host .sd-reorder-cell sd-icon{cursor:grab;color:#00000061;display:flex;align-items:center}:host .sd-reorder-cell sd-icon:active{cursor:grabbing}:host .sd-reorder-cell sd-icon.sd-reorder-disabled{opacity:.3;cursor:not-allowed;pointer-events:none}:host ::ng-deep .mat-sort-header-content{display:block;text-align:left;width:100%}:host ::ng-deep .mat-select-arrow{color:#a6a6a6}:host ::ng-deep .mat-sort-header-disabled{background-image:none!important;cursor:default!important;padding-right:0!important}:host ::ng-deep .mat-sort-header-container{align-items:start!important}:host ::ng-deep .mat-sort-header-arrow{margin-top:4px!important}:host ::ng-deep .mat-sort-header-arrow{display:none!important}:host ::ng-deep .mat-sort-header{cursor:pointer}:host ::ng-deep .mat-sort-header[aria-sort]{background-repeat:no-repeat;background-position:center right 0;background-size:16px 16px;cursor:pointer;padding-right:24px}:host ::ng-deep .mat-sort-header[aria-sort=none]{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z'/%3E%3C/svg%3E\")}:host ::ng-deep .mat-sort-header[aria-sort=ascending]{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z'/%3E%3C/svg%3E\")}:host ::ng-deep .mat-sort-header[aria-sort=descending]{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z'/%3E%3C/svg%3E\")}:host ::ng-deep .c-paginator .mat-mdc-paginator .mdc-text-field--outlined .mat-mdc-form-field-infix,:host ::ng-deep .c-paginator .mat-mdc-paginator .mdc-text-field--no-label .mat-mdc-form-field-infix{padding-top:2px;padding-bottom:2px;min-height:32px}:host ::ng-deep .c-paginator .mat-mdc-paginator-range-label{margin:0 4px}:host ::ng-deep .c-paginator .mat-mdc-paginator-page-size-select mat-select{margin-top:2px!important}:host ::ng-deep .cdk-drag-preview{box-shadow:0 4px 12px #00000026;background:#fff;display:table;width:100%}:host ::ng-deep .cdk-drag-preview td{padding:0 8px;border-bottom:1px solid rgba(0,0,0,.12)}:host ::ng-deep .cdk-drag-placeholder{opacity:0}:host ::ng-deep .cdk-drop-list-dragging tr.c-row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}:host ::ng-deep .sd-selection-cell{width:42px;min-width:42px;max-width:42px}:host ::ng-deep .sd-filler-cell{width:auto;min-width:0;padding:0!important;border:0}:host ::ng-deep .sd-group-header-cell{background:#f5f7fc;border-top:1px solid #e6e9f2;border-bottom:1px solid #e6e9f2}:host ::ng-deep .sd-group-row{min-height:36px}:host ::ng-deep .sd-group-selection-slot{width:42px;min-width:42px;max-width:42px}:host ::ng-deep .c-selection{transform:scale(.85);transform-origin:center}:host ::ng-deep .sd-tree-line{display:inline-flex;align-items:center;min-height:32px}:host ::ng-deep .sd-tree-indent{flex:0 0 auto}:host ::ng-deep .sd-tree-toggle-slot{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px}:host ::ng-deep .sd-tree-toggle-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;background:transparent;border-radius:50%;cursor:pointer;color:var(--sd-text-secondary, #5b6472);transition:background-color .15s ease}:host ::ng-deep .sd-tree-toggle-btn sd-icon{font-size:18px;width:18px;height:18px;line-height:18px}:host ::ng-deep .sd-tree-toggle-btn:hover{background-color:#0f172a14}:host ::ng-deep .sd-tree-spinner{transform:scale(.45)}:host ::ng-deep .sd-tree-stt{margin-left:2px;white-space:nowrap}:host ::ng-deep .sd-tree-index-cell{text-align:left!important;white-space:nowrap;padding-left:8px;padding-right:8px}:host ::ng-deep .sd-tree-index-header{padding-left:32px}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-0{background:#fbfcfe}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-0>td{font-weight:500}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-1{background:#fff}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-2{background:#fafbfd}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-3{background:#f6f8fb}:host ::ng-deep .sd-stt-root{font-weight:700;color:#1f2330}\n", ":host ::ng-deep .sticky-shadow-right{overflow:visible!important}:host ::ng-deep .sticky-shadow-right:after{content:\"\";position:absolute;top:0;right:0;bottom:0;width:8px;transform:translate(100%);background:linear-gradient(to right,rgba(0,0,0,.12),transparent);pointer-events:none}:host ::ng-deep .sticky-shadow-left{overflow:visible!important}:host ::ng-deep .sticky-shadow-left:after{content:\"\";position:absolute;top:0;left:0;bottom:0;width:8px;transform:translate(-100%);background:linear-gradient(to left,rgba(0,0,0,.12),transparent);pointer-events:none}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: i1.JsonPipe, name: "json" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i3.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i3.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i3.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i4$1.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i5.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i5.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5.MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: i5.MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }, { kind: "directive", type: i5.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: i5.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "component", type: i5.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i5.MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i6.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i6.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i7.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i8.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "component", type: i9.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i10.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i10.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i10.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: DesktopCommand, selector: "desktop-command", inputs: ["autoId", "item", "itemIndex", "commands"] }, { kind: "component", type: DesktopCellComponent, selector: "desktop-cell", inputs: ["column", "item", "cellDef"] }, { kind: "component", type: ColumnTitleComponent, selector: "column-title", inputs: ["column", "titleDef"] }, { kind: "component", type: ExternalFilterComponent, selector: "external-filter", inputs: ["autoId", "filter", "externalFilters", "filterRegister"] }, { kind: "component", type: ConfigComponent, selector: "config", inputs: ["autoId", "tableOption"], outputs: ["changes"] }, { kind: "component", type: ColumnFilterComponent, selector: "column-filter", inputs: ["autoId", "column", "columnFilter", "cacheValues", "value", "operator", "isMobile"], outputs: ["operatorChange", "filterChange", "filterCommit"] }, { kind: "component", type: MobileFilterComponent, selector: "mobile-filter", inputs: ["autoId", "filter", "externalFilters", "columns", "filterDefs", "filterRegister", "cacheValues"] }, { kind: "pipe", type: SdGroupPipe, name: "sdGroup" }, { kind: "pipe", type: SdTreePipe, name: "sdTree" }, { kind: "pipe", type: SdSelectionVisiblePipe, name: "selectionVisible" }, { kind: "pipe", type: SdSelectionDisabledPipe, name: "selectionDisabled" }, { kind: "directive", type: SdScrollDirective, selector: "[sdScroll]" }, { kind: "directive", type: SdDesktopDirective, selector: "[sdDesktop]" }, { kind: "directive", type: SdMobileDirective, selector: "[sdMobile]" }, { kind: "directive", type: SdHoverCopyDirective, selector: "[sdHoverCopy]", inputs: ["sdHoverCopy", "sdHoverCopyDisabled"] }, { kind: "component", type: SelectorActionComponent, selector: "selector-action", inputs: ["autoId", "tableOption", "selectedTableItems"], outputs: ["clear"] }, { kind: "directive", type: StickyShadowDirective, selector: "[stickyShadow]" }, { kind: "directive", type: SdColumnResizeDirective, selector: "[sdColumnResize]", inputs: ["sdColumnResize", "minWidth", "maxWidth"], outputs: ["resizeEnd"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], animations: [
|
|
5387
|
+
], queries: [{ propertyName: "sdSubInformation", first: true, predicate: SdTableExpandDefDirective, descendants: true, isSignal: true }, { propertyName: "sdGroupDef", first: true, predicate: SdTableGroupDefDirective, descendants: true, isSignal: true }, { propertyName: "sdCellDefs", predicate: SdTableCellDefDirective, isSignal: true }, { propertyName: "sdCommandHeaderDef", first: true, predicate: SdTableCommandHeaderDefDirective, descendants: true, isSignal: true }, { propertyName: "sdFooterDefs", predicate: SdMaterialFooterDefDirective, isSignal: true }, { propertyName: "sdFilterDefs", predicate: SdTableFilterDefDirective, isSignal: true }, { propertyName: "sdTitleDefs", predicate: SdTableTitleDefDirective, isSignal: true }, { propertyName: "sdRowMobileDef", first: true, predicate: SdTableRowMobileDefDirective, isSignal: true }], viewQueries: [{ propertyName: "table", first: true, predicate: MatTable, descendants: true, isSignal: true }, { propertyName: "configComponent", first: true, predicate: ConfigComponent, descendants: true, isSignal: true }, { propertyName: "sdPopupExport", first: true, predicate: SdPopupExport, descendants: true, isSignal: true }, { propertyName: "scroll", first: true, predicate: SdScrollDirective, descendants: true, isSignal: true }, { propertyName: "quickAction", first: true, predicate: SdQuickAction, descendants: true, isSignal: true }, { propertyName: "externalFilter", first: true, predicate: ExternalFilterComponent, descendants: true, isSignal: true }, { propertyName: "mobileFilter", first: true, predicate: MobileFilterComponent, descendants: true, isSignal: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, isSignal: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true, isSignal: true }], ngImport: i0, template: "@let _visibleSelectAll = visibleSelectAll();\n@let _isSelectIndeterminate = isSelectIndeterminate();\n@let _isSelectAll = isSelectAll();\n@let _configuration = configuration();\n@let _tableOption = tableOption()!;\n@let _loading = loading();\n@let _items = items();\n@let _total = total();\n@let _isFiltered = isFiltered();\n@let _requireFiltered = requireFiltered();\n@let _export = _tableOption?.export;\n@let _exporting = exporting();\n@let _titleDef = titleDef();\n@let _autoId = autoId();\n@let _exportTitle = exportTitle();\n@let _cellDef = cellDef();\n@let _footerDef = footerDef();\n@let _sdSubInformation = sdSubInformation();\n@let _configComponent = configComponent();\n@let _mobileFilter = mobileFilter();\n@let _selectedTableItems = selectedTableItems();\n@let _rowCommands = rowCommands();\n@let _mobileCards = mobileCards();\n@let _isMobile = isMobile();\n@let _commandHeaderDef = sdCommandHeaderDef();\n<!-- why: tree kh\u00F4ng c\u00F2n c\u1ED9t ri\u00EAng \u2014 khi KH\u00D4NG c\u00F3 c\u1ED9t Index, icon expand nh\u00FAng v\u00E0o\n c\u1ED9t data \u0111\u1EA7u ti\u00EAn. \u0110\u00E2y l\u00E0 field c\u1EE7a c\u1ED9t \u0111\u00F3 (null n\u1EBFu c\u00F3 Index ho\u1EB7c kh\u00F4ng tree). -->\n@let _treeFirstField = _tableOption?.tree && !_tableOption.index?.enabled ? _configuration?.firstColumns?.[0]?.field : null;\n\n@if (_configuration) {\n @if (!_mobileCards && !_tableOption.filter?.disabled && !!_tableOption.filter?.externalFilters?.length && filterRegister) {\n <external-filter\n class=\"mb-16\"\n [autoId]=\"_autoId\"\n [filterRegister]=\"filterRegister\"\n [filter]=\"_tableOption.filter!\"\n [externalFilters]=\"_tableOption.filter?.externalFilters!\">\n </external-filter>\n }\n @let groupedItems = _items | sdTree: _tableOption.tree : treeRevision() | sdGroup: _tableOption : groupExpandState : groupHost;\n\n <!-- Tree toggle d\u00F9ng chung: indent (theo c\u1EA5p) + slot chevron/spinner. Nh\u00FAng v\u00E0o\n c\u1ED9t Index ho\u1EB7c c\u1ED9t data \u0111\u1EA7u qua *ngTemplateOutlet (context: { row }). -->\n <ng-template #sdTreeToggle let-row=\"row\">\n @let _tree = row?.meta?.tree;\n @if (_tree) {\n <span class=\"sd-tree-indent\" [style.width.px]=\"(_tree.level ?? 0) * (_tableOption.tree?.indentSize ?? 20)\"></span>\n <span class=\"sd-tree-toggle-slot\">\n @if (_tree.hasChildren) {\n @if (_tree.isExpanding) {\n <span class=\"lds-ring sd-tree-spinner\">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </span>\n } @else {\n @let _aid = _autoId;\n <button\n type=\"button\"\n class=\"sd-tree-toggle-btn\"\n [attr.data-autoid]=\"_aid ? _aid + '-tree-toggle-' + row.meta.id : null\"\n (click)=\"onTreeToggle(row); $event.stopPropagation()\">\n <sd-icon [name]=\"_tree.isExpanded ? 'expand_more' : 'chevron_right'\"></sd-icon>\n </button>\n }\n }\n </span>\n }\n </ng-template>\n\n <ng-template #sdGroupHeader let-item=\"item\">\n <div class=\"sd-group-row d-flex align-items-center py-8\">\n @if (_tableOption.selector?.visible && !_tableOption.selector?.single) {\n <div class=\"sd-group-selection-slot d-flex align-items-center justify-content-center\">\n <mat-checkbox\n class=\"c-selection\"\n color=\"primary\"\n [checked]=\"isGroupAllSelected(item)\"\n [indeterminate]=\"isGroupIndeterminate(item)\"\n (change)=\"onSelectGroup(item, $event.checked)\">\n </mat-checkbox>\n </div>\n } @else {\n <div class=\"sd-group-selection-slot\"></div>\n }\n @if (_tableOption.group?.collapsible) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-group-toggle-' + (item.meta.group?.key || item.meta.id) : null\"\n type=\"text\"\n [prefixIcon]=\"item.meta.group.isExpanded ? 'expand_more' : 'chevron_right'\"\n width=\"32px\"\n (click)=\"toggleGroupExpand(item)\">\n </sd-button>\n }\n @if (sdGroupDef()?.templateRef; as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: groupContext(item)\"></ng-container>\n } @else {\n <span class=\"T14R\">{{ item.meta.group.values | json }}</span>\n }\n </div>\n </ng-template>\n\n <ng-content select=\"[sdTableTop]\"></ng-content>\n <div class=\"c-container\" [class.sd-table-mobile]=\"_mobileCards\">\n <!-- why: b\u1EA3ng t\u1EA3i d\u1EEF li\u1EC7u B\u1EA4T \u0110\u1ED2NG B\u1ED8 nh\u01B0ng tr\u01B0\u1EDBc \u0111\u00E2y ch\u1EC9 c\u00F3 spinner thu\u1EA7n h\u00ECnh \u1EA3nh \u2014 screen\n reader kh\u00F4ng \u0111\u01B0\u1EE3c b\u00E1o g\u00EC c\u1EA3. role=\"status\" + aria-live=\"polite\" \u0111\u1ECDc tr\u1EA1ng th\u00E1i ngay khi\n spinner xu\u1EA5t hi\u1EC7n; aria-busy tr\u00EAn v\u00F9ng b\u1EA3ng cho bi\u1EBFt n\u1ED9i dung \u0111ang \u0111\u01B0\u1EE3c thay th\u1EBF. -->\n @if (_loading) {\n <div class=\"c-loading\" role=\"status\" aria-live=\"polite\" [attr.aria-label]=\"'core.component.table.loading' | sdTranslate\">\n <mat-spinner></mat-spinner>\n </div>\n }\n <div\n class=\"c-table\"\n sdScroll\n stickyShadow\n matSort\n [matSortDisabled]=\"!_tableOption.sort?.enable\"\n [attr.aria-busy]=\"_loading ? 'true' : null\"\n [style.max-height]=\"_tableOption.style?.maxHeight\"\n [style.min-height]=\"_tableOption.style?.minHeight\">\n @if (_mobileCards) {\n @if (_commandHeaderDef) {\n <div class=\"sd-mobile-command-header\"><ng-container *ngTemplateOutlet=\"_commandHeaderDef.templateRef\"></ng-container></div>\n }\n <sd-table-mobile-cards [table]=\"this\" [rows]=\"groupedItems\" [groupTemplate]=\"sdGroupHeader\"></sd-table-mobile-cards>\n @if (hasFooter()) {\n <div class=\"sd-mobile-footer p-12\" role=\"region\" [attr.aria-label]=\"'core.component.table.mobile.summary' | sdTranslate\">\n @for (column of mobileFooterColumns(); track column.field) {\n <div class=\"d-flex align-items-center flex-wrap gap-8 py-8\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n <ng-container\n *ngTemplateOutlet=\"_footerDef[column.field].templateRef; context: { items: _items, column: column }\"></ng-container>\n </div>\n }\n </div>\n }\n } @else {\n <table\n mat-table\n [dataSource]=\"groupedItems\"\n [trackBy]=\"trackBy\"\n multiTemplateDataRows\n cdkDropList\n [cdkDropListData]=\"groupedItems\"\n [cdkDropListDisabled]=\"!_tableOption.rowReorder?.enabled\"\n [cdkDropListSortPredicate]=\"reorderSortPredicate\"\n (cdkDropListDropped)=\"onReorderDrop($event)\">\n @if (_tableOption.rowReorder?.enabled) {\n <ng-container matColumnDef=\"sdReorder\">\n <th mat-header-cell *matHeaderCellDef class=\"sd-reorder-header\" [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\"></th>\n <td mat-cell *matCellDef=\"let row\" class=\"sd-reorder-cell\">\n @if (!row.meta?.group?.items?.length) {\n <sd-icon\n cdkDragHandle\n [class.sd-reorder-disabled]=\"isReorderDisabled(row)\"\n [name]=\"_tableOption.rowReorder?.icon || 'drag_indicator'\"></sd-icon>\n }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n }\n\n <ng-container matColumnDef=\"sdSubInformation\" sticky>\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\" [attr.colspan]=\"_configuration.displayedColumns.length\">\n @if (_sdSubInformation?.templateRef) {\n @if (_tableOption.expand?.always) {\n <ng-container *ngTemplateOutlet=\"_sdSubInformation?.templateRef!; context: { item: item }\"> </ng-container>\n } @else {\n <div [@detailExpand]=\"item.meta.expand?.isExpanded ? 'expanded' : 'collapsed'\">\n @if (item.meta.expand?.isExpanded) {\n <ng-container *ngTemplateOutlet=\"_sdSubInformation?.templateRef!; context: { item: item }\"> </ng-container>\n }\n </div>\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n\n <ng-container matColumnDef=\"sdSubInformationAction\" stickyEnd>\n <th\n class=\"p-0\"\n mat-header-cell\n *matHeaderCellDef\n style=\"width: 1px\"\n [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\"></th>\n <td mat-cell *matCellDef=\"let element\">\n @if (!element.meta.expand?.isExpanding && !_tableOption.expand?.always) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-expand-' + element.meta.id : null\"\n type=\"text\"\n [prefixIcon]=\"element.meta.expand?.isExpanded ? 'expand_less' : 'expand_more'\"\n (click)=\"onExpand(element)\"\n width=\"35px\">\n </sd-button>\n }\n @if (element.meta.expand?.isExpanding) {\n <div class=\"lds-ring\">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n }\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"sdSelection\" sticky>\n <th class=\"sd-selection-cell p-0\" mat-header-cell *matHeaderCellDef [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\">\n @if (_visibleSelectAll) {\n <mat-checkbox\n class=\"c-selection px-8\"\n color=\"primary\"\n [indeterminate]=\"_isSelectIndeterminate\"\n [ngModel]=\"_isSelectAll\"\n (ngModelChange)=\"isSelectAll.set($event)\"\n (change)=\"onSelectAll()\">\n </mat-checkbox>\n }\n </th>\n\n <td class=\"sd-selection-cell p-0\" mat-cell *matCellDef=\"let item\">\n @let visible = item.meta.selector?.visible;\n @if (visible) {\n @if (_tableOption.selector?.single) {\n <mat-radio-button\n class=\"c-selection px-8\"\n color=\"primary\"\n [checked]=\"item.meta.selector.isSelected\"\n (change)=\"item.meta.selector.isSelected = true; onSelect(item)\"\n [disabled]=\"item.meta.selector?.disabled\">\n </mat-radio-button>\n } @else {\n <mat-checkbox\n class=\"c-selection px-8\"\n color=\"primary\"\n [(ngModel)]=\"item.meta.selector.isSelected\"\n (change)=\"onSelect(item)\"\n [disabled]=\"item.meta.selector?.disabled\">\n </mat-checkbox>\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n @if (_tableOption.index?.enabled) {\n @let _pageOffset = pageOffset();\n @let _indexWidth = _tableOption.index?.width || '50px';\n <!-- why: khi tree, c\u1ED9t Index \"\u00F4m\" th\u00EAm chevron + indent. D\u00F9ng width:1px +\n nowrap (.sd-tree-index-cell) \u0111\u1EC3 c\u1ED9t co S\u00C1T n\u1ED9i dung, kh\u00F4ng chi\u1EBFm ch\u1ED7\n th\u1EEBa; header \"#\" canh tr\u00E1i l\u00F9i v\u00E0o (.sd-tree-index-header) cho th\u1EB3ng s\u1ED1. -->\n @let _treeIndex = !!_tableOption.tree;\n <ng-container matColumnDef=\"sdIndex\" sticky>\n <th\n [class.p-0]=\"!_treeIndex\"\n [class.text-center]=\"!_treeIndex\"\n [class.sd-tree-index-cell]=\"_treeIndex\"\n [class.sd-tree-index-header]=\"_treeIndex\"\n mat-header-cell\n *matHeaderCellDef\n [style.width]=\"_treeIndex ? '1px' : _indexWidth\"\n [style.min-width]=\"_treeIndex ? null : _indexWidth\"\n [style.max-width]=\"_treeIndex ? null : _indexWidth\"\n [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\">\n {{ _tableOption.index?.title || '#' }}\n </th>\n <td\n [class.px-4]=\"!_treeIndex\"\n [class.text-center]=\"!_treeIndex\"\n [class.sd-tree-index-cell]=\"_treeIndex\"\n mat-cell\n *matCellDef=\"let item; let i = dataIndex\"\n [style.width]=\"_treeIndex ? '1px' : null\"\n [style.min-width]=\"_treeIndex ? null : _indexWidth\"\n [style.max-width]=\"_treeIndex ? null : _indexWidth\">\n @if (!item?.meta?.group?.isGroupHeader) {\n @if (_treeIndex) {\n <!-- why: tree \u2192 chevron + indent + STT ph\u00E2n c\u1EA5p (1, 1.2, 1.2.1). T\u00F4 \u0111\u1EADm root (level 0). -->\n <span class=\"sd-tree-line\">\n <ng-container *ngTemplateOutlet=\"sdTreeToggle; context: { row: item }\"></ng-container>\n @if (item?.meta?.tree?.indexPath?.length) {\n <span class=\"sd-tree-stt\" [class.sd-stt-root]=\"(item.meta.tree.level ?? 0) === 0\">\n {{ item.meta.tree.indexPath.join('.') }}\n </span>\n }\n </span>\n } @else {\n {{ _pageOffset + i + 1 }}\n }\n }\n </td>\n <td\n mat-footer-cell\n *matFooterCellDef\n [style.width]=\"_treeIndex ? '1px' : null\"\n [style.min-width]=\"_treeIndex ? null : _indexWidth\"\n [style.max-width]=\"_treeIndex ? null : _indexWidth\"></td>\n </ng-container>\n }\n <ng-container\n matColumnDef=\"sdCommand\"\n [sticky]=\"_tableOption.command?.align !== 'right'\"\n [stickyEnd]=\"_tableOption.command?.align === 'right'\">\n <!-- why: \u00F4 header c\u1EE7a c\u1ED9t command v\u1ED1n \u0111\u1EC3 tr\u1ED1ng. Cho consumer chi\u1EBFm ch\u1ED7 \u0111\u00F3 b\u1EB1ng\n `sdTableCommandHeaderDef` (th\u01B0\u1EDDng l\u00E0 n\u00FAt th\u00EAm d\u00F2ng) th\u00EC h\u00E0nh \u0111\u1ED9ng c\u1EA5p b\u1EA3ng n\u1EB1m ngay\n tr\u00EAn c\u1EE5m n\u00FAt c\u1EE7a t\u1EEBng d\u00F2ng, thay v\u00EC ph\u1EA3i d\u1EF1ng th\u00EAm m\u1ED9t d\u1EA3i ri\u00EAng d\u01B0\u1EDBi b\u1EA3ng. -->\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 50px\" [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\">\n @if (_commandHeaderDef) {\n <div class=\"sd-command-header d-flex align-items-center justify-content-center\">\n <ng-container *ngTemplateOutlet=\"_commandHeaderDef.templateRef\"></ng-container>\n </div>\n }\n </th>\n <!-- why: `dataIndex` do CDK c\u1EA5p s\u1EB5n. B\u1EA3n c\u0169 d\u00F9ng `groupedItems.indexOf(item)` \u2014\n qu\u00E9t to\u00E0n m\u1EA3ng cho M\u1ED6I d\u00F2ng render \u1EDF M\u1ED6I CD pass (O(n\u00B2) tr\u00EAn \u0111\u01B0\u1EDDng render),\n v\u00E0 c\u00F2n tr\u1EA3 sai index khi 2 d\u00F2ng tr\u00F9ng reference. -->\n <td class=\"px-8\" mat-cell *matCellDef=\"let item; let i = dataIndex\">\n <desktop-command [autoId]=\"_autoId\" [commands]=\"_rowCommands\" [item]=\"item\" [itemIndex]=\"i\"></desktop-command>\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n <!-- why: group header row d\u00F9ng matRowDef RI\u00CANG v\u1EDBi column list ['sdGroupHeader']\n qua predicate when:isGroupHeaderRow. Cell colspan = displayedColumns.length \u0111\u1EC3\n span TO\u00C0N B\u1ED8 width data row. Tr\u00E1nh colspan trick overflow row khi c\u00E1c TD kh\u00E1c render. -->\n <ng-container matColumnDef=\"sdGroupHeader\">\n <td class=\"p-0 sd-group-header-cell\" mat-cell *matCellDef=\"let item\" [attr.colspan]=\"sdGroupColspan()\">\n <ng-container *ngTemplateOutlet=\"sdGroupHeader; context: { item: item }\"></ng-container>\n </td>\n </ng-container>\n <!-- why: filler column \u1EDF cu\u1ED1i h\u1EA5p th\u1EE5 leftover space khi t\u1ED5ng width c\u00E1c c\u1ED9t data < container \u2014 gi\u1EEF cho selection/STT/command kh\u00F4ng b\u1ECB d\u00E3n. -->\n <ng-container matColumnDef=\"sdFiller\">\n <th class=\"sd-filler-cell p-0\" mat-header-cell *matHeaderCellDef [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\"></th>\n <td class=\"sd-filler-cell p-0\" mat-cell *matCellDef=\"let item\"></td>\n <td class=\"sd-filler-cell p-0\" mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n @for (column of _configuration.firstColumns; track column.field) {\n <ng-container [matColumnDef]=\"column.field\" [sticky]=\"_configuration.fixedColumn[column.field]\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"px-8 py-8 c-th\"\n [sdColumnResize]=\"!!_tableOption.config?.resizable && column.type !== 'children'\"\n [minWidth]=\"column.minWidth\"\n [maxWidth]=\"column.maxWidth\"\n (resizeEnd)=\"onColumnResize(column.field, $event)\"\n [style.width]=\"column.width\"\n [style.min-width]=\"column.minWidth || column.width\"\n [style.max-width]=\"column.maxWidth\"\n [attr.rowspan]=\"_configuration.multipleHeader && column.type !== 'children' ? 2 : 1\"\n [attr.colspan]=\"column.type === 'children' ? column.children.length : 1\"\n [attr.aria-sort]=\"\n _tableOption.sort?.enable && column.type !== 'children' && column.sortable ? getSortAria(column.field) : null\n \">\n <div>\n <!-- why: sort control ch\u1EC9 \u00F4m title; filter l\u00E0 sibling n\u00EAn kh\u00F4ng th\u00E0nh interactive\n descendant. aria-sort thu\u1ED9c semantic <th>, kh\u00F4ng thu\u1ED9c control n\u00E0y. -->\n @if (column.type === 'children') {\n <div\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n } @else {\n @if (_tableOption.sort?.enable && column.sortable) {\n <div\n [sdTableSortHeader]=\"column.field\"\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n } @else {\n <div\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n }\n @let hideInlineFilter =\n _tableOption.filter?.disabled ||\n _tableOption.filter?.hideInlineFilter === true ||\n (_tableOption.filter?.hideInlineFilter === 'auto' && !_isFiltered && _total! <= 10);\n @if (!hideInlineFilter) {\n @if (!_isMobile) {\n <column-filter\n [autoId]=\"_autoId\"\n [value]=\"columnFilter?.[column.field!]!\"\n [operator]=\"columnOperator[column.field]\"\n (operatorChange)=\"columnOperator[column.field] = $event!; onOperatorChange(column, $event)\"\n [columnFilter]=\"columnFilter!\"\n [cacheValues]=\"cacheValues\"\n [column]=\"column\"\n (filterChange)=\"onFilterChange()\"\n (filterCommit)=\"onFilterCommit()\">\n </column-filter>\n }\n }\n }\n </div>\n </th>\n <td\n class=\"c-td px-0\"\n [class.d-none]=\"column.type === 'children'\"\n mat-cell\n *matCellDef=\"let item\"\n [sdHoverCopy]=\"(item.data && item.data[column.field]) || ''\"\n [sdHoverCopyDisabled]=\"!column.cell?.copiable\">\n @if (column.type !== 'children' && !item?.meta?.group?.isGroupHeader) {\n @if (_treeFirstField && column.field === _treeFirstField) {\n <!-- why: kh\u00F4ng c\u00F3 c\u1ED9t Index \u2192 chevron + indent nh\u00FAng v\u00E0o c\u1ED9t data \u0111\u1EA7u (nh\u01B0 file explorer). -->\n <span class=\"sd-tree-line px-8\">\n <ng-container *ngTemplateOutlet=\"sdTreeToggle; context: { row: item }\"></ng-container>\n <desktop-cell class=\"d-block\" [column]=\"column\" [item]=\"item\" [cellDef]=\"_cellDef\"></desktop-cell>\n </span>\n } @else {\n <desktop-cell class=\"d-block px-8\" [column]=\"column\" [item]=\"item\" [cellDef]=\"_cellDef\"> </desktop-cell>\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef>\n <ng-container *ngIf=\"_footerDef[column.field]\">\n <ng-container *ngTemplateOutlet=\"_footerDef[column.field].templateRef; context: { items: _items, column: column }\">\n </ng-container>\n </ng-container>\n </td>\n </ng-container>\n }\n @for (column of _configuration.secondColumns; track column.field) {\n <ng-container [matColumnDef]=\"column.field\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"c-th px-8\"\n [style.width]=\"column.width\"\n [style.min-width]=\"column.minWidth || column.width\"\n [style.max-width]=\"column.maxWidth\"\n [attr.aria-sort]=\"_tableOption.sort?.enable && column.sortable ? getSortAria(column.field) : null\">\n <div>\n @if (_tableOption.sort?.enable && column.sortable) {\n <div\n [sdTableSortHeader]=\"column.field\"\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n } @else {\n <div\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n }\n @if (!_tableOption.filter?.disabled && !_tableOption.filter?.hideInlineFilter && columnOperator) {\n @if (!_isMobile) {\n <column-filter\n [autoId]=\"_autoId\"\n [value]=\"columnFilter?.[column.field!]!\"\n [operator]=\"columnOperator[column.field]\"\n [columnFilter]=\"columnFilter!\"\n [cacheValues]=\"cacheValues\"\n [column]=\"column\"\n (operatorChange)=\"columnOperator[column.field] = $event!; onOperatorChange(column, $event)\"\n (filterChange)=\"onFilterChange()\"\n (filterCommit)=\"onFilterCommit()\">\n </column-filter>\n }\n }\n </div>\n </th>\n <td\n class=\"c-td px-0\"\n mat-cell\n *matCellDef=\"let item\"\n [sdHoverCopy]=\"item[column.field]\"\n [sdHoverCopyDisabled]=\"!column.cell?.copiable\">\n @if (column.type !== 'children') {\n <desktop-cell class=\"d-block px-8\" [column]=\"column\" [item]=\"item\" [cellDef]=\"_cellDef\"> </desktop-cell>\n }\n </td>\n <td mat-footer-cell *matFooterCellDef>\n <ng-container *ngIf=\"_footerDef[column.field]\">\n <ng-container *ngTemplateOutlet=\"_footerDef[column.field].templateRef; context: { items: _items, column: column }\">\n </ng-container>\n </ng-container>\n </td>\n </ng-container>\n }\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"_configuration.firstHeaders; sticky: true\"></tr>\n @if (!!_configuration.secondHeaders.length) {\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"_configuration.secondHeaders; sticky: true\"></tr>\n }\n <!-- Group header row \u2014 ch\u1EC9 1 cell sdGroupHeader colspan to\u00E0n width. -->\n <tr mat-row *matRowDef=\"let row; columns: ['sdGroupHeader']; when: isGroupHeaderRow\" class=\"c-group-row-tr\"></tr>\n\n <!-- Data row \u2014 d\u00F9ng displayedColumns \u0111\u1EA7y \u0111\u1EE7; when isDataRow \u0111\u1EC3 lo\u1EA1i tr\u1EEB group header. -->\n <!-- why: [ngStyle] \u0111\u1ECDc meta.rowStyle \u2014 style.rowCss \u0111\u00E3 \u0111\u01B0\u1EE3c resolve 1 l\u1EA7n m\u1ED7i l\u1EA7n\n render. B\u1EA3n c\u0169 g\u1ECDi rowStyle(row) ngay trong binding \u2192 ch\u1EA1y callback c\u1EE7a consumer\n cho T\u1EEANG d\u00F2ng \u1EDF M\u1ED6I CD pass, v\u00E0 v\u00EC tr\u1EA3 object M\u1EDAI n\u00EAn NgStyle ph\u1EA3i ch\u1EA1y l\u1EA1i\n KeyValueDiffer tr\u00EAn m\u1ECDi d\u00F2ng \u1EDF m\u1ECDi pass. -->\n <tr\n mat-row\n cdkDrag\n [cdkDragData]=\"row\"\n [cdkDragDisabled]=\"\n !_tableOption.rowReorder?.enabled ||\n !!row.meta?.group?.items?.length ||\n (row.meta?.tree?.level ?? 0) > 0 ||\n isReorderDisabled(row)\n \"\n *matRowDef=\"let row; columns: _configuration.displayedColumns; when: isDataRow\"\n matRipple\n class=\"c-row\"\n [class.sd-tree-row]=\"!!_tableOption.tree\"\n [ngClass]=\"_tableOption.tree ? 'sd-tree-level-' + (row.meta?.tree?.level ?? 0) : null\"\n [ngStyle]=\"row.meta.rowStyle\"\n [class.selected]=\"row.meta.selector.isSelected\"></tr>\n\n <!-- Sub-information row \u2014 also gated b\u1EDFi isDataRow \u0111\u1EC3 KH\u00D4NG render empty expand row d\u01B0\u1EDBi group header. -->\n <tr mat-row *matRowDef=\"let row; columns: ['sdSubInformation']; when: isDataRow\" class=\"c-detail-row\"></tr>\n @if (hasFooter() && !!_configuration.displayedFooters.length) {\n <tr mat-footer-row *matFooterRowDef=\"_configuration.displayedFooters; sticky: true\"></tr>\n }\n </table>\n }\n <!-- why: tr\u1EA1ng th\u00E1i r\u1ED7ng c\u0169ng xu\u1EA5t hi\u1EC7n B\u1EA4T \u0110\u1ED2NG B\u1ED8 sau khi fetch xong; kh\u00F4ng c\u00F3 live region\n th\u00EC ng\u01B0\u1EDDi d\u00F9ng screen reader ch\u1EDD m\u00E3i m\u00E0 kh\u00F4ng bi\u1EBFt b\u1EA3ng \u0111\u00E3 tr\u1EA3 v\u1EC1 0 d\u00F2ng. -->\n @if (!_loading && loadError()) {\n <div class=\"c-no-data-row\" role=\"alert\">\n <p>{{ 'core.component.table.error-occurred' | sdTranslate }}</p>\n <sd-button [title]=\"'core.component.table.reload' | sdTranslate\" (click)=\"reload()\"></sd-button>\n </div>\n } @else if (!_loading && !_total) {\n <div class=\"c-no-data-row\" role=\"status\" aria-live=\"polite\">\n @if (_isFiltered) {\n @if (tableConfiguration?.images?.filterEmpty) {\n <img class=\"c-image\" [src]=\"tableConfiguration!.images!.filterEmpty\" alt=\"filter-empty\" />\n } @else {\n <img class=\"c-image sd-image-filter-empty\" alt=\"filter-empty\" />\n }\n <div class=\"T16M\">{{ 'core.component.table.no-results' | sdTranslate }}</div>\n <div class=\"T16R text-secondary\">{{ 'core.component.table.no-results-hint' | sdTranslate }}</div>\n } @else {\n @if (_requireFiltered) {\n @if (tableConfiguration?.images?.filterRequired) {\n <img class=\"c-image\" [src]=\"tableConfiguration!.images!.filterRequired\" alt=\"filter-required\" />\n } @else {\n <img class=\"c-image sd-image-filter-required\" alt=\"filter-required\" />\n }\n <div class=\"T16R text-secondary\">{{ 'core.component.table.choose-filter-hint' | sdTranslate }}</div>\n } @else {\n @if (tableConfiguration?.images?.dataEmpty) {\n <img class=\"c-image\" [src]=\"tableConfiguration!.images!.dataEmpty\" alt=\"data-empty\" />\n } @else {\n <img class=\"c-image sd-image-data-empty\" alt=\"data-empty\" />\n }\n <div class=\"T16R text-secondary\">{{ 'core.component.table.no-data' | sdTranslate }}</div>\n }\n }\n </div>\n }\n </div>\n <div class=\"c-paginator\">\n <div class=\"c-action\">\n @if (_mobileCards) {\n @let _tools = mobileToolsActions();\n @if (_tools.length) {\n <button\n mat-button\n type=\"button\"\n class=\"sd-mobile-tools-trigger\"\n aria-haspopup=\"dialog\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-mobile-tools' : null\"\n (click)=\"mobileTools.openMore()\">\n <sd-icon name=\"tune\"></sd-icon><span>{{ 'core.component.table.mobile.tools' | sdTranslate }}</span>\n </button>\n <sd-table-mobile-actions\n #mobileTools\n [actions]=\"_tools\"\n [autoOpen]=\"false\"\n [title]=\"'core.component.table.mobile.tools-title' | sdTranslate\"\n [autoId]=\"_autoId\"></sd-table-mobile-actions>\n }\n } @else {\n @if (_tableOption.reload?.visible) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-reload' : null\"\n class=\"mr-8\"\n [title]=\"'core.component.table.reload' | sdTranslate\"\n prefixIcon=\"refresh\"\n (click)=\"reload()\"\n type=\"text\">\n </sd-button>\n }\n @if (_export && _items.length) {\n @if (_export.type === 'custom') {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-export' : null\"\n class=\"mr-8\"\n [title]=\"_exportTitle\"\n prefixIcon=\"get_app\"\n (click)=\"exportCustom()\"\n type=\"text\">\n </sd-button>\n } @else {\n @if (_export.visible) {\n @if (_exporting) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-export' : null\"\n class=\"mr-8\"\n [loading]=\"_exporting\"\n [title]=\"_exportTitle\"\n prefixIcon=\"get_app\"\n type=\"text\">\n </sd-button>\n } @else {\n @if (_export.visible === 'ALL' || !_export.visible) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-export' : null\"\n class=\"mr-8\"\n [title]=\"_exportTitle\"\n prefixIcon=\"get_app\"\n [matMenuTriggerFor]=\"menu\"\n type=\"text\">\n </sd-button>\n <mat-menu #menu=\"matMenu\">\n <button\n mat-menu-item\n [attr.data-autoid]=\"_autoId ? _autoId + '-export-excel' : null\"\n (click)=\"exportExcel()\"\n type=\"button\">\n <sd-icon name=\"file_download\"></sd-icon>\n <span> {{ 'core.component.table.export-excel' | sdTranslate }}</span>\n </button>\n <button\n mat-menu-item\n [attr.data-autoid]=\"_autoId ? _autoId + '-export-csv' : null\"\n (click)=\"exportCSV()\"\n type=\"button\">\n <sd-icon name=\"file_download\"></sd-icon>\n <span> {{ 'core.component.table.export-csv' | sdTranslate }}</span>\n </button>\n </mat-menu>\n } @else if (_export.visible === 'EXCEL') {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-export-excel' : null\"\n class=\"mr-8\"\n [title]=\"_exportTitle\"\n prefixIcon=\"get_app\"\n (click)=\"exportExcel()\"\n type=\"text\">\n </sd-button>\n } @else if (_export.visible === 'CSV') {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-export-csv' : null\"\n class=\"mr-8\"\n [title]=\"_exportTitle\"\n prefixIcon=\"get_app\"\n (click)=\"exportCSV()\"\n type=\"text\">\n </sd-button>\n }\n }\n }\n }\n }\n\n @if (_configComponent) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-config' : null\"\n class=\"mr-8\"\n [title]=\"'core.component.table.setup-short' | sdTranslate\"\n prefixIcon=\"settings\"\n (click)=\"_configComponent.open()\"\n type=\"text\">\n </sd-button>\n }\n <!-- Mobile: n\u00FAt Filter m\u1EDF mobile-filter drawer (inline filter \u1EA9n tr\u00EAn mobile) -->\n @if (_isMobile) {\n @if (!_tableOption.filter?.disabled && _mobileFilter) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-mobile-filter-open' : null\"\n class=\"mr-8\"\n prefixIcon=\"filter_alt\"\n [title]=\"_mobileCards ? ('core.component.table.filter' | sdTranslate) : undefined\"\n (click)=\"_mobileFilter.open()\"\n type=\"text\">\n </sd-button>\n }\n }\n }\n </div>\n @let hidePaginator = !_tableOption.paginate?.pageSize || _total === undefined || _total <= _tableOption.paginate?.pageSize!;\n <mat-paginator\n [class.sd-mobile-paginator]=\"_mobileCards\"\n [class.d-none]=\"_tableOption.paginate?.hidden || hidePaginator\"\n [length]=\"_total\"\n [pageSize]=\"_tableOption.paginate?.pageSize\"\n [pageSizeOptions]=\"_tableOption.paginate?.pages!\"\n [showFirstLastButtons]=\"!_isMobile && _tableOption.paginate?.showFirstLastButtons\"\n [hidePageSize]=\"_isMobile || _tableOption.paginate?.hidePageSize\"></mat-paginator>\n <!-- \"\u0110ang hi\u1EC3n th\u1ECB...\" ch\u1EC9 desktop -->\n @if (!_isMobile) {\n @if (!_tableOption.paginate?.hidden && hidePaginator && _total !== undefined && _total > 0) {\n <div class=\"T14R c-summary\">\n {{ 'core.component.table.showing' | sdTranslate }} <span class=\"T14M ml-2\">1-{{ _total }}/{{ _total }}</span>\n </div>\n }\n }\n </div>\n </div>\n @if (!_mobileCards) {\n <selector-action\n [autoId]=\"_autoId\"\n [tableOption]=\"_tableOption\"\n [selectedTableItems]=\"_selectedTableItems\"\n (clear)=\"onClearSelection()\" />\n }\n @if (_tableOption.config?.visible) {\n <config [autoId]=\"_autoId\" [tableOption]=\"_tableOption\" />\n }\n <!-- Mobile filter drawer \u2014 ch\u1EC9 instantiate khi c\u1EA7n render tr\u00EAn mobile -->\n @if (!_tableOption.filter?.disabled && filterRegister) {\n <mobile-filter\n [autoId]=\"_autoId\"\n [filter]=\"_tableOption.filter!\"\n [externalFilters]=\"_tableOption.filter?.externalFilters!\"\n [columns]=\"mobileColumns()\"\n [filterDefs]=\"sdFilterDefs()\"\n [filterRegister]=\"filterRegister\"\n [cacheValues]=\"cacheValues\">\n </mobile-filter>\n }\n}\n", styles: [":host{display:flex;flex-direction:column;overflow:auto;width:100%;height:100%}:host:focus-visible{outline:2px solid var(--sd-primary);outline-offset:2px}:host .c-header-title{height:40px;display:flex;align-items:center}:host .c-container{position:relative;min-height:50px;display:flex;flex-direction:column;flex:1}:host .c-container .c-table{position:relative;flex:1;display:flex;flex-direction:column}:host .c-container .c-table table{border-collapse:separate;width:100%}:host .c-container .c-table table tr.c-first-header.mat-mdc-header-row{height:40px}:host .c-container .c-table table tr.c-second-header.mat-mdc-header-row{height:40px}:host .c-container .c-table table tr.c-detail-row{height:0}:host .c-container .c-table table tr.c-row.activated{background-color:#e5ecff}:host .c-container .c-table table tr.c-row.selected{background-color:#eef2ff}:host .c-container .c-table table tr.c-row:not(.selected):not(.activated):hover{background-color:#f5f5f5}:host .c-container .c-table table tr.c-row td{border-bottom-width:0}:host .c-container .c-table table tr.c-row.c-expandable{cursor:pointer}:host .c-container .c-table table tr.c-row.c-expandable:hover{background:#f5f5f5}:host .c-container .c-table table th.mat-mdc-header-cell{background-color:#f2f3f4;border-bottom:0!important}:host .c-container .c-table table td.mat-mdc-cell,:host .c-container .c-table table td.mat-mdc-footer-cell,:host .c-container .c-table table th.mat-mdc-header-cell{border-bottom-color:#f2f2f2!important}:host .c-container .c-table .c-th{vertical-align:middle;font-weight:500;font-size:14px;line-height:20px;color:#212121}:host .c-container .c-table .c-th.sd-col-resize-host{position:relative}:host .c-container .c-table .c-th.sd-resizing{-webkit-user-select:none;user-select:none}:host .c-container .c-table .c-th .sd-col-resize-handle{position:absolute;top:0;right:0;width:6px;height:100%;cursor:col-resize;-webkit-user-select:none;user-select:none;z-index:2}:host .c-container .c-table .c-th .sd-col-resize-handle:hover{background:#00000014}:host .c-container .c-table .c-td:first{padding-left:10px}:host .c-container .c-table .c-no-data-row{flex:1;width:100%;position:sticky;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center}:host .c-container .c-table .c-no-data-row .c-image{margin-bottom:16px;width:96px}:host .c-container .c-loading{position:absolute;inset:0 0 56px;background:#00000026;z-index:2;display:flex;align-items:center;justify-content:center}:host .c-container .c-paginator{display:flex;flex-direction:row;justify-content:space-between;align-items:center;background-color:#fff}:host .c-container .c-paginator .mat-mdc-paginator{background:transparent;--mat-paginator-container-size: 40px;--mat-icon-button-state-layer-size: 32px;--mdc-icon-button-state-layer-size: 32px;--mdc-icon-button-icon-size: 20px}:host .c-container .c-paginator .c-action{padding:0}:host .c-container .c-paginator .c-action sd-button{margin:8px 5px}:host .c-container .c-paginator .c-summary{padding:8px 16px}:host .c-container .c-empty{text-align:center;background-color:#fff;border:none!important}:host .c-container .c-empty sd-icon{font-size:150px;margin-top:30px;margin-bottom:30px;opacity:.2;width:auto;height:auto}:host button.c-btn-add{background-color:#fff;box-shadow:0 2px 4px #2f313629}:host .lds-ring{display:inline-block;position:relative;width:40px;height:40px}:host .lds-ring div{box-sizing:border-box;display:block;position:absolute;width:32px;height:32px;margin:4px;border:4px solid #cef;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#cef transparent transparent transparent}:host .lds-ring div:nth-child(1){animation-delay:-.45s}:host .lds-ring div:nth-child(2){animation-delay:-.3s}:host .lds-ring div:nth-child(3){animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host .sd-reorder-header,:host .sd-reorder-cell{width:40px;min-width:40px;padding:0 4px;box-sizing:border-box}:host .sd-reorder-cell sd-icon{cursor:grab;color:#00000061;display:flex;align-items:center}:host .sd-reorder-cell sd-icon:active{cursor:grabbing}:host .sd-reorder-cell sd-icon.sd-reorder-disabled{opacity:.3;cursor:not-allowed;pointer-events:none}:host ::ng-deep .sd-mobile-paginator .mat-mdc-paginator-range-label{margin-inline:4px;white-space:nowrap}:host .sd-mobile-command-header{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:8px;padding:4px}:host .c-container.sd-table-mobile .c-paginator{flex-wrap:wrap;gap:4px}:host .c-container.sd-table-mobile .c-action{display:flex;align-items:center;min-width:0}:host .c-container.sd-table-mobile .sd-mobile-tools-trigger{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px}:host .c-container.sd-table-mobile .sd-mobile-paginator{margin-inline-start:auto}:host .c-container.sd-table-mobile .c-paginator,:host .c-container.sd-table-mobile .c-empty{background-color:var(--sd-surface);color:var(--sd-text)}:host ::ng-deep .sd-table-mobile .c-paginator button{min-width:44px;min-height:44px}:host .c-container.sd-table-mobile .c-paginator .sd-mobile-paginator{--mat-icon-button-state-layer-size: 44px;--mdc-icon-button-state-layer-size: 44px}:host ::ng-deep .mat-select-arrow{color:#a6a6a6}:host ::ng-deep .sd-table-sort-header{cursor:pointer;outline:none}:host ::ng-deep .sd-table-sort-header:focus-visible{border-bottom:solid 1px currentColor}:host ::ng-deep th[aria-sort] .sd-table-sort-header{background-repeat:no-repeat;background-position:center right 0;background-size:16px 16px;padding-right:24px}:host ::ng-deep th[aria-sort=none] .sd-table-sort-header{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z'/%3E%3C/svg%3E\")}:host ::ng-deep th[aria-sort=ascending] .sd-table-sort-header{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z'/%3E%3C/svg%3E\")}:host ::ng-deep th[aria-sort=descending] .sd-table-sort-header{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z'/%3E%3C/svg%3E\")}:host ::ng-deep .c-paginator .mat-mdc-paginator .mdc-text-field--outlined .mat-mdc-form-field-infix,:host ::ng-deep .c-paginator .mat-mdc-paginator .mdc-text-field--no-label .mat-mdc-form-field-infix{padding-top:2px;padding-bottom:2px;min-height:32px}:host ::ng-deep .c-paginator .mat-mdc-paginator-range-label{margin:0 4px}:host ::ng-deep .c-paginator .mat-mdc-paginator-page-size-select mat-select{margin-top:2px!important}:host ::ng-deep .cdk-drag-preview{box-shadow:0 4px 12px #00000026;background:#fff;display:table;width:100%}:host ::ng-deep .cdk-drag-preview td{padding:0 8px;border-bottom:1px solid rgba(0,0,0,.12)}:host ::ng-deep .cdk-drag-placeholder{opacity:0}:host ::ng-deep .cdk-drop-list-dragging tr.c-row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}:host ::ng-deep .sd-selection-cell{width:42px;min-width:42px;max-width:42px}:host ::ng-deep .sd-filler-cell{width:auto;min-width:0;padding:0!important;border:0}:host ::ng-deep .sd-group-header-cell{background:#f5f7fc;border-top:1px solid #e6e9f2;border-bottom:1px solid #e6e9f2}:host ::ng-deep .sd-group-row{min-height:36px}:host ::ng-deep .sd-group-selection-slot{width:42px;min-width:42px;max-width:42px}:host ::ng-deep .c-selection{transform:scale(.85);transform-origin:center}:host ::ng-deep .sd-tree-line{display:inline-flex;align-items:center;min-height:32px}:host ::ng-deep .sd-tree-indent{flex:0 0 auto}:host ::ng-deep .sd-tree-toggle-slot{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px}:host ::ng-deep .sd-tree-toggle-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;background:transparent;border-radius:50%;cursor:pointer;color:var(--sd-text-secondary, #5b6472);transition:background-color .15s ease}:host ::ng-deep .sd-tree-toggle-btn sd-icon{font-size:18px;width:18px;height:18px;line-height:18px}:host ::ng-deep .sd-tree-toggle-btn:hover{background-color:#0f172a14}:host ::ng-deep .sd-tree-spinner{transform:scale(.45)}:host ::ng-deep .sd-tree-stt{margin-left:2px;white-space:nowrap}:host ::ng-deep .sd-tree-index-cell{text-align:left!important;white-space:nowrap;padding-left:8px;padding-right:8px}:host ::ng-deep .sd-tree-index-header{padding-left:32px}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-0{background:#fbfcfe}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-0>td{font-weight:500}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-1{background:#fff}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-2{background:#fafbfd}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-3{background:#f6f8fb}:host ::ng-deep .sd-stt-root{font-weight:700;color:#1f2330}:host ::ng-deep .sd-mobile-tools-trigger .mdc-button__label{display:inline-flex;align-items:center;gap:6px}\n", ":host ::ng-deep .sticky-shadow-right{overflow:visible!important}:host ::ng-deep .sticky-shadow-right:after{content:\"\";position:absolute;top:0;right:0;bottom:0;width:8px;transform:translate(100%);background:linear-gradient(to right,rgba(0,0,0,.12),transparent);pointer-events:none}:host ::ng-deep .sticky-shadow-left{overflow:visible!important}:host ::ng-deep .sticky-shadow-left:after{content:\"\";position:absolute;top:0;left:0;bottom:0;width:8px;transform:translate(-100%);background:linear-gradient(to left,rgba(0,0,0,.12),transparent);pointer-events:none}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: i1$1.JsonPipe, name: "json" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i3$1.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i3$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i3$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i4$1.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i5.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i5.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5.MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: i5.MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }, { kind: "directive", type: i5.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: i5.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "component", type: i5.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i5.MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i6.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i7.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i3.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "component", type: i4.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i1.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i1.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: DesktopCommand, selector: "desktop-command", inputs: ["autoId", "item", "itemIndex", "commands"] }, { kind: "component", type: DesktopCellComponent, selector: "desktop-cell", inputs: ["column", "item", "cellDef"] }, { kind: "component", type: ColumnTitleComponent, selector: "column-title", inputs: ["column", "titleDef"] }, { kind: "component", type: ExternalFilterComponent, selector: "external-filter", inputs: ["autoId", "filter", "externalFilters", "filterRegister"] }, { kind: "component", type: ConfigComponent, selector: "config", inputs: ["autoId", "tableOption"], outputs: ["changes"] }, { kind: "component", type: ColumnFilterComponent, selector: "column-filter", inputs: ["autoId", "column", "columnFilter", "cacheValues", "value", "operator", "isMobile"], outputs: ["operatorChange", "filterChange", "filterCommit"] }, { kind: "component", type: MobileFilterComponent, selector: "mobile-filter", inputs: ["autoId", "filter", "externalFilters", "columns", "filterDefs", "filterRegister", "cacheValues"] }, { kind: "pipe", type: SdGroupPipe, name: "sdGroup" }, { kind: "pipe", type: SdTreePipe, name: "sdTree" }, { kind: "directive", type: SdScrollDirective, selector: "[sdScroll]" }, { kind: "directive", type: SdHoverCopyDirective, selector: "[sdHoverCopy]", inputs: ["sdHoverCopy", "sdHoverCopyDisabled"] }, { kind: "component", type: SelectorActionComponent, selector: "selector-action", inputs: ["autoId", "tableOption", "selectedTableItems"], outputs: ["clear"] }, { kind: "directive", type: StickyShadowDirective, selector: "[stickyShadow]" }, { kind: "directive", type: SdColumnResizeDirective, selector: "[sdColumnResize]", inputs: ["sdColumnResize", "minWidth", "maxWidth"], outputs: ["resizeEnd"] }, { kind: "directive", type: SdTableSortHeaderDirective, selector: "[sdTableSortHeader]", inputs: ["sdTableSortHeader"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }, { kind: "component", type: SdTableMobileCardsComponent, selector: "sd-table-mobile-cards", inputs: ["table", "rows", "groupTemplate"] }, { kind: "component", type: SdTableMobileActionsComponent, selector: "sd-table-mobile-actions", inputs: ["actions", "title", "selection", "count", "autoOpen", "autoId"], outputs: ["end"] }], animations: [
|
|
4859
5388
|
trigger('detailExpand', [
|
|
4860
5389
|
state('collapsed', style({ height: '0', minHeight: '0', visibility: 'hidden' })),
|
|
4861
5390
|
state('expanded', style({ height: '*', visibility: 'visible' })),
|
|
@@ -4873,6 +5402,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
4873
5402
|
]),
|
|
4874
5403
|
], host: {
|
|
4875
5404
|
'[attr.data-autoid]': 'autoId()',
|
|
5405
|
+
tabindex: '0',
|
|
4876
5406
|
'[attr.data-loading]': 'loading() ? "true" : "false"',
|
|
4877
5407
|
}, providers: [
|
|
4878
5408
|
DatePipe,
|
|
@@ -4895,6 +5425,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
4895
5425
|
MatTableModule,
|
|
4896
5426
|
MatSortModule,
|
|
4897
5427
|
MatProgressSpinnerModule,
|
|
5428
|
+
MatButtonModule,
|
|
4898
5429
|
MatCheckboxModule,
|
|
4899
5430
|
MatRadioModule,
|
|
4900
5431
|
DragDropModule,
|
|
@@ -4908,23 +5439,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
4908
5439
|
MobileFilterComponent,
|
|
4909
5440
|
SdGroupPipe,
|
|
4910
5441
|
SdTreePipe,
|
|
4911
|
-
SdSelectionVisiblePipe,
|
|
4912
5442
|
SdSafeHtmlPipe,
|
|
4913
|
-
SdSelectionDisabledPipe,
|
|
4914
5443
|
SdScrollDirective,
|
|
4915
|
-
SdDesktopDirective,
|
|
4916
|
-
SdMobileDirective,
|
|
4917
5444
|
SdHoverCopyDirective,
|
|
4918
5445
|
SelectorActionComponent,
|
|
4919
5446
|
StickyShadowDirective,
|
|
4920
5447
|
SdColumnResizeDirective,
|
|
5448
|
+
SdTableSortHeaderDirective,
|
|
4921
5449
|
SdTranslatePipe,
|
|
4922
|
-
], template: "@let _configuration = configuration();\n@let _tableOption = tableOption()!;\n@let _loading = loading();\n@let _items = items();\n@let _total = total();\n@let _isFiltered = isFiltered();\n@let _requireFiltered = requireFiltered();\n@let _export = _tableOption?.export;\n@let _exporting = exporting();\n@let _titleDef = titleDef();\n@let _autoId = autoId();\n@let _exportTitle = exportTitle();\n@let _cellDef = cellDef();\n@let _footerDef = footerDef();\n@let _sdSubInformation = sdSubInformation();\n@let _configComponent = configComponent();\n@let _mobileFilter = mobileFilter();\n@let _selectedTableItems = selectedTableItems();\n@let _rowCommands = rowCommands();\n<!-- why: tree kh\u00F4ng c\u00F2n c\u1ED9t ri\u00EAng \u2014 khi KH\u00D4NG c\u00F3 c\u1ED9t Index, icon expand nh\u00FAng v\u00E0o\n c\u1ED9t data \u0111\u1EA7u ti\u00EAn. \u0110\u00E2y l\u00E0 field c\u1EE7a c\u1ED9t \u0111\u00F3 (null n\u1EBFu c\u00F3 Index ho\u1EB7c kh\u00F4ng tree). -->\n@let _treeFirstField = _tableOption?.tree && !_tableOption.index?.enabled ? _configuration?.firstColumns?.[0]?.field : null;\n\n@if (_configuration) {\n @if (!_tableOption.filter?.disabled && !!_tableOption.filter?.externalFilters?.length && filterRegister) {\n <external-filter\n class=\"mb-16\"\n [autoId]=\"_autoId\"\n [filterRegister]=\"filterRegister\"\n [filter]=\"_tableOption.filter!\"\n [externalFilters]=\"_tableOption.filter?.externalFilters!\">\n </external-filter>\n }\n @let groupedItems = _items | sdTree: _tableOption.tree : treeRevision() | sdGroup: _tableOption : groupExpandState : groupHost;\n\n <!-- Tree toggle d\u00F9ng chung: indent (theo c\u1EA5p) + slot chevron/spinner. Nh\u00FAng v\u00E0o\n c\u1ED9t Index ho\u1EB7c c\u1ED9t data \u0111\u1EA7u qua *ngTemplateOutlet (context: { row }). -->\n <ng-template #sdTreeToggle let-row=\"row\">\n @let _tree = row?.meta?.tree;\n @if (_tree) {\n <span class=\"sd-tree-indent\" [style.width.px]=\"(_tree.level ?? 0) * (_tableOption.tree?.indentSize ?? 20)\"></span>\n <span class=\"sd-tree-toggle-slot\">\n @if (_tree.hasChildren) {\n @if (_tree.isExpanding) {\n <span class=\"lds-ring sd-tree-spinner\">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </span>\n } @else {\n @let _aid = _autoId;\n <button\n type=\"button\"\n class=\"sd-tree-toggle-btn\"\n [attr.data-autoid]=\"_aid ? _aid + '-tree-toggle-' + row.meta.id : null\"\n (click)=\"onTreeToggle(row); $event.stopPropagation()\">\n <sd-icon [name]=\"_tree.isExpanded ? 'expand_more' : 'chevron_right'\"></sd-icon>\n </button>\n }\n }\n </span>\n }\n </ng-template>\n\n <ng-content select=\"[sdTableTop]\"></ng-content>\n <div class=\"c-container\">\n <!-- why: b\u1EA3ng t\u1EA3i d\u1EEF li\u1EC7u B\u1EA4T \u0110\u1ED2NG B\u1ED8 nh\u01B0ng tr\u01B0\u1EDBc \u0111\u00E2y ch\u1EC9 c\u00F3 spinner thu\u1EA7n h\u00ECnh \u1EA3nh \u2014 screen\n reader kh\u00F4ng \u0111\u01B0\u1EE3c b\u00E1o g\u00EC c\u1EA3. role=\"status\" + aria-live=\"polite\" \u0111\u1ECDc tr\u1EA1ng th\u00E1i ngay khi\n spinner xu\u1EA5t hi\u1EC7n; aria-busy tr\u00EAn v\u00F9ng b\u1EA3ng cho bi\u1EBFt n\u1ED9i dung \u0111ang \u0111\u01B0\u1EE3c thay th\u1EBF. -->\n @if (_loading) {\n <div class=\"c-loading\" role=\"status\" aria-live=\"polite\" [attr.aria-label]=\"'core.component.table.loading' | sdTranslate\">\n <mat-spinner></mat-spinner>\n </div>\n }\n <div\n class=\"c-table\"\n sdScroll\n stickyShadow\n [attr.aria-busy]=\"_loading ? 'true' : null\"\n [style.max-height]=\"_tableOption.style?.maxHeight\"\n [style.min-height]=\"_tableOption.style?.minHeight\">\n <table\n mat-table\n [dataSource]=\"groupedItems\"\n [trackBy]=\"trackBy\"\n matSort\n [matSortDisabled]=\"!_tableOption.sort?.enable\"\n multiTemplateDataRows\n cdkDropList\n [cdkDropListData]=\"groupedItems\"\n [cdkDropListDisabled]=\"!_tableOption.rowReorder?.enabled\"\n [cdkDropListSortPredicate]=\"reorderSortPredicate\"\n (cdkDropListDropped)=\"onReorderDrop($event)\">\n @if (_tableOption.rowReorder?.enabled) {\n <ng-container matColumnDef=\"sdReorder\">\n <th mat-header-cell *matHeaderCellDef class=\"sd-reorder-header\" [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\"></th>\n <td mat-cell *matCellDef=\"let row\" class=\"sd-reorder-cell\">\n @if (!row.meta?.group?.items?.length) {\n <sd-icon cdkDragHandle [class.sd-reorder-disabled]=\"isReorderDisabled(row)\" [name]=\"_tableOption.rowReorder?.icon || 'drag_indicator'\"></sd-icon>\n }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n }\n\n <ng-container matColumnDef=\"sdSubInformation\" sticky>\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\" [attr.colspan]=\"_configuration.displayedColumns.length\">\n @if (_sdSubInformation?.templateRef) {\n @if (_tableOption.expand?.always) {\n <ng-container *ngTemplateOutlet=\"_sdSubInformation?.templateRef!; context: { item: item }\"> </ng-container>\n } @else {\n <div [@detailExpand]=\"item.isExpanded ? 'expanded' : 'collapsed'\">\n @if (item.isExpanded) {\n <ng-container *ngTemplateOutlet=\"_sdSubInformation?.templateRef!; context: { item: item }\"> </ng-container>\n }\n </div>\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n\n <ng-container matColumnDef=\"sdSubInformationAction\" stickyEnd>\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\" [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\"></th>\n <td mat-cell *matCellDef=\"let element\">\n @if (!element.isExpanding && !_tableOption.expand?.always) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-expand-' + element.meta.id : null\"\n type=\"text\"\n [prefixIcon]=\"element.isExpanded ? 'expand_less' : 'expand_more'\"\n (click)=\"onExpand(element)\"\n width=\"35px\">\n </sd-button>\n }\n @if (element.isExpanding) {\n <div class=\"lds-ring\">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n }\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"sdSelection\" sticky>\n <th class=\"sd-selection-cell p-0\" mat-header-cell *matHeaderCellDef [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\">\n @if (visibleSelectAll()) {\n <mat-checkbox\n class=\"c-selection px-8\"\n color=\"primary\"\n [ngModel]=\"isSelectAll()\"\n (ngModelChange)=\"isSelectAll.set($event)\"\n (change)=\"onSelectAll()\">\n </mat-checkbox>\n }\n </th>\n\n <td class=\"sd-selection-cell p-0\" mat-cell *matCellDef=\"let item\">\n @let visible = item | selectionVisible: _tableOption.selector;\n @if (visible) {\n @if (_tableOption.selector?.single) {\n <mat-radio-button\n class=\"c-selection px-8\"\n color=\"primary\"\n [checked]=\"item.meta.selector.isSelected\"\n (change)=\"item.meta.selector.isSelected = true; onSelect(item)\"\n [disabled]=\"_selectedTableItems | selectionDisabled: item : _tableOption.selector!\">\n </mat-radio-button>\n } @else {\n <mat-checkbox\n class=\"c-selection px-8\"\n color=\"primary\"\n [(ngModel)]=\"item.meta.selector.isSelected\"\n (change)=\"onSelect(item)\"\n [disabled]=\"_selectedTableItems | selectionDisabled: item : _tableOption.selector!\">\n </mat-checkbox>\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n @if (_tableOption.index?.enabled) {\n @let _pageOffset = pageOffset();\n @let _indexWidth = _tableOption.index?.width || '50px';\n <!-- why: khi tree, c\u1ED9t Index \"\u00F4m\" th\u00EAm chevron + indent. D\u00F9ng width:1px +\n nowrap (.sd-tree-index-cell) \u0111\u1EC3 c\u1ED9t co S\u00C1T n\u1ED9i dung, kh\u00F4ng chi\u1EBFm ch\u1ED7\n th\u1EEBa; header \"#\" canh tr\u00E1i l\u00F9i v\u00E0o (.sd-tree-index-header) cho th\u1EB3ng s\u1ED1. -->\n @let _treeIndex = !!_tableOption.tree;\n <ng-container matColumnDef=\"sdIndex\" sticky>\n <th\n [class.p-0]=\"!_treeIndex\"\n [class.text-center]=\"!_treeIndex\"\n [class.sd-tree-index-cell]=\"_treeIndex\"\n [class.sd-tree-index-header]=\"_treeIndex\"\n mat-header-cell\n *matHeaderCellDef\n [style.width]=\"_treeIndex ? '1px' : _indexWidth\"\n [style.min-width]=\"_treeIndex ? null : _indexWidth\"\n [style.max-width]=\"_treeIndex ? null : _indexWidth\"\n [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\">\n {{ _tableOption.index?.title || '#' }}\n </th>\n <td\n [class.px-4]=\"!_treeIndex\"\n [class.text-center]=\"!_treeIndex\"\n [class.sd-tree-index-cell]=\"_treeIndex\"\n mat-cell\n *matCellDef=\"let item; let i = dataIndex\"\n [style.width]=\"_treeIndex ? '1px' : null\"\n [style.min-width]=\"_treeIndex ? null : _indexWidth\"\n [style.max-width]=\"_treeIndex ? null : _indexWidth\">\n @if (!item?.meta?.group?.isGroupHeader) {\n @if (_treeIndex) {\n <!-- why: tree \u2192 chevron + indent + STT ph\u00E2n c\u1EA5p (1, 1.2, 1.2.1). T\u00F4 \u0111\u1EADm root (level 0). -->\n <span class=\"sd-tree-line\">\n <ng-container *ngTemplateOutlet=\"sdTreeToggle; context: { row: item }\"></ng-container>\n @if (item?.meta?.tree?.indexPath?.length) {\n <span class=\"sd-tree-stt\" [class.sd-stt-root]=\"(item.meta.tree.level ?? 0) === 0\">\n {{ item.meta.tree.indexPath.join('.') }}\n </span>\n }\n </span>\n } @else {\n {{ _pageOffset + i + 1 }}\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef [style.width]=\"_treeIndex ? '1px' : null\" [style.min-width]=\"_treeIndex ? null : _indexWidth\" [style.max-width]=\"_treeIndex ? null : _indexWidth\"></td>\n </ng-container>\n }\n <ng-container\n matColumnDef=\"sdCommand\"\n [sticky]=\"_tableOption.command?.align !== 'right'\"\n [stickyEnd]=\"_tableOption.command?.align === 'right'\">\n <!-- why: \u00F4 header c\u1EE7a c\u1ED9t command v\u1ED1n \u0111\u1EC3 tr\u1ED1ng. Cho consumer chi\u1EBFm ch\u1ED7 \u0111\u00F3 b\u1EB1ng\n `sdTableCommandHeaderDef` (th\u01B0\u1EDDng l\u00E0 n\u00FAt th\u00EAm d\u00F2ng) th\u00EC h\u00E0nh \u0111\u1ED9ng c\u1EA5p b\u1EA3ng n\u1EB1m ngay\n tr\u00EAn c\u1EE5m n\u00FAt c\u1EE7a t\u1EEBng d\u00F2ng, thay v\u00EC ph\u1EA3i d\u1EF1ng th\u00EAm m\u1ED9t d\u1EA3i ri\u00EAng d\u01B0\u1EDBi b\u1EA3ng. -->\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 50px\" [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\">\n @if (sdCommandHeaderDef(); as _commandHeaderDef) {\n <div class=\"sd-command-header d-flex align-items-center justify-content-center\">\n <ng-container *ngTemplateOutlet=\"_commandHeaderDef.templateRef\"></ng-container>\n </div>\n }\n </th>\n <!-- why: `dataIndex` do CDK c\u1EA5p s\u1EB5n. B\u1EA3n c\u0169 d\u00F9ng `groupedItems.indexOf(item)` \u2014\n qu\u00E9t to\u00E0n m\u1EA3ng cho M\u1ED6I d\u00F2ng render \u1EDF M\u1ED6I CD pass (O(n\u00B2) tr\u00EAn \u0111\u01B0\u1EDDng render),\n v\u00E0 c\u00F2n tr\u1EA3 sai index khi 2 d\u00F2ng tr\u00F9ng reference. -->\n <td class=\"px-8\" mat-cell *matCellDef=\"let item; let i = dataIndex\">\n <desktop-command [autoId]=\"_autoId\" [commands]=\"_rowCommands\" [item]=\"item\" [itemIndex]=\"i\"></desktop-command>\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n <!-- why: group header row d\u00F9ng matRowDef RI\u00CANG v\u1EDBi column list ['sdGroupHeader']\n qua predicate when:isGroupHeaderRow. Cell colspan = displayedColumns.length \u0111\u1EC3\n span TO\u00C0N B\u1ED8 width data row. Tr\u00E1nh colspan trick overflow row khi c\u00E1c TD kh\u00E1c render. -->\n <ng-container matColumnDef=\"sdGroupHeader\">\n <td\n class=\"p-0 sd-group-header-cell\"\n mat-cell\n *matCellDef=\"let item\"\n [attr.colspan]=\"sdGroupColspan()\">\n <div class=\"sd-group-row d-flex align-items-center py-8\">\n <!-- why: slot 42px kh\u1EDBp width v\u1EDBi sd-selection-cell data row \u2192 checkbox group c\u0103n TR\u1EE4C d\u1ECDc \u0111\u00FAng v\u1EDBi checkbox data. -->\n @if (_tableOption.selector?.visible && !_tableOption.selector?.single) {\n <div class=\"sd-group-selection-slot d-flex align-items-center justify-content-center\">\n <!-- why: PH\u1EA2I t\u00EDnh live, KH\u00D4NG \u0111\u1ECDc cache tr\u00EAn meta.group. `selector.selectable`\n m\u1EB7c \u0111\u1ECBnh l\u00E0 `false` (table-item.model.ts) v\u00E0 ch\u1EC9 \u0111\u01B0\u1EE3c `SdSelectionVisiblePipe`\n \u0111\u1EB7t \u0111\u00FAng khi cell BODY render \u2014 m\u00E0 CDK d\u1EF1ng header TR\u01AF\u1EDAC body. Cache do\n `SdGroupPipe` ghi l\u00FAc d\u1EF1ng header v\u00EC th\u1EBF lu\u00F4n th\u1EA5y `total = 0` v\u00E0 kho\u00E1 c\u1EE9ng\n checkbox \u1EDF tr\u1EA1ng th\u00E1i b\u1ECF ch\u1ECDn, k\u1EC3 c\u1EA3 khi defaultSelected/preserveSelection\n v\u1EEBa ch\u1ECDn h\u1EBFt. Pipe l\u00E0 pure n\u00EAn gi\u00E1 tr\u1ECB \u0111\u00F3 kh\u00F4ng bao gi\u1EDD t\u1EF1 s\u1EEDa.\n Ch\u1EC9 c\u00F3 M\u1ED8T group header m\u1ED7i group (kh\u00F4ng ph\u1EA3i m\u1ED7i row) n\u00EAn chi ph\u00ED duy\u1EC7t \u1EDF\n \u0111\u00E2y nh\u1ECF; ph\u1EA7n \u0111\u1EAFt (d\u1EF1ng object context + map data) v\u1EABn \u0111\u01B0\u1EE3c cache. -->\n <mat-checkbox\n class=\"c-selection\"\n color=\"primary\"\n [checked]=\"isGroupAllSelected(item)\"\n [indeterminate]=\"isGroupIndeterminate(item)\"\n (change)=\"onSelectGroup(item, $event.checked)\">\n </mat-checkbox>\n </div>\n } @else {\n <div class=\"sd-group-selection-slot\"></div>\n }\n @if (_tableOption.group?.collapsible) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-group-toggle-' + (item.meta.group?.key || item.meta.id) : null\"\n type=\"text\"\n [prefixIcon]=\"item.meta.group.isExpanded ? 'expand_more' : 'chevron_right'\"\n width=\"32px\"\n (click)=\"toggleGroupExpand(item)\">\n </sd-button>\n }\n @if (sdGroupDef()?.templateRef; as tpl) {\n <!-- why: groupContext() gi\u1EDD tr\u1EA3 context \u0111\u00E3 precompute tr\u00EAn meta.group (c\u00F9ng\n m\u1ED9t reference qua m\u1ECDi CD pass). B\u1EA3n c\u0169 d\u1EF1ng object m\u1EDBi + m\u1EA3ng\n `items.map(i => i.data)` m\u1EDBi m\u1ED7i pass \u2192 ngTemplateOutlet ph\u1EA3i d\u1EF1ng l\u1EA1i\n embedded view c\u1EE7a m\u1ECDi group row. -->\n <ng-container *ngTemplateOutlet=\"tpl; context: groupContext(item)\"></ng-container>\n } @else {\n <span class=\"T14R\">{{ item.meta.group.values | json }}</span>\n }\n </div>\n </td>\n </ng-container>\n <!-- why: filler column \u1EDF cu\u1ED1i h\u1EA5p th\u1EE5 leftover space khi t\u1ED5ng width c\u00E1c c\u1ED9t data < container \u2014 gi\u1EEF cho selection/STT/command kh\u00F4ng b\u1ECB d\u00E3n. -->\n <ng-container matColumnDef=\"sdFiller\">\n <th class=\"sd-filler-cell p-0\" mat-header-cell *matHeaderCellDef [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\"></th>\n <td class=\"sd-filler-cell p-0\" mat-cell *matCellDef=\"let item\"></td>\n <td class=\"sd-filler-cell p-0\" mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n @for (column of _configuration.firstColumns; track column.field) {\n <ng-container [matColumnDef]=\"column.field\" [sticky]=\"_configuration.fixedColumn[column.field]\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"px-8 py-8 c-th\"\n [sdColumnResize]=\"!!_tableOption.config?.resizable && column.type !== 'children'\"\n [minWidth]=\"column.minWidth\"\n [maxWidth]=\"column.maxWidth\"\n (resizeEnd)=\"onColumnResize(column.field, $event)\"\n [style.width]=\"column.width\"\n [style.min-width]=\"column.minWidth || column.width\"\n [style.max-width]=\"column.maxWidth\"\n [attr.rowspan]=\"_configuration.multipleHeader && column.type !== 'children' ? 2 : 1\"\n [attr.colspan]=\"column.type === 'children' ? column.children.length : 1\">\n <div>\n <!-- why: b\u1ECF aria-hidden=\"true\" kh\u1ECFi header. `mat-sort-header` t\u1EF1 g\u1EAFn role=\"button\",\n tabindex v\u00E0 aria-sort l\u00EAn ch\u00EDnh div n\u00E0y \u2014 aria-hidden khi\u1EBFn header v\u1EABn tab t\u1EDBi\n \u0111\u01B0\u1EE3c nh\u01B0ng kh\u00F4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c t\u00EAn c\u1ED9t l\u1EABn h\u01B0\u1EDBng s\u1EAFp x\u1EBFp, t\u1EE9c ng\u01B0\u1EDDi d\u00F9ng screen\n reader m\u1EA5t ho\u00E0n to\u00E0n kh\u1EA3 n\u0103ng s\u1EAFp x\u1EBFp b\u1EA3ng. -->\n @if (column.type === 'children') {\n <div\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n } @else {\n <div\n mat-sort-header\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\"\n [disabled]=\"!column.sortable\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n @let hideInlineFilter =\n _tableOption.filter?.disabled ||\n _tableOption.filter?.hideInlineFilter === true ||\n (_tableOption.filter?.hideInlineFilter === 'auto' && !_isFiltered && _total! <= 10);\n @if (!hideInlineFilter) {\n <ng-container *sdDesktop>\n <column-filter\n [autoId]=\"_autoId\"\n [value]=\"columnFilter?.[column.field!]!\"\n [operator]=\"columnOperator[column.field]\"\n (operatorChange)=\"columnOperator[column.field] = $event!; onOperatorChange(column, $event)\"\n [columnFilter]=\"columnFilter!\"\n [cacheValues]=\"cacheValues\"\n [column]=\"column\"\n (filterChange)=\"onFilterChange()\"\n (filterCommit)=\"onFilterCommit()\">\n </column-filter>\n </ng-container>\n }\n }\n </div>\n </th>\n <td\n class=\"c-td px-0\"\n [class.d-none]=\"column.type === 'children'\"\n mat-cell\n *matCellDef=\"let item\"\n [sdHoverCopy]=\"(item.data && item.data[column.field]) || ''\"\n [sdHoverCopyDisabled]=\"!column.cell?.copiable\">\n @if (column.type !== 'children' && !item?.meta?.group?.isGroupHeader) {\n @if (_treeFirstField && column.field === _treeFirstField) {\n <!-- why: kh\u00F4ng c\u00F3 c\u1ED9t Index \u2192 chevron + indent nh\u00FAng v\u00E0o c\u1ED9t data \u0111\u1EA7u (nh\u01B0 file explorer). -->\n <span class=\"sd-tree-line px-8\">\n <ng-container *ngTemplateOutlet=\"sdTreeToggle; context: { row: item }\"></ng-container>\n <desktop-cell class=\"d-block\" [column]=\"column\" [item]=\"item\" [cellDef]=\"_cellDef\"></desktop-cell>\n </span>\n } @else {\n <desktop-cell class=\"d-block px-8\" [column]=\"column\" [item]=\"item\" [cellDef]=\"_cellDef\"> </desktop-cell>\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef>\n <ng-container *ngIf=\"_footerDef[column.field]\">\n <ng-container *ngTemplateOutlet=\"_footerDef[column.field].templateRef; context: { items: _items, column: column }\">\n </ng-container>\n </ng-container>\n </td>\n </ng-container>\n }\n @for (column of _configuration.secondColumns; track column.field) {\n <ng-container [matColumnDef]=\"column.field\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"c-th px-8\"\n [style.width]=\"column.width\"\n [style.min-width]=\"column.minWidth || column.width\"\n [style.max-width]=\"column.maxWidth\">\n <div>\n <!-- why: xem ch\u00FA th\u00EDch \u1EDF header nh\u00F3m tr\u00EAn \u2014 mat-sort-header l\u00E0 control th\u1EADt,\n aria-hidden xo\u00E1 t\u00EAn c\u1ED9t + aria-sort kh\u1ECFi accessibility tree. -->\n <div\n mat-sort-header\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\"\n [disabled]=\"!column.sortable\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n @if (!_tableOption.filter?.disabled && !_tableOption.filter?.hideInlineFilter && columnOperator) {\n <ng-container *sdDesktop>\n <column-filter\n [autoId]=\"_autoId\"\n [value]=\"columnFilter?.[column.field!]!\"\n [operator]=\"columnOperator[column.field]\"\n [columnFilter]=\"columnFilter!\"\n [cacheValues]=\"cacheValues\"\n [column]=\"column\"\n (operatorChange)=\"columnOperator[column.field] = $event!; onOperatorChange(column, $event)\"\n (filterChange)=\"onFilterChange()\"\n (filterCommit)=\"onFilterCommit()\">\n </column-filter>\n </ng-container>\n }\n </div>\n </th>\n <td\n class=\"c-td px-0\"\n mat-cell\n *matCellDef=\"let item\"\n [sdHoverCopy]=\"item[column.field]\"\n [sdHoverCopyDisabled]=\"!column.cell?.copiable\">\n @if (column.type !== 'children') {\n <desktop-cell class=\"d-block px-8\" [column]=\"column\" [item]=\"item\" [cellDef]=\"_cellDef\"> </desktop-cell>\n }\n </td>\n <td mat-footer-cell *matFooterCellDef>\n <ng-container *ngIf=\"_footerDef[column.field]\">\n <ng-container *ngTemplateOutlet=\"_footerDef[column.field].templateRef; context: { items: _items, column: column }\">\n </ng-container>\n </ng-container>\n </td>\n </ng-container>\n }\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"_configuration.firstHeaders; sticky: true\"></tr>\n @if (!!_configuration.secondHeaders.length) {\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"_configuration.secondHeaders; sticky: true\"></tr>\n }\n <!-- Group header row \u2014 ch\u1EC9 1 cell sdGroupHeader colspan to\u00E0n width. -->\n <tr\n mat-row\n *matRowDef=\"let row; columns: ['sdGroupHeader']; when: isGroupHeaderRow\"\n class=\"c-group-row-tr\"></tr>\n\n <!-- Data row \u2014 d\u00F9ng displayedColumns \u0111\u1EA7y \u0111\u1EE7; when isDataRow \u0111\u1EC3 lo\u1EA1i tr\u1EEB group header. -->\n <!-- why: [ngStyle] \u0111\u1ECDc meta.rowStyle \u2014 style.rowCss \u0111\u00E3 \u0111\u01B0\u1EE3c resolve 1 l\u1EA7n m\u1ED7i l\u1EA7n\n render. B\u1EA3n c\u0169 g\u1ECDi rowStyle(row) ngay trong binding \u2192 ch\u1EA1y callback c\u1EE7a consumer\n cho T\u1EEANG d\u00F2ng \u1EDF M\u1ED6I CD pass, v\u00E0 v\u00EC tr\u1EA3 object M\u1EDAI n\u00EAn NgStyle ph\u1EA3i ch\u1EA1y l\u1EA1i\n KeyValueDiffer tr\u00EAn m\u1ECDi d\u00F2ng \u1EDF m\u1ECDi pass. -->\n <tr\n mat-row\n cdkDrag\n [cdkDragData]=\"row\"\n [cdkDragDisabled]=\"\n !_tableOption.rowReorder?.enabled ||\n !!row.meta?.group?.items?.length ||\n (row.meta?.tree?.level ?? 0) > 0 ||\n isReorderDisabled(row)\n \"\n *matRowDef=\"let row; columns: _configuration.displayedColumns; when: isDataRow\"\n matRipple\n class=\"c-row\"\n [class.sd-tree-row]=\"!!_tableOption.tree\"\n [ngClass]=\"_tableOption.tree ? 'sd-tree-level-' + (row.meta?.tree?.level ?? 0) : null\"\n [ngStyle]=\"row.meta.rowStyle\"\n [class.selected]=\"row.meta.selector.isSelected\"></tr>\n\n <!-- Sub-information row \u2014 also gated b\u1EDFi isDataRow \u0111\u1EC3 KH\u00D4NG render empty expand row d\u01B0\u1EDBi group header. -->\n <tr mat-row *matRowDef=\"let row; columns: ['sdSubInformation']; when: isDataRow\" class=\"c-detail-row\"></tr>\n @if (hasFooter() && !!_configuration.displayedFooters.length) {\n <tr mat-footer-row *matFooterRowDef=\"_configuration.displayedFooters; sticky: true\"></tr>\n }\n </table>\n <!-- why: tr\u1EA1ng th\u00E1i r\u1ED7ng c\u0169ng xu\u1EA5t hi\u1EC7n B\u1EA4T \u0110\u1ED2NG B\u1ED8 sau khi fetch xong; kh\u00F4ng c\u00F3 live region\n th\u00EC ng\u01B0\u1EDDi d\u00F9ng screen reader ch\u1EDD m\u00E3i m\u00E0 kh\u00F4ng bi\u1EBFt b\u1EA3ng \u0111\u00E3 tr\u1EA3 v\u1EC1 0 d\u00F2ng. -->\n @if (!_loading && !_total) {\n <div class=\"c-no-data-row\" role=\"status\" aria-live=\"polite\">\n @if (_isFiltered) {\n @if (tableConfiguration?.images?.filterEmpty) {\n <img class=\"c-image\" [src]=\"tableConfiguration!.images!.filterEmpty\" alt=\"filter-empty\" />\n } @else {\n <img class=\"c-image sd-image-filter-empty\" alt=\"filter-empty\" />\n }\n <div class=\"T16M\">{{ 'core.component.table.no-results' | sdTranslate }}</div>\n <div class=\"T16R text-secondary\">{{ 'core.component.table.no-results-hint' | sdTranslate }}</div>\n } @else {\n @if (_requireFiltered) {\n @if (tableConfiguration?.images?.filterRequired) {\n <img class=\"c-image\" [src]=\"tableConfiguration!.images!.filterRequired\" alt=\"filter-required\" />\n } @else {\n <img class=\"c-image sd-image-filter-required\" alt=\"filter-required\" />\n }\n <div class=\"T16R text-secondary\">{{ 'core.component.table.choose-filter-hint' | sdTranslate }}</div>\n } @else {\n @if (tableConfiguration?.images?.dataEmpty) {\n <img class=\"c-image\" [src]=\"tableConfiguration!.images!.dataEmpty\" alt=\"data-empty\" />\n } @else {\n <img class=\"c-image sd-image-data-empty\" alt=\"data-empty\" />\n }\n <div class=\"T16R text-secondary\">{{ 'core.component.table.no-data' | sdTranslate }}</div>\n }\n }\n </div>\n }\n </div>\n <div class=\"c-paginator\">\n <div class=\"c-action\">\n <ng-container *sdDesktop>\n @if (_tableOption.reload?.visible) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-reload' : null\"\n class=\"mr-8\"\n [title]=\"'core.component.table.reload' | sdTranslate\"\n prefixIcon=\"refresh\"\n (click)=\"reload()\"\n type=\"text\">\n </sd-button>\n }\n </ng-container>\n @if (_export && _items.length) {\n @if (_export.type === 'custom') {\n <sd-button [autoId]=\"_autoId ? _autoId + '-export' : null\" class=\"mr-8\" [title]=\"_exportTitle\" prefixIcon=\"get_app\" (click)=\"exportCustom()\" type=\"text\"> </sd-button>\n } @else {\n @if (_export.visible) {\n @if (_exporting) {\n <sd-button [autoId]=\"_autoId ? _autoId + '-export' : null\" class=\"mr-8\" [loading]=\"_exporting\" [title]=\"_exportTitle\" prefixIcon=\"get_app\" type=\"text\"> </sd-button>\n } @else {\n @if (_export.visible === 'ALL' || !_export.visible) {\n <sd-button [autoId]=\"_autoId ? _autoId + '-export' : null\" class=\"mr-8\" [title]=\"_exportTitle\" prefixIcon=\"get_app\" [matMenuTriggerFor]=\"menu\" type=\"text\"> </sd-button>\n <mat-menu #menu=\"matMenu\">\n <button mat-menu-item [attr.data-autoid]=\"_autoId ? _autoId + '-export-excel' : null\" (click)=\"exportExcel()\" type=\"button\">\n <sd-icon name=\"file_download\"></sd-icon>\n <span> {{ 'core.component.table.export-excel' | sdTranslate }}</span>\n </button>\n <button mat-menu-item [attr.data-autoid]=\"_autoId ? _autoId + '-export-csv' : null\" (click)=\"exportCSV()\" type=\"button\">\n <sd-icon name=\"file_download\"></sd-icon>\n <span> {{ 'core.component.table.export-csv' | sdTranslate }}</span>\n </button>\n </mat-menu>\n } @else if (_export.visible === 'EXCEL') {\n <sd-button [autoId]=\"_autoId ? _autoId + '-export-excel' : null\" class=\"mr-8\" [title]=\"_exportTitle\" prefixIcon=\"get_app\" (click)=\"exportExcel()\" type=\"text\"> </sd-button>\n } @else if (_export.visible === 'CSV') {\n <sd-button [autoId]=\"_autoId ? _autoId + '-export-csv' : null\" class=\"mr-8\" [title]=\"_exportTitle\" prefixIcon=\"get_app\" (click)=\"exportCSV()\" type=\"text\"> </sd-button>\n }\n }\n }\n }\n }\n\n <ng-container *sdDesktop>\n @if (_configComponent) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-config' : null\"\n class=\"mr-8\"\n [title]=\"'core.component.table.setup-short' | sdTranslate\"\n prefixIcon=\"settings\"\n (click)=\"_configComponent.open()\"\n type=\"text\">\n </sd-button>\n }\n </ng-container>\n <!-- Mobile: n\u00FAt Filter m\u1EDF mobile-filter drawer (inline filter \u1EA9n tr\u00EAn mobile) -->\n <ng-container *sdMobile>\n @if (!_tableOption.filter?.disabled && _mobileFilter) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-mobile-filter-open' : null\"\n class=\"mr-8\"\n prefixIcon=\"filter_alt\"\n (click)=\"_mobileFilter.open()\"\n type=\"text\">\n </sd-button>\n }\n </ng-container>\n </div>\n @let hidePaginator = !_tableOption.paginate?.pageSize || _total === undefined || _total <= _tableOption.paginate?.pageSize!;\n <!-- Desktop paginator: full config (pageSize dropdown, first/last buttons) -->\n <ng-container *sdDesktop>\n <mat-paginator\n [class.d-none]=\"_tableOption.paginate?.hidden || hidePaginator\"\n [length]=\"_total\"\n [pageSize]=\"_tableOption.paginate?.pageSize\"\n [pageSizeOptions]=\"_tableOption.paginate?.pages!\"\n [showFirstLastButtons]=\"_tableOption.paginate?.showFirstLastButtons\"\n [hidePageSize]=\"_tableOption.paginate?.hidePageSize\"></mat-paginator>\n </ng-container>\n <!-- Mobile paginator: \u1EA9n pageSize dropdown + first/last buttons \u0111\u1EC3 ti\u1EBFt ki\u1EC7m kh\u00F4ng gian -->\n <ng-container *sdMobile>\n <mat-paginator\n [class.d-none]=\"_tableOption.paginate?.hidden || hidePaginator\"\n [length]=\"_total\"\n [pageSize]=\"_tableOption.paginate?.pageSize\"\n [showFirstLastButtons]=\"false\"\n hidePageSize></mat-paginator>\n </ng-container>\n <!-- \"\u0110ang hi\u1EC3n th\u1ECB...\" ch\u1EC9 desktop -->\n <ng-container *sdDesktop>\n @if (!_tableOption.paginate?.hidden && hidePaginator && _total !== undefined && _total > 0) {\n <div class=\"T14R c-summary\">\n {{ 'core.component.table.showing' | sdTranslate }} <span class=\"T14M ml-2\">1-{{ _total }}/{{ _total }}</span>\n </div>\n }\n </ng-container>\n </div>\n </div>\n <selector-action [autoId]=\"_autoId\" [tableOption]=\"_tableOption\" [selectedTableItems]=\"_selectedTableItems\" (clear)=\"onClearSelection(groupedItems)\" />\n @if (_tableOption.config?.visible) {\n <config [autoId]=\"_autoId\" [tableOption]=\"_tableOption\" />\n }\n <!-- Mobile filter drawer \u2014 ch\u1EC9 instantiate khi c\u1EA7n render tr\u00EAn mobile -->\n @if (!_tableOption.filter?.disabled && filterRegister) {\n <mobile-filter\n [autoId]=\"_autoId\"\n [filter]=\"_tableOption.filter!\"\n [externalFilters]=\"_tableOption.filter?.externalFilters!\"\n [columns]=\"_configuration.firstColumns\"\n [filterDefs]=\"sdFilterDefs()\"\n [filterRegister]=\"filterRegister\"\n [cacheValues]=\"cacheValues\">\n </mobile-filter>\n }\n}\n", styles: [":host{display:flex;flex-direction:column;overflow:auto;width:100%;height:100%}:host .c-header-title{height:40px;display:flex;align-items:center}:host .c-container{position:relative;min-height:50px;display:flex;flex-direction:column;flex:1}:host .c-container .c-table{position:relative;flex:1;display:flex;flex-direction:column}:host .c-container .c-table table{border-collapse:separate;width:100%}:host .c-container .c-table table tr.c-first-header.mat-mdc-header-row{height:40px}:host .c-container .c-table table tr.c-second-header.mat-mdc-header-row{height:40px}:host .c-container .c-table table tr.c-detail-row{height:0}:host .c-container .c-table table tr.c-row.activated{background-color:#e5ecff}:host .c-container .c-table table tr.c-row.selected{background-color:#eef2ff}:host .c-container .c-table table tr.c-row:not(.selected):not(.activated):hover{background-color:#f5f5f5}:host .c-container .c-table table tr.c-row td{border-bottom-width:0}:host .c-container .c-table table tr.c-row.c-expandable{cursor:pointer}:host .c-container .c-table table tr.c-row.c-expandable:hover{background:#f5f5f5}:host .c-container .c-table table th.mat-mdc-header-cell{background-color:#f2f3f4;border-bottom:0!important}:host .c-container .c-table table td.mat-mdc-cell,:host .c-container .c-table table td.mat-mdc-footer-cell,:host .c-container .c-table table th.mat-mdc-header-cell{border-bottom-color:#f2f2f2!important}:host .c-container .c-table .c-th{vertical-align:middle;font-weight:500;font-size:14px;line-height:20px;color:#212121}:host .c-container .c-table .c-th.sd-col-resize-host{position:relative}:host .c-container .c-table .c-th.sd-resizing{-webkit-user-select:none;user-select:none}:host .c-container .c-table .c-th .sd-col-resize-handle{position:absolute;top:0;right:0;width:6px;height:100%;cursor:col-resize;-webkit-user-select:none;user-select:none;z-index:2}:host .c-container .c-table .c-th .sd-col-resize-handle:hover{background:#00000014}:host .c-container .c-table .c-td:first{padding-left:10px}:host .c-container .c-table .c-no-data-row{flex:1;width:100%;position:sticky;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center}:host .c-container .c-table .c-no-data-row .c-image{margin-bottom:16px;width:96px}:host .c-container .c-loading{position:absolute;inset:0 0 56px;background:#00000026;z-index:2;display:flex;align-items:center;justify-content:center}:host .c-container .c-paginator{display:flex;flex-direction:row;justify-content:space-between;align-items:center;background-color:#fff}:host .c-container .c-paginator .mat-mdc-paginator{background:transparent;--mat-paginator-container-size: 40px;--mdc-icon-button-state-layer-size: 32px;--mdc-icon-button-icon-size: 20px}:host .c-container .c-paginator .c-action{padding:0}:host .c-container .c-paginator .c-action sd-button{margin:8px 5px}:host .c-container .c-paginator .c-summary{padding:8px 16px}:host .c-container .c-empty{text-align:center;background-color:#fff;border:none!important}:host .c-container .c-empty sd-icon{font-size:150px;margin-top:30px;margin-bottom:30px;opacity:.2;width:auto;height:auto}:host button.c-btn-add{background-color:#fff;box-shadow:0 2px 4px #2f313629}:host .lds-ring{display:inline-block;position:relative;width:40px;height:40px}:host .lds-ring div{box-sizing:border-box;display:block;position:absolute;width:32px;height:32px;margin:4px;border:4px solid #cef;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#cef transparent transparent transparent}:host .lds-ring div:nth-child(1){animation-delay:-.45s}:host .lds-ring div:nth-child(2){animation-delay:-.3s}:host .lds-ring div:nth-child(3){animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host .sd-reorder-header,:host .sd-reorder-cell{width:40px;min-width:40px;padding:0 4px;box-sizing:border-box}:host .sd-reorder-cell sd-icon{cursor:grab;color:#00000061;display:flex;align-items:center}:host .sd-reorder-cell sd-icon:active{cursor:grabbing}:host .sd-reorder-cell sd-icon.sd-reorder-disabled{opacity:.3;cursor:not-allowed;pointer-events:none}:host ::ng-deep .mat-sort-header-content{display:block;text-align:left;width:100%}:host ::ng-deep .mat-select-arrow{color:#a6a6a6}:host ::ng-deep .mat-sort-header-disabled{background-image:none!important;cursor:default!important;padding-right:0!important}:host ::ng-deep .mat-sort-header-container{align-items:start!important}:host ::ng-deep .mat-sort-header-arrow{margin-top:4px!important}:host ::ng-deep .mat-sort-header-arrow{display:none!important}:host ::ng-deep .mat-sort-header{cursor:pointer}:host ::ng-deep .mat-sort-header[aria-sort]{background-repeat:no-repeat;background-position:center right 0;background-size:16px 16px;cursor:pointer;padding-right:24px}:host ::ng-deep .mat-sort-header[aria-sort=none]{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z'/%3E%3C/svg%3E\")}:host ::ng-deep .mat-sort-header[aria-sort=ascending]{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z'/%3E%3C/svg%3E\")}:host ::ng-deep .mat-sort-header[aria-sort=descending]{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z'/%3E%3C/svg%3E\")}:host ::ng-deep .c-paginator .mat-mdc-paginator .mdc-text-field--outlined .mat-mdc-form-field-infix,:host ::ng-deep .c-paginator .mat-mdc-paginator .mdc-text-field--no-label .mat-mdc-form-field-infix{padding-top:2px;padding-bottom:2px;min-height:32px}:host ::ng-deep .c-paginator .mat-mdc-paginator-range-label{margin:0 4px}:host ::ng-deep .c-paginator .mat-mdc-paginator-page-size-select mat-select{margin-top:2px!important}:host ::ng-deep .cdk-drag-preview{box-shadow:0 4px 12px #00000026;background:#fff;display:table;width:100%}:host ::ng-deep .cdk-drag-preview td{padding:0 8px;border-bottom:1px solid rgba(0,0,0,.12)}:host ::ng-deep .cdk-drag-placeholder{opacity:0}:host ::ng-deep .cdk-drop-list-dragging tr.c-row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}:host ::ng-deep .sd-selection-cell{width:42px;min-width:42px;max-width:42px}:host ::ng-deep .sd-filler-cell{width:auto;min-width:0;padding:0!important;border:0}:host ::ng-deep .sd-group-header-cell{background:#f5f7fc;border-top:1px solid #e6e9f2;border-bottom:1px solid #e6e9f2}:host ::ng-deep .sd-group-row{min-height:36px}:host ::ng-deep .sd-group-selection-slot{width:42px;min-width:42px;max-width:42px}:host ::ng-deep .c-selection{transform:scale(.85);transform-origin:center}:host ::ng-deep .sd-tree-line{display:inline-flex;align-items:center;min-height:32px}:host ::ng-deep .sd-tree-indent{flex:0 0 auto}:host ::ng-deep .sd-tree-toggle-slot{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px}:host ::ng-deep .sd-tree-toggle-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;background:transparent;border-radius:50%;cursor:pointer;color:var(--sd-text-secondary, #5b6472);transition:background-color .15s ease}:host ::ng-deep .sd-tree-toggle-btn sd-icon{font-size:18px;width:18px;height:18px;line-height:18px}:host ::ng-deep .sd-tree-toggle-btn:hover{background-color:#0f172a14}:host ::ng-deep .sd-tree-spinner{transform:scale(.45)}:host ::ng-deep .sd-tree-stt{margin-left:2px;white-space:nowrap}:host ::ng-deep .sd-tree-index-cell{text-align:left!important;white-space:nowrap;padding-left:8px;padding-right:8px}:host ::ng-deep .sd-tree-index-header{padding-left:32px}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-0{background:#fbfcfe}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-0>td{font-weight:500}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-1{background:#fff}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-2{background:#fafbfd}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-3{background:#f6f8fb}:host ::ng-deep .sd-stt-root{font-weight:700;color:#1f2330}\n", ":host ::ng-deep .sticky-shadow-right{overflow:visible!important}:host ::ng-deep .sticky-shadow-right:after{content:\"\";position:absolute;top:0;right:0;bottom:0;width:8px;transform:translate(100%);background:linear-gradient(to right,rgba(0,0,0,.12),transparent);pointer-events:none}:host ::ng-deep .sticky-shadow-left{overflow:visible!important}:host ::ng-deep .sticky-shadow-left:after{content:\"\";position:absolute;top:0;left:0;bottom:0;width:8px;transform:translate(-100%);background:linear-gradient(to left,rgba(0,0,0,.12),transparent);pointer-events:none}\n"] }]
|
|
5450
|
+
SdTableMobileCardsComponent,
|
|
5451
|
+
SdTableMobileActionsComponent,
|
|
5452
|
+
], template: "@let _visibleSelectAll = visibleSelectAll();\n@let _isSelectIndeterminate = isSelectIndeterminate();\n@let _isSelectAll = isSelectAll();\n@let _configuration = configuration();\n@let _tableOption = tableOption()!;\n@let _loading = loading();\n@let _items = items();\n@let _total = total();\n@let _isFiltered = isFiltered();\n@let _requireFiltered = requireFiltered();\n@let _export = _tableOption?.export;\n@let _exporting = exporting();\n@let _titleDef = titleDef();\n@let _autoId = autoId();\n@let _exportTitle = exportTitle();\n@let _cellDef = cellDef();\n@let _footerDef = footerDef();\n@let _sdSubInformation = sdSubInformation();\n@let _configComponent = configComponent();\n@let _mobileFilter = mobileFilter();\n@let _selectedTableItems = selectedTableItems();\n@let _rowCommands = rowCommands();\n@let _mobileCards = mobileCards();\n@let _isMobile = isMobile();\n@let _commandHeaderDef = sdCommandHeaderDef();\n<!-- why: tree kh\u00F4ng c\u00F2n c\u1ED9t ri\u00EAng \u2014 khi KH\u00D4NG c\u00F3 c\u1ED9t Index, icon expand nh\u00FAng v\u00E0o\n c\u1ED9t data \u0111\u1EA7u ti\u00EAn. \u0110\u00E2y l\u00E0 field c\u1EE7a c\u1ED9t \u0111\u00F3 (null n\u1EBFu c\u00F3 Index ho\u1EB7c kh\u00F4ng tree). -->\n@let _treeFirstField = _tableOption?.tree && !_tableOption.index?.enabled ? _configuration?.firstColumns?.[0]?.field : null;\n\n@if (_configuration) {\n @if (!_mobileCards && !_tableOption.filter?.disabled && !!_tableOption.filter?.externalFilters?.length && filterRegister) {\n <external-filter\n class=\"mb-16\"\n [autoId]=\"_autoId\"\n [filterRegister]=\"filterRegister\"\n [filter]=\"_tableOption.filter!\"\n [externalFilters]=\"_tableOption.filter?.externalFilters!\">\n </external-filter>\n }\n @let groupedItems = _items | sdTree: _tableOption.tree : treeRevision() | sdGroup: _tableOption : groupExpandState : groupHost;\n\n <!-- Tree toggle d\u00F9ng chung: indent (theo c\u1EA5p) + slot chevron/spinner. Nh\u00FAng v\u00E0o\n c\u1ED9t Index ho\u1EB7c c\u1ED9t data \u0111\u1EA7u qua *ngTemplateOutlet (context: { row }). -->\n <ng-template #sdTreeToggle let-row=\"row\">\n @let _tree = row?.meta?.tree;\n @if (_tree) {\n <span class=\"sd-tree-indent\" [style.width.px]=\"(_tree.level ?? 0) * (_tableOption.tree?.indentSize ?? 20)\"></span>\n <span class=\"sd-tree-toggle-slot\">\n @if (_tree.hasChildren) {\n @if (_tree.isExpanding) {\n <span class=\"lds-ring sd-tree-spinner\">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </span>\n } @else {\n @let _aid = _autoId;\n <button\n type=\"button\"\n class=\"sd-tree-toggle-btn\"\n [attr.data-autoid]=\"_aid ? _aid + '-tree-toggle-' + row.meta.id : null\"\n (click)=\"onTreeToggle(row); $event.stopPropagation()\">\n <sd-icon [name]=\"_tree.isExpanded ? 'expand_more' : 'chevron_right'\"></sd-icon>\n </button>\n }\n }\n </span>\n }\n </ng-template>\n\n <ng-template #sdGroupHeader let-item=\"item\">\n <div class=\"sd-group-row d-flex align-items-center py-8\">\n @if (_tableOption.selector?.visible && !_tableOption.selector?.single) {\n <div class=\"sd-group-selection-slot d-flex align-items-center justify-content-center\">\n <mat-checkbox\n class=\"c-selection\"\n color=\"primary\"\n [checked]=\"isGroupAllSelected(item)\"\n [indeterminate]=\"isGroupIndeterminate(item)\"\n (change)=\"onSelectGroup(item, $event.checked)\">\n </mat-checkbox>\n </div>\n } @else {\n <div class=\"sd-group-selection-slot\"></div>\n }\n @if (_tableOption.group?.collapsible) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-group-toggle-' + (item.meta.group?.key || item.meta.id) : null\"\n type=\"text\"\n [prefixIcon]=\"item.meta.group.isExpanded ? 'expand_more' : 'chevron_right'\"\n width=\"32px\"\n (click)=\"toggleGroupExpand(item)\">\n </sd-button>\n }\n @if (sdGroupDef()?.templateRef; as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: groupContext(item)\"></ng-container>\n } @else {\n <span class=\"T14R\">{{ item.meta.group.values | json }}</span>\n }\n </div>\n </ng-template>\n\n <ng-content select=\"[sdTableTop]\"></ng-content>\n <div class=\"c-container\" [class.sd-table-mobile]=\"_mobileCards\">\n <!-- why: b\u1EA3ng t\u1EA3i d\u1EEF li\u1EC7u B\u1EA4T \u0110\u1ED2NG B\u1ED8 nh\u01B0ng tr\u01B0\u1EDBc \u0111\u00E2y ch\u1EC9 c\u00F3 spinner thu\u1EA7n h\u00ECnh \u1EA3nh \u2014 screen\n reader kh\u00F4ng \u0111\u01B0\u1EE3c b\u00E1o g\u00EC c\u1EA3. role=\"status\" + aria-live=\"polite\" \u0111\u1ECDc tr\u1EA1ng th\u00E1i ngay khi\n spinner xu\u1EA5t hi\u1EC7n; aria-busy tr\u00EAn v\u00F9ng b\u1EA3ng cho bi\u1EBFt n\u1ED9i dung \u0111ang \u0111\u01B0\u1EE3c thay th\u1EBF. -->\n @if (_loading) {\n <div class=\"c-loading\" role=\"status\" aria-live=\"polite\" [attr.aria-label]=\"'core.component.table.loading' | sdTranslate\">\n <mat-spinner></mat-spinner>\n </div>\n }\n <div\n class=\"c-table\"\n sdScroll\n stickyShadow\n matSort\n [matSortDisabled]=\"!_tableOption.sort?.enable\"\n [attr.aria-busy]=\"_loading ? 'true' : null\"\n [style.max-height]=\"_tableOption.style?.maxHeight\"\n [style.min-height]=\"_tableOption.style?.minHeight\">\n @if (_mobileCards) {\n @if (_commandHeaderDef) {\n <div class=\"sd-mobile-command-header\"><ng-container *ngTemplateOutlet=\"_commandHeaderDef.templateRef\"></ng-container></div>\n }\n <sd-table-mobile-cards [table]=\"this\" [rows]=\"groupedItems\" [groupTemplate]=\"sdGroupHeader\"></sd-table-mobile-cards>\n @if (hasFooter()) {\n <div class=\"sd-mobile-footer p-12\" role=\"region\" [attr.aria-label]=\"'core.component.table.mobile.summary' | sdTranslate\">\n @for (column of mobileFooterColumns(); track column.field) {\n <div class=\"d-flex align-items-center flex-wrap gap-8 py-8\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n <ng-container\n *ngTemplateOutlet=\"_footerDef[column.field].templateRef; context: { items: _items, column: column }\"></ng-container>\n </div>\n }\n </div>\n }\n } @else {\n <table\n mat-table\n [dataSource]=\"groupedItems\"\n [trackBy]=\"trackBy\"\n multiTemplateDataRows\n cdkDropList\n [cdkDropListData]=\"groupedItems\"\n [cdkDropListDisabled]=\"!_tableOption.rowReorder?.enabled\"\n [cdkDropListSortPredicate]=\"reorderSortPredicate\"\n (cdkDropListDropped)=\"onReorderDrop($event)\">\n @if (_tableOption.rowReorder?.enabled) {\n <ng-container matColumnDef=\"sdReorder\">\n <th mat-header-cell *matHeaderCellDef class=\"sd-reorder-header\" [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\"></th>\n <td mat-cell *matCellDef=\"let row\" class=\"sd-reorder-cell\">\n @if (!row.meta?.group?.items?.length) {\n <sd-icon\n cdkDragHandle\n [class.sd-reorder-disabled]=\"isReorderDisabled(row)\"\n [name]=\"_tableOption.rowReorder?.icon || 'drag_indicator'\"></sd-icon>\n }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n }\n\n <ng-container matColumnDef=\"sdSubInformation\" sticky>\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\" [attr.colspan]=\"_configuration.displayedColumns.length\">\n @if (_sdSubInformation?.templateRef) {\n @if (_tableOption.expand?.always) {\n <ng-container *ngTemplateOutlet=\"_sdSubInformation?.templateRef!; context: { item: item }\"> </ng-container>\n } @else {\n <div [@detailExpand]=\"item.meta.expand?.isExpanded ? 'expanded' : 'collapsed'\">\n @if (item.meta.expand?.isExpanded) {\n <ng-container *ngTemplateOutlet=\"_sdSubInformation?.templateRef!; context: { item: item }\"> </ng-container>\n }\n </div>\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n\n <ng-container matColumnDef=\"sdSubInformationAction\" stickyEnd>\n <th\n class=\"p-0\"\n mat-header-cell\n *matHeaderCellDef\n style=\"width: 1px\"\n [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\"></th>\n <td mat-cell *matCellDef=\"let element\">\n @if (!element.meta.expand?.isExpanding && !_tableOption.expand?.always) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-expand-' + element.meta.id : null\"\n type=\"text\"\n [prefixIcon]=\"element.meta.expand?.isExpanded ? 'expand_less' : 'expand_more'\"\n (click)=\"onExpand(element)\"\n width=\"35px\">\n </sd-button>\n }\n @if (element.meta.expand?.isExpanding) {\n <div class=\"lds-ring\">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n }\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"sdSelection\" sticky>\n <th class=\"sd-selection-cell p-0\" mat-header-cell *matHeaderCellDef [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\">\n @if (_visibleSelectAll) {\n <mat-checkbox\n class=\"c-selection px-8\"\n color=\"primary\"\n [indeterminate]=\"_isSelectIndeterminate\"\n [ngModel]=\"_isSelectAll\"\n (ngModelChange)=\"isSelectAll.set($event)\"\n (change)=\"onSelectAll()\">\n </mat-checkbox>\n }\n </th>\n\n <td class=\"sd-selection-cell p-0\" mat-cell *matCellDef=\"let item\">\n @let visible = item.meta.selector?.visible;\n @if (visible) {\n @if (_tableOption.selector?.single) {\n <mat-radio-button\n class=\"c-selection px-8\"\n color=\"primary\"\n [checked]=\"item.meta.selector.isSelected\"\n (change)=\"item.meta.selector.isSelected = true; onSelect(item)\"\n [disabled]=\"item.meta.selector?.disabled\">\n </mat-radio-button>\n } @else {\n <mat-checkbox\n class=\"c-selection px-8\"\n color=\"primary\"\n [(ngModel)]=\"item.meta.selector.isSelected\"\n (change)=\"onSelect(item)\"\n [disabled]=\"item.meta.selector?.disabled\">\n </mat-checkbox>\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n @if (_tableOption.index?.enabled) {\n @let _pageOffset = pageOffset();\n @let _indexWidth = _tableOption.index?.width || '50px';\n <!-- why: khi tree, c\u1ED9t Index \"\u00F4m\" th\u00EAm chevron + indent. D\u00F9ng width:1px +\n nowrap (.sd-tree-index-cell) \u0111\u1EC3 c\u1ED9t co S\u00C1T n\u1ED9i dung, kh\u00F4ng chi\u1EBFm ch\u1ED7\n th\u1EEBa; header \"#\" canh tr\u00E1i l\u00F9i v\u00E0o (.sd-tree-index-header) cho th\u1EB3ng s\u1ED1. -->\n @let _treeIndex = !!_tableOption.tree;\n <ng-container matColumnDef=\"sdIndex\" sticky>\n <th\n [class.p-0]=\"!_treeIndex\"\n [class.text-center]=\"!_treeIndex\"\n [class.sd-tree-index-cell]=\"_treeIndex\"\n [class.sd-tree-index-header]=\"_treeIndex\"\n mat-header-cell\n *matHeaderCellDef\n [style.width]=\"_treeIndex ? '1px' : _indexWidth\"\n [style.min-width]=\"_treeIndex ? null : _indexWidth\"\n [style.max-width]=\"_treeIndex ? null : _indexWidth\"\n [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\">\n {{ _tableOption.index?.title || '#' }}\n </th>\n <td\n [class.px-4]=\"!_treeIndex\"\n [class.text-center]=\"!_treeIndex\"\n [class.sd-tree-index-cell]=\"_treeIndex\"\n mat-cell\n *matCellDef=\"let item; let i = dataIndex\"\n [style.width]=\"_treeIndex ? '1px' : null\"\n [style.min-width]=\"_treeIndex ? null : _indexWidth\"\n [style.max-width]=\"_treeIndex ? null : _indexWidth\">\n @if (!item?.meta?.group?.isGroupHeader) {\n @if (_treeIndex) {\n <!-- why: tree \u2192 chevron + indent + STT ph\u00E2n c\u1EA5p (1, 1.2, 1.2.1). T\u00F4 \u0111\u1EADm root (level 0). -->\n <span class=\"sd-tree-line\">\n <ng-container *ngTemplateOutlet=\"sdTreeToggle; context: { row: item }\"></ng-container>\n @if (item?.meta?.tree?.indexPath?.length) {\n <span class=\"sd-tree-stt\" [class.sd-stt-root]=\"(item.meta.tree.level ?? 0) === 0\">\n {{ item.meta.tree.indexPath.join('.') }}\n </span>\n }\n </span>\n } @else {\n {{ _pageOffset + i + 1 }}\n }\n }\n </td>\n <td\n mat-footer-cell\n *matFooterCellDef\n [style.width]=\"_treeIndex ? '1px' : null\"\n [style.min-width]=\"_treeIndex ? null : _indexWidth\"\n [style.max-width]=\"_treeIndex ? null : _indexWidth\"></td>\n </ng-container>\n }\n <ng-container\n matColumnDef=\"sdCommand\"\n [sticky]=\"_tableOption.command?.align !== 'right'\"\n [stickyEnd]=\"_tableOption.command?.align === 'right'\">\n <!-- why: \u00F4 header c\u1EE7a c\u1ED9t command v\u1ED1n \u0111\u1EC3 tr\u1ED1ng. Cho consumer chi\u1EBFm ch\u1ED7 \u0111\u00F3 b\u1EB1ng\n `sdTableCommandHeaderDef` (th\u01B0\u1EDDng l\u00E0 n\u00FAt th\u00EAm d\u00F2ng) th\u00EC h\u00E0nh \u0111\u1ED9ng c\u1EA5p b\u1EA3ng n\u1EB1m ngay\n tr\u00EAn c\u1EE5m n\u00FAt c\u1EE7a t\u1EEBng d\u00F2ng, thay v\u00EC ph\u1EA3i d\u1EF1ng th\u00EAm m\u1ED9t d\u1EA3i ri\u00EAng d\u01B0\u1EDBi b\u1EA3ng. -->\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 50px\" [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\">\n @if (_commandHeaderDef) {\n <div class=\"sd-command-header d-flex align-items-center justify-content-center\">\n <ng-container *ngTemplateOutlet=\"_commandHeaderDef.templateRef\"></ng-container>\n </div>\n }\n </th>\n <!-- why: `dataIndex` do CDK c\u1EA5p s\u1EB5n. B\u1EA3n c\u0169 d\u00F9ng `groupedItems.indexOf(item)` \u2014\n qu\u00E9t to\u00E0n m\u1EA3ng cho M\u1ED6I d\u00F2ng render \u1EDF M\u1ED6I CD pass (O(n\u00B2) tr\u00EAn \u0111\u01B0\u1EDDng render),\n v\u00E0 c\u00F2n tr\u1EA3 sai index khi 2 d\u00F2ng tr\u00F9ng reference. -->\n <td class=\"px-8\" mat-cell *matCellDef=\"let item; let i = dataIndex\">\n <desktop-command [autoId]=\"_autoId\" [commands]=\"_rowCommands\" [item]=\"item\" [itemIndex]=\"i\"></desktop-command>\n </td>\n <td mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n <!-- why: group header row d\u00F9ng matRowDef RI\u00CANG v\u1EDBi column list ['sdGroupHeader']\n qua predicate when:isGroupHeaderRow. Cell colspan = displayedColumns.length \u0111\u1EC3\n span TO\u00C0N B\u1ED8 width data row. Tr\u00E1nh colspan trick overflow row khi c\u00E1c TD kh\u00E1c render. -->\n <ng-container matColumnDef=\"sdGroupHeader\">\n <td class=\"p-0 sd-group-header-cell\" mat-cell *matCellDef=\"let item\" [attr.colspan]=\"sdGroupColspan()\">\n <ng-container *ngTemplateOutlet=\"sdGroupHeader; context: { item: item }\"></ng-container>\n </td>\n </ng-container>\n <!-- why: filler column \u1EDF cu\u1ED1i h\u1EA5p th\u1EE5 leftover space khi t\u1ED5ng width c\u00E1c c\u1ED9t data < container \u2014 gi\u1EEF cho selection/STT/command kh\u00F4ng b\u1ECB d\u00E3n. -->\n <ng-container matColumnDef=\"sdFiller\">\n <th class=\"sd-filler-cell p-0\" mat-header-cell *matHeaderCellDef [attr.rowspan]=\"_configuration.multipleHeader ? 2 : 1\"></th>\n <td class=\"sd-filler-cell p-0\" mat-cell *matCellDef=\"let item\"></td>\n <td class=\"sd-filler-cell p-0\" mat-footer-cell *matFooterCellDef></td>\n </ng-container>\n @for (column of _configuration.firstColumns; track column.field) {\n <ng-container [matColumnDef]=\"column.field\" [sticky]=\"_configuration.fixedColumn[column.field]\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"px-8 py-8 c-th\"\n [sdColumnResize]=\"!!_tableOption.config?.resizable && column.type !== 'children'\"\n [minWidth]=\"column.minWidth\"\n [maxWidth]=\"column.maxWidth\"\n (resizeEnd)=\"onColumnResize(column.field, $event)\"\n [style.width]=\"column.width\"\n [style.min-width]=\"column.minWidth || column.width\"\n [style.max-width]=\"column.maxWidth\"\n [attr.rowspan]=\"_configuration.multipleHeader && column.type !== 'children' ? 2 : 1\"\n [attr.colspan]=\"column.type === 'children' ? column.children.length : 1\"\n [attr.aria-sort]=\"\n _tableOption.sort?.enable && column.type !== 'children' && column.sortable ? getSortAria(column.field) : null\n \">\n <div>\n <!-- why: sort control ch\u1EC9 \u00F4m title; filter l\u00E0 sibling n\u00EAn kh\u00F4ng th\u00E0nh interactive\n descendant. aria-sort thu\u1ED9c semantic <th>, kh\u00F4ng thu\u1ED9c control n\u00E0y. -->\n @if (column.type === 'children') {\n <div\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n } @else {\n @if (_tableOption.sort?.enable && column.sortable) {\n <div\n [sdTableSortHeader]=\"column.field\"\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n } @else {\n <div\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n }\n @let hideInlineFilter =\n _tableOption.filter?.disabled ||\n _tableOption.filter?.hideInlineFilter === true ||\n (_tableOption.filter?.hideInlineFilter === 'auto' && !_isFiltered && _total! <= 10);\n @if (!hideInlineFilter) {\n @if (!_isMobile) {\n <column-filter\n [autoId]=\"_autoId\"\n [value]=\"columnFilter?.[column.field!]!\"\n [operator]=\"columnOperator[column.field]\"\n (operatorChange)=\"columnOperator[column.field] = $event!; onOperatorChange(column, $event)\"\n [columnFilter]=\"columnFilter!\"\n [cacheValues]=\"cacheValues\"\n [column]=\"column\"\n (filterChange)=\"onFilterChange()\"\n (filterCommit)=\"onFilterCommit()\">\n </column-filter>\n }\n }\n }\n </div>\n </th>\n <td\n class=\"c-td px-0\"\n [class.d-none]=\"column.type === 'children'\"\n mat-cell\n *matCellDef=\"let item\"\n [sdHoverCopy]=\"(item.data && item.data[column.field]) || ''\"\n [sdHoverCopyDisabled]=\"!column.cell?.copiable\">\n @if (column.type !== 'children' && !item?.meta?.group?.isGroupHeader) {\n @if (_treeFirstField && column.field === _treeFirstField) {\n <!-- why: kh\u00F4ng c\u00F3 c\u1ED9t Index \u2192 chevron + indent nh\u00FAng v\u00E0o c\u1ED9t data \u0111\u1EA7u (nh\u01B0 file explorer). -->\n <span class=\"sd-tree-line px-8\">\n <ng-container *ngTemplateOutlet=\"sdTreeToggle; context: { row: item }\"></ng-container>\n <desktop-cell class=\"d-block\" [column]=\"column\" [item]=\"item\" [cellDef]=\"_cellDef\"></desktop-cell>\n </span>\n } @else {\n <desktop-cell class=\"d-block px-8\" [column]=\"column\" [item]=\"item\" [cellDef]=\"_cellDef\"> </desktop-cell>\n }\n }\n </td>\n <td mat-footer-cell *matFooterCellDef>\n <ng-container *ngIf=\"_footerDef[column.field]\">\n <ng-container *ngTemplateOutlet=\"_footerDef[column.field].templateRef; context: { items: _items, column: column }\">\n </ng-container>\n </ng-container>\n </td>\n </ng-container>\n }\n @for (column of _configuration.secondColumns; track column.field) {\n <ng-container [matColumnDef]=\"column.field\">\n <th\n mat-header-cell\n *matHeaderCellDef\n class=\"c-th px-8\"\n [style.width]=\"column.width\"\n [style.min-width]=\"column.minWidth || column.width\"\n [style.max-width]=\"column.maxWidth\"\n [attr.aria-sort]=\"_tableOption.sort?.enable && column.sortable ? getSortAria(column.field) : null\">\n <div>\n @if (_tableOption.sort?.enable && column.sortable) {\n <div\n [sdTableSortHeader]=\"column.field\"\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n } @else {\n <div\n class=\"c-header-title\"\n [class.justify-content-end]=\"column.align === 'right'\"\n [class.text-right]=\"column.align === 'right'\">\n <column-title [column]=\"column\" [titleDef]=\"_titleDef[column.field]\"></column-title>\n </div>\n }\n @if (!_tableOption.filter?.disabled && !_tableOption.filter?.hideInlineFilter && columnOperator) {\n @if (!_isMobile) {\n <column-filter\n [autoId]=\"_autoId\"\n [value]=\"columnFilter?.[column.field!]!\"\n [operator]=\"columnOperator[column.field]\"\n [columnFilter]=\"columnFilter!\"\n [cacheValues]=\"cacheValues\"\n [column]=\"column\"\n (operatorChange)=\"columnOperator[column.field] = $event!; onOperatorChange(column, $event)\"\n (filterChange)=\"onFilterChange()\"\n (filterCommit)=\"onFilterCommit()\">\n </column-filter>\n }\n }\n </div>\n </th>\n <td\n class=\"c-td px-0\"\n mat-cell\n *matCellDef=\"let item\"\n [sdHoverCopy]=\"item[column.field]\"\n [sdHoverCopyDisabled]=\"!column.cell?.copiable\">\n @if (column.type !== 'children') {\n <desktop-cell class=\"d-block px-8\" [column]=\"column\" [item]=\"item\" [cellDef]=\"_cellDef\"> </desktop-cell>\n }\n </td>\n <td mat-footer-cell *matFooterCellDef>\n <ng-container *ngIf=\"_footerDef[column.field]\">\n <ng-container *ngTemplateOutlet=\"_footerDef[column.field].templateRef; context: { items: _items, column: column }\">\n </ng-container>\n </ng-container>\n </td>\n </ng-container>\n }\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"_configuration.firstHeaders; sticky: true\"></tr>\n @if (!!_configuration.secondHeaders.length) {\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"_configuration.secondHeaders; sticky: true\"></tr>\n }\n <!-- Group header row \u2014 ch\u1EC9 1 cell sdGroupHeader colspan to\u00E0n width. -->\n <tr mat-row *matRowDef=\"let row; columns: ['sdGroupHeader']; when: isGroupHeaderRow\" class=\"c-group-row-tr\"></tr>\n\n <!-- Data row \u2014 d\u00F9ng displayedColumns \u0111\u1EA7y \u0111\u1EE7; when isDataRow \u0111\u1EC3 lo\u1EA1i tr\u1EEB group header. -->\n <!-- why: [ngStyle] \u0111\u1ECDc meta.rowStyle \u2014 style.rowCss \u0111\u00E3 \u0111\u01B0\u1EE3c resolve 1 l\u1EA7n m\u1ED7i l\u1EA7n\n render. B\u1EA3n c\u0169 g\u1ECDi rowStyle(row) ngay trong binding \u2192 ch\u1EA1y callback c\u1EE7a consumer\n cho T\u1EEANG d\u00F2ng \u1EDF M\u1ED6I CD pass, v\u00E0 v\u00EC tr\u1EA3 object M\u1EDAI n\u00EAn NgStyle ph\u1EA3i ch\u1EA1y l\u1EA1i\n KeyValueDiffer tr\u00EAn m\u1ECDi d\u00F2ng \u1EDF m\u1ECDi pass. -->\n <tr\n mat-row\n cdkDrag\n [cdkDragData]=\"row\"\n [cdkDragDisabled]=\"\n !_tableOption.rowReorder?.enabled ||\n !!row.meta?.group?.items?.length ||\n (row.meta?.tree?.level ?? 0) > 0 ||\n isReorderDisabled(row)\n \"\n *matRowDef=\"let row; columns: _configuration.displayedColumns; when: isDataRow\"\n matRipple\n class=\"c-row\"\n [class.sd-tree-row]=\"!!_tableOption.tree\"\n [ngClass]=\"_tableOption.tree ? 'sd-tree-level-' + (row.meta?.tree?.level ?? 0) : null\"\n [ngStyle]=\"row.meta.rowStyle\"\n [class.selected]=\"row.meta.selector.isSelected\"></tr>\n\n <!-- Sub-information row \u2014 also gated b\u1EDFi isDataRow \u0111\u1EC3 KH\u00D4NG render empty expand row d\u01B0\u1EDBi group header. -->\n <tr mat-row *matRowDef=\"let row; columns: ['sdSubInformation']; when: isDataRow\" class=\"c-detail-row\"></tr>\n @if (hasFooter() && !!_configuration.displayedFooters.length) {\n <tr mat-footer-row *matFooterRowDef=\"_configuration.displayedFooters; sticky: true\"></tr>\n }\n </table>\n }\n <!-- why: tr\u1EA1ng th\u00E1i r\u1ED7ng c\u0169ng xu\u1EA5t hi\u1EC7n B\u1EA4T \u0110\u1ED2NG B\u1ED8 sau khi fetch xong; kh\u00F4ng c\u00F3 live region\n th\u00EC ng\u01B0\u1EDDi d\u00F9ng screen reader ch\u1EDD m\u00E3i m\u00E0 kh\u00F4ng bi\u1EBFt b\u1EA3ng \u0111\u00E3 tr\u1EA3 v\u1EC1 0 d\u00F2ng. -->\n @if (!_loading && loadError()) {\n <div class=\"c-no-data-row\" role=\"alert\">\n <p>{{ 'core.component.table.error-occurred' | sdTranslate }}</p>\n <sd-button [title]=\"'core.component.table.reload' | sdTranslate\" (click)=\"reload()\"></sd-button>\n </div>\n } @else if (!_loading && !_total) {\n <div class=\"c-no-data-row\" role=\"status\" aria-live=\"polite\">\n @if (_isFiltered) {\n @if (tableConfiguration?.images?.filterEmpty) {\n <img class=\"c-image\" [src]=\"tableConfiguration!.images!.filterEmpty\" alt=\"filter-empty\" />\n } @else {\n <img class=\"c-image sd-image-filter-empty\" alt=\"filter-empty\" />\n }\n <div class=\"T16M\">{{ 'core.component.table.no-results' | sdTranslate }}</div>\n <div class=\"T16R text-secondary\">{{ 'core.component.table.no-results-hint' | sdTranslate }}</div>\n } @else {\n @if (_requireFiltered) {\n @if (tableConfiguration?.images?.filterRequired) {\n <img class=\"c-image\" [src]=\"tableConfiguration!.images!.filterRequired\" alt=\"filter-required\" />\n } @else {\n <img class=\"c-image sd-image-filter-required\" alt=\"filter-required\" />\n }\n <div class=\"T16R text-secondary\">{{ 'core.component.table.choose-filter-hint' | sdTranslate }}</div>\n } @else {\n @if (tableConfiguration?.images?.dataEmpty) {\n <img class=\"c-image\" [src]=\"tableConfiguration!.images!.dataEmpty\" alt=\"data-empty\" />\n } @else {\n <img class=\"c-image sd-image-data-empty\" alt=\"data-empty\" />\n }\n <div class=\"T16R text-secondary\">{{ 'core.component.table.no-data' | sdTranslate }}</div>\n }\n }\n </div>\n }\n </div>\n <div class=\"c-paginator\">\n <div class=\"c-action\">\n @if (_mobileCards) {\n @let _tools = mobileToolsActions();\n @if (_tools.length) {\n <button\n mat-button\n type=\"button\"\n class=\"sd-mobile-tools-trigger\"\n aria-haspopup=\"dialog\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-mobile-tools' : null\"\n (click)=\"mobileTools.openMore()\">\n <sd-icon name=\"tune\"></sd-icon><span>{{ 'core.component.table.mobile.tools' | sdTranslate }}</span>\n </button>\n <sd-table-mobile-actions\n #mobileTools\n [actions]=\"_tools\"\n [autoOpen]=\"false\"\n [title]=\"'core.component.table.mobile.tools-title' | sdTranslate\"\n [autoId]=\"_autoId\"></sd-table-mobile-actions>\n }\n } @else {\n @if (_tableOption.reload?.visible) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-reload' : null\"\n class=\"mr-8\"\n [title]=\"'core.component.table.reload' | sdTranslate\"\n prefixIcon=\"refresh\"\n (click)=\"reload()\"\n type=\"text\">\n </sd-button>\n }\n @if (_export && _items.length) {\n @if (_export.type === 'custom') {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-export' : null\"\n class=\"mr-8\"\n [title]=\"_exportTitle\"\n prefixIcon=\"get_app\"\n (click)=\"exportCustom()\"\n type=\"text\">\n </sd-button>\n } @else {\n @if (_export.visible) {\n @if (_exporting) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-export' : null\"\n class=\"mr-8\"\n [loading]=\"_exporting\"\n [title]=\"_exportTitle\"\n prefixIcon=\"get_app\"\n type=\"text\">\n </sd-button>\n } @else {\n @if (_export.visible === 'ALL' || !_export.visible) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-export' : null\"\n class=\"mr-8\"\n [title]=\"_exportTitle\"\n prefixIcon=\"get_app\"\n [matMenuTriggerFor]=\"menu\"\n type=\"text\">\n </sd-button>\n <mat-menu #menu=\"matMenu\">\n <button\n mat-menu-item\n [attr.data-autoid]=\"_autoId ? _autoId + '-export-excel' : null\"\n (click)=\"exportExcel()\"\n type=\"button\">\n <sd-icon name=\"file_download\"></sd-icon>\n <span> {{ 'core.component.table.export-excel' | sdTranslate }}</span>\n </button>\n <button\n mat-menu-item\n [attr.data-autoid]=\"_autoId ? _autoId + '-export-csv' : null\"\n (click)=\"exportCSV()\"\n type=\"button\">\n <sd-icon name=\"file_download\"></sd-icon>\n <span> {{ 'core.component.table.export-csv' | sdTranslate }}</span>\n </button>\n </mat-menu>\n } @else if (_export.visible === 'EXCEL') {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-export-excel' : null\"\n class=\"mr-8\"\n [title]=\"_exportTitle\"\n prefixIcon=\"get_app\"\n (click)=\"exportExcel()\"\n type=\"text\">\n </sd-button>\n } @else if (_export.visible === 'CSV') {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-export-csv' : null\"\n class=\"mr-8\"\n [title]=\"_exportTitle\"\n prefixIcon=\"get_app\"\n (click)=\"exportCSV()\"\n type=\"text\">\n </sd-button>\n }\n }\n }\n }\n }\n\n @if (_configComponent) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-config' : null\"\n class=\"mr-8\"\n [title]=\"'core.component.table.setup-short' | sdTranslate\"\n prefixIcon=\"settings\"\n (click)=\"_configComponent.open()\"\n type=\"text\">\n </sd-button>\n }\n <!-- Mobile: n\u00FAt Filter m\u1EDF mobile-filter drawer (inline filter \u1EA9n tr\u00EAn mobile) -->\n @if (_isMobile) {\n @if (!_tableOption.filter?.disabled && _mobileFilter) {\n <sd-button\n [autoId]=\"_autoId ? _autoId + '-mobile-filter-open' : null\"\n class=\"mr-8\"\n prefixIcon=\"filter_alt\"\n [title]=\"_mobileCards ? ('core.component.table.filter' | sdTranslate) : undefined\"\n (click)=\"_mobileFilter.open()\"\n type=\"text\">\n </sd-button>\n }\n }\n }\n </div>\n @let hidePaginator = !_tableOption.paginate?.pageSize || _total === undefined || _total <= _tableOption.paginate?.pageSize!;\n <mat-paginator\n [class.sd-mobile-paginator]=\"_mobileCards\"\n [class.d-none]=\"_tableOption.paginate?.hidden || hidePaginator\"\n [length]=\"_total\"\n [pageSize]=\"_tableOption.paginate?.pageSize\"\n [pageSizeOptions]=\"_tableOption.paginate?.pages!\"\n [showFirstLastButtons]=\"!_isMobile && _tableOption.paginate?.showFirstLastButtons\"\n [hidePageSize]=\"_isMobile || _tableOption.paginate?.hidePageSize\"></mat-paginator>\n <!-- \"\u0110ang hi\u1EC3n th\u1ECB...\" ch\u1EC9 desktop -->\n @if (!_isMobile) {\n @if (!_tableOption.paginate?.hidden && hidePaginator && _total !== undefined && _total > 0) {\n <div class=\"T14R c-summary\">\n {{ 'core.component.table.showing' | sdTranslate }} <span class=\"T14M ml-2\">1-{{ _total }}/{{ _total }}</span>\n </div>\n }\n }\n </div>\n </div>\n @if (!_mobileCards) {\n <selector-action\n [autoId]=\"_autoId\"\n [tableOption]=\"_tableOption\"\n [selectedTableItems]=\"_selectedTableItems\"\n (clear)=\"onClearSelection()\" />\n }\n @if (_tableOption.config?.visible) {\n <config [autoId]=\"_autoId\" [tableOption]=\"_tableOption\" />\n }\n <!-- Mobile filter drawer \u2014 ch\u1EC9 instantiate khi c\u1EA7n render tr\u00EAn mobile -->\n @if (!_tableOption.filter?.disabled && filterRegister) {\n <mobile-filter\n [autoId]=\"_autoId\"\n [filter]=\"_tableOption.filter!\"\n [externalFilters]=\"_tableOption.filter?.externalFilters!\"\n [columns]=\"mobileColumns()\"\n [filterDefs]=\"sdFilterDefs()\"\n [filterRegister]=\"filterRegister\"\n [cacheValues]=\"cacheValues\">\n </mobile-filter>\n }\n}\n", styles: [":host{display:flex;flex-direction:column;overflow:auto;width:100%;height:100%}:host:focus-visible{outline:2px solid var(--sd-primary);outline-offset:2px}:host .c-header-title{height:40px;display:flex;align-items:center}:host .c-container{position:relative;min-height:50px;display:flex;flex-direction:column;flex:1}:host .c-container .c-table{position:relative;flex:1;display:flex;flex-direction:column}:host .c-container .c-table table{border-collapse:separate;width:100%}:host .c-container .c-table table tr.c-first-header.mat-mdc-header-row{height:40px}:host .c-container .c-table table tr.c-second-header.mat-mdc-header-row{height:40px}:host .c-container .c-table table tr.c-detail-row{height:0}:host .c-container .c-table table tr.c-row.activated{background-color:#e5ecff}:host .c-container .c-table table tr.c-row.selected{background-color:#eef2ff}:host .c-container .c-table table tr.c-row:not(.selected):not(.activated):hover{background-color:#f5f5f5}:host .c-container .c-table table tr.c-row td{border-bottom-width:0}:host .c-container .c-table table tr.c-row.c-expandable{cursor:pointer}:host .c-container .c-table table tr.c-row.c-expandable:hover{background:#f5f5f5}:host .c-container .c-table table th.mat-mdc-header-cell{background-color:#f2f3f4;border-bottom:0!important}:host .c-container .c-table table td.mat-mdc-cell,:host .c-container .c-table table td.mat-mdc-footer-cell,:host .c-container .c-table table th.mat-mdc-header-cell{border-bottom-color:#f2f2f2!important}:host .c-container .c-table .c-th{vertical-align:middle;font-weight:500;font-size:14px;line-height:20px;color:#212121}:host .c-container .c-table .c-th.sd-col-resize-host{position:relative}:host .c-container .c-table .c-th.sd-resizing{-webkit-user-select:none;user-select:none}:host .c-container .c-table .c-th .sd-col-resize-handle{position:absolute;top:0;right:0;width:6px;height:100%;cursor:col-resize;-webkit-user-select:none;user-select:none;z-index:2}:host .c-container .c-table .c-th .sd-col-resize-handle:hover{background:#00000014}:host .c-container .c-table .c-td:first{padding-left:10px}:host .c-container .c-table .c-no-data-row{flex:1;width:100%;position:sticky;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center}:host .c-container .c-table .c-no-data-row .c-image{margin-bottom:16px;width:96px}:host .c-container .c-loading{position:absolute;inset:0 0 56px;background:#00000026;z-index:2;display:flex;align-items:center;justify-content:center}:host .c-container .c-paginator{display:flex;flex-direction:row;justify-content:space-between;align-items:center;background-color:#fff}:host .c-container .c-paginator .mat-mdc-paginator{background:transparent;--mat-paginator-container-size: 40px;--mat-icon-button-state-layer-size: 32px;--mdc-icon-button-state-layer-size: 32px;--mdc-icon-button-icon-size: 20px}:host .c-container .c-paginator .c-action{padding:0}:host .c-container .c-paginator .c-action sd-button{margin:8px 5px}:host .c-container .c-paginator .c-summary{padding:8px 16px}:host .c-container .c-empty{text-align:center;background-color:#fff;border:none!important}:host .c-container .c-empty sd-icon{font-size:150px;margin-top:30px;margin-bottom:30px;opacity:.2;width:auto;height:auto}:host button.c-btn-add{background-color:#fff;box-shadow:0 2px 4px #2f313629}:host .lds-ring{display:inline-block;position:relative;width:40px;height:40px}:host .lds-ring div{box-sizing:border-box;display:block;position:absolute;width:32px;height:32px;margin:4px;border:4px solid #cef;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#cef transparent transparent transparent}:host .lds-ring div:nth-child(1){animation-delay:-.45s}:host .lds-ring div:nth-child(2){animation-delay:-.3s}:host .lds-ring div:nth-child(3){animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host .sd-reorder-header,:host .sd-reorder-cell{width:40px;min-width:40px;padding:0 4px;box-sizing:border-box}:host .sd-reorder-cell sd-icon{cursor:grab;color:#00000061;display:flex;align-items:center}:host .sd-reorder-cell sd-icon:active{cursor:grabbing}:host .sd-reorder-cell sd-icon.sd-reorder-disabled{opacity:.3;cursor:not-allowed;pointer-events:none}:host ::ng-deep .sd-mobile-paginator .mat-mdc-paginator-range-label{margin-inline:4px;white-space:nowrap}:host .sd-mobile-command-header{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:8px;padding:4px}:host .c-container.sd-table-mobile .c-paginator{flex-wrap:wrap;gap:4px}:host .c-container.sd-table-mobile .c-action{display:flex;align-items:center;min-width:0}:host .c-container.sd-table-mobile .sd-mobile-tools-trigger{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px}:host .c-container.sd-table-mobile .sd-mobile-paginator{margin-inline-start:auto}:host .c-container.sd-table-mobile .c-paginator,:host .c-container.sd-table-mobile .c-empty{background-color:var(--sd-surface);color:var(--sd-text)}:host ::ng-deep .sd-table-mobile .c-paginator button{min-width:44px;min-height:44px}:host .c-container.sd-table-mobile .c-paginator .sd-mobile-paginator{--mat-icon-button-state-layer-size: 44px;--mdc-icon-button-state-layer-size: 44px}:host ::ng-deep .mat-select-arrow{color:#a6a6a6}:host ::ng-deep .sd-table-sort-header{cursor:pointer;outline:none}:host ::ng-deep .sd-table-sort-header:focus-visible{border-bottom:solid 1px currentColor}:host ::ng-deep th[aria-sort] .sd-table-sort-header{background-repeat:no-repeat;background-position:center right 0;background-size:16px 16px;padding-right:24px}:host ::ng-deep th[aria-sort=none] .sd-table-sort-header{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z'/%3E%3C/svg%3E\")}:host ::ng-deep th[aria-sort=ascending] .sd-table-sort-header{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z'/%3E%3C/svg%3E\")}:host ::ng-deep th[aria-sort=descending] .sd-table-sort-header{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z'/%3E%3C/svg%3E\")}:host ::ng-deep .c-paginator .mat-mdc-paginator .mdc-text-field--outlined .mat-mdc-form-field-infix,:host ::ng-deep .c-paginator .mat-mdc-paginator .mdc-text-field--no-label .mat-mdc-form-field-infix{padding-top:2px;padding-bottom:2px;min-height:32px}:host ::ng-deep .c-paginator .mat-mdc-paginator-range-label{margin:0 4px}:host ::ng-deep .c-paginator .mat-mdc-paginator-page-size-select mat-select{margin-top:2px!important}:host ::ng-deep .cdk-drag-preview{box-shadow:0 4px 12px #00000026;background:#fff;display:table;width:100%}:host ::ng-deep .cdk-drag-preview td{padding:0 8px;border-bottom:1px solid rgba(0,0,0,.12)}:host ::ng-deep .cdk-drag-placeholder{opacity:0}:host ::ng-deep .cdk-drop-list-dragging tr.c-row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}:host ::ng-deep .sd-selection-cell{width:42px;min-width:42px;max-width:42px}:host ::ng-deep .sd-filler-cell{width:auto;min-width:0;padding:0!important;border:0}:host ::ng-deep .sd-group-header-cell{background:#f5f7fc;border-top:1px solid #e6e9f2;border-bottom:1px solid #e6e9f2}:host ::ng-deep .sd-group-row{min-height:36px}:host ::ng-deep .sd-group-selection-slot{width:42px;min-width:42px;max-width:42px}:host ::ng-deep .c-selection{transform:scale(.85);transform-origin:center}:host ::ng-deep .sd-tree-line{display:inline-flex;align-items:center;min-height:32px}:host ::ng-deep .sd-tree-indent{flex:0 0 auto}:host ::ng-deep .sd-tree-toggle-slot{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px}:host ::ng-deep .sd-tree-toggle-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;background:transparent;border-radius:50%;cursor:pointer;color:var(--sd-text-secondary, #5b6472);transition:background-color .15s ease}:host ::ng-deep .sd-tree-toggle-btn sd-icon{font-size:18px;width:18px;height:18px;line-height:18px}:host ::ng-deep .sd-tree-toggle-btn:hover{background-color:#0f172a14}:host ::ng-deep .sd-tree-spinner{transform:scale(.45)}:host ::ng-deep .sd-tree-stt{margin-left:2px;white-space:nowrap}:host ::ng-deep .sd-tree-index-cell{text-align:left!important;white-space:nowrap;padding-left:8px;padding-right:8px}:host ::ng-deep .sd-tree-index-header{padding-left:32px}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-0{background:#fbfcfe}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-0>td{font-weight:500}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-1{background:#fff}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-2{background:#fafbfd}:host ::ng-deep tr.c-row.sd-tree-row.sd-tree-level-3{background:#f6f8fb}:host ::ng-deep .sd-stt-root{font-weight:700;color:#1f2330}:host ::ng-deep .sd-mobile-tools-trigger .mdc-button__label{display:inline-flex;align-items:center;gap:6px}\n", ":host ::ng-deep .sticky-shadow-right{overflow:visible!important}:host ::ng-deep .sticky-shadow-right:after{content:\"\";position:absolute;top:0;right:0;bottom:0;width:8px;transform:translate(100%);background:linear-gradient(to right,rgba(0,0,0,.12),transparent);pointer-events:none}:host ::ng-deep .sticky-shadow-left{overflow:visible!important}:host ::ng-deep .sticky-shadow-left:after{content:\"\";position:absolute;top:0;left:0;bottom:0;width:8px;transform:translate(-100%);background:linear-gradient(to left,rgba(0,0,0,.12),transparent);pointer-events:none}\n"] }]
|
|
4923
5453
|
}], ctorParameters: () => [] });
|
|
4924
5454
|
|
|
4925
5455
|
/**
|
|
4926
5456
|
* Generated bundle index. Do not edit.
|
|
4927
5457
|
*/
|
|
4928
5458
|
|
|
4929
|
-
export { SD_TABLE_CONFIGURATION, SdConvertToPagingReq, SdMaterialFooterDefDirective, SdTable, SdTableCellDefDirective, SdTableCommandHeaderDefDirective, SdTableExpandDefDirective, SdTableFilterDefDirective, SdTableGroupDefDirective, SdTablePaginatorIntl, SdTableTitleDefDirective };
|
|
5459
|
+
export { SD_TABLE_CONFIGURATION, SdConvertToPagingReq, SdMaterialFooterDefDirective, SdTable, SdTableCellDefDirective, SdTableCommandHeaderDefDirective, SdTableExpandDefDirective, SdTableFilterDefDirective, SdTableGroupDefDirective, SdTablePaginatorIntl, SdTableRowMobileDefDirective, SdTableTitleDefDirective };
|
|
4930
5460
|
//# sourceMappingURL=sdcorejs-angular-components-table.mjs.map
|