xxl-job-vue3 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/403-D8dRpQKz.js +36 -0
- package/dist/404-DXM7nyXC.js +36 -0
- package/dist/500-BUCjxPG1.js +36 -0
- package/dist/CrontabDay-DqR3VUYR.js +4 -0
- package/dist/CrontabHour-B0Ub5MaR.js +4 -0
- package/dist/CrontabMin-DtjfCxp1.js +4 -0
- package/dist/CrontabMonth-BU6m9TVZ.js +4 -0
- package/dist/CrontabResult-DGO_apJU.js +4 -0
- package/dist/CrontabSecond-BqQGVOZ9.js +4 -0
- package/dist/CrontabWeek-DHqRjAy-.js +4 -0
- package/dist/CrontabYear-D3Z1OkFC.js +4 -0
- package/dist/EditExecutor-C-jVvoY3.js +4 -0
- package/dist/JobTaskClearDialog-CpXLIi7N.js +4 -0
- package/dist/RunOnceView-Bk8stgp6.js +4 -0
- package/dist/favicon.ico +0 -0
- package/dist/index-Bf5gEacT.js +98346 -0
- package/dist/index-Btu-nIzi.js +4 -0
- package/dist/index-CXZ4_Fnb.js +4 -0
- package/dist/index-OKUPhEWh.js +4012 -0
- package/dist/index-tWx7VrPi.js +4 -0
- package/dist/xxl-job-vue3.es.js +8 -0
- package/dist/xxl-job-vue3.umd.js +75 -0
- package/package.json +136 -0
|
@@ -0,0 +1,4012 @@
|
|
|
1
|
+
import { defineComponent, ref, provide, onMounted, createElementBlock, openBlock, unref, normalizeClass, renderSlot, getCurrentInstance, inject, createElementVNode, createBlock, withCtx, resolveDynamicComponent, toDisplayString, Transition, mergeProps, toHandlers, shallowRef, computed, watch, normalizeStyle, Fragment, renderList, watchEffect, reactive, nextTick, createCommentVNode, withDirectives, createVNode, vShow, withKeys, createTextVNode, useSlots, onBeforeUnmount, h, toRef, resolveComponent, isRef, KeepAlive, TransitionGroup } from "vue";
|
|
2
|
+
import { n as buildProps, o as iconPropType, p as _export_sfc, u as useLocale, q as useNamespace, r as definePropType, E as ElIcon, w as withInstall, s as withNoopInstall, t as isClient, v as addUnit, x as EVENT_CODE, y as isString, z as isNil, C as CHANGE_EVENT, U as UPDATE_MODEL_EVENT, A as useAriaProps, B as useTooltipContentProps, D as useSizeProp, F as hasOwn, G as useFormItem, H as useFormSize, I as useFormDisabled, J as useFormItemInputId, K as useFocusController, L as debounce, M as ElTooltip, N as arrow_down_default, O as close_default, P as ElInput, Q as ElButton, R as ClickOutside, S as debugWarn, T as triggerEvent, V as addClass, W as hasClass, X as removeClass, Y as TinyColor, Z as throwError, $ as arrow_right_default, a0 as useTimeoutFn, a1 as isArray, a2 as isObject, a3 as useResizeObserver, a4 as flattedChildren, a5 as more_default, a6 as mutable, a7 as useGlobalStore, a8 as DEFAULT_PRIMARY, a9 as ElSwitch, aa as moon_default, ab as sunny_default, ac as ElDrawer, ad as _export_sfc$1, ae as piniaPersistConfig, af as getUrlWithParams, ag as router, ah as useAuthStore, ai as useRoute, aj as useRouter, ak as ElDropdown, al as ElDropdownMenu, am as ElDropdownItem, an as Sortable, ao as ElTabs, ap as ElTabPane, aq as useDebounceFn, ar as useUserStore, as as normalizeStyle$1, at as ElScrollbar } from "./index-Bf5gEacT.js";
|
|
3
|
+
import { storeToRefs, defineStore } from "pinia";
|
|
4
|
+
import { ElMessage } from "element-plus";
|
|
5
|
+
const breadcrumbKey = Symbol("breadcrumbKey");
|
|
6
|
+
const breadcrumbProps = buildProps({
|
|
7
|
+
separator: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: "/"
|
|
10
|
+
},
|
|
11
|
+
separatorIcon: {
|
|
12
|
+
type: iconPropType
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const __default__$h = defineComponent({
|
|
16
|
+
name: "ElBreadcrumb"
|
|
17
|
+
});
|
|
18
|
+
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
19
|
+
...__default__$h,
|
|
20
|
+
props: breadcrumbProps,
|
|
21
|
+
setup(__props) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const { t } = useLocale();
|
|
24
|
+
const ns = useNamespace("breadcrumb");
|
|
25
|
+
const breadcrumb = ref();
|
|
26
|
+
provide(breadcrumbKey, props);
|
|
27
|
+
onMounted(() => {
|
|
28
|
+
const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
|
|
29
|
+
if (items.length) {
|
|
30
|
+
items[items.length - 1].setAttribute("aria-current", "page");
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return (_ctx, _cache) => {
|
|
34
|
+
return openBlock(), createElementBlock("div", {
|
|
35
|
+
ref_key: "breadcrumb",
|
|
36
|
+
ref: breadcrumb,
|
|
37
|
+
class: normalizeClass(unref(ns).b()),
|
|
38
|
+
"aria-label": unref(t)("el.breadcrumb.label"),
|
|
39
|
+
role: "navigation"
|
|
40
|
+
}, [
|
|
41
|
+
renderSlot(_ctx.$slots, "default")
|
|
42
|
+
], 10, ["aria-label"]);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
var Breadcrumb$1 = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__file", "breadcrumb.vue"]]);
|
|
47
|
+
const breadcrumbItemProps = buildProps({
|
|
48
|
+
to: {
|
|
49
|
+
type: definePropType([String, Object]),
|
|
50
|
+
default: ""
|
|
51
|
+
},
|
|
52
|
+
replace: Boolean
|
|
53
|
+
});
|
|
54
|
+
const __default__$g = defineComponent({
|
|
55
|
+
name: "ElBreadcrumbItem"
|
|
56
|
+
});
|
|
57
|
+
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
58
|
+
...__default__$g,
|
|
59
|
+
props: breadcrumbItemProps,
|
|
60
|
+
setup(__props) {
|
|
61
|
+
const props = __props;
|
|
62
|
+
const instance = getCurrentInstance();
|
|
63
|
+
const breadcrumbContext = inject(breadcrumbKey, void 0);
|
|
64
|
+
const ns = useNamespace("breadcrumb");
|
|
65
|
+
const router2 = instance.appContext.config.globalProperties.$router;
|
|
66
|
+
const link = ref();
|
|
67
|
+
const onClick = () => {
|
|
68
|
+
if (!props.to || !router2)
|
|
69
|
+
return;
|
|
70
|
+
props.replace ? router2.replace(props.to) : router2.push(props.to);
|
|
71
|
+
};
|
|
72
|
+
return (_ctx, _cache) => {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
return openBlock(), createElementBlock("span", {
|
|
75
|
+
class: normalizeClass(unref(ns).e("item"))
|
|
76
|
+
}, [
|
|
77
|
+
createElementVNode("span", {
|
|
78
|
+
ref_key: "link",
|
|
79
|
+
ref: link,
|
|
80
|
+
class: normalizeClass([unref(ns).e("inner"), unref(ns).is("link", !!_ctx.to)]),
|
|
81
|
+
role: "link",
|
|
82
|
+
onClick
|
|
83
|
+
}, [
|
|
84
|
+
renderSlot(_ctx.$slots, "default")
|
|
85
|
+
], 2),
|
|
86
|
+
((_a = unref(breadcrumbContext)) == null ? void 0 : _a.separatorIcon) ? (openBlock(), createBlock(unref(ElIcon), {
|
|
87
|
+
key: 0,
|
|
88
|
+
class: normalizeClass(unref(ns).e("separator"))
|
|
89
|
+
}, {
|
|
90
|
+
default: withCtx(() => [
|
|
91
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(breadcrumbContext).separatorIcon)))
|
|
92
|
+
]),
|
|
93
|
+
_: 1
|
|
94
|
+
}, 8, ["class"])) : (openBlock(), createElementBlock("span", {
|
|
95
|
+
key: 1,
|
|
96
|
+
class: normalizeClass(unref(ns).e("separator")),
|
|
97
|
+
role: "presentation"
|
|
98
|
+
}, toDisplayString((_b = unref(breadcrumbContext)) == null ? void 0 : _b.separator), 3))
|
|
99
|
+
], 2);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
var BreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__file", "breadcrumb-item.vue"]]);
|
|
104
|
+
const ElBreadcrumb = withInstall(Breadcrumb$1, {
|
|
105
|
+
BreadcrumbItem
|
|
106
|
+
});
|
|
107
|
+
const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem);
|
|
108
|
+
const __default__$f = defineComponent({
|
|
109
|
+
name: "ElCollapseTransition"
|
|
110
|
+
});
|
|
111
|
+
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
112
|
+
...__default__$f,
|
|
113
|
+
setup(__props) {
|
|
114
|
+
const ns = useNamespace("collapse-transition");
|
|
115
|
+
const reset = (el) => {
|
|
116
|
+
el.style.maxHeight = "";
|
|
117
|
+
el.style.overflow = el.dataset.oldOverflow;
|
|
118
|
+
el.style.paddingTop = el.dataset.oldPaddingTop;
|
|
119
|
+
el.style.paddingBottom = el.dataset.oldPaddingBottom;
|
|
120
|
+
};
|
|
121
|
+
const on = {
|
|
122
|
+
beforeEnter(el) {
|
|
123
|
+
if (!el.dataset)
|
|
124
|
+
el.dataset = {};
|
|
125
|
+
el.dataset.oldPaddingTop = el.style.paddingTop;
|
|
126
|
+
el.dataset.oldPaddingBottom = el.style.paddingBottom;
|
|
127
|
+
if (el.style.height)
|
|
128
|
+
el.dataset.elExistsHeight = el.style.height;
|
|
129
|
+
el.style.maxHeight = 0;
|
|
130
|
+
el.style.paddingTop = 0;
|
|
131
|
+
el.style.paddingBottom = 0;
|
|
132
|
+
},
|
|
133
|
+
enter(el) {
|
|
134
|
+
requestAnimationFrame(() => {
|
|
135
|
+
el.dataset.oldOverflow = el.style.overflow;
|
|
136
|
+
if (el.dataset.elExistsHeight) {
|
|
137
|
+
el.style.maxHeight = el.dataset.elExistsHeight;
|
|
138
|
+
} else if (el.scrollHeight !== 0) {
|
|
139
|
+
el.style.maxHeight = `${el.scrollHeight}px`;
|
|
140
|
+
} else {
|
|
141
|
+
el.style.maxHeight = 0;
|
|
142
|
+
}
|
|
143
|
+
el.style.paddingTop = el.dataset.oldPaddingTop;
|
|
144
|
+
el.style.paddingBottom = el.dataset.oldPaddingBottom;
|
|
145
|
+
el.style.overflow = "hidden";
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
afterEnter(el) {
|
|
149
|
+
el.style.maxHeight = "";
|
|
150
|
+
el.style.overflow = el.dataset.oldOverflow;
|
|
151
|
+
},
|
|
152
|
+
enterCancelled(el) {
|
|
153
|
+
reset(el);
|
|
154
|
+
},
|
|
155
|
+
beforeLeave(el) {
|
|
156
|
+
if (!el.dataset)
|
|
157
|
+
el.dataset = {};
|
|
158
|
+
el.dataset.oldPaddingTop = el.style.paddingTop;
|
|
159
|
+
el.dataset.oldPaddingBottom = el.style.paddingBottom;
|
|
160
|
+
el.dataset.oldOverflow = el.style.overflow;
|
|
161
|
+
el.style.maxHeight = `${el.scrollHeight}px`;
|
|
162
|
+
el.style.overflow = "hidden";
|
|
163
|
+
},
|
|
164
|
+
leave(el) {
|
|
165
|
+
if (el.scrollHeight !== 0) {
|
|
166
|
+
el.style.maxHeight = 0;
|
|
167
|
+
el.style.paddingTop = 0;
|
|
168
|
+
el.style.paddingBottom = 0;
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
afterLeave(el) {
|
|
172
|
+
reset(el);
|
|
173
|
+
},
|
|
174
|
+
leaveCancelled(el) {
|
|
175
|
+
reset(el);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
return (_ctx, _cache) => {
|
|
179
|
+
return openBlock(), createBlock(Transition, mergeProps({
|
|
180
|
+
name: unref(ns).b()
|
|
181
|
+
}, toHandlers(on)), {
|
|
182
|
+
default: withCtx(() => [
|
|
183
|
+
renderSlot(_ctx.$slots, "default")
|
|
184
|
+
]),
|
|
185
|
+
_: 3
|
|
186
|
+
}, 16, ["name"]);
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__file", "collapse-transition.vue"]]);
|
|
191
|
+
const ElCollapseTransition = withInstall(CollapseTransition);
|
|
192
|
+
const alphaSliderProps = buildProps({
|
|
193
|
+
color: {
|
|
194
|
+
type: definePropType(Object),
|
|
195
|
+
required: true
|
|
196
|
+
},
|
|
197
|
+
vertical: {
|
|
198
|
+
type: Boolean,
|
|
199
|
+
default: false
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
let isDragging = false;
|
|
203
|
+
function draggable(element, options) {
|
|
204
|
+
if (!isClient)
|
|
205
|
+
return;
|
|
206
|
+
const moveFn = function(event) {
|
|
207
|
+
var _a;
|
|
208
|
+
(_a = options.drag) == null ? void 0 : _a.call(options, event);
|
|
209
|
+
};
|
|
210
|
+
const upFn = function(event) {
|
|
211
|
+
var _a;
|
|
212
|
+
document.removeEventListener("mousemove", moveFn);
|
|
213
|
+
document.removeEventListener("mouseup", upFn);
|
|
214
|
+
document.removeEventListener("touchmove", moveFn);
|
|
215
|
+
document.removeEventListener("touchend", upFn);
|
|
216
|
+
document.onselectstart = null;
|
|
217
|
+
document.ondragstart = null;
|
|
218
|
+
isDragging = false;
|
|
219
|
+
(_a = options.end) == null ? void 0 : _a.call(options, event);
|
|
220
|
+
};
|
|
221
|
+
const downFn = function(event) {
|
|
222
|
+
var _a;
|
|
223
|
+
if (isDragging)
|
|
224
|
+
return;
|
|
225
|
+
event.preventDefault();
|
|
226
|
+
document.onselectstart = () => false;
|
|
227
|
+
document.ondragstart = () => false;
|
|
228
|
+
document.addEventListener("mousemove", moveFn);
|
|
229
|
+
document.addEventListener("mouseup", upFn);
|
|
230
|
+
document.addEventListener("touchmove", moveFn);
|
|
231
|
+
document.addEventListener("touchend", upFn);
|
|
232
|
+
isDragging = true;
|
|
233
|
+
(_a = options.start) == null ? void 0 : _a.call(options, event);
|
|
234
|
+
};
|
|
235
|
+
element.addEventListener("mousedown", downFn);
|
|
236
|
+
element.addEventListener("touchstart", downFn, { passive: false });
|
|
237
|
+
}
|
|
238
|
+
const getClientXY = (event) => {
|
|
239
|
+
let clientX;
|
|
240
|
+
let clientY;
|
|
241
|
+
if (event.type === "touchend") {
|
|
242
|
+
clientY = event.changedTouches[0].clientY;
|
|
243
|
+
clientX = event.changedTouches[0].clientX;
|
|
244
|
+
} else if (event.type.startsWith("touch")) {
|
|
245
|
+
clientY = event.touches[0].clientY;
|
|
246
|
+
clientX = event.touches[0].clientX;
|
|
247
|
+
} else {
|
|
248
|
+
clientY = event.clientY;
|
|
249
|
+
clientX = event.clientX;
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
clientX,
|
|
253
|
+
clientY
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
const useAlphaSlider = (props) => {
|
|
257
|
+
const instance = getCurrentInstance();
|
|
258
|
+
const { t } = useLocale();
|
|
259
|
+
const thumb = shallowRef();
|
|
260
|
+
const bar = shallowRef();
|
|
261
|
+
const alpha = computed(() => props.color.get("alpha"));
|
|
262
|
+
const alphaLabel = computed(() => t("el.colorpicker.alphaLabel"));
|
|
263
|
+
function handleClick(event) {
|
|
264
|
+
var _a;
|
|
265
|
+
const target = event.target;
|
|
266
|
+
if (target !== thumb.value) {
|
|
267
|
+
handleDrag(event);
|
|
268
|
+
}
|
|
269
|
+
(_a = thumb.value) == null ? void 0 : _a.focus();
|
|
270
|
+
}
|
|
271
|
+
function handleDrag(event) {
|
|
272
|
+
if (!bar.value || !thumb.value)
|
|
273
|
+
return;
|
|
274
|
+
const el = instance.vnode.el;
|
|
275
|
+
const rect = el.getBoundingClientRect();
|
|
276
|
+
const { clientX, clientY } = getClientXY(event);
|
|
277
|
+
if (!props.vertical) {
|
|
278
|
+
let left = clientX - rect.left;
|
|
279
|
+
left = Math.max(thumb.value.offsetWidth / 2, left);
|
|
280
|
+
left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
|
|
281
|
+
props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
|
|
282
|
+
} else {
|
|
283
|
+
let top = clientY - rect.top;
|
|
284
|
+
top = Math.max(thumb.value.offsetHeight / 2, top);
|
|
285
|
+
top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
|
|
286
|
+
props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function handleKeydown(event) {
|
|
290
|
+
const { code, shiftKey } = event;
|
|
291
|
+
const step = shiftKey ? 10 : 1;
|
|
292
|
+
switch (code) {
|
|
293
|
+
case EVENT_CODE.left:
|
|
294
|
+
case EVENT_CODE.down:
|
|
295
|
+
event.preventDefault();
|
|
296
|
+
event.stopPropagation();
|
|
297
|
+
incrementPosition(-step);
|
|
298
|
+
break;
|
|
299
|
+
case EVENT_CODE.right:
|
|
300
|
+
case EVENT_CODE.up:
|
|
301
|
+
event.preventDefault();
|
|
302
|
+
event.stopPropagation();
|
|
303
|
+
incrementPosition(step);
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
function incrementPosition(step) {
|
|
308
|
+
let next = alpha.value + step;
|
|
309
|
+
next = next < 0 ? 0 : next > 100 ? 100 : next;
|
|
310
|
+
props.color.set("alpha", next);
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
thumb,
|
|
314
|
+
bar,
|
|
315
|
+
alpha,
|
|
316
|
+
alphaLabel,
|
|
317
|
+
handleDrag,
|
|
318
|
+
handleClick,
|
|
319
|
+
handleKeydown
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
const useAlphaSliderDOM = (props, {
|
|
323
|
+
bar,
|
|
324
|
+
thumb,
|
|
325
|
+
handleDrag
|
|
326
|
+
}) => {
|
|
327
|
+
const instance = getCurrentInstance();
|
|
328
|
+
const ns = useNamespace("color-alpha-slider");
|
|
329
|
+
const thumbLeft = ref(0);
|
|
330
|
+
const thumbTop = ref(0);
|
|
331
|
+
const background = ref();
|
|
332
|
+
function getThumbLeft() {
|
|
333
|
+
if (!thumb.value)
|
|
334
|
+
return 0;
|
|
335
|
+
if (props.vertical)
|
|
336
|
+
return 0;
|
|
337
|
+
const el = instance.vnode.el;
|
|
338
|
+
const alpha = props.color.get("alpha");
|
|
339
|
+
if (!el)
|
|
340
|
+
return 0;
|
|
341
|
+
return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
|
|
342
|
+
}
|
|
343
|
+
function getThumbTop() {
|
|
344
|
+
if (!thumb.value)
|
|
345
|
+
return 0;
|
|
346
|
+
const el = instance.vnode.el;
|
|
347
|
+
if (!props.vertical)
|
|
348
|
+
return 0;
|
|
349
|
+
const alpha = props.color.get("alpha");
|
|
350
|
+
if (!el)
|
|
351
|
+
return 0;
|
|
352
|
+
return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
|
|
353
|
+
}
|
|
354
|
+
function getBackground() {
|
|
355
|
+
if (props.color && props.color.value) {
|
|
356
|
+
const { r, g, b } = props.color.toRgb();
|
|
357
|
+
return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
|
|
358
|
+
}
|
|
359
|
+
return "";
|
|
360
|
+
}
|
|
361
|
+
function update() {
|
|
362
|
+
thumbLeft.value = getThumbLeft();
|
|
363
|
+
thumbTop.value = getThumbTop();
|
|
364
|
+
background.value = getBackground();
|
|
365
|
+
}
|
|
366
|
+
onMounted(() => {
|
|
367
|
+
if (!bar.value || !thumb.value)
|
|
368
|
+
return;
|
|
369
|
+
const dragConfig = {
|
|
370
|
+
drag: (event) => {
|
|
371
|
+
handleDrag(event);
|
|
372
|
+
},
|
|
373
|
+
end: (event) => {
|
|
374
|
+
handleDrag(event);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
draggable(bar.value, dragConfig);
|
|
378
|
+
draggable(thumb.value, dragConfig);
|
|
379
|
+
update();
|
|
380
|
+
});
|
|
381
|
+
watch(() => props.color.get("alpha"), () => update());
|
|
382
|
+
watch(() => props.color.value, () => update());
|
|
383
|
+
const rootKls = computed(() => [ns.b(), ns.is("vertical", props.vertical)]);
|
|
384
|
+
const barKls = computed(() => ns.e("bar"));
|
|
385
|
+
const thumbKls = computed(() => ns.e("thumb"));
|
|
386
|
+
const barStyle = computed(() => ({ background: background.value }));
|
|
387
|
+
const thumbStyle = computed(() => ({
|
|
388
|
+
left: addUnit(thumbLeft.value),
|
|
389
|
+
top: addUnit(thumbTop.value)
|
|
390
|
+
}));
|
|
391
|
+
return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update };
|
|
392
|
+
};
|
|
393
|
+
const COMPONENT_NAME$2 = "ElColorAlphaSlider";
|
|
394
|
+
const __default__$e = defineComponent({
|
|
395
|
+
name: COMPONENT_NAME$2
|
|
396
|
+
});
|
|
397
|
+
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
398
|
+
...__default__$e,
|
|
399
|
+
props: alphaSliderProps,
|
|
400
|
+
setup(__props, { expose }) {
|
|
401
|
+
const props = __props;
|
|
402
|
+
const {
|
|
403
|
+
alpha,
|
|
404
|
+
alphaLabel,
|
|
405
|
+
bar,
|
|
406
|
+
thumb,
|
|
407
|
+
handleDrag,
|
|
408
|
+
handleClick,
|
|
409
|
+
handleKeydown
|
|
410
|
+
} = useAlphaSlider(props);
|
|
411
|
+
const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
|
|
412
|
+
bar,
|
|
413
|
+
thumb,
|
|
414
|
+
handleDrag
|
|
415
|
+
});
|
|
416
|
+
expose({
|
|
417
|
+
update,
|
|
418
|
+
bar,
|
|
419
|
+
thumb
|
|
420
|
+
});
|
|
421
|
+
return (_ctx, _cache) => {
|
|
422
|
+
return openBlock(), createElementBlock("div", {
|
|
423
|
+
class: normalizeClass(unref(rootKls))
|
|
424
|
+
}, [
|
|
425
|
+
createElementVNode("div", {
|
|
426
|
+
ref_key: "bar",
|
|
427
|
+
ref: bar,
|
|
428
|
+
class: normalizeClass(unref(barKls)),
|
|
429
|
+
style: normalizeStyle(unref(barStyle)),
|
|
430
|
+
onClick: unref(handleClick)
|
|
431
|
+
}, null, 14, ["onClick"]),
|
|
432
|
+
createElementVNode("div", {
|
|
433
|
+
ref_key: "thumb",
|
|
434
|
+
ref: thumb,
|
|
435
|
+
class: normalizeClass(unref(thumbKls)),
|
|
436
|
+
style: normalizeStyle(unref(thumbStyle)),
|
|
437
|
+
"aria-label": unref(alphaLabel),
|
|
438
|
+
"aria-valuenow": unref(alpha),
|
|
439
|
+
"aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
|
|
440
|
+
"aria-valuemin": "0",
|
|
441
|
+
"aria-valuemax": "100",
|
|
442
|
+
role: "slider",
|
|
443
|
+
tabindex: "0",
|
|
444
|
+
onKeydown: unref(handleKeydown)
|
|
445
|
+
}, null, 46, ["aria-label", "aria-valuenow", "aria-orientation", "onKeydown"])
|
|
446
|
+
], 2);
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__file", "alpha-slider.vue"]]);
|
|
451
|
+
const _sfc_main$u = defineComponent({
|
|
452
|
+
name: "ElColorHueSlider",
|
|
453
|
+
props: {
|
|
454
|
+
color: {
|
|
455
|
+
type: Object,
|
|
456
|
+
required: true
|
|
457
|
+
},
|
|
458
|
+
vertical: Boolean
|
|
459
|
+
},
|
|
460
|
+
setup(props) {
|
|
461
|
+
const ns = useNamespace("color-hue-slider");
|
|
462
|
+
const instance = getCurrentInstance();
|
|
463
|
+
const thumb = ref();
|
|
464
|
+
const bar = ref();
|
|
465
|
+
const thumbLeft = ref(0);
|
|
466
|
+
const thumbTop = ref(0);
|
|
467
|
+
const hueValue = computed(() => {
|
|
468
|
+
return props.color.get("hue");
|
|
469
|
+
});
|
|
470
|
+
watch(() => hueValue.value, () => {
|
|
471
|
+
update();
|
|
472
|
+
});
|
|
473
|
+
function handleClick(event) {
|
|
474
|
+
const target = event.target;
|
|
475
|
+
if (target !== thumb.value) {
|
|
476
|
+
handleDrag(event);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function handleDrag(event) {
|
|
480
|
+
if (!bar.value || !thumb.value)
|
|
481
|
+
return;
|
|
482
|
+
const el = instance.vnode.el;
|
|
483
|
+
const rect = el.getBoundingClientRect();
|
|
484
|
+
const { clientX, clientY } = getClientXY(event);
|
|
485
|
+
let hue;
|
|
486
|
+
if (!props.vertical) {
|
|
487
|
+
let left = clientX - rect.left;
|
|
488
|
+
left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
|
|
489
|
+
left = Math.max(thumb.value.offsetWidth / 2, left);
|
|
490
|
+
hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
|
|
491
|
+
} else {
|
|
492
|
+
let top = clientY - rect.top;
|
|
493
|
+
top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
|
|
494
|
+
top = Math.max(thumb.value.offsetHeight / 2, top);
|
|
495
|
+
hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
|
|
496
|
+
}
|
|
497
|
+
props.color.set("hue", hue);
|
|
498
|
+
}
|
|
499
|
+
function getThumbLeft() {
|
|
500
|
+
if (!thumb.value)
|
|
501
|
+
return 0;
|
|
502
|
+
const el = instance.vnode.el;
|
|
503
|
+
if (props.vertical)
|
|
504
|
+
return 0;
|
|
505
|
+
const hue = props.color.get("hue");
|
|
506
|
+
if (!el)
|
|
507
|
+
return 0;
|
|
508
|
+
return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
|
|
509
|
+
}
|
|
510
|
+
function getThumbTop() {
|
|
511
|
+
if (!thumb.value)
|
|
512
|
+
return 0;
|
|
513
|
+
const el = instance.vnode.el;
|
|
514
|
+
if (!props.vertical)
|
|
515
|
+
return 0;
|
|
516
|
+
const hue = props.color.get("hue");
|
|
517
|
+
if (!el)
|
|
518
|
+
return 0;
|
|
519
|
+
return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
|
|
520
|
+
}
|
|
521
|
+
function update() {
|
|
522
|
+
thumbLeft.value = getThumbLeft();
|
|
523
|
+
thumbTop.value = getThumbTop();
|
|
524
|
+
}
|
|
525
|
+
onMounted(() => {
|
|
526
|
+
if (!bar.value || !thumb.value)
|
|
527
|
+
return;
|
|
528
|
+
const dragConfig = {
|
|
529
|
+
drag: (event) => {
|
|
530
|
+
handleDrag(event);
|
|
531
|
+
},
|
|
532
|
+
end: (event) => {
|
|
533
|
+
handleDrag(event);
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
draggable(bar.value, dragConfig);
|
|
537
|
+
draggable(thumb.value, dragConfig);
|
|
538
|
+
update();
|
|
539
|
+
});
|
|
540
|
+
return {
|
|
541
|
+
bar,
|
|
542
|
+
thumb,
|
|
543
|
+
thumbLeft,
|
|
544
|
+
thumbTop,
|
|
545
|
+
hueValue,
|
|
546
|
+
handleClick,
|
|
547
|
+
update,
|
|
548
|
+
ns
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
553
|
+
return openBlock(), createElementBlock("div", {
|
|
554
|
+
class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
|
|
555
|
+
}, [
|
|
556
|
+
createElementVNode("div", {
|
|
557
|
+
ref: "bar",
|
|
558
|
+
class: normalizeClass(_ctx.ns.e("bar")),
|
|
559
|
+
onClick: _ctx.handleClick
|
|
560
|
+
}, null, 10, ["onClick"]),
|
|
561
|
+
createElementVNode("div", {
|
|
562
|
+
ref: "thumb",
|
|
563
|
+
class: normalizeClass(_ctx.ns.e("thumb")),
|
|
564
|
+
style: normalizeStyle({
|
|
565
|
+
left: _ctx.thumbLeft + "px",
|
|
566
|
+
top: _ctx.thumbTop + "px"
|
|
567
|
+
})
|
|
568
|
+
}, null, 6)
|
|
569
|
+
], 2);
|
|
570
|
+
}
|
|
571
|
+
var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["render", _sfc_render$4], ["__file", "hue-slider.vue"]]);
|
|
572
|
+
const colorPickerProps = buildProps({
|
|
573
|
+
modelValue: String,
|
|
574
|
+
id: String,
|
|
575
|
+
showAlpha: Boolean,
|
|
576
|
+
colorFormat: String,
|
|
577
|
+
disabled: Boolean,
|
|
578
|
+
size: useSizeProp,
|
|
579
|
+
popperClass: {
|
|
580
|
+
type: String,
|
|
581
|
+
default: ""
|
|
582
|
+
},
|
|
583
|
+
tabindex: {
|
|
584
|
+
type: [String, Number],
|
|
585
|
+
default: 0
|
|
586
|
+
},
|
|
587
|
+
teleported: useTooltipContentProps.teleported,
|
|
588
|
+
predefine: {
|
|
589
|
+
type: definePropType(Array)
|
|
590
|
+
},
|
|
591
|
+
validateEvent: {
|
|
592
|
+
type: Boolean,
|
|
593
|
+
default: true
|
|
594
|
+
},
|
|
595
|
+
...useAriaProps(["ariaLabel"])
|
|
596
|
+
});
|
|
597
|
+
const colorPickerEmits = {
|
|
598
|
+
[UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val),
|
|
599
|
+
[CHANGE_EVENT]: (val) => isString(val) || isNil(val),
|
|
600
|
+
activeChange: (val) => isString(val) || isNil(val),
|
|
601
|
+
focus: (evt) => evt instanceof FocusEvent,
|
|
602
|
+
blur: (evt) => evt instanceof FocusEvent
|
|
603
|
+
};
|
|
604
|
+
const colorPickerContextKey = Symbol("colorPickerContextKey");
|
|
605
|
+
const hsv2hsl = function(hue, sat, val) {
|
|
606
|
+
return [
|
|
607
|
+
hue,
|
|
608
|
+
sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
|
|
609
|
+
hue / 2
|
|
610
|
+
];
|
|
611
|
+
};
|
|
612
|
+
const isOnePointZero = function(n) {
|
|
613
|
+
return isString(n) && n.includes(".") && Number.parseFloat(n) === 1;
|
|
614
|
+
};
|
|
615
|
+
const isPercentage = function(n) {
|
|
616
|
+
return isString(n) && n.includes("%");
|
|
617
|
+
};
|
|
618
|
+
const bound01 = function(value, max) {
|
|
619
|
+
if (isOnePointZero(value))
|
|
620
|
+
value = "100%";
|
|
621
|
+
const processPercent = isPercentage(value);
|
|
622
|
+
value = Math.min(max, Math.max(0, Number.parseFloat(`${value}`)));
|
|
623
|
+
if (processPercent) {
|
|
624
|
+
value = Number.parseInt(`${value * max}`, 10) / 100;
|
|
625
|
+
}
|
|
626
|
+
if (Math.abs(value - max) < 1e-6) {
|
|
627
|
+
return 1;
|
|
628
|
+
}
|
|
629
|
+
return value % max / Number.parseFloat(max);
|
|
630
|
+
};
|
|
631
|
+
const INT_HEX_MAP = {
|
|
632
|
+
10: "A",
|
|
633
|
+
11: "B",
|
|
634
|
+
12: "C",
|
|
635
|
+
13: "D",
|
|
636
|
+
14: "E",
|
|
637
|
+
15: "F"
|
|
638
|
+
};
|
|
639
|
+
const hexOne = (value) => {
|
|
640
|
+
value = Math.min(Math.round(value), 255);
|
|
641
|
+
const high = Math.floor(value / 16);
|
|
642
|
+
const low = value % 16;
|
|
643
|
+
return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
|
|
644
|
+
};
|
|
645
|
+
const toHex = function({ r, g, b }) {
|
|
646
|
+
if (Number.isNaN(+r) || Number.isNaN(+g) || Number.isNaN(+b))
|
|
647
|
+
return "";
|
|
648
|
+
return `#${hexOne(r)}${hexOne(g)}${hexOne(b)}`;
|
|
649
|
+
};
|
|
650
|
+
const HEX_INT_MAP = {
|
|
651
|
+
A: 10,
|
|
652
|
+
B: 11,
|
|
653
|
+
C: 12,
|
|
654
|
+
D: 13,
|
|
655
|
+
E: 14,
|
|
656
|
+
F: 15
|
|
657
|
+
};
|
|
658
|
+
const parseHexChannel = function(hex) {
|
|
659
|
+
if (hex.length === 2) {
|
|
660
|
+
return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
|
|
661
|
+
}
|
|
662
|
+
return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
|
|
663
|
+
};
|
|
664
|
+
const hsl2hsv = function(hue, sat, light) {
|
|
665
|
+
sat = sat / 100;
|
|
666
|
+
light = light / 100;
|
|
667
|
+
let smin = sat;
|
|
668
|
+
const lmin = Math.max(light, 0.01);
|
|
669
|
+
light *= 2;
|
|
670
|
+
sat *= light <= 1 ? light : 2 - light;
|
|
671
|
+
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
672
|
+
const v = (light + sat) / 2;
|
|
673
|
+
const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
|
|
674
|
+
return {
|
|
675
|
+
h: hue,
|
|
676
|
+
s: sv * 100,
|
|
677
|
+
v: v * 100
|
|
678
|
+
};
|
|
679
|
+
};
|
|
680
|
+
const rgb2hsv = (r, g, b) => {
|
|
681
|
+
r = bound01(r, 255);
|
|
682
|
+
g = bound01(g, 255);
|
|
683
|
+
b = bound01(b, 255);
|
|
684
|
+
const max = Math.max(r, g, b);
|
|
685
|
+
const min = Math.min(r, g, b);
|
|
686
|
+
let h2;
|
|
687
|
+
const v = max;
|
|
688
|
+
const d = max - min;
|
|
689
|
+
const s = max === 0 ? 0 : d / max;
|
|
690
|
+
if (max === min) {
|
|
691
|
+
h2 = 0;
|
|
692
|
+
} else {
|
|
693
|
+
switch (max) {
|
|
694
|
+
case r: {
|
|
695
|
+
h2 = (g - b) / d + (g < b ? 6 : 0);
|
|
696
|
+
break;
|
|
697
|
+
}
|
|
698
|
+
case g: {
|
|
699
|
+
h2 = (b - r) / d + 2;
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
case b: {
|
|
703
|
+
h2 = (r - g) / d + 4;
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
h2 /= 6;
|
|
708
|
+
}
|
|
709
|
+
return { h: h2 * 360, s: s * 100, v: v * 100 };
|
|
710
|
+
};
|
|
711
|
+
const hsv2rgb = function(h2, s, v) {
|
|
712
|
+
h2 = bound01(h2, 360) * 6;
|
|
713
|
+
s = bound01(s, 100);
|
|
714
|
+
v = bound01(v, 100);
|
|
715
|
+
const i = Math.floor(h2);
|
|
716
|
+
const f = h2 - i;
|
|
717
|
+
const p = v * (1 - s);
|
|
718
|
+
const q = v * (1 - f * s);
|
|
719
|
+
const t = v * (1 - (1 - f) * s);
|
|
720
|
+
const mod = i % 6;
|
|
721
|
+
const r = [v, q, p, p, t, v][mod];
|
|
722
|
+
const g = [t, v, v, q, p, p][mod];
|
|
723
|
+
const b = [p, p, t, v, v, q][mod];
|
|
724
|
+
return {
|
|
725
|
+
r: Math.round(r * 255),
|
|
726
|
+
g: Math.round(g * 255),
|
|
727
|
+
b: Math.round(b * 255)
|
|
728
|
+
};
|
|
729
|
+
};
|
|
730
|
+
class Color {
|
|
731
|
+
constructor(options = {}) {
|
|
732
|
+
this._hue = 0;
|
|
733
|
+
this._saturation = 100;
|
|
734
|
+
this._value = 100;
|
|
735
|
+
this._alpha = 100;
|
|
736
|
+
this.enableAlpha = false;
|
|
737
|
+
this.format = "hex";
|
|
738
|
+
this.value = "";
|
|
739
|
+
for (const option in options) {
|
|
740
|
+
if (hasOwn(options, option)) {
|
|
741
|
+
this[option] = options[option];
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
if (options.value) {
|
|
745
|
+
this.fromString(options.value);
|
|
746
|
+
} else {
|
|
747
|
+
this.doOnChange();
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
set(prop, value) {
|
|
751
|
+
if (arguments.length === 1 && typeof prop === "object") {
|
|
752
|
+
for (const p in prop) {
|
|
753
|
+
if (hasOwn(prop, p)) {
|
|
754
|
+
this.set(p, prop[p]);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
this[`_${prop}`] = value;
|
|
760
|
+
this.doOnChange();
|
|
761
|
+
}
|
|
762
|
+
get(prop) {
|
|
763
|
+
if (prop === "alpha") {
|
|
764
|
+
return Math.floor(this[`_${prop}`]);
|
|
765
|
+
}
|
|
766
|
+
return this[`_${prop}`];
|
|
767
|
+
}
|
|
768
|
+
toRgb() {
|
|
769
|
+
return hsv2rgb(this._hue, this._saturation, this._value);
|
|
770
|
+
}
|
|
771
|
+
fromString(value) {
|
|
772
|
+
if (!value) {
|
|
773
|
+
this._hue = 0;
|
|
774
|
+
this._saturation = 100;
|
|
775
|
+
this._value = 100;
|
|
776
|
+
this.doOnChange();
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
const fromHSV = (h2, s, v) => {
|
|
780
|
+
this._hue = Math.max(0, Math.min(360, h2));
|
|
781
|
+
this._saturation = Math.max(0, Math.min(100, s));
|
|
782
|
+
this._value = Math.max(0, Math.min(100, v));
|
|
783
|
+
this.doOnChange();
|
|
784
|
+
};
|
|
785
|
+
if (value.includes("hsl")) {
|
|
786
|
+
const parts = value.replace(/hsla|hsl|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
|
|
787
|
+
if (parts.length === 4) {
|
|
788
|
+
this._alpha = Number.parseFloat(parts[3]) * 100;
|
|
789
|
+
} else if (parts.length === 3) {
|
|
790
|
+
this._alpha = 100;
|
|
791
|
+
}
|
|
792
|
+
if (parts.length >= 3) {
|
|
793
|
+
const { h: h2, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
|
|
794
|
+
fromHSV(h2, s, v);
|
|
795
|
+
}
|
|
796
|
+
} else if (value.includes("hsv")) {
|
|
797
|
+
const parts = value.replace(/hsva|hsv|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
|
|
798
|
+
if (parts.length === 4) {
|
|
799
|
+
this._alpha = Number.parseFloat(parts[3]) * 100;
|
|
800
|
+
} else if (parts.length === 3) {
|
|
801
|
+
this._alpha = 100;
|
|
802
|
+
}
|
|
803
|
+
if (parts.length >= 3) {
|
|
804
|
+
fromHSV(parts[0], parts[1], parts[2]);
|
|
805
|
+
}
|
|
806
|
+
} else if (value.includes("rgb")) {
|
|
807
|
+
const parts = value.replace(/rgba|rgb|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
|
|
808
|
+
if (parts.length === 4) {
|
|
809
|
+
this._alpha = Number.parseFloat(parts[3]) * 100;
|
|
810
|
+
} else if (parts.length === 3) {
|
|
811
|
+
this._alpha = 100;
|
|
812
|
+
}
|
|
813
|
+
if (parts.length >= 3) {
|
|
814
|
+
const { h: h2, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
|
|
815
|
+
fromHSV(h2, s, v);
|
|
816
|
+
}
|
|
817
|
+
} else if (value.includes("#")) {
|
|
818
|
+
const hex = value.replace("#", "").trim();
|
|
819
|
+
if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
|
|
820
|
+
return;
|
|
821
|
+
let r, g, b;
|
|
822
|
+
if (hex.length === 3) {
|
|
823
|
+
r = parseHexChannel(hex[0] + hex[0]);
|
|
824
|
+
g = parseHexChannel(hex[1] + hex[1]);
|
|
825
|
+
b = parseHexChannel(hex[2] + hex[2]);
|
|
826
|
+
} else if (hex.length === 6 || hex.length === 8) {
|
|
827
|
+
r = parseHexChannel(hex.slice(0, 2));
|
|
828
|
+
g = parseHexChannel(hex.slice(2, 4));
|
|
829
|
+
b = parseHexChannel(hex.slice(4, 6));
|
|
830
|
+
}
|
|
831
|
+
if (hex.length === 8) {
|
|
832
|
+
this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
|
|
833
|
+
} else if (hex.length === 3 || hex.length === 6) {
|
|
834
|
+
this._alpha = 100;
|
|
835
|
+
}
|
|
836
|
+
const { h: h2, s, v } = rgb2hsv(r, g, b);
|
|
837
|
+
fromHSV(h2, s, v);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
compare(color) {
|
|
841
|
+
return Math.abs(color._hue - this._hue) < 2 && Math.abs(color._saturation - this._saturation) < 1 && Math.abs(color._value - this._value) < 1 && Math.abs(color._alpha - this._alpha) < 1;
|
|
842
|
+
}
|
|
843
|
+
doOnChange() {
|
|
844
|
+
const { _hue, _saturation, _value, _alpha, format } = this;
|
|
845
|
+
if (this.enableAlpha) {
|
|
846
|
+
switch (format) {
|
|
847
|
+
case "hsl": {
|
|
848
|
+
const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
|
|
849
|
+
this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
|
|
850
|
+
break;
|
|
851
|
+
}
|
|
852
|
+
case "hsv": {
|
|
853
|
+
this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
|
|
854
|
+
break;
|
|
855
|
+
}
|
|
856
|
+
case "hex": {
|
|
857
|
+
this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
|
|
858
|
+
break;
|
|
859
|
+
}
|
|
860
|
+
default: {
|
|
861
|
+
const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
|
|
862
|
+
this.value = `rgba(${r}, ${g}, ${b}, ${this.get("alpha") / 100})`;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
} else {
|
|
866
|
+
switch (format) {
|
|
867
|
+
case "hsl": {
|
|
868
|
+
const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
|
|
869
|
+
this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
|
|
870
|
+
break;
|
|
871
|
+
}
|
|
872
|
+
case "hsv": {
|
|
873
|
+
this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
|
|
874
|
+
break;
|
|
875
|
+
}
|
|
876
|
+
case "rgb": {
|
|
877
|
+
const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
|
|
878
|
+
this.value = `rgb(${r}, ${g}, ${b})`;
|
|
879
|
+
break;
|
|
880
|
+
}
|
|
881
|
+
default: {
|
|
882
|
+
this.value = toHex(hsv2rgb(_hue, _saturation, _value));
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
const _sfc_main$t = defineComponent({
|
|
889
|
+
props: {
|
|
890
|
+
colors: {
|
|
891
|
+
type: Array,
|
|
892
|
+
required: true
|
|
893
|
+
},
|
|
894
|
+
color: {
|
|
895
|
+
type: Object,
|
|
896
|
+
required: true
|
|
897
|
+
},
|
|
898
|
+
enableAlpha: {
|
|
899
|
+
type: Boolean,
|
|
900
|
+
required: true
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
setup(props) {
|
|
904
|
+
const ns = useNamespace("color-predefine");
|
|
905
|
+
const { currentColor } = inject(colorPickerContextKey);
|
|
906
|
+
const rgbaColors = ref(parseColors(props.colors, props.color));
|
|
907
|
+
watch(() => currentColor.value, (val) => {
|
|
908
|
+
const color = new Color();
|
|
909
|
+
color.fromString(val);
|
|
910
|
+
rgbaColors.value.forEach((item) => {
|
|
911
|
+
item.selected = color.compare(item);
|
|
912
|
+
});
|
|
913
|
+
});
|
|
914
|
+
watchEffect(() => {
|
|
915
|
+
rgbaColors.value = parseColors(props.colors, props.color);
|
|
916
|
+
});
|
|
917
|
+
function handleSelect(index2) {
|
|
918
|
+
props.color.fromString(props.colors[index2]);
|
|
919
|
+
}
|
|
920
|
+
function parseColors(colors, color) {
|
|
921
|
+
return colors.map((value) => {
|
|
922
|
+
const c = new Color();
|
|
923
|
+
c.enableAlpha = props.enableAlpha;
|
|
924
|
+
c.format = "rgba";
|
|
925
|
+
c.fromString(value);
|
|
926
|
+
c.selected = c.value === color.value;
|
|
927
|
+
return c;
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
return {
|
|
931
|
+
rgbaColors,
|
|
932
|
+
handleSelect,
|
|
933
|
+
ns
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
938
|
+
return openBlock(), createElementBlock("div", {
|
|
939
|
+
class: normalizeClass(_ctx.ns.b())
|
|
940
|
+
}, [
|
|
941
|
+
createElementVNode("div", {
|
|
942
|
+
class: normalizeClass(_ctx.ns.e("colors"))
|
|
943
|
+
}, [
|
|
944
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rgbaColors, (item, index2) => {
|
|
945
|
+
return openBlock(), createElementBlock("div", {
|
|
946
|
+
key: _ctx.colors[index2],
|
|
947
|
+
class: normalizeClass([
|
|
948
|
+
_ctx.ns.e("color-selector"),
|
|
949
|
+
_ctx.ns.is("alpha", item._alpha < 100),
|
|
950
|
+
{ selected: item.selected }
|
|
951
|
+
]),
|
|
952
|
+
onClick: ($event) => _ctx.handleSelect(index2)
|
|
953
|
+
}, [
|
|
954
|
+
createElementVNode("div", {
|
|
955
|
+
style: normalizeStyle({ backgroundColor: item.value })
|
|
956
|
+
}, null, 4)
|
|
957
|
+
], 10, ["onClick"]);
|
|
958
|
+
}), 128))
|
|
959
|
+
], 2)
|
|
960
|
+
], 2);
|
|
961
|
+
}
|
|
962
|
+
var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["render", _sfc_render$3], ["__file", "predefine.vue"]]);
|
|
963
|
+
const _sfc_main$s = defineComponent({
|
|
964
|
+
name: "ElSlPanel",
|
|
965
|
+
props: {
|
|
966
|
+
color: {
|
|
967
|
+
type: Object,
|
|
968
|
+
required: true
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
setup(props) {
|
|
972
|
+
const ns = useNamespace("color-svpanel");
|
|
973
|
+
const instance = getCurrentInstance();
|
|
974
|
+
const cursorTop = ref(0);
|
|
975
|
+
const cursorLeft = ref(0);
|
|
976
|
+
const background = ref("hsl(0, 100%, 50%)");
|
|
977
|
+
const colorValue = computed(() => {
|
|
978
|
+
const hue = props.color.get("hue");
|
|
979
|
+
const value = props.color.get("value");
|
|
980
|
+
return { hue, value };
|
|
981
|
+
});
|
|
982
|
+
function update() {
|
|
983
|
+
const saturation = props.color.get("saturation");
|
|
984
|
+
const value = props.color.get("value");
|
|
985
|
+
const el = instance.vnode.el;
|
|
986
|
+
const { clientWidth: width, clientHeight: height } = el;
|
|
987
|
+
cursorLeft.value = saturation * width / 100;
|
|
988
|
+
cursorTop.value = (100 - value) * height / 100;
|
|
989
|
+
background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
|
|
990
|
+
}
|
|
991
|
+
function handleDrag(event) {
|
|
992
|
+
const el = instance.vnode.el;
|
|
993
|
+
const rect = el.getBoundingClientRect();
|
|
994
|
+
const { clientX, clientY } = getClientXY(event);
|
|
995
|
+
let left = clientX - rect.left;
|
|
996
|
+
let top = clientY - rect.top;
|
|
997
|
+
left = Math.max(0, left);
|
|
998
|
+
left = Math.min(left, rect.width);
|
|
999
|
+
top = Math.max(0, top);
|
|
1000
|
+
top = Math.min(top, rect.height);
|
|
1001
|
+
cursorLeft.value = left;
|
|
1002
|
+
cursorTop.value = top;
|
|
1003
|
+
props.color.set({
|
|
1004
|
+
saturation: left / rect.width * 100,
|
|
1005
|
+
value: 100 - top / rect.height * 100
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
watch(() => colorValue.value, () => {
|
|
1009
|
+
update();
|
|
1010
|
+
});
|
|
1011
|
+
onMounted(() => {
|
|
1012
|
+
draggable(instance.vnode.el, {
|
|
1013
|
+
drag: (event) => {
|
|
1014
|
+
handleDrag(event);
|
|
1015
|
+
},
|
|
1016
|
+
end: (event) => {
|
|
1017
|
+
handleDrag(event);
|
|
1018
|
+
}
|
|
1019
|
+
});
|
|
1020
|
+
update();
|
|
1021
|
+
});
|
|
1022
|
+
return {
|
|
1023
|
+
cursorTop,
|
|
1024
|
+
cursorLeft,
|
|
1025
|
+
background,
|
|
1026
|
+
colorValue,
|
|
1027
|
+
handleDrag,
|
|
1028
|
+
update,
|
|
1029
|
+
ns
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
1033
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1034
|
+
return openBlock(), createElementBlock("div", {
|
|
1035
|
+
class: normalizeClass(_ctx.ns.b()),
|
|
1036
|
+
style: normalizeStyle({
|
|
1037
|
+
backgroundColor: _ctx.background
|
|
1038
|
+
})
|
|
1039
|
+
}, [
|
|
1040
|
+
createElementVNode("div", {
|
|
1041
|
+
class: normalizeClass(_ctx.ns.e("white"))
|
|
1042
|
+
}, null, 2),
|
|
1043
|
+
createElementVNode("div", {
|
|
1044
|
+
class: normalizeClass(_ctx.ns.e("black"))
|
|
1045
|
+
}, null, 2),
|
|
1046
|
+
createElementVNode("div", {
|
|
1047
|
+
class: normalizeClass(_ctx.ns.e("cursor")),
|
|
1048
|
+
style: normalizeStyle({
|
|
1049
|
+
top: _ctx.cursorTop + "px",
|
|
1050
|
+
left: _ctx.cursorLeft + "px"
|
|
1051
|
+
})
|
|
1052
|
+
}, [
|
|
1053
|
+
createElementVNode("div")
|
|
1054
|
+
], 6)
|
|
1055
|
+
], 6);
|
|
1056
|
+
}
|
|
1057
|
+
var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["render", _sfc_render$2], ["__file", "sv-panel.vue"]]);
|
|
1058
|
+
const __default__$d = defineComponent({
|
|
1059
|
+
name: "ElColorPicker"
|
|
1060
|
+
});
|
|
1061
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
1062
|
+
...__default__$d,
|
|
1063
|
+
props: colorPickerProps,
|
|
1064
|
+
emits: colorPickerEmits,
|
|
1065
|
+
setup(__props, { expose, emit }) {
|
|
1066
|
+
const props = __props;
|
|
1067
|
+
const { t } = useLocale();
|
|
1068
|
+
const ns = useNamespace("color");
|
|
1069
|
+
const { formItem } = useFormItem();
|
|
1070
|
+
const colorSize = useFormSize();
|
|
1071
|
+
const colorDisabled = useFormDisabled();
|
|
1072
|
+
const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
|
|
1073
|
+
formItemContext: formItem
|
|
1074
|
+
});
|
|
1075
|
+
const hue = ref();
|
|
1076
|
+
const sv = ref();
|
|
1077
|
+
const alpha = ref();
|
|
1078
|
+
const popper = ref();
|
|
1079
|
+
const triggerRef = ref();
|
|
1080
|
+
const inputRef = ref();
|
|
1081
|
+
const { isFocused, handleFocus, handleBlur } = useFocusController(triggerRef, {
|
|
1082
|
+
beforeFocus() {
|
|
1083
|
+
return colorDisabled.value;
|
|
1084
|
+
},
|
|
1085
|
+
beforeBlur(event) {
|
|
1086
|
+
var _a;
|
|
1087
|
+
return (_a = popper.value) == null ? void 0 : _a.isFocusInsideContent(event);
|
|
1088
|
+
},
|
|
1089
|
+
afterBlur() {
|
|
1090
|
+
setShowPicker(false);
|
|
1091
|
+
resetColor();
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
let shouldActiveChange = true;
|
|
1095
|
+
const color = reactive(new Color({
|
|
1096
|
+
enableAlpha: props.showAlpha,
|
|
1097
|
+
format: props.colorFormat || "",
|
|
1098
|
+
value: props.modelValue
|
|
1099
|
+
}));
|
|
1100
|
+
const showPicker = ref(false);
|
|
1101
|
+
const showPanelColor = ref(false);
|
|
1102
|
+
const customInput = ref("");
|
|
1103
|
+
const displayedColor = computed(() => {
|
|
1104
|
+
if (!props.modelValue && !showPanelColor.value) {
|
|
1105
|
+
return "transparent";
|
|
1106
|
+
}
|
|
1107
|
+
return displayedRgb(color, props.showAlpha);
|
|
1108
|
+
});
|
|
1109
|
+
const currentColor = computed(() => {
|
|
1110
|
+
return !props.modelValue && !showPanelColor.value ? "" : color.value;
|
|
1111
|
+
});
|
|
1112
|
+
const buttonAriaLabel = computed(() => {
|
|
1113
|
+
return !isLabeledByFormItem.value ? props.ariaLabel || t("el.colorpicker.defaultLabel") : void 0;
|
|
1114
|
+
});
|
|
1115
|
+
const buttonAriaLabelledby = computed(() => {
|
|
1116
|
+
return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
|
|
1117
|
+
});
|
|
1118
|
+
const btnKls = computed(() => {
|
|
1119
|
+
return [
|
|
1120
|
+
ns.b("picker"),
|
|
1121
|
+
ns.is("disabled", colorDisabled.value),
|
|
1122
|
+
ns.bm("picker", colorSize.value),
|
|
1123
|
+
ns.is("focused", isFocused.value)
|
|
1124
|
+
];
|
|
1125
|
+
});
|
|
1126
|
+
function displayedRgb(color2, showAlpha) {
|
|
1127
|
+
if (!(color2 instanceof Color)) {
|
|
1128
|
+
throw new TypeError("color should be instance of _color Class");
|
|
1129
|
+
}
|
|
1130
|
+
const { r, g, b } = color2.toRgb();
|
|
1131
|
+
return showAlpha ? `rgba(${r}, ${g}, ${b}, ${color2.get("alpha") / 100})` : `rgb(${r}, ${g}, ${b})`;
|
|
1132
|
+
}
|
|
1133
|
+
function setShowPicker(value) {
|
|
1134
|
+
showPicker.value = value;
|
|
1135
|
+
}
|
|
1136
|
+
const debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true });
|
|
1137
|
+
function show() {
|
|
1138
|
+
if (colorDisabled.value)
|
|
1139
|
+
return;
|
|
1140
|
+
setShowPicker(true);
|
|
1141
|
+
}
|
|
1142
|
+
function hide() {
|
|
1143
|
+
debounceSetShowPicker(false);
|
|
1144
|
+
resetColor();
|
|
1145
|
+
}
|
|
1146
|
+
function resetColor() {
|
|
1147
|
+
nextTick(() => {
|
|
1148
|
+
if (props.modelValue) {
|
|
1149
|
+
color.fromString(props.modelValue);
|
|
1150
|
+
} else {
|
|
1151
|
+
color.value = "";
|
|
1152
|
+
nextTick(() => {
|
|
1153
|
+
showPanelColor.value = false;
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
function handleTrigger() {
|
|
1159
|
+
if (colorDisabled.value)
|
|
1160
|
+
return;
|
|
1161
|
+
if (showPicker.value) {
|
|
1162
|
+
resetColor();
|
|
1163
|
+
}
|
|
1164
|
+
debounceSetShowPicker(!showPicker.value);
|
|
1165
|
+
}
|
|
1166
|
+
function handleConfirm() {
|
|
1167
|
+
color.fromString(customInput.value);
|
|
1168
|
+
}
|
|
1169
|
+
function confirmValue() {
|
|
1170
|
+
const value = color.value;
|
|
1171
|
+
emit(UPDATE_MODEL_EVENT, value);
|
|
1172
|
+
emit("change", value);
|
|
1173
|
+
if (props.validateEvent) {
|
|
1174
|
+
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
|
|
1175
|
+
}
|
|
1176
|
+
debounceSetShowPicker(false);
|
|
1177
|
+
nextTick(() => {
|
|
1178
|
+
const newColor = new Color({
|
|
1179
|
+
enableAlpha: props.showAlpha,
|
|
1180
|
+
format: props.colorFormat || "",
|
|
1181
|
+
value: props.modelValue
|
|
1182
|
+
});
|
|
1183
|
+
if (!color.compare(newColor)) {
|
|
1184
|
+
resetColor();
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
function clear() {
|
|
1189
|
+
debounceSetShowPicker(false);
|
|
1190
|
+
emit(UPDATE_MODEL_EVENT, null);
|
|
1191
|
+
emit("change", null);
|
|
1192
|
+
if (props.modelValue !== null && props.validateEvent) {
|
|
1193
|
+
formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
|
|
1194
|
+
}
|
|
1195
|
+
resetColor();
|
|
1196
|
+
}
|
|
1197
|
+
function handleClickOutside() {
|
|
1198
|
+
if (!showPicker.value)
|
|
1199
|
+
return;
|
|
1200
|
+
hide();
|
|
1201
|
+
isFocused.value && focus();
|
|
1202
|
+
}
|
|
1203
|
+
function handleEsc(event) {
|
|
1204
|
+
event.preventDefault();
|
|
1205
|
+
event.stopPropagation();
|
|
1206
|
+
setShowPicker(false);
|
|
1207
|
+
resetColor();
|
|
1208
|
+
}
|
|
1209
|
+
function handleKeyDown(event) {
|
|
1210
|
+
switch (event.code) {
|
|
1211
|
+
case EVENT_CODE.enter:
|
|
1212
|
+
case EVENT_CODE.numpadEnter:
|
|
1213
|
+
case EVENT_CODE.space:
|
|
1214
|
+
event.preventDefault();
|
|
1215
|
+
event.stopPropagation();
|
|
1216
|
+
show();
|
|
1217
|
+
inputRef.value.focus();
|
|
1218
|
+
break;
|
|
1219
|
+
case EVENT_CODE.esc:
|
|
1220
|
+
handleEsc(event);
|
|
1221
|
+
break;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
function focus() {
|
|
1225
|
+
triggerRef.value.focus();
|
|
1226
|
+
}
|
|
1227
|
+
function blur() {
|
|
1228
|
+
triggerRef.value.blur();
|
|
1229
|
+
}
|
|
1230
|
+
onMounted(() => {
|
|
1231
|
+
if (props.modelValue) {
|
|
1232
|
+
customInput.value = currentColor.value;
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
watch(() => props.modelValue, (newVal) => {
|
|
1236
|
+
if (!newVal) {
|
|
1237
|
+
showPanelColor.value = false;
|
|
1238
|
+
} else if (newVal && newVal !== color.value) {
|
|
1239
|
+
shouldActiveChange = false;
|
|
1240
|
+
color.fromString(newVal);
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1243
|
+
watch(() => [props.colorFormat, props.showAlpha], () => {
|
|
1244
|
+
color.enableAlpha = props.showAlpha;
|
|
1245
|
+
color.format = props.colorFormat || color.format;
|
|
1246
|
+
color.doOnChange();
|
|
1247
|
+
emit(UPDATE_MODEL_EVENT, color.value);
|
|
1248
|
+
});
|
|
1249
|
+
watch(() => currentColor.value, (val) => {
|
|
1250
|
+
customInput.value = val;
|
|
1251
|
+
shouldActiveChange && emit("activeChange", val);
|
|
1252
|
+
shouldActiveChange = true;
|
|
1253
|
+
});
|
|
1254
|
+
watch(() => color.value, () => {
|
|
1255
|
+
if (!props.modelValue && !showPanelColor.value) {
|
|
1256
|
+
showPanelColor.value = true;
|
|
1257
|
+
}
|
|
1258
|
+
});
|
|
1259
|
+
watch(() => showPicker.value, () => {
|
|
1260
|
+
nextTick(() => {
|
|
1261
|
+
var _a, _b, _c;
|
|
1262
|
+
(_a = hue.value) == null ? void 0 : _a.update();
|
|
1263
|
+
(_b = sv.value) == null ? void 0 : _b.update();
|
|
1264
|
+
(_c = alpha.value) == null ? void 0 : _c.update();
|
|
1265
|
+
});
|
|
1266
|
+
});
|
|
1267
|
+
provide(colorPickerContextKey, {
|
|
1268
|
+
currentColor
|
|
1269
|
+
});
|
|
1270
|
+
expose({
|
|
1271
|
+
color,
|
|
1272
|
+
show,
|
|
1273
|
+
hide,
|
|
1274
|
+
focus,
|
|
1275
|
+
blur
|
|
1276
|
+
});
|
|
1277
|
+
return (_ctx, _cache) => {
|
|
1278
|
+
return openBlock(), createBlock(unref(ElTooltip), {
|
|
1279
|
+
ref_key: "popper",
|
|
1280
|
+
ref: popper,
|
|
1281
|
+
visible: showPicker.value,
|
|
1282
|
+
"show-arrow": false,
|
|
1283
|
+
"fallback-placements": ["bottom", "top", "right", "left"],
|
|
1284
|
+
offset: 0,
|
|
1285
|
+
"gpu-acceleration": false,
|
|
1286
|
+
"popper-class": [unref(ns).be("picker", "panel"), unref(ns).b("dropdown"), _ctx.popperClass],
|
|
1287
|
+
"stop-popper-mouse-event": false,
|
|
1288
|
+
effect: "light",
|
|
1289
|
+
trigger: "click",
|
|
1290
|
+
teleported: _ctx.teleported,
|
|
1291
|
+
transition: `${unref(ns).namespace.value}-zoom-in-top`,
|
|
1292
|
+
persistent: "",
|
|
1293
|
+
onHide: ($event) => setShowPicker(false)
|
|
1294
|
+
}, {
|
|
1295
|
+
content: withCtx(() => [
|
|
1296
|
+
withDirectives((openBlock(), createElementBlock("div", {
|
|
1297
|
+
onKeydown: withKeys(handleEsc, ["esc"])
|
|
1298
|
+
}, [
|
|
1299
|
+
createElementVNode("div", {
|
|
1300
|
+
class: normalizeClass(unref(ns).be("dropdown", "main-wrapper"))
|
|
1301
|
+
}, [
|
|
1302
|
+
createVNode(HueSlider, {
|
|
1303
|
+
ref_key: "hue",
|
|
1304
|
+
ref: hue,
|
|
1305
|
+
class: "hue-slider",
|
|
1306
|
+
color: unref(color),
|
|
1307
|
+
vertical: ""
|
|
1308
|
+
}, null, 8, ["color"]),
|
|
1309
|
+
createVNode(SvPanel, {
|
|
1310
|
+
ref_key: "sv",
|
|
1311
|
+
ref: sv,
|
|
1312
|
+
color: unref(color)
|
|
1313
|
+
}, null, 8, ["color"])
|
|
1314
|
+
], 2),
|
|
1315
|
+
_ctx.showAlpha ? (openBlock(), createBlock(AlphaSlider, {
|
|
1316
|
+
key: 0,
|
|
1317
|
+
ref_key: "alpha",
|
|
1318
|
+
ref: alpha,
|
|
1319
|
+
color: unref(color)
|
|
1320
|
+
}, null, 8, ["color"])) : createCommentVNode("v-if", true),
|
|
1321
|
+
_ctx.predefine ? (openBlock(), createBlock(Predefine, {
|
|
1322
|
+
key: 1,
|
|
1323
|
+
ref: "predefine",
|
|
1324
|
+
"enable-alpha": _ctx.showAlpha,
|
|
1325
|
+
color: unref(color),
|
|
1326
|
+
colors: _ctx.predefine
|
|
1327
|
+
}, null, 8, ["enable-alpha", "color", "colors"])) : createCommentVNode("v-if", true),
|
|
1328
|
+
createElementVNode("div", {
|
|
1329
|
+
class: normalizeClass(unref(ns).be("dropdown", "btns"))
|
|
1330
|
+
}, [
|
|
1331
|
+
createElementVNode("span", {
|
|
1332
|
+
class: normalizeClass(unref(ns).be("dropdown", "value"))
|
|
1333
|
+
}, [
|
|
1334
|
+
createVNode(unref(ElInput), {
|
|
1335
|
+
ref_key: "inputRef",
|
|
1336
|
+
ref: inputRef,
|
|
1337
|
+
modelValue: customInput.value,
|
|
1338
|
+
"onUpdate:modelValue": ($event) => customInput.value = $event,
|
|
1339
|
+
"validate-event": false,
|
|
1340
|
+
size: "small",
|
|
1341
|
+
onKeyup: withKeys(handleConfirm, ["enter"]),
|
|
1342
|
+
onBlur: handleConfirm
|
|
1343
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onKeyup"])
|
|
1344
|
+
], 2),
|
|
1345
|
+
createVNode(unref(ElButton), {
|
|
1346
|
+
class: normalizeClass(unref(ns).be("dropdown", "link-btn")),
|
|
1347
|
+
text: "",
|
|
1348
|
+
size: "small",
|
|
1349
|
+
onClick: clear
|
|
1350
|
+
}, {
|
|
1351
|
+
default: withCtx(() => [
|
|
1352
|
+
createTextVNode(toDisplayString(unref(t)("el.colorpicker.clear")), 1)
|
|
1353
|
+
]),
|
|
1354
|
+
_: 1
|
|
1355
|
+
}, 8, ["class"]),
|
|
1356
|
+
createVNode(unref(ElButton), {
|
|
1357
|
+
plain: "",
|
|
1358
|
+
size: "small",
|
|
1359
|
+
class: normalizeClass(unref(ns).be("dropdown", "btn")),
|
|
1360
|
+
onClick: confirmValue
|
|
1361
|
+
}, {
|
|
1362
|
+
default: withCtx(() => [
|
|
1363
|
+
createTextVNode(toDisplayString(unref(t)("el.colorpicker.confirm")), 1)
|
|
1364
|
+
]),
|
|
1365
|
+
_: 1
|
|
1366
|
+
}, 8, ["class"])
|
|
1367
|
+
], 2)
|
|
1368
|
+
], 40, ["onKeydown"])), [
|
|
1369
|
+
[unref(ClickOutside), handleClickOutside, triggerRef.value]
|
|
1370
|
+
])
|
|
1371
|
+
]),
|
|
1372
|
+
default: withCtx(() => [
|
|
1373
|
+
createElementVNode("div", mergeProps({
|
|
1374
|
+
id: unref(buttonId),
|
|
1375
|
+
ref_key: "triggerRef",
|
|
1376
|
+
ref: triggerRef
|
|
1377
|
+
}, _ctx.$attrs, {
|
|
1378
|
+
class: unref(btnKls),
|
|
1379
|
+
role: "button",
|
|
1380
|
+
"aria-label": unref(buttonAriaLabel),
|
|
1381
|
+
"aria-labelledby": unref(buttonAriaLabelledby),
|
|
1382
|
+
"aria-description": unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
|
|
1383
|
+
"aria-disabled": unref(colorDisabled),
|
|
1384
|
+
tabindex: unref(colorDisabled) ? -1 : _ctx.tabindex,
|
|
1385
|
+
onKeydown: handleKeyDown,
|
|
1386
|
+
onFocus: unref(handleFocus),
|
|
1387
|
+
onBlur: unref(handleBlur)
|
|
1388
|
+
}), [
|
|
1389
|
+
unref(colorDisabled) ? (openBlock(), createElementBlock("div", {
|
|
1390
|
+
key: 0,
|
|
1391
|
+
class: normalizeClass(unref(ns).be("picker", "mask"))
|
|
1392
|
+
}, null, 2)) : createCommentVNode("v-if", true),
|
|
1393
|
+
createElementVNode("div", {
|
|
1394
|
+
class: normalizeClass(unref(ns).be("picker", "trigger")),
|
|
1395
|
+
onClick: handleTrigger
|
|
1396
|
+
}, [
|
|
1397
|
+
createElementVNode("span", {
|
|
1398
|
+
class: normalizeClass([unref(ns).be("picker", "color"), unref(ns).is("alpha", _ctx.showAlpha)])
|
|
1399
|
+
}, [
|
|
1400
|
+
createElementVNode("span", {
|
|
1401
|
+
class: normalizeClass(unref(ns).be("picker", "color-inner")),
|
|
1402
|
+
style: normalizeStyle({
|
|
1403
|
+
backgroundColor: unref(displayedColor)
|
|
1404
|
+
})
|
|
1405
|
+
}, [
|
|
1406
|
+
withDirectives(createVNode(unref(ElIcon), {
|
|
1407
|
+
class: normalizeClass([unref(ns).be("picker", "icon"), unref(ns).is("icon-arrow-down")])
|
|
1408
|
+
}, {
|
|
1409
|
+
default: withCtx(() => [
|
|
1410
|
+
createVNode(unref(arrow_down_default))
|
|
1411
|
+
]),
|
|
1412
|
+
_: 1
|
|
1413
|
+
}, 8, ["class"]), [
|
|
1414
|
+
[vShow, _ctx.modelValue || showPanelColor.value]
|
|
1415
|
+
]),
|
|
1416
|
+
withDirectives(createVNode(unref(ElIcon), {
|
|
1417
|
+
class: normalizeClass([unref(ns).be("picker", "empty"), unref(ns).is("icon-close")])
|
|
1418
|
+
}, {
|
|
1419
|
+
default: withCtx(() => [
|
|
1420
|
+
createVNode(unref(close_default))
|
|
1421
|
+
]),
|
|
1422
|
+
_: 1
|
|
1423
|
+
}, 8, ["class"]), [
|
|
1424
|
+
[vShow, !_ctx.modelValue && !showPanelColor.value]
|
|
1425
|
+
])
|
|
1426
|
+
], 6)
|
|
1427
|
+
], 2)
|
|
1428
|
+
], 2)
|
|
1429
|
+
], 16, ["id", "aria-label", "aria-labelledby", "aria-description", "aria-disabled", "tabindex", "onFocus", "onBlur"])
|
|
1430
|
+
]),
|
|
1431
|
+
_: 1
|
|
1432
|
+
}, 8, ["visible", "popper-class", "teleported", "transition", "onHide"]);
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
});
|
|
1436
|
+
var ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__file", "color-picker.vue"]]);
|
|
1437
|
+
const ElColorPicker = withInstall(ColorPicker);
|
|
1438
|
+
const __default__$c = defineComponent({
|
|
1439
|
+
name: "ElContainer"
|
|
1440
|
+
});
|
|
1441
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
1442
|
+
...__default__$c,
|
|
1443
|
+
props: {
|
|
1444
|
+
direction: {
|
|
1445
|
+
type: String
|
|
1446
|
+
}
|
|
1447
|
+
},
|
|
1448
|
+
setup(__props) {
|
|
1449
|
+
const props = __props;
|
|
1450
|
+
const slots = useSlots();
|
|
1451
|
+
const ns = useNamespace("container");
|
|
1452
|
+
const isVertical = computed(() => {
|
|
1453
|
+
if (props.direction === "vertical") {
|
|
1454
|
+
return true;
|
|
1455
|
+
} else if (props.direction === "horizontal") {
|
|
1456
|
+
return false;
|
|
1457
|
+
}
|
|
1458
|
+
if (slots && slots.default) {
|
|
1459
|
+
const vNodes = slots.default();
|
|
1460
|
+
return vNodes.some((vNode) => {
|
|
1461
|
+
const tag = vNode.type.name;
|
|
1462
|
+
return tag === "ElHeader" || tag === "ElFooter";
|
|
1463
|
+
});
|
|
1464
|
+
} else {
|
|
1465
|
+
return false;
|
|
1466
|
+
}
|
|
1467
|
+
});
|
|
1468
|
+
return (_ctx, _cache) => {
|
|
1469
|
+
return openBlock(), createElementBlock("section", {
|
|
1470
|
+
class: normalizeClass([unref(ns).b(), unref(ns).is("vertical", unref(isVertical))])
|
|
1471
|
+
}, [
|
|
1472
|
+
renderSlot(_ctx.$slots, "default")
|
|
1473
|
+
], 2);
|
|
1474
|
+
};
|
|
1475
|
+
}
|
|
1476
|
+
});
|
|
1477
|
+
var Container = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__file", "container.vue"]]);
|
|
1478
|
+
const __default__$b = defineComponent({
|
|
1479
|
+
name: "ElAside"
|
|
1480
|
+
});
|
|
1481
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
1482
|
+
...__default__$b,
|
|
1483
|
+
props: {
|
|
1484
|
+
width: {
|
|
1485
|
+
type: String,
|
|
1486
|
+
default: null
|
|
1487
|
+
}
|
|
1488
|
+
},
|
|
1489
|
+
setup(__props) {
|
|
1490
|
+
const props = __props;
|
|
1491
|
+
const ns = useNamespace("aside");
|
|
1492
|
+
const style = computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
|
|
1493
|
+
return (_ctx, _cache) => {
|
|
1494
|
+
return openBlock(), createElementBlock("aside", {
|
|
1495
|
+
class: normalizeClass(unref(ns).b()),
|
|
1496
|
+
style: normalizeStyle(unref(style))
|
|
1497
|
+
}, [
|
|
1498
|
+
renderSlot(_ctx.$slots, "default")
|
|
1499
|
+
], 6);
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1502
|
+
});
|
|
1503
|
+
var Aside = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__file", "aside.vue"]]);
|
|
1504
|
+
const __default__$a = defineComponent({
|
|
1505
|
+
name: "ElFooter"
|
|
1506
|
+
});
|
|
1507
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
1508
|
+
...__default__$a,
|
|
1509
|
+
props: {
|
|
1510
|
+
height: {
|
|
1511
|
+
type: String,
|
|
1512
|
+
default: null
|
|
1513
|
+
}
|
|
1514
|
+
},
|
|
1515
|
+
setup(__props) {
|
|
1516
|
+
const props = __props;
|
|
1517
|
+
const ns = useNamespace("footer");
|
|
1518
|
+
const style = computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
|
|
1519
|
+
return (_ctx, _cache) => {
|
|
1520
|
+
return openBlock(), createElementBlock("footer", {
|
|
1521
|
+
class: normalizeClass(unref(ns).b()),
|
|
1522
|
+
style: normalizeStyle(unref(style))
|
|
1523
|
+
}, [
|
|
1524
|
+
renderSlot(_ctx.$slots, "default")
|
|
1525
|
+
], 6);
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
});
|
|
1529
|
+
var Footer$1 = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__file", "footer.vue"]]);
|
|
1530
|
+
const __default__$9 = defineComponent({
|
|
1531
|
+
name: "ElHeader"
|
|
1532
|
+
});
|
|
1533
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
1534
|
+
...__default__$9,
|
|
1535
|
+
props: {
|
|
1536
|
+
height: {
|
|
1537
|
+
type: String,
|
|
1538
|
+
default: null
|
|
1539
|
+
}
|
|
1540
|
+
},
|
|
1541
|
+
setup(__props) {
|
|
1542
|
+
const props = __props;
|
|
1543
|
+
const ns = useNamespace("header");
|
|
1544
|
+
const style = computed(() => {
|
|
1545
|
+
return props.height ? ns.cssVarBlock({
|
|
1546
|
+
height: props.height
|
|
1547
|
+
}) : {};
|
|
1548
|
+
});
|
|
1549
|
+
return (_ctx, _cache) => {
|
|
1550
|
+
return openBlock(), createElementBlock("header", {
|
|
1551
|
+
class: normalizeClass(unref(ns).b()),
|
|
1552
|
+
style: normalizeStyle(unref(style))
|
|
1553
|
+
}, [
|
|
1554
|
+
renderSlot(_ctx.$slots, "default")
|
|
1555
|
+
], 6);
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
var Header = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__file", "header.vue"]]);
|
|
1560
|
+
const __default__$8 = defineComponent({
|
|
1561
|
+
name: "ElMain"
|
|
1562
|
+
});
|
|
1563
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
1564
|
+
...__default__$8,
|
|
1565
|
+
setup(__props) {
|
|
1566
|
+
const ns = useNamespace("main");
|
|
1567
|
+
return (_ctx, _cache) => {
|
|
1568
|
+
return openBlock(), createElementBlock("main", {
|
|
1569
|
+
class: normalizeClass(unref(ns).b())
|
|
1570
|
+
}, [
|
|
1571
|
+
renderSlot(_ctx.$slots, "default")
|
|
1572
|
+
], 2);
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
});
|
|
1576
|
+
var Main$1 = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "main.vue"]]);
|
|
1577
|
+
const ElContainer = withInstall(Container, {
|
|
1578
|
+
Aside,
|
|
1579
|
+
Footer: Footer$1,
|
|
1580
|
+
Header,
|
|
1581
|
+
Main: Main$1
|
|
1582
|
+
});
|
|
1583
|
+
const ElAside = withNoopInstall(Aside);
|
|
1584
|
+
const ElFooter = withNoopInstall(Footer$1);
|
|
1585
|
+
const ElHeader = withNoopInstall(Header);
|
|
1586
|
+
const ElMain = withNoopInstall(Main$1);
|
|
1587
|
+
const dividerProps = buildProps({
|
|
1588
|
+
direction: {
|
|
1589
|
+
type: String,
|
|
1590
|
+
values: ["horizontal", "vertical"],
|
|
1591
|
+
default: "horizontal"
|
|
1592
|
+
},
|
|
1593
|
+
contentPosition: {
|
|
1594
|
+
type: String,
|
|
1595
|
+
values: ["left", "center", "right"],
|
|
1596
|
+
default: "center"
|
|
1597
|
+
},
|
|
1598
|
+
borderStyle: {
|
|
1599
|
+
type: definePropType(String),
|
|
1600
|
+
default: "solid"
|
|
1601
|
+
}
|
|
1602
|
+
});
|
|
1603
|
+
const __default__$7 = defineComponent({
|
|
1604
|
+
name: "ElDivider"
|
|
1605
|
+
});
|
|
1606
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
1607
|
+
...__default__$7,
|
|
1608
|
+
props: dividerProps,
|
|
1609
|
+
setup(__props) {
|
|
1610
|
+
const props = __props;
|
|
1611
|
+
const ns = useNamespace("divider");
|
|
1612
|
+
const dividerStyle = computed(() => {
|
|
1613
|
+
return ns.cssVar({
|
|
1614
|
+
"border-style": props.borderStyle
|
|
1615
|
+
});
|
|
1616
|
+
});
|
|
1617
|
+
return (_ctx, _cache) => {
|
|
1618
|
+
return openBlock(), createElementBlock("div", {
|
|
1619
|
+
class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.direction)]),
|
|
1620
|
+
style: normalizeStyle(unref(dividerStyle)),
|
|
1621
|
+
role: "separator"
|
|
1622
|
+
}, [
|
|
1623
|
+
_ctx.$slots.default && _ctx.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
|
|
1624
|
+
key: 0,
|
|
1625
|
+
class: normalizeClass([unref(ns).e("text"), unref(ns).is(_ctx.contentPosition)])
|
|
1626
|
+
}, [
|
|
1627
|
+
renderSlot(_ctx.$slots, "default")
|
|
1628
|
+
], 2)) : createCommentVNode("v-if", true)
|
|
1629
|
+
], 6);
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
});
|
|
1633
|
+
var Divider = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__file", "divider.vue"]]);
|
|
1634
|
+
const ElDivider = withInstall(Divider);
|
|
1635
|
+
let SubMenu$1 = class SubMenu {
|
|
1636
|
+
constructor(parent, domNode) {
|
|
1637
|
+
this.parent = parent;
|
|
1638
|
+
this.domNode = domNode;
|
|
1639
|
+
this.subIndex = 0;
|
|
1640
|
+
this.subIndex = 0;
|
|
1641
|
+
this.init();
|
|
1642
|
+
}
|
|
1643
|
+
init() {
|
|
1644
|
+
this.subMenuItems = this.domNode.querySelectorAll("li");
|
|
1645
|
+
this.addListeners();
|
|
1646
|
+
}
|
|
1647
|
+
gotoSubIndex(idx) {
|
|
1648
|
+
if (idx === this.subMenuItems.length) {
|
|
1649
|
+
idx = 0;
|
|
1650
|
+
} else if (idx < 0) {
|
|
1651
|
+
idx = this.subMenuItems.length - 1;
|
|
1652
|
+
}
|
|
1653
|
+
this.subMenuItems[idx].focus();
|
|
1654
|
+
this.subIndex = idx;
|
|
1655
|
+
}
|
|
1656
|
+
addListeners() {
|
|
1657
|
+
const parentNode = this.parent.domNode;
|
|
1658
|
+
Array.prototype.forEach.call(this.subMenuItems, (el) => {
|
|
1659
|
+
el.addEventListener("keydown", (event) => {
|
|
1660
|
+
let prevDef = false;
|
|
1661
|
+
switch (event.code) {
|
|
1662
|
+
case EVENT_CODE.down: {
|
|
1663
|
+
this.gotoSubIndex(this.subIndex + 1);
|
|
1664
|
+
prevDef = true;
|
|
1665
|
+
break;
|
|
1666
|
+
}
|
|
1667
|
+
case EVENT_CODE.up: {
|
|
1668
|
+
this.gotoSubIndex(this.subIndex - 1);
|
|
1669
|
+
prevDef = true;
|
|
1670
|
+
break;
|
|
1671
|
+
}
|
|
1672
|
+
case EVENT_CODE.tab: {
|
|
1673
|
+
triggerEvent(parentNode, "mouseleave");
|
|
1674
|
+
break;
|
|
1675
|
+
}
|
|
1676
|
+
case EVENT_CODE.enter:
|
|
1677
|
+
case EVENT_CODE.numpadEnter:
|
|
1678
|
+
case EVENT_CODE.space: {
|
|
1679
|
+
prevDef = true;
|
|
1680
|
+
event.currentTarget.click();
|
|
1681
|
+
break;
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
if (prevDef) {
|
|
1685
|
+
event.preventDefault();
|
|
1686
|
+
event.stopPropagation();
|
|
1687
|
+
}
|
|
1688
|
+
return false;
|
|
1689
|
+
});
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1693
|
+
let MenuItem$1 = class MenuItem {
|
|
1694
|
+
constructor(domNode, namespace) {
|
|
1695
|
+
this.domNode = domNode;
|
|
1696
|
+
this.submenu = null;
|
|
1697
|
+
this.submenu = null;
|
|
1698
|
+
this.init(namespace);
|
|
1699
|
+
}
|
|
1700
|
+
init(namespace) {
|
|
1701
|
+
this.domNode.setAttribute("tabindex", "0");
|
|
1702
|
+
const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
|
|
1703
|
+
if (menuChild) {
|
|
1704
|
+
this.submenu = new SubMenu$1(this, menuChild);
|
|
1705
|
+
}
|
|
1706
|
+
this.addListeners();
|
|
1707
|
+
}
|
|
1708
|
+
addListeners() {
|
|
1709
|
+
this.domNode.addEventListener("keydown", (event) => {
|
|
1710
|
+
let prevDef = false;
|
|
1711
|
+
switch (event.code) {
|
|
1712
|
+
case EVENT_CODE.down: {
|
|
1713
|
+
triggerEvent(event.currentTarget, "mouseenter");
|
|
1714
|
+
this.submenu && this.submenu.gotoSubIndex(0);
|
|
1715
|
+
prevDef = true;
|
|
1716
|
+
break;
|
|
1717
|
+
}
|
|
1718
|
+
case EVENT_CODE.up: {
|
|
1719
|
+
triggerEvent(event.currentTarget, "mouseenter");
|
|
1720
|
+
this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
|
|
1721
|
+
prevDef = true;
|
|
1722
|
+
break;
|
|
1723
|
+
}
|
|
1724
|
+
case EVENT_CODE.tab: {
|
|
1725
|
+
triggerEvent(event.currentTarget, "mouseleave");
|
|
1726
|
+
break;
|
|
1727
|
+
}
|
|
1728
|
+
case EVENT_CODE.enter:
|
|
1729
|
+
case EVENT_CODE.numpadEnter:
|
|
1730
|
+
case EVENT_CODE.space: {
|
|
1731
|
+
prevDef = true;
|
|
1732
|
+
event.currentTarget.click();
|
|
1733
|
+
break;
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
if (prevDef) {
|
|
1737
|
+
event.preventDefault();
|
|
1738
|
+
}
|
|
1739
|
+
});
|
|
1740
|
+
}
|
|
1741
|
+
};
|
|
1742
|
+
let Menu$1 = class Menu {
|
|
1743
|
+
constructor(domNode, namespace) {
|
|
1744
|
+
this.domNode = domNode;
|
|
1745
|
+
this.init(namespace);
|
|
1746
|
+
}
|
|
1747
|
+
init(namespace) {
|
|
1748
|
+
const menuChildren = this.domNode.childNodes;
|
|
1749
|
+
Array.from(menuChildren).forEach((child) => {
|
|
1750
|
+
if (child.nodeType === 1) {
|
|
1751
|
+
new MenuItem$1(child, namespace);
|
|
1752
|
+
}
|
|
1753
|
+
});
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
const __default__$6 = defineComponent({
|
|
1757
|
+
name: "ElMenuCollapseTransition"
|
|
1758
|
+
});
|
|
1759
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
1760
|
+
...__default__$6,
|
|
1761
|
+
setup(__props) {
|
|
1762
|
+
const ns = useNamespace("menu");
|
|
1763
|
+
const listeners = {
|
|
1764
|
+
onBeforeEnter: (el) => el.style.opacity = "0.2",
|
|
1765
|
+
onEnter(el, done) {
|
|
1766
|
+
addClass(el, `${ns.namespace.value}-opacity-transition`);
|
|
1767
|
+
el.style.opacity = "1";
|
|
1768
|
+
done();
|
|
1769
|
+
},
|
|
1770
|
+
onAfterEnter(el) {
|
|
1771
|
+
removeClass(el, `${ns.namespace.value}-opacity-transition`);
|
|
1772
|
+
el.style.opacity = "";
|
|
1773
|
+
},
|
|
1774
|
+
onBeforeLeave(el) {
|
|
1775
|
+
if (!el.dataset)
|
|
1776
|
+
el.dataset = {};
|
|
1777
|
+
if (hasClass(el, ns.m("collapse"))) {
|
|
1778
|
+
removeClass(el, ns.m("collapse"));
|
|
1779
|
+
el.dataset.oldOverflow = el.style.overflow;
|
|
1780
|
+
el.dataset.scrollWidth = el.clientWidth.toString();
|
|
1781
|
+
addClass(el, ns.m("collapse"));
|
|
1782
|
+
} else {
|
|
1783
|
+
addClass(el, ns.m("collapse"));
|
|
1784
|
+
el.dataset.oldOverflow = el.style.overflow;
|
|
1785
|
+
el.dataset.scrollWidth = el.clientWidth.toString();
|
|
1786
|
+
removeClass(el, ns.m("collapse"));
|
|
1787
|
+
}
|
|
1788
|
+
el.style.width = `${el.scrollWidth}px`;
|
|
1789
|
+
el.style.overflow = "hidden";
|
|
1790
|
+
},
|
|
1791
|
+
onLeave(el) {
|
|
1792
|
+
addClass(el, "horizontal-collapse-transition");
|
|
1793
|
+
el.style.width = `${el.dataset.scrollWidth}px`;
|
|
1794
|
+
}
|
|
1795
|
+
};
|
|
1796
|
+
return (_ctx, _cache) => {
|
|
1797
|
+
return openBlock(), createBlock(Transition, mergeProps({ mode: "out-in" }, unref(listeners)), {
|
|
1798
|
+
default: withCtx(() => [
|
|
1799
|
+
renderSlot(_ctx.$slots, "default")
|
|
1800
|
+
]),
|
|
1801
|
+
_: 3
|
|
1802
|
+
}, 16);
|
|
1803
|
+
};
|
|
1804
|
+
}
|
|
1805
|
+
});
|
|
1806
|
+
var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__file", "menu-collapse-transition.vue"]]);
|
|
1807
|
+
function useMenu(instance, currentIndex) {
|
|
1808
|
+
const indexPath = computed(() => {
|
|
1809
|
+
let parent = instance.parent;
|
|
1810
|
+
const path = [currentIndex.value];
|
|
1811
|
+
while (parent.type.name !== "ElMenu") {
|
|
1812
|
+
if (parent.props.index) {
|
|
1813
|
+
path.unshift(parent.props.index);
|
|
1814
|
+
}
|
|
1815
|
+
parent = parent.parent;
|
|
1816
|
+
}
|
|
1817
|
+
return path;
|
|
1818
|
+
});
|
|
1819
|
+
const parentMenu = computed(() => {
|
|
1820
|
+
let parent = instance.parent;
|
|
1821
|
+
while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
|
|
1822
|
+
parent = parent.parent;
|
|
1823
|
+
}
|
|
1824
|
+
return parent;
|
|
1825
|
+
});
|
|
1826
|
+
return {
|
|
1827
|
+
parentMenu,
|
|
1828
|
+
indexPath
|
|
1829
|
+
};
|
|
1830
|
+
}
|
|
1831
|
+
function useMenuColor(props) {
|
|
1832
|
+
const menuBarColor = computed(() => {
|
|
1833
|
+
const color = props.backgroundColor;
|
|
1834
|
+
return color ? new TinyColor(color).shade(20).toString() : "";
|
|
1835
|
+
});
|
|
1836
|
+
return menuBarColor;
|
|
1837
|
+
}
|
|
1838
|
+
const useMenuCssVar = (props, level) => {
|
|
1839
|
+
const ns = useNamespace("menu");
|
|
1840
|
+
return computed(() => ns.cssVarBlock({
|
|
1841
|
+
"text-color": props.textColor || "",
|
|
1842
|
+
"hover-text-color": props.textColor || "",
|
|
1843
|
+
"bg-color": props.backgroundColor || "",
|
|
1844
|
+
"hover-bg-color": useMenuColor(props).value || "",
|
|
1845
|
+
"active-color": props.activeTextColor || "",
|
|
1846
|
+
level: `${level}`
|
|
1847
|
+
}));
|
|
1848
|
+
};
|
|
1849
|
+
const subMenuProps = buildProps({
|
|
1850
|
+
index: {
|
|
1851
|
+
type: String,
|
|
1852
|
+
required: true
|
|
1853
|
+
},
|
|
1854
|
+
showTimeout: Number,
|
|
1855
|
+
hideTimeout: Number,
|
|
1856
|
+
popperClass: String,
|
|
1857
|
+
disabled: Boolean,
|
|
1858
|
+
teleported: {
|
|
1859
|
+
type: Boolean,
|
|
1860
|
+
default: void 0
|
|
1861
|
+
},
|
|
1862
|
+
popperOffset: Number,
|
|
1863
|
+
expandCloseIcon: {
|
|
1864
|
+
type: iconPropType
|
|
1865
|
+
},
|
|
1866
|
+
expandOpenIcon: {
|
|
1867
|
+
type: iconPropType
|
|
1868
|
+
},
|
|
1869
|
+
collapseCloseIcon: {
|
|
1870
|
+
type: iconPropType
|
|
1871
|
+
},
|
|
1872
|
+
collapseOpenIcon: {
|
|
1873
|
+
type: iconPropType
|
|
1874
|
+
}
|
|
1875
|
+
});
|
|
1876
|
+
const COMPONENT_NAME$1 = "ElSubMenu";
|
|
1877
|
+
var SubMenu2 = defineComponent({
|
|
1878
|
+
name: COMPONENT_NAME$1,
|
|
1879
|
+
props: subMenuProps,
|
|
1880
|
+
setup(props, { slots, expose }) {
|
|
1881
|
+
const instance = getCurrentInstance();
|
|
1882
|
+
const { indexPath, parentMenu } = useMenu(instance, computed(() => props.index));
|
|
1883
|
+
const nsMenu = useNamespace("menu");
|
|
1884
|
+
const nsSubMenu = useNamespace("sub-menu");
|
|
1885
|
+
const rootMenu = inject("rootMenu");
|
|
1886
|
+
if (!rootMenu)
|
|
1887
|
+
throwError(COMPONENT_NAME$1, "can not inject root menu");
|
|
1888
|
+
const subMenu = inject(`subMenu:${parentMenu.value.uid}`);
|
|
1889
|
+
if (!subMenu)
|
|
1890
|
+
throwError(COMPONENT_NAME$1, "can not inject sub menu");
|
|
1891
|
+
const items = ref({});
|
|
1892
|
+
const subMenus = ref({});
|
|
1893
|
+
let timeout;
|
|
1894
|
+
const mouseInChild = ref(false);
|
|
1895
|
+
const verticalTitleRef = ref();
|
|
1896
|
+
const vPopper = ref();
|
|
1897
|
+
const currentPlacement = computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
|
|
1898
|
+
const subMenuTitleIcon = computed(() => {
|
|
1899
|
+
return mode.value === "horizontal" && isFirstLevel.value || mode.value === "vertical" && !rootMenu.props.collapse ? props.expandCloseIcon && props.expandOpenIcon ? opened.value ? props.expandOpenIcon : props.expandCloseIcon : arrow_down_default : props.collapseCloseIcon && props.collapseOpenIcon ? opened.value ? props.collapseOpenIcon : props.collapseCloseIcon : arrow_right_default;
|
|
1900
|
+
});
|
|
1901
|
+
const isFirstLevel = computed(() => subMenu.level === 0);
|
|
1902
|
+
const appendToBody = computed(() => {
|
|
1903
|
+
const value = props.teleported;
|
|
1904
|
+
return value === void 0 ? isFirstLevel.value : value;
|
|
1905
|
+
});
|
|
1906
|
+
const menuTransitionName = computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
|
|
1907
|
+
const fallbackPlacements = computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
|
|
1908
|
+
"bottom-start",
|
|
1909
|
+
"bottom-end",
|
|
1910
|
+
"top-start",
|
|
1911
|
+
"top-end",
|
|
1912
|
+
"right-start",
|
|
1913
|
+
"left-start"
|
|
1914
|
+
] : [
|
|
1915
|
+
"right-start",
|
|
1916
|
+
"right",
|
|
1917
|
+
"right-end",
|
|
1918
|
+
"left-start",
|
|
1919
|
+
"bottom-start",
|
|
1920
|
+
"bottom-end",
|
|
1921
|
+
"top-start",
|
|
1922
|
+
"top-end"
|
|
1923
|
+
]);
|
|
1924
|
+
const opened = computed(() => rootMenu.openedMenus.includes(props.index));
|
|
1925
|
+
const active = computed(() => [...Object.values(items.value), ...Object.values(subMenus.value)].some(({ active: active2 }) => active2));
|
|
1926
|
+
const mode = computed(() => rootMenu.props.mode);
|
|
1927
|
+
const persistent = computed(() => rootMenu.props.persistent);
|
|
1928
|
+
const item = reactive({
|
|
1929
|
+
index: props.index,
|
|
1930
|
+
indexPath,
|
|
1931
|
+
active
|
|
1932
|
+
});
|
|
1933
|
+
const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
|
|
1934
|
+
const subMenuPopperOffset = computed(() => {
|
|
1935
|
+
var _a;
|
|
1936
|
+
return (_a = props.popperOffset) != null ? _a : rootMenu.props.popperOffset;
|
|
1937
|
+
});
|
|
1938
|
+
const subMenuPopperClass = computed(() => {
|
|
1939
|
+
var _a;
|
|
1940
|
+
return (_a = props.popperClass) != null ? _a : rootMenu.props.popperClass;
|
|
1941
|
+
});
|
|
1942
|
+
const subMenuShowTimeout = computed(() => {
|
|
1943
|
+
var _a;
|
|
1944
|
+
return (_a = props.showTimeout) != null ? _a : rootMenu.props.showTimeout;
|
|
1945
|
+
});
|
|
1946
|
+
const subMenuHideTimeout = computed(() => {
|
|
1947
|
+
var _a;
|
|
1948
|
+
return (_a = props.hideTimeout) != null ? _a : rootMenu.props.hideTimeout;
|
|
1949
|
+
});
|
|
1950
|
+
const doDestroy = () => {
|
|
1951
|
+
var _a, _b, _c;
|
|
1952
|
+
return (_c = (_b = (_a = vPopper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy();
|
|
1953
|
+
};
|
|
1954
|
+
const handleCollapseToggle = (value) => {
|
|
1955
|
+
if (!value) {
|
|
1956
|
+
doDestroy();
|
|
1957
|
+
}
|
|
1958
|
+
};
|
|
1959
|
+
const handleClick = () => {
|
|
1960
|
+
if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled)
|
|
1961
|
+
return;
|
|
1962
|
+
rootMenu.handleSubMenuClick({
|
|
1963
|
+
index: props.index,
|
|
1964
|
+
indexPath: indexPath.value,
|
|
1965
|
+
active: active.value
|
|
1966
|
+
});
|
|
1967
|
+
};
|
|
1968
|
+
const handleMouseenter = (event, showTimeout = subMenuShowTimeout.value) => {
|
|
1969
|
+
var _a;
|
|
1970
|
+
if (event.type === "focus")
|
|
1971
|
+
return;
|
|
1972
|
+
if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
|
|
1973
|
+
subMenu.mouseInChild.value = true;
|
|
1974
|
+
return;
|
|
1975
|
+
}
|
|
1976
|
+
subMenu.mouseInChild.value = true;
|
|
1977
|
+
timeout == null ? void 0 : timeout();
|
|
1978
|
+
({ stop: timeout } = useTimeoutFn(() => {
|
|
1979
|
+
rootMenu.openMenu(props.index, indexPath.value);
|
|
1980
|
+
}, showTimeout));
|
|
1981
|
+
if (appendToBody.value) {
|
|
1982
|
+
(_a = parentMenu.value.vnode.el) == null ? void 0 : _a.dispatchEvent(new MouseEvent("mouseenter"));
|
|
1983
|
+
}
|
|
1984
|
+
};
|
|
1985
|
+
const handleMouseleave = (deepDispatch = false) => {
|
|
1986
|
+
var _a;
|
|
1987
|
+
if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
|
|
1988
|
+
subMenu.mouseInChild.value = false;
|
|
1989
|
+
return;
|
|
1990
|
+
}
|
|
1991
|
+
timeout == null ? void 0 : timeout();
|
|
1992
|
+
subMenu.mouseInChild.value = false;
|
|
1993
|
+
({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), subMenuHideTimeout.value));
|
|
1994
|
+
if (appendToBody.value && deepDispatch) {
|
|
1995
|
+
(_a = subMenu.handleMouseleave) == null ? void 0 : _a.call(subMenu, true);
|
|
1996
|
+
}
|
|
1997
|
+
};
|
|
1998
|
+
watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
|
|
1999
|
+
{
|
|
2000
|
+
const addSubMenu = (item2) => {
|
|
2001
|
+
subMenus.value[item2.index] = item2;
|
|
2002
|
+
};
|
|
2003
|
+
const removeSubMenu = (item2) => {
|
|
2004
|
+
delete subMenus.value[item2.index];
|
|
2005
|
+
};
|
|
2006
|
+
provide(`subMenu:${instance.uid}`, {
|
|
2007
|
+
addSubMenu,
|
|
2008
|
+
removeSubMenu,
|
|
2009
|
+
handleMouseleave,
|
|
2010
|
+
mouseInChild,
|
|
2011
|
+
level: subMenu.level + 1
|
|
2012
|
+
});
|
|
2013
|
+
}
|
|
2014
|
+
expose({
|
|
2015
|
+
opened
|
|
2016
|
+
});
|
|
2017
|
+
onMounted(() => {
|
|
2018
|
+
rootMenu.addSubMenu(item);
|
|
2019
|
+
subMenu.addSubMenu(item);
|
|
2020
|
+
});
|
|
2021
|
+
onBeforeUnmount(() => {
|
|
2022
|
+
subMenu.removeSubMenu(item);
|
|
2023
|
+
rootMenu.removeSubMenu(item);
|
|
2024
|
+
});
|
|
2025
|
+
return () => {
|
|
2026
|
+
var _a;
|
|
2027
|
+
const titleTag = [
|
|
2028
|
+
(_a = slots.title) == null ? void 0 : _a.call(slots),
|
|
2029
|
+
h(ElIcon, {
|
|
2030
|
+
class: nsSubMenu.e("icon-arrow"),
|
|
2031
|
+
style: {
|
|
2032
|
+
transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none"
|
|
2033
|
+
}
|
|
2034
|
+
}, {
|
|
2035
|
+
default: () => isString(subMenuTitleIcon.value) ? h(instance.appContext.components[subMenuTitleIcon.value]) : h(subMenuTitleIcon.value)
|
|
2036
|
+
})
|
|
2037
|
+
];
|
|
2038
|
+
const child = rootMenu.isMenuPopup ? h(ElTooltip, {
|
|
2039
|
+
ref: vPopper,
|
|
2040
|
+
visible: opened.value,
|
|
2041
|
+
effect: "light",
|
|
2042
|
+
pure: true,
|
|
2043
|
+
offset: subMenuPopperOffset.value,
|
|
2044
|
+
showArrow: false,
|
|
2045
|
+
persistent: persistent.value,
|
|
2046
|
+
popperClass: subMenuPopperClass.value,
|
|
2047
|
+
placement: currentPlacement.value,
|
|
2048
|
+
teleported: appendToBody.value,
|
|
2049
|
+
fallbackPlacements: fallbackPlacements.value,
|
|
2050
|
+
transition: menuTransitionName.value,
|
|
2051
|
+
gpuAcceleration: false
|
|
2052
|
+
}, {
|
|
2053
|
+
content: () => {
|
|
2054
|
+
var _a2;
|
|
2055
|
+
return h("div", {
|
|
2056
|
+
class: [
|
|
2057
|
+
nsMenu.m(mode.value),
|
|
2058
|
+
nsMenu.m("popup-container"),
|
|
2059
|
+
subMenuPopperClass.value
|
|
2060
|
+
],
|
|
2061
|
+
onMouseenter: (evt) => handleMouseenter(evt, 100),
|
|
2062
|
+
onMouseleave: () => handleMouseleave(true),
|
|
2063
|
+
onFocus: (evt) => handleMouseenter(evt, 100)
|
|
2064
|
+
}, [
|
|
2065
|
+
h("ul", {
|
|
2066
|
+
class: [
|
|
2067
|
+
nsMenu.b(),
|
|
2068
|
+
nsMenu.m("popup"),
|
|
2069
|
+
nsMenu.m(`popup-${currentPlacement.value}`)
|
|
2070
|
+
],
|
|
2071
|
+
style: ulStyle.value
|
|
2072
|
+
}, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])
|
|
2073
|
+
]);
|
|
2074
|
+
},
|
|
2075
|
+
default: () => h("div", {
|
|
2076
|
+
class: nsSubMenu.e("title"),
|
|
2077
|
+
onClick: handleClick
|
|
2078
|
+
}, titleTag)
|
|
2079
|
+
}) : h(Fragment, {}, [
|
|
2080
|
+
h("div", {
|
|
2081
|
+
class: nsSubMenu.e("title"),
|
|
2082
|
+
ref: verticalTitleRef,
|
|
2083
|
+
onClick: handleClick
|
|
2084
|
+
}, titleTag),
|
|
2085
|
+
h(ElCollapseTransition, {}, {
|
|
2086
|
+
default: () => {
|
|
2087
|
+
var _a2;
|
|
2088
|
+
return withDirectives(h("ul", {
|
|
2089
|
+
role: "menu",
|
|
2090
|
+
class: [nsMenu.b(), nsMenu.m("inline")],
|
|
2091
|
+
style: ulStyle.value
|
|
2092
|
+
}, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]), [[vShow, opened.value]]);
|
|
2093
|
+
}
|
|
2094
|
+
})
|
|
2095
|
+
]);
|
|
2096
|
+
return h("li", {
|
|
2097
|
+
class: [
|
|
2098
|
+
nsSubMenu.b(),
|
|
2099
|
+
nsSubMenu.is("active", active.value),
|
|
2100
|
+
nsSubMenu.is("opened", opened.value),
|
|
2101
|
+
nsSubMenu.is("disabled", props.disabled)
|
|
2102
|
+
],
|
|
2103
|
+
role: "menuitem",
|
|
2104
|
+
ariaHaspopup: true,
|
|
2105
|
+
ariaExpanded: opened.value,
|
|
2106
|
+
onMouseenter: handleMouseenter,
|
|
2107
|
+
onMouseleave: () => handleMouseleave(),
|
|
2108
|
+
onFocus: handleMouseenter
|
|
2109
|
+
}, [child]);
|
|
2110
|
+
};
|
|
2111
|
+
}
|
|
2112
|
+
});
|
|
2113
|
+
const menuProps = buildProps({
|
|
2114
|
+
mode: {
|
|
2115
|
+
type: String,
|
|
2116
|
+
values: ["horizontal", "vertical"],
|
|
2117
|
+
default: "vertical"
|
|
2118
|
+
},
|
|
2119
|
+
defaultActive: {
|
|
2120
|
+
type: String,
|
|
2121
|
+
default: ""
|
|
2122
|
+
},
|
|
2123
|
+
defaultOpeneds: {
|
|
2124
|
+
type: definePropType(Array),
|
|
2125
|
+
default: () => mutable([])
|
|
2126
|
+
},
|
|
2127
|
+
uniqueOpened: Boolean,
|
|
2128
|
+
router: Boolean,
|
|
2129
|
+
menuTrigger: {
|
|
2130
|
+
type: String,
|
|
2131
|
+
values: ["hover", "click"],
|
|
2132
|
+
default: "hover"
|
|
2133
|
+
},
|
|
2134
|
+
collapse: Boolean,
|
|
2135
|
+
backgroundColor: String,
|
|
2136
|
+
textColor: String,
|
|
2137
|
+
activeTextColor: String,
|
|
2138
|
+
closeOnClickOutside: Boolean,
|
|
2139
|
+
collapseTransition: {
|
|
2140
|
+
type: Boolean,
|
|
2141
|
+
default: true
|
|
2142
|
+
},
|
|
2143
|
+
ellipsis: {
|
|
2144
|
+
type: Boolean,
|
|
2145
|
+
default: true
|
|
2146
|
+
},
|
|
2147
|
+
popperOffset: {
|
|
2148
|
+
type: Number,
|
|
2149
|
+
default: 6
|
|
2150
|
+
},
|
|
2151
|
+
ellipsisIcon: {
|
|
2152
|
+
type: iconPropType,
|
|
2153
|
+
default: () => more_default
|
|
2154
|
+
},
|
|
2155
|
+
popperEffect: {
|
|
2156
|
+
type: definePropType(String),
|
|
2157
|
+
default: "dark"
|
|
2158
|
+
},
|
|
2159
|
+
popperClass: String,
|
|
2160
|
+
showTimeout: {
|
|
2161
|
+
type: Number,
|
|
2162
|
+
default: 300
|
|
2163
|
+
},
|
|
2164
|
+
hideTimeout: {
|
|
2165
|
+
type: Number,
|
|
2166
|
+
default: 300
|
|
2167
|
+
},
|
|
2168
|
+
persistent: {
|
|
2169
|
+
type: Boolean,
|
|
2170
|
+
default: true
|
|
2171
|
+
}
|
|
2172
|
+
});
|
|
2173
|
+
const checkIndexPath = (indexPath) => isArray(indexPath) && indexPath.every((path) => isString(path));
|
|
2174
|
+
const menuEmits = {
|
|
2175
|
+
close: (index2, indexPath) => isString(index2) && checkIndexPath(indexPath),
|
|
2176
|
+
open: (index2, indexPath) => isString(index2) && checkIndexPath(indexPath),
|
|
2177
|
+
select: (index2, indexPath, item, routerResult) => isString(index2) && checkIndexPath(indexPath) && isObject(item) && (routerResult === void 0 || routerResult instanceof Promise)
|
|
2178
|
+
};
|
|
2179
|
+
var Menu2 = defineComponent({
|
|
2180
|
+
name: "ElMenu",
|
|
2181
|
+
props: menuProps,
|
|
2182
|
+
emits: menuEmits,
|
|
2183
|
+
setup(props, { emit, slots, expose }) {
|
|
2184
|
+
const instance = getCurrentInstance();
|
|
2185
|
+
const router2 = instance.appContext.config.globalProperties.$router;
|
|
2186
|
+
const menu = ref();
|
|
2187
|
+
const nsMenu = useNamespace("menu");
|
|
2188
|
+
const nsSubMenu = useNamespace("sub-menu");
|
|
2189
|
+
const sliceIndex = ref(-1);
|
|
2190
|
+
const openedMenus = ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
|
|
2191
|
+
const activeIndex = ref(props.defaultActive);
|
|
2192
|
+
const items = ref({});
|
|
2193
|
+
const subMenus = ref({});
|
|
2194
|
+
const isMenuPopup = computed(() => props.mode === "horizontal" || props.mode === "vertical" && props.collapse);
|
|
2195
|
+
const initMenu = () => {
|
|
2196
|
+
const activeItem = activeIndex.value && items.value[activeIndex.value];
|
|
2197
|
+
if (!activeItem || props.mode === "horizontal" || props.collapse)
|
|
2198
|
+
return;
|
|
2199
|
+
const indexPath = activeItem.indexPath;
|
|
2200
|
+
indexPath.forEach((index2) => {
|
|
2201
|
+
const subMenu = subMenus.value[index2];
|
|
2202
|
+
subMenu && openMenu(index2, subMenu.indexPath);
|
|
2203
|
+
});
|
|
2204
|
+
};
|
|
2205
|
+
const openMenu = (index2, indexPath) => {
|
|
2206
|
+
if (openedMenus.value.includes(index2))
|
|
2207
|
+
return;
|
|
2208
|
+
if (props.uniqueOpened) {
|
|
2209
|
+
openedMenus.value = openedMenus.value.filter((index22) => indexPath.includes(index22));
|
|
2210
|
+
}
|
|
2211
|
+
openedMenus.value.push(index2);
|
|
2212
|
+
emit("open", index2, indexPath);
|
|
2213
|
+
};
|
|
2214
|
+
const close = (index2) => {
|
|
2215
|
+
const i = openedMenus.value.indexOf(index2);
|
|
2216
|
+
if (i !== -1) {
|
|
2217
|
+
openedMenus.value.splice(i, 1);
|
|
2218
|
+
}
|
|
2219
|
+
};
|
|
2220
|
+
const closeMenu = (index2, indexPath) => {
|
|
2221
|
+
close(index2);
|
|
2222
|
+
emit("close", index2, indexPath);
|
|
2223
|
+
};
|
|
2224
|
+
const handleSubMenuClick = ({
|
|
2225
|
+
index: index2,
|
|
2226
|
+
indexPath
|
|
2227
|
+
}) => {
|
|
2228
|
+
const isOpened = openedMenus.value.includes(index2);
|
|
2229
|
+
isOpened ? closeMenu(index2, indexPath) : openMenu(index2, indexPath);
|
|
2230
|
+
};
|
|
2231
|
+
const handleMenuItemClick = (menuItem) => {
|
|
2232
|
+
if (props.mode === "horizontal" || props.collapse) {
|
|
2233
|
+
openedMenus.value = [];
|
|
2234
|
+
}
|
|
2235
|
+
const { index: index2, indexPath } = menuItem;
|
|
2236
|
+
if (isNil(index2) || isNil(indexPath))
|
|
2237
|
+
return;
|
|
2238
|
+
if (props.router && router2) {
|
|
2239
|
+
const route = menuItem.route || index2;
|
|
2240
|
+
const routerResult = router2.push(route).then((res) => {
|
|
2241
|
+
if (!res)
|
|
2242
|
+
activeIndex.value = index2;
|
|
2243
|
+
return res;
|
|
2244
|
+
});
|
|
2245
|
+
emit("select", index2, indexPath, { index: index2, indexPath, route }, routerResult);
|
|
2246
|
+
} else {
|
|
2247
|
+
activeIndex.value = index2;
|
|
2248
|
+
emit("select", index2, indexPath, { index: index2, indexPath });
|
|
2249
|
+
}
|
|
2250
|
+
};
|
|
2251
|
+
const updateActiveIndex = (val) => {
|
|
2252
|
+
var _a;
|
|
2253
|
+
const itemsInData = items.value;
|
|
2254
|
+
const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
|
|
2255
|
+
activeIndex.value = (_a = item == null ? void 0 : item.index) != null ? _a : val;
|
|
2256
|
+
};
|
|
2257
|
+
const calcMenuItemWidth = (menuItem) => {
|
|
2258
|
+
const computedStyle = getComputedStyle(menuItem);
|
|
2259
|
+
const marginLeft = Number.parseInt(computedStyle.marginLeft, 10);
|
|
2260
|
+
const marginRight = Number.parseInt(computedStyle.marginRight, 10);
|
|
2261
|
+
return menuItem.offsetWidth + marginLeft + marginRight || 0;
|
|
2262
|
+
};
|
|
2263
|
+
const calcSliceIndex = () => {
|
|
2264
|
+
var _a, _b;
|
|
2265
|
+
if (!menu.value)
|
|
2266
|
+
return -1;
|
|
2267
|
+
const items2 = Array.from((_b = (_a = menu.value) == null ? void 0 : _a.childNodes) != null ? _b : []).filter((item) => item.nodeName !== "#text" || item.nodeValue);
|
|
2268
|
+
const moreItemWidth = 64;
|
|
2269
|
+
const computedMenuStyle = getComputedStyle(menu.value);
|
|
2270
|
+
const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10);
|
|
2271
|
+
const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10);
|
|
2272
|
+
const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
|
|
2273
|
+
let calcWidth = 0;
|
|
2274
|
+
let sliceIndex2 = 0;
|
|
2275
|
+
items2.forEach((item, index2) => {
|
|
2276
|
+
if (item.nodeName === "#comment")
|
|
2277
|
+
return;
|
|
2278
|
+
calcWidth += calcMenuItemWidth(item);
|
|
2279
|
+
if (calcWidth <= menuWidth - moreItemWidth) {
|
|
2280
|
+
sliceIndex2 = index2 + 1;
|
|
2281
|
+
}
|
|
2282
|
+
});
|
|
2283
|
+
return sliceIndex2 === items2.length ? -1 : sliceIndex2;
|
|
2284
|
+
};
|
|
2285
|
+
const getIndexPath = (index2) => subMenus.value[index2].indexPath;
|
|
2286
|
+
const debounce2 = (fn, wait = 33.34) => {
|
|
2287
|
+
let timmer;
|
|
2288
|
+
return () => {
|
|
2289
|
+
timmer && clearTimeout(timmer);
|
|
2290
|
+
timmer = setTimeout(() => {
|
|
2291
|
+
fn();
|
|
2292
|
+
}, wait);
|
|
2293
|
+
};
|
|
2294
|
+
};
|
|
2295
|
+
let isFirstTimeRender = true;
|
|
2296
|
+
const handleResize = () => {
|
|
2297
|
+
if (sliceIndex.value === calcSliceIndex())
|
|
2298
|
+
return;
|
|
2299
|
+
const callback = () => {
|
|
2300
|
+
sliceIndex.value = -1;
|
|
2301
|
+
nextTick(() => {
|
|
2302
|
+
sliceIndex.value = calcSliceIndex();
|
|
2303
|
+
});
|
|
2304
|
+
};
|
|
2305
|
+
isFirstTimeRender ? callback() : debounce2(callback)();
|
|
2306
|
+
isFirstTimeRender = false;
|
|
2307
|
+
};
|
|
2308
|
+
watch(() => props.defaultActive, (currentActive) => {
|
|
2309
|
+
if (!items.value[currentActive]) {
|
|
2310
|
+
activeIndex.value = "";
|
|
2311
|
+
}
|
|
2312
|
+
updateActiveIndex(currentActive);
|
|
2313
|
+
});
|
|
2314
|
+
watch(() => props.collapse, (value) => {
|
|
2315
|
+
if (value)
|
|
2316
|
+
openedMenus.value = [];
|
|
2317
|
+
});
|
|
2318
|
+
watch(items.value, initMenu);
|
|
2319
|
+
let resizeStopper;
|
|
2320
|
+
watchEffect(() => {
|
|
2321
|
+
if (props.mode === "horizontal" && props.ellipsis)
|
|
2322
|
+
resizeStopper = useResizeObserver(menu, handleResize).stop;
|
|
2323
|
+
else
|
|
2324
|
+
resizeStopper == null ? void 0 : resizeStopper();
|
|
2325
|
+
});
|
|
2326
|
+
const mouseInChild = ref(false);
|
|
2327
|
+
{
|
|
2328
|
+
const addSubMenu = (item) => {
|
|
2329
|
+
subMenus.value[item.index] = item;
|
|
2330
|
+
};
|
|
2331
|
+
const removeSubMenu = (item) => {
|
|
2332
|
+
delete subMenus.value[item.index];
|
|
2333
|
+
};
|
|
2334
|
+
const addMenuItem = (item) => {
|
|
2335
|
+
items.value[item.index] = item;
|
|
2336
|
+
};
|
|
2337
|
+
const removeMenuItem = (item) => {
|
|
2338
|
+
delete items.value[item.index];
|
|
2339
|
+
};
|
|
2340
|
+
provide("rootMenu", reactive({
|
|
2341
|
+
props,
|
|
2342
|
+
openedMenus,
|
|
2343
|
+
items,
|
|
2344
|
+
subMenus,
|
|
2345
|
+
activeIndex,
|
|
2346
|
+
isMenuPopup,
|
|
2347
|
+
addMenuItem,
|
|
2348
|
+
removeMenuItem,
|
|
2349
|
+
addSubMenu,
|
|
2350
|
+
removeSubMenu,
|
|
2351
|
+
openMenu,
|
|
2352
|
+
closeMenu,
|
|
2353
|
+
handleMenuItemClick,
|
|
2354
|
+
handleSubMenuClick
|
|
2355
|
+
}));
|
|
2356
|
+
provide(`subMenu:${instance.uid}`, {
|
|
2357
|
+
addSubMenu,
|
|
2358
|
+
removeSubMenu,
|
|
2359
|
+
mouseInChild,
|
|
2360
|
+
level: 0
|
|
2361
|
+
});
|
|
2362
|
+
}
|
|
2363
|
+
onMounted(() => {
|
|
2364
|
+
if (props.mode === "horizontal") {
|
|
2365
|
+
new Menu$1(instance.vnode.el, nsMenu.namespace.value);
|
|
2366
|
+
}
|
|
2367
|
+
});
|
|
2368
|
+
{
|
|
2369
|
+
const open = (index2) => {
|
|
2370
|
+
const { indexPath } = subMenus.value[index2];
|
|
2371
|
+
indexPath.forEach((i) => openMenu(i, indexPath));
|
|
2372
|
+
};
|
|
2373
|
+
expose({
|
|
2374
|
+
open,
|
|
2375
|
+
close,
|
|
2376
|
+
handleResize
|
|
2377
|
+
});
|
|
2378
|
+
}
|
|
2379
|
+
const ulStyle = useMenuCssVar(props, 0);
|
|
2380
|
+
return () => {
|
|
2381
|
+
var _a, _b;
|
|
2382
|
+
let slot = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : [];
|
|
2383
|
+
const vShowMore = [];
|
|
2384
|
+
if (props.mode === "horizontal" && menu.value) {
|
|
2385
|
+
const originalSlot = flattedChildren(slot);
|
|
2386
|
+
const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
|
|
2387
|
+
const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
|
|
2388
|
+
if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) {
|
|
2389
|
+
slot = slotDefault;
|
|
2390
|
+
vShowMore.push(h(SubMenu2, {
|
|
2391
|
+
index: "sub-menu-more",
|
|
2392
|
+
class: nsSubMenu.e("hide-arrow"),
|
|
2393
|
+
popperOffset: props.popperOffset
|
|
2394
|
+
}, {
|
|
2395
|
+
title: () => h(ElIcon, {
|
|
2396
|
+
class: nsSubMenu.e("icon-more")
|
|
2397
|
+
}, {
|
|
2398
|
+
default: () => h(props.ellipsisIcon)
|
|
2399
|
+
}),
|
|
2400
|
+
default: () => slotMore
|
|
2401
|
+
}));
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
const directives = props.closeOnClickOutside ? [
|
|
2405
|
+
[
|
|
2406
|
+
ClickOutside,
|
|
2407
|
+
() => {
|
|
2408
|
+
if (!openedMenus.value.length)
|
|
2409
|
+
return;
|
|
2410
|
+
if (!mouseInChild.value) {
|
|
2411
|
+
openedMenus.value.forEach((openedMenu) => emit("close", openedMenu, getIndexPath(openedMenu)));
|
|
2412
|
+
openedMenus.value = [];
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
]
|
|
2416
|
+
] : [];
|
|
2417
|
+
const vMenu = withDirectives(h("ul", {
|
|
2418
|
+
key: String(props.collapse),
|
|
2419
|
+
role: "menubar",
|
|
2420
|
+
ref: menu,
|
|
2421
|
+
style: ulStyle.value,
|
|
2422
|
+
class: {
|
|
2423
|
+
[nsMenu.b()]: true,
|
|
2424
|
+
[nsMenu.m(props.mode)]: true,
|
|
2425
|
+
[nsMenu.m("collapse")]: props.collapse
|
|
2426
|
+
}
|
|
2427
|
+
}, [...slot, ...vShowMore]), directives);
|
|
2428
|
+
if (props.collapseTransition && props.mode === "vertical") {
|
|
2429
|
+
return h(ElMenuCollapseTransition, () => vMenu);
|
|
2430
|
+
}
|
|
2431
|
+
return vMenu;
|
|
2432
|
+
};
|
|
2433
|
+
}
|
|
2434
|
+
});
|
|
2435
|
+
const menuItemProps = buildProps({
|
|
2436
|
+
index: {
|
|
2437
|
+
type: definePropType([String, null]),
|
|
2438
|
+
default: null
|
|
2439
|
+
},
|
|
2440
|
+
route: {
|
|
2441
|
+
type: definePropType([String, Object])
|
|
2442
|
+
},
|
|
2443
|
+
disabled: Boolean
|
|
2444
|
+
});
|
|
2445
|
+
const menuItemEmits = {
|
|
2446
|
+
click: (item) => isString(item.index) && isArray(item.indexPath)
|
|
2447
|
+
};
|
|
2448
|
+
const COMPONENT_NAME = "ElMenuItem";
|
|
2449
|
+
const __default__$5 = defineComponent({
|
|
2450
|
+
name: COMPONENT_NAME
|
|
2451
|
+
});
|
|
2452
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
2453
|
+
...__default__$5,
|
|
2454
|
+
props: menuItemProps,
|
|
2455
|
+
emits: menuItemEmits,
|
|
2456
|
+
setup(__props, { expose, emit }) {
|
|
2457
|
+
const props = __props;
|
|
2458
|
+
const instance = getCurrentInstance();
|
|
2459
|
+
const rootMenu = inject("rootMenu");
|
|
2460
|
+
const nsMenu = useNamespace("menu");
|
|
2461
|
+
const nsMenuItem = useNamespace("menu-item");
|
|
2462
|
+
if (!rootMenu)
|
|
2463
|
+
throwError(COMPONENT_NAME, "can not inject root menu");
|
|
2464
|
+
const { parentMenu, indexPath } = useMenu(instance, toRef(props, "index"));
|
|
2465
|
+
const subMenu = inject(`subMenu:${parentMenu.value.uid}`);
|
|
2466
|
+
if (!subMenu)
|
|
2467
|
+
throwError(COMPONENT_NAME, "can not inject sub menu");
|
|
2468
|
+
const active = computed(() => props.index === rootMenu.activeIndex);
|
|
2469
|
+
const item = reactive({
|
|
2470
|
+
index: props.index,
|
|
2471
|
+
indexPath,
|
|
2472
|
+
active
|
|
2473
|
+
});
|
|
2474
|
+
const handleClick = () => {
|
|
2475
|
+
if (!props.disabled) {
|
|
2476
|
+
rootMenu.handleMenuItemClick({
|
|
2477
|
+
index: props.index,
|
|
2478
|
+
indexPath: indexPath.value,
|
|
2479
|
+
route: props.route
|
|
2480
|
+
});
|
|
2481
|
+
emit("click", item);
|
|
2482
|
+
}
|
|
2483
|
+
};
|
|
2484
|
+
onMounted(() => {
|
|
2485
|
+
subMenu.addSubMenu(item);
|
|
2486
|
+
rootMenu.addMenuItem(item);
|
|
2487
|
+
});
|
|
2488
|
+
onBeforeUnmount(() => {
|
|
2489
|
+
subMenu.removeSubMenu(item);
|
|
2490
|
+
rootMenu.removeMenuItem(item);
|
|
2491
|
+
});
|
|
2492
|
+
expose({
|
|
2493
|
+
parentMenu,
|
|
2494
|
+
rootMenu,
|
|
2495
|
+
active,
|
|
2496
|
+
nsMenu,
|
|
2497
|
+
nsMenuItem,
|
|
2498
|
+
handleClick
|
|
2499
|
+
});
|
|
2500
|
+
return (_ctx, _cache) => {
|
|
2501
|
+
return openBlock(), createElementBlock("li", {
|
|
2502
|
+
class: normalizeClass([
|
|
2503
|
+
unref(nsMenuItem).b(),
|
|
2504
|
+
unref(nsMenuItem).is("active", unref(active)),
|
|
2505
|
+
unref(nsMenuItem).is("disabled", _ctx.disabled)
|
|
2506
|
+
]),
|
|
2507
|
+
role: "menuitem",
|
|
2508
|
+
tabindex: "-1",
|
|
2509
|
+
onClick: handleClick
|
|
2510
|
+
}, [
|
|
2511
|
+
unref(parentMenu).type.name === "ElMenu" && unref(rootMenu).props.collapse && _ctx.$slots.title ? (openBlock(), createBlock(unref(ElTooltip), {
|
|
2512
|
+
key: 0,
|
|
2513
|
+
effect: unref(rootMenu).props.popperEffect,
|
|
2514
|
+
placement: "right",
|
|
2515
|
+
"fallback-placements": ["left"],
|
|
2516
|
+
persistent: unref(rootMenu).props.persistent
|
|
2517
|
+
}, {
|
|
2518
|
+
content: withCtx(() => [
|
|
2519
|
+
renderSlot(_ctx.$slots, "title")
|
|
2520
|
+
]),
|
|
2521
|
+
default: withCtx(() => [
|
|
2522
|
+
createElementVNode("div", {
|
|
2523
|
+
class: normalizeClass(unref(nsMenu).be("tooltip", "trigger"))
|
|
2524
|
+
}, [
|
|
2525
|
+
renderSlot(_ctx.$slots, "default")
|
|
2526
|
+
], 2)
|
|
2527
|
+
]),
|
|
2528
|
+
_: 3
|
|
2529
|
+
}, 8, ["effect", "persistent"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2530
|
+
renderSlot(_ctx.$slots, "default"),
|
|
2531
|
+
renderSlot(_ctx.$slots, "title")
|
|
2532
|
+
], 64))
|
|
2533
|
+
], 2);
|
|
2534
|
+
};
|
|
2535
|
+
}
|
|
2536
|
+
});
|
|
2537
|
+
var MenuItem2 = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__file", "menu-item.vue"]]);
|
|
2538
|
+
const menuItemGroupProps = {
|
|
2539
|
+
title: String
|
|
2540
|
+
};
|
|
2541
|
+
const __default__$4 = defineComponent({
|
|
2542
|
+
name: "ElMenuItemGroup"
|
|
2543
|
+
});
|
|
2544
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
2545
|
+
...__default__$4,
|
|
2546
|
+
props: menuItemGroupProps,
|
|
2547
|
+
setup(__props) {
|
|
2548
|
+
const ns = useNamespace("menu-item-group");
|
|
2549
|
+
return (_ctx, _cache) => {
|
|
2550
|
+
return openBlock(), createElementBlock("li", {
|
|
2551
|
+
class: normalizeClass(unref(ns).b())
|
|
2552
|
+
}, [
|
|
2553
|
+
createElementVNode("div", {
|
|
2554
|
+
class: normalizeClass(unref(ns).e("title"))
|
|
2555
|
+
}, [
|
|
2556
|
+
!_ctx.$slots.title ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2557
|
+
createTextVNode(toDisplayString(_ctx.title), 1)
|
|
2558
|
+
], 64)) : renderSlot(_ctx.$slots, "title", { key: 1 })
|
|
2559
|
+
], 2),
|
|
2560
|
+
createElementVNode("ul", null, [
|
|
2561
|
+
renderSlot(_ctx.$slots, "default")
|
|
2562
|
+
])
|
|
2563
|
+
], 2);
|
|
2564
|
+
};
|
|
2565
|
+
}
|
|
2566
|
+
});
|
|
2567
|
+
var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__file", "menu-item-group.vue"]]);
|
|
2568
|
+
const ElMenu = withInstall(Menu2, {
|
|
2569
|
+
MenuItem: MenuItem2,
|
|
2570
|
+
MenuItemGroup,
|
|
2571
|
+
SubMenu: SubMenu2
|
|
2572
|
+
});
|
|
2573
|
+
const ElMenuItem = withNoopInstall(MenuItem2);
|
|
2574
|
+
withNoopInstall(MenuItemGroup);
|
|
2575
|
+
const ElSubMenu = withNoopInstall(SubMenu2);
|
|
2576
|
+
function hexToRgb(str) {
|
|
2577
|
+
let hexs = "";
|
|
2578
|
+
let reg = /^\#?[0-9A-Fa-f]{6}$/;
|
|
2579
|
+
if (!reg.test(str)) return ElMessage.warning("输入错误的hex");
|
|
2580
|
+
str = str.replace("#", "");
|
|
2581
|
+
hexs = str.match(/../g);
|
|
2582
|
+
for (let i = 0; i < 3; i++) hexs[i] = parseInt(hexs[i], 16);
|
|
2583
|
+
return hexs;
|
|
2584
|
+
}
|
|
2585
|
+
function rgbToHex(r, g, b) {
|
|
2586
|
+
let reg = /^\d{1,3}$/;
|
|
2587
|
+
if (!reg.test(r) || !reg.test(g) || !reg.test(b)) return ElMessage.warning("输入错误的rgb颜色值");
|
|
2588
|
+
let hexs = [r.toString(16), g.toString(16), b.toString(16)];
|
|
2589
|
+
for (let i = 0; i < 3; i++) if (hexs[i].length == 1) hexs[i] = `0${hexs[i]}`;
|
|
2590
|
+
return `#${hexs.join("")}`;
|
|
2591
|
+
}
|
|
2592
|
+
function getDarkColor(color, level) {
|
|
2593
|
+
let reg = /^\#?[0-9A-Fa-f]{6}$/;
|
|
2594
|
+
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
|
|
2595
|
+
let rgb = hexToRgb(color);
|
|
2596
|
+
for (let i = 0; i < 3; i++) rgb[i] = Math.round(20.5 * level + rgb[i] * (1 - level));
|
|
2597
|
+
return rgbToHex(rgb[0], rgb[1], rgb[2]);
|
|
2598
|
+
}
|
|
2599
|
+
function getLightColor(color, level) {
|
|
2600
|
+
let reg = /^\#?[0-9A-Fa-f]{6}$/;
|
|
2601
|
+
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
|
|
2602
|
+
let rgb = hexToRgb(color);
|
|
2603
|
+
for (let i = 0; i < 3; i++) rgb[i] = Math.round(255 * level + rgb[i] * (1 - level));
|
|
2604
|
+
return rgbToHex(rgb[0], rgb[1], rgb[2]);
|
|
2605
|
+
}
|
|
2606
|
+
const menuTheme = {
|
|
2607
|
+
light: {
|
|
2608
|
+
"--el-menu-bg-color": "#ffffff",
|
|
2609
|
+
"--el-menu-hover-bg-color": "#cccccc",
|
|
2610
|
+
"--el-menu-active-bg-color": "var(--el-color-primary-light-9)",
|
|
2611
|
+
"--el-menu-text-color": "#333333",
|
|
2612
|
+
"--el-menu-active-color": "var(--el-color-primary)",
|
|
2613
|
+
"--el-menu-hover-text-color": "#333333",
|
|
2614
|
+
"--el-menu-horizontal-sub-item-height": "50px"
|
|
2615
|
+
},
|
|
2616
|
+
inverted: {
|
|
2617
|
+
"--el-menu-bg-color": "#ffffff",
|
|
2618
|
+
"--el-menu-hover-bg-color": "#cccccc",
|
|
2619
|
+
"--el-menu-active-bg-color": "var(--el-color-primary-light-9)",
|
|
2620
|
+
"--el-menu-text-color": "#333333",
|
|
2621
|
+
"--el-menu-active-color": "var(--el-color-primary)",
|
|
2622
|
+
"--el-menu-hover-text-color": "#333333",
|
|
2623
|
+
"--el-menu-horizontal-sub-item-height": "50px"
|
|
2624
|
+
},
|
|
2625
|
+
dark: {
|
|
2626
|
+
"--el-menu-bg-color": "#141414",
|
|
2627
|
+
"--el-menu-hover-bg-color": "#000000",
|
|
2628
|
+
"--el-menu-active-bg-color": "#000000",
|
|
2629
|
+
"--el-menu-text-color": "#bdbdc0",
|
|
2630
|
+
"--el-menu-active-color": "#ffffff",
|
|
2631
|
+
"--el-menu-hover-text-color": "#ffffff",
|
|
2632
|
+
"--el-menu-horizontal-sub-item-height": "50px"
|
|
2633
|
+
}
|
|
2634
|
+
};
|
|
2635
|
+
const asideTheme = {
|
|
2636
|
+
light: {
|
|
2637
|
+
"--el-aside-logo-text-color": "#303133",
|
|
2638
|
+
"--el-aside-border-color": "#e4e7ed"
|
|
2639
|
+
},
|
|
2640
|
+
inverted: {
|
|
2641
|
+
"--el-aside-logo-text-color": "#dadada",
|
|
2642
|
+
"--el-aside-border-color": "#414243"
|
|
2643
|
+
},
|
|
2644
|
+
dark: {
|
|
2645
|
+
"--el-aside-logo-text-color": "#dadada",
|
|
2646
|
+
"--el-aside-border-color": "#414243"
|
|
2647
|
+
}
|
|
2648
|
+
};
|
|
2649
|
+
const headerTheme = {
|
|
2650
|
+
light: {
|
|
2651
|
+
"--el-header-logo-text-color": "#303133",
|
|
2652
|
+
"--el-header-bg-color": "#ffffff",
|
|
2653
|
+
"--el-header-text-color": "#303133",
|
|
2654
|
+
"--el-header-text-color-regular": "#606266",
|
|
2655
|
+
"--el-header-border-color": "#e4e7ed"
|
|
2656
|
+
},
|
|
2657
|
+
inverted: {
|
|
2658
|
+
"--el-header-logo-text-color": "#fff",
|
|
2659
|
+
"--el-header-bg-color": "var(--el-color-primary)",
|
|
2660
|
+
"--el-header-text-color": "#fff",
|
|
2661
|
+
"--el-header-text-color-regular": "#fff",
|
|
2662
|
+
"--el-header-border-color": "var(--el-color-primary)"
|
|
2663
|
+
},
|
|
2664
|
+
dark: {
|
|
2665
|
+
"--el-header-logo-text-color": "#dadada",
|
|
2666
|
+
"--el-header-bg-color": "#141414",
|
|
2667
|
+
"--el-header-text-color": "#e5eaf3",
|
|
2668
|
+
"--el-header-text-color-regular": "#cfd3dc",
|
|
2669
|
+
"--el-header-border-color": "#414243"
|
|
2670
|
+
}
|
|
2671
|
+
};
|
|
2672
|
+
const useTheme = () => {
|
|
2673
|
+
const globalStore = useGlobalStore();
|
|
2674
|
+
const { primary, isDark, isGrey, isWeak, layout, asideInverted, headerInverted } = storeToRefs(globalStore);
|
|
2675
|
+
const switchDark = () => {
|
|
2676
|
+
const html = document.documentElement;
|
|
2677
|
+
if (isDark.value) html.setAttribute("class", "dark");
|
|
2678
|
+
else html.setAttribute("class", "");
|
|
2679
|
+
changePrimary(primary.value);
|
|
2680
|
+
setAsideTheme();
|
|
2681
|
+
setHeaderTheme();
|
|
2682
|
+
};
|
|
2683
|
+
const changePrimary = (val) => {
|
|
2684
|
+
if (!val) {
|
|
2685
|
+
val = DEFAULT_PRIMARY;
|
|
2686
|
+
ElMessage({ type: "success", message: `主题颜色已重置为 ${DEFAULT_PRIMARY}` });
|
|
2687
|
+
}
|
|
2688
|
+
document.documentElement.style.setProperty("--el-color-primary", val);
|
|
2689
|
+
document.documentElement.style.setProperty(
|
|
2690
|
+
"--el-color-primary-dark-2",
|
|
2691
|
+
isDark.value ? `${getLightColor(val, 0.2)}` : `${getDarkColor(val, 0.3)}`
|
|
2692
|
+
);
|
|
2693
|
+
for (let i = 1; i <= 9; i++) {
|
|
2694
|
+
const primaryColor = isDark.value ? `${getDarkColor(val, i / 10)}` : `${getLightColor(val, i / 10)}`;
|
|
2695
|
+
document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, primaryColor);
|
|
2696
|
+
}
|
|
2697
|
+
globalStore.setGlobalState("primary", val);
|
|
2698
|
+
};
|
|
2699
|
+
const changeGreyOrWeak = (type, value) => {
|
|
2700
|
+
const body = document.body;
|
|
2701
|
+
if (!value) return body.removeAttribute("style");
|
|
2702
|
+
const styles = {
|
|
2703
|
+
grey: "filter: grayscale(1)",
|
|
2704
|
+
weak: "filter: invert(80%)"
|
|
2705
|
+
};
|
|
2706
|
+
body.setAttribute("style", styles[type]);
|
|
2707
|
+
const propName = type === "grey" ? "isWeak" : "isGrey";
|
|
2708
|
+
globalStore.setGlobalState(propName, false);
|
|
2709
|
+
};
|
|
2710
|
+
const setMenuTheme = () => {
|
|
2711
|
+
let type = "light";
|
|
2712
|
+
if (layout.value === "transverse" && headerInverted.value) type = "inverted";
|
|
2713
|
+
if (layout.value !== "transverse" && asideInverted.value) type = "inverted";
|
|
2714
|
+
if (isDark.value) type = "dark";
|
|
2715
|
+
const theme = menuTheme[type];
|
|
2716
|
+
for (const [key, value] of Object.entries(theme)) {
|
|
2717
|
+
document.documentElement.style.setProperty(key, value);
|
|
2718
|
+
}
|
|
2719
|
+
};
|
|
2720
|
+
const setAsideTheme = () => {
|
|
2721
|
+
let type = "light";
|
|
2722
|
+
if (asideInverted.value) type = "inverted";
|
|
2723
|
+
if (isDark.value) type = "dark";
|
|
2724
|
+
const theme = asideTheme[type];
|
|
2725
|
+
for (const [key, value] of Object.entries(theme)) {
|
|
2726
|
+
document.documentElement.style.setProperty(key, value);
|
|
2727
|
+
}
|
|
2728
|
+
setMenuTheme();
|
|
2729
|
+
};
|
|
2730
|
+
const setHeaderTheme = () => {
|
|
2731
|
+
let type = "light";
|
|
2732
|
+
if (headerInverted.value) type = "inverted";
|
|
2733
|
+
if (isDark.value) type = "dark";
|
|
2734
|
+
const theme = headerTheme[type];
|
|
2735
|
+
for (const [key, value] of Object.entries(theme)) {
|
|
2736
|
+
document.documentElement.style.setProperty(key, value);
|
|
2737
|
+
}
|
|
2738
|
+
setMenuTheme();
|
|
2739
|
+
};
|
|
2740
|
+
const initTheme = () => {
|
|
2741
|
+
switchDark();
|
|
2742
|
+
if (isGrey.value) changeGreyOrWeak("grey", true);
|
|
2743
|
+
if (isWeak.value) changeGreyOrWeak("weak", true);
|
|
2744
|
+
};
|
|
2745
|
+
return {
|
|
2746
|
+
initTheme,
|
|
2747
|
+
switchDark,
|
|
2748
|
+
changePrimary,
|
|
2749
|
+
changeGreyOrWeak,
|
|
2750
|
+
setAsideTheme,
|
|
2751
|
+
setHeaderTheme
|
|
2752
|
+
};
|
|
2753
|
+
};
|
|
2754
|
+
function mitt(n) {
|
|
2755
|
+
return { all: n = n || /* @__PURE__ */ new Map(), on: function(t, e) {
|
|
2756
|
+
var i = n.get(t);
|
|
2757
|
+
i ? i.push(e) : n.set(t, [e]);
|
|
2758
|
+
}, off: function(t, e) {
|
|
2759
|
+
var i = n.get(t);
|
|
2760
|
+
i && (e ? i.splice(i.indexOf(e) >>> 0, 1) : n.set(t, []));
|
|
2761
|
+
}, emit: function(t, e) {
|
|
2762
|
+
var i = n.get(t);
|
|
2763
|
+
i && i.slice().map(function(n2) {
|
|
2764
|
+
n2(e);
|
|
2765
|
+
}), (i = n.get("*")) && i.slice().map(function(n2) {
|
|
2766
|
+
n2(t, e);
|
|
2767
|
+
});
|
|
2768
|
+
} };
|
|
2769
|
+
}
|
|
2770
|
+
const mittBus = mitt();
|
|
2771
|
+
const __default__$3 = defineComponent({
|
|
2772
|
+
name: "SwitchDark"
|
|
2773
|
+
});
|
|
2774
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
2775
|
+
...__default__$3,
|
|
2776
|
+
setup(__props) {
|
|
2777
|
+
const {
|
|
2778
|
+
switchDark
|
|
2779
|
+
} = useTheme();
|
|
2780
|
+
const globalStore = useGlobalStore();
|
|
2781
|
+
return (_ctx, _cache) => {
|
|
2782
|
+
const _component_el_switch = ElSwitch;
|
|
2783
|
+
return openBlock(), createBlock(_component_el_switch, {
|
|
2784
|
+
modelValue: unref(globalStore).isDark,
|
|
2785
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(globalStore).isDark = $event),
|
|
2786
|
+
"inline-prompt": "",
|
|
2787
|
+
"active-icon": unref(sunny_default),
|
|
2788
|
+
"inactive-icon": unref(moon_default),
|
|
2789
|
+
onChange: unref(switchDark)
|
|
2790
|
+
}, null, 8, ["modelValue", "active-icon", "inactive-icon", "onChange"]);
|
|
2791
|
+
};
|
|
2792
|
+
}
|
|
2793
|
+
});
|
|
2794
|
+
const _hoisted_1$a = {
|
|
2795
|
+
class: "layout-box"
|
|
2796
|
+
};
|
|
2797
|
+
const _hoisted_2$6 = {
|
|
2798
|
+
class: "theme-item mb50"
|
|
2799
|
+
};
|
|
2800
|
+
const _hoisted_3$2 = {
|
|
2801
|
+
class: "theme-item"
|
|
2802
|
+
};
|
|
2803
|
+
const _hoisted_4$1 = {
|
|
2804
|
+
class: "theme-item"
|
|
2805
|
+
};
|
|
2806
|
+
const _hoisted_5 = {
|
|
2807
|
+
class: "theme-item"
|
|
2808
|
+
};
|
|
2809
|
+
const _hoisted_6 = {
|
|
2810
|
+
class: "theme-item"
|
|
2811
|
+
};
|
|
2812
|
+
const _hoisted_7 = {
|
|
2813
|
+
class: "theme-item"
|
|
2814
|
+
};
|
|
2815
|
+
const _hoisted_8 = {
|
|
2816
|
+
class: "theme-item"
|
|
2817
|
+
};
|
|
2818
|
+
const _hoisted_9 = {
|
|
2819
|
+
class: "theme-item"
|
|
2820
|
+
};
|
|
2821
|
+
const _hoisted_10 = {
|
|
2822
|
+
class: "theme-item"
|
|
2823
|
+
};
|
|
2824
|
+
const _hoisted_11 = {
|
|
2825
|
+
class: "theme-item"
|
|
2826
|
+
};
|
|
2827
|
+
const _hoisted_12 = {
|
|
2828
|
+
class: "theme-item"
|
|
2829
|
+
};
|
|
2830
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
2831
|
+
__name: "index",
|
|
2832
|
+
setup(__props) {
|
|
2833
|
+
const {
|
|
2834
|
+
changePrimary,
|
|
2835
|
+
setAsideTheme,
|
|
2836
|
+
setHeaderTheme
|
|
2837
|
+
} = useTheme();
|
|
2838
|
+
const globalStore = useGlobalStore();
|
|
2839
|
+
const {
|
|
2840
|
+
layout,
|
|
2841
|
+
primary,
|
|
2842
|
+
headerInverted,
|
|
2843
|
+
isCollapse,
|
|
2844
|
+
isSubCollapse,
|
|
2845
|
+
accordion,
|
|
2846
|
+
breadcrumb,
|
|
2847
|
+
breadcrumbIcon,
|
|
2848
|
+
tabs,
|
|
2849
|
+
tabsIcon,
|
|
2850
|
+
footer
|
|
2851
|
+
} = storeToRefs(globalStore);
|
|
2852
|
+
const colorList = [DEFAULT_PRIMARY, "#daa96e", "#0c819f", "#409eff", "#27ae60", "#ff5c93", "#e74c3c", "#fd726d", "#f39c12", "#9b59b6"];
|
|
2853
|
+
const setLayout = (val) => {
|
|
2854
|
+
globalStore.setGlobalState("layout", val);
|
|
2855
|
+
setAsideTheme();
|
|
2856
|
+
};
|
|
2857
|
+
const drawerVisible = ref(false);
|
|
2858
|
+
mittBus.on("openThemeDrawer", () => drawerVisible.value = true);
|
|
2859
|
+
return (_ctx, _cache) => {
|
|
2860
|
+
const _component_Notification = resolveComponent("Notification");
|
|
2861
|
+
const _component_el_icon = ElIcon;
|
|
2862
|
+
const _component_el_divider = ElDivider;
|
|
2863
|
+
const _component_CircleCheckFilled = resolveComponent("CircleCheckFilled");
|
|
2864
|
+
const _component_el_tooltip = ElTooltip;
|
|
2865
|
+
const _component_QuestionFilled = resolveComponent("QuestionFilled");
|
|
2866
|
+
const _component_el_switch = ElSwitch;
|
|
2867
|
+
const _component_ColdDrink = resolveComponent("ColdDrink");
|
|
2868
|
+
const _component_el_color_picker = ElColorPicker;
|
|
2869
|
+
const _component_Setting = resolveComponent("Setting");
|
|
2870
|
+
const _component_el_drawer = ElDrawer;
|
|
2871
|
+
return openBlock(), createBlock(_component_el_drawer, {
|
|
2872
|
+
modelValue: drawerVisible.value,
|
|
2873
|
+
"onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => drawerVisible.value = $event),
|
|
2874
|
+
title: "布局设置",
|
|
2875
|
+
size: "290px"
|
|
2876
|
+
}, {
|
|
2877
|
+
default: withCtx(() => [createVNode(_component_el_divider, {
|
|
2878
|
+
class: "divider",
|
|
2879
|
+
"content-position": "center"
|
|
2880
|
+
}, {
|
|
2881
|
+
default: withCtx(() => [createVNode(_component_el_icon, null, {
|
|
2882
|
+
default: withCtx(() => [createVNode(_component_Notification)]),
|
|
2883
|
+
_: 1
|
|
2884
|
+
}), _cache[13] || (_cache[13] = createTextVNode(" 布局样式 "))]),
|
|
2885
|
+
_: 1
|
|
2886
|
+
}), createElementVNode("div", _hoisted_1$a, [createVNode(_component_el_tooltip, {
|
|
2887
|
+
effect: "dark",
|
|
2888
|
+
content: "经典",
|
|
2889
|
+
placement: "top",
|
|
2890
|
+
"show-after": 200
|
|
2891
|
+
}, {
|
|
2892
|
+
default: withCtx(() => [createElementVNode("div", {
|
|
2893
|
+
class: normalizeClass(["layout-item layout-classic", {
|
|
2894
|
+
"is-active": unref(layout) == "classic"
|
|
2895
|
+
}]),
|
|
2896
|
+
onClick: _cache[0] || (_cache[0] = ($event) => setLayout("classic"))
|
|
2897
|
+
}, [_cache[14] || (_cache[14] = createElementVNode("div", {
|
|
2898
|
+
class: "layout-dark"
|
|
2899
|
+
}, null, -1)), _cache[15] || (_cache[15] = createElementVNode("div", {
|
|
2900
|
+
class: "layout-container"
|
|
2901
|
+
}, [createElementVNode("div", {
|
|
2902
|
+
class: "layout-light"
|
|
2903
|
+
}), createElementVNode("div", {
|
|
2904
|
+
class: "layout-content"
|
|
2905
|
+
})], -1)), unref(layout) == "classic" ? (openBlock(), createBlock(_component_el_icon, {
|
|
2906
|
+
key: 0
|
|
2907
|
+
}, {
|
|
2908
|
+
default: withCtx(() => [createVNode(_component_CircleCheckFilled)]),
|
|
2909
|
+
_: 1
|
|
2910
|
+
})) : createCommentVNode("", true)], 2)]),
|
|
2911
|
+
_: 1
|
|
2912
|
+
}), createVNode(_component_el_tooltip, {
|
|
2913
|
+
effect: "dark",
|
|
2914
|
+
content: "横向",
|
|
2915
|
+
placement: "top",
|
|
2916
|
+
"show-after": 200
|
|
2917
|
+
}, {
|
|
2918
|
+
default: withCtx(() => [createElementVNode("div", {
|
|
2919
|
+
class: normalizeClass(["layout-item layout-transverse", {
|
|
2920
|
+
"is-active": unref(layout) == "transverse"
|
|
2921
|
+
}]),
|
|
2922
|
+
onClick: _cache[1] || (_cache[1] = ($event) => setLayout("transverse"))
|
|
2923
|
+
}, [_cache[16] || (_cache[16] = createElementVNode("div", {
|
|
2924
|
+
class: "layout-dark"
|
|
2925
|
+
}, null, -1)), _cache[17] || (_cache[17] = createElementVNode("div", {
|
|
2926
|
+
class: "layout-content"
|
|
2927
|
+
}, null, -1)), unref(layout) == "transverse" ? (openBlock(), createBlock(_component_el_icon, {
|
|
2928
|
+
key: 0
|
|
2929
|
+
}, {
|
|
2930
|
+
default: withCtx(() => [createVNode(_component_CircleCheckFilled)]),
|
|
2931
|
+
_: 1
|
|
2932
|
+
})) : createCommentVNode("", true)], 2)]),
|
|
2933
|
+
_: 1
|
|
2934
|
+
})]), createElementVNode("div", _hoisted_2$6, [createElementVNode("span", null, [_cache[18] || (_cache[18] = createTextVNode(" 头部反转色 ")), createVNode(_component_el_tooltip, {
|
|
2935
|
+
effect: "dark",
|
|
2936
|
+
content: "头部颜色变为深色模式",
|
|
2937
|
+
placement: "top"
|
|
2938
|
+
}, {
|
|
2939
|
+
default: withCtx(() => [createVNode(_component_el_icon, null, {
|
|
2940
|
+
default: withCtx(() => [createVNode(_component_QuestionFilled)]),
|
|
2941
|
+
_: 1
|
|
2942
|
+
})]),
|
|
2943
|
+
_: 1
|
|
2944
|
+
})]), createVNode(_component_el_switch, {
|
|
2945
|
+
modelValue: unref(headerInverted),
|
|
2946
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(headerInverted) ? headerInverted.value = $event : null),
|
|
2947
|
+
onChange: unref(setHeaderTheme)
|
|
2948
|
+
}, null, 8, ["modelValue", "onChange"])]), createVNode(_component_el_divider, {
|
|
2949
|
+
class: "divider",
|
|
2950
|
+
"content-position": "center"
|
|
2951
|
+
}, {
|
|
2952
|
+
default: withCtx(() => [createVNode(_component_el_icon, null, {
|
|
2953
|
+
default: withCtx(() => [createVNode(_component_ColdDrink)]),
|
|
2954
|
+
_: 1
|
|
2955
|
+
}), _cache[19] || (_cache[19] = createTextVNode(" 全局主题 "))]),
|
|
2956
|
+
_: 1
|
|
2957
|
+
}), createElementVNode("div", _hoisted_3$2, [_cache[20] || (_cache[20] = createElementVNode("span", null, "主题颜色", -1)), createVNode(_component_el_color_picker, {
|
|
2958
|
+
modelValue: unref(primary),
|
|
2959
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(primary) ? primary.value = $event : null),
|
|
2960
|
+
predefine: colorList,
|
|
2961
|
+
onChange: unref(changePrimary)
|
|
2962
|
+
}, null, 8, ["modelValue", "onChange"])]), createElementVNode("div", _hoisted_4$1, [_cache[21] || (_cache[21] = createElementVNode("span", null, "暗黑模式", -1)), createVNode(_sfc_main$h)]), createVNode(_component_el_divider, {
|
|
2963
|
+
class: "divider",
|
|
2964
|
+
"content-position": "center"
|
|
2965
|
+
}, {
|
|
2966
|
+
default: withCtx(() => [createVNode(_component_el_icon, null, {
|
|
2967
|
+
default: withCtx(() => [createVNode(_component_Setting)]),
|
|
2968
|
+
_: 1
|
|
2969
|
+
}), _cache[22] || (_cache[22] = createTextVNode(" 界面设置 "))]),
|
|
2970
|
+
_: 1
|
|
2971
|
+
}), createElementVNode("div", _hoisted_5, [_cache[23] || (_cache[23] = createElementVNode("span", null, "主菜单折叠", -1)), createVNode(_component_el_switch, {
|
|
2972
|
+
modelValue: unref(isCollapse),
|
|
2973
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(isCollapse) ? isCollapse.value = $event : null)
|
|
2974
|
+
}, null, 8, ["modelValue"])]), createElementVNode("div", _hoisted_6, [_cache[24] || (_cache[24] = createElementVNode("span", null, "内部菜单折叠", -1)), createVNode(_component_el_switch, {
|
|
2975
|
+
modelValue: unref(isSubCollapse),
|
|
2976
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(isSubCollapse) ? isSubCollapse.value = $event : null)
|
|
2977
|
+
}, null, 8, ["modelValue"])]), createElementVNode("div", _hoisted_7, [_cache[25] || (_cache[25] = createElementVNode("span", null, "菜单手风琴", -1)), createVNode(_component_el_switch, {
|
|
2978
|
+
modelValue: unref(accordion),
|
|
2979
|
+
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(accordion) ? accordion.value = $event : null)
|
|
2980
|
+
}, null, 8, ["modelValue"])]), createElementVNode("div", _hoisted_8, [_cache[26] || (_cache[26] = createElementVNode("span", null, "面包屑", -1)), createVNode(_component_el_switch, {
|
|
2981
|
+
modelValue: unref(breadcrumb),
|
|
2982
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(breadcrumb) ? breadcrumb.value = $event : null)
|
|
2983
|
+
}, null, 8, ["modelValue"])]), createElementVNode("div", _hoisted_9, [_cache[27] || (_cache[27] = createElementVNode("span", null, "面包屑图标", -1)), createVNode(_component_el_switch, {
|
|
2984
|
+
modelValue: unref(breadcrumbIcon),
|
|
2985
|
+
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(breadcrumbIcon) ? breadcrumbIcon.value = $event : null)
|
|
2986
|
+
}, null, 8, ["modelValue"])]), createElementVNode("div", _hoisted_10, [_cache[28] || (_cache[28] = createElementVNode("span", null, "标签栏", -1)), createVNode(_component_el_switch, {
|
|
2987
|
+
modelValue: unref(tabs),
|
|
2988
|
+
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => isRef(tabs) ? tabs.value = $event : null)
|
|
2989
|
+
}, null, 8, ["modelValue"])]), createElementVNode("div", _hoisted_11, [_cache[29] || (_cache[29] = createElementVNode("span", null, "标签栏图标", -1)), createVNode(_component_el_switch, {
|
|
2990
|
+
modelValue: unref(tabsIcon),
|
|
2991
|
+
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => isRef(tabsIcon) ? tabsIcon.value = $event : null)
|
|
2992
|
+
}, null, 8, ["modelValue"])]), createElementVNode("div", _hoisted_12, [_cache[30] || (_cache[30] = createElementVNode("span", null, "页脚", -1)), createVNode(_component_el_switch, {
|
|
2993
|
+
modelValue: unref(footer),
|
|
2994
|
+
"onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => isRef(footer) ? footer.value = $event : null)
|
|
2995
|
+
}, null, 8, ["modelValue"])])]),
|
|
2996
|
+
_: 1
|
|
2997
|
+
}, 8, ["modelValue"]);
|
|
2998
|
+
};
|
|
2999
|
+
}
|
|
3000
|
+
});
|
|
3001
|
+
const ThemeDrawer = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["__scopeId", "data-v-1e728fc7"]]);
|
|
3002
|
+
const _imports_0$1 = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1729040958234'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='5152'%20width='64'%20height='64'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cpath%20d='M953.398227%20371.854971a384.834739%20384.834739%200%200%200-4.284805-4.341784q-14.495404-14.529591-30.062009-27.213069C884.089228%20146.765964%20714.816642%200%20511.265617%200%20307.190388%200%20137.587325%20147.495293%20103.21772%20341.6904q-14.620757%2012.136482-28.329854%2025.822787-2.17659%202.153798-4.284805%204.341784C-82.464757%20529.469697%2031.11676%20793.851276%20250.781387%20793.851276h522.438514c219.653231%200%20333.25754-264.38158%20180.178326-421.996305zM280.091276%20577.810501a37.423668%2037.423668%200%201%201%2037.423668-37.423668%2037.423668%2037.423668%200%200%201-37.423668%2037.423668z%20m0-143.449799a37.423668%2037.423668%200%201%201%2037.423668-37.423668%2037.423668%2037.423668%200%200%201-37.423668%2037.423668z%20m0-143.461194a37.423668%2037.423668%200%201%201%2037.423668-37.412273%2037.412273%2037.412273%200%200%201-37.423668%2037.412273z%20m501.242404%20250.524339a36.386654%2036.386654%200%200%201-36.39805%2036.386654h-353.952236a36.375259%2036.375259%200%200%201-36.386654-36.386654v-2.062633a36.375259%2036.375259%200%200%201%2036.386654-36.386654h353.952236a36.386654%2036.386654%200%200%201%2036.39805%2036.386654z%20m0-143.449799a36.39805%2036.39805%200%200%201-36.39805%2036.386654h-353.952236a36.386654%2036.386654%200%200%201-36.386654-36.386654v-2.074028a36.386654%2036.386654%200%200%201%2036.386654-36.386654h353.952236a36.39805%2036.39805%200%200%201%2036.39805%2036.386654z%20m0-143.461194a36.386654%2036.386654%200%200%201-36.39805%2036.386654h-353.952236a36.375259%2036.375259%200%200%201-36.386654-36.386654v-2.062633a36.375259%2036.375259%200%200%201%2036.386654-36.363863h353.952236a36.386654%2036.386654%200%200%201%2036.39805%2036.386655z'%20fill='%23ffffff'%20p-id='5153'%3e%3c/path%3e%3cpath%20d='M517.692825%20950.748069V705.659507h-11.395758V950.748069a34.187273%2034.187273%200%201%200%2011.395758%200zM355.497005%20789.691825c0%2083.62207-64.283469%20156.497941-124.840526%20170.822409a34.187273%2034.187273%200%201%200%207.384451%209.800351c26.677469-7.555387%2053.936121-25.139042%2076.704845-50.141334%2033.628881-36.899464%2052.146987-83.24601%2052.146988-130.481426zM670.885996%20793.851276c0%2083.610675%2064.283469%20156.486545%20124.840526%20170.811013a34.187273%2034.187273%200%201%201-7.384451%209.800352c-26.677469-7.555387-53.936121-25.070667-76.704845-50.141334-33.640277-36.876672-52.146987-83.223219-52.146987-130.470031z'%20fill='%23ffffff'%20p-id='5154'%3e%3c/path%3e%3c/svg%3e";
|
|
3003
|
+
const useKeepAliveStore = defineStore({
|
|
3004
|
+
id: "old-dsp-web-keepAlive",
|
|
3005
|
+
state: () => ({
|
|
3006
|
+
keepAliveName: []
|
|
3007
|
+
}),
|
|
3008
|
+
actions: {
|
|
3009
|
+
// Add KeepAliveName
|
|
3010
|
+
async addKeepAliveName(name) {
|
|
3011
|
+
!this.keepAliveName.includes(name) && this.keepAliveName.push(name);
|
|
3012
|
+
},
|
|
3013
|
+
// Remove KeepAliveName
|
|
3014
|
+
async removeKeepAliveName(name) {
|
|
3015
|
+
this.keepAliveName = this.keepAliveName.filter((item) => item !== name);
|
|
3016
|
+
},
|
|
3017
|
+
// Set KeepAliveName
|
|
3018
|
+
async setKeepAliveName(keepAliveName = []) {
|
|
3019
|
+
this.keepAliveName = keepAliveName;
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
});
|
|
3023
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
3024
|
+
__name: "Maximize",
|
|
3025
|
+
setup(__props) {
|
|
3026
|
+
const globalStore = useGlobalStore();
|
|
3027
|
+
const exitMaximize = () => {
|
|
3028
|
+
globalStore.setGlobalState("maximize", false);
|
|
3029
|
+
};
|
|
3030
|
+
return (_ctx, _cache) => {
|
|
3031
|
+
return openBlock(), createElementBlock("div", {
|
|
3032
|
+
class: "maximize",
|
|
3033
|
+
onClick: exitMaximize
|
|
3034
|
+
}, _cache[0] || (_cache[0] = [createElementVNode("i", {
|
|
3035
|
+
class: normalizeClass("iconfont icon-tuichu")
|
|
3036
|
+
}, null, -1)]));
|
|
3037
|
+
};
|
|
3038
|
+
}
|
|
3039
|
+
});
|
|
3040
|
+
const Maximize = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["__scopeId", "data-v-fbc0d1c1"]]);
|
|
3041
|
+
const keepAliveStore = useKeepAliveStore();
|
|
3042
|
+
const useTabsStore = defineStore({
|
|
3043
|
+
id: "old-dsp-web-tabs",
|
|
3044
|
+
state: () => ({
|
|
3045
|
+
tabsMenuList: []
|
|
3046
|
+
}),
|
|
3047
|
+
actions: {
|
|
3048
|
+
// Add Tabs
|
|
3049
|
+
async addTabs(tabItem) {
|
|
3050
|
+
if (this.tabsMenuList.every((item) => item.path !== tabItem.path)) {
|
|
3051
|
+
this.tabsMenuList.push(tabItem);
|
|
3052
|
+
}
|
|
3053
|
+
if (!keepAliveStore.keepAliveName.includes(tabItem.name) && tabItem.isKeepAlive) {
|
|
3054
|
+
keepAliveStore.addKeepAliveName(tabItem.path);
|
|
3055
|
+
}
|
|
3056
|
+
},
|
|
3057
|
+
// Remove Tabs
|
|
3058
|
+
async removeTabs(tabPath, isCurrent = true) {
|
|
3059
|
+
if (isCurrent) {
|
|
3060
|
+
this.tabsMenuList.forEach((item, index2) => {
|
|
3061
|
+
if (item.path !== tabPath) return;
|
|
3062
|
+
const nextTab = this.tabsMenuList[index2 + 1] || this.tabsMenuList[index2 - 1];
|
|
3063
|
+
if (!nextTab) return;
|
|
3064
|
+
router.push(nextTab.path);
|
|
3065
|
+
});
|
|
3066
|
+
}
|
|
3067
|
+
const tabItem = this.tabsMenuList.find((item) => item.path === tabPath);
|
|
3068
|
+
(tabItem == null ? void 0 : tabItem.isKeepAlive) && keepAliveStore.removeKeepAliveName(tabItem.path);
|
|
3069
|
+
this.tabsMenuList = this.tabsMenuList.filter((item) => item.path !== tabPath);
|
|
3070
|
+
},
|
|
3071
|
+
// Close Tabs On Side
|
|
3072
|
+
async closeTabsOnSide(path, type) {
|
|
3073
|
+
const currentIndex = this.tabsMenuList.findIndex((item) => item.path === path);
|
|
3074
|
+
if (currentIndex !== -1) {
|
|
3075
|
+
const range = type === "left" ? [0, currentIndex] : [currentIndex + 1, this.tabsMenuList.length];
|
|
3076
|
+
this.tabsMenuList = this.tabsMenuList.filter((item, index2) => {
|
|
3077
|
+
return index2 < range[0] || index2 >= range[1] || !item.close;
|
|
3078
|
+
});
|
|
3079
|
+
}
|
|
3080
|
+
const KeepAliveList = this.tabsMenuList.filter((item) => item.isKeepAlive);
|
|
3081
|
+
keepAliveStore.setKeepAliveName(KeepAliveList.map((item) => item.path));
|
|
3082
|
+
},
|
|
3083
|
+
// Close MultipleTab
|
|
3084
|
+
async closeMultipleTab(tabsMenuValue) {
|
|
3085
|
+
this.tabsMenuList = this.tabsMenuList.filter((item) => {
|
|
3086
|
+
return item.path === tabsMenuValue || !item.close;
|
|
3087
|
+
});
|
|
3088
|
+
const KeepAliveList = this.tabsMenuList.filter((item) => item.isKeepAlive);
|
|
3089
|
+
keepAliveStore.setKeepAliveName(KeepAliveList.map((item) => item.path));
|
|
3090
|
+
},
|
|
3091
|
+
// Set Tabs
|
|
3092
|
+
async setTabs(tabsMenuList) {
|
|
3093
|
+
this.tabsMenuList = tabsMenuList;
|
|
3094
|
+
},
|
|
3095
|
+
// Set Tabs Title
|
|
3096
|
+
async setTabsTitle(title) {
|
|
3097
|
+
this.tabsMenuList.forEach((item) => {
|
|
3098
|
+
if (item.path == getUrlWithParams()) item.title = title;
|
|
3099
|
+
});
|
|
3100
|
+
}
|
|
3101
|
+
},
|
|
3102
|
+
persist: piniaPersistConfig("old-dsp-web-tabs")
|
|
3103
|
+
});
|
|
3104
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
3105
|
+
__name: "MoreButton",
|
|
3106
|
+
setup(__props) {
|
|
3107
|
+
const authStore = useAuthStore();
|
|
3108
|
+
const route = useRoute();
|
|
3109
|
+
const router2 = useRouter();
|
|
3110
|
+
const tabStore = useTabsStore();
|
|
3111
|
+
const globalStore = useGlobalStore();
|
|
3112
|
+
const keepAliveStore2 = useKeepAliveStore();
|
|
3113
|
+
const refreshCurrentPage = inject("refresh");
|
|
3114
|
+
const refresh = () => {
|
|
3115
|
+
setTimeout(() => {
|
|
3116
|
+
route.meta.isKeepAlive && keepAliveStore2.removeKeepAliveName(route.path);
|
|
3117
|
+
refreshCurrentPage(false);
|
|
3118
|
+
nextTick(() => {
|
|
3119
|
+
route.meta.isKeepAlive && keepAliveStore2.addKeepAliveName(route.path);
|
|
3120
|
+
refreshCurrentPage(true);
|
|
3121
|
+
});
|
|
3122
|
+
}, 0);
|
|
3123
|
+
};
|
|
3124
|
+
const maximize = () => {
|
|
3125
|
+
globalStore.setGlobalState("maximize", true);
|
|
3126
|
+
};
|
|
3127
|
+
const closeCurrentTab = () => {
|
|
3128
|
+
if (route.meta.isAffix) return;
|
|
3129
|
+
tabStore.removeTabs(route.path);
|
|
3130
|
+
};
|
|
3131
|
+
const closeAllTab = () => {
|
|
3132
|
+
tabStore.closeMultipleTab();
|
|
3133
|
+
router2.push(authStore.homeURL);
|
|
3134
|
+
};
|
|
3135
|
+
return (_ctx, _cache) => {
|
|
3136
|
+
const _component_Refresh = resolveComponent("Refresh");
|
|
3137
|
+
const _component_el_icon = ElIcon;
|
|
3138
|
+
const _component_el_dropdown_item = ElDropdownItem;
|
|
3139
|
+
const _component_FullScreen = resolveComponent("FullScreen");
|
|
3140
|
+
const _component_Remove = resolveComponent("Remove");
|
|
3141
|
+
const _component_DArrowLeft = resolveComponent("DArrowLeft");
|
|
3142
|
+
const _component_DArrowRight = resolveComponent("DArrowRight");
|
|
3143
|
+
const _component_CircleClose = resolveComponent("CircleClose");
|
|
3144
|
+
const _component_FolderDelete = resolveComponent("FolderDelete");
|
|
3145
|
+
const _component_el_dropdown_menu = ElDropdownMenu;
|
|
3146
|
+
const _component_el_dropdown = ElDropdown;
|
|
3147
|
+
return openBlock(), createBlock(_component_el_dropdown, {
|
|
3148
|
+
trigger: "click",
|
|
3149
|
+
teleported: false
|
|
3150
|
+
}, {
|
|
3151
|
+
dropdown: withCtx(() => [createVNode(_component_el_dropdown_menu, null, {
|
|
3152
|
+
default: withCtx(() => [createVNode(_component_el_dropdown_item, {
|
|
3153
|
+
onClick: refresh
|
|
3154
|
+
}, {
|
|
3155
|
+
default: withCtx(() => [createVNode(_component_el_icon, null, {
|
|
3156
|
+
default: withCtx(() => [createVNode(_component_Refresh)]),
|
|
3157
|
+
_: 1
|
|
3158
|
+
}), createTextVNode(toDisplayString(_ctx.$t("tabs.refresh")), 1)]),
|
|
3159
|
+
_: 1
|
|
3160
|
+
}), createVNode(_component_el_dropdown_item, {
|
|
3161
|
+
onClick: maximize
|
|
3162
|
+
}, {
|
|
3163
|
+
default: withCtx(() => [createVNode(_component_el_icon, null, {
|
|
3164
|
+
default: withCtx(() => [createVNode(_component_FullScreen)]),
|
|
3165
|
+
_: 1
|
|
3166
|
+
}), createTextVNode(toDisplayString(_ctx.$t("tabs.maximize")), 1)]),
|
|
3167
|
+
_: 1
|
|
3168
|
+
}), createVNode(_component_el_dropdown_item, {
|
|
3169
|
+
divided: "",
|
|
3170
|
+
onClick: closeCurrentTab
|
|
3171
|
+
}, {
|
|
3172
|
+
default: withCtx(() => [createVNode(_component_el_icon, null, {
|
|
3173
|
+
default: withCtx(() => [createVNode(_component_Remove)]),
|
|
3174
|
+
_: 1
|
|
3175
|
+
}), createTextVNode(toDisplayString(_ctx.$t("tabs.closeCurrent")), 1)]),
|
|
3176
|
+
_: 1
|
|
3177
|
+
}), createVNode(_component_el_dropdown_item, {
|
|
3178
|
+
onClick: _cache[0] || (_cache[0] = ($event) => unref(tabStore).closeTabsOnSide(unref(route).path, "left"))
|
|
3179
|
+
}, {
|
|
3180
|
+
default: withCtx(() => [createVNode(_component_el_icon, null, {
|
|
3181
|
+
default: withCtx(() => [createVNode(_component_DArrowLeft)]),
|
|
3182
|
+
_: 1
|
|
3183
|
+
}), createTextVNode(toDisplayString(_ctx.$t("tabs.closeLeft")), 1)]),
|
|
3184
|
+
_: 1
|
|
3185
|
+
}), createVNode(_component_el_dropdown_item, {
|
|
3186
|
+
onClick: _cache[1] || (_cache[1] = ($event) => unref(tabStore).closeTabsOnSide(unref(route).path, "right"))
|
|
3187
|
+
}, {
|
|
3188
|
+
default: withCtx(() => [createVNode(_component_el_icon, null, {
|
|
3189
|
+
default: withCtx(() => [createVNode(_component_DArrowRight)]),
|
|
3190
|
+
_: 1
|
|
3191
|
+
}), createTextVNode(toDisplayString(_ctx.$t("tabs.closeRight")), 1)]),
|
|
3192
|
+
_: 1
|
|
3193
|
+
}), createVNode(_component_el_dropdown_item, {
|
|
3194
|
+
divided: "",
|
|
3195
|
+
onClick: _cache[2] || (_cache[2] = ($event) => unref(tabStore).closeMultipleTab(unref(route).path))
|
|
3196
|
+
}, {
|
|
3197
|
+
default: withCtx(() => [createVNode(_component_el_icon, null, {
|
|
3198
|
+
default: withCtx(() => [createVNode(_component_CircleClose)]),
|
|
3199
|
+
_: 1
|
|
3200
|
+
}), createTextVNode(toDisplayString(_ctx.$t("tabs.closeOther")), 1)]),
|
|
3201
|
+
_: 1
|
|
3202
|
+
}), createVNode(_component_el_dropdown_item, {
|
|
3203
|
+
onClick: closeAllTab
|
|
3204
|
+
}, {
|
|
3205
|
+
default: withCtx(() => [createVNode(_component_el_icon, null, {
|
|
3206
|
+
default: withCtx(() => [createVNode(_component_FolderDelete)]),
|
|
3207
|
+
_: 1
|
|
3208
|
+
}), createTextVNode(toDisplayString(_ctx.$t("tabs.closeAll")), 1)]),
|
|
3209
|
+
_: 1
|
|
3210
|
+
})]),
|
|
3211
|
+
_: 1
|
|
3212
|
+
})]),
|
|
3213
|
+
default: withCtx(() => [_cache[3] || (_cache[3] = createElementVNode("div", {
|
|
3214
|
+
class: "more-button"
|
|
3215
|
+
}, [createElementVNode("i", {
|
|
3216
|
+
class: normalizeClass("iconfont icon-xiala")
|
|
3217
|
+
})], -1))]),
|
|
3218
|
+
_: 1
|
|
3219
|
+
});
|
|
3220
|
+
};
|
|
3221
|
+
}
|
|
3222
|
+
});
|
|
3223
|
+
const MoreButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["__scopeId", "data-v-dfabef4d"]]);
|
|
3224
|
+
const _hoisted_1$9 = {
|
|
3225
|
+
class: "tabs-box"
|
|
3226
|
+
};
|
|
3227
|
+
const _hoisted_2$5 = {
|
|
3228
|
+
class: "tabs-menu"
|
|
3229
|
+
};
|
|
3230
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
3231
|
+
__name: "index",
|
|
3232
|
+
setup(__props) {
|
|
3233
|
+
const route = useRoute();
|
|
3234
|
+
const router2 = useRouter();
|
|
3235
|
+
const tabStore = useTabsStore();
|
|
3236
|
+
const authStore = useAuthStore();
|
|
3237
|
+
const globalStore = useGlobalStore();
|
|
3238
|
+
const tabsMenuValue = ref(route.path);
|
|
3239
|
+
const tabsMenuList = computed(() => {
|
|
3240
|
+
return tabStore.tabsMenuList;
|
|
3241
|
+
});
|
|
3242
|
+
const tabsIcon = computed(() => globalStore.tabsIcon);
|
|
3243
|
+
onMounted(() => {
|
|
3244
|
+
tabsDrop();
|
|
3245
|
+
initTabs();
|
|
3246
|
+
});
|
|
3247
|
+
watch(() => route.path, () => {
|
|
3248
|
+
if (route.meta.isFull) return;
|
|
3249
|
+
tabsMenuValue.value = route.path;
|
|
3250
|
+
const tabsParams = {
|
|
3251
|
+
icon: route.meta.icon,
|
|
3252
|
+
title: route.meta.title,
|
|
3253
|
+
path: route.path,
|
|
3254
|
+
name: route.name,
|
|
3255
|
+
close: !route.meta.isAffix,
|
|
3256
|
+
isKeepAlive: route.meta.isKeepAlive
|
|
3257
|
+
};
|
|
3258
|
+
tabStore.addTabs(tabsParams);
|
|
3259
|
+
}, {
|
|
3260
|
+
immediate: true
|
|
3261
|
+
});
|
|
3262
|
+
const initTabs = () => {
|
|
3263
|
+
authStore.flatMenuListGet.forEach((item) => {
|
|
3264
|
+
if (item.meta.isAffix && !item.meta.isHide && !item.meta.isFull) {
|
|
3265
|
+
const tabsParams = {
|
|
3266
|
+
icon: item.meta.icon,
|
|
3267
|
+
title: item.meta.title,
|
|
3268
|
+
path: item.path,
|
|
3269
|
+
name: item.name,
|
|
3270
|
+
close: !item.meta.isAffix,
|
|
3271
|
+
isKeepAlive: item.meta.isKeepAlive
|
|
3272
|
+
};
|
|
3273
|
+
tabStore.addTabs(tabsParams);
|
|
3274
|
+
}
|
|
3275
|
+
});
|
|
3276
|
+
};
|
|
3277
|
+
const tabsDrop = () => {
|
|
3278
|
+
Sortable.create(document.querySelector(".el-tabs__nav"), {
|
|
3279
|
+
draggable: ".el-tabs__item",
|
|
3280
|
+
animation: 300,
|
|
3281
|
+
onEnd({
|
|
3282
|
+
newIndex,
|
|
3283
|
+
oldIndex
|
|
3284
|
+
}) {
|
|
3285
|
+
let tabsList = [];
|
|
3286
|
+
tabsList = [...tabStore.tabsMenuList];
|
|
3287
|
+
const currRow = tabsList.splice(oldIndex, 1)[0];
|
|
3288
|
+
tabsList.splice(newIndex, 0, currRow);
|
|
3289
|
+
tabStore.setTabs(tabsList);
|
|
3290
|
+
}
|
|
3291
|
+
});
|
|
3292
|
+
};
|
|
3293
|
+
const tabClick = (tabItem) => {
|
|
3294
|
+
const path = tabItem.props.name;
|
|
3295
|
+
router2.push(path);
|
|
3296
|
+
};
|
|
3297
|
+
const tabRemove = (path) => {
|
|
3298
|
+
tabStore.removeTabs(path, path == route.path);
|
|
3299
|
+
};
|
|
3300
|
+
return (_ctx, _cache) => {
|
|
3301
|
+
const _component_el_icon = ElIcon;
|
|
3302
|
+
const _component_el_tab_pane = ElTabPane;
|
|
3303
|
+
const _component_el_tabs = ElTabs;
|
|
3304
|
+
return openBlock(), createElementBlock("div", _hoisted_1$9, [createElementVNode("div", _hoisted_2$5, [createVNode(_component_el_tabs, {
|
|
3305
|
+
modelValue: tabsMenuValue.value,
|
|
3306
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => tabsMenuValue.value = $event),
|
|
3307
|
+
type: "card",
|
|
3308
|
+
onTabClick: tabClick,
|
|
3309
|
+
onTabRemove: tabRemove
|
|
3310
|
+
}, {
|
|
3311
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(tabsMenuList.value, (item) => {
|
|
3312
|
+
return openBlock(), createBlock(_component_el_tab_pane, {
|
|
3313
|
+
key: item.path,
|
|
3314
|
+
label: item.title,
|
|
3315
|
+
name: item.path,
|
|
3316
|
+
closable: item.close
|
|
3317
|
+
}, {
|
|
3318
|
+
label: withCtx(() => [item.icon && tabsIcon.value ? (openBlock(), createBlock(_component_el_icon, {
|
|
3319
|
+
key: 0,
|
|
3320
|
+
class: "tabs-icon"
|
|
3321
|
+
}, {
|
|
3322
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(item.icon)))]),
|
|
3323
|
+
_: 2
|
|
3324
|
+
}, 1024)) : createCommentVNode("", true), createTextVNode(" " + toDisplayString(item.title), 1)]),
|
|
3325
|
+
_: 2
|
|
3326
|
+
}, 1032, ["label", "name", "closable"]);
|
|
3327
|
+
}), 128))]),
|
|
3328
|
+
_: 1
|
|
3329
|
+
}, 8, ["modelValue"]), createVNode(MoreButton, {
|
|
3330
|
+
"is-custom-tabs": false
|
|
3331
|
+
})])]);
|
|
3332
|
+
};
|
|
3333
|
+
}
|
|
3334
|
+
});
|
|
3335
|
+
const Tabs = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["__scopeId", "data-v-e1175c6d"]]);
|
|
3336
|
+
const _sfc_main$c = {};
|
|
3337
|
+
const _hoisted_1$8 = {
|
|
3338
|
+
class: "footer flx-center"
|
|
3339
|
+
};
|
|
3340
|
+
function _sfc_render$1(_ctx, _cache) {
|
|
3341
|
+
return openBlock(), createElementBlock("div", _hoisted_1$8, _cache[0] || (_cache[0] = [createElementVNode("a", {
|
|
3342
|
+
href: "#",
|
|
3343
|
+
target: "_blank"
|
|
3344
|
+
}, " 2024 © 青岛安工数联信息科技有限公司 ", -1)]));
|
|
3345
|
+
}
|
|
3346
|
+
const Footer = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render$1], ["__scopeId", "data-v-1254311c"]]);
|
|
3347
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
3348
|
+
__name: "index",
|
|
3349
|
+
props: {
|
|
3350
|
+
isShowCustomTabs: {
|
|
3351
|
+
type: Boolean,
|
|
3352
|
+
default: false
|
|
3353
|
+
}
|
|
3354
|
+
},
|
|
3355
|
+
setup(__props) {
|
|
3356
|
+
const globalStore = useGlobalStore();
|
|
3357
|
+
const {
|
|
3358
|
+
maximize,
|
|
3359
|
+
isCollapse,
|
|
3360
|
+
isSubCollapse,
|
|
3361
|
+
layout,
|
|
3362
|
+
tabs,
|
|
3363
|
+
footer
|
|
3364
|
+
} = storeToRefs(globalStore);
|
|
3365
|
+
const keepAliveStore2 = useKeepAliveStore();
|
|
3366
|
+
const {
|
|
3367
|
+
keepAliveName
|
|
3368
|
+
} = storeToRefs(keepAliveStore2);
|
|
3369
|
+
const isRouterShow = ref(true);
|
|
3370
|
+
const refreshCurrentPage = (val) => isRouterShow.value = val;
|
|
3371
|
+
provide("refresh", refreshCurrentPage);
|
|
3372
|
+
const wrapperMap = /* @__PURE__ */ new Map();
|
|
3373
|
+
function createComponentWrapper(component, route) {
|
|
3374
|
+
if (!component) return;
|
|
3375
|
+
const wrapperName = route.path;
|
|
3376
|
+
let wrapper = wrapperMap.get(wrapperName);
|
|
3377
|
+
if (!wrapper) {
|
|
3378
|
+
wrapper = {
|
|
3379
|
+
name: wrapperName,
|
|
3380
|
+
render: () => h(component)
|
|
3381
|
+
};
|
|
3382
|
+
wrapperMap.set(wrapperName, wrapper);
|
|
3383
|
+
}
|
|
3384
|
+
return h(wrapper);
|
|
3385
|
+
}
|
|
3386
|
+
watch(() => maximize.value, () => {
|
|
3387
|
+
const app = document.getElementById("app");
|
|
3388
|
+
if (maximize.value) app.classList.add("main-maximize");
|
|
3389
|
+
else app.classList.remove("main-maximize");
|
|
3390
|
+
}, {
|
|
3391
|
+
immediate: true
|
|
3392
|
+
});
|
|
3393
|
+
watch(() => layout.value, () => {
|
|
3394
|
+
const body = document.body;
|
|
3395
|
+
body.setAttribute("class", layout.value);
|
|
3396
|
+
}, {
|
|
3397
|
+
immediate: true
|
|
3398
|
+
});
|
|
3399
|
+
const screenWidth = ref(0);
|
|
3400
|
+
const listeningWindow = useDebounceFn(() => {
|
|
3401
|
+
screenWidth.value = document.body.clientWidth;
|
|
3402
|
+
if (!isCollapse.value && screenWidth.value < 1200) globalStore.setGlobalState("isCollapse", true);
|
|
3403
|
+
if (isCollapse.value && screenWidth.value > 1200) globalStore.setGlobalState("isCollapse", false);
|
|
3404
|
+
if (isSubCollapse.value && screenWidth.value > 1200) globalStore.setGlobalState("isSubCollapse", false);
|
|
3405
|
+
if (!isSubCollapse.value && screenWidth.value < 1200) globalStore.setGlobalState("isSubCollapse", true);
|
|
3406
|
+
}, 100);
|
|
3407
|
+
window.addEventListener("resize", listeningWindow, false);
|
|
3408
|
+
onBeforeUnmount(() => {
|
|
3409
|
+
window.removeEventListener("resize", listeningWindow);
|
|
3410
|
+
});
|
|
3411
|
+
const props = __props;
|
|
3412
|
+
return (_ctx, _cache) => {
|
|
3413
|
+
const _component_router_view = resolveComponent("router-view");
|
|
3414
|
+
const _component_el_main = ElMain;
|
|
3415
|
+
const _component_el_footer = ElFooter;
|
|
3416
|
+
return openBlock(), createElementBlock(Fragment, null, [withDirectives(createVNode(Maximize, null, null, 512), [[vShow, unref(maximize)]]), withDirectives(createVNode(Tabs, {
|
|
3417
|
+
"is-custom-tabs": _ctx.isShowCustomTabs
|
|
3418
|
+
}, null, 8, ["is-custom-tabs"]), [[vShow, props.isShowCustomTabs && unref(tabs)]]), withDirectives(createVNode(Tabs, {
|
|
3419
|
+
"is-custom-tabs": _ctx.isShowCustomTabs
|
|
3420
|
+
}, null, 8, ["is-custom-tabs"]), [[vShow, !props.isShowCustomTabs && unref(tabs)]]), createVNode(_component_el_main, null, {
|
|
3421
|
+
default: withCtx(() => [createVNode(_component_router_view, null, {
|
|
3422
|
+
default: withCtx(({
|
|
3423
|
+
Component,
|
|
3424
|
+
route
|
|
3425
|
+
}) => [createVNode(Transition, {
|
|
3426
|
+
appear: "",
|
|
3427
|
+
name: "fade-transform",
|
|
3428
|
+
mode: "out-in"
|
|
3429
|
+
}, {
|
|
3430
|
+
default: withCtx(() => [(openBlock(), createBlock(KeepAlive, {
|
|
3431
|
+
include: unref(keepAliveName)
|
|
3432
|
+
}, [isRouterShow.value ? (openBlock(), createBlock(resolveDynamicComponent(createComponentWrapper(Component, route)), {
|
|
3433
|
+
key: route.path
|
|
3434
|
+
})) : createCommentVNode("", true)], 1032, ["include"]))]),
|
|
3435
|
+
_: 2
|
|
3436
|
+
}, 1024)]),
|
|
3437
|
+
_: 1
|
|
3438
|
+
})]),
|
|
3439
|
+
_: 1
|
|
3440
|
+
}), withDirectives(createVNode(_component_el_footer, null, {
|
|
3441
|
+
default: withCtx(() => [createVNode(Footer)]),
|
|
3442
|
+
_: 1
|
|
3443
|
+
}, 512), [[vShow, unref(footer) && !props.isShowCustomTabs]])], 64);
|
|
3444
|
+
};
|
|
3445
|
+
}
|
|
3446
|
+
});
|
|
3447
|
+
const Main = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__scopeId", "data-v-b147247f"]]);
|
|
3448
|
+
const _hoisted_1$7 = {
|
|
3449
|
+
class: "sle"
|
|
3450
|
+
};
|
|
3451
|
+
const _hoisted_2$4 = {
|
|
3452
|
+
class: "sle"
|
|
3453
|
+
};
|
|
3454
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
3455
|
+
__name: "SubMenu",
|
|
3456
|
+
props: {
|
|
3457
|
+
menuList: {}
|
|
3458
|
+
},
|
|
3459
|
+
setup(__props) {
|
|
3460
|
+
const router2 = useRouter();
|
|
3461
|
+
const handleClickMenu = (subItem) => {
|
|
3462
|
+
if (subItem.meta.isLink && subItem.path) return window.open(subItem.path, "_blank");
|
|
3463
|
+
router2.push(subItem.path);
|
|
3464
|
+
};
|
|
3465
|
+
return (_ctx, _cache) => {
|
|
3466
|
+
const _component_el_icon = ElIcon;
|
|
3467
|
+
const _component_SubMenu = resolveComponent("SubMenu", true);
|
|
3468
|
+
const _component_el_sub_menu = ElSubMenu;
|
|
3469
|
+
const _component_el_menu_item = ElMenuItem;
|
|
3470
|
+
return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuList, (subItem) => {
|
|
3471
|
+
var _a;
|
|
3472
|
+
return openBlock(), createElementBlock(Fragment, {
|
|
3473
|
+
key: subItem.path
|
|
3474
|
+
}, [((_a = subItem.children) == null ? void 0 : _a.length) ? (openBlock(), createBlock(_component_el_sub_menu, {
|
|
3475
|
+
key: 0,
|
|
3476
|
+
index: subItem.path
|
|
3477
|
+
}, {
|
|
3478
|
+
title: withCtx(() => [subItem.meta.icon ? (openBlock(), createBlock(_component_el_icon, {
|
|
3479
|
+
key: 0
|
|
3480
|
+
}, {
|
|
3481
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(subItem.meta.icon)))]),
|
|
3482
|
+
_: 2
|
|
3483
|
+
}, 1024)) : createCommentVNode("", true), createElementVNode("span", _hoisted_1$7, toDisplayString(subItem.meta.title), 1)]),
|
|
3484
|
+
default: withCtx(() => [createVNode(_component_SubMenu, {
|
|
3485
|
+
"menu-list": subItem.children
|
|
3486
|
+
}, null, 8, ["menu-list"])]),
|
|
3487
|
+
_: 2
|
|
3488
|
+
}, 1032, ["index"])) : (openBlock(), createBlock(_component_el_menu_item, {
|
|
3489
|
+
key: 1,
|
|
3490
|
+
index: subItem.path,
|
|
3491
|
+
onClick: ($event) => handleClickMenu(subItem)
|
|
3492
|
+
}, {
|
|
3493
|
+
title: withCtx(() => [createElementVNode("span", _hoisted_2$4, toDisplayString(subItem.meta.title), 1)]),
|
|
3494
|
+
default: withCtx(() => [subItem.meta.icon ? (openBlock(), createBlock(_component_el_icon, {
|
|
3495
|
+
key: 0
|
|
3496
|
+
}, {
|
|
3497
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(subItem.meta.icon)))]),
|
|
3498
|
+
_: 2
|
|
3499
|
+
}, 1024)) : createCommentVNode("", true)]),
|
|
3500
|
+
_: 2
|
|
3501
|
+
}, 1032, ["index", "onClick"]))], 64);
|
|
3502
|
+
}), 128);
|
|
3503
|
+
};
|
|
3504
|
+
}
|
|
3505
|
+
});
|
|
3506
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
3507
|
+
__name: "CollapseIcon",
|
|
3508
|
+
setup(__props) {
|
|
3509
|
+
const globalStore = useGlobalStore();
|
|
3510
|
+
const changeCollapse = () => globalStore.setGlobalState("isCollapse", !globalStore.isCollapse);
|
|
3511
|
+
return (_ctx, _cache) => {
|
|
3512
|
+
const _component_el_icon = ElIcon;
|
|
3513
|
+
return openBlock(), createBlock(_component_el_icon, {
|
|
3514
|
+
class: "collapse-icon",
|
|
3515
|
+
onClick: changeCollapse
|
|
3516
|
+
}, {
|
|
3517
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(unref(globalStore).isCollapse ? "expand" : "fold")))]),
|
|
3518
|
+
_: 1
|
|
3519
|
+
});
|
|
3520
|
+
};
|
|
3521
|
+
}
|
|
3522
|
+
});
|
|
3523
|
+
const CollapseIcon = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__scopeId", "data-v-79434c0f"]]);
|
|
3524
|
+
const _hoisted_1$6 = ["onClick"];
|
|
3525
|
+
const _hoisted_2$3 = {
|
|
3526
|
+
class: "breadcrumb-title"
|
|
3527
|
+
};
|
|
3528
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
3529
|
+
__name: "Breadcrumb",
|
|
3530
|
+
setup(__props) {
|
|
3531
|
+
const route = useRoute();
|
|
3532
|
+
const router2 = useRouter();
|
|
3533
|
+
const authStore = useAuthStore();
|
|
3534
|
+
const globalStore = useGlobalStore();
|
|
3535
|
+
const breadcrumbList = computed(() => {
|
|
3536
|
+
let breadcrumbData = authStore.breadcrumbListGet[route.matched[route.matched.length - 1].path] ?? [];
|
|
3537
|
+
return breadcrumbData;
|
|
3538
|
+
});
|
|
3539
|
+
const onBreadcrumbClick = (item, index2) => {
|
|
3540
|
+
if (index2 !== breadcrumbList.value.length - 1) {
|
|
3541
|
+
if (item.component) {
|
|
3542
|
+
router2.push(item.path);
|
|
3543
|
+
} else if (item.children && item.children.length > 0 && item.children[0].component) {
|
|
3544
|
+
router2.push(item.children[0].path);
|
|
3545
|
+
}
|
|
3546
|
+
}
|
|
3547
|
+
};
|
|
3548
|
+
return (_ctx, _cache) => {
|
|
3549
|
+
const _component_el_icon = ElIcon;
|
|
3550
|
+
const _component_el_breadcrumb_item = ElBreadcrumbItem;
|
|
3551
|
+
const _component_el_breadcrumb = ElBreadcrumb;
|
|
3552
|
+
return openBlock(), createElementBlock("div", {
|
|
3553
|
+
class: normalizeClass(["breadcrumb-box mask-image", !unref(globalStore).breadcrumbIcon && "no-icon"])
|
|
3554
|
+
}, [createVNode(_component_el_breadcrumb, {
|
|
3555
|
+
"separator-icon": unref(arrow_right_default)
|
|
3556
|
+
}, {
|
|
3557
|
+
default: withCtx(() => [createVNode(TransitionGroup, {
|
|
3558
|
+
name: "breadcrumb"
|
|
3559
|
+
}, {
|
|
3560
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(breadcrumbList.value, (item, index2) => {
|
|
3561
|
+
return openBlock(), createBlock(_component_el_breadcrumb_item, {
|
|
3562
|
+
key: item.path
|
|
3563
|
+
}, {
|
|
3564
|
+
default: withCtx(() => [createElementVNode("div", {
|
|
3565
|
+
class: normalizeClass(["el-breadcrumb__inner is-link", {
|
|
3566
|
+
"item-no-icon": !item.meta.icon
|
|
3567
|
+
}]),
|
|
3568
|
+
onClick: ($event) => onBreadcrumbClick(item, index2)
|
|
3569
|
+
}, [item.meta.icon && unref(globalStore).breadcrumbIcon ? (openBlock(), createBlock(_component_el_icon, {
|
|
3570
|
+
key: 0,
|
|
3571
|
+
class: "breadcrumb-icon"
|
|
3572
|
+
}, {
|
|
3573
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(item.meta.icon)))]),
|
|
3574
|
+
_: 2
|
|
3575
|
+
}, 1024)) : createCommentVNode("", true), createElementVNode("span", _hoisted_2$3, toDisplayString(item.meta.title), 1)], 10, _hoisted_1$6)]),
|
|
3576
|
+
_: 2
|
|
3577
|
+
}, 1024);
|
|
3578
|
+
}), 128))]),
|
|
3579
|
+
_: 1
|
|
3580
|
+
})]),
|
|
3581
|
+
_: 1
|
|
3582
|
+
}, 8, ["separator-icon"])], 2);
|
|
3583
|
+
};
|
|
3584
|
+
}
|
|
3585
|
+
});
|
|
3586
|
+
const Breadcrumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["__scopeId", "data-v-5791e0dd"]]);
|
|
3587
|
+
const _hoisted_1$5 = {
|
|
3588
|
+
class: "tool-bar-lf"
|
|
3589
|
+
};
|
|
3590
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
3591
|
+
__name: "ToolBarLeft",
|
|
3592
|
+
setup(__props) {
|
|
3593
|
+
const globalStore = useGlobalStore();
|
|
3594
|
+
return (_ctx, _cache) => {
|
|
3595
|
+
return openBlock(), createElementBlock("div", _hoisted_1$5, [createVNode(CollapseIcon, {
|
|
3596
|
+
id: "collapseIcon"
|
|
3597
|
+
}), withDirectives(createVNode(Breadcrumb, {
|
|
3598
|
+
id: "breadcrumb"
|
|
3599
|
+
}, null, 512), [[vShow, unref(globalStore).breadcrumb]])]);
|
|
3600
|
+
};
|
|
3601
|
+
}
|
|
3602
|
+
});
|
|
3603
|
+
const ToolBarLeft = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["__scopeId", "data-v-143c0251"]]);
|
|
3604
|
+
const _hoisted_1$4 = {
|
|
3605
|
+
class: "theme-setting"
|
|
3606
|
+
};
|
|
3607
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
3608
|
+
__name: "ThemeSetting",
|
|
3609
|
+
setup(__props) {
|
|
3610
|
+
const openDrawer = () => {
|
|
3611
|
+
mittBus.emit("openThemeDrawer");
|
|
3612
|
+
};
|
|
3613
|
+
return (_ctx, _cache) => {
|
|
3614
|
+
return openBlock(), createElementBlock("div", _hoisted_1$4, [createElementVNode("i", {
|
|
3615
|
+
class: normalizeClass(["iconfont icon-zhuti", "toolBar-icon"]),
|
|
3616
|
+
onClick: openDrawer
|
|
3617
|
+
})]);
|
|
3618
|
+
};
|
|
3619
|
+
}
|
|
3620
|
+
});
|
|
3621
|
+
const methodMap = [
|
|
3622
|
+
[
|
|
3623
|
+
"requestFullscreen",
|
|
3624
|
+
"exitFullscreen",
|
|
3625
|
+
"fullscreenElement",
|
|
3626
|
+
"fullscreenEnabled",
|
|
3627
|
+
"fullscreenchange",
|
|
3628
|
+
"fullscreenerror"
|
|
3629
|
+
],
|
|
3630
|
+
// New WebKit
|
|
3631
|
+
[
|
|
3632
|
+
"webkitRequestFullscreen",
|
|
3633
|
+
"webkitExitFullscreen",
|
|
3634
|
+
"webkitFullscreenElement",
|
|
3635
|
+
"webkitFullscreenEnabled",
|
|
3636
|
+
"webkitfullscreenchange",
|
|
3637
|
+
"webkitfullscreenerror"
|
|
3638
|
+
],
|
|
3639
|
+
// Old WebKit
|
|
3640
|
+
[
|
|
3641
|
+
"webkitRequestFullScreen",
|
|
3642
|
+
"webkitCancelFullScreen",
|
|
3643
|
+
"webkitCurrentFullScreenElement",
|
|
3644
|
+
"webkitCancelFullScreen",
|
|
3645
|
+
"webkitfullscreenchange",
|
|
3646
|
+
"webkitfullscreenerror"
|
|
3647
|
+
],
|
|
3648
|
+
[
|
|
3649
|
+
"mozRequestFullScreen",
|
|
3650
|
+
"mozCancelFullScreen",
|
|
3651
|
+
"mozFullScreenElement",
|
|
3652
|
+
"mozFullScreenEnabled",
|
|
3653
|
+
"mozfullscreenchange",
|
|
3654
|
+
"mozfullscreenerror"
|
|
3655
|
+
],
|
|
3656
|
+
[
|
|
3657
|
+
"msRequestFullscreen",
|
|
3658
|
+
"msExitFullscreen",
|
|
3659
|
+
"msFullscreenElement",
|
|
3660
|
+
"msFullscreenEnabled",
|
|
3661
|
+
"MSFullscreenChange",
|
|
3662
|
+
"MSFullscreenError"
|
|
3663
|
+
]
|
|
3664
|
+
];
|
|
3665
|
+
const nativeAPI = (() => {
|
|
3666
|
+
if (typeof document === "undefined") {
|
|
3667
|
+
return false;
|
|
3668
|
+
}
|
|
3669
|
+
const unprefixedMethods = methodMap[0];
|
|
3670
|
+
const returnValue = {};
|
|
3671
|
+
for (const methodList of methodMap) {
|
|
3672
|
+
const exitFullscreenMethod = methodList == null ? void 0 : methodList[1];
|
|
3673
|
+
if (exitFullscreenMethod in document) {
|
|
3674
|
+
for (const [index2, method] of methodList.entries()) {
|
|
3675
|
+
returnValue[unprefixedMethods[index2]] = method;
|
|
3676
|
+
}
|
|
3677
|
+
return returnValue;
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
return false;
|
|
3681
|
+
})();
|
|
3682
|
+
const eventNameMap = {
|
|
3683
|
+
change: nativeAPI.fullscreenchange,
|
|
3684
|
+
error: nativeAPI.fullscreenerror
|
|
3685
|
+
};
|
|
3686
|
+
let screenfull = {
|
|
3687
|
+
// eslint-disable-next-line default-param-last
|
|
3688
|
+
request(element = document.documentElement, options) {
|
|
3689
|
+
return new Promise((resolve, reject) => {
|
|
3690
|
+
const onFullScreenEntered = () => {
|
|
3691
|
+
screenfull.off("change", onFullScreenEntered);
|
|
3692
|
+
resolve();
|
|
3693
|
+
};
|
|
3694
|
+
screenfull.on("change", onFullScreenEntered);
|
|
3695
|
+
const returnPromise = element[nativeAPI.requestFullscreen](options);
|
|
3696
|
+
if (returnPromise instanceof Promise) {
|
|
3697
|
+
returnPromise.then(onFullScreenEntered).catch(reject);
|
|
3698
|
+
}
|
|
3699
|
+
});
|
|
3700
|
+
},
|
|
3701
|
+
exit() {
|
|
3702
|
+
return new Promise((resolve, reject) => {
|
|
3703
|
+
if (!screenfull.isFullscreen) {
|
|
3704
|
+
resolve();
|
|
3705
|
+
return;
|
|
3706
|
+
}
|
|
3707
|
+
const onFullScreenExit = () => {
|
|
3708
|
+
screenfull.off("change", onFullScreenExit);
|
|
3709
|
+
resolve();
|
|
3710
|
+
};
|
|
3711
|
+
screenfull.on("change", onFullScreenExit);
|
|
3712
|
+
const returnPromise = document[nativeAPI.exitFullscreen]();
|
|
3713
|
+
if (returnPromise instanceof Promise) {
|
|
3714
|
+
returnPromise.then(onFullScreenExit).catch(reject);
|
|
3715
|
+
}
|
|
3716
|
+
});
|
|
3717
|
+
},
|
|
3718
|
+
toggle(element, options) {
|
|
3719
|
+
return screenfull.isFullscreen ? screenfull.exit() : screenfull.request(element, options);
|
|
3720
|
+
},
|
|
3721
|
+
onchange(callback) {
|
|
3722
|
+
screenfull.on("change", callback);
|
|
3723
|
+
},
|
|
3724
|
+
onerror(callback) {
|
|
3725
|
+
screenfull.on("error", callback);
|
|
3726
|
+
},
|
|
3727
|
+
on(event, callback) {
|
|
3728
|
+
const eventName = eventNameMap[event];
|
|
3729
|
+
if (eventName) {
|
|
3730
|
+
document.addEventListener(eventName, callback, false);
|
|
3731
|
+
}
|
|
3732
|
+
},
|
|
3733
|
+
off(event, callback) {
|
|
3734
|
+
const eventName = eventNameMap[event];
|
|
3735
|
+
if (eventName) {
|
|
3736
|
+
document.removeEventListener(eventName, callback, false);
|
|
3737
|
+
}
|
|
3738
|
+
},
|
|
3739
|
+
raw: nativeAPI
|
|
3740
|
+
};
|
|
3741
|
+
Object.defineProperties(screenfull, {
|
|
3742
|
+
isFullscreen: {
|
|
3743
|
+
get: () => Boolean(document[nativeAPI.fullscreenElement])
|
|
3744
|
+
},
|
|
3745
|
+
element: {
|
|
3746
|
+
enumerable: true,
|
|
3747
|
+
get: () => document[nativeAPI.fullscreenElement] ?? void 0
|
|
3748
|
+
},
|
|
3749
|
+
isEnabled: {
|
|
3750
|
+
enumerable: true,
|
|
3751
|
+
// Coerce to boolean in case of old WebKit.
|
|
3752
|
+
get: () => Boolean(document[nativeAPI.fullscreenEnabled])
|
|
3753
|
+
}
|
|
3754
|
+
});
|
|
3755
|
+
if (!nativeAPI) {
|
|
3756
|
+
screenfull = { isEnabled: false };
|
|
3757
|
+
}
|
|
3758
|
+
const _hoisted_1$3 = {
|
|
3759
|
+
class: "fullscreen"
|
|
3760
|
+
};
|
|
3761
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
3762
|
+
__name: "Fullscreen",
|
|
3763
|
+
setup(__props) {
|
|
3764
|
+
const isFullscreen = ref(screenfull.isFullscreen);
|
|
3765
|
+
onMounted(() => {
|
|
3766
|
+
screenfull.on("change", () => {
|
|
3767
|
+
if (screenfull.isFullscreen) isFullscreen.value = true;
|
|
3768
|
+
else isFullscreen.value = false;
|
|
3769
|
+
});
|
|
3770
|
+
});
|
|
3771
|
+
const handleFullScreen = () => {
|
|
3772
|
+
if (!screenfull.isEnabled) ElMessage.warning("当前您的浏览器不支持全屏 ❌");
|
|
3773
|
+
screenfull.toggle();
|
|
3774
|
+
};
|
|
3775
|
+
return (_ctx, _cache) => {
|
|
3776
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [createElementVNode("i", {
|
|
3777
|
+
class: normalizeClass([["iconfont", isFullscreen.value ? "icon-suoxiao" : "icon-fangda"], "toolBar-icon"]),
|
|
3778
|
+
onClick: handleFullScreen
|
|
3779
|
+
}, null, 2)]);
|
|
3780
|
+
};
|
|
3781
|
+
}
|
|
3782
|
+
});
|
|
3783
|
+
const _imports_0 = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1717059093602'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='21911'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='64'%20height='64'%3e%3cpath%20d='M0%20511.99968c0%20282.783823%20229.215857%20511.99968%20511.99968%20511.99968s511.99968-229.215857%20511.99968-511.99968S794.783503%200%20511.99968%200%200%20229.215857%200%20511.99968z'%20fill='%23DEEDFF'%20p-id='21912'%3e%3c/path%3e%3cpath%20d='M511.99968%200c282.783823%200%20511.99968%20229.215857%20511.99968%20511.99968s-229.215857%20511.99968-511.99968%20511.99968S0%20794.783503%200%20511.99968%20229.215857%200%20511.99968%200z%20m0%2031.99998C246.911846%2031.99998%2031.99998%20246.911846%2031.99998%20511.99968c0%20265.087834%20214.911866%20479.9997%20479.9997%20479.9997%20265.087834%200%20479.9997-214.911866%20479.9997-479.9997%200-265.087834-214.911866-479.9997-479.9997-479.9997z'%20fill='%2300B4FF'%20p-id='21913'%3e%3c/path%3e%3cpath%20d='M725.247547%20452.351717c0%20130.143919-93.727941%20235.615853-209.311869%20235.615853-115.647928%200-209.343869-105.471934-209.34387-235.615853s93.727941-235.647853%20209.34387-235.647852c115.583928%200%20209.311869%20105.503934%20209.311869%20235.647852'%20fill='%23F6CAA9'%20p-id='21914'%3e%3c/path%3e%3cpath%20d='M434.591728%20650.911593h160.5759v132.799917H434.559728v-132.799917z%20m-101.535936-184.767884c0%2019.455988-14.399991%2035.231978-32.15998%2035.231978-17.791989%200-32.15998-15.77599-32.15998-35.199978%200-19.487988%2014.399991-35.231978%2032.15998-35.231978%2017.759989%200%2032.15998%2015.74399%2032.15998%2035.199978m429.631731-0.416c0%2019.455988-14.399991%2035.199978-32.15998%2035.199978-17.759989%200-32.15998-15.74399-32.159979-35.199978%200-19.455988%2014.399991-35.231978%2032.159979-35.231978%2017.759989%200%2032.15998%2015.77599%2032.15998%2035.199978'%20fill='%23F6CAA9'%20p-id='21915'%3e%3c/path%3e%3cpath%20d='M435.007728%20669.951581s30.399981%2015.64799%2074.527954%2015.647991c51.807968%202.111999%2085.631946-15.23199%2085.631946-15.231991v15.67999s-56.959964%2030.399981-82.655948%2030.399981c-25.695984%200-77.919951-35.903978-77.919952-35.903977l0.416-10.559994z%20m53.887966-511.45568s-141.663911%2014.111991-143.13591%20106.879933c-1.439999%2092.703942%20109.407932%20110.463931%20150.463906%20120.607925%2041.087974%2010.143994%20154.047904%2023.167986%20220.063862-84.031948%200%200-18.111989-42.047974-27.999982-71.359955-4.415997-7.647995%207.103996%2013.023992-32.51198-11.967993-39.615975-24.959984-92.799942-65.919959-166.879896-60.127962'%20fill='%23ECB485'%20p-id='21916'%3e%3c/path%3e%3cpath%20d='M389.727756%20209.151869s-103.263935%2017.215989-109.119931%20109.631932c-5.887996%2092.415942%2010.495993%20116.799927%2010.495993%20116.799927s23.295985-0.064%2029.151982%2034.751978c0%200%2010.783993%206.399996%2011.743993%200%201.599999-10.623993-9.439994-61.055962%2012.575992-107.935932%2021.855986-46.591971%2042.911973-53.247967%2042.911973-53.247967l2.239998-99.999938z%20m271.487831%20100.991937s27.615983%2035.615978%2032.38398%2071.167956c4.063997%2030.207981%209.695994%2086.975946%209.695993%2086.975945s7.679995%205.439997%2013.215992-7.615995c5.503997-13.023992%204.063997-26.079984%209.183994-29.439982%2027.039983-17.919989%2019.967988-93.151942%2018.559989-101.119936-6.175996-33.599979-34.047979-87.551945-34.047979-87.551946l-48.991969%2067.583958z'%20fill='%233F3F3F'%20p-id='21917'%3e%3c/path%3e%3cpath%20d='M485.311697%20127.32792s-146.559908%206.015996-148.031908%20103.487936c-1.471999%2097.471939%20114.303929%20124.959922%20155.391903%20135.615915%2041.055974%2010.655993%20154.015904%2024.383985%20220.031863-88.319945%200%200%2016.51199-51.039968%206.623995-81.855949-4.415997-7.999995-27.519983%2020.543987-67.135958-5.727996-39.615975-26.239984-92.799942-69.279957-166.879895-63.199961'%20fill='%233F3F3F'%20p-id='21918'%3e%3c/path%3e%3cpath%20d='M885.823446%20861.855461c-26.047984-20.479987-75.135953-50.591968-123.775922-74.239953-78.943951-38.399976-166.847896-55.615965-166.847896-55.615965l-0.064%202.623998c-6.399996%206.815996-37.279977%2037.279977-79.83995%2037.279977-41.887974%200-73.215954-28.575982-80.44795-35.807978l-0.384-3.679998s-84.639947%2011.583993-163.583897%2049.983969c-54.047966%2026.271984-108.575932%2060.543962-131.519918%2080.67195A510.559681%20510.559681%200%200%200%20511.99968%201023.99936c147.487908%200%20280.383825-62.367961%20373.823766-162.143899z'%20fill='%2300B4FF'%20p-id='21919'%3e%3c/path%3e%3c/svg%3e";
|
|
3784
|
+
const _sfc_main$4 = {};
|
|
3785
|
+
function _sfc_render(_ctx, _cache) {
|
|
3786
|
+
const _component_el_dropdown = ElDropdown;
|
|
3787
|
+
return openBlock(), createBlock(_component_el_dropdown, {
|
|
3788
|
+
trigger: "click"
|
|
3789
|
+
}, {
|
|
3790
|
+
default: withCtx(() => _cache[0] || (_cache[0] = [createElementVNode("div", {
|
|
3791
|
+
class: "avatar"
|
|
3792
|
+
}, [createElementVNode("img", {
|
|
3793
|
+
src: _imports_0,
|
|
3794
|
+
alt: "avatar"
|
|
3795
|
+
})], -1)])),
|
|
3796
|
+
_: 1
|
|
3797
|
+
});
|
|
3798
|
+
}
|
|
3799
|
+
const Avatar = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["render", _sfc_render], ["__scopeId", "data-v-c52ec7eb"]]);
|
|
3800
|
+
const _hoisted_1$2 = {
|
|
3801
|
+
class: "tool-bar-ri"
|
|
3802
|
+
};
|
|
3803
|
+
const _hoisted_2$2 = {
|
|
3804
|
+
class: "header-icon"
|
|
3805
|
+
};
|
|
3806
|
+
const _hoisted_3$1 = {
|
|
3807
|
+
class: "username"
|
|
3808
|
+
};
|
|
3809
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3810
|
+
__name: "ToolBarRight",
|
|
3811
|
+
setup(__props) {
|
|
3812
|
+
const userStore = useUserStore();
|
|
3813
|
+
const username = computed(() => userStore.userInfo.loginName);
|
|
3814
|
+
return (_ctx, _cache) => {
|
|
3815
|
+
return openBlock(), createElementBlock("div", _hoisted_1$2, [createElementVNode("div", _hoisted_2$2, [createVNode(_sfc_main$6, {
|
|
3816
|
+
id: "themeSetting"
|
|
3817
|
+
}), createVNode(_sfc_main$5, {
|
|
3818
|
+
id: "fullscreen"
|
|
3819
|
+
})]), createElementVNode("span", _hoisted_3$1, toDisplayString(username.value), 1), createVNode(Avatar)]);
|
|
3820
|
+
};
|
|
3821
|
+
}
|
|
3822
|
+
});
|
|
3823
|
+
const ToolBarRight = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["__scopeId", "data-v-a6baabba"]]);
|
|
3824
|
+
const _hoisted_1$1 = {
|
|
3825
|
+
class: "header-lf mask-image"
|
|
3826
|
+
};
|
|
3827
|
+
const _hoisted_2$1 = {
|
|
3828
|
+
class: "logo flx-center"
|
|
3829
|
+
};
|
|
3830
|
+
const _hoisted_3 = {
|
|
3831
|
+
class: "logo-text"
|
|
3832
|
+
};
|
|
3833
|
+
const _hoisted_4 = {
|
|
3834
|
+
class: "header-ri"
|
|
3835
|
+
};
|
|
3836
|
+
const __default__$2 = defineComponent({
|
|
3837
|
+
name: "layoutClassic"
|
|
3838
|
+
});
|
|
3839
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
3840
|
+
...__default__$2,
|
|
3841
|
+
setup(__props) {
|
|
3842
|
+
const title = "定时任务";
|
|
3843
|
+
const route = useRoute();
|
|
3844
|
+
const authStore = useAuthStore();
|
|
3845
|
+
const globalStore = useGlobalStore();
|
|
3846
|
+
const accordion = computed(() => globalStore.accordion);
|
|
3847
|
+
const isCollapse = computed(() => globalStore.isCollapse);
|
|
3848
|
+
const menuList = computed(() => authStore.showMenuListGet);
|
|
3849
|
+
const activeMenu = computed(() => route.meta.activeMenu ? route.meta.activeMenu : route.path);
|
|
3850
|
+
return (_ctx, _cache) => {
|
|
3851
|
+
const _component_el_header = ElHeader;
|
|
3852
|
+
const _component_el_menu = ElMenu;
|
|
3853
|
+
const _component_el_scrollbar = ElScrollbar;
|
|
3854
|
+
const _component_el_aside = ElAside;
|
|
3855
|
+
const _component_el_container = ElContainer;
|
|
3856
|
+
return openBlock(), createBlock(_component_el_container, {
|
|
3857
|
+
class: "layout"
|
|
3858
|
+
}, {
|
|
3859
|
+
default: withCtx(() => [createVNode(_component_el_header, null, {
|
|
3860
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1$1, [createElementVNode("div", _hoisted_2$1, [_cache[0] || (_cache[0] = createElementVNode("img", {
|
|
3861
|
+
class: "logo-img",
|
|
3862
|
+
src: _imports_0$1,
|
|
3863
|
+
alt: "logo"
|
|
3864
|
+
}, null, -1)), createElementVNode("span", _hoisted_3, toDisplayString(unref(title)), 1)]), createVNode(ToolBarLeft)]), createElementVNode("div", _hoisted_4, [createVNode(ToolBarRight)])]),
|
|
3865
|
+
_: 1
|
|
3866
|
+
}), createVNode(_component_el_container, {
|
|
3867
|
+
class: "classic-content"
|
|
3868
|
+
}, {
|
|
3869
|
+
default: withCtx(() => [createVNode(_component_el_aside, null, {
|
|
3870
|
+
default: withCtx(() => [createElementVNode("div", {
|
|
3871
|
+
class: "aside-box",
|
|
3872
|
+
style: normalizeStyle$1({
|
|
3873
|
+
width: isCollapse.value ? "65px" : "210px"
|
|
3874
|
+
})
|
|
3875
|
+
}, [createVNode(_component_el_scrollbar, null, {
|
|
3876
|
+
default: withCtx(() => [createVNode(_component_el_menu, {
|
|
3877
|
+
router: false,
|
|
3878
|
+
"default-active": activeMenu.value,
|
|
3879
|
+
collapse: isCollapse.value,
|
|
3880
|
+
"unique-opened": accordion.value,
|
|
3881
|
+
"collapse-transition": false
|
|
3882
|
+
}, {
|
|
3883
|
+
default: withCtx(() => [createVNode(_sfc_main$a, {
|
|
3884
|
+
"menu-list": menuList.value
|
|
3885
|
+
}, null, 8, ["menu-list"])]),
|
|
3886
|
+
_: 1
|
|
3887
|
+
}, 8, ["default-active", "collapse", "unique-opened"])]),
|
|
3888
|
+
_: 1
|
|
3889
|
+
})], 4)]),
|
|
3890
|
+
_: 1
|
|
3891
|
+
}), createVNode(_component_el_container, {
|
|
3892
|
+
class: "classic-main"
|
|
3893
|
+
}, {
|
|
3894
|
+
default: withCtx(() => [createVNode(Main)]),
|
|
3895
|
+
_: 1
|
|
3896
|
+
})]),
|
|
3897
|
+
_: 1
|
|
3898
|
+
})]),
|
|
3899
|
+
_: 1
|
|
3900
|
+
});
|
|
3901
|
+
};
|
|
3902
|
+
}
|
|
3903
|
+
});
|
|
3904
|
+
const LayoutClassic = /* @__PURE__ */ _export_sfc$1(_sfc_main$2, [["__scopeId", "data-v-bf954f1e"]]);
|
|
3905
|
+
const _hoisted_1 = {
|
|
3906
|
+
class: "logo flx-center"
|
|
3907
|
+
};
|
|
3908
|
+
const _hoisted_2 = {
|
|
3909
|
+
class: "logo-text"
|
|
3910
|
+
};
|
|
3911
|
+
const __default__$1 = defineComponent({
|
|
3912
|
+
name: "layoutTransverse"
|
|
3913
|
+
});
|
|
3914
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3915
|
+
...__default__$1,
|
|
3916
|
+
setup(__props) {
|
|
3917
|
+
const title = "定时任务";
|
|
3918
|
+
const route = useRoute();
|
|
3919
|
+
const router2 = useRouter();
|
|
3920
|
+
const authStore = useAuthStore();
|
|
3921
|
+
const menuList = computed(() => authStore.showMenuListGet);
|
|
3922
|
+
const activeMenu = computed(() => route.meta.activeMenu ? route.meta.activeMenu : route.path);
|
|
3923
|
+
const handleClickMenu = (subItem) => {
|
|
3924
|
+
if (subItem.meta.isLink && subItem.path) {
|
|
3925
|
+
return window.open(subItem.path, "_blank");
|
|
3926
|
+
} else {
|
|
3927
|
+
router2.push(subItem.path);
|
|
3928
|
+
}
|
|
3929
|
+
};
|
|
3930
|
+
return (_ctx, _cache) => {
|
|
3931
|
+
const _component_el_header = ElHeader;
|
|
3932
|
+
const _component_el_icon = ElIcon;
|
|
3933
|
+
const _component_el_sub_menu = ElSubMenu;
|
|
3934
|
+
const _component_el_menu_item = ElMenuItem;
|
|
3935
|
+
const _component_el_menu = ElMenu;
|
|
3936
|
+
const _component_el_container = ElContainer;
|
|
3937
|
+
return openBlock(), createBlock(_component_el_container, {
|
|
3938
|
+
class: "layout"
|
|
3939
|
+
}, {
|
|
3940
|
+
default: withCtx(() => [createVNode(_component_el_header, null, {
|
|
3941
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1, [_cache[0] || (_cache[0] = createElementVNode("img", {
|
|
3942
|
+
class: "logo-img",
|
|
3943
|
+
src: _imports_0$1,
|
|
3944
|
+
alt: "logo"
|
|
3945
|
+
}, null, -1)), createElementVNode("span", _hoisted_2, toDisplayString(unref(title)), 1)]), createVNode(ToolBarRight)]),
|
|
3946
|
+
_: 1
|
|
3947
|
+
}), createVNode(_component_el_menu, {
|
|
3948
|
+
style: {
|
|
3949
|
+
"height": "2.08333vw"
|
|
3950
|
+
},
|
|
3951
|
+
mode: "horizontal",
|
|
3952
|
+
router: false,
|
|
3953
|
+
"default-active": activeMenu.value
|
|
3954
|
+
}, {
|
|
3955
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(menuList.value, (subItem) => {
|
|
3956
|
+
var _a;
|
|
3957
|
+
return openBlock(), createElementBlock(Fragment, {
|
|
3958
|
+
key: subItem.path
|
|
3959
|
+
}, [((_a = subItem.children) == null ? void 0 : _a.length) ? (openBlock(), createBlock(_component_el_sub_menu, {
|
|
3960
|
+
key: subItem.path,
|
|
3961
|
+
index: subItem.path + "el-sub-menu"
|
|
3962
|
+
}, {
|
|
3963
|
+
title: withCtx(() => [createVNode(_component_el_icon, null, {
|
|
3964
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(subItem.meta.icon)))]),
|
|
3965
|
+
_: 2
|
|
3966
|
+
}, 1024), createElementVNode("span", null, toDisplayString(subItem.meta.title), 1)]),
|
|
3967
|
+
default: withCtx(() => [createVNode(_sfc_main$a, {
|
|
3968
|
+
"menu-list": subItem.children
|
|
3969
|
+
}, null, 8, ["menu-list"])]),
|
|
3970
|
+
_: 2
|
|
3971
|
+
}, 1032, ["index"])) : (openBlock(), createBlock(_component_el_menu_item, {
|
|
3972
|
+
key: subItem.path + "el-menu-item",
|
|
3973
|
+
index: subItem.path,
|
|
3974
|
+
onClick: ($event) => handleClickMenu(subItem)
|
|
3975
|
+
}, {
|
|
3976
|
+
title: withCtx(() => [createElementVNode("span", null, toDisplayString(subItem.meta.title), 1)]),
|
|
3977
|
+
default: withCtx(() => [createVNode(_component_el_icon, null, {
|
|
3978
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(subItem.meta.icon)))]),
|
|
3979
|
+
_: 2
|
|
3980
|
+
}, 1024)]),
|
|
3981
|
+
_: 2
|
|
3982
|
+
}, 1032, ["index", "onClick"]))], 64);
|
|
3983
|
+
}), 128))]),
|
|
3984
|
+
_: 1
|
|
3985
|
+
}, 8, ["default-active"]), createVNode(Main)]),
|
|
3986
|
+
_: 1
|
|
3987
|
+
});
|
|
3988
|
+
};
|
|
3989
|
+
}
|
|
3990
|
+
});
|
|
3991
|
+
const LayoutTransverse = /* @__PURE__ */ _export_sfc$1(_sfc_main$1, [["__scopeId", "data-v-59b91c5a"]]);
|
|
3992
|
+
const __default__ = defineComponent({
|
|
3993
|
+
name: "layout"
|
|
3994
|
+
});
|
|
3995
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3996
|
+
...__default__,
|
|
3997
|
+
setup(__props) {
|
|
3998
|
+
const LayoutComponents = {
|
|
3999
|
+
classic: LayoutClassic,
|
|
4000
|
+
transverse: LayoutTransverse
|
|
4001
|
+
};
|
|
4002
|
+
const globalStore = useGlobalStore();
|
|
4003
|
+
const layout = computed(() => globalStore.layout);
|
|
4004
|
+
return (_ctx, _cache) => {
|
|
4005
|
+
return openBlock(), createElementBlock(Fragment, null, [(openBlock(), createBlock(resolveDynamicComponent(LayoutComponents[layout.value]))), createVNode(ThemeDrawer)], 64);
|
|
4006
|
+
};
|
|
4007
|
+
}
|
|
4008
|
+
});
|
|
4009
|
+
const index = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__scopeId", "data-v-08019659"]]);
|
|
4010
|
+
export {
|
|
4011
|
+
index as default
|
|
4012
|
+
};
|