@underverse-ui/underverse 1.0.78 → 1.0.79
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 +11 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/api-reference.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -16375,6 +16375,7 @@ function CategoryTreeSelect(props) {
|
|
|
16375
16375
|
onNodeClick,
|
|
16376
16376
|
className,
|
|
16377
16377
|
useOverlayScrollbar = false,
|
|
16378
|
+
leafOnlySelect = false,
|
|
16378
16379
|
singleSelect = false
|
|
16379
16380
|
} = props;
|
|
16380
16381
|
const [isOpen, setIsOpen] = (0, import_react22.useState)(false);
|
|
@@ -16470,7 +16471,12 @@ function CategoryTreeSelect(props) {
|
|
|
16470
16471
|
};
|
|
16471
16472
|
const handleSelect = (categoryId, category) => {
|
|
16472
16473
|
if (viewOnly) return;
|
|
16474
|
+
const hasChildren = (childrenMap.get(categoryId) ?? []).length > 0;
|
|
16473
16475
|
onNodeClick?.(category);
|
|
16476
|
+
if (leafOnlySelect && hasChildren) {
|
|
16477
|
+
toggleExpand(categoryId);
|
|
16478
|
+
return;
|
|
16479
|
+
}
|
|
16474
16480
|
if (!props.onChange) return;
|
|
16475
16481
|
if (singleSelect) {
|
|
16476
16482
|
const onChange = props.onChange;
|
|
@@ -16504,6 +16510,7 @@ function CategoryTreeSelect(props) {
|
|
|
16504
16510
|
const hasChildren = children.length > 0;
|
|
16505
16511
|
const isExpanded = hasChildren && (isSearchMode || expandedNodes.has(category.id));
|
|
16506
16512
|
const isSelected = selectedIds.has(category.id);
|
|
16513
|
+
const isSelectable = !viewOnly && (!leafOnlySelect || !hasChildren);
|
|
16507
16514
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
16508
16515
|
"div",
|
|
16509
16516
|
{
|
|
@@ -16516,9 +16523,8 @@ function CategoryTreeSelect(props) {
|
|
|
16516
16523
|
onClick: () => !viewOnly && handleSelect(category.id, category),
|
|
16517
16524
|
className: cn(
|
|
16518
16525
|
"relative flex min-w-0 items-center gap-2.5 px-3 py-2.5 min-h-11 transition-all duration-200 rounded-3xl",
|
|
16519
|
-
|
|
16520
|
-
!
|
|
16521
|
-
!viewOnly && !isSelected && "hover:bg-accent/50",
|
|
16526
|
+
!viewOnly && (isSelectable ? "cursor-pointer" : "cursor-default"),
|
|
16527
|
+
isSelectable && !isSelected && "hover:bg-accent/50",
|
|
16522
16528
|
// Selected state - đồng bộ cho tất cả
|
|
16523
16529
|
!viewOnly && isSelected && "bg-accent/40"
|
|
16524
16530
|
),
|
|
@@ -16558,7 +16564,8 @@ function CategoryTreeSelect(props) {
|
|
|
16558
16564
|
{
|
|
16559
16565
|
className: cn(
|
|
16560
16566
|
"min-w-0 flex-1 text-sm leading-snug break-words [overflow-wrap:anywhere] transition-all duration-200",
|
|
16561
|
-
isSelected ? "font-semibold text-primary" : "text-foreground/80"
|
|
16567
|
+
isSelected ? "font-semibold text-primary" : "text-foreground/80",
|
|
16568
|
+
!isSelectable && "text-foreground"
|
|
16562
16569
|
),
|
|
16563
16570
|
children: category.name
|
|
16564
16571
|
}
|