@shival99/z-ui 2.1.5 → 2.1.7
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/fesm2022/shival99-z-ui-components-z-icon.mjs +96 -0
- package/fesm2022/shival99-z-ui-components-z-icon.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-popover.mjs +6 -5
- package/fesm2022/shival99-z-ui-components-z-popover.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-table.mjs +164 -2
- package/fesm2022/shival99-z-ui-components-z-table.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-tooltip.mjs +2 -1
- package/fesm2022/shival99-z-ui-components-z-tooltip.mjs.map +1 -1
- package/package.json +8 -4
- package/scripts/z-init-project.mjs +645 -0
- package/types/shival99-z-ui-components-z-icon.d.ts +17 -1
- package/types/shival99-z-ui-components-z-table.d.ts +59 -10
- package/types/shival99-z-ui-components-z-tooltip.d.ts +1 -0
|
@@ -7,7 +7,7 @@ import * as _angular_core from '@angular/core';
|
|
|
7
7
|
import { TemplateRef, Type, AfterViewInit, ElementRef, OnInit } from '@angular/core';
|
|
8
8
|
import { CdkDragDrop } from '@angular/cdk/drag-drop';
|
|
9
9
|
import { ConnectedPosition } from '@angular/cdk/overlay';
|
|
10
|
-
import { ZPopoverControl, ZPopoverDirective } from '@shival99/z-ui/components/z-popover';
|
|
10
|
+
import { ZPopoverPosition, ZPopoverTrigger, ZPopoverControl, ZPopoverDirective } from '@shival99/z-ui/components/z-popover';
|
|
11
11
|
import { ClassValue } from 'clsx';
|
|
12
12
|
import { NgScrollbar } from 'ngx-scrollbar';
|
|
13
13
|
import { ZAutocompleteType, ZAutocompleteOption } from '@shival99/z-ui/components/z-autocomplete';
|
|
@@ -17,7 +17,7 @@ import { ZSelectOption, ZSelectConfig, ZSelectMode } from '@shival99/z-ui/compon
|
|
|
17
17
|
import * as _shival99_z_ui_components_z_tags from '@shival99/z-ui/components/z-tags';
|
|
18
18
|
import { ZTagColor } from '@shival99/z-ui/components/z-tags';
|
|
19
19
|
import * as _shival99_z_ui_components_z_tooltip from '@shival99/z-ui/components/z-tooltip';
|
|
20
|
-
import { ZTooltipConfig, ZTooltipContent } from '@shival99/z-ui/components/z-tooltip';
|
|
20
|
+
import { ZTooltipConfig, ZTooltipContent, ZTooltipTrigger } from '@shival99/z-ui/components/z-tooltip';
|
|
21
21
|
import { ZExcelColumnConfig, ZExcelExportOptions } from '@shival99/z-ui/services';
|
|
22
22
|
import { ZDateRange } from '@shival99/z-ui/components/z-calendar';
|
|
23
23
|
import { ZDropdownMenuItem } from '@shival99/z-ui/components/z-dropdown-menu';
|
|
@@ -78,6 +78,43 @@ interface ZTableGroupLabelContext<T> {
|
|
|
78
78
|
rows: Row<T>[];
|
|
79
79
|
}
|
|
80
80
|
type ZTableGroupLabelFormatter<T> = (context: ZTableGroupLabelContext<T>) => string;
|
|
81
|
+
type ZTablePopoverContent = string | TemplateRef<unknown>;
|
|
82
|
+
interface ZTablePopoverConfig {
|
|
83
|
+
content?: ZTablePopoverContent;
|
|
84
|
+
position?: ZPopoverPosition;
|
|
85
|
+
trigger?: ZPopoverTrigger;
|
|
86
|
+
class?: string;
|
|
87
|
+
showDelay?: number;
|
|
88
|
+
hideDelay?: number;
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
offset?: number;
|
|
91
|
+
width?: 'auto' | 'trigger' | number;
|
|
92
|
+
manualClose?: boolean;
|
|
93
|
+
outsideClickClose?: boolean;
|
|
94
|
+
scrollClose?: boolean;
|
|
95
|
+
sticky?: boolean;
|
|
96
|
+
showArrow?: boolean;
|
|
97
|
+
keyboardSafe?: boolean;
|
|
98
|
+
}
|
|
99
|
+
type ZTableBodyPopoverConfig<T> = string | ZTablePopoverConfig | TemplateRef<unknown> | ((info: CellContext<T, unknown>) => string | ZTablePopoverConfig | TemplateRef<unknown>);
|
|
100
|
+
interface ZTableGroupTotalContext<T> {
|
|
101
|
+
columnId: string;
|
|
102
|
+
rows: Row<T>[];
|
|
103
|
+
value: unknown;
|
|
104
|
+
depth: number;
|
|
105
|
+
}
|
|
106
|
+
type ZTableGroupTotalContent<T> = 'sum' | ((context: ZTableGroupTotalContext<T>) => unknown);
|
|
107
|
+
interface ZTableGroupTotalConfig<T = unknown> {
|
|
108
|
+
columnId: string;
|
|
109
|
+
content?: ZTableGroupTotalContent<T>;
|
|
110
|
+
class?: string;
|
|
111
|
+
tooltip?: string | TemplateRef<unknown> | ZTableTooltipConfig;
|
|
112
|
+
popover?: ZTablePopoverContent | ZTablePopoverConfig;
|
|
113
|
+
}
|
|
114
|
+
interface ZTableTooltipConfig extends ZTooltipConfig {
|
|
115
|
+
trigger?: ZTooltipTrigger;
|
|
116
|
+
}
|
|
117
|
+
type ZTableBodyTooltipConfig<T> = string | ZTableTooltipConfig | TemplateRef<unknown> | ((info: CellContext<T, unknown>) => string | ZTableTooltipConfig | TemplateRef<unknown>);
|
|
81
118
|
/** Available column filter value input hints */
|
|
82
119
|
type ZTableFilterValueType = 'text' | 'number';
|
|
83
120
|
type ZTableFilterUi = 'basic' | 'advanced' | 'custom';
|
|
@@ -287,7 +324,8 @@ interface ZTableBodyColumnConfig<T> {
|
|
|
287
324
|
colSpan?: number | ((info: CellContext<T, unknown>) => number);
|
|
288
325
|
contentClass?: string | ((info: CellContext<T, unknown>) => string);
|
|
289
326
|
contentStyle?: Record<string, string> | ((info: CellContext<T, unknown>) => Record<string, string>);
|
|
290
|
-
tooltip?:
|
|
327
|
+
tooltip?: ZTableBodyTooltipConfig<T>;
|
|
328
|
+
popover?: ZTableBodyPopoverConfig<T>;
|
|
291
329
|
/**
|
|
292
330
|
* Action buttons rendered inside this cell.
|
|
293
331
|
*
|
|
@@ -397,8 +435,10 @@ interface ZTableServerGroup {
|
|
|
397
435
|
count?: number;
|
|
398
436
|
/** Đang fetch rows cho group này (hiển thị loading trong group). */
|
|
399
437
|
loading?: boolean;
|
|
438
|
+
/** Tổng theo cột do server cung cấp, key là columnId. */
|
|
439
|
+
totals?: Record<string, unknown>;
|
|
400
440
|
}
|
|
401
|
-
interface ZTableGroupingConfig {
|
|
441
|
+
interface ZTableGroupingConfig<T = unknown> {
|
|
402
442
|
enabled?: boolean;
|
|
403
443
|
mode?: ZTableGroupingMode;
|
|
404
444
|
/** Các cột được phép group từ header menu. */
|
|
@@ -408,6 +448,8 @@ interface ZTableGroupingConfig {
|
|
|
408
448
|
allowHeaderMenu?: boolean;
|
|
409
449
|
defaultExpanded?: boolean;
|
|
410
450
|
showCount?: boolean;
|
|
451
|
+
/** Cấu hình các cột cần hiển thị tổng trên group row. */
|
|
452
|
+
totals?: ZTableGroupTotalConfig<T>[];
|
|
411
453
|
/**
|
|
412
454
|
* Cột đang group ở chế độ server (bắt buộc cho server grouping vì table không tự suy ra).
|
|
413
455
|
* Nếu bỏ trống, dùng phần tử đầu của `columns`.
|
|
@@ -896,7 +938,7 @@ interface ZTableConfig<T> {
|
|
|
896
938
|
enableColumnPinning?: boolean;
|
|
897
939
|
enableColumnOrdering?: boolean;
|
|
898
940
|
enableColumnSorting?: boolean;
|
|
899
|
-
enableGrouping?: ZTableGroupingConfig | boolean;
|
|
941
|
+
enableGrouping?: ZTableGroupingConfig<T> | boolean;
|
|
900
942
|
pagination?: ZTablePaginationConfig;
|
|
901
943
|
initialState?: ZTableInitialState;
|
|
902
944
|
loading?: boolean;
|
|
@@ -981,6 +1023,7 @@ interface ZTableGroupRowItem {
|
|
|
981
1023
|
expanded: boolean;
|
|
982
1024
|
/** Server grouping: group đang fetch child rows. */
|
|
983
1025
|
loading?: boolean;
|
|
1026
|
+
totals?: Record<string, unknown>;
|
|
984
1027
|
}
|
|
985
1028
|
interface ZTableDataRowItem<T> {
|
|
986
1029
|
type: 'row';
|
|
@@ -1211,7 +1254,7 @@ declare class ZTableComponent<T> implements AfterViewInit {
|
|
|
1211
1254
|
protected readonly hasSorting: _angular_core.Signal<boolean>;
|
|
1212
1255
|
protected readonly hasLocalSorting: _angular_core.Signal<boolean>;
|
|
1213
1256
|
protected readonly hasServerFiltering: _angular_core.Signal<boolean>;
|
|
1214
|
-
protected readonly groupingConfig: _angular_core.Signal<ZTableGroupingConfig
|
|
1257
|
+
protected readonly groupingConfig: _angular_core.Signal<ZTableGroupingConfig<T>>;
|
|
1215
1258
|
/** EN/VI: true khi grouping chạy ở chế độ server (group meta do server cung cấp). */
|
|
1216
1259
|
protected readonly isServerGrouping: _angular_core.Signal<boolean>;
|
|
1217
1260
|
protected readonly canUseGrouping: _angular_core.Signal<boolean>;
|
|
@@ -1220,6 +1263,8 @@ declare class ZTableComponent<T> implements AfterViewInit {
|
|
|
1220
1263
|
protected readonly activeGroupingColumnIds: _angular_core.Signal<string[]>;
|
|
1221
1264
|
protected readonly activeGroupingColumnId: _angular_core.Signal<string>;
|
|
1222
1265
|
protected readonly groupingColumnMap: _angular_core.Signal<Record<string, boolean>>;
|
|
1266
|
+
protected readonly groupTotalColumnMap: _angular_core.Signal<Record<string, boolean>>;
|
|
1267
|
+
protected readonly groupTotalConfigMap: _angular_core.Signal<Record<string, ZTableGroupTotalConfig<T>>>;
|
|
1223
1268
|
protected readonly groupableColumnMap: _angular_core.Signal<Record<string, boolean>>;
|
|
1224
1269
|
protected readonly groupingHeaderMenuMap: _angular_core.Signal<Record<string, boolean>>;
|
|
1225
1270
|
protected readonly groupedCenterRowItems: _angular_core.Signal<ZTableGroupedRowItem<T>[]>;
|
|
@@ -1231,6 +1276,8 @@ declare class ZTableComponent<T> implements AfterViewInit {
|
|
|
1231
1276
|
* Child rows lấy từ `getCenterRows()` (data parent đã fetch) và gán vào group theo value.
|
|
1232
1277
|
*/
|
|
1233
1278
|
private _buildServerGroupedItems;
|
|
1279
|
+
private _getGroupTotals;
|
|
1280
|
+
private _sumGroupColumn;
|
|
1234
1281
|
/**
|
|
1235
1282
|
* EN: Flat list of body rows in the exact order they are rendered. When grouping is active the
|
|
1236
1283
|
* center rows are re-ordered group-by-group, so the flat `table.getRowModel().rows` no longer
|
|
@@ -1658,13 +1705,13 @@ declare class ZTableFilterComponent<T> {
|
|
|
1658
1705
|
|
|
1659
1706
|
declare class ZTableIconTextComponent {
|
|
1660
1707
|
readonly zText: _angular_core.InputSignal<string>;
|
|
1661
|
-
readonly zTooltip: _angular_core.InputSignal<
|
|
1708
|
+
readonly zTooltip: _angular_core.InputSignal<ZTooltipConfig | ZTooltipContent>;
|
|
1662
1709
|
readonly zTriggerElement: _angular_core.InputSignal<HTMLElement | null>;
|
|
1663
1710
|
private readonly _hostEl;
|
|
1664
1711
|
private readonly _zTranslate;
|
|
1665
1712
|
protected readonly triggerEl: _angular_core.Signal<any>;
|
|
1666
1713
|
protected readonly translatedParts: _angular_core.Signal<ZTableIconPart[]>;
|
|
1667
|
-
protected readonly tooltipContent: _angular_core.Signal<
|
|
1714
|
+
protected readonly tooltipContent: _angular_core.Signal<ZTooltipContent>;
|
|
1668
1715
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZTableIconTextComponent, never>;
|
|
1669
1716
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ZTableIconTextComponent, "z-table-icon-text", never, { "zText": { "alias": "zText"; "required": false; "isSignal": true; }; "zTooltip": { "alias": "zTooltip"; "required": false; "isSignal": true; }; "zTriggerElement": { "alias": "zTriggerElement"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1670
1717
|
}
|
|
@@ -1673,7 +1720,7 @@ declare class ZTableActionsComponent<T = unknown> {
|
|
|
1673
1720
|
readonly zConfig: _angular_core.InputSignal<ZTableActionColumnConfig<T>>;
|
|
1674
1721
|
readonly zRow: _angular_core.InputSignal<T>;
|
|
1675
1722
|
readonly zRowId: _angular_core.InputSignal<string>;
|
|
1676
|
-
readonly zDropdownButtonSize: _angular_core.InputSignal<"
|
|
1723
|
+
readonly zDropdownButtonSize: _angular_core.InputSignal<"sm" | "default" | "lg" | "xs" | "xl" | null | undefined>;
|
|
1677
1724
|
readonly zActionClick: _angular_core.OutputEmitterRef<ZTableActionClickEvent<T>>;
|
|
1678
1725
|
protected readonly allActions: _angular_core.Signal<ZTableActionItem<T>[]>;
|
|
1679
1726
|
protected readonly shouldShowAsButtons: _angular_core.Signal<boolean>;
|
|
@@ -1778,6 +1825,7 @@ declare const getBodyConfig: <T>(col: ZTableColumnConfig<T> | undefined, ctx?: C
|
|
|
1778
1825
|
contentClass: string | undefined;
|
|
1779
1826
|
contentStyle: Record<string, string> | undefined;
|
|
1780
1827
|
tooltip: string | object | undefined;
|
|
1828
|
+
popover: string | object | undefined;
|
|
1781
1829
|
} | {
|
|
1782
1830
|
content: ZTableCellContent<T> | undefined;
|
|
1783
1831
|
type: _shival99_z_ui_components_z_table.ZTableBodyContentType;
|
|
@@ -1789,7 +1837,8 @@ declare const getBodyConfig: <T>(col: ZTableColumnConfig<T> | undefined, ctx?: C
|
|
|
1789
1837
|
colSpan: number | undefined;
|
|
1790
1838
|
contentClass: string | ((info: CellContext<T, unknown>) => string) | undefined;
|
|
1791
1839
|
contentStyle: Record<string, string> | undefined;
|
|
1792
|
-
tooltip:
|
|
1840
|
+
tooltip: ZTableBodyTooltipConfig<T> | undefined;
|
|
1841
|
+
popover: ZTableBodyPopoverConfig<T> | undefined;
|
|
1793
1842
|
};
|
|
1794
1843
|
declare const getFooterConfig: <T>(col: ZTableColumnConfig<T> | undefined, footerRowIndex?: number) => {
|
|
1795
1844
|
content: ZTableHeaderContent<T> | undefined;
|
|
@@ -17,6 +17,7 @@ type ZTooltipContent = string | TemplateRef<unknown>;
|
|
|
17
17
|
interface ZTooltipConfig {
|
|
18
18
|
content?: ZTooltipContent;
|
|
19
19
|
position?: ZTooltipPosition;
|
|
20
|
+
trigger?: ZTooltipTrigger;
|
|
20
21
|
type?: ZTooltipVariants['zType'];
|
|
21
22
|
size?: ZTooltipVariants['zSize'];
|
|
22
23
|
class?: string;
|