@v-c/tree 1.0.5 → 1.1.0-rc.1
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/DropIndicator.js +7 -11
- package/dist/Indent.js +6 -6
- package/dist/MotionTreeNode.js +8 -7
- package/dist/NodeList.d.ts +0 -1
- package/dist/NodeList.js +19 -33
- package/dist/Tree.d.ts +0 -1
- package/dist/Tree.js +16 -21
- package/dist/TreeNode.js +8 -7
- package/dist/contextTypes.js +5 -2
- package/dist/index.js +7 -6
- package/dist/inter.js +2 -0
- package/dist/util.js +2 -0
- package/dist/utils/conductUtil.js +2 -0
- package/dist/utils/diffUtil.js +2 -0
- package/dist/utils/keyUtil.js +2 -0
- package/dist/utils/treeUtil.js +2 -0
- package/package.json +3 -3
package/dist/DropIndicator.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createVNode, defineComponent } from "vue";
|
|
2
|
-
|
|
2
|
+
//#region src/DropIndicator.tsx
|
|
3
|
+
var DropIndicator = /* @__PURE__ */ defineComponent((props) => {
|
|
3
4
|
return () => {
|
|
4
5
|
const style = {
|
|
5
6
|
pointerEvents: "none",
|
|
@@ -17,7 +18,6 @@ var DropIndicator_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
17
18
|
style.bottom = 0;
|
|
18
19
|
style.left = `${-props.dropLevelOffset * props.indent}px`;
|
|
19
20
|
break;
|
|
20
|
-
case 0:
|
|
21
21
|
default:
|
|
22
22
|
style.bottom = 0;
|
|
23
23
|
style.left = `${props.indent}px`;
|
|
@@ -27,22 +27,18 @@ var DropIndicator_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
27
27
|
};
|
|
28
28
|
}, {
|
|
29
29
|
props: {
|
|
30
|
-
dropPosition: {
|
|
31
|
-
required: true,
|
|
32
|
-
default: void 0
|
|
33
|
-
},
|
|
30
|
+
dropPosition: { required: true },
|
|
34
31
|
dropLevelOffset: {
|
|
35
32
|
type: Number,
|
|
36
|
-
required: true
|
|
37
|
-
default: void 0
|
|
33
|
+
required: true
|
|
38
34
|
},
|
|
39
35
|
indent: {
|
|
40
36
|
type: Number,
|
|
41
|
-
required: true
|
|
42
|
-
default: void 0
|
|
37
|
+
required: true
|
|
43
38
|
}
|
|
44
39
|
},
|
|
45
40
|
name: "DropIndicator",
|
|
46
41
|
inheritAttrs: false
|
|
47
42
|
});
|
|
48
|
-
|
|
43
|
+
//#endregion
|
|
44
|
+
export { DropIndicator as default };
|
package/dist/Indent.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createVNode, defineComponent } from "vue";
|
|
2
2
|
import { clsx } from "@v-c/util";
|
|
3
|
-
|
|
3
|
+
//#region src/Indent.tsx
|
|
4
|
+
var Indent = /* @__PURE__ */ defineComponent((props) => {
|
|
4
5
|
return () => {
|
|
5
6
|
const { prefixCls, level, isStart, isEnd } = props;
|
|
6
7
|
const baseClassName = `${prefixCls}-indent-unit`;
|
|
@@ -21,13 +22,11 @@ var Indent_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
21
22
|
props: {
|
|
22
23
|
prefixCls: {
|
|
23
24
|
type: String,
|
|
24
|
-
required: true
|
|
25
|
-
default: void 0
|
|
25
|
+
required: true
|
|
26
26
|
},
|
|
27
27
|
level: {
|
|
28
28
|
type: Number,
|
|
29
|
-
required: true
|
|
30
|
-
default: void 0
|
|
29
|
+
required: true
|
|
31
30
|
},
|
|
32
31
|
isStart: {
|
|
33
32
|
type: Array,
|
|
@@ -43,4 +42,5 @@ var Indent_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
43
42
|
name: "Indent",
|
|
44
43
|
inheritAttrs: false
|
|
45
44
|
});
|
|
46
|
-
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Indent as default };
|
package/dist/MotionTreeNode.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { TreeContextKey } from "./contextTypes.js";
|
|
2
2
|
import { getTreeNodeProps } from "./utils/treeUtil.js";
|
|
3
|
-
import
|
|
3
|
+
import TreeNode from "./TreeNode.js";
|
|
4
4
|
import { Transition, computed, createVNode, defineComponent, inject, mergeProps, onBeforeUnmount, ref, watch } from "vue";
|
|
5
5
|
import { clsx } from "@v-c/util";
|
|
6
6
|
import omit from "@v-c/util/dist/omit";
|
|
7
7
|
import { getTransitionProps } from "@v-c/util/dist/utils/transition";
|
|
8
|
-
|
|
8
|
+
//#region src/MotionTreeNode.tsx
|
|
9
|
+
var MotionTreeNode = /* @__PURE__ */ defineComponent((props) => {
|
|
9
10
|
const context = inject(TreeContextKey, null);
|
|
10
11
|
const prefixCls = computed(() => context?.prefixCls);
|
|
11
12
|
let hideTimer = null;
|
|
@@ -83,7 +84,7 @@ var MotionTreeNode_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
83
84
|
const restProps = { ...nodeData || {} };
|
|
84
85
|
delete restProps.children;
|
|
85
86
|
delete restProps.key;
|
|
86
|
-
return createVNode(
|
|
87
|
+
return createVNode(TreeNode, mergeProps(restProps, getTreeNodeProps(key, requiredProps), {
|
|
87
88
|
"title": title,
|
|
88
89
|
"active": active,
|
|
89
90
|
"data": nodeData,
|
|
@@ -94,7 +95,7 @@ var MotionTreeNode_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
94
95
|
}), null);
|
|
95
96
|
})])] });
|
|
96
97
|
}
|
|
97
|
-
return createVNode(
|
|
98
|
+
return createVNode(TreeNode, mergeProps(omit(props, [
|
|
98
99
|
"motion",
|
|
99
100
|
"motionNodes",
|
|
100
101
|
"motionType",
|
|
@@ -137,8 +138,7 @@ var MotionTreeNode_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
137
138
|
},
|
|
138
139
|
treeNodeRequiredProps: {
|
|
139
140
|
type: Object,
|
|
140
|
-
required: true
|
|
141
|
-
default: void 0
|
|
141
|
+
required: true
|
|
142
142
|
},
|
|
143
143
|
treeId: {
|
|
144
144
|
type: String,
|
|
@@ -320,4 +320,5 @@ var MotionTreeNode_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
320
320
|
name: "MotionTreeNode",
|
|
321
321
|
inheritAttrs: false
|
|
322
322
|
});
|
|
323
|
-
|
|
323
|
+
//#endregion
|
|
324
|
+
export { MotionTreeNode as default };
|
package/dist/NodeList.d.ts
CHANGED
|
@@ -35,7 +35,6 @@ export interface NodeListProps {
|
|
|
35
35
|
onFocus?: (e: FocusEvent) => void;
|
|
36
36
|
onBlur?: (e: FocusEvent) => void;
|
|
37
37
|
onMouseDown?: (e: MouseEvent) => void;
|
|
38
|
-
onMouseUp?: (e: MouseEvent) => void;
|
|
39
38
|
onActiveChange?: (key: Key | null) => void;
|
|
40
39
|
onListChangeStart?: () => void;
|
|
41
40
|
onListChangeEnd?: () => void;
|
package/dist/NodeList.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { getKey, getTreeNodeProps } from "./utils/treeUtil.js";
|
|
2
|
-
import
|
|
2
|
+
import MotionTreeNode from "./MotionTreeNode.js";
|
|
3
3
|
import { findExpandedKeys, getExpandRange } from "./utils/diffUtil.js";
|
|
4
4
|
import { Fragment, computed, createVNode, defineComponent, mergeProps, ref, shallowRef, watch } from "vue";
|
|
5
5
|
import useId, { getId } from "@v-c/util/dist/hooks/useId";
|
|
6
6
|
import { toPropsRefs } from "@v-c/util/dist/props-util";
|
|
7
7
|
import VirtualList from "@v-c/virtual-list";
|
|
8
|
+
//#region src/NodeList.tsx
|
|
8
9
|
function itemKey(item) {
|
|
9
10
|
const { key, pos } = item;
|
|
10
11
|
return String(getKey(key, pos));
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
var MOTION_KEY = `VC_TREE_MOTION_${Math.random()}`;
|
|
13
14
|
var MotionNode = { key: MOTION_KEY };
|
|
14
|
-
|
|
15
|
+
var MotionEntity = {
|
|
15
16
|
key: MOTION_KEY,
|
|
16
17
|
level: 0,
|
|
17
18
|
index: 0,
|
|
@@ -33,7 +34,7 @@ function getMinimumRangeTransitionRange(list, virtual, height, itemHeight) {
|
|
|
33
34
|
if (virtual === false || !height || !itemHeight) return list;
|
|
34
35
|
return list.slice(0, Math.ceil(height / itemHeight) + 1);
|
|
35
36
|
}
|
|
36
|
-
var
|
|
37
|
+
var NodeList = /* @__PURE__ */ defineComponent((props, { attrs, expose }) => {
|
|
37
38
|
const treeId = useId();
|
|
38
39
|
const listRef = ref();
|
|
39
40
|
const indentMeasurerRef = ref();
|
|
@@ -106,7 +107,7 @@ var NodeList_default = /* @__PURE__ */ defineComponent((props, { attrs, expose }
|
|
|
106
107
|
});
|
|
107
108
|
const mergedData = computed(() => props.motion ? transitionData.value : props.data || []);
|
|
108
109
|
return () => {
|
|
109
|
-
const { motion, activeItem, focusable, disabled, tabIndex, prefixCls, virtual, itemHeight, height, scrollWidth, onScroll, onContextmenu, onKeyDown, onFocus, onBlur, onMouseDown,
|
|
110
|
+
const { motion, activeItem, focusable, disabled, tabIndex, prefixCls, virtual, itemHeight, height, scrollWidth, onScroll, onContextmenu, onKeyDown, onFocus, onBlur, onMouseDown, onListChangeStart, onActiveChange } = props;
|
|
110
111
|
return createVNode(Fragment, null, [createVNode("div", {
|
|
111
112
|
"class": `${prefixCls}-treenode`,
|
|
112
113
|
"aria-hidden": true,
|
|
@@ -142,7 +143,6 @@ var NodeList_default = /* @__PURE__ */ defineComponent((props, { attrs, expose }
|
|
|
142
143
|
"onFocus": onFocus,
|
|
143
144
|
"onBlur": onBlur,
|
|
144
145
|
"onMousedown": onMouseDown,
|
|
145
|
-
"onMouseup": onMouseUp,
|
|
146
146
|
"onVisibleChange": (originList) => {
|
|
147
147
|
if (motionType.value && originList.every((item) => itemKey(item) !== MOTION_KEY)) onMotionEnd();
|
|
148
148
|
}
|
|
@@ -154,7 +154,7 @@ var NodeList_default = /* @__PURE__ */ defineComponent((props, { attrs, expose }
|
|
|
154
154
|
const restProps = { ...nodeData || {} };
|
|
155
155
|
delete restProps.key;
|
|
156
156
|
delete restProps.children;
|
|
157
|
-
return createVNode(
|
|
157
|
+
return createVNode(MotionTreeNode, mergeProps(restProps, treeNodeProps, {
|
|
158
158
|
"title": title,
|
|
159
159
|
"active": active,
|
|
160
160
|
"pos": pos,
|
|
@@ -176,8 +176,7 @@ var NodeList_default = /* @__PURE__ */ defineComponent((props, { attrs, expose }
|
|
|
176
176
|
props: {
|
|
177
177
|
prefixCls: {
|
|
178
178
|
type: String,
|
|
179
|
-
required: true
|
|
180
|
-
default: void 0
|
|
179
|
+
required: true
|
|
181
180
|
},
|
|
182
181
|
style: {
|
|
183
182
|
required: false,
|
|
@@ -215,38 +214,31 @@ var NodeList_default = /* @__PURE__ */ defineComponent((props, { attrs, expose }
|
|
|
215
214
|
},
|
|
216
215
|
expandedKeys: {
|
|
217
216
|
type: Array,
|
|
218
|
-
required: true
|
|
219
|
-
default: void 0
|
|
217
|
+
required: true
|
|
220
218
|
},
|
|
221
219
|
selectedKeys: {
|
|
222
220
|
type: Array,
|
|
223
|
-
required: true
|
|
224
|
-
default: void 0
|
|
221
|
+
required: true
|
|
225
222
|
},
|
|
226
223
|
checkedKeys: {
|
|
227
224
|
type: Array,
|
|
228
|
-
required: true
|
|
229
|
-
default: void 0
|
|
225
|
+
required: true
|
|
230
226
|
},
|
|
231
227
|
loadedKeys: {
|
|
232
228
|
type: Array,
|
|
233
|
-
required: true
|
|
234
|
-
default: void 0
|
|
229
|
+
required: true
|
|
235
230
|
},
|
|
236
231
|
loadingKeys: {
|
|
237
232
|
type: Array,
|
|
238
|
-
required: true
|
|
239
|
-
default: void 0
|
|
233
|
+
required: true
|
|
240
234
|
},
|
|
241
235
|
halfCheckedKeys: {
|
|
242
236
|
type: Array,
|
|
243
|
-
required: true
|
|
244
|
-
default: void 0
|
|
237
|
+
required: true
|
|
245
238
|
},
|
|
246
239
|
keyEntities: {
|
|
247
240
|
type: Object,
|
|
248
|
-
required: true
|
|
249
|
-
default: void 0
|
|
241
|
+
required: true
|
|
250
242
|
},
|
|
251
243
|
dragging: {
|
|
252
244
|
type: Boolean,
|
|
@@ -259,13 +251,11 @@ var NodeList_default = /* @__PURE__ */ defineComponent((props, { attrs, expose }
|
|
|
259
251
|
Number,
|
|
260
252
|
null
|
|
261
253
|
],
|
|
262
|
-
required: true
|
|
263
|
-
default: void 0
|
|
254
|
+
required: true
|
|
264
255
|
},
|
|
265
256
|
dropPosition: {
|
|
266
257
|
type: [Number, null],
|
|
267
|
-
required: true
|
|
268
|
-
default: void 0
|
|
258
|
+
required: true
|
|
269
259
|
},
|
|
270
260
|
motion: {
|
|
271
261
|
type: Object,
|
|
@@ -317,11 +307,6 @@ var NodeList_default = /* @__PURE__ */ defineComponent((props, { attrs, expose }
|
|
|
317
307
|
required: false,
|
|
318
308
|
default: void 0
|
|
319
309
|
},
|
|
320
|
-
onMouseUp: {
|
|
321
|
-
type: Function,
|
|
322
|
-
required: false,
|
|
323
|
-
default: void 0
|
|
324
|
-
},
|
|
325
310
|
onActiveChange: {
|
|
326
311
|
type: Function,
|
|
327
312
|
required: false,
|
|
@@ -351,4 +336,5 @@ var NodeList_default = /* @__PURE__ */ defineComponent((props, { attrs, expose }
|
|
|
351
336
|
name: "NodeList",
|
|
352
337
|
inheritAttrs: false
|
|
353
338
|
});
|
|
354
|
-
|
|
339
|
+
//#endregion
|
|
340
|
+
export { MOTION_KEY, MotionEntity, NodeList as default };
|
package/dist/Tree.d.ts
CHANGED
|
@@ -63,7 +63,6 @@ export interface TreeProps<TreeDataType extends BasicDataNode = DataNode> {
|
|
|
63
63
|
direction: Direction;
|
|
64
64
|
}) => any;
|
|
65
65
|
onMouseDown?: (e: MouseEvent) => void;
|
|
66
|
-
onMouseUp?: (e: MouseEvent) => void;
|
|
67
66
|
onFocus?: (e: FocusEvent) => void;
|
|
68
67
|
onBlur?: (e: FocusEvent) => void;
|
|
69
68
|
onKeyDown?: (e: KeyboardEvent) => void;
|
package/dist/Tree.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import DropIndicator from "./DropIndicator.js";
|
|
2
2
|
import { TreeContextKey } from "./contextTypes.js";
|
|
3
3
|
import getEntity from "./utils/keyUtil.js";
|
|
4
4
|
import { convertDataToEntities, convertNodePropsToEventData, convertTreeToData, fillFieldNames, flattenTreeData, getTreeNodeProps, isLeafNode, warningWithoutKey } from "./utils/treeUtil.js";
|
|
5
|
-
import
|
|
5
|
+
import NodeList, { MOTION_KEY, MotionEntity } from "./NodeList.js";
|
|
6
6
|
import { arrAdd, arrDel, calcDropPosition, calcSelectedKeys, conductExpandParent, getDragChildrenKeys, parseCheckedKeys, posToArr } from "./util.js";
|
|
7
7
|
import { conductCheck } from "./utils/conductUtil.js";
|
|
8
|
-
import { computed, createVNode, defineComponent, mergeDefaults, mergeProps, onBeforeUnmount, provide, reactive, ref, shallowRef, watch, watchEffect } from "vue";
|
|
8
|
+
import { computed, createVNode, defineComponent, mergeDefaults, mergeProps, onBeforeUnmount, onMounted, provide, reactive, ref, shallowRef, watch, watchEffect } from "vue";
|
|
9
9
|
import { clsx } from "@v-c/util";
|
|
10
10
|
import pickAttrs from "@v-c/util/dist/pickAttrs";
|
|
11
11
|
import warning from "@v-c/util/dist/warning";
|
|
12
12
|
import useMergedState from "@v-c/util/dist/hooks/useMergedState";
|
|
13
13
|
import KeyCode from "@v-c/util/dist/KeyCode";
|
|
14
|
+
//#region src/Tree.tsx
|
|
14
15
|
var MAX_RETRY_TIMES = 10;
|
|
15
16
|
var defaultProps = {
|
|
16
17
|
prefixCls: "vc-tree",
|
|
@@ -34,7 +35,7 @@ var defaultProps = {
|
|
|
34
35
|
tabIndex: 0,
|
|
35
36
|
virtual: true
|
|
36
37
|
};
|
|
37
|
-
var
|
|
38
|
+
var Tree = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose }) => {
|
|
38
39
|
const mergedPrefixCls = computed(() => props.prefixCls);
|
|
39
40
|
const mergedShowLine = computed(() => props.showLine);
|
|
40
41
|
const mergedShowIcon = computed(() => props.showIcon);
|
|
@@ -229,7 +230,6 @@ var Tree_default = /* @__PURE__ */ defineComponent((props, { slots, attrs, expos
|
|
|
229
230
|
props.onFocus?.(e);
|
|
230
231
|
}
|
|
231
232
|
function onBlur(e) {
|
|
232
|
-
focusedByMouse = false;
|
|
233
233
|
onActiveChange(null);
|
|
234
234
|
props.onBlur?.(e);
|
|
235
235
|
}
|
|
@@ -237,9 +237,8 @@ var Tree_default = /* @__PURE__ */ defineComponent((props, { slots, attrs, expos
|
|
|
237
237
|
focusedByMouse = true;
|
|
238
238
|
props.onMouseDown?.(e);
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function onGlobalMouseUp() {
|
|
241
241
|
focusedByMouse = false;
|
|
242
|
-
props.onMouseUp?.(e);
|
|
243
242
|
}
|
|
244
243
|
function onNodeLoad(treeNode) {
|
|
245
244
|
const key = treeNode.key;
|
|
@@ -291,17 +290,14 @@ var Tree_default = /* @__PURE__ */ defineComponent((props, { slots, attrs, expos
|
|
|
291
290
|
}
|
|
292
291
|
}
|
|
293
292
|
function triggerExpandActionExpand(e, treeNode) {
|
|
294
|
-
const expanded = treeNode.expanded;
|
|
295
293
|
const key = treeNode.key;
|
|
296
294
|
if (treeNode.isLeaf || e.shiftKey || e.metaKey || e.ctrlKey) return;
|
|
297
295
|
const node = flattenNodes.value.find((nodeItem) => nodeItem.key === key);
|
|
298
296
|
if (!node) return;
|
|
299
|
-
|
|
297
|
+
onNodeExpand(e, convertNodePropsToEventData({
|
|
300
298
|
...getTreeNodeProps(key, getTreeNodeRequiredProps.value),
|
|
301
299
|
data: node.data
|
|
302
|
-
});
|
|
303
|
-
setExpandedKeys(expanded ? arrDel(expandedKeys.value, key) : arrAdd(expandedKeys.value, key));
|
|
304
|
-
onNodeExpand(e, eventNode);
|
|
300
|
+
}));
|
|
305
301
|
}
|
|
306
302
|
const onNodeClick = (e, treeNode) => {
|
|
307
303
|
if (props.expandAction === "click") triggerExpandActionExpand(e, treeNode);
|
|
@@ -430,8 +426,12 @@ var Tree_default = /* @__PURE__ */ defineComponent((props, { slots, attrs, expos
|
|
|
430
426
|
onNodeDragEnd(event, null, true);
|
|
431
427
|
window.removeEventListener("dragend", onWindowDragEnd);
|
|
432
428
|
};
|
|
429
|
+
onMounted(() => {
|
|
430
|
+
window.addEventListener("mouseup", onGlobalMouseUp);
|
|
431
|
+
});
|
|
433
432
|
onBeforeUnmount(() => {
|
|
434
433
|
window.removeEventListener("dragend", onWindowDragEnd);
|
|
434
|
+
window.removeEventListener("mouseup", onGlobalMouseUp);
|
|
435
435
|
Object.keys(delayedDragEnterLogic).forEach((key) => {
|
|
436
436
|
clearTimeout(delayedDragEnterLogic[key]);
|
|
437
437
|
});
|
|
@@ -650,7 +650,7 @@ var Tree_default = /* @__PURE__ */ defineComponent((props, { slots, attrs, expos
|
|
|
650
650
|
indent: indent.value,
|
|
651
651
|
dropIndicatorRender: (diProps) => {
|
|
652
652
|
if (props.dropIndicatorRender) return props.dropIndicatorRender(diProps);
|
|
653
|
-
return createVNode(
|
|
653
|
+
return createVNode(DropIndicator, {
|
|
654
654
|
"dropPosition": diProps.dropPosition,
|
|
655
655
|
"dropLevelOffset": diProps.dropLevelOffset,
|
|
656
656
|
"indent": diProps.indent
|
|
@@ -724,7 +724,7 @@ var Tree_default = /* @__PURE__ */ defineComponent((props, { slots, attrs, expos
|
|
|
724
724
|
return createVNode("div", {
|
|
725
725
|
"class": clsx(mergedPrefixCls.value, props.className, props.rootClassName, { [`${mergedPrefixCls.value}-show-line`]: mergedShowLine.value }),
|
|
726
726
|
"style": props.rootStyle
|
|
727
|
-
}, [createVNode(
|
|
727
|
+
}, [createVNode(NodeList, mergeProps({
|
|
728
728
|
"ref": listRef,
|
|
729
729
|
"prefixCls": mergedPrefixCls.value,
|
|
730
730
|
"style": props.style,
|
|
@@ -742,7 +742,6 @@ var Tree_default = /* @__PURE__ */ defineComponent((props, { slots, attrs, expos
|
|
|
742
742
|
"activeItem": getActiveItem.value,
|
|
743
743
|
"onFocus": onFocus,
|
|
744
744
|
"onMouseDown": onMouseDown,
|
|
745
|
-
"onMouseUp": onMouseUp,
|
|
746
745
|
"onBlur": onBlur,
|
|
747
746
|
"onKeyDown": onKeyDown,
|
|
748
747
|
"onActiveChange": onActiveChange,
|
|
@@ -944,11 +943,6 @@ var Tree_default = /* @__PURE__ */ defineComponent((props, { slots, attrs, expos
|
|
|
944
943
|
required: false,
|
|
945
944
|
default: void 0
|
|
946
945
|
},
|
|
947
|
-
onMouseUp: {
|
|
948
|
-
type: Function,
|
|
949
|
-
required: false,
|
|
950
|
-
default: void 0
|
|
951
|
-
},
|
|
952
946
|
onFocus: {
|
|
953
947
|
type: Function,
|
|
954
948
|
required: false,
|
|
@@ -1131,4 +1125,5 @@ var Tree_default = /* @__PURE__ */ defineComponent((props, { slots, attrs, expos
|
|
|
1131
1125
|
name: "Tree",
|
|
1132
1126
|
inheritAttrs: false
|
|
1133
1127
|
});
|
|
1134
|
-
|
|
1128
|
+
//#endregion
|
|
1129
|
+
export { Tree as default };
|
package/dist/TreeNode.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Indent from "./Indent.js";
|
|
2
2
|
import { TreeContextKey, UnstableContextKey } from "./contextTypes.js";
|
|
3
3
|
import getEntity from "./utils/keyUtil.js";
|
|
4
4
|
import { convertNodePropsToEventData, isLeafNode } from "./utils/treeUtil.js";
|
|
@@ -7,6 +7,7 @@ import { clsx } from "@v-c/util";
|
|
|
7
7
|
import { getId } from "@v-c/util/dist/hooks/useId";
|
|
8
8
|
import pickAttrs from "@v-c/util/dist/pickAttrs";
|
|
9
9
|
import { filterEmpty } from "@v-c/util/dist/props-util";
|
|
10
|
+
//#region src/TreeNode.tsx
|
|
10
11
|
var ICON_OPEN = "open";
|
|
11
12
|
var ICON_CLOSE = "close";
|
|
12
13
|
var defaultTitle = "---";
|
|
@@ -117,11 +118,11 @@ var TreeNode = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
117
118
|
};
|
|
118
119
|
const renderSwitcher = () => {
|
|
119
120
|
if (memoizedIsLeaf.value) {
|
|
120
|
-
const switcherIconDom
|
|
121
|
-
return switcherIconDom
|
|
121
|
+
const switcherIconDom = renderSwitcherIconDom(true);
|
|
122
|
+
return switcherIconDom !== false ? createVNode("span", {
|
|
122
123
|
"class": clsx(`${context.prefixCls}-switcher`, `${context.prefixCls}-switcher-noop`, context.classNames?.itemSwitcher),
|
|
123
124
|
"style": context.styles?.itemSwitcher
|
|
124
|
-
}, [switcherIconDom
|
|
125
|
+
}, [switcherIconDom]) : null;
|
|
125
126
|
}
|
|
126
127
|
const switcherIconDom = renderSwitcherIconDom(false);
|
|
127
128
|
return switcherIconDom !== false ? createVNode("span", {
|
|
@@ -254,7 +255,7 @@ var TreeNode = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
254
255
|
"onDragend": isDraggable.value ? onDragEnd : void 0,
|
|
255
256
|
"onMousemove": props.onMouseMove
|
|
256
257
|
}, dataOrAriaAttributeProps.value), [
|
|
257
|
-
createVNode(
|
|
258
|
+
createVNode(Indent, {
|
|
258
259
|
"prefixCls": context.prefixCls,
|
|
259
260
|
"level": level.value,
|
|
260
261
|
"isStart": props.isStart || [],
|
|
@@ -458,5 +459,5 @@ var TreeNode = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
458
459
|
inheritAttrs: false
|
|
459
460
|
});
|
|
460
461
|
TreeNode.isTreeNode = true;
|
|
461
|
-
|
|
462
|
-
export {
|
|
462
|
+
//#endregion
|
|
463
|
+
export { TreeNode as default };
|
package/dist/contextTypes.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/contextTypes.ts
|
|
2
|
+
var TreeContextKey = Symbol("TreeContext");
|
|
3
|
+
/** Internal usage, safe to remove. Do not use in prod */
|
|
4
|
+
var UnstableContextKey = Symbol("UnstableTreeContext");
|
|
5
|
+
//#endregion
|
|
3
6
|
export { TreeContextKey, UnstableContextKey };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { UnstableContextKey } from "./contextTypes.js";
|
|
2
2
|
import { convertDataToEntities, convertTreeToData, fillFieldNames, flattenTreeData } from "./utils/treeUtil.js";
|
|
3
|
-
import
|
|
3
|
+
import TreeNode from "./TreeNode.js";
|
|
4
4
|
import { arrAdd, arrDel, calcDropPosition, calcSelectedKeys, conductExpandParent, getDragChildrenKeys, isFirstChild, isLastChild, parseCheckedKeys, posToArr } from "./util.js";
|
|
5
5
|
import { conductCheck } from "./utils/conductUtil.js";
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
ExportTree
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
import Tree from "./Tree.js";
|
|
7
|
+
//#region src/index.ts
|
|
8
|
+
var ExportTree = Tree;
|
|
9
|
+
ExportTree.TreeNode = TreeNode;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { TreeNode, UnstableContextKey, arrAdd, arrDel, calcDropPosition, calcSelectedKeys, conductCheck, conductExpandParent, convertDataToEntities, convertTreeToData, ExportTree as default, fillFieldNames, flattenTreeData, getDragChildrenKeys, isFirstChild, isLastChild, parseCheckedKeys, posToArr };
|
package/dist/inter.js
CHANGED
package/dist/util.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import getEntity from "./utils/keyUtil.js";
|
|
2
2
|
import warning from "@v-c/util/dist/warning";
|
|
3
|
+
//#region src/util.ts
|
|
3
4
|
function arrDel(list, value) {
|
|
4
5
|
if (!list) return [];
|
|
5
6
|
const clone = list.slice();
|
|
@@ -144,4 +145,5 @@ function conductExpandParent(keyList, keyEntities) {
|
|
|
144
145
|
});
|
|
145
146
|
return [...expandedKeys];
|
|
146
147
|
}
|
|
148
|
+
//#endregion
|
|
147
149
|
export { arrAdd, arrDel, calcDropPosition, calcSelectedKeys, conductExpandParent, getDragChildrenKeys, isFirstChild, isLastChild, parseCheckedKeys, posToArr };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import getEntity from "./keyUtil.js";
|
|
2
2
|
import warning from "@v-c/util/dist/warning";
|
|
3
|
+
//#region src/utils/conductUtil.ts
|
|
3
4
|
function removeFromCheckedKeys(halfCheckedKeys, checkedKeys) {
|
|
4
5
|
const filteredKeys = /* @__PURE__ */ new Set();
|
|
5
6
|
halfCheckedKeys.forEach((key) => {
|
|
@@ -103,4 +104,5 @@ function conductCheck(keyList, checked, keyEntities, getCheckDisabled) {
|
|
|
103
104
|
if (checked === true) return fillConductCheck(keys, levelEntities, maxLevel, syntheticGetCheckDisabled);
|
|
104
105
|
return cleanConductCheck(keys, checked.halfCheckedKeys, levelEntities, maxLevel, syntheticGetCheckDisabled);
|
|
105
106
|
}
|
|
107
|
+
//#endregion
|
|
106
108
|
export { conductCheck, isCheckDisabled };
|
package/dist/utils/diffUtil.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/utils/diffUtil.ts
|
|
1
2
|
function findExpandedKeys(prev = [], next = []) {
|
|
2
3
|
const prevLen = prev.length;
|
|
3
4
|
const nextLen = next.length;
|
|
@@ -31,4 +32,5 @@ function getExpandRange(shorter, longer, key) {
|
|
|
31
32
|
}
|
|
32
33
|
return longer.slice(longerStartIndex + 1);
|
|
33
34
|
}
|
|
35
|
+
//#endregion
|
|
34
36
|
export { findExpandedKeys, getExpandRange };
|
package/dist/utils/keyUtil.js
CHANGED
package/dist/utils/treeUtil.js
CHANGED
|
@@ -2,6 +2,7 @@ import getEntity from "./keyUtil.js";
|
|
|
2
2
|
import { toArray } from "@v-c/util/dist/Children/toArray";
|
|
3
3
|
import { omit } from "@v-c/util/dist/utils/omit";
|
|
4
4
|
import warning from "@v-c/util/dist/warning";
|
|
5
|
+
//#region src/utils/treeUtil.ts
|
|
5
6
|
function getPosition(level, index) {
|
|
6
7
|
return `${level}-${index}`;
|
|
7
8
|
}
|
|
@@ -215,4 +216,5 @@ function isLeafNode(isLeaf, loadData, hasChildren, loaded) {
|
|
|
215
216
|
if (isLeaf === false) return false;
|
|
216
217
|
return !!isLeaf || !loadData && !hasChildren || !!(loadData && loaded && !hasChildren);
|
|
217
218
|
}
|
|
219
|
+
//#endregion
|
|
218
220
|
export { convertDataToEntities, convertNodePropsToEventData, convertTreeToData, fillFieldNames, flattenTreeData, getKey, getPosition, getTreeNodeProps, isLeafNode, isTreeNode, traverseDataNodes, warningWithoutKey };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/tree",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.1.0-rc.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"vue": "^3.0.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@v-c/util": "^1.0.
|
|
33
|
-
"@v-c/virtual-list": "^1.0.
|
|
32
|
+
"@v-c/util": "^1.0.19",
|
|
33
|
+
"@v-c/virtual-list": "^1.0.7"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "vite build",
|