@sdcorejs/angular 19.3.4 → 19.3.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/components/modal/src/modal.component.d.ts +6 -1
- package/components/query-bar/index.d.ts +1 -0
- package/components/query-bar/src/query-bar-chip-text.d.ts +27 -0
- package/components/table/src/components/config/config.component.d.ts +69 -1
- package/components/table/src/components/filter/mobile-filter/mobile-field-sheet.component.d.ts +35 -0
- package/components/table/src/components/filter/mobile-filter/mobile-filter-field.component.d.ts +64 -0
- package/components/table/src/components/filter/mobile-filter/mobile-filter-summary.d.ts +11 -0
- package/components/table/src/components/filter/mobile-filter/mobile-filter.component.d.ts +47 -15
- package/components/table/src/components/mobile-cards/mobile-card-data.component.d.ts +45 -0
- package/components/table/src/components/mobile-cards/mobile-cards.component.d.ts +13 -1
- package/components/table/src/components/mobile-sheet/mobile-sheet.d.ts +35 -0
- package/components/table/src/components/mobile-sort/mobile-sort-sheet.component.d.ts +36 -0
- package/components/table/src/components/mobile-toolbar/mobile-filter-chips.component.d.ts +49 -0
- package/components/table/src/components/mobile-toolbar/mobile-tools-sheet.component.d.ts +48 -0
- package/components/table/src/components/mobile-toolbar/pull-refresh.component.d.ts +21 -0
- package/components/table/src/configurations/table.configuration.d.ts +9 -0
- package/components/table/src/models/index.d.ts +1 -0
- package/components/table/src/models/table-mobile.model.d.ts +55 -0
- package/components/table/src/models/table-option.model.d.ts +11 -1
- package/components/table/src/services/config-custom.util.d.ts +11 -3
- package/components/table/src/services/mobile/mobile-view.util.d.ts +77 -0
- package/components/table/src/services/table-export/table-export.service.d.ts +2 -0
- package/components/table/src/services/table-filter/table-filter.model.d.ts +12 -2
- package/components/table/src/services/table-filter/table-mobile-filter.util.d.ts +54 -0
- package/components/table/src/services/table-filter/table-query-bar.util.d.ts +21 -1
- package/components/table/src/table.component.d.ts +57 -6
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +5 -5
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +45 -9
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +171 -151
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +5376 -3610
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +23 -4
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +190 -0
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +10 -6
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-excel.mjs +34 -0
- package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
- package/i18n/src/en.d.ts +38 -0
- package/package.json +9 -9
- package/services/excel/src/lib/excel.model.d.ts +29 -0
- package/services/excel/src/lib/excel.service.d.ts +30 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ElementRef } from '@angular/core';
|
|
2
|
+
import { SdModal } from '@sdcorejs/angular/components/modal';
|
|
3
|
+
import type { SdTable } from '../../table.component';
|
|
4
|
+
import type { SdTableMobileAction } from '../mobile-cards/mobile-action.model';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
type ToolTone = 'success' | 'info' | 'primary' | 'secondary';
|
|
7
|
+
interface Tool {
|
|
8
|
+
action: SdTableMobileAction;
|
|
9
|
+
title: string;
|
|
10
|
+
hint: string;
|
|
11
|
+
icon: string;
|
|
12
|
+
tone: ToolTone;
|
|
13
|
+
/** Short note next to the title, e.g. "Customized" while the table uses a setup of its own. */
|
|
14
|
+
badge?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Tools sheet of the phone (⋮, handoff table-mobile 2): the exports as tiles (format, file kind, progress while one runs)
|
|
18
|
+
* and the table settings as a row that says when the table uses a setup of its own. Same chrome as the other phone
|
|
19
|
+
* sheets: handle, title, swipe down and Back close it. An export keeps the sheet open until it is done.
|
|
20
|
+
*/
|
|
21
|
+
export declare class SdTableMobileToolsSheetComponent<T = unknown> {
|
|
22
|
+
#private;
|
|
23
|
+
readonly table: import("@angular/core").InputSignal<SdTable<T>>;
|
|
24
|
+
/** `SdTable.mobileToolsActions`. */
|
|
25
|
+
readonly actions: import("@angular/core").InputSignal<SdTableMobileAction[]>;
|
|
26
|
+
readonly sheet: import("@angular/core").Signal<SdModal>;
|
|
27
|
+
protected readonly head: import("@angular/core").Signal<ElementRef<HTMLElement> | undefined>;
|
|
28
|
+
protected readonly ids: {
|
|
29
|
+
export: string;
|
|
30
|
+
table: string;
|
|
31
|
+
};
|
|
32
|
+
/** Key of the export started from this sheet, until it is done. */
|
|
33
|
+
readonly running: import("@angular/core").WritableSignal<string | undefined>;
|
|
34
|
+
readonly exporting: import("@angular/core").WritableSignal<boolean>;
|
|
35
|
+
readonly tools: import("@angular/core").Signal<Tool[]>;
|
|
36
|
+
readonly exportTools: import("@angular/core").Signal<Tool[]>;
|
|
37
|
+
readonly tableTools: import("@angular/core").Signal<Tool[]>;
|
|
38
|
+
/** Hint of the running export: the percent of a paged export, else "Exporting…". */
|
|
39
|
+
readonly progress: import("@angular/core").Signal<string>;
|
|
40
|
+
constructor();
|
|
41
|
+
open(): void;
|
|
42
|
+
run(tool: Tool): void;
|
|
43
|
+
/** Every close path ends here: drop the history entry, then run a tool that waited for the close. */
|
|
44
|
+
onClosed(): void;
|
|
45
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SdTableMobileToolsSheetComponent<any>, never>;
|
|
46
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SdTableMobileToolsSheetComponent<any>, "sd-table-mobile-tools-sheet", never, { "table": { "alias": "table"; "required": true; "isSignal": true; }; "actions": { "alias": "actions"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
/** Pull distance that triggers a refresh. */
|
|
3
|
+
export declare const SD_TABLE_PULL_DISTANCE = 64;
|
|
4
|
+
/**
|
|
5
|
+
* Pull to refresh on the phone cards (handoff table-mobile 7). Listens to touches on `target` (the card list); only a
|
|
6
|
+
* pull that starts with the list at the top, while no sheet is open, counts. Past `SD_TABLE_PULL_DISTANCE` the release
|
|
7
|
+
* emits `refresh`; the indicator stays until `loading` turns false. Listeners are passive.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SdTablePullRefreshComponent {
|
|
10
|
+
#private;
|
|
11
|
+
readonly target: import("@angular/core").InputSignal<HTMLElement | undefined>;
|
|
12
|
+
readonly enabled: import("@angular/core").InputSignal<boolean>;
|
|
13
|
+
readonly loading: import("@angular/core").InputSignal<boolean>;
|
|
14
|
+
readonly refresh: import("@angular/core").OutputEmitterRef<void>;
|
|
15
|
+
readonly distance: import("@angular/core").WritableSignal<number>;
|
|
16
|
+
readonly refreshing: import("@angular/core").WritableSignal<boolean>;
|
|
17
|
+
readonly threshold = 64;
|
|
18
|
+
constructor();
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SdTablePullRefreshComponent, never>;
|
|
20
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SdTablePullRefreshComponent, "sd-table-pull-refresh", never, { "target": { "alias": "target"; "required": false; "isSignal": true; }; "enabled": { "alias": "enabled"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; }, { "refresh": "refresh"; }, never, never, true, never>;
|
|
21
|
+
}
|
|
@@ -22,6 +22,8 @@ export interface ISdTableConfiguration {
|
|
|
22
22
|
hideExternalFilterToolbar?: SdTableOptionFilter['hideExternalFilterToolbar'];
|
|
23
23
|
/** Giao diện lọc mặc định cho mọi bảng; `option.filter.mode` thắng. Mặc định là `'default'`. */
|
|
24
24
|
mode?: SdTableOptionFilter['mode'];
|
|
25
|
+
/** Cho người dùng chọn giao diện lọc trong modal Thiết lập; `option.filter.modeSelectable` thắng. Mặc định là `true`. */
|
|
26
|
+
modeSelectable?: SdTableOptionFilter['modeSelectable'];
|
|
25
27
|
/** Tuỳ chọn mặc định của mode `'query-bar'`; gộp theo từng field với `option.filter.queryBar`. */
|
|
26
28
|
queryBar?: SdTableOptionFilter['queryBar'];
|
|
27
29
|
operator?: {
|
|
@@ -36,6 +38,13 @@ export interface ISdTableConfiguration {
|
|
|
36
38
|
};
|
|
37
39
|
/** Lớp hiển thị khi đang tải cho mọi bảng; `option.loading` của từng bảng thắng theo từng field. */
|
|
38
40
|
loading?: SdTableOptionLoading;
|
|
41
|
+
mobile?: {
|
|
42
|
+
/**
|
|
43
|
+
* Phone cards for tables without a card body (`sdTableRowMobileDef` or `mobile.template`): the card is built from
|
|
44
|
+
* the visible columns. `mobile.template: false` opts a table out. Mặc định là `false`.
|
|
45
|
+
*/
|
|
46
|
+
autoTemplate?: boolean;
|
|
47
|
+
};
|
|
39
48
|
}
|
|
40
49
|
export declare const DEFAULT_TABLE_CONFIG: ISdTableConfiguration;
|
|
41
50
|
export declare const SD_TABLE_CONFIGURATION: InjectionToken<ISdTableConfiguration>;
|
|
@@ -4,4 +4,5 @@ export type * from './table-aggregate.model';
|
|
|
4
4
|
export type * from './table-command.model';
|
|
5
5
|
export type * from './table-option-tree.model';
|
|
6
6
|
export type * from './table-option-loading.model';
|
|
7
|
+
export type * from './table-mobile.model';
|
|
7
8
|
export type { SdTableItem, SdTableMeta, SdTableDisplay } from './table-item.model';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { TemplateRef } from '@angular/core';
|
|
2
|
+
import type { SdBadgeData } from '@sdcorejs/angular/components/badge';
|
|
3
|
+
import type { NestedKeyOf } from '@sdcorejs/utils/models';
|
|
4
|
+
import type { SdTableRowMobileDefContext } from '../directives/sd-table-row-mobile-def.directive';
|
|
5
|
+
/** A leaf column of the table, by its `field`. Checked at build time (`NestedKeyOf<T>`) and at run time (leaf column). */
|
|
6
|
+
export type SdTableMobileField<T> = NestedKeyOf<T>;
|
|
7
|
+
/** A column value, or fixed text shown as is. */
|
|
8
|
+
export type SdTableMobileText<T> = SdTableMobileField<T> | {
|
|
9
|
+
text: string;
|
|
10
|
+
};
|
|
11
|
+
/** Slots every mobile layout has. */
|
|
12
|
+
export interface SdTableMobileData<T> {
|
|
13
|
+
/** First line, 15px medium. A missing or unknown field falls back to `mobile.rowLabel`, then `rowKey`. */
|
|
14
|
+
title: SdTableMobileText<T>;
|
|
15
|
+
/** Second line, one line cut with "…". */
|
|
16
|
+
subtitle?: SdTableMobileText<T>;
|
|
17
|
+
/** After the title. A field must be a column with `useBadge` (checked at run time), otherwise it shows as text. */
|
|
18
|
+
badge?: SdTableMobileField<T> | SdBadgeData;
|
|
19
|
+
/** Grid cells with the column title as label, in this order. */
|
|
20
|
+
fields?: SdTableMobileField<T>[];
|
|
21
|
+
}
|
|
22
|
+
/** Data of a `card` (the only layout so far). */
|
|
23
|
+
export interface SdTableMobileCardData<T> extends SdTableMobileData<T> {
|
|
24
|
+
/** First grid cell, medium weight. */
|
|
25
|
+
highlight?: SdTableMobileField<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Grid cells shown before the "{n} more fields" button, `highlight` included.
|
|
28
|
+
* @defaultValue 4
|
|
29
|
+
*/
|
|
30
|
+
maxFields?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Not a card slot. why: TypeScript does not report excess properties of an object returned by an arrow function,
|
|
33
|
+
* so `never` is what rejects `trailing` (a slot of the future `list` layout) on a card.
|
|
34
|
+
*/
|
|
35
|
+
trailing?: never;
|
|
36
|
+
}
|
|
37
|
+
/** Second argument of `mobile.template.data`. */
|
|
38
|
+
export interface SdTableMobileDataContext {
|
|
39
|
+
/** Zero-based data-row position on the current page, as in `SdTableRowMobileDefContext`. */
|
|
40
|
+
index: number;
|
|
41
|
+
selected: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Builds the slots of one row. Called again when the rows are read again or `detectChanges()` runs, and when the index
|
|
45
|
+
* or the selection of the row changes.
|
|
46
|
+
*/
|
|
47
|
+
export type SdTableMobileDataFn<T, D> = (item: T, context: SdTableMobileDataContext) => D;
|
|
48
|
+
/**
|
|
49
|
+
* Body of the phone card: a consumer template, or slots built from the row (`data`). `layout` is fixed per table;
|
|
50
|
+
* leaving it out means `'card'`.
|
|
51
|
+
*/
|
|
52
|
+
export type SdTableMobileTemplate<T> = TemplateRef<SdTableRowMobileDefContext<T>> | {
|
|
53
|
+
layout?: 'card';
|
|
54
|
+
data: SdTableMobileDataFn<T, SdTableMobileCardData<T>>;
|
|
55
|
+
};
|
|
@@ -13,6 +13,7 @@ import { SdTableOptionSelector } from './table-option-selector.model';
|
|
|
13
13
|
import { SdTableOptionSort } from './table-option-sort.model';
|
|
14
14
|
import { SdTableOptionStyle } from './table-option-style.model';
|
|
15
15
|
import { SdTableOptionTree } from './table-option-tree.model';
|
|
16
|
+
import type { SdTableMobileTemplate } from './table-mobile.model';
|
|
16
17
|
import type { SdTableOptionAggregate } from './table-aggregate.model';
|
|
17
18
|
export type SdTableOption<T = any> = SdTableLocalOption<T> | SdTableServerOption<T>;
|
|
18
19
|
interface SdTableBaseOption<T = any> {
|
|
@@ -43,10 +44,19 @@ interface SdTableBaseOption<T = any> {
|
|
|
43
44
|
* cần autoId theo dòng ổn định cho E2E.
|
|
44
45
|
*/
|
|
45
46
|
rowKey?: string;
|
|
46
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Phone layout. Cards activate when the table has a card body: a projected `sdTableRowMobileDef` (wins, with a dev
|
|
49
|
+
* warning when `template` is set too), `template`, or `SD_TABLE_CONFIGURATION.mobile.autoTemplate`.
|
|
50
|
+
*/
|
|
47
51
|
mobile?: {
|
|
48
52
|
/** Row command title and accessible labels; falls back to rowKey, then row number. */
|
|
49
53
|
rowLabel?: (row: T) => string;
|
|
54
|
+
/**
|
|
55
|
+
* Card body on phones: a `TemplateRef`, or `{ data }` to build the card from row values. `false` keeps the desktop
|
|
56
|
+
* table on phones even with `autoTemplate`.
|
|
57
|
+
* @example `template: { data: row => ({ title: 'code', badge: 'status', highlight: 'total' }) }`
|
|
58
|
+
*/
|
|
59
|
+
template?: SdTableMobileTemplate<T> | false;
|
|
50
60
|
};
|
|
51
61
|
/**
|
|
52
62
|
* Cấu hình hiển thị/phục hồi config của table.
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { ConfiguredTable } from '../models/table-option-config.model';
|
|
2
2
|
import { SdTableOption } from '../models/table-option.model';
|
|
3
|
+
import { SdTableOptionFilter } from './table-filter/table-filter.model';
|
|
3
4
|
/** The column setup of an option before anyone changes it: every column that is not `hidden`, in option order. */
|
|
4
5
|
export declare const defaultConfiguredTable: (option: SdTableOption | undefined) => ConfiguredTable;
|
|
6
|
+
/**
|
|
7
|
+
* Whether two column setups build the same table: the same columns in the same order, with the same title, width,
|
|
8
|
+
* visibility, fixed and truncate. A value set back to its original counts as unchanged.
|
|
9
|
+
*/
|
|
10
|
+
export declare const sdTableSameColumnSetup: (left: ConfiguredTable | undefined, right: ConfiguredTable | undefined) => boolean;
|
|
5
11
|
/**
|
|
6
12
|
* Whether the table uses a setup of its own: the stored columns differ from the defaults in order, visibility, title,
|
|
7
|
-
* width (the settings modal or a resize on the table), fixed or truncate,
|
|
8
|
-
* `defaultShowing
|
|
13
|
+
* width (the settings modal or a resize on the table), fixed or truncate, the inline external filters differ from
|
|
14
|
+
* `defaultShowing`, or the stored filter mode differs from `filter.mode` (only while `filter.modeSelectable` is not
|
|
15
|
+
* `false`). Columns added to or removed from the option since the setup was stored do not count.
|
|
9
16
|
*/
|
|
10
|
-
export declare const sdTableHasCustomSetup: ({ option, configuration, inlineExternal, }: {
|
|
17
|
+
export declare const sdTableHasCustomSetup: ({ option, configuration, inlineExternal, filterMode, }: {
|
|
11
18
|
option: SdTableOption | undefined;
|
|
12
19
|
configuration: ConfiguredTable | undefined;
|
|
13
20
|
inlineExternal?: Record<string, boolean>;
|
|
21
|
+
filterMode?: SdTableOptionFilter["mode"];
|
|
14
22
|
}) => boolean;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type TemplateRef } from '@angular/core';
|
|
2
|
+
import type { SdBadgeData } from '@sdcorejs/angular/components/badge';
|
|
3
|
+
import type { SdTableRowMobileDefContext } from '../../directives/sd-table-row-mobile-def.directive';
|
|
4
|
+
import type { SdTableColumnAnyRow } from '../../models/table-column.model';
|
|
5
|
+
import type { SdTableMobileCardData, SdTableMobileDataFn } from '../../models/table-mobile.model';
|
|
6
|
+
/** What fills a phone card: a template, slots from `mobile.template.data`, or slots derived from the columns. */
|
|
7
|
+
export type SdTableMobileBody<T> = {
|
|
8
|
+
kind: 'template';
|
|
9
|
+
templateRef: TemplateRef<SdTableRowMobileDefContext<T>>;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'data';
|
|
12
|
+
layout: unknown;
|
|
13
|
+
data: SdTableMobileDataFn<T, SdTableMobileCardData<T>>;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'auto';
|
|
16
|
+
};
|
|
17
|
+
/** Grid cells before the "{n} more fields" button when `maxFields` is not set. */
|
|
18
|
+
export declare const SD_TABLE_MOBILE_MAX_FIELDS = 4;
|
|
19
|
+
/** A text slot of a card: the value of a column, or fixed text. */
|
|
20
|
+
export type SdTableMobileTextSlot = {
|
|
21
|
+
column: SdTableColumnAnyRow;
|
|
22
|
+
} | {
|
|
23
|
+
text: string;
|
|
24
|
+
};
|
|
25
|
+
/** The badge slot: a column value (`badge: false` when the column has no `useBadge`) or a fixed badge. */
|
|
26
|
+
export type SdTableMobileBadgeSlot = {
|
|
27
|
+
column: SdTableColumnAnyRow;
|
|
28
|
+
badge: boolean;
|
|
29
|
+
} | {
|
|
30
|
+
data: SdBadgeData;
|
|
31
|
+
};
|
|
32
|
+
/** Card slots checked against the columns. */
|
|
33
|
+
export interface SdTableMobileView {
|
|
34
|
+
layout: 'card';
|
|
35
|
+
/** Missing: the card shows the row label (`mobile.rowLabel`, then `rowKey`, then the row number). */
|
|
36
|
+
title?: SdTableMobileTextSlot;
|
|
37
|
+
subtitle?: SdTableMobileTextSlot;
|
|
38
|
+
badge?: SdTableMobileBadgeSlot;
|
|
39
|
+
/** Grid cells in order. With `highlight` the first cell is the highlighted one. */
|
|
40
|
+
fields: SdTableColumnAnyRow[];
|
|
41
|
+
highlight: boolean;
|
|
42
|
+
maxFields: number;
|
|
43
|
+
}
|
|
44
|
+
export type SdTableMobileIssueKind = 'unknown-field' | 'badge-field' | 'layout';
|
|
45
|
+
export interface SdTableMobileIssue {
|
|
46
|
+
kind: SdTableMobileIssueKind;
|
|
47
|
+
/** The field or layout value that failed. */
|
|
48
|
+
value: string;
|
|
49
|
+
}
|
|
50
|
+
export interface SdTableMobileResolved {
|
|
51
|
+
view: SdTableMobileView;
|
|
52
|
+
issues: SdTableMobileIssue[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Checks the slots returned by `mobile.template.data` against the table columns (leaf columns, children of grouped
|
|
56
|
+
* headers included) and returns the card to draw. Pure: the caller warns about `issues`.
|
|
57
|
+
*
|
|
58
|
+
* - An unknown field drops its slot; a missing title falls back to the row label.
|
|
59
|
+
* - A badge field without `useBadge` shows as text.
|
|
60
|
+
* - An unknown `layout` (plain JavaScript) draws a card.
|
|
61
|
+
* - Hidden, invisible and settings-hidden columns still show: the consumer named them.
|
|
62
|
+
*/
|
|
63
|
+
export declare const resolveMobileView: (columns: readonly SdTableColumnAnyRow[], layout: unknown, data: Record<string, unknown>) => SdTableMobileResolved;
|
|
64
|
+
/**
|
|
65
|
+
* Card built from the columns on screen (`SD_TABLE_CONFIGURATION.mobile.autoTemplate`, or a row whose `data` threw).
|
|
66
|
+
* Title: the `rowKey` column, else the first column. Badge: the first other column with `useBadge`. Subtitle: the
|
|
67
|
+
* first other `string` column. Fields: the rest, in column order. Pass the columns on screen (`shownLeafColumns`):
|
|
68
|
+
* `invisible` there is the option's default, not the settings, so only `hidden` columns are left out here.
|
|
69
|
+
*/
|
|
70
|
+
export declare const autoMobileView: (columns: readonly SdTableColumnAnyRow[], rowKey?: string) => SdTableMobileView;
|
|
71
|
+
/**
|
|
72
|
+
* Leaf columns on screen in the order the settings give: `firstColumns` with each grouped header replaced by its
|
|
73
|
+
* visible children (`secondColumns`).
|
|
74
|
+
*/
|
|
75
|
+
export declare const shownLeafColumns: (firstColumns: readonly SdTableColumnAnyRow[] | undefined, secondColumns: readonly SdTableColumnAnyRow[] | undefined) => SdTableColumnAnyRow[];
|
|
76
|
+
/** `console.warn` once per owner (a table) and key, in dev mode only. */
|
|
77
|
+
export declare const warnMobileOnce: (owner: object, key: string, message: string, ...details: unknown[]) => void;
|
|
@@ -18,6 +18,8 @@ export interface SdTableExportContext<T = any> {
|
|
|
18
18
|
export declare class TableExportService {
|
|
19
19
|
#private;
|
|
20
20
|
exporting: import("@angular/core").WritableSignal<boolean>;
|
|
21
|
+
/** Progress of a paged export in percent; `null` while unknown. */
|
|
22
|
+
readonly exportPercent: import("@angular/core").Signal<number | null>;
|
|
21
23
|
exportTitle: import("@angular/core").Signal<string>;
|
|
22
24
|
/** Đặt tiến độ export (0-100), hoặc null để trả nút về nhãn mặc định. */
|
|
23
25
|
setExportProgress: (percent: number | null) => void;
|
|
@@ -13,6 +13,8 @@ export interface SdTableQuickFilter {
|
|
|
13
13
|
}
|
|
14
14
|
export interface TableFilterConfiguration {
|
|
15
15
|
inlineExternal: Record<string, boolean>;
|
|
16
|
+
/** Giao diện lọc người dùng chọn trong modal Thiết lập; thắng `filter.mode` khi `filter.modeSelectable` khác `false`. */
|
|
17
|
+
mode?: SdTableOptionFilter['mode'];
|
|
16
18
|
}
|
|
17
19
|
export interface TableFilterValue {
|
|
18
20
|
quickSearch?: SdTableQuickSearchValue;
|
|
@@ -71,14 +73,22 @@ export interface SdTableOptionFilter<T = unknown> {
|
|
|
71
73
|
* @defaultValue 'default'
|
|
72
74
|
*/
|
|
73
75
|
mode?: 'default' | 'query-bar';
|
|
76
|
+
/**
|
|
77
|
+
* Cho người dùng chọn giao diện lọc trong modal Thiết lập. Lựa chọn được lưu cùng thiết lập bộ lọc (theo `filter.key`)
|
|
78
|
+
* và thắng `mode`; **Khôi phục mặc định** xoá nó. `false`: luôn dùng `mode` và bỏ qua lựa chọn đã lưu.
|
|
79
|
+
* `SD_TABLE_CONFIGURATION.filter.modeSelectable` đặt cho mọi bảng; option thắng.
|
|
80
|
+
* @defaultValue true
|
|
81
|
+
*/
|
|
82
|
+
modeSelectable?: boolean;
|
|
74
83
|
/** Chỉ dùng khi `mode` là `'query-bar'`. */
|
|
75
84
|
queryBar?: SdTableOptionFilterQueryBar;
|
|
76
85
|
}
|
|
77
86
|
/** Tuỳ chọn của `filter.mode: 'query-bar'`. */
|
|
78
87
|
export interface SdTableOptionFilterQueryBar {
|
|
79
88
|
/**
|
|
80
|
-
* Cách sửa chip:
|
|
81
|
-
*
|
|
89
|
+
* Cách sửa chip: control ngay trên thanh (`sd-query-bar` mode `'inline'`) hoặc popover. `sd-query-bar` đứng riêng
|
|
90
|
+
* vẫn mặc định `'popover'`.
|
|
91
|
+
* @defaultValue 'inline'
|
|
82
92
|
*/
|
|
83
93
|
editor?: 'popover' | 'inline';
|
|
84
94
|
/**
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { SdQueryField } from '@sdcorejs/angular/components/query-bar';
|
|
2
|
+
import type { Filter } from '@sdcorejs/utils/models';
|
|
3
|
+
import type { SdTableFilterDefDirective } from '../../directives/sd-table-filter-def.directive';
|
|
4
|
+
import type { SdTableColumnAnyRow } from '../../models/table-column.model';
|
|
5
|
+
import type { SdTableExternalFilter, TableFilterValue } from './table-filter.model';
|
|
6
|
+
import { type SdTableQueryContext, type SdTableQuerySource } from './table-query-bar.util';
|
|
7
|
+
/**
|
|
8
|
+
* One filter of the phone UI (chip row and filter sheet).
|
|
9
|
+
* - `source` + `field`: a filter the query-bar model can read — it gets a chip, a summary and the built-in controls.
|
|
10
|
+
* - `custom`: a filter only its own control can edit (a template, a time column, an external filter the bar leaves
|
|
11
|
+
* out). It has a row in the filter sheet that opens that control, but no chip and no summary.
|
|
12
|
+
*/
|
|
13
|
+
export interface SdTableMobileFilterItem {
|
|
14
|
+
/** `external:<field>` / `column:<field>` as on the query bar, `custom-*:<field>` otherwise. */
|
|
15
|
+
key: string;
|
|
16
|
+
label: string;
|
|
17
|
+
source?: SdTableQuerySource;
|
|
18
|
+
field?: SdQueryField;
|
|
19
|
+
custom?: {
|
|
20
|
+
kind: 'column';
|
|
21
|
+
column: SdTableColumnAnyRow;
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'external';
|
|
24
|
+
external: SdTableExternalFilter;
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'def';
|
|
27
|
+
def: SdTableFilterDefDirective;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Filters in the fixed phone order: external filters, then `sdTableFilterDef` templates, then columns (handoff 3, 5).
|
|
32
|
+
* `ctx` comes from `sdTableQueryFields` over the same columns and external filters.
|
|
33
|
+
*/
|
|
34
|
+
export declare const sdTableMobileFilterItems: (args: {
|
|
35
|
+
ctx: SdTableQueryContext;
|
|
36
|
+
columns: readonly SdTableColumnAnyRow[];
|
|
37
|
+
externalFilters?: readonly SdTableExternalFilter[];
|
|
38
|
+
filterDefs?: readonly SdTableFilterDefDirective[];
|
|
39
|
+
}) => SdTableMobileFilterItem[];
|
|
40
|
+
/** The chip of an item for a raw record, or `undefined` for a custom item. */
|
|
41
|
+
export declare const sdTableMobileFilterChip: (item: SdTableMobileFilterItem, value: TableFilterValue) => {
|
|
42
|
+
filter: Filter;
|
|
43
|
+
active: boolean;
|
|
44
|
+
} | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Whether an item filters something. A custom column counts when its raw value has content; templates write keys
|
|
47
|
+
* the table cannot know, so they never count.
|
|
48
|
+
*/
|
|
49
|
+
export declare const sdTableMobileFilterActive: (item: SdTableMobileFilterItem, value: TableFilterValue) => boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The raw record with one item cleared: no value, and a `NULL` / `NOT_NULL` column operator back to the default.
|
|
52
|
+
* Custom template items are left alone (their keys are unknown).
|
|
53
|
+
*/
|
|
54
|
+
export declare const sdTableMobileFilterClear: (item: SdTableMobileFilterItem, value: TableFilterValue, ctx: SdTableQueryContext) => TableFilterValue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SdQuery, type SdQueryField } from '@sdcorejs/angular/components/query-bar';
|
|
2
2
|
import { Filter, Operator } from '@sdcorejs/utils/models';
|
|
3
3
|
import { SdTableColumnAnyRow } from '../../models/table-column.model';
|
|
4
4
|
import type { SdTableExternalFilter, SdTableOptionFilterQueryBar, TableFilterValue } from './table-filter.model';
|
|
@@ -61,6 +61,21 @@ export interface SdTableQueryChange {
|
|
|
61
61
|
/** New column operator, when it changed. */
|
|
62
62
|
operator?: Operator;
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* `aria-haspopup` of the header filter icon: what `SdQueryBar.openField` shows for `field` (same steps as `beginBuild`).
|
|
66
|
+
* The popover editor opens the chip menu. The inline editor only focuses an existing chip; for a field without a chip it
|
|
67
|
+
* builds one, which opens the operator menu, or the value picker of a values / date field (a date skips the operator
|
|
68
|
+
* step when its default operator is allowed).
|
|
69
|
+
*/
|
|
70
|
+
export declare const sdTableQueryTriggerPopup: (field: SdQueryField, editor: "popover" | "inline", hasChip: boolean) => "menu" | "listbox" | "dialog" | null;
|
|
71
|
+
/**
|
|
72
|
+
* Why the query bar cannot show an external filter, or `undefined` when it can. Also tells the settings modal which
|
|
73
|
+
* filters are "not on the bar".
|
|
74
|
+
*/
|
|
75
|
+
export declare const sdTableExternalOffBar: (item: SdTableExternalFilter, args: {
|
|
76
|
+
exclude: ReadonlySet<string>;
|
|
77
|
+
filterDefs: ReadonlySet<string>;
|
|
78
|
+
}) => string | undefined;
|
|
64
79
|
/**
|
|
65
80
|
* Fields of the query bar for a table (handoff section 3): keys, groups, pinned chips, operators, and the filters
|
|
66
81
|
* left out. Order: `quickSearch.filters`, `externalFilters`, then the leaf columns given (children flattened).
|
|
@@ -84,6 +99,11 @@ export declare const sdTableQueryFields: (args: {
|
|
|
84
99
|
/** Items the table loaded for `values` columns whose `items` is a function. */
|
|
85
100
|
cacheValues?: Record<string, unknown[]>;
|
|
86
101
|
}) => SdTableQueryFields;
|
|
102
|
+
/** The chip a field shows for a raw record (active or not): what the bar would draw, shared with the phone filters. */
|
|
103
|
+
export declare const sdTableQueryChipOf: (source: SdTableQuerySource, value: TableFilterValue) => {
|
|
104
|
+
filter: Filter;
|
|
105
|
+
active: boolean;
|
|
106
|
+
};
|
|
87
107
|
/**
|
|
88
108
|
* Raw record → bar query (handoff section 5). Chips: every pinned field, then unpinned fields that filter something,
|
|
89
109
|
* in the order of `prev` and then declaration order. A chip whose operator and data equal the one in `prev` is that
|
|
@@ -14,14 +14,16 @@ import { SdTableQuickSearchRightDefDirective } from './directives/sd-table-quick
|
|
|
14
14
|
import { SdTableQuickSearchValue } from './services/table-filter/table-quick-search.model';
|
|
15
15
|
import { SdQuery, SdQueryBar, SdQueryBarOption } from '@sdcorejs/angular/components/query-bar';
|
|
16
16
|
import { SdTableQueryContext } from './services/table-filter/table-query-bar.util';
|
|
17
|
+
import { type SdTableMobileFilterItem } from './services/table-filter/table-mobile-filter.util';
|
|
17
18
|
import { SdTableRowMobileDefDirective } from './directives/sd-table-row-mobile-def.directive';
|
|
18
19
|
import { SdTableMobileAction } from './components/mobile-cards/mobile-action.model';
|
|
20
|
+
import { type SdTableMobileBody } from './services/mobile/mobile-view.util';
|
|
19
21
|
import { SdTableColumn } from './models/table-column.model';
|
|
20
22
|
import { SdTableCommand } from './models/table-command.model';
|
|
21
23
|
import { SdTableOption } from './models/table-option.model';
|
|
22
24
|
import { SdTableUnknownTotalPageEvent, SdTableUnknownTotalPagerState } from './components/unknown-total-paginator/unknown-total-paginator.component';
|
|
23
25
|
import { SdTableLoadingView, TableSkeletonCell } from './services/table-loading/table-loading.util';
|
|
24
|
-
import { SdTableFilterRequest, TableFilterRegister, TableFilterValue } from './services/table-filter/table-filter.model';
|
|
26
|
+
import { SdTableFilterRequest, TableFilterConfiguration, TableFilterRegister, TableFilterValue } from './services/table-filter/table-filter.model';
|
|
25
27
|
import { CdkDrag, CdkDragDrop, CdkDropList } from '@angular/cdk/drag-drop';
|
|
26
28
|
import { SdDataStateTemplateDirective } from '@sdcorejs/angular/components/data-state';
|
|
27
29
|
import { SdReadState } from '@sdcorejs/angular/utilities/read-state';
|
|
@@ -31,7 +33,7 @@ import { AggregateRenderHost } from './pipes/sd-aggregate-rows.pipe';
|
|
|
31
33
|
import { AggregateSnapshot } from './services/table-aggregate.util';
|
|
32
34
|
import { Filter, Operator } from '@sdcorejs/utils/models';
|
|
33
35
|
import { ExternalFilterComponent, MobileFilterComponent } from './components';
|
|
34
|
-
import { ConfigComponent } from './components/config/config.component';
|
|
36
|
+
import { ConfigComponent, ConfigFilterSetup } from './components/config/config.component';
|
|
35
37
|
import { SdPopupExport } from './components/popup-export/popup-export.component';
|
|
36
38
|
import { ISdTableConfiguration } from './configurations';
|
|
37
39
|
import { SdTableItem } from './models/table-item.model';
|
|
@@ -79,10 +81,16 @@ export declare class SdTable<T = unknown> implements AfterViewInit, OnDestroy {
|
|
|
79
81
|
sdTitleDefs: import("@angular/core").Signal<readonly SdTableTitleDefDirective<any>[]>;
|
|
80
82
|
readonly sdRowMobileDef: import("@angular/core").Signal<SdTableRowMobileDefDirective<T> | undefined>;
|
|
81
83
|
readonly isMobile: import("@angular/core").Signal<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Body of the phone cards, by priority: `sdTableRowMobileDef`, then `mobile.template` (a template or `{ data }`),
|
|
86
|
+
* then `SD_TABLE_CONFIGURATION.mobile.autoTemplate`. `undefined`: phones show the desktop table.
|
|
87
|
+
*/
|
|
88
|
+
protected readonly mobileBody: import("@angular/core").Signal<SdTableMobileBody<T> | undefined>;
|
|
82
89
|
readonly mobileCards: import("@angular/core").Signal<boolean>;
|
|
83
90
|
/**
|
|
84
91
|
* The footer settings button carries a dot while the table uses a setup of its own: stored columns that differ from
|
|
85
|
-
* the option (settings modal or a resize on the table)
|
|
92
|
+
* the option (settings modal or a resize on the table), inline external filters that differ from `defaultShowing`, or
|
|
93
|
+
* a stored filter mode that differs from `filter.mode`.
|
|
86
94
|
*/
|
|
87
95
|
readonly hasCustomSetup: import("@angular/core").Signal<boolean>;
|
|
88
96
|
cellDef: import("@angular/core").Signal<Record<string, SdTableCellDefDirective<any>>>;
|
|
@@ -150,11 +158,24 @@ export declare class SdTable<T = unknown> implements AfterViewInit, OnDestroy {
|
|
|
150
158
|
active: string;
|
|
151
159
|
direction: SortDirection;
|
|
152
160
|
}>;
|
|
161
|
+
/**
|
|
162
|
+
* Columns of the phone sort sheet: sortable leaf columns of the option in their order, `invisible` and
|
|
163
|
+
* settings-hidden ones included, `hidden: true` ones left out (handoff table-mobile 6), with the settings title when
|
|
164
|
+
* the column is on screen.
|
|
165
|
+
*/
|
|
153
166
|
readonly mobileSortColumns: import("@angular/core").Signal<{
|
|
154
167
|
field: string;
|
|
155
168
|
title: string;
|
|
156
169
|
direction: SortDirection;
|
|
157
170
|
}[]>;
|
|
171
|
+
/** The phone shows a sort chip / button: `sort.enable` and at least one sortable column. */
|
|
172
|
+
protected readonly mobileSortAvailable: import("@angular/core").Signal<boolean>;
|
|
173
|
+
/** Accessible name of the phone sort chip / button: "Sort", or the column and direction while sorted. */
|
|
174
|
+
protected readonly mobileSortLabel: import("@angular/core").Signal<string>;
|
|
175
|
+
/**
|
|
176
|
+
* Tools sheet of the phone (⋮): export and settings. Filter, sort and reload live in the chip row, the sort sheet and
|
|
177
|
+
* pull to refresh. The exports are laid out flat (two at most).
|
|
178
|
+
*/
|
|
158
179
|
readonly mobileToolsActions: import("@angular/core").Signal<SdTableMobileAction[]>;
|
|
159
180
|
readonly pageRevision: import("@angular/core").WritableSignal<number>;
|
|
160
181
|
readonly dataRevision: import("@angular/core").WritableSignal<number>;
|
|
@@ -184,7 +205,17 @@ export declare class SdTable<T = unknown> implements AfterViewInit, OnDestroy {
|
|
|
184
205
|
readonly quickSearchValue: import("@angular/core").WritableSignal<SdTableQuickSearchValue>;
|
|
185
206
|
private readonly quickSearchControl;
|
|
186
207
|
readonly quickSearchValid: import("@angular/core").Signal<boolean>;
|
|
187
|
-
/**
|
|
208
|
+
/**
|
|
209
|
+
* Tab "Bộ lọc" của modal Thiết lập: kiểu lọc và external filter hiện ở khung / ghim trên thanh. Không có tab khi
|
|
210
|
+
* `filter.disabled`, trên mobile (luôn dùng giao diện mặc định), khi bảng không có bộ lọc nào, hoặc khi không chọn
|
|
211
|
+
* được kiểu lọc mà cũng không có external filter. `barBlockedBy`: external filter bắt buộc mà thanh không hiển thị
|
|
212
|
+
* được — thanh sẽ chặn đọc dữ liệu mà người dùng không có chỗ nhập, nên modal không cho chọn thanh.
|
|
213
|
+
*/
|
|
214
|
+
protected readonly configFilter: import("@angular/core").Signal<ConfigFilterSetup | undefined>;
|
|
215
|
+
/**
|
|
216
|
+
* Giao diện lọc đã chọn: lựa chọn đã lưu của người dùng (trừ khi `filter.modeSelectable` là `false`), rồi
|
|
217
|
+
* `filter.mode` sau khi gộp `SD_TABLE_CONFIGURATION.filter.mode`.
|
|
218
|
+
*/
|
|
188
219
|
readonly filterMode: import("@angular/core").Signal<"default" | "query-bar">;
|
|
189
220
|
/** Giao diện lọc đang hiển thị: mobile luôn dùng giao diện mặc định; giá trị lọc không đổi khi đổi viewport. */
|
|
190
221
|
readonly effectiveFilterMode: import("@angular/core").Signal<"default" | "query-bar">;
|
|
@@ -197,9 +228,20 @@ export declare class SdTable<T = unknown> implements AfterViewInit, OnDestroy {
|
|
|
197
228
|
readonly queryBarHintId: string;
|
|
198
229
|
/** Field của thanh và bảng tra nguồn; `undefined` khi không ở mode query-bar. */
|
|
199
230
|
readonly queryBarModel: import("@angular/core").Signal<SdTableQueryContext | undefined>;
|
|
231
|
+
/**
|
|
232
|
+
* Filters of the phone UI (chip row and filter sheets), in the fixed order external → `sdTableFilterDef` → columns.
|
|
233
|
+
* `undefined` on desktop, with `filter.disabled`, or before the configuration is known.
|
|
234
|
+
*/
|
|
235
|
+
protected readonly mobileFilterModel: import("@angular/core").Signal<{
|
|
236
|
+
ctx: SdTableQueryContext;
|
|
237
|
+
items: SdTableMobileFilterItem[];
|
|
238
|
+
} | undefined>;
|
|
239
|
+
/** Applied filter value (last emission of the filter register); the phone chips summarise it. */
|
|
240
|
+
protected readonly mobileFilterValue: import("@angular/core").Signal<TableFilterValue | undefined>;
|
|
200
241
|
readonly queryBarOption: import("@angular/core").Signal<SdQueryBarOption<unknown> | undefined>;
|
|
201
242
|
/** Khoá thanh của các field đang lọc theo giá trị đã áp dụng — icon lọc ở header của chúng luôn hiện. */
|
|
202
243
|
readonly queryBarActiveKeys: import("@angular/core").Signal<Set<string>>;
|
|
244
|
+
queryBarTriggerPopup: (key: string) => "menu" | "listbox" | "dialog" | null;
|
|
203
245
|
/** `aria-label` của icon lọc ở header: "Lọc theo …" / "Đang lọc theo …". */
|
|
204
246
|
filterTriggerLabel(column: SdTableColumn, active: boolean): string;
|
|
205
247
|
/** Icon lọc ở header: mở chip của field trên thanh (tạo chip nếu chưa có); đóng popover thì focus về icon. */
|
|
@@ -215,7 +257,11 @@ export declare class SdTable<T = unknown> implements AfterViewInit, OnDestroy {
|
|
|
215
257
|
exporting: import("@angular/core").WritableSignal<boolean>;
|
|
216
258
|
exportTitle: import("@angular/core").Signal<string>;
|
|
217
259
|
tableConfiguration: ISdTableConfiguration | null;
|
|
218
|
-
/**
|
|
260
|
+
/**
|
|
261
|
+
* Bảng chính của khung trang (sd-page-list): lấp phần chiều cao còn lại, giữ tối thiểu header + 5 dòng. Không áp
|
|
262
|
+
* dụng khi điện thoại hiện thẻ: thẻ nằm theo trang và vùng cuộn của trang cuộn một lần, thay vì cuộn trong một hộp
|
|
263
|
+
* thấp giữa header và paginator (và cuộn lồng với trang khi màn thấp).
|
|
264
|
+
*/
|
|
219
265
|
readonly fill: import("@angular/core").Signal<boolean>;
|
|
220
266
|
/** External filter của bảng chính thu gọn khi khung trang đang ở chế độ màn thấp. */
|
|
221
267
|
readonly externalFilterCollapsedByDefault: import("@angular/core").Signal<boolean>;
|
|
@@ -301,8 +347,13 @@ export declare class SdTable<T = unknown> implements AfterViewInit, OnDestroy {
|
|
|
301
347
|
get dataItems(): T[];
|
|
302
348
|
get selectedItems(): T[];
|
|
303
349
|
detectChanges: () => void;
|
|
304
|
-
/**
|
|
350
|
+
/**
|
|
351
|
+
* Restore defaults in the settings modal also puts the inline external filters back to `defaultShowing` and clears the
|
|
352
|
+
* stored filter mode.
|
|
353
|
+
*/
|
|
305
354
|
onConfigDefaultsRestored: () => void;
|
|
355
|
+
/** Apply in the settings modal with a changed "Bộ lọc" tab: store the filter kind and the inline external filters. */
|
|
356
|
+
onConfigFilterApplied: (configuration: Partial<TableFilterConfiguration>) => void;
|
|
306
357
|
onColumnResize: (field: string, width: string) => void;
|
|
307
358
|
getSortAria: (field: string) => "none" | "ascending" | "descending";
|
|
308
359
|
onOperatorChange: (column: SdTableColumn, operator: Operator | undefined) => void;
|