@v-c/tree 1.0.6 → 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.
@@ -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
@@ -107,7 +107,7 @@ var NodeList = /* @__PURE__ */ defineComponent((props, { attrs, expose }) => {
107
107
  });
108
108
  const mergedData = computed(() => props.motion ? transitionData.value : props.data || []);
109
109
  return () => {
110
- const { motion, activeItem, focusable, disabled, tabIndex, prefixCls, virtual, itemHeight, height, scrollWidth, onScroll, onContextmenu, onKeyDown, onFocus, onBlur, onMouseDown, onMouseUp, onListChangeStart, onActiveChange } = props;
110
+ const { motion, activeItem, focusable, disabled, tabIndex, prefixCls, virtual, itemHeight, height, scrollWidth, onScroll, onContextmenu, onKeyDown, onFocus, onBlur, onMouseDown, onListChangeStart, onActiveChange } = props;
111
111
  return createVNode(Fragment, null, [createVNode("div", {
112
112
  "class": `${prefixCls}-treenode`,
113
113
  "aria-hidden": true,
@@ -143,7 +143,6 @@ var NodeList = /* @__PURE__ */ defineComponent((props, { attrs, expose }) => {
143
143
  "onFocus": onFocus,
144
144
  "onBlur": onBlur,
145
145
  "onMousedown": onMouseDown,
146
- "onMouseup": onMouseUp,
147
146
  "onVisibleChange": (originList) => {
148
147
  if (motionType.value && originList.every((item) => itemKey(item) !== MOTION_KEY)) onMotionEnd();
149
148
  }
@@ -308,11 +307,6 @@ var NodeList = /* @__PURE__ */ defineComponent((props, { attrs, expose }) => {
308
307
  required: false,
309
308
  default: void 0
310
309
  },
311
- onMouseUp: {
312
- type: Function,
313
- required: false,
314
- default: void 0
315
- },
316
310
  onActiveChange: {
317
311
  type: Function,
318
312
  required: false,
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
@@ -5,7 +5,7 @@ import { convertDataToEntities, convertNodePropsToEventData, convertTreeToData,
5
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";
@@ -230,7 +230,6 @@ var Tree = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose }) =>
230
230
  props.onFocus?.(e);
231
231
  }
232
232
  function onBlur(e) {
233
- focusedByMouse = false;
234
233
  onActiveChange(null);
235
234
  props.onBlur?.(e);
236
235
  }
@@ -238,9 +237,8 @@ var Tree = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose }) =>
238
237
  focusedByMouse = true;
239
238
  props.onMouseDown?.(e);
240
239
  }
241
- function onMouseUp(e) {
240
+ function onGlobalMouseUp() {
242
241
  focusedByMouse = false;
243
- props.onMouseUp?.(e);
244
242
  }
245
243
  function onNodeLoad(treeNode) {
246
244
  const key = treeNode.key;
@@ -428,8 +426,12 @@ var Tree = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose }) =>
428
426
  onNodeDragEnd(event, null, true);
429
427
  window.removeEventListener("dragend", onWindowDragEnd);
430
428
  };
429
+ onMounted(() => {
430
+ window.addEventListener("mouseup", onGlobalMouseUp);
431
+ });
431
432
  onBeforeUnmount(() => {
432
433
  window.removeEventListener("dragend", onWindowDragEnd);
434
+ window.removeEventListener("mouseup", onGlobalMouseUp);
433
435
  Object.keys(delayedDragEnterLogic).forEach((key) => {
434
436
  clearTimeout(delayedDragEnterLogic[key]);
435
437
  });
@@ -740,7 +742,6 @@ var Tree = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose }) =>
740
742
  "activeItem": getActiveItem.value,
741
743
  "onFocus": onFocus,
742
744
  "onMouseDown": onMouseDown,
743
- "onMouseUp": onMouseUp,
744
745
  "onBlur": onBlur,
745
746
  "onKeyDown": onKeyDown,
746
747
  "onActiveChange": onActiveChange,
@@ -942,11 +943,6 @@ var Tree = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose }) =>
942
943
  required: false,
943
944
  default: void 0
944
945
  },
945
- onMouseUp: {
946
- type: Function,
947
- required: false,
948
- default: void 0
949
- },
950
946
  onFocus: {
951
947
  type: Function,
952
948
  required: false,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@v-c/tree",
3
3
  "type": "module",
4
- "version": "1.0.6",
4
+ "version": "1.1.0-rc.1",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"