@sia.soul/sia-react-ui 0.1.27 → 0.1.28
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/dist/{chunk-5MW3NE2V.js → chunk-DQYNL6VZ.js} +62 -10
- package/dist/{chunk-NAOV53NK.js → chunk-NEYUBLLB.js} +1 -1
- package/dist/{chunk-IQU4GGLM.js → chunk-T2EKKSCH.js} +1 -1
- package/dist/{core-BM-wnJRa.d.cts → core-CTe-Sfl1.d.cts} +5 -3
- package/dist/{core-CLqv6btD.d.ts → core-DlvCqFU7.d.ts} +5 -3
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +2 -2
- package/dist/index.cjs +64 -12
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/select-date-range.js +2 -2
- package/package.json +1 -1
|
@@ -93,6 +93,61 @@ var Checkbox2 = Object.assign(CheckboxRoot, {
|
|
|
93
93
|
Group: CheckboxGroup
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
+
// src/components/treeCheckState.ts
|
|
97
|
+
function affectedKeys(node) {
|
|
98
|
+
if (node.disabled || node.disableCheckbox) return [];
|
|
99
|
+
return [...node.checkable === false ? [] : [node.key], ...node.children?.flatMap(affectedKeys) ?? []];
|
|
100
|
+
}
|
|
101
|
+
function getTreeCheckState(nodes, keys, strictly = false) {
|
|
102
|
+
const checked = new Set(keys);
|
|
103
|
+
const halfChecked = /* @__PURE__ */ new Set();
|
|
104
|
+
if (strictly) return { checked, halfChecked };
|
|
105
|
+
const explicit = new Set(keys);
|
|
106
|
+
function expand(items) {
|
|
107
|
+
for (const node of items) {
|
|
108
|
+
if (explicit.has(node.key)) affectedKeys(node).forEach((key) => checked.add(key));
|
|
109
|
+
if (node.children) expand(node.children);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
expand(nodes);
|
|
113
|
+
function fold(node) {
|
|
114
|
+
const children = node.children?.map(fold).filter((value) => value !== void 0) ?? [];
|
|
115
|
+
if (node.disabled || node.disableCheckbox) return void 0;
|
|
116
|
+
if (!children.length) return { checked: checked.has(node.key), partial: false };
|
|
117
|
+
const all = children.every((child) => child.checked);
|
|
118
|
+
const some = children.some((child) => child.checked || child.partial);
|
|
119
|
+
if (node.checkable !== false) {
|
|
120
|
+
if (all) checked.add(node.key);
|
|
121
|
+
else checked.delete(node.key);
|
|
122
|
+
if (!all && some) halfChecked.add(node.key);
|
|
123
|
+
}
|
|
124
|
+
return { checked: all, partial: !all && some };
|
|
125
|
+
}
|
|
126
|
+
nodes.forEach(fold);
|
|
127
|
+
return { checked, halfChecked };
|
|
128
|
+
}
|
|
129
|
+
function toggleTreeCheck(nodes, keys, node, strictly = false) {
|
|
130
|
+
const state = getTreeCheckState(nodes, keys, strictly);
|
|
131
|
+
const next = new Set(state.checked);
|
|
132
|
+
const checked = !next.has(node.key);
|
|
133
|
+
if (node.disabled || node.disableCheckbox || node.checkable === false) return { ...state, checkedValue: !checked };
|
|
134
|
+
(strictly ? [node.key] : affectedKeys(node)).forEach((key) => checked ? next.add(key) : next.delete(key));
|
|
135
|
+
if (!strictly && !checked) {
|
|
136
|
+
let removeParents2 = function(items) {
|
|
137
|
+
let found = false;
|
|
138
|
+
for (const item of items) {
|
|
139
|
+
const childFound = item.children ? removeParents2(item.children) : false;
|
|
140
|
+
if (childFound) next.delete(item.key);
|
|
141
|
+
if (item.key === node.key || childFound) found = true;
|
|
142
|
+
}
|
|
143
|
+
return found;
|
|
144
|
+
};
|
|
145
|
+
var removeParents = removeParents2;
|
|
146
|
+
removeParents2(nodes);
|
|
147
|
+
}
|
|
148
|
+
return { ...getTreeCheckState(nodes, [...next], strictly), checkedValue: checked };
|
|
149
|
+
}
|
|
150
|
+
|
|
96
151
|
// src/components/FloatingDisplay.tsx
|
|
97
152
|
import { cloneElement, useEffect as useEffect2, useId as useId2, useLayoutEffect, useMemo as useMemo2, useRef as useRef2, useState } from "react";
|
|
98
153
|
import { createPortal } from "react-dom";
|
|
@@ -306,9 +361,6 @@ function collectKeys(nodes, branchOnly = false, result = []) {
|
|
|
306
361
|
});
|
|
307
362
|
return result;
|
|
308
363
|
}
|
|
309
|
-
function descendants(node) {
|
|
310
|
-
return node.children ? collectKeys(node.children) : [];
|
|
311
|
-
}
|
|
312
364
|
function Tree({
|
|
313
365
|
treeData,
|
|
314
366
|
selectedKeys,
|
|
@@ -379,12 +431,11 @@ function Tree({
|
|
|
379
431
|
setExpanded(next);
|
|
380
432
|
onExpand?.([...next], { expanded: nextExpanded, node });
|
|
381
433
|
}
|
|
434
|
+
const checkState = useMemo2(() => getTreeCheckState(treeData, checked, checkStrictly), [treeData, checked, checkStrictly]);
|
|
382
435
|
function check(node) {
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
setChecked(next);
|
|
387
|
-
onCheck?.([...next], { checked: !nodeChecked, node });
|
|
436
|
+
const next = toggleTreeCheck(treeData, checked, node, checkStrictly);
|
|
437
|
+
setChecked([...next.checked]);
|
|
438
|
+
onCheck?.([...next.checked], { checked: next.checkedValue, halfCheckedKeys: [...next.halfChecked], node });
|
|
388
439
|
}
|
|
389
440
|
function select(node, event) {
|
|
390
441
|
if (!selectable || node.selectable === false || node.disabled) return;
|
|
@@ -467,7 +518,8 @@ function Tree({
|
|
|
467
518
|
const open = expanded.includes(node.key);
|
|
468
519
|
const isSelected = selected.includes(node.key);
|
|
469
520
|
const isSelectedAncestor = selectedAncestorKeys.has(node.key);
|
|
470
|
-
const isChecked = checked.
|
|
521
|
+
const isChecked = checkState.checked.has(node.key);
|
|
522
|
+
const isHalfChecked = checkState.halfChecked.has(node.key);
|
|
471
523
|
const hasChildren = Boolean(node.children?.length || node.isLeaf === false);
|
|
472
524
|
const nodeLoading = loading.has(node.key) || controlledLoading.has(node.key);
|
|
473
525
|
const sticky = stickyAncestors && hasChildren && open;
|
|
@@ -502,7 +554,7 @@ function Tree({
|
|
|
502
554
|
event.stopPropagation();
|
|
503
555
|
void toggleExpand(node);
|
|
504
556
|
}, children: nodeLoading ? /* @__PURE__ */ jsx2(Icon, { name: "loader", className: "sia-spin-icon", size: 13 }) : /* @__PURE__ */ jsx2(Icon, { name: open ? "chevron-down" : "chevron-right", size: 13 }) }) : /* @__PURE__ */ jsx2("span", { className: "sia-tree__switcher", "aria-label": open ? "\u6536\u8D77\u8282\u70B9" : "\u5C55\u5F00\u8282\u70B9", "aria-expanded": open, style: { width: normalizedSwitcherWidth, flexBasis: normalizedSwitcherWidth }, "aria-hidden": "true" }),
|
|
505
|
-
checkable || node.checkable ? /* @__PURE__ */ jsx2("span", { onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx2(Checkbox2, { checked: isChecked, disabled: node.disabled || node.disableCheckbox, onChange: () => check(node) }) }) : null,
|
|
557
|
+
checkable || node.checkable ? /* @__PURE__ */ jsx2("span", { onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx2(Checkbox2, { checked: isChecked, indeterminate: isHalfChecked, disabled: node.disabled || node.disableCheckbox, onChange: () => check(node) }) }) : null,
|
|
506
558
|
node.prefix ? /* @__PURE__ */ jsx2("span", { className: "sia-tree__prefix", onClick: (event) => event.stopPropagation(), children: node.prefix }) : null,
|
|
507
559
|
showIcon ? /* @__PURE__ */ jsx2("span", { className: "sia-tree__icon", children: node.icon ?? /* @__PURE__ */ jsx2(Icon, { name: hasChildren ? "folder" : "file", size: 15 }) }) : null,
|
|
508
560
|
/* @__PURE__ */ jsx2(
|
|
@@ -983,7 +983,7 @@ interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect" | "o
|
|
|
983
983
|
* @defaultValue false
|
|
984
984
|
*/
|
|
985
985
|
defaultExpandAll?: boolean;
|
|
986
|
-
/**
|
|
986
|
+
/** 受控勾选键;非独立模式自动向下关联子节点、向上汇总父节点及半选,禁用节点阻断传播。通过 onCheck 同步更新。 */
|
|
987
987
|
checkedKeys?: readonly TreeKey[];
|
|
988
988
|
/**
|
|
989
989
|
* 非受控模式下初始勾选的节点标识。
|
|
@@ -1001,7 +1001,7 @@ interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect" | "o
|
|
|
1001
1001
|
*/
|
|
1002
1002
|
checkable?: boolean;
|
|
1003
1003
|
/**
|
|
1004
|
-
*
|
|
1004
|
+
* 为 true 时父子独立;为 false 时父子联动,并显示部分子项选中的半选状态。
|
|
1005
1005
|
* @defaultValue false
|
|
1006
1006
|
*/
|
|
1007
1007
|
checkStrictly?: boolean;
|
|
@@ -1066,10 +1066,12 @@ interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect" | "o
|
|
|
1066
1066
|
/** 触发本次操作的原生事件。 */
|
|
1067
1067
|
nativeEvent: React.MouseEvent;
|
|
1068
1068
|
}) => void;
|
|
1069
|
-
/**
|
|
1069
|
+
/** 用户切换勾选时调用;keys 为联动后的完整选中键,info.halfCheckedKeys 为半选父节点。 */
|
|
1070
1070
|
onCheck?: (keys: TreeKey[], info: {
|
|
1071
1071
|
/** 当前是否勾选;作为受控属性时通过回调更新。 */
|
|
1072
1072
|
checked: boolean;
|
|
1073
|
+
/** 联动计算后处于半选状态的节点键;独立模式为空数组。 */
|
|
1074
|
+
halfCheckedKeys: TreeKey[];
|
|
1073
1075
|
/** 当前操作关联的节点数据。 */
|
|
1074
1076
|
node: TreeNode;
|
|
1075
1077
|
}) => void;
|
|
@@ -983,7 +983,7 @@ interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect" | "o
|
|
|
983
983
|
* @defaultValue false
|
|
984
984
|
*/
|
|
985
985
|
defaultExpandAll?: boolean;
|
|
986
|
-
/**
|
|
986
|
+
/** 受控勾选键;非独立模式自动向下关联子节点、向上汇总父节点及半选,禁用节点阻断传播。通过 onCheck 同步更新。 */
|
|
987
987
|
checkedKeys?: readonly TreeKey[];
|
|
988
988
|
/**
|
|
989
989
|
* 非受控模式下初始勾选的节点标识。
|
|
@@ -1001,7 +1001,7 @@ interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect" | "o
|
|
|
1001
1001
|
*/
|
|
1002
1002
|
checkable?: boolean;
|
|
1003
1003
|
/**
|
|
1004
|
-
*
|
|
1004
|
+
* 为 true 时父子独立;为 false 时父子联动,并显示部分子项选中的半选状态。
|
|
1005
1005
|
* @defaultValue false
|
|
1006
1006
|
*/
|
|
1007
1007
|
checkStrictly?: boolean;
|
|
@@ -1066,10 +1066,12 @@ interface TreeProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect" | "o
|
|
|
1066
1066
|
/** 触发本次操作的原生事件。 */
|
|
1067
1067
|
nativeEvent: React.MouseEvent;
|
|
1068
1068
|
}) => void;
|
|
1069
|
-
/**
|
|
1069
|
+
/** 用户切换勾选时调用;keys 为联动后的完整选中键,info.halfCheckedKeys 为半选父节点。 */
|
|
1070
1070
|
onCheck?: (keys: TreeKey[], info: {
|
|
1071
1071
|
/** 当前是否勾选;作为受控属性时通过回调更新。 */
|
|
1072
1072
|
checked: boolean;
|
|
1073
|
+
/** 联动计算后处于半选状态的节点键;独立模式为空数组。 */
|
|
1074
|
+
halfCheckedKeys: TreeKey[];
|
|
1073
1075
|
/** 当前操作关联的节点数据。 */
|
|
1074
1076
|
node: TreeNode;
|
|
1075
1077
|
}) => void;
|
package/dist/core.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, T as TagStatus, az as TagVariant, aD as Toolbar, aE as ToolbarItem, aF as ToolbarProps, aQ as Typography, aR as TypographyLinkProps, aS as TypographyProps, aT as TypographyTitleProps, aU as TypographyType, aV as Upload, aW as UploadChangeInfo, aX as UploadDraggerProps, aY as UploadFile, aZ as UploadFileStatus, a_ as UploadProps, a$ as UploadRequestOptions, b3 as message } from './core-
|
|
1
|
+
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, T as TagStatus, az as TagVariant, aD as Toolbar, aE as ToolbarItem, aF as ToolbarProps, aQ as Typography, aR as TypographyLinkProps, aS as TypographyProps, aT as TypographyTitleProps, aU as TypographyType, aV as Upload, aW as UploadChangeInfo, aX as UploadDraggerProps, aY as UploadFile, aZ as UploadFileStatus, a_ as UploadProps, a$ as UploadRequestOptions, b3 as message } from './core-CTe-Sfl1.cjs';
|
|
2
2
|
export { f as Button, B as ButtonProps, e as ButtonSize, g as ButtonVariant, h as Modal, d as ModalActionResult, M as ModalOpenConfig, i as ModalProps, j as ModalType, a as OverlayApiHandle, k as Select, S as SelectOption, c as SelectProps, m as SelectValue } from './Select-YJbT-MF1.cjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './shared-Bx4B28Wh.cjs';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, T as TagStatus, az as TagVariant, aD as Toolbar, aE as ToolbarItem, aF as ToolbarProps, aQ as Typography, aR as TypographyLinkProps, aS as TypographyProps, aT as TypographyTitleProps, aU as TypographyType, aV as Upload, aW as UploadChangeInfo, aX as UploadDraggerProps, aY as UploadFile, aZ as UploadFileStatus, a_ as UploadProps, a$ as UploadRequestOptions, b3 as message } from './core-
|
|
1
|
+
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, T as TagStatus, az as TagVariant, aD as Toolbar, aE as ToolbarItem, aF as ToolbarProps, aQ as Typography, aR as TypographyLinkProps, aS as TypographyProps, aT as TypographyTitleProps, aU as TypographyType, aV as Upload, aW as UploadChangeInfo, aX as UploadDraggerProps, aY as UploadFile, aZ as UploadFileStatus, a_ as UploadProps, a$ as UploadRequestOptions, b3 as message } from './core-DlvCqFU7.js';
|
|
2
2
|
export { f as Button, B as ButtonProps, e as ButtonSize, g as ButtonVariant, h as Modal, d as ModalActionResult, M as ModalOpenConfig, i as ModalProps, j as ModalType, a as OverlayApiHandle, k as Select, S as SelectOption, c as SelectProps, m as SelectValue } from './Select-CCrPqULn.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './shared-Bx4B28Wh.js';
|
package/dist/core.js
CHANGED
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
Typography,
|
|
11
11
|
Upload,
|
|
12
12
|
message
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-NEYUBLLB.js";
|
|
14
14
|
import "./chunk-YQDHCORW.js";
|
|
15
15
|
import {
|
|
16
16
|
Modal,
|
|
17
17
|
Select
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-DQYNL6VZ.js";
|
|
19
19
|
import {
|
|
20
20
|
Icon,
|
|
21
21
|
Input,
|
package/dist/index.cjs
CHANGED
|
@@ -2432,6 +2432,61 @@ var Checkbox2 = Object.assign(CheckboxRoot, {
|
|
|
2432
2432
|
// src/components/SelectionPanel.tsx
|
|
2433
2433
|
var import_react17 = require("react");
|
|
2434
2434
|
|
|
2435
|
+
// src/components/treeCheckState.ts
|
|
2436
|
+
function affectedKeys(node) {
|
|
2437
|
+
if (node.disabled || node.disableCheckbox) return [];
|
|
2438
|
+
return [...node.checkable === false ? [] : [node.key], ...node.children?.flatMap(affectedKeys) ?? []];
|
|
2439
|
+
}
|
|
2440
|
+
function getTreeCheckState(nodes, keys, strictly = false) {
|
|
2441
|
+
const checked = new Set(keys);
|
|
2442
|
+
const halfChecked = /* @__PURE__ */ new Set();
|
|
2443
|
+
if (strictly) return { checked, halfChecked };
|
|
2444
|
+
const explicit = new Set(keys);
|
|
2445
|
+
function expand(items) {
|
|
2446
|
+
for (const node of items) {
|
|
2447
|
+
if (explicit.has(node.key)) affectedKeys(node).forEach((key) => checked.add(key));
|
|
2448
|
+
if (node.children) expand(node.children);
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
expand(nodes);
|
|
2452
|
+
function fold(node) {
|
|
2453
|
+
const children = node.children?.map(fold).filter((value) => value !== void 0) ?? [];
|
|
2454
|
+
if (node.disabled || node.disableCheckbox) return void 0;
|
|
2455
|
+
if (!children.length) return { checked: checked.has(node.key), partial: false };
|
|
2456
|
+
const all = children.every((child) => child.checked);
|
|
2457
|
+
const some = children.some((child) => child.checked || child.partial);
|
|
2458
|
+
if (node.checkable !== false) {
|
|
2459
|
+
if (all) checked.add(node.key);
|
|
2460
|
+
else checked.delete(node.key);
|
|
2461
|
+
if (!all && some) halfChecked.add(node.key);
|
|
2462
|
+
}
|
|
2463
|
+
return { checked: all, partial: !all && some };
|
|
2464
|
+
}
|
|
2465
|
+
nodes.forEach(fold);
|
|
2466
|
+
return { checked, halfChecked };
|
|
2467
|
+
}
|
|
2468
|
+
function toggleTreeCheck(nodes, keys, node, strictly = false) {
|
|
2469
|
+
const state = getTreeCheckState(nodes, keys, strictly);
|
|
2470
|
+
const next = new Set(state.checked);
|
|
2471
|
+
const checked = !next.has(node.key);
|
|
2472
|
+
if (node.disabled || node.disableCheckbox || node.checkable === false) return { ...state, checkedValue: !checked };
|
|
2473
|
+
(strictly ? [node.key] : affectedKeys(node)).forEach((key) => checked ? next.add(key) : next.delete(key));
|
|
2474
|
+
if (!strictly && !checked) {
|
|
2475
|
+
let removeParents2 = function(items) {
|
|
2476
|
+
let found = false;
|
|
2477
|
+
for (const item of items) {
|
|
2478
|
+
const childFound = item.children ? removeParents2(item.children) : false;
|
|
2479
|
+
if (childFound) next.delete(item.key);
|
|
2480
|
+
if (item.key === node.key || childFound) found = true;
|
|
2481
|
+
}
|
|
2482
|
+
return found;
|
|
2483
|
+
};
|
|
2484
|
+
var removeParents = removeParents2;
|
|
2485
|
+
removeParents2(nodes);
|
|
2486
|
+
}
|
|
2487
|
+
return { ...getTreeCheckState(nodes, [...next], strictly), checkedValue: checked };
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2435
2490
|
// src/components/FloatingDisplay.tsx
|
|
2436
2491
|
var import_react14 = require("react");
|
|
2437
2492
|
var import_react_dom3 = require("react-dom");
|
|
@@ -2645,9 +2700,6 @@ function collectKeys(nodes, branchOnly = false, result = []) {
|
|
|
2645
2700
|
});
|
|
2646
2701
|
return result;
|
|
2647
2702
|
}
|
|
2648
|
-
function descendants(node) {
|
|
2649
|
-
return node.children ? collectKeys(node.children) : [];
|
|
2650
|
-
}
|
|
2651
2703
|
function Tree({
|
|
2652
2704
|
treeData,
|
|
2653
2705
|
selectedKeys,
|
|
@@ -2718,12 +2770,11 @@ function Tree({
|
|
|
2718
2770
|
setExpanded(next);
|
|
2719
2771
|
onExpand?.([...next], { expanded: nextExpanded, node });
|
|
2720
2772
|
}
|
|
2773
|
+
const checkState = (0, import_react14.useMemo)(() => getTreeCheckState(treeData, checked, checkStrictly), [treeData, checked, checkStrictly]);
|
|
2721
2774
|
function check(node) {
|
|
2722
|
-
const
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
setChecked(next);
|
|
2726
|
-
onCheck?.([...next], { checked: !nodeChecked, node });
|
|
2775
|
+
const next = toggleTreeCheck(treeData, checked, node, checkStrictly);
|
|
2776
|
+
setChecked([...next.checked]);
|
|
2777
|
+
onCheck?.([...next.checked], { checked: next.checkedValue, halfCheckedKeys: [...next.halfChecked], node });
|
|
2727
2778
|
}
|
|
2728
2779
|
function select(node, event) {
|
|
2729
2780
|
if (!selectable || node.selectable === false || node.disabled) return;
|
|
@@ -2806,7 +2857,8 @@ function Tree({
|
|
|
2806
2857
|
const open = expanded.includes(node.key);
|
|
2807
2858
|
const isSelected = selected.includes(node.key);
|
|
2808
2859
|
const isSelectedAncestor = selectedAncestorKeys.has(node.key);
|
|
2809
|
-
const isChecked = checked.
|
|
2860
|
+
const isChecked = checkState.checked.has(node.key);
|
|
2861
|
+
const isHalfChecked = checkState.halfChecked.has(node.key);
|
|
2810
2862
|
const hasChildren = Boolean(node.children?.length || node.isLeaf === false);
|
|
2811
2863
|
const nodeLoading = loading.has(node.key) || controlledLoading.has(node.key);
|
|
2812
2864
|
const sticky = stickyAncestors && hasChildren && open;
|
|
@@ -2841,7 +2893,7 @@ function Tree({
|
|
|
2841
2893
|
event.stopPropagation();
|
|
2842
2894
|
void toggleExpand(node);
|
|
2843
2895
|
}, children: nodeLoading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: "loader", className: "sia-spin-icon", size: 13 }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: open ? "chevron-down" : "chevron-right", size: 13 }) }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sia-tree__switcher", "aria-label": open ? "\u6536\u8D77\u8282\u70B9" : "\u5C55\u5F00\u8282\u70B9", "aria-expanded": open, style: { width: normalizedSwitcherWidth, flexBasis: normalizedSwitcherWidth }, "aria-hidden": "true" }),
|
|
2844
|
-
checkable || node.checkable ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Checkbox2, { checked: isChecked, disabled: node.disabled || node.disableCheckbox, onChange: () => check(node) }) }) : null,
|
|
2896
|
+
checkable || node.checkable ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Checkbox2, { checked: isChecked, indeterminate: isHalfChecked, disabled: node.disabled || node.disableCheckbox, onChange: () => check(node) }) }) : null,
|
|
2845
2897
|
node.prefix ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sia-tree__prefix", onClick: (event) => event.stopPropagation(), children: node.prefix }) : null,
|
|
2846
2898
|
showIcon ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sia-tree__icon", children: node.icon ?? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: hasChildren ? "folder" : "file", size: 15 }) }) : null,
|
|
2847
2899
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
@@ -13655,9 +13707,9 @@ function buildHeaderRows(columns) {
|
|
|
13655
13707
|
const colSpan = countLeaves(column);
|
|
13656
13708
|
if (colSpan === 0) continue;
|
|
13657
13709
|
const leaf = !column.children?.length;
|
|
13658
|
-
const
|
|
13710
|
+
const descendants = flattenTableColumns([column]);
|
|
13659
13711
|
const segments = [];
|
|
13660
|
-
for (const descendant of
|
|
13712
|
+
for (const descendant of descendants) {
|
|
13661
13713
|
const previous = segments[segments.length - 1];
|
|
13662
13714
|
if (previous && normalizeFixed(previous[0].fixed) === normalizeFixed(descendant.fixed)) previous.push(descendant);
|
|
13663
13715
|
else segments.push([descendant]);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TagStatus, B as BadgeProps } from './core-
|
|
2
|
-
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagVariant, aA as Timeline, aB as TimelineItem, aC as TimelineProps, aD as Toolbar, aE as ToolbarItem, aF as ToolbarProps, aG as Tooltip, aH as TooltipProps, aI as Tour, aJ as TourProps, aK as TourStep, aL as Tree, aM as TreeDropPosition, aN as TreeKey, aO as TreeNode, aP as TreeProps, aQ as Typography, aR as TypographyLinkProps, aS as TypographyProps, aT as TypographyTitleProps, aU as TypographyType, aV as Upload, aW as UploadChangeInfo, aX as UploadDraggerProps, aY as UploadFile, aZ as UploadFileStatus, a_ as UploadProps, a$ as UploadRequestOptions, b0 as Watermark, b1 as WatermarkFont, b2 as WatermarkProps, b3 as message, b4 as notification } from './core-
|
|
1
|
+
import { T as TagStatus, B as BadgeProps } from './core-CTe-Sfl1.cjs';
|
|
2
|
+
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagVariant, aA as Timeline, aB as TimelineItem, aC as TimelineProps, aD as Toolbar, aE as ToolbarItem, aF as ToolbarProps, aG as Tooltip, aH as TooltipProps, aI as Tour, aJ as TourProps, aK as TourStep, aL as Tree, aM as TreeDropPosition, aN as TreeKey, aO as TreeNode, aP as TreeProps, aQ as Typography, aR as TypographyLinkProps, aS as TypographyProps, aT as TypographyTitleProps, aU as TypographyType, aV as Upload, aW as UploadChangeInfo, aX as UploadDraggerProps, aY as UploadFile, aZ as UploadFileStatus, a_ as UploadProps, a$ as UploadRequestOptions, b0 as Watermark, b1 as WatermarkFont, b2 as WatermarkProps, b3 as message, b4 as notification } from './core-CTe-Sfl1.cjs';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
5
5
|
import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TagStatus, B as BadgeProps } from './core-
|
|
2
|
-
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagVariant, aA as Timeline, aB as TimelineItem, aC as TimelineProps, aD as Toolbar, aE as ToolbarItem, aF as ToolbarProps, aG as Tooltip, aH as TooltipProps, aI as Tour, aJ as TourProps, aK as TourStep, aL as Tree, aM as TreeDropPosition, aN as TreeKey, aO as TreeNode, aP as TreeProps, aQ as Typography, aR as TypographyLinkProps, aS as TypographyProps, aT as TypographyTitleProps, aU as TypographyType, aV as Upload, aW as UploadChangeInfo, aX as UploadDraggerProps, aY as UploadFile, aZ as UploadFileStatus, a_ as UploadProps, a$ as UploadRequestOptions, b0 as Watermark, b1 as WatermarkFont, b2 as WatermarkProps, b3 as message, b4 as notification } from './core-
|
|
1
|
+
import { T as TagStatus, B as BadgeProps } from './core-DlvCqFU7.js';
|
|
2
|
+
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagVariant, aA as Timeline, aB as TimelineItem, aC as TimelineProps, aD as Toolbar, aE as ToolbarItem, aF as ToolbarProps, aG as Tooltip, aH as TooltipProps, aI as Tour, aJ as TourProps, aK as TourStep, aL as Tree, aM as TreeDropPosition, aN as TreeKey, aO as TreeNode, aP as TreeProps, aQ as Typography, aR as TypographyLinkProps, aS as TypographyProps, aT as TypographyTitleProps, aU as TypographyType, aV as Upload, aW as UploadChangeInfo, aX as UploadDraggerProps, aY as UploadFile, aZ as UploadFileStatus, a_ as UploadProps, a$ as UploadRequestOptions, b0 as Watermark, b1 as WatermarkFont, b2 as WatermarkProps, b3 as message, b4 as notification } from './core-DlvCqFU7.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
5
5
|
import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.js';
|
package/dist/index.js
CHANGED
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
Watermark,
|
|
81
81
|
message,
|
|
82
82
|
notification
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-NEYUBLLB.js";
|
|
84
84
|
import {
|
|
85
85
|
TextArea
|
|
86
86
|
} from "./chunk-YQDHCORW.js";
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
DatePicker,
|
|
96
96
|
SelectDateRange,
|
|
97
97
|
TimePanel
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-T2EKKSCH.js";
|
|
99
99
|
import {
|
|
100
100
|
Checkbox,
|
|
101
101
|
FloatingScrollbarProvider,
|
|
@@ -110,7 +110,7 @@ import {
|
|
|
110
110
|
Tree,
|
|
111
111
|
useOverlayLifecycle,
|
|
112
112
|
useScrollbarProximity
|
|
113
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-DQYNL6VZ.js";
|
|
114
114
|
import {
|
|
115
115
|
Dropdown,
|
|
116
116
|
FILLED_ICON_NAMES,
|