vue-devui 1.0.0-beta.15 → 1.0.0-beta.16

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/tree/index.es.js CHANGED
@@ -21,7 +21,7 @@ var __publicField = (obj, key, value) => {
21
21
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
22
  return value;
23
23
  };
24
- import { h, render, defineComponent, ref, createVNode, inject, computed, mergeProps, watch, unref, Fragment, onUpdated, toRefs, reactive, provide } from "vue";
24
+ import { h, render, defineComponent, ref, createVNode, inject, computed, mergeProps, watch, unref, Fragment, reactive, onUpdated, toRefs, provide } from "vue";
25
25
  const treeProps = {
26
26
  data: {
27
27
  type: Array,
@@ -32,9 +32,17 @@ const treeProps = {
32
32
  type: Boolean,
33
33
  default: false
34
34
  },
35
+ draggable: {
36
+ type: Boolean,
37
+ default: false
38
+ },
35
39
  checkableRelation: {
36
40
  type: String,
37
41
  default: "none"
42
+ },
43
+ dropType: {
44
+ type: Object,
45
+ default: () => ({})
38
46
  }
39
47
  };
40
48
  const CHECK_CONFIG = {
@@ -52,7 +60,6 @@ const flatten = (tree2, key = "children") => {
52
60
  const getRandomId = () => (Math.random() * 10 ** 9).toString().slice(0, 8);
53
61
  const preCheckNodeId = (d, postfixId) => {
54
62
  const randomStr = getRandomId();
55
- console.info("randomStr: ", randomStr);
56
63
  return __spreadProps(__spreadValues({}, d), { id: postfixId ? `${postfixId}_${randomStr}` : randomStr });
57
64
  };
58
65
  const getId = (id) => {
@@ -62,6 +69,9 @@ const getId = (id) => {
62
69
  const preCheckTree = (ds, postfixId) => {
63
70
  return ds.map((d) => {
64
71
  const dd = preCheckNodeId(d, postfixId);
72
+ if (!dd.parentId && postfixId) {
73
+ dd.parentId = postfixId;
74
+ }
65
75
  return d.children ? __spreadProps(__spreadValues({}, dd), {
66
76
  children: preCheckTree(d.children, dd.id)
67
77
  }) : dd;
@@ -477,7 +487,10 @@ function useMergeNode(data) {
477
487
  });
478
488
  });
479
489
  };
480
- const mergeData = ref(mergeNode(data));
490
+ const mergeData = ref(mergeNode(data.value));
491
+ watch(() => data.value, () => {
492
+ mergeData.value = mergeNode(data.value);
493
+ }, { deep: true });
481
494
  return {
482
495
  mergeData
483
496
  };
@@ -487,8 +500,8 @@ const IS_DISABLED_FLAG = "devui-tree_isDisabledNode";
487
500
  const useHighlightNode = () => {
488
501
  const nodeClassNameReflectRef = ref({});
489
502
  const prevActiveNodeKey = ref("");
490
- const handleInit = (isDisabled = false, ...keys) => {
491
- const key = keys.join("-");
503
+ const handleInit = (isDisabled = false, ...keys2) => {
504
+ const key = keys2.join("-");
492
505
  nodeClassNameReflectRef.value[key] = isDisabled ? IS_DISABLED_FLAG : nodeClassNameReflectRef.value[key] || "";
493
506
  return key;
494
507
  };
@@ -677,6 +690,945 @@ const useOperate = (treeData) => {
677
690
  handleReflectIdToIcon
678
691
  };
679
692
  };
693
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
694
+ var freeGlobal$1 = freeGlobal;
695
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
696
+ var root = freeGlobal$1 || freeSelf || Function("return this")();
697
+ var root$1 = root;
698
+ var Symbol$1 = root$1.Symbol;
699
+ var Symbol$2 = Symbol$1;
700
+ var objectProto$c = Object.prototype;
701
+ var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
702
+ var nativeObjectToString$1 = objectProto$c.toString;
703
+ var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
704
+ function getRawTag(value) {
705
+ var isOwn = hasOwnProperty$9.call(value, symToStringTag$1), tag = value[symToStringTag$1];
706
+ try {
707
+ value[symToStringTag$1] = void 0;
708
+ var unmasked = true;
709
+ } catch (e) {
710
+ }
711
+ var result = nativeObjectToString$1.call(value);
712
+ if (unmasked) {
713
+ if (isOwn) {
714
+ value[symToStringTag$1] = tag;
715
+ } else {
716
+ delete value[symToStringTag$1];
717
+ }
718
+ }
719
+ return result;
720
+ }
721
+ var objectProto$b = Object.prototype;
722
+ var nativeObjectToString = objectProto$b.toString;
723
+ function objectToString(value) {
724
+ return nativeObjectToString.call(value);
725
+ }
726
+ var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
727
+ var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
728
+ function baseGetTag(value) {
729
+ if (value == null) {
730
+ return value === void 0 ? undefinedTag : nullTag;
731
+ }
732
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
733
+ }
734
+ function isObjectLike(value) {
735
+ return value != null && typeof value == "object";
736
+ }
737
+ var isArray = Array.isArray;
738
+ var isArray$1 = isArray;
739
+ function isObject(value) {
740
+ var type = typeof value;
741
+ return value != null && (type == "object" || type == "function");
742
+ }
743
+ var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
744
+ function isFunction(value) {
745
+ if (!isObject(value)) {
746
+ return false;
747
+ }
748
+ var tag = baseGetTag(value);
749
+ return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
750
+ }
751
+ var coreJsData = root$1["__core-js_shared__"];
752
+ var coreJsData$1 = coreJsData;
753
+ var maskSrcKey = function() {
754
+ var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
755
+ return uid ? "Symbol(src)_1." + uid : "";
756
+ }();
757
+ function isMasked(func) {
758
+ return !!maskSrcKey && maskSrcKey in func;
759
+ }
760
+ var funcProto$1 = Function.prototype;
761
+ var funcToString$1 = funcProto$1.toString;
762
+ function toSource(func) {
763
+ if (func != null) {
764
+ try {
765
+ return funcToString$1.call(func);
766
+ } catch (e) {
767
+ }
768
+ try {
769
+ return func + "";
770
+ } catch (e) {
771
+ }
772
+ }
773
+ return "";
774
+ }
775
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
776
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
777
+ var funcProto = Function.prototype, objectProto$a = Object.prototype;
778
+ var funcToString = funcProto.toString;
779
+ var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
780
+ var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty$8).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
781
+ function baseIsNative(value) {
782
+ if (!isObject(value) || isMasked(value)) {
783
+ return false;
784
+ }
785
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
786
+ return pattern.test(toSource(value));
787
+ }
788
+ function getValue(object, key) {
789
+ return object == null ? void 0 : object[key];
790
+ }
791
+ function getNative(object, key) {
792
+ var value = getValue(object, key);
793
+ return baseIsNative(value) ? value : void 0;
794
+ }
795
+ var WeakMap$1 = getNative(root$1, "WeakMap");
796
+ var WeakMap$2 = WeakMap$1;
797
+ var objectCreate = Object.create;
798
+ var baseCreate = function() {
799
+ function object() {
800
+ }
801
+ return function(proto) {
802
+ if (!isObject(proto)) {
803
+ return {};
804
+ }
805
+ if (objectCreate) {
806
+ return objectCreate(proto);
807
+ }
808
+ object.prototype = proto;
809
+ var result = new object();
810
+ object.prototype = void 0;
811
+ return result;
812
+ };
813
+ }();
814
+ var baseCreate$1 = baseCreate;
815
+ function copyArray(source, array) {
816
+ var index2 = -1, length = source.length;
817
+ array || (array = Array(length));
818
+ while (++index2 < length) {
819
+ array[index2] = source[index2];
820
+ }
821
+ return array;
822
+ }
823
+ var defineProperty = function() {
824
+ try {
825
+ var func = getNative(Object, "defineProperty");
826
+ func({}, "", {});
827
+ return func;
828
+ } catch (e) {
829
+ }
830
+ }();
831
+ var defineProperty$1 = defineProperty;
832
+ function arrayEach(array, iteratee) {
833
+ var index2 = -1, length = array == null ? 0 : array.length;
834
+ while (++index2 < length) {
835
+ if (iteratee(array[index2], index2, array) === false) {
836
+ break;
837
+ }
838
+ }
839
+ return array;
840
+ }
841
+ var MAX_SAFE_INTEGER$1 = 9007199254740991;
842
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
843
+ function isIndex(value, length) {
844
+ var type = typeof value;
845
+ length = length == null ? MAX_SAFE_INTEGER$1 : length;
846
+ return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
847
+ }
848
+ function baseAssignValue(object, key, value) {
849
+ if (key == "__proto__" && defineProperty$1) {
850
+ defineProperty$1(object, key, {
851
+ "configurable": true,
852
+ "enumerable": true,
853
+ "value": value,
854
+ "writable": true
855
+ });
856
+ } else {
857
+ object[key] = value;
858
+ }
859
+ }
860
+ function eq(value, other) {
861
+ return value === other || value !== value && other !== other;
862
+ }
863
+ var objectProto$9 = Object.prototype;
864
+ var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
865
+ function assignValue(object, key, value) {
866
+ var objValue = object[key];
867
+ if (!(hasOwnProperty$7.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
868
+ baseAssignValue(object, key, value);
869
+ }
870
+ }
871
+ function copyObject(source, props, object, customizer) {
872
+ var isNew = !object;
873
+ object || (object = {});
874
+ var index2 = -1, length = props.length;
875
+ while (++index2 < length) {
876
+ var key = props[index2];
877
+ var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
878
+ if (newValue === void 0) {
879
+ newValue = source[key];
880
+ }
881
+ if (isNew) {
882
+ baseAssignValue(object, key, newValue);
883
+ } else {
884
+ assignValue(object, key, newValue);
885
+ }
886
+ }
887
+ return object;
888
+ }
889
+ var MAX_SAFE_INTEGER = 9007199254740991;
890
+ function isLength(value) {
891
+ return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
892
+ }
893
+ function isArrayLike(value) {
894
+ return value != null && isLength(value.length) && !isFunction(value);
895
+ }
896
+ var objectProto$8 = Object.prototype;
897
+ function isPrototype(value) {
898
+ var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$8;
899
+ return value === proto;
900
+ }
901
+ function baseTimes(n, iteratee) {
902
+ var index2 = -1, result = Array(n);
903
+ while (++index2 < n) {
904
+ result[index2] = iteratee(index2);
905
+ }
906
+ return result;
907
+ }
908
+ var argsTag$2 = "[object Arguments]";
909
+ function baseIsArguments(value) {
910
+ return isObjectLike(value) && baseGetTag(value) == argsTag$2;
911
+ }
912
+ var objectProto$7 = Object.prototype;
913
+ var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
914
+ var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
915
+ var isArguments = baseIsArguments(function() {
916
+ return arguments;
917
+ }()) ? baseIsArguments : function(value) {
918
+ return isObjectLike(value) && hasOwnProperty$6.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
919
+ };
920
+ var isArguments$1 = isArguments;
921
+ function stubFalse() {
922
+ return false;
923
+ }
924
+ var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
925
+ var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
926
+ var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
927
+ var Buffer$1 = moduleExports$2 ? root$1.Buffer : void 0;
928
+ var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
929
+ var isBuffer = nativeIsBuffer || stubFalse;
930
+ var isBuffer$1 = isBuffer;
931
+ var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", errorTag$1 = "[object Error]", funcTag$1 = "[object Function]", mapTag$4 = "[object Map]", numberTag$2 = "[object Number]", objectTag$2 = "[object Object]", regexpTag$2 = "[object RegExp]", setTag$4 = "[object Set]", stringTag$2 = "[object String]", weakMapTag$2 = "[object WeakMap]";
932
+ var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$3 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
933
+ var typedArrayTags = {};
934
+ typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
935
+ typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] = typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$2] = typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] = typedArrayTags[weakMapTag$2] = false;
936
+ function baseIsTypedArray(value) {
937
+ return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
938
+ }
939
+ function baseUnary(func) {
940
+ return function(value) {
941
+ return func(value);
942
+ };
943
+ }
944
+ var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
945
+ var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
946
+ var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
947
+ var freeProcess = moduleExports$1 && freeGlobal$1.process;
948
+ var nodeUtil = function() {
949
+ try {
950
+ var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
951
+ if (types) {
952
+ return types;
953
+ }
954
+ return freeProcess && freeProcess.binding && freeProcess.binding("util");
955
+ } catch (e) {
956
+ }
957
+ }();
958
+ var nodeUtil$1 = nodeUtil;
959
+ var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
960
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
961
+ var isTypedArray$1 = isTypedArray;
962
+ var objectProto$6 = Object.prototype;
963
+ var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
964
+ function arrayLikeKeys(value, inherited) {
965
+ var isArr = isArray$1(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
966
+ for (var key in value) {
967
+ if ((inherited || hasOwnProperty$5.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
968
+ result.push(key);
969
+ }
970
+ }
971
+ return result;
972
+ }
973
+ function overArg(func, transform) {
974
+ return function(arg) {
975
+ return func(transform(arg));
976
+ };
977
+ }
978
+ var nativeKeys = overArg(Object.keys, Object);
979
+ var nativeKeys$1 = nativeKeys;
980
+ var objectProto$5 = Object.prototype;
981
+ var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
982
+ function baseKeys(object) {
983
+ if (!isPrototype(object)) {
984
+ return nativeKeys$1(object);
985
+ }
986
+ var result = [];
987
+ for (var key in Object(object)) {
988
+ if (hasOwnProperty$4.call(object, key) && key != "constructor") {
989
+ result.push(key);
990
+ }
991
+ }
992
+ return result;
993
+ }
994
+ function keys(object) {
995
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
996
+ }
997
+ function nativeKeysIn(object) {
998
+ var result = [];
999
+ if (object != null) {
1000
+ for (var key in Object(object)) {
1001
+ result.push(key);
1002
+ }
1003
+ }
1004
+ return result;
1005
+ }
1006
+ var objectProto$4 = Object.prototype;
1007
+ var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
1008
+ function baseKeysIn(object) {
1009
+ if (!isObject(object)) {
1010
+ return nativeKeysIn(object);
1011
+ }
1012
+ var isProto = isPrototype(object), result = [];
1013
+ for (var key in object) {
1014
+ if (!(key == "constructor" && (isProto || !hasOwnProperty$3.call(object, key)))) {
1015
+ result.push(key);
1016
+ }
1017
+ }
1018
+ return result;
1019
+ }
1020
+ function keysIn(object) {
1021
+ return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
1022
+ }
1023
+ var nativeCreate = getNative(Object, "create");
1024
+ var nativeCreate$1 = nativeCreate;
1025
+ function hashClear() {
1026
+ this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
1027
+ this.size = 0;
1028
+ }
1029
+ function hashDelete(key) {
1030
+ var result = this.has(key) && delete this.__data__[key];
1031
+ this.size -= result ? 1 : 0;
1032
+ return result;
1033
+ }
1034
+ var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
1035
+ var objectProto$3 = Object.prototype;
1036
+ var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
1037
+ function hashGet(key) {
1038
+ var data = this.__data__;
1039
+ if (nativeCreate$1) {
1040
+ var result = data[key];
1041
+ return result === HASH_UNDEFINED$1 ? void 0 : result;
1042
+ }
1043
+ return hasOwnProperty$2.call(data, key) ? data[key] : void 0;
1044
+ }
1045
+ var objectProto$2 = Object.prototype;
1046
+ var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
1047
+ function hashHas(key) {
1048
+ var data = this.__data__;
1049
+ return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$1.call(data, key);
1050
+ }
1051
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
1052
+ function hashSet(key, value) {
1053
+ var data = this.__data__;
1054
+ this.size += this.has(key) ? 0 : 1;
1055
+ data[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED : value;
1056
+ return this;
1057
+ }
1058
+ function Hash(entries) {
1059
+ var index2 = -1, length = entries == null ? 0 : entries.length;
1060
+ this.clear();
1061
+ while (++index2 < length) {
1062
+ var entry = entries[index2];
1063
+ this.set(entry[0], entry[1]);
1064
+ }
1065
+ }
1066
+ Hash.prototype.clear = hashClear;
1067
+ Hash.prototype["delete"] = hashDelete;
1068
+ Hash.prototype.get = hashGet;
1069
+ Hash.prototype.has = hashHas;
1070
+ Hash.prototype.set = hashSet;
1071
+ function listCacheClear() {
1072
+ this.__data__ = [];
1073
+ this.size = 0;
1074
+ }
1075
+ function assocIndexOf(array, key) {
1076
+ var length = array.length;
1077
+ while (length--) {
1078
+ if (eq(array[length][0], key)) {
1079
+ return length;
1080
+ }
1081
+ }
1082
+ return -1;
1083
+ }
1084
+ var arrayProto = Array.prototype;
1085
+ var splice = arrayProto.splice;
1086
+ function listCacheDelete(key) {
1087
+ var data = this.__data__, index2 = assocIndexOf(data, key);
1088
+ if (index2 < 0) {
1089
+ return false;
1090
+ }
1091
+ var lastIndex = data.length - 1;
1092
+ if (index2 == lastIndex) {
1093
+ data.pop();
1094
+ } else {
1095
+ splice.call(data, index2, 1);
1096
+ }
1097
+ --this.size;
1098
+ return true;
1099
+ }
1100
+ function listCacheGet(key) {
1101
+ var data = this.__data__, index2 = assocIndexOf(data, key);
1102
+ return index2 < 0 ? void 0 : data[index2][1];
1103
+ }
1104
+ function listCacheHas(key) {
1105
+ return assocIndexOf(this.__data__, key) > -1;
1106
+ }
1107
+ function listCacheSet(key, value) {
1108
+ var data = this.__data__, index2 = assocIndexOf(data, key);
1109
+ if (index2 < 0) {
1110
+ ++this.size;
1111
+ data.push([key, value]);
1112
+ } else {
1113
+ data[index2][1] = value;
1114
+ }
1115
+ return this;
1116
+ }
1117
+ function ListCache(entries) {
1118
+ var index2 = -1, length = entries == null ? 0 : entries.length;
1119
+ this.clear();
1120
+ while (++index2 < length) {
1121
+ var entry = entries[index2];
1122
+ this.set(entry[0], entry[1]);
1123
+ }
1124
+ }
1125
+ ListCache.prototype.clear = listCacheClear;
1126
+ ListCache.prototype["delete"] = listCacheDelete;
1127
+ ListCache.prototype.get = listCacheGet;
1128
+ ListCache.prototype.has = listCacheHas;
1129
+ ListCache.prototype.set = listCacheSet;
1130
+ var Map = getNative(root$1, "Map");
1131
+ var Map$1 = Map;
1132
+ function mapCacheClear() {
1133
+ this.size = 0;
1134
+ this.__data__ = {
1135
+ "hash": new Hash(),
1136
+ "map": new (Map$1 || ListCache)(),
1137
+ "string": new Hash()
1138
+ };
1139
+ }
1140
+ function isKeyable(value) {
1141
+ var type = typeof value;
1142
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
1143
+ }
1144
+ function getMapData(map, key) {
1145
+ var data = map.__data__;
1146
+ return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
1147
+ }
1148
+ function mapCacheDelete(key) {
1149
+ var result = getMapData(this, key)["delete"](key);
1150
+ this.size -= result ? 1 : 0;
1151
+ return result;
1152
+ }
1153
+ function mapCacheGet(key) {
1154
+ return getMapData(this, key).get(key);
1155
+ }
1156
+ function mapCacheHas(key) {
1157
+ return getMapData(this, key).has(key);
1158
+ }
1159
+ function mapCacheSet(key, value) {
1160
+ var data = getMapData(this, key), size = data.size;
1161
+ data.set(key, value);
1162
+ this.size += data.size == size ? 0 : 1;
1163
+ return this;
1164
+ }
1165
+ function MapCache(entries) {
1166
+ var index2 = -1, length = entries == null ? 0 : entries.length;
1167
+ this.clear();
1168
+ while (++index2 < length) {
1169
+ var entry = entries[index2];
1170
+ this.set(entry[0], entry[1]);
1171
+ }
1172
+ }
1173
+ MapCache.prototype.clear = mapCacheClear;
1174
+ MapCache.prototype["delete"] = mapCacheDelete;
1175
+ MapCache.prototype.get = mapCacheGet;
1176
+ MapCache.prototype.has = mapCacheHas;
1177
+ MapCache.prototype.set = mapCacheSet;
1178
+ function arrayPush(array, values) {
1179
+ var index2 = -1, length = values.length, offset = array.length;
1180
+ while (++index2 < length) {
1181
+ array[offset + index2] = values[index2];
1182
+ }
1183
+ return array;
1184
+ }
1185
+ var getPrototype = overArg(Object.getPrototypeOf, Object);
1186
+ var getPrototype$1 = getPrototype;
1187
+ function stackClear() {
1188
+ this.__data__ = new ListCache();
1189
+ this.size = 0;
1190
+ }
1191
+ function stackDelete(key) {
1192
+ var data = this.__data__, result = data["delete"](key);
1193
+ this.size = data.size;
1194
+ return result;
1195
+ }
1196
+ function stackGet(key) {
1197
+ return this.__data__.get(key);
1198
+ }
1199
+ function stackHas(key) {
1200
+ return this.__data__.has(key);
1201
+ }
1202
+ var LARGE_ARRAY_SIZE = 200;
1203
+ function stackSet(key, value) {
1204
+ var data = this.__data__;
1205
+ if (data instanceof ListCache) {
1206
+ var pairs = data.__data__;
1207
+ if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE - 1) {
1208
+ pairs.push([key, value]);
1209
+ this.size = ++data.size;
1210
+ return this;
1211
+ }
1212
+ data = this.__data__ = new MapCache(pairs);
1213
+ }
1214
+ data.set(key, value);
1215
+ this.size = data.size;
1216
+ return this;
1217
+ }
1218
+ function Stack(entries) {
1219
+ var data = this.__data__ = new ListCache(entries);
1220
+ this.size = data.size;
1221
+ }
1222
+ Stack.prototype.clear = stackClear;
1223
+ Stack.prototype["delete"] = stackDelete;
1224
+ Stack.prototype.get = stackGet;
1225
+ Stack.prototype.has = stackHas;
1226
+ Stack.prototype.set = stackSet;
1227
+ function baseAssign(object, source) {
1228
+ return object && copyObject(source, keys(source), object);
1229
+ }
1230
+ function baseAssignIn(object, source) {
1231
+ return object && copyObject(source, keysIn(source), object);
1232
+ }
1233
+ var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
1234
+ var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
1235
+ var moduleExports = freeModule && freeModule.exports === freeExports;
1236
+ var Buffer2 = moduleExports ? root$1.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
1237
+ function cloneBuffer(buffer, isDeep) {
1238
+ if (isDeep) {
1239
+ return buffer.slice();
1240
+ }
1241
+ var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
1242
+ buffer.copy(result);
1243
+ return result;
1244
+ }
1245
+ function arrayFilter(array, predicate) {
1246
+ var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
1247
+ while (++index2 < length) {
1248
+ var value = array[index2];
1249
+ if (predicate(value, index2, array)) {
1250
+ result[resIndex++] = value;
1251
+ }
1252
+ }
1253
+ return result;
1254
+ }
1255
+ function stubArray() {
1256
+ return [];
1257
+ }
1258
+ var objectProto$1 = Object.prototype;
1259
+ var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
1260
+ var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
1261
+ var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
1262
+ if (object == null) {
1263
+ return [];
1264
+ }
1265
+ object = Object(object);
1266
+ return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
1267
+ return propertyIsEnumerable.call(object, symbol);
1268
+ });
1269
+ };
1270
+ var getSymbols$1 = getSymbols;
1271
+ function copySymbols(source, object) {
1272
+ return copyObject(source, getSymbols$1(source), object);
1273
+ }
1274
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
1275
+ var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
1276
+ var result = [];
1277
+ while (object) {
1278
+ arrayPush(result, getSymbols$1(object));
1279
+ object = getPrototype$1(object);
1280
+ }
1281
+ return result;
1282
+ };
1283
+ var getSymbolsIn$1 = getSymbolsIn;
1284
+ function copySymbolsIn(source, object) {
1285
+ return copyObject(source, getSymbolsIn$1(source), object);
1286
+ }
1287
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
1288
+ var result = keysFunc(object);
1289
+ return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
1290
+ }
1291
+ function getAllKeys(object) {
1292
+ return baseGetAllKeys(object, keys, getSymbols$1);
1293
+ }
1294
+ function getAllKeysIn(object) {
1295
+ return baseGetAllKeys(object, keysIn, getSymbolsIn$1);
1296
+ }
1297
+ var DataView = getNative(root$1, "DataView");
1298
+ var DataView$1 = DataView;
1299
+ var Promise$1 = getNative(root$1, "Promise");
1300
+ var Promise$2 = Promise$1;
1301
+ var Set = getNative(root$1, "Set");
1302
+ var Set$1 = Set;
1303
+ var mapTag$3 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$3 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
1304
+ var dataViewTag$2 = "[object DataView]";
1305
+ var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap$2);
1306
+ var getTag = baseGetTag;
1307
+ if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$2 || Map$1 && getTag(new Map$1()) != mapTag$3 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$3 || WeakMap$2 && getTag(new WeakMap$2()) != weakMapTag$1) {
1308
+ getTag = function(value) {
1309
+ var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
1310
+ if (ctorString) {
1311
+ switch (ctorString) {
1312
+ case dataViewCtorString:
1313
+ return dataViewTag$2;
1314
+ case mapCtorString:
1315
+ return mapTag$3;
1316
+ case promiseCtorString:
1317
+ return promiseTag;
1318
+ case setCtorString:
1319
+ return setTag$3;
1320
+ case weakMapCtorString:
1321
+ return weakMapTag$1;
1322
+ }
1323
+ }
1324
+ return result;
1325
+ };
1326
+ }
1327
+ var getTag$1 = getTag;
1328
+ var objectProto = Object.prototype;
1329
+ var hasOwnProperty = objectProto.hasOwnProperty;
1330
+ function initCloneArray(array) {
1331
+ var length = array.length, result = new array.constructor(length);
1332
+ if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
1333
+ result.index = array.index;
1334
+ result.input = array.input;
1335
+ }
1336
+ return result;
1337
+ }
1338
+ var Uint8Array2 = root$1.Uint8Array;
1339
+ var Uint8Array$1 = Uint8Array2;
1340
+ function cloneArrayBuffer(arrayBuffer) {
1341
+ var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
1342
+ new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
1343
+ return result;
1344
+ }
1345
+ function cloneDataView(dataView, isDeep) {
1346
+ var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
1347
+ return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
1348
+ }
1349
+ var reFlags = /\w*$/;
1350
+ function cloneRegExp(regexp) {
1351
+ var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
1352
+ result.lastIndex = regexp.lastIndex;
1353
+ return result;
1354
+ }
1355
+ var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
1356
+ function cloneSymbol(symbol) {
1357
+ return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
1358
+ }
1359
+ function cloneTypedArray(typedArray, isDeep) {
1360
+ var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
1361
+ return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
1362
+ }
1363
+ var boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]";
1364
+ var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
1365
+ function initCloneByTag(object, tag, isDeep) {
1366
+ var Ctor = object.constructor;
1367
+ switch (tag) {
1368
+ case arrayBufferTag$1:
1369
+ return cloneArrayBuffer(object);
1370
+ case boolTag$1:
1371
+ case dateTag$1:
1372
+ return new Ctor(+object);
1373
+ case dataViewTag$1:
1374
+ return cloneDataView(object, isDeep);
1375
+ case float32Tag$1:
1376
+ case float64Tag$1:
1377
+ case int8Tag$1:
1378
+ case int16Tag$1:
1379
+ case int32Tag$1:
1380
+ case uint8Tag$1:
1381
+ case uint8ClampedTag$1:
1382
+ case uint16Tag$1:
1383
+ case uint32Tag$1:
1384
+ return cloneTypedArray(object, isDeep);
1385
+ case mapTag$2:
1386
+ return new Ctor();
1387
+ case numberTag$1:
1388
+ case stringTag$1:
1389
+ return new Ctor(object);
1390
+ case regexpTag$1:
1391
+ return cloneRegExp(object);
1392
+ case setTag$2:
1393
+ return new Ctor();
1394
+ case symbolTag$1:
1395
+ return cloneSymbol(object);
1396
+ }
1397
+ }
1398
+ function initCloneObject(object) {
1399
+ return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate$1(getPrototype$1(object)) : {};
1400
+ }
1401
+ var mapTag$1 = "[object Map]";
1402
+ function baseIsMap(value) {
1403
+ return isObjectLike(value) && getTag$1(value) == mapTag$1;
1404
+ }
1405
+ var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
1406
+ var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
1407
+ var isMap$1 = isMap;
1408
+ var setTag$1 = "[object Set]";
1409
+ function baseIsSet(value) {
1410
+ return isObjectLike(value) && getTag$1(value) == setTag$1;
1411
+ }
1412
+ var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet;
1413
+ var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
1414
+ var isSet$1 = isSet;
1415
+ var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$1 = 4;
1416
+ var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", weakMapTag = "[object WeakMap]";
1417
+ var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
1418
+ var cloneableTags = {};
1419
+ cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
1420
+ cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
1421
+ function baseClone(value, bitmask, customizer, key, object, stack) {
1422
+ var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
1423
+ if (customizer) {
1424
+ result = object ? customizer(value, key, object, stack) : customizer(value);
1425
+ }
1426
+ if (result !== void 0) {
1427
+ return result;
1428
+ }
1429
+ if (!isObject(value)) {
1430
+ return value;
1431
+ }
1432
+ var isArr = isArray$1(value);
1433
+ if (isArr) {
1434
+ result = initCloneArray(value);
1435
+ if (!isDeep) {
1436
+ return copyArray(value, result);
1437
+ }
1438
+ } else {
1439
+ var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
1440
+ if (isBuffer$1(value)) {
1441
+ return cloneBuffer(value, isDeep);
1442
+ }
1443
+ if (tag == objectTag || tag == argsTag || isFunc && !object) {
1444
+ result = isFlat || isFunc ? {} : initCloneObject(value);
1445
+ if (!isDeep) {
1446
+ return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
1447
+ }
1448
+ } else {
1449
+ if (!cloneableTags[tag]) {
1450
+ return object ? value : {};
1451
+ }
1452
+ result = initCloneByTag(value, tag, isDeep);
1453
+ }
1454
+ }
1455
+ stack || (stack = new Stack());
1456
+ var stacked = stack.get(value);
1457
+ if (stacked) {
1458
+ return stacked;
1459
+ }
1460
+ stack.set(value, result);
1461
+ if (isSet$1(value)) {
1462
+ value.forEach(function(subValue) {
1463
+ result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
1464
+ });
1465
+ } else if (isMap$1(value)) {
1466
+ value.forEach(function(subValue, key2) {
1467
+ result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
1468
+ });
1469
+ }
1470
+ var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
1471
+ var props = isArr ? void 0 : keysFunc(value);
1472
+ arrayEach(props || value, function(subValue, key2) {
1473
+ if (props) {
1474
+ key2 = subValue;
1475
+ subValue = value[key2];
1476
+ }
1477
+ assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
1478
+ });
1479
+ return result;
1480
+ }
1481
+ var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
1482
+ function cloneDeep(value) {
1483
+ return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
1484
+ }
1485
+ const ACTIVE_NODE = "devui-tree-node__content--value-wrapper";
1486
+ function useDraggable(draggable, dropType, node, renderData, data) {
1487
+ const dragState = reactive({
1488
+ dropType: null,
1489
+ draggingNode: null
1490
+ });
1491
+ const treeIdMapValue = ref({});
1492
+ watch(() => renderData.value, () => {
1493
+ treeIdMapValue.value = renderData.value.reduce((acc, cur) => __spreadProps(__spreadValues({}, acc), { [cur.id]: cur }), {});
1494
+ }, { deep: true, immediate: true });
1495
+ const removeDraggingStyle = (target) => {
1496
+ var _a;
1497
+ (_a = target.querySelector(`.${ACTIVE_NODE}`)) == null ? void 0 : _a.classList.remove(...["prev", "next", "inner"].map((item) => `devui-drop-${item}`));
1498
+ };
1499
+ const checkIsParent = (childNodeId, parentNodeId) => {
1500
+ const realParentId = treeIdMapValue.value[childNodeId].parentId;
1501
+ if (realParentId === parentNodeId) {
1502
+ return true;
1503
+ } else if (realParentId !== void 0) {
1504
+ return checkIsParent(realParentId, parentNodeId);
1505
+ } else {
1506
+ return false;
1507
+ }
1508
+ };
1509
+ const handlerDropData = (dragNodeId, dropNodeId, dropType2) => {
1510
+ const cloneData = cloneDeep(data.value);
1511
+ let nowDragNode;
1512
+ let nowDropNode;
1513
+ const findDragAndDropNode = (curr) => {
1514
+ if (!Array.isArray(curr))
1515
+ return;
1516
+ curr.every((item, index2) => {
1517
+ if (nowDragNode && nowDropNode) {
1518
+ return false;
1519
+ }
1520
+ if (item.id === dragNodeId) {
1521
+ nowDragNode = { target: curr, index: index2, item };
1522
+ } else if (item.id === dropNodeId) {
1523
+ nowDropNode = { target: curr, index: index2, item };
1524
+ }
1525
+ if (!nowDragNode || !nowDropNode) {
1526
+ findDragAndDropNode(item.children);
1527
+ }
1528
+ return true;
1529
+ });
1530
+ };
1531
+ findDragAndDropNode(cloneData);
1532
+ if (nowDragNode && nowDropNode && dropType2) {
1533
+ const cloneDrapNode = cloneDeep(nowDragNode.target[nowDragNode.index]);
1534
+ if (dropType2 === "prev") {
1535
+ nowDropNode.target.splice(nowDropNode.index, 0, cloneDrapNode);
1536
+ } else if (dropType2 === "next") {
1537
+ nowDropNode.target.splice(nowDropNode.index + 1, 0, cloneDrapNode);
1538
+ } else if (dropType2 === "inner") {
1539
+ const children = nowDropNode.target[nowDropNode.index].children;
1540
+ if (Array.isArray(children)) {
1541
+ children.unshift(cloneDrapNode);
1542
+ } else {
1543
+ nowDropNode.target[nowDropNode.index].children = [cloneDrapNode];
1544
+ }
1545
+ }
1546
+ const targetIndex = nowDragNode.target.indexOf(nowDragNode.item);
1547
+ if (targetIndex !== -1) {
1548
+ nowDragNode.target.splice(targetIndex, 1);
1549
+ }
1550
+ }
1551
+ return cloneData;
1552
+ };
1553
+ const onDragstart = (event, treeNode) => {
1554
+ dragState.draggingNode = event.target;
1555
+ const data2 = {
1556
+ type: "tree-node",
1557
+ nodeId: treeNode.id
1558
+ };
1559
+ event.dataTransfer.setData("Text", JSON.stringify(data2));
1560
+ };
1561
+ const onDragover = (event) => {
1562
+ var _a;
1563
+ if (draggable) {
1564
+ event.preventDefault();
1565
+ event.dataTransfer.dropEffect = "move";
1566
+ if (!node) {
1567
+ return;
1568
+ }
1569
+ const dropPrev = dropType.dropPrev;
1570
+ const dropNext = dropType.dropNext;
1571
+ const dropInner = dropType.dropInner;
1572
+ let innerDropType;
1573
+ const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
1574
+ const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
1575
+ const currentTarget = event.currentTarget;
1576
+ const targetPosition = currentTarget.getBoundingClientRect();
1577
+ const distance = event.clientY - targetPosition.top;
1578
+ if (distance < targetPosition.height * prevPercent) {
1579
+ innerDropType = "prev";
1580
+ } else if (distance > targetPosition.height * nextPercent) {
1581
+ innerDropType = "next";
1582
+ } else if (dropInner) {
1583
+ innerDropType = "inner";
1584
+ } else {
1585
+ innerDropType = void 0;
1586
+ }
1587
+ removeDraggingStyle(currentTarget);
1588
+ if (innerDropType && innerDropType !== "none") {
1589
+ (_a = currentTarget.querySelector(`.${ACTIVE_NODE}`)) == null ? void 0 : _a.classList.add(`devui-drop-${innerDropType}`);
1590
+ }
1591
+ dragState.dropType = innerDropType;
1592
+ }
1593
+ };
1594
+ const onDragleave = (event) => {
1595
+ removeDraggingStyle(event.currentTarget);
1596
+ };
1597
+ const onDrop = (event, dropNode) => {
1598
+ removeDraggingStyle(event.currentTarget);
1599
+ if (!draggable) {
1600
+ return;
1601
+ }
1602
+ event.preventDefault();
1603
+ const transferDataStr = event.dataTransfer.getData("Text");
1604
+ if (transferDataStr) {
1605
+ try {
1606
+ const transferData = JSON.parse(transferDataStr);
1607
+ if (typeof transferData === "object" && transferData.type === "tree-node") {
1608
+ const dragNodeId = transferData.nodeId;
1609
+ const isParent = checkIsParent(dropNode.id, dragNodeId);
1610
+ if (dragNodeId === dropNode.id || isParent) {
1611
+ return;
1612
+ }
1613
+ let result;
1614
+ if (dragState.dropType) {
1615
+ result = handlerDropData(dragNodeId, dropNode.id, dragState.dropType);
1616
+ }
1617
+ data.value = result;
1618
+ }
1619
+ } catch (e) {
1620
+ console.error(e);
1621
+ }
1622
+ }
1623
+ };
1624
+ return {
1625
+ onDragstart,
1626
+ onDragover,
1627
+ onDragleave,
1628
+ onDrop,
1629
+ dragState
1630
+ };
1631
+ }
680
1632
  var IconOpen = "data:image/svg+xml;base64,PHN2ZwogIHdpZHRoPSIxNnB4IgogIGhlaWdodD0iMTZweCIKICB2aWV3Qm94PSIwIDAgMTYgMTYiCiAgdmVyc2lvbj0iMS4xIgogIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIKICBjbGFzcz0ic3ZnLWljb24gc3ZnLWljb24tY2xvc2UiCj4KICA8ZyBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICA8cmVjdCB4PSIwLjUiIHk9IjAuNSIgd2lkdGg9IjE1IiBoZWlnaHQ9IjE1IiByeD0iMiIgc3Ryb2tlPSIjNWU3Y2UwIj48L3JlY3Q+CiAgICA8cmVjdCB4PSI0IiB5PSI3IiB3aWR0aD0iOCIgaGVpZ2h0PSIyIiBmaWxsPSIjNWU3Y2UwIj48L3JlY3Q+CiAgPC9nPgo8L3N2Zz4=";
