bkui-vue 0.0.1-beta.221 → 0.0.1-beta.222

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/index.esm.js CHANGED
@@ -27158,6 +27158,10 @@ var EVENTS = /* @__PURE__ */ ((EVENTS2) => {
27158
27158
  EVENTS2["NODE_COLLAPSE"] = "nodeCollapse";
27159
27159
  EVENTS2["NODE_EXPAND"] = "nodeExpand";
27160
27160
  EVENTS2["NODE_CHECKED"] = "nodeChecked";
27161
+ EVENTS2["NODE_DRAG_START"] = "nodeDragStart";
27162
+ EVENTS2["NODE_DRAG_OVER"] = "nodeDragOver";
27163
+ EVENTS2["NODE_DRAG_LEAVE"] = "nodeDragLeave";
27164
+ EVENTS2["NODE_DROP"] = "nodeDrop";
27161
27165
  return EVENTS2;
27162
27166
  })(EVENTS || {});
27163
27167
  const EMPTY = (..._args) => true;
@@ -27165,7 +27169,11 @@ const TreeEmitEventsType = {
27165
27169
  ["nodeClick"]: EMPTY,
27166
27170
  ["nodeCollapse"]: EMPTY,
27167
27171
  ["nodeExpand"]: EMPTY,
27168
- ["nodeChecked"]: EMPTY
27172
+ ["nodeChecked"]: EMPTY,
27173
+ ["nodeDragStart"]: EMPTY,
27174
+ ["nodeDragOver"]: EMPTY,
27175
+ ["nodeDragLeave"]: EMPTY,
27176
+ ["nodeDrop"]: EMPTY
27169
27177
  };
27170
27178
  var NODE_ATTRIBUTES = /* @__PURE__ */ ((NODE_ATTRIBUTES2) => {
27171
27179
  NODE_ATTRIBUTES2["DEPTH"] = "__depth";
@@ -27440,6 +27448,8 @@ const getNodeRowClass = (item, schema) => {
27440
27448
  return {
27441
27449
  "is-checked": __is_checked,
27442
27450
  "is-selected": __is_selected,
27451
+ "node-folder": item.is_folder,
27452
+ "node-leaf": item.is_leaf,
27443
27453
  [resolveClassName("node-row")]: true
27444
27454
  };
27445
27455
  };
@@ -27817,10 +27827,10 @@ var useNodeAction = (props2, ctx, flatData, _renderData, schemaValues, initOptio
27817
27827
  "class": getNodeItemClass(item, flatData.schema, props2),
27818
27828
  "style": getNodeItemStyle(item, props2, flatData),
27819
27829
  "onClick": (e) => handleNodeContentClick(item, e)
27820
- }, [createVNode("span", {
27830
+ }, [createVNode("div", {
27821
27831
  "class": [resolveClassName("node-action")],
27822
27832
  "onClick": (e) => handleNodeActionClick(e, item)
27823
- }, [getActionIcon(item)]), createVNode("span", {
27833
+ }, [getActionIcon(item)]), createVNode("div", {
27824
27834
  "class": resolveClassName("node-content")
27825
27835
  }, [[getCheckboxRender(item), getNodePrefixIcon(item)], createVNode("span", {
27826
27836
  "class": resolveClassName("node-text")
@@ -27837,7 +27847,7 @@ var useNodeAction = (props2, ctx, flatData, _renderData, schemaValues, initOptio
27837
27847
  setOpen
27838
27848
  };
27839
27849
  };
27840
- var useNodeDrag = (props2, root, flatData) => {
27850
+ var useNodeDrag = (props2, ctx, root, flatData) => {
27841
27851
  const {
27842
27852
  getSourceNodeByUID,
27843
27853
  getNodeParentIdById,
@@ -27875,6 +27885,7 @@ var useNodeDrag = (props2, root, flatData) => {
27875
27885
  e.preventDefault();
27876
27886
  const targetNode = getTargetTreeNode(e);
27877
27887
  const data2 = getNodeByTargetTreeNode(targetNode);
27888
+ ctx.emit(EVENTS.NODE_DRAG_OVER, e, targetNode, data2);
27878
27889
  if (isNeedCheckDroppable.value && (props2 == null ? void 0 : props2.disableDrop(data2))) {
27879
27890
  e.dataTransfer.effectAllowed = "move";
27880
27891
  e.dataTransfer.dropEffect = "none";
@@ -27894,6 +27905,7 @@ var useNodeDrag = (props2, root, flatData) => {
27894
27905
  const targetNode = getTargetTreeNode(e);
27895
27906
  e.dataTransfer.setData("text/plain", "");
27896
27907
  e.dataTransfer.setData("node-id", targetNode.getAttribute("data-tree-node"));
27908
+ ctx.emit(EVENTS.NODE_DRAG_START, e, targetNode);
27897
27909
  };
27898
27910
  const handleTreeNodeDrop = (e) => {
27899
27911
  e.preventDefault();
@@ -27907,6 +27919,7 @@ var useNodeDrag = (props2, root, flatData) => {
27907
27919
  const sourceNodeId = e.dataTransfer.getData("node-id");
27908
27920
  const targetNodeId = targetNode.getAttribute("data-tree-node");
27909
27921
  Reflect.apply(props2.dragSort ? dragSortData : dragAsChildNode, globalThis, [sourceNodeId, targetNodeId]);
27922
+ ctx.emit(EVENTS.NODE_DROP, e, targetNode, data2);
27910
27923
  };
27911
27924
  const isNodeSortable = (sourceId, targetId) => {
27912
27925
  const sourcePath = getNodePath({
@@ -27966,6 +27979,7 @@ var useNodeDrag = (props2, root, flatData) => {
27966
27979
  e.preventDefault();
27967
27980
  const targetNode = getTargetTreeNode(e);
27968
27981
  targetNode.classList.remove("bk-tree-drop-active", "bk-tree-drop-disabled");
27982
+ ctx.emit(EVENTS.NODE_DRAG_LEAVE, e, targetNode);
27969
27983
  };
27970
27984
  onMounted(() => {
27971
27985
  if (props2.draggable && root.value) {
@@ -28373,7 +28387,7 @@ var Component$8 = defineComponent({
28373
28387
  const {
28374
28388
  renderEmpty
28375
28389
  } = useEmpty(props2, ctx);
28376
- useNodeDrag(props2, root, flatData);
28390
+ useNodeDrag(props2, ctx, root, flatData);
28377
28391
  const renderTreeContent = (scopedData) => {
28378
28392
  if (scopedData.length) {
28379
28393
  return scopedData.map(renderTreeNode);