@expcat/tigercat-react 1.3.3 → 1.4.0
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-3SV6J7I5.mjs → chunk-2L7QEOFD.mjs} +34 -25
- package/dist/{chunk-FNJDBFKM.mjs → chunk-2LYV6NBJ.mjs} +6 -1
- package/dist/{chunk-EEWHWEYO.js → chunk-2RBHQBSG.js} +2 -2
- package/dist/{chunk-Y5RQN5BO.mjs → chunk-376X7SDZ.mjs} +2 -2
- package/dist/{chunk-UXUYCWQC.js → chunk-3EDASNTG.js} +5 -5
- package/dist/{chunk-NPTXXUXF.mjs → chunk-3RBRWBUG.mjs} +9 -7
- package/dist/{chunk-PUZDW7NR.js → chunk-4AMSYFYC.js} +134 -20
- package/dist/{chunk-IG75YSX3.mjs → chunk-4MONGWU5.mjs} +4 -6
- package/dist/{chunk-3CJFNG54.mjs → chunk-56CTXEJS.mjs} +1 -1
- package/dist/{chunk-TMON4MPO.js → chunk-5ALMTE35.js} +9 -7
- package/dist/{chunk-MSHCPJIJ.mjs → chunk-6BOSSZM3.mjs} +8 -9
- package/dist/{chunk-SIY6FDKJ.js → chunk-7CHTTM6D.js} +339 -314
- package/dist/{chunk-RF2BA2N6.js → chunk-7PXALKLM.js} +4 -4
- package/dist/{chunk-DLKUDB2R.js → chunk-AF2AEZKM.js} +15 -3
- package/dist/{chunk-FB34UWF7.mjs → chunk-AVLIUHOS.mjs} +101 -40
- package/dist/{chunk-TSJYAEFZ.js → chunk-B63GEB2Y.js} +358 -305
- package/dist/{chunk-CFPKK5WW.js → chunk-BA6TJQZL.js} +12 -12
- package/dist/{chunk-LMTUM3J3.js → chunk-BEM7XG2L.js} +2 -4
- package/dist/{chunk-MB6U72CI.js → chunk-BEZO5IE4.js} +2 -2
- package/dist/{chunk-5OHVTGHS.mjs → chunk-BN4ZKCAI.mjs} +368 -315
- package/dist/{chunk-UHFHOTNI.js → chunk-BRA3PO53.js} +6 -7
- package/dist/{chunk-M7HBWFQO.js → chunk-BROIZ266.js} +11 -1
- package/dist/{chunk-SDZOVRVR.mjs → chunk-CAQPYJFA.mjs} +350 -325
- package/dist/{chunk-BFAZZUD6.js → chunk-CC5GFX6F.js} +5 -22
- package/dist/{chunk-LQT6ZGME.mjs → chunk-CME2IFUT.mjs} +15 -3
- package/dist/{chunk-KQ5I7PRM.js → chunk-CNNEUJR2.js} +28 -14
- package/dist/{chunk-EF5ZTNHX.js → chunk-D5MQBUP2.js} +16 -4
- package/dist/{chunk-RQXY2MGX.mjs → chunk-D7UR526A.mjs} +231 -184
- package/dist/{chunk-CBYJXDW4.js → chunk-DBMC6FPU.js} +16 -4
- package/dist/{chunk-WQ4FOHOU.mjs → chunk-DEIVWO2D.mjs} +3 -5
- package/dist/{chunk-7QZ4XT2P.mjs → chunk-DVEK5SO6.mjs} +3 -8
- package/dist/{chunk-TC6JLEGZ.js → chunk-EJKOUI26.js} +24 -7
- package/dist/{chunk-4GITZKAH.mjs → chunk-EPJ6W4VI.mjs} +14 -2
- package/dist/{chunk-KYP7U6FK.js → chunk-FZHBVHQ6.js} +34 -25
- package/dist/{chunk-WVVXZKNI.js → chunk-GDPU5MYA.js} +3 -8
- package/dist/{chunk-2GQCFTD7.mjs → chunk-H4MPPCTB.mjs} +23 -4
- package/dist/{chunk-YOAYDEWW.mjs → chunk-HHMYERHY.mjs} +3 -20
- package/dist/{chunk-LRPPXU74.mjs → chunk-I7FEGKX2.mjs} +19 -5
- package/dist/{chunk-F6IXIH6B.mjs → chunk-IZGXDHPB.mjs} +24 -5
- package/dist/{chunk-GQFVVAEF.js → chunk-J6OZWT3P.js} +5 -5
- package/dist/{chunk-IGAMV6ML.mjs → chunk-KDXKF6B2.mjs} +1 -1
- package/dist/{chunk-A42OLED6.mjs → chunk-KED5S2WG.mjs} +13 -2
- package/dist/{chunk-BJQIYELW.mjs → chunk-KGMVRIYC.mjs} +5 -5
- package/dist/{chunk-6GYT3EZD.mjs → chunk-KXT2TP6A.mjs} +3 -4
- package/dist/{chunk-BBLVRLXT.js → chunk-KYNWNTGO.js} +230 -146
- package/dist/{chunk-M73NMNZX.js → chunk-L24PPXLV.js} +17 -5
- package/dist/chunk-L3WPA2RP.js +25 -0
- package/dist/{chunk-V4JIZN3E.mjs → chunk-L6KSO66F.mjs} +4 -12
- package/dist/{chunk-4LX5UGPQ.js → chunk-LJRCEB7F.js} +168 -121
- package/dist/{chunk-F7H4ALKN.js → chunk-LZG24TDB.js} +8 -9
- package/dist/{chunk-ZYJTHGQW.js → chunk-M3FVPPMM.js} +9 -13
- package/dist/{chunk-GN3TSQWW.mjs → chunk-M6YXUNOU.mjs} +2 -2
- package/dist/{chunk-I373B74W.js → chunk-MC26ORSN.js} +102 -41
- package/dist/{chunk-5HFHHFQS.mjs → chunk-MTIGGMHG.mjs} +17 -5
- package/dist/{chunk-DKT2EYVM.mjs → chunk-MV2JQ6XQ.mjs} +3 -6
- package/dist/{chunk-HR5GBE3P.js → chunk-NDGA3N6H.js} +19 -7
- package/dist/{chunk-BO6QGXMN.mjs → chunk-NEZ445D4.mjs} +9 -9
- package/dist/{chunk-4U5HSR2H.js → chunk-NVI2P7VH.js} +3 -4
- package/dist/{chunk-NVEIVIAW.mjs → chunk-OFRKYQOZ.mjs} +133 -19
- package/dist/{chunk-AW5M3EL4.js → chunk-OS6M3IZF.js} +62 -12
- package/dist/{chunk-3ZNZLGQO.mjs → chunk-OXQOKKTP.mjs} +6 -7
- package/dist/{chunk-NMEVQPOD.js → chunk-PHAJXRGE.js} +2 -4
- package/dist/{chunk-WG3YS2QV.js → chunk-PT5T5F4H.js} +13 -2
- package/dist/{chunk-WNLUUD5N.mjs → chunk-QIL24WZD.mjs} +8 -12
- package/dist/{chunk-ZFMMAYSX.js → chunk-QLATA4UB.js} +4 -6
- package/dist/{chunk-KIYNHQGW.mjs → chunk-RVLV63SI.mjs} +41 -20
- package/dist/{chunk-3QPCQH62.mjs → chunk-RYNLPRUM.mjs} +1 -1
- package/dist/{chunk-6GIJ7NFV.mjs → chunk-SDZKL3IB.mjs} +3 -5
- package/dist/{chunk-G5USITWF.js → chunk-SH4BZYXO.js} +27 -8
- package/dist/{chunk-L5AMVEQL.mjs → chunk-SLEXEH7R.mjs} +60 -10
- package/dist/{chunk-JLRRXRZO.js → chunk-SQONS5PH.js} +4 -7
- package/dist/chunk-SQTOVSDU.mjs +692 -0
- package/dist/{chunk-3ZQMHXRY.js → chunk-TEYL5X56.js} +39 -18
- package/dist/{chunk-KGSDDVRC.mjs → chunk-TNTOSFGN.mjs} +4 -4
- package/dist/{chunk-CY5GRTAX.js → chunk-UAM3RQY4.js} +24 -5
- package/dist/{chunk-XRNKHQTL.js → chunk-UEAXYZSE.js} +3 -2
- package/dist/{chunk-7ISEWLA3.js → chunk-UKQMF3JV.js} +21 -6
- package/dist/{chunk-ITVLIR7T.mjs → chunk-ULWT6W6M.mjs} +13 -20
- package/dist/{chunk-M5GSLKUX.mjs → chunk-VAIWWELW.mjs} +15 -3
- package/dist/{chunk-4SO4LANY.js → chunk-VC26SAXB.js} +340 -274
- package/dist/{chunk-SKMZTW3K.js → chunk-WCTNQYXO.js} +16 -23
- package/dist/{chunk-KXNWY2Q7.mjs → chunk-WFWEMXO7.mjs} +241 -157
- package/dist/chunk-WHYHLUXG.mjs +25 -0
- package/dist/{chunk-ONTRGV5T.js → chunk-WZUADPYB.js} +6 -14
- package/dist/{chunk-N4PP3ENO.js → chunk-XTQUPDRI.js} +2 -2
- package/dist/{chunk-XATXFVKR.mjs → chunk-Y7K27DVV.mjs} +4 -3
- package/dist/{chunk-WI4N5DD3.mjs → chunk-YH57D4AV.mjs} +16 -4
- package/dist/{chunk-3MRP3XYI.js → chunk-YRVAF2ID.js} +7 -2
- package/dist/{chunk-5XE5VBDS.mjs → chunk-YSGM22AH.mjs} +11 -1
- package/dist/{chunk-6TR7JB6C.js → chunk-ZDNQGS4O.js} +4 -4
- package/dist/{chunk-CHBUNQIJ.mjs → chunk-ZQSMJS2Q.mjs} +23 -6
- package/dist/{chunk-QQFLRNI3.mjs → chunk-ZRZB3C5J.mjs} +18 -3
- package/dist/components/ActivityFeed.js +4 -3
- package/dist/components/ActivityFeed.mjs +3 -2
- package/dist/components/Cascader.d.mts +3 -1
- package/dist/components/Cascader.d.ts +3 -1
- package/dist/components/Cascader.js +3 -2
- package/dist/components/Cascader.mjs +2 -1
- package/dist/components/ChatWindow.js +5 -5
- package/dist/components/ChatWindow.mjs +4 -4
- package/dist/components/Checkbox.js +4 -4
- package/dist/components/Checkbox.mjs +3 -3
- package/dist/components/CheckboxGroup.js +3 -3
- package/dist/components/CheckboxGroup.mjs +2 -2
- package/dist/components/CommentThread.js +4 -4
- package/dist/components/CommentThread.mjs +3 -3
- package/dist/components/CropUpload.js +4 -4
- package/dist/components/CropUpload.mjs +3 -3
- package/dist/components/DataTableWithToolbar.d.mts +2 -2
- package/dist/components/DataTableWithToolbar.d.ts +2 -2
- package/dist/components/DataTableWithToolbar.js +11 -11
- package/dist/components/DataTableWithToolbar.mjs +10 -10
- package/dist/components/DatePicker.d.mts +1 -0
- package/dist/components/DatePicker.d.ts +1 -0
- package/dist/components/DatePicker.js +3 -2
- package/dist/components/DatePicker.mjs +2 -1
- package/dist/components/Drawer.js +3 -3
- package/dist/components/Drawer.mjs +2 -2
- package/dist/components/FileManager.d.mts +2 -1
- package/dist/components/FileManager.d.ts +2 -1
- package/dist/components/FileManager.js +3 -2
- package/dist/components/FileManager.mjs +2 -1
- package/dist/components/Form.js +3 -2
- package/dist/components/Form.mjs +2 -1
- package/dist/components/FormItem.js +4 -3
- package/dist/components/FormItem.mjs +3 -2
- package/dist/components/FormWizard.js +4 -4
- package/dist/components/FormWizard.mjs +3 -3
- package/dist/components/Image.js +4 -4
- package/dist/components/Image.mjs +3 -3
- package/dist/components/ImageGroup.js +3 -3
- package/dist/components/ImageGroup.mjs +2 -2
- package/dist/components/ImagePreview.js +2 -2
- package/dist/components/ImagePreview.mjs +1 -1
- package/dist/components/ImageViewer.d.mts +1 -1
- package/dist/components/ImageViewer.d.ts +1 -1
- package/dist/components/ImageViewer.js +2 -2
- package/dist/components/ImageViewer.mjs +1 -1
- package/dist/components/InfiniteScroll.d.mts +2 -0
- package/dist/components/InfiniteScroll.d.ts +2 -0
- package/dist/components/InfiniteScroll.js +3 -2
- package/dist/components/InfiniteScroll.mjs +2 -1
- package/dist/components/Input.js +3 -2
- package/dist/components/Input.mjs +2 -1
- package/dist/components/InputNumber.js +3 -2
- package/dist/components/InputNumber.mjs +2 -1
- package/dist/components/List.d.mts +6 -2
- package/dist/components/List.d.ts +6 -2
- package/dist/components/List.js +3 -2
- package/dist/components/List.mjs +2 -1
- package/dist/components/Loading.js +3 -2
- package/dist/components/Loading.mjs +2 -1
- package/dist/components/MarkdownEditor.js +3 -3
- package/dist/components/MarkdownEditor.mjs +2 -2
- package/dist/components/Mentions.js +2 -2
- package/dist/components/Mentions.mjs +1 -1
- package/dist/components/Menu.d.mts +8 -80
- package/dist/components/Menu.d.ts +8 -80
- package/dist/components/Menu.js +2 -2
- package/dist/components/Menu.mjs +1 -1
- package/dist/components/MenuItem.d.mts +6 -2
- package/dist/components/MenuItem.d.ts +6 -2
- package/dist/components/MenuItem.js +2 -2
- package/dist/components/MenuItem.mjs +1 -1
- package/dist/components/MenuItemGroup.d.mts +6 -2
- package/dist/components/MenuItemGroup.d.ts +6 -2
- package/dist/components/MenuItemGroup.js +2 -2
- package/dist/components/MenuItemGroup.mjs +1 -1
- package/dist/components/Message.js +2 -2
- package/dist/components/Message.mjs +1 -1
- package/dist/components/Modal.js +3 -3
- package/dist/components/Modal.mjs +2 -2
- package/dist/components/Notification.js +2 -2
- package/dist/components/Notification.mjs +1 -1
- package/dist/components/NotificationCenter.js +5 -4
- package/dist/components/NotificationCenter.mjs +4 -3
- package/dist/components/NumberKeyboard.js +3 -2
- package/dist/components/NumberKeyboard.mjs +2 -1
- package/dist/components/Radio.js +4 -4
- package/dist/components/Radio.mjs +3 -3
- package/dist/components/RadioGroup.js +3 -3
- package/dist/components/RadioGroup.mjs +2 -2
- package/dist/components/RichTextEditor.js +3 -3
- package/dist/components/RichTextEditor.mjs +2 -2
- package/dist/components/Select.d.mts +3 -1
- package/dist/components/Select.d.ts +3 -1
- package/dist/components/Select.js +3 -2
- package/dist/components/Select.mjs +2 -1
- package/dist/components/Signature.d.mts +1 -0
- package/dist/components/Signature.d.ts +1 -0
- package/dist/components/Signature.js +3 -2
- package/dist/components/Signature.mjs +2 -1
- package/dist/components/Spotlight.js +4 -2
- package/dist/components/Spotlight.mjs +3 -1
- package/dist/components/Steps.js +2 -2
- package/dist/components/Steps.mjs +1 -1
- package/dist/components/StepsItem.js +2 -2
- package/dist/components/StepsItem.mjs +1 -1
- package/dist/components/SubMenu.d.mts +6 -2
- package/dist/components/SubMenu.d.ts +6 -2
- package/dist/components/SubMenu.js +2 -2
- package/dist/components/SubMenu.mjs +1 -1
- package/dist/components/Table.d.mts +2 -2
- package/dist/components/Table.d.ts +2 -2
- package/dist/components/Table.js +9 -9
- package/dist/components/Table.mjs +8 -8
- package/dist/components/Textarea.js +3 -3
- package/dist/components/Textarea.mjs +2 -2
- package/dist/components/TimePicker.d.mts +1 -0
- package/dist/components/TimePicker.d.ts +1 -0
- package/dist/components/TimePicker.js +4 -2
- package/dist/components/TimePicker.mjs +3 -1
- package/dist/components/Tour.js +3 -2
- package/dist/components/Tour.mjs +2 -1
- package/dist/components/Transfer.d.mts +3 -1
- package/dist/components/Transfer.d.ts +3 -1
- package/dist/components/Transfer.js +3 -2
- package/dist/components/Transfer.mjs +2 -1
- package/dist/components/Tree.d.mts +3 -1
- package/dist/components/Tree.d.ts +3 -1
- package/dist/components/Tree.js +3 -2
- package/dist/components/Tree.mjs +2 -1
- package/dist/components/TreeSelect.d.mts +3 -1
- package/dist/components/TreeSelect.d.ts +3 -1
- package/dist/components/TreeSelect.js +3 -2
- package/dist/components/TreeSelect.mjs +2 -1
- package/dist/components/Upload.js +3 -2
- package/dist/components/Upload.mjs +2 -1
- package/dist/components/VirtualTable.d.mts +3 -2
- package/dist/components/VirtualTable.d.ts +3 -2
- package/dist/components/VirtualTable.js +3 -2
- package/dist/components/VirtualTable.mjs +2 -1
- package/dist/index.d.mts +33 -7
- package/dist/index.d.ts +33 -7
- package/dist/index.js +54 -54
- package/dist/index.mjs +53 -53
- package/dist/{types-CHmCMNEM.d.ts → types-0oVwMXtR.d.mts} +1 -1
- package/dist/{types-CHmCMNEM.d.mts → types-0oVwMXtR.d.ts} +1 -1
- package/dist/types-DaC4a0Ny.d.mts +80 -0
- package/dist/types-DaC4a0Ny.d.ts +80 -0
- package/package.json +2 -2
- package/dist/chunk-UKGQ7256.js +0 -12
- package/dist/chunk-UQMPEMY7.mjs +0 -12
- package/dist/chunk-VNVGSPBI.mjs +0 -626
- package/dist/{chunk-OZD75CLT.js → chunk-ANBNSUSR.js} +3 -3
- package/dist/{chunk-I2AUOICV.mjs → chunk-M3MOSUZO.mjs} +3 -3
- package/dist/{chunk-UMZ3PMUJ.js → chunk-SXHCMZ6U.js} +2 -2
- package/dist/{chunk-BWDQZSAB.mjs → chunk-WTSG7QXK.mjs} +3 -3
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
var _chunkP36GX65Njs = require('./chunk-P36GX65N.js');
|
|
4
4
|
|
|
5
|
-
// src/components/Tree.tsx
|
|
6
|
-
var _react = require('react');
|
|
7
|
-
|
|
8
|
-
|
|
9
5
|
|
|
6
|
+
var _chunkTDODFBBOjs = require('./chunk-TDODFBBO.js');
|
|
10
7
|
|
|
8
|
+
// src/components/Tree.tsx
|
|
11
9
|
|
|
12
10
|
|
|
13
11
|
|
|
14
12
|
|
|
15
13
|
|
|
14
|
+
var _tigercatcore = require('@expcat/tigercat-core');
|
|
16
15
|
|
|
16
|
+
// src/components/Tree/state.ts
|
|
17
|
+
var _react = require('react');
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
|
|
@@ -29,82 +30,53 @@ var _react = require('react');
|
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
showIcon = true,
|
|
73
|
-
showLine = false,
|
|
74
|
-
defaultExpandedKeys = [],
|
|
75
|
-
defaultSelectedKeys = [],
|
|
76
|
-
defaultCheckedKeys = [],
|
|
77
|
-
expandedKeys: controlledExpandedKeys,
|
|
78
|
-
selectedKeys: controlledSelectedKeys,
|
|
79
|
-
checkedKeys: controlledCheckedKeys,
|
|
80
|
-
defaultExpandAll = false,
|
|
81
|
-
checkStrictly = false,
|
|
82
|
-
checkStrategy = "all",
|
|
83
|
-
selectable = true,
|
|
84
|
-
multiple = false,
|
|
85
|
-
loadData,
|
|
86
|
-
filterValue = "",
|
|
87
|
-
searchable = false,
|
|
88
|
-
filterFn,
|
|
89
|
-
autoExpandParent = true,
|
|
90
|
-
blockNode = false,
|
|
91
|
-
emptyText = "No data",
|
|
92
|
-
ariaLabel = "Tree",
|
|
93
|
-
onExpand,
|
|
94
|
-
onSelect,
|
|
95
|
-
onCheck,
|
|
96
|
-
onNodeClick,
|
|
97
|
-
onNodeExpand,
|
|
98
|
-
onNodeCollapse,
|
|
99
|
-
className,
|
|
100
|
-
draggable: isDraggable = false,
|
|
101
|
-
onDrop,
|
|
102
|
-
virtual = false,
|
|
103
|
-
height = 400,
|
|
104
|
-
itemHeight = 32
|
|
105
|
-
}) => {
|
|
33
|
+
function useTreeState(props) {
|
|
34
|
+
const {
|
|
35
|
+
treeData = [],
|
|
36
|
+
selectionMode,
|
|
37
|
+
checkable = false,
|
|
38
|
+
showIcon = true,
|
|
39
|
+
showLine = false,
|
|
40
|
+
defaultExpandedKeys = [],
|
|
41
|
+
defaultSelectedKeys = [],
|
|
42
|
+
defaultCheckedKeys = [],
|
|
43
|
+
expandedKeys: controlledExpandedKeys,
|
|
44
|
+
selectedKeys: controlledSelectedKeys,
|
|
45
|
+
checkedKeys: controlledCheckedKeys,
|
|
46
|
+
defaultExpandAll = false,
|
|
47
|
+
checkStrictly = false,
|
|
48
|
+
checkStrategy = "all",
|
|
49
|
+
selectable = true,
|
|
50
|
+
multiple = false,
|
|
51
|
+
loadData,
|
|
52
|
+
filterValue = "",
|
|
53
|
+
searchable = false,
|
|
54
|
+
filterFn,
|
|
55
|
+
autoExpandParent = true,
|
|
56
|
+
blockNode = false,
|
|
57
|
+
emptyText,
|
|
58
|
+
ariaLabel = "Tree",
|
|
59
|
+
onExpand,
|
|
60
|
+
onSelect,
|
|
61
|
+
onCheck,
|
|
62
|
+
onNodeClick,
|
|
63
|
+
onNodeExpand,
|
|
64
|
+
onNodeCollapse,
|
|
65
|
+
className,
|
|
66
|
+
draggable: isDraggable = false,
|
|
67
|
+
onDrop,
|
|
68
|
+
virtual = false,
|
|
69
|
+
height = 400,
|
|
70
|
+
itemHeight = 32,
|
|
71
|
+
locale
|
|
72
|
+
} = props;
|
|
106
73
|
const itemRefs = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
|
|
107
74
|
const dragNodeKeyRef = _react.useRef.call(void 0, null);
|
|
75
|
+
const config = _chunkTDODFBBOjs.useTigerConfig.call(void 0, );
|
|
76
|
+
const mergedLocale = _react.useMemo.call(void 0,
|
|
77
|
+
() => _tigercatcore.mergeTigerLocale.call(void 0, config.locale, locale),
|
|
78
|
+
[config.locale, locale]
|
|
79
|
+
);
|
|
108
80
|
const effectiveSelectable = _react.useMemo.call(void 0, () => {
|
|
109
81
|
if (selectionMode !== void 0) {
|
|
110
82
|
return selectionMode !== "none";
|
|
@@ -307,294 +279,347 @@ var Tree = ({
|
|
|
307
279
|
},
|
|
308
280
|
[treeData, computedCheckedState, checkStrictly, checkStrategy, controlledCheckedKeys, onCheck]
|
|
309
281
|
);
|
|
310
|
-
const getFirstChildKey = _react.useCallback.call(void 0,
|
|
311
|
-
(nodeKey) => {
|
|
312
|
-
const index = visibleItems.findIndex((i) => i.key === nodeKey);
|
|
313
|
-
if (index < 0) return void 0;
|
|
314
|
-
const base = visibleItems[index];
|
|
315
|
-
for (let i = index + 1; i < visibleItems.length; i++) {
|
|
316
|
-
const item = visibleItems[i];
|
|
317
|
-
if (item.level <= base.level) break;
|
|
318
|
-
if (item.parentKey === nodeKey && !item.node.disabled) return item.key;
|
|
319
|
-
}
|
|
320
|
-
return void 0;
|
|
321
|
-
},
|
|
322
|
-
[visibleItems]
|
|
323
|
-
);
|
|
324
282
|
const handleKeyDown = _react.useCallback.call(void 0,
|
|
325
283
|
(e, node, isExpanded, isChecked) => {
|
|
326
284
|
if (node.disabled) return;
|
|
327
285
|
const currentKey = _nullishCoalesce(_nullishCoalesce(activeKey, () => ( defaultActiveKey)), () => ( node.key));
|
|
328
|
-
const currentIndex = focusableKeys.findIndex((k) => k === currentKey);
|
|
329
286
|
const isExpandable = !!(node.children && node.children.length > 0) || !!(loadData && !node.isLeaf);
|
|
330
287
|
const parents = _tigercatcore.getParentKeys.call(void 0, treeData, node.key);
|
|
331
288
|
const parentKey = parents[parents.length - 1];
|
|
332
|
-
|
|
333
|
-
e.
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
if (isExpandable && isExpanded) {
|
|
366
|
-
handleExpand(node.key);
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
if (parentKey !== void 0) {
|
|
370
|
-
setActiveKey(parentKey);
|
|
371
|
-
}
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
if (e.key === "Escape") {
|
|
375
|
-
e.preventDefault();
|
|
376
|
-
if (isExpandable && isExpanded) {
|
|
377
|
-
handleExpand(node.key);
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
if (parentKey !== void 0) {
|
|
381
|
-
if (computedExpandedKeys.has(parentKey)) {
|
|
382
|
-
handleExpand(parentKey);
|
|
383
|
-
}
|
|
384
|
-
setActiveKey(parentKey);
|
|
385
|
-
}
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
if (e.key === "Enter") {
|
|
389
|
-
e.preventDefault();
|
|
390
|
-
if (effectiveSelectable) {
|
|
391
|
-
handleSelect(node.key, e);
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
394
|
-
if (isExpandable) {
|
|
395
|
-
handleExpand(node.key);
|
|
396
|
-
}
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
if (e.key === " ") {
|
|
400
|
-
e.preventDefault();
|
|
401
|
-
if (checkable) {
|
|
402
|
-
handleCheck(node.key, !isChecked);
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
if (isExpandable) {
|
|
406
|
-
handleExpand(node.key);
|
|
407
|
-
}
|
|
289
|
+
const action = _tigercatcore.getTreeKeyboardAction.call(void 0, {
|
|
290
|
+
key: e.key,
|
|
291
|
+
nodeKey: node.key,
|
|
292
|
+
currentKey,
|
|
293
|
+
focusableKeys,
|
|
294
|
+
parentKey,
|
|
295
|
+
firstChildKey: _tigercatcore.getFirstVisibleChildKey.call(void 0, visibleItems, node.key),
|
|
296
|
+
isExpandable,
|
|
297
|
+
isExpanded,
|
|
298
|
+
isParentExpanded: parentKey !== void 0 && computedExpandedKeys.has(parentKey),
|
|
299
|
+
isChecked,
|
|
300
|
+
selectable: effectiveSelectable,
|
|
301
|
+
checkable
|
|
302
|
+
});
|
|
303
|
+
if (!action) return;
|
|
304
|
+
e.preventDefault();
|
|
305
|
+
switch (action.type) {
|
|
306
|
+
case "focus":
|
|
307
|
+
setActiveKey(action.key);
|
|
308
|
+
break;
|
|
309
|
+
case "toggleExpand":
|
|
310
|
+
handleExpand(action.key);
|
|
311
|
+
break;
|
|
312
|
+
case "select":
|
|
313
|
+
handleSelect(action.key, e);
|
|
314
|
+
break;
|
|
315
|
+
case "check":
|
|
316
|
+
handleCheck(action.key, action.checked);
|
|
317
|
+
break;
|
|
318
|
+
case "collapseAndFocus":
|
|
319
|
+
if (action.collapseKey !== void 0) handleExpand(action.collapseKey);
|
|
320
|
+
setActiveKey(action.focusKey);
|
|
321
|
+
break;
|
|
408
322
|
}
|
|
409
323
|
},
|
|
410
324
|
[
|
|
411
325
|
activeKey,
|
|
412
326
|
defaultActiveKey,
|
|
413
327
|
focusableKeys,
|
|
328
|
+
visibleItems,
|
|
414
329
|
treeData,
|
|
415
330
|
loadData,
|
|
416
331
|
checkable,
|
|
417
332
|
computedExpandedKeys,
|
|
418
333
|
effectiveSelectable,
|
|
419
|
-
getFirstChildKey,
|
|
420
334
|
handleExpand,
|
|
421
335
|
handleSelect,
|
|
422
336
|
handleCheck
|
|
423
337
|
]
|
|
424
338
|
);
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
339
|
+
return {
|
|
340
|
+
treeData,
|
|
341
|
+
className,
|
|
342
|
+
ariaLabel,
|
|
343
|
+
emptyText,
|
|
344
|
+
mergedLocale,
|
|
345
|
+
showIcon,
|
|
346
|
+
showLine,
|
|
347
|
+
blockNode,
|
|
348
|
+
checkable,
|
|
349
|
+
effectiveSelectable,
|
|
350
|
+
effectiveMultiple,
|
|
351
|
+
isDraggable,
|
|
352
|
+
searchable,
|
|
353
|
+
virtual,
|
|
354
|
+
height,
|
|
355
|
+
itemHeight,
|
|
356
|
+
computedExpandedKeys,
|
|
357
|
+
computedSelectedKeys,
|
|
358
|
+
checkedSets,
|
|
359
|
+
loadingNodes,
|
|
360
|
+
filteredNodeKeys,
|
|
361
|
+
visibleItems,
|
|
362
|
+
activeKey,
|
|
363
|
+
defaultActiveKey,
|
|
364
|
+
internalSearchValue,
|
|
365
|
+
setInternalSearchValue,
|
|
366
|
+
itemRefs,
|
|
367
|
+
dragNodeKeyRef,
|
|
368
|
+
setActiveKey,
|
|
369
|
+
loadData,
|
|
370
|
+
onNodeClick,
|
|
371
|
+
onDrop,
|
|
372
|
+
handleExpand,
|
|
373
|
+
handleSelect,
|
|
374
|
+
handleCheck,
|
|
375
|
+
handleKeyDown
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// src/components/Tree/render-node.tsx
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
// src/components/Tree/render-row.tsx
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
// src/components/Tree/icons.tsx
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
405
|
+
var spinnerSvg = _tigercatcore.getSpinnerSVG.call(void 0, "spinner");
|
|
406
|
+
var ExpandIcon = ({
|
|
407
|
+
expanded,
|
|
408
|
+
hasChildren
|
|
409
|
+
}) => {
|
|
410
|
+
if (!hasChildren) {
|
|
411
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: _tigercatcore.treeNodeIndentClasses });
|
|
412
|
+
}
|
|
413
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
414
|
+
"svg",
|
|
415
|
+
{
|
|
416
|
+
className: _tigercatcore.getTreeNodeExpandIconClasses.call(void 0, expanded),
|
|
417
|
+
width: "16",
|
|
418
|
+
height: "16",
|
|
419
|
+
viewBox: "0 0 16 16",
|
|
420
|
+
fill: "currentColor",
|
|
421
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M6 4l4 4-4 4V4z" })
|
|
443
422
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
423
|
+
);
|
|
424
|
+
};
|
|
425
|
+
var LoadingSpinner = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
426
|
+
"svg",
|
|
427
|
+
{
|
|
428
|
+
className: _tigercatcore.treeLoadingClasses,
|
|
429
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
430
|
+
fill: "none",
|
|
431
|
+
viewBox: spinnerSvg.viewBox,
|
|
432
|
+
children: spinnerSvg.elements.map((el, index) => {
|
|
433
|
+
if (el.type === "circle") return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { ...el.attrs }, index);
|
|
434
|
+
if (el.type === "path") return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { ...el.attrs }, index);
|
|
435
|
+
return null;
|
|
436
|
+
})
|
|
437
|
+
}
|
|
438
|
+
);
|
|
439
|
+
|
|
440
|
+
// src/components/Tree/render-row.tsx
|
|
441
|
+
|
|
442
|
+
function renderTreeRow(ctx, node, level) {
|
|
443
|
+
const hasChildren = !!(node.children && node.children.length > 0);
|
|
444
|
+
const isExpanded = ctx.computedExpandedKeys.has(node.key);
|
|
445
|
+
const isSelected = ctx.computedSelectedKeys.has(node.key);
|
|
446
|
+
const isChecked = ctx.checkedSets.checkedSet.has(node.key);
|
|
447
|
+
const isHalfChecked = ctx.checkedSets.halfCheckedSet.has(node.key);
|
|
448
|
+
const isLoading = ctx.loadingNodes.has(node.key);
|
|
449
|
+
const isFiltered = ctx.filteredNodeKeys.size > 0;
|
|
450
|
+
const isMatched = ctx.filteredNodeKeys.has(node.key);
|
|
451
|
+
const isVisible = !isFiltered || isMatched;
|
|
452
|
+
const isExpandable = hasChildren || !!(ctx.loadData && !node.isLeaf);
|
|
453
|
+
const isFocusable = !node.disabled && node.key === (_nullishCoalesce(ctx.activeKey, () => ( ctx.defaultActiveKey)));
|
|
454
|
+
if (!isVisible) {
|
|
455
|
+
return null;
|
|
456
|
+
}
|
|
457
|
+
const indent = [];
|
|
458
|
+
for (let i = 0; i < level; i++) {
|
|
459
|
+
indent.push(/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: _tigercatcore.treeNodeIndentClasses }, i));
|
|
460
|
+
}
|
|
461
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
462
|
+
"div",
|
|
463
|
+
{
|
|
464
|
+
className: _tigercatcore.getTreeNodeClasses.call(void 0, isSelected, !!node.disabled, ctx.blockNode),
|
|
465
|
+
ref: (el) => {
|
|
466
|
+
ctx.itemRefs.current.set(node.key, el);
|
|
467
|
+
},
|
|
468
|
+
role: "treeitem",
|
|
469
|
+
"aria-level": level + 1,
|
|
470
|
+
"aria-disabled": node.disabled || void 0,
|
|
471
|
+
"aria-selected": ctx.effectiveSelectable ? isSelected : void 0,
|
|
472
|
+
"aria-expanded": isExpandable ? isExpanded : void 0,
|
|
473
|
+
"aria-checked": ctx.checkable ? isHalfChecked ? "mixed" : isChecked : void 0,
|
|
474
|
+
tabIndex: isFocusable ? 0 : -1,
|
|
475
|
+
draggable: ctx.isDraggable && !node.disabled ? true : void 0,
|
|
476
|
+
onDragStart: ctx.isDraggable && !node.disabled ? (e) => {
|
|
477
|
+
e.stopPropagation();
|
|
478
|
+
ctx.dragNodeKeyRef.current = node.key;
|
|
479
|
+
} : void 0,
|
|
480
|
+
onDragOver: ctx.isDraggable ? (e) => {
|
|
481
|
+
e.preventDefault();
|
|
482
|
+
e.stopPropagation();
|
|
483
|
+
} : void 0,
|
|
484
|
+
onDrop: ctx.isDraggable ? (e) => {
|
|
485
|
+
e.preventDefault();
|
|
486
|
+
e.stopPropagation();
|
|
487
|
+
if (ctx.dragNodeKeyRef.current !== null && ctx.dragNodeKeyRef.current !== node.key) {
|
|
488
|
+
_optionalChain([ctx, 'access', _11 => _11.onDrop, 'optionalCall', _12 => _12({ dragKey: ctx.dragNodeKeyRef.current, dropKey: node.key })]);
|
|
489
|
+
}
|
|
490
|
+
ctx.dragNodeKeyRef.current = null;
|
|
491
|
+
} : void 0,
|
|
492
|
+
onDragEnd: ctx.isDraggable ? () => {
|
|
493
|
+
ctx.dragNodeKeyRef.current = null;
|
|
494
|
+
} : void 0,
|
|
495
|
+
onFocus: () => {
|
|
496
|
+
if (!node.disabled) ctx.setActiveKey(node.key);
|
|
497
|
+
},
|
|
498
|
+
onKeyDown: (e) => ctx.handleKeyDown(e, node, isExpanded, isChecked),
|
|
499
|
+
onClick: (e) => {
|
|
500
|
+
ctx.setActiveKey(node.key);
|
|
501
|
+
if (!node.disabled) _optionalChain([ctx, 'access', _13 => _13.onNodeClick, 'optionalCall', _14 => _14(node, e)]);
|
|
502
|
+
if (ctx.effectiveSelectable && !node.disabled) {
|
|
503
|
+
ctx.handleSelect(node.key, e);
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
children: [
|
|
507
|
+
indent,
|
|
508
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
509
|
+
"span",
|
|
510
|
+
{
|
|
511
|
+
className: isExpandable ? "cursor-pointer" : "",
|
|
512
|
+
onClick: (e) => {
|
|
513
|
+
e.stopPropagation();
|
|
514
|
+
if (isExpandable) {
|
|
515
|
+
ctx.setActiveKey(node.key);
|
|
516
|
+
ctx.handleExpand(node.key);
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExpandIcon, { expanded: isExpanded, hasChildren: isExpandable })
|
|
487
520
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
"
|
|
493
|
-
{
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
handleExpand(node.key);
|
|
500
|
-
}
|
|
501
|
-
},
|
|
502
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExpandIcon, { expanded: isExpanded, hasChildren: isExpandable })
|
|
503
|
-
}
|
|
504
|
-
),
|
|
505
|
-
checkable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
506
|
-
"input",
|
|
507
|
-
{
|
|
508
|
-
type: "checkbox",
|
|
509
|
-
"aria-label": `Select ${node.label}`,
|
|
510
|
-
className: _tigercatcore.treeNodeCheckboxClasses,
|
|
511
|
-
checked: isChecked,
|
|
512
|
-
ref: (input) => {
|
|
513
|
-
if (input) {
|
|
514
|
-
input.indeterminate = isHalfChecked;
|
|
515
|
-
}
|
|
516
|
-
},
|
|
517
|
-
disabled: node.disabled,
|
|
518
|
-
onClick: (e) => {
|
|
519
|
-
e.stopPropagation();
|
|
520
|
-
},
|
|
521
|
-
onChange: (e) => {
|
|
522
|
-
handleCheck(node.key, e.target.checked);
|
|
521
|
+
),
|
|
522
|
+
ctx.checkable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
523
|
+
"input",
|
|
524
|
+
{
|
|
525
|
+
type: "checkbox",
|
|
526
|
+
"aria-label": `Select ${node.label}`,
|
|
527
|
+
className: _tigercatcore.treeNodeCheckboxClasses,
|
|
528
|
+
checked: isChecked,
|
|
529
|
+
ref: (input) => {
|
|
530
|
+
if (input) {
|
|
531
|
+
input.indeterminate = isHalfChecked;
|
|
523
532
|
}
|
|
533
|
+
},
|
|
534
|
+
disabled: node.disabled,
|
|
535
|
+
onClick: (e) => {
|
|
536
|
+
e.stopPropagation();
|
|
537
|
+
},
|
|
538
|
+
onChange: (e) => {
|
|
539
|
+
ctx.handleCheck(node.key, e.target.checked);
|
|
524
540
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
)
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
);
|
|
541
|
-
};
|
|
542
|
-
const renderTreeNode = (node, level) => {
|
|
543
|
-
const hasChildren = !!(node.children && node.children.length > 0);
|
|
544
|
-
const isExpanded = computedExpandedKeys.has(node.key);
|
|
545
|
-
const isFiltered = filteredNodeKeys.size > 0;
|
|
546
|
-
const isMatched = filteredNodeKeys.has(node.key);
|
|
547
|
-
const isVisible = !isFiltered || isMatched;
|
|
548
|
-
if (!isVisible) {
|
|
549
|
-
return null;
|
|
541
|
+
}
|
|
542
|
+
),
|
|
543
|
+
ctx.showIcon && node.icon ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: _tigercatcore.treeNodeIconClasses, children: node.icon }) : null,
|
|
544
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
545
|
+
"span",
|
|
546
|
+
{
|
|
547
|
+
className: _tigercatcore.classNames.call(void 0,
|
|
548
|
+
_tigercatcore.treeNodeLabelClasses,
|
|
549
|
+
isFiltered && isMatched ? "font-semibold text-[var(--tiger-primary,#2563eb)]" : ""
|
|
550
|
+
),
|
|
551
|
+
children: node.label
|
|
552
|
+
}
|
|
553
|
+
),
|
|
554
|
+
isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoadingSpinner, {})
|
|
555
|
+
]
|
|
550
556
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// src/components/Tree/render-node.tsx
|
|
561
|
+
|
|
562
|
+
function renderTreeNode(ctx, node, level) {
|
|
563
|
+
const hasChildren = !!(node.children && node.children.length > 0);
|
|
564
|
+
const isExpanded = ctx.computedExpandedKeys.has(node.key);
|
|
565
|
+
const isFiltered = ctx.filteredNodeKeys.size > 0;
|
|
566
|
+
const isMatched = ctx.filteredNodeKeys.has(node.key);
|
|
567
|
+
const isVisible = !isFiltered || isMatched;
|
|
568
|
+
if (!isVisible) {
|
|
569
|
+
return null;
|
|
570
|
+
}
|
|
571
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.treeNodeWrapperClasses, children: [
|
|
572
|
+
renderTreeRow(ctx, node, level),
|
|
573
|
+
hasChildren && isExpanded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.classNames.call(void 0, _tigercatcore.treeNodeChildrenClasses, ctx.showLine && _tigercatcore.treeLineClasses), children: (_nullishCoalesce(node.children, () => ( []))).map((child) => renderTreeNode(ctx, child, level + 1)) })
|
|
574
|
+
] }, node.key);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// src/components/Tree.tsx
|
|
578
|
+
|
|
579
|
+
var Tree = (props) => {
|
|
580
|
+
const ctx = useTreeState(props);
|
|
581
|
+
if (!ctx.treeData || ctx.treeData.length === 0) {
|
|
557
582
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
558
583
|
"div",
|
|
559
584
|
{
|
|
560
|
-
className: _tigercatcore.classNames.call(void 0, _tigercatcore.treeBaseClasses, "p-4", className),
|
|
585
|
+
className: _tigercatcore.classNames.call(void 0, _tigercatcore.treeBaseClasses, "p-4", ctx.className),
|
|
561
586
|
role: "tree",
|
|
562
|
-
"aria-label": ariaLabel,
|
|
563
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.treeEmptyStateClasses, children: emptyText })
|
|
587
|
+
"aria-label": ctx.ariaLabel,
|
|
588
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.treeEmptyStateClasses, children: _tigercatcore.resolveLocaleText.call(void 0, "No data", ctx.emptyText, _optionalChain([ctx, 'access', _15 => _15.mergedLocale, 'optionalAccess', _16 => _16.common, 'optionalAccess', _17 => _17.emptyText])) })
|
|
564
589
|
}
|
|
565
590
|
);
|
|
566
591
|
}
|
|
567
592
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
568
593
|
"div",
|
|
569
594
|
{
|
|
570
|
-
className: _tigercatcore.classNames.call(void 0, _tigercatcore.treeBaseClasses, className),
|
|
595
|
+
className: _tigercatcore.classNames.call(void 0, _tigercatcore.treeBaseClasses, ctx.className),
|
|
571
596
|
role: "tree",
|
|
572
|
-
"aria-label": ariaLabel,
|
|
573
|
-
"aria-multiselectable": effectiveMultiple || void 0,
|
|
597
|
+
"aria-label": ctx.ariaLabel,
|
|
598
|
+
"aria-multiselectable": ctx.effectiveMultiple || void 0,
|
|
574
599
|
children: [
|
|
575
|
-
searchable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
600
|
+
ctx.searchable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
576
601
|
"input",
|
|
577
602
|
{
|
|
578
603
|
type: "text",
|
|
579
604
|
className: "w-full mb-2 px-2 py-1 text-sm border border-[var(--tiger-border,#e5e7eb)] rounded bg-[var(--tiger-surface,#ffffff)] focus:outline-none focus:ring-1 focus:ring-[var(--tiger-primary,#2563eb)]",
|
|
580
|
-
placeholder: "Search...",
|
|
581
|
-
value: internalSearchValue,
|
|
582
|
-
onChange: (e) => setInternalSearchValue(e.target.value)
|
|
605
|
+
placeholder: _tigercatcore.resolveLocaleText.call(void 0, "Search...", _optionalChain([ctx, 'access', _18 => _18.mergedLocale, 'optionalAccess', _19 => _19.common, 'optionalAccess', _20 => _20.searchPlaceholder])),
|
|
606
|
+
value: ctx.internalSearchValue,
|
|
607
|
+
onChange: (e) => ctx.setInternalSearchValue(e.target.value)
|
|
583
608
|
}
|
|
584
609
|
),
|
|
585
|
-
virtual ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
610
|
+
ctx.virtual ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
586
611
|
_chunkP36GX65Njs.VirtualList,
|
|
587
612
|
{
|
|
588
|
-
itemCount: visibleItems.length,
|
|
589
|
-
itemHeight,
|
|
590
|
-
height,
|
|
613
|
+
itemCount: ctx.visibleItems.length,
|
|
614
|
+
itemHeight: ctx.itemHeight,
|
|
615
|
+
height: ctx.height,
|
|
591
616
|
renderItem: ({ index }) => {
|
|
592
|
-
const item = visibleItems[index];
|
|
617
|
+
const item = ctx.visibleItems[index];
|
|
593
618
|
if (!item) return null;
|
|
594
|
-
return renderTreeRow(item.node, item.level - 1);
|
|
619
|
+
return renderTreeRow(ctx, item.node, item.level - 1);
|
|
595
620
|
}
|
|
596
621
|
}
|
|
597
|
-
) : treeData.map((node) => renderTreeNode(node, 0))
|
|
622
|
+
) : ctx.treeData.map((node) => renderTreeNode(ctx, node, 0))
|
|
598
623
|
]
|
|
599
624
|
}
|
|
600
625
|
);
|