681
1633
  var IconClose = "data:image/svg+xml;base64,PHN2ZwogIHdpZHRoPSIxNnB4IgogIGhlaWdodD0iMTZweCIKICB2aWV3Qm94PSIwIDAgMTYgMTYiCiAgdmVyc2lvbj0iMS4xIgogIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIKICBjbGFzcz0ic3ZnLWljb24iCj4KICA8ZyBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgIDxyZWN0IHg9IjAuNSIgeT0iMC41IiB3aWR0aD0iMTUiIGhlaWdodD0iMTUiIHJ4PSIyIiBzdHJva2U9IiMyNTJiM2EiPjwvcmVjdD4KICAgIDxwYXRoCiAgICAgIGZpbGw9IiMyNTJiM2EiCiAgICAgIGQ9Ik04Ljc1LDQgTDguNzUsNy4yNSBMMTIsNy4yNSBMMTIsOC43NSBMOC43NDksOC43NSBMOC43NSwxMiBMNy4yNSwxMiBMNy4yNDksOC43NSBMNCw4Ljc1IEw0LDcuMjUgTDcuMjUsNy4yNSBMNy4yNSw0IEw4Ljc1LDQgWiIKICAgID48L3BhdGg+CiAgPC9nPgo8L3N2Zz4K";
682
1634
  var NodeContent = defineComponent({
@@ -739,13 +1691,16 @@ var Tree = defineComponent({
739
1691
  const {
740
1692
  data,
741
1693
  checkable,
1694
+ draggable,
1695
+ dropType,
742
1696
  checkableRelation: cbr
743
1697
  } = toRefs(reactive(__spreadProps(__spreadValues({}, props), {
744
1698
  data: preCheckTree(props.data)
745
1699
  })));
1700
+ const node = ref(null);
746
1701
  const {
747
1702
  mergeData
748
- } = useMergeNode(data.value);
1703
+ } = useMergeNode(data);
749
1704
  const {
750
1705
  openedData,
751
1706
  toggle
@@ -769,20 +1724,20 @@ var Tree = defineComponent({
769
1724
  operateIconReflect,
770
1725
  handleReflectIdToIcon
771
1726
  } = useOperate();
1727
+ const {
1728
+ onDragstart,
1729
+ onDragover,
1730
+ onDragleave,
1731
+ onDrop
1732
+ } = useDraggable(draggable.value, dropType.value, node, openedData, data);
772
1733
  provide("treeRoot", {
773
1734
  ctx,
774
1735
  props
775
1736
  });
776
- const Indent = () => {
777
- return createVNode("span", {
778
- "style": "display: inline-block; width: 16px; height: 16px; margin-left: 8px;"
779
- }, null);
780
- };
781
1737
  const renderNode = (item) => {
782
1738
  var _a;
783
1739
  const {
784
1740
  id = "",
785
- label,
786
1741
  disabled,
787
1742
  open,
788
1743
  isParent,
@@ -860,20 +1815,27 @@ var Tree = defineComponent({
860
1815
  "class": "mr-xs"
861
1816
  }, null) : createVNode(IconClose, {
862
1817
  "class": "mr-xs"
863
- }, null) : createVNode(Indent, null, null)]);
1818
+ }, null) : createVNode("span", {
1819
+ "class": "devui-tree-node__indent"
1820
+ }, null)]);
864
1821
  };
