@ithinkdt/ui 4.0.0-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/auto-imports.d.ts +15 -0
- package/auto-imports.js +34 -0
- package/locale.d.ts +74 -0
- package/package.json +99 -0
- package/src/components.d.ts +435 -0
- package/src/design.d.ts +234 -0
- package/src/directives.d.ts +42 -0
- package/src/index.d.ts +19 -0
- package/src/index.js +1361 -0
- package/src/page.d.ts +153 -0
- package/src/use-style.d.ts +10 -0
- package/unocss.d.ts +5 -0
- package/unocss.js +95 -0
package/src/index.js
ADDED
|
@@ -0,0 +1,1361 @@
|
|
|
1
|
+
import { Fragment, computed, createVNode, defineComponent, h, inject as inject$1, isVNode, mergeProps, nextTick, provide, reactive, ref as ref$1, renderSlot, shallowRef, toRef as toRef$1, toValue, useTemplateRef, watch, withDirectives } from "vue";
|
|
2
|
+
import { promiseTimeout, useElementHover, useElementSize, useEventListener, useFullscreen, watchDebounced } from "@vueuse/core";
|
|
3
|
+
import { NAvatar, NBadge, NBreadcrumb, NBreadcrumbItem, NButton, NDrawer, NDrawerContent, NDropdown, NEmpty, NIcon, NList, NListItem, NMenu, NPagination, NPopover, NScrollbar, NText, NThing, NTooltip, useThemeVars } from "ithinkdt-ui";
|
|
4
|
+
import { useAtomicBroadcast, useElementIntersectionRect } from "@ithinkdt/common/composables";
|
|
5
|
+
import { string2dom } from "@ithinkdt/common/dom";
|
|
6
|
+
import { debounce } from "@ithinkdt/common/fn";
|
|
7
|
+
import { useMergedClsPrefix } from "ithinkdt-ui/es/_mixins/use-config";
|
|
8
|
+
import _useStyle from "ithinkdt-ui/es/_mixins/use-style";
|
|
9
|
+
import { c, cB, cE, cM } from "ithinkdt-ui/es/_utils/cssr/index";
|
|
10
|
+
import { RouterLink, useRouter } from "vue-router";
|
|
11
|
+
import { walkTree } from "@ithinkdt/common/tree";
|
|
12
|
+
import { format } from "date-fns";
|
|
13
|
+
import { getOpaqueColor } from "@ithinkdt/common/color";
|
|
14
|
+
const UI_I18N_INJECTION = "__UI_I18N__";
|
|
15
|
+
function useI18n() {
|
|
16
|
+
return inject$1(UI_I18N_INJECTION).value();
|
|
17
|
+
}
|
|
18
|
+
var Tooltip = /* @__PURE__ */ Symbol("tooltip-dir"), current = /* @__PURE__ */ shallowRef(), _update;
|
|
19
|
+
const TooltipDirectiveProvider = /* @__PURE__ */ defineComponent({
|
|
20
|
+
name: "TooltipDirectiveProvider",
|
|
21
|
+
props: { delay: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: 180
|
|
24
|
+
} },
|
|
25
|
+
setup(u) {
|
|
26
|
+
let R = shallowRef(), B = reactive({
|
|
27
|
+
show: !1,
|
|
28
|
+
tip: void 0,
|
|
29
|
+
placement: "top",
|
|
30
|
+
x: 0,
|
|
31
|
+
y: 0
|
|
32
|
+
});
|
|
33
|
+
return _update = async () => {
|
|
34
|
+
if (!current.value) return;
|
|
35
|
+
u.delay > 0 && await promiseTimeout(u.delay);
|
|
36
|
+
let z = current.value, V = z?.[Tooltip];
|
|
37
|
+
if (!V) return;
|
|
38
|
+
let H = V.tip;
|
|
39
|
+
R.value = typeof H == "function" ? H : () => H || z.attributes.getNamedItem("title") || z.textContent;
|
|
40
|
+
let { auto: U } = V.binding.modifiers;
|
|
41
|
+
if (!U || z.firstChild.offsetWidth > z.clientWidth || z.firstChild.offsetHeight > z.clientHeight) {
|
|
42
|
+
B.show = !0;
|
|
43
|
+
let u = z.getBoundingClientRect();
|
|
44
|
+
switch (B.placement = Object.keys(V.binding.modifiers).find((u) => [
|
|
45
|
+
"top",
|
|
46
|
+
"right",
|
|
47
|
+
"left",
|
|
48
|
+
"bottom"
|
|
49
|
+
].find((R) => u.startsWith(R))) ?? "top", B.placement.split("-")[0]) {
|
|
50
|
+
case "top":
|
|
51
|
+
B.x = u.left + u.width / 2, B.y = u.top;
|
|
52
|
+
break;
|
|
53
|
+
case "right":
|
|
54
|
+
B.x = u.left + u.width, B.y = u.top + u.height / 2;
|
|
55
|
+
break;
|
|
56
|
+
case "left":
|
|
57
|
+
B.x = u.left, B.y = u.top + u.height / 2;
|
|
58
|
+
break;
|
|
59
|
+
case "bottom":
|
|
60
|
+
B.x = u.left + u.width / 2, B.y = u.bottom;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
} else B.show &&= !1;
|
|
64
|
+
}, useEventListener("mouseover", (u) => {
|
|
65
|
+
let R = u.target;
|
|
66
|
+
!current.value || current.value?.contains(R) || (B.show = !1, current.value = void 0);
|
|
67
|
+
}, { capture: !0 }), () => createVNode(NTooltip, {
|
|
68
|
+
trigger: "manual",
|
|
69
|
+
show: !!current.value && B.show,
|
|
70
|
+
x: B.x,
|
|
71
|
+
y: B.y,
|
|
72
|
+
placement: B.placement,
|
|
73
|
+
keepAliveOnHover: !0
|
|
74
|
+
}, { default: () => [R.value?.()] });
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
var _listener = (u) => {
|
|
78
|
+
current.value = u.target, _update?.();
|
|
79
|
+
};
|
|
80
|
+
const vTooltip = {
|
|
81
|
+
mounted(u, R) {
|
|
82
|
+
u[Tooltip] = {
|
|
83
|
+
binding: R,
|
|
84
|
+
tip: R.value
|
|
85
|
+
}, u.addEventListener("mouseenter", _listener);
|
|
86
|
+
},
|
|
87
|
+
updated(u, R) {
|
|
88
|
+
u[Tooltip].binding = R, u[Tooltip].tip = R.value, _update();
|
|
89
|
+
},
|
|
90
|
+
beforeUnmount(u) {
|
|
91
|
+
u[Tooltip] && u.removeEventListener("mouseenter", _listener), current.value === u && (current.value = void 0), delete u[Tooltip];
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
function useStyle(u, R, z, B) {
|
|
95
|
+
return z ??= useMergedClsPrefix(), _useStyle(u, R, z, B), z;
|
|
96
|
+
}
|
|
97
|
+
const fullWidth = { width: "100%" }, fullHeight = { height: "100%" };
|
|
98
|
+
({
|
|
99
|
+
...fullWidth,
|
|
100
|
+
...fullHeight
|
|
101
|
+
});
|
|
102
|
+
const flex = { display: "flex" };
|
|
103
|
+
({ ...flex });
|
|
104
|
+
const flexAlignCenter = {
|
|
105
|
+
...flex,
|
|
106
|
+
alignItems: "center"
|
|
107
|
+
}, flexJustifyCenter = {
|
|
108
|
+
...flex,
|
|
109
|
+
justifyContent: "center"
|
|
110
|
+
};
|
|
111
|
+
({ ...flex }), {
|
|
112
|
+
...flexAlignCenter,
|
|
113
|
+
...flexJustifyCenter
|
|
114
|
+
};
|
|
115
|
+
var clsPrefix$1, isDark, style$1 = /* @__PURE__ */ c([c(({ props: u }) => `:where(${u.bPrefix}spin-host)`, { position: "relative" }), cB("spin-directive", {
|
|
116
|
+
zIndex: "999999",
|
|
117
|
+
position: "absolute",
|
|
118
|
+
color: "var(--color-primary)",
|
|
119
|
+
display: "flex",
|
|
120
|
+
flexDirection: "column",
|
|
121
|
+
justifyContent: "center",
|
|
122
|
+
alignItems: "center",
|
|
123
|
+
gap: "4px",
|
|
124
|
+
willChange: "background-color",
|
|
125
|
+
backgroundColor: "rgb(var(--host-bg, 255 255 255) / 0)",
|
|
126
|
+
transition: "background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
127
|
+
}, [
|
|
128
|
+
cE("tip, icon", {
|
|
129
|
+
willChange: "opacity",
|
|
130
|
+
opacity: "0",
|
|
131
|
+
transition: "opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
132
|
+
}),
|
|
133
|
+
cE("tip:empty", { display: "none" }),
|
|
134
|
+
cM("spining", { backgroundColor: "rgb(var(--host-bg, 255 255 255) / 0.5)" }, [cE("tip, icon", { opacity: "1" })])
|
|
135
|
+
])]);
|
|
136
|
+
const SpinDirectiveProvider = /* @__PURE__ */ defineComponent({
|
|
137
|
+
name: "SpinDirectiveProvider",
|
|
138
|
+
props: { dark: Boolean },
|
|
139
|
+
setup(R) {
|
|
140
|
+
return clsPrefix$1 = useStyle("-spin-directive", style$1), isDark = toRef$1(R, "dark"), () => h(Fragment);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
var Spin = /* @__PURE__ */ Symbol("spin-dir"), updateLoading = (u, { value: R, modifiers: z }) => {
|
|
144
|
+
if (u[Spin].loading.value = !!R, !u[Spin].loading.value) return;
|
|
145
|
+
let B = z.dark || !z.light && isDark.value;
|
|
146
|
+
u[Spin].spinEl.style.setProperty("--host-bg", B ? "0 0 0" : "255 255 255");
|
|
147
|
+
};
|
|
148
|
+
const vSpin = {
|
|
149
|
+
beforeMount(u) {
|
|
150
|
+
if (u.classList.add(`${clsPrefix$1.value}-spin-host`), u[Spin]) return;
|
|
151
|
+
let R = ref$1(!1), z = string2dom(`
|
|
152
|
+
<div class="${clsPrefix$1.value}-spin-directive">
|
|
153
|
+
<svg class="${clsPrefix$1.value}-spin-directive__icon" width="32" height="32" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
|
|
154
|
+
<g>
|
|
155
|
+
<animateTransform attributeName="transform" type="rotate" values="0 100 100;270 100 100" begin="0s" dur="1.6s" fill="freeze" repeatCount="indefinite"></animateTransform>
|
|
156
|
+
<circle fill="none" stroke="currentColor" stroke-width="18" stroke-linecap="round" cx="100" cy="100" r="92" stroke-dasharray="567" stroke-dashoffset="1848">
|
|
157
|
+
<animateTransform attributeName="transform" type="rotate" values="0 100 100;135 100 100;450 100 100" begin="0s" dur="1.6s" fill="freeze" repeatCount="indefinite"></animateTransform>
|
|
158
|
+
<animate attributeName="stroke-dashoffset" values="567;142;567" begin="0s" dur="1.6s" fill="freeze" repeatCount="indefinite"></animate>
|
|
159
|
+
</circle>
|
|
160
|
+
</g>
|
|
161
|
+
</svg>
|
|
162
|
+
<div class="${clsPrefix$1.value}-spin-directive__tip"></div>
|
|
163
|
+
</div>
|
|
164
|
+
`.trim()), B, { stop: V, update: H } = useElementIntersectionRect(u, (u) => {
|
|
165
|
+
B = u, Object.assign(z.style, {
|
|
166
|
+
left: 0,
|
|
167
|
+
top: 0,
|
|
168
|
+
width: B.width + "px",
|
|
169
|
+
height: B.height + "px"
|
|
170
|
+
});
|
|
171
|
+
}, { interval: 1e3 / 30 }), U, W = watch(R, debounce(() => {
|
|
172
|
+
if (R.value) U === void 0 && (clearTimeout(U), U = void 0), H(), u.append(z), requestAnimationFrame(() => {
|
|
173
|
+
R.value && z.classList.add(`${clsPrefix$1.value}-spin-directive--spining`);
|
|
174
|
+
});
|
|
175
|
+
else {
|
|
176
|
+
z.classList.remove(`${clsPrefix$1.value}-spin-directive--spining`);
|
|
177
|
+
let u = () => {
|
|
178
|
+
z.remove(), R && clearTimeout(R), R = null, z.removeEventListener("transitioncancel", u), z.removeEventListener("transitionend", u);
|
|
179
|
+
};
|
|
180
|
+
z.addEventListener("transitioncancel", u), z.addEventListener("transitionend", u);
|
|
181
|
+
let R = setTimeout(u, 300);
|
|
182
|
+
}
|
|
183
|
+
}, 30));
|
|
184
|
+
u[Spin] = {
|
|
185
|
+
loading: R,
|
|
186
|
+
spinEl: z,
|
|
187
|
+
updateTip: () => {
|
|
188
|
+
let R = z.querySelector(`.${clsPrefix$1.value}-spin-directive__tip`);
|
|
189
|
+
R.textContent = u.dataset.spinTip;
|
|
190
|
+
},
|
|
191
|
+
stop: () => {
|
|
192
|
+
V(), W();
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
mounted(u, R) {
|
|
197
|
+
updateLoading(u, R), u[Spin].updateTip(), !u[Spin].observer && nextTick().then(() => {
|
|
198
|
+
(u[Spin].observer = new MutationObserver((R) => {
|
|
199
|
+
for (let z of R) if (z.type === "attributes" && z.attributeName === "data-spin-tip") {
|
|
200
|
+
u[Spin].updateTip();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
})).observe(u, {
|
|
204
|
+
attributes: !0,
|
|
205
|
+
attributeFilter: ["data-spin-tip"]
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
updated: updateLoading,
|
|
210
|
+
beforeUnmount(u) {
|
|
211
|
+
u[Spin].loading.value = !1, u[Spin].stop(), u[Spin].observer?.disconnect(), delete u[Spin];
|
|
212
|
+
}
|
|
213
|
+
}, COLLAPSED_INJECTION_KEY = "APP_SIDER_COLLAPSED", IBookmark = () => createVNode("svg", {
|
|
214
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
215
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
216
|
+
role: "img",
|
|
217
|
+
width: "1em",
|
|
218
|
+
height: "1em",
|
|
219
|
+
viewBox: "0 0 24 24"
|
|
220
|
+
}, [createVNode("path", {
|
|
221
|
+
fill: "currentColor",
|
|
222
|
+
d: "m17 18l-5-2.18L7 18V5h10m0-2H7a2 2 0 0 0-2 2v16l7-3l7 3V5a2 2 0 0 0-2-2Z"
|
|
223
|
+
}, null)]), CTX_INJECTION_KEY = "__APP_CTX__", getCtx = () => inject(CTX_INJECTION_KEY);
|
|
224
|
+
var style = /* @__PURE__ */ c([
|
|
225
|
+
cB("layout", {
|
|
226
|
+
display: "grid",
|
|
227
|
+
gridTemplateAreas: "\n 'sider header'\n 'sider content'\n 'sider footer'\n ",
|
|
228
|
+
gridTemplateRows: "auto 1fr auto",
|
|
229
|
+
gridTemplateColumns: "auto 1fr",
|
|
230
|
+
position: "relative",
|
|
231
|
+
top: "0",
|
|
232
|
+
left: "0",
|
|
233
|
+
transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
234
|
+
"--app-content-height": "calc(100vh - var(--app-header-height) - var(--app-footer-height))"
|
|
235
|
+
}, [cM("full-header", { gridTemplateAreas: "\n 'header header'\n 'sider content'\n 'sider footer'\n " }), cM("full-content", {
|
|
236
|
+
width: "calc(100% + var(--app-sider-width))",
|
|
237
|
+
height: "calc(100% + var(--app-header-height))",
|
|
238
|
+
left: "calc(-1 * var(--app-sider-width))",
|
|
239
|
+
top: "calc(-1 * var(--app-header-height))"
|
|
240
|
+
})]),
|
|
241
|
+
cB("header", {
|
|
242
|
+
gridArea: "header",
|
|
243
|
+
overflow: "hidden",
|
|
244
|
+
zIndex: 2,
|
|
245
|
+
height: "var(--app-header-height, 44px)",
|
|
246
|
+
zIndex: "2"
|
|
247
|
+
}),
|
|
248
|
+
cB("sider", {
|
|
249
|
+
gridArea: "sider",
|
|
250
|
+
width: "var(--app-sider-width, 220px)",
|
|
251
|
+
display: "flex",
|
|
252
|
+
flexDirection: "column",
|
|
253
|
+
overflow: "auto",
|
|
254
|
+
position: "relative",
|
|
255
|
+
transition: "width 0.2s ease-in-out",
|
|
256
|
+
zIndex: "2"
|
|
257
|
+
}, [cE("collapse-btn", {
|
|
258
|
+
"--n-padding": "0 12px",
|
|
259
|
+
position: "absolute",
|
|
260
|
+
zIndex: "2",
|
|
261
|
+
bottom: "8px",
|
|
262
|
+
right: "8px"
|
|
263
|
+
})]),
|
|
264
|
+
cB("content", {
|
|
265
|
+
gridArea: "content",
|
|
266
|
+
position: "relative",
|
|
267
|
+
overflow: "hidden",
|
|
268
|
+
zIndex: "1"
|
|
269
|
+
}),
|
|
270
|
+
cB("footer", {
|
|
271
|
+
gridArea: "footer",
|
|
272
|
+
lineHeight: "24px"
|
|
273
|
+
})
|
|
274
|
+
]), IFold = () => createVNode("svg", {
|
|
275
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
276
|
+
width: "1em",
|
|
277
|
+
height: "1em",
|
|
278
|
+
viewBox: "0 0 24 24"
|
|
279
|
+
}, [createVNode("path", {
|
|
280
|
+
fill: "none",
|
|
281
|
+
stroke: "currentColor",
|
|
282
|
+
"stroke-linecap": "round",
|
|
283
|
+
"stroke-linejoin": "round",
|
|
284
|
+
"stroke-width": "1.5",
|
|
285
|
+
d: "M11.5 18s-6-4.419-6-6s6-6 6-6m7 12s-6-4.419-6-6s6-6 6-6",
|
|
286
|
+
color: "currentColor"
|
|
287
|
+
}, null)]), IUnfold = () => createVNode("svg", {
|
|
288
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
289
|
+
width: "1em",
|
|
290
|
+
height: "1em",
|
|
291
|
+
viewBox: "0 0 24 24"
|
|
292
|
+
}, [createVNode("path", {
|
|
293
|
+
fill: "none",
|
|
294
|
+
stroke: "currentColor",
|
|
295
|
+
"stroke-linecap": "round",
|
|
296
|
+
"stroke-linejoin": "round",
|
|
297
|
+
"stroke-width": "1.5",
|
|
298
|
+
d: "M12.5 18s6-4.419 6-6s-6-6-6-6m-7 12s6-4.419 6-6s-6-6-6-6",
|
|
299
|
+
color: "currentColor"
|
|
300
|
+
}, null)]);
|
|
301
|
+
const AppLayout = /* @__PURE__ */ defineComponent({
|
|
302
|
+
name: "AppLayout",
|
|
303
|
+
props: {
|
|
304
|
+
layout: {
|
|
305
|
+
type: String,
|
|
306
|
+
default: "left2right"
|
|
307
|
+
},
|
|
308
|
+
fullContent: Boolean
|
|
309
|
+
},
|
|
310
|
+
setup(u, { slots: R }) {
|
|
311
|
+
useStyle("-layout", style, ref("app"), !1);
|
|
312
|
+
let B = reactive({
|
|
313
|
+
siderWidth: "0px",
|
|
314
|
+
headerHeight: "0px",
|
|
315
|
+
footerHeight: "0px",
|
|
316
|
+
hasMultiTab: !1
|
|
317
|
+
});
|
|
318
|
+
return provide(CTX_INJECTION_KEY, B), () => {
|
|
319
|
+
let { layout: V } = u;
|
|
320
|
+
return createVNode("div", {
|
|
321
|
+
class: {
|
|
322
|
+
"app-layout": !0,
|
|
323
|
+
"app-layout--full-header": V === "top2bottom",
|
|
324
|
+
"app-layout--full-content": u.fullContent
|
|
325
|
+
},
|
|
326
|
+
style: {
|
|
327
|
+
"--app-sider-width": B.siderWidth,
|
|
328
|
+
"--app-header-height": B.headerHeight,
|
|
329
|
+
"--app-footer-height": B.footerHeight
|
|
330
|
+
}
|
|
331
|
+
}, [renderSlot(R, "default")]);
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
}), AppHeader = /* @__PURE__ */ defineComponent({
|
|
335
|
+
name: "AppHeader",
|
|
336
|
+
props: { height: {
|
|
337
|
+
type: Number,
|
|
338
|
+
default: 44
|
|
339
|
+
} },
|
|
340
|
+
setup(u, { slots: R }) {
|
|
341
|
+
let B = getCtx();
|
|
342
|
+
return () => (B.headerHeight = u.height + "px", createVNode("div", { class: "app-header" }, [renderSlot(R, "default")]));
|
|
343
|
+
}
|
|
344
|
+
}), AppSider = /* @__PURE__ */ defineComponent({
|
|
345
|
+
name: "AppSider",
|
|
346
|
+
props: {
|
|
347
|
+
showCollapseBtn: {
|
|
348
|
+
type: Boolean,
|
|
349
|
+
default: !0
|
|
350
|
+
},
|
|
351
|
+
collapsed: Boolean,
|
|
352
|
+
width: {
|
|
353
|
+
type: Number,
|
|
354
|
+
default: 220
|
|
355
|
+
},
|
|
356
|
+
collapsedWidth: {
|
|
357
|
+
type: Number,
|
|
358
|
+
default: 60
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
emits: { "update:collapsed": () => !0 },
|
|
362
|
+
setup(u, { emit: R, slots: B }) {
|
|
363
|
+
provide(COLLAPSED_INJECTION_KEY, toRef$1(u, "collapsed"));
|
|
364
|
+
let { t: V } = useI18n(), H = getCtx();
|
|
365
|
+
return () => (H.siderWidth = (u.collapsed ? u.collapsedWidth : u.width) + "px", createVNode("div", { class: "app-sider" }, [renderSlot(B, "default"), u.showCollapseBtn ? withDirectives(createVNode(NButton, {
|
|
366
|
+
class: "app-sider__collapse-btn",
|
|
367
|
+
quaternary: !0,
|
|
368
|
+
onClick: () => {
|
|
369
|
+
R("update:collapsed", !u.collapsed);
|
|
370
|
+
}
|
|
371
|
+
}, { default: () => [createVNode(NIcon, { size: "20" }, { default: () => [u.collapsed ? createVNode(IUnfold, null, null) : createVNode(IFold, null, null)] })] }), [[vTooltip, u.collapsed ? V("common.layout.sider.expand") : V("common.layout.sider.collapse")]]) : void 0]));
|
|
372
|
+
}
|
|
373
|
+
}), AppContent = /* @__PURE__ */ defineComponent({
|
|
374
|
+
name: "AppContent",
|
|
375
|
+
setup(u, { slots: R }) {
|
|
376
|
+
return () => createVNode("div", { class: "app-content" }, [renderSlot(R, "default")]);
|
|
377
|
+
}
|
|
378
|
+
}), AppFooter = /* @__PURE__ */ defineComponent({
|
|
379
|
+
name: "AppFooter",
|
|
380
|
+
props: { height: {
|
|
381
|
+
type: Number,
|
|
382
|
+
default: 30
|
|
383
|
+
} },
|
|
384
|
+
setup(u, { slots: R }) {
|
|
385
|
+
let B = getCtx();
|
|
386
|
+
return () => (B.footerHeight = u.height + "px", createVNode("div", { class: "app-footer" }, [renderSlot(R, "default")]));
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
function _isSlot$4(u) {
|
|
390
|
+
return typeof u == "function" || Object.prototype.toString.call(u) === "[object Object]" && !isVNode(u);
|
|
391
|
+
}
|
|
392
|
+
const AppLogo = /* @__PURE__ */ defineComponent({
|
|
393
|
+
name: "AppLogo",
|
|
394
|
+
props: {
|
|
395
|
+
src: [String, Function],
|
|
396
|
+
name: String,
|
|
397
|
+
collapsed: {
|
|
398
|
+
type: Boolean,
|
|
399
|
+
default: void 0
|
|
400
|
+
},
|
|
401
|
+
center: {
|
|
402
|
+
type: Boolean,
|
|
403
|
+
default: !1
|
|
404
|
+
},
|
|
405
|
+
link: {
|
|
406
|
+
type: Boolean,
|
|
407
|
+
default: !0
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
setup(u, { slots: R }) {
|
|
411
|
+
let B = asyncComputed(() => typeof u.src == "function" ? u.src() : u.src), V = inject$1(COLLAPSED_INJECTION_KEY, !1);
|
|
412
|
+
return () => {
|
|
413
|
+
let { name: H, collapsed: U, center: W, link: G } = u;
|
|
414
|
+
U ??= unref(V);
|
|
415
|
+
let K = U ? 1 : 1 / 1.1;
|
|
416
|
+
return createVNode("div", {
|
|
417
|
+
class: "app-logo",
|
|
418
|
+
style: {
|
|
419
|
+
"--app-logo-img-size": "32px",
|
|
420
|
+
"--app-logo-name-size": "22px",
|
|
421
|
+
width: W ? "100%" : "auto",
|
|
422
|
+
overflow: "hidden",
|
|
423
|
+
display: "flex",
|
|
424
|
+
alignItems: "center",
|
|
425
|
+
justifyContent: W ? "center" : "flex-start",
|
|
426
|
+
cursor: G ? "pointer" : void 0
|
|
427
|
+
}
|
|
428
|
+
}, [R.default ? R.default() : createVNode("div", {
|
|
429
|
+
class: "app-logo__img",
|
|
430
|
+
style: `
|
|
431
|
+
width: ${U ? "var(--app-sider-width, 60px)" : "56px"};
|
|
432
|
+
font-size: ${U ? "calc(var(--app-sider-width, 60px) - 24px)" : "32px"};
|
|
433
|
+
transition: width 0.2s ease-in-out 0.1s;
|
|
434
|
+
flex: 0 0 auto;
|
|
435
|
+
display: flex;
|
|
436
|
+
justify-content: center
|
|
437
|
+
`
|
|
438
|
+
}, [R.icon ? R.icon() : createVNode("img", {
|
|
439
|
+
src: B.value,
|
|
440
|
+
alt: "App Logo",
|
|
441
|
+
style: `transition: height 0.2s ease-in-out; height: calc(var(--app-logo-img-size) * ${K})`
|
|
442
|
+
}, null)]), H ? createVNode(NText, {
|
|
443
|
+
class: "app-logo__name",
|
|
444
|
+
style: "font-size: var(--app-logo-name-size); font-weight: bold; white-space: nowrap; flex: 0 1 auto; overflow: hidden"
|
|
445
|
+
}, _isSlot$4(H) ? H : { default: () => [H] }) : ""]);
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
function _isSlot$3(u) {
|
|
450
|
+
return typeof u == "function" || Object.prototype.toString.call(u) === "[object Object]" && !isVNode(u);
|
|
451
|
+
}
|
|
452
|
+
const AppMenu = /* @__PURE__ */ defineComponent({
|
|
453
|
+
name: "AppMenu",
|
|
454
|
+
props: {
|
|
455
|
+
menus: Array,
|
|
456
|
+
getIcon: Function,
|
|
457
|
+
current: String,
|
|
458
|
+
horizontal: Boolean,
|
|
459
|
+
single: Boolean,
|
|
460
|
+
accordion: Boolean,
|
|
461
|
+
collapsed: {
|
|
462
|
+
type: Boolean,
|
|
463
|
+
default: void 0
|
|
464
|
+
},
|
|
465
|
+
renderLabel: Function,
|
|
466
|
+
width: {
|
|
467
|
+
type: Number,
|
|
468
|
+
default: 220
|
|
469
|
+
},
|
|
470
|
+
collapsedWidth: {
|
|
471
|
+
type: Number,
|
|
472
|
+
default: 60
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
setup(u) {
|
|
476
|
+
let R = shallowRef([]);
|
|
477
|
+
watch([() => u.menus, () => u.single], ([z, B]) => {
|
|
478
|
+
if (R.value = [], !z?.length) return;
|
|
479
|
+
let V = (R, z = 0) => {
|
|
480
|
+
let H = [];
|
|
481
|
+
for (let U of R) {
|
|
482
|
+
if (U.type === "action") continue;
|
|
483
|
+
let R = U.type === "view" ? void 0 : V(U.children ?? [], z + 1), W = {
|
|
484
|
+
_: U,
|
|
485
|
+
key: U.key,
|
|
486
|
+
label: () => u.renderLabel?.(U) ?? U.name,
|
|
487
|
+
icon: z === 0 || U.icon ? u.getIcon?.(U.icon) ?? IBookmark : void 0,
|
|
488
|
+
children: B ? void 0 : R,
|
|
489
|
+
path: U.path || (B ? R?.[0]?.path : void 0),
|
|
490
|
+
depth: z
|
|
491
|
+
};
|
|
492
|
+
delete W.type, H.push(W);
|
|
493
|
+
}
|
|
494
|
+
return H;
|
|
495
|
+
};
|
|
496
|
+
R.value = V(z);
|
|
497
|
+
}, { immediate: !0 }), watch([useTemplateRef("menu"), () => u.current], ([u, R]) => {
|
|
498
|
+
u?.showOption(R);
|
|
499
|
+
}, { immediate: !0 });
|
|
500
|
+
let B = inject$1(COLLAPSED_INJECTION_KEY, !1), V = (R) => {
|
|
501
|
+
let V = u.collapsed ?? unref(B), H;
|
|
502
|
+
if (R._.type === "view") if (R.isExternal && R.externalEmbed) H = createVNode("a", {
|
|
503
|
+
href: R.externalLink,
|
|
504
|
+
target: "_blank",
|
|
505
|
+
onClick: (u) => u.stopPropagation()
|
|
506
|
+
}, [R.label()]);
|
|
507
|
+
else {
|
|
508
|
+
let u;
|
|
509
|
+
H = createVNode(RouterLink, { to: R.path }, _isSlot$3(u = R.label()) ? u : { default: () => [u] });
|
|
510
|
+
}
|
|
511
|
+
else H = createVNode("span", null, [R.label()]);
|
|
512
|
+
return H.key = `${R.key}:${V ? 1 : 0}`, R.depth === 0 && !V && (H = withDirectives(H, [[
|
|
513
|
+
vTooltip,
|
|
514
|
+
R.label(),
|
|
515
|
+
void 0,
|
|
516
|
+
{
|
|
517
|
+
auto: !0,
|
|
518
|
+
right: !0
|
|
519
|
+
}
|
|
520
|
+
]])), R.isNew && (H = createVNode("div", { style: "display: flex; width: 100%" }, [createVNode("span", { style: "flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis" }, [H]), createVNode("svg", {
|
|
521
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
522
|
+
width: "24",
|
|
523
|
+
height: "24",
|
|
524
|
+
viewBox: "0 0 1024 1024",
|
|
525
|
+
style: "margin-left: 8px; flex: 0 0 auto;"
|
|
526
|
+
}, [createVNode("path", {
|
|
527
|
+
d: "M245.76 286.72h552.96c124.928 0 225.28 100.352 225.28 225.28s-100.352 225.28-225.28 225.28H0V532.48c0-135.168 110.592-245.76 245.76-245.76z m133.12 348.16V401.408H348.16v178.176l-112.64-178.176H204.8V634.88h30.72v-178.176L348.16 634.88h30.72z m182.272-108.544v-24.576h-96.256v-75.776h110.592v-24.576h-141.312V634.88h143.36v-24.576h-112.64v-83.968h96.256z m100.352 28.672l-34.816-151.552h-34.816l55.296 233.472H675.84l47.104-161.792 4.096-20.48 4.096 20.48 47.104 161.792h28.672l57.344-233.472h-34.816l-32.768 151.552-4.096 30.72-6.144-30.72-40.96-151.552h-30.72l-40.96 151.552-6.144 30.72-6.144-30.72z",
|
|
528
|
+
fill: "var(--color-danger)"
|
|
529
|
+
}, null)])])), H;
|
|
530
|
+
};
|
|
531
|
+
return () => {
|
|
532
|
+
let H = createVNode(NMenu, {
|
|
533
|
+
ref: "menu",
|
|
534
|
+
options: R.value,
|
|
535
|
+
rootIndent: 16,
|
|
536
|
+
accordion: u.accordion,
|
|
537
|
+
collapsed: u.collapsed ?? unref(B),
|
|
538
|
+
dropdownProps: { showArrow: !0 },
|
|
539
|
+
mode: u.horizontal ? "horizontal" : "vertical",
|
|
540
|
+
value: u.current ?? null,
|
|
541
|
+
renderLabel: V,
|
|
542
|
+
responsive: !0,
|
|
543
|
+
collapsedWidth: u.collapsedWidth,
|
|
544
|
+
width: u.width
|
|
545
|
+
}, null);
|
|
546
|
+
return u.horizontal ? H : createVNode(NScrollbar, null, _isSlot$3(H) ? H : { default: () => [H] });
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
function _isSlot$2(u) {
|
|
551
|
+
return typeof u == "function" || Object.prototype.toString.call(u) === "[object Object]" && !isVNode(u);
|
|
552
|
+
}
|
|
553
|
+
const AppBreadcrumb = /* @__PURE__ */ defineComponent({
|
|
554
|
+
name: "AppBreadcrumb",
|
|
555
|
+
props: {
|
|
556
|
+
items: {
|
|
557
|
+
type: Array,
|
|
558
|
+
default: () => []
|
|
559
|
+
},
|
|
560
|
+
getIcon: {
|
|
561
|
+
type: Function,
|
|
562
|
+
default: void 0
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
setup(R) {
|
|
566
|
+
let B = useRouter(), V = Symbol(), H = Symbol();
|
|
567
|
+
return watch(() => R.items, (u) => {
|
|
568
|
+
walkTree(u, (u) => {
|
|
569
|
+
u.icon && (typeof u.icon == "string" ? (u[V] = R.getIcon?.(u.icon), u[H] = () => u[V]?.() || IBookmark()) : u[H] = u.icon);
|
|
570
|
+
});
|
|
571
|
+
}, { immediate: !0 }), () => {
|
|
572
|
+
let V;
|
|
573
|
+
return createVNode(NBreadcrumb, null, _isSlot$2(V = R.items.map((R) => createVNode(NBreadcrumbItem, {
|
|
574
|
+
clickable: R.href?.length > 0,
|
|
575
|
+
separator: R.separator,
|
|
576
|
+
onClick: R.href && ((u) => {
|
|
577
|
+
u.stopPropagation(), B.push(R.href);
|
|
578
|
+
})
|
|
579
|
+
}, { default: () => [R.icon ? createVNode(Fragment, null, [createVNode(NIcon, { component: R[H] }, null), " "]) : void 0, toValue(R.title)] }))) ? V : { default: () => [V] });
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
function _isSlot$1(u) {
|
|
584
|
+
return typeof u == "function" || Object.prototype.toString.call(u) === "[object Object]" && !isVNode(u);
|
|
585
|
+
}
|
|
586
|
+
const AppAccount = /* @__PURE__ */ defineComponent({
|
|
587
|
+
name: "AppAccount",
|
|
588
|
+
props: {
|
|
589
|
+
username: String,
|
|
590
|
+
nickname: String,
|
|
591
|
+
head: String,
|
|
592
|
+
showLogoutButton: {
|
|
593
|
+
type: Boolean,
|
|
594
|
+
default: !0
|
|
595
|
+
},
|
|
596
|
+
showChangePwd: {
|
|
597
|
+
type: Boolean,
|
|
598
|
+
default: !0
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
emit: ["logout", "change-pwd"],
|
|
602
|
+
setup(u, { emit: B, slots: V }) {
|
|
603
|
+
let H = computed(() => /^[\u4E00-\u9FA5]+$/.test(u.nickname) ? u.nickname?.slice(u.nickname?.length > 3 ? 2 : 1) : u.nickname?.split(" ")[0]), { t: U } = useI18n(), W = createVNode(NIcon, { size: "28" }, { default: () => [createVNode("svg", {
|
|
604
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
605
|
+
width: "1em",
|
|
606
|
+
height: "1em",
|
|
607
|
+
viewBox: "-4 -4 32 32"
|
|
608
|
+
}, [createVNode("path", {
|
|
609
|
+
fill: "currentColor",
|
|
610
|
+
d: "M12 12q-1.65 0-2.825-1.175T8 8t1.175-2.825T12 4t2.825 1.175T16 8t-1.175 2.825T12 12m-8 6v-.8q0-.85.438-1.562T5.6 14.55q1.55-.775 3.15-1.162T12 13t3.25.388t3.15 1.162q.725.375 1.163 1.088T20 17.2v.8q0 .825-.587 1.413T18 20H6q-.825 0-1.412-.587T4 18"
|
|
611
|
+
}, null)])] }), G = createVNode("svg", {
|
|
612
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
613
|
+
width: "1em",
|
|
614
|
+
height: "1em",
|
|
615
|
+
viewBox: "0 0 24 24"
|
|
616
|
+
}, [createVNode("path", {
|
|
617
|
+
fill: "currentColor",
|
|
618
|
+
d: "M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2a9.99 9.99 0 0 1 8 4h-2.71a8 8 0 1 0 .001 12h2.71A9.99 9.99 0 0 1 12 22m7-6v-3h-8v-2h8V8l5 4z"
|
|
619
|
+
}, null)]);
|
|
620
|
+
return () => createVNode("div", { style: "display: flex; align-items: center" }, [createVNode(NPopover, { style: "padding: 4px" }, {
|
|
621
|
+
trigger: () => createVNode(NButton, {
|
|
622
|
+
quaternary: !0,
|
|
623
|
+
style: "--n-padding: 0 12px"
|
|
624
|
+
}, { default: () => [createVNode("div", { style: "display: flex; align-items: center; gap: 8px" }, [createVNode(NAvatar, {
|
|
625
|
+
key: u.head ? "head" : "no-head",
|
|
626
|
+
src: u.head,
|
|
627
|
+
round: !0,
|
|
628
|
+
size: "small",
|
|
629
|
+
radix: .78,
|
|
630
|
+
color: "var(--color-primary-hover)"
|
|
631
|
+
}, {
|
|
632
|
+
fallback: () => W,
|
|
633
|
+
placeholder: () => W,
|
|
634
|
+
default: u.head ? void 0 : () => H.value
|
|
635
|
+
}), createVNode("span", { style: "font-size: 14px" }, [u.username ?? ""])])] }),
|
|
636
|
+
default: () => {
|
|
637
|
+
let R = () => u.showChangePwd ? createVNode(NButton, {
|
|
638
|
+
quaternary: !0,
|
|
639
|
+
style: "justify-content: left",
|
|
640
|
+
onClick: () => B("change-pwd")
|
|
641
|
+
}, {
|
|
642
|
+
icon: () => createVNode(NIcon, null, { default: () => [createVNode("svg", {
|
|
643
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
644
|
+
width: "1em",
|
|
645
|
+
height: "1em",
|
|
646
|
+
viewBox: "0 0 32 32"
|
|
647
|
+
}, [createVNode("path", {
|
|
648
|
+
fill: "currentColor",
|
|
649
|
+
d: "M21 2a8.998 8.998 0 0 0-8.612 11.612L2 24v6h6l10.388-10.388A9 9 0 1 0 21 2m0 16a7 7 0 0 1-2.032-.302l-1.147-.348l-.847.847l-3.181 3.181L12.414 20L11 21.414l1.379 1.379l-1.586 1.586L9.414 23L8 24.414l1.379 1.379L7.172 28H4v-3.172l9.802-9.802l.848-.847l-.348-1.147A7 7 0 1 1 21 18"
|
|
650
|
+
}, null), createVNode("circle", {
|
|
651
|
+
cx: "22",
|
|
652
|
+
cy: "10",
|
|
653
|
+
r: "2",
|
|
654
|
+
fill: "currentColor"
|
|
655
|
+
}, null)])] }),
|
|
656
|
+
default: () => U("common.account.changePwd")
|
|
657
|
+
}) : void 0, H = () => u.showLogoutButton ? void 0 : createVNode(NButton, {
|
|
658
|
+
quaternary: !0,
|
|
659
|
+
style: "justify-content: left",
|
|
660
|
+
onClick: () => B("logout")
|
|
661
|
+
}, {
|
|
662
|
+
icon: () => createVNode(NIcon, null, _isSlot$1(G) ? G : { default: () => [G] }),
|
|
663
|
+
default: () => U("common.account.logout")
|
|
664
|
+
});
|
|
665
|
+
return V.dropdown ? V.dropdown({
|
|
666
|
+
pwd: R,
|
|
667
|
+
logout: H
|
|
668
|
+
}) : createVNode("div", { style: "display: flex; flex-direction: column" }, [
|
|
669
|
+
R(),
|
|
670
|
+
V.dropdownExtra?.(),
|
|
671
|
+
H()
|
|
672
|
+
]);
|
|
673
|
+
}
|
|
674
|
+
}), u.showLogoutButton ? withDirectives(createVNode(NButton, {
|
|
675
|
+
quaternary: !0,
|
|
676
|
+
style: "--n-padding: 0 12px",
|
|
677
|
+
onClick: () => u.username && B("logout")
|
|
678
|
+
}, { default: () => [V.logoutButton?.() ?? createVNode(NIcon, { size: "16" }, _isSlot$1(G) ? G : { default: () => [G] })] }), [[
|
|
679
|
+
vTooltip,
|
|
680
|
+
U("common.account.logout"),
|
|
681
|
+
void 0,
|
|
682
|
+
{ "bottom-end": !0 }
|
|
683
|
+
]]) : void 0]);
|
|
684
|
+
}
|
|
685
|
+
}), AppFullscreen = /* @__PURE__ */ defineComponent({
|
|
686
|
+
name: "AppFullscreen",
|
|
687
|
+
props: {},
|
|
688
|
+
emit: ["change"],
|
|
689
|
+
setup(u, { emit: R }) {
|
|
690
|
+
let { t: B } = useI18n(), { isFullscreen: V, toggle: H } = useFullscreen();
|
|
691
|
+
return () => withDirectives(createVNode(NButton, {
|
|
692
|
+
quaternary: !0,
|
|
693
|
+
style: "--n-padding: 0 12px",
|
|
694
|
+
onClick: () => {
|
|
695
|
+
H(), R("change", V.value);
|
|
696
|
+
}
|
|
697
|
+
}, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [V.value ? createVNode("svg", {
|
|
698
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
699
|
+
width: "1em",
|
|
700
|
+
height: "1em",
|
|
701
|
+
viewBox: "0 0 24 24"
|
|
702
|
+
}, [createVNode("path", {
|
|
703
|
+
fill: "none",
|
|
704
|
+
stroke: "currentColor",
|
|
705
|
+
"stroke-linecap": "round",
|
|
706
|
+
"stroke-linejoin": "round",
|
|
707
|
+
"stroke-width": "1.5",
|
|
708
|
+
d: "M8.345 3.75v2.095a2.5 2.5 0 0 1-2.5 2.5H3.75M8.345 20.25v-2.095a2.5 2.5 0 0 0-2.5-2.5H3.75M15.655 3.75v2.095a2.5 2.5 0 0 0 2.5 2.5h2.095M15.655 20.25v-2.095a2.5 2.5 0 0 1 2.5-2.5h2.095"
|
|
709
|
+
}, null)]) : createVNode("svg", {
|
|
710
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
711
|
+
width: "1em",
|
|
712
|
+
height: "1em",
|
|
713
|
+
viewBox: "0 0 24 24"
|
|
714
|
+
}, [createVNode("path", {
|
|
715
|
+
fill: "none",
|
|
716
|
+
stroke: "currentColor",
|
|
717
|
+
"stroke-linecap": "round",
|
|
718
|
+
"stroke-linejoin": "round",
|
|
719
|
+
"stroke-width": "1.5",
|
|
720
|
+
d: "M3.75 8.345V6.25a2.5 2.5 0 0 1 2.5-2.5h2.095M3.75 15.655v2.095a2.5 2.5 0 0 0 2.5 2.5h2.095M20.25 8.345V6.25a2.5 2.5 0 0 0-2.5-2.5h-2.095m4.595 11.905v2.095a2.5 2.5 0 0 1-2.5 2.5h-2.095"
|
|
721
|
+
}, null)])] })] }), [[
|
|
722
|
+
vTooltip,
|
|
723
|
+
V.value ? B("common.layout.screen.exitfull") : B("common.layout.screen.full"),
|
|
724
|
+
void 0,
|
|
725
|
+
{ bottom: !0 }
|
|
726
|
+
]]);
|
|
727
|
+
}
|
|
728
|
+
}), AppAppearance = /* @__PURE__ */ defineComponent({
|
|
729
|
+
name: "AppAppearance",
|
|
730
|
+
props: { mode: String },
|
|
731
|
+
emit: ["update:mode"],
|
|
732
|
+
setup(u, { emit: R }) {
|
|
733
|
+
let { t: B } = useI18n();
|
|
734
|
+
return () => withDirectives(createVNode(NButton, {
|
|
735
|
+
quaternary: !0,
|
|
736
|
+
style: "--n-padding: 0 12px",
|
|
737
|
+
onClick: () => {
|
|
738
|
+
R("update:mode", u.mode === "light" ? "dark" : u.mode === "dark" ? "auto" : "light");
|
|
739
|
+
}
|
|
740
|
+
}, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [u.mode === "light" ? createVNode("svg", {
|
|
741
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
742
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
743
|
+
role: "img",
|
|
744
|
+
width: "1em",
|
|
745
|
+
height: "1em",
|
|
746
|
+
viewBox: "0 0 24 24"
|
|
747
|
+
}, [createVNode("path", {
|
|
748
|
+
fill: "currentColor",
|
|
749
|
+
d: "M12 15q1.25 0 2.125-.875T15 12q0-1.25-.875-2.125T12 9q-1.25 0-2.125.875T9 12q0 1.25.875 2.125T12 15Zm0 2q-2.075 0-3.537-1.463Q7 14.075 7 12t1.463-3.538Q9.925 7 12 7t3.538 1.462Q17 9.925 17 12q0 2.075-1.462 3.537Q14.075 17 12 17ZM1 13v-2h4v2Zm18 0v-2h4v2Zm-8-8V1h2v4Zm0 18v-4h2v4ZM6.35 7.75L3.875 5.275l1.4-1.4L7.75 6.35Zm12.375 12.375L16.25 17.65l1.4-1.4l2.475 2.475ZM17.65 7.75l-1.4-1.4l2.475-2.475l1.4 1.4ZM5.275 20.125l-1.4-1.4L6.35 16.25l1.4 1.4ZM12 12Z"
|
|
750
|
+
}, null)]) : u.mode === "dark" ? createVNode("svg", {
|
|
751
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
752
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
753
|
+
role: "img",
|
|
754
|
+
width: "1em",
|
|
755
|
+
height: "1em",
|
|
756
|
+
viewBox: "0 0 24 24"
|
|
757
|
+
}, [createVNode("path", {
|
|
758
|
+
fill: "currentColor",
|
|
759
|
+
d: "M12 21q-3.75 0-6.375-2.625T3 12q0-3.75 2.625-6.375T12 3q.35 0 .688.025q.337.025.662.075q-1.025.725-1.637 1.887Q11.1 6.15 11.1 7.5q0 2.25 1.575 3.825Q14.25 12.9 16.5 12.9q1.375 0 2.525-.613q1.15-.612 1.875-1.637q.05.325.075.662Q21 11.65 21 12q0 3.75-2.625 6.375T12 21Zm0-2q2.2 0 3.95-1.212q1.75-1.213 2.55-3.163q-.5.125-1 .2q-.5.075-1 .075q-3.075 0-5.238-2.162Q9.1 10.575 9.1 7.5q0-.5.075-1t.2-1q-1.95.8-3.162 2.55Q5 9.8 5 12q0 2.9 2.05 4.95Q9.1 19 12 19Zm-.25-6.75Z"
|
|
760
|
+
}, null)]) : createVNode("svg", {
|
|
761
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
762
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
763
|
+
role: "img",
|
|
764
|
+
width: "1em",
|
|
765
|
+
height: "1em",
|
|
766
|
+
viewBox: "0 0 24 24"
|
|
767
|
+
}, [createVNode("path", {
|
|
768
|
+
fill: "currentColor",
|
|
769
|
+
d: "M11 19q1.35 0 2.513-.538q1.162-.537 1.987-1.487q-3.15-.2-5.325-2.488Q8 12.2 8 9q0-.325.025-.638q.025-.312.075-.612q-1.4.775-2.25 2.162Q5 11.3 5 13q0 2.5 1.75 4.25T11 19Zm0 2q-3.35 0-5.675-2.325Q3 16.35 3 13q0-3.35 2.325-5.675Q7.65 5 11 5q.125 0 .25.012q.125.013.25.013q-.725.8-1.113 1.812Q10 7.85 10 9q0 2.5 1.75 4.25T16 15q.8 0 1.525-.2q.725-.2 1.375-.55q-.45 2.875-2.662 4.812Q14.025 21 11 21Zm2.8-10L17 2h2l3.2 9h-1.9l-.7-2h-3.2l-.7 2Zm3.05-3.35h2.3L18 4Z"
|
|
770
|
+
}, null)])] })] }), [[
|
|
771
|
+
vTooltip,
|
|
772
|
+
u.mode === "light" ? B("common.layout.mode.light") : u.mode === "dark" ? B("common.layout.mode.dark") : B("common.layout.mode.auto"),
|
|
773
|
+
void 0,
|
|
774
|
+
{ bottom: !0 }
|
|
775
|
+
]]);
|
|
776
|
+
}
|
|
777
|
+
}), AppLanguage = /* @__PURE__ */ defineComponent({
|
|
778
|
+
name: "AppLanguage",
|
|
779
|
+
props: {
|
|
780
|
+
lang: String,
|
|
781
|
+
supports: Array
|
|
782
|
+
},
|
|
783
|
+
emit: ["update:lang"],
|
|
784
|
+
setup(u, { emit: R }) {
|
|
785
|
+
return () => createVNode(NDropdown, {
|
|
786
|
+
options: u.supports,
|
|
787
|
+
keyField: "value",
|
|
788
|
+
showArrow: !0,
|
|
789
|
+
onSelect: (u) => R("update:lang", u)
|
|
790
|
+
}, { default: () => [createVNode(NButton, {
|
|
791
|
+
quaternary: !0,
|
|
792
|
+
style: "--n-padding: 0 12px"
|
|
793
|
+
}, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [createVNode("svg", {
|
|
794
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
795
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
796
|
+
role: "img",
|
|
797
|
+
width: "1em",
|
|
798
|
+
height: "1em",
|
|
799
|
+
viewBox: "0 0 24 24"
|
|
800
|
+
}, [createVNode("g", {
|
|
801
|
+
fill: "none",
|
|
802
|
+
stroke: "currentColor",
|
|
803
|
+
"stroke-linecap": "round",
|
|
804
|
+
"stroke-linejoin": "round",
|
|
805
|
+
"stroke-width": "1.5"
|
|
806
|
+
}, [createVNode("path", { d: "M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2S2 6.477 2 12Z" }, null), createVNode("path", { d: "M13 2.05S16 6 16 12c0 6-3 9.95-3 9.95m-2 0S8 18 8 12c0-6 3-9.95 3-9.95M2.63 15.5h18.74m-18.74-7h18.74" }, null)])])] })] })] });
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
function _isSlot(u) {
|
|
810
|
+
return typeof u == "function" || Object.prototype.toString.call(u) === "[object Object]" && !isVNode(u);
|
|
811
|
+
}
|
|
812
|
+
const AppNotification = /* @__PURE__ */ defineComponent({
|
|
813
|
+
name: "AppNotification",
|
|
814
|
+
inheritAttrs: !1,
|
|
815
|
+
props: {
|
|
816
|
+
getUnreadCount: Function,
|
|
817
|
+
getPage: Function,
|
|
818
|
+
markRead: Function,
|
|
819
|
+
markDelete: Function,
|
|
820
|
+
interval: {
|
|
821
|
+
type: Number,
|
|
822
|
+
default: 3e4
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
setup(R, { slots: B, attrs: V }) {
|
|
826
|
+
let { t: H } = useI18n(), U = ref(!1), G = ref("unread"), K = reactive({
|
|
827
|
+
page: 1,
|
|
828
|
+
size: 10,
|
|
829
|
+
loading: !1,
|
|
830
|
+
records: [],
|
|
831
|
+
total: 0,
|
|
832
|
+
unread: 0
|
|
833
|
+
}), { sync: J, post: Y } = useAtomicBroadcast({
|
|
834
|
+
channel: "__ithinkdt_mc_shared_channel",
|
|
835
|
+
onMsg: (u) => {
|
|
836
|
+
K.unread = u;
|
|
837
|
+
},
|
|
838
|
+
getMsg: () => (U.value && (K.loading = !0, Promise.resolve(R.getPage?.(G.value, K.page, K.size) ?? []).then(({ records: u, total: R }) => {
|
|
839
|
+
K.records = u, G.value === "unread" ? (K.unread = R, Y(R)) : K.total = R;
|
|
840
|
+
}).finally(() => {
|
|
841
|
+
K.loading = !1;
|
|
842
|
+
})), R.getUnreadCount?.() ?? 0),
|
|
843
|
+
timeout: () => R.interval,
|
|
844
|
+
immediate: !0
|
|
845
|
+
});
|
|
846
|
+
return () => {
|
|
847
|
+
let q = withDirectives(createVNode(NButton, mergeProps(V, {
|
|
848
|
+
quaternary: !0,
|
|
849
|
+
style: "--n-padding: 0 12px",
|
|
850
|
+
onClick: () => {
|
|
851
|
+
U.value = !0, G.value = K.unread > 0 ? "unread" : "all", setTimeout(J, 300);
|
|
852
|
+
}
|
|
853
|
+
}), { default: () => [B.icon ? B.icon() : createVNode(NBadge, {
|
|
854
|
+
show: K.unread > 0,
|
|
855
|
+
dot: !0,
|
|
856
|
+
offset: [-2, 5],
|
|
857
|
+
processing: !0
|
|
858
|
+
}, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [createVNode("svg", {
|
|
859
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
860
|
+
width: "1em",
|
|
861
|
+
height: "1em",
|
|
862
|
+
viewBox: "0 0 24 24"
|
|
863
|
+
}, [createVNode("g", {
|
|
864
|
+
fill: "none",
|
|
865
|
+
stroke: "currentColor",
|
|
866
|
+
"stroke-linecap": "round",
|
|
867
|
+
"stroke-linejoin": "round",
|
|
868
|
+
"stroke-width": "1.5",
|
|
869
|
+
color: "currentColor"
|
|
870
|
+
}, [createVNode("path", { d: "M2.53 14.77c-.213 1.394.738 2.361 1.902 2.843c4.463 1.85 10.673 1.85 15.136 0c1.164-.482 2.115-1.45 1.902-2.843c-.13-.857-.777-1.57-1.256-2.267c-.627-.924-.689-1.931-.69-3.003C19.525 5.358 16.157 2 12 2S4.475 5.358 4.475 9.5c0 1.072-.062 2.08-.69 3.003c-.478.697-1.124 1.41-1.255 2.267" }, null), createVNode("path", { d: "M8 19c.458 1.725 2.076 3 4 3c1.925 0 3.541-1.275 4-3" }, null)])])] })] })] }), [[
|
|
871
|
+
vTooltip,
|
|
872
|
+
H("common.notification.tip", { count: K.unread }),
|
|
873
|
+
void 0,
|
|
874
|
+
{ bottom: !0 }
|
|
875
|
+
]]), Y = () => {
|
|
876
|
+
let u, R;
|
|
877
|
+
return createVNode("div", { style: "display: flex; align-items: baseline; gap: 20px" }, [
|
|
878
|
+
createVNode("div", { style: "padding-right: 12px" }, [H("common.notification.title")]),
|
|
879
|
+
createVNode(NButton, {
|
|
880
|
+
text: !0,
|
|
881
|
+
type: G.value === "all" ? "primary" : "default",
|
|
882
|
+
onClick: () => {
|
|
883
|
+
G.value = "all", J();
|
|
884
|
+
}
|
|
885
|
+
}, _isSlot(u = H("common.notification.all")) ? u : { default: () => [u] }),
|
|
886
|
+
createVNode(NButton, {
|
|
887
|
+
text: !0,
|
|
888
|
+
type: G.value === "unread" ? "primary" : "default",
|
|
889
|
+
onClick: () => {
|
|
890
|
+
G.value = "unread", J();
|
|
891
|
+
}
|
|
892
|
+
}, _isSlot(R = H("common.notification.unread", { count: K.unread > 99 ? "99+" : K.unread.toString() })) ? R : { default: () => [R] })
|
|
893
|
+
]);
|
|
894
|
+
}, X = (u) => createVNode(NListItem, {
|
|
895
|
+
key: u.key,
|
|
896
|
+
onClick: () => {
|
|
897
|
+
u.status === "unread" && (R.markRead?.([u.key]).then(() => {
|
|
898
|
+
u.status = "read";
|
|
899
|
+
}), K.unread--), u.link && window.open(u.link, "_target");
|
|
900
|
+
}
|
|
901
|
+
}, { default: () => [createVNode(NThing, {
|
|
902
|
+
bordered: !1,
|
|
903
|
+
closable: !0,
|
|
904
|
+
contentIndented: !0,
|
|
905
|
+
size: "small",
|
|
906
|
+
onMouseenter: () => u.hover = !0,
|
|
907
|
+
onMouseleave: () => u.hover = !1,
|
|
908
|
+
style: "padding: 0 4px"
|
|
909
|
+
}, {
|
|
910
|
+
avatar: () => createVNode(NIcon, {
|
|
911
|
+
size: 22,
|
|
912
|
+
color: u.status === "unread" ? "var(--color-primary)" : void 0
|
|
913
|
+
}, { default: () => [createVNode("svg", {
|
|
914
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
915
|
+
width: "1em",
|
|
916
|
+
height: "1em",
|
|
917
|
+
viewBox: "0 0 24 24"
|
|
918
|
+
}, [createVNode("path", {
|
|
919
|
+
fill: "currentColor",
|
|
920
|
+
d: "M12.3 7.29c.2-.18.44-.29.7-.29c.27 0 .5.11.71.29c.19.21.29.45.29.71c0 .27-.1.5-.29.71c-.21.19-.44.29-.71.29c-.26 0-.5-.1-.7-.29c-.19-.21-.3-.44-.3-.71c0-.26.11-.5.3-.71m-2.5 4.68s2.17-1.72 2.96-1.79c.74-.06.59.79.52 1.23l-.01.06c-.14.53-.31 1.17-.48 1.78c-.38 1.39-.75 2.75-.66 3c.1.34.72-.09 1.17-.39c.06-.04.11-.08.16-.11c0 0 .08-.08.16.03c.02.03.04.06.06.08c.09.14.14.19.02.27l-.04.02c-.22.15-1.16.81-1.54 1.05c-.41.27-1.98 1.17-1.74-.58c.21-1.23.49-2.29.71-3.12c.41-1.5.59-2.18-.33-1.59c-.37.22-.59.36-.72.45c-.11.08-.12.08-.19-.05l-.03-.06l-.05-.08c-.07-.1-.07-.11.03-.2M22 12c0 5.5-4.5 10-10 10S2 17.5 2 12S6.5 2 12 2s10 4.5 10 10m-2 0c0-4.42-3.58-8-8-8s-8 3.58-8 8s3.58 8 8 8s8-3.58 8-8"
|
|
921
|
+
}, null)])] }),
|
|
922
|
+
header: () => u.title,
|
|
923
|
+
"header-extra": () => {
|
|
924
|
+
let B, V;
|
|
925
|
+
return u.hover ? createVNode("div", {
|
|
926
|
+
style: "display: flex; justify-content: end; gap: 12px",
|
|
927
|
+
onClick: (u) => {
|
|
928
|
+
u.preventDefault(), u.stopPropagation();
|
|
929
|
+
}
|
|
930
|
+
}, [u.status === "unread" ? createVNode(NButton, {
|
|
931
|
+
text: !0,
|
|
932
|
+
type: "primary",
|
|
933
|
+
onClick: () => {
|
|
934
|
+
R.markRead?.([u.key]).then(() => {
|
|
935
|
+
u.status = "read", K.unread--;
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
}, _isSlot(B = H("common.notification.markRead")) ? B : { default: () => [B] }) : void 0, createVNode(NButton, {
|
|
939
|
+
text: !0,
|
|
940
|
+
type: "error",
|
|
941
|
+
onClick: () => {
|
|
942
|
+
K.records === 1 ? (K.records = [], J()) : K.records.splice(K.records.findIndex((R) => R.key == u.key), 1), R.markDelete?.([u.key]);
|
|
943
|
+
}
|
|
944
|
+
}, _isSlot(V = H("common.notification.markDelete")) ? V : { default: () => [V] })]) : void 0;
|
|
945
|
+
},
|
|
946
|
+
default: u.content,
|
|
947
|
+
footer: () => createVNode("span", { style: "color: gray" }, [u.hover ? format(u.date, H("common.notification.time")) : H("common.timeago", { time: u.date })])
|
|
948
|
+
})] }), Z = () => {
|
|
949
|
+
let u;
|
|
950
|
+
return withDirectives(K.records.length > 0 ? createVNode(NList, {
|
|
951
|
+
clickable: !0,
|
|
952
|
+
hoverable: !0,
|
|
953
|
+
style: "min-height: 50vh"
|
|
954
|
+
}, _isSlot(u = K.records.map((u) => X(u))) ? u : { default: () => [u] }) : createVNode(NEmpty, { style: "margin-top: 30vh" }, null), [[vSpin, K.loading]]);
|
|
955
|
+
}, Q = () => createVNode("div", { style: "display: flex; justify-content: space-between; width: 100%" }, [G.value === "unread" ? createVNode(NButton, {
|
|
956
|
+
text: !0,
|
|
957
|
+
type: "primary",
|
|
958
|
+
disabled: K.records.length === 0,
|
|
959
|
+
onClick: () => {
|
|
960
|
+
let u = K.records.filter((u) => u.status === "unread").map((u) => u.key);
|
|
961
|
+
R.markRead(u).then(() => {
|
|
962
|
+
for (; K.unread - u.length <= K.size * (K.page - 1);) K.page--;
|
|
963
|
+
J();
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
}, {
|
|
967
|
+
icon: () => createVNode(NIcon, { size: "20" }, { default: () => [createVNode("svg", {
|
|
968
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
969
|
+
width: "1em",
|
|
970
|
+
height: "1em",
|
|
971
|
+
viewBox: "0 0 24 24"
|
|
972
|
+
}, [createVNode("path", {
|
|
973
|
+
fill: "currentColor",
|
|
974
|
+
d: "M.41 13.41L6 19l1.41-1.42L1.83 12m20.41-6.42L11.66 16.17L7.5 12l-1.43 1.41L11.66 19l12-12M18 7l-1.41-1.42l-6.35 6.35l1.42 1.41z"
|
|
975
|
+
}, null)])] }),
|
|
976
|
+
default: () => H("common.notification.markPageRead")
|
|
977
|
+
}) : createVNode("span", null, null), createVNode(NPagination, {
|
|
978
|
+
simple: !0,
|
|
979
|
+
pageSize: K.size,
|
|
980
|
+
page: K.page,
|
|
981
|
+
itemCount: G.value === "unread" ? K.unread : K.total,
|
|
982
|
+
onUpdatePage: (u) => {
|
|
983
|
+
K.page = u, J();
|
|
984
|
+
}
|
|
985
|
+
}, null)]);
|
|
986
|
+
return createVNode(Fragment, null, [q, createVNode(NDrawer, {
|
|
987
|
+
show: U.value,
|
|
988
|
+
"onUpdate:show": (u) => U.value = u,
|
|
989
|
+
showMask: !1,
|
|
990
|
+
width: 400
|
|
991
|
+
}, { default: () => [createVNode(NDrawerContent, {
|
|
992
|
+
title: H("common.notification.title"),
|
|
993
|
+
closable: !0,
|
|
994
|
+
nativeScrollbar: !1,
|
|
995
|
+
bodyContentStyle: { padding: "0" }
|
|
996
|
+
}, {
|
|
997
|
+
header: Y,
|
|
998
|
+
default: Z,
|
|
999
|
+
footer: Q
|
|
1000
|
+
})] })]);
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
function useCtxMenu(u, B, V) {
|
|
1005
|
+
let { t: H } = useI18n(), U = reactive({
|
|
1006
|
+
visible: !1,
|
|
1007
|
+
x: 0,
|
|
1008
|
+
y: 0
|
|
1009
|
+
}), W = async (u, R) => {
|
|
1010
|
+
u.preventDefault(), u.stopPropagation(), !(U.visible && U.tab === R) && (U.tab = R, U.visible && (U.visible = !1, await promiseTimeout(130)), U.visible = !0, U.x = u.clientX, U.y = u.clientY);
|
|
1011
|
+
}, G = async () => {
|
|
1012
|
+
requestIdleCallback(() => {
|
|
1013
|
+
U.visible = !1;
|
|
1014
|
+
}, { timeout: 30 });
|
|
1015
|
+
}, K = useRouter();
|
|
1016
|
+
return {
|
|
1017
|
+
ctx: U,
|
|
1018
|
+
onCtx: W,
|
|
1019
|
+
onClickoutside: G,
|
|
1020
|
+
options: computed(() => [
|
|
1021
|
+
{
|
|
1022
|
+
key: "reload",
|
|
1023
|
+
label: H("common.layout.tabs.reloadTab"),
|
|
1024
|
+
disabled: U.tab && U.tab.key !== B.value,
|
|
1025
|
+
icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
|
|
1026
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1027
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
1028
|
+
role: "img",
|
|
1029
|
+
width: "1em",
|
|
1030
|
+
height: "1em",
|
|
1031
|
+
viewBox: "0 0 24 24"
|
|
1032
|
+
}, [createVNode("path", {
|
|
1033
|
+
fill: "currentColor",
|
|
1034
|
+
d: "M17.65 6.35A7.958 7.958 0 0 0 12 4a8 8 0 0 0-8 8a8 8 0 0 0 8 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18a6 6 0 0 1-6-6a6 6 0 0 1 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35Z"
|
|
1035
|
+
}, null)])] })
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
key: "fullTab",
|
|
1039
|
+
label: H("common.layout.tabs.fullTab"),
|
|
1040
|
+
icon: () => createVNode(NIcon, { size: 16 }, { default: () => [createVNode("svg", {
|
|
1041
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1042
|
+
width: "1em",
|
|
1043
|
+
height: "1em",
|
|
1044
|
+
viewBox: "0 0 24 24"
|
|
1045
|
+
}, [createVNode("path", {
|
|
1046
|
+
fill: "currentColor",
|
|
1047
|
+
"fill-rule": "evenodd",
|
|
1048
|
+
d: "M18.29 2.89c-1.028-.138-2.383-.14-4.29-.14a.75.75 0 0 1 0-1.5h.056c1.838 0 3.294 0 4.433.153c1.172.158 2.121.49 2.87 1.238c.748.749 1.08 1.698 1.238 2.87c.153 1.14.153 2.595.153 4.433V10a.75.75 0 0 1-1.5 0c0-1.907-.002-3.261-.14-4.29c-.135-1.005-.389-1.585-.812-2.008s-1.003-.677-2.009-.812M2 13.25a.75.75 0 0 1 .75.75c0 1.907.002 3.262.14 4.29c.135 1.005.389 1.585.812 2.008s1.003.677 2.009.812c1.028.138 2.382.14 4.289.14a.75.75 0 0 1 0 1.5h-.056c-1.838 0-3.294 0-4.433-.153c-1.172-.158-2.121-.49-2.87-1.238c-.748-.749-1.08-1.698-1.238-2.87c-.153-1.14-.153-2.595-.153-4.433V14a.75.75 0 0 1 .75-.75",
|
|
1049
|
+
"clip-rule": "evenodd"
|
|
1050
|
+
}, null), createVNode("path", {
|
|
1051
|
+
fill: "currentColor",
|
|
1052
|
+
d: "M9.944 1.25H10a.75.75 0 0 1 0 1.5c-1.907 0-3.261.002-4.29.14c-1.005.135-1.585.389-2.008.812S3.025 4.705 2.89 5.71c-.138 1.029-.14 2.383-.14 4.29a.75.75 0 0 1-1.5 0v-.056c0-1.838 0-3.294.153-4.433c.158-1.172.49-2.121 1.238-2.87c.749-.748 1.698-1.08 2.87-1.238c1.14-.153 2.595-.153 4.433-.153M22 13.25a.75.75 0 0 1 .75.75v.056c0 1.838 0 3.294-.153 4.433c-.158 1.172-.49 2.121-1.238 2.87c-.749.748-1.698 1.08-2.87 1.238c-1.14.153-2.595.153-4.433.153H14a.75.75 0 0 1 0-1.5c1.907 0 3.262-.002 4.29-.14c1.005-.135 1.585-.389 2.008-.812s.677-1.003.812-2.009c.138-1.027.14-2.382.14-4.289a.75.75 0 0 1 .75-.75",
|
|
1053
|
+
opacity: ".5"
|
|
1054
|
+
}, null)])] })
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
key: "open",
|
|
1058
|
+
label: H("common.layout.tabs.openTabBlank"),
|
|
1059
|
+
disabled: U.tab?.key !== B.value,
|
|
1060
|
+
icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
|
|
1061
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1062
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
1063
|
+
role: "img",
|
|
1064
|
+
width: "1em",
|
|
1065
|
+
height: "1em",
|
|
1066
|
+
viewBox: "0 0 15 15"
|
|
1067
|
+
}, [createVNode("path", {
|
|
1068
|
+
fill: "currentColor",
|
|
1069
|
+
"clip-rule": "evenodd",
|
|
1070
|
+
"fill-rule": "evenodd",
|
|
1071
|
+
d: "M12 13a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v3.5a.5.5 0 0 0 1 0V3h9v9H8.5a.5.5 0 0 0 0 1H12ZM9 6.5v3a.5.5 0 0 1-1 0V7.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 7H5.5a.5.5 0 0 1 0-1h3a.498.498 0 0 1 .5.497"
|
|
1072
|
+
}, null)])] })
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
key: "closeAll",
|
|
1076
|
+
label: H("common.layout.tabs.closeAllTabs"),
|
|
1077
|
+
icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
|
|
1078
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1079
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
1080
|
+
role: "img",
|
|
1081
|
+
width: "1em",
|
|
1082
|
+
height: "1em",
|
|
1083
|
+
viewBox: "0 0 24 24"
|
|
1084
|
+
}, [createVNode("path", {
|
|
1085
|
+
fill: "currentColor",
|
|
1086
|
+
d: "M6.4 19L5 17.6l5.6-5.6L5 6.4L6.4 5l5.6 5.6L17.6 5L19 6.4L13.4 12l5.6 5.6l-1.4 1.4l-5.6-5.6L6.4 19Z"
|
|
1087
|
+
}, null)])] })
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
key: "closeLeft",
|
|
1091
|
+
label: H("common.layout.tabs.closeLeftTabs"),
|
|
1092
|
+
disabled: !U.tab,
|
|
1093
|
+
icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
|
|
1094
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1095
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
1096
|
+
role: "img",
|
|
1097
|
+
width: "1em",
|
|
1098
|
+
height: "1em",
|
|
1099
|
+
viewBox: "0 0 24 24"
|
|
1100
|
+
}, [createVNode("path", {
|
|
1101
|
+
fill: "currentColor",
|
|
1102
|
+
d: "M11 16v-3h10v-2H11V8l-4 4l4 4m-8 4h2V4H3v16Z"
|
|
1103
|
+
}, null)])] })
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
key: "closeRight",
|
|
1107
|
+
label: H("common.layout.tabs.closeRightTabs"),
|
|
1108
|
+
disabled: !U.tab,
|
|
1109
|
+
icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
|
|
1110
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1111
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
1112
|
+
role: "img",
|
|
1113
|
+
width: "1em",
|
|
1114
|
+
height: "1em",
|
|
1115
|
+
viewBox: "0 0 24 24"
|
|
1116
|
+
}, [createVNode("path", {
|
|
1117
|
+
fill: "currentColor",
|
|
1118
|
+
d: "M13 8v3H3v2h10v3l4-4l-4-4m6 12h2V4h-2v16Z"
|
|
1119
|
+
}, null)])] })
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
key: "closeOther",
|
|
1123
|
+
label: H("common.layout.tabs.closeOtherTabs"),
|
|
1124
|
+
disabled: !U.tab,
|
|
1125
|
+
icon: () => createVNode(NIcon, { size: 20 }, { default: () => [" ", createVNode("svg", {
|
|
1126
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1127
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
1128
|
+
role: "img",
|
|
1129
|
+
width: "1em",
|
|
1130
|
+
height: "1em",
|
|
1131
|
+
viewBox: "0 0 1024 1024"
|
|
1132
|
+
}, [createVNode("path", {
|
|
1133
|
+
fill: "currentColor",
|
|
1134
|
+
d: "M180 176h-60c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8zm724 0h-60c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8zM785.3 504.3L657.7 403.6a7.23 7.23 0 0 0-11.7 5.7V476H378v-62.8c0-6-7-9.4-11.7-5.7L238.7 508.3a7.14 7.14 0 0 0 0 11.3l127.5 100.8c4.7 3.7 11.7.4 11.7-5.7V548h268v62.8c0 6 7 9.4 11.7 5.7l127.5-100.8c3.8-2.9 3.8-8.5.2-11.4z"
|
|
1135
|
+
}, null)])] })
|
|
1136
|
+
}
|
|
1137
|
+
]),
|
|
1138
|
+
onSelect: async (R) => {
|
|
1139
|
+
U.visible = !1;
|
|
1140
|
+
let z = [...u.value];
|
|
1141
|
+
if (R === "closeAll") {
|
|
1142
|
+
await K.push("/");
|
|
1143
|
+
for (let u of z) u.key !== B.value && u.close(!1);
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
if (R === "fullTab") {
|
|
1147
|
+
V();
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
if (!U.tab) {
|
|
1151
|
+
let u = z.find((u) => u.key === B.value);
|
|
1152
|
+
switch (R) {
|
|
1153
|
+
case "open":
|
|
1154
|
+
window.open(u.href, "_blank");
|
|
1155
|
+
break;
|
|
1156
|
+
case "reload":
|
|
1157
|
+
u.reloading ||= (u.reloading = !0, await promiseTimeout(220), !1);
|
|
1158
|
+
break;
|
|
1159
|
+
}
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
switch (R) {
|
|
1163
|
+
case "open":
|
|
1164
|
+
window.open(U.tab.href, "_blank");
|
|
1165
|
+
break;
|
|
1166
|
+
case "reload":
|
|
1167
|
+
U.tab.reloading || (U.tab.reloading = !0, await promiseTimeout(220), U.tab.reloading = !1);
|
|
1168
|
+
break;
|
|
1169
|
+
case "close":
|
|
1170
|
+
U.tab?.close();
|
|
1171
|
+
break;
|
|
1172
|
+
case "closeOther":
|
|
1173
|
+
B.value !== U.tab.key && await K.push(U.tab.fullPath);
|
|
1174
|
+
for (let u of z) u.key !== U.tab.key && u.close(!1);
|
|
1175
|
+
break;
|
|
1176
|
+
case "closeLeft":
|
|
1177
|
+
B.value !== U.tab.key && await K.push(U.tab.fullPath);
|
|
1178
|
+
for (let R of u.value.slice(0, z.indexOf(U.tab))) R.close(!1);
|
|
1179
|
+
break;
|
|
1180
|
+
case "closeRight":
|
|
1181
|
+
B.value !== U.tab.key && await K.push(U.tab.fullPath);
|
|
1182
|
+
for (let R of u.value.slice(z.indexOf(U.tab) + 1)) R.close(!1);
|
|
1183
|
+
break;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1188
|
+
function useContentScroll(u, R, z) {
|
|
1189
|
+
function B(z) {
|
|
1190
|
+
if (z === -1 || !R.value?.children.length) return;
|
|
1191
|
+
let B = R.value.children[z];
|
|
1192
|
+
u.value.scrollTo({
|
|
1193
|
+
behavior: "smooth",
|
|
1194
|
+
left: Math.max(0, R.value.offsetLeft + B.offsetLeft - u.value.clientWidth / 2 + B.clientWidth / 2 + 10)
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
return watchDebounced(useElementHover(u), (u) => {
|
|
1198
|
+
u || B(z.value);
|
|
1199
|
+
}, { debounce: 333 }), watch(z, B, { flush: "post" }), useEventListener(u, "wheel", (R) => {
|
|
1200
|
+
R.deltaMode === WheelEvent.DOM_DELTA_PIXEL && (R.preventDefault(), u.value.scrollBy({ left: R.deltaY }));
|
|
1201
|
+
}, { passive: !1 }), {
|
|
1202
|
+
el: u,
|
|
1203
|
+
content: R
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
var IBg = (u) => createVNode("svg", u, [
|
|
1207
|
+
createVNode("defs", null, [
|
|
1208
|
+
createVNode("symbol", {
|
|
1209
|
+
id: "geometry-left",
|
|
1210
|
+
viewBox: "0 0 214 36"
|
|
1211
|
+
}, [createVNode("path", { d: "M17 0h197v36H0v-2c4.5 0 9-3.5 9-8V8c0-4.5 3.5-8 8-8z" }, null)]),
|
|
1212
|
+
createVNode("symbol", {
|
|
1213
|
+
id: "geometry-right",
|
|
1214
|
+
viewBox: "0 0 214 36"
|
|
1215
|
+
}, [createVNode("use", { "xlink:href": "#geometry-left" }, null)]),
|
|
1216
|
+
createVNode("clipPath", null, [createVNode("rect", {
|
|
1217
|
+
width: "100%",
|
|
1218
|
+
height: "100%",
|
|
1219
|
+
x: "0"
|
|
1220
|
+
}, null)])
|
|
1221
|
+
]),
|
|
1222
|
+
createVNode("svg", {
|
|
1223
|
+
width: "50%",
|
|
1224
|
+
height: "100%"
|
|
1225
|
+
}, [createVNode("use", {
|
|
1226
|
+
"xlink:href": "#geometry-left",
|
|
1227
|
+
width: "214",
|
|
1228
|
+
height: "36",
|
|
1229
|
+
fill: "currentColor"
|
|
1230
|
+
}, null)]),
|
|
1231
|
+
createVNode("g", { transform: "scale(-1, 1)" }, [createVNode("svg", {
|
|
1232
|
+
width: "50%",
|
|
1233
|
+
height: "100%",
|
|
1234
|
+
x: "-100%",
|
|
1235
|
+
y: "0"
|
|
1236
|
+
}, [createVNode("use", {
|
|
1237
|
+
"xlink:href": "#geometry-right",
|
|
1238
|
+
width: "214",
|
|
1239
|
+
height: "36",
|
|
1240
|
+
fill: "currentColor"
|
|
1241
|
+
}, null)])])
|
|
1242
|
+
]), AppTab = /* @__PURE__ */ defineComponent({
|
|
1243
|
+
name: "AppTab",
|
|
1244
|
+
props: {
|
|
1245
|
+
path: String,
|
|
1246
|
+
isCurrent: Boolean,
|
|
1247
|
+
isLast: Boolean,
|
|
1248
|
+
closable: Boolean,
|
|
1249
|
+
dark: Boolean
|
|
1250
|
+
},
|
|
1251
|
+
emits: ["close"],
|
|
1252
|
+
setup(u, { emit: B, slots: V }) {
|
|
1253
|
+
let H = ref$1(), U = useElementHover(H), W = ref$1(), G = ref$1(), { width: K } = useElementSize(G);
|
|
1254
|
+
watch(K, async () => {
|
|
1255
|
+
await promiseTimeout(1), W.value.style.width = G.value.scrollWidth + "px";
|
|
1256
|
+
});
|
|
1257
|
+
let q = useThemeVars(), Y = computed(() => ({
|
|
1258
|
+
fontSize: "14px",
|
|
1259
|
+
color: u.isCurrent ? q.value.primaryColor : q.value.textColor3,
|
|
1260
|
+
maxWidth: "355px",
|
|
1261
|
+
overflow: "hidden"
|
|
1262
|
+
})), X = computed(() => ({
|
|
1263
|
+
width: "calc(100% + 27px)",
|
|
1264
|
+
height: "100%",
|
|
1265
|
+
position: "absolute",
|
|
1266
|
+
top: "0",
|
|
1267
|
+
left: "-14px",
|
|
1268
|
+
zIndex: u.isCurrent ? -1 : -2,
|
|
1269
|
+
color: u.isCurrent ? getOpaqueColor(q.value.primaryColor, u.dark ? .3 : .12, u.dark ? "#000" : "#fff") : U.value ? q.value.borderColor : "transparent"
|
|
1270
|
+
}));
|
|
1271
|
+
return () => createVNode("div", {
|
|
1272
|
+
ref: H,
|
|
1273
|
+
style: "position: relative; padding: 2px 10px 5px; cursor: pointer"
|
|
1274
|
+
}, [
|
|
1275
|
+
createVNode("div", {
|
|
1276
|
+
ref: W,
|
|
1277
|
+
style: "transition: width 300ms; overflow: hidden"
|
|
1278
|
+
}, [createVNode("div", {
|
|
1279
|
+
ref: G,
|
|
1280
|
+
style: "display: flex; align-items: center; gap: 4px; width: fit-content"
|
|
1281
|
+
}, [createVNode("span", { style: Y.value }, [V.default?.()]), u.closable !== !1 && (u.isCurrent || U.value) ? createVNode("span", { style: "line-height: 0; display: inline-block; text-align: right; padding-top: 2px" }, [createVNode(NButton, {
|
|
1282
|
+
text: !0,
|
|
1283
|
+
onClick: (u) => {
|
|
1284
|
+
u.stopPropagation(), B("close");
|
|
1285
|
+
}
|
|
1286
|
+
}, { default: () => [createVNode(NIcon, { size: 18 }, { default: () => [createVNode("svg", {
|
|
1287
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1288
|
+
width: "1em",
|
|
1289
|
+
height: "1em",
|
|
1290
|
+
viewBox: "0 0 24 24"
|
|
1291
|
+
}, [createVNode("path", {
|
|
1292
|
+
fill: "currentColor",
|
|
1293
|
+
d: "m6.4 18.308l-.708-.708l5.6-5.6l-5.6-5.6l.708-.708l5.6 5.6l5.6-5.6l.708.708l-5.6 5.6l5.6 5.6l-.708.708l-5.6-5.6z"
|
|
1294
|
+
}, null)])] })] })]) : void 0])]),
|
|
1295
|
+
createVNode("span", { style: "height: 50%; width: 1px; background: #aaa; display: inline-block; position: absolute; top: 20%; right: -4px; z-index: -3" }, null),
|
|
1296
|
+
createVNode(IBg, { style: X.value }, null)
|
|
1297
|
+
]);
|
|
1298
|
+
}
|
|
1299
|
+
});
|
|
1300
|
+
const AppMultiTabs = /* @__PURE__ */ defineComponent({
|
|
1301
|
+
name: "AppMultiTabs",
|
|
1302
|
+
props: {
|
|
1303
|
+
fullTab: Boolean,
|
|
1304
|
+
showBreadcrumb: Boolean,
|
|
1305
|
+
tabs: Array,
|
|
1306
|
+
current: Object,
|
|
1307
|
+
dark: Boolean
|
|
1308
|
+
},
|
|
1309
|
+
emits: ["update:fullTab"],
|
|
1310
|
+
setup(u, { emit: B, slots: V }) {
|
|
1311
|
+
let H = getCtx();
|
|
1312
|
+
H.hasMultiTab = !0;
|
|
1313
|
+
let U = useRouter(), { ctx: W, onCtx: G, onClickoutside: K, options: q, onSelect: Y } = useCtxMenu(toRef$1(u, "tabs"), computed(() => u.current?.key), () => B("update:fullTab", !u.fullTab)), X = computed(() => u.current ? u.tabs.findIndex((R) => R.key === u.current?.key) : -1), Q = ref$1(), $ = ref$1();
|
|
1314
|
+
return useContentScroll(Q, $, X), () => createVNode("div", { style: "width: 100%; height: 100%; overflow: hidden; display: flex; justify-content: space-between" }, [createVNode("div", {
|
|
1315
|
+
ref: Q,
|
|
1316
|
+
style: "flex: 1 1 100%; height: 100%; display: flex; overflow: hidden; align-items: center; position: relative"
|
|
1317
|
+
}, [
|
|
1318
|
+
createVNode("div", { style: "height: 100%; flex: 0 0 16px; z-index: 1; position: sticky; left: 0; backdrop-filter: opacity(0.9) blur(5px)" }, null),
|
|
1319
|
+
createVNode("div", {
|
|
1320
|
+
ref: $,
|
|
1321
|
+
style: "padding-inline: 12px; flex: 1 1 auto; display: flex; align-items: end; gap: 8px; height: 100%",
|
|
1322
|
+
onContextmenu: (u) => G(u)
|
|
1323
|
+
}, [u.tabs.map((R, B, H) => {
|
|
1324
|
+
let W = u.current?.key === R.key, K = R.title ?? R.path;
|
|
1325
|
+
return createVNode(AppTab, {
|
|
1326
|
+
key: R.key,
|
|
1327
|
+
isCurrent: W,
|
|
1328
|
+
isLast: B === H.length - 1,
|
|
1329
|
+
onClose: R.close,
|
|
1330
|
+
closable: R.closable,
|
|
1331
|
+
dark: u.dark,
|
|
1332
|
+
onClick: () => {
|
|
1333
|
+
W || U.push(R.fullPath);
|
|
1334
|
+
},
|
|
1335
|
+
onContextmenu: (u) => G(u, R)
|
|
1336
|
+
}, { default: () => [V.name ? V.name({
|
|
1337
|
+
isCurrent: W,
|
|
1338
|
+
name: K,
|
|
1339
|
+
tab: R
|
|
1340
|
+
}) : K] });
|
|
1341
|
+
})]),
|
|
1342
|
+
createVNode("div", { style: "height: 100%; flex: 0 0 16px; z-index: 1; position: sticky; right: 0; backdrop-filter: opacity(0.9) blur(5px)" }, null)
|
|
1343
|
+
]), createVNode(NDropdown, {
|
|
1344
|
+
placement: "bottom-start",
|
|
1345
|
+
trigger: "manual",
|
|
1346
|
+
show: W.visible,
|
|
1347
|
+
x: W.x,
|
|
1348
|
+
y: W.y,
|
|
1349
|
+
options: q.value,
|
|
1350
|
+
onClickoutside: K,
|
|
1351
|
+
onSelect: Y
|
|
1352
|
+
}, null)]);
|
|
1353
|
+
}
|
|
1354
|
+
}), UIProvider = /* @__PURE__ */ defineComponent({
|
|
1355
|
+
name: "UIProvider",
|
|
1356
|
+
props: { i18n: Function },
|
|
1357
|
+
setup(u, { slots: R }) {
|
|
1358
|
+
return provide(UI_I18N_INJECTION, toRef(u, "i18n")), () => R.default();
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
export { AppAccount, AppAppearance, AppBreadcrumb, AppContent, AppFooter, AppFullscreen, AppHeader, AppLanguage, AppLayout, AppLogo, AppMenu, AppMultiTabs, AppNotification, AppSider, SpinDirectiveProvider, TooltipDirectiveProvider, UIProvider, vSpin, vTooltip };
|