@gkd-kit/inspect 0.0.1701678184497 → 0.0.1701762114130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/404.html +4 -4
- package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-f4d28c47.js +10 -0
- package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-f4d28c47.js.map +1 -0
- package/dist/assets/DevicePage-1ca1a7a5.js +4 -0
- package/dist/assets/DevicePage-1ca1a7a5.js.map +1 -0
- package/dist/assets/HomePage-fb6363af.js +10 -0
- package/dist/assets/HomePage-fb6363af.js.map +1 -0
- package/dist/assets/ImportPage-d0a52d21.js +2 -0
- package/dist/assets/ImportPage-d0a52d21.js.map +1 -0
- package/dist/assets/SnapshotPage-dc32bf1e.js +241 -0
- package/dist/assets/SnapshotPage-dc32bf1e.js.map +1 -0
- package/dist/assets/_404Page-44f14f69.js +2 -0
- package/dist/assets/_404Page-44f14f69.js.map +1 -0
- package/dist/assets/import-27273a86.js +2 -0
- package/dist/assets/import-27273a86.js.map +1 -0
- package/dist/assets/index-6fbc76b7.css +1 -0
- package/dist/assets/index-9a74ec84.js +554 -0
- package/dist/assets/index-9a74ec84.js.map +1 -0
- package/dist/assets/index-af9eb709.js +17 -0
- package/dist/assets/index-af9eb709.js.map +1 -0
- package/dist/assets/jszip.min-14bc980b.js +13 -0
- package/dist/assets/jszip.min-14bc980b.js.map +1 -0
- package/dist/assets/node-7c87a44a.js +731 -0
- package/dist/assets/node-7c87a44a.js.map +1 -0
- package/dist/assets/polyfills-e3dd7d1e.js +1 -0
- package/dist/assets/storage-25ae3853.js +330 -0
- package/dist/assets/storage-25ae3853.js.map +1 -0
- package/dist/assets/table-318c850e.js +958 -0
- package/dist/assets/table-318c850e.js.map +1 -0
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/dist/assets/ActionCard.vue_vue_type_script_setup_true_lang-bda27d9e.js +0 -1388
- package/dist/assets/DevicePage-fee3235d.js +0 -457
- package/dist/assets/HomePage-5632f622.js +0 -400
- package/dist/assets/ImportPage-21674b0a.js +0 -87
- package/dist/assets/SnapshotPage-3157f92e.js +0 -3629
- package/dist/assets/SnapshotPage-3c2cecee.css +0 -8
- package/dist/assets/_404Page-09910a83.js +0 -32
- package/dist/assets/_404Page-1bb368b2.css +0 -9
- package/dist/assets/import-1c0da893.js +0 -288
- package/dist/assets/index-235f5a3e.js +0 -21365
- package/dist/assets/index-2bb4cdf2.js +0 -9780
- package/dist/assets/index-50ce64aa.css +0 -360
- package/dist/assets/jszip.min-9f22f6d7.js +0 -2651
- package/dist/assets/node-c1756ecf.js +0 -7817
- package/dist/assets/polyfills-bdd638aa.js +0 -11381
- package/dist/assets/storage-00dd3e29.js +0 -4479
- package/dist/assets/table-ad72f278.js +0 -8763
|
@@ -1,3629 +0,0 @@
|
|
|
1
|
-
import { _ as _sfc_main$6, e as exportSnapshotAsJpgUrl, f as exportSnapshotAsZipUrl } from "./ActionCard.vue_vue_type_script_setup_true_lang-bda27d9e.js";
|
|
2
|
-
import { f as fadeInHeightExpandTransition, c as copy, m as message, b as githubJpgStorage, g as githubUrlToSelfUrl, e as githubZipStorage, a as snapshotStorage, h as gmOk, i as screenshotStorage, j as delay } from "./storage-00dd3e29.js";
|
|
3
|
-
import { d as defineComponent, n as h, p as commonLight, q as cB, v as cM, x as cE, y as c, z as useConfig, A as ref, c as computed, B as useTheme, C as provide, D as useRtl, E as useThemeClass, G as createInjectionKey, H as call, I as useFalseUntilTruthy, J as toRef, K as withDirectives, L as vShow, M as NFadeInExpandTransition, O as createId, P as useMemo, Q as inject, S as throwError, T as resolveSlotWithProps, U as NBaseIcon, V as resolveWrappedSlotWithProps, W as composite, X as createTheme, Y as scrollbarLight, Z as changeColor, _ as cNotM, $ as insideModal, a0 as insidePopover, a1 as createKey, a2 as NIconSwitchTransition, a3 as NBaseLoading, a4 as render, a5 as isBrowser, a6 as onMounted, a7 as repeat, a8 as pxfy, a9 as iconSwitchTransition, w as watchEffect, e as watch, aa as getMargin, ab as depx, ac as XScrollbar, ad as resolveSlot, ae as nextTick, a as shallowReactive, s as shallowRef, af as onUnmounted, ag as createBlock, h as createBaseVNode, ah as renderSlot, ai as normalizeStyle, aj as normalizeClass, ak as Teleport, o as openBlock, g as withCtx, b as createVNode, u as unref, f as createElementBlock, al as renderList, F as Fragment, l as toDisplayString, m as createCommentVNode, k as createTextVNode, i as withKeys, j as NButton, am as withModifiers, an as useRoute, ao as useRouter } from "./index-235f5a3e.js";
|
|
4
|
-
import { e as useMergedState, C as ChevronRightIcon, f as checkboxLight, g as emptyLight, h as NCheckbox, i as happensIn, V as VVirtualList, j as createTreeMate, k as flatten, l as createIndexGetter, m as NEmpty, n as NTooltip, d as NIcon, o as NEllipsis, p as findNodeByXy, c as NSpace, q as NRadio, r as NRadioGroup, N as NInput, a as NInputGroup, s as getNodeLabel, t as dayjs, v as getDevice, w as listToTree } from "./node-c1756ecf.js";
|
|
5
|
-
import { e as errorTry, a as errorWrap, p as parseSelector, l as lib, u as useTitle } from "./index-2bb4cdf2.js";
|
|
6
|
-
import "./jszip.min-9f22f6d7.js";
|
|
7
|
-
function createDataKey(key) {
|
|
8
|
-
return typeof key === "string" ? `s-${key}` : `n-${key}`;
|
|
9
|
-
}
|
|
10
|
-
const ChevronLeftIcon = defineComponent({
|
|
11
|
-
name: "ChevronLeft",
|
|
12
|
-
render() {
|
|
13
|
-
return h(
|
|
14
|
-
"svg",
|
|
15
|
-
{ viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
16
|
-
h("path", { d: "M10.3536 3.14645C10.5488 3.34171 10.5488 3.65829 10.3536 3.85355L6.20711 8L10.3536 12.1464C10.5488 12.3417 10.5488 12.6583 10.3536 12.8536C10.1583 13.0488 9.84171 13.0488 9.64645 12.8536L5.14645 8.35355C4.95118 8.15829 4.95118 7.84171 5.14645 7.64645L9.64645 3.14645C9.84171 2.95118 10.1583 2.95118 10.3536 3.14645Z", fill: "currentColor" })
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
const SwitcherIcon = defineComponent({
|
|
21
|
-
name: "Switcher",
|
|
22
|
-
render() {
|
|
23
|
-
return h(
|
|
24
|
-
"svg",
|
|
25
|
-
{ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32" },
|
|
26
|
-
h("path", { d: "M12 8l10 8l-10 8z" })
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
const self$2 = (vars) => {
|
|
31
|
-
const { fontWeight, textColor1, textColor2, textColorDisabled, dividerColor, fontSize } = vars;
|
|
32
|
-
return {
|
|
33
|
-
titleFontSize: fontSize,
|
|
34
|
-
titleFontWeight: fontWeight,
|
|
35
|
-
dividerColor,
|
|
36
|
-
titleTextColor: textColor1,
|
|
37
|
-
titleTextColorDisabled: textColorDisabled,
|
|
38
|
-
fontSize,
|
|
39
|
-
textColor: textColor2,
|
|
40
|
-
arrowColor: textColor2,
|
|
41
|
-
arrowColorDisabled: textColorDisabled,
|
|
42
|
-
itemMargin: "16px 0 0 0",
|
|
43
|
-
titlePadding: "16px 0 0 0"
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
const collapseLight = {
|
|
47
|
-
name: "Collapse",
|
|
48
|
-
common: commonLight,
|
|
49
|
-
self: self$2
|
|
50
|
-
};
|
|
51
|
-
const collapseLight$1 = collapseLight;
|
|
52
|
-
const style$2 = cB("collapse", "width: 100%;", [cB("collapse-item", `
|
|
53
|
-
font-size: var(--n-font-size);
|
|
54
|
-
color: var(--n-text-color);
|
|
55
|
-
transition:
|
|
56
|
-
color .3s var(--n-bezier),
|
|
57
|
-
border-color .3s var(--n-bezier);
|
|
58
|
-
margin: var(--n-item-margin);
|
|
59
|
-
`, [cM("disabled", [cE("header", "cursor: not-allowed;", [cE("header-main", `
|
|
60
|
-
color: var(--n-title-text-color-disabled);
|
|
61
|
-
`), cB("collapse-item-arrow", `
|
|
62
|
-
color: var(--n-arrow-color-disabled);
|
|
63
|
-
`)])]), cB("collapse-item", "margin-left: 32px;"), c("&:first-child", "margin-top: 0;"), c("&:first-child >", [cE("header", "padding-top: 0;")]), cM("left-arrow-placement", [cE("header", [cB("collapse-item-arrow", "margin-right: 4px;")])]), cM("right-arrow-placement", [cE("header", [cB("collapse-item-arrow", "margin-left: 4px;")])]), cE("content-wrapper", [cE("content-inner", "padding-top: 16px;"), fadeInHeightExpandTransition({
|
|
64
|
-
duration: "0.15s"
|
|
65
|
-
})]), cM("active", [cE("header", [cM("active", [cB("collapse-item-arrow", "transform: rotate(90deg);")])])]), c("&:not(:first-child)", "border-top: 1px solid var(--n-divider-color);"), cE("header", `
|
|
66
|
-
font-size: var(--n-title-font-size);
|
|
67
|
-
display: flex;
|
|
68
|
-
flex-wrap: nowrap;
|
|
69
|
-
align-items: center;
|
|
70
|
-
transition: color .3s var(--n-bezier);
|
|
71
|
-
position: relative;
|
|
72
|
-
padding: var(--n-title-padding);
|
|
73
|
-
color: var(--n-title-text-color);
|
|
74
|
-
cursor: pointer;
|
|
75
|
-
`, [cE("header-main", `
|
|
76
|
-
display: flex;
|
|
77
|
-
flex-wrap: nowrap;
|
|
78
|
-
align-items: center;
|
|
79
|
-
font-weight: var(--n-title-font-weight);
|
|
80
|
-
transition: color .3s var(--n-bezier);
|
|
81
|
-
flex: 1;
|
|
82
|
-
color: var(--n-title-text-color);
|
|
83
|
-
`), cE("header-extra", `
|
|
84
|
-
display: flex;
|
|
85
|
-
align-items: center;
|
|
86
|
-
transition: color .3s var(--n-bezier);
|
|
87
|
-
color: var(--n-text-color);
|
|
88
|
-
`), cB("collapse-item-arrow", `
|
|
89
|
-
display: flex;
|
|
90
|
-
transition:
|
|
91
|
-
transform .15s var(--n-bezier),
|
|
92
|
-
color .3s var(--n-bezier);
|
|
93
|
-
font-size: 18px;
|
|
94
|
-
color: var(--n-arrow-color);
|
|
95
|
-
`)])])]);
|
|
96
|
-
const collapseProps = Object.assign(Object.assign({}, useTheme.props), {
|
|
97
|
-
defaultExpandedNames: {
|
|
98
|
-
type: [Array, String],
|
|
99
|
-
default: null
|
|
100
|
-
},
|
|
101
|
-
expandedNames: [Array, String],
|
|
102
|
-
arrowPlacement: {
|
|
103
|
-
type: String,
|
|
104
|
-
default: "left"
|
|
105
|
-
},
|
|
106
|
-
accordion: {
|
|
107
|
-
type: Boolean,
|
|
108
|
-
default: false
|
|
109
|
-
},
|
|
110
|
-
displayDirective: {
|
|
111
|
-
type: String,
|
|
112
|
-
default: "if"
|
|
113
|
-
},
|
|
114
|
-
onItemHeaderClick: [Function, Array],
|
|
115
|
-
"onUpdate:expandedNames": [Function, Array],
|
|
116
|
-
onUpdateExpandedNames: [Function, Array],
|
|
117
|
-
// deprecated
|
|
118
|
-
onExpandedNamesChange: {
|
|
119
|
-
type: [Function, Array],
|
|
120
|
-
validator: () => {
|
|
121
|
-
return true;
|
|
122
|
-
},
|
|
123
|
-
default: void 0
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
const collapseInjectionKey = createInjectionKey("n-collapse");
|
|
127
|
-
const NCollapse = defineComponent({
|
|
128
|
-
name: "Collapse",
|
|
129
|
-
props: collapseProps,
|
|
130
|
-
setup(props, { slots }) {
|
|
131
|
-
const { mergedClsPrefixRef, inlineThemeDisabled, mergedRtlRef } = useConfig(props);
|
|
132
|
-
const uncontrolledExpandedNamesRef = ref(props.defaultExpandedNames);
|
|
133
|
-
const controlledExpandedNamesRef = computed(() => props.expandedNames);
|
|
134
|
-
const mergedExpandedNamesRef = useMergedState(controlledExpandedNamesRef, uncontrolledExpandedNamesRef);
|
|
135
|
-
const themeRef = useTheme("Collapse", "-collapse", style$2, collapseLight$1, props, mergedClsPrefixRef);
|
|
136
|
-
function doUpdateExpandedNames(names) {
|
|
137
|
-
const { "onUpdate:expandedNames": _onUpdateExpandedNames, onUpdateExpandedNames, onExpandedNamesChange } = props;
|
|
138
|
-
if (onUpdateExpandedNames) {
|
|
139
|
-
call(onUpdateExpandedNames, names);
|
|
140
|
-
}
|
|
141
|
-
if (_onUpdateExpandedNames) {
|
|
142
|
-
call(_onUpdateExpandedNames, names);
|
|
143
|
-
}
|
|
144
|
-
if (onExpandedNamesChange) {
|
|
145
|
-
call(onExpandedNamesChange, names);
|
|
146
|
-
}
|
|
147
|
-
uncontrolledExpandedNamesRef.value = names;
|
|
148
|
-
}
|
|
149
|
-
function doItemHeaderClick(info) {
|
|
150
|
-
const { onItemHeaderClick } = props;
|
|
151
|
-
if (onItemHeaderClick) {
|
|
152
|
-
call(onItemHeaderClick, info);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function toggleItem(collapse, name, event) {
|
|
156
|
-
const { accordion } = props;
|
|
157
|
-
const { value: expandedNames } = mergedExpandedNamesRef;
|
|
158
|
-
if (accordion) {
|
|
159
|
-
if (collapse) {
|
|
160
|
-
doUpdateExpandedNames([name]);
|
|
161
|
-
doItemHeaderClick({ name, expanded: true, event });
|
|
162
|
-
} else {
|
|
163
|
-
doUpdateExpandedNames([]);
|
|
164
|
-
doItemHeaderClick({ name, expanded: false, event });
|
|
165
|
-
}
|
|
166
|
-
} else {
|
|
167
|
-
if (!Array.isArray(expandedNames)) {
|
|
168
|
-
doUpdateExpandedNames([name]);
|
|
169
|
-
doItemHeaderClick({ name, expanded: true, event });
|
|
170
|
-
} else {
|
|
171
|
-
const activeNames = expandedNames.slice();
|
|
172
|
-
const index = activeNames.findIndex((activeName) => name === activeName);
|
|
173
|
-
if (~index) {
|
|
174
|
-
activeNames.splice(index, 1);
|
|
175
|
-
doUpdateExpandedNames(activeNames);
|
|
176
|
-
doItemHeaderClick({ name, expanded: false, event });
|
|
177
|
-
} else {
|
|
178
|
-
activeNames.push(name);
|
|
179
|
-
doUpdateExpandedNames(activeNames);
|
|
180
|
-
doItemHeaderClick({ name, expanded: true, event });
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
provide(collapseInjectionKey, {
|
|
186
|
-
props,
|
|
187
|
-
mergedClsPrefixRef,
|
|
188
|
-
expandedNamesRef: mergedExpandedNamesRef,
|
|
189
|
-
slots,
|
|
190
|
-
toggleItem
|
|
191
|
-
});
|
|
192
|
-
const rtlEnabledRef = useRtl("Collapse", mergedRtlRef, mergedClsPrefixRef);
|
|
193
|
-
const cssVarsRef = computed(() => {
|
|
194
|
-
const { common: { cubicBezierEaseInOut }, self: { titleFontWeight, dividerColor, titlePadding, titleTextColor, titleTextColorDisabled, textColor, arrowColor, fontSize, titleFontSize, arrowColorDisabled, itemMargin } } = themeRef.value;
|
|
195
|
-
return {
|
|
196
|
-
"--n-font-size": fontSize,
|
|
197
|
-
"--n-bezier": cubicBezierEaseInOut,
|
|
198
|
-
"--n-text-color": textColor,
|
|
199
|
-
"--n-divider-color": dividerColor,
|
|
200
|
-
"--n-title-padding": titlePadding,
|
|
201
|
-
"--n-title-font-size": titleFontSize,
|
|
202
|
-
"--n-title-text-color": titleTextColor,
|
|
203
|
-
"--n-title-text-color-disabled": titleTextColorDisabled,
|
|
204
|
-
"--n-title-font-weight": titleFontWeight,
|
|
205
|
-
"--n-arrow-color": arrowColor,
|
|
206
|
-
"--n-arrow-color-disabled": arrowColorDisabled,
|
|
207
|
-
"--n-item-margin": itemMargin
|
|
208
|
-
};
|
|
209
|
-
});
|
|
210
|
-
const themeClassHandle = inlineThemeDisabled ? useThemeClass("collapse", void 0, cssVarsRef, props) : void 0;
|
|
211
|
-
return {
|
|
212
|
-
rtlEnabled: rtlEnabledRef,
|
|
213
|
-
mergedTheme: themeRef,
|
|
214
|
-
mergedClsPrefix: mergedClsPrefixRef,
|
|
215
|
-
cssVars: inlineThemeDisabled ? void 0 : cssVarsRef,
|
|
216
|
-
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
217
|
-
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
218
|
-
};
|
|
219
|
-
},
|
|
220
|
-
render() {
|
|
221
|
-
var _a;
|
|
222
|
-
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
223
|
-
return h("div", { class: [
|
|
224
|
-
`${this.mergedClsPrefix}-collapse`,
|
|
225
|
-
this.rtlEnabled && `${this.mergedClsPrefix}-collapse--rtl`,
|
|
226
|
-
this.themeClass
|
|
227
|
-
], style: this.cssVars }, this.$slots);
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
const NCollapseItemContent = defineComponent({
|
|
231
|
-
name: "CollapseItemContent",
|
|
232
|
-
props: {
|
|
233
|
-
displayDirective: {
|
|
234
|
-
type: String,
|
|
235
|
-
required: true
|
|
236
|
-
},
|
|
237
|
-
show: Boolean,
|
|
238
|
-
clsPrefix: {
|
|
239
|
-
type: String,
|
|
240
|
-
required: true
|
|
241
|
-
}
|
|
242
|
-
},
|
|
243
|
-
setup(props) {
|
|
244
|
-
const onceTrueRef = useFalseUntilTruthy(toRef(props, "show"));
|
|
245
|
-
return {
|
|
246
|
-
onceTrue: onceTrueRef
|
|
247
|
-
};
|
|
248
|
-
},
|
|
249
|
-
render() {
|
|
250
|
-
return h(NFadeInExpandTransition, null, {
|
|
251
|
-
default: () => {
|
|
252
|
-
const { show, displayDirective, onceTrue, clsPrefix } = this;
|
|
253
|
-
const useVShow = displayDirective === "show" && onceTrue;
|
|
254
|
-
const contentNode = h(
|
|
255
|
-
"div",
|
|
256
|
-
{ class: `${clsPrefix}-collapse-item__content-wrapper` },
|
|
257
|
-
h("div", { class: `${clsPrefix}-collapse-item__content-inner` }, this.$slots)
|
|
258
|
-
);
|
|
259
|
-
return useVShow ? withDirectives(contentNode, [[vShow, show]]) : show ? contentNode : null;
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
const collapseItemProps = {
|
|
265
|
-
title: String,
|
|
266
|
-
name: [String, Number],
|
|
267
|
-
disabled: Boolean,
|
|
268
|
-
displayDirective: String
|
|
269
|
-
};
|
|
270
|
-
const NCollapseItem = defineComponent({
|
|
271
|
-
name: "CollapseItem",
|
|
272
|
-
props: collapseItemProps,
|
|
273
|
-
setup(props) {
|
|
274
|
-
const { mergedRtlRef } = useConfig(props);
|
|
275
|
-
const randomName = createId();
|
|
276
|
-
const mergedNameRef = useMemo(() => {
|
|
277
|
-
var _a;
|
|
278
|
-
return (_a = props.name) !== null && _a !== void 0 ? _a : randomName;
|
|
279
|
-
});
|
|
280
|
-
const NCollapse2 = inject(collapseInjectionKey);
|
|
281
|
-
if (!NCollapse2) {
|
|
282
|
-
throwError("collapse-item", "`n-collapse-item` must be placed inside `n-collapse`.");
|
|
283
|
-
}
|
|
284
|
-
const { expandedNamesRef, props: collapseProps2, mergedClsPrefixRef, slots: collapseSlots } = NCollapse2;
|
|
285
|
-
const collapsedRef = computed(() => {
|
|
286
|
-
const { value: expandedNames } = expandedNamesRef;
|
|
287
|
-
if (Array.isArray(expandedNames)) {
|
|
288
|
-
const { value: name } = mergedNameRef;
|
|
289
|
-
return !~expandedNames.findIndex((expandedName) => expandedName === name);
|
|
290
|
-
} else if (expandedNames) {
|
|
291
|
-
const { value: name } = mergedNameRef;
|
|
292
|
-
return name !== expandedNames;
|
|
293
|
-
}
|
|
294
|
-
return true;
|
|
295
|
-
});
|
|
296
|
-
const rtlEnabledRef = useRtl("Collapse", mergedRtlRef, mergedClsPrefixRef);
|
|
297
|
-
return {
|
|
298
|
-
rtlEnabled: rtlEnabledRef,
|
|
299
|
-
collapseSlots,
|
|
300
|
-
randomName,
|
|
301
|
-
mergedClsPrefix: mergedClsPrefixRef,
|
|
302
|
-
collapsed: collapsedRef,
|
|
303
|
-
mergedDisplayDirective: computed(() => {
|
|
304
|
-
const { displayDirective } = props;
|
|
305
|
-
if (displayDirective) {
|
|
306
|
-
return displayDirective;
|
|
307
|
-
} else {
|
|
308
|
-
return collapseProps2.displayDirective;
|
|
309
|
-
}
|
|
310
|
-
}),
|
|
311
|
-
arrowPlacement: computed(() => {
|
|
312
|
-
return collapseProps2.arrowPlacement;
|
|
313
|
-
}),
|
|
314
|
-
handleClick(e) {
|
|
315
|
-
if (NCollapse2 && !props.disabled) {
|
|
316
|
-
NCollapse2.toggleItem(collapsedRef.value, mergedNameRef.value, e);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
},
|
|
321
|
-
render() {
|
|
322
|
-
const { collapseSlots, $slots, arrowPlacement, collapsed, mergedDisplayDirective, mergedClsPrefix, disabled } = this;
|
|
323
|
-
const headerNode = resolveSlotWithProps($slots.header, { collapsed }, () => [this.title]);
|
|
324
|
-
const headerExtraSlot = $slots["header-extra"] || collapseSlots["header-extra"];
|
|
325
|
-
const arrowSlot = $slots.arrow || collapseSlots.arrow;
|
|
326
|
-
return h(
|
|
327
|
-
"div",
|
|
328
|
-
{ class: [
|
|
329
|
-
`${mergedClsPrefix}-collapse-item`,
|
|
330
|
-
`${mergedClsPrefix}-collapse-item--${arrowPlacement}-arrow-placement`,
|
|
331
|
-
disabled && `${mergedClsPrefix}-collapse-item--disabled`,
|
|
332
|
-
!collapsed && `${mergedClsPrefix}-collapse-item--active`
|
|
333
|
-
] },
|
|
334
|
-
h(
|
|
335
|
-
"div",
|
|
336
|
-
{ class: [
|
|
337
|
-
`${mergedClsPrefix}-collapse-item__header`,
|
|
338
|
-
!collapsed && `${mergedClsPrefix}-collapse-item__header--active`
|
|
339
|
-
] },
|
|
340
|
-
h(
|
|
341
|
-
"div",
|
|
342
|
-
{ class: `${mergedClsPrefix}-collapse-item__header-main`, onClick: this.handleClick },
|
|
343
|
-
arrowPlacement === "right" && headerNode,
|
|
344
|
-
h("div", { class: `${mergedClsPrefix}-collapse-item-arrow`, key: this.rtlEnabled ? 0 : 1 }, resolveSlotWithProps(arrowSlot, { collapsed }, () => {
|
|
345
|
-
var _a;
|
|
346
|
-
return [
|
|
347
|
-
h(NBaseIcon, { clsPrefix: mergedClsPrefix }, {
|
|
348
|
-
default: (_a = collapseSlots.expandIcon) !== null && _a !== void 0 ? _a : () => this.rtlEnabled ? h(ChevronLeftIcon, null) : h(ChevronRightIcon, null)
|
|
349
|
-
})
|
|
350
|
-
];
|
|
351
|
-
})),
|
|
352
|
-
arrowPlacement === "left" && headerNode
|
|
353
|
-
),
|
|
354
|
-
resolveWrappedSlotWithProps(headerExtraSlot, { collapsed }, (children) => h("div", { class: `${mergedClsPrefix}-collapse-item__header-extra`, onClick: this.handleClick }, children))
|
|
355
|
-
),
|
|
356
|
-
h(NCollapseItemContent, { clsPrefix: mergedClsPrefix, displayDirective: mergedDisplayDirective, show: !collapsed }, $slots)
|
|
357
|
-
);
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
const sizeVariables = {
|
|
361
|
-
thPaddingSmall: "6px",
|
|
362
|
-
thPaddingMedium: "12px",
|
|
363
|
-
thPaddingLarge: "12px",
|
|
364
|
-
tdPaddingSmall: "6px",
|
|
365
|
-
tdPaddingMedium: "12px",
|
|
366
|
-
tdPaddingLarge: "12px"
|
|
367
|
-
};
|
|
368
|
-
const self$1 = (vars) => {
|
|
369
|
-
const { dividerColor, cardColor, modalColor, popoverColor, tableHeaderColor, tableColorStriped, textColor1, textColor2, borderRadius, fontWeightStrong, lineHeight, fontSizeSmall, fontSizeMedium, fontSizeLarge } = vars;
|
|
370
|
-
return Object.assign(Object.assign({}, sizeVariables), {
|
|
371
|
-
fontSizeSmall,
|
|
372
|
-
fontSizeMedium,
|
|
373
|
-
fontSizeLarge,
|
|
374
|
-
lineHeight,
|
|
375
|
-
borderRadius,
|
|
376
|
-
borderColor: composite(cardColor, dividerColor),
|
|
377
|
-
borderColorModal: composite(modalColor, dividerColor),
|
|
378
|
-
borderColorPopover: composite(popoverColor, dividerColor),
|
|
379
|
-
tdColor: cardColor,
|
|
380
|
-
tdColorModal: modalColor,
|
|
381
|
-
tdColorPopover: popoverColor,
|
|
382
|
-
tdColorStriped: composite(cardColor, tableColorStriped),
|
|
383
|
-
tdColorStripedModal: composite(modalColor, tableColorStriped),
|
|
384
|
-
tdColorStripedPopover: composite(popoverColor, tableColorStriped),
|
|
385
|
-
thColor: composite(cardColor, tableHeaderColor),
|
|
386
|
-
thColorModal: composite(modalColor, tableHeaderColor),
|
|
387
|
-
thColorPopover: composite(popoverColor, tableHeaderColor),
|
|
388
|
-
thTextColor: textColor1,
|
|
389
|
-
tdTextColor: textColor2,
|
|
390
|
-
thFontWeight: fontWeightStrong
|
|
391
|
-
});
|
|
392
|
-
};
|
|
393
|
-
const tableLight = {
|
|
394
|
-
name: "Table",
|
|
395
|
-
common: commonLight,
|
|
396
|
-
self: self$1
|
|
397
|
-
};
|
|
398
|
-
const tableLight$1 = tableLight;
|
|
399
|
-
const self = (vars) => {
|
|
400
|
-
const { borderRadiusSmall, hoverColor, pressedColor, primaryColor, textColor3, textColor2, textColorDisabled, fontSize } = vars;
|
|
401
|
-
return {
|
|
402
|
-
fontSize,
|
|
403
|
-
lineHeight: "1.5",
|
|
404
|
-
nodeHeight: "30px",
|
|
405
|
-
nodeWrapperPadding: "3px 0",
|
|
406
|
-
nodeBorderRadius: borderRadiusSmall,
|
|
407
|
-
nodeColorHover: hoverColor,
|
|
408
|
-
nodeColorPressed: pressedColor,
|
|
409
|
-
nodeColorActive: changeColor(primaryColor, { alpha: 0.1 }),
|
|
410
|
-
arrowColor: textColor3,
|
|
411
|
-
nodeTextColor: textColor2,
|
|
412
|
-
nodeTextColorDisabled: textColorDisabled,
|
|
413
|
-
loadingColor: primaryColor,
|
|
414
|
-
dropMarkColor: primaryColor
|
|
415
|
-
};
|
|
416
|
-
};
|
|
417
|
-
const treeLight = createTheme({
|
|
418
|
-
name: "Tree",
|
|
419
|
-
common: commonLight,
|
|
420
|
-
peers: {
|
|
421
|
-
Checkbox: checkboxLight,
|
|
422
|
-
Scrollbar: scrollbarLight,
|
|
423
|
-
Empty: emptyLight
|
|
424
|
-
},
|
|
425
|
-
self
|
|
426
|
-
});
|
|
427
|
-
const treeLight$1 = treeLight;
|
|
428
|
-
const style$1 = c([cB("table", `
|
|
429
|
-
font-size: var(--n-font-size);
|
|
430
|
-
font-variant-numeric: tabular-nums;
|
|
431
|
-
line-height: var(--n-line-height);
|
|
432
|
-
width: 100%;
|
|
433
|
-
border-radius: var(--n-border-radius) var(--n-border-radius) 0 0;
|
|
434
|
-
text-align: left;
|
|
435
|
-
border-collapse: separate;
|
|
436
|
-
border-spacing: 0;
|
|
437
|
-
overflow: hidden;
|
|
438
|
-
background-color: var(--n-td-color);
|
|
439
|
-
border-color: var(--n-merged-border-color);
|
|
440
|
-
transition:
|
|
441
|
-
background-color .3s var(--n-bezier),
|
|
442
|
-
border-color .3s var(--n-bezier),
|
|
443
|
-
color .3s var(--n-bezier);
|
|
444
|
-
--n-merged-border-color: var(--n-border-color);
|
|
445
|
-
`, [c("th", `
|
|
446
|
-
white-space: nowrap;
|
|
447
|
-
transition:
|
|
448
|
-
background-color .3s var(--n-bezier),
|
|
449
|
-
border-color .3s var(--n-bezier),
|
|
450
|
-
color .3s var(--n-bezier);
|
|
451
|
-
text-align: inherit;
|
|
452
|
-
padding: var(--n-th-padding);
|
|
453
|
-
vertical-align: inherit;
|
|
454
|
-
text-transform: none;
|
|
455
|
-
border: 0px solid var(--n-merged-border-color);
|
|
456
|
-
font-weight: var(--n-th-font-weight);
|
|
457
|
-
color: var(--n-th-text-color);
|
|
458
|
-
background-color: var(--n-th-color);
|
|
459
|
-
border-bottom: 1px solid var(--n-merged-border-color);
|
|
460
|
-
border-right: 1px solid var(--n-merged-border-color);
|
|
461
|
-
`, [c("&:last-child", `
|
|
462
|
-
border-right: 0px solid var(--n-merged-border-color);
|
|
463
|
-
`)]), c("td", `
|
|
464
|
-
transition:
|
|
465
|
-
background-color .3s var(--n-bezier),
|
|
466
|
-
border-color .3s var(--n-bezier),
|
|
467
|
-
color .3s var(--n-bezier);
|
|
468
|
-
padding: var(--n-td-padding);
|
|
469
|
-
color: var(--n-td-text-color);
|
|
470
|
-
background-color: var(--n-td-color);
|
|
471
|
-
border: 0px solid var(--n-merged-border-color);
|
|
472
|
-
border-right: 1px solid var(--n-merged-border-color);
|
|
473
|
-
border-bottom: 1px solid var(--n-merged-border-color);
|
|
474
|
-
`, [c("&:last-child", `
|
|
475
|
-
border-right: 0px solid var(--n-merged-border-color);
|
|
476
|
-
`)]), cM("bordered", `
|
|
477
|
-
border: 1px solid var(--n-merged-border-color);
|
|
478
|
-
border-radius: var(--n-border-radius);
|
|
479
|
-
`, [c("tr", [c("&:last-child", [c("td", `
|
|
480
|
-
border-bottom: 0 solid var(--n-merged-border-color);
|
|
481
|
-
`)])])]), cM("single-line", [c("th", `
|
|
482
|
-
border-right: 0px solid var(--n-merged-border-color);
|
|
483
|
-
`), c("td", `
|
|
484
|
-
border-right: 0px solid var(--n-merged-border-color);
|
|
485
|
-
`)]), cM("single-column", [c("tr", [c("&:not(:last-child)", [c("td", `
|
|
486
|
-
border-bottom: 0px solid var(--n-merged-border-color);
|
|
487
|
-
`)])])]), cM("striped", [c("tr:nth-of-type(even)", [c("td", "background-color: var(--n-td-color-striped)")])]), cNotM("bottom-bordered", [c("tr", [c("&:last-child", [c("td", `
|
|
488
|
-
border-bottom: 0px solid var(--n-merged-border-color);
|
|
489
|
-
`)])])])]), insideModal(cB("table", `
|
|
490
|
-
background-color: var(--n-td-color-modal);
|
|
491
|
-
--n-merged-border-color: var(--n-border-color-modal);
|
|
492
|
-
`, [c("th", `
|
|
493
|
-
background-color: var(--n-th-color-modal);
|
|
494
|
-
`), c("td", `
|
|
495
|
-
background-color: var(--n-td-color-modal);
|
|
496
|
-
`)])), insidePopover(cB("table", `
|
|
497
|
-
background-color: var(--n-td-color-popover);
|
|
498
|
-
--n-merged-border-color: var(--n-border-color-popover);
|
|
499
|
-
`, [c("th", `
|
|
500
|
-
background-color: var(--n-th-color-popover);
|
|
501
|
-
`), c("td", `
|
|
502
|
-
background-color: var(--n-td-color-popover);
|
|
503
|
-
`)]))]);
|
|
504
|
-
const tableProps = Object.assign(Object.assign({}, useTheme.props), { bordered: {
|
|
505
|
-
type: Boolean,
|
|
506
|
-
default: true
|
|
507
|
-
}, bottomBordered: {
|
|
508
|
-
type: Boolean,
|
|
509
|
-
default: true
|
|
510
|
-
}, singleLine: {
|
|
511
|
-
type: Boolean,
|
|
512
|
-
default: true
|
|
513
|
-
}, striped: Boolean, singleColumn: Boolean, size: {
|
|
514
|
-
type: String,
|
|
515
|
-
default: "medium"
|
|
516
|
-
} });
|
|
517
|
-
const NTable = defineComponent({
|
|
518
|
-
name: "Table",
|
|
519
|
-
props: tableProps,
|
|
520
|
-
setup(props) {
|
|
521
|
-
const { mergedClsPrefixRef, inlineThemeDisabled, mergedRtlRef } = useConfig(props);
|
|
522
|
-
const themeRef = useTheme("Table", "-table", style$1, tableLight$1, props, mergedClsPrefixRef);
|
|
523
|
-
const rtlEnabledRef = useRtl("Table", mergedRtlRef, mergedClsPrefixRef);
|
|
524
|
-
const cssVarsRef = computed(() => {
|
|
525
|
-
const { size } = props;
|
|
526
|
-
const { self: { borderColor, tdColor, tdColorModal, tdColorPopover, thColor, thColorModal, thColorPopover, thTextColor, tdTextColor, borderRadius, thFontWeight, lineHeight, borderColorModal, borderColorPopover, tdColorStriped, tdColorStripedModal, tdColorStripedPopover, [createKey("fontSize", size)]: fontSize, [createKey("tdPadding", size)]: tdPadding, [createKey("thPadding", size)]: thPadding }, common: { cubicBezierEaseInOut } } = themeRef.value;
|
|
527
|
-
return {
|
|
528
|
-
"--n-bezier": cubicBezierEaseInOut,
|
|
529
|
-
"--n-td-color": tdColor,
|
|
530
|
-
"--n-td-color-modal": tdColorModal,
|
|
531
|
-
"--n-td-color-popover": tdColorPopover,
|
|
532
|
-
"--n-td-text-color": tdTextColor,
|
|
533
|
-
"--n-border-color": borderColor,
|
|
534
|
-
"--n-border-color-modal": borderColorModal,
|
|
535
|
-
"--n-border-color-popover": borderColorPopover,
|
|
536
|
-
"--n-border-radius": borderRadius,
|
|
537
|
-
"--n-font-size": fontSize,
|
|
538
|
-
"--n-th-color": thColor,
|
|
539
|
-
"--n-th-color-modal": thColorModal,
|
|
540
|
-
"--n-th-color-popover": thColorPopover,
|
|
541
|
-
"--n-th-font-weight": thFontWeight,
|
|
542
|
-
"--n-th-text-color": thTextColor,
|
|
543
|
-
"--n-line-height": lineHeight,
|
|
544
|
-
"--n-td-padding": tdPadding,
|
|
545
|
-
"--n-th-padding": thPadding,
|
|
546
|
-
"--n-td-color-striped": tdColorStriped,
|
|
547
|
-
"--n-td-color-striped-modal": tdColorStripedModal,
|
|
548
|
-
"--n-td-color-striped-popover": tdColorStripedPopover
|
|
549
|
-
};
|
|
550
|
-
});
|
|
551
|
-
const themeClassHandle = inlineThemeDisabled ? useThemeClass("table", computed(() => {
|
|
552
|
-
return props.size[0];
|
|
553
|
-
}), cssVarsRef, props) : void 0;
|
|
554
|
-
return {
|
|
555
|
-
rtlEnabled: rtlEnabledRef,
|
|
556
|
-
mergedClsPrefix: mergedClsPrefixRef,
|
|
557
|
-
cssVars: inlineThemeDisabled ? void 0 : cssVarsRef,
|
|
558
|
-
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
559
|
-
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
560
|
-
};
|
|
561
|
-
},
|
|
562
|
-
render() {
|
|
563
|
-
var _a;
|
|
564
|
-
const { mergedClsPrefix } = this;
|
|
565
|
-
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
566
|
-
return h("table", { class: [
|
|
567
|
-
`${mergedClsPrefix}-table`,
|
|
568
|
-
this.themeClass,
|
|
569
|
-
{
|
|
570
|
-
[`${mergedClsPrefix}-table--rtl`]: this.rtlEnabled,
|
|
571
|
-
[`${mergedClsPrefix}-table--bottom-bordered`]: this.bottomBordered,
|
|
572
|
-
[`${mergedClsPrefix}-table--bordered`]: this.bordered,
|
|
573
|
-
[`${mergedClsPrefix}-table--single-line`]: this.singleLine,
|
|
574
|
-
[`${mergedClsPrefix}-table--single-column`]: this.singleColumn,
|
|
575
|
-
[`${mergedClsPrefix}-table--striped`]: this.striped
|
|
576
|
-
}
|
|
577
|
-
], style: this.cssVars }, this.$slots);
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
const NTh = defineComponent({
|
|
581
|
-
name: "Th",
|
|
582
|
-
render() {
|
|
583
|
-
return h("th", null, this.$slots);
|
|
584
|
-
}
|
|
585
|
-
});
|
|
586
|
-
const NTr = defineComponent({
|
|
587
|
-
name: "Tr",
|
|
588
|
-
render() {
|
|
589
|
-
return h("tr", null, this.$slots);
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
const NTd = defineComponent({
|
|
593
|
-
name: "Td",
|
|
594
|
-
render() {
|
|
595
|
-
return h("td", null, this.$slots);
|
|
596
|
-
}
|
|
597
|
-
});
|
|
598
|
-
const NThead = defineComponent({
|
|
599
|
-
name: "Thead",
|
|
600
|
-
render() {
|
|
601
|
-
return h("thead", null, this.$slots);
|
|
602
|
-
}
|
|
603
|
-
});
|
|
604
|
-
const NTbody = defineComponent({
|
|
605
|
-
name: "Tbody",
|
|
606
|
-
render() {
|
|
607
|
-
return h("tbody", null, this.$slots);
|
|
608
|
-
}
|
|
609
|
-
});
|
|
610
|
-
const treeSelectInjectionKey = createInjectionKey("n-tree-select");
|
|
611
|
-
const treeInjectionKey = createInjectionKey("n-tree");
|
|
612
|
-
const NTreeNodeSwitcher = defineComponent({
|
|
613
|
-
name: "NTreeSwitcher",
|
|
614
|
-
props: {
|
|
615
|
-
clsPrefix: {
|
|
616
|
-
type: String,
|
|
617
|
-
required: true
|
|
618
|
-
},
|
|
619
|
-
indent: { type: Number, required: true },
|
|
620
|
-
expanded: Boolean,
|
|
621
|
-
selected: Boolean,
|
|
622
|
-
hide: Boolean,
|
|
623
|
-
loading: Boolean,
|
|
624
|
-
onClick: Function,
|
|
625
|
-
tmNode: {
|
|
626
|
-
type: Object,
|
|
627
|
-
required: true
|
|
628
|
-
}
|
|
629
|
-
},
|
|
630
|
-
setup(props) {
|
|
631
|
-
const { renderSwitcherIconRef } = inject(treeInjectionKey, null);
|
|
632
|
-
return () => {
|
|
633
|
-
const { clsPrefix, expanded, hide, indent, onClick } = props;
|
|
634
|
-
return h(
|
|
635
|
-
"span",
|
|
636
|
-
{ "data-switcher": true, class: [
|
|
637
|
-
`${clsPrefix}-tree-node-switcher`,
|
|
638
|
-
expanded && `${clsPrefix}-tree-node-switcher--expanded`,
|
|
639
|
-
hide && `${clsPrefix}-tree-node-switcher--hide`
|
|
640
|
-
], style: { width: `${indent}px` }, onClick },
|
|
641
|
-
h(
|
|
642
|
-
"div",
|
|
643
|
-
{ class: `${clsPrefix}-tree-node-switcher__icon` },
|
|
644
|
-
h(NIconSwitchTransition, null, {
|
|
645
|
-
default: () => {
|
|
646
|
-
if (props.loading) {
|
|
647
|
-
return h(NBaseLoading, { clsPrefix, key: "loading", radius: 85, strokeWidth: 20 });
|
|
648
|
-
}
|
|
649
|
-
const { value: renderSwitcherIcon } = renderSwitcherIconRef;
|
|
650
|
-
return renderSwitcherIcon ? renderSwitcherIcon({
|
|
651
|
-
expanded: props.expanded,
|
|
652
|
-
selected: props.selected,
|
|
653
|
-
option: props.tmNode.rawNode
|
|
654
|
-
}) : h(NBaseIcon, { clsPrefix, key: "switcher" }, { default: () => h(SwitcherIcon, null) });
|
|
655
|
-
}
|
|
656
|
-
})
|
|
657
|
-
)
|
|
658
|
-
);
|
|
659
|
-
};
|
|
660
|
-
}
|
|
661
|
-
});
|
|
662
|
-
const NTreeNodeCheckbox = defineComponent({
|
|
663
|
-
name: "NTreeNodeCheckbox",
|
|
664
|
-
props: {
|
|
665
|
-
clsPrefix: {
|
|
666
|
-
type: String,
|
|
667
|
-
required: true
|
|
668
|
-
},
|
|
669
|
-
indent: {
|
|
670
|
-
type: Number,
|
|
671
|
-
required: true
|
|
672
|
-
},
|
|
673
|
-
right: Boolean,
|
|
674
|
-
focusable: Boolean,
|
|
675
|
-
disabled: Boolean,
|
|
676
|
-
checked: Boolean,
|
|
677
|
-
indeterminate: Boolean,
|
|
678
|
-
onCheck: Function
|
|
679
|
-
},
|
|
680
|
-
setup(props) {
|
|
681
|
-
const NTree2 = inject(treeInjectionKey);
|
|
682
|
-
function doCheck(value) {
|
|
683
|
-
const { onCheck } = props;
|
|
684
|
-
if (onCheck) {
|
|
685
|
-
onCheck(value);
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
function handleUpdateValue(value) {
|
|
689
|
-
doCheck(value);
|
|
690
|
-
}
|
|
691
|
-
return {
|
|
692
|
-
handleUpdateValue,
|
|
693
|
-
mergedTheme: NTree2.mergedThemeRef
|
|
694
|
-
};
|
|
695
|
-
},
|
|
696
|
-
render() {
|
|
697
|
-
const { clsPrefix, mergedTheme, checked, indeterminate, disabled, focusable, indent, handleUpdateValue } = this;
|
|
698
|
-
return h(
|
|
699
|
-
"span",
|
|
700
|
-
{ class: [
|
|
701
|
-
`${clsPrefix}-tree-node-checkbox`,
|
|
702
|
-
this.right && `${clsPrefix}-tree-node-checkbox--right`
|
|
703
|
-
], style: {
|
|
704
|
-
width: `${indent}px`
|
|
705
|
-
}, "data-checkbox": true },
|
|
706
|
-
h(NCheckbox, { focusable, disabled, theme: mergedTheme.peers.Checkbox, themeOverrides: mergedTheme.peerOverrides.Checkbox, checked, indeterminate, onUpdateChecked: handleUpdateValue })
|
|
707
|
-
);
|
|
708
|
-
}
|
|
709
|
-
});
|
|
710
|
-
const NTreeNodeContent = defineComponent({
|
|
711
|
-
name: "TreeNodeContent",
|
|
712
|
-
props: {
|
|
713
|
-
clsPrefix: {
|
|
714
|
-
type: String,
|
|
715
|
-
required: true
|
|
716
|
-
},
|
|
717
|
-
disabled: Boolean,
|
|
718
|
-
checked: Boolean,
|
|
719
|
-
selected: Boolean,
|
|
720
|
-
onClick: Function,
|
|
721
|
-
onDragstart: Function,
|
|
722
|
-
tmNode: {
|
|
723
|
-
type: Object,
|
|
724
|
-
required: true
|
|
725
|
-
},
|
|
726
|
-
nodeProps: Object
|
|
727
|
-
},
|
|
728
|
-
setup(props) {
|
|
729
|
-
const { renderLabelRef, renderPrefixRef, renderSuffixRef, labelFieldRef } = (
|
|
730
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
731
|
-
inject(treeInjectionKey)
|
|
732
|
-
);
|
|
733
|
-
const selfRef = ref(null);
|
|
734
|
-
function doClick(e) {
|
|
735
|
-
const { onClick } = props;
|
|
736
|
-
if (onClick)
|
|
737
|
-
onClick(e);
|
|
738
|
-
}
|
|
739
|
-
function handleClick(e) {
|
|
740
|
-
doClick(e);
|
|
741
|
-
}
|
|
742
|
-
return {
|
|
743
|
-
selfRef,
|
|
744
|
-
renderLabel: renderLabelRef,
|
|
745
|
-
renderPrefix: renderPrefixRef,
|
|
746
|
-
renderSuffix: renderSuffixRef,
|
|
747
|
-
labelField: labelFieldRef,
|
|
748
|
-
handleClick
|
|
749
|
-
};
|
|
750
|
-
},
|
|
751
|
-
render() {
|
|
752
|
-
const { clsPrefix, labelField, nodeProps, checked = false, selected = false, renderLabel, renderPrefix, renderSuffix, handleClick, onDragstart, tmNode: { rawNode, rawNode: { prefix, suffix, [labelField]: label } } } = this;
|
|
753
|
-
return h(
|
|
754
|
-
"span",
|
|
755
|
-
Object.assign({}, nodeProps, { ref: "selfRef", class: [`${clsPrefix}-tree-node-content`, nodeProps === null || nodeProps === void 0 ? void 0 : nodeProps.class], onClick: handleClick, draggable: onDragstart === void 0 ? void 0 : true, onDragstart }),
|
|
756
|
-
renderPrefix || prefix ? h("div", { class: `${clsPrefix}-tree-node-content__prefix` }, renderPrefix ? renderPrefix({
|
|
757
|
-
option: rawNode,
|
|
758
|
-
selected,
|
|
759
|
-
checked
|
|
760
|
-
}) : render(prefix)) : null,
|
|
761
|
-
h("div", { class: `${clsPrefix}-tree-node-content__text` }, renderLabel ? renderLabel({
|
|
762
|
-
option: rawNode,
|
|
763
|
-
selected,
|
|
764
|
-
checked
|
|
765
|
-
}) : render(label)),
|
|
766
|
-
renderSuffix || suffix ? h("div", { class: `${clsPrefix}-tree-node-content__suffix` }, renderSuffix ? renderSuffix({
|
|
767
|
-
option: rawNode,
|
|
768
|
-
selected,
|
|
769
|
-
checked
|
|
770
|
-
}) : render(suffix)) : null
|
|
771
|
-
);
|
|
772
|
-
}
|
|
773
|
-
});
|
|
774
|
-
function renderDropMark({ position, offsetLevel, indent, el }) {
|
|
775
|
-
const style2 = {
|
|
776
|
-
position: "absolute",
|
|
777
|
-
boxSizing: "border-box",
|
|
778
|
-
right: 0
|
|
779
|
-
};
|
|
780
|
-
if (position === "inside") {
|
|
781
|
-
style2.left = 0;
|
|
782
|
-
style2.top = 0;
|
|
783
|
-
style2.bottom = 0;
|
|
784
|
-
style2.borderRadius = "inherit";
|
|
785
|
-
style2.boxShadow = "inset 0 0 0 2px var(--n-drop-mark-color)";
|
|
786
|
-
} else {
|
|
787
|
-
const cssPosition = position === "before" ? "top" : "bottom";
|
|
788
|
-
style2[cssPosition] = 0;
|
|
789
|
-
style2.left = `${el.offsetLeft + 6 - offsetLevel * indent}px`;
|
|
790
|
-
style2.height = "2px";
|
|
791
|
-
style2.backgroundColor = "var(--n-drop-mark-color)";
|
|
792
|
-
style2.transformOrigin = cssPosition;
|
|
793
|
-
style2.borderRadius = "1px";
|
|
794
|
-
style2.transform = position === "before" ? "translateY(-4px)" : "translateY(4px)";
|
|
795
|
-
}
|
|
796
|
-
return h("div", { style: style2 });
|
|
797
|
-
}
|
|
798
|
-
function defaultAllowDrop({ dropPosition, node }) {
|
|
799
|
-
if (node.isLeaf === false)
|
|
800
|
-
return true;
|
|
801
|
-
if (node.children) {
|
|
802
|
-
return true;
|
|
803
|
-
}
|
|
804
|
-
return dropPosition !== "inside";
|
|
805
|
-
}
|
|
806
|
-
function useMergedCheckStrategy(props) {
|
|
807
|
-
return computed(() => props.leafOnly ? "child" : props.checkStrategy);
|
|
808
|
-
}
|
|
809
|
-
function isNodeDisabled(node, disabledField) {
|
|
810
|
-
return !!node.rawNode[disabledField];
|
|
811
|
-
}
|
|
812
|
-
function traverse(nodes, childrenField, callback, callbackAfter) {
|
|
813
|
-
nodes === null || nodes === void 0 ? void 0 : nodes.forEach((node) => {
|
|
814
|
-
callback(node);
|
|
815
|
-
traverse(node[childrenField], childrenField, callback, callbackAfter);
|
|
816
|
-
callbackAfter(node);
|
|
817
|
-
});
|
|
818
|
-
}
|
|
819
|
-
function keysWithFilter(nodes, pattern, keyField, childrenField, filter) {
|
|
820
|
-
const keys = /* @__PURE__ */ new Set();
|
|
821
|
-
const highlightKeySet = /* @__PURE__ */ new Set();
|
|
822
|
-
const path = [];
|
|
823
|
-
traverse(nodes, childrenField, (node) => {
|
|
824
|
-
path.push(node);
|
|
825
|
-
if (filter(pattern, node)) {
|
|
826
|
-
highlightKeySet.add(node[keyField]);
|
|
827
|
-
for (let i = path.length - 2; i >= 0; --i) {
|
|
828
|
-
if (!keys.has(path[i][keyField])) {
|
|
829
|
-
keys.add(path[i][keyField]);
|
|
830
|
-
} else {
|
|
831
|
-
return;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
}, () => {
|
|
836
|
-
path.pop();
|
|
837
|
-
});
|
|
838
|
-
return {
|
|
839
|
-
expandedKeys: Array.from(keys),
|
|
840
|
-
highlightKeySet
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
if (isBrowser && Image) {
|
|
844
|
-
const emptyImage = new Image();
|
|
845
|
-
emptyImage.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
|
|
846
|
-
}
|
|
847
|
-
function filterTree(tree, filter, pattern, keyField, childrenField) {
|
|
848
|
-
const visitedTailKeys = /* @__PURE__ */ new Set();
|
|
849
|
-
const visitedNonTailKeys = /* @__PURE__ */ new Set();
|
|
850
|
-
const highlightKeySet = /* @__PURE__ */ new Set();
|
|
851
|
-
const expandedKeys = [];
|
|
852
|
-
const filteredTree = [];
|
|
853
|
-
const path = [];
|
|
854
|
-
function visit(t) {
|
|
855
|
-
t.forEach((n) => {
|
|
856
|
-
path.push(n);
|
|
857
|
-
if (filter(pattern, n)) {
|
|
858
|
-
visitedTailKeys.add(n[keyField]);
|
|
859
|
-
highlightKeySet.add(n[keyField]);
|
|
860
|
-
for (let i = path.length - 2; i >= 0; --i) {
|
|
861
|
-
const key = path[i][keyField];
|
|
862
|
-
if (!visitedNonTailKeys.has(key)) {
|
|
863
|
-
visitedNonTailKeys.add(key);
|
|
864
|
-
if (visitedTailKeys.has(key)) {
|
|
865
|
-
visitedTailKeys.delete(key);
|
|
866
|
-
}
|
|
867
|
-
} else {
|
|
868
|
-
break;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
const children = n[childrenField];
|
|
873
|
-
if (children) {
|
|
874
|
-
visit(children);
|
|
875
|
-
}
|
|
876
|
-
path.pop();
|
|
877
|
-
});
|
|
878
|
-
}
|
|
879
|
-
visit(tree);
|
|
880
|
-
function build(t, sibs) {
|
|
881
|
-
t.forEach((n) => {
|
|
882
|
-
const key = n[keyField];
|
|
883
|
-
const isVisitedTail = visitedTailKeys.has(key);
|
|
884
|
-
const isVisitedNonTail = visitedNonTailKeys.has(key);
|
|
885
|
-
if (!isVisitedTail && !isVisitedNonTail)
|
|
886
|
-
return;
|
|
887
|
-
const children = n[childrenField];
|
|
888
|
-
if (children) {
|
|
889
|
-
if (isVisitedTail) {
|
|
890
|
-
sibs.push(n);
|
|
891
|
-
} else {
|
|
892
|
-
expandedKeys.push(key);
|
|
893
|
-
const clonedNode = Object.assign(Object.assign({}, n), { [childrenField]: [] });
|
|
894
|
-
sibs.push(clonedNode);
|
|
895
|
-
build(children, clonedNode[childrenField]);
|
|
896
|
-
}
|
|
897
|
-
} else {
|
|
898
|
-
sibs.push(n);
|
|
899
|
-
}
|
|
900
|
-
});
|
|
901
|
-
}
|
|
902
|
-
build(tree, filteredTree);
|
|
903
|
-
return {
|
|
904
|
-
filteredTree,
|
|
905
|
-
highlightKeySet,
|
|
906
|
-
expandedKeys
|
|
907
|
-
};
|
|
908
|
-
}
|
|
909
|
-
const TreeNode = defineComponent({
|
|
910
|
-
name: "TreeNode",
|
|
911
|
-
props: {
|
|
912
|
-
clsPrefix: {
|
|
913
|
-
type: String,
|
|
914
|
-
required: true
|
|
915
|
-
},
|
|
916
|
-
tmNode: {
|
|
917
|
-
type: Object,
|
|
918
|
-
required: true
|
|
919
|
-
}
|
|
920
|
-
},
|
|
921
|
-
setup(props) {
|
|
922
|
-
const NTree2 = inject(treeInjectionKey);
|
|
923
|
-
const { droppingNodeParentRef, droppingMouseNodeRef, draggingNodeRef, droppingPositionRef, droppingOffsetLevelRef, nodePropsRef, indentRef, blockLineRef, checkboxPlacementRef, checkOnClickRef, disabledFieldRef, showLineRef } = NTree2;
|
|
924
|
-
const checkboxDisabledRef = useMemo(() => !!props.tmNode.rawNode.checkboxDisabled);
|
|
925
|
-
const nodeIsDisabledRef = useMemo(() => {
|
|
926
|
-
return isNodeDisabled(props.tmNode, disabledFieldRef.value);
|
|
927
|
-
});
|
|
928
|
-
const disabledRef = useMemo(() => NTree2.disabledRef.value || nodeIsDisabledRef.value);
|
|
929
|
-
const resolvedNodePropsRef = computed(() => {
|
|
930
|
-
const { value: nodeProps } = nodePropsRef;
|
|
931
|
-
if (!nodeProps)
|
|
932
|
-
return void 0;
|
|
933
|
-
return nodeProps({ option: props.tmNode.rawNode });
|
|
934
|
-
});
|
|
935
|
-
const contentInstRef = ref(null);
|
|
936
|
-
const contentElRef = { value: null };
|
|
937
|
-
onMounted(() => {
|
|
938
|
-
contentElRef.value = contentInstRef.value.$el;
|
|
939
|
-
});
|
|
940
|
-
function handleSwitcherClick() {
|
|
941
|
-
const { tmNode } = props;
|
|
942
|
-
if (!tmNode.isLeaf && !tmNode.shallowLoaded) {
|
|
943
|
-
if (!NTree2.loadingKeysRef.value.has(tmNode.key)) {
|
|
944
|
-
NTree2.loadingKeysRef.value.add(tmNode.key);
|
|
945
|
-
} else {
|
|
946
|
-
return;
|
|
947
|
-
}
|
|
948
|
-
const { onLoadRef: { value: onLoad } } = NTree2;
|
|
949
|
-
if (onLoad) {
|
|
950
|
-
void onLoad(tmNode.rawNode).then((value) => {
|
|
951
|
-
if (value !== false) {
|
|
952
|
-
NTree2.handleSwitcherClick(tmNode);
|
|
953
|
-
}
|
|
954
|
-
}).finally(() => {
|
|
955
|
-
NTree2.loadingKeysRef.value.delete(tmNode.key);
|
|
956
|
-
});
|
|
957
|
-
}
|
|
958
|
-
} else {
|
|
959
|
-
NTree2.handleSwitcherClick(tmNode);
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
const selectableRef = useMemo(() => !nodeIsDisabledRef.value && NTree2.selectableRef.value && (NTree2.internalTreeSelect ? NTree2.mergedCheckStrategyRef.value !== "child" || NTree2.multipleRef.value && NTree2.cascadeRef.value || props.tmNode.isLeaf : true));
|
|
963
|
-
const checkableRef = useMemo(() => NTree2.checkableRef.value && (NTree2.cascadeRef.value || NTree2.mergedCheckStrategyRef.value !== "child" || props.tmNode.isLeaf));
|
|
964
|
-
const checkedRef = useMemo(() => NTree2.displayedCheckedKeysRef.value.includes(props.tmNode.key));
|
|
965
|
-
const mergedCheckOnClickRef = useMemo(() => {
|
|
966
|
-
const { value: checkable } = checkableRef;
|
|
967
|
-
if (!checkable)
|
|
968
|
-
return false;
|
|
969
|
-
const { value: checkOnClick } = checkOnClickRef;
|
|
970
|
-
const { tmNode } = props;
|
|
971
|
-
if (typeof checkOnClick === "boolean") {
|
|
972
|
-
return !tmNode.disabled && checkOnClick;
|
|
973
|
-
}
|
|
974
|
-
return checkOnClick(props.tmNode.rawNode);
|
|
975
|
-
});
|
|
976
|
-
function _handleClick(e) {
|
|
977
|
-
const { value: expandOnClick } = NTree2.expandOnClickRef;
|
|
978
|
-
const { value: selectable } = selectableRef;
|
|
979
|
-
const { value: mergedCheckOnClick } = mergedCheckOnClickRef;
|
|
980
|
-
if (!selectable && !expandOnClick && !mergedCheckOnClick)
|
|
981
|
-
return;
|
|
982
|
-
if (happensIn(e, "checkbox") || happensIn(e, "switcher"))
|
|
983
|
-
return;
|
|
984
|
-
const { tmNode } = props;
|
|
985
|
-
if (selectable) {
|
|
986
|
-
NTree2.handleSelect(tmNode);
|
|
987
|
-
}
|
|
988
|
-
if (expandOnClick && !tmNode.isLeaf) {
|
|
989
|
-
handleSwitcherClick();
|
|
990
|
-
}
|
|
991
|
-
if (mergedCheckOnClick) {
|
|
992
|
-
handleCheck(!checkedRef.value);
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
function handleContentClick(e) {
|
|
996
|
-
var _a, _b;
|
|
997
|
-
if (blockLineRef.value)
|
|
998
|
-
return;
|
|
999
|
-
if (!disabledRef.value)
|
|
1000
|
-
_handleClick(e);
|
|
1001
|
-
(_b = (_a = resolvedNodePropsRef.value) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
1002
|
-
}
|
|
1003
|
-
function handleLineClick(e) {
|
|
1004
|
-
var _a, _b;
|
|
1005
|
-
if (!blockLineRef.value)
|
|
1006
|
-
return;
|
|
1007
|
-
if (!disabledRef.value) {
|
|
1008
|
-
_handleClick(e);
|
|
1009
|
-
}
|
|
1010
|
-
(_b = (_a = resolvedNodePropsRef.value) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
1011
|
-
}
|
|
1012
|
-
function handleCheck(checked) {
|
|
1013
|
-
NTree2.handleCheck(props.tmNode, checked);
|
|
1014
|
-
}
|
|
1015
|
-
function handleDragStart(e) {
|
|
1016
|
-
NTree2.handleDragStart({
|
|
1017
|
-
event: e,
|
|
1018
|
-
node: props.tmNode
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
function handleDragEnter(e) {
|
|
1022
|
-
if (e.currentTarget !== e.target) {
|
|
1023
|
-
return;
|
|
1024
|
-
}
|
|
1025
|
-
NTree2.handleDragEnter({
|
|
1026
|
-
event: e,
|
|
1027
|
-
node: props.tmNode
|
|
1028
|
-
});
|
|
1029
|
-
}
|
|
1030
|
-
function handleDragOver(e) {
|
|
1031
|
-
e.preventDefault();
|
|
1032
|
-
NTree2.handleDragOver({
|
|
1033
|
-
event: e,
|
|
1034
|
-
node: props.tmNode
|
|
1035
|
-
});
|
|
1036
|
-
}
|
|
1037
|
-
function handleDragEnd(e) {
|
|
1038
|
-
NTree2.handleDragEnd({
|
|
1039
|
-
event: e,
|
|
1040
|
-
node: props.tmNode
|
|
1041
|
-
});
|
|
1042
|
-
}
|
|
1043
|
-
function handleDragLeave(e) {
|
|
1044
|
-
if (e.currentTarget !== e.target) {
|
|
1045
|
-
return;
|
|
1046
|
-
}
|
|
1047
|
-
NTree2.handleDragLeave({
|
|
1048
|
-
event: e,
|
|
1049
|
-
node: props.tmNode
|
|
1050
|
-
});
|
|
1051
|
-
}
|
|
1052
|
-
function handleDrop(e) {
|
|
1053
|
-
e.preventDefault();
|
|
1054
|
-
if (droppingPositionRef.value !== null) {
|
|
1055
|
-
NTree2.handleDrop({
|
|
1056
|
-
event: e,
|
|
1057
|
-
node: props.tmNode,
|
|
1058
|
-
dropPosition: droppingPositionRef.value
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
const indentNodes = computed(() => {
|
|
1063
|
-
const { clsPrefix } = props;
|
|
1064
|
-
const { value: indent } = indentRef;
|
|
1065
|
-
if (showLineRef.value) {
|
|
1066
|
-
const indentNodes2 = [];
|
|
1067
|
-
let cursor = props.tmNode.parent;
|
|
1068
|
-
while (cursor) {
|
|
1069
|
-
if (cursor.isLastChild) {
|
|
1070
|
-
indentNodes2.push(h(
|
|
1071
|
-
"div",
|
|
1072
|
-
{ class: `${clsPrefix}-tree-node-indent` },
|
|
1073
|
-
h("div", { style: { width: `${indent}px` } })
|
|
1074
|
-
));
|
|
1075
|
-
} else {
|
|
1076
|
-
indentNodes2.push(h(
|
|
1077
|
-
"div",
|
|
1078
|
-
{ class: [
|
|
1079
|
-
`${clsPrefix}-tree-node-indent`,
|
|
1080
|
-
`${clsPrefix}-tree-node-indent--show-line`
|
|
1081
|
-
] },
|
|
1082
|
-
h("div", { style: { width: `${indent}px` } })
|
|
1083
|
-
));
|
|
1084
|
-
}
|
|
1085
|
-
cursor = cursor.parent;
|
|
1086
|
-
}
|
|
1087
|
-
return indentNodes2.reverse();
|
|
1088
|
-
} else {
|
|
1089
|
-
return repeat(props.tmNode.level, h(
|
|
1090
|
-
"div",
|
|
1091
|
-
{ class: `${props.clsPrefix}-tree-node-indent` },
|
|
1092
|
-
h("div", { style: { width: `${indent}px` } })
|
|
1093
|
-
));
|
|
1094
|
-
}
|
|
1095
|
-
});
|
|
1096
|
-
return {
|
|
1097
|
-
showDropMark: useMemo(() => {
|
|
1098
|
-
const { value: draggingNode } = draggingNodeRef;
|
|
1099
|
-
if (!draggingNode)
|
|
1100
|
-
return;
|
|
1101
|
-
const { value: droppingPosition } = droppingPositionRef;
|
|
1102
|
-
if (!droppingPosition)
|
|
1103
|
-
return;
|
|
1104
|
-
const { value: droppingMouseNode } = droppingMouseNodeRef;
|
|
1105
|
-
if (!droppingMouseNode) {
|
|
1106
|
-
return;
|
|
1107
|
-
}
|
|
1108
|
-
const { tmNode } = props;
|
|
1109
|
-
if (tmNode.key === droppingMouseNode.key)
|
|
1110
|
-
return true;
|
|
1111
|
-
return false;
|
|
1112
|
-
}),
|
|
1113
|
-
showDropMarkAsParent: useMemo(() => {
|
|
1114
|
-
const { value: droppingNodeParent } = droppingNodeParentRef;
|
|
1115
|
-
if (!droppingNodeParent)
|
|
1116
|
-
return false;
|
|
1117
|
-
const { tmNode } = props;
|
|
1118
|
-
const { value: droppingPosition } = droppingPositionRef;
|
|
1119
|
-
if (droppingPosition === "before" || droppingPosition === "after") {
|
|
1120
|
-
return droppingNodeParent.key === tmNode.key;
|
|
1121
|
-
}
|
|
1122
|
-
return false;
|
|
1123
|
-
}),
|
|
1124
|
-
pending: useMemo(() => NTree2.pendingNodeKeyRef.value === props.tmNode.key),
|
|
1125
|
-
loading: useMemo(() => NTree2.loadingKeysRef.value.has(props.tmNode.key)),
|
|
1126
|
-
highlight: useMemo(() => {
|
|
1127
|
-
var _a;
|
|
1128
|
-
return (_a = NTree2.highlightKeySetRef.value) === null || _a === void 0 ? void 0 : _a.has(props.tmNode.key);
|
|
1129
|
-
}),
|
|
1130
|
-
checked: checkedRef,
|
|
1131
|
-
indeterminate: useMemo(() => NTree2.displayedIndeterminateKeysRef.value.includes(props.tmNode.key)),
|
|
1132
|
-
selected: useMemo(() => NTree2.mergedSelectedKeysRef.value.includes(props.tmNode.key)),
|
|
1133
|
-
expanded: useMemo(() => NTree2.mergedExpandedKeysRef.value.includes(props.tmNode.key)),
|
|
1134
|
-
disabled: disabledRef,
|
|
1135
|
-
checkable: checkableRef,
|
|
1136
|
-
mergedCheckOnClick: mergedCheckOnClickRef,
|
|
1137
|
-
checkboxDisabled: checkboxDisabledRef,
|
|
1138
|
-
selectable: selectableRef,
|
|
1139
|
-
expandOnClick: NTree2.expandOnClickRef,
|
|
1140
|
-
internalScrollable: NTree2.internalScrollableRef,
|
|
1141
|
-
draggable: NTree2.draggableRef,
|
|
1142
|
-
blockLine: blockLineRef,
|
|
1143
|
-
nodeProps: resolvedNodePropsRef,
|
|
1144
|
-
checkboxFocusable: NTree2.internalCheckboxFocusableRef,
|
|
1145
|
-
droppingPosition: droppingPositionRef,
|
|
1146
|
-
droppingOffsetLevel: droppingOffsetLevelRef,
|
|
1147
|
-
indent: indentRef,
|
|
1148
|
-
checkboxPlacement: checkboxPlacementRef,
|
|
1149
|
-
showLine: showLineRef,
|
|
1150
|
-
contentInstRef,
|
|
1151
|
-
contentElRef,
|
|
1152
|
-
indentNodes,
|
|
1153
|
-
handleCheck,
|
|
1154
|
-
handleDrop,
|
|
1155
|
-
handleDragStart,
|
|
1156
|
-
handleDragEnter,
|
|
1157
|
-
handleDragOver,
|
|
1158
|
-
handleDragEnd,
|
|
1159
|
-
handleDragLeave,
|
|
1160
|
-
handleLineClick,
|
|
1161
|
-
handleContentClick,
|
|
1162
|
-
handleSwitcherClick
|
|
1163
|
-
};
|
|
1164
|
-
},
|
|
1165
|
-
render() {
|
|
1166
|
-
const { tmNode, clsPrefix, checkable, expandOnClick, selectable, selected, checked, highlight, draggable, blockLine, indent, indentNodes, disabled, pending, internalScrollable, nodeProps, checkboxPlacement } = this;
|
|
1167
|
-
const dragEventHandlers = draggable && !disabled ? {
|
|
1168
|
-
onDragenter: this.handleDragEnter,
|
|
1169
|
-
onDragleave: this.handleDragLeave,
|
|
1170
|
-
onDragend: this.handleDragEnd,
|
|
1171
|
-
onDrop: this.handleDrop,
|
|
1172
|
-
onDragover: this.handleDragOver
|
|
1173
|
-
} : void 0;
|
|
1174
|
-
const dataKey = internalScrollable ? createDataKey(tmNode.key) : void 0;
|
|
1175
|
-
const checkboxOnRight = checkboxPlacement === "right";
|
|
1176
|
-
const checkboxNode = checkable ? h(NTreeNodeCheckbox, { indent, right: checkboxOnRight, focusable: this.checkboxFocusable, disabled: disabled || this.checkboxDisabled, clsPrefix, checked: this.checked, indeterminate: this.indeterminate, onCheck: this.handleCheck }) : null;
|
|
1177
|
-
return h(
|
|
1178
|
-
"div",
|
|
1179
|
-
Object.assign({ class: `${clsPrefix}-tree-node-wrapper` }, dragEventHandlers),
|
|
1180
|
-
h(
|
|
1181
|
-
"div",
|
|
1182
|
-
Object.assign({}, blockLine ? nodeProps : void 0, { class: [
|
|
1183
|
-
`${clsPrefix}-tree-node`,
|
|
1184
|
-
{
|
|
1185
|
-
[`${clsPrefix}-tree-node--selected`]: selected,
|
|
1186
|
-
[`${clsPrefix}-tree-node--checkable`]: checkable,
|
|
1187
|
-
[`${clsPrefix}-tree-node--highlight`]: highlight,
|
|
1188
|
-
[`${clsPrefix}-tree-node--pending`]: pending,
|
|
1189
|
-
[`${clsPrefix}-tree-node--disabled`]: disabled,
|
|
1190
|
-
[`${clsPrefix}-tree-node--selectable`]: selectable,
|
|
1191
|
-
[`${clsPrefix}-tree-node--clickable`]: selectable || expandOnClick || this.mergedCheckOnClick
|
|
1192
|
-
},
|
|
1193
|
-
nodeProps === null || nodeProps === void 0 ? void 0 : nodeProps.class
|
|
1194
|
-
], "data-key": dataKey, draggable: draggable && blockLine, onClick: this.handleLineClick, onDragstart: draggable && blockLine && !disabled ? this.handleDragStart : void 0 }),
|
|
1195
|
-
indentNodes,
|
|
1196
|
-
tmNode.isLeaf && this.showLine ? h(
|
|
1197
|
-
"div",
|
|
1198
|
-
{ class: [
|
|
1199
|
-
`${clsPrefix}-tree-node-indent`,
|
|
1200
|
-
`${clsPrefix}-tree-node-indent--show-line`,
|
|
1201
|
-
tmNode.isLeaf && `${clsPrefix}-tree-node-indent--is-leaf`,
|
|
1202
|
-
tmNode.isLastChild && `${clsPrefix}-tree-node-indent--last-child`
|
|
1203
|
-
] },
|
|
1204
|
-
h("div", { style: { width: `${indent}px` } })
|
|
1205
|
-
) : h(NTreeNodeSwitcher, { clsPrefix, expanded: this.expanded, selected, loading: this.loading, hide: tmNode.isLeaf, tmNode: this.tmNode, indent, onClick: this.handleSwitcherClick }),
|
|
1206
|
-
!checkboxOnRight ? checkboxNode : null,
|
|
1207
|
-
h(NTreeNodeContent, { ref: "contentInstRef", clsPrefix, checked, selected, onClick: this.handleContentClick, nodeProps: blockLine ? void 0 : nodeProps, onDragstart: draggable && !blockLine && !disabled ? this.handleDragStart : void 0, tmNode }),
|
|
1208
|
-
draggable ? this.showDropMark ? renderDropMark({
|
|
1209
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1210
|
-
el: this.contentElRef.value,
|
|
1211
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1212
|
-
position: this.droppingPosition,
|
|
1213
|
-
offsetLevel: this.droppingOffsetLevel,
|
|
1214
|
-
indent
|
|
1215
|
-
}) : this.showDropMarkAsParent ? renderDropMark({
|
|
1216
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1217
|
-
el: this.contentElRef.value,
|
|
1218
|
-
position: "inside",
|
|
1219
|
-
offsetLevel: this.droppingOffsetLevel,
|
|
1220
|
-
indent
|
|
1221
|
-
}) : null : null,
|
|
1222
|
-
checkboxOnRight ? checkboxNode : null
|
|
1223
|
-
)
|
|
1224
|
-
);
|
|
1225
|
-
}
|
|
1226
|
-
});
|
|
1227
|
-
const NTreeNode = TreeNode;
|
|
1228
|
-
function useKeyboard({ props, fNodesRef, mergedExpandedKeysRef, mergedSelectedKeysRef, handleSelect, handleSwitcherClick }) {
|
|
1229
|
-
const { value: mergedSelectedKeys } = mergedSelectedKeysRef;
|
|
1230
|
-
const treeSelectInjection = inject(treeSelectInjectionKey, null);
|
|
1231
|
-
const pendingNodeKeyRef = treeSelectInjection ? treeSelectInjection.pendingNodeKeyRef : ref(mergedSelectedKeys.length ? mergedSelectedKeys[mergedSelectedKeys.length - 1] : null);
|
|
1232
|
-
function handleKeydown(e) {
|
|
1233
|
-
if (!props.keyboard)
|
|
1234
|
-
return;
|
|
1235
|
-
const { value: pendingNodeKey } = pendingNodeKeyRef;
|
|
1236
|
-
if (pendingNodeKey === null) {
|
|
1237
|
-
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
1238
|
-
e.preventDefault();
|
|
1239
|
-
}
|
|
1240
|
-
if (["ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"].includes(e.key)) {
|
|
1241
|
-
if (pendingNodeKey === null) {
|
|
1242
|
-
const { value: fNodes } = fNodesRef;
|
|
1243
|
-
let fIndex = 0;
|
|
1244
|
-
while (fIndex < fNodes.length) {
|
|
1245
|
-
if (!fNodes[fIndex].disabled) {
|
|
1246
|
-
pendingNodeKeyRef.value = fNodes[fIndex].key;
|
|
1247
|
-
break;
|
|
1248
|
-
}
|
|
1249
|
-
fIndex += 1;
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
} else {
|
|
1254
|
-
const { value: fNodes } = fNodesRef;
|
|
1255
|
-
let fIndex = fNodes.findIndex((tmNode) => tmNode.key === pendingNodeKey);
|
|
1256
|
-
if (!~fIndex)
|
|
1257
|
-
return;
|
|
1258
|
-
if (e.key === "Enter") {
|
|
1259
|
-
handleSelect(fNodes[fIndex]);
|
|
1260
|
-
} else if (e.key === "ArrowDown") {
|
|
1261
|
-
e.preventDefault();
|
|
1262
|
-
fIndex += 1;
|
|
1263
|
-
while (fIndex < fNodes.length) {
|
|
1264
|
-
if (!fNodes[fIndex].disabled) {
|
|
1265
|
-
pendingNodeKeyRef.value = fNodes[fIndex].key;
|
|
1266
|
-
break;
|
|
1267
|
-
}
|
|
1268
|
-
fIndex += 1;
|
|
1269
|
-
}
|
|
1270
|
-
} else if (e.key === "ArrowUp") {
|
|
1271
|
-
e.preventDefault();
|
|
1272
|
-
fIndex -= 1;
|
|
1273
|
-
while (fIndex >= 0) {
|
|
1274
|
-
if (!fNodes[fIndex].disabled) {
|
|
1275
|
-
pendingNodeKeyRef.value = fNodes[fIndex].key;
|
|
1276
|
-
break;
|
|
1277
|
-
}
|
|
1278
|
-
fIndex -= 1;
|
|
1279
|
-
}
|
|
1280
|
-
} else if (e.key === "ArrowLeft") {
|
|
1281
|
-
const pendingNode = fNodes[fIndex];
|
|
1282
|
-
if (pendingNode.isLeaf || !mergedExpandedKeysRef.value.includes(pendingNodeKey)) {
|
|
1283
|
-
const parentTmNode = pendingNode.getParent();
|
|
1284
|
-
if (parentTmNode) {
|
|
1285
|
-
pendingNodeKeyRef.value = parentTmNode.key;
|
|
1286
|
-
}
|
|
1287
|
-
} else {
|
|
1288
|
-
handleSwitcherClick(pendingNode);
|
|
1289
|
-
}
|
|
1290
|
-
} else if (e.key === "ArrowRight") {
|
|
1291
|
-
const pendingNode = fNodes[fIndex];
|
|
1292
|
-
if (pendingNode.isLeaf)
|
|
1293
|
-
return;
|
|
1294
|
-
if (!mergedExpandedKeysRef.value.includes(pendingNodeKey)) {
|
|
1295
|
-
handleSwitcherClick(pendingNode);
|
|
1296
|
-
} else {
|
|
1297
|
-
fIndex += 1;
|
|
1298
|
-
while (fIndex < fNodes.length) {
|
|
1299
|
-
if (!fNodes[fIndex].disabled) {
|
|
1300
|
-
pendingNodeKeyRef.value = fNodes[fIndex].key;
|
|
1301
|
-
break;
|
|
1302
|
-
}
|
|
1303
|
-
fIndex += 1;
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
return {
|
|
1310
|
-
pendingNodeKeyRef,
|
|
1311
|
-
handleKeydown
|
|
1312
|
-
};
|
|
1313
|
-
}
|
|
1314
|
-
const MotionWrapper = defineComponent({
|
|
1315
|
-
name: "TreeMotionWrapper",
|
|
1316
|
-
props: {
|
|
1317
|
-
clsPrefix: {
|
|
1318
|
-
type: String,
|
|
1319
|
-
required: true
|
|
1320
|
-
},
|
|
1321
|
-
height: Number,
|
|
1322
|
-
nodes: {
|
|
1323
|
-
type: Array,
|
|
1324
|
-
required: true
|
|
1325
|
-
},
|
|
1326
|
-
mode: {
|
|
1327
|
-
type: String,
|
|
1328
|
-
required: true
|
|
1329
|
-
},
|
|
1330
|
-
onAfterEnter: {
|
|
1331
|
-
type: Function,
|
|
1332
|
-
required: true
|
|
1333
|
-
}
|
|
1334
|
-
},
|
|
1335
|
-
render() {
|
|
1336
|
-
const { clsPrefix } = this;
|
|
1337
|
-
return h(NFadeInExpandTransition, { onAfterEnter: this.onAfterEnter, appear: true, reverse: this.mode === "collapse" }, {
|
|
1338
|
-
default: () => h("div", { class: [
|
|
1339
|
-
`${clsPrefix}-tree-motion-wrapper`,
|
|
1340
|
-
`${clsPrefix}-tree-motion-wrapper--${this.mode}`
|
|
1341
|
-
], style: {
|
|
1342
|
-
height: pxfy(this.height)
|
|
1343
|
-
} }, this.nodes.map((node) => h(NTreeNode, { clsPrefix, tmNode: node })))
|
|
1344
|
-
});
|
|
1345
|
-
}
|
|
1346
|
-
});
|
|
1347
|
-
const iconSwitchTransitionNode = iconSwitchTransition();
|
|
1348
|
-
const style = cB("tree", `
|
|
1349
|
-
font-size: var(--n-font-size);
|
|
1350
|
-
outline: none;
|
|
1351
|
-
`, [c("ul, li", `
|
|
1352
|
-
margin: 0;
|
|
1353
|
-
padding: 0;
|
|
1354
|
-
list-style: none;
|
|
1355
|
-
`), c(">", [cB("tree-node", [c("&:first-child", "margin-top: 0;")])]), cB("tree-motion-wrapper", [cM("expand", [fadeInHeightExpandTransition({
|
|
1356
|
-
duration: "0.2s"
|
|
1357
|
-
})]), cM("collapse", [fadeInHeightExpandTransition({
|
|
1358
|
-
duration: "0.2s",
|
|
1359
|
-
reverse: true
|
|
1360
|
-
})])]), cB("tree-node-wrapper", `
|
|
1361
|
-
box-sizing: border-box;
|
|
1362
|
-
padding: var(--n-node-wrapper-padding);
|
|
1363
|
-
`), cB("tree-node", `
|
|
1364
|
-
transform: translate3d(0,0,0);
|
|
1365
|
-
position: relative;
|
|
1366
|
-
display: flex;
|
|
1367
|
-
border-radius: var(--n-node-border-radius);
|
|
1368
|
-
transition: background-color .3s var(--n-bezier);
|
|
1369
|
-
`, [cM("highlight", [cB("tree-node-content", [cE("text", "border-bottom-color: var(--n-node-text-color-disabled);")])]), cM("disabled", [cB("tree-node-content", `
|
|
1370
|
-
color: var(--n-node-text-color-disabled);
|
|
1371
|
-
cursor: not-allowed;
|
|
1372
|
-
`)]), cNotM("disabled", [cM("clickable", [cB("tree-node-content", `
|
|
1373
|
-
cursor: pointer;
|
|
1374
|
-
`)])])]), cM("block-node", [cB("tree-node-content", `
|
|
1375
|
-
flex: 1;
|
|
1376
|
-
min-width: 0;
|
|
1377
|
-
`)]), cNotM("block-line", [cB("tree-node", [cNotM("disabled", [cB("tree-node-content", [c("&:hover", "background: var(--n-node-color-hover);")]), cM("selectable", [cB("tree-node-content", [c("&:active", "background: var(--n-node-color-pressed);")])]), cM("pending", [cB("tree-node-content", `
|
|
1378
|
-
background: var(--n-node-color-hover);
|
|
1379
|
-
`)]), cM("selected", [cB("tree-node-content", "background: var(--n-node-color-active);")])])])]), cM("block-line", [cB("tree-node", [cNotM("disabled", [c("&:hover", "background: var(--n-node-color-hover);"), cM("pending", `
|
|
1380
|
-
background: var(--n-node-color-hover);
|
|
1381
|
-
`), cM("selectable", [cNotM("selected", [c("&:active", "background: var(--n-node-color-pressed);")])]), cM("selected", "background: var(--n-node-color-active);")]), cM("disabled", `
|
|
1382
|
-
cursor: not-allowed;
|
|
1383
|
-
`)])]), cB("tree-node-indent", `
|
|
1384
|
-
flex-grow: 0;
|
|
1385
|
-
flex-shrink: 0;
|
|
1386
|
-
`, [cM("show-line", "position: relative", [c("&::before", `
|
|
1387
|
-
position: absolute;
|
|
1388
|
-
left: 50%;
|
|
1389
|
-
border-left: 1px solid var(--n-border-color);
|
|
1390
|
-
transition: border-color .3s var(--n-bezier);
|
|
1391
|
-
transform: translate(-50%);
|
|
1392
|
-
content: "";
|
|
1393
|
-
top: var(--n-line-offset-top);
|
|
1394
|
-
bottom: var(--n-line-offset-bottom);
|
|
1395
|
-
`), cM("last-child", [c("&::before", `
|
|
1396
|
-
bottom: 50%;
|
|
1397
|
-
`)]), cM("is-leaf", [c("&::after", `
|
|
1398
|
-
position: absolute;
|
|
1399
|
-
content: "";
|
|
1400
|
-
left: calc(50% + 0.5px);
|
|
1401
|
-
right: 0;
|
|
1402
|
-
bottom: 50%;
|
|
1403
|
-
transition: border-color .3s var(--n-bezier);
|
|
1404
|
-
border-bottom: 1px solid var(--n-border-color);
|
|
1405
|
-
`)])]), cNotM("show-line", "height: 0;")]), cB("tree-node-switcher", `
|
|
1406
|
-
cursor: pointer;
|
|
1407
|
-
display: inline-flex;
|
|
1408
|
-
flex-shrink: 0;
|
|
1409
|
-
height: var(--n-node-content-height);
|
|
1410
|
-
align-items: center;
|
|
1411
|
-
justify-content: center;
|
|
1412
|
-
transition: transform .15s var(--n-bezier);
|
|
1413
|
-
vertical-align: bottom;
|
|
1414
|
-
`, [cE("icon", `
|
|
1415
|
-
position: relative;
|
|
1416
|
-
height: 14px;
|
|
1417
|
-
width: 14px;
|
|
1418
|
-
display: flex;
|
|
1419
|
-
color: var(--n-arrow-color);
|
|
1420
|
-
transition: color .3s var(--n-bezier);
|
|
1421
|
-
font-size: 14px;
|
|
1422
|
-
`, [cB("icon", [iconSwitchTransitionNode]), cB("base-loading", `
|
|
1423
|
-
color: var(--n-loading-color);
|
|
1424
|
-
position: absolute;
|
|
1425
|
-
left: 0;
|
|
1426
|
-
top: 0;
|
|
1427
|
-
right: 0;
|
|
1428
|
-
bottom: 0;
|
|
1429
|
-
`, [iconSwitchTransitionNode]), cB("base-icon", [iconSwitchTransitionNode])]), cM("hide", "visibility: hidden;"), cM("expanded", "transform: rotate(90deg);")]), cB("tree-node-checkbox", `
|
|
1430
|
-
display: inline-flex;
|
|
1431
|
-
height: var(--n-node-content-height);
|
|
1432
|
-
vertical-align: bottom;
|
|
1433
|
-
align-items: center;
|
|
1434
|
-
justify-content: center;
|
|
1435
|
-
`), cB("tree-node-content", `
|
|
1436
|
-
user-select: none;
|
|
1437
|
-
position: relative;
|
|
1438
|
-
display: inline-flex;
|
|
1439
|
-
align-items: center;
|
|
1440
|
-
min-height: var(--n-node-content-height);
|
|
1441
|
-
box-sizing: border-box;
|
|
1442
|
-
line-height: var(--n-line-height);
|
|
1443
|
-
vertical-align: bottom;
|
|
1444
|
-
padding: 0 6px 0 4px;
|
|
1445
|
-
cursor: default;
|
|
1446
|
-
border-radius: var(--n-node-border-radius);
|
|
1447
|
-
color: var(--n-node-text-color);
|
|
1448
|
-
transition:
|
|
1449
|
-
color .3s var(--n-bezier),
|
|
1450
|
-
background-color .3s var(--n-bezier),
|
|
1451
|
-
border-color .3s var(--n-bezier);
|
|
1452
|
-
`, [c("&:last-child", "margin-bottom: 0;"), cE("prefix", `
|
|
1453
|
-
display: inline-flex;
|
|
1454
|
-
margin-right: 8px;
|
|
1455
|
-
`), cE("text", `
|
|
1456
|
-
border-bottom: 1px solid #0000;
|
|
1457
|
-
transition: border-color .3s var(--n-bezier);
|
|
1458
|
-
flex-grow: 1;
|
|
1459
|
-
max-width: 100%;
|
|
1460
|
-
`), cE("suffix", `
|
|
1461
|
-
display: inline-flex;
|
|
1462
|
-
`)]), cE("empty", "margin: auto;")]);
|
|
1463
|
-
var __awaiter = globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
1464
|
-
function adopt(value) {
|
|
1465
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
1466
|
-
resolve(value);
|
|
1467
|
-
});
|
|
1468
|
-
}
|
|
1469
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1470
|
-
function fulfilled(value) {
|
|
1471
|
-
try {
|
|
1472
|
-
step(generator.next(value));
|
|
1473
|
-
} catch (e) {
|
|
1474
|
-
reject(e);
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
function rejected(value) {
|
|
1478
|
-
try {
|
|
1479
|
-
step(generator["throw"](value));
|
|
1480
|
-
} catch (e) {
|
|
1481
|
-
reject(e);
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
function step(result) {
|
|
1485
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1486
|
-
}
|
|
1487
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1488
|
-
});
|
|
1489
|
-
};
|
|
1490
|
-
function createTreeMateOptions(keyField, childrenField, disabledField, getChildren) {
|
|
1491
|
-
const settledGetChildren = getChildren || ((node) => {
|
|
1492
|
-
return node[childrenField];
|
|
1493
|
-
});
|
|
1494
|
-
return {
|
|
1495
|
-
getIsGroup() {
|
|
1496
|
-
return false;
|
|
1497
|
-
},
|
|
1498
|
-
getKey(node) {
|
|
1499
|
-
return node[keyField];
|
|
1500
|
-
},
|
|
1501
|
-
getChildren: settledGetChildren,
|
|
1502
|
-
getDisabled(node) {
|
|
1503
|
-
return !!(node[disabledField] || node.checkboxDisabled);
|
|
1504
|
-
}
|
|
1505
|
-
};
|
|
1506
|
-
}
|
|
1507
|
-
const treeSharedProps = {
|
|
1508
|
-
allowCheckingNotLoaded: Boolean,
|
|
1509
|
-
filter: Function,
|
|
1510
|
-
defaultExpandAll: Boolean,
|
|
1511
|
-
expandedKeys: Array,
|
|
1512
|
-
keyField: {
|
|
1513
|
-
type: String,
|
|
1514
|
-
default: "key"
|
|
1515
|
-
},
|
|
1516
|
-
labelField: {
|
|
1517
|
-
type: String,
|
|
1518
|
-
default: "label"
|
|
1519
|
-
},
|
|
1520
|
-
childrenField: {
|
|
1521
|
-
type: String,
|
|
1522
|
-
default: "children"
|
|
1523
|
-
},
|
|
1524
|
-
disabledField: {
|
|
1525
|
-
type: String,
|
|
1526
|
-
default: "disabled"
|
|
1527
|
-
},
|
|
1528
|
-
defaultExpandedKeys: {
|
|
1529
|
-
type: Array,
|
|
1530
|
-
default: () => []
|
|
1531
|
-
},
|
|
1532
|
-
indeterminateKeys: Array,
|
|
1533
|
-
renderSwitcherIcon: Function,
|
|
1534
|
-
onUpdateIndeterminateKeys: [Function, Array],
|
|
1535
|
-
"onUpdate:indeterminateKeys": [Function, Array],
|
|
1536
|
-
onUpdateExpandedKeys: [Function, Array],
|
|
1537
|
-
"onUpdate:expandedKeys": [Function, Array]
|
|
1538
|
-
};
|
|
1539
|
-
const treeProps = Object.assign(Object.assign(Object.assign(Object.assign({}, useTheme.props), { accordion: Boolean, showIrrelevantNodes: { type: Boolean, default: true }, data: {
|
|
1540
|
-
type: Array,
|
|
1541
|
-
default: () => []
|
|
1542
|
-
}, expandOnDragenter: {
|
|
1543
|
-
type: Boolean,
|
|
1544
|
-
default: true
|
|
1545
|
-
}, expandOnClick: Boolean, checkOnClick: {
|
|
1546
|
-
type: [Boolean, Function],
|
|
1547
|
-
default: false
|
|
1548
|
-
}, cancelable: {
|
|
1549
|
-
type: Boolean,
|
|
1550
|
-
default: true
|
|
1551
|
-
}, checkable: Boolean, draggable: Boolean, blockNode: Boolean, blockLine: Boolean, showLine: Boolean, disabled: Boolean, checkedKeys: Array, defaultCheckedKeys: {
|
|
1552
|
-
type: Array,
|
|
1553
|
-
default: () => []
|
|
1554
|
-
}, selectedKeys: Array, defaultSelectedKeys: {
|
|
1555
|
-
type: Array,
|
|
1556
|
-
default: () => []
|
|
1557
|
-
}, multiple: Boolean, pattern: {
|
|
1558
|
-
type: String,
|
|
1559
|
-
default: ""
|
|
1560
|
-
}, onLoad: Function, cascade: Boolean, selectable: {
|
|
1561
|
-
type: Boolean,
|
|
1562
|
-
default: true
|
|
1563
|
-
}, scrollbarProps: Object, indent: {
|
|
1564
|
-
type: Number,
|
|
1565
|
-
default: 24
|
|
1566
|
-
}, allowDrop: {
|
|
1567
|
-
type: Function,
|
|
1568
|
-
default: defaultAllowDrop
|
|
1569
|
-
}, animated: {
|
|
1570
|
-
type: Boolean,
|
|
1571
|
-
default: true
|
|
1572
|
-
}, checkboxPlacement: {
|
|
1573
|
-
type: String,
|
|
1574
|
-
default: "left"
|
|
1575
|
-
}, virtualScroll: Boolean, watchProps: Array, renderLabel: Function, renderPrefix: Function, renderSuffix: Function, nodeProps: Function, keyboard: {
|
|
1576
|
-
type: Boolean,
|
|
1577
|
-
default: true
|
|
1578
|
-
}, getChildren: Function, onDragenter: [Function, Array], onDragleave: [Function, Array], onDragend: [Function, Array], onDragstart: [Function, Array], onDragover: [Function, Array], onDrop: [Function, Array], onUpdateCheckedKeys: [Function, Array], "onUpdate:checkedKeys": [Function, Array], onUpdateSelectedKeys: [Function, Array], "onUpdate:selectedKeys": [Function, Array] }), treeSharedProps), {
|
|
1579
|
-
// internal props for tree-select
|
|
1580
|
-
internalTreeSelect: Boolean,
|
|
1581
|
-
internalScrollable: Boolean,
|
|
1582
|
-
internalScrollablePadding: String,
|
|
1583
|
-
// use it to display
|
|
1584
|
-
internalRenderEmpty: Function,
|
|
1585
|
-
internalHighlightKeySet: Object,
|
|
1586
|
-
internalUnifySelectCheck: Boolean,
|
|
1587
|
-
internalCheckboxFocusable: {
|
|
1588
|
-
type: Boolean,
|
|
1589
|
-
default: true
|
|
1590
|
-
},
|
|
1591
|
-
internalFocusable: {
|
|
1592
|
-
// Make tree-select take over keyboard operations
|
|
1593
|
-
type: Boolean,
|
|
1594
|
-
default: true
|
|
1595
|
-
},
|
|
1596
|
-
checkStrategy: {
|
|
1597
|
-
type: String,
|
|
1598
|
-
default: "all"
|
|
1599
|
-
},
|
|
1600
|
-
/**
|
|
1601
|
-
* @deprecated
|
|
1602
|
-
*/
|
|
1603
|
-
leafOnly: Boolean
|
|
1604
|
-
});
|
|
1605
|
-
const NTree = defineComponent({
|
|
1606
|
-
name: "Tree",
|
|
1607
|
-
props: treeProps,
|
|
1608
|
-
setup(props) {
|
|
1609
|
-
const { mergedClsPrefixRef, inlineThemeDisabled, mergedRtlRef } = useConfig(props);
|
|
1610
|
-
const rtlEnabledRef = useRtl("Tree", mergedRtlRef, mergedClsPrefixRef);
|
|
1611
|
-
const themeRef = useTheme("Tree", "-tree", style, treeLight$1, props, mergedClsPrefixRef);
|
|
1612
|
-
const selfElRef = ref(null);
|
|
1613
|
-
const scrollbarInstRef = ref(null);
|
|
1614
|
-
const virtualListInstRef = ref(null);
|
|
1615
|
-
function getScrollContainer() {
|
|
1616
|
-
var _a;
|
|
1617
|
-
return (_a = virtualListInstRef.value) === null || _a === void 0 ? void 0 : _a.listElRef;
|
|
1618
|
-
}
|
|
1619
|
-
function getScrollContent() {
|
|
1620
|
-
var _a;
|
|
1621
|
-
return (_a = virtualListInstRef.value) === null || _a === void 0 ? void 0 : _a.itemsElRef;
|
|
1622
|
-
}
|
|
1623
|
-
const mergedFilterRef = computed(() => {
|
|
1624
|
-
const { filter } = props;
|
|
1625
|
-
if (filter)
|
|
1626
|
-
return filter;
|
|
1627
|
-
const { labelField } = props;
|
|
1628
|
-
return (pattern, node) => {
|
|
1629
|
-
if (!pattern.length)
|
|
1630
|
-
return true;
|
|
1631
|
-
const label = node[labelField];
|
|
1632
|
-
if (typeof label === "string") {
|
|
1633
|
-
return label.toLowerCase().includes(pattern.toLowerCase());
|
|
1634
|
-
}
|
|
1635
|
-
return false;
|
|
1636
|
-
};
|
|
1637
|
-
});
|
|
1638
|
-
const filteredTreeInfoRef = computed(() => {
|
|
1639
|
-
const { pattern } = props;
|
|
1640
|
-
if (!pattern) {
|
|
1641
|
-
return {
|
|
1642
|
-
filteredTree: props.data,
|
|
1643
|
-
highlightKeySet: null,
|
|
1644
|
-
expandedKeys: void 0
|
|
1645
|
-
};
|
|
1646
|
-
}
|
|
1647
|
-
if (!pattern.length || !mergedFilterRef.value) {
|
|
1648
|
-
return {
|
|
1649
|
-
filteredTree: props.data,
|
|
1650
|
-
highlightKeySet: null,
|
|
1651
|
-
expandedKeys: void 0
|
|
1652
|
-
};
|
|
1653
|
-
}
|
|
1654
|
-
return filterTree(props.data, mergedFilterRef.value, pattern, props.keyField, props.childrenField);
|
|
1655
|
-
});
|
|
1656
|
-
const displayTreeMateRef = computed(() => createTreeMate(props.showIrrelevantNodes ? props.data : filteredTreeInfoRef.value.filteredTree, createTreeMateOptions(props.keyField, props.childrenField, props.disabledField, props.getChildren)));
|
|
1657
|
-
const treeSelectInjection = inject(treeSelectInjectionKey, null);
|
|
1658
|
-
const dataTreeMateRef = props.internalTreeSelect ? treeSelectInjection.dataTreeMate : displayTreeMateRef;
|
|
1659
|
-
const { watchProps } = props;
|
|
1660
|
-
const uncontrolledCheckedKeysRef = ref([]);
|
|
1661
|
-
if (watchProps === null || watchProps === void 0 ? void 0 : watchProps.includes("defaultCheckedKeys")) {
|
|
1662
|
-
watchEffect(() => {
|
|
1663
|
-
uncontrolledCheckedKeysRef.value = props.defaultCheckedKeys;
|
|
1664
|
-
});
|
|
1665
|
-
} else {
|
|
1666
|
-
uncontrolledCheckedKeysRef.value = props.defaultCheckedKeys;
|
|
1667
|
-
}
|
|
1668
|
-
const controlledCheckedKeysRef = toRef(props, "checkedKeys");
|
|
1669
|
-
const mergedCheckedKeysRef = useMergedState(controlledCheckedKeysRef, uncontrolledCheckedKeysRef);
|
|
1670
|
-
const checkedStatusRef = computed(() => {
|
|
1671
|
-
const value = dataTreeMateRef.value.getCheckedKeys(mergedCheckedKeysRef.value, {
|
|
1672
|
-
cascade: props.cascade,
|
|
1673
|
-
allowNotLoaded: props.allowCheckingNotLoaded
|
|
1674
|
-
});
|
|
1675
|
-
return value;
|
|
1676
|
-
});
|
|
1677
|
-
const mergedCheckStrategyRef = useMergedCheckStrategy(props);
|
|
1678
|
-
const displayedCheckedKeysRef = computed(() => {
|
|
1679
|
-
return checkedStatusRef.value.checkedKeys;
|
|
1680
|
-
});
|
|
1681
|
-
const displayedIndeterminateKeysRef = computed(() => {
|
|
1682
|
-
const { indeterminateKeys } = props;
|
|
1683
|
-
if (indeterminateKeys !== void 0)
|
|
1684
|
-
return indeterminateKeys;
|
|
1685
|
-
return checkedStatusRef.value.indeterminateKeys;
|
|
1686
|
-
});
|
|
1687
|
-
const uncontrolledSelectedKeysRef = ref([]);
|
|
1688
|
-
if (watchProps === null || watchProps === void 0 ? void 0 : watchProps.includes("defaultSelectedKeys")) {
|
|
1689
|
-
watchEffect(() => {
|
|
1690
|
-
uncontrolledSelectedKeysRef.value = props.defaultSelectedKeys;
|
|
1691
|
-
});
|
|
1692
|
-
} else {
|
|
1693
|
-
uncontrolledSelectedKeysRef.value = props.defaultSelectedKeys;
|
|
1694
|
-
}
|
|
1695
|
-
const controlledSelectedKeysRef = toRef(props, "selectedKeys");
|
|
1696
|
-
const mergedSelectedKeysRef = useMergedState(controlledSelectedKeysRef, uncontrolledSelectedKeysRef);
|
|
1697
|
-
const uncontrolledExpandedKeysRef = ref([]);
|
|
1698
|
-
const initUncontrolledExpandedKeys = (keys) => {
|
|
1699
|
-
uncontrolledExpandedKeysRef.value = props.defaultExpandAll ? dataTreeMateRef.value.getNonLeafKeys() : keys === void 0 ? props.defaultExpandedKeys : keys;
|
|
1700
|
-
};
|
|
1701
|
-
if (watchProps === null || watchProps === void 0 ? void 0 : watchProps.includes("defaultExpandedKeys")) {
|
|
1702
|
-
watchEffect(() => {
|
|
1703
|
-
initUncontrolledExpandedKeys(void 0);
|
|
1704
|
-
});
|
|
1705
|
-
} else {
|
|
1706
|
-
watchEffect(() => {
|
|
1707
|
-
initUncontrolledExpandedKeys(props.defaultExpandedKeys);
|
|
1708
|
-
});
|
|
1709
|
-
}
|
|
1710
|
-
const controlledExpandedKeysRef = toRef(props, "expandedKeys");
|
|
1711
|
-
const mergedExpandedKeysRef = useMergedState(controlledExpandedKeysRef, uncontrolledExpandedKeysRef);
|
|
1712
|
-
const fNodesRef = computed(() => displayTreeMateRef.value.getFlattenedNodes(mergedExpandedKeysRef.value));
|
|
1713
|
-
const { pendingNodeKeyRef, handleKeydown } = useKeyboard({
|
|
1714
|
-
props,
|
|
1715
|
-
mergedSelectedKeysRef,
|
|
1716
|
-
fNodesRef,
|
|
1717
|
-
mergedExpandedKeysRef,
|
|
1718
|
-
handleSelect,
|
|
1719
|
-
handleSwitcherClick
|
|
1720
|
-
});
|
|
1721
|
-
let expandTimerId = null;
|
|
1722
|
-
let nodeKeyToBeExpanded = null;
|
|
1723
|
-
const uncontrolledHighlightKeySetRef = ref(/* @__PURE__ */ new Set());
|
|
1724
|
-
const controlledHighlightKeySetRef = computed(() => {
|
|
1725
|
-
return props.internalHighlightKeySet || filteredTreeInfoRef.value.highlightKeySet;
|
|
1726
|
-
});
|
|
1727
|
-
const mergedHighlightKeySetRef = useMergedState(controlledHighlightKeySetRef, uncontrolledHighlightKeySetRef);
|
|
1728
|
-
const loadingKeysRef = ref(/* @__PURE__ */ new Set());
|
|
1729
|
-
const expandedNonLoadingKeysRef = computed(() => {
|
|
1730
|
-
return mergedExpandedKeysRef.value.filter((key) => !loadingKeysRef.value.has(key));
|
|
1731
|
-
});
|
|
1732
|
-
let dragStartX = 0;
|
|
1733
|
-
const draggingNodeRef = ref(null);
|
|
1734
|
-
const droppingNodeRef = ref(null);
|
|
1735
|
-
const droppingMouseNodeRef = ref(null);
|
|
1736
|
-
const droppingPositionRef = ref(null);
|
|
1737
|
-
const droppingOffsetLevelRef = ref(0);
|
|
1738
|
-
const droppingNodeParentRef = computed(() => {
|
|
1739
|
-
const { value: droppingNode } = droppingNodeRef;
|
|
1740
|
-
if (!droppingNode)
|
|
1741
|
-
return null;
|
|
1742
|
-
return droppingNode.parent;
|
|
1743
|
-
});
|
|
1744
|
-
watch(toRef(props, "data"), () => {
|
|
1745
|
-
loadingKeysRef.value.clear();
|
|
1746
|
-
pendingNodeKeyRef.value = null;
|
|
1747
|
-
resetDndState();
|
|
1748
|
-
}, {
|
|
1749
|
-
deep: false
|
|
1750
|
-
});
|
|
1751
|
-
let expandAnimationDisabled = false;
|
|
1752
|
-
const disableExpandAnimationForOneTick = () => {
|
|
1753
|
-
expandAnimationDisabled = true;
|
|
1754
|
-
void nextTick(() => {
|
|
1755
|
-
expandAnimationDisabled = false;
|
|
1756
|
-
});
|
|
1757
|
-
};
|
|
1758
|
-
let memoizedExpandedKeys;
|
|
1759
|
-
watch(toRef(props, "pattern"), (value, oldValue) => {
|
|
1760
|
-
if (props.showIrrelevantNodes) {
|
|
1761
|
-
memoizedExpandedKeys = void 0;
|
|
1762
|
-
if (value) {
|
|
1763
|
-
const { expandedKeys: expandedKeysAfterChange, highlightKeySet } = keysWithFilter(props.data, props.pattern, props.keyField, props.childrenField, mergedFilterRef.value);
|
|
1764
|
-
uncontrolledHighlightKeySetRef.value = highlightKeySet;
|
|
1765
|
-
disableExpandAnimationForOneTick();
|
|
1766
|
-
doUpdateExpandedKeys(expandedKeysAfterChange, getOptionsByKeys(expandedKeysAfterChange), { node: null, action: "filter" });
|
|
1767
|
-
} else {
|
|
1768
|
-
uncontrolledHighlightKeySetRef.value = /* @__PURE__ */ new Set();
|
|
1769
|
-
}
|
|
1770
|
-
} else {
|
|
1771
|
-
if (!value.length) {
|
|
1772
|
-
if (memoizedExpandedKeys !== void 0) {
|
|
1773
|
-
disableExpandAnimationForOneTick();
|
|
1774
|
-
doUpdateExpandedKeys(memoizedExpandedKeys, getOptionsByKeys(memoizedExpandedKeys), { node: null, action: "filter" });
|
|
1775
|
-
}
|
|
1776
|
-
} else {
|
|
1777
|
-
if (!oldValue.length) {
|
|
1778
|
-
memoizedExpandedKeys = mergedExpandedKeysRef.value;
|
|
1779
|
-
}
|
|
1780
|
-
const { expandedKeys } = filteredTreeInfoRef.value;
|
|
1781
|
-
if (expandedKeys !== void 0) {
|
|
1782
|
-
disableExpandAnimationForOneTick();
|
|
1783
|
-
doUpdateExpandedKeys(expandedKeys, getOptionsByKeys(expandedKeys), {
|
|
1784
|
-
node: null,
|
|
1785
|
-
action: "filter"
|
|
1786
|
-
});
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
});
|
|
1791
|
-
function triggerLoading(node) {
|
|
1792
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1793
|
-
const { onLoad } = props;
|
|
1794
|
-
if (!onLoad) {
|
|
1795
|
-
yield Promise.resolve();
|
|
1796
|
-
return;
|
|
1797
|
-
}
|
|
1798
|
-
const { value: loadingKeys } = loadingKeysRef;
|
|
1799
|
-
if (!loadingKeys.has(node.key)) {
|
|
1800
|
-
loadingKeys.add(node.key);
|
|
1801
|
-
try {
|
|
1802
|
-
const loadResult = yield onLoad(node.rawNode);
|
|
1803
|
-
if (loadResult === false) {
|
|
1804
|
-
resetDragExpandState();
|
|
1805
|
-
}
|
|
1806
|
-
} catch (loadError) {
|
|
1807
|
-
console.error(loadError);
|
|
1808
|
-
resetDragExpandState();
|
|
1809
|
-
}
|
|
1810
|
-
loadingKeys.delete(node.key);
|
|
1811
|
-
}
|
|
1812
|
-
});
|
|
1813
|
-
}
|
|
1814
|
-
watchEffect(() => {
|
|
1815
|
-
var _a;
|
|
1816
|
-
const { value: displayTreeMate } = displayTreeMateRef;
|
|
1817
|
-
if (!displayTreeMate)
|
|
1818
|
-
return;
|
|
1819
|
-
const { getNode } = displayTreeMate;
|
|
1820
|
-
(_a = mergedExpandedKeysRef.value) === null || _a === void 0 ? void 0 : _a.forEach((key) => {
|
|
1821
|
-
const node = getNode(key);
|
|
1822
|
-
if (node && !node.shallowLoaded) {
|
|
1823
|
-
void triggerLoading(node);
|
|
1824
|
-
}
|
|
1825
|
-
});
|
|
1826
|
-
});
|
|
1827
|
-
const aipRef = ref(false);
|
|
1828
|
-
const afNodesRef = ref([]);
|
|
1829
|
-
watch(expandedNonLoadingKeysRef, (value, prevValue) => {
|
|
1830
|
-
if (!props.animated || expandAnimationDisabled) {
|
|
1831
|
-
void nextTick(syncScrollbar);
|
|
1832
|
-
return;
|
|
1833
|
-
}
|
|
1834
|
-
const nodeHeight = depx(themeRef.value.self.nodeHeight);
|
|
1835
|
-
const prevVSet = new Set(prevValue);
|
|
1836
|
-
let addedKey = null;
|
|
1837
|
-
let removedKey = null;
|
|
1838
|
-
for (const expandedKey of value) {
|
|
1839
|
-
if (!prevVSet.has(expandedKey)) {
|
|
1840
|
-
if (addedKey !== null)
|
|
1841
|
-
return;
|
|
1842
|
-
addedKey = expandedKey;
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
const currentVSet = new Set(value);
|
|
1846
|
-
for (const expandedKey of prevValue) {
|
|
1847
|
-
if (!currentVSet.has(expandedKey)) {
|
|
1848
|
-
if (removedKey !== null)
|
|
1849
|
-
return;
|
|
1850
|
-
removedKey = expandedKey;
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1853
|
-
if (addedKey === null && removedKey === null) {
|
|
1854
|
-
return;
|
|
1855
|
-
}
|
|
1856
|
-
const { virtualScroll } = props;
|
|
1857
|
-
const viewportHeight = (virtualScroll ? virtualListInstRef.value.listElRef : selfElRef.value).offsetHeight;
|
|
1858
|
-
const viewportItemCount = Math.ceil(viewportHeight / nodeHeight) + 1;
|
|
1859
|
-
let baseExpandedKeys;
|
|
1860
|
-
if (addedKey !== null) {
|
|
1861
|
-
baseExpandedKeys = prevValue;
|
|
1862
|
-
}
|
|
1863
|
-
if (removedKey !== null) {
|
|
1864
|
-
if (baseExpandedKeys === void 0) {
|
|
1865
|
-
baseExpandedKeys = value;
|
|
1866
|
-
} else {
|
|
1867
|
-
baseExpandedKeys = baseExpandedKeys.filter((key) => key !== removedKey);
|
|
1868
|
-
}
|
|
1869
|
-
}
|
|
1870
|
-
aipRef.value = true;
|
|
1871
|
-
afNodesRef.value = displayTreeMateRef.value.getFlattenedNodes(baseExpandedKeys);
|
|
1872
|
-
if (addedKey !== null) {
|
|
1873
|
-
const expandedNodeIndex = afNodesRef.value.findIndex((node) => node.key === addedKey);
|
|
1874
|
-
if (~expandedNodeIndex) {
|
|
1875
|
-
const children = (
|
|
1876
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1877
|
-
afNodesRef.value[expandedNodeIndex].children
|
|
1878
|
-
);
|
|
1879
|
-
if (children) {
|
|
1880
|
-
const expandedChildren = flatten(children, value);
|
|
1881
|
-
afNodesRef.value.splice(expandedNodeIndex + 1, 0, {
|
|
1882
|
-
__motion: true,
|
|
1883
|
-
mode: "expand",
|
|
1884
|
-
height: virtualScroll ? expandedChildren.length * nodeHeight : void 0,
|
|
1885
|
-
nodes: virtualScroll ? expandedChildren.slice(0, viewportItemCount) : expandedChildren
|
|
1886
|
-
});
|
|
1887
|
-
}
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
if (removedKey !== null) {
|
|
1891
|
-
const collapsedNodeIndex = afNodesRef.value.findIndex((node) => node.key === removedKey);
|
|
1892
|
-
if (~collapsedNodeIndex) {
|
|
1893
|
-
const collapsedNodeChildren = afNodesRef.value[collapsedNodeIndex].children;
|
|
1894
|
-
if (!collapsedNodeChildren)
|
|
1895
|
-
return;
|
|
1896
|
-
aipRef.value = true;
|
|
1897
|
-
const collapsedChildren = flatten(collapsedNodeChildren, value);
|
|
1898
|
-
afNodesRef.value.splice(collapsedNodeIndex + 1, 0, {
|
|
1899
|
-
__motion: true,
|
|
1900
|
-
mode: "collapse",
|
|
1901
|
-
height: virtualScroll ? collapsedChildren.length * nodeHeight : void 0,
|
|
1902
|
-
nodes: virtualScroll ? collapsedChildren.slice(0, viewportItemCount) : collapsedChildren
|
|
1903
|
-
});
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
});
|
|
1907
|
-
const getFIndexRef = computed(() => {
|
|
1908
|
-
return createIndexGetter(fNodesRef.value);
|
|
1909
|
-
});
|
|
1910
|
-
const mergedFNodesRef = computed(() => {
|
|
1911
|
-
if (aipRef.value)
|
|
1912
|
-
return afNodesRef.value;
|
|
1913
|
-
else
|
|
1914
|
-
return fNodesRef.value;
|
|
1915
|
-
});
|
|
1916
|
-
function syncScrollbar() {
|
|
1917
|
-
const { value: scrollbarInst } = scrollbarInstRef;
|
|
1918
|
-
if (scrollbarInst)
|
|
1919
|
-
scrollbarInst.sync();
|
|
1920
|
-
}
|
|
1921
|
-
function handleAfterEnter() {
|
|
1922
|
-
aipRef.value = false;
|
|
1923
|
-
if (props.virtualScroll) {
|
|
1924
|
-
void nextTick(syncScrollbar);
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
function getOptionsByKeys(keys) {
|
|
1928
|
-
const { getNode } = dataTreeMateRef.value;
|
|
1929
|
-
return keys.map((key) => {
|
|
1930
|
-
var _a;
|
|
1931
|
-
return ((_a = getNode(key)) === null || _a === void 0 ? void 0 : _a.rawNode) || null;
|
|
1932
|
-
});
|
|
1933
|
-
}
|
|
1934
|
-
function doUpdateExpandedKeys(value, option, meta) {
|
|
1935
|
-
const { "onUpdate:expandedKeys": _onUpdateExpandedKeys, onUpdateExpandedKeys } = props;
|
|
1936
|
-
uncontrolledExpandedKeysRef.value = value;
|
|
1937
|
-
if (_onUpdateExpandedKeys) {
|
|
1938
|
-
call(_onUpdateExpandedKeys, value, option, meta);
|
|
1939
|
-
}
|
|
1940
|
-
if (onUpdateExpandedKeys) {
|
|
1941
|
-
call(onUpdateExpandedKeys, value, option, meta);
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
function doUpdateCheckedKeys(value, option, meta) {
|
|
1945
|
-
const { "onUpdate:checkedKeys": _onUpdateCheckedKeys, onUpdateCheckedKeys } = props;
|
|
1946
|
-
uncontrolledCheckedKeysRef.value = value;
|
|
1947
|
-
if (onUpdateCheckedKeys) {
|
|
1948
|
-
call(onUpdateCheckedKeys, value, option, meta);
|
|
1949
|
-
}
|
|
1950
|
-
if (_onUpdateCheckedKeys) {
|
|
1951
|
-
call(_onUpdateCheckedKeys, value, option, meta);
|
|
1952
|
-
}
|
|
1953
|
-
}
|
|
1954
|
-
function doUpdateIndeterminateKeys(value, option) {
|
|
1955
|
-
const { "onUpdate:indeterminateKeys": _onUpdateIndeterminateKeys, onUpdateIndeterminateKeys } = props;
|
|
1956
|
-
if (_onUpdateIndeterminateKeys) {
|
|
1957
|
-
call(_onUpdateIndeterminateKeys, value, option);
|
|
1958
|
-
}
|
|
1959
|
-
if (onUpdateIndeterminateKeys) {
|
|
1960
|
-
call(onUpdateIndeterminateKeys, value, option);
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
function doUpdateSelectedKeys(value, option, meta) {
|
|
1964
|
-
const { "onUpdate:selectedKeys": _onUpdateSelectedKeys, onUpdateSelectedKeys } = props;
|
|
1965
|
-
uncontrolledSelectedKeysRef.value = value;
|
|
1966
|
-
if (onUpdateSelectedKeys) {
|
|
1967
|
-
call(onUpdateSelectedKeys, value, option, meta);
|
|
1968
|
-
}
|
|
1969
|
-
if (_onUpdateSelectedKeys) {
|
|
1970
|
-
call(_onUpdateSelectedKeys, value, option, meta);
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1973
|
-
function doDragEnter(info) {
|
|
1974
|
-
const { onDragenter } = props;
|
|
1975
|
-
if (onDragenter)
|
|
1976
|
-
call(onDragenter, info);
|
|
1977
|
-
}
|
|
1978
|
-
function doDragLeave(info) {
|
|
1979
|
-
const { onDragleave } = props;
|
|
1980
|
-
if (onDragleave)
|
|
1981
|
-
call(onDragleave, info);
|
|
1982
|
-
}
|
|
1983
|
-
function doDragEnd(info) {
|
|
1984
|
-
const { onDragend } = props;
|
|
1985
|
-
if (onDragend)
|
|
1986
|
-
call(onDragend, info);
|
|
1987
|
-
}
|
|
1988
|
-
function doDragStart(info) {
|
|
1989
|
-
const { onDragstart } = props;
|
|
1990
|
-
if (onDragstart)
|
|
1991
|
-
call(onDragstart, info);
|
|
1992
|
-
}
|
|
1993
|
-
function doDragOver(info) {
|
|
1994
|
-
const { onDragover } = props;
|
|
1995
|
-
if (onDragover)
|
|
1996
|
-
call(onDragover, info);
|
|
1997
|
-
}
|
|
1998
|
-
function doDrop(info) {
|
|
1999
|
-
const { onDrop } = props;
|
|
2000
|
-
if (onDrop)
|
|
2001
|
-
call(onDrop, info);
|
|
2002
|
-
}
|
|
2003
|
-
function resetDndState() {
|
|
2004
|
-
resetDragState();
|
|
2005
|
-
resetDropState();
|
|
2006
|
-
}
|
|
2007
|
-
function resetDragState() {
|
|
2008
|
-
draggingNodeRef.value = null;
|
|
2009
|
-
}
|
|
2010
|
-
function resetDropState() {
|
|
2011
|
-
droppingOffsetLevelRef.value = 0;
|
|
2012
|
-
droppingNodeRef.value = null;
|
|
2013
|
-
droppingMouseNodeRef.value = null;
|
|
2014
|
-
droppingPositionRef.value = null;
|
|
2015
|
-
resetDragExpandState();
|
|
2016
|
-
}
|
|
2017
|
-
function resetDragExpandState() {
|
|
2018
|
-
if (expandTimerId) {
|
|
2019
|
-
window.clearTimeout(expandTimerId);
|
|
2020
|
-
expandTimerId = null;
|
|
2021
|
-
}
|
|
2022
|
-
nodeKeyToBeExpanded = null;
|
|
2023
|
-
}
|
|
2024
|
-
function handleCheck(node, checked) {
|
|
2025
|
-
if (props.disabled || isNodeDisabled(node, props.disabledField)) {
|
|
2026
|
-
return;
|
|
2027
|
-
}
|
|
2028
|
-
if (props.internalUnifySelectCheck && !props.multiple) {
|
|
2029
|
-
handleSelect(node);
|
|
2030
|
-
return;
|
|
2031
|
-
}
|
|
2032
|
-
const checkedAction = checked ? "check" : "uncheck";
|
|
2033
|
-
const { checkedKeys, indeterminateKeys } = dataTreeMateRef.value[checkedAction](node.key, displayedCheckedKeysRef.value, {
|
|
2034
|
-
cascade: props.cascade,
|
|
2035
|
-
checkStrategy: mergedCheckStrategyRef.value,
|
|
2036
|
-
allowNotLoaded: props.allowCheckingNotLoaded
|
|
2037
|
-
});
|
|
2038
|
-
doUpdateCheckedKeys(checkedKeys, getOptionsByKeys(checkedKeys), {
|
|
2039
|
-
node: node.rawNode,
|
|
2040
|
-
action: checkedAction
|
|
2041
|
-
});
|
|
2042
|
-
doUpdateIndeterminateKeys(indeterminateKeys, getOptionsByKeys(indeterminateKeys));
|
|
2043
|
-
}
|
|
2044
|
-
function toggleExpand(node) {
|
|
2045
|
-
if (props.disabled)
|
|
2046
|
-
return;
|
|
2047
|
-
const { key } = node;
|
|
2048
|
-
const { value: mergedExpandedKeys } = mergedExpandedKeysRef;
|
|
2049
|
-
const index = mergedExpandedKeys.findIndex((expandNodeId) => expandNodeId === key);
|
|
2050
|
-
if (~index) {
|
|
2051
|
-
const expandedKeysAfterChange = Array.from(mergedExpandedKeys);
|
|
2052
|
-
expandedKeysAfterChange.splice(index, 1);
|
|
2053
|
-
doUpdateExpandedKeys(expandedKeysAfterChange, getOptionsByKeys(expandedKeysAfterChange), {
|
|
2054
|
-
node: node.rawNode,
|
|
2055
|
-
action: "collapse"
|
|
2056
|
-
});
|
|
2057
|
-
} else {
|
|
2058
|
-
const nodeToBeExpanded = displayTreeMateRef.value.getNode(key);
|
|
2059
|
-
if (!nodeToBeExpanded || nodeToBeExpanded.isLeaf) {
|
|
2060
|
-
return;
|
|
2061
|
-
}
|
|
2062
|
-
let nextKeys;
|
|
2063
|
-
if (props.accordion) {
|
|
2064
|
-
const siblingKeySet = new Set(node.siblings.map(({ key: key2 }) => key2));
|
|
2065
|
-
nextKeys = mergedExpandedKeys.filter((expandedKey) => {
|
|
2066
|
-
return !siblingKeySet.has(expandedKey);
|
|
2067
|
-
});
|
|
2068
|
-
nextKeys.push(key);
|
|
2069
|
-
} else {
|
|
2070
|
-
nextKeys = mergedExpandedKeys.concat(key);
|
|
2071
|
-
}
|
|
2072
|
-
doUpdateExpandedKeys(nextKeys, getOptionsByKeys(nextKeys), {
|
|
2073
|
-
node: node.rawNode,
|
|
2074
|
-
action: "expand"
|
|
2075
|
-
});
|
|
2076
|
-
}
|
|
2077
|
-
}
|
|
2078
|
-
function handleSwitcherClick(node) {
|
|
2079
|
-
if (props.disabled || aipRef.value)
|
|
2080
|
-
return;
|
|
2081
|
-
toggleExpand(node);
|
|
2082
|
-
}
|
|
2083
|
-
function handleSelect(node) {
|
|
2084
|
-
if (props.disabled || !props.selectable) {
|
|
2085
|
-
return;
|
|
2086
|
-
}
|
|
2087
|
-
pendingNodeKeyRef.value = node.key;
|
|
2088
|
-
if (props.internalUnifySelectCheck) {
|
|
2089
|
-
const { value: { checkedKeys, indeterminateKeys } } = checkedStatusRef;
|
|
2090
|
-
if (props.multiple) {
|
|
2091
|
-
handleCheck(node, !(checkedKeys.includes(node.key) || indeterminateKeys.includes(node.key)));
|
|
2092
|
-
} else {
|
|
2093
|
-
doUpdateCheckedKeys([node.key], getOptionsByKeys([node.key]), {
|
|
2094
|
-
node: node.rawNode,
|
|
2095
|
-
action: "check"
|
|
2096
|
-
});
|
|
2097
|
-
}
|
|
2098
|
-
}
|
|
2099
|
-
if (props.multiple) {
|
|
2100
|
-
const selectedKeys = Array.from(mergedSelectedKeysRef.value);
|
|
2101
|
-
const index = selectedKeys.findIndex((key) => key === node.key);
|
|
2102
|
-
if (~index) {
|
|
2103
|
-
if (props.cancelable) {
|
|
2104
|
-
selectedKeys.splice(index, 1);
|
|
2105
|
-
}
|
|
2106
|
-
} else if (!~index) {
|
|
2107
|
-
selectedKeys.push(node.key);
|
|
2108
|
-
}
|
|
2109
|
-
doUpdateSelectedKeys(selectedKeys, getOptionsByKeys(selectedKeys), {
|
|
2110
|
-
node: node.rawNode,
|
|
2111
|
-
action: ~index ? "unselect" : "select"
|
|
2112
|
-
});
|
|
2113
|
-
} else {
|
|
2114
|
-
const selectedKeys = mergedSelectedKeysRef.value;
|
|
2115
|
-
if (selectedKeys.includes(node.key)) {
|
|
2116
|
-
if (props.cancelable) {
|
|
2117
|
-
doUpdateSelectedKeys([], [], {
|
|
2118
|
-
node: node.rawNode,
|
|
2119
|
-
action: "unselect"
|
|
2120
|
-
});
|
|
2121
|
-
}
|
|
2122
|
-
} else {
|
|
2123
|
-
doUpdateSelectedKeys([node.key], getOptionsByKeys([node.key]), {
|
|
2124
|
-
node: node.rawNode,
|
|
2125
|
-
action: "select"
|
|
2126
|
-
});
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
function expandDragEnterNode(node) {
|
|
2131
|
-
if (expandTimerId) {
|
|
2132
|
-
window.clearTimeout(expandTimerId);
|
|
2133
|
-
expandTimerId = null;
|
|
2134
|
-
}
|
|
2135
|
-
if (node.isLeaf)
|
|
2136
|
-
return;
|
|
2137
|
-
nodeKeyToBeExpanded = node.key;
|
|
2138
|
-
const expand = () => {
|
|
2139
|
-
if (nodeKeyToBeExpanded !== node.key)
|
|
2140
|
-
return;
|
|
2141
|
-
const { value: droppingMouseNode } = droppingMouseNodeRef;
|
|
2142
|
-
if (droppingMouseNode && droppingMouseNode.key === node.key && !mergedExpandedKeysRef.value.includes(node.key)) {
|
|
2143
|
-
const nextKeys = mergedExpandedKeysRef.value.concat(node.key);
|
|
2144
|
-
doUpdateExpandedKeys(nextKeys, getOptionsByKeys(nextKeys), {
|
|
2145
|
-
node: node.rawNode,
|
|
2146
|
-
action: "expand"
|
|
2147
|
-
});
|
|
2148
|
-
}
|
|
2149
|
-
expandTimerId = null;
|
|
2150
|
-
nodeKeyToBeExpanded = null;
|
|
2151
|
-
};
|
|
2152
|
-
if (!node.shallowLoaded) {
|
|
2153
|
-
expandTimerId = window.setTimeout(() => {
|
|
2154
|
-
void triggerLoading(node).then(() => {
|
|
2155
|
-
expand();
|
|
2156
|
-
});
|
|
2157
|
-
}, 1e3);
|
|
2158
|
-
} else {
|
|
2159
|
-
expandTimerId = window.setTimeout(() => {
|
|
2160
|
-
expand();
|
|
2161
|
-
}, 1e3);
|
|
2162
|
-
}
|
|
2163
|
-
}
|
|
2164
|
-
function handleDragEnter({ event, node }) {
|
|
2165
|
-
if (!props.draggable || props.disabled || isNodeDisabled(node, props.disabledField)) {
|
|
2166
|
-
return;
|
|
2167
|
-
}
|
|
2168
|
-
handleDragOver({ event, node }, false);
|
|
2169
|
-
doDragEnter({ event, node: node.rawNode });
|
|
2170
|
-
}
|
|
2171
|
-
function handleDragLeave({ event, node }) {
|
|
2172
|
-
if (!props.draggable || props.disabled || isNodeDisabled(node, props.disabledField)) {
|
|
2173
|
-
return;
|
|
2174
|
-
}
|
|
2175
|
-
doDragLeave({ event, node: node.rawNode });
|
|
2176
|
-
}
|
|
2177
|
-
function handleDragLeaveTree(e) {
|
|
2178
|
-
if (e.target !== e.currentTarget)
|
|
2179
|
-
return;
|
|
2180
|
-
resetDropState();
|
|
2181
|
-
}
|
|
2182
|
-
function handleDragEnd({ event, node }) {
|
|
2183
|
-
resetDndState();
|
|
2184
|
-
if (!props.draggable || props.disabled || isNodeDisabled(node, props.disabledField)) {
|
|
2185
|
-
return;
|
|
2186
|
-
}
|
|
2187
|
-
doDragEnd({ event, node: node.rawNode });
|
|
2188
|
-
}
|
|
2189
|
-
function handleDragStart({ event, node }) {
|
|
2190
|
-
if (!props.draggable || props.disabled || isNodeDisabled(node, props.disabledField)) {
|
|
2191
|
-
return;
|
|
2192
|
-
}
|
|
2193
|
-
dragStartX = event.clientX;
|
|
2194
|
-
draggingNodeRef.value = node;
|
|
2195
|
-
doDragStart({ event, node: node.rawNode });
|
|
2196
|
-
}
|
|
2197
|
-
function handleDragOver({ event, node }, emit = true) {
|
|
2198
|
-
var _a;
|
|
2199
|
-
if (!props.draggable || props.disabled || isNodeDisabled(node, props.disabledField)) {
|
|
2200
|
-
return;
|
|
2201
|
-
}
|
|
2202
|
-
const { value: draggingNode } = draggingNodeRef;
|
|
2203
|
-
if (!draggingNode)
|
|
2204
|
-
return;
|
|
2205
|
-
const { allowDrop, indent } = props;
|
|
2206
|
-
if (emit)
|
|
2207
|
-
doDragOver({ event, node: node.rawNode });
|
|
2208
|
-
const el = event.currentTarget;
|
|
2209
|
-
const { height: elOffsetHeight, top: elClientTop } = el.getBoundingClientRect();
|
|
2210
|
-
const eventOffsetY = event.clientY - elClientTop;
|
|
2211
|
-
let mousePosition;
|
|
2212
|
-
const allowDropInside = allowDrop({
|
|
2213
|
-
node: node.rawNode,
|
|
2214
|
-
dropPosition: "inside",
|
|
2215
|
-
phase: "drag"
|
|
2216
|
-
});
|
|
2217
|
-
if (allowDropInside) {
|
|
2218
|
-
if (eventOffsetY <= 8) {
|
|
2219
|
-
mousePosition = "before";
|
|
2220
|
-
} else if (eventOffsetY >= elOffsetHeight - 8) {
|
|
2221
|
-
mousePosition = "after";
|
|
2222
|
-
} else {
|
|
2223
|
-
mousePosition = "inside";
|
|
2224
|
-
}
|
|
2225
|
-
} else {
|
|
2226
|
-
if (eventOffsetY <= elOffsetHeight / 2) {
|
|
2227
|
-
mousePosition = "before";
|
|
2228
|
-
} else {
|
|
2229
|
-
mousePosition = "after";
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
const { value: getFindex } = getFIndexRef;
|
|
2233
|
-
let finalDropNode;
|
|
2234
|
-
let finalDropPosition;
|
|
2235
|
-
const hoverNodeFIndex = getFindex(node.key);
|
|
2236
|
-
if (hoverNodeFIndex === null) {
|
|
2237
|
-
resetDropState();
|
|
2238
|
-
return;
|
|
2239
|
-
}
|
|
2240
|
-
let mouseAtExpandedNonLeafNode = false;
|
|
2241
|
-
if (mousePosition === "inside") {
|
|
2242
|
-
finalDropNode = node;
|
|
2243
|
-
finalDropPosition = "inside";
|
|
2244
|
-
} else {
|
|
2245
|
-
if (mousePosition === "before") {
|
|
2246
|
-
if (node.isFirstChild) {
|
|
2247
|
-
finalDropNode = node;
|
|
2248
|
-
finalDropPosition = "before";
|
|
2249
|
-
} else {
|
|
2250
|
-
finalDropNode = fNodesRef.value[hoverNodeFIndex - 1];
|
|
2251
|
-
finalDropPosition = "after";
|
|
2252
|
-
}
|
|
2253
|
-
} else {
|
|
2254
|
-
finalDropNode = node;
|
|
2255
|
-
finalDropPosition = "after";
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
if (!finalDropNode.isLeaf && mergedExpandedKeysRef.value.includes(finalDropNode.key)) {
|
|
2259
|
-
mouseAtExpandedNonLeafNode = true;
|
|
2260
|
-
if (finalDropPosition === "after") {
|
|
2261
|
-
finalDropNode = fNodesRef.value[hoverNodeFIndex + 1];
|
|
2262
|
-
if (!finalDropNode) {
|
|
2263
|
-
finalDropNode = node;
|
|
2264
|
-
finalDropPosition = "inside";
|
|
2265
|
-
} else {
|
|
2266
|
-
finalDropPosition = "before";
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
const droppingMouseNode = finalDropNode;
|
|
2271
|
-
droppingMouseNodeRef.value = droppingMouseNode;
|
|
2272
|
-
if (!mouseAtExpandedNonLeafNode && draggingNode.isLastChild && draggingNode.key === finalDropNode.key) {
|
|
2273
|
-
finalDropPosition = "after";
|
|
2274
|
-
}
|
|
2275
|
-
if (finalDropPosition === "after") {
|
|
2276
|
-
let offset = dragStartX - event.clientX;
|
|
2277
|
-
let offsetLevel = 0;
|
|
2278
|
-
while (offset >= indent / 2 && // divide by 2 to make it easier to trigger
|
|
2279
|
-
finalDropNode.parent !== null && finalDropNode.isLastChild && offsetLevel < 1) {
|
|
2280
|
-
offset -= indent;
|
|
2281
|
-
offsetLevel += 1;
|
|
2282
|
-
finalDropNode = finalDropNode.parent;
|
|
2283
|
-
}
|
|
2284
|
-
droppingOffsetLevelRef.value = offsetLevel;
|
|
2285
|
-
} else {
|
|
2286
|
-
droppingOffsetLevelRef.value = 0;
|
|
2287
|
-
}
|
|
2288
|
-
if (draggingNode.contains(finalDropNode) || finalDropPosition === "inside" && ((_a = draggingNode.parent) === null || _a === void 0 ? void 0 : _a.key) === finalDropNode.key) {
|
|
2289
|
-
if (draggingNode.key === droppingMouseNode.key && draggingNode.key === finalDropNode.key)
|
|
2290
|
-
;
|
|
2291
|
-
else {
|
|
2292
|
-
resetDropState();
|
|
2293
|
-
return;
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
|
-
if (!allowDrop({
|
|
2297
|
-
node: finalDropNode.rawNode,
|
|
2298
|
-
dropPosition: finalDropPosition,
|
|
2299
|
-
phase: "drag"
|
|
2300
|
-
})) {
|
|
2301
|
-
resetDropState();
|
|
2302
|
-
return;
|
|
2303
|
-
}
|
|
2304
|
-
if (draggingNode.key === finalDropNode.key) {
|
|
2305
|
-
resetDragExpandState();
|
|
2306
|
-
} else {
|
|
2307
|
-
if (nodeKeyToBeExpanded !== finalDropNode.key) {
|
|
2308
|
-
if (finalDropPosition === "inside") {
|
|
2309
|
-
if (props.expandOnDragenter) {
|
|
2310
|
-
expandDragEnterNode(finalDropNode);
|
|
2311
|
-
if (!finalDropNode.shallowLoaded && nodeKeyToBeExpanded !== finalDropNode.key) {
|
|
2312
|
-
resetDndState();
|
|
2313
|
-
return;
|
|
2314
|
-
}
|
|
2315
|
-
} else {
|
|
2316
|
-
if (!finalDropNode.shallowLoaded) {
|
|
2317
|
-
resetDndState();
|
|
2318
|
-
return;
|
|
2319
|
-
}
|
|
2320
|
-
}
|
|
2321
|
-
} else {
|
|
2322
|
-
resetDragExpandState();
|
|
2323
|
-
}
|
|
2324
|
-
} else {
|
|
2325
|
-
if (finalDropPosition !== "inside") {
|
|
2326
|
-
resetDragExpandState();
|
|
2327
|
-
}
|
|
2328
|
-
}
|
|
2329
|
-
}
|
|
2330
|
-
droppingPositionRef.value = finalDropPosition;
|
|
2331
|
-
droppingNodeRef.value = finalDropNode;
|
|
2332
|
-
}
|
|
2333
|
-
function handleDrop({ event, node, dropPosition }) {
|
|
2334
|
-
if (!props.draggable || props.disabled || isNodeDisabled(node, props.disabledField)) {
|
|
2335
|
-
return;
|
|
2336
|
-
}
|
|
2337
|
-
const { value: draggingNode } = draggingNodeRef;
|
|
2338
|
-
const { value: droppingNode } = droppingNodeRef;
|
|
2339
|
-
const { value: droppingPosition } = droppingPositionRef;
|
|
2340
|
-
if (!draggingNode || !droppingNode || !droppingPosition) {
|
|
2341
|
-
return;
|
|
2342
|
-
}
|
|
2343
|
-
if (!props.allowDrop({
|
|
2344
|
-
node: droppingNode.rawNode,
|
|
2345
|
-
dropPosition: droppingPosition,
|
|
2346
|
-
phase: "drag"
|
|
2347
|
-
})) {
|
|
2348
|
-
return;
|
|
2349
|
-
}
|
|
2350
|
-
if (draggingNode.key === droppingNode.key) {
|
|
2351
|
-
return;
|
|
2352
|
-
}
|
|
2353
|
-
if (droppingPosition === "before") {
|
|
2354
|
-
const nextNode = draggingNode.getNext({ includeDisabled: true });
|
|
2355
|
-
if (nextNode) {
|
|
2356
|
-
if (nextNode.key === droppingNode.key) {
|
|
2357
|
-
resetDropState();
|
|
2358
|
-
return;
|
|
2359
|
-
}
|
|
2360
|
-
}
|
|
2361
|
-
}
|
|
2362
|
-
if (droppingPosition === "after") {
|
|
2363
|
-
const prevNode = draggingNode.getPrev({ includeDisabled: true });
|
|
2364
|
-
if (prevNode) {
|
|
2365
|
-
if (prevNode.key === droppingNode.key) {
|
|
2366
|
-
resetDropState();
|
|
2367
|
-
return;
|
|
2368
|
-
}
|
|
2369
|
-
}
|
|
2370
|
-
}
|
|
2371
|
-
doDrop({
|
|
2372
|
-
event,
|
|
2373
|
-
node: droppingNode.rawNode,
|
|
2374
|
-
dragNode: draggingNode.rawNode,
|
|
2375
|
-
dropPosition
|
|
2376
|
-
});
|
|
2377
|
-
resetDndState();
|
|
2378
|
-
}
|
|
2379
|
-
function handleScroll() {
|
|
2380
|
-
syncScrollbar();
|
|
2381
|
-
}
|
|
2382
|
-
function handleResize() {
|
|
2383
|
-
syncScrollbar();
|
|
2384
|
-
}
|
|
2385
|
-
function handleFocusout(e) {
|
|
2386
|
-
var _a;
|
|
2387
|
-
if (props.virtualScroll || props.internalScrollable) {
|
|
2388
|
-
const { value: scrollbarInst } = scrollbarInstRef;
|
|
2389
|
-
if ((_a = scrollbarInst === null || scrollbarInst === void 0 ? void 0 : scrollbarInst.containerRef) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget)) {
|
|
2390
|
-
return;
|
|
2391
|
-
}
|
|
2392
|
-
pendingNodeKeyRef.value = null;
|
|
2393
|
-
} else {
|
|
2394
|
-
const { value: selfEl } = selfElRef;
|
|
2395
|
-
if (selfEl === null || selfEl === void 0 ? void 0 : selfEl.contains(e.relatedTarget))
|
|
2396
|
-
return;
|
|
2397
|
-
pendingNodeKeyRef.value = null;
|
|
2398
|
-
}
|
|
2399
|
-
}
|
|
2400
|
-
watch(pendingNodeKeyRef, (value) => {
|
|
2401
|
-
var _a, _b;
|
|
2402
|
-
if (value === null)
|
|
2403
|
-
return;
|
|
2404
|
-
if (props.virtualScroll) {
|
|
2405
|
-
(_a = virtualListInstRef.value) === null || _a === void 0 ? void 0 : _a.scrollTo({ key: value });
|
|
2406
|
-
} else if (props.internalScrollable) {
|
|
2407
|
-
const { value: scrollbarInst } = scrollbarInstRef;
|
|
2408
|
-
if (scrollbarInst === null)
|
|
2409
|
-
return;
|
|
2410
|
-
const targetEl = (_b = scrollbarInst.contentRef) === null || _b === void 0 ? void 0 : _b.querySelector(`[data-key="${createDataKey(value)}"]`);
|
|
2411
|
-
if (!targetEl)
|
|
2412
|
-
return;
|
|
2413
|
-
scrollbarInst.scrollTo({
|
|
2414
|
-
el: targetEl
|
|
2415
|
-
});
|
|
2416
|
-
}
|
|
2417
|
-
});
|
|
2418
|
-
provide(treeInjectionKey, {
|
|
2419
|
-
loadingKeysRef,
|
|
2420
|
-
highlightKeySetRef: mergedHighlightKeySetRef,
|
|
2421
|
-
displayedCheckedKeysRef,
|
|
2422
|
-
displayedIndeterminateKeysRef,
|
|
2423
|
-
mergedSelectedKeysRef,
|
|
2424
|
-
mergedExpandedKeysRef,
|
|
2425
|
-
mergedThemeRef: themeRef,
|
|
2426
|
-
mergedCheckStrategyRef,
|
|
2427
|
-
nodePropsRef: toRef(props, "nodeProps"),
|
|
2428
|
-
disabledRef: toRef(props, "disabled"),
|
|
2429
|
-
checkableRef: toRef(props, "checkable"),
|
|
2430
|
-
selectableRef: toRef(props, "selectable"),
|
|
2431
|
-
expandOnClickRef: toRef(props, "expandOnClick"),
|
|
2432
|
-
onLoadRef: toRef(props, "onLoad"),
|
|
2433
|
-
draggableRef: toRef(props, "draggable"),
|
|
2434
|
-
blockLineRef: toRef(props, "blockLine"),
|
|
2435
|
-
indentRef: toRef(props, "indent"),
|
|
2436
|
-
cascadeRef: toRef(props, "cascade"),
|
|
2437
|
-
checkOnClickRef: toRef(props, "checkOnClick"),
|
|
2438
|
-
checkboxPlacementRef: props.checkboxPlacement,
|
|
2439
|
-
droppingMouseNodeRef,
|
|
2440
|
-
droppingNodeParentRef,
|
|
2441
|
-
draggingNodeRef,
|
|
2442
|
-
droppingPositionRef,
|
|
2443
|
-
droppingOffsetLevelRef,
|
|
2444
|
-
fNodesRef,
|
|
2445
|
-
pendingNodeKeyRef,
|
|
2446
|
-
showLineRef: toRef(props, "showLine"),
|
|
2447
|
-
disabledFieldRef: toRef(props, "disabledField"),
|
|
2448
|
-
internalScrollableRef: toRef(props, "internalScrollable"),
|
|
2449
|
-
internalCheckboxFocusableRef: toRef(props, "internalCheckboxFocusable"),
|
|
2450
|
-
internalTreeSelect: props.internalTreeSelect,
|
|
2451
|
-
renderLabelRef: toRef(props, "renderLabel"),
|
|
2452
|
-
renderPrefixRef: toRef(props, "renderPrefix"),
|
|
2453
|
-
renderSuffixRef: toRef(props, "renderSuffix"),
|
|
2454
|
-
renderSwitcherIconRef: toRef(props, "renderSwitcherIcon"),
|
|
2455
|
-
labelFieldRef: toRef(props, "labelField"),
|
|
2456
|
-
multipleRef: toRef(props, "multiple"),
|
|
2457
|
-
handleSwitcherClick,
|
|
2458
|
-
handleDragEnd,
|
|
2459
|
-
handleDragEnter,
|
|
2460
|
-
handleDragLeave,
|
|
2461
|
-
handleDragStart,
|
|
2462
|
-
handleDrop,
|
|
2463
|
-
handleDragOver,
|
|
2464
|
-
handleSelect,
|
|
2465
|
-
handleCheck
|
|
2466
|
-
});
|
|
2467
|
-
function scrollTo(options) {
|
|
2468
|
-
var _a;
|
|
2469
|
-
(_a = virtualListInstRef.value) === null || _a === void 0 ? void 0 : _a.scrollTo(options);
|
|
2470
|
-
}
|
|
2471
|
-
const exposedMethods = {
|
|
2472
|
-
handleKeydown,
|
|
2473
|
-
scrollTo,
|
|
2474
|
-
getCheckedData: () => {
|
|
2475
|
-
if (!props.checkable)
|
|
2476
|
-
return { keys: [], options: [] };
|
|
2477
|
-
const { checkedKeys } = checkedStatusRef.value;
|
|
2478
|
-
return {
|
|
2479
|
-
keys: checkedKeys,
|
|
2480
|
-
options: getOptionsByKeys(checkedKeys)
|
|
2481
|
-
};
|
|
2482
|
-
},
|
|
2483
|
-
getIndeterminateData: () => {
|
|
2484
|
-
if (!props.checkable)
|
|
2485
|
-
return { keys: [], options: [] };
|
|
2486
|
-
const { indeterminateKeys } = checkedStatusRef.value;
|
|
2487
|
-
return {
|
|
2488
|
-
keys: indeterminateKeys,
|
|
2489
|
-
options: getOptionsByKeys(indeterminateKeys)
|
|
2490
|
-
};
|
|
2491
|
-
}
|
|
2492
|
-
};
|
|
2493
|
-
const cssVarsRef = computed(() => {
|
|
2494
|
-
const { common: { cubicBezierEaseInOut }, self: { fontSize, nodeBorderRadius, nodeColorHover, nodeColorPressed, nodeColorActive, arrowColor, loadingColor, nodeTextColor, nodeTextColorDisabled, dropMarkColor, nodeWrapperPadding, nodeHeight, lineHeight } } = themeRef.value;
|
|
2495
|
-
const lineOffsetTop = getMargin(nodeWrapperPadding, "top");
|
|
2496
|
-
const lineOffsetBottom = getMargin(nodeWrapperPadding, "bottom");
|
|
2497
|
-
const nodeContentHeight = pxfy(depx(nodeHeight) - depx(lineOffsetTop) - depx(lineOffsetBottom));
|
|
2498
|
-
return {
|
|
2499
|
-
"--n-arrow-color": arrowColor,
|
|
2500
|
-
"--n-loading-color": loadingColor,
|
|
2501
|
-
"--n-bezier": cubicBezierEaseInOut,
|
|
2502
|
-
"--n-font-size": fontSize,
|
|
2503
|
-
"--n-node-border-radius": nodeBorderRadius,
|
|
2504
|
-
"--n-node-color-active": nodeColorActive,
|
|
2505
|
-
"--n-node-color-hover": nodeColorHover,
|
|
2506
|
-
"--n-node-color-pressed": nodeColorPressed,
|
|
2507
|
-
"--n-node-text-color": nodeTextColor,
|
|
2508
|
-
"--n-node-text-color-disabled": nodeTextColorDisabled,
|
|
2509
|
-
"--n-drop-mark-color": dropMarkColor,
|
|
2510
|
-
"--n-node-wrapper-padding": nodeWrapperPadding,
|
|
2511
|
-
"--n-line-offset-top": `-${lineOffsetTop}`,
|
|
2512
|
-
"--n-line-offset-bottom": `-${lineOffsetBottom}`,
|
|
2513
|
-
"--n-node-content-height": nodeContentHeight,
|
|
2514
|
-
"--n-line-height": lineHeight
|
|
2515
|
-
};
|
|
2516
|
-
});
|
|
2517
|
-
const themeClassHandle = inlineThemeDisabled ? useThemeClass("tree", void 0, cssVarsRef, props) : void 0;
|
|
2518
|
-
return Object.assign(Object.assign({}, exposedMethods), {
|
|
2519
|
-
mergedClsPrefix: mergedClsPrefixRef,
|
|
2520
|
-
mergedTheme: themeRef,
|
|
2521
|
-
rtlEnabled: rtlEnabledRef,
|
|
2522
|
-
fNodes: mergedFNodesRef,
|
|
2523
|
-
aip: aipRef,
|
|
2524
|
-
selfElRef,
|
|
2525
|
-
virtualListInstRef,
|
|
2526
|
-
scrollbarInstRef,
|
|
2527
|
-
handleFocusout,
|
|
2528
|
-
handleDragLeaveTree,
|
|
2529
|
-
handleScroll,
|
|
2530
|
-
getScrollContainer,
|
|
2531
|
-
getScrollContent,
|
|
2532
|
-
handleAfterEnter,
|
|
2533
|
-
handleResize,
|
|
2534
|
-
cssVars: inlineThemeDisabled ? void 0 : cssVarsRef,
|
|
2535
|
-
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
2536
|
-
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
2537
|
-
});
|
|
2538
|
-
},
|
|
2539
|
-
render() {
|
|
2540
|
-
var _a;
|
|
2541
|
-
const { fNodes, internalRenderEmpty } = this;
|
|
2542
|
-
if (!fNodes.length && internalRenderEmpty) {
|
|
2543
|
-
return internalRenderEmpty();
|
|
2544
|
-
}
|
|
2545
|
-
const { mergedClsPrefix, blockNode, blockLine, draggable, disabled, internalFocusable, checkable, handleKeydown, rtlEnabled, handleFocusout, scrollbarProps } = this;
|
|
2546
|
-
const mergedFocusable = internalFocusable && !disabled;
|
|
2547
|
-
const tabindex = mergedFocusable ? "0" : void 0;
|
|
2548
|
-
const treeClass = [
|
|
2549
|
-
`${mergedClsPrefix}-tree`,
|
|
2550
|
-
rtlEnabled && `${mergedClsPrefix}-tree--rtl`,
|
|
2551
|
-
checkable && `${mergedClsPrefix}-tree--checkable`,
|
|
2552
|
-
(blockLine || blockNode) && `${mergedClsPrefix}-tree--block-node`,
|
|
2553
|
-
blockLine && `${mergedClsPrefix}-tree--block-line`
|
|
2554
|
-
];
|
|
2555
|
-
const createNode = (tmNode) => {
|
|
2556
|
-
return "__motion" in tmNode ? h(MotionWrapper, { height: tmNode.height, nodes: tmNode.nodes, clsPrefix: mergedClsPrefix, mode: tmNode.mode, onAfterEnter: this.handleAfterEnter }) : h(NTreeNode, { key: tmNode.key, tmNode, clsPrefix: mergedClsPrefix });
|
|
2557
|
-
};
|
|
2558
|
-
if (this.virtualScroll) {
|
|
2559
|
-
const { mergedTheme, internalScrollablePadding } = this;
|
|
2560
|
-
const padding = getMargin(internalScrollablePadding || "0");
|
|
2561
|
-
return h(XScrollbar, Object.assign({}, scrollbarProps, { ref: "scrollbarInstRef", onDragleave: draggable ? this.handleDragLeaveTree : void 0, container: this.getScrollContainer, content: this.getScrollContent, class: treeClass, theme: mergedTheme.peers.Scrollbar, themeOverrides: mergedTheme.peerOverrides.Scrollbar, tabindex, onKeydown: mergedFocusable ? handleKeydown : void 0, onFocusout: mergedFocusable ? handleFocusout : void 0 }), {
|
|
2562
|
-
default: () => {
|
|
2563
|
-
var _a2;
|
|
2564
|
-
(_a2 = this.onRender) === null || _a2 === void 0 ? void 0 : _a2.call(this);
|
|
2565
|
-
return h(VVirtualList, { ref: "virtualListInstRef", items: this.fNodes, itemSize: depx(mergedTheme.self.nodeHeight), ignoreItemResize: this.aip, paddingTop: padding.top, paddingBottom: padding.bottom, class: this.themeClass, style: [
|
|
2566
|
-
this.cssVars,
|
|
2567
|
-
{
|
|
2568
|
-
paddingLeft: padding.left,
|
|
2569
|
-
paddingRight: padding.right
|
|
2570
|
-
}
|
|
2571
|
-
], onScroll: this.handleScroll, onResize: this.handleResize, showScrollbar: false, itemResizable: true }, {
|
|
2572
|
-
default: ({ item }) => createNode(item)
|
|
2573
|
-
});
|
|
2574
|
-
}
|
|
2575
|
-
});
|
|
2576
|
-
}
|
|
2577
|
-
const { internalScrollable } = this;
|
|
2578
|
-
treeClass.push(this.themeClass);
|
|
2579
|
-
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2580
|
-
if (internalScrollable) {
|
|
2581
|
-
return h(XScrollbar, Object.assign({}, scrollbarProps, { class: treeClass, tabindex, onKeydown: mergedFocusable ? handleKeydown : void 0, onFocusout: mergedFocusable ? handleFocusout : void 0, style: this.cssVars, contentStyle: { padding: this.internalScrollablePadding } }), {
|
|
2582
|
-
default: () => h("div", { onDragleave: draggable ? this.handleDragLeaveTree : void 0, ref: "selfElRef" }, this.fNodes.map(createNode))
|
|
2583
|
-
});
|
|
2584
|
-
} else {
|
|
2585
|
-
return h("div", { class: treeClass, tabindex, ref: "selfElRef", style: this.cssVars, onKeydown: mergedFocusable ? handleKeydown : void 0, onFocusout: mergedFocusable ? handleFocusout : void 0, onDragleave: draggable ? this.handleDragLeaveTree : void 0 }, !fNodes.length ? resolveSlot(this.$slots.empty, () => [
|
|
2586
|
-
h(NEmpty, { class: `${mergedClsPrefix}-tree__empty`, theme: this.mergedTheme.peers.Empty, themeOverrides: this.mergedTheme.peerOverrides.Empty })
|
|
2587
|
-
]) : fNodes.map(createNode));
|
|
2588
|
-
}
|
|
2589
|
-
}
|
|
2590
|
-
});
|
|
2591
|
-
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
2592
|
-
__name: "DraggableCard",
|
|
2593
|
-
props: {
|
|
2594
|
-
initialValue: { default: () => ({}) }
|
|
2595
|
-
},
|
|
2596
|
-
setup(__props) {
|
|
2597
|
-
const props = __props;
|
|
2598
|
-
const isLeft = props.initialValue.left !== void 0;
|
|
2599
|
-
const isTop = props.initialValue.top !== void 0;
|
|
2600
|
-
const prevOffset = {
|
|
2601
|
-
x: (isLeft ? props.initialValue.left : props.initialValue.right) ?? 0,
|
|
2602
|
-
y: (isTop ? props.initialValue.top : props.initialValue.bottom) ?? 0
|
|
2603
|
-
};
|
|
2604
|
-
const offset = shallowReactive({ ...prevOffset });
|
|
2605
|
-
const currentStyle = computed(() => {
|
|
2606
|
-
const xStyle = isLeft ? `left:${offset.x}px;` : `right:${offset.x}px;`;
|
|
2607
|
-
const yStyle = isTop ? `top:${offset.y}px;` : `bottom:${offset.y}px;`;
|
|
2608
|
-
return xStyle + yStyle;
|
|
2609
|
-
});
|
|
2610
|
-
let prevEv = void 0;
|
|
2611
|
-
const startMove = (ev) => {
|
|
2612
|
-
prevEv = ev;
|
|
2613
|
-
prevOffset.x = offset.x;
|
|
2614
|
-
prevOffset.y = offset.y;
|
|
2615
|
-
};
|
|
2616
|
-
const move = (ev) => {
|
|
2617
|
-
if (!target.value || !prevEv)
|
|
2618
|
-
return;
|
|
2619
|
-
const dx = ev.clientX - prevEv.clientX;
|
|
2620
|
-
const dy = ev.clientY - prevEv.clientY;
|
|
2621
|
-
offset.x = prevOffset.x + (isLeft ? dx : -dx);
|
|
2622
|
-
offset.y = prevOffset.y + (isTop ? dy : -dy);
|
|
2623
|
-
};
|
|
2624
|
-
const endMove = () => {
|
|
2625
|
-
prevEv = void 0;
|
|
2626
|
-
};
|
|
2627
|
-
const box = shallowRef();
|
|
2628
|
-
const target = shallowRef();
|
|
2629
|
-
const preventSelection = (ev) => {
|
|
2630
|
-
if (prevEv) {
|
|
2631
|
-
ev.preventDefault();
|
|
2632
|
-
}
|
|
2633
|
-
};
|
|
2634
|
-
const transitions = [`transition-top,bottom,left,right-500`];
|
|
2635
|
-
const windowEndMove = () => {
|
|
2636
|
-
if (!target.value)
|
|
2637
|
-
return;
|
|
2638
|
-
const { top, bottom, left, right } = target.value.getBoundingClientRect();
|
|
2639
|
-
if (right < 0 || left > window.innerWidth || bottom < 0 || top > window.innerHeight) {
|
|
2640
|
-
offset.x = prevOffset.x;
|
|
2641
|
-
offset.y = prevOffset.y;
|
|
2642
|
-
endMove();
|
|
2643
|
-
const boxDiv = box.value;
|
|
2644
|
-
if (boxDiv) {
|
|
2645
|
-
boxDiv.classList.add(...transitions);
|
|
2646
|
-
setTimeout(() => {
|
|
2647
|
-
boxDiv.classList.remove(...transitions);
|
|
2648
|
-
}, 550);
|
|
2649
|
-
}
|
|
2650
|
-
}
|
|
2651
|
-
};
|
|
2652
|
-
window.addEventListener("pointermove", move);
|
|
2653
|
-
window.addEventListener("pointerup", windowEndMove);
|
|
2654
|
-
document.addEventListener("selectstart", preventSelection);
|
|
2655
|
-
onUnmounted(() => {
|
|
2656
|
-
window.removeEventListener("pointermove", move);
|
|
2657
|
-
window.removeEventListener("pointerup", windowEndMove);
|
|
2658
|
-
document.removeEventListener("selectstart", preventSelection);
|
|
2659
|
-
endMove();
|
|
2660
|
-
});
|
|
2661
|
-
watch(target, (newValue, oldvalue) => {
|
|
2662
|
-
if (newValue) {
|
|
2663
|
-
newValue.addEventListener("pointerdown", startMove);
|
|
2664
|
-
newValue.addEventListener("pointerup", endMove);
|
|
2665
|
-
}
|
|
2666
|
-
if (oldvalue) {
|
|
2667
|
-
oldvalue.removeEventListener("pointerdown", startMove);
|
|
2668
|
-
oldvalue.removeEventListener("pointerup", endMove);
|
|
2669
|
-
}
|
|
2670
|
-
});
|
|
2671
|
-
onUnmounted(() => {
|
|
2672
|
-
if (!target.value)
|
|
2673
|
-
return;
|
|
2674
|
-
target.value.removeEventListener("pointerdown", startMove);
|
|
2675
|
-
target.value.removeEventListener("pointerup", endMove);
|
|
2676
|
-
});
|
|
2677
|
-
const updateTarget = (arg) => {
|
|
2678
|
-
if (arg instanceof HTMLElement) {
|
|
2679
|
-
target.value = arg;
|
|
2680
|
-
} else {
|
|
2681
|
-
target.value = void 0;
|
|
2682
|
-
}
|
|
2683
|
-
};
|
|
2684
|
-
return (_ctx, _cache) => {
|
|
2685
|
-
return openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
2686
|
-
createBaseVNode("div", {
|
|
2687
|
-
fixed: "",
|
|
2688
|
-
ref_key: "box",
|
|
2689
|
-
ref: box,
|
|
2690
|
-
style: normalizeStyle([_ctx.$attrs.style, currentStyle.value]),
|
|
2691
|
-
class: normalizeClass(_ctx.$attrs.class)
|
|
2692
|
-
}, [
|
|
2693
|
-
renderSlot(_ctx.$slots, "default", { onRef: updateTarget })
|
|
2694
|
-
], 6)
|
|
2695
|
-
]);
|
|
2696
|
-
};
|
|
2697
|
-
}
|
|
2698
|
-
});
|
|
2699
|
-
const DraggableCard_vue_vue_type_style_index_0_lang = "";
|
|
2700
|
-
const _hoisted_1$4 = /* @__PURE__ */ createBaseVNode("th", null, "Name", -1);
|
|
2701
|
-
const _hoisted_2$2 = /* @__PURE__ */ createBaseVNode("th", null, "Value", -1);
|
|
2702
|
-
const _hoisted_3$2 = [
|
|
2703
|
-
_hoisted_1$4,
|
|
2704
|
-
_hoisted_2$2
|
|
2705
|
-
];
|
|
2706
|
-
const _hoisted_4$2 = {
|
|
2707
|
-
key: 0,
|
|
2708
|
-
flex: "",
|
|
2709
|
-
"flex-justify-between": "",
|
|
2710
|
-
"flex-items-center": ""
|
|
2711
|
-
};
|
|
2712
|
-
const _hoisted_5$2 = {
|
|
2713
|
-
key: 0,
|
|
2714
|
-
viewBox: "0 0 28 28"
|
|
2715
|
-
};
|
|
2716
|
-
const _hoisted_6$2 = /* @__PURE__ */ createBaseVNode("g", { fill: "none" }, [
|
|
2717
|
-
/* @__PURE__ */ createBaseVNode("path", {
|
|
2718
|
-
d: "M15 8a1 1 0 1 1-2 0a1 1 0 0 1 2 0zm-1.75 3.75v7.5a.75.75 0 0 0 1.5 0v-7.5a.75.75 0 0 0-1.5 0zM2 14C2 7.373 7.373 2 14 2s12 5.373 12 12s-5.373 12-12 12S2 20.627 2 14zM14 3.5C8.201 3.5 3.5 8.201 3.5 14S8.201 24.5 14 24.5S24.5 19.799 24.5 14S19.799 3.5 14 3.5z",
|
|
2719
|
-
fill: "currentColor"
|
|
2720
|
-
})
|
|
2721
|
-
], -1);
|
|
2722
|
-
const _hoisted_7$2 = [
|
|
2723
|
-
_hoisted_6$2
|
|
2724
|
-
];
|
|
2725
|
-
const _hoisted_8$2 = {
|
|
2726
|
-
key: 1,
|
|
2727
|
-
viewBox: "0 0 1024 1024"
|
|
2728
|
-
};
|
|
2729
|
-
const _hoisted_9$2 = /* @__PURE__ */ createBaseVNode("path", { d: "M722.500267 330.888533l-273.408 273.408-147.729067-147.729066a42.018133 42.018133 0 1 0-59.426133 59.426133l177.425066 177.493333a41.984 41.984 0 0 0 59.426134 0L781.9264 390.314667a42.001067 42.001067 0 0 0-59.392-59.426134h-0.034133zM78.506667 783.496533a508.279467 508.279467 0 0 0 319.0784 226.986667C530.773333 1041.066667 667.886933 1017.924267 783.701333 945.390933a508.279467 508.279467 0 0 0 226.986667-319.0784 508.279467 508.279467 0 0 0-65.058133-386.116266C848.554667 85.367467 681.710933 0.341333 511.214933 0.341333a508.6208 508.6208 0 0 0-270.813866 77.960534A36.864 36.864 0 0 0 279.552 140.629333C484.113067 12.288 755.029333 74.581333 883.268267 279.278933a434.9952 434.9952 0 0 1 55.739733 330.5472 435.029333 435.029333 0 0 1-194.3552 273.134934 435.746133 435.746133 0 0 1-330.581333 55.773866A435.165867 435.165867 0 0 1 140.936533 744.379733a436.770133 436.770133 0 0 1-5.666133-456.055466 36.829867 36.829867 0 0 0-63.317333-37.546667A510.1568 510.1568 0 0 0 78.506667 783.530667v-0.034134z" }, null, -1);
|
|
2730
|
-
const _hoisted_10 = [
|
|
2731
|
-
_hoisted_9$2
|
|
2732
|
-
];
|
|
2733
|
-
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
2734
|
-
__name: "AttrCard",
|
|
2735
|
-
props: {
|
|
2736
|
-
focusNode: {}
|
|
2737
|
-
},
|
|
2738
|
-
setup(__props) {
|
|
2739
|
-
const props = __props;
|
|
2740
|
-
const lenAttrNames = [`text`, `desc`];
|
|
2741
|
-
const attrs = computed(() => {
|
|
2742
|
-
return Object.entries(props.focusNode.attr).map(([name, value]) => {
|
|
2743
|
-
const attr = {
|
|
2744
|
-
name,
|
|
2745
|
-
value: JSON.stringify(value)
|
|
2746
|
-
};
|
|
2747
|
-
if (lenAttrNames.includes(name)) {
|
|
2748
|
-
return [
|
|
2749
|
-
attr,
|
|
2750
|
-
{
|
|
2751
|
-
name: name + `.length`,
|
|
2752
|
-
value: JSON.stringify((value == null ? void 0 : value.length) ?? null)
|
|
2753
|
-
}
|
|
2754
|
-
];
|
|
2755
|
-
}
|
|
2756
|
-
return attr;
|
|
2757
|
-
}).flat();
|
|
2758
|
-
});
|
|
2759
|
-
const attrDesc = {
|
|
2760
|
-
_id: `虚拟属性:生成快照访问节点顺序`,
|
|
2761
|
-
_pid: `虚拟属性:父节点的 _id`,
|
|
2762
|
-
depth: `在某些应用上可能造成无限节点错误`,
|
|
2763
|
-
id: `可快速查找`,
|
|
2764
|
-
text: `可快速查找`
|
|
2765
|
-
};
|
|
2766
|
-
return (_ctx, _cache) => {
|
|
2767
|
-
return openBlock(), createBlock(_sfc_main$5, { initialValue: { top: 75, right: 10 } }, {
|
|
2768
|
-
default: withCtx(({ onRef }) => [
|
|
2769
|
-
createVNode(unref(NTable), {
|
|
2770
|
-
size: "small",
|
|
2771
|
-
striped: "",
|
|
2772
|
-
singleLine: false,
|
|
2773
|
-
class: "gkd_code",
|
|
2774
|
-
themeOverrides: {
|
|
2775
|
-
thPaddingSmall: "1px 3px",
|
|
2776
|
-
tdPaddingSmall: "1px 3px"
|
|
2777
|
-
}
|
|
2778
|
-
}, {
|
|
2779
|
-
default: withCtx(() => [
|
|
2780
|
-
createBaseVNode("thead", null, [
|
|
2781
|
-
createBaseVNode("tr", {
|
|
2782
|
-
ref: onRef,
|
|
2783
|
-
"cursor-move": ""
|
|
2784
|
-
}, _hoisted_3$2, 512)
|
|
2785
|
-
]),
|
|
2786
|
-
createVNode(unref(NTbody), null, {
|
|
2787
|
-
default: withCtx(() => [
|
|
2788
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(attrs.value, (attrx) => {
|
|
2789
|
-
return openBlock(), createBlock(unref(NTr), {
|
|
2790
|
-
key: attrx.name
|
|
2791
|
-
}, {
|
|
2792
|
-
default: withCtx(() => [
|
|
2793
|
-
createVNode(unref(NTd), {
|
|
2794
|
-
onClick: ($event) => unref(copy)(`${attrx.name}=${attrx.value}`)
|
|
2795
|
-
}, {
|
|
2796
|
-
default: withCtx(() => [
|
|
2797
|
-
attrx.name in attrDesc ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
|
|
2798
|
-
createBaseVNode("div", null, toDisplayString(attrx.name), 1),
|
|
2799
|
-
createVNode(unref(NTooltip), null, {
|
|
2800
|
-
trigger: withCtx(() => [
|
|
2801
|
-
createVNode(unref(NIcon), { size: "16" }, {
|
|
2802
|
-
default: withCtx(() => [
|
|
2803
|
-
attrx.name != `id` && attrx.name != `text` ? (openBlock(), createElementBlock("svg", _hoisted_5$2, _hoisted_7$2)) : (_ctx.focusNode.quickFind || attrx.name == "id" && _ctx.focusNode.idQf || attrx.name == "text" && _ctx.focusNode.textQf) && JSON.parse(attrx.value) ? (openBlock(), createElementBlock("svg", _hoisted_8$2, _hoisted_10)) : createCommentVNode("", true)
|
|
2804
|
-
]),
|
|
2805
|
-
_: 2
|
|
2806
|
-
}, 1024)
|
|
2807
|
-
]),
|
|
2808
|
-
default: withCtx(() => [
|
|
2809
|
-
createTextVNode(" " + toDisplayString(attrDesc[attrx.name]), 1)
|
|
2810
|
-
]),
|
|
2811
|
-
_: 2
|
|
2812
|
-
}, 1024)
|
|
2813
|
-
])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2814
|
-
createTextVNode(toDisplayString(attrx.name), 1)
|
|
2815
|
-
], 64))
|
|
2816
|
-
]),
|
|
2817
|
-
_: 2
|
|
2818
|
-
}, 1032, ["onClick"]),
|
|
2819
|
-
createVNode(unref(NTd), null, {
|
|
2820
|
-
default: withCtx(() => [
|
|
2821
|
-
attrx.name == "id" ? (openBlock(), createBlock(unref(NEllipsis), {
|
|
2822
|
-
key: 0,
|
|
2823
|
-
style: { "width": "180px", "min-width": "max(12vw, 180px)", "direction": "rtl", "text-align": "left" }
|
|
2824
|
-
}, {
|
|
2825
|
-
default: withCtx(() => [
|
|
2826
|
-
createTextVNode(toDisplayString(attrx.value), 1)
|
|
2827
|
-
]),
|
|
2828
|
-
_: 2
|
|
2829
|
-
}, 1024)) : (openBlock(), createBlock(unref(NEllipsis), {
|
|
2830
|
-
key: 1,
|
|
2831
|
-
style: { "width": "180px", "min-width": "max(12vw, 180px)" }
|
|
2832
|
-
}, {
|
|
2833
|
-
default: withCtx(() => [
|
|
2834
|
-
createTextVNode(toDisplayString(attrx.value), 1)
|
|
2835
|
-
]),
|
|
2836
|
-
_: 2
|
|
2837
|
-
}, 1024))
|
|
2838
|
-
]),
|
|
2839
|
-
_: 2
|
|
2840
|
-
}, 1024)
|
|
2841
|
-
]),
|
|
2842
|
-
_: 2
|
|
2843
|
-
}, 1024);
|
|
2844
|
-
}), 128))
|
|
2845
|
-
]),
|
|
2846
|
-
_: 1
|
|
2847
|
-
})
|
|
2848
|
-
]),
|
|
2849
|
-
_: 2
|
|
2850
|
-
}, 1024)
|
|
2851
|
-
]),
|
|
2852
|
-
_: 1
|
|
2853
|
-
});
|
|
2854
|
-
};
|
|
2855
|
-
}
|
|
2856
|
-
});
|
|
2857
|
-
const _hoisted_1$3 = {
|
|
2858
|
-
flex: "",
|
|
2859
|
-
"flex-col": "",
|
|
2860
|
-
relative: "",
|
|
2861
|
-
"h-full": ""
|
|
2862
|
-
};
|
|
2863
|
-
const _hoisted_2$1 = ["src"];
|
|
2864
|
-
const _hoisted_3$1 = /* @__PURE__ */ createBaseVNode("div", {
|
|
2865
|
-
absolute: "",
|
|
2866
|
-
"left-0": "",
|
|
2867
|
-
"top-0": "",
|
|
2868
|
-
"bottom-0": "",
|
|
2869
|
-
"right-0": "",
|
|
2870
|
-
"b-solid": "",
|
|
2871
|
-
"b-1px": "",
|
|
2872
|
-
"b-red": ""
|
|
2873
|
-
}, null, -1);
|
|
2874
|
-
const _hoisted_4$1 = [
|
|
2875
|
-
_hoisted_3$1
|
|
2876
|
-
];
|
|
2877
|
-
const _hoisted_5$1 = {
|
|
2878
|
-
class: "left-[calc(100%+4px)]",
|
|
2879
|
-
absolute: "",
|
|
2880
|
-
"top-0": "",
|
|
2881
|
-
"overflow-hidden": "",
|
|
2882
|
-
"z-1": "",
|
|
2883
|
-
"bg-white": "",
|
|
2884
|
-
"h-200px": "",
|
|
2885
|
-
"w-200px": "",
|
|
2886
|
-
"border-1px": "",
|
|
2887
|
-
"border-indigo-600": "",
|
|
2888
|
-
"border-dashed": ""
|
|
2889
|
-
};
|
|
2890
|
-
const _hoisted_6$1 = ["src"];
|
|
2891
|
-
const _hoisted_7$1 = {
|
|
2892
|
-
absolute: "",
|
|
2893
|
-
"left-2px": "",
|
|
2894
|
-
"top-2px": "",
|
|
2895
|
-
class: "leading-[1]",
|
|
2896
|
-
style: { "background-color": "rgba(256, 256, 256, 0.7)" }
|
|
2897
|
-
};
|
|
2898
|
-
const _hoisted_8$1 = /* @__PURE__ */ createBaseVNode("div", {
|
|
2899
|
-
class: "top-[calc(50%-1px)]",
|
|
2900
|
-
absolute: "",
|
|
2901
|
-
"left-0": "",
|
|
2902
|
-
"right-0": "",
|
|
2903
|
-
"h-1px": "",
|
|
2904
|
-
"bg-repeat-x": "",
|
|
2905
|
-
"mix-blend-difference": "",
|
|
2906
|
-
style: { "background": "linear-gradient(\n to left,\n transparent 0%,\n transparent 50%,\n #fff 50%,\n #fff 100%\n )", "background-size": "10px 1px" }
|
|
2907
|
-
}, null, -1);
|
|
2908
|
-
const _hoisted_9$1 = /* @__PURE__ */ createBaseVNode("div", {
|
|
2909
|
-
class: "left-[calc(50%-1px)]",
|
|
2910
|
-
absolute: "",
|
|
2911
|
-
"top-0": "",
|
|
2912
|
-
"bottom-0": "",
|
|
2913
|
-
"w-1px": "",
|
|
2914
|
-
"bg-repeat-y": "",
|
|
2915
|
-
"mix-blend-difference": "",
|
|
2916
|
-
style: { "background": "linear-gradient(\n to top,\n transparent 0%,\n transparent 50%,\n #fff 50%,\n #fff 100%\n )", "background-size": "1px 10px" }
|
|
2917
|
-
}, null, -1);
|
|
2918
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
2919
|
-
__name: "ScreenshotCard",
|
|
2920
|
-
props: {
|
|
2921
|
-
url: {},
|
|
2922
|
-
snapshot: {},
|
|
2923
|
-
rootNode: {},
|
|
2924
|
-
focusNode: {},
|
|
2925
|
-
onUpdateFocusNode: { type: Function, default: () => () => {
|
|
2926
|
-
} }
|
|
2927
|
-
},
|
|
2928
|
-
setup(__props) {
|
|
2929
|
-
const props = __props;
|
|
2930
|
-
const imgRef = shallowRef();
|
|
2931
|
-
const clickEvRef = shallowRef();
|
|
2932
|
-
watchEffect(() => {
|
|
2933
|
-
if (!props.rootNode)
|
|
2934
|
-
return;
|
|
2935
|
-
const ev = clickEvRef.value;
|
|
2936
|
-
const img = imgRef.value;
|
|
2937
|
-
if (!ev || !img) {
|
|
2938
|
-
return;
|
|
2939
|
-
}
|
|
2940
|
-
const imgRect = img.getBoundingClientRect();
|
|
2941
|
-
const innerHeight = imgRect.width / img.naturalWidth * img.naturalHeight;
|
|
2942
|
-
const offsetTop = (imgRect.height - innerHeight) / 2;
|
|
2943
|
-
const ox = (ev.clientX - imgRect.left) / imgRect.width * img.naturalWidth;
|
|
2944
|
-
const oy = (ev.clientY - imgRect.top - offsetTop) / innerHeight * img.naturalHeight;
|
|
2945
|
-
const childNode = findNodeByXy(props.snapshot.nodes, ox, oy);
|
|
2946
|
-
if (childNode) {
|
|
2947
|
-
props.onUpdateFocusNode(childNode);
|
|
2948
|
-
}
|
|
2949
|
-
});
|
|
2950
|
-
const percent = (n) => {
|
|
2951
|
-
return `${n * 100}%`;
|
|
2952
|
-
};
|
|
2953
|
-
const positionStyle = computed(() => {
|
|
2954
|
-
var _a;
|
|
2955
|
-
const img = imgRef.value;
|
|
2956
|
-
const attr = (_a = props.focusNode) == null ? void 0 : _a.attr;
|
|
2957
|
-
if (!props.focusNode || !img || !attr) {
|
|
2958
|
-
return ``;
|
|
2959
|
-
}
|
|
2960
|
-
const imgRect = img.getBoundingClientRect();
|
|
2961
|
-
const innerHeight = imgRect.width / img.naturalWidth * img.naturalHeight;
|
|
2962
|
-
return {
|
|
2963
|
-
left: `calc(${percent(attr.left / img.naturalWidth)} - 2px)`,
|
|
2964
|
-
width: `calc(${percent(
|
|
2965
|
-
(attr.right - attr.left) / img.naturalWidth
|
|
2966
|
-
)} + 2px)`,
|
|
2967
|
-
top: `calc(${percent(
|
|
2968
|
-
(attr.top / img.naturalHeight * innerHeight + (imgRect.height - innerHeight) / 2) / imgRect.height
|
|
2969
|
-
)} - 2px)`,
|
|
2970
|
-
height: `calc(${percent(
|
|
2971
|
-
(attr.bottom - attr.top) / img.naturalHeight * innerHeight / imgRect.height
|
|
2972
|
-
)} + 2px)`
|
|
2973
|
-
};
|
|
2974
|
-
});
|
|
2975
|
-
const imgHover = shallowRef(false);
|
|
2976
|
-
const hoverPosition = shallowRef({ ox: 0, oy: 0 });
|
|
2977
|
-
const imgMove = (ev) => {
|
|
2978
|
-
const img = imgRef.value;
|
|
2979
|
-
if (!img)
|
|
2980
|
-
return;
|
|
2981
|
-
const imgRect = img.getBoundingClientRect();
|
|
2982
|
-
const innerHeight = imgRect.width / img.naturalWidth * img.naturalHeight;
|
|
2983
|
-
const offsetTop = (imgRect.height - innerHeight) / 2;
|
|
2984
|
-
const ox = (ev.clientX - imgRect.left) / imgRect.width * img.naturalWidth;
|
|
2985
|
-
const oy = (ev.clientY - imgRect.top - offsetTop) / innerHeight * img.naturalHeight;
|
|
2986
|
-
hoverPosition.value = { ox, oy };
|
|
2987
|
-
hoverPositionStyle.value = {
|
|
2988
|
-
left: -(ox - 0.1 * img.naturalWidth) / img.naturalWidth * 1e3 + "px",
|
|
2989
|
-
top: -(oy - 0.1 * img.naturalWidth) / img.naturalWidth * 1e3 + "px"
|
|
2990
|
-
};
|
|
2991
|
-
};
|
|
2992
|
-
const hoverPositionStyle = shallowRef({ left: "0", top: "0" });
|
|
2993
|
-
return (_ctx, _cache) => {
|
|
2994
|
-
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
2995
|
-
createBaseVNode("img", {
|
|
2996
|
-
ref_key: "imgRef",
|
|
2997
|
-
ref: imgRef,
|
|
2998
|
-
src: _ctx.url,
|
|
2999
|
-
onClick: _cache[0] || (_cache[0] = ($event) => clickEvRef.value = $event),
|
|
3000
|
-
"cursor-crosshair": "",
|
|
3001
|
-
"h-full": "",
|
|
3002
|
-
"object-contain": "",
|
|
3003
|
-
style: { "max-width": "max(35vw, 400px)" },
|
|
3004
|
-
onMouseover: _cache[1] || (_cache[1] = ($event) => imgHover.value = true),
|
|
3005
|
-
onMouseleave: _cache[2] || (_cache[2] = ($event) => imgHover.value = false),
|
|
3006
|
-
onMousemove: imgMove
|
|
3007
|
-
}, null, 40, _hoisted_2$1),
|
|
3008
|
-
createBaseVNode("div", {
|
|
3009
|
-
style: normalizeStyle(positionStyle.value),
|
|
3010
|
-
absolute: "",
|
|
3011
|
-
"pointer-events-none": "",
|
|
3012
|
-
"transition-all-300": "",
|
|
3013
|
-
"b-1px": "",
|
|
3014
|
-
"b-blue": "",
|
|
3015
|
-
"b-solid": ""
|
|
3016
|
-
}, _hoisted_4$1, 4),
|
|
3017
|
-
withDirectives(createBaseVNode("div", _hoisted_5$1, [
|
|
3018
|
-
createBaseVNode("img", {
|
|
3019
|
-
src: _ctx.url,
|
|
3020
|
-
"object-contain": "",
|
|
3021
|
-
absolute: "",
|
|
3022
|
-
"left-0": "",
|
|
3023
|
-
"top-0": "",
|
|
3024
|
-
style: normalizeStyle(hoverPositionStyle.value),
|
|
3025
|
-
"w-1000px": ""
|
|
3026
|
-
}, null, 12, _hoisted_6$1),
|
|
3027
|
-
createBaseVNode("div", _hoisted_7$1, toDisplayString(`${hoverPosition.value.ox.toFixed(0)},${hoverPosition.value.oy.toFixed(0)}`), 1),
|
|
3028
|
-
_hoisted_8$1,
|
|
3029
|
-
_hoisted_9$1
|
|
3030
|
-
], 512), [
|
|
3031
|
-
[vShow, imgHover.value]
|
|
3032
|
-
])
|
|
3033
|
-
]);
|
|
3034
|
-
};
|
|
3035
|
-
}
|
|
3036
|
-
});
|
|
3037
|
-
const _hoisted_1$2 = {
|
|
3038
|
-
"w-480px": "",
|
|
3039
|
-
"bg-white": "",
|
|
3040
|
-
"b-1px": "",
|
|
3041
|
-
"b-solid": "",
|
|
3042
|
-
"b-gray-200": "",
|
|
3043
|
-
"rounded-4px": "",
|
|
3044
|
-
"p-8px": "",
|
|
3045
|
-
style: { "min-width": "max(25vw, 480px)" }
|
|
3046
|
-
};
|
|
3047
|
-
const _hoisted_2 = {
|
|
3048
|
-
flex: "",
|
|
3049
|
-
"m-b-4px": ""
|
|
3050
|
-
};
|
|
3051
|
-
const _hoisted_3 = /* @__PURE__ */ createBaseVNode("svg", {
|
|
3052
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3053
|
-
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
3054
|
-
viewBox: "0 0 32 32"
|
|
3055
|
-
}, [
|
|
3056
|
-
/* @__PURE__ */ createBaseVNode("path", {
|
|
3057
|
-
d: "M29 27.586l-7.552-7.552a11.018 11.018 0 1 0-1.414 1.414L27.586 29zM4 13a9 9 0 1 1 9 9a9.01 9.01 0 0 1-9-9z",
|
|
3058
|
-
fill: "currentColor"
|
|
3059
|
-
})
|
|
3060
|
-
], -1);
|
|
3061
|
-
const _hoisted_4 = /* @__PURE__ */ createBaseVNode("div", { "p-5px": "" }, null, -1);
|
|
3062
|
-
const _hoisted_5 = {
|
|
3063
|
-
key: 0,
|
|
3064
|
-
underline: "",
|
|
3065
|
-
"decoration-1": "",
|
|
3066
|
-
"m-r-4px": "",
|
|
3067
|
-
title: "查询数量"
|
|
3068
|
-
};
|
|
3069
|
-
const _hoisted_6 = ["title"];
|
|
3070
|
-
const _hoisted_7 = /* @__PURE__ */ createBaseVNode("svg", { viewBox: "0 0 24 24" }, [
|
|
3071
|
-
/* @__PURE__ */ createBaseVNode("path", {
|
|
3072
|
-
d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z",
|
|
3073
|
-
fill: "currentColor"
|
|
3074
|
-
})
|
|
3075
|
-
], -1);
|
|
3076
|
-
const _hoisted_8 = /* @__PURE__ */ createBaseVNode("div", { "p-l-8px": "" }, null, -1);
|
|
3077
|
-
const _hoisted_9 = /* @__PURE__ */ createBaseVNode("svg", { viewBox: "0 0 24 24" }, [
|
|
3078
|
-
/* @__PURE__ */ createBaseVNode("g", { fill: "none" }, [
|
|
3079
|
-
/* @__PURE__ */ createBaseVNode("path", {
|
|
3080
|
-
d: "M12 1.75a3.25 3.25 0 0 1 3.245 3.066L15.25 5h5.25a.75.75 0 0 1 .102 1.493L20.5 6.5h-.796l-1.28 13.02a2.75 2.75 0 0 1-2.561 2.474l-.176.006H8.313a2.75 2.75 0 0 1-2.714-2.307l-.023-.174L4.295 6.5H3.5a.75.75 0 0 1-.743-.648L2.75 5.75a.75.75 0 0 1 .648-.743L3.5 5h5.25A3.25 3.25 0 0 1 12 1.75zm6.197 4.75H5.802l1.267 12.872a1.25 1.25 0 0 0 1.117 1.122l.127.006h7.374c.6 0 1.109-.425 1.225-1.002l.02-.126L18.196 6.5zM13.75 9.25a.75.75 0 0 1 .743.648L14.5 10v7a.75.75 0 0 1-1.493.102L13 17v-7a.75.75 0 0 1 .75-.75zm-3.5 0a.75.75 0 0 1 .743.648L11 10v7a.75.75 0 0 1-1.493.102L9.5 17v-7a.75.75 0 0 1 .75-.75zm1.75-6a1.75 1.75 0 0 0-1.744 1.606L10.25 5h3.5A1.75 1.75 0 0 0 12 3.25z",
|
|
3081
|
-
fill: "currentColor"
|
|
3082
|
-
})
|
|
3083
|
-
])
|
|
3084
|
-
], -1);
|
|
3085
|
-
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
3086
|
-
__name: "SearchCard",
|
|
3087
|
-
props: {
|
|
3088
|
-
snapshot: {},
|
|
3089
|
-
rootNode: {},
|
|
3090
|
-
onUpdateFocusNode: { type: Function, default: () => () => {
|
|
3091
|
-
} }
|
|
3092
|
-
},
|
|
3093
|
-
setup(__props) {
|
|
3094
|
-
const props = __props;
|
|
3095
|
-
const selectorText = shallowRef(``);
|
|
3096
|
-
const selectorResults = shallowReactive([]);
|
|
3097
|
-
const searchBySelector = errorTry(() => {
|
|
3098
|
-
if (!props.rootNode) {
|
|
3099
|
-
message.error(`根节点不存在`);
|
|
3100
|
-
return;
|
|
3101
|
-
}
|
|
3102
|
-
const text = selectorText.value.trim();
|
|
3103
|
-
if (!text)
|
|
3104
|
-
return;
|
|
3105
|
-
if (enableSearchBySelector.value) {
|
|
3106
|
-
const selector = errorWrap(() => parseSelector(text), `选择器非法`);
|
|
3107
|
-
if (selectorResults.find(
|
|
3108
|
-
(s) => typeof s.selector == "object" && s.selector.toString() == selector.toString()
|
|
3109
|
-
)) {
|
|
3110
|
-
message.warning(`不可重复选择`);
|
|
3111
|
-
return;
|
|
3112
|
-
}
|
|
3113
|
-
const results = selector.querySelectorAll(props.rootNode);
|
|
3114
|
-
if (results.length == 0) {
|
|
3115
|
-
message.success(`没有选择到节点`);
|
|
3116
|
-
return;
|
|
3117
|
-
}
|
|
3118
|
-
message.success(`选择到 ${results.length} 个节点`);
|
|
3119
|
-
selectorResults.unshift({ selector, results });
|
|
3120
|
-
} else {
|
|
3121
|
-
if (selectorResults.find(
|
|
3122
|
-
(s) => typeof s.selector == "string" && s.selector.toString() == text
|
|
3123
|
-
)) {
|
|
3124
|
-
message.warning(`不可重复选择`);
|
|
3125
|
-
return;
|
|
3126
|
-
}
|
|
3127
|
-
const results = [];
|
|
3128
|
-
const stack = [props.rootNode];
|
|
3129
|
-
while (stack.length > 0) {
|
|
3130
|
-
const n = stack.pop();
|
|
3131
|
-
if (getNodeLabel(n).includes(text)) {
|
|
3132
|
-
results.push(n);
|
|
3133
|
-
}
|
|
3134
|
-
stack.push(...[...n.children].reverse());
|
|
3135
|
-
}
|
|
3136
|
-
if (results.length == 0) {
|
|
3137
|
-
message.success(`没有搜索到节点`);
|
|
3138
|
-
return;
|
|
3139
|
-
}
|
|
3140
|
-
message.success(`搜索到 ${results.length} 个节点`);
|
|
3141
|
-
selectorResults.unshift({ selector: text, results });
|
|
3142
|
-
}
|
|
3143
|
-
});
|
|
3144
|
-
const generateRules = errorTry(async (selector) => {
|
|
3145
|
-
let jpgUrl = githubJpgStorage[props.snapshot.id];
|
|
3146
|
-
if (jpgUrl) {
|
|
3147
|
-
jpgUrl = githubUrlToSelfUrl(jpgUrl);
|
|
3148
|
-
}
|
|
3149
|
-
let zipUrl = githubZipStorage[props.snapshot.id];
|
|
3150
|
-
if (zipUrl) {
|
|
3151
|
-
zipUrl = githubUrlToSelfUrl(zipUrl);
|
|
3152
|
-
}
|
|
3153
|
-
const rule = {
|
|
3154
|
-
id: props.snapshot.appId,
|
|
3155
|
-
name: props.snapshot.appName,
|
|
3156
|
-
groups: [
|
|
3157
|
-
{
|
|
3158
|
-
key: 1,
|
|
3159
|
-
name: `[ChangeMe]规则名称-${dayjs().format("YYYY-MM-DD HH:mm:ss")}`,
|
|
3160
|
-
desc: `[ChangeMe]本规则由GKD网页端审查工具生成`,
|
|
3161
|
-
rules: [
|
|
3162
|
-
{
|
|
3163
|
-
activityIds: props.snapshot.activityId,
|
|
3164
|
-
matches: selector.toString(),
|
|
3165
|
-
exampleUrls: jpgUrl,
|
|
3166
|
-
snapshotUrls: zipUrl
|
|
3167
|
-
}
|
|
3168
|
-
]
|
|
3169
|
-
}
|
|
3170
|
-
]
|
|
3171
|
-
};
|
|
3172
|
-
copy(lib.stringify(rule, void 0, 2));
|
|
3173
|
-
});
|
|
3174
|
-
const enableSearchBySelector = shallowRef(true);
|
|
3175
|
-
const _1vw = window.innerWidth / 100;
|
|
3176
|
-
return (_ctx, _cache) => {
|
|
3177
|
-
return openBlock(), createBlock(_sfc_main$5, {
|
|
3178
|
-
initialValue: { top: 75, right: Math.max(315, 12 * _1vw + 135) },
|
|
3179
|
-
class: "z-1"
|
|
3180
|
-
}, {
|
|
3181
|
-
default: withCtx(({ onRef }) => [
|
|
3182
|
-
createBaseVNode("div", _hoisted_1$2, [
|
|
3183
|
-
createBaseVNode("div", _hoisted_2, [
|
|
3184
|
-
createVNode(unref(NRadioGroup), {
|
|
3185
|
-
value: enableSearchBySelector.value,
|
|
3186
|
-
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => enableSearchBySelector.value = $event)
|
|
3187
|
-
}, {
|
|
3188
|
-
default: withCtx(() => [
|
|
3189
|
-
createVNode(unref(NSpace), null, {
|
|
3190
|
-
default: withCtx(() => [
|
|
3191
|
-
createVNode(unref(NRadio), { value: false }, {
|
|
3192
|
-
default: withCtx(() => [
|
|
3193
|
-
createTextVNode(" 字符搜索 ")
|
|
3194
|
-
]),
|
|
3195
|
-
_: 1
|
|
3196
|
-
}),
|
|
3197
|
-
createVNode(unref(NRadio), { value: true }, {
|
|
3198
|
-
default: withCtx(() => [
|
|
3199
|
-
createTextVNode(" 选择器查询 ")
|
|
3200
|
-
]),
|
|
3201
|
-
_: 1
|
|
3202
|
-
})
|
|
3203
|
-
]),
|
|
3204
|
-
_: 1
|
|
3205
|
-
})
|
|
3206
|
-
]),
|
|
3207
|
-
_: 1
|
|
3208
|
-
}, 8, ["value"]),
|
|
3209
|
-
createBaseVNode("div", {
|
|
3210
|
-
"flex-1": "",
|
|
3211
|
-
"cursor-move": "",
|
|
3212
|
-
ref: onRef
|
|
3213
|
-
}, null, 512)
|
|
3214
|
-
]),
|
|
3215
|
-
createVNode(unref(NInputGroup), null, {
|
|
3216
|
-
default: withCtx(() => [
|
|
3217
|
-
createVNode(unref(NInput), {
|
|
3218
|
-
value: selectorText.value,
|
|
3219
|
-
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => selectorText.value = $event),
|
|
3220
|
-
placeholder: enableSearchBySelector.value ? `请输入选择器` : `请输入字符`,
|
|
3221
|
-
onKeyup: withKeys(unref(searchBySelector), ["enter"]),
|
|
3222
|
-
inputProps: { class: "gkd_code" }
|
|
3223
|
-
}, null, 8, ["value", "placeholder", "onKeyup"]),
|
|
3224
|
-
createVNode(unref(NButton), { onClick: unref(searchBySelector) }, {
|
|
3225
|
-
icon: withCtx(() => [
|
|
3226
|
-
createVNode(unref(NIcon), null, {
|
|
3227
|
-
default: withCtx(() => [
|
|
3228
|
-
_hoisted_3
|
|
3229
|
-
]),
|
|
3230
|
-
_: 1
|
|
3231
|
-
})
|
|
3232
|
-
]),
|
|
3233
|
-
_: 1
|
|
3234
|
-
}, 8, ["onClick"])
|
|
3235
|
-
]),
|
|
3236
|
-
_: 1
|
|
3237
|
-
}),
|
|
3238
|
-
_hoisted_4,
|
|
3239
|
-
createVNode(unref(NCollapse), null, {
|
|
3240
|
-
default: withCtx(() => [
|
|
3241
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(selectorResults), (selectorResult, index) => {
|
|
3242
|
-
return openBlock(), createBlock(unref(NCollapseItem), {
|
|
3243
|
-
key: selectorResult.selector.toString()
|
|
3244
|
-
}, {
|
|
3245
|
-
header: withCtx(() => [
|
|
3246
|
-
selectorResult.results.length > 1 ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(selectorResult.results.length), 1)) : createCommentVNode("", true),
|
|
3247
|
-
createBaseVNode("span", {
|
|
3248
|
-
"break-all": "",
|
|
3249
|
-
title: typeof selectorResult.selector == "object" ? `选择器` : `搜索字符`
|
|
3250
|
-
}, toDisplayString(selectorResult.selector.toString()), 9, _hoisted_6)
|
|
3251
|
-
]),
|
|
3252
|
-
"header-extra": withCtx(() => [
|
|
3253
|
-
typeof selectorResult.selector == "object" ? (openBlock(), createBlock(unref(NButton), {
|
|
3254
|
-
key: 0,
|
|
3255
|
-
size: "small",
|
|
3256
|
-
onClick: withModifiers(($event) => unref(generateRules)(selectorResult.selector), ["stop"]),
|
|
3257
|
-
title: "复制规则"
|
|
3258
|
-
}, {
|
|
3259
|
-
icon: withCtx(() => [
|
|
3260
|
-
createVNode(unref(NIcon), null, {
|
|
3261
|
-
default: withCtx(() => [
|
|
3262
|
-
_hoisted_7
|
|
3263
|
-
]),
|
|
3264
|
-
_: 1
|
|
3265
|
-
})
|
|
3266
|
-
]),
|
|
3267
|
-
_: 2
|
|
3268
|
-
}, 1032, ["onClick"])) : createCommentVNode("", true),
|
|
3269
|
-
_hoisted_8,
|
|
3270
|
-
createVNode(unref(NButton), {
|
|
3271
|
-
size: "small",
|
|
3272
|
-
onClick: withModifiers(($event) => unref(selectorResults).splice(index, 1), ["stop"]),
|
|
3273
|
-
title: "删除记录"
|
|
3274
|
-
}, {
|
|
3275
|
-
icon: withCtx(() => [
|
|
3276
|
-
createVNode(unref(NIcon), null, {
|
|
3277
|
-
default: withCtx(() => [
|
|
3278
|
-
_hoisted_9
|
|
3279
|
-
]),
|
|
3280
|
-
_: 1
|
|
3281
|
-
})
|
|
3282
|
-
]),
|
|
3283
|
-
_: 2
|
|
3284
|
-
}, 1032, ["onClick"])
|
|
3285
|
-
]),
|
|
3286
|
-
default: withCtx(() => [
|
|
3287
|
-
createVNode(unref(NSpace), { style: { "max-height": "400px", "overflow-y": "scroll", "padding-bottom": "10px" } }, {
|
|
3288
|
-
default: withCtx(() => [
|
|
3289
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(selectorResult.results, (resultNode) => {
|
|
3290
|
-
return openBlock(), createBlock(unref(NButton), {
|
|
3291
|
-
key: resultNode.id,
|
|
3292
|
-
onClick: ($event) => _ctx.onUpdateFocusNode(resultNode),
|
|
3293
|
-
size: "small"
|
|
3294
|
-
}, {
|
|
3295
|
-
default: withCtx(() => [
|
|
3296
|
-
createTextVNode(toDisplayString(unref(getNodeLabel)(resultNode)), 1)
|
|
3297
|
-
]),
|
|
3298
|
-
_: 2
|
|
3299
|
-
}, 1032, ["onClick"]);
|
|
3300
|
-
}), 128))
|
|
3301
|
-
]),
|
|
3302
|
-
_: 2
|
|
3303
|
-
}, 1024)
|
|
3304
|
-
]),
|
|
3305
|
-
_: 2
|
|
3306
|
-
}, 1024);
|
|
3307
|
-
}), 128))
|
|
3308
|
-
]),
|
|
3309
|
-
_: 1
|
|
3310
|
-
})
|
|
3311
|
-
])
|
|
3312
|
-
]),
|
|
3313
|
-
_: 1
|
|
3314
|
-
}, 8, ["initialValue"]);
|
|
3315
|
-
};
|
|
3316
|
-
}
|
|
3317
|
-
});
|
|
3318
|
-
const _hoisted_1$1 = {
|
|
3319
|
-
flex: "",
|
|
3320
|
-
"flex-col": ""
|
|
3321
|
-
};
|
|
3322
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3323
|
-
__name: "WindowCard",
|
|
3324
|
-
props: {
|
|
3325
|
-
snapshot: {},
|
|
3326
|
-
rootNode: {},
|
|
3327
|
-
focusNode: {},
|
|
3328
|
-
onUpdateFocusNode: {
|
|
3329
|
-
type: Function,
|
|
3330
|
-
default: () => () => {
|
|
3331
|
-
}
|
|
3332
|
-
}
|
|
3333
|
-
},
|
|
3334
|
-
setup(__props) {
|
|
3335
|
-
const props = __props;
|
|
3336
|
-
const defaultExpandedKeys = shallowRef([]);
|
|
3337
|
-
watchEffect(async () => {
|
|
3338
|
-
var _a;
|
|
3339
|
-
if (!props.focusNode)
|
|
3340
|
-
return;
|
|
3341
|
-
const key = props.focusNode.id;
|
|
3342
|
-
let n = props.focusNode.parent;
|
|
3343
|
-
if (!n) {
|
|
3344
|
-
return;
|
|
3345
|
-
}
|
|
3346
|
-
const s = new Set(defaultExpandedKeys.value);
|
|
3347
|
-
while (n) {
|
|
3348
|
-
s.add(n.id);
|
|
3349
|
-
n = n.parent;
|
|
3350
|
-
}
|
|
3351
|
-
if (s.size == defaultExpandedKeys.value.length) {
|
|
3352
|
-
return;
|
|
3353
|
-
}
|
|
3354
|
-
defaultExpandedKeys.value = [...s];
|
|
3355
|
-
await nextTick();
|
|
3356
|
-
(_a = treeRef.value) == null ? void 0 : _a.scrollTo({
|
|
3357
|
-
key
|
|
3358
|
-
});
|
|
3359
|
-
});
|
|
3360
|
-
const treeRef = shallowRef();
|
|
3361
|
-
const updateCheckedKeys = (keys, options, meta) => {
|
|
3362
|
-
};
|
|
3363
|
-
const treeFilter = (pattern, node) => {
|
|
3364
|
-
var _a;
|
|
3365
|
-
return node.id === ((_a = props.focusNode) == null ? void 0 : _a.id);
|
|
3366
|
-
};
|
|
3367
|
-
const treeNodeProps = (info) => {
|
|
3368
|
-
var _a;
|
|
3369
|
-
return {
|
|
3370
|
-
onClick: () => {
|
|
3371
|
-
props.onUpdateFocusNode(info.option);
|
|
3372
|
-
},
|
|
3373
|
-
style: {
|
|
3374
|
-
color: info.option.id == ((_a = props.focusNode) == null ? void 0 : _a.id) ? `#00F` : void 0
|
|
3375
|
-
}
|
|
3376
|
-
};
|
|
3377
|
-
};
|
|
3378
|
-
const renderLabel = (info) => {
|
|
3379
|
-
return getNodeLabel(info.option);
|
|
3380
|
-
};
|
|
3381
|
-
return (_ctx, _cache) => {
|
|
3382
|
-
return openBlock(), createElementBlock("div", _hoisted_1$1, [createVNode(unref(NTable), {
|
|
3383
|
-
size: "small",
|
|
3384
|
-
striped: "",
|
|
3385
|
-
singleLine: false,
|
|
3386
|
-
class: "table-fixed",
|
|
3387
|
-
themeOverrides: {
|
|
3388
|
-
thPaddingSmall: "2px 4px",
|
|
3389
|
-
tdPaddingSmall: "2px 4px"
|
|
3390
|
-
}
|
|
3391
|
-
}, {
|
|
3392
|
-
default: withCtx(() => [createVNode(unref(NThead), null, {
|
|
3393
|
-
default: withCtx(() => [createVNode(unref(NTr), null, {
|
|
3394
|
-
default: withCtx(() => [createVNode(unref(NTh), {
|
|
3395
|
-
class: "w-140px"
|
|
3396
|
-
}, {
|
|
3397
|
-
default: withCtx(() => [createTextVNode(" Device ")]),
|
|
3398
|
-
_: 1
|
|
3399
|
-
}), createVNode(unref(NTh), {
|
|
3400
|
-
class: "w-100px"
|
|
3401
|
-
}, {
|
|
3402
|
-
default: withCtx(() => [createTextVNode(" Name ")]),
|
|
3403
|
-
_: 1
|
|
3404
|
-
}), createVNode(unref(NTh), {
|
|
3405
|
-
class: "w-100px"
|
|
3406
|
-
}, {
|
|
3407
|
-
default: withCtx(() => [createTextVNode(" VersionName ")]),
|
|
3408
|
-
_: 1
|
|
3409
|
-
}), createVNode(unref(NTh), {
|
|
3410
|
-
class: "w-100px"
|
|
3411
|
-
}, {
|
|
3412
|
-
default: withCtx(() => [createTextVNode(" VersionCode ")]),
|
|
3413
|
-
_: 1
|
|
3414
|
-
}), createVNode(unref(NTh), {
|
|
3415
|
-
class: "w-150px"
|
|
3416
|
-
}, {
|
|
3417
|
-
default: withCtx(() => [createTextVNode(" AppId ")]),
|
|
3418
|
-
_: 1
|
|
3419
|
-
}), createVNode(unref(NTh), null, {
|
|
3420
|
-
default: withCtx(() => [createTextVNode(" ActivityId ")]),
|
|
3421
|
-
_: 1
|
|
3422
|
-
}), createVNode(unref(NTh), {
|
|
3423
|
-
class: "w-175px"
|
|
3424
|
-
}, {
|
|
3425
|
-
default: withCtx(() => [createTextVNode(" 操作 ")]),
|
|
3426
|
-
_: 1
|
|
3427
|
-
})]),
|
|
3428
|
-
_: 1
|
|
3429
|
-
})]),
|
|
3430
|
-
_: 1
|
|
3431
|
-
}), createVNode(unref(NTbody), null, {
|
|
3432
|
-
default: withCtx(() => [createVNode(unref(NTr), null, {
|
|
3433
|
-
default: withCtx(() => [createVNode(unref(NTd), {
|
|
3434
|
-
class: "whitespace-nowrap"
|
|
3435
|
-
}, {
|
|
3436
|
-
default: withCtx(() => [createTextVNode(toDisplayString(`${unref(getDevice)(_ctx.snapshot).manufacturer} Android ${unref(getDevice)(_ctx.snapshot).release || ``}`), 1)]),
|
|
3437
|
-
_: 1
|
|
3438
|
-
}), createVNode(unref(NTd), {
|
|
3439
|
-
class: "whitespace-nowrap",
|
|
3440
|
-
onClick: _cache[0] || (_cache[0] = ($event) => unref(copy)(_ctx.snapshot.appName))
|
|
3441
|
-
}, {
|
|
3442
|
-
default: withCtx(() => [createVNode(unref(NEllipsis), null, {
|
|
3443
|
-
default: withCtx(() => [createTextVNode(toDisplayString(_ctx.snapshot.appName), 1)]),
|
|
3444
|
-
_: 1
|
|
3445
|
-
})]),
|
|
3446
|
-
_: 1
|
|
3447
|
-
}), createVNode(unref(NTd), {
|
|
3448
|
-
class: "whitespace-nowrap",
|
|
3449
|
-
onClick: _cache[1] || (_cache[1] = ($event) => unref(copy)(_ctx.snapshot.appVersionName))
|
|
3450
|
-
}, {
|
|
3451
|
-
default: withCtx(() => [createVNode(unref(NEllipsis), null, {
|
|
3452
|
-
default: withCtx(() => [createTextVNode(toDisplayString(_ctx.snapshot.appVersionName), 1)]),
|
|
3453
|
-
_: 1
|
|
3454
|
-
})]),
|
|
3455
|
-
_: 1
|
|
3456
|
-
}), createVNode(unref(NTd), {
|
|
3457
|
-
class: "whitespace-nowrap",
|
|
3458
|
-
onClick: _cache[2] || (_cache[2] = ($event) => unref(copy)(_ctx.snapshot.appVersionCode.toString()))
|
|
3459
|
-
}, {
|
|
3460
|
-
default: withCtx(() => [createVNode(unref(NEllipsis), null, {
|
|
3461
|
-
default: withCtx(() => [createTextVNode(toDisplayString(_ctx.snapshot.appVersionCode), 1)]),
|
|
3462
|
-
_: 1
|
|
3463
|
-
})]),
|
|
3464
|
-
_: 1
|
|
3465
|
-
}), createVNode(unref(NTd), {
|
|
3466
|
-
class: "whitespace-nowrap",
|
|
3467
|
-
onClick: _cache[3] || (_cache[3] = ($event) => unref(copy)(_ctx.snapshot.appId))
|
|
3468
|
-
}, {
|
|
3469
|
-
default: withCtx(() => [createVNode(unref(NEllipsis), null, {
|
|
3470
|
-
default: withCtx(() => [createTextVNode(toDisplayString(_ctx.snapshot.appId), 1)]),
|
|
3471
|
-
_: 1
|
|
3472
|
-
})]),
|
|
3473
|
-
_: 1
|
|
3474
|
-
}), createVNode(unref(NTd), {
|
|
3475
|
-
onClick: _cache[4] || (_cache[4] = ($event) => unref(copy)(_ctx.snapshot.activityId)),
|
|
3476
|
-
class: "break-words"
|
|
3477
|
-
}, {
|
|
3478
|
-
default: withCtx(() => [createVNode(unref(NEllipsis), null, {
|
|
3479
|
-
default: withCtx(() => [createTextVNode(toDisplayString(_ctx.snapshot.activityId), 1)]),
|
|
3480
|
-
_: 1
|
|
3481
|
-
})]),
|
|
3482
|
-
_: 1
|
|
3483
|
-
}), createVNode(unref(NTd), null, {
|
|
3484
|
-
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
3485
|
-
_: 3
|
|
3486
|
-
})]),
|
|
3487
|
-
_: 3
|
|
3488
|
-
})]),
|
|
3489
|
-
_: 3
|
|
3490
|
-
})]),
|
|
3491
|
-
_: 3
|
|
3492
|
-
}), createVNode(unref(NTree), {
|
|
3493
|
-
ref_key: "treeRef",
|
|
3494
|
-
ref: treeRef,
|
|
3495
|
-
virtualScroll: "",
|
|
3496
|
-
showLine: "",
|
|
3497
|
-
"onUpdate:checkedKeys": updateCheckedKeys,
|
|
3498
|
-
keyField: "id",
|
|
3499
|
-
defaultExpandedKeys: defaultExpandedKeys.value,
|
|
3500
|
-
data: [_ctx.rootNode],
|
|
3501
|
-
filter: treeFilter,
|
|
3502
|
-
nodeProps: treeNodeProps,
|
|
3503
|
-
renderLabel,
|
|
3504
|
-
style: {
|
|
3505
|
-
"--n-border-color": "rgb(239, 239, 245)"
|
|
3506
|
-
}
|
|
3507
|
-
}, null, 8, ["defaultExpandedKeys", "data", "filter", "nodeProps", "renderLabel"])]);
|
|
3508
|
-
};
|
|
3509
|
-
}
|
|
3510
|
-
});
|
|
3511
|
-
const _hoisted_1 = {
|
|
3512
|
-
"h-full": "",
|
|
3513
|
-
flex: "",
|
|
3514
|
-
"gap-5px": "",
|
|
3515
|
-
"p-5px": "",
|
|
3516
|
-
"box-border": ""
|
|
3517
|
-
};
|
|
3518
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3519
|
-
__name: "SnapshotPage",
|
|
3520
|
-
setup(__props) {
|
|
3521
|
-
const route = useRoute();
|
|
3522
|
-
const router = useRouter();
|
|
3523
|
-
const title = useTitle();
|
|
3524
|
-
const snapshotId = computed(() => String(route.params.snapshotId || ``));
|
|
3525
|
-
const showSize = computed(() => {
|
|
3526
|
-
const n = Number(route.query.showSize || ``);
|
|
3527
|
-
if (!Number.isSafeInteger(n) || n <= 0) {
|
|
3528
|
-
return 2e3;
|
|
3529
|
-
}
|
|
3530
|
-
return n;
|
|
3531
|
-
});
|
|
3532
|
-
const screenshotUrl = shallowRef(``);
|
|
3533
|
-
const snapshot = shallowRef();
|
|
3534
|
-
watchEffect(async () => {
|
|
3535
|
-
const localSnapshot = await snapshotStorage.getItem(snapshotId.value);
|
|
3536
|
-
if (!localSnapshot) {
|
|
3537
|
-
message.error(`快照数据缺失`);
|
|
3538
|
-
return;
|
|
3539
|
-
}
|
|
3540
|
-
if (gmOk()) {
|
|
3541
|
-
setTimeout(async () => {
|
|
3542
|
-
exportSnapshotAsJpgUrl(localSnapshot);
|
|
3543
|
-
if (!githubZipStorage[localSnapshot.id]) {
|
|
3544
|
-
exportSnapshotAsZipUrl(
|
|
3545
|
-
await snapshotStorage.getItem(snapshotId.value)
|
|
3546
|
-
);
|
|
3547
|
-
}
|
|
3548
|
-
}, 1e3);
|
|
3549
|
-
}
|
|
3550
|
-
if (localSnapshot.nodes.length > showSize.value) {
|
|
3551
|
-
message.warning(
|
|
3552
|
-
`当前展示节点数量为${showSize.value}
|
|
3553
|
-
之后的${localSnapshot.nodes.length - showSize.value}个节点将被丢弃
|
|
3554
|
-
使用showSize查询参数可以修改展示数量`
|
|
3555
|
-
);
|
|
3556
|
-
localSnapshot.nodes = localSnapshot.nodes.slice(0, showSize.value);
|
|
3557
|
-
}
|
|
3558
|
-
const bf = await screenshotStorage.getItem(snapshotId.value);
|
|
3559
|
-
if (!bf) {
|
|
3560
|
-
message.create(`截屏数据缺失`);
|
|
3561
|
-
return;
|
|
3562
|
-
}
|
|
3563
|
-
screenshotUrl.value = URL.createObjectURL(
|
|
3564
|
-
new Blob([bf], {
|
|
3565
|
-
type: "image/png"
|
|
3566
|
-
})
|
|
3567
|
-
);
|
|
3568
|
-
snapshot.value = localSnapshot;
|
|
3569
|
-
rootNode.value = listToTree(localSnapshot.nodes);
|
|
3570
|
-
title.value = "快照-" + localSnapshot.appName || localSnapshot.appId;
|
|
3571
|
-
await delay(500);
|
|
3572
|
-
if (!focusNode.value) {
|
|
3573
|
-
focusNode.value = rootNode.value;
|
|
3574
|
-
}
|
|
3575
|
-
});
|
|
3576
|
-
const rootNode = shallowRef();
|
|
3577
|
-
const focusNode = shallowRef();
|
|
3578
|
-
const onDelete = async () => {
|
|
3579
|
-
message.success(`删除成功,即将回到首页`);
|
|
3580
|
-
await delay(2e3);
|
|
3581
|
-
router.replace({
|
|
3582
|
-
path: `/`
|
|
3583
|
-
});
|
|
3584
|
-
};
|
|
3585
|
-
return (_ctx, _cache) => {
|
|
3586
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
3587
|
-
screenshotUrl.value && snapshot.value ? (openBlock(), createBlock(_sfc_main$3, {
|
|
3588
|
-
key: 0,
|
|
3589
|
-
url: screenshotUrl.value,
|
|
3590
|
-
snapshot: snapshot.value,
|
|
3591
|
-
rootNode: rootNode.value,
|
|
3592
|
-
focusNode: focusNode.value,
|
|
3593
|
-
onUpdateFocusNode: _cache[0] || (_cache[0] = ($event) => focusNode.value = $event)
|
|
3594
|
-
}, null, 8, ["url", "snapshot", "rootNode", "focusNode"])) : createCommentVNode("", true),
|
|
3595
|
-
snapshot.value && rootNode.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
3596
|
-
key: 1,
|
|
3597
|
-
rootNode: rootNode.value,
|
|
3598
|
-
snapshot: snapshot.value,
|
|
3599
|
-
focusNode: focusNode.value,
|
|
3600
|
-
onUpdateFocusNode: _cache[1] || (_cache[1] = ($event) => focusNode.value = $event),
|
|
3601
|
-
class: "flex-1"
|
|
3602
|
-
}, {
|
|
3603
|
-
default: withCtx(() => [
|
|
3604
|
-
snapshot.value ? (openBlock(), createBlock(_sfc_main$6, {
|
|
3605
|
-
key: 0,
|
|
3606
|
-
snapshot: snapshot.value,
|
|
3607
|
-
onDelete,
|
|
3608
|
-
showPreview: false
|
|
3609
|
-
}, null, 8, ["snapshot"])) : createCommentVNode("", true)
|
|
3610
|
-
]),
|
|
3611
|
-
_: 1
|
|
3612
|
-
}, 8, ["rootNode", "snapshot", "focusNode"])) : createCommentVNode("", true),
|
|
3613
|
-
focusNode.value ? (openBlock(), createBlock(_sfc_main$4, {
|
|
3614
|
-
key: 2,
|
|
3615
|
-
focusNode: focusNode.value
|
|
3616
|
-
}, null, 8, ["focusNode"])) : createCommentVNode("", true),
|
|
3617
|
-
rootNode.value ? (openBlock(), createBlock(_sfc_main$2, {
|
|
3618
|
-
key: 3,
|
|
3619
|
-
snapshot: snapshot.value,
|
|
3620
|
-
rootNode: rootNode.value,
|
|
3621
|
-
onUpdateFocusNode: _cache[2] || (_cache[2] = ($event) => focusNode.value = $event)
|
|
3622
|
-
}, null, 8, ["snapshot", "rootNode"])) : createCommentVNode("", true)
|
|
3623
|
-
]);
|
|
3624
|
-
};
|
|
3625
|
-
}
|
|
3626
|
-
});
|
|
3627
|
-
export {
|
|
3628
|
-
_sfc_main as default
|
|
3629
|
-
};
|