@underverse-ui/underverse 2.0.1 → 2.0.2
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/CHANGELOG.md +10 -0
- package/api-reference.json +1 -1
- package/dist/index.cjs +40 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +40 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2116,7 +2116,7 @@ interface CategoryTreeSelectBaseProps {
|
|
|
2116
2116
|
leafOnlySelect?: boolean;
|
|
2117
2117
|
/** Virtualize the dropdown tree by rendering only visible rows. Inline/view-only trees keep recursive rendering. */
|
|
2118
2118
|
virtualized?: boolean;
|
|
2119
|
-
/** Estimated tree row height used by virtualized rendering. Default: `
|
|
2119
|
+
/** Estimated tree row height used by virtualized rendering. Default: `36`. */
|
|
2120
2120
|
estimatedItemHeight?: number;
|
|
2121
2121
|
/** Number of extra rows rendered above and below the visible range. Default: `8`. */
|
|
2122
2122
|
overscan?: number;
|
|
@@ -2149,7 +2149,7 @@ interface CategoryTreeSelectBaseProps {
|
|
|
2149
2149
|
*/
|
|
2150
2150
|
renderItemActions?: (category: Category) => React__default.ReactNode;
|
|
2151
2151
|
/**
|
|
2152
|
-
* Base left padding in rem applied to every node regardless of depth. Default: `0
|
|
2152
|
+
* Base left padding in rem applied to every node regardless of depth. Default: `0`.
|
|
2153
2153
|
*
|
|
2154
2154
|
* @remarks
|
|
2155
2155
|
* Combined with `indentSize`, the final padding of a node at a given depth is:
|
|
@@ -2161,7 +2161,7 @@ interface CategoryTreeSelectBaseProps {
|
|
|
2161
2161
|
*/
|
|
2162
2162
|
baseIndent?: number;
|
|
2163
2163
|
/**
|
|
2164
|
-
* Additional left padding in rem added per depth level. Default: `
|
|
2164
|
+
* Additional left padding in rem added per depth level. Default: `0.75`.
|
|
2165
2165
|
*
|
|
2166
2166
|
* @remarks
|
|
2167
2167
|
* Set to a smaller value (e.g. `0.75`) to reduce the visual gap between
|
|
@@ -2172,6 +2172,8 @@ interface CategoryTreeSelectBaseProps {
|
|
|
2172
2172
|
* <CategoryTreeSelect baseIndent={0.25} indentSize={0.75} />
|
|
2173
2173
|
*/
|
|
2174
2174
|
indentSize?: number;
|
|
2175
|
+
/** Show dashed vertical guide lines between parent and child levels. Default: `true`. */
|
|
2176
|
+
showTreeLines?: boolean;
|
|
2175
2177
|
borderMode?: BorderMode;
|
|
2176
2178
|
}
|
|
2177
2179
|
/** Multi-select mode. This is the default when `singleSelect` is omitted. */
|
|
@@ -2784,7 +2786,10 @@ type DataTableColumn<T> = {
|
|
|
2784
2786
|
};
|
|
2785
2787
|
render?: (value: any, record: T, index: number) => React__default.ReactNode;
|
|
2786
2788
|
width?: number | string;
|
|
2789
|
+
/** Body cell alignment for this column. Defaults to `"left"`. */
|
|
2787
2790
|
align?: "left" | "center" | "right";
|
|
2791
|
+
/** Header alignment for this column. Defaults to the table header alignment (`"center"` initially). */
|
|
2792
|
+
headerAlign?: "left" | "center" | "right";
|
|
2788
2793
|
/** Vị trí của icon sort/filter: "inline" (ngay sát text) hoặc "end" (cuối dòng). Mặc định là "end". */
|
|
2789
2794
|
iconPosition?: "inline" | "end";
|
|
2790
2795
|
visible?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -2116,7 +2116,7 @@ interface CategoryTreeSelectBaseProps {
|
|
|
2116
2116
|
leafOnlySelect?: boolean;
|
|
2117
2117
|
/** Virtualize the dropdown tree by rendering only visible rows. Inline/view-only trees keep recursive rendering. */
|
|
2118
2118
|
virtualized?: boolean;
|
|
2119
|
-
/** Estimated tree row height used by virtualized rendering. Default: `
|
|
2119
|
+
/** Estimated tree row height used by virtualized rendering. Default: `36`. */
|
|
2120
2120
|
estimatedItemHeight?: number;
|
|
2121
2121
|
/** Number of extra rows rendered above and below the visible range. Default: `8`. */
|
|
2122
2122
|
overscan?: number;
|
|
@@ -2149,7 +2149,7 @@ interface CategoryTreeSelectBaseProps {
|
|
|
2149
2149
|
*/
|
|
2150
2150
|
renderItemActions?: (category: Category) => React__default.ReactNode;
|
|
2151
2151
|
/**
|
|
2152
|
-
* Base left padding in rem applied to every node regardless of depth. Default: `0
|
|
2152
|
+
* Base left padding in rem applied to every node regardless of depth. Default: `0`.
|
|
2153
2153
|
*
|
|
2154
2154
|
* @remarks
|
|
2155
2155
|
* Combined with `indentSize`, the final padding of a node at a given depth is:
|
|
@@ -2161,7 +2161,7 @@ interface CategoryTreeSelectBaseProps {
|
|
|
2161
2161
|
*/
|
|
2162
2162
|
baseIndent?: number;
|
|
2163
2163
|
/**
|
|
2164
|
-
* Additional left padding in rem added per depth level. Default: `
|
|
2164
|
+
* Additional left padding in rem added per depth level. Default: `0.75`.
|
|
2165
2165
|
*
|
|
2166
2166
|
* @remarks
|
|
2167
2167
|
* Set to a smaller value (e.g. `0.75`) to reduce the visual gap between
|
|
@@ -2172,6 +2172,8 @@ interface CategoryTreeSelectBaseProps {
|
|
|
2172
2172
|
* <CategoryTreeSelect baseIndent={0.25} indentSize={0.75} />
|
|
2173
2173
|
*/
|
|
2174
2174
|
indentSize?: number;
|
|
2175
|
+
/** Show dashed vertical guide lines between parent and child levels. Default: `true`. */
|
|
2176
|
+
showTreeLines?: boolean;
|
|
2175
2177
|
borderMode?: BorderMode;
|
|
2176
2178
|
}
|
|
2177
2179
|
/** Multi-select mode. This is the default when `singleSelect` is omitted. */
|
|
@@ -2784,7 +2786,10 @@ type DataTableColumn<T> = {
|
|
|
2784
2786
|
};
|
|
2785
2787
|
render?: (value: any, record: T, index: number) => React__default.ReactNode;
|
|
2786
2788
|
width?: number | string;
|
|
2789
|
+
/** Body cell alignment for this column. Defaults to `"left"`. */
|
|
2787
2790
|
align?: "left" | "center" | "right";
|
|
2791
|
+
/** Header alignment for this column. Defaults to the table header alignment (`"center"` initially). */
|
|
2792
|
+
headerAlign?: "left" | "center" | "right";
|
|
2788
2793
|
/** Vị trí của icon sort/filter: "inline" (ngay sát text) hoặc "end" (cuối dòng). Mặc định là "end". */
|
|
2789
2794
|
iconPosition?: "inline" | "end";
|
|
2790
2795
|
visible?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -16682,9 +16682,8 @@ var defaultLabels = {
|
|
|
16682
16682
|
searchPlaceholder: "Search...",
|
|
16683
16683
|
noResultsText: "No results found"
|
|
16684
16684
|
};
|
|
16685
|
-
var TREE_NODE_BASE_PADDING_REM = 0
|
|
16686
|
-
var TREE_NODE_INDENT_REM =
|
|
16687
|
-
var TREE_BRANCH_OFFSET_CLASS = "ml-1.5 pl-1.5";
|
|
16685
|
+
var TREE_NODE_BASE_PADDING_REM = 0;
|
|
16686
|
+
var TREE_NODE_INDENT_REM = 0.75;
|
|
16688
16687
|
var TREE_NODE_GAP_CLASS = "gap-1.5";
|
|
16689
16688
|
var TREE_EXPANDER_PLACEHOLDER_CLASS = "w-5";
|
|
16690
16689
|
var CATEGORY_TREE_DROPDOWN_MAX_HEIGHT = 320;
|
|
@@ -16814,7 +16813,7 @@ function CategoryTreeSelect(props) {
|
|
|
16814
16813
|
useOverlayScrollbar = false,
|
|
16815
16814
|
leafOnlySelect = false,
|
|
16816
16815
|
virtualized = false,
|
|
16817
|
-
estimatedItemHeight =
|
|
16816
|
+
estimatedItemHeight = 36,
|
|
16818
16817
|
overscan = 8,
|
|
16819
16818
|
maxInitialOptions,
|
|
16820
16819
|
searchMode = "auto",
|
|
@@ -16824,6 +16823,7 @@ function CategoryTreeSelect(props) {
|
|
|
16824
16823
|
showSearchPromptWhenEmptyQuery = false,
|
|
16825
16824
|
baseIndent = TREE_NODE_BASE_PADDING_REM,
|
|
16826
16825
|
indentSize = TREE_NODE_INDENT_REM,
|
|
16826
|
+
showTreeLines = true,
|
|
16827
16827
|
renderItemActions,
|
|
16828
16828
|
singleSelect = false,
|
|
16829
16829
|
borderMode
|
|
@@ -17111,7 +17111,7 @@ function CategoryTreeSelect(props) {
|
|
|
17111
17111
|
{
|
|
17112
17112
|
ref: virtualItem ? treeVirtualizer.measureElement : void 0,
|
|
17113
17113
|
"data-index": virtualItem?.index,
|
|
17114
|
-
className: cn("min-w-0 [content-visibility:auto] [contain-intrinsic-size:
|
|
17114
|
+
className: cn("min-w-0 [content-visibility:auto] [contain-intrinsic-size:36px]", !virtualItem && "animate-in fade-in-50 duration-200"),
|
|
17115
17115
|
style: { animationDelay: virtualItem ? void 0 : `${level * 30}ms`, ...rowStyle },
|
|
17116
17116
|
children: [
|
|
17117
17117
|
/* @__PURE__ */ jsxs36(
|
|
@@ -17123,7 +17123,7 @@ function CategoryTreeSelect(props) {
|
|
|
17123
17123
|
"aria-selected": viewOnly ? void 0 : isSelected,
|
|
17124
17124
|
onClick: () => !viewOnly && handleSelect(category.id, category),
|
|
17125
17125
|
className: cn(
|
|
17126
|
-
"relative flex min-w-0 items-center
|
|
17126
|
+
"relative flex min-h-9 min-w-0 items-center rounded-3xl transition-all duration-200",
|
|
17127
17127
|
TREE_NODE_GAP_CLASS,
|
|
17128
17128
|
!viewOnly && (isSelectable ? "cursor-pointer" : "cursor-default"),
|
|
17129
17129
|
isSelectable && !isSelected && "hover:bg-accent/50",
|
|
@@ -17133,6 +17133,16 @@ function CategoryTreeSelect(props) {
|
|
|
17133
17133
|
),
|
|
17134
17134
|
style: { paddingLeft: `${level * indentSize + baseIndent}rem` },
|
|
17135
17135
|
children: [
|
|
17136
|
+
virtualItem && showTreeLines && Array.from({ length: level }, (_, ancestorLevel) => /* @__PURE__ */ jsx43(
|
|
17137
|
+
"span",
|
|
17138
|
+
{
|
|
17139
|
+
"data-tree-line": true,
|
|
17140
|
+
"aria-hidden": "true",
|
|
17141
|
+
className: "pointer-events-none absolute inset-y-0 w-px border-l border-dashed border-border/50",
|
|
17142
|
+
style: { left: `${ancestorLevel * indentSize + baseIndent + 0.5}rem` }
|
|
17143
|
+
},
|
|
17144
|
+
ancestorLevel
|
|
17145
|
+
)),
|
|
17136
17146
|
hasChildren ? /* @__PURE__ */ jsx43(
|
|
17137
17147
|
"button",
|
|
17138
17148
|
{
|
|
@@ -17181,16 +17191,23 @@ function CategoryTreeSelect(props) {
|
|
|
17181
17191
|
]
|
|
17182
17192
|
}
|
|
17183
17193
|
),
|
|
17184
|
-
!virtualItem && hasChildren && isExpanded && /* @__PURE__ */
|
|
17194
|
+
!virtualItem && hasChildren && isExpanded && /* @__PURE__ */ jsxs36(
|
|
17185
17195
|
"div",
|
|
17186
17196
|
{
|
|
17187
17197
|
role: "group",
|
|
17188
|
-
className:
|
|
17189
|
-
|
|
17190
|
-
|
|
17191
|
-
|
|
17192
|
-
|
|
17193
|
-
|
|
17198
|
+
className: "relative animate-in fade-in-50 slide-in-from-top-2 duration-200",
|
|
17199
|
+
children: [
|
|
17200
|
+
showTreeLines && /* @__PURE__ */ jsx43(
|
|
17201
|
+
"span",
|
|
17202
|
+
{
|
|
17203
|
+
"data-tree-line": true,
|
|
17204
|
+
"aria-hidden": "true",
|
|
17205
|
+
className: "pointer-events-none absolute inset-y-0 w-px border-l border-dashed border-border/50",
|
|
17206
|
+
style: { left: `${level * indentSize + baseIndent + 0.5}rem` }
|
|
17207
|
+
}
|
|
17208
|
+
),
|
|
17209
|
+
children.map((child) => renderCategoryRow(child, level + 1))
|
|
17210
|
+
]
|
|
17194
17211
|
}
|
|
17195
17212
|
)
|
|
17196
17213
|
]
|
|
@@ -21324,6 +21341,7 @@ function DataTableBodyRows({
|
|
|
21324
21341
|
style: getStickyColumnStyle(col),
|
|
21325
21342
|
className: cn(
|
|
21326
21343
|
cellPadding,
|
|
21344
|
+
(!col.align || col.align === "left") && "text-left",
|
|
21327
21345
|
col.align === "right" && "text-right",
|
|
21328
21346
|
col.align === "center" && "text-center",
|
|
21329
21347
|
showBorderLeft && "border-l border-border/60",
|
|
@@ -21525,16 +21543,17 @@ function DataTableHeader({
|
|
|
21525
21543
|
className: cn(
|
|
21526
21544
|
"flex items-center gap-1",
|
|
21527
21545
|
headerMinHeightClass,
|
|
21528
|
-
col.
|
|
21529
|
-
col.
|
|
21530
|
-
|
|
21546
|
+
(col.headerAlign ?? headerAlign) === "right" && "justify-end",
|
|
21547
|
+
(col.headerAlign ?? headerAlign) === "center" && "justify-center",
|
|
21548
|
+
(col.headerAlign ?? headerAlign) === "left" && "justify-start"
|
|
21531
21549
|
),
|
|
21532
21550
|
children: /* @__PURE__ */ jsx58("span", { className: cn("font-medium whitespace-nowrap select-text", headerTitleClass), children: col.title })
|
|
21533
21551
|
}
|
|
21534
21552
|
);
|
|
21535
21553
|
}
|
|
21536
|
-
const
|
|
21537
|
-
const
|
|
21554
|
+
const resolvedHeaderAlign = col.headerAlign ?? headerAlign;
|
|
21555
|
+
const isRightAlign = resolvedHeaderAlign === "right";
|
|
21556
|
+
const isCenterAlign = resolvedHeaderAlign === "center";
|
|
21538
21557
|
const columnLabel = getColumnLabel(col.title) || col.key;
|
|
21539
21558
|
const sortByText = sortByLabel ?? gi18n.sortBy ?? "Sort by";
|
|
21540
21559
|
const sortLabel = `${sortByText} ${columnLabel}`;
|
|
@@ -21696,8 +21715,8 @@ function DataTableHeader({
|
|
|
21696
21715
|
},
|
|
21697
21716
|
className: cn(
|
|
21698
21717
|
"relative",
|
|
21699
|
-
(col.
|
|
21700
|
-
(col.
|
|
21718
|
+
(col.headerAlign ?? headerAlign) === "right" && "text-right",
|
|
21719
|
+
(col.headerAlign ?? headerAlign) === "center" && "text-center",
|
|
21701
21720
|
showBorderLeft && "border-l border-border/60",
|
|
21702
21721
|
getStickyHeaderClass(col)
|
|
21703
21722
|
),
|
|
@@ -22217,7 +22236,7 @@ function useDataTableState({
|
|
|
22217
22236
|
const allLeafColumns = React56.useMemo(() => getLeafColumns(columns), [columns]);
|
|
22218
22237
|
const defaultVisibleLeafKeys = React56.useMemo(() => allLeafColumns.filter((column) => column.visible !== false).map((column) => column.key), [allLeafColumns]);
|
|
22219
22238
|
const knownLeafKeysRef = React56.useRef(new Set(defaultVisibleLeafKeys));
|
|
22220
|
-
const [headerAlign, setHeaderAlign] = React56.useState("
|
|
22239
|
+
const [headerAlign, setHeaderAlign] = React56.useState("center");
|
|
22221
22240
|
const [visibleCols, setVisibleCols] = React56.useState(defaultVisibleLeafKeys);
|
|
22222
22241
|
const [filters, setFilters] = React56.useState({});
|
|
22223
22242
|
const [sort, setSort] = React56.useState(null);
|