@sdcorejs/angular 21.2.4 → 22.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/assets/fonts/fonts.scss +2 -2
- package/assets/images/coming-soon.svg +6 -6
- package/assets/images/data-empty.svg +2 -2
- package/assets/images/expired.svg +6 -6
- package/assets/images/file-error.svg +6 -6
- package/assets/images/filter-empty.svg +2 -2
- package/assets/images/filter-required.svg +2 -2
- package/assets/images/forbidden.svg +2 -2
- package/assets/images/image-error.svg +8 -8
- package/assets/images/maintenance.svg +3 -3
- package/assets/images/not-found.svg +2 -2
- package/assets/images/offline.svg +5 -5
- package/assets/images/submitted.svg +5 -5
- package/assets/images/success.svg +3 -3
- package/assets/images/unauthorized.svg +2 -2
- package/assets/images/unknown-error.svg +2 -2
- package/fesm2022/sdcorejs-angular-components-anchor.mjs +46 -29
- package/fesm2022/sdcorejs-angular-components-anchor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +167 -94
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-audit-diff.mjs +20 -13
- package/fesm2022/sdcorejs-angular-components-audit-diff.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs +65 -40
- package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-avatar.mjs +15 -9
- package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-badge.mjs +31 -17
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs +17 -10
- package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +17 -10
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-card.mjs +185 -0
- package/fesm2022/sdcorejs-angular-components-card.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-chart.mjs +52 -32
- package/fesm2022/sdcorejs-angular-components-chart.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs +3 -3
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-code-editor.mjs +15 -9
- package/fesm2022/sdcorejs-angular-components-code-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs +32 -19
- package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor.mjs +38 -21
- package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +396 -306
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-history.mjs +10 -10
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +12 -12
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs +42 -24
- package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-job-progress.mjs +39 -21
- package/fesm2022/sdcorejs-angular-components-job-progress.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +9 -8
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +22 -14
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +36 -14
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-operator.mjs +17 -10
- package/fesm2022/sdcorejs-angular-components-operator.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-org-chart.mjs +26 -16
- package/fesm2022/sdcorejs-angular-components-org-chart.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-preview.mjs +288 -147
- package/fesm2022/sdcorejs-angular-components-preview.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +279 -153
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs +69 -36
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs +7 -5
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +17 -13
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +26 -16
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-splitter.mjs +58 -37
- package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-stepper.mjs +36 -21
- package/fesm2022/sdcorejs-angular-components-stepper.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +27 -23
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab.mjs +34 -20
- package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +1630 -998
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs +86 -46
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +65 -40
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-view.mjs +25 -14
- package/fesm2022/sdcorejs-angular-components-view.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-configurations.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +42 -33
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +80 -42
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs +15 -9
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +41 -24
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip.mjs +37 -22
- package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +55 -30
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +63 -34
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +65 -35
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-directives.mjs +12 -12
- package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +94 -53
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-inline-text.mjs +33 -18
- package/fesm2022/sdcorejs-angular-forms-inline-text.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs +25 -14
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +123 -42
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +94 -49
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-label.mjs +3 -3
- package/fesm2022/sdcorejs-angular-forms-label.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-models.mjs +13 -8
- package/fesm2022/sdcorejs-angular-forms-models.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-radio.mjs +41 -22
- package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +112 -59
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-switch.mjs +21 -12
- package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +48 -26
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time-range.mjs +83 -43
- package/fesm2022/sdcorejs-angular-forms-time-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time.mjs +72 -38
- package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +76 -41
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms.mjs +4 -4
- package/fesm2022/sdcorejs-angular-forms.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-handlers.mjs +3 -3
- package/fesm2022/sdcorejs-angular-handlers.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +97 -9
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-interceptors.mjs +6 -6
- package/fesm2022/sdcorejs-angular-interceptors.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-auth.mjs +11 -10
- package/fesm2022/sdcorejs-angular-modules-auth.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-icon.mjs +19 -11
- package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-keycloak.mjs +7 -7
- package/fesm2022/sdcorejs-angular-modules-keycloak.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +387 -247
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-permission.mjs +13 -11
- package/fesm2022/sdcorejs-angular-modules-permission.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-pipes.mjs +25 -25
- package/fesm2022/sdcorejs-angular-pipes.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-api.mjs +15 -10
- package/fesm2022/sdcorejs-angular-services-api.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-cache.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-cache.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +9 -9
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-excel.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-loading.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-loading.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-notify.mjs +21 -16
- package/fesm2022/sdcorejs-angular-services-notify.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-persistence.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-persistence.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-storage.mjs +3 -3
- package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-task.mjs +19 -11
- package/fesm2022/sdcorejs-angular-services-task.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs +17 -10
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-viewport.mjs +15 -9
- package/fesm2022/sdcorejs-angular-services-viewport.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-extensions.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-models.mjs.map +1 -1
- package/package.json +17 -13
- package/types/sdcorejs-angular-components-card.d.ts +58 -0
- package/types/sdcorejs-angular-components-modal.d.ts +1 -0
- package/types/sdcorejs-angular-components-quick-action.d.ts +6 -4
- package/types/sdcorejs-angular-components-table.d.ts +294 -233
- package/types/sdcorejs-angular-components.d.ts +1 -0
- package/types/sdcorejs-angular-i18n.d.ts +17 -0
|
@@ -1,7 +1,7 @@
|
|
|
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
|
-
import * as i4 from '@angular/material/paginator';
|
|
4
|
+
import * as i4$1 from '@angular/material/paginator';
|
|
5
5
|
import { MatPaginatorIntl, MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
6
6
|
import * as i6 from '@angular/material/sort';
|
|
7
7
|
import { MatSort, MatSortModule } from '@angular/material/sort';
|
|
@@ -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 i2$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,14 +49,8 @@ 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 i1$1 from '@angular/material/tooltip';
|
|
53
|
+
import * as i1$2 from '@angular/material/tooltip';
|
|
53
54
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
54
55
|
import * as i3$1 from '@angular/material/chips';
|
|
55
56
|
import { MatChipsModule } from '@angular/material/chips';
|
|
@@ -58,18 +59,35 @@ class SdTableCellDefDirective {
|
|
|
58
59
|
static ngTemplateContextGuard(_dir, _ctx) {
|
|
59
60
|
return true;
|
|
60
61
|
}
|
|
61
|
-
sdTableCellDef = input.required(
|
|
62
|
+
sdTableCellDef = input.required(/* @ts-ignore */
|
|
63
|
+
...(ngDevMode ? [{ debugName: "sdTableCellDef" }] : /* istanbul ignore next */ []));
|
|
62
64
|
templateRef = inject(TemplateRef);
|
|
63
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
64
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
65
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableCellDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
66
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.5", type: SdTableCellDefDirective, isStandalone: true, selector: "[sdTableCellDef]", inputs: { sdTableCellDef: { classPropertyName: "sdTableCellDef", publicName: "sdTableCellDef", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
65
67
|
}
|
|
66
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableCellDefDirective, decorators: [{
|
|
67
69
|
type: Directive,
|
|
68
70
|
args: [{
|
|
69
71
|
selector: '[sdTableCellDef]',
|
|
70
72
|
}]
|
|
71
73
|
}], propDecorators: { sdTableCellDef: [{ type: i0.Input, args: [{ isSignal: true, alias: "sdTableCellDef", required: true }] }] } });
|
|
72
74
|
|
|
75
|
+
class SdTableRowMobileDefDirective {
|
|
76
|
+
/** Optional type witness: bind the typed table option for strict row inference. */
|
|
77
|
+
sdTableRowMobileDef = input('', /* @ts-ignore */
|
|
78
|
+
...(ngDevMode ? [{ debugName: "sdTableRowMobileDef" }] : /* istanbul ignore next */ []));
|
|
79
|
+
templateRef = inject(TemplateRef);
|
|
80
|
+
static ngTemplateContextGuard(_directive, context) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableRowMobileDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
84
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.5", type: SdTableRowMobileDefDirective, isStandalone: true, selector: "ng-template[sdTableRowMobileDef]", inputs: { sdTableRowMobileDef: { classPropertyName: "sdTableRowMobileDef", publicName: "sdTableRowMobileDef", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
85
|
+
}
|
|
86
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableRowMobileDefDirective, decorators: [{
|
|
87
|
+
type: Directive,
|
|
88
|
+
args: [{ selector: 'ng-template[sdTableRowMobileDef]', standalone: true }]
|
|
89
|
+
}], propDecorators: { sdTableRowMobileDef: [{ type: i0.Input, args: [{ isSignal: true, alias: "sdTableRowMobileDef", required: false }] }] } });
|
|
90
|
+
|
|
73
91
|
/**
|
|
74
92
|
* Nội dung cho ô HEADER của cột command.
|
|
75
93
|
*
|
|
@@ -89,10 +107,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
89
107
|
*/
|
|
90
108
|
class SdTableCommandHeaderDefDirective {
|
|
91
109
|
templateRef = inject(TemplateRef);
|
|
92
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
93
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
110
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableCommandHeaderDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
111
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.5", type: SdTableCommandHeaderDefDirective, isStandalone: true, selector: "[sdTableCommandHeaderDef]", ngImport: i0 });
|
|
94
112
|
}
|
|
95
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableCommandHeaderDefDirective, decorators: [{
|
|
96
114
|
type: Directive,
|
|
97
115
|
args: [{
|
|
98
116
|
selector: '[sdTableCommandHeaderDef]',
|
|
@@ -104,10 +122,10 @@ class SdTableExpandDefDirective {
|
|
|
104
122
|
return true;
|
|
105
123
|
}
|
|
106
124
|
templateRef = inject(TemplateRef);
|
|
107
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
108
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
125
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableExpandDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
126
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.5", type: SdTableExpandDefDirective, isStandalone: true, selector: "[sdTableExpandDef]", ngImport: i0 });
|
|
109
127
|
}
|
|
110
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableExpandDefDirective, decorators: [{
|
|
111
129
|
type: Directive,
|
|
112
130
|
args: [{
|
|
113
131
|
selector: '[sdTableExpandDef]',
|
|
@@ -118,13 +136,14 @@ class SdTableFilterDefDirective {
|
|
|
118
136
|
static ngTemplateContextGuard(_dir, _ctx) {
|
|
119
137
|
return true;
|
|
120
138
|
}
|
|
121
|
-
sdTableFilterDef = input.required(
|
|
139
|
+
sdTableFilterDef = input.required(/* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [{ debugName: "sdTableFilterDef" }] : /* istanbul ignore next */ []));
|
|
122
141
|
defaultShowing = input(false, { ...(ngDevMode ? { debugName: "defaultShowing" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
123
142
|
templateRef = inject(TemplateRef, { optional: true });
|
|
124
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
125
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
143
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableFilterDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
144
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.5", type: SdTableFilterDefDirective, isStandalone: true, selector: "[sdTableFilterDef]", inputs: { sdTableFilterDef: { classPropertyName: "sdTableFilterDef", publicName: "sdTableFilterDef", isSignal: true, isRequired: true, transformFunction: null }, defaultShowing: { classPropertyName: "defaultShowing", publicName: "defaultShowing", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
126
145
|
}
|
|
127
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableFilterDefDirective, decorators: [{
|
|
128
147
|
type: Directive,
|
|
129
148
|
args: [{
|
|
130
149
|
selector: '[sdTableFilterDef]',
|
|
@@ -135,12 +154,13 @@ class SdMaterialFooterDefDirective {
|
|
|
135
154
|
static ngTemplateContextGuard(_dir, _ctx) {
|
|
136
155
|
return true;
|
|
137
156
|
}
|
|
138
|
-
sdTableFooterDef = input.required(
|
|
157
|
+
sdTableFooterDef = input.required(/* @ts-ignore */
|
|
158
|
+
...(ngDevMode ? [{ debugName: "sdTableFooterDef" }] : /* istanbul ignore next */ []));
|
|
139
159
|
templateRef = inject(TemplateRef);
|
|
140
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
141
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
160
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdMaterialFooterDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
161
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.5", type: SdMaterialFooterDefDirective, isStandalone: true, selector: "[sdTableFooterDef]", inputs: { sdTableFooterDef: { classPropertyName: "sdTableFooterDef", publicName: "sdTableFooterDef", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
142
162
|
}
|
|
143
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
163
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdMaterialFooterDefDirective, decorators: [{
|
|
144
164
|
type: Directive,
|
|
145
165
|
args: [{
|
|
146
166
|
selector: '[sdTableFooterDef]',
|
|
@@ -166,30 +186,853 @@ class SdTableGroupDefDirective {
|
|
|
166
186
|
static ngTemplateContextGuard(_dir, _ctx) {
|
|
167
187
|
return true;
|
|
168
188
|
}
|
|
169
|
-
templateRef = inject(TemplateRef);
|
|
170
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
171
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
172
|
-
}
|
|
173
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
174
|
-
type: Directive,
|
|
175
|
-
args: [{ selector: '[sdTableGroupDef]' }]
|
|
176
|
-
}] });
|
|
177
|
-
|
|
178
|
-
class SdTableTitleDefDirective {
|
|
179
|
-
static ngTemplateContextGuard(_dir, _ctx) {
|
|
180
|
-
return true;
|
|
189
|
+
templateRef = inject(TemplateRef);
|
|
190
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableGroupDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
191
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.5", type: SdTableGroupDefDirective, isStandalone: true, selector: "[sdTableGroupDef]", ngImport: i0 });
|
|
192
|
+
}
|
|
193
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableGroupDefDirective, decorators: [{
|
|
194
|
+
type: Directive,
|
|
195
|
+
args: [{ selector: '[sdTableGroupDef]' }]
|
|
196
|
+
}] });
|
|
197
|
+
|
|
198
|
+
class SdTableTitleDefDirective {
|
|
199
|
+
static ngTemplateContextGuard(_dir, _ctx) {
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
sdTableTitleDef = input.required(/* @ts-ignore */
|
|
203
|
+
...(ngDevMode ? [{ debugName: "sdTableTitleDef" }] : /* istanbul ignore next */ []));
|
|
204
|
+
templateRef = inject(TemplateRef);
|
|
205
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableTitleDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
206
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.5", type: SdTableTitleDefDirective, isStandalone: true, selector: "[sdTableTitleDef]", inputs: { sdTableTitleDef: { classPropertyName: "sdTableTitleDef", publicName: "sdTableTitleDef", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
207
|
+
}
|
|
208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableTitleDefDirective, decorators: [{
|
|
209
|
+
type: Directive,
|
|
210
|
+
args: [{
|
|
211
|
+
selector: '[sdTableTitleDef]',
|
|
212
|
+
}]
|
|
213
|
+
}], propDecorators: { sdTableTitleDef: [{ type: i0.Input, args: [{ isSignal: true, alias: "sdTableTitleDef", required: true }] }] } });
|
|
214
|
+
|
|
215
|
+
class SdTableMobileActionsComponent {
|
|
216
|
+
actions = input.required(/* @ts-ignore */
|
|
217
|
+
...(ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []));
|
|
218
|
+
title = input.required(/* @ts-ignore */
|
|
219
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
220
|
+
selection = input(false, /* @ts-ignore */
|
|
221
|
+
...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
222
|
+
count = input(0, /* @ts-ignore */
|
|
223
|
+
...(ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []));
|
|
224
|
+
autoOpen = input(true, /* @ts-ignore */
|
|
225
|
+
...(ngDevMode ? [{ debugName: "autoOpen" }] : /* istanbul ignore next */ []));
|
|
226
|
+
autoId = input(/* @ts-ignore */
|
|
227
|
+
...(ngDevMode ? [undefined, { debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
228
|
+
end = output();
|
|
229
|
+
busy = signal(false, /* @ts-ignore */
|
|
230
|
+
...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
231
|
+
error = signal('', /* @ts-ignore */
|
|
232
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
233
|
+
sheet = viewChild('sheet', /* @ts-ignore */
|
|
234
|
+
...(ngDevMode ? [{ debugName: "sheet" }] : /* istanbul ignore next */ []));
|
|
235
|
+
sheetOpen = computed(() => this.sheet()?.isOpened() ?? false, /* @ts-ignore */
|
|
236
|
+
...(ngDevMode ? [{ debugName: "sheetOpen" }] : /* istanbul ignore next */ []));
|
|
237
|
+
#host = inject(ElementRef);
|
|
238
|
+
#i18n = inject(I18nService);
|
|
239
|
+
#destroyed = false;
|
|
240
|
+
#pending;
|
|
241
|
+
// why: flat actions wrap in the toolbar; groups keep their declaration order in More.
|
|
242
|
+
direct = computed(() => {
|
|
243
|
+
const result = [];
|
|
244
|
+
for (const action of this.actions()) {
|
|
245
|
+
if (action.children || action.htmlTemplate)
|
|
246
|
+
break;
|
|
247
|
+
result.push(action);
|
|
248
|
+
}
|
|
249
|
+
return result;
|
|
250
|
+
}, /* @ts-ignore */
|
|
251
|
+
...(ngDevMode ? [{ debugName: "direct" }] : /* istanbul ignore next */ []));
|
|
252
|
+
overflow = computed(() => this.actions().slice(this.direct().length), /* @ts-ignore */
|
|
253
|
+
...(ngDevMode ? [{ debugName: "overflow" }] : /* istanbul ignore next */ []));
|
|
254
|
+
sheetActions = computed(() => (this.selection() ? this.overflow() : this.actions()), /* @ts-ignore */
|
|
255
|
+
...(ngDevMode ? [{ debugName: "sheetActions" }] : /* istanbul ignore next */ []));
|
|
256
|
+
constructor() {
|
|
257
|
+
// why: opening a newly created SdModal requires its title/dismiss bindings to be rendered first.
|
|
258
|
+
afterRenderEffect(() => {
|
|
259
|
+
const actions = this.actions();
|
|
260
|
+
const selection = this.selection();
|
|
261
|
+
const autoOpen = this.autoOpen();
|
|
262
|
+
const sheet = this.sheet();
|
|
263
|
+
untracked(() => {
|
|
264
|
+
if (!selection && autoOpen && actions.length)
|
|
265
|
+
sheet?.open();
|
|
266
|
+
else
|
|
267
|
+
sheet?.close();
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
openMore() {
|
|
272
|
+
if (!this.sheetOpen() && this.sheetActions().length)
|
|
273
|
+
this.sheet()?.open();
|
|
274
|
+
}
|
|
275
|
+
closeSheet() {
|
|
276
|
+
this.sheet()?.close();
|
|
277
|
+
}
|
|
278
|
+
onSheetClosed() {
|
|
279
|
+
if (this.#destroyed)
|
|
280
|
+
return;
|
|
281
|
+
const pending = this.#pending;
|
|
282
|
+
this.#pending = undefined;
|
|
283
|
+
if (pending)
|
|
284
|
+
void this.run(pending);
|
|
285
|
+
if (!this.selection() && this.autoOpen())
|
|
286
|
+
this.end.emit();
|
|
287
|
+
}
|
|
288
|
+
async runSheet(action) {
|
|
289
|
+
if (this.busy() || action.disabled)
|
|
290
|
+
return;
|
|
291
|
+
// why: finish closing before another drawer/dialog takes focus and overlay ownership.
|
|
292
|
+
if (action.closeBeforeRun) {
|
|
293
|
+
this.#pending = action;
|
|
294
|
+
this.closeSheet();
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
await this.run(action);
|
|
298
|
+
if (!this.error())
|
|
299
|
+
this.closeSheet();
|
|
300
|
+
}
|
|
301
|
+
async run(action) {
|
|
302
|
+
if (this.busy() || action.disabled || action.children || !action.run)
|
|
303
|
+
return;
|
|
304
|
+
this.error.set('');
|
|
305
|
+
try {
|
|
306
|
+
const result = action.run();
|
|
307
|
+
if (result && typeof result.then === 'function') {
|
|
308
|
+
this.busy.set(true);
|
|
309
|
+
await result;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
catch (error) {
|
|
313
|
+
console.error(error);
|
|
314
|
+
if (!this.#destroyed)
|
|
315
|
+
this.error.set(this.#i18n.t('core.component.table.error-occurred'));
|
|
316
|
+
}
|
|
317
|
+
finally {
|
|
318
|
+
if (!this.#destroyed)
|
|
319
|
+
this.busy.set(false);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
ngOnDestroy() {
|
|
323
|
+
this.#destroyed = true;
|
|
324
|
+
this.#pending = undefined;
|
|
325
|
+
const wasOpen = this.sheetOpen();
|
|
326
|
+
this.sheet()?.forceClose();
|
|
327
|
+
const owner = this.#host.nativeElement.closest('sd-table');
|
|
328
|
+
if (wasOpen && owner?.isConnected)
|
|
329
|
+
owner.focus();
|
|
330
|
+
}
|
|
331
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableMobileActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
332
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { 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 });
|
|
333
|
+
}
|
|
334
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableMobileActionsComponent, decorators: [{
|
|
335
|
+
type: Component,
|
|
336
|
+
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"] }]
|
|
337
|
+
}], ctorParameters: () => [], propDecorators: { actions: [{ type: i0.Input, args: [{ isSignal: true, alias: "actions", required: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], count: [{ type: i0.Input, args: [{ isSignal: true, alias: "count", required: false }] }], autoOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoOpen", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], end: [{ type: i0.Output, args: ["end"] }], sheet: [{ type: i0.ViewChild, args: ['sheet', { isSignal: true }] }] } });
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Resolves the bulk actions a selection is allowed to run.
|
|
341
|
+
*
|
|
342
|
+
* why: tách khỏi pipe để component đọc được cùng KẾT QUẢ trong `computed()` — quick-action chỉ
|
|
343
|
+
* đượ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
|
|
344
|
+
* từ một pipe chỉ chạy trong template.
|
|
345
|
+
*/
|
|
346
|
+
function sdResolveTableActions(selectedItems, actions) {
|
|
347
|
+
const results = [];
|
|
348
|
+
if (!actions?.length || !selectedItems?.length) {
|
|
349
|
+
return [];
|
|
350
|
+
}
|
|
351
|
+
for (const action of actions) {
|
|
352
|
+
if ('children' in action) {
|
|
353
|
+
const children = [];
|
|
354
|
+
for (const childAction of action.children) {
|
|
355
|
+
const key = Utilities.hash(childAction);
|
|
356
|
+
if (selectedItems.every(e => e?.meta?.selector?.actions?.includes(key))) {
|
|
357
|
+
children.push(childAction);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (children.length > 0) {
|
|
361
|
+
results.push({ ...action, children });
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
const key = Utilities.hash(action);
|
|
366
|
+
if (selectedItems.every(e => e?.meta?.selector?.actions?.includes(key))) {
|
|
367
|
+
results.push(action);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return results.map(result => convertAction(result));
|
|
372
|
+
}
|
|
373
|
+
function convertAction(action) {
|
|
374
|
+
if ('children' in action) {
|
|
375
|
+
return {
|
|
376
|
+
variant: 'children',
|
|
377
|
+
title: action.title,
|
|
378
|
+
icon: action.icon,
|
|
379
|
+
fontSet: action.fontSet,
|
|
380
|
+
tooltip: action.tooltip,
|
|
381
|
+
color: action.color,
|
|
382
|
+
type: action.type,
|
|
383
|
+
children: action.children.map(e => ({
|
|
384
|
+
variant: 'normal',
|
|
385
|
+
title: e.title,
|
|
386
|
+
icon: e.icon,
|
|
387
|
+
color: e.color ?? action.color,
|
|
388
|
+
type: e.type ?? action.type,
|
|
389
|
+
fontSet: e.fontSet,
|
|
390
|
+
tooltip: e.tooltip,
|
|
391
|
+
click: e.click,
|
|
392
|
+
})),
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
return {
|
|
396
|
+
variant: 'normal',
|
|
397
|
+
title: action.title,
|
|
398
|
+
icon: action.icon,
|
|
399
|
+
color: action.color,
|
|
400
|
+
type: action.type,
|
|
401
|
+
fontSet: action.fontSet,
|
|
402
|
+
tooltip: action.tooltip,
|
|
403
|
+
click: action.click,
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
class ActionFilterPipe {
|
|
407
|
+
transform = (selectedItems, actions) => sdResolveTableActions(selectedItems, actions);
|
|
408
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ActionFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
409
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.1.5", ngImport: i0, type: ActionFilterPipe, isStandalone: true, name: "actionFilter" });
|
|
410
|
+
}
|
|
411
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ActionFilterPipe, decorators: [{
|
|
412
|
+
type: Pipe,
|
|
413
|
+
args: [{
|
|
414
|
+
name: 'actionFilter',
|
|
415
|
+
}]
|
|
416
|
+
}] });
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Filters visible commands and pre-resolves icon, title, and stable key for the current row.
|
|
420
|
+
*/
|
|
421
|
+
class CommandFilterPipe {
|
|
422
|
+
transform(item, commands) {
|
|
423
|
+
return sdResolveTableCommands(item, commands);
|
|
424
|
+
}
|
|
425
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: CommandFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
426
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.1.5", ngImport: i0, type: CommandFilterPipe, isStandalone: true, name: "filter" });
|
|
427
|
+
}
|
|
428
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: CommandFilterPipe, decorators: [{
|
|
429
|
+
type: Pipe,
|
|
430
|
+
args: [{ name: 'filter', standalone: true }]
|
|
431
|
+
}] });
|
|
432
|
+
async function sdResolveTableCommands(item, commands) {
|
|
433
|
+
const results = [];
|
|
434
|
+
if (!commands)
|
|
435
|
+
return results;
|
|
436
|
+
for (const command of commands) {
|
|
437
|
+
if (!(await visible(item, command)))
|
|
438
|
+
continue;
|
|
439
|
+
const icon = iconFor(item, command);
|
|
440
|
+
const title = titleFor(item, command);
|
|
441
|
+
if ('children' in command) {
|
|
442
|
+
const children = [];
|
|
443
|
+
for (const child of command.children) {
|
|
444
|
+
if (!(await visible(item, child)))
|
|
445
|
+
continue;
|
|
446
|
+
children.push({
|
|
447
|
+
...child,
|
|
448
|
+
type: 'normal',
|
|
449
|
+
icon: iconFor(item, child),
|
|
450
|
+
title: titleFor(item, child),
|
|
451
|
+
key: keyFor(item, child),
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
if (children.length > 0) {
|
|
455
|
+
results.push({
|
|
456
|
+
...command,
|
|
457
|
+
type: 'children',
|
|
458
|
+
icon,
|
|
459
|
+
title,
|
|
460
|
+
key: keyFor(item, command),
|
|
461
|
+
children,
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
results.push({
|
|
467
|
+
...command,
|
|
468
|
+
type: 'normal',
|
|
469
|
+
icon,
|
|
470
|
+
title,
|
|
471
|
+
key: keyFor(item, command),
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
return results;
|
|
476
|
+
}
|
|
477
|
+
const visible = async (item, command) => {
|
|
478
|
+
const { hidden } = command;
|
|
479
|
+
if (hidden === undefined)
|
|
480
|
+
return true;
|
|
481
|
+
if (typeof hidden === 'boolean')
|
|
482
|
+
return !hidden;
|
|
483
|
+
const result = hidden(item.data);
|
|
484
|
+
return !(result instanceof Promise ? await result : result);
|
|
485
|
+
};
|
|
486
|
+
const iconFor = (item, command) => {
|
|
487
|
+
if (!command?.icon)
|
|
488
|
+
return 'more_vert';
|
|
489
|
+
return typeof command.icon === 'string' ? command.icon : command.icon(item.data);
|
|
490
|
+
};
|
|
491
|
+
const titleFor = (item, command) => {
|
|
492
|
+
if (!command?.title)
|
|
493
|
+
return '';
|
|
494
|
+
return typeof command.title === 'string' ? command.title : command.title(item.data);
|
|
495
|
+
};
|
|
496
|
+
// Stable autoId key generated from resolved icon and title.
|
|
497
|
+
const keyFor = (item, command) => {
|
|
498
|
+
const icon = iconFor(item, command);
|
|
499
|
+
const title = titleFor(item, command);
|
|
500
|
+
return `${icon || 'noicon'}-${StringUtilities.changeAliasLowerCase(title) || 'notitle'}`;
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Resolves command metadata for the current row once, then lets the template reuse it with `@let`.
|
|
505
|
+
*/
|
|
506
|
+
class CommandPipe {
|
|
507
|
+
transform(item, command) {
|
|
508
|
+
return {
|
|
509
|
+
disabled: this.#disabled(item, command),
|
|
510
|
+
title: this.#title(item, command),
|
|
511
|
+
icon: this.#icon(item, command),
|
|
512
|
+
htmlTemplate: this.#htmlTemplate(item, command),
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
#disabled = (item, command) => {
|
|
516
|
+
const d = command?.disabled;
|
|
517
|
+
if (d == null)
|
|
518
|
+
return false;
|
|
519
|
+
return typeof d === 'boolean' ? d : d(item.data);
|
|
520
|
+
};
|
|
521
|
+
#title = (item, command) => {
|
|
522
|
+
if (!command?.title)
|
|
523
|
+
return '';
|
|
524
|
+
return typeof command.title === 'string' ? command.title : command.title(item.data);
|
|
525
|
+
};
|
|
526
|
+
#icon = (item, command) => {
|
|
527
|
+
if (!command?.icon)
|
|
528
|
+
return '';
|
|
529
|
+
return typeof command.icon === 'string' ? command.icon : command.icon(item.data);
|
|
530
|
+
};
|
|
531
|
+
// Only child commands can provide htmlTemplate.
|
|
532
|
+
#htmlTemplate = (item, command) => {
|
|
533
|
+
const tpl = command?.htmlTemplate;
|
|
534
|
+
return typeof tpl === 'function' ? tpl(item.data) : undefined;
|
|
535
|
+
};
|
|
536
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: CommandPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
537
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.1.5", ngImport: i0, type: CommandPipe, isStandalone: true, name: "command" });
|
|
538
|
+
}
|
|
539
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: CommandPipe, decorators: [{
|
|
540
|
+
type: Pipe,
|
|
541
|
+
args: [{ name: 'command', standalone: true }]
|
|
542
|
+
}] });
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Type-guard: tree có nạp children lười (lazy) hay không.
|
|
546
|
+
* Dùng để narrow discriminated union `SdTableOptionTree` một cách an toàn —
|
|
547
|
+
* thay vì truy cập `option.onExpandChildren` trực tiếp trên union (chỉ tồn tại
|
|
548
|
+
* ở nhánh lazy).
|
|
549
|
+
*/
|
|
550
|
+
const isLazyTree = (option) => option?.loadType === 'lazy';
|
|
551
|
+
/**
|
|
552
|
+
* Key chứa mảng children trên object row.
|
|
553
|
+
* - `static`: lấy `childrenKey` đã cấu hình, mặc định `'children'`.
|
|
554
|
+
* - `lazy`: không có `childrenKey` riêng → luôn dùng `'children'` làm nơi lưu
|
|
555
|
+
* kết quả nạp lười.
|
|
556
|
+
*/
|
|
557
|
+
const getChildrenKey = (option) => (option?.loadType === 'static' ? option.childrenKey : undefined) ?? 'children';
|
|
558
|
+
const getChildrenFromData = (data, option) => {
|
|
559
|
+
const key = getChildrenKey(option);
|
|
560
|
+
const raw = data?.[key];
|
|
561
|
+
return Array.isArray(raw) ? raw : [];
|
|
562
|
+
};
|
|
563
|
+
/**
|
|
564
|
+
* Trạng thái bung mặc định cho một cấp.
|
|
565
|
+
* Chỉ `static` mới có `defaultExpanded`; lazy luôn trả `false` (không thể bung
|
|
566
|
+
* mặc định nhánh chưa nạp).
|
|
567
|
+
*/
|
|
568
|
+
const resolveDefaultExpanded = (level, option) => {
|
|
569
|
+
const def = option?.loadType === 'static' ? (option.defaultExpanded ?? false) : false;
|
|
570
|
+
if (def === true)
|
|
571
|
+
return true;
|
|
572
|
+
if (def === false)
|
|
573
|
+
return false;
|
|
574
|
+
if (typeof def === 'number')
|
|
575
|
+
return level < def;
|
|
576
|
+
return false;
|
|
577
|
+
};
|
|
578
|
+
/**
|
|
579
|
+
* Row có khả năng có children hay không (để hiện nút bung).
|
|
580
|
+
* - Có children embedded → true.
|
|
581
|
+
* - Lazy tree: dùng `hasChildren(row.data)` nếu được cấu hình; không thì luôn
|
|
582
|
+
* true (chưa biết cho tới khi nạp).
|
|
583
|
+
*/
|
|
584
|
+
const resolveHasChildren = (row, option) => {
|
|
585
|
+
const embedded = getChildrenFromData(row.data, option);
|
|
586
|
+
if (embedded.length > 0)
|
|
587
|
+
return true;
|
|
588
|
+
if (isLazyTree(option))
|
|
589
|
+
return option.hasChildren ? option.hasChildren(row.data) : true;
|
|
590
|
+
return false;
|
|
591
|
+
};
|
|
592
|
+
/** Row cần nạp lười (lazy) khi bung: là lazy tree và chưa có children embedded. */
|
|
593
|
+
const hasLazyChildren = (row, option) => {
|
|
594
|
+
if (!isLazyTree(option))
|
|
595
|
+
return false;
|
|
596
|
+
return getChildrenFromData(row.data, option).length === 0;
|
|
597
|
+
};
|
|
598
|
+
/**
|
|
599
|
+
* True nếu `data` HOẶC bất kỳ hậu duệ nào (theo `childrenKey`) thoả `predicate`.
|
|
600
|
+
*
|
|
601
|
+
* Dùng cho search ở cấp con (static tree, table `type: 'local'`): một nhánh
|
|
602
|
+
* 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
|
|
603
|
+
* khớp từ khoá. `visited` chống đệ quy vô hạn khi data có circular reference.
|
|
604
|
+
*/
|
|
605
|
+
const subtreeMatches = (data, predicate, option, visited = new Set()) => {
|
|
606
|
+
if (data == null || visited.has(data))
|
|
607
|
+
return false;
|
|
608
|
+
visited.add(data);
|
|
609
|
+
if (predicate(data))
|
|
610
|
+
return true;
|
|
611
|
+
for (const child of getChildrenFromData(data, option)) {
|
|
612
|
+
if (subtreeMatches(child, predicate, option, visited))
|
|
613
|
+
return true;
|
|
614
|
+
}
|
|
615
|
+
return false;
|
|
616
|
+
};
|
|
617
|
+
/**
|
|
618
|
+
* Lọc mảng children: chỉ giữ child có subtree khớp `predicate`.
|
|
619
|
+
*
|
|
620
|
+
* Trả về MẢNG MỚI nhưng GIỮ NGUYÊN object reference của từng child (không clone)
|
|
621
|
+
* — nhờ vậy `meta.id` (bám theo identity của object data, hoặc theo `option.rowKey`)
|
|
622
|
+
* ổn định, selection / trạng thái bung không bị mất khi từ khoá search đổi. Đây là
|
|
623
|
+
* bước "prune" của tính năng search-con.
|
|
624
|
+
*/
|
|
625
|
+
const filterMatchingChildren = (children, predicate, option) => children.filter(child => subtreeMatches(child, predicate, option));
|
|
626
|
+
const getVisibleChildrenData = (data, option, predicate) => {
|
|
627
|
+
const children = getChildrenFromData(data, option);
|
|
628
|
+
return predicate ? filterMatchingChildren(children, predicate, option) : children;
|
|
629
|
+
};
|
|
630
|
+
const saveTreeExpandState = (rows, expandState) => {
|
|
631
|
+
for (const row of rows) {
|
|
632
|
+
if (row.meta.tree?.isExpanded) {
|
|
633
|
+
expandState.set(row.meta.id, true);
|
|
634
|
+
}
|
|
635
|
+
const children = row.meta.tree?.childItems;
|
|
636
|
+
if (children?.length) {
|
|
637
|
+
saveTreeExpandState(children, expandState);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
const clearTreeChildCache = (rows) => {
|
|
642
|
+
for (const row of rows) {
|
|
643
|
+
const children = row.meta.tree?.childItems;
|
|
644
|
+
if (children?.length) {
|
|
645
|
+
clearTreeChildCache(children);
|
|
646
|
+
row.meta.tree.childItems = undefined;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
const initTreeMeta = (rows, option, args = {}) => {
|
|
651
|
+
const { expandState, treeSearchPredicate, level = 0, parentId } = args;
|
|
652
|
+
const searchActive = !!treeSearchPredicate;
|
|
653
|
+
for (const row of rows) {
|
|
654
|
+
const saved = expandState?.get(row.meta.id);
|
|
655
|
+
const hasChildren = searchActive
|
|
656
|
+
? getVisibleChildrenData(row.data, option, treeSearchPredicate).length > 0
|
|
657
|
+
: resolveHasChildren(row, option);
|
|
658
|
+
row.meta.tree = {
|
|
659
|
+
...row.meta.tree,
|
|
660
|
+
level,
|
|
661
|
+
parentId,
|
|
662
|
+
hasChildren,
|
|
663
|
+
isExpanded: searchActive ? hasChildren : (saved ?? resolveDefaultExpanded(level, option)),
|
|
664
|
+
isExpanding: false,
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
const flattenTree = (roots, option, visited = new Set()) => {
|
|
669
|
+
if (!option)
|
|
670
|
+
return roots;
|
|
671
|
+
const maxDepth = option.maxDepth;
|
|
672
|
+
const result = [];
|
|
673
|
+
const walk = (rows, level, parentPath) => {
|
|
674
|
+
rows.forEach((row, siblingIdx) => {
|
|
675
|
+
if (visited.has(row.meta.id))
|
|
676
|
+
return;
|
|
677
|
+
visited.add(row.meta.id);
|
|
678
|
+
row.meta.tree ??= { level, hasChildren: false, isExpanded: false };
|
|
679
|
+
row.meta.tree.level = level;
|
|
680
|
+
// why: hierarchical numbering (1, 1.2, 1.2.1, ...) — STT template join('.').
|
|
681
|
+
const indexPath = [...parentPath, siblingIdx + 1];
|
|
682
|
+
row.meta.tree.indexPath = indexPath;
|
|
683
|
+
result.push(row);
|
|
684
|
+
const canDescend = row.meta.tree.isExpanded && row.meta.tree.hasChildren;
|
|
685
|
+
const depthOk = maxDepth === undefined || level < maxDepth;
|
|
686
|
+
if (!canDescend || !depthOk)
|
|
687
|
+
return;
|
|
688
|
+
const children = row.meta.tree.childItems ?? [];
|
|
689
|
+
walk(children, level + 1, indexPath);
|
|
690
|
+
});
|
|
691
|
+
};
|
|
692
|
+
walk(roots, 0, []);
|
|
693
|
+
return result;
|
|
694
|
+
};
|
|
695
|
+
/** Thu thập mọi SdTableItem đã format trong cây (kể cả node đang collapse). */
|
|
696
|
+
const collectFormattedTreeRows = (roots) => {
|
|
697
|
+
const result = [];
|
|
698
|
+
const walk = (rows) => {
|
|
699
|
+
for (const row of rows) {
|
|
700
|
+
result.push(row);
|
|
701
|
+
const children = row.meta.tree?.childItems;
|
|
702
|
+
if (children?.length)
|
|
703
|
+
walk(children);
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
walk(roots);
|
|
707
|
+
return result;
|
|
708
|
+
};
|
|
709
|
+
/** Flatten ALL nodes regardless of expand state — used for export */
|
|
710
|
+
const flattenTreeAll = (roots, option, visited = new Set()) => {
|
|
711
|
+
if (!option)
|
|
712
|
+
return roots;
|
|
713
|
+
const maxDepth = option.maxDepth;
|
|
714
|
+
const result = [];
|
|
715
|
+
const walk = (rows, level) => {
|
|
716
|
+
for (const row of rows) {
|
|
717
|
+
if (visited.has(row.meta.id))
|
|
718
|
+
continue;
|
|
719
|
+
visited.add(row.meta.id);
|
|
720
|
+
result.push(row);
|
|
721
|
+
const depthOk = maxDepth === undefined || level < maxDepth;
|
|
722
|
+
if (!depthOk)
|
|
723
|
+
continue;
|
|
724
|
+
const children = row.meta.tree?.childItems ?? [];
|
|
725
|
+
walk(children, level + 1);
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
walk(roots, 0);
|
|
729
|
+
return result;
|
|
730
|
+
};
|
|
731
|
+
/** Flatten raw data tree for export (ignores expand state) */
|
|
732
|
+
const flattenDataTree = (roots, option, visited = new Set()) => {
|
|
733
|
+
if (!option)
|
|
734
|
+
return roots;
|
|
735
|
+
const maxDepth = option.maxDepth;
|
|
736
|
+
const result = [];
|
|
737
|
+
const walk = (rows, level) => {
|
|
738
|
+
for (const row of rows) {
|
|
739
|
+
if (visited.has(row))
|
|
740
|
+
continue;
|
|
741
|
+
visited.add(row);
|
|
742
|
+
result.push(row);
|
|
743
|
+
const depthOk = maxDepth === undefined || level < maxDepth;
|
|
744
|
+
if (!depthOk)
|
|
745
|
+
continue;
|
|
746
|
+
walk(getChildrenFromData(row, option), level + 1);
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
walk(roots, 0);
|
|
750
|
+
return result;
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
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]';
|
|
754
|
+
class SdTableMobileCardsComponent {
|
|
755
|
+
table = input.required(/* @ts-ignore */
|
|
756
|
+
...(ngDevMode ? [{ debugName: "table" }] : /* istanbul ignore next */ []));
|
|
757
|
+
rows = input.required(/* @ts-ignore */
|
|
758
|
+
...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
759
|
+
groupTemplate = input.required(/* @ts-ignore */
|
|
760
|
+
...(ngDevMode ? [{ debugName: "groupTemplate" }] : /* istanbul ignore next */ []));
|
|
761
|
+
#i18n = inject(I18nService);
|
|
762
|
+
#document = inject(DOCUMENT);
|
|
763
|
+
#element = inject(ElementRef);
|
|
764
|
+
#modal = inject(SdModal, { optional: true });
|
|
765
|
+
#drawer = inject(SdSideDrawer, { optional: true });
|
|
766
|
+
containerOpen = computed(() => (this.#modal?.isOpened() ?? true) && (this.#drawer?.isOpened() ?? true), /* @ts-ignore */
|
|
767
|
+
...(ngDevMode ? [{ debugName: "containerOpen" }] : /* istanbul ignore next */ []));
|
|
768
|
+
#commandMeta = new CommandPipe();
|
|
769
|
+
option = computed(() => this.table().tableOption(), /* @ts-ignore */
|
|
770
|
+
...(ngDevMode ? [{ debugName: "option" }] : /* istanbul ignore next */ []));
|
|
771
|
+
selected = computed(() => this.table().selectedTableItems(), /* @ts-ignore */
|
|
772
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
773
|
+
selectionMode = computed(() => !!this.option().selector?.visible && this.selected().length > 0, /* @ts-ignore */
|
|
774
|
+
...(ngDevMode ? [{ debugName: "selectionMode" }] : /* istanbul ignore next */ []));
|
|
775
|
+
active = signal(undefined, /* @ts-ignore */
|
|
776
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
777
|
+
resolvedCommands = signal(new Map(), /* @ts-ignore */
|
|
778
|
+
...(ngDevMode ? [{ debugName: "resolvedCommands" }] : /* istanbul ignore next */ []));
|
|
779
|
+
#commandRevision = 0;
|
|
780
|
+
#focusOrigin;
|
|
781
|
+
#pointer;
|
|
782
|
+
#dragged = false;
|
|
783
|
+
cards = computed(() => {
|
|
784
|
+
const table = this.table();
|
|
785
|
+
table.selectedTableItems();
|
|
786
|
+
table.treeRevision();
|
|
787
|
+
table.expandRevision();
|
|
788
|
+
const option = this.option();
|
|
789
|
+
let index = 0;
|
|
790
|
+
return this.rows().map(row => {
|
|
791
|
+
const dataIndex = row.meta.group?.isGroupHeader ? -1 : index++;
|
|
792
|
+
if (row.meta.group?.isGroupHeader)
|
|
793
|
+
return {
|
|
794
|
+
row,
|
|
795
|
+
label: '',
|
|
796
|
+
selectLabel: '',
|
|
797
|
+
commandLabel: '',
|
|
798
|
+
expandLabel: '',
|
|
799
|
+
treeLabel: '',
|
|
800
|
+
reorderDisabled: true,
|
|
801
|
+
expandDisabled: true,
|
|
802
|
+
context: { item: row.data, index: -1, selected: false, selectionDisabled: true, autoId: undefined },
|
|
803
|
+
};
|
|
804
|
+
const rawKey = option.rowKey ? Utilities.getNestedValue(row.data, option.rowKey) : undefined;
|
|
805
|
+
const keyLabel = rawKey != null && ['string', 'number', 'bigint', 'boolean'].includes(typeof rawKey) ? String(rawKey) : '';
|
|
806
|
+
const label = option.mobile?.rowLabel?.(row.data)?.trim() ||
|
|
807
|
+
keyLabel ||
|
|
808
|
+
this.#i18n.t('core.component.table.mobile.row', { index: table.pageOffset() + dataIndex + 1 });
|
|
809
|
+
return {
|
|
810
|
+
row,
|
|
811
|
+
label,
|
|
812
|
+
context: {
|
|
813
|
+
item: row.data,
|
|
814
|
+
index: dataIndex,
|
|
815
|
+
selected: !!row.meta.selector?.isSelected,
|
|
816
|
+
selectionDisabled: !!row.meta.selector?.disabled || !row.meta.selector?.visible,
|
|
817
|
+
autoId: table.autoId() ? `${table.autoId()}-mobile-row-${row.meta.id}` : undefined,
|
|
818
|
+
},
|
|
819
|
+
selectLabel: this.#i18n.t('core.component.table.mobile.select-row', { row: label }),
|
|
820
|
+
commandLabel: this.#i18n.t('core.component.table.mobile.commands-for', { row: label }),
|
|
821
|
+
expandLabel: this.#i18n.t('core.component.table.mobile.expand-row', { row: label }),
|
|
822
|
+
treeLabel: this.#i18n.t('core.component.table.mobile.level', { level: (row.meta.tree?.level ?? 0) + 1 }),
|
|
823
|
+
reorderDisabled: table.isReorderDisabled(row) || (row.meta.tree?.level ?? 0) > 0,
|
|
824
|
+
expandDisabled: !!option.expand?.disabled?.(row.data),
|
|
825
|
+
};
|
|
826
|
+
});
|
|
827
|
+
}, /* @ts-ignore */
|
|
828
|
+
...(ngDevMode ? [{ debugName: "cards" }] : /* istanbul ignore next */ []));
|
|
829
|
+
selectionSummary = computed(() => {
|
|
830
|
+
const total = this.selected().length;
|
|
831
|
+
this.table().treeRevision();
|
|
832
|
+
// why: thu gọn nhánh không biến child đã tải thành selection ngoài trang.
|
|
833
|
+
const onPage = collectFormattedTreeRows(this.table().items());
|
|
834
|
+
const ids = new Set(onPage.map(row => row.meta.id));
|
|
835
|
+
const here = this.selected().filter(row => ids.has(row.meta.id)).length;
|
|
836
|
+
return this.#i18n.t(here < total ? 'core.component.table.mobile.selected-across-pages' : 'core.component.table.mobile.selected', {
|
|
837
|
+
count: total,
|
|
838
|
+
here,
|
|
839
|
+
});
|
|
840
|
+
}, /* @ts-ignore */
|
|
841
|
+
...(ngDevMode ? [{ debugName: "selectionSummary" }] : /* istanbul ignore next */ []));
|
|
842
|
+
// Keep B's action array stable when only A's async hidden predicate resolves.
|
|
843
|
+
activeCommands = computed(() => {
|
|
844
|
+
const active = this.active();
|
|
845
|
+
return active ? this.resolvedCommands().get(active.row) : undefined;
|
|
846
|
+
}, /* @ts-ignore */
|
|
847
|
+
...(ngDevMode ? [{ debugName: "activeCommands" }] : /* istanbul ignore next */ []));
|
|
848
|
+
actions = computed(() => {
|
|
849
|
+
if (!this.containerOpen())
|
|
850
|
+
return [];
|
|
851
|
+
if (this.selectionMode()) {
|
|
852
|
+
const selected = this.selected();
|
|
853
|
+
return sdResolveTableActions(selected, this.option().selector?.actions).map((action, index) => this.#bulkAction(action, index, selected.map(row => row.data)));
|
|
854
|
+
}
|
|
855
|
+
const active = this.active();
|
|
856
|
+
if (!active)
|
|
857
|
+
return [];
|
|
858
|
+
return (this.activeCommands() ?? []).map((command, index) => this.#rowAction(command, active.row, index));
|
|
859
|
+
}, /* @ts-ignore */
|
|
860
|
+
...(ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []));
|
|
861
|
+
actionTitle = computed(() => this.selectionMode()
|
|
862
|
+
? this.selectionSummary()
|
|
863
|
+
: this.#i18n.t('core.component.table.mobile.row-commands', { row: this.active()?.label ?? '' }), /* @ts-ignore */
|
|
864
|
+
...(ngDevMode ? [{ debugName: "actionTitle" }] : /* istanbul ignore next */ []));
|
|
865
|
+
constructor() {
|
|
866
|
+
effect(onCleanup => {
|
|
867
|
+
const rows = this.rows();
|
|
868
|
+
this.table().dataRevision();
|
|
869
|
+
const commands = this.table().rowCommands();
|
|
870
|
+
const revision = ++this.#commandRevision;
|
|
871
|
+
untracked(() => {
|
|
872
|
+
this.closeCommand(false);
|
|
873
|
+
this.resolvedCommands.set(new Map());
|
|
874
|
+
});
|
|
875
|
+
for (const row of rows) {
|
|
876
|
+
if (row.meta.group?.isGroupHeader)
|
|
877
|
+
continue;
|
|
878
|
+
sdResolveTableCommands(row, commands)
|
|
879
|
+
.then(resolved => {
|
|
880
|
+
if (revision !== this.#commandRevision)
|
|
881
|
+
return;
|
|
882
|
+
this.resolvedCommands.update(current => new Map(current).set(row, resolved));
|
|
883
|
+
})
|
|
884
|
+
.catch(error => {
|
|
885
|
+
if (revision === this.#commandRevision)
|
|
886
|
+
console.error(error);
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
onCleanup(() => {
|
|
890
|
+
this.#commandRevision++;
|
|
891
|
+
});
|
|
892
|
+
});
|
|
893
|
+
effect(() => {
|
|
894
|
+
if (this.selectionMode() || this.table().loading() || !this.containerOpen())
|
|
895
|
+
untracked(() => this.closeCommand(false));
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
#actionTitle(title, index) {
|
|
899
|
+
return title || this.#i18n.t('core.component.table.mobile.action', { index: index + 1 });
|
|
900
|
+
}
|
|
901
|
+
#rowAction(command, row, index, parentDisabled = false) {
|
|
902
|
+
const meta = this.#commandMeta.transform(row, command);
|
|
903
|
+
const disabled = parentDisabled || meta.disabled;
|
|
904
|
+
return {
|
|
905
|
+
key: `${index}-${command.key}`,
|
|
906
|
+
title: this.#actionTitle(meta.title, index),
|
|
907
|
+
icon: meta.icon,
|
|
908
|
+
fontSet: command.fontSet,
|
|
909
|
+
color: 'color' in command ? command.color : undefined,
|
|
910
|
+
disabled,
|
|
911
|
+
htmlTemplate: meta.htmlTemplate,
|
|
912
|
+
...('children' in command
|
|
913
|
+
? { children: command.children.map((child, childIndex) => this.#rowAction(child, row, childIndex, disabled)) }
|
|
914
|
+
: { run: () => command.click(row.data) }),
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
#bulkAction(action, index, rows) {
|
|
918
|
+
return {
|
|
919
|
+
key: String(index),
|
|
920
|
+
title: this.#actionTitle(action.title, index),
|
|
921
|
+
icon: action.icon,
|
|
922
|
+
fontSet: action.fontSet ?? undefined,
|
|
923
|
+
color: action.color ?? undefined,
|
|
924
|
+
type: action.type,
|
|
925
|
+
...('children' in action
|
|
926
|
+
? { children: action.children.map((child, childIndex) => this.#bulkAction(child, childIndex, rows)) }
|
|
927
|
+
: { run: () => action.click(rows) }),
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
select(card) {
|
|
931
|
+
if (!this.option().selector?.visible || !card.row.meta.selector?.visible || card.row.meta.selector.disabled)
|
|
932
|
+
return;
|
|
933
|
+
const meta = card.row.meta.selector;
|
|
934
|
+
if (this.option().selector?.single && meta.isSelected)
|
|
935
|
+
return;
|
|
936
|
+
this.closeCommand(false);
|
|
937
|
+
meta.isSelected = this.option().selector?.single ? true : !meta.isSelected;
|
|
938
|
+
this.table().onSelect(card.row);
|
|
939
|
+
}
|
|
940
|
+
openCommand(card, event) {
|
|
941
|
+
if (this.selectionMode() || !this.resolvedCommands().get(card.row)?.length)
|
|
942
|
+
return;
|
|
943
|
+
this.#focusOrigin = event.currentTarget;
|
|
944
|
+
this.active.set(card);
|
|
181
945
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
946
|
+
closeCommand(restoreFocus = true) {
|
|
947
|
+
const wasActive = this.active();
|
|
948
|
+
this.active.set(undefined);
|
|
949
|
+
if (restoreFocus && wasActive) {
|
|
950
|
+
const fallback = this.#element.nativeElement.closest('sd-table');
|
|
951
|
+
(this.#focusOrigin?.isConnected ? this.#focusOrigin : fallback)?.focus();
|
|
952
|
+
}
|
|
953
|
+
this.#focusOrigin = undefined;
|
|
954
|
+
}
|
|
955
|
+
endActions() {
|
|
956
|
+
if (this.selectionMode())
|
|
957
|
+
this.table().onClearSelection();
|
|
958
|
+
else
|
|
959
|
+
this.closeCommand();
|
|
960
|
+
}
|
|
961
|
+
onCardClick(card, event) {
|
|
962
|
+
if (this.#dragged || this.#pointer?.moved || this.#isChildControl(event))
|
|
963
|
+
return;
|
|
964
|
+
const selectedText = this.#document.getSelection();
|
|
965
|
+
if (selectedText?.toString() && event.currentTarget.contains(selectedText.anchorNode))
|
|
966
|
+
return;
|
|
967
|
+
if (this.selectionMode() || !this.table().rowCommands().length)
|
|
968
|
+
this.select(card);
|
|
969
|
+
else
|
|
970
|
+
this.openCommand(card, event);
|
|
971
|
+
}
|
|
972
|
+
onCardKey(card, event) {
|
|
973
|
+
if (event.defaultPrevented)
|
|
974
|
+
return;
|
|
975
|
+
if (event.key === 'Escape') {
|
|
976
|
+
if (this.active()) {
|
|
977
|
+
event.preventDefault();
|
|
978
|
+
event.stopPropagation();
|
|
979
|
+
this.closeCommand();
|
|
980
|
+
}
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
if ((event.key !== 'Enter' && event.key !== ' ') || this.#isChildControl(event))
|
|
984
|
+
return;
|
|
985
|
+
event.preventDefault();
|
|
986
|
+
if (this.selectionMode() || !this.table().rowCommands().length)
|
|
987
|
+
this.select(card);
|
|
988
|
+
else
|
|
989
|
+
this.openCommand(card, event);
|
|
990
|
+
}
|
|
991
|
+
#isChildControl(event) {
|
|
992
|
+
for (const target of event.composedPath()) {
|
|
993
|
+
if (target === event.currentTarget)
|
|
994
|
+
break;
|
|
995
|
+
if (target instanceof Element && target.matches(INTERACTIVE))
|
|
996
|
+
return true;
|
|
997
|
+
}
|
|
998
|
+
return false;
|
|
999
|
+
}
|
|
1000
|
+
pointerStart(event) {
|
|
1001
|
+
this.#pointer = { x: event.clientX, y: event.clientY, moved: false };
|
|
1002
|
+
this.#dragged = false;
|
|
1003
|
+
}
|
|
1004
|
+
pointerMove(event) {
|
|
1005
|
+
if (this.#pointer && Math.hypot(event.clientX - this.#pointer.x, event.clientY - this.#pointer.y) > 8)
|
|
1006
|
+
this.#pointer.moved = true;
|
|
1007
|
+
}
|
|
1008
|
+
cancelPointer() {
|
|
1009
|
+
if (this.#pointer)
|
|
1010
|
+
this.#pointer.moved = true;
|
|
1011
|
+
}
|
|
1012
|
+
dragStart() {
|
|
1013
|
+
this.#dragged = true;
|
|
1014
|
+
this.closeCommand(false);
|
|
1015
|
+
}
|
|
1016
|
+
ngOnDestroy() {
|
|
1017
|
+
this.#commandRevision++;
|
|
1018
|
+
}
|
|
1019
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableMobileCardsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1020
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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", "cdkDropListHasAnchor"], 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[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { 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: "component", type: SdTableMobileActionsComponent, selector: "sd-table-mobile-actions", inputs: ["actions", "title", "selection", "count", "autoOpen", "autoId"], outputs: ["end"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
186
1021
|
}
|
|
187
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
188
|
-
type:
|
|
189
|
-
args: [{
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
1022
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableMobileCardsComponent, decorators: [{
|
|
1023
|
+
type: Component,
|
|
1024
|
+
args: [{ selector: 'sd-table-mobile-cards', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
1025
|
+
NgTemplateOutlet,
|
|
1026
|
+
NgStyle,
|
|
1027
|
+
DragDropModule,
|
|
1028
|
+
MatButtonModule,
|
|
1029
|
+
MatCheckboxModule,
|
|
1030
|
+
MatRadioModule,
|
|
1031
|
+
SdIcon,
|
|
1032
|
+
SdTranslatePipe,
|
|
1033
|
+
SdTableMobileActionsComponent,
|
|
1034
|
+
], 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"] }]
|
|
1035
|
+
}], ctorParameters: () => [], propDecorators: { table: [{ type: i0.Input, args: [{ isSignal: true, alias: "table", required: true }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: true }] }], groupTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupTemplate", required: true }] }] } });
|
|
193
1036
|
|
|
194
1037
|
// why: `columns` nhận `SdTableColumnAnyRow[]` (= `SdTableColumn<never>[]`). Hàm chỉ đọc
|
|
195
1038
|
// `field` / `type` / `filter.operator.default` — không bao giờ chạm dữ liệu hàng — nên không cần generic
|
|
@@ -432,19 +1275,22 @@ const SdConvertToPagingReq = (filterRequest, args) => {
|
|
|
432
1275
|
};
|
|
433
1276
|
|
|
434
1277
|
class ColumnTitleComponent {
|
|
435
|
-
column = input.required(
|
|
436
|
-
|
|
1278
|
+
column = input.required(/* @ts-ignore */
|
|
1279
|
+
...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
|
|
1280
|
+
titleDef = input(undefined, /* @ts-ignore */
|
|
1281
|
+
...(ngDevMode ? [{ debugName: "titleDef" }] : /* istanbul ignore next */ []));
|
|
437
1282
|
templateRef = computed(() => {
|
|
438
1283
|
const title = this.column()?.title;
|
|
439
1284
|
if (typeof title === 'object') {
|
|
440
1285
|
return title?.templateRef || this.titleDef()?.templateRef;
|
|
441
1286
|
}
|
|
442
1287
|
return this.titleDef()?.templateRef;
|
|
443
|
-
},
|
|
444
|
-
|
|
445
|
-
static
|
|
1288
|
+
}, /* @ts-ignore */
|
|
1289
|
+
...(ngDevMode ? [{ debugName: "templateRef" }] : /* istanbul ignore next */ []));
|
|
1290
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ColumnTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1291
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: ColumnTitleComponent, isStandalone: true, selector: "column-title", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, titleDef: { classPropertyName: "titleDef", publicName: "titleDef", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let _column = column();\n@let _templateRef = templateRef();\n\n@if (_templateRef) {\n <ng-container *ngTemplateOutlet=\"_templateRef\"></ng-container>\n} @else {\n {{ _column.title }}\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
446
1292
|
}
|
|
447
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1293
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ColumnTitleComponent, decorators: [{
|
|
448
1294
|
type: Component,
|
|
449
1295
|
args: [{ selector: 'column-title', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [NgTemplateOutlet], template: "@let _column = column();\n@let _templateRef = templateRef();\n\n@if (_templateRef) {\n <ng-container *ngTemplateOutlet=\"_templateRef\"></ng-container>\n} @else {\n {{ _column.title }}\n}\n" }]
|
|
450
1296
|
}], propDecorators: { column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], titleDef: [{ type: i0.Input, args: [{ isSignal: true, alias: "titleDef", required: false }] }] } });
|
|
@@ -455,13 +1301,18 @@ class ColumnFilterComponent {
|
|
|
455
1301
|
// 1. SIGNAL INPUTS
|
|
456
1302
|
// ==========================================
|
|
457
1303
|
autoIdInput = input(undefined, { ...(ngDevMode ? { debugName: "autoIdInput" } : /* istanbul ignore next */ {}), alias: 'autoId' });
|
|
458
|
-
column = input.required(
|
|
459
|
-
|
|
460
|
-
|
|
1304
|
+
column = input.required(/* @ts-ignore */
|
|
1305
|
+
...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
|
|
1306
|
+
columnFilter = input({}, /* @ts-ignore */
|
|
1307
|
+
...(ngDevMode ? [{ debugName: "columnFilter" }] : /* istanbul ignore next */ []));
|
|
1308
|
+
cacheValues = input(undefined, /* @ts-ignore */
|
|
1309
|
+
...(ngDevMode ? [{ debugName: "cacheValues" }] : /* istanbul ignore next */ []));
|
|
461
1310
|
// Parent vẫn truyền `value` vào — giữ input để không phá hợp đồng (template không dùng trực tiếp).
|
|
462
|
-
value = input(
|
|
1311
|
+
value = input(/* @ts-ignore */
|
|
1312
|
+
...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
463
1313
|
// 2-way bind từ parent: parent đọc/ghi operator hiện tại của column.
|
|
464
|
-
operator = model(undefined,
|
|
1314
|
+
operator = model(undefined, /* @ts-ignore */
|
|
1315
|
+
...(ngDevMode ? [{ debugName: "operator" }] : /* istanbul ignore next */ []));
|
|
465
1316
|
// Khi true (mobile context): gán column.title vào [label] của các control con
|
|
466
1317
|
// để parent không phải render <label> riêng. Default false (desktop inline).
|
|
467
1318
|
isMobile = input(false, { ...(ngDevMode ? { debugName: "isMobile" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
@@ -478,9 +1329,11 @@ class ColumnFilterComponent {
|
|
|
478
1329
|
const base = this.autoIdInput();
|
|
479
1330
|
const field = this.column()?.field ?? '';
|
|
480
1331
|
return base ? `${base}-inline-${field}` : '';
|
|
481
|
-
},
|
|
1332
|
+
}, /* @ts-ignore */
|
|
1333
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
482
1334
|
// Cho phép parent custom filter qua templateRef (column.filter.filterDef).
|
|
483
|
-
templateRef = computed(() => this.column()?.filter?.filterDef,
|
|
1335
|
+
templateRef = computed(() => this.column()?.filter?.filterDef, /* @ts-ignore */
|
|
1336
|
+
...(ngDevMode ? [{ debugName: "templateRef" }] : /* istanbul ignore next */ []));
|
|
484
1337
|
// Label cho control con khi isMobile=true. column.title có thể là string hoặc { title, templateRef }.
|
|
485
1338
|
// Trả undefined khi không phải mobile → control không hiển thị label (giữ behavior desktop cũ).
|
|
486
1339
|
label = computed(() => {
|
|
@@ -491,7 +1344,8 @@ class ColumnFilterComponent {
|
|
|
491
1344
|
if (!title)
|
|
492
1345
|
return col?.field;
|
|
493
1346
|
return typeof title === 'string' ? title : title.title || col?.field;
|
|
494
|
-
},
|
|
1347
|
+
}, /* @ts-ignore */
|
|
1348
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
495
1349
|
// Danh sách operator hiển thị dựa trên column config
|
|
496
1350
|
operators = computed(() => {
|
|
497
1351
|
const col = this.column();
|
|
@@ -499,9 +1353,11 @@ class ColumnFilterComponent {
|
|
|
499
1353
|
return OPERATORS.filter(e => col.filter?.operator?.list?.includes?.(e.value));
|
|
500
1354
|
}
|
|
501
1355
|
return [];
|
|
502
|
-
},
|
|
1356
|
+
}, /* @ts-ignore */
|
|
1357
|
+
...(ngDevMode ? [{ debugName: "operators" }] : /* istanbul ignore next */ []));
|
|
503
1358
|
// Chỉ các Operator value cho phép — truyền vào <sd-operator [operators]>.
|
|
504
|
-
operatorValues = computed(() => this.operators().map(o => o.value),
|
|
1359
|
+
operatorValues = computed(() => this.operators().map(o => o.value), /* @ts-ignore */
|
|
1360
|
+
...(ngDevMode ? [{ debugName: "operatorValues" }] : /* istanbul ignore next */ []));
|
|
505
1361
|
// Items cho sd-select khi column type = values / lazy-values
|
|
506
1362
|
items = computed(() => {
|
|
507
1363
|
const col = this.column();
|
|
@@ -518,7 +1374,8 @@ class ColumnFilterComponent {
|
|
|
518
1374
|
return col.option.items;
|
|
519
1375
|
}
|
|
520
1376
|
return [];
|
|
521
|
-
},
|
|
1377
|
+
}, /* @ts-ignore */
|
|
1378
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
522
1379
|
constructor() {
|
|
523
1380
|
// Khởi tạo default { from: null, to: null } cho split-date / split-number / daterange.
|
|
524
1381
|
// Chạy trước lần render đầu nên template thấy giá trị đã init — không cần markForCheck.
|
|
@@ -563,10 +1420,10 @@ class ColumnFilterComponent {
|
|
|
563
1420
|
col.filter.onChange(value, col, filter);
|
|
564
1421
|
};
|
|
565
1422
|
#filterValueHash = (value) => Utilities.hash({ value });
|
|
566
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
567
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", 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 });
|
|
1423
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ColumnFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1424
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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 });
|
|
568
1425
|
}
|
|
569
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1426
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ColumnFilterComponent, decorators: [{
|
|
570
1427
|
type: Component,
|
|
571
1428
|
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
1429
|
}], ctorParameters: () => [], propDecorators: { autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], columnFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnFilter", required: false }] }], cacheValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "cacheValues", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], operator: [{ type: i0.Input, args: [{ isSignal: true, alias: "operator", required: false }] }, { type: i0.Output, args: ["operatorChange"] }], isMobile: [{ type: i0.Input, args: [{ isSignal: true, alias: "isMobile", required: false }] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], filterCommit: [{ type: i0.Output, args: ["filterCommit"] }] } });
|
|
@@ -586,224 +1443,15 @@ class FilterValuesPipe {
|
|
|
586
1443
|
}
|
|
587
1444
|
return [];
|
|
588
1445
|
}
|
|
589
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
590
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
1446
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: FilterValuesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1447
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.1.5", ngImport: i0, type: FilterValuesPipe, isStandalone: true, name: "filterValues" });
|
|
591
1448
|
}
|
|
592
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1449
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: FilterValuesPipe, decorators: [{
|
|
593
1450
|
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)
|
|
742
|
-
return;
|
|
743
|
-
const children = row.meta.tree.childItems ?? [];
|
|
744
|
-
walk(children, level + 1, indexPath);
|
|
745
|
-
});
|
|
746
|
-
};
|
|
747
|
-
walk(roots, 0, []);
|
|
748
|
-
return result;
|
|
749
|
-
};
|
|
750
|
-
/** Thu thập mọi SdTableItem đã format trong cây (kể cả node đang collapse). */
|
|
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
|
-
}
|
|
760
|
-
};
|
|
761
|
-
walk(roots);
|
|
762
|
-
return result;
|
|
763
|
-
};
|
|
764
|
-
/** Flatten ALL nodes regardless of expand state — used for export */
|
|
765
|
-
const flattenTreeAll = (roots, option, visited = new Set()) => {
|
|
766
|
-
if (!option)
|
|
767
|
-
return roots;
|
|
768
|
-
const maxDepth = option.maxDepth;
|
|
769
|
-
const result = [];
|
|
770
|
-
const walk = (rows, level) => {
|
|
771
|
-
for (const row of rows) {
|
|
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
|
-
}
|
|
782
|
-
};
|
|
783
|
-
walk(roots, 0);
|
|
784
|
-
return result;
|
|
785
|
-
};
|
|
786
|
-
/** Flatten raw data tree for export (ignores expand state) */
|
|
787
|
-
const flattenDataTree = (roots, option, visited = new Set()) => {
|
|
788
|
-
if (!option)
|
|
789
|
-
return roots;
|
|
790
|
-
const maxDepth = option.maxDepth;
|
|
791
|
-
const result = [];
|
|
792
|
-
const walk = (rows, level) => {
|
|
793
|
-
for (const row of rows) {
|
|
794
|
-
if (visited.has(row))
|
|
795
|
-
continue;
|
|
796
|
-
visited.add(row);
|
|
797
|
-
result.push(row);
|
|
798
|
-
const depthOk = maxDepth === undefined || level < maxDepth;
|
|
799
|
-
if (!depthOk)
|
|
800
|
-
continue;
|
|
801
|
-
walk(getChildrenFromData(row, option), level + 1);
|
|
802
|
-
}
|
|
803
|
-
};
|
|
804
|
-
walk(roots, 0);
|
|
805
|
-
return result;
|
|
806
|
-
};
|
|
1451
|
+
args: [{
|
|
1452
|
+
name: 'filterValues',
|
|
1453
|
+
}]
|
|
1454
|
+
}], ctorParameters: () => [] });
|
|
807
1455
|
|
|
808
1456
|
class SdTreePipe {
|
|
809
1457
|
transform(items, treeOption, _revision = 0) {
|
|
@@ -811,10 +1459,10 @@ class SdTreePipe {
|
|
|
811
1459
|
return items;
|
|
812
1460
|
return flattenTree(items, treeOption);
|
|
813
1461
|
}
|
|
814
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
815
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
1462
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTreePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1463
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.1.5", ngImport: i0, type: SdTreePipe, isStandalone: true, name: "sdTree" });
|
|
816
1464
|
}
|
|
817
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1465
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTreePipe, decorators: [{
|
|
818
1466
|
type: Pipe,
|
|
819
1467
|
args: [{ name: 'sdTree' }]
|
|
820
1468
|
}] });
|
|
@@ -824,9 +1472,12 @@ class ExternalFilterComponent {
|
|
|
824
1472
|
// 1. SIGNAL INPUTS
|
|
825
1473
|
// ==========================================
|
|
826
1474
|
autoIdInput = input(undefined, { ...(ngDevMode ? { debugName: "autoIdInput" } : /* istanbul ignore next */ {}), alias: 'autoId' });
|
|
827
|
-
filter = input(undefined,
|
|
828
|
-
|
|
829
|
-
|
|
1475
|
+
filter = input(undefined, /* @ts-ignore */
|
|
1476
|
+
...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
|
|
1477
|
+
externalFilters = input([], /* @ts-ignore */
|
|
1478
|
+
...(ngDevMode ? [{ debugName: "externalFilters" }] : /* istanbul ignore next */ []));
|
|
1479
|
+
filterRegister = input(undefined, /* @ts-ignore */
|
|
1480
|
+
...(ngDevMode ? [{ debugName: "filterRegister" }] : /* istanbul ignore next */ []));
|
|
830
1481
|
// ==========================================
|
|
831
1482
|
// 2. INJECT
|
|
832
1483
|
// ==========================================
|
|
@@ -834,9 +1485,12 @@ class ExternalFilterComponent {
|
|
|
834
1485
|
// ==========================================
|
|
835
1486
|
// 3. STATE (signals)
|
|
836
1487
|
// ==========================================
|
|
837
|
-
externalFilter = signal({},
|
|
838
|
-
|
|
839
|
-
|
|
1488
|
+
externalFilter = signal({}, /* @ts-ignore */
|
|
1489
|
+
...(ngDevMode ? [{ debugName: "externalFilter" }] : /* istanbul ignore next */ []));
|
|
1490
|
+
inlineExternal = signal({}, /* @ts-ignore */
|
|
1491
|
+
...(ngDevMode ? [{ debugName: "inlineExternal" }] : /* istanbul ignore next */ []));
|
|
1492
|
+
filtered = signal(false, /* @ts-ignore */
|
|
1493
|
+
...(ngDevMode ? [{ debugName: "filtered" }] : /* istanbul ignore next */ []));
|
|
840
1494
|
isMobileOrTablet = BrowserUtilities.isMobile();
|
|
841
1495
|
// FormGroup là instance, parent đọc qua viewChild — giữ readonly field.
|
|
842
1496
|
form = new FormGroup({});
|
|
@@ -847,11 +1501,14 @@ class ExternalFilterComponent {
|
|
|
847
1501
|
autoId = computed(() => {
|
|
848
1502
|
const base = this.autoIdInput();
|
|
849
1503
|
return base ? `${base}-external-` : '';
|
|
850
|
-
},
|
|
1504
|
+
}, /* @ts-ignore */
|
|
1505
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
851
1506
|
// Layout column: 4 filter/row → 3 cột; mặc định 6 filter/row → 2 cột.
|
|
852
|
-
col = computed(() => (this.filter()?.externalFilterPerRow === 4 ? 3 : 2),
|
|
1507
|
+
col = computed(() => (this.filter()?.externalFilterPerRow === 4 ? 3 : 2), /* @ts-ignore */
|
|
1508
|
+
...(ngDevMode ? [{ debugName: "col" }] : /* istanbul ignore next */ []));
|
|
853
1509
|
// Normalize externalFilters về mảng (input có thể null/undefined).
|
|
854
|
-
filterItems = computed(() => this.externalFilters() || [],
|
|
1510
|
+
filterItems = computed(() => this.externalFilters() || [], /* @ts-ignore */
|
|
1511
|
+
...(ngDevMode ? [{ debugName: "filterItems" }] : /* istanbul ignore next */ []));
|
|
855
1512
|
constructor() {
|
|
856
1513
|
// Subscribe filterRegister observers — re-subscribe khi input đổi, cleanup khi đổi/destroy.
|
|
857
1514
|
// QUAN TRỌNG: phải wrap untracked(). Observer có startWith() → emit ĐỒNG BỘ ngay khi
|
|
@@ -943,10 +1600,10 @@ class ExternalFilterComponent {
|
|
|
943
1600
|
return val !== undefined && val !== null && val !== '';
|
|
944
1601
|
});
|
|
945
1602
|
};
|
|
946
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
947
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", 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: "ngmodule", type: MatMenuModule }, { kind: "component", type: i2.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: i2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i2.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: "component", type: SdCheckbox, selector: "sd-checkbox", inputs: ["autoId", "name", "form", "label", "color", "disabled", "viewed", "inlineError", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: FilterValuesPipe, name: "filterValues" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1603
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ExternalFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1604
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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: "ngmodule", type: MatMenuModule }, { kind: "component", type: i2$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: i2$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i2$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: "component", type: SdCheckbox, selector: "sd-checkbox", inputs: ["autoId", "name", "form", "label", "color", "disabled", "viewed", "inlineError", "model"], outputs: ["modelChange", "sdChange"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: FilterValuesPipe, name: "filterValues" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
948
1605
|
}
|
|
949
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1606
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ExternalFilterComponent, decorators: [{
|
|
950
1607
|
type: Component,
|
|
951
1608
|
args: [{ selector: 'external-filter', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
952
1609
|
CommonModule,
|
|
@@ -984,32 +1641,46 @@ class MobileFilterComponent {
|
|
|
984
1641
|
// 1. SIGNAL INPUTS
|
|
985
1642
|
// ==========================================
|
|
986
1643
|
autoIdInput = input(undefined, { ...(ngDevMode ? { debugName: "autoIdInput" } : /* istanbul ignore next */ {}), alias: 'autoId' });
|
|
987
|
-
filter = input(undefined,
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1644
|
+
filter = input(undefined, /* @ts-ignore */
|
|
1645
|
+
...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
|
|
1646
|
+
externalFilters = input([], /* @ts-ignore */
|
|
1647
|
+
...(ngDevMode ? [{ debugName: "externalFilters" }] : /* istanbul ignore next */ []));
|
|
1648
|
+
columns = input([], /* @ts-ignore */
|
|
1649
|
+
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
1650
|
+
filterDefs = input([], /* @ts-ignore */
|
|
1651
|
+
...(ngDevMode ? [{ debugName: "filterDefs" }] : /* istanbul ignore next */ []));
|
|
1652
|
+
filterRegister = input(undefined, /* @ts-ignore */
|
|
1653
|
+
...(ngDevMode ? [{ debugName: "filterRegister" }] : /* istanbul ignore next */ []));
|
|
1654
|
+
cacheValues = input(undefined, /* @ts-ignore */
|
|
1655
|
+
...(ngDevMode ? [{ debugName: "cacheValues" }] : /* istanbul ignore next */ []));
|
|
993
1656
|
// ==========================================
|
|
994
1657
|
// 2. VIEW QUERY
|
|
995
1658
|
// ==========================================
|
|
996
|
-
drawer = viewChild.required(SdSideDrawer
|
|
1659
|
+
drawer = viewChild.required(SdSideDrawer, /* @ts-ignore */
|
|
1660
|
+
...(ngDevMode ? [{ debugName: "drawer" }] : /* istanbul ignore next */ []));
|
|
997
1661
|
// ==========================================
|
|
998
1662
|
// 3. STATE — local working copies; chỉ flush khi Apply.
|
|
999
1663
|
// ==========================================
|
|
1000
|
-
workingColumnFilter = signal({},
|
|
1001
|
-
|
|
1002
|
-
|
|
1664
|
+
workingColumnFilter = signal({}, /* @ts-ignore */
|
|
1665
|
+
...(ngDevMode ? [{ debugName: "workingColumnFilter" }] : /* istanbul ignore next */ []));
|
|
1666
|
+
workingColumnOperator = signal({}, /* @ts-ignore */
|
|
1667
|
+
...(ngDevMode ? [{ debugName: "workingColumnOperator" }] : /* istanbul ignore next */ []));
|
|
1668
|
+
workingExternalFilter = signal({}, /* @ts-ignore */
|
|
1669
|
+
...(ngDevMode ? [{ debugName: "workingExternalFilter" }] : /* istanbul ignore next */ []));
|
|
1003
1670
|
// ==========================================
|
|
1004
1671
|
// 4. COMPUTED
|
|
1005
1672
|
// ==========================================
|
|
1006
1673
|
autoId = computed(() => {
|
|
1007
1674
|
const base = this.autoIdInput();
|
|
1008
1675
|
return base ? `${base}-mobile-filter-` : '';
|
|
1009
|
-
},
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1676
|
+
}, /* @ts-ignore */
|
|
1677
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
1678
|
+
externalFilterItems = computed(() => this.externalFilters() || [], /* @ts-ignore */
|
|
1679
|
+
...(ngDevMode ? [{ debugName: "externalFilterItems" }] : /* istanbul ignore next */ []));
|
|
1680
|
+
columnItems = computed(() => this.columns() || [], /* @ts-ignore */
|
|
1681
|
+
...(ngDevMode ? [{ debugName: "columnItems" }] : /* istanbul ignore next */ []));
|
|
1682
|
+
filterDefItems = computed(() => this.filterDefs() || [], /* @ts-ignore */
|
|
1683
|
+
...(ngDevMode ? [{ debugName: "filterDefItems" }] : /* istanbul ignore next */ []));
|
|
1013
1684
|
// ==========================================
|
|
1014
1685
|
// 5. PUBLIC API
|
|
1015
1686
|
// ==========================================
|
|
@@ -1038,10 +1709,10 @@ class MobileFilterComponent {
|
|
|
1038
1709
|
// Local working state — không ghi gì khi cancel, chỉ đóng drawer.
|
|
1039
1710
|
this.drawer().close();
|
|
1040
1711
|
};
|
|
1041
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1042
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", 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: "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: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: FilterValuesPipe, name: "filterValues" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1712
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: MobileFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1713
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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: "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: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: FilterValuesPipe, name: "filterValues" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1043
1714
|
}
|
|
1044
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1715
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: MobileFilterComponent, decorators: [{
|
|
1045
1716
|
type: Component,
|
|
1046
1717
|
args: [{ selector: 'mobile-filter', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
1047
1718
|
CommonModule,
|
|
@@ -1059,95 +1730,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1059
1730
|
], 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
1731
|
}], propDecorators: { autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], externalFilters: [{ type: i0.Input, args: [{ isSignal: true, alias: "externalFilters", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], filterDefs: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterDefs", required: false }] }], filterRegister: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterRegister", required: false }] }], cacheValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "cacheValues", required: false }] }], drawer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdSideDrawer), { isSignal: true }] }] } });
|
|
1061
1732
|
|
|
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,
|
|
1127
|
-
};
|
|
1128
|
-
}
|
|
1129
|
-
class ActionFilterPipe {
|
|
1130
|
-
transform = (selectedItems, actions) => sdResolveTableActions(selectedItems, actions);
|
|
1131
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ActionFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1132
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.17", ngImport: i0, type: ActionFilterPipe, isStandalone: true, name: "actionFilter" });
|
|
1133
|
-
}
|
|
1134
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ActionFilterPipe, decorators: [{
|
|
1135
|
-
type: Pipe,
|
|
1136
|
-
args: [{
|
|
1137
|
-
name: 'actionFilter',
|
|
1138
|
-
}]
|
|
1139
|
-
}] });
|
|
1140
|
-
|
|
1141
1733
|
class SelectorActionComponent {
|
|
1142
1734
|
// ==========================================
|
|
1143
1735
|
// 1. SIGNAL INPUTS / OUTPUTS
|
|
1144
1736
|
// ==========================================
|
|
1145
1737
|
autoIdInput = input(undefined, { ...(ngDevMode ? { debugName: "autoIdInput" } : /* istanbul ignore next */ {}), alias: 'autoId' });
|
|
1146
|
-
tableOption = input(undefined,
|
|
1147
|
-
|
|
1738
|
+
tableOption = input(undefined, /* @ts-ignore */
|
|
1739
|
+
...(ngDevMode ? [{ debugName: "tableOption" }] : /* istanbul ignore next */ []));
|
|
1740
|
+
selectedTableItems = input(undefined, /* @ts-ignore */
|
|
1741
|
+
...(ngDevMode ? [{ debugName: "selectedTableItems" }] : /* istanbul ignore next */ []));
|
|
1148
1742
|
clear = output();
|
|
1149
1743
|
// Base autoId (đã là `components-table-<scope>` từ parent), '' khi parent không set.
|
|
1150
|
-
autoId = computed(() => this.autoIdInput() || '',
|
|
1744
|
+
autoId = computed(() => this.autoIdInput() || '', /* @ts-ignore */
|
|
1745
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
1151
1746
|
// ==========================================
|
|
1152
1747
|
// 2. INJECT
|
|
1153
1748
|
// ==========================================
|
|
@@ -1163,13 +1758,16 @@ class SelectorActionComponent {
|
|
|
1163
1758
|
return msg(this.selectedTableItems()?.map(e => e.data));
|
|
1164
1759
|
}
|
|
1165
1760
|
return msg;
|
|
1166
|
-
},
|
|
1761
|
+
}, /* @ts-ignore */
|
|
1762
|
+
...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
1167
1763
|
/** Bulk actions the current selection is allowed to run. */
|
|
1168
|
-
actions = computed(() => sdResolveTableActions(this.selectedTableItems(), this.tableOption()?.selector?.actions),
|
|
1764
|
+
actions = computed(() => sdResolveTableActions(this.selectedTableItems(), this.tableOption()?.selector?.actions), /* @ts-ignore */
|
|
1765
|
+
...(ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []));
|
|
1169
1766
|
// why: chọn dòng mà KHÔNG có action nào chạy được thì thanh quick-action chỉ còn đúng một nút ✕ —
|
|
1170
1767
|
// nó che nội dung bảng để đổi lấy thông tin người dùng đã thấy (dòng đang highlight + checkbox).
|
|
1171
1768
|
// Không có action ⇒ không mở thanh; bỏ chọn bằng chính checkbox ở header/dòng.
|
|
1172
|
-
opened = computed(() => !!this.selectedTableItems()?.length && this.actions().length > 0,
|
|
1769
|
+
opened = computed(() => !!this.selectedTableItems()?.length && this.actions().length > 0, /* @ts-ignore */
|
|
1770
|
+
...(ngDevMode ? [{ debugName: "opened" }] : /* istanbul ignore next */ []));
|
|
1173
1771
|
// ==========================================
|
|
1174
1772
|
// 4. HANDLERS
|
|
1175
1773
|
// ==========================================
|
|
@@ -1179,10 +1777,10 @@ class SelectorActionComponent {
|
|
|
1179
1777
|
action.click(this.selectedTableItems()?.map(e => e.data));
|
|
1180
1778
|
}
|
|
1181
1779
|
};
|
|
1182
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1183
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
1780
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SelectorActionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1781
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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: i2$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: i2$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i2$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
1782
|
}
|
|
1185
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1783
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SelectorActionComponent, decorators: [{
|
|
1186
1784
|
type: Component,
|
|
1187
1785
|
args: [{ selector: 'selector-action', changeDetection: ChangeDetectionStrategy.OnPush, imports: [SdIcon, MatMenuModule, SdButton, SdQuickAction], 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"] }]
|
|
1188
1786
|
}], propDecorators: { autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], tableOption: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableOption", required: false }] }], selectedTableItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedTableItems", required: false }] }], clear: [{ type: i0.Output, args: ["clear"] }] } });
|
|
@@ -1412,10 +2010,10 @@ class ConfigService {
|
|
|
1412
2010
|
columns,
|
|
1413
2011
|
};
|
|
1414
2012
|
};
|
|
1415
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1416
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
2013
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2014
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ConfigService });
|
|
1417
2015
|
}
|
|
1418
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2016
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ConfigService, decorators: [{
|
|
1419
2017
|
type: Injectable
|
|
1420
2018
|
}], ctorParameters: () => [] });
|
|
1421
2019
|
|
|
@@ -1424,15 +2022,19 @@ class ConfigComponent {
|
|
|
1424
2022
|
// 1. SIGNAL INPUTS / OUTPUTS
|
|
1425
2023
|
// ==========================================
|
|
1426
2024
|
autoIdInput = input(undefined, { ...(ngDevMode ? { debugName: "autoIdInput" } : /* istanbul ignore next */ {}), alias: 'autoId' });
|
|
1427
|
-
tableOption = input(undefined,
|
|
2025
|
+
tableOption = input(undefined, /* @ts-ignore */
|
|
2026
|
+
...(ngDevMode ? [{ debugName: "tableOption" }] : /* istanbul ignore next */ []));
|
|
1428
2027
|
changes = output();
|
|
1429
2028
|
// Base autoId (đã là `components-table-<scope>` từ parent), '' khi parent không set.
|
|
1430
|
-
autoId = computed(() => this.autoIdInput() || '',
|
|
2029
|
+
autoId = computed(() => this.autoIdInput() || '', /* @ts-ignore */
|
|
2030
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
1431
2031
|
// ==========================================
|
|
1432
2032
|
// 2. SIGNAL QUERIES
|
|
1433
2033
|
// ==========================================
|
|
1434
|
-
modal = viewChild(SdModal,
|
|
1435
|
-
|
|
2034
|
+
modal = viewChild(SdModal, /* @ts-ignore */
|
|
2035
|
+
...(ngDevMode ? [{ debugName: "modal" }] : /* istanbul ignore next */ []));
|
|
2036
|
+
table = viewChild.required(MatTable, /* @ts-ignore */
|
|
2037
|
+
...(ngDevMode ? [{ debugName: "table" }] : /* istanbul ignore next */ []));
|
|
1436
2038
|
// ==========================================
|
|
1437
2039
|
// 3. INJECT
|
|
1438
2040
|
// ==========================================
|
|
@@ -1443,7 +2045,8 @@ class ConfigComponent {
|
|
|
1443
2045
|
// ==========================================
|
|
1444
2046
|
// 4. STATE
|
|
1445
2047
|
// ==========================================
|
|
1446
|
-
configuration = signal(undefined,
|
|
2048
|
+
configuration = signal(undefined, /* @ts-ignore */
|
|
2049
|
+
...(ngDevMode ? [{ debugName: "configuration" }] : /* istanbul ignore next */ []));
|
|
1447
2050
|
// dragDisabled không nên là signal (mutated trong drag handlers, không trigger render).
|
|
1448
2051
|
dragDisabled = true;
|
|
1449
2052
|
#setting;
|
|
@@ -1503,12 +2106,12 @@ class ConfigComponent {
|
|
|
1503
2106
|
handleMouseUp() {
|
|
1504
2107
|
this.dragDisabled = true;
|
|
1505
2108
|
}
|
|
1506
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1507
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", 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", "cdkDropListHasAnchor"], 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" }] });
|
|
2109
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ConfigComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2110
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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", "cdkDropListHasAnchor"], 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" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
1508
2111
|
}
|
|
1509
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ConfigComponent, decorators: [{
|
|
1510
2113
|
type: Component,
|
|
1511
|
-
args: [{ selector: 'config', standalone: true, imports: [
|
|
2114
|
+
args: [{ changeDetection: ChangeDetectionStrategy.Eager, selector: 'config', standalone: true, imports: [
|
|
1512
2115
|
CommonModule,
|
|
1513
2116
|
FormsModule,
|
|
1514
2117
|
MatTableModule,
|
|
@@ -1527,10 +2130,10 @@ class ToStringPipe {
|
|
|
1527
2130
|
transform(value) {
|
|
1528
2131
|
return value !== null && value !== undefined ? String(value) : '';
|
|
1529
2132
|
}
|
|
1530
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1531
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
2133
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ToStringPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2134
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.1.5", ngImport: i0, type: ToStringPipe, isStandalone: true, name: "asString" });
|
|
1532
2135
|
}
|
|
1533
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2136
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ToStringPipe, decorators: [{
|
|
1534
2137
|
type: Pipe,
|
|
1535
2138
|
args: [{
|
|
1536
2139
|
name: 'asString',
|
|
@@ -1540,19 +2143,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
1540
2143
|
class ViewComponent {
|
|
1541
2144
|
// Inject
|
|
1542
2145
|
#cdr = inject(ChangeDetectorRef);
|
|
1543
|
-
contentContainer = viewChild('contentContainer',
|
|
1544
|
-
|
|
1545
|
-
|
|
2146
|
+
contentContainer = viewChild('contentContainer', /* @ts-ignore */
|
|
2147
|
+
...(ngDevMode ? [{ debugName: "contentContainer" }] : /* istanbul ignore next */ []));
|
|
2148
|
+
isCollapsed = signal(true, /* @ts-ignore */
|
|
2149
|
+
...(ngDevMode ? [{ debugName: "isCollapsed" }] : /* istanbul ignore next */ []));
|
|
2150
|
+
isOverflowing = signal(false, /* @ts-ignore */
|
|
2151
|
+
...(ngDevMode ? [{ debugName: "isOverflowing" }] : /* istanbul ignore next */ []));
|
|
1546
2152
|
// Inputs
|
|
1547
|
-
autoId = input.required(
|
|
1548
|
-
|
|
1549
|
-
|
|
2153
|
+
autoId = input.required(/* @ts-ignore */
|
|
2154
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
2155
|
+
column = input.required(/* @ts-ignore */
|
|
2156
|
+
...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
|
|
2157
|
+
item = input.required(/* @ts-ignore */
|
|
2158
|
+
...(ngDevMode ? [{ debugName: "item" }] : /* istanbul ignore next */ []));
|
|
1550
2159
|
truncateEnable = computed(() => {
|
|
1551
2160
|
return this.column()?.cell?.truncate?.enable;
|
|
1552
|
-
},
|
|
2161
|
+
}, /* @ts-ignore */
|
|
2162
|
+
...(ngDevMode ? [{ debugName: "truncateEnable" }] : /* istanbul ignore next */ []));
|
|
1553
2163
|
truncateWidth = computed(() => {
|
|
1554
2164
|
return this.column()?.width;
|
|
1555
|
-
},
|
|
2165
|
+
}, /* @ts-ignore */
|
|
2166
|
+
...(ngDevMode ? [{ debugName: "truncateWidth" }] : /* istanbul ignore next */ []));
|
|
1556
2167
|
constructor() {
|
|
1557
2168
|
effect(() => {
|
|
1558
2169
|
this.truncateWidth();
|
|
@@ -1585,10 +2196,10 @@ class ViewComponent {
|
|
|
1585
2196
|
event.preventDefault();
|
|
1586
2197
|
this.item().meta.display[this.column().field]?.click?.();
|
|
1587
2198
|
};
|
|
1588
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1589
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
2199
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2200
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: ViewComponent, isStandalone: true, selector: "view", inputs: { autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", 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 view = _item.meta.display[_column.field];\n@let _truncateEnable = truncateEnable();\n@let _truncateWidth = truncateWidth();\n@let _isCollapsed = isCollapsed();\n@let isExpandByMore = isOverflowing() && _column?.cell?.truncate?.type === 'more';\n@let isExpandByTooltip = isOverflowing() && _column?.cell?.truncate?.type === 'tooltip';\n\n@if (view) {\n @if (view.isHtml) {\n @if (view.click) {\n <!-- why: b\u1ECF aria-hidden=\"true\" \u2014 \u00F4 n\u00E0y c\u00F3 (click) th\u1EADt n\u00EAn n\u00F3 l\u00E0 m\u1ED9t control; aria-hidden\n v\u1EEBa xo\u00E1 n\u1ED9i dung \u00F4 kh\u1ECFi accessibility tree v\u1EEBa \u0111\u1EC3 l\u1EA1i m\u1ED9t v\u00F9ng b\u1EA5m chu\u1ED9t \"c\u00E2m\".\n Nay l\u00E0 role=\"button\" + tabindex=\"0\" + Enter/Space ch\u1EA1y \u0111\u00FAng nh\u01B0 click. -->\n <div\n #contentContainer\n [attr.data-autoId]=\"_autoId\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"view.click()\"\n (keydown.enter)=\"onViewKeydown($event)\"\n (keydown.space)=\"onViewKeydown($event)\"\n class=\"text-break cursor-pointer\"\n [sdTooltip]=\"view.tooltip || (isExpandByTooltip ? htmlClickTooltip : '')\"\n [style]=\"view.cellStyle\"\n [style.max-width]=\"_truncateWidth\"\n [class.c-ellipsis-html]=\"_truncateEnable\"\n [innerHTML]=\"view.data | sdSafeHtml\"></div>\n\n <ng-template #htmlClickTooltip>\n <div\n class=\"c-tooltip-inner-content\"\n [style.max-width]=\"'calc(' + _truncateWidth + ' * 1.5)'\"\n style=\"max-height: 200px; overflow-y: auto; scrollbar-width: thin\">\n <div [innerHTML]=\"view.data | sdSafeHtml\"></div>\n </div>\n </ng-template>\n } @else {\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 [attr.data-autoId]=\"_autoId\"\n class=\"text-break\"\n [sdTooltip]=\"view.tooltip || (isExpandByTooltip ? htmlTooltip : '')\"\n containerClass=\"c-tooltip-html-d374bd93-f136-425c-bcc2-2d88cb163e44\"\n container=\"body\"\n placement=\"bottom\"\n [sdTooltipDelay]=\"100\"\n [style]=\"view.cellStyle\"\n [innerHTML]=\"view.data | sdSafeHtml\"></div>\n\n <ng-template #htmlTooltip>\n <div\n class=\"c-tooltip-inner-content\"\n [style.max-width]=\"'calc(' + _truncateWidth + ' * 1.5)'\"\n style=\"max-height: 200px; overflow-y: auto; scrollbar-width: thin\">\n <div [innerHTML]=\"view.data | sdSafeHtml\"></div>\n </div>\n </ng-template>\n\n @if (isExpandByMore) {\n <button (click)=\"toggle()\" class=\"c-collapse\">{{ _isCollapsed ? ('core.component.form-builder.show-more' | sdTranslate) : ('core.component.form-builder.show-less' | sdTranslate) }}</button>\n }\n } @else {\n <div\n [attr.data-autoId]=\"_autoId\"\n class=\"text-break\"\n [sdTooltip]=\"view.tooltip || ''\"\n [style]=\"view.cellStyle\"\n [innerHTML]=\"view.data | sdSafeHtml\"></div>\n }\n <!-- End -->\n }\n } @else {\n <!-- N\u1EBFu l\u00E0 gi\u00E1 tr\u1ECB l\u1EA5y hi\u1EC3n th\u1ECB l\u1EA5y tr\u1EF1c ti\u1EBFp t\u1EEB field -->\n @if (view.badge) {\n @if (view.data) {\n <sd-badge\n [attr.data-autoId]=\"_autoId\"\n [type]=\"view.badge.type\"\n [title]=\"view.data\"\n [color]=\"view.badge.color\"\n [icon]=\"view.badge.icon\"\n [sdTooltip]=\"view.tooltip || ''\"\n (click)=\"!!view.click && view.click()\">\n </sd-badge>\n }\n } @else {\n @if (view.click) {\n <div\n #contentContainer\n class=\"text-break\"\n [style]=\"view.cellStyle\"\n [style.max-width]=\"_truncateWidth\"\n [class.c-ellipsis]=\"_truncateEnable\"\n [sdTooltip]=\"view.tooltip || (isExpandByTooltip ? view.data : '') | asString\">\n <a [attr.data-autoId]=\"_autoId\" href=\"javascript:;\" (click)=\"view.click()\">\n {{ view.data }}\n </a>\n </div>\n } @else {\n <!-- N\u1EBFu column c\u00F3 b\u1EADt \"gi\u1EDBi h\u1EA1n k\u00FD t\u1EF1\" -->\n @if (_truncateEnable) {\n <div\n #contentContainer\n [attr.data-autoId]=\"_autoId\"\n class=\"text-break\"\n [style]=\"view.cellStyle\"\n [style.max-width]=\"_truncateWidth\"\n [class.c-ellipsis]=\"_isCollapsed\"\n [sdTooltip]=\"view.tooltip || (isExpandByTooltip ? view.data : '') | asString\">\n {{ view.data }}\n </div>\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\">{{ _isCollapsed ? ('core.component.form-builder.show-more' | sdTranslate) : ('core.component.form-builder.show-less' | sdTranslate) }}</button>\n }\n } @else {\n <div [attr.data-autoId]=\"_autoId\" class=\"text-break\" [style]=\"view.cellStyle\" [sdTooltip]=\"view.tooltip || ''\">\n {{ view.data }}\n </div>\n }\n <!-- End -->\n }\n }\n }\n}\n", styles: [".c-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.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}:host [role=button]:focus-visible{outline:2px solid var(--sd-primary, #005cbb);outline-offset:-2px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: SdBadge, selector: "sd-badge", inputs: ["type", "color", "primary", "secondary", "success", "info", "warning", "error", "fontSet", "title", "description", "tooltip", "icon", "size"], outputs: ["click"] }, { kind: "directive", type: SdTooltipDirective, selector: "[sdTooltip]", inputs: ["sdTooltip", "sdTooltipPosition", "sdTooltipDelay", "sdTooltipColor"] }, { kind: "pipe", type: SdSafeHtmlPipe, name: "sdSafeHtml" }, { kind: "pipe", type: ToStringPipe, name: "asString" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1590
2201
|
}
|
|
1591
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2202
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ViewComponent, decorators: [{
|
|
1592
2203
|
type: Component,
|
|
1593
2204
|
args: [{ selector: 'view', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [CommonModule, SdBadge, SdSafeHtmlPipe, SdTooltipDirective, ToStringPipe, SdTranslatePipe], template: "@let _column = column();\n@let _item = item();\n@let _autoId = autoId();\n\n@let view = _item.meta.display[_column.field];\n@let _truncateEnable = truncateEnable();\n@let _truncateWidth = truncateWidth();\n@let _isCollapsed = isCollapsed();\n@let isExpandByMore = isOverflowing() && _column?.cell?.truncate?.type === 'more';\n@let isExpandByTooltip = isOverflowing() && _column?.cell?.truncate?.type === 'tooltip';\n\n@if (view) {\n @if (view.isHtml) {\n @if (view.click) {\n <!-- why: b\u1ECF aria-hidden=\"true\" \u2014 \u00F4 n\u00E0y c\u00F3 (click) th\u1EADt n\u00EAn n\u00F3 l\u00E0 m\u1ED9t control; aria-hidden\n v\u1EEBa xo\u00E1 n\u1ED9i dung \u00F4 kh\u1ECFi accessibility tree v\u1EEBa \u0111\u1EC3 l\u1EA1i m\u1ED9t v\u00F9ng b\u1EA5m chu\u1ED9t \"c\u00E2m\".\n Nay l\u00E0 role=\"button\" + tabindex=\"0\" + Enter/Space ch\u1EA1y \u0111\u00FAng nh\u01B0 click. -->\n <div\n #contentContainer\n [attr.data-autoId]=\"_autoId\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"view.click()\"\n (keydown.enter)=\"onViewKeydown($event)\"\n (keydown.space)=\"onViewKeydown($event)\"\n class=\"text-break cursor-pointer\"\n [sdTooltip]=\"view.tooltip || (isExpandByTooltip ? htmlClickTooltip : '')\"\n [style]=\"view.cellStyle\"\n [style.max-width]=\"_truncateWidth\"\n [class.c-ellipsis-html]=\"_truncateEnable\"\n [innerHTML]=\"view.data | sdSafeHtml\"></div>\n\n <ng-template #htmlClickTooltip>\n <div\n class=\"c-tooltip-inner-content\"\n [style.max-width]=\"'calc(' + _truncateWidth + ' * 1.5)'\"\n style=\"max-height: 200px; overflow-y: auto; scrollbar-width: thin\">\n <div [innerHTML]=\"view.data | sdSafeHtml\"></div>\n </div>\n </ng-template>\n } @else {\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 [attr.data-autoId]=\"_autoId\"\n class=\"text-break\"\n [sdTooltip]=\"view.tooltip || (isExpandByTooltip ? htmlTooltip : '')\"\n containerClass=\"c-tooltip-html-d374bd93-f136-425c-bcc2-2d88cb163e44\"\n container=\"body\"\n placement=\"bottom\"\n [sdTooltipDelay]=\"100\"\n [style]=\"view.cellStyle\"\n [innerHTML]=\"view.data | sdSafeHtml\"></div>\n\n <ng-template #htmlTooltip>\n <div\n class=\"c-tooltip-inner-content\"\n [style.max-width]=\"'calc(' + _truncateWidth + ' * 1.5)'\"\n style=\"max-height: 200px; overflow-y: auto; scrollbar-width: thin\">\n <div [innerHTML]=\"view.data | sdSafeHtml\"></div>\n </div>\n </ng-template>\n\n @if (isExpandByMore) {\n <button (click)=\"toggle()\" class=\"c-collapse\">{{ _isCollapsed ? ('core.component.form-builder.show-more' | sdTranslate) : ('core.component.form-builder.show-less' | sdTranslate) }}</button>\n }\n } @else {\n <div\n [attr.data-autoId]=\"_autoId\"\n class=\"text-break\"\n [sdTooltip]=\"view.tooltip || ''\"\n [style]=\"view.cellStyle\"\n [innerHTML]=\"view.data | sdSafeHtml\"></div>\n }\n <!-- End -->\n }\n } @else {\n <!-- N\u1EBFu l\u00E0 gi\u00E1 tr\u1ECB l\u1EA5y hi\u1EC3n th\u1ECB l\u1EA5y tr\u1EF1c ti\u1EBFp t\u1EEB field -->\n @if (view.badge) {\n @if (view.data) {\n <sd-badge\n [attr.data-autoId]=\"_autoId\"\n [type]=\"view.badge.type\"\n [title]=\"view.data\"\n [color]=\"view.badge.color\"\n [icon]=\"view.badge.icon\"\n [sdTooltip]=\"view.tooltip || ''\"\n (click)=\"!!view.click && view.click()\">\n </sd-badge>\n }\n } @else {\n @if (view.click) {\n <div\n #contentContainer\n class=\"text-break\"\n [style]=\"view.cellStyle\"\n [style.max-width]=\"_truncateWidth\"\n [class.c-ellipsis]=\"_truncateEnable\"\n [sdTooltip]=\"view.tooltip || (isExpandByTooltip ? view.data : '') | asString\">\n <a [attr.data-autoId]=\"_autoId\" href=\"javascript:;\" (click)=\"view.click()\">\n {{ view.data }}\n </a>\n </div>\n } @else {\n <!-- N\u1EBFu column c\u00F3 b\u1EADt \"gi\u1EDBi h\u1EA1n k\u00FD t\u1EF1\" -->\n @if (_truncateEnable) {\n <div\n #contentContainer\n [attr.data-autoId]=\"_autoId\"\n class=\"text-break\"\n [style]=\"view.cellStyle\"\n [style.max-width]=\"_truncateWidth\"\n [class.c-ellipsis]=\"_isCollapsed\"\n [sdTooltip]=\"view.tooltip || (isExpandByTooltip ? view.data : '') | asString\">\n {{ view.data }}\n </div>\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\">{{ _isCollapsed ? ('core.component.form-builder.show-more' | sdTranslate) : ('core.component.form-builder.show-less' | sdTranslate) }}</button>\n }\n } @else {\n <div [attr.data-autoId]=\"_autoId\" class=\"text-break\" [style]=\"view.cellStyle\" [sdTooltip]=\"view.tooltip || ''\">\n {{ view.data }}\n </div>\n }\n <!-- End -->\n }\n }\n }\n}\n", styles: [".c-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.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}:host [role=button]:focus-visible{outline:2px solid var(--sd-primary, #005cbb);outline-offset:-2px}\n"] }]
|
|
1594
2205
|
}], ctorParameters: () => [], propDecorators: { contentContainer: [{ type: i0.ViewChild, args: ['contentContainer', { isSignal: true }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: true }] }], column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], item: [{ type: i0.Input, args: [{ isSignal: true, alias: "item", required: true }] }] } });
|
|
@@ -1597,38 +2208,49 @@ class DesktopCellComponent {
|
|
|
1597
2208
|
// Inject
|
|
1598
2209
|
#cdr = inject(ChangeDetectorRef);
|
|
1599
2210
|
// ViewChild
|
|
1600
|
-
contentContainer = viewChild('contentContainer',
|
|
2211
|
+
contentContainer = viewChild('contentContainer', /* @ts-ignore */
|
|
2212
|
+
...(ngDevMode ? [{ debugName: "contentContainer" }] : /* istanbul ignore next */ []));
|
|
1601
2213
|
// Inputs
|
|
1602
|
-
column = input.required(
|
|
1603
|
-
|
|
2214
|
+
column = input.required(/* @ts-ignore */
|
|
2215
|
+
...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
|
|
2216
|
+
item = input.required(/* @ts-ignore */
|
|
2217
|
+
...(ngDevMode ? [{ debugName: "item" }] : /* istanbul ignore next */ []));
|
|
1604
2218
|
cellDef = input.required({ ...(ngDevMode ? { debugName: "cellDef" } : /* istanbul ignore next */ {}) });
|
|
1605
2219
|
value = computed(() => {
|
|
1606
2220
|
return Utilities.getNestedValue(this.item()?.data, this.column()?.field);
|
|
1607
|
-
},
|
|
2221
|
+
}, /* @ts-ignore */
|
|
2222
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1608
2223
|
key = computed(() => {
|
|
1609
2224
|
const data = this.item()?.data;
|
|
1610
2225
|
return data?.id?.toString() || data?.code?.toString() || data?.value?.toString() || '';
|
|
1611
|
-
},
|
|
2226
|
+
}, /* @ts-ignore */
|
|
2227
|
+
...(ngDevMode ? [{ debugName: "key" }] : /* istanbul ignore next */ []));
|
|
1612
2228
|
autoId = computed(() => {
|
|
1613
2229
|
const column = this.column();
|
|
1614
2230
|
const key = this.key();
|
|
1615
2231
|
return `${key}_${column.field}`;
|
|
1616
|
-
},
|
|
2232
|
+
}, /* @ts-ignore */
|
|
2233
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
1617
2234
|
truncateEnable = computed(() => {
|
|
1618
2235
|
return this.column()?.cell?.truncate?.enable;
|
|
1619
|
-
},
|
|
2236
|
+
}, /* @ts-ignore */
|
|
2237
|
+
...(ngDevMode ? [{ debugName: "truncateEnable" }] : /* istanbul ignore next */ []));
|
|
1620
2238
|
truncateWidth = computed(() => {
|
|
1621
2239
|
return this.column()?.width;
|
|
1622
|
-
},
|
|
2240
|
+
}, /* @ts-ignore */
|
|
2241
|
+
...(ngDevMode ? [{ debugName: "truncateWidth" }] : /* istanbul ignore next */ []));
|
|
1623
2242
|
// why: widen to TemplateRef<any> so ng-packagr doesn't try to surface the
|
|
1624
2243
|
// directive's internal Context type through this public computed.
|
|
1625
2244
|
templateRef = computed(() => {
|
|
1626
2245
|
const cellDef = this.cellDef();
|
|
1627
2246
|
const column = this.column();
|
|
1628
2247
|
return cellDef[column?.field]?.templateRef || column?.cell?.templateRef;
|
|
1629
|
-
},
|
|
1630
|
-
|
|
1631
|
-
|
|
2248
|
+
}, /* @ts-ignore */
|
|
2249
|
+
...(ngDevMode ? [{ debugName: "templateRef" }] : /* istanbul ignore next */ []));
|
|
2250
|
+
isCollapsed = signal(true, /* @ts-ignore */
|
|
2251
|
+
...(ngDevMode ? [{ debugName: "isCollapsed" }] : /* istanbul ignore next */ []));
|
|
2252
|
+
isOverflowing = signal(false, /* @ts-ignore */
|
|
2253
|
+
...(ngDevMode ? [{ debugName: "isOverflowing" }] : /* istanbul ignore next */ []));
|
|
1632
2254
|
constructor() {
|
|
1633
2255
|
effect(() => {
|
|
1634
2256
|
this.truncateWidth();
|
|
@@ -1651,157 +2273,40 @@ class DesktopCellComponent {
|
|
|
1651
2273
|
}
|
|
1652
2274
|
});
|
|
1653
2275
|
};
|
|
1654
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1655
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
2276
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: DesktopCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2277
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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
2278
|
}
|
|
1657
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2279
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: DesktopCellComponent, decorators: [{
|
|
1658
2280
|
type: Component,
|
|
1659
2281
|
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
2282
|
}], ctorParameters: () => [], propDecorators: { contentContainer: [{ type: i0.ViewChild, args: ['contentContainer', { isSignal: true }] }], column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], item: [{ type: i0.Input, args: [{ isSignal: true, alias: "item", required: true }] }], cellDef: [{ type: i0.Input, args: [{ isSignal: true, alias: "cellDef", required: true }] }] } });
|
|
1661
2283
|
|
|
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: "21.2.17", ngImport: i0, type: CommandPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1696
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.17", ngImport: i0, type: CommandPipe, isStandalone: true, name: "command" });
|
|
1697
|
-
}
|
|
1698
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", 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: "21.2.17", ngImport: i0, type: CommandFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1778
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.17", ngImport: i0, type: CommandFilterPipe, isStandalone: true, name: "filter" });
|
|
1779
|
-
}
|
|
1780
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: CommandFilterPipe, decorators: [{
|
|
1781
|
-
type: Pipe,
|
|
1782
|
-
args: [{ name: 'filter', standalone: true }]
|
|
1783
|
-
}] });
|
|
1784
|
-
|
|
1785
2284
|
class DesktopCommand {
|
|
1786
2285
|
autoIdInput = input(undefined, { ...(ngDevMode ? { debugName: "autoIdInput" } : /* istanbul ignore next */ {}), alias: 'autoId' });
|
|
1787
|
-
item = input.required(
|
|
1788
|
-
|
|
1789
|
-
|
|
2286
|
+
item = input.required(/* @ts-ignore */
|
|
2287
|
+
...(ngDevMode ? [{ debugName: "item" }] : /* istanbul ignore next */ []));
|
|
2288
|
+
itemIndex = input.required(/* @ts-ignore */
|
|
2289
|
+
...(ngDevMode ? [{ debugName: "itemIndex" }] : /* istanbul ignore next */ []));
|
|
2290
|
+
commands = input([], /* @ts-ignore */
|
|
2291
|
+
...(ngDevMode ? [{ debugName: "commands" }] : /* istanbul ignore next */ []));
|
|
1790
2292
|
// Row key for autoId: prefer id, then code, then value, then itemIndex.
|
|
1791
2293
|
itemKey = computed(() => {
|
|
1792
2294
|
const data = this.item()?.data;
|
|
1793
2295
|
return data?.['id']?.toString() || data?.['code']?.toString() || data?.['value']?.toString() || this.itemIndex().toString();
|
|
1794
|
-
},
|
|
2296
|
+
}, /* @ts-ignore */
|
|
2297
|
+
...(ngDevMode ? [{ debugName: "itemKey" }] : /* istanbul ignore next */ []));
|
|
1795
2298
|
// Host autoId: `<base>-command-<itemKey>`. Template appends command and child keys.
|
|
1796
2299
|
autoId = computed(() => {
|
|
1797
2300
|
const base = this.autoIdInput();
|
|
1798
2301
|
return base ? `${base}-command-${this.itemKey()}` : '';
|
|
1799
|
-
},
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", 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: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i1$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i2.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: i2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i2.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: i3.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: CommandPipe, name: "command" }, { kind: "pipe", type: CommandFilterPipe, name: "filter" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2302
|
+
}, /* @ts-ignore */
|
|
2303
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
2304
|
+
_commands = computed(() => this.commands() || [], /* @ts-ignore */
|
|
2305
|
+
...(ngDevMode ? [{ debugName: "_commands" }] : /* istanbul ignore next */ []));
|
|
2306
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: DesktopCommand, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2307
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i1$2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i2$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: i2$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i2$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], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: CommandPipe, name: "command" }, { kind: "pipe", type: CommandFilterPipe, name: "filter" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1803
2308
|
}
|
|
1804
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: DesktopCommand, decorators: [{
|
|
1805
2310
|
type: Component,
|
|
1806
2311
|
args: [{ selector: 'desktop-command', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, host: {
|
|
1807
2312
|
'[attr.data-autoid]': 'autoId()',
|
|
@@ -1832,7 +2337,8 @@ class SdPopupExport {
|
|
|
1832
2337
|
}
|
|
1833
2338
|
this.columns = this.#getExportableColumns();
|
|
1834
2339
|
}
|
|
1835
|
-
configuration = input(
|
|
2340
|
+
configuration = input(/* @ts-ignore */
|
|
2341
|
+
...(ngDevMode ? [undefined, { debugName: "configuration" }] : /* istanbul ignore next */ []));
|
|
1836
2342
|
get key() {
|
|
1837
2343
|
const prefix = '93889e78-f971-4a1d-8c73-fe2321af9233';
|
|
1838
2344
|
if (!this.exportOption?.key) {
|
|
@@ -2083,10 +2589,10 @@ class SdPopupExport {
|
|
|
2083
2589
|
}
|
|
2084
2590
|
return '';
|
|
2085
2591
|
};
|
|
2086
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2087
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
2592
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdPopupExport, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2593
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.5", 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$1.MatChipListbox, selector: "mat-chip-listbox", inputs: ["multiple", "aria-orientation", "selectable", "compareWith", "required", "hideSingleSelectionIndicator", "value"], outputs: ["change"] }, { kind: "component", type: i3$1.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
2594
|
}
|
|
2089
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2595
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdPopupExport, decorators: [{
|
|
2090
2596
|
type: Component,
|
|
2091
2597
|
args: [{ selector: 'sd-popup-export', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [SdIcon, CommonModule, MatTableModule, MatChipsModule, SdButton, SdInput, SdModal], 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"] }]
|
|
2092
2598
|
}], ctorParameters: () => [], propDecorators: { modal: [{
|
|
@@ -2104,12 +2610,13 @@ class SdTableColumnFilterDefDirective {
|
|
|
2104
2610
|
static ngTemplateContextGuard(_dir, _ctx) {
|
|
2105
2611
|
return true;
|
|
2106
2612
|
}
|
|
2107
|
-
sdTableColumnFilterDef = input.required(
|
|
2613
|
+
sdTableColumnFilterDef = input.required(/* @ts-ignore */
|
|
2614
|
+
...(ngDevMode ? [{ debugName: "sdTableColumnFilterDef" }] : /* istanbul ignore next */ []));
|
|
2108
2615
|
templateRef = inject(TemplateRef);
|
|
2109
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2110
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
2616
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableColumnFilterDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2617
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.5", type: SdTableColumnFilterDefDirective, isStandalone: true, selector: "[sdTableColumnFilterDef]", inputs: { sdTableColumnFilterDef: { classPropertyName: "sdTableColumnFilterDef", publicName: "sdTableColumnFilterDef", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
|
|
2111
2618
|
}
|
|
2112
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2619
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableColumnFilterDefDirective, decorators: [{
|
|
2113
2620
|
type: Directive,
|
|
2114
2621
|
args: [{
|
|
2115
2622
|
selector: '[sdTableColumnFilterDef]',
|
|
@@ -2223,10 +2730,10 @@ class StickyShadowDirective {
|
|
|
2223
2730
|
this.#setShadow(container, colClass, 'sticky-shadow-left', true);
|
|
2224
2731
|
}
|
|
2225
2732
|
}
|
|
2226
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2227
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
2733
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: StickyShadowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2734
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.5", type: StickyShadowDirective, isStandalone: true, selector: "[stickyShadow]", ngImport: i0 });
|
|
2228
2735
|
}
|
|
2229
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2736
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: StickyShadowDirective, decorators: [{
|
|
2230
2737
|
type: Directive,
|
|
2231
2738
|
args: [{
|
|
2232
2739
|
selector: '[stickyShadow]',
|
|
@@ -2236,10 +2743,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2236
2743
|
|
|
2237
2744
|
class SdColumnResizeDirective {
|
|
2238
2745
|
// Bật/tắt resize cho cell này
|
|
2239
|
-
sdColumnResize = input.required(
|
|
2746
|
+
sdColumnResize = input.required(/* @ts-ignore */
|
|
2747
|
+
...(ngDevMode ? [{ debugName: "sdColumnResize" }] : /* istanbul ignore next */ []));
|
|
2240
2748
|
// min/max width tùy chọn (chuỗi 'NNpx'); nếu không phải px sẽ bỏ qua
|
|
2241
|
-
minWidth = input(
|
|
2242
|
-
|
|
2749
|
+
minWidth = input(/* @ts-ignore */
|
|
2750
|
+
...(ngDevMode ? [undefined, { debugName: "minWidth" }] : /* istanbul ignore next */ []));
|
|
2751
|
+
maxWidth = input(/* @ts-ignore */
|
|
2752
|
+
...(ngDevMode ? [undefined, { debugName: "maxWidth" }] : /* istanbul ignore next */ []));
|
|
2243
2753
|
// Emit width cuối cùng dạng 'NNpx' khi mouseup
|
|
2244
2754
|
resizeEnd = output();
|
|
2245
2755
|
#el = inject((ElementRef));
|
|
@@ -2344,10 +2854,10 @@ class SdColumnResizeDirective {
|
|
|
2344
2854
|
const m = /^(\d+(?:\.\d+)?)px$/i.exec(value.trim());
|
|
2345
2855
|
return m ? parseFloat(m[1]) : null;
|
|
2346
2856
|
}
|
|
2347
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2348
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
2857
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdColumnResizeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2858
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.5", type: SdColumnResizeDirective, isStandalone: true, selector: "[sdColumnResize]", inputs: { sdColumnResize: { classPropertyName: "sdColumnResize", publicName: "sdColumnResize", isSignal: true, isRequired: true, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { resizeEnd: "resizeEnd" }, ngImport: i0 });
|
|
2349
2859
|
}
|
|
2350
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2860
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdColumnResizeDirective, decorators: [{
|
|
2351
2861
|
type: Directive,
|
|
2352
2862
|
args: [{
|
|
2353
2863
|
selector: '[sdColumnResize]',
|
|
@@ -2546,229 +3056,48 @@ class SdGroupPipe {
|
|
|
2546
3056
|
let bucket = buckets.get(key);
|
|
2547
3057
|
if (!bucket) {
|
|
2548
3058
|
bucket = { values, items: [] };
|
|
2549
|
-
buckets.set(key, bucket);
|
|
2550
|
-
}
|
|
2551
|
-
bucket.items.push(item);
|
|
2552
|
-
}
|
|
2553
|
-
const result = [];
|
|
2554
|
-
buckets.forEach((bucket, key) => {
|
|
2555
|
-
const isExpanded = expandState?.has(key) ? !!expandState.get(key) : defaultExpanded;
|
|
2556
|
-
if (collapsible && expandState)
|
|
2557
|
-
expandState.set(key, isExpanded);
|
|
2558
|
-
const header = MapToSdTableItem({});
|
|
2559
|
-
// why: `MapToSdTableItem({})` sinh id cho một object rỗng MỚI mỗi lần transform →
|
|
2560
|
-
// trackBy của mat-table đổi liên tục (và trước kia, khi id là hash nội dung, MỌI
|
|
2561
|
-
// header dùng CHUNG một id). Khoá id theo group key: duy nhất giữa các group và
|
|
2562
|
-
// ổn định qua mọi lần re-eval.
|
|
2563
|
-
header.meta.id = `sd-group-${key}`;
|
|
2564
|
-
header.meta.group = {
|
|
2565
|
-
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: "21.2.17", ngImport: i0, type: SdGroupPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2586
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.17", ngImport: i0, type: SdGroupPipe, isStandalone: true, name: "sdGroup" });
|
|
2587
|
-
}
|
|
2588
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", 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: "21.2.17", ngImport: i0, type: SdSelectionDisabledPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2646
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.17", ngImport: i0, type: SdSelectionDisabledPipe, isStandalone: true, name: "selectionDisabled" });
|
|
2647
|
-
}
|
|
2648
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", 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
|
-
}
|
|
3059
|
+
buckets.set(key, bucket);
|
|
2692
3060
|
}
|
|
3061
|
+
bucket.items.push(item);
|
|
2693
3062
|
}
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
3063
|
+
const result = [];
|
|
3064
|
+
buckets.forEach((bucket, key) => {
|
|
3065
|
+
const isExpanded = expandState?.has(key) ? !!expandState.get(key) : defaultExpanded;
|
|
3066
|
+
if (collapsible && expandState)
|
|
3067
|
+
expandState.set(key, isExpanded);
|
|
3068
|
+
const header = MapToSdTableItem({});
|
|
3069
|
+
// why: `MapToSdTableItem({})` sinh id cho một object rỗng MỚI mỗi lần transform →
|
|
3070
|
+
// trackBy của mat-table đổi liên tục (và trước kia, khi id là hash nội dung, MỌI
|
|
3071
|
+
// header dùng CHUNG một id). Khoá id theo group key: duy nhất giữa các group và
|
|
3072
|
+
// ổn định qua mọi lần re-eval.
|
|
3073
|
+
header.meta.id = `sd-group-${key}`;
|
|
3074
|
+
header.meta.group = {
|
|
3075
|
+
isGroupHeader: true,
|
|
3076
|
+
key,
|
|
3077
|
+
values: bucket.values,
|
|
3078
|
+
items: bucket.items,
|
|
3079
|
+
// why: precompute 1 lần — template/context không map lại mỗi CD pass nữa.
|
|
3080
|
+
data: bucket.items.map(i => i.data),
|
|
3081
|
+
isExpanded,
|
|
3082
|
+
};
|
|
3083
|
+
header.meta.selector.selectable = false;
|
|
3084
|
+
header.meta.group.context = buildGroupHeaderContext(header, host);
|
|
3085
|
+
syncGroupSelectionMeta(header);
|
|
3086
|
+
host?.headers.push(header);
|
|
3087
|
+
result.push(header);
|
|
3088
|
+
if (!collapsible || isExpanded) {
|
|
3089
|
+
for (const child of bucket.items)
|
|
3090
|
+
result.push(child);
|
|
2702
3091
|
}
|
|
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);
|
|
3092
|
+
});
|
|
3093
|
+
return result;
|
|
2732
3094
|
}
|
|
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: "21.2.17", ngImport: i0, type: SdSelectionVisiblePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2765
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.17", ngImport: i0, type: SdSelectionVisiblePipe, isStandalone: true, name: "selectionVisible" });
|
|
3095
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdGroupPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
3096
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.1.5", ngImport: i0, type: SdGroupPipe, isStandalone: true, name: "sdGroup" });
|
|
2766
3097
|
}
|
|
2767
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3098
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdGroupPipe, decorators: [{
|
|
2768
3099
|
type: Pipe,
|
|
2769
|
-
args: [{
|
|
2770
|
-
name: 'selectionVisible',
|
|
2771
|
-
}]
|
|
3100
|
+
args: [{ name: 'sdGroup' }]
|
|
2772
3101
|
}] });
|
|
2773
3102
|
|
|
2774
3103
|
class TableExportService {
|
|
@@ -2777,16 +3106,19 @@ class TableExportService {
|
|
|
2777
3106
|
// ==========================================
|
|
2778
3107
|
// SIGNAL STATE (Component sẽ bind trực tiếp vào đây)
|
|
2779
3108
|
// ==========================================
|
|
2780
|
-
exporting = signal(false,
|
|
3109
|
+
exporting = signal(false, /* @ts-ignore */
|
|
3110
|
+
...(ngDevMode ? [{ debugName: "exporting" }] : /* istanbul ignore next */ []));
|
|
2781
3111
|
// Phần trăm tiến độ export; null = đang rảnh (nút hiện nhãn mặc định).
|
|
2782
|
-
#exportPercent = signal(null,
|
|
3112
|
+
#exportPercent = signal(null, /* @ts-ignore */
|
|
3113
|
+
...(ngDevMode ? [{ debugName: "#exportPercent" }] : /* istanbul ignore next */ []));
|
|
2783
3114
|
// WHY computed + i18n: trước đây đây là signal('Export') hard-code tiếng Anh nên
|
|
2784
3115
|
// app chạy tiếng Việt vẫn hiện "Export". Đọc qua I18nService.t() để nhãn nút bám
|
|
2785
3116
|
// theo catalog ngôn ngữ hiện tại.
|
|
2786
3117
|
exportTitle = computed(() => {
|
|
2787
3118
|
const percent = this.#exportPercent();
|
|
2788
3119
|
return percent === null ? this.#i18n.t('core.component.table.export') : this.#i18n.t('core.component.table.exporting', { percent });
|
|
2789
|
-
},
|
|
3120
|
+
}, /* @ts-ignore */
|
|
3121
|
+
...(ngDevMode ? [{ debugName: "exportTitle" }] : /* istanbul ignore next */ []));
|
|
2790
3122
|
/** Đặt tiến độ export (0-100), hoặc null để trả nút về nhãn mặc định. */
|
|
2791
3123
|
setExportProgress = (percent) => {
|
|
2792
3124
|
this.#exportPercent.set(percent === null ? null : Math.min(Math.max(percent, 0), 100));
|
|
@@ -3034,10 +3366,10 @@ class TableExportService {
|
|
|
3034
3366
|
return [];
|
|
3035
3367
|
return option.export?.columns?.filter(e => !e.export?.disabled) || [];
|
|
3036
3368
|
}
|
|
3037
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3038
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
3369
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: TableExportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3370
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: TableExportService });
|
|
3039
3371
|
}
|
|
3040
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3372
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: TableExportService, decorators: [{
|
|
3041
3373
|
type: Injectable
|
|
3042
3374
|
}] });
|
|
3043
3375
|
|
|
@@ -3251,10 +3583,10 @@ class TableFormatService {
|
|
|
3251
3583
|
}
|
|
3252
3584
|
return undefined;
|
|
3253
3585
|
}
|
|
3254
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3255
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
3586
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: TableFormatService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3587
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: TableFormatService });
|
|
3256
3588
|
}
|
|
3257
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3589
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: TableFormatService, decorators: [{
|
|
3258
3590
|
type: Injectable
|
|
3259
3591
|
}] });
|
|
3260
3592
|
|
|
@@ -3274,6 +3606,32 @@ const buildColumnWidthMap = (column) => {
|
|
|
3274
3606
|
return result;
|
|
3275
3607
|
};
|
|
3276
3608
|
|
|
3609
|
+
const sortValue = (value, type) => {
|
|
3610
|
+
if (value === null || value === undefined || value === '')
|
|
3611
|
+
return null;
|
|
3612
|
+
if (type === 'number') {
|
|
3613
|
+
const number = typeof value === 'number' || typeof value === 'string' || typeof value === 'boolean' ? Number(value) : NaN;
|
|
3614
|
+
return Number.isNaN(number) ? null : number;
|
|
3615
|
+
}
|
|
3616
|
+
if (type === 'date' || type === 'datetime' || type === 'time') {
|
|
3617
|
+
const time = value instanceof Date ? value.getTime() : typeof value === 'string' || typeof value === 'number' ? new Date(value).getTime() : NaN;
|
|
3618
|
+
return Number.isNaN(time) ? null : time;
|
|
3619
|
+
}
|
|
3620
|
+
return String(value);
|
|
3621
|
+
};
|
|
3622
|
+
/** Internal local-sort comparison; intentionally not exported from the table entry point. */
|
|
3623
|
+
const compareLocalValues = (a, b, type, direction) => {
|
|
3624
|
+
const first = sortValue(a, type);
|
|
3625
|
+
const second = sortValue(b, type);
|
|
3626
|
+
// 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.
|
|
3627
|
+
if (first === null)
|
|
3628
|
+
return second === null ? 0 : 1;
|
|
3629
|
+
if (second === null)
|
|
3630
|
+
return -1;
|
|
3631
|
+
const order = first < second ? -1 : first > second ? 1 : 0;
|
|
3632
|
+
return direction === 'DESC' ? -order : order;
|
|
3633
|
+
};
|
|
3634
|
+
|
|
3277
3635
|
const isTableItem = (item) => !!item && typeof item === 'object' && 'data' in item && 'meta' in item;
|
|
3278
3636
|
const resolveItemData = (item) => (isTableItem(item) ? item.data : item);
|
|
3279
3637
|
const hasActiveColumnFilter = (rawColumnFilter = {}, columns = []) => columns.some(col => {
|
|
@@ -3390,27 +3748,8 @@ const filterLocalItems = (localItems, option, filterInfo) => {
|
|
|
3390
3748
|
items.sort((tableItemCurrent, tableItemNext) => {
|
|
3391
3749
|
const dataVal = Utilities.getNestedValue(resolveItemData(tableItemCurrent), field);
|
|
3392
3750
|
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;
|
|
3751
|
+
return compareLocalValues(dataVal, nextVal, type, orderDirection);
|
|
3410
3752
|
});
|
|
3411
|
-
if (orderDirection === 'DESC') {
|
|
3412
|
-
items.reverse();
|
|
3413
|
-
}
|
|
3414
3753
|
}
|
|
3415
3754
|
}
|
|
3416
3755
|
return {
|
|
@@ -3494,6 +3833,130 @@ const reorderTableItems = ({ items, renderedItems, previousRenderedIndex, curren
|
|
|
3494
3833
|
};
|
|
3495
3834
|
};
|
|
3496
3835
|
|
|
3836
|
+
/** 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). */
|
|
3837
|
+
const isActionVisible = (hidden, data) => typeof hidden === 'function' ? !hidden(data) : !hidden;
|
|
3838
|
+
/**
|
|
3839
|
+
* Thu thập danh sách action key khả dụng cho MỘT row.
|
|
3840
|
+
*
|
|
3841
|
+
* why: ghi thẳng vào 2 mảng do caller cấp (in-place) thay vì `return` mảng mới —
|
|
3842
|
+
* 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
|
|
3843
|
+
* mảng mới mỗi lần gọi. Caller reset độ dài mảng trước khi gọi.
|
|
3844
|
+
*
|
|
3845
|
+
* Key = `Utilities.hash(action)`, khớp với `ActionFilterPipe` để action bar lọc
|
|
3846
|
+
* đúng action chung của mọi item đang chọn.
|
|
3847
|
+
*/
|
|
3848
|
+
const collectRowActionKeys = (rowData, selection, actions, groupedActions) => {
|
|
3849
|
+
for (const action of selection?.actions ?? []) {
|
|
3850
|
+
if (!isActionVisible(action.hidden, rowData.data))
|
|
3851
|
+
continue;
|
|
3852
|
+
if ('children' in action) {
|
|
3853
|
+
let flag = false;
|
|
3854
|
+
let hasGroup = false;
|
|
3855
|
+
for (const child of action.children) {
|
|
3856
|
+
const { hidden, isGrouped } = child;
|
|
3857
|
+
if (isGrouped) {
|
|
3858
|
+
hasGroup = true;
|
|
3859
|
+
}
|
|
3860
|
+
if (isActionVisible(hidden, rowData.data)) {
|
|
3861
|
+
flag = true;
|
|
3862
|
+
const key = Utilities.hash(child);
|
|
3863
|
+
actions.push(key);
|
|
3864
|
+
if (isGrouped) {
|
|
3865
|
+
groupedActions.push(key);
|
|
3866
|
+
}
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
if (flag) {
|
|
3870
|
+
const key = Utilities.hash(action);
|
|
3871
|
+
actions.push(key);
|
|
3872
|
+
if (hasGroup) {
|
|
3873
|
+
groupedActions.push(key);
|
|
3874
|
+
}
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
else {
|
|
3878
|
+
const { hidden, isGrouped } = action;
|
|
3879
|
+
if (isActionVisible(hidden, rowData.data)) {
|
|
3880
|
+
const key = Utilities.hash(action);
|
|
3881
|
+
actions.push(key);
|
|
3882
|
+
if (isGrouped) {
|
|
3883
|
+
groupedActions.push(key);
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
}
|
|
3887
|
+
}
|
|
3888
|
+
};
|
|
3889
|
+
/**
|
|
3890
|
+
* Checkbox "chọn tất cả" ở header có hiển thị hay không.
|
|
3891
|
+
*
|
|
3892
|
+
* why: trước đây là pure pipe `async` với `await setTimeout(500)` bên trong. Sleep đó
|
|
3893
|
+
* che một vấn đề THỨ TỰ change-detection: pipe đọc `meta.selector.actions` — mảng do
|
|
3894
|
+
* `SdSelectionVisiblePipe` ghi ở cell BODY, mà CDK render header TRƯỚC body, nên ở pass
|
|
3895
|
+
* đầ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
|
|
3896
|
+
* một timer không ai dọn. Ở đây tự tính key action từ `selection` nên không phụ thuộc
|
|
3897
|
+
* pipe nào chạy trước → quyết định được ngay trong pass hiện tại, không cần timer.
|
|
3898
|
+
*/
|
|
3899
|
+
const resolveSelectAllVisible = (items, selection) => {
|
|
3900
|
+
// Nếu chỉ chọn 1 thì không có select all
|
|
3901
|
+
if (selection?.single)
|
|
3902
|
+
return false;
|
|
3903
|
+
if (!items.length)
|
|
3904
|
+
return false;
|
|
3905
|
+
if (!selection?.actions?.length)
|
|
3906
|
+
return true;
|
|
3907
|
+
if (selection.actions.some(e => ('children' in e && e.children.some(e1 => e1.isGrouped)) || e.isGrouped))
|
|
3908
|
+
return false;
|
|
3909
|
+
const keysPerRow = [];
|
|
3910
|
+
for (const item of items) {
|
|
3911
|
+
const actions = [];
|
|
3912
|
+
collectRowActionKeys(item, selection, actions, []);
|
|
3913
|
+
if (actions.length)
|
|
3914
|
+
keysPerRow.push(actions);
|
|
3915
|
+
}
|
|
3916
|
+
if (!keysPerRow.length)
|
|
3917
|
+
return false;
|
|
3918
|
+
// Có ít nhất 1 action chung cho MỌI row còn action → cho phép select all.
|
|
3919
|
+
const leafKeys = (selection.actions ?? []).flatMap(action => 'children' in action ? action.children.map(child => Utilities.hash(child)) : [Utilities.hash(action)]);
|
|
3920
|
+
return leafKeys.some(action => keysPerRow.every(keys => keys.includes(action)));
|
|
3921
|
+
};
|
|
3922
|
+
/** Same grouped-action visibility contract for both renderers and the legacy pipe. */
|
|
3923
|
+
function prepareRowSelectionVisibility(row, selection) {
|
|
3924
|
+
const meta = row.meta.selector;
|
|
3925
|
+
const keys = (meta.actions ??= []);
|
|
3926
|
+
keys.length = 0;
|
|
3927
|
+
const grouped = [];
|
|
3928
|
+
collectRowActionKeys(row, selection, keys, grouped);
|
|
3929
|
+
meta.selectable = !selection?.actions?.length || keys.length > 0;
|
|
3930
|
+
meta.visible =
|
|
3931
|
+
!!meta.isSelected ||
|
|
3932
|
+
(meta.selectable && (!grouped.length || !!row.meta.group?.items?.length || keys.some(key => !grouped.includes(key))));
|
|
3933
|
+
return meta.visible;
|
|
3934
|
+
}
|
|
3935
|
+
/** A selected row remains removable even if its eligibility changed after a reload. */
|
|
3936
|
+
function resolveRowSelectionDisabled(selected, row, selection) {
|
|
3937
|
+
if (row.meta.selector.isSelected)
|
|
3938
|
+
return false;
|
|
3939
|
+
if (selection?.disabled?.(row.data, selected.map(item => item.data)))
|
|
3940
|
+
return true;
|
|
3941
|
+
if (!selection?.actions?.length)
|
|
3942
|
+
return false;
|
|
3943
|
+
// why: chọn đơn thay thế lựa chọn cũ, không cần action chung với dòng cũ.
|
|
3944
|
+
const comparison = selection.single ? [] : selected;
|
|
3945
|
+
const leafKeys = selection.actions.flatMap(action => 'children' in action ? action.children.map(child => Utilities.hash(child)) : [Utilities.hash(action)]);
|
|
3946
|
+
return !leafKeys.some(key => row.meta.selector?.actions?.includes(key) && comparison.every(item => item.meta.selector?.actions?.includes(key)));
|
|
3947
|
+
}
|
|
3948
|
+
/** Prepare ALL action keys first so no row depends on another cell's rendering order. */
|
|
3949
|
+
function prepareTableSelection(rows, selected, selection) {
|
|
3950
|
+
const all = [...new Set([...rows, ...selected])];
|
|
3951
|
+
for (const row of all)
|
|
3952
|
+
prepareRowSelectionVisibility(row, selection);
|
|
3953
|
+
for (const row of all) {
|
|
3954
|
+
const meta = row.meta.selector;
|
|
3955
|
+
meta.disabled = resolveRowSelectionDisabled(selected, row, selection);
|
|
3956
|
+
meta.selectable = (!!meta.isSelected || !selection?.actions?.length || !!meta.actions?.length) && !meta.disabled;
|
|
3957
|
+
}
|
|
3958
|
+
}
|
|
3959
|
+
|
|
3497
3960
|
class SdTableFilterService {
|
|
3498
3961
|
storageService = inject(SdStorageService);
|
|
3499
3962
|
#destroyRef = inject(DestroyRef);
|
|
@@ -3746,10 +4209,10 @@ class SdTableFilterService {
|
|
|
3746
4209
|
columnOperator,
|
|
3747
4210
|
};
|
|
3748
4211
|
};
|
|
3749
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3750
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
4212
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableFilterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4213
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableFilterService });
|
|
3751
4214
|
}
|
|
3752
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4215
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableFilterService, decorators: [{
|
|
3753
4216
|
type: Injectable
|
|
3754
4217
|
}], ctorParameters: () => [] });
|
|
3755
4218
|
|
|
@@ -3775,10 +4238,10 @@ class SdTableSortHeaderDirective {
|
|
|
3775
4238
|
event.preventDefault();
|
|
3776
4239
|
this.activate();
|
|
3777
4240
|
}
|
|
3778
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3779
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
4241
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableSortHeaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4242
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.5", 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 });
|
|
3780
4243
|
}
|
|
3781
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4244
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTableSortHeaderDirective, decorators: [{
|
|
3782
4245
|
type: Directive,
|
|
3783
4246
|
args: [{
|
|
3784
4247
|
selector: '[sdTableSortHeader]',
|
|
@@ -3816,10 +4279,10 @@ class SdTablePaginatorIntl extends MatPaginatorIntl {
|
|
|
3816
4279
|
const to = from + (length - page * pageSize > pageSize ? pageSize : length - page * pageSize) - 1;
|
|
3817
4280
|
return `${from}-${to}/${NumberUtilities.toISO(length)}`;
|
|
3818
4281
|
};
|
|
3819
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3820
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
4282
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTablePaginatorIntl, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
4283
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTablePaginatorIntl });
|
|
3821
4284
|
}
|
|
3822
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
4285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTablePaginatorIntl, decorators: [{
|
|
3823
4286
|
type: Injectable
|
|
3824
4287
|
}] });
|
|
3825
4288
|
/** Mảng rỗng dùng chung — tránh cấp phát `[]` mới trong binding mỗi CD pass. */
|
|
@@ -3830,28 +4293,50 @@ class SdTable {
|
|
|
3830
4293
|
// 1. SIGNAL INPUTS
|
|
3831
4294
|
// ==========================================
|
|
3832
4295
|
autoIdInput = input(undefined, { ...(ngDevMode ? { debugName: "autoIdInput" } : /* istanbul ignore next */ {}), alias: 'autoId' });
|
|
3833
|
-
autoId = computed(() => (this.autoIdInput() ? `components-table-${this.autoIdInput()}` : undefined),
|
|
3834
|
-
|
|
4296
|
+
autoId = computed(() => (this.autoIdInput() ? `components-table-${this.autoIdInput()}` : undefined), /* @ts-ignore */
|
|
4297
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
4298
|
+
option = input.required(/* @ts-ignore */
|
|
4299
|
+
...(ngDevMode ? [{ debugName: "option" }] : /* istanbul ignore next */ []));
|
|
3835
4300
|
// ==========================================
|
|
3836
4301
|
// 2. SIGNAL QUERIES
|
|
3837
4302
|
// ==========================================
|
|
3838
|
-
table = viewChild(MatTable,
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
4303
|
+
table = viewChild(MatTable, /* @ts-ignore */
|
|
4304
|
+
...(ngDevMode ? [{ debugName: "table" }] : /* istanbul ignore next */ []));
|
|
4305
|
+
configComponent = viewChild(ConfigComponent, /* @ts-ignore */
|
|
4306
|
+
...(ngDevMode ? [{ debugName: "configComponent" }] : /* istanbul ignore next */ []));
|
|
4307
|
+
sdPopupExport = viewChild(SdPopupExport, /* @ts-ignore */
|
|
4308
|
+
...(ngDevMode ? [{ debugName: "sdPopupExport" }] : /* istanbul ignore next */ []));
|
|
4309
|
+
scroll = viewChild(SdScrollDirective, /* @ts-ignore */
|
|
4310
|
+
...(ngDevMode ? [{ debugName: "scroll" }] : /* istanbul ignore next */ []));
|
|
4311
|
+
quickAction = viewChild(SdQuickAction, /* @ts-ignore */
|
|
4312
|
+
...(ngDevMode ? [{ debugName: "quickAction" }] : /* istanbul ignore next */ []));
|
|
4313
|
+
externalFilter = viewChild(ExternalFilterComponent, /* @ts-ignore */
|
|
4314
|
+
...(ngDevMode ? [{ debugName: "externalFilter" }] : /* istanbul ignore next */ []));
|
|
4315
|
+
mobileFilter = viewChild(MobileFilterComponent, /* @ts-ignore */
|
|
4316
|
+
...(ngDevMode ? [{ debugName: "mobileFilter" }] : /* istanbul ignore next */ []));
|
|
4317
|
+
paginator = viewChild(MatPaginator, /* @ts-ignore */
|
|
4318
|
+
...(ngDevMode ? [{ debugName: "paginator" }] : /* istanbul ignore next */ []));
|
|
4319
|
+
sort = viewChild(MatSort, /* @ts-ignore */
|
|
4320
|
+
...(ngDevMode ? [{ debugName: "sort" }] : /* istanbul ignore next */ []));
|
|
4321
|
+
sdSubInformation = contentChild(SdTableExpandDefDirective, /* @ts-ignore */
|
|
4322
|
+
...(ngDevMode ? [{ debugName: "sdSubInformation" }] : /* istanbul ignore next */ []));
|
|
4323
|
+
sdGroupDef = contentChild(SdTableGroupDefDirective, /* @ts-ignore */
|
|
4324
|
+
...(ngDevMode ? [{ debugName: "sdGroupDef" }] : /* istanbul ignore next */ []));
|
|
4325
|
+
sdCellDefs = contentChildren(SdTableCellDefDirective, /* @ts-ignore */
|
|
4326
|
+
...(ngDevMode ? [{ debugName: "sdCellDefs" }] : /* istanbul ignore next */ []));
|
|
3850
4327
|
/** Nội dung tuỳ chọn cho ô header của cột command (mặc định ô này để trống). */
|
|
3851
|
-
sdCommandHeaderDef = contentChild(SdTableCommandHeaderDefDirective,
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
4328
|
+
sdCommandHeaderDef = contentChild(SdTableCommandHeaderDefDirective, /* @ts-ignore */
|
|
4329
|
+
...(ngDevMode ? [{ debugName: "sdCommandHeaderDef" }] : /* istanbul ignore next */ []));
|
|
4330
|
+
sdFooterDefs = contentChildren(SdMaterialFooterDefDirective, /* @ts-ignore */
|
|
4331
|
+
...(ngDevMode ? [{ debugName: "sdFooterDefs" }] : /* istanbul ignore next */ []));
|
|
4332
|
+
sdFilterDefs = contentChildren(SdTableFilterDefDirective, /* @ts-ignore */
|
|
4333
|
+
...(ngDevMode ? [{ debugName: "sdFilterDefs" }] : /* istanbul ignore next */ []));
|
|
4334
|
+
sdTitleDefs = contentChildren(SdTableTitleDefDirective, /* @ts-ignore */
|
|
4335
|
+
...(ngDevMode ? [{ debugName: "sdTitleDefs" }] : /* istanbul ignore next */ []));
|
|
4336
|
+
sdRowMobileDef = contentChild(SdTableRowMobileDefDirective, { ...(ngDevMode ? { debugName: "sdRowMobileDef" } : /* istanbul ignore next */ {}), descendants: false });
|
|
4337
|
+
isMobile = inject(SdViewportService).isMobile;
|
|
4338
|
+
mobileCards = computed(() => this.isMobile() && !!this.sdRowMobileDef(), /* @ts-ignore */
|
|
4339
|
+
...(ngDevMode ? [{ debugName: "mobileCards" }] : /* istanbul ignore next */ []));
|
|
3855
4340
|
// ==========================================
|
|
3856
4341
|
// 3. COMPUTED FROM QUERIES
|
|
3857
4342
|
// ==========================================
|
|
@@ -3863,7 +4348,8 @@ class SdTable {
|
|
|
3863
4348
|
map[field] = def;
|
|
3864
4349
|
}
|
|
3865
4350
|
return map;
|
|
3866
|
-
},
|
|
4351
|
+
}, /* @ts-ignore */
|
|
4352
|
+
...(ngDevMode ? [{ debugName: "cellDef" }] : /* istanbul ignore next */ []));
|
|
3867
4353
|
footerDef = computed(() => {
|
|
3868
4354
|
const map = {};
|
|
3869
4355
|
for (const def of this.sdFooterDefs()) {
|
|
@@ -3872,8 +4358,21 @@ class SdTable {
|
|
|
3872
4358
|
map[field] = def;
|
|
3873
4359
|
}
|
|
3874
4360
|
return map;
|
|
3875
|
-
},
|
|
3876
|
-
|
|
4361
|
+
}, /* @ts-ignore */
|
|
4362
|
+
...(ngDevMode ? [{ debugName: "footerDef" }] : /* istanbul ignore next */ []));
|
|
4363
|
+
hasFooter = computed(() => Object.keys(this.footerDef()).length > 0, /* @ts-ignore */
|
|
4364
|
+
...(ngDevMode ? [{ debugName: "hasFooter" }] : /* istanbul ignore next */ []));
|
|
4365
|
+
mobileColumns = computed(() => {
|
|
4366
|
+
const config = this.configuration();
|
|
4367
|
+
return [...(config?.firstColumns ?? []), ...(config?.secondColumns ?? [])].filter(column => column.type !== 'children');
|
|
4368
|
+
}, /* @ts-ignore */
|
|
4369
|
+
...(ngDevMode ? [{ debugName: "mobileColumns" }] : /* istanbul ignore next */ []));
|
|
4370
|
+
mobileFooterColumns = computed(() => {
|
|
4371
|
+
const config = this.configuration();
|
|
4372
|
+
const footers = this.footerDef();
|
|
4373
|
+
return [...(config?.firstColumns ?? []), ...(config?.secondColumns ?? [])].filter(column => !!footers[column.field] && config?.displayedFooters.includes(column.field));
|
|
4374
|
+
}, /* @ts-ignore */
|
|
4375
|
+
...(ngDevMode ? [{ debugName: "mobileFooterColumns" }] : /* istanbul ignore next */ []));
|
|
3877
4376
|
titleDef = computed(() => {
|
|
3878
4377
|
const map = {};
|
|
3879
4378
|
for (const def of this.sdTitleDefs()) {
|
|
@@ -3882,17 +4381,98 @@ class SdTable {
|
|
|
3882
4381
|
map[field] = def;
|
|
3883
4382
|
}
|
|
3884
4383
|
return map;
|
|
3885
|
-
},
|
|
4384
|
+
}, /* @ts-ignore */
|
|
4385
|
+
...(ngDevMode ? [{ debugName: "titleDef" }] : /* istanbul ignore next */ []));
|
|
3886
4386
|
// ==========================================
|
|
3887
4387
|
// 4. SIGNAL STATE
|
|
3888
4388
|
// ==========================================
|
|
3889
|
-
tableOption = signal(undefined,
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
4389
|
+
tableOption = signal(undefined, /* @ts-ignore */
|
|
4390
|
+
...(ngDevMode ? [{ debugName: "tableOption" }] : /* istanbul ignore next */ []));
|
|
4391
|
+
configuration = signal(undefined, /* @ts-ignore */
|
|
4392
|
+
...(ngDevMode ? [{ debugName: "configuration" }] : /* istanbul ignore next */ []));
|
|
4393
|
+
items = signal([], /* @ts-ignore */
|
|
4394
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
4395
|
+
selectedTableItems = signal([], /* @ts-ignore */
|
|
4396
|
+
...(ngDevMode ? [{ debugName: "selectedTableItems" }] : /* istanbul ignore next */ []));
|
|
4397
|
+
total = signal(undefined, /* @ts-ignore */
|
|
4398
|
+
...(ngDevMode ? [{ debugName: "total" }] : /* istanbul ignore next */ []));
|
|
4399
|
+
loading = signal(false, /* @ts-ignore */
|
|
4400
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
4401
|
+
loadError = signal(false, /* @ts-ignore */
|
|
4402
|
+
...(ngDevMode ? [{ debugName: "loadError" }] : /* istanbul ignore next */ []));
|
|
4403
|
+
isSelectAll = signal(false, /* @ts-ignore */
|
|
4404
|
+
...(ngDevMode ? [{ debugName: "isSelectAll" }] : /* istanbul ignore next */ []));
|
|
4405
|
+
isSelectIndeterminate = signal(false, /* @ts-ignore */
|
|
4406
|
+
...(ngDevMode ? [{ debugName: "isSelectIndeterminate" }] : /* istanbul ignore next */ []));
|
|
4407
|
+
sortState = signal({ active: '', direction: '' }, /* @ts-ignore */
|
|
4408
|
+
...(ngDevMode ? [{ debugName: "sortState" }] : /* istanbul ignore next */ []));
|
|
4409
|
+
mobileSortColumns = computed(() => {
|
|
4410
|
+
const config = this.configuration();
|
|
4411
|
+
const state = this.sortState();
|
|
4412
|
+
return [...(config?.firstColumns ?? []), ...(config?.secondColumns ?? [])]
|
|
4413
|
+
.filter(column => column.type !== 'children' && column.sortable)
|
|
4414
|
+
.map(column => ({
|
|
4415
|
+
field: column.field,
|
|
4416
|
+
title: typeof column.title === 'string' ? column.title : column.title.title,
|
|
4417
|
+
direction: state.active === column.field ? state.direction : '',
|
|
4418
|
+
}));
|
|
4419
|
+
}, /* @ts-ignore */
|
|
4420
|
+
...(ngDevMode ? [{ debugName: "mobileSortColumns" }] : /* istanbul ignore next */ []));
|
|
4421
|
+
mobileToolsActions = computed(() => {
|
|
4422
|
+
const option = this.tableOption();
|
|
4423
|
+
if (!option)
|
|
4424
|
+
return [];
|
|
4425
|
+
const t = (key) => this.#i18n.t('core.component.table.' + key);
|
|
4426
|
+
const actions = [];
|
|
4427
|
+
if (option.reload?.visible)
|
|
4428
|
+
actions.push({ key: 'tool-reload', title: t('reload'), icon: 'refresh', run: () => this.reload() });
|
|
4429
|
+
const exporting = option.export;
|
|
4430
|
+
if (exporting && this.items().length) {
|
|
4431
|
+
if (exporting.type === 'custom')
|
|
4432
|
+
actions.push({ key: 'tool-export', title: this.exportTitle(), icon: 'download', run: () => this.exportCustom() });
|
|
4433
|
+
else if (exporting.visible) {
|
|
4434
|
+
const children = [];
|
|
4435
|
+
if (exporting.visible === 'ALL' || exporting.visible === 'EXCEL')
|
|
4436
|
+
children.push({ key: 'tool-export-excel', title: t('export-excel'), icon: 'table_view', run: () => this.exportExcel() });
|
|
4437
|
+
if (exporting.visible === 'ALL' || exporting.visible === 'CSV')
|
|
4438
|
+
children.push({ key: 'tool-export-csv', title: t('export-csv'), icon: 'description', run: () => this.exportCSV() });
|
|
4439
|
+
actions.push({ key: 'tool-export', title: this.exportTitle(), disabled: this.exporting(), children });
|
|
4440
|
+
}
|
|
4441
|
+
}
|
|
4442
|
+
if (!option.filter?.disabled && this.mobileFilter())
|
|
4443
|
+
actions.push({
|
|
4444
|
+
key: 'tool-filter',
|
|
4445
|
+
title: t('filter'),
|
|
4446
|
+
icon: 'filter_alt',
|
|
4447
|
+
closeBeforeRun: true,
|
|
4448
|
+
run: () => this.mobileFilter()?.open(),
|
|
4449
|
+
});
|
|
4450
|
+
if (option.sort?.enable && this.mobileSortColumns().length)
|
|
4451
|
+
actions.push({
|
|
4452
|
+
key: 'tool-sort',
|
|
4453
|
+
title: t('mobile.sort'),
|
|
4454
|
+
children: this.mobileSortColumns().map(column => ({
|
|
4455
|
+
key: 'tool-sort-' + column.field,
|
|
4456
|
+
title: column.title,
|
|
4457
|
+
icon: column.direction === 'asc' ? 'arrow_upward' : column.direction === 'desc' ? 'arrow_downward' : 'sort',
|
|
4458
|
+
run: () => this.sort()?.sort({ id: column.field, start: 'asc', disableClear: false }),
|
|
4459
|
+
})),
|
|
4460
|
+
});
|
|
4461
|
+
if (this.configComponent())
|
|
4462
|
+
actions.push({
|
|
4463
|
+
key: 'tool-config',
|
|
4464
|
+
title: t('setup-short'),
|
|
4465
|
+
icon: 'settings',
|
|
4466
|
+
closeBeforeRun: true,
|
|
4467
|
+
run: () => this.configComponent()?.open(),
|
|
4468
|
+
});
|
|
4469
|
+
return actions;
|
|
4470
|
+
}, /* @ts-ignore */
|
|
4471
|
+
...(ngDevMode ? [{ debugName: "mobileToolsActions" }] : /* istanbul ignore next */ []));
|
|
4472
|
+
pageRevision = signal(0, /* @ts-ignore */
|
|
4473
|
+
...(ngDevMode ? [{ debugName: "pageRevision" }] : /* istanbul ignore next */ []));
|
|
4474
|
+
dataRevision = signal(0, /* @ts-ignore */
|
|
4475
|
+
...(ngDevMode ? [{ debugName: "dataRevision" }] : /* istanbul ignore next */ []));
|
|
3896
4476
|
/**
|
|
3897
4477
|
* Checkbox "chọn tất cả" ở header có hiển thị không.
|
|
3898
4478
|
*
|
|
@@ -3904,7 +4484,12 @@ class SdTable {
|
|
|
3904
4484
|
* trả một Promise mới + đặt thêm một timer không ai dọn. Computed tự tính từ
|
|
3905
4485
|
* `items()` + `selector` nên không phụ thuộc pipe nào chạy trước → bỏ hẳn timer.
|
|
3906
4486
|
*/
|
|
3907
|
-
visibleSelectAll = computed(() =>
|
|
4487
|
+
visibleSelectAll = computed(() => {
|
|
4488
|
+
this.selectedTableItems();
|
|
4489
|
+
this.treeRevision();
|
|
4490
|
+
return resolveSelectAllVisible(this.#getSelectionRows().filter(row => row.meta.selector?.selectable), this.tableOption()?.selector);
|
|
4491
|
+
}, /* @ts-ignore */
|
|
4492
|
+
...(ngDevMode ? [{ debugName: "visibleSelectAll" }] : /* istanbul ignore next */ []));
|
|
3908
4493
|
/**
|
|
3909
4494
|
* Danh sách command của row, memoize theo option.
|
|
3910
4495
|
* why: template cũ bind `_tableOption.command?.commands || _tableOption.commands || []`
|
|
@@ -3914,9 +4499,12 @@ class SdTable {
|
|
|
3914
4499
|
rowCommands = computed(() => {
|
|
3915
4500
|
const opt = this.tableOption();
|
|
3916
4501
|
return opt?.command?.commands || opt?.commands || EMPTY_COMMANDS;
|
|
3917
|
-
},
|
|
3918
|
-
|
|
3919
|
-
|
|
4502
|
+
}, /* @ts-ignore */
|
|
4503
|
+
...(ngDevMode ? [{ debugName: "rowCommands" }] : /* istanbul ignore next */ []));
|
|
4504
|
+
isFiltered = signal(false, /* @ts-ignore */
|
|
4505
|
+
...(ngDevMode ? [{ debugName: "isFiltered" }] : /* istanbul ignore next */ []));
|
|
4506
|
+
requireFiltered = signal(false, /* @ts-ignore */
|
|
4507
|
+
...(ngDevMode ? [{ debugName: "requireFiltered" }] : /* istanbul ignore next */ []));
|
|
3920
4508
|
#tableId = Utilities.generateUuid();
|
|
3921
4509
|
filterRegister;
|
|
3922
4510
|
key = Utilities.generateUuid();
|
|
@@ -3934,7 +4522,10 @@ class SdTable {
|
|
|
3934
4522
|
#cacheObjValues = {};
|
|
3935
4523
|
#itemIndexMap = new WeakMap();
|
|
3936
4524
|
#treeExpandState = new Map();
|
|
3937
|
-
treeRevision = signal(0,
|
|
4525
|
+
treeRevision = signal(0, /* @ts-ignore */
|
|
4526
|
+
...(ngDevMode ? [{ debugName: "treeRevision" }] : /* istanbul ignore next */ []));
|
|
4527
|
+
expandRevision = signal(0, /* @ts-ignore */
|
|
4528
|
+
...(ngDevMode ? [{ debugName: "expandRevision" }] : /* istanbul ignore next */ []));
|
|
3938
4529
|
// Search ở cấp con (static tree + type 'local'): predicate khớp 1 dòng theo
|
|
3939
4530
|
// column filter hiện hành. Set ở #filterLocal khi có filter active, đọc lại ở
|
|
3940
4531
|
// #render/#ensureChildItemsFormatted dùng predicate này để prune + auto-expand các
|
|
@@ -3944,6 +4535,7 @@ class SdTable {
|
|
|
3944
4535
|
#treeSearchActive = false;
|
|
3945
4536
|
// 1. Private Services
|
|
3946
4537
|
#ref = inject(ChangeDetectorRef);
|
|
4538
|
+
#destroyed = false;
|
|
3947
4539
|
#configService = inject(ConfigService);
|
|
3948
4540
|
#gridFilterService = inject(SdTableFilterService);
|
|
3949
4541
|
#notifyService = inject(SdNotifyService);
|
|
@@ -3997,25 +4589,35 @@ class SdTable {
|
|
|
3997
4589
|
});
|
|
3998
4590
|
}
|
|
3999
4591
|
});
|
|
4000
|
-
effect(
|
|
4592
|
+
effect(onCleanup => {
|
|
4001
4593
|
const paginator = this.paginator();
|
|
4002
4594
|
if (paginator) {
|
|
4003
4595
|
untracked(() => {
|
|
4004
|
-
|
|
4596
|
+
const subscription = paginator.page.subscribe(() => {
|
|
4597
|
+
this.pageRevision.update(n => n + 1);
|
|
4598
|
+
this.#requestReload(false);
|
|
4599
|
+
});
|
|
4600
|
+
onCleanup(() => subscription.unsubscribe());
|
|
4005
4601
|
});
|
|
4006
4602
|
}
|
|
4007
4603
|
});
|
|
4008
|
-
effect(
|
|
4604
|
+
effect(onCleanup => {
|
|
4009
4605
|
const sort = this.sort();
|
|
4010
4606
|
if (sort) {
|
|
4011
4607
|
untracked(() => {
|
|
4012
|
-
|
|
4608
|
+
const subscription = sort.sortChange.subscribe(state => {
|
|
4609
|
+
this.sortState.set(state);
|
|
4013
4610
|
this.#ref.markForCheck();
|
|
4014
4611
|
this.#requestReload(false);
|
|
4015
|
-
})
|
|
4612
|
+
});
|
|
4613
|
+
onCleanup(() => subscription.unsubscribe());
|
|
4016
4614
|
});
|
|
4017
4615
|
}
|
|
4018
4616
|
});
|
|
4617
|
+
effect(() => {
|
|
4618
|
+
this.mobileCards();
|
|
4619
|
+
untracked(() => this.mobileFilter()?.close());
|
|
4620
|
+
});
|
|
4019
4621
|
effect(() => {
|
|
4020
4622
|
const items = this.items();
|
|
4021
4623
|
this.#itemIndexMap = new WeakMap();
|
|
@@ -4047,7 +4649,7 @@ class SdTable {
|
|
|
4047
4649
|
const result = await this.#load(filterInfo, !this.#loadCompleted || data.force);
|
|
4048
4650
|
if (data.revision !== this.#optionRevision)
|
|
4049
4651
|
return undefined;
|
|
4050
|
-
this.#loadCompleted =
|
|
4652
|
+
this.#loadCompleted = !this.loadError();
|
|
4051
4653
|
return {
|
|
4052
4654
|
result,
|
|
4053
4655
|
revision: data.revision,
|
|
@@ -4060,6 +4662,7 @@ class SdTable {
|
|
|
4060
4662
|
}));
|
|
4061
4663
|
}
|
|
4062
4664
|
ngOnDestroy() {
|
|
4665
|
+
this.#destroyed = true;
|
|
4063
4666
|
this.#subscription.unsubscribe();
|
|
4064
4667
|
}
|
|
4065
4668
|
// --- GIỮ NGUYÊN TẤT CẢ CÁC HÀM FILTER VÀ EXPORT CŨ CỦA BẠN ---
|
|
@@ -4096,6 +4699,10 @@ class SdTable {
|
|
|
4096
4699
|
this.total.set(undefined);
|
|
4097
4700
|
this.loading.set(false);
|
|
4098
4701
|
this.isSelectAll.set(false);
|
|
4702
|
+
this.isSelectIndeterminate.set(false);
|
|
4703
|
+
this.loadError.set(false);
|
|
4704
|
+
this.sortState.set({ active: '', direction: '' });
|
|
4705
|
+
this.pageRevision.update(n => n + 1);
|
|
4099
4706
|
this.isFiltered.set(false);
|
|
4100
4707
|
this.requireFiltered.set(false);
|
|
4101
4708
|
this.columnOperator = {};
|
|
@@ -4266,6 +4873,8 @@ class SdTable {
|
|
|
4266
4873
|
};
|
|
4267
4874
|
#load = async (filterReq, force = true) => {
|
|
4268
4875
|
this.loading.set(true);
|
|
4876
|
+
if (force || this.tableOption()?.type === 'server')
|
|
4877
|
+
this.loadError.set(false);
|
|
4269
4878
|
this.#ref.detectChanges();
|
|
4270
4879
|
this.#checkFilter(filterReq);
|
|
4271
4880
|
const opt = this.tableOption();
|
|
@@ -4291,7 +4900,10 @@ class SdTable {
|
|
|
4291
4900
|
columns: opt.columns,
|
|
4292
4901
|
externalFilters: opt.filter?.externalFilters,
|
|
4293
4902
|
});
|
|
4294
|
-
const data = await
|
|
4903
|
+
const data = await Promise.resolve()
|
|
4904
|
+
.then(() => items(filterReq, pagingReq))
|
|
4905
|
+
.catch(err => {
|
|
4906
|
+
this.loadError.set(true);
|
|
4295
4907
|
console.error(err);
|
|
4296
4908
|
return {
|
|
4297
4909
|
items: [],
|
|
@@ -4303,24 +4915,23 @@ class SdTable {
|
|
|
4303
4915
|
.format(data?.items, opt.columns, this.cacheValues, this.#cacheObjValues, opt.rowKey)
|
|
4304
4916
|
.finally(() => {
|
|
4305
4917
|
this.loading.set(false);
|
|
4306
|
-
this.#
|
|
4918
|
+
if (!this.#destroyed)
|
|
4919
|
+
this.#ref.detectChanges();
|
|
4307
4920
|
}),
|
|
4308
4921
|
total: data?.total || 0,
|
|
4309
4922
|
};
|
|
4310
4923
|
}
|
|
4311
4924
|
if (force) {
|
|
4312
4925
|
const { items } = opt;
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
data = await results.catch(err => {
|
|
4317
|
-
this.#notifyService.warning(this.#i18n.t('core.component.table.error-occurred'));
|
|
4318
|
-
console.error(err);
|
|
4319
|
-
return [];
|
|
4320
|
-
});
|
|
4926
|
+
let data;
|
|
4927
|
+
try {
|
|
4928
|
+
data = await items();
|
|
4321
4929
|
}
|
|
4322
|
-
|
|
4323
|
-
|
|
4930
|
+
catch (err) {
|
|
4931
|
+
this.loadError.set(true);
|
|
4932
|
+
this.#notifyService.warning(this.#i18n.t('core.component.table.error-occurred'));
|
|
4933
|
+
console.error(err);
|
|
4934
|
+
data = [];
|
|
4324
4935
|
}
|
|
4325
4936
|
if (!Array.isArray(data)) {
|
|
4326
4937
|
this.#notifyService.warning(this.#i18n.t('core.component.table.not-an-array'));
|
|
@@ -4329,10 +4940,13 @@ class SdTable {
|
|
|
4329
4940
|
this.#localItems = await this.#tableFormatService.format(data, opt.columns, this.cacheValues, this.#cacheObjValues, opt.rowKey);
|
|
4330
4941
|
}
|
|
4331
4942
|
this.loading.set(false);
|
|
4332
|
-
this.#
|
|
4943
|
+
if (!this.#destroyed)
|
|
4944
|
+
this.#ref.detectChanges();
|
|
4333
4945
|
return this.#filterLocal(this.#localItems, filterReq);
|
|
4334
4946
|
};
|
|
4335
4947
|
#render = async (args, scrollTop = true, additionArgs) => {
|
|
4948
|
+
if (this.#destroyed)
|
|
4949
|
+
return;
|
|
4336
4950
|
if (scrollTop) {
|
|
4337
4951
|
this.scroll()?.scrollTop();
|
|
4338
4952
|
}
|
|
@@ -4361,11 +4975,15 @@ class SdTable {
|
|
|
4361
4975
|
this.treeRevision.update(n => n + 1);
|
|
4362
4976
|
}
|
|
4363
4977
|
this.#treeSearchActive = searchNow;
|
|
4364
|
-
//
|
|
4365
|
-
// Phải chạy TRƯỚC applyDefaultSelected để user-selection ưu tiên hơn default.
|
|
4366
|
-
this.#restorePreservedSelection();
|
|
4367
|
-
// Áp dụng defaultSelected: pre-select các item thỏa predicate
|
|
4978
|
+
// 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.
|
|
4368
4979
|
this.#applyDefaultSelected();
|
|
4980
|
+
this.#restorePreservedSelection();
|
|
4981
|
+
if (this.tableOption()?.selector?.single) {
|
|
4982
|
+
const rows = collectFormattedTreeRows(this.items());
|
|
4983
|
+
const chosen = this.#preservedSelectedMap.values().next().value ?? rows.find(row => row.meta.selector?.isSelected);
|
|
4984
|
+
for (const row of rows)
|
|
4985
|
+
row.meta.selector.isSelected = row.meta.id === chosen?.meta.id;
|
|
4986
|
+
}
|
|
4369
4987
|
// Resolve style.rowCss 1 lần/row cho lần render này (xem #applyRowStyles).
|
|
4370
4988
|
this.#applyRowStyles();
|
|
4371
4989
|
await this.tableOption()?.reload?.onReload?.(this.items(), additionArgs);
|
|
@@ -4385,7 +5003,7 @@ class SdTable {
|
|
|
4385
5003
|
notReload: true,
|
|
4386
5004
|
});
|
|
4387
5005
|
const data = await this.#load(this.getFilterRequest(), force);
|
|
4388
|
-
this.#render(data, scrollTop, { fromSource: 'RELOAD' });
|
|
5006
|
+
await this.#render(data, scrollTop, { fromSource: 'RELOAD' });
|
|
4389
5007
|
};
|
|
4390
5008
|
#exportedItems = async (pageNumber = 0, pageSize = 100) => {
|
|
4391
5009
|
const opt = this.tableOption();
|
|
@@ -4504,6 +5122,8 @@ class SdTable {
|
|
|
4504
5122
|
// style của trạng thái đang mở.
|
|
4505
5123
|
this.#applyRowStyles();
|
|
4506
5124
|
this.treeRevision.update(n => n + 1);
|
|
5125
|
+
this.#updateSelectedItems();
|
|
5126
|
+
this.#syncSelectAllState();
|
|
4507
5127
|
this.#ref.markForCheck();
|
|
4508
5128
|
return;
|
|
4509
5129
|
}
|
|
@@ -4541,6 +5161,9 @@ class SdTable {
|
|
|
4541
5161
|
// Children mới format + level/isExpanded vừa đổi → refresh cache rowStyle.
|
|
4542
5162
|
this.#applyRowStyles();
|
|
4543
5163
|
this.treeRevision.update(n => n + 1);
|
|
5164
|
+
this.#restorePreservedSelection();
|
|
5165
|
+
this.#updateSelectedItems();
|
|
5166
|
+
this.#syncSelectAllState();
|
|
4544
5167
|
this.#ref.markForCheck();
|
|
4545
5168
|
}
|
|
4546
5169
|
};
|
|
@@ -4560,84 +5183,83 @@ class SdTable {
|
|
|
4560
5183
|
notReload: true,
|
|
4561
5184
|
});
|
|
4562
5185
|
};
|
|
4563
|
-
onExpand = async (
|
|
4564
|
-
const
|
|
4565
|
-
|
|
5186
|
+
onExpand = async (row) => {
|
|
5187
|
+
const option = this.tableOption()?.expand;
|
|
5188
|
+
const meta = row.meta.expand;
|
|
5189
|
+
if (option?.always || meta.isExpanding || option?.disabled?.(row.data))
|
|
4566
5190
|
return;
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
5191
|
+
if (meta.isExpanded) {
|
|
5192
|
+
meta.isExpanded = false;
|
|
5193
|
+
this.expandRevision.update(n => n + 1);
|
|
5194
|
+
this.#ref.markForCheck();
|
|
4570
5195
|
return;
|
|
4571
5196
|
}
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
this.items().forEach(item => (item.meta.expand.isExpanding = item.meta.expand.isExpanded = false));
|
|
5197
|
+
if (!option?.multiple) {
|
|
5198
|
+
collectFormattedTreeRows(this.items()).forEach(item => (item.meta.expand.isExpanded = false));
|
|
4575
5199
|
}
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
.finally(() => (rowData.meta.expand.isExpanding = false));
|
|
5200
|
+
try {
|
|
5201
|
+
const result = option?.onExpand?.(row.data);
|
|
5202
|
+
meta.isExpanding = result instanceof Promise;
|
|
5203
|
+
this.expandRevision.update(n => n + 1);
|
|
5204
|
+
this.#ref.markForCheck();
|
|
5205
|
+
meta.data = await result;
|
|
5206
|
+
meta.isExpanded = true;
|
|
4584
5207
|
}
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
5208
|
+
catch (error) {
|
|
5209
|
+
console.error(error);
|
|
5210
|
+
this.#notifyService.warning(this.#i18n.t('core.component.table.error-occurred'));
|
|
5211
|
+
}
|
|
5212
|
+
finally {
|
|
5213
|
+
meta.isExpanding = false;
|
|
5214
|
+
this.expandRevision.update(n => n + 1);
|
|
5215
|
+
this.#ref.markForCheck();
|
|
4588
5216
|
}
|
|
4589
5217
|
};
|
|
4590
5218
|
onSelect = (rowData) => {
|
|
4591
5219
|
const opt = this.tableOption();
|
|
4592
|
-
const selectedData = () => this.#getSelectedRowData();
|
|
4593
5220
|
if (rowData.meta.group?.items?.length) {
|
|
4594
|
-
|
|
4595
|
-
opt.selector?.onSelect?.(rowData.data,
|
|
4596
|
-
|
|
4597
|
-
this.#syncSelectAllState();
|
|
5221
|
+
this.onSelectGroup(rowData, !!rowData.meta.selector?.isSelected);
|
|
5222
|
+
opt.selector?.onSelect?.(rowData.data, this.selectedItems);
|
|
5223
|
+
return;
|
|
4598
5224
|
}
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
opt.selector?.onSelect?.(rowData.data, selectedData());
|
|
4611
|
-
this.isSelectAll.set(false);
|
|
4612
|
-
this.#updateSelectedItems();
|
|
4613
|
-
return;
|
|
4614
|
-
}
|
|
4615
|
-
opt.selector?.onSelect?.(rowData.data, selectedData());
|
|
4616
|
-
this.#updateSelectedItems();
|
|
4617
|
-
this.#syncSelectAllState();
|
|
5225
|
+
if (opt.selector?.single) {
|
|
5226
|
+
this.#getSelectionRows()
|
|
5227
|
+
.filter(row => row !== rowData)
|
|
5228
|
+
.forEach(row => (row.meta.selector.isSelected = false));
|
|
5229
|
+
this.#preservedSelectedMap.clear();
|
|
5230
|
+
}
|
|
5231
|
+
if (this.#preserveEnabled()) {
|
|
5232
|
+
if (rowData.meta.selector?.isSelected)
|
|
5233
|
+
this.#preservedSelectedMap.set(rowData.meta.id, rowData);
|
|
5234
|
+
else
|
|
5235
|
+
this.#preservedSelectedMap.delete(rowData.meta.id);
|
|
4618
5236
|
}
|
|
5237
|
+
this.#updateSelectedItems();
|
|
5238
|
+
this.#syncSelectAllState();
|
|
5239
|
+
opt.selector?.onSelect?.(rowData.data, this.selectedItems);
|
|
4619
5240
|
};
|
|
4620
5241
|
onSelectAll = () => {
|
|
4621
|
-
const
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
e.meta.selector.isSelected = isSelected;
|
|
5242
|
+
const checked = this.isSelectAll();
|
|
5243
|
+
this.#getSelectionRows().forEach(row => {
|
|
5244
|
+
if (row.meta.selector?.selectable || (!checked && row.meta.selector?.isSelected)) {
|
|
5245
|
+
row.meta.selector.isSelected = checked;
|
|
4626
5246
|
}
|
|
4627
5247
|
});
|
|
4628
|
-
opt?.selector?.onSelectAll?.(this.#getSelectedRowData());
|
|
4629
5248
|
this.#updateSelectedItems();
|
|
4630
5249
|
this.#syncSelectAllState();
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
this.
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
this.#preservedSelectedMap.
|
|
4639
|
-
|
|
5250
|
+
this.tableOption()?.selector?.onSelectAll?.(this.selectedItems);
|
|
5251
|
+
};
|
|
5252
|
+
onClearSelection = (_items) => {
|
|
5253
|
+
// why: clear is global, including cached tree children and rows outside this page.
|
|
5254
|
+
const rows = [
|
|
5255
|
+
...collectFormattedTreeRows(this.items()),
|
|
5256
|
+
...collectFormattedTreeRows(this.#localItems),
|
|
5257
|
+
...this.#preservedSelectedMap.values(),
|
|
5258
|
+
];
|
|
5259
|
+
rows.forEach(row => (row.meta.selector.isSelected = false));
|
|
5260
|
+
this.#preservedSelectedMap.clear();
|
|
4640
5261
|
this.#updateSelectedItems();
|
|
5262
|
+
this.#syncSelectAllState();
|
|
4641
5263
|
};
|
|
4642
5264
|
#getSelectionRows = () => {
|
|
4643
5265
|
return getSelectionRows(this.items(), this.tableOption()?.tree);
|
|
@@ -4647,7 +5269,10 @@ class SdTable {
|
|
|
4647
5269
|
applyDefaultSelected(this.items(), this.tableOption()?.tree, this.tableOption()?.selector?.defaultSelected);
|
|
4648
5270
|
};
|
|
4649
5271
|
#syncSelectAllState = () => {
|
|
4650
|
-
this
|
|
5272
|
+
const rows = this.#getSelectionRows().filter(row => row.meta.selector?.selectable);
|
|
5273
|
+
const all = resolveSelectAllState(rows);
|
|
5274
|
+
this.isSelectAll.set(all);
|
|
5275
|
+
this.isSelectIndeterminate.set(!all && rows.some(row => row.meta.selector?.isSelected));
|
|
4651
5276
|
};
|
|
4652
5277
|
// ==========================================
|
|
4653
5278
|
// GROUP HELPERS — sync selection + expand state cho group header rows
|
|
@@ -4676,9 +5301,9 @@ class SdTable {
|
|
|
4676
5301
|
const sel = this.#groupSelectableChildren(header);
|
|
4677
5302
|
sel.forEach(c => (c.meta.selector.isSelected = checked));
|
|
4678
5303
|
const opt = this.tableOption();
|
|
4679
|
-
opt?.selector?.onSelectAll?.(this.#getSelectedRowData());
|
|
4680
5304
|
this.#updateSelectedItems();
|
|
4681
5305
|
this.#syncSelectAllState();
|
|
5306
|
+
opt?.selector?.onSelectAll?.(this.selectedItems);
|
|
4682
5307
|
};
|
|
4683
5308
|
// Map<groupKey, isExpanded> — table own state, pass vào SdGroupPipe arg 3.
|
|
4684
5309
|
// why: pipe stateless, persist toggle qua các lần re-eval bằng Map external. Mutate Map
|
|
@@ -4735,7 +5360,8 @@ class SdTable {
|
|
|
4735
5360
|
* Colspan cho cell sdGroupHeader trên group row = displayedColumns.length.
|
|
4736
5361
|
* Span TOÀN BỘ width data row vì group row chỉ có 1 cell.
|
|
4737
5362
|
*/
|
|
4738
|
-
sdGroupColspan = computed(() => this.configuration()?.displayedColumns?.length || 1,
|
|
5363
|
+
sdGroupColspan = computed(() => this.configuration()?.displayedColumns?.length || 1, /* @ts-ignore */
|
|
5364
|
+
...(ngDevMode ? [{ debugName: "sdGroupColspan" }] : /* istanbul ignore next */ []));
|
|
4739
5365
|
/**
|
|
4740
5366
|
* Context truyền vào template `sdTableGroupDef`.
|
|
4741
5367
|
*
|
|
@@ -4800,8 +5426,6 @@ class SdTable {
|
|
|
4800
5426
|
};
|
|
4801
5427
|
#updateSelectedItems = () => {
|
|
4802
5428
|
const rows = this.#getSelectionRows();
|
|
4803
|
-
// Selection vừa đổi → cập nhật checkbox state cache của mọi group header.
|
|
4804
|
-
this.#syncGroupSelectionState();
|
|
4805
5429
|
if (this.#preserveEnabled()) {
|
|
4806
5430
|
// Sync map theo state visible: add nếu selected, remove nếu deselected.
|
|
4807
5431
|
// Off-page items giữ nguyên trong map (không bị visit ở đây).
|
|
@@ -4810,6 +5434,8 @@ class SdTable {
|
|
|
4810
5434
|
else {
|
|
4811
5435
|
this.selectedTableItems.set(rows.filter(item => item.meta.selector.isSelected));
|
|
4812
5436
|
}
|
|
5437
|
+
prepareTableSelection(collectFormattedTreeRows(this.items()), this.selectedTableItems(), this.tableOption()?.selector);
|
|
5438
|
+
this.#syncGroupSelectionState();
|
|
4813
5439
|
this.#ref.detectChanges();
|
|
4814
5440
|
};
|
|
4815
5441
|
clearFilter = () => {
|
|
@@ -4832,7 +5458,11 @@ class SdTable {
|
|
|
4832
5458
|
get selectedItems() {
|
|
4833
5459
|
return this.selectedTableItems().map(item => item.data);
|
|
4834
5460
|
}
|
|
4835
|
-
detectChanges = () =>
|
|
5461
|
+
detectChanges = () => {
|
|
5462
|
+
this.dataRevision.update(value => value + 1);
|
|
5463
|
+
this.#updateSelectedItems();
|
|
5464
|
+
this.#syncSelectAllState();
|
|
5465
|
+
};
|
|
4836
5466
|
onColumnResize = (field, width) => {
|
|
4837
5467
|
// persistColumnWidth ghi storage (silent) và emit widthChange$,
|
|
4838
5468
|
// subscriber trong constructor đã update configuration() signal đồng bộ.
|
|
@@ -4863,9 +5493,11 @@ class SdTable {
|
|
|
4863
5493
|
// Offset STT theo paging — computed memoize, không tính lại trừ khi paginator đổi.
|
|
4864
5494
|
// Template chỉ cần đọc pageOffset() rồi cộng `i + 1` (rẻ hơn gọi function).
|
|
4865
5495
|
pageOffset = computed(() => {
|
|
5496
|
+
this.pageRevision();
|
|
4866
5497
|
const p = this.paginator();
|
|
4867
5498
|
return (p?.pageIndex ?? 0) * (p?.pageSize ?? 0);
|
|
4868
|
-
},
|
|
5499
|
+
}, /* @ts-ignore */
|
|
5500
|
+
...(ngDevMode ? [{ debugName: "pageOffset" }] : /* istanbul ignore next */ []));
|
|
4869
5501
|
isReorderDisabled(item) {
|
|
4870
5502
|
const opt = this.tableOption()?.rowReorder;
|
|
4871
5503
|
const idx = this.#itemIndexMap.get(item) ?? -1;
|
|
@@ -4899,8 +5531,8 @@ class SdTable {
|
|
|
4899
5531
|
this.table()?.renderRows();
|
|
4900
5532
|
this.tableOption()?.rowReorder?.onChange?.(result.items.map(i => i.data), event.item.data.data, result.fromIndex, result.toIndex);
|
|
4901
5533
|
}
|
|
4902
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
4903
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
5534
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5535
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", 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: [
|
|
4904
5536
|
DatePipe,
|
|
4905
5537
|
DecimalPipe,
|
|
4906
5538
|
CdkColumnDef,
|
|
@@ -4912,7 +5544,7 @@ class SdTable {
|
|
|
4912
5544
|
provide: MatPaginatorIntl,
|
|
4913
5545
|
useClass: SdTablePaginatorIntl,
|
|
4914
5546
|
},
|
|
4915
|
-
], 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 [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 <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 [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 <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;--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 .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}\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: "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: i2.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: i2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i2.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.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: 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", "cdkDropListHasAnchor"], 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: "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: "directive", type: SdTableSortHeaderDirective, selector: "[sdTableSortHeader]", inputs: ["sdTableSortHeader"] }, { kind: "pipe", type: i1.JsonPipe, name: "json" }, { 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: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], animations: [
|
|
5547
|
+
], 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:focus-visible{outline:2px solid var(--sd-primary);outline-offset:2px}: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;--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: "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: i2$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: i2$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i2$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[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { 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", "cdkDropListHasAnchor"], 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: "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: "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"] }, { kind: "pipe", type: i1$1.JsonPipe, name: "json" }, { kind: "pipe", type: SdGroupPipe, name: "sdGroup" }, { kind: "pipe", type: SdTreePipe, name: "sdTree" }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], animations: [
|
|
4916
5548
|
trigger('detailExpand', [
|
|
4917
5549
|
state('collapsed', style({ height: '0', minHeight: '0', visibility: 'hidden' })),
|
|
4918
5550
|
state('expanded', style({ height: '*', visibility: 'visible' })),
|
|
@@ -4920,7 +5552,7 @@ class SdTable {
|
|
|
4920
5552
|
]),
|
|
4921
5553
|
], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4922
5554
|
}
|
|
4923
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
5555
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdTable, decorators: [{
|
|
4924
5556
|
type: Component,
|
|
4925
5557
|
args: [{ selector: 'sd-table', changeDetection: ChangeDetectionStrategy.OnPush, animations: [
|
|
4926
5558
|
trigger('detailExpand', [
|
|
@@ -4930,6 +5562,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
4930
5562
|
]),
|
|
4931
5563
|
], host: {
|
|
4932
5564
|
'[attr.data-autoid]': 'autoId()',
|
|
5565
|
+
tabindex: '0',
|
|
4933
5566
|
'[attr.data-loading]': 'loading() ? "true" : "false"',
|
|
4934
5567
|
}, providers: [
|
|
4935
5568
|
DatePipe,
|
|
@@ -4952,6 +5585,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
4952
5585
|
MatTableModule,
|
|
4953
5586
|
MatSortModule,
|
|
4954
5587
|
MatProgressSpinnerModule,
|
|
5588
|
+
MatButtonModule,
|
|
4955
5589
|
MatCheckboxModule,
|
|
4956
5590
|
MatRadioModule,
|
|
4957
5591
|
DragDropModule,
|
|
@@ -4965,24 +5599,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
4965
5599
|
MobileFilterComponent,
|
|
4966
5600
|
SdGroupPipe,
|
|
4967
5601
|
SdTreePipe,
|
|
4968
|
-
SdSelectionVisiblePipe,
|
|
4969
5602
|
SdSafeHtmlPipe,
|
|
4970
|
-
SdSelectionDisabledPipe,
|
|
4971
5603
|
SdScrollDirective,
|
|
4972
|
-
SdDesktopDirective,
|
|
4973
|
-
SdMobileDirective,
|
|
4974
5604
|
SdHoverCopyDirective,
|
|
4975
5605
|
SelectorActionComponent,
|
|
4976
5606
|
StickyShadowDirective,
|
|
4977
5607
|
SdColumnResizeDirective,
|
|
4978
5608
|
SdTableSortHeaderDirective,
|
|
4979
5609
|
SdTranslatePipe,
|
|
4980
|
-
], 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 [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 <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 [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 <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;--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 .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}\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"] }]
|
|
4981
|
-
|
|
5610
|
+
SdTableMobileCardsComponent,
|
|
5611
|
+
SdTableMobileActionsComponent,
|
|
5612
|
+
], 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:focus-visible{outline:2px solid var(--sd-primary);outline-offset:2px}: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;--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"] }]
|
|
5613
|
+
}], ctorParameters: () => [], propDecorators: { autoIdInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: true }] }], table: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatTable), { isSignal: true }] }], configComponent: [{ type: i0.ViewChild, args: [i0.forwardRef(() => ConfigComponent), { isSignal: true }] }], sdPopupExport: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdPopupExport), { isSignal: true }] }], scroll: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdScrollDirective), { isSignal: true }] }], quickAction: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdQuickAction), { isSignal: true }] }], externalFilter: [{ type: i0.ViewChild, args: [i0.forwardRef(() => ExternalFilterComponent), { isSignal: true }] }], mobileFilter: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MobileFilterComponent), { isSignal: true }] }], paginator: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatPaginator), { isSignal: true }] }], sort: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatSort), { isSignal: true }] }], sdSubInformation: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdTableExpandDefDirective), { isSignal: true }] }], sdGroupDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdTableGroupDefDirective), { isSignal: true }] }], sdCellDefs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SdTableCellDefDirective), { isSignal: true }] }], sdCommandHeaderDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdTableCommandHeaderDefDirective), { isSignal: true }] }], sdFooterDefs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SdMaterialFooterDefDirective), { isSignal: true }] }], sdFilterDefs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SdTableFilterDefDirective), { isSignal: true }] }], sdTitleDefs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SdTableTitleDefDirective), { isSignal: true }] }], sdRowMobileDef: [{ type: i0.ContentChild, args: [i0.forwardRef(() => SdTableRowMobileDefDirective), { ...{ descendants: false }, isSignal: true }] }] } });
|
|
4982
5614
|
|
|
4983
5615
|
/**
|
|
4984
5616
|
* Generated bundle index. Do not edit.
|
|
4985
5617
|
*/
|
|
4986
5618
|
|
|
4987
|
-
export { SD_TABLE_CONFIGURATION, SdConvertToPagingReq, SdMaterialFooterDefDirective, SdTable, SdTableCellDefDirective, SdTableCommandHeaderDefDirective, SdTableExpandDefDirective, SdTableFilterDefDirective, SdTableGroupDefDirective, SdTablePaginatorIntl, SdTableTitleDefDirective };
|
|
5619
|
+
export { SD_TABLE_CONFIGURATION, SdConvertToPagingReq, SdMaterialFooterDefDirective, SdTable, SdTableCellDefDirective, SdTableCommandHeaderDefDirective, SdTableExpandDefDirective, SdTableFilterDefDirective, SdTableGroupDefDirective, SdTablePaginatorIntl, SdTableRowMobileDefDirective, SdTableTitleDefDirective };
|
|
4988
5620
|
//# sourceMappingURL=sdcorejs-angular-components-table.mjs.map
|