@sdcorejs/angular 22.2.12 → 22.2.14
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/assets/STYLE-GUIDE.md +138 -10
- package/assets/scss/core/form.scss +18 -2
- package/assets/scss/core/utilities/_base.scss +3 -3
- package/assets/scss/themes/_presets.scss +52 -0
- package/assets/scss/themes/default.scss +39 -11
- package/assets/scss/themes/material-theme.scss +2 -2
- package/fesm2022/sdcorejs-angular-components-button.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs +9 -5
- package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +10 -4
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab.mjs +56 -3
- package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +509 -78
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-icon.mjs +1 -0
- package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +2 -2
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/package.json +1 -1
- package/types/sdcorejs-angular-components-inform.d.ts +6 -2
- package/types/sdcorejs-angular-components-tab.d.ts +8 -2
- package/types/sdcorejs-angular-components-table.d.ts +220 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdcorejs/angular",
|
|
3
|
-
"version": "22.2.
|
|
3
|
+
"version": "22.2.14",
|
|
4
4
|
"description": "Angular component library: data table, query bar/builder, 20+ signal-based form controls, layout, auth and workflow services. Standalone, OnPush, signals-first. Published in parallel lines for Angular 19, 20, 21 and 22.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -12,8 +12,11 @@ declare class SdInformActionDirective {
|
|
|
12
12
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SdInformActionDirective, "[sdInformAction]", never, {}, {}, never, never, true, never>;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
type SdInformType = 'default' | 'tip';
|
|
15
16
|
declare class SdInform {
|
|
16
17
|
#private;
|
|
18
|
+
/** Compact non-live guidance; omitted type preserves the standard banner. */
|
|
19
|
+
type: _angular_core.InputSignalWithTransform<SdInformType, SdInformType | null | undefined>;
|
|
17
20
|
color: _angular_core.InputSignalWithTransform<Color, Color | null | undefined>;
|
|
18
21
|
primary: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
19
22
|
secondary: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
@@ -50,7 +53,7 @@ declare class SdInform {
|
|
|
50
53
|
hasActionSlot: _angular_core.Signal<boolean>;
|
|
51
54
|
clampLines: _angular_core.Signal<number | null>;
|
|
52
55
|
showToggle: _angular_core.Signal<boolean>;
|
|
53
|
-
liveRole: _angular_core.Signal<"alert" | "status">;
|
|
56
|
+
liveRole: _angular_core.Signal<"alert" | "status" | "note">;
|
|
54
57
|
constructor();
|
|
55
58
|
/** Đo tràn dòng của body; chỉ có ý nghĩa khi đang clamp. */
|
|
56
59
|
measureOverflow(): void;
|
|
@@ -58,7 +61,8 @@ declare class SdInform {
|
|
|
58
61
|
onClose(event: Event): void;
|
|
59
62
|
onAction(event: Event): void;
|
|
60
63
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdInform, never>;
|
|
61
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdInform, "sd-inform", never, { "color": { "alias": "color"; "required": false; "isSignal": true; }; "primary": { "alias": "primary"; "required": false; "isSignal": true; }; "secondary": { "alias": "secondary"; "required": false; "isSignal": true; }; "info": { "alias": "info"; "required": false; "isSignal": true; }; "success": { "alias": "success"; "required": false; "isSignal": true; }; "warning": { "alias": "warning"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "hideIcon": { "alias": "hideIcon"; "required": false; "isSignal": true; }; "fontSet": { "alias": "fontSet"; "required": false; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; "isSignal": true; }; "actionLabel": { "alias": "actionLabel"; "required": false; "isSignal": true; }; "lineClamp": { "alias": "lineClamp"; "required": false; "isSignal": true; }; "autoId": { "alias": "autoId"; "required": false; "isSignal": true; }; }, { "sdClosed": "sdClosed"; "sdAction": "sdAction"; }, ["actionSlot"], ["[sdInformAction]"], true, never>;
|
|
64
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdInform, "sd-inform", never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "primary": { "alias": "primary"; "required": false; "isSignal": true; }; "secondary": { "alias": "secondary"; "required": false; "isSignal": true; }; "info": { "alias": "info"; "required": false; "isSignal": true; }; "success": { "alias": "success"; "required": false; "isSignal": true; }; "warning": { "alias": "warning"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "hideIcon": { "alias": "hideIcon"; "required": false; "isSignal": true; }; "fontSet": { "alias": "fontSet"; "required": false; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; "isSignal": true; }; "actionLabel": { "alias": "actionLabel"; "required": false; "isSignal": true; }; "lineClamp": { "alias": "lineClamp"; "required": false; "isSignal": true; }; "autoId": { "alias": "autoId"; "required": false; "isSignal": true; }; }, { "sdClosed": "sdClosed"; "sdAction": "sdAction"; }, ["actionSlot"], ["[sdInformAction]", "*"], true, never>;
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
export { SdInform, SdInformActionDirective };
|
|
68
|
+
export type { SdInformType };
|
|
@@ -25,6 +25,7 @@ interface SdTabClosedEvent {
|
|
|
25
25
|
index: number;
|
|
26
26
|
tab: SdTab;
|
|
27
27
|
}
|
|
28
|
+
type SdTabRegionStyle = Readonly<Record<string, string | number | null | undefined>>;
|
|
28
29
|
declare class SdTabGroup {
|
|
29
30
|
#private;
|
|
30
31
|
tabs: _angular_core.Signal<readonly SdTab[]>;
|
|
@@ -32,6 +33,10 @@ declare class SdTabGroup {
|
|
|
32
33
|
variant: _angular_core.InputSignal<"line" | "pills" | "segmented">;
|
|
33
34
|
color: _angular_core.InputSignal<Color>;
|
|
34
35
|
headerPosition: _angular_core.InputSignal<"above" | "below">;
|
|
36
|
+
headerClass: _angular_core.InputSignal<string | null | undefined>;
|
|
37
|
+
headerStyle: _angular_core.InputSignal<Readonly<Record<string, string | number | null | undefined>> | null | undefined>;
|
|
38
|
+
bodyClass: _angular_core.InputSignal<string | null | undefined>;
|
|
39
|
+
bodyStyle: _angular_core.InputSignal<Readonly<Record<string, string | number | null | undefined>> | null | undefined>;
|
|
35
40
|
alignTabs: _angular_core.InputSignal<"start" | "center" | "end">;
|
|
36
41
|
stretchTabs: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
37
42
|
animationDuration: _angular_core.InputSignal<string>;
|
|
@@ -40,6 +45,7 @@ declare class SdTabGroup {
|
|
|
40
45
|
autoId: _angular_core.InputSignal<string | undefined>;
|
|
41
46
|
tabClosed: _angular_core.OutputEmitterRef<SdTabClosedEvent>;
|
|
42
47
|
protected matTabGroup: _angular_core.Signal<MatTabGroup | undefined>;
|
|
48
|
+
private readonly matTabElement;
|
|
43
49
|
get autoIdAttr(): string | null;
|
|
44
50
|
get isPills(): boolean;
|
|
45
51
|
get isSegmented(): boolean;
|
|
@@ -52,8 +58,8 @@ declare class SdTabGroup {
|
|
|
52
58
|
realignInkBar(): void;
|
|
53
59
|
protected onClose(tab: SdTab, index: number, event: MouseEvent): void;
|
|
54
60
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdTabGroup, never>;
|
|
55
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdTabGroup, "sd-tab-group", never, { "selectedIndex": { "alias": "selectedIndex"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "headerPosition": { "alias": "headerPosition"; "required": false; "isSignal": true; }; "alignTabs": { "alias": "alignTabs"; "required": false; "isSignal": true; }; "stretchTabs": { "alias": "stretchTabs"; "required": false; "isSignal": true; }; "animationDuration": { "alias": "animationDuration"; "required": false; "isSignal": true; }; "disableRipple": { "alias": "disableRipple"; "required": false; "isSignal": true; }; "dynamicHeight": { "alias": "dynamicHeight"; "required": false; "isSignal": true; }; "autoId": { "alias": "autoId"; "required": false; "isSignal": true; }; }, { "selectedIndex": "selectedIndexChange"; "tabClosed": "tabClosed"; }, ["tabs"], never, true, never>;
|
|
61
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdTabGroup, "sd-tab-group", never, { "selectedIndex": { "alias": "selectedIndex"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "headerPosition": { "alias": "headerPosition"; "required": false; "isSignal": true; }; "headerClass": { "alias": "headerClass"; "required": false; "isSignal": true; }; "headerStyle": { "alias": "headerStyle"; "required": false; "isSignal": true; }; "bodyClass": { "alias": "bodyClass"; "required": false; "isSignal": true; }; "bodyStyle": { "alias": "bodyStyle"; "required": false; "isSignal": true; }; "alignTabs": { "alias": "alignTabs"; "required": false; "isSignal": true; }; "stretchTabs": { "alias": "stretchTabs"; "required": false; "isSignal": true; }; "animationDuration": { "alias": "animationDuration"; "required": false; "isSignal": true; }; "disableRipple": { "alias": "disableRipple"; "required": false; "isSignal": true; }; "dynamicHeight": { "alias": "dynamicHeight"; "required": false; "isSignal": true; }; "autoId": { "alias": "autoId"; "required": false; "isSignal": true; }; }, { "selectedIndex": "selectedIndexChange"; "tabClosed": "tabClosed"; }, ["tabs"], never, true, never>;
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
export { SdTab, SdTabGroup };
|
|
59
|
-
export type { SdTabBeforeClose, SdTabClosedEvent };
|
|
65
|
+
export type { SdTabBeforeClose, SdTabClosedEvent, SdTabRegionStyle };
|
|
@@ -22,7 +22,148 @@ import { SdSideDrawer } from '@sdcorejs/angular/components/side-drawer';
|
|
|
22
22
|
import { SdModal } from '@sdcorejs/angular/components/modal';
|
|
23
23
|
import { MatSelectionList } from '@angular/material/list';
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
/** Numeric columns support every operation; date/datetime support COUNT/MIN/MAX; other data columns support COUNT. */
|
|
26
|
+
type SdTableAggregateOperation = 'SUM' | 'AVERAGE' | 'COUNT' | 'MIN' | 'MAX';
|
|
27
|
+
/** Synchronous aggregate output. Strings render as text; HTML requires a template. Missing results render the table placeholder. */
|
|
28
|
+
type SdTableAggregateResult = string | number | boolean | Date | null | undefined;
|
|
29
|
+
/** Metadata for the existing combined-field row group, never a synthetic data item. */
|
|
30
|
+
interface SdTableAggregateGroup {
|
|
31
|
+
/** Stable key used by the table's group collapse state. */
|
|
32
|
+
readonly key: string;
|
|
33
|
+
/** Raw values of the fields that identify this group. */
|
|
34
|
+
readonly values: Readonly<Record<string, unknown>>;
|
|
35
|
+
}
|
|
36
|
+
/** Calculation metadata shared by callbacks and templates. Completeness is relative to the requested scope, not the database. */
|
|
37
|
+
interface SdTableAggregateContext<T = unknown> {
|
|
38
|
+
/** Leaf data column whose raw field is aggregated; functional and parent header columns are excluded. */
|
|
39
|
+
readonly column: SdTableColumnNormal<T>;
|
|
40
|
+
/** Grand total, row-group subtotal, or descendants of a tree parent. */
|
|
41
|
+
readonly kind: 'total' | 'group' | 'tree';
|
|
42
|
+
/** Requested page or locally filtered dataset; never silently changed for server tables. */
|
|
43
|
+
readonly scope: 'page' | 'filtered';
|
|
44
|
+
/** Combined-field group metadata, present only for group subtotals. */
|
|
45
|
+
readonly group?: SdTableAggregateGroup;
|
|
46
|
+
/** Original parent data item, present only for tree subtotals; it is excluded from subtotal items. */
|
|
47
|
+
readonly parent?: T;
|
|
48
|
+
/** False during loading/error, unsupported server filtered scope, or when required lazy children are missing. A loaded server page can be complete. */
|
|
49
|
+
readonly isComplete: boolean;
|
|
50
|
+
}
|
|
51
|
+
/** Context for `TemplateRef`, including raw items and the optional calculated result. */
|
|
52
|
+
interface SdTableAggregateTemplateContext<T = unknown, R = SdTableAggregateResult> extends SdTableAggregateContext<T> {
|
|
53
|
+
/** Implicit raw item array, identical to `items`; excludes group headers and summary rows. */
|
|
54
|
+
readonly $implicit: readonly T[];
|
|
55
|
+
/** Raw data in the requested scope. May be partial when `isComplete` is false. Never mutate it or its items. */
|
|
56
|
+
readonly items: readonly T[];
|
|
57
|
+
/** Calculation result; undefined for template-only configurations or incomplete built-ins. */
|
|
58
|
+
readonly value: R | undefined;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Pure synchronous calculation on original consumer data. Do not mutate items or call APIs.
|
|
62
|
+
* @param items Raw rows in scope, including available partial rows when context.isComplete is false.
|
|
63
|
+
* @param context Scope, column, group/tree metadata and completeness.
|
|
64
|
+
* @returns A synchronous display value. Promise/Observable results are unsupported. Strings are escaped.
|
|
65
|
+
* @example `aggregate: items => items.length` counts rows, unlike COUNT which counts nonempty field values.
|
|
66
|
+
*/
|
|
67
|
+
type SdTableAggregateCallback<T = unknown, R extends SdTableAggregateResult = SdTableAggregateResult> = (items: readonly T[], context: SdTableAggregateContext<T>) => R;
|
|
68
|
+
/** Shared options; use SdTableColumnAggregate to require a calculation or template. */
|
|
69
|
+
interface SdTableAggregateDefinition<T = unknown, O extends SdTableAggregateOperation = SdTableAggregateOperation> {
|
|
70
|
+
/**
|
|
71
|
+
* Built-in or pure synchronous callback. Templates receive its result without replacing the calculation.
|
|
72
|
+
* @defaultValue undefined (template-only value is undefined)
|
|
73
|
+
* @remarks COUNT excludes null/undefined, blank strings, empty arrays, nonfinite numbers and invalid Dates;
|
|
74
|
+
* it counts 0, false, {}, and [null], once per row. SUM/AVERAGE/MIN/MAX number use valid numeric values;
|
|
75
|
+
* AVERAGE divides by their number, not COUNT. Successful empty SUM/COUNT = 0; other empty built-ins = null.
|
|
76
|
+
* Numeric strings accepted by the existing number formatter are supported; booleans, blank strings,
|
|
77
|
+
* nonfinite values and locale currency strings are excluded. Date MIN/MAX use Date, native-parsable
|
|
78
|
+
* date strings (including timezone offsets) or epoch milliseconds, matching local sorting.
|
|
79
|
+
* Results use table number/date formatters; COUNT uses integer formatting. Missing values display `--`.
|
|
80
|
+
* Incomplete built-ins return undefined; callbacks inspect isComplete and may describe partial data.
|
|
81
|
+
* @example `{ calculate: 'SUM' }`
|
|
82
|
+
*/
|
|
83
|
+
calculate?: O | SdTableAggregateCallback<T>;
|
|
84
|
+
/**
|
|
85
|
+
* Custom aggregate HTML. Overrides rendering, not calculation; template-only value is undefined.
|
|
86
|
+
* @defaultValue undefined (safe text rendered with the table formatters)
|
|
87
|
+
* @remarks Read the query only after the template exists. The example uses a static query and initializes
|
|
88
|
+
* table options in ngOnInit, avoiding an undefined TemplateRef in the column definition.
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
|
|
92
|
+
* import { DecimalPipe } from '@angular/common';
|
|
93
|
+
* import { SdTable, SdTableOption, SdTableAggregateTemplateContext } from '@sdcorejs/angular/components/table';
|
|
94
|
+
* interface Order { amount: number; }
|
|
95
|
+
* @Component({
|
|
96
|
+
* selector: 'app-order-summary',
|
|
97
|
+
* imports: [SdTable, DecimalPipe],
|
|
98
|
+
* template: `
|
|
99
|
+
* <ng-template #summary let-items let-value="value" let-kind="kind" let-isComplete="isComplete">
|
|
100
|
+
* @if (isComplete) {
|
|
101
|
+
* <strong>{{ value | number:'1.0-2' }}</strong>
|
|
102
|
+
* <small>{{ kind }} · {{ items.length }} bản ghi</small>
|
|
103
|
+
* } @else { <span>Chưa đủ dữ liệu</span> }
|
|
104
|
+
* </ng-template>
|
|
105
|
+
* @if (option) { <sd-table [option]="option" /> }
|
|
106
|
+
* `,
|
|
107
|
+
* })
|
|
108
|
+
* export class OrderSummary implements OnInit {
|
|
109
|
+
* @ViewChild('summary', { static: true }) summary!: TemplateRef<SdTableAggregateTemplateContext<Order>>;
|
|
110
|
+
* option?: SdTableOption<Order>;
|
|
111
|
+
* ngOnInit(): void {
|
|
112
|
+
* this.option = {
|
|
113
|
+
* type: 'local', items: () => [{ amount: 40 }, { amount: 60 }],
|
|
114
|
+
* columns: [{ field: 'amount', title: 'Amount', type: 'number',
|
|
115
|
+
* aggregate: { calculate: 'SUM', templateRef: this.summary } }],
|
|
116
|
+
* };
|
|
117
|
+
* }
|
|
118
|
+
* }
|
|
119
|
+
* ```
|
|
120
|
+
* Remove calculate for a template-only summary; then use items/context because value is undefined.
|
|
121
|
+
*/
|
|
122
|
+
templateRef?: TemplateRef<SdTableAggregateTemplateContext<T>>;
|
|
123
|
+
}
|
|
124
|
+
/** Column shorthand or nonempty object. Number/date operation restrictions are supplied by the column discriminant. */
|
|
125
|
+
type SdTableColumnAggregate<T = unknown, O extends SdTableAggregateOperation = SdTableAggregateOperation> = O | SdTableAggregateCallback<T> | (SdTableAggregateDefinition<T, O> & (Required<Pick<SdTableAggregateDefinition<T, O>, 'templateRef'>> | (Required<Pick<SdTableAggregateDefinition<T, O>, 'calculate'>> & {
|
|
126
|
+
templateRef?: never;
|
|
127
|
+
})));
|
|
128
|
+
/** Selects data scope and optional subtotals; any visible aggregate column automatically enables the total row. */
|
|
129
|
+
interface SdTableOptionAggregate {
|
|
130
|
+
/**
|
|
131
|
+
* page = current page after filtering; filtered = all locally filtered rows before pagination.
|
|
132
|
+
* @defaultValue 'page'
|
|
133
|
+
* @remarks Server filtered scope is unsupported: diagnostic + incomplete value, never a page fallback or an API request.
|
|
134
|
+
* @example For 50 matching local records with pageSize 10, page counts up to 10 values; filtered counts up to 50.
|
|
135
|
+
*/
|
|
136
|
+
scope?: 'page' | 'filtered';
|
|
137
|
+
/**
|
|
138
|
+
* Show a subtotal after each expanded row group. Collapse never changes the grand total.
|
|
139
|
+
* @defaultValue false
|
|
140
|
+
* @example `{ scope: 'page', group: true }` summarizes only each group's rows on this page.
|
|
141
|
+
*/
|
|
142
|
+
group?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Tree aggregation policy; does not enable option.tree. Ignored on non-tree tables.
|
|
145
|
+
* @defaultValue undefined (tree tables aggregate known leaves without branch subtotals)
|
|
146
|
+
* @example `{ tree: { items: 'roots' } }` totals root rows without requiring lazy descendants.
|
|
147
|
+
*/
|
|
148
|
+
tree?: {
|
|
149
|
+
/**
|
|
150
|
+
* roots = scope roots (subtotal: direct children); leaves = known descendant leaves;
|
|
151
|
+
* all = every node (subtotal: all descendants). The parent is excluded from its subtotal.
|
|
152
|
+
* @defaultValue 'leaves'
|
|
153
|
+
* @example Parent 100 with children 40 and 60 gives total roots=100, leaves=100, all=200.
|
|
154
|
+
* @remarks Missing lazy children make leaves/all incomplete; roots can remain complete. Never fetch children for aggregation.
|
|
155
|
+
*/
|
|
156
|
+
items?: 'roots' | 'leaves' | 'all';
|
|
157
|
+
/**
|
|
158
|
+
* Render a subtotal at the end of each expanded branch, using the selected items policy.
|
|
159
|
+
* @defaultValue false
|
|
160
|
+
* @example `{ tree: { items: 'leaves', subtotal: true } }` summarizes descendants without double-counting parents.
|
|
161
|
+
*/
|
|
162
|
+
subtotal?: boolean;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
type SdTableColumn<T = unknown> = SdTableColumnText<T> | SdTableColumnNumber<T> | SdTableColumnBool<T> | SdTableColumnDate<T> | SdTableColumnTime<T> | SdTableColumnValues<T> | SdTableColumnLazyValues<T> | SdTableColumnChildren<T>;
|
|
26
167
|
/**
|
|
27
168
|
* Cột bảng dùng ở các API **không quan tâm kiểu hàng** — chúng chỉ đọc `field` / `type` / `hidden` /
|
|
28
169
|
* `filter` và không bao giờ chạm vào dữ liệu hàng (service filter, `SdConvertToPagingReq`, …).
|
|
@@ -63,7 +204,20 @@ interface ColumnCellOption {
|
|
|
63
204
|
type?: 'more' | 'tooltip';
|
|
64
205
|
};
|
|
65
206
|
}
|
|
66
|
-
interface SdTableColumnBase<T = unknown> {
|
|
207
|
+
interface SdTableColumnBase<T = unknown, O extends SdTableAggregateOperation = 'COUNT'> {
|
|
208
|
+
/**
|
|
209
|
+
* Independent summary above the existing footer. Omit to leave this column's summary cell empty.
|
|
210
|
+
* Number: SUM/AVERAGE/COUNT/MIN/MAX; date/datetime: COUNT/MIN/MAX; other data columns: COUNT.
|
|
211
|
+
* Callbacks receive raw readonly items and scope/completeness context; strings render as escaped text.
|
|
212
|
+
* @defaultValue undefined
|
|
213
|
+
* @remarks COUNT counts nonempty raw field values, not items.length. It excludes null/undefined,
|
|
214
|
+
* blank strings, empty arrays, nonfinite numbers and invalid Dates, but includes 0/false/{}/[null].
|
|
215
|
+
* Configure data scope/subtotals with option.aggregate; templates and calculations can be combined.
|
|
216
|
+
* @example `aggregate: 'SUM'`
|
|
217
|
+
* @example `aggregate: items => items.length`
|
|
218
|
+
* @see SdTableAggregateDefinition.templateRef for a complete Angular example.
|
|
219
|
+
*/
|
|
220
|
+
aggregate?: SdTableColumnAggregate<T, O>;
|
|
67
221
|
title: string | ColumnTitleOption;
|
|
68
222
|
cell?: ColumnCellOption;
|
|
69
223
|
width?: string;
|
|
@@ -99,7 +253,7 @@ interface SdTableColumnText<T = unknown> extends SdTableColumnBase<T> {
|
|
|
99
253
|
type: 'string';
|
|
100
254
|
useBadge?: UseBadgeFunc<T>;
|
|
101
255
|
}
|
|
102
|
-
interface SdTableColumnNumber<T = unknown> extends SdTableColumnBase<T> {
|
|
256
|
+
interface SdTableColumnNumber<T = unknown> extends SdTableColumnBase<T, SdTableAggregateOperation> {
|
|
103
257
|
field: NestedKeyOf<T>;
|
|
104
258
|
type: 'number';
|
|
105
259
|
useBadge?: UseBadgeFunc<T>;
|
|
@@ -116,9 +270,17 @@ interface SdTableColumnBool<T = unknown> extends SdTableColumnBase<T> {
|
|
|
116
270
|
displayOnFalse?: string;
|
|
117
271
|
};
|
|
118
272
|
}
|
|
119
|
-
interface SdTableColumnDate<T = unknown> extends SdTableColumnBase<T> {
|
|
273
|
+
interface SdTableColumnDate<T = unknown> extends SdTableColumnBase<T, 'COUNT' | 'MIN' | 'MAX'> {
|
|
274
|
+
field: NestedKeyOf<T>;
|
|
275
|
+
type: 'date' | 'datetime';
|
|
276
|
+
useBadge?: UseBadgeFunc<T>;
|
|
277
|
+
filter?: SdTableColumnBase<T>['filter'] & {
|
|
278
|
+
type?: 'daterange' | 'date' | 'split-date';
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
interface SdTableColumnTime<T = unknown> extends SdTableColumnBase<T> {
|
|
120
282
|
field: NestedKeyOf<T>;
|
|
121
|
-
type: '
|
|
283
|
+
type: 'time';
|
|
122
284
|
useBadge?: UseBadgeFunc<T>;
|
|
123
285
|
filter?: SdTableColumnBase<T>['filter'] & {
|
|
124
286
|
type?: 'daterange' | 'date' | 'split-date';
|
|
@@ -149,6 +311,8 @@ interface SdTableColumnLazyValues<T = unknown, K = Record<string, any>> extends
|
|
|
149
311
|
}
|
|
150
312
|
type SdTableColumnNormal<T = unknown> = Exclude<SdTableColumn<T>, SdTableColumnChildren<T>>;
|
|
151
313
|
interface SdTableColumnChildren<T = unknown> extends SdTableColumnBase<T> {
|
|
314
|
+
/** Parent headers have no data value; configure aggregates on their leaf children. */
|
|
315
|
+
aggregate?: never;
|
|
152
316
|
field: string;
|
|
153
317
|
type: 'children';
|
|
154
318
|
children: SdTableColumnNormal<T>[];
|
|
@@ -852,6 +1016,15 @@ interface TableOptionTreeLazy<T = any> {
|
|
|
852
1016
|
|
|
853
1017
|
type SdTableOption<T = any> = SdTableLocalOption<T> | SdTableServerOption<T>;
|
|
854
1018
|
interface SdTableBaseOption<T = any> {
|
|
1019
|
+
/**
|
|
1020
|
+
* Data scope and optional group/tree subtotals for column.aggregate. Independent of sdTableFooterDef.
|
|
1021
|
+
* @defaultValue page scope, no subtotals, tree items='leaves'
|
|
1022
|
+
* @remarks A visible aggregate column enables the total row automatically. Server filtered scope is incomplete
|
|
1023
|
+
* and never silently falls back to page; missing lazy descendants also remain incomplete.
|
|
1024
|
+
* @example `{ aggregate: { scope: 'filtered', group: true } }` summarizes all matching local rows.
|
|
1025
|
+
* @see SdTableOptionAggregate
|
|
1026
|
+
*/
|
|
1027
|
+
aggregate?: SdTableOptionAggregate;
|
|
855
1028
|
/**
|
|
856
1029
|
* Key định danh của table option.
|
|
857
1030
|
* Thường dùng khi một số tính năng con cần lưu trạng thái riêng theo table,
|
|
@@ -1144,6 +1317,26 @@ interface SdTableMobileAction {
|
|
|
1144
1317
|
run?: () => unknown;
|
|
1145
1318
|
}
|
|
1146
1319
|
|
|
1320
|
+
interface AggregateCell<T> {
|
|
1321
|
+
context: SdTableAggregateTemplateContext<T>;
|
|
1322
|
+
templateRef?: TemplateRef<SdTableAggregateTemplateContext<T>>;
|
|
1323
|
+
text: string;
|
|
1324
|
+
}
|
|
1325
|
+
interface AggregateRow<T> {
|
|
1326
|
+
key: string;
|
|
1327
|
+
cells: ReadonlyMap<string, AggregateCell<T>>;
|
|
1328
|
+
}
|
|
1329
|
+
interface AggregateSnapshot<T> {
|
|
1330
|
+
total?: AggregateRow<T>;
|
|
1331
|
+
groups: ReadonlyMap<string, AggregateRow<T>>;
|
|
1332
|
+
branches: ReadonlyMap<T, AggregateRow<T>>;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
interface AggregateRenderHost<T> {
|
|
1336
|
+
rows: WeakMap<SdTableItem<T>, AggregateRow<T>>;
|
|
1337
|
+
indices: WeakMap<SdTableItem<T>, number>;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1147
1340
|
declare class ExternalFilterComponent {
|
|
1148
1341
|
#private;
|
|
1149
1342
|
autoIdInput: _angular_core.InputSignal<string | null | undefined>;
|
|
@@ -1377,6 +1570,26 @@ declare class SdTable<T = unknown> implements AfterViewInit, OnDestroy {
|
|
|
1377
1570
|
total: _angular_core.WritableSignal<number | undefined>;
|
|
1378
1571
|
loading: _angular_core.WritableSignal<boolean>;
|
|
1379
1572
|
loadError: _angular_core.WritableSignal<boolean>;
|
|
1573
|
+
readonly aggregateSnapshot: _angular_core.WritableSignal<AggregateSnapshot<T>>;
|
|
1574
|
+
readonly aggregateRenderHost: AggregateRenderHost<T>;
|
|
1575
|
+
readonly aggregateColumns: _angular_core.Signal<{
|
|
1576
|
+
id: string;
|
|
1577
|
+
field: string;
|
|
1578
|
+
column: SdTableColumn | undefined;
|
|
1579
|
+
hidden: boolean;
|
|
1580
|
+
sticky: boolean;
|
|
1581
|
+
stickyEnd: boolean;
|
|
1582
|
+
}[]>;
|
|
1583
|
+
readonly aggregateColumnIds: _angular_core.Signal<string[]>;
|
|
1584
|
+
readonly headerFilterColumns: _angular_core.Signal<{
|
|
1585
|
+
id: string;
|
|
1586
|
+
field: string;
|
|
1587
|
+
column: SdTableColumn | undefined;
|
|
1588
|
+
hidden: boolean;
|
|
1589
|
+
sticky: boolean;
|
|
1590
|
+
stickyEnd: boolean;
|
|
1591
|
+
}[]>;
|
|
1592
|
+
readonly headerFilterColumnIds: _angular_core.Signal<string[]>;
|
|
1380
1593
|
isSelectAll: _angular_core.WritableSignal<boolean>;
|
|
1381
1594
|
isSelectIndeterminate: _angular_core.WritableSignal<boolean>;
|
|
1382
1595
|
readonly sortState: _angular_core.WritableSignal<{
|
|
@@ -1467,6 +1680,7 @@ declare class SdTable<T = unknown> implements AfterViewInit, OnDestroy {
|
|
|
1467
1680
|
* Data row dùng displayedColumns nguyên vẹn.
|
|
1468
1681
|
*/
|
|
1469
1682
|
isGroupHeaderRow: (_idx: number, row: SdTableItem<T>) => boolean;
|
|
1683
|
+
isAggregateRow: (_idx: number, row: SdTableItem<T>) => boolean;
|
|
1470
1684
|
isDataRow: (_idx: number, row: SdTableItem<T>) => boolean;
|
|
1471
1685
|
/**
|
|
1472
1686
|
* Colspan cho cell sdGroupHeader trên group row = displayedColumns.length.
|
|
@@ -1508,4 +1722,4 @@ declare class SdTable<T = unknown> implements AfterViewInit, OnDestroy {
|
|
|
1508
1722
|
}
|
|
1509
1723
|
|
|
1510
1724
|
export { SD_TABLE_CONFIGURATION, SdConvertToPagingReq, SdMaterialFooterDefDirective, SdTable, SdTableCellDefDirective, SdTableCommandHeaderDefDirective, SdTableExpandDefDirective, SdTableFilterDefDirective, SdTableGroupDefDirective, SdTablePaginatorIntl, SdTableQuickSearchRightDefDirective, SdTableRowMobileDefDirective, SdTableTitleDefDirective };
|
|
1511
|
-
export type { ISdTableConfiguration, SdTableColumn, SdTableColumnAnyRow, SdTableColumnChildren, SdTableColumnLazyValues, SdTableColumnNormal, SdTableColumnTransformFunc, SdTableColumnValues, SdTableCommand, SdTableCommandChildren, SdTableCommandNormal, SdTableCommandOption, SdTableDisplay, SdTableExternalFilter, SdTableFilterRequest, SdTableGroupDefContext, SdTableItem, SdTableMeta, SdTableOption, SdTableOptionFilter, SdTableOptionQuickSearch, SdTableOptionTree, SdTableQuickFilter, SdTableQuickSearchFilter, SdTableQuickSearchFilterValue, SdTableQuickSearchValue, SdTableRowMobileDefContext, TableFilterConfiguration, TableFilterRegister, TableFilterValue, TableOptionTreeLazy, TableOptionTreeStatic };
|
|
1725
|
+
export type { ISdTableConfiguration, SdTableAggregateCallback, SdTableAggregateContext, SdTableAggregateDefinition, SdTableAggregateGroup, SdTableAggregateOperation, SdTableAggregateResult, SdTableAggregateTemplateContext, SdTableColumn, SdTableColumnAggregate, SdTableColumnAnyRow, SdTableColumnChildren, SdTableColumnLazyValues, SdTableColumnNormal, SdTableColumnTransformFunc, SdTableColumnValues, SdTableCommand, SdTableCommandChildren, SdTableCommandNormal, SdTableCommandOption, SdTableDisplay, SdTableExternalFilter, SdTableFilterRequest, SdTableGroupDefContext, SdTableItem, SdTableMeta, SdTableOption, SdTableOptionAggregate, SdTableOptionFilter, SdTableOptionQuickSearch, SdTableOptionTree, SdTableQuickFilter, SdTableQuickSearchFilter, SdTableQuickSearchFilterValue, SdTableQuickSearchValue, SdTableRowMobileDefContext, TableFilterConfiguration, TableFilterRegister, TableFilterValue, TableOptionTreeLazy, TableOptionTreeStatic };
|