xxl-job-vue3 1.0.1 → 1.0.3

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.

Potentially problematic release.


This version of xxl-job-vue3 might be problematic. Click here for more details.

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