vue-devui 1.0.0-rc.12 → 1.0.0-rc.15
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/README.md +161 -149
- package/alert/index.umd.js +1 -1
- package/auto-complete/index.es.js +243 -83
- package/auto-complete/index.umd.js +29 -18
- package/auto-complete/style.css +1 -1
- package/avatar/index.umd.js +1 -1
- package/badge/index.umd.js +1 -1
- package/button/index.es.js +23 -43
- package/button/index.umd.js +9 -9
- package/button/style.css +1 -1
- package/card/index.umd.js +1 -1
- package/checkbox/index.es.js +94 -77
- package/checkbox/index.umd.js +26 -15
- package/checkbox/style.css +1 -1
- package/collapse/index.es.js +3 -21
- package/collapse/index.umd.js +1 -1
- package/countdown/index.umd.js +1 -1
- package/date-picker-pro/index.es.js +1423 -248
- package/date-picker-pro/index.umd.js +25 -14
- package/date-picker-pro/style.css +1 -1
- package/drawer/index.es.js +4 -17
- package/drawer/index.umd.js +1 -1
- package/dropdown/index.es.js +12 -23
- package/dropdown/index.umd.js +1 -1
- package/editable-select/index.es.js +260 -105
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +85 -71
- package/form/index.umd.js +21 -10
- package/fullscreen/index.umd.js +1 -1
- package/grid/index.es.js +7 -20
- package/grid/index.umd.js +1 -1
- package/icon/index.es.js +2 -1
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -1
- package/image-preview/index.es.js +12 -23
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +241 -76
- package/input/index.umd.js +27 -16
- package/input/style.css +1 -1
- package/input-number/index.es.js +2 -20
- package/input-number/index.umd.js +1 -1
- package/layout/index.es.js +1 -1
- package/layout/index.umd.js +1 -1
- package/loading/index.es.js +15 -38
- package/loading/index.umd.js +1 -1
- package/message/index.d.ts +7 -0
- package/message/index.es.js +534 -0
- package/message/index.umd.js +1 -0
- package/message/package.json +7 -0
- package/message/style.css +1 -0
- package/modal/index.es.js +13 -44
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +45 -54
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/Message.js +3 -0
- package/nuxt/components/animationInjectionKey.js +3 -0
- package/nuxt/components/messageProps.js +3 -0
- package/nuxt/components/roundInjectionKey.js +3 -0
- package/nuxt/components/skeletonItemProps.js +3 -0
- package/overlay/index.es.js +1 -1
- package/overlay/index.umd.js +1 -1
- package/package.json +2 -2
- package/pagination/index.es.js +152 -2
- package/pagination/index.umd.js +1 -1
- package/panel/index.umd.js +1 -1
- package/popover/index.es.js +1 -1
- package/popover/index.umd.js +4 -4
- package/progress/index.umd.js +3 -3
- package/radio/index.es.js +91 -75
- package/radio/index.umd.js +28 -17
- package/radio/style.css +1 -1
- package/rate/index.umd.js +1 -1
- package/result/index.es.js +2 -1
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/ripple/index.es.js +5 -18
- package/ripple/index.umd.js +1 -1
- package/search/index.es.js +258 -80
- package/search/index.umd.js +27 -16
- package/search/style.css +1 -1
- package/select/index.es.js +352 -146
- package/select/index.umd.js +28 -17
- package/select/style.css +1 -1
- package/skeleton/index.es.js +87 -261
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.umd.js +1 -1
- package/splitter/index.es.js +175 -32
- package/splitter/index.umd.js +13 -13
- package/statistic/index.es.js +0 -21
- package/statistic/index.umd.js +1 -1
- package/status/index.umd.js +1 -1
- package/steps/index.es.js +2 -1
- package/steps/index.umd.js +1 -1
- package/steps/style.css +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +85 -71
- package/switch/index.umd.js +25 -14
- package/table/index.es.js +465 -130
- package/table/index.umd.js +24 -13
- package/table/style.css +1 -1
- package/tabs/index.es.js +21 -11
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.umd.js +1 -1
- package/textarea/index.es.js +88 -72
- package/textarea/index.umd.js +26 -15
- package/time-picker/index.es.js +289 -116
- package/time-picker/index.umd.js +27 -16
- package/time-picker/style.css +1 -1
- package/time-select/index.es.js +352 -146
- package/time-select/index.umd.js +26 -15
- package/time-select/style.css +1 -1
- package/timeline/index.es.js +2 -1
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +1 -1
- package/tooltip/index.umd.js +4 -4
- package/tree/index.es.js +515 -144
- package/tree/index.umd.js +26 -15
- package/tree/style.css +1 -1
- package/upload/index.es.js +197 -81
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +13710 -12898
- package/vue-devui.umd.js +30 -19
package/tree/index.es.js
CHANGED
|
@@ -1,35 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
import { createVNode, defineComponent, toRefs, inject, watch, provide, reactive, onUnmounted, Transition, mergeProps, ref, unref, nextTick, Comment, Text, h, Fragment, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, getCurrentInstance, renderSlot, useSlots, resolveComponent, isVNode, onUpdated, shallowRef, toRaw, watchEffect } from "vue";
|
|
1
|
+
import { createVNode, defineComponent, toRefs, inject, ref, reactive, getCurrentInstance, watch, provide, onUnmounted, Transition, mergeProps, nextTick, unref, Comment, Text, Fragment, h, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, renderSlot, useSlots, resolveComponent, isVNode, onUpdated, shallowRef, toRaw, watchEffect } from "vue";
|
|
33
2
|
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
34
3
|
const USE_TREE_TOKEN = "use-tree-token";
|
|
35
4
|
const TREE_INSTANCE = "tree-instance";
|
|
@@ -142,6 +111,187 @@ var DTreeNodeToggle = defineComponent({
|
|
|
142
111
|
};
|
|
143
112
|
}
|
|
144
113
|
});
|
|
114
|
+
function deepAssign(...objects) {
|
|
115
|
+
const isObject2 = (obj) => obj && typeof obj === "object";
|
|
116
|
+
return objects.reduce((prev, from) => {
|
|
117
|
+
Object.keys(from).forEach((key) => {
|
|
118
|
+
const pVal = prev[key];
|
|
119
|
+
const oVal = from[key];
|
|
120
|
+
if (Array.isArray(pVal) && Array.isArray(oVal)) {
|
|
121
|
+
prev[key] = Array.from(/* @__PURE__ */ new Set([...oVal, ...pVal]));
|
|
122
|
+
} else if (isObject2(pVal) && isObject2(oVal)) {
|
|
123
|
+
prev[key] = deepAssign(pVal, oVal);
|
|
124
|
+
} else {
|
|
125
|
+
prev[key] = oVal;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return prev;
|
|
129
|
+
}, {});
|
|
130
|
+
}
|
|
131
|
+
var zhCN = {
|
|
132
|
+
pagination: {
|
|
133
|
+
totalItemText: "\u6240\u6709\u6761\u76EE",
|
|
134
|
+
goToText: "\u8DF3\u81F3"
|
|
135
|
+
},
|
|
136
|
+
accordion: {
|
|
137
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
138
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
139
|
+
},
|
|
140
|
+
autoCompleteDropdown: {
|
|
141
|
+
latestInput: "\u6700\u8FD1\u8F93\u5165"
|
|
142
|
+
},
|
|
143
|
+
cascaderList: {
|
|
144
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
145
|
+
},
|
|
146
|
+
colorPicker: {
|
|
147
|
+
foundationPanel: "\u57FA\u7840\u9762\u677F",
|
|
148
|
+
advancedPanel: "\u9AD8\u7EA7\u9762\u677F"
|
|
149
|
+
},
|
|
150
|
+
datePickerPro: {
|
|
151
|
+
ok: "\u786E\u5B9A",
|
|
152
|
+
placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F",
|
|
153
|
+
month1: "1\u6708",
|
|
154
|
+
month2: "2\u6708",
|
|
155
|
+
month3: "3\u6708",
|
|
156
|
+
month4: "4\u6708",
|
|
157
|
+
month5: "5\u6708",
|
|
158
|
+
month6: "6\u6708",
|
|
159
|
+
month7: "7\u6708",
|
|
160
|
+
month8: "8\u6708",
|
|
161
|
+
month9: "9\u6708",
|
|
162
|
+
month10: "10\u6708",
|
|
163
|
+
month11: "11\u6708",
|
|
164
|
+
month12: "12\u6708",
|
|
165
|
+
year: "\u5E74",
|
|
166
|
+
startPlaceholder: "\u8BF7\u9009\u62E9\u5F00\u59CB\u65E5\u671F",
|
|
167
|
+
endPlaceholder: "\u8BF7\u9009\u62E9\u7ED3\u675F\u65E5\u671F",
|
|
168
|
+
getWeekDays() {
|
|
169
|
+
return ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
|
|
170
|
+
},
|
|
171
|
+
getTimeArr() {
|
|
172
|
+
return ["\u65F6", "\u5206", "\u79D2"];
|
|
173
|
+
},
|
|
174
|
+
getYearMonthStr(year, month) {
|
|
175
|
+
return `${year}\u5E74${month}\u6708`;
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
editableSelect: {
|
|
179
|
+
noRelatedRecords: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
|
|
180
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
181
|
+
},
|
|
182
|
+
input: {
|
|
183
|
+
placeholder: "\u8BF7\u8F93\u5165"
|
|
184
|
+
},
|
|
185
|
+
splitterBar: {
|
|
186
|
+
collapse: "\u6536\u8D77",
|
|
187
|
+
expand: "\u5C55\u5F00"
|
|
188
|
+
},
|
|
189
|
+
stepsGuide: {
|
|
190
|
+
previous: "\u4E0A\u4E00\u6B65",
|
|
191
|
+
continue: "\u6211\u77E5\u9053\u5566\uFF0C\u7EE7\u7EED",
|
|
192
|
+
ok: "\u6211\u77E5\u9053\u5566"
|
|
193
|
+
},
|
|
194
|
+
table: {
|
|
195
|
+
selectAll: "\u5168\u9009",
|
|
196
|
+
ok: "\u786E\u5B9A"
|
|
197
|
+
},
|
|
198
|
+
timePopup: {
|
|
199
|
+
ok: "\u786E\u5B9A"
|
|
200
|
+
},
|
|
201
|
+
transfer: {
|
|
202
|
+
unit: "\u9879",
|
|
203
|
+
panelUnit: "\u9879",
|
|
204
|
+
headerUnit: "\u9879",
|
|
205
|
+
noData: "\u6682\u65E0\u6570\u636E",
|
|
206
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22"
|
|
207
|
+
},
|
|
208
|
+
tree: {
|
|
209
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
210
|
+
newNode: "\u65B0\u8282\u70B9",
|
|
211
|
+
selectPlaceholder: "\u8BF7\u9009\u62E9"
|
|
212
|
+
},
|
|
213
|
+
upload: {
|
|
214
|
+
placeholder: "\u9009\u62E9\u6587\u4EF6",
|
|
215
|
+
getExistSameNameFilesMsg(sameNames) {
|
|
216
|
+
return `\u60A8\u4E0A\u4F20\u7684 "${sameNames}" \u5B58\u5728\u91CD\u540D\u6587\u4EF6, \u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
|
|
217
|
+
},
|
|
218
|
+
getAllFilesBeyondMaximalFileSizeMsg(maximalSize) {
|
|
219
|
+
return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u672C\u6B21\u4E0A\u4F20\u7684\u6240\u6709\u6587\u4EF6\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
|
|
220
|
+
},
|
|
221
|
+
getBeyondMaximalFileSizeMsg(filename, maximalSize) {
|
|
222
|
+
return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
|
|
223
|
+
},
|
|
224
|
+
getNotAllowedFileTypeMsg(filename, scope) {
|
|
225
|
+
return `\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B: "${scope}", \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u4E0D\u5728\u5141\u8BB8\u8303\u56F4\u5185\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
search: {
|
|
229
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57"
|
|
230
|
+
},
|
|
231
|
+
select: {
|
|
232
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
233
|
+
noDataText: "\u65E0\u6570\u636E",
|
|
234
|
+
noMatchText: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
|
|
235
|
+
loadingText: "\u52A0\u8F7D\u4E2D..."
|
|
236
|
+
},
|
|
237
|
+
tagInput: {
|
|
238
|
+
maxTagsText: "\u5DF2\u8FBE\u5230\u6700\u5927\u4E2A\u6570\uFF1A"
|
|
239
|
+
},
|
|
240
|
+
timeSelect: {
|
|
241
|
+
placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4"
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
const lang = ref("zh-CN");
|
|
245
|
+
let langMessages = reactive({
|
|
246
|
+
[lang.value]: zhCN
|
|
247
|
+
});
|
|
248
|
+
const Locale = {
|
|
249
|
+
messages() {
|
|
250
|
+
return langMessages[lang.value];
|
|
251
|
+
},
|
|
252
|
+
lang() {
|
|
253
|
+
return lang.value;
|
|
254
|
+
},
|
|
255
|
+
use(newLang, newMessages2) {
|
|
256
|
+
lang.value = newLang;
|
|
257
|
+
this.add({ [newLang]: newMessages2 });
|
|
258
|
+
},
|
|
259
|
+
add(newMessages2 = {}) {
|
|
260
|
+
langMessages = deepAssign(langMessages, newMessages2);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
const camelize = (name) => name.substring(1).replace(/^\S/, (s) => s.toLocaleLowerCase());
|
|
264
|
+
function get(object4, path) {
|
|
265
|
+
const keys = path.split(".");
|
|
266
|
+
let result = object4;
|
|
267
|
+
keys.forEach((key) => {
|
|
268
|
+
var _a;
|
|
269
|
+
result = (_a = result[key]) != null ? _a : "";
|
|
270
|
+
});
|
|
271
|
+
return result;
|
|
272
|
+
}
|
|
273
|
+
function createI18nTranslate(name, app, newPrefix) {
|
|
274
|
+
const prefix = newPrefix || camelize(name) + ".";
|
|
275
|
+
return (path) => {
|
|
276
|
+
var _a;
|
|
277
|
+
const messages2 = ((_a = app == null ? void 0 : app.appContext.config.globalProperties.langMessages) == null ? void 0 : _a.value) || Locale.messages();
|
|
278
|
+
const message = get(messages2, prefix + path) || get(messages2, path);
|
|
279
|
+
return message;
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
var DTreeNodeLoading = defineComponent({
|
|
283
|
+
name: "DTreeNodeLoading",
|
|
284
|
+
setup() {
|
|
285
|
+
const app = getCurrentInstance();
|
|
286
|
+
const t = createI18nTranslate("DTree", app);
|
|
287
|
+
const ns2 = useNamespace("loading-children ");
|
|
288
|
+
return () => {
|
|
289
|
+
return createVNode("span", {
|
|
290
|
+
"class": ns2.b()
|
|
291
|
+
}, [`${t("loading") || "Loading"}...`]);
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
});
|
|
145
295
|
const commonProps = {
|
|
146
296
|
name: {
|
|
147
297
|
type: String,
|
|
@@ -179,7 +329,8 @@ const commonProps = {
|
|
|
179
329
|
default: "md"
|
|
180
330
|
}
|
|
181
331
|
};
|
|
182
|
-
const checkboxProps =
|
|
332
|
+
const checkboxProps = {
|
|
333
|
+
...commonProps,
|
|
183
334
|
checked: {
|
|
184
335
|
type: Boolean,
|
|
185
336
|
default: false
|
|
@@ -209,8 +360,9 @@ const checkboxProps = __spreadProps(__spreadValues({}, commonProps), {
|
|
|
209
360
|
type: Boolean,
|
|
210
361
|
default: false
|
|
211
362
|
}
|
|
212
|
-
}
|
|
213
|
-
const checkboxGroupProps =
|
|
363
|
+
};
|
|
364
|
+
const checkboxGroupProps = {
|
|
365
|
+
...commonProps,
|
|
214
366
|
modelValue: {
|
|
215
367
|
type: Array,
|
|
216
368
|
required: true
|
|
@@ -247,7 +399,7 @@ const checkboxGroupProps = __spreadProps(__spreadValues({}, commonProps), {
|
|
|
247
399
|
type: String,
|
|
248
400
|
default: ""
|
|
249
401
|
}
|
|
250
|
-
}
|
|
402
|
+
};
|
|
251
403
|
const checkboxGroupInjectionKey = Symbol("d-checkbox-group");
|
|
252
404
|
const formProps = {
|
|
253
405
|
data: {
|
|
@@ -1015,7 +1167,7 @@ var lodash = { exports: {} };
|
|
|
1015
1167
|
var objectCtorString = funcToString.call(Object2);
|
|
1016
1168
|
var oldDash = root._;
|
|
1017
1169
|
var reIsNative = RegExp2("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
|
1018
|
-
var
|
|
1170
|
+
var Buffer = moduleExports ? context.Buffer : undefined$1, Symbol2 = context.Symbol, Uint8Array = context.Uint8Array, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined$1, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined$1, symIterator = Symbol2 ? Symbol2.iterator : undefined$1, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined$1;
|
|
1019
1171
|
var defineProperty = function() {
|
|
1020
1172
|
try {
|
|
1021
1173
|
var func = getNative(Object2, "defineProperty");
|
|
@@ -1025,11 +1177,11 @@ var lodash = { exports: {} };
|
|
|
1025
1177
|
}
|
|
1026
1178
|
}();
|
|
1027
1179
|
var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
|
|
1028
|
-
var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer =
|
|
1029
|
-
var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"),
|
|
1030
|
-
var metaMap =
|
|
1180
|
+
var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined$1, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
|
|
1181
|
+
var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
|
|
1182
|
+
var metaMap = WeakMap && new WeakMap();
|
|
1031
1183
|
var realNames = {};
|
|
1032
|
-
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(
|
|
1184
|
+
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap);
|
|
1033
1185
|
var symbolProto = Symbol2 ? Symbol2.prototype : undefined$1, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined$1, symbolToString = symbolProto ? symbolProto.toString : undefined$1;
|
|
1034
1186
|
function lodash2(value) {
|
|
1035
1187
|
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
|
|
@@ -2277,7 +2429,7 @@ var lodash = { exports: {} };
|
|
|
2277
2429
|
}
|
|
2278
2430
|
function cloneArrayBuffer(arrayBuffer) {
|
|
2279
2431
|
var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
2280
|
-
new
|
|
2432
|
+
new Uint8Array(result2).set(new Uint8Array(arrayBuffer));
|
|
2281
2433
|
return result2;
|
|
2282
2434
|
}
|
|
2283
2435
|
function cloneDataView(dataView, isDeep) {
|
|
@@ -2721,8 +2873,8 @@ var lodash = { exports: {} };
|
|
|
2721
2873
|
return func(number4);
|
|
2722
2874
|
};
|
|
2723
2875
|
}
|
|
2724
|
-
var createSet = !(
|
|
2725
|
-
return new
|
|
2876
|
+
var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values2) {
|
|
2877
|
+
return new Set2(values2);
|
|
2726
2878
|
};
|
|
2727
2879
|
function createToPairs(keysFunc) {
|
|
2728
2880
|
return function(object4) {
|
|
@@ -2859,7 +3011,7 @@ var lodash = { exports: {} };
|
|
|
2859
3011
|
object4 = object4.buffer;
|
|
2860
3012
|
other = other.buffer;
|
|
2861
3013
|
case arrayBufferTag:
|
|
2862
|
-
if (object4.byteLength != other.byteLength || !equalFunc(new
|
|
3014
|
+
if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array(object4), new Uint8Array(other))) {
|
|
2863
3015
|
return false;
|
|
2864
3016
|
}
|
|
2865
3017
|
return true;
|
|
@@ -3021,7 +3173,7 @@ var lodash = { exports: {} };
|
|
|
3021
3173
|
return result2;
|
|
3022
3174
|
};
|
|
3023
3175
|
var getTag = baseGetTag;
|
|
3024
|
-
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag ||
|
|
3176
|
+
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
|
|
3025
3177
|
getTag = function(value) {
|
|
3026
3178
|
var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined$1, ctorString = Ctor ? toSource(Ctor) : "";
|
|
3027
3179
|
if (ctorString) {
|
|
@@ -5738,7 +5890,10 @@ function useFormValidation(itemContexts) {
|
|
|
5738
5890
|
try {
|
|
5739
5891
|
await field.validate("");
|
|
5740
5892
|
} catch (err) {
|
|
5741
|
-
errors =
|
|
5893
|
+
errors = {
|
|
5894
|
+
...errors,
|
|
5895
|
+
...err
|
|
5896
|
+
};
|
|
5742
5897
|
}
|
|
5743
5898
|
}
|
|
5744
5899
|
if (!Object.keys(errors).length) {
|
|
@@ -5795,11 +5950,12 @@ defineComponent({
|
|
|
5795
5950
|
}, {
|
|
5796
5951
|
deep: true
|
|
5797
5952
|
});
|
|
5798
|
-
provide(FORM_TOKEN, reactive(
|
|
5953
|
+
provide(FORM_TOKEN, reactive({
|
|
5954
|
+
...toRefs(props),
|
|
5799
5955
|
emit: ctx.emit,
|
|
5800
5956
|
addItemContext,
|
|
5801
5957
|
removeItemContext
|
|
5802
|
-
}))
|
|
5958
|
+
}));
|
|
5803
5959
|
ctx.expose({
|
|
5804
5960
|
validate,
|
|
5805
5961
|
validateFields,
|
|
@@ -6676,7 +6832,7 @@ var FormControl = defineComponent({
|
|
|
6676
6832
|
}
|
|
6677
6833
|
});
|
|
6678
6834
|
function _extends() {
|
|
6679
|
-
_extends = Object.assign
|
|
6835
|
+
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
6680
6836
|
for (var i = 1; i < arguments.length; i++) {
|
|
6681
6837
|
var source = arguments[i];
|
|
6682
6838
|
for (var key in source) {
|
|
@@ -6695,13 +6851,13 @@ function _inheritsLoose(subClass, superClass) {
|
|
|
6695
6851
|
_setPrototypeOf(subClass, superClass);
|
|
6696
6852
|
}
|
|
6697
6853
|
function _getPrototypeOf(o) {
|
|
6698
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
|
|
6854
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
|
|
6699
6855
|
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
6700
6856
|
};
|
|
6701
6857
|
return _getPrototypeOf(o);
|
|
6702
6858
|
}
|
|
6703
6859
|
function _setPrototypeOf(o, p) {
|
|
6704
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
6860
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
|
|
6705
6861
|
o2.__proto__ = p2;
|
|
6706
6862
|
return o2;
|
|
6707
6863
|
};
|
|
@@ -6724,7 +6880,7 @@ function _isNativeReflectConstruct() {
|
|
|
6724
6880
|
}
|
|
6725
6881
|
function _construct(Parent, args, Class) {
|
|
6726
6882
|
if (_isNativeReflectConstruct()) {
|
|
6727
|
-
_construct = Reflect.construct;
|
|
6883
|
+
_construct = Reflect.construct.bind();
|
|
6728
6884
|
} else {
|
|
6729
6885
|
_construct = function _construct2(Parent2, args2, Class2) {
|
|
6730
6886
|
var a = [null];
|
|
@@ -7002,9 +7158,45 @@ var whitespace = function whitespace2(rule, value, source, errors, options) {
|
|
|
7002
7158
|
errors.push(format(options.messages.whitespace, rule.fullField));
|
|
7003
7159
|
}
|
|
7004
7160
|
};
|
|
7161
|
+
var urlReg;
|
|
7162
|
+
var getUrlRegex = function() {
|
|
7163
|
+
if (urlReg) {
|
|
7164
|
+
return urlReg;
|
|
7165
|
+
}
|
|
7166
|
+
var word = "[a-fA-F\\d:]";
|
|
7167
|
+
var b = function b2(options) {
|
|
7168
|
+
return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
|
|
7169
|
+
};
|
|
7170
|
+
var v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
|
|
7171
|
+
var v6seg = "[a-fA-F\\d]{1,4}";
|
|
7172
|
+
var v6 = ("\n(?:\n(?:" + v6seg + ":){7}(?:" + v6seg + "|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:" + v6seg + ":){6}(?:" + v4 + "|:" + v6seg + "|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:" + v6seg + ":){5}(?::" + v4 + "|(?::" + v6seg + "){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:" + v6seg + ":){4}(?:(?::" + v6seg + "){0,1}:" + v4 + "|(?::" + v6seg + "){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:" + v6seg + ":){3}(?:(?::" + v6seg + "){0,2}:" + v4 + "|(?::" + v6seg + "){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:" + v6seg + ":){2}(?:(?::" + v6seg + "){0,3}:" + v4 + "|(?::" + v6seg + "){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:" + v6seg + ":){1}(?:(?::" + v6seg + "){0,4}:" + v4 + "|(?::" + v6seg + "){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::" + v6seg + "){0,5}:" + v4 + "|(?::" + v6seg + "){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim();
|
|
7173
|
+
var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
|
|
7174
|
+
var v4exact = new RegExp("^" + v4 + "$");
|
|
7175
|
+
var v6exact = new RegExp("^" + v6 + "$");
|
|
7176
|
+
var ip = function ip2(options) {
|
|
7177
|
+
return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
|
|
7178
|
+
};
|
|
7179
|
+
ip.v4 = function(options) {
|
|
7180
|
+
return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
|
|
7181
|
+
};
|
|
7182
|
+
ip.v6 = function(options) {
|
|
7183
|
+
return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
|
|
7184
|
+
};
|
|
7185
|
+
var protocol = "(?:(?:[a-z]+:)?//)";
|
|
7186
|
+
var auth = "(?:\\S+(?::\\S*)?@)?";
|
|
7187
|
+
var ipv4 = ip.v4().source;
|
|
7188
|
+
var ipv6 = ip.v6().source;
|
|
7189
|
+
var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
|
|
7190
|
+
var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
|
|
7191
|
+
var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
|
|
7192
|
+
var port = "(?::\\d{2,5})?";
|
|
7193
|
+
var path = '(?:[/?#][^\\s"]*)?';
|
|
7194
|
+
var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
|
|
7195
|
+
urlReg = new RegExp("(?:^" + regex + "$)", "i");
|
|
7196
|
+
return urlReg;
|
|
7197
|
+
};
|
|
7005
7198
|
var pattern$2 = {
|
|
7006
7199
|
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
|
|
7007
|
-
url: new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$", "i"),
|
|
7008
7200
|
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
|
|
7009
7201
|
};
|
|
7010
7202
|
var types = {
|
|
@@ -7046,7 +7238,7 @@ var types = {
|
|
|
7046
7238
|
return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
|
|
7047
7239
|
},
|
|
7048
7240
|
url: function url(value) {
|
|
7049
|
-
return typeof value === "string" && value.length <= 2048 && !!value.match(
|
|
7241
|
+
return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
|
|
7050
7242
|
},
|
|
7051
7243
|
hex: function hex(value) {
|
|
7052
7244
|
return typeof value === "string" && !!value.match(pattern$2.hex);
|
|
@@ -7621,7 +7813,17 @@ var Schema = /* @__PURE__ */ function() {
|
|
|
7621
7813
|
if (rule.asyncValidator) {
|
|
7622
7814
|
res = rule.asyncValidator(rule, data.value, cb, data.source, options);
|
|
7623
7815
|
} else if (rule.validator) {
|
|
7624
|
-
|
|
7816
|
+
try {
|
|
7817
|
+
res = rule.validator(rule, data.value, cb, data.source, options);
|
|
7818
|
+
} catch (error) {
|
|
7819
|
+
console.error == null ? void 0 : console.error(error);
|
|
7820
|
+
if (!options.suppressValidatorError) {
|
|
7821
|
+
setTimeout(function() {
|
|
7822
|
+
throw error;
|
|
7823
|
+
}, 0);
|
|
7824
|
+
}
|
|
7825
|
+
cb(error.message);
|
|
7826
|
+
}
|
|
7625
7827
|
if (res === true) {
|
|
7626
7828
|
cb();
|
|
7627
7829
|
} else if (res === false) {
|
|
@@ -7742,10 +7944,7 @@ function useFormItemValidate(props, _rules) {
|
|
|
7742
7944
|
} else {
|
|
7743
7945
|
return rule.trigger === triggerVal;
|
|
7744
7946
|
}
|
|
7745
|
-
}).map((
|
|
7746
|
-
var _b = _a, { trigger } = _b, rule = __objRest(_b, ["trigger"]);
|
|
7747
|
-
return rule;
|
|
7748
|
-
});
|
|
7947
|
+
}).map(({ ...rule }) => rule);
|
|
7749
7948
|
};
|
|
7750
7949
|
const onValidateSuccess = () => {
|
|
7751
7950
|
validateState.value = "success";
|
|
@@ -7818,15 +8017,12 @@ defineComponent({
|
|
|
7818
8017
|
props: formItemProps,
|
|
7819
8018
|
setup(props, ctx) {
|
|
7820
8019
|
const formContext = inject(FORM_TOKEN);
|
|
7821
|
-
const
|
|
8020
|
+
const {
|
|
7822
8021
|
messageType: itemMessageType,
|
|
7823
8022
|
popPosition: itemPopPosition,
|
|
7824
|
-
showFeedback: itemShowFeedback
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
"popPosition",
|
|
7828
|
-
"showFeedback"
|
|
7829
|
-
]);
|
|
8023
|
+
showFeedback: itemShowFeedback,
|
|
8024
|
+
...otherProps
|
|
8025
|
+
} = toRefs(props);
|
|
7830
8026
|
const {
|
|
7831
8027
|
label,
|
|
7832
8028
|
helpTips,
|
|
@@ -7856,7 +8052,8 @@ defineComponent({
|
|
|
7856
8052
|
labelAlign: formContext.labelAlign
|
|
7857
8053
|
}));
|
|
7858
8054
|
provide(LABEL_DATA, labelData);
|
|
7859
|
-
const context = reactive(
|
|
8055
|
+
const context = reactive({
|
|
8056
|
+
...otherProps,
|
|
7860
8057
|
showFeedback,
|
|
7861
8058
|
messageType,
|
|
7862
8059
|
popPosition,
|
|
@@ -7866,7 +8063,7 @@ defineComponent({
|
|
|
7866
8063
|
validate,
|
|
7867
8064
|
resetField,
|
|
7868
8065
|
clearValidate
|
|
7869
|
-
})
|
|
8066
|
+
});
|
|
7870
8067
|
provide(FORM_ITEM_TOKEN, context);
|
|
7871
8068
|
ctx.expose({
|
|
7872
8069
|
resetField,
|
|
@@ -7891,8 +8088,8 @@ defineComponent({
|
|
|
7891
8088
|
"extra-info": extraInfo.value
|
|
7892
8089
|
}, {
|
|
7893
8090
|
default: () => {
|
|
7894
|
-
var
|
|
7895
|
-
return [(_b = (
|
|
8091
|
+
var _a, _b;
|
|
8092
|
+
return [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)];
|
|
7896
8093
|
}
|
|
7897
8094
|
})]);
|
|
7898
8095
|
}
|
|
@@ -8193,9 +8390,10 @@ defineComponent({
|
|
|
8193
8390
|
value: opt
|
|
8194
8391
|
});
|
|
8195
8392
|
} else if (typeof opt === "object") {
|
|
8196
|
-
mergedOpt = Object.assign({}, defaultOpt,
|
|
8393
|
+
mergedOpt = Object.assign({}, defaultOpt, {
|
|
8394
|
+
...opt,
|
|
8197
8395
|
label: opt.name
|
|
8198
|
-
})
|
|
8396
|
+
});
|
|
8199
8397
|
}
|
|
8200
8398
|
return createVNode(Checkbox, mergedOpt, null);
|
|
8201
8399
|
});
|
|
@@ -8283,9 +8481,9 @@ function useTreeNode(data) {
|
|
|
8283
8481
|
if (!data.value || data.value.level === 1) {
|
|
8284
8482
|
return [];
|
|
8285
8483
|
}
|
|
8286
|
-
const { currentIndex = 0,
|
|
8484
|
+
const { currentIndex = 0, parentChildNodeCount = 0, level, expanded, isLeaf } = data.value;
|
|
8287
8485
|
return Array.from({ length: data.value.level - 1 }).map((_, index2) => ({
|
|
8288
|
-
height: `${currentIndex + 1 ===
|
|
8486
|
+
height: `${currentIndex + 1 === parentChildNodeCount && index2 === 0 ? isLeaf || !expanded ? NODE_HEIGHT / 2 : NODE_HEIGHT : NODE_HEIGHT}px`,
|
|
8289
8487
|
left: `${NODE_INDENT * (level - index2 - 2) + 9}px`,
|
|
8290
8488
|
top: `0px`
|
|
8291
8489
|
}));
|
|
@@ -8303,6 +8501,15 @@ function useTreeNode(data) {
|
|
|
8303
8501
|
return [ns.e("node-title"), ((_a = data.value) == null ? void 0 : _a.disableSelect) && "select-disabled"];
|
|
8304
8502
|
});
|
|
8305
8503
|
const nodeOperationAreaClass = computed(() => ns.e("node-operation-area"));
|
|
8504
|
+
const matchedContents = computed(() => {
|
|
8505
|
+
var _a, _b;
|
|
8506
|
+
const matchItem = ((_a = data.value) == null ? void 0 : _a.matchedText) || "";
|
|
8507
|
+
const label = ((_b = data.value) == null ? void 0 : _b.label) || "";
|
|
8508
|
+
const reg = (str) => str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
8509
|
+
const regExp = new RegExp("(" + reg(matchItem) + ")", "gi");
|
|
8510
|
+
return label.split(regExp);
|
|
8511
|
+
});
|
|
8512
|
+
const highlightCls = ns.e("match-highlight");
|
|
8306
8513
|
return {
|
|
8307
8514
|
nodeClass,
|
|
8308
8515
|
nodeStyle,
|
|
@@ -8311,7 +8518,9 @@ function useTreeNode(data) {
|
|
|
8311
8518
|
nodeVLineClass,
|
|
8312
8519
|
nodeVLineStyles,
|
|
8313
8520
|
nodeHLineClass,
|
|
8314
|
-
nodeOperationAreaClass
|
|
8521
|
+
nodeOperationAreaClass,
|
|
8522
|
+
matchedContents,
|
|
8523
|
+
highlightCls
|
|
8315
8524
|
};
|
|
8316
8525
|
}
|
|
8317
8526
|
var DTreeNodeContent = defineComponent({
|
|
@@ -8327,37 +8536,23 @@ var DTreeNodeContent = defineComponent({
|
|
|
8327
8536
|
data
|
|
8328
8537
|
} = toRefs(props);
|
|
8329
8538
|
const {
|
|
8330
|
-
nodeTitleClass
|
|
8539
|
+
nodeTitleClass,
|
|
8540
|
+
matchedContents,
|
|
8541
|
+
highlightCls
|
|
8331
8542
|
} = useTreeNode(data);
|
|
8332
8543
|
return () => {
|
|
8333
|
-
var _a;
|
|
8544
|
+
var _a, _b, _c;
|
|
8334
8545
|
return createVNode("span", {
|
|
8335
8546
|
"class": nodeTitleClass.value
|
|
8336
|
-
}, [(_a = data.value) == null ? void 0 : _a.label
|
|
8547
|
+
}, [!((_a = data.value) == null ? void 0 : _a.matchedText) && ((_b = data.value) == null ? void 0 : _b.label), ((_c = data.value) == null ? void 0 : _c.matchedText) && matchedContents.value.map((item, index2) => index2 % 2 === 0 ? item : createVNode("span", {
|
|
8548
|
+
"class": highlightCls
|
|
8549
|
+
}, [item]))]);
|
|
8337
8550
|
};
|
|
8338
8551
|
}
|
|
8339
8552
|
});
|
|
8340
8553
|
const formatCheckStatus = (check) => {
|
|
8341
8554
|
return typeof check === "boolean" ? check ? "both" : "none" : check;
|
|
8342
8555
|
};
|
|
8343
|
-
const camelize = (name) => name.substring(1).replace(/^\S/, (s) => s.toLocaleLowerCase());
|
|
8344
|
-
function get(object4, path) {
|
|
8345
|
-
const keys = path.split(".");
|
|
8346
|
-
let result = object4;
|
|
8347
|
-
keys.forEach((key) => {
|
|
8348
|
-
var _a;
|
|
8349
|
-
result = (_a = result[key]) != null ? _a : "";
|
|
8350
|
-
});
|
|
8351
|
-
return result;
|
|
8352
|
-
}
|
|
8353
|
-
function createI18nTranslate(name, app, newPrefix) {
|
|
8354
|
-
const prefix = newPrefix || camelize(name) + ".";
|
|
8355
|
-
return (path) => {
|
|
8356
|
-
const messages2 = app == null ? void 0 : app.appContext.config.globalProperties.langMessages.value;
|
|
8357
|
-
const message = get(messages2, prefix + path) || get(messages2, path);
|
|
8358
|
-
return message;
|
|
8359
|
-
};
|
|
8360
|
-
}
|
|
8361
8556
|
var DTreeNode = defineComponent({
|
|
8362
8557
|
name: "DTreeNode",
|
|
8363
8558
|
props: {
|
|
@@ -8390,7 +8585,8 @@ var DTreeNode = defineComponent({
|
|
|
8390
8585
|
toggleNode,
|
|
8391
8586
|
getChildren,
|
|
8392
8587
|
insertBefore,
|
|
8393
|
-
removeNode
|
|
8588
|
+
removeNode,
|
|
8589
|
+
getNode
|
|
8394
8590
|
} = inject(USE_TREE_TOKEN);
|
|
8395
8591
|
const treeInstance = inject(TREE_INSTANCE);
|
|
8396
8592
|
const ns2 = useNamespace("tree");
|
|
@@ -8440,6 +8636,7 @@ var DTreeNode = defineComponent({
|
|
|
8440
8636
|
isShowOperationArea.value = false;
|
|
8441
8637
|
};
|
|
8442
8638
|
return () => {
|
|
8639
|
+
var _a;
|
|
8443
8640
|
return createVNode("div", {
|
|
8444
8641
|
"class": nodeClass.value,
|
|
8445
8642
|
"style": nodeStyle.value,
|
|
@@ -8470,7 +8667,7 @@ var DTreeNode = defineComponent({
|
|
|
8470
8667
|
nodeData: data
|
|
8471
8668
|
}) : createVNode(DTreeNodeContent, {
|
|
8472
8669
|
"data": data.value
|
|
8473
|
-
}, null)]), operate.value && isShowOperationArea.value && createVNode("div", {
|
|
8670
|
+
}, null), ((_a = getNode == null ? void 0 : getNode(data.value)) == null ? void 0 : _a.loading) ? slots.loading ? renderSlot(useSlots(), "loading") : createVNode(DTreeNodeLoading, null, null) : ""]), operate.value && isShowOperationArea.value && createVNode("div", {
|
|
8474
8671
|
"class": nodeOperationAreaClass.value
|
|
8475
8672
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
8476
8673
|
"name": "add",
|
|
@@ -8837,10 +9034,11 @@ var ResizeObserver$1 = defineComponent({
|
|
|
8837
9034
|
Object.assign(state, size);
|
|
8838
9035
|
if (onResize) {
|
|
8839
9036
|
Promise.resolve().then(() => {
|
|
8840
|
-
onResize(
|
|
9037
|
+
onResize({
|
|
9038
|
+
...size,
|
|
8841
9039
|
offsetWidth,
|
|
8842
9040
|
offsetHeight
|
|
8843
|
-
}
|
|
9041
|
+
}, target);
|
|
8844
9042
|
});
|
|
8845
9043
|
}
|
|
8846
9044
|
}
|
|
@@ -8903,13 +9101,14 @@ var ResizeObserverContainer = defineComponent({
|
|
|
8903
9101
|
position: "relative",
|
|
8904
9102
|
overflow: "hidden"
|
|
8905
9103
|
};
|
|
8906
|
-
innerStyle.value =
|
|
9104
|
+
innerStyle.value = {
|
|
9105
|
+
...innerStyle.value,
|
|
8907
9106
|
transform: `translateY(${offset2.value}px)`,
|
|
8908
9107
|
position: "absolute",
|
|
8909
9108
|
left: 0,
|
|
8910
9109
|
right: 0,
|
|
8911
9110
|
top: 0
|
|
8912
|
-
}
|
|
9111
|
+
};
|
|
8913
9112
|
}
|
|
8914
9113
|
}, {
|
|
8915
9114
|
immediate: true
|
|
@@ -9397,9 +9596,10 @@ var VirtualList = defineComponent({
|
|
|
9397
9596
|
const componentStyle = computed(() => {
|
|
9398
9597
|
let cs = null;
|
|
9399
9598
|
if (props.height) {
|
|
9400
|
-
cs =
|
|
9401
|
-
maxHeight: isVirtual.value ? props.height + "px" : void 0
|
|
9402
|
-
|
|
9599
|
+
cs = {
|
|
9600
|
+
maxHeight: isVirtual.value ? props.height + "px" : void 0,
|
|
9601
|
+
...ScrollStyle
|
|
9602
|
+
};
|
|
9403
9603
|
if (isVirtual.value) {
|
|
9404
9604
|
cs.overflowY = "hidden";
|
|
9405
9605
|
if (state.scrollMoving) {
|
|
@@ -9459,24 +9659,25 @@ var VirtualList = defineComponent({
|
|
|
9459
9659
|
}
|
|
9460
9660
|
});
|
|
9461
9661
|
function useToggle() {
|
|
9462
|
-
return function useToggle2(data, core, context) {
|
|
9662
|
+
return function useToggle2(data, core, context, lazyLode) {
|
|
9463
9663
|
const { getNode, setNodeValue } = core;
|
|
9664
|
+
const { lazyLoadNodes } = lazyLode;
|
|
9464
9665
|
const expandNode = (node) => {
|
|
9465
|
-
if (node.disableToggle) {
|
|
9666
|
+
if (node.disableToggle || node.loading) {
|
|
9466
9667
|
return;
|
|
9467
9668
|
}
|
|
9468
9669
|
setNodeValue(node, "expanded", true);
|
|
9469
9670
|
context.emit("toggle-change", node);
|
|
9470
9671
|
};
|
|
9471
9672
|
const collapseNode = (node) => {
|
|
9472
|
-
if (node.disableToggle) {
|
|
9673
|
+
if (node.disableToggle || node.loading) {
|
|
9473
9674
|
return;
|
|
9474
9675
|
}
|
|
9475
9676
|
setNodeValue(node, "expanded", false);
|
|
9476
9677
|
context.emit("toggle-change", node);
|
|
9477
9678
|
};
|
|
9478
9679
|
const toggleNode = (node) => {
|
|
9479
|
-
if (node.disableToggle) {
|
|
9680
|
+
if (node.disableToggle || node.loading) {
|
|
9480
9681
|
return;
|
|
9481
9682
|
}
|
|
9482
9683
|
if (getNode(node).expanded) {
|
|
@@ -9484,6 +9685,7 @@ function useToggle() {
|
|
|
9484
9685
|
} else {
|
|
9485
9686
|
expandNode(node);
|
|
9486
9687
|
}
|
|
9688
|
+
lazyLoadNodes(node);
|
|
9487
9689
|
};
|
|
9488
9690
|
const expandAllNodes = () => {
|
|
9489
9691
|
data.value.forEach((node) => {
|
|
@@ -9512,17 +9714,18 @@ function omit(obj, ...keys) {
|
|
|
9512
9714
|
function generateInnerTree(tree2, key = "children", level = 0, path = []) {
|
|
9513
9715
|
level++;
|
|
9514
9716
|
return tree2.reduce((acc, item, currentIndex) => {
|
|
9515
|
-
var _a, _b;
|
|
9717
|
+
var _a, _b, _c;
|
|
9516
9718
|
const newItem = Object.assign({}, item);
|
|
9517
9719
|
if (newItem.id === void 0) {
|
|
9518
9720
|
newItem.id = randomId();
|
|
9519
9721
|
newItem.idType = "random";
|
|
9520
9722
|
}
|
|
9521
9723
|
newItem.level = level;
|
|
9522
|
-
newItem.
|
|
9724
|
+
newItem.parentChildNodeCount = tree2.length;
|
|
9523
9725
|
newItem.currentIndex = currentIndex;
|
|
9524
|
-
|
|
9525
|
-
|
|
9726
|
+
newItem.childNodeCount = ((_a = newItem.children) == null ? void 0 : _a.length) || 0;
|
|
9727
|
+
if (path.length > 0 && ((_b = path[path.length - 1]) == null ? void 0 : _b.level) >= level) {
|
|
9728
|
+
while (((_c = path[path.length - 1]) == null ? void 0 : _c.level) >= level) {
|
|
9526
9729
|
path.pop();
|
|
9527
9730
|
}
|
|
9528
9731
|
}
|
|
@@ -9532,7 +9735,7 @@ function generateInnerTree(tree2, key = "children", level = 0, path = []) {
|
|
|
9532
9735
|
newItem.parentId = parentNode.id;
|
|
9533
9736
|
}
|
|
9534
9737
|
if (!newItem[key]) {
|
|
9535
|
-
return acc.concat(
|
|
9738
|
+
return acc.concat({ ...newItem, isLeaf: newItem.isLeaf === false ? false : true });
|
|
9536
9739
|
} else {
|
|
9537
9740
|
return acc.concat(omit(newItem, "children"), generateInnerTree(newItem[key], key, level, path));
|
|
9538
9741
|
}
|
|
@@ -9542,8 +9745,8 @@ const DEFAULT_CONFIG = {
|
|
|
9542
9745
|
expanded: false,
|
|
9543
9746
|
recursive: true
|
|
9544
9747
|
};
|
|
9545
|
-
const nodeMap = /* @__PURE__ */ new Map();
|
|
9546
9748
|
function useCore() {
|
|
9749
|
+
const nodeMap = /* @__PURE__ */ new Map();
|
|
9547
9750
|
return function useCore2(data) {
|
|
9548
9751
|
const getLevel = (node) => {
|
|
9549
9752
|
var _a;
|
|
@@ -9553,7 +9756,14 @@ function useCore() {
|
|
|
9553
9756
|
if (node.isLeaf) {
|
|
9554
9757
|
return [];
|
|
9555
9758
|
}
|
|
9556
|
-
|
|
9759
|
+
let mapKey = node.id || "";
|
|
9760
|
+
if (userConfig.expanded) {
|
|
9761
|
+
mapKey += "_expanded";
|
|
9762
|
+
}
|
|
9763
|
+
if (userConfig.recursive) {
|
|
9764
|
+
mapKey += "_recursive";
|
|
9765
|
+
}
|
|
9766
|
+
if (node.id && nodeMap.has(mapKey)) {
|
|
9557
9767
|
const cacheNode = nodeMap.get(node.id);
|
|
9558
9768
|
if (cacheNode) {
|
|
9559
9769
|
return cacheNode;
|
|
@@ -9577,21 +9787,24 @@ function useCore() {
|
|
|
9577
9787
|
});
|
|
9578
9788
|
};
|
|
9579
9789
|
const result = [];
|
|
9580
|
-
const config =
|
|
9790
|
+
const config = { ...DEFAULT_CONFIG, ...userConfig };
|
|
9581
9791
|
const treeData = config.expanded ? getInnerExpendedTree() : data;
|
|
9582
9792
|
const startIndex = treeData.value.findIndex((item) => item.id === node.id);
|
|
9583
9793
|
for (let i = startIndex + 1; i < treeData.value.length && getLevel(node) < treeData.value[i].level; i++) {
|
|
9584
|
-
if (config.recursive) {
|
|
9794
|
+
if (config.recursive && !treeData.value[i].isHide) {
|
|
9585
9795
|
result.push(treeData.value[i]);
|
|
9586
|
-
} else if (getLevel(node) === treeData.value[i].level - 1) {
|
|
9796
|
+
} else if (getLevel(node) === treeData.value[i].level - 1 && !treeData.value[i].isHide) {
|
|
9587
9797
|
result.push(treeData.value[i]);
|
|
9588
9798
|
}
|
|
9589
9799
|
}
|
|
9590
9800
|
if (node.id) {
|
|
9591
|
-
nodeMap.set(
|
|
9801
|
+
nodeMap.set(mapKey, result);
|
|
9592
9802
|
}
|
|
9593
9803
|
return result;
|
|
9594
9804
|
};
|
|
9805
|
+
const clearNodeMap = () => {
|
|
9806
|
+
nodeMap.clear();
|
|
9807
|
+
};
|
|
9595
9808
|
const getParent = (node) => {
|
|
9596
9809
|
return data.value.find((item) => item.id === node.parentId);
|
|
9597
9810
|
};
|
|
@@ -9601,7 +9814,7 @@ function useCore() {
|
|
|
9601
9814
|
const result = [];
|
|
9602
9815
|
for (let i = 0, len = data == null ? void 0 : data.value.length; i < len; i++) {
|
|
9603
9816
|
const item = data == null ? void 0 : data.value[i];
|
|
9604
|
-
if (excludeNodes.map((node) => node.id).includes(item.id)) {
|
|
9817
|
+
if (excludeNodes.map((node) => node.id).includes(item.id) || item.isHide) {
|
|
9605
9818
|
continue;
|
|
9606
9819
|
}
|
|
9607
9820
|
if (item.expanded !== true) {
|
|
@@ -9622,24 +9835,25 @@ function useCore() {
|
|
|
9622
9835
|
return data.value.find((item) => item.id === node.id);
|
|
9623
9836
|
};
|
|
9624
9837
|
const setNodeValue = (node, key, value) => {
|
|
9625
|
-
|
|
9838
|
+
clearNodeMap();
|
|
9626
9839
|
if (getIndex(node) !== -1) {
|
|
9627
9840
|
data.value[getIndex(node)][key] = value;
|
|
9628
9841
|
}
|
|
9629
9842
|
};
|
|
9630
9843
|
const setTree = (newTree) => {
|
|
9631
|
-
|
|
9844
|
+
clearNodeMap();
|
|
9632
9845
|
data.value = generateInnerTree(newTree);
|
|
9633
9846
|
};
|
|
9634
9847
|
const getTree = () => {
|
|
9635
9848
|
return data.value;
|
|
9636
9849
|
};
|
|
9637
9850
|
onUnmounted(() => {
|
|
9638
|
-
|
|
9851
|
+
clearNodeMap();
|
|
9639
9852
|
});
|
|
9640
9853
|
return {
|
|
9641
9854
|
getLevel,
|
|
9642
9855
|
getChildren,
|
|
9856
|
+
clearNodeMap,
|
|
9643
9857
|
getParent,
|
|
9644
9858
|
getExpendedTree,
|
|
9645
9859
|
getIndex,
|
|
@@ -9650,16 +9864,56 @@ function useCore() {
|
|
|
9650
9864
|
};
|
|
9651
9865
|
};
|
|
9652
9866
|
}
|
|
9653
|
-
|
|
9867
|
+
function useLazyLoad() {
|
|
9868
|
+
return function useLazyLoad2(data, core, context) {
|
|
9869
|
+
const { getNode, setNodeValue, getIndex, getChildren } = core;
|
|
9870
|
+
const setCommonParent = (node, nodes) => {
|
|
9871
|
+
nodes.value.forEach((item) => {
|
|
9872
|
+
if (item.level - 1 === node.level && !item.parentId) {
|
|
9873
|
+
item.parentId = node.id;
|
|
9874
|
+
}
|
|
9875
|
+
});
|
|
9876
|
+
};
|
|
9877
|
+
const insertChildrenNodes = (parent, nodes) => {
|
|
9878
|
+
const parentIndex = getIndex(parent);
|
|
9879
|
+
if (parentIndex !== -1) {
|
|
9880
|
+
data.value.splice(parentIndex + 1, 0, ...nodes.value);
|
|
9881
|
+
}
|
|
9882
|
+
};
|
|
9883
|
+
const dealChildNodes = (result) => {
|
|
9884
|
+
const node = getNode(result.node);
|
|
9885
|
+
setNodeValue(node, "loading", false);
|
|
9886
|
+
const childNodes = ref(generateInnerTree(result.treeItems, "children", node.level));
|
|
9887
|
+
setCommonParent(node, childNodes);
|
|
9888
|
+
insertChildrenNodes(node, childNodes);
|
|
9889
|
+
const childrenNodes = getChildren(node);
|
|
9890
|
+
setNodeValue(node, "childNodeCount", childrenNodes.length);
|
|
9891
|
+
};
|
|
9892
|
+
const lazyLoadNodes = (node) => {
|
|
9893
|
+
const innerNode = getNode(node);
|
|
9894
|
+
if (!innerNode.isLeaf && !innerNode.childNodeCount) {
|
|
9895
|
+
setNodeValue(node, "loading", true);
|
|
9896
|
+
context.emit("lazy-load", node, dealChildNodes);
|
|
9897
|
+
}
|
|
9898
|
+
};
|
|
9899
|
+
return {
|
|
9900
|
+
lazyLoadNodes
|
|
9901
|
+
};
|
|
9902
|
+
};
|
|
9903
|
+
}
|
|
9904
|
+
const DEFAULT_TREE_PLUGINS = [useToggle()];
|
|
9654
9905
|
function useTree(tree2, plugins = [], context) {
|
|
9655
9906
|
const treeData = ref(generateInnerTree(tree2));
|
|
9656
9907
|
const core = useCore()(treeData);
|
|
9908
|
+
const lazyLode = useLazyLoad()(treeData, core, context);
|
|
9657
9909
|
const pluginMethods = DEFAULT_TREE_PLUGINS.concat(plugins).reduce((acc, plugin) => {
|
|
9658
|
-
return
|
|
9910
|
+
return { ...acc, ...plugin(treeData, core, context, lazyLode) };
|
|
9659
9911
|
}, {});
|
|
9660
|
-
return
|
|
9661
|
-
treeData
|
|
9662
|
-
|
|
9912
|
+
return {
|
|
9913
|
+
treeData,
|
|
9914
|
+
...pluginMethods,
|
|
9915
|
+
...core
|
|
9916
|
+
};
|
|
9663
9917
|
}
|
|
9664
9918
|
function useCheck(options = ref({ checkStrategy: "both" })) {
|
|
9665
9919
|
return function useCheck2(data, core, context) {
|
|
@@ -9668,6 +9922,11 @@ function useCheck(options = ref({ checkStrategy: "both" })) {
|
|
|
9668
9922
|
setNodeValue(node, "checked", true);
|
|
9669
9923
|
context.emit("check-change", node);
|
|
9670
9924
|
};
|
|
9925
|
+
const setNodeValueInAvailable = (node, key, value) => {
|
|
9926
|
+
if (!node.disableCheck) {
|
|
9927
|
+
setNodeValue(node, key, value);
|
|
9928
|
+
}
|
|
9929
|
+
};
|
|
9671
9930
|
const uncheckNode = (node) => {
|
|
9672
9931
|
setNodeValue(node, "checked", false);
|
|
9673
9932
|
context.emit("check-change", node);
|
|
@@ -9683,15 +9942,15 @@ function useCheck(options = ref({ checkStrategy: "both" })) {
|
|
|
9683
9942
|
let childChecked = checked;
|
|
9684
9943
|
if (checked) {
|
|
9685
9944
|
if (!parentNode.checked) {
|
|
9686
|
-
|
|
9945
|
+
setNodeValueInAvailable(parentNode, "checked", true);
|
|
9687
9946
|
}
|
|
9688
9947
|
} else {
|
|
9689
9948
|
const siblingNodes = getChildren(parentNode);
|
|
9690
9949
|
const checkedSiblingNodes = siblingNodes.filter((item) => item.checked && item.id !== node.id);
|
|
9691
9950
|
if (checkedSiblingNodes.length === 0) {
|
|
9692
|
-
|
|
9951
|
+
setNodeValueInAvailable(parentNode, "checked", false);
|
|
9693
9952
|
} else {
|
|
9694
|
-
|
|
9953
|
+
setNodeValueInAvailable(parentNode, "checked", true);
|
|
9695
9954
|
childChecked = true;
|
|
9696
9955
|
}
|
|
9697
9956
|
}
|
|
@@ -9705,13 +9964,13 @@ function useCheck(options = ref({ checkStrategy: "both" })) {
|
|
|
9705
9964
|
setNodeValue(node, "checked", false);
|
|
9706
9965
|
context.emit("check-change", node);
|
|
9707
9966
|
if (["downward", "both"].includes(options.value.checkStrategy)) {
|
|
9708
|
-
getChildren(node).forEach((item) =>
|
|
9967
|
+
getChildren(node).forEach((item) => setNodeValueInAvailable(item, "checked", false));
|
|
9709
9968
|
}
|
|
9710
9969
|
} else {
|
|
9711
9970
|
setNodeValue(node, "checked", true);
|
|
9712
9971
|
context.emit("check-change", node);
|
|
9713
9972
|
if (["downward", "both"].includes(options.value.checkStrategy)) {
|
|
9714
|
-
getChildren(node).forEach((item) =>
|
|
9973
|
+
getChildren(node).forEach((item) => setNodeValueInAvailable(item, "checked", true));
|
|
9715
9974
|
}
|
|
9716
9975
|
}
|
|
9717
9976
|
if (["upward", "both"].includes(options.value.checkStrategy)) {
|
|
@@ -9784,15 +10043,16 @@ function useOperate() {
|
|
|
9784
10043
|
setNodeValue(parentNode, "expanded", true);
|
|
9785
10044
|
setNodeValue(parentNode, "isLeaf", false);
|
|
9786
10045
|
if (lastChild) {
|
|
9787
|
-
setNodeValue(lastChild, "
|
|
10046
|
+
setNodeValue(lastChild, "parentChildNodeCount", children.length + 1);
|
|
9788
10047
|
}
|
|
9789
|
-
const currentNode = ref(
|
|
10048
|
+
const currentNode = ref({
|
|
10049
|
+
...node,
|
|
9790
10050
|
level: getLevel(parentNode) + 1,
|
|
9791
10051
|
parentId: parentNode.id,
|
|
9792
10052
|
isLeaf: true,
|
|
9793
|
-
|
|
10053
|
+
parentChildNodeCount: children.length + 1,
|
|
9794
10054
|
currentIndex: (lastChild == null ? void 0 : lastChild.currentIndex) + 1
|
|
9795
|
-
})
|
|
10055
|
+
});
|
|
9796
10056
|
if (currentNode.value.id === void 0) {
|
|
9797
10057
|
currentNode.value.id = randomId();
|
|
9798
10058
|
}
|
|
@@ -9857,6 +10117,111 @@ function useMergeNodes() {
|
|
|
9857
10117
|
};
|
|
9858
10118
|
};
|
|
9859
10119
|
}
|
|
10120
|
+
function useSearchFilter() {
|
|
10121
|
+
return function useSearchFilter2(data, core) {
|
|
10122
|
+
const { clearNodeMap, getExpendedTree } = core;
|
|
10123
|
+
const virtualListRef = ref();
|
|
10124
|
+
const resetNodeSearchProperty = () => {
|
|
10125
|
+
data.value.forEach((item) => {
|
|
10126
|
+
item.childrenMatched = false;
|
|
10127
|
+
item.isHide = false;
|
|
10128
|
+
item.isMatched = false;
|
|
10129
|
+
item.matchedText = "";
|
|
10130
|
+
});
|
|
10131
|
+
if (virtualListRef.value) {
|
|
10132
|
+
virtualListRef.value.scrollTo(0);
|
|
10133
|
+
}
|
|
10134
|
+
};
|
|
10135
|
+
const hasDealParentNode = (pre, cur, parentIdSet) => {
|
|
10136
|
+
return data.value[pre].parentId === data.value[cur].parentId && data.value[pre].isMatched || parentIdSet.has(data.value[pre].id) && data.value[pre].childrenMatched;
|
|
10137
|
+
};
|
|
10138
|
+
const dealMatchedData = (target, matchKey, pattern4) => {
|
|
10139
|
+
const trimmedTarget = lodash.exports.trim(target).toLocaleLowerCase();
|
|
10140
|
+
for (let i = 0; i < data.value.length; i++) {
|
|
10141
|
+
const key = matchKey ? data.value[i][matchKey] : data.value[i].label;
|
|
10142
|
+
const selfMatched = pattern4 ? pattern4.test(key) : key.toLocaleLowerCase().includes(trimmedTarget);
|
|
10143
|
+
data.value[i].isMatched = selfMatched;
|
|
10144
|
+
if (selfMatched) {
|
|
10145
|
+
data.value[i].matchedText = matchKey ? data.value[i].label : trimmedTarget;
|
|
10146
|
+
if (!data.value[i].parentId) {
|
|
10147
|
+
continue;
|
|
10148
|
+
}
|
|
10149
|
+
let L = i - 1;
|
|
10150
|
+
const set = /* @__PURE__ */ new Set();
|
|
10151
|
+
set.add(data.value[i].parentId);
|
|
10152
|
+
while (L >= 0 && data.value[L].parentId && !hasDealParentNode(L, i, set)) {
|
|
10153
|
+
if (set.has(data.value[L].id)) {
|
|
10154
|
+
data.value[L].childrenMatched = true;
|
|
10155
|
+
data.value[L].expanded = true;
|
|
10156
|
+
set.add(data.value[L].parentId);
|
|
10157
|
+
}
|
|
10158
|
+
L--;
|
|
10159
|
+
}
|
|
10160
|
+
if (L >= 0 && !data.value[L].parentId && set.has(data.value[L].id)) {
|
|
10161
|
+
data.value[L].childrenMatched = true;
|
|
10162
|
+
data.value[L].expanded = true;
|
|
10163
|
+
}
|
|
10164
|
+
}
|
|
10165
|
+
}
|
|
10166
|
+
};
|
|
10167
|
+
const hasParentNodeMatched = (pre, cur, parentIdSet) => {
|
|
10168
|
+
return parentIdSet.has(data.value[pre].id) && data.value[pre].isMatched;
|
|
10169
|
+
};
|
|
10170
|
+
const dealNodeHideProperty = () => {
|
|
10171
|
+
data.value.forEach((item, index2) => {
|
|
10172
|
+
if (item.isMatched || item.childrenMatched) {
|
|
10173
|
+
item.isHide = false;
|
|
10174
|
+
} else {
|
|
10175
|
+
if (!item.parentId) {
|
|
10176
|
+
item.isHide = true;
|
|
10177
|
+
return;
|
|
10178
|
+
}
|
|
10179
|
+
let L = index2 - 1;
|
|
10180
|
+
const set = /* @__PURE__ */ new Set();
|
|
10181
|
+
set.add(data.value[index2].parentId);
|
|
10182
|
+
while (L >= 0 && data.value[L].parentId && !hasParentNodeMatched(L, index2, set)) {
|
|
10183
|
+
if (set.has(data.value[L].id)) {
|
|
10184
|
+
set.add(data.value[L].parentId);
|
|
10185
|
+
}
|
|
10186
|
+
L--;
|
|
10187
|
+
}
|
|
10188
|
+
if (!data.value[L].parentId && !data.value[L].isMatched) {
|
|
10189
|
+
item.isHide = true;
|
|
10190
|
+
} else {
|
|
10191
|
+
item.isHide = false;
|
|
10192
|
+
}
|
|
10193
|
+
}
|
|
10194
|
+
});
|
|
10195
|
+
};
|
|
10196
|
+
const getFirstMatchIndex = () => {
|
|
10197
|
+
let index2 = 0;
|
|
10198
|
+
const showTreeData = getExpendedTree().value;
|
|
10199
|
+
while (index2 <= showTreeData.length - 1 && !showTreeData[index2].isMatched) {
|
|
10200
|
+
index2++;
|
|
10201
|
+
}
|
|
10202
|
+
return index2 >= showTreeData.length ? 0 : index2;
|
|
10203
|
+
};
|
|
10204
|
+
const searchTree = (target, option) => {
|
|
10205
|
+
clearNodeMap();
|
|
10206
|
+
resetNodeSearchProperty();
|
|
10207
|
+
if (!target) {
|
|
10208
|
+
return;
|
|
10209
|
+
}
|
|
10210
|
+
dealMatchedData(target, option.matchKey, option.pattern);
|
|
10211
|
+
if (option.isFilter) {
|
|
10212
|
+
dealNodeHideProperty();
|
|
10213
|
+
}
|
|
10214
|
+
if (virtualListRef.value) {
|
|
10215
|
+
const scrollIndex = getFirstMatchIndex();
|
|
10216
|
+
virtualListRef.value.scrollTo(scrollIndex);
|
|
10217
|
+
}
|
|
10218
|
+
};
|
|
10219
|
+
return {
|
|
10220
|
+
virtualListRef,
|
|
10221
|
+
searchTree
|
|
10222
|
+
};
|
|
10223
|
+
};
|
|
10224
|
+
}
|
|
9860
10225
|
const treeProps = {
|
|
9861
10226
|
data: {
|
|
9862
10227
|
type: Object,
|
|
@@ -9878,7 +10243,7 @@ var tree = "";
|
|
|
9878
10243
|
var Tree = defineComponent({
|
|
9879
10244
|
name: "DTree",
|
|
9880
10245
|
props: treeProps,
|
|
9881
|
-
emits: ["toggle-change", "check-change", "select-change", "node-click"],
|
|
10246
|
+
emits: ["toggle-change", "check-change", "select-change", "node-click", "lazy-load"],
|
|
9882
10247
|
setup(props, context) {
|
|
9883
10248
|
const {
|
|
9884
10249
|
slots,
|
|
@@ -9891,7 +10256,8 @@ var Tree = defineComponent({
|
|
|
9891
10256
|
operate
|
|
9892
10257
|
} = toRefs(props);
|
|
9893
10258
|
const ns2 = useNamespace("tree");
|
|
9894
|
-
const
|
|
10259
|
+
const normalRef = ref();
|
|
10260
|
+
const userPlugins = [useSelect(), useOperate(), useMergeNodes(), useSearchFilter()];
|
|
9895
10261
|
const checkOptions = ref({
|
|
9896
10262
|
checkStrategy: formatCheckStatus(check.value)
|
|
9897
10263
|
});
|
|
@@ -9905,7 +10271,8 @@ var Tree = defineComponent({
|
|
|
9905
10271
|
const {
|
|
9906
10272
|
setTree,
|
|
9907
10273
|
getExpendedTree,
|
|
9908
|
-
toggleNode
|
|
10274
|
+
toggleNode,
|
|
10275
|
+
virtualListRef
|
|
9909
10276
|
} = treeFactory;
|
|
9910
10277
|
watch(data, setTree);
|
|
9911
10278
|
provide(USE_TREE_TOKEN, treeFactory);
|
|
@@ -9931,13 +10298,16 @@ var Tree = defineComponent({
|
|
|
9931
10298
|
toggleNode
|
|
9932
10299
|
}) : createVNode(DTreeNodeToggle, {
|
|
9933
10300
|
"data": treeNode
|
|
9934
|
-
}, null)
|
|
10301
|
+
}, null),
|
|
10302
|
+
loading: () => slots.loading ? renderSlot(useSlots(), "loading", {
|
|
10303
|
+
nodeData: treeNode
|
|
10304
|
+
}) : createVNode(DTreeNodeLoading, null, null)
|
|
9935
10305
|
});
|
|
9936
10306
|
return () => {
|
|
9937
10307
|
const Component = props.height ? VirtualList : "div";
|
|
9938
10308
|
const treeData = getExpendedTree == null ? void 0 : getExpendedTree().value;
|
|
9939
10309
|
const vSlotsProps = {
|
|
9940
|
-
default:
|
|
10310
|
+
default: () => treeData == null ? void 0 : treeData.map(renderDTreeNode),
|
|
9941
10311
|
item: props.height && ((treeNode) => renderDTreeNode(treeNode))
|
|
9942
10312
|
};
|
|
9943
10313
|
let virtualListProps2 = {};
|
|
@@ -9949,6 +10319,7 @@ var Tree = defineComponent({
|
|
|
9949
10319
|
};
|
|
9950
10320
|
}
|
|
9951
10321
|
return createVNode(Component, mergeProps({
|
|
10322
|
+
"ref": props.height ? virtualListRef : normalRef,
|
|
9952
10323
|
"class": ns2.b()
|
|
9953
10324
|
}, virtualListProps2), vSlotsProps);
|
|
9954
10325
|
};
|