@underverse-ui/underverse 1.0.161 → 1.0.162
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/api-reference.json +1 -1
- package/dist/index.cjs +149 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -1
- package/dist/index.d.ts +46 -1
- package/dist/index.js +149 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2559,7 +2559,20 @@ type DataTableColumn<T> = {
|
|
|
2559
2559
|
/** Advanced: Override auto-calculated colspan (defaults to number of leaf descendants) */
|
|
2560
2560
|
colSpan?: number;
|
|
2561
2561
|
/** Advanced: Override auto-calculated rowspan (defaults based on depth) */
|
|
2562
|
+
/** Advanced: Override auto-calculated rowspan (defaults based on depth) */
|
|
2562
2563
|
rowSpan?: number;
|
|
2564
|
+
/**
|
|
2565
|
+
* Color tag for this column (hex or rgb string, e.g. "#3b82f6").
|
|
2566
|
+
* - Header cell gets a darker tinted background
|
|
2567
|
+
* - Body cells get a lighter tinted background
|
|
2568
|
+
* - Columns with the same colorTag are grouped together in the visibility dropdown
|
|
2569
|
+
*/
|
|
2570
|
+
colorTag?: string;
|
|
2571
|
+
};
|
|
2572
|
+
/** Configuration for a column color group in the visibility dropdown */
|
|
2573
|
+
type ColumnColorGroup = {
|
|
2574
|
+
/** Display label for this group (e.g. "Bắt buộc", "Tùy chọn") */
|
|
2575
|
+
label: string;
|
|
2563
2576
|
};
|
|
2564
2577
|
type Sorter = {
|
|
2565
2578
|
key: string;
|
|
@@ -2583,6 +2596,8 @@ type DataTableLabels = {
|
|
|
2583
2596
|
alignRight?: string;
|
|
2584
2597
|
noData?: string;
|
|
2585
2598
|
sortBy?: string;
|
|
2599
|
+
selectAll?: string;
|
|
2600
|
+
default?: string;
|
|
2586
2601
|
};
|
|
2587
2602
|
/** Public props for the `DataTable` component. */
|
|
2588
2603
|
interface DataTableProps<T> {
|
|
@@ -2597,6 +2612,12 @@ interface DataTableProps<T> {
|
|
|
2597
2612
|
onQueryChange?: (q: DataTableQuery) => void;
|
|
2598
2613
|
caption?: React__default.ReactNode;
|
|
2599
2614
|
toolbar?: React__default.ReactNode;
|
|
2615
|
+
/**
|
|
2616
|
+
* Define color groups for the column visibility dropdown legend.
|
|
2617
|
+
* Key = color value used in column's `colorTag` (e.g. "#1e40af").
|
|
2618
|
+
* If not provided, columns with colorTag still get colored but won't be grouped in dropdown.
|
|
2619
|
+
*/
|
|
2620
|
+
columnColorGroups?: Record<string, ColumnColorGroup>;
|
|
2600
2621
|
/** Visual size preset. Maps to component scales in the table UI. */
|
|
2601
2622
|
size?: DataTableSize;
|
|
2602
2623
|
enableColumnVisibilityToggle?: boolean;
|
|
@@ -2634,7 +2655,7 @@ interface DataTableProps<T> {
|
|
|
2634
2655
|
labels?: DataTableLabels;
|
|
2635
2656
|
}
|
|
2636
2657
|
|
|
2637
|
-
declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, pageSizeOptions, onQueryChange, caption, toolbar, size, enableColumnVisibilityToggle, enableDensityToggle, enableHeaderAlignToggle, striped, columnDividers, className, storageKey, stickyHeader, maxHeight, horizontalMode, overflowHidden, useOverlayScrollbar, virtualizedRows, estimatedRowHeight, overscan, enableHeaderAutoFit, labels, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
2658
|
+
declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, pageSizeOptions, onQueryChange, caption, toolbar, size, enableColumnVisibilityToggle, enableDensityToggle, enableHeaderAlignToggle, striped, columnDividers, className, storageKey, stickyHeader, maxHeight, horizontalMode, overflowHidden, useOverlayScrollbar, virtualizedRows, estimatedRowHeight, overscan, enableHeaderAutoFit, labels, columnColorGroups, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
2638
2659
|
|
|
2639
2660
|
/** Public props for the `Table` component. */
|
|
2640
2661
|
interface TableProps extends React__default.HTMLAttributes<HTMLTableElement> {
|
|
@@ -3375,6 +3396,9 @@ declare const underverseMessages: {
|
|
|
3375
3396
|
loading: string;
|
|
3376
3397
|
noData: string;
|
|
3377
3398
|
clearFilter: string;
|
|
3399
|
+
selectAll: string;
|
|
3400
|
+
default: string;
|
|
3401
|
+
other: string;
|
|
3378
3402
|
headerAlign: string;
|
|
3379
3403
|
alignLeft: string;
|
|
3380
3404
|
alignCenter: string;
|
|
@@ -3768,6 +3792,9 @@ declare const underverseMessages: {
|
|
|
3768
3792
|
loading: string;
|
|
3769
3793
|
noData: string;
|
|
3770
3794
|
clearFilter: string;
|
|
3795
|
+
selectAll: string;
|
|
3796
|
+
default: string;
|
|
3797
|
+
other: string;
|
|
3771
3798
|
headerAlign: string;
|
|
3772
3799
|
alignLeft: string;
|
|
3773
3800
|
alignCenter: string;
|
|
@@ -4161,6 +4188,9 @@ declare const underverseMessages: {
|
|
|
4161
4188
|
loading: string;
|
|
4162
4189
|
noData: string;
|
|
4163
4190
|
clearFilter: string;
|
|
4191
|
+
selectAll: string;
|
|
4192
|
+
default: string;
|
|
4193
|
+
other: string;
|
|
4164
4194
|
headerAlign: string;
|
|
4165
4195
|
alignLeft: string;
|
|
4166
4196
|
alignCenter: string;
|
|
@@ -4554,6 +4584,9 @@ declare const underverseMessages: {
|
|
|
4554
4584
|
loading: string;
|
|
4555
4585
|
noData: string;
|
|
4556
4586
|
clearFilter: string;
|
|
4587
|
+
selectAll: string;
|
|
4588
|
+
default: string;
|
|
4589
|
+
other: string;
|
|
4557
4590
|
headerAlign: string;
|
|
4558
4591
|
alignLeft: string;
|
|
4559
4592
|
alignCenter: string;
|
|
@@ -4950,6 +4983,9 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
|
|
|
4950
4983
|
loading: string;
|
|
4951
4984
|
noData: string;
|
|
4952
4985
|
clearFilter: string;
|
|
4986
|
+
selectAll: string;
|
|
4987
|
+
default: string;
|
|
4988
|
+
other: string;
|
|
4953
4989
|
headerAlign: string;
|
|
4954
4990
|
alignLeft: string;
|
|
4955
4991
|
alignCenter: string;
|
|
@@ -5342,6 +5378,9 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
|
|
|
5342
5378
|
loading: string;
|
|
5343
5379
|
noData: string;
|
|
5344
5380
|
clearFilter: string;
|
|
5381
|
+
selectAll: string;
|
|
5382
|
+
default: string;
|
|
5383
|
+
other: string;
|
|
5345
5384
|
headerAlign: string;
|
|
5346
5385
|
alignLeft: string;
|
|
5347
5386
|
alignCenter: string;
|
|
@@ -5734,6 +5773,9 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
|
|
|
5734
5773
|
loading: string;
|
|
5735
5774
|
noData: string;
|
|
5736
5775
|
clearFilter: string;
|
|
5776
|
+
selectAll: string;
|
|
5777
|
+
default: string;
|
|
5778
|
+
other: string;
|
|
5737
5779
|
headerAlign: string;
|
|
5738
5780
|
alignLeft: string;
|
|
5739
5781
|
alignCenter: string;
|
|
@@ -6126,6 +6168,9 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
|
|
|
6126
6168
|
loading: string;
|
|
6127
6169
|
noData: string;
|
|
6128
6170
|
clearFilter: string;
|
|
6171
|
+
selectAll: string;
|
|
6172
|
+
default: string;
|
|
6173
|
+
other: string;
|
|
6129
6174
|
headerAlign: string;
|
|
6130
6175
|
alignLeft: string;
|
|
6131
6176
|
alignCenter: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -2559,7 +2559,20 @@ type DataTableColumn<T> = {
|
|
|
2559
2559
|
/** Advanced: Override auto-calculated colspan (defaults to number of leaf descendants) */
|
|
2560
2560
|
colSpan?: number;
|
|
2561
2561
|
/** Advanced: Override auto-calculated rowspan (defaults based on depth) */
|
|
2562
|
+
/** Advanced: Override auto-calculated rowspan (defaults based on depth) */
|
|
2562
2563
|
rowSpan?: number;
|
|
2564
|
+
/**
|
|
2565
|
+
* Color tag for this column (hex or rgb string, e.g. "#3b82f6").
|
|
2566
|
+
* - Header cell gets a darker tinted background
|
|
2567
|
+
* - Body cells get a lighter tinted background
|
|
2568
|
+
* - Columns with the same colorTag are grouped together in the visibility dropdown
|
|
2569
|
+
*/
|
|
2570
|
+
colorTag?: string;
|
|
2571
|
+
};
|
|
2572
|
+
/** Configuration for a column color group in the visibility dropdown */
|
|
2573
|
+
type ColumnColorGroup = {
|
|
2574
|
+
/** Display label for this group (e.g. "Bắt buộc", "Tùy chọn") */
|
|
2575
|
+
label: string;
|
|
2563
2576
|
};
|
|
2564
2577
|
type Sorter = {
|
|
2565
2578
|
key: string;
|
|
@@ -2583,6 +2596,8 @@ type DataTableLabels = {
|
|
|
2583
2596
|
alignRight?: string;
|
|
2584
2597
|
noData?: string;
|
|
2585
2598
|
sortBy?: string;
|
|
2599
|
+
selectAll?: string;
|
|
2600
|
+
default?: string;
|
|
2586
2601
|
};
|
|
2587
2602
|
/** Public props for the `DataTable` component. */
|
|
2588
2603
|
interface DataTableProps<T> {
|
|
@@ -2597,6 +2612,12 @@ interface DataTableProps<T> {
|
|
|
2597
2612
|
onQueryChange?: (q: DataTableQuery) => void;
|
|
2598
2613
|
caption?: React__default.ReactNode;
|
|
2599
2614
|
toolbar?: React__default.ReactNode;
|
|
2615
|
+
/**
|
|
2616
|
+
* Define color groups for the column visibility dropdown legend.
|
|
2617
|
+
* Key = color value used in column's `colorTag` (e.g. "#1e40af").
|
|
2618
|
+
* If not provided, columns with colorTag still get colored but won't be grouped in dropdown.
|
|
2619
|
+
*/
|
|
2620
|
+
columnColorGroups?: Record<string, ColumnColorGroup>;
|
|
2600
2621
|
/** Visual size preset. Maps to component scales in the table UI. */
|
|
2601
2622
|
size?: DataTableSize;
|
|
2602
2623
|
enableColumnVisibilityToggle?: boolean;
|
|
@@ -2634,7 +2655,7 @@ interface DataTableProps<T> {
|
|
|
2634
2655
|
labels?: DataTableLabels;
|
|
2635
2656
|
}
|
|
2636
2657
|
|
|
2637
|
-
declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, pageSizeOptions, onQueryChange, caption, toolbar, size, enableColumnVisibilityToggle, enableDensityToggle, enableHeaderAlignToggle, striped, columnDividers, className, storageKey, stickyHeader, maxHeight, horizontalMode, overflowHidden, useOverlayScrollbar, virtualizedRows, estimatedRowHeight, overscan, enableHeaderAutoFit, labels, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
2658
|
+
declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, pageSizeOptions, onQueryChange, caption, toolbar, size, enableColumnVisibilityToggle, enableDensityToggle, enableHeaderAlignToggle, striped, columnDividers, className, storageKey, stickyHeader, maxHeight, horizontalMode, overflowHidden, useOverlayScrollbar, virtualizedRows, estimatedRowHeight, overscan, enableHeaderAutoFit, labels, columnColorGroups, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
2638
2659
|
|
|
2639
2660
|
/** Public props for the `Table` component. */
|
|
2640
2661
|
interface TableProps extends React__default.HTMLAttributes<HTMLTableElement> {
|
|
@@ -3375,6 +3396,9 @@ declare const underverseMessages: {
|
|
|
3375
3396
|
loading: string;
|
|
3376
3397
|
noData: string;
|
|
3377
3398
|
clearFilter: string;
|
|
3399
|
+
selectAll: string;
|
|
3400
|
+
default: string;
|
|
3401
|
+
other: string;
|
|
3378
3402
|
headerAlign: string;
|
|
3379
3403
|
alignLeft: string;
|
|
3380
3404
|
alignCenter: string;
|
|
@@ -3768,6 +3792,9 @@ declare const underverseMessages: {
|
|
|
3768
3792
|
loading: string;
|
|
3769
3793
|
noData: string;
|
|
3770
3794
|
clearFilter: string;
|
|
3795
|
+
selectAll: string;
|
|
3796
|
+
default: string;
|
|
3797
|
+
other: string;
|
|
3771
3798
|
headerAlign: string;
|
|
3772
3799
|
alignLeft: string;
|
|
3773
3800
|
alignCenter: string;
|
|
@@ -4161,6 +4188,9 @@ declare const underverseMessages: {
|
|
|
4161
4188
|
loading: string;
|
|
4162
4189
|
noData: string;
|
|
4163
4190
|
clearFilter: string;
|
|
4191
|
+
selectAll: string;
|
|
4192
|
+
default: string;
|
|
4193
|
+
other: string;
|
|
4164
4194
|
headerAlign: string;
|
|
4165
4195
|
alignLeft: string;
|
|
4166
4196
|
alignCenter: string;
|
|
@@ -4554,6 +4584,9 @@ declare const underverseMessages: {
|
|
|
4554
4584
|
loading: string;
|
|
4555
4585
|
noData: string;
|
|
4556
4586
|
clearFilter: string;
|
|
4587
|
+
selectAll: string;
|
|
4588
|
+
default: string;
|
|
4589
|
+
other: string;
|
|
4557
4590
|
headerAlign: string;
|
|
4558
4591
|
alignLeft: string;
|
|
4559
4592
|
alignCenter: string;
|
|
@@ -4950,6 +4983,9 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
|
|
|
4950
4983
|
loading: string;
|
|
4951
4984
|
noData: string;
|
|
4952
4985
|
clearFilter: string;
|
|
4986
|
+
selectAll: string;
|
|
4987
|
+
default: string;
|
|
4988
|
+
other: string;
|
|
4953
4989
|
headerAlign: string;
|
|
4954
4990
|
alignLeft: string;
|
|
4955
4991
|
alignCenter: string;
|
|
@@ -5342,6 +5378,9 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
|
|
|
5342
5378
|
loading: string;
|
|
5343
5379
|
noData: string;
|
|
5344
5380
|
clearFilter: string;
|
|
5381
|
+
selectAll: string;
|
|
5382
|
+
default: string;
|
|
5383
|
+
other: string;
|
|
5345
5384
|
headerAlign: string;
|
|
5346
5385
|
alignLeft: string;
|
|
5347
5386
|
alignCenter: string;
|
|
@@ -5734,6 +5773,9 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
|
|
|
5734
5773
|
loading: string;
|
|
5735
5774
|
noData: string;
|
|
5736
5775
|
clearFilter: string;
|
|
5776
|
+
selectAll: string;
|
|
5777
|
+
default: string;
|
|
5778
|
+
other: string;
|
|
5737
5779
|
headerAlign: string;
|
|
5738
5780
|
alignLeft: string;
|
|
5739
5781
|
alignCenter: string;
|
|
@@ -6126,6 +6168,9 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
|
|
|
6126
6168
|
loading: string;
|
|
6127
6169
|
noData: string;
|
|
6128
6170
|
clearFilter: string;
|
|
6171
|
+
selectAll: string;
|
|
6172
|
+
default: string;
|
|
6173
|
+
other: string;
|
|
6129
6174
|
headerAlign: string;
|
|
6130
6175
|
alignLeft: string;
|
|
6131
6176
|
alignCenter: string;
|
package/dist/index.js
CHANGED
|
@@ -585,6 +585,9 @@ var en_default = {
|
|
|
585
585
|
loading: "Loading",
|
|
586
586
|
noData: "No data",
|
|
587
587
|
clearFilter: "Clear filter",
|
|
588
|
+
selectAll: "Select all",
|
|
589
|
+
default: "Default",
|
|
590
|
+
other: "Other",
|
|
588
591
|
headerAlign: "Header alignment",
|
|
589
592
|
alignLeft: "Align left",
|
|
590
593
|
alignCenter: "Align center",
|
|
@@ -980,6 +983,9 @@ var vi_default = {
|
|
|
980
983
|
loading: "\u0110ang t\u1EA3i",
|
|
981
984
|
noData: "Kh\xF4ng c\xF3 d\u1EEF li\u1EC7u",
|
|
982
985
|
clearFilter: "X\xF3a b\u1ED9 l\u1ECDc",
|
|
986
|
+
selectAll: "Ch\u1ECDn t\u1EA5t c\u1EA3",
|
|
987
|
+
default: "M\u1EB7c \u0111\u1ECBnh",
|
|
988
|
+
other: "Kh\xE1c",
|
|
983
989
|
headerAlign: "C\u0103n ch\u1EC9nh ti\xEAu \u0111\u1EC1",
|
|
984
990
|
alignLeft: "C\u0103n tr\xE1i",
|
|
985
991
|
alignCenter: "C\u0103n gi\u1EEFa",
|
|
@@ -1375,6 +1381,9 @@ var ko_default = {
|
|
|
1375
1381
|
loading: "\uB85C\uB529 \uC911",
|
|
1376
1382
|
noData: "\uB370\uC774\uD130 \uC5C6\uC74C",
|
|
1377
1383
|
clearFilter: "\uD544\uD130 \uC9C0\uC6B0\uAE30",
|
|
1384
|
+
selectAll: "\uC804\uCCB4 \uC120\uD0DD",
|
|
1385
|
+
default: "\uAE30\uBCF8\uAC12",
|
|
1386
|
+
other: "\uAE30\uD0C0",
|
|
1378
1387
|
headerAlign: "\uD5E4\uB354 \uC815\uB82C",
|
|
1379
1388
|
alignLeft: "\uC67C\uCABD \uC815\uB82C",
|
|
1380
1389
|
alignCenter: "\uAC00\uC6B4\uB370 \uC815\uB82C",
|
|
@@ -1770,6 +1779,9 @@ var ja_default = {
|
|
|
1770
1779
|
loading: "\u8AAD\u307F\u8FBC\u307F\u4E2D",
|
|
1771
1780
|
noData: "\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",
|
|
1772
1781
|
clearFilter: "\u30D5\u30A3\u30EB\u30BF\u30FC\u3092\u30AF\u30EA\u30A2",
|
|
1782
|
+
selectAll: "\u3059\u3079\u3066\u9078\u629E",
|
|
1783
|
+
default: "\u30C7\u30D5\u30A9\u30EB\u30C8",
|
|
1784
|
+
other: "\u305D\u306E\u4ED6",
|
|
1773
1785
|
headerAlign: "\u30D8\u30C3\u30C0\u30FC\u914D\u7F6E",
|
|
1774
1786
|
alignLeft: "\u5DE6\u63C3\u3048",
|
|
1775
1787
|
alignCenter: "\u4E2D\u592E\u63C3\u3048",
|
|
@@ -22925,6 +22937,78 @@ function DataTableBodyRows({
|
|
|
22925
22937
|
// src/components/DataTable/components/DataTableHeader.tsx
|
|
22926
22938
|
import React56 from "react";
|
|
22927
22939
|
import { Filter as FilterIcon } from "lucide-react";
|
|
22940
|
+
|
|
22941
|
+
// src/components/DataTable/utils/colorTag.ts
|
|
22942
|
+
function parseColor(color) {
|
|
22943
|
+
if (!color) return null;
|
|
22944
|
+
const c = color.trim().toLowerCase();
|
|
22945
|
+
if (c.startsWith("#")) {
|
|
22946
|
+
let hex = c.substring(1);
|
|
22947
|
+
if (hex.length === 3) {
|
|
22948
|
+
hex = hex.split("").map((char) => char + char).join("");
|
|
22949
|
+
}
|
|
22950
|
+
if (hex.length === 6) {
|
|
22951
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
22952
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
22953
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
22954
|
+
if (!isNaN(r) && !isNaN(g) && !isNaN(b)) {
|
|
22955
|
+
return [r, g, b];
|
|
22956
|
+
}
|
|
22957
|
+
}
|
|
22958
|
+
return null;
|
|
22959
|
+
}
|
|
22960
|
+
if (c.startsWith("rgb")) {
|
|
22961
|
+
const match = c.match(/rgba?\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
22962
|
+
if (match) {
|
|
22963
|
+
const r = parseInt(match[1], 10);
|
|
22964
|
+
const g = parseInt(match[2], 10);
|
|
22965
|
+
const b = parseInt(match[3], 10);
|
|
22966
|
+
if (!isNaN(r) && !isNaN(g) && !isNaN(b)) {
|
|
22967
|
+
return [r, g, b];
|
|
22968
|
+
}
|
|
22969
|
+
}
|
|
22970
|
+
return null;
|
|
22971
|
+
}
|
|
22972
|
+
return null;
|
|
22973
|
+
}
|
|
22974
|
+
function toRgba(r, g, b, alpha) {
|
|
22975
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
22976
|
+
}
|
|
22977
|
+
function getHeaderBgColor(colorTag) {
|
|
22978
|
+
const rgb = parseColor(colorTag);
|
|
22979
|
+
if (!rgb) return colorTag;
|
|
22980
|
+
return toRgba(rgb[0], rgb[1], rgb[2], 1);
|
|
22981
|
+
}
|
|
22982
|
+
function groupColumnsByColorTag(leafCols, colorGroups) {
|
|
22983
|
+
const groupsMap = /* @__PURE__ */ new Map();
|
|
22984
|
+
const ungrouped = [];
|
|
22985
|
+
for (const col of leafCols) {
|
|
22986
|
+
if (col.colorTag && colorGroups && colorGroups[col.colorTag]) {
|
|
22987
|
+
const tag = col.colorTag;
|
|
22988
|
+
if (!groupsMap.has(tag)) {
|
|
22989
|
+
groupsMap.set(tag, []);
|
|
22990
|
+
}
|
|
22991
|
+
groupsMap.get(tag).push(col);
|
|
22992
|
+
} else {
|
|
22993
|
+
ungrouped.push(col);
|
|
22994
|
+
}
|
|
22995
|
+
}
|
|
22996
|
+
const groups = [];
|
|
22997
|
+
if (colorGroups) {
|
|
22998
|
+
for (const [tag, groupConfig] of Object.entries(colorGroups)) {
|
|
22999
|
+
if (groupsMap.has(tag)) {
|
|
23000
|
+
groups.push({
|
|
23001
|
+
colorTag: tag,
|
|
23002
|
+
label: groupConfig.label,
|
|
23003
|
+
columns: groupsMap.get(tag)
|
|
23004
|
+
});
|
|
23005
|
+
}
|
|
23006
|
+
}
|
|
23007
|
+
}
|
|
23008
|
+
return { groups, ungrouped };
|
|
23009
|
+
}
|
|
23010
|
+
|
|
23011
|
+
// src/components/DataTable/components/DataTableHeader.tsx
|
|
22928
23012
|
import { Fragment as Fragment24, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
22929
23013
|
function getColumnLabel(title) {
|
|
22930
23014
|
if (typeof title === "string" || typeof title === "number") {
|
|
@@ -23173,6 +23257,7 @@ function DataTableHeader({
|
|
|
23173
23257
|
const isAfterFixedLeft = prevCol?.fixed === "left";
|
|
23174
23258
|
const showBorderLeft = columnDividers && cellIndex > 0 && !isAfterFixedLeft && !col.fixed;
|
|
23175
23259
|
const isLastCell = cellIndex === row.length - 1;
|
|
23260
|
+
const headerBackgroundColor = isLeaf && col.colorTag ? getHeaderBgColor(col.colorTag) : "var(--muted)";
|
|
23176
23261
|
return /* @__PURE__ */ jsxs53(
|
|
23177
23262
|
TableHead,
|
|
23178
23263
|
{
|
|
@@ -23181,6 +23266,7 @@ function DataTableHeader({
|
|
|
23181
23266
|
"data-underverse-column-key": isLeaf ? col.key : void 0,
|
|
23182
23267
|
style: {
|
|
23183
23268
|
width: col.width,
|
|
23269
|
+
backgroundColor: headerBackgroundColor,
|
|
23184
23270
|
...getStickyHeaderCellStyle(headerCell)
|
|
23185
23271
|
},
|
|
23186
23272
|
className: cn(
|
|
@@ -23257,7 +23343,6 @@ function DataTablePagination({
|
|
|
23257
23343
|
result.push(totalPages);
|
|
23258
23344
|
return result;
|
|
23259
23345
|
}, [curPage, totalPages]);
|
|
23260
|
-
if (!(totalItems > 0 && totalPages > 1)) return null;
|
|
23261
23346
|
const controlButtonSize = size === "lg" ? "md" : "sm";
|
|
23262
23347
|
const navBtnClass = size === "sm" ? "h-6 w-6 p-0 rounded-full" : size === "lg" ? "h-8 w-8 p-0 rounded-full" : "h-7 w-7 p-0 rounded-full";
|
|
23263
23348
|
const navIconClass = size === "sm" ? "h-3.5 w-3.5" : size === "lg" ? "h-5 w-5" : "h-4 w-4";
|
|
@@ -23439,13 +23524,18 @@ function DataTableToolbar({
|
|
|
23439
23524
|
setDensity,
|
|
23440
23525
|
setHeaderAlign,
|
|
23441
23526
|
labels,
|
|
23442
|
-
t
|
|
23527
|
+
t,
|
|
23528
|
+
columnColorGroups,
|
|
23529
|
+
defaultVisibleKeys
|
|
23443
23530
|
}) {
|
|
23444
23531
|
const controlButtonSize = size === "lg" ? "md" : "sm";
|
|
23445
23532
|
const controlButtonClass = size === "sm" ? "h-7 px-2 text-xs" : size === "lg" ? "h-9 px-3 text-sm" : "h-8 px-2";
|
|
23446
23533
|
const iconClass = size === "sm" ? "w-3.5 h-3.5 mr-1" : "w-4 h-4 mr-1";
|
|
23447
23534
|
const captionClass = size === "sm" ? "text-xs" : size === "lg" ? "text-sm" : "text-sm";
|
|
23448
23535
|
const leafCols = React58.useMemo(() => getLeafColumns(columns), [columns]);
|
|
23536
|
+
const { groups, ungrouped } = React58.useMemo(() => groupColumnsByColorTag(leafCols, columnColorGroups), [leafCols, columnColorGroups]);
|
|
23537
|
+
const handleSelectAll = () => setVisibleCols(leafCols.map((c) => c.key));
|
|
23538
|
+
const handleDefault = () => setVisibleCols(defaultVisibleKeys);
|
|
23449
23539
|
return /* @__PURE__ */ jsxs55("div", { className: "flex items-center justify-between gap-4 mb-1", children: [
|
|
23450
23540
|
/* @__PURE__ */ jsx67("div", { className: captionClass + " text-muted-foreground", children: caption }),
|
|
23451
23541
|
/* @__PURE__ */ jsxs55("div", { className: "flex items-center gap-2", children: [
|
|
@@ -23463,7 +23553,7 @@ function DataTableToolbar({
|
|
|
23463
23553
|
]
|
|
23464
23554
|
}
|
|
23465
23555
|
),
|
|
23466
|
-
enableColumnVisibilityToggle && /* @__PURE__ */
|
|
23556
|
+
enableColumnVisibilityToggle && /* @__PURE__ */ jsxs55(
|
|
23467
23557
|
DropdownMenu_default,
|
|
23468
23558
|
{
|
|
23469
23559
|
trigger: /* @__PURE__ */ jsxs55(Button_default, { variant: "ghost", size: controlButtonSize, className: controlButtonClass, children: [
|
|
@@ -23478,19 +23568,49 @@ function DataTableToolbar({
|
|
|
23478
23568
|
) }),
|
|
23479
23569
|
labels?.columns || t("columns")
|
|
23480
23570
|
] }),
|
|
23481
|
-
children:
|
|
23482
|
-
|
|
23483
|
-
|
|
23484
|
-
onClick: ()
|
|
23485
|
-
|
|
23486
|
-
|
|
23487
|
-
children: [
|
|
23488
|
-
/* @__PURE__ */
|
|
23489
|
-
|
|
23490
|
-
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
23571
|
+
children: [
|
|
23572
|
+
/* @__PURE__ */ jsxs55("div", { className: "flex items-center gap-2 px-2 py-1.5 mb-1", children: [
|
|
23573
|
+
/* @__PURE__ */ jsx67(Button_default, { variant: "outline", size: "sm", className: "h-7 text-xs flex-1", onClick: handleSelectAll, children: labels?.selectAll || t("selectAll") || "Select All" }),
|
|
23574
|
+
/* @__PURE__ */ jsx67(Button_default, { variant: "outline", size: "sm", className: "h-7 text-xs flex-1", onClick: handleDefault, children: labels?.default || t("default") || "Default" })
|
|
23575
|
+
] }),
|
|
23576
|
+
/* @__PURE__ */ jsxs55("div", { className: "max-h-80 overflow-y-auto min-w-50", children: [
|
|
23577
|
+
groups.length > 0 && groups.map((group) => /* @__PURE__ */ jsxs55(React58.Fragment, { children: [
|
|
23578
|
+
/* @__PURE__ */ jsxs55("div", { className: "px-3 py-1.5 text-[11px] font-semibold uppercase text-muted-foreground flex items-center gap-2 mt-1 bg-accent/30 sticky top-0 z-10 backdrop-blur-sm", children: [
|
|
23579
|
+
/* @__PURE__ */ jsx67("span", { className: "w-2.5 h-2.5 rounded-full shadow-sm", style: { backgroundColor: group.colorTag } }),
|
|
23580
|
+
group.label
|
|
23581
|
+
] }),
|
|
23582
|
+
group.columns.map((c) => /* @__PURE__ */ jsxs55(
|
|
23583
|
+
DropdownMenuItem,
|
|
23584
|
+
{
|
|
23585
|
+
onClick: () => {
|
|
23586
|
+
setVisibleCols((prev) => prev.includes(c.key) ? prev.filter((k) => k !== c.key) : [...prev, c.key]);
|
|
23587
|
+
},
|
|
23588
|
+
closeOnSelect: false,
|
|
23589
|
+
children: [
|
|
23590
|
+
/* @__PURE__ */ jsx67("input", { type: "checkbox", className: "mr-2 rounded-md border-border/50", readOnly: true, checked: visibleCols.includes(c.key) }),
|
|
23591
|
+
/* @__PURE__ */ jsx67("span", { className: "truncate", children: c.title })
|
|
23592
|
+
]
|
|
23593
|
+
},
|
|
23594
|
+
c.key
|
|
23595
|
+
))
|
|
23596
|
+
] }, group.colorTag)),
|
|
23597
|
+
groups.length > 0 && ungrouped.length > 0 && /* @__PURE__ */ jsx67("div", { className: "px-3 py-1.5 text-[11px] font-semibold uppercase text-muted-foreground mt-1 bg-accent/30 sticky top-0 z-10 backdrop-blur-sm", children: t("other") || "Other" }),
|
|
23598
|
+
ungrouped.map((c) => /* @__PURE__ */ jsxs55(
|
|
23599
|
+
DropdownMenuItem,
|
|
23600
|
+
{
|
|
23601
|
+
onClick: () => {
|
|
23602
|
+
setVisibleCols((prev) => prev.includes(c.key) ? prev.filter((k) => k !== c.key) : [...prev, c.key]);
|
|
23603
|
+
},
|
|
23604
|
+
closeOnSelect: false,
|
|
23605
|
+
children: [
|
|
23606
|
+
/* @__PURE__ */ jsx67("input", { type: "checkbox", className: "mr-2 rounded-md border-border/50", readOnly: true, checked: visibleCols.includes(c.key) }),
|
|
23607
|
+
/* @__PURE__ */ jsx67("span", { className: "truncate", children: c.title })
|
|
23608
|
+
]
|
|
23609
|
+
},
|
|
23610
|
+
c.key
|
|
23611
|
+
))
|
|
23612
|
+
] })
|
|
23613
|
+
]
|
|
23494
23614
|
}
|
|
23495
23615
|
),
|
|
23496
23616
|
enableHeaderAlignToggle && /* @__PURE__ */ jsx67(
|
|
@@ -23786,7 +23906,7 @@ function useStickyColumns(visibleColumns) {
|
|
|
23786
23906
|
const getStickyHeaderClass = React63.useCallback(
|
|
23787
23907
|
(col) => {
|
|
23788
23908
|
if (!col.fixed) return "";
|
|
23789
|
-
return cn("sticky", col.fixed === "left" && "left-0", col.fixed === "right" && "right-0", getBoundaryShadowClass(col), "z-50
|
|
23909
|
+
return cn("sticky", col.fixed === "left" && "left-0", col.fixed === "right" && "right-0", getBoundaryShadowClass(col), "z-50");
|
|
23790
23910
|
},
|
|
23791
23911
|
[getBoundaryShadowClass]
|
|
23792
23912
|
);
|
|
@@ -23991,7 +24111,8 @@ function DataTable({
|
|
|
23991
24111
|
estimatedRowHeight,
|
|
23992
24112
|
overscan = 8,
|
|
23993
24113
|
enableHeaderAutoFit = true,
|
|
23994
|
-
labels
|
|
24114
|
+
labels,
|
|
24115
|
+
columnColorGroups
|
|
23995
24116
|
}) {
|
|
23996
24117
|
const t = useSmartTranslations("Common");
|
|
23997
24118
|
const [columnWidthOverrides, setColumnWidthOverrides] = React64.useState({});
|
|
@@ -23999,6 +24120,9 @@ function DataTable({
|
|
|
23999
24120
|
() => applyColumnWidthOverrides(columns, columnWidthOverrides),
|
|
24000
24121
|
[columnWidthOverrides, columns]
|
|
24001
24122
|
);
|
|
24123
|
+
const defaultVisibleKeys = React64.useMemo(() => {
|
|
24124
|
+
return getLeafColumns(columnsWithWidthOverrides).filter((col) => col.visible !== false).map((col) => col.key);
|
|
24125
|
+
}, [columnsWithWidthOverrides]);
|
|
24002
24126
|
const {
|
|
24003
24127
|
headerAlign,
|
|
24004
24128
|
setHeaderAlign,
|
|
@@ -24139,7 +24263,9 @@ function DataTable({
|
|
|
24139
24263
|
setDensity,
|
|
24140
24264
|
setHeaderAlign,
|
|
24141
24265
|
labels,
|
|
24142
|
-
t
|
|
24266
|
+
t,
|
|
24267
|
+
columnColorGroups,
|
|
24268
|
+
defaultVisibleKeys
|
|
24143
24269
|
}
|
|
24144
24270
|
),
|
|
24145
24271
|
/* @__PURE__ */ jsx68(
|
|
@@ -24793,7 +24919,7 @@ var CalloutView = ({ node, updateAttributes, selected }) => {
|
|
|
24793
24919
|
children: currentEmoji
|
|
24794
24920
|
}
|
|
24795
24921
|
),
|
|
24796
|
-
children: /* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-3 w-64 max-h-
|
|
24922
|
+
children: /* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-3 w-64 max-h-90 overflow-y-auto p-1", children: [
|
|
24797
24923
|
/* @__PURE__ */ jsx76("div", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider px-1", children: t("callout.selectEmoji") }),
|
|
24798
24924
|
/* @__PURE__ */ jsx76("div", { className: "h-44 overflow-y-auto border border-border/40 rounded-lg", children: /* @__PURE__ */ jsx76(EmojiPicker2, { onSelect: (emoji) => updateAttributes({ emoji }) }) }),
|
|
24799
24925
|
/* @__PURE__ */ jsxs62("div", { className: "border-t border-border/50 pt-2 mt-1", children: [
|
|
@@ -24977,7 +25103,7 @@ var BookmarkView = ({ node, updateAttributes, selected, editor }) => {
|
|
|
24977
25103
|
/* @__PURE__ */ jsx77("div", { className: "h-4 w-5/6 bg-muted-foreground/20 rounded" })
|
|
24978
25104
|
] }),
|
|
24979
25105
|
/* @__PURE__ */ jsx77("div", { className: "h-20 w-32 bg-muted-foreground/20 rounded-lg flex-shrink-0" })
|
|
24980
|
-
] }) : /* @__PURE__ */ jsxs63("div", { className: "flex flex-col sm:flex-row items-stretch justify-between min-h-
|
|
25106
|
+
] }) : /* @__PURE__ */ jsxs63("div", { className: "flex flex-col sm:flex-row items-stretch justify-between min-h-25", children: [
|
|
24981
25107
|
/* @__PURE__ */ jsxs63("div", { className: "flex-1 p-4 flex flex-col justify-between gap-1 min-w-0", children: [
|
|
24982
25108
|
/* @__PURE__ */ jsxs63("div", { className: "flex flex-col gap-1 min-w-0", children: [
|
|
24983
25109
|
/* @__PURE__ */ jsxs63("span", { className: "text-xs text-muted-foreground font-medium flex items-center gap-1.5 truncate", children: [
|
|
@@ -25260,7 +25386,7 @@ var FileCardView = ({ node, selected, editor, updateAttributes }) => {
|
|
|
25260
25386
|
/* @__PURE__ */ jsxs64("div", { className: "text-xs text-muted-foreground flex items-center gap-2 mt-0.5", children: [
|
|
25261
25387
|
fileSize ? /* @__PURE__ */ jsx78("span", { children: formatBytes(fileSize) }) : null,
|
|
25262
25388
|
isUploading && /* @__PURE__ */ jsx78("span", { className: cn(
|
|
25263
|
-
"font-medium truncate max-w-
|
|
25389
|
+
"font-medium truncate max-w-50",
|
|
25264
25390
|
uploadError ? "text-destructive" : "text-primary animate-pulse"
|
|
25265
25391
|
), children: uploadError ? `${t("fileCard.uploadFailed") || "T\u1EA3i l\xEAn th\u1EA5t b\u1EA1i"}: ${uploadError}` : t("fileCard.uploading") }),
|
|
25266
25392
|
isUploading && uploadError && /* @__PURE__ */ jsxs64(
|
|
@@ -32125,7 +32251,7 @@ var LinkPreviewContent = ({ editor, onEdit }) => {
|
|
|
32125
32251
|
editor.chain().focus().unsetLink().run();
|
|
32126
32252
|
};
|
|
32127
32253
|
return /* @__PURE__ */ jsxs73("div", { className: "flex items-center gap-1 p-1 max-w-sm", children: [
|
|
32128
|
-
/* @__PURE__ */ jsx87("span", { className: "text-xs text-muted-foreground font-mono px-2 truncate max-w-
|
|
32254
|
+
/* @__PURE__ */ jsx87("span", { className: "text-xs text-muted-foreground font-mono px-2 truncate max-w-45", children: url }),
|
|
32129
32255
|
/* @__PURE__ */ jsx87("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
32130
32256
|
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: handleOpen, title: t("linkPreview.open") || "Open link", children: /* @__PURE__ */ jsx87(ExternalLink3, { className: "w-4 h-4" }) }),
|
|
32131
32257
|
/* @__PURE__ */ jsx87(ToolbarButton, { onClick: onEdit, title: t("linkPreview.edit") || "Edit link", children: /* @__PURE__ */ jsx87(Edit2, { className: "w-4 h-4" }) }),
|