865
1822
  const checkState = CHECK_CONFIG[(_a = selected.value[id]) != null ? _a : "none"];
866
1823
  return createVNode("div", {
867
1824
  "class": ["devui-tree-node", open && "devui-tree-node__open"],
868
1825
  "style": {
869
1826
  paddingLeft: `${24 * (level - 1)}px`
870
- }
1827
+ },
1828
+ "draggable": draggable.value,
1829
+ "onDragstart": (event) => onDragstart(event, item),
1830
+ "onDragover": (event) => onDragover(event, item),
1831
+ "onDragleave": (event) => onDragleave(event),
1832
+ "onDrop": (event) => onDrop(event, item)
871
1833
  }, [createVNode("div", {
872
1834
  "class": `devui-tree-node__content ${nodeClassNameReflect.value[id]}`,
873
1835
  "onClick": () => handleClickOnNode(id)
874
- }, [createVNode("div", {
875
- "class": "devui-tree-node__content--value-wrapper"
876
- }, [renderFoldIcon(item), checkable.value && createVNode(Checkbox, mergeProps({
1836
+ }, [renderFoldIcon(item), createVNode("div", {
1837
+ "class": ["devui-tree-node__content--value-wrapper", draggable && "devui-drop-draggable"]
1838
+ }, [checkable.value && createVNode(Checkbox, mergeProps({
877
1839
  "key": id,
878
1840
  "onClick": () => onNodeClick(item),
879
1841
  "disabled": disabled