@ithinkdt/ui 4.0.0-9 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,216 +1,170 @@
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";
1
+ import { n as useI18n, t as UI_I18N_INJECTION } from "./use-i18n-D-AJ8KbA.js";
2
+ import { g as useStyle, i as cM, n as cB, r as cE, t as c } from "./use-style-BGq0HdRK.js";
3
+ import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-pc2Vi93X.js";
4
+ import { Fragment, computed, createVNode, defineComponent, inject, isVNode, mergeProps, provide, reactive, ref, renderSlot, shallowRef, toRef, toValue, unref, useTemplateRef, watch, withDirectives } from "vue";
5
+ import { computedAsync, promiseTimeout, useElementHover, useElementSize, useEventListener, useFullscreen, watchDebounced } from "@vueuse/core";
6
+ import { NAvatar, NBadge, NBreadcrumb, NBreadcrumbItem, NButton, NDrawer, NDrawerContent, NDropdown, NEmpty, NIcon, NList, NListItem, NMenu, NPagination, NPopover, NScrollbar, NText, NThing, useThemeVars } from "ithinkdt-ui";
7
+ import { useAtomicBroadcast } from "@ithinkdt/common/composables";
10
8
  import { RouterLink, useRouter } from "vue-router";
11
9
  import { walkTree } from "@ithinkdt/common/tree";
12
- import { format } from "date-fns";
13
10
  import { getOpaqueColor } from "@ithinkdt/common/color";
14
- const UI_I18N_INJECTION = "__UI_I18N__";
15
- function useI18n() {
16
- return inject$1(UI_I18N_INJECTION).value();
11
+ import { format } from "date-fns";
12
+ function _isSlot$4(e) {
13
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
17
14
  }
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();
15
+ const AppAccount = /* @__PURE__ */ defineComponent({
16
+ name: "AppAccount",
17
+ props: {
18
+ username: String,
19
+ nickname: String,
20
+ head: String,
21
+ showLogoutButton: {
22
+ type: Boolean,
23
+ default: !0
24
+ },
25
+ showChangePwd: {
26
+ type: Boolean,
27
+ default: !0
28
+ }
89
29
  },
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);
30
+ emit: ["logout", "change-pwd"],
31
+ setup(t, { emit: n, slots: r }) {
32
+ let i = computed(() => /^[\u4E00-\u9FA5]+$/.test(t.nickname) ? t.nickname?.slice(t.nickname?.length > 3 ? 2 : 1) : t.nickname?.split(" ")[0]), { t: a } = useI18n(), o = createVNode(NIcon, { size: "28" }, { default: () => [createVNode("svg", {
33
+ xmlns: "http://www.w3.org/2000/svg",
34
+ width: "1em",
35
+ height: "1em",
36
+ viewBox: "-4 -4 32 32"
37
+ }, [createVNode("path", {
38
+ fill: "currentColor",
39
+ 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"
40
+ }, null)])] }), l = createVNode("svg", {
41
+ xmlns: "http://www.w3.org/2000/svg",
42
+ width: "1em",
43
+ height: "1em",
44
+ viewBox: "0 0 24 24"
45
+ }, [createVNode("path", {
46
+ fill: "currentColor",
47
+ 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"
48
+ }, null)]);
49
+ return () => createVNode("div", { style: "display: flex; align-items: center" }, [
50
+ createVNode(NPopover, { style: "padding: 4px" }, {
51
+ trigger: () => createVNode(NButton, {
52
+ quaternary: !0,
53
+ style: "--n-padding: 0 12px"
54
+ }, { default: () => [createVNode("div", { style: "display: flex; align-items: center; gap: 8px" }, [createVNode(NAvatar, {
55
+ key: t.head ? "head" : "no-head",
56
+ src: t.head,
57
+ round: !0,
58
+ size: "small",
59
+ radix: .78,
60
+ color: "var(--color-primary-hover)"
61
+ }, {
62
+ fallback: () => o,
63
+ placeholder: () => o,
64
+ default: t.head ? void 0 : () => i.value
65
+ }), createVNode("span", { style: "font-size: 14px" }, [t.username ?? ""])])] }),
66
+ default: () => {
67
+ let e = () => t.showChangePwd ? createVNode(NButton, {
68
+ quaternary: !0,
69
+ style: "justify-content: left",
70
+ onClick: () => n("change-pwd")
71
+ }, {
72
+ icon: () => createVNode(NIcon, null, { default: () => [createVNode("svg", {
73
+ xmlns: "http://www.w3.org/2000/svg",
74
+ width: "1em",
75
+ height: "1em",
76
+ viewBox: "0 0 32 32"
77
+ }, [createVNode("path", {
78
+ fill: "currentColor",
79
+ 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"
80
+ }, null), createVNode("circle", {
81
+ cx: "22",
82
+ cy: "10",
83
+ r: "2",
84
+ fill: "currentColor"
85
+ }, null)])] }),
86
+ default: () => a("common.account.changePwd")
87
+ }) : void 0, i = () => t.showLogoutButton ? void 0 : createVNode(NButton, {
88
+ quaternary: !0,
89
+ style: "justify-content: left",
90
+ onClick: () => n("logout")
91
+ }, {
92
+ icon: () => createVNode(NIcon, null, _isSlot$4(l) ? l : { default: () => [l] }),
93
+ default: () => a("common.account.logout")
94
+ });
95
+ return r.dropdown ? r.dropdown({
96
+ pwd: e,
97
+ logout: i
98
+ }) : createVNode("div", { style: "display: flex; flex-direction: column" }, [
99
+ e(),
100
+ r.dropdownExtra?.(),
101
+ i()
102
+ ]);
103
+ }
104
+ }),
105
+ r.extra?.(),
106
+ t.showLogoutButton ? withDirectives(createVNode(NButton, {
107
+ quaternary: !0,
108
+ style: "--n-padding: 0 12px",
109
+ onClick: () => t.username && n("logout")
110
+ }, { default: () => [r.logoutButton?.() ?? createVNode(NIcon, { size: "16" }, _isSlot$4(l) ? l : { default: () => [l] })] }), [[
111
+ vTooltip,
112
+ a("common.account.logout"),
113
+ void 0,
114
+ { "bottom-end": !0 }
115
+ ]]) : void 0
116
+ ]);
141
117
  }
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();
118
+ }), AppAppearance = /* @__PURE__ */ defineComponent({
119
+ name: "AppAppearance",
120
+ props: { mode: String },
121
+ emit: ["update:mode"],
122
+ setup(t, { emit: n }) {
123
+ let { t: r } = useI18n();
124
+ return () => withDirectives(createVNode(NButton, {
125
+ quaternary: !0,
126
+ style: "--n-padding: 0 12px",
127
+ onClick: () => {
128
+ n("update:mode", t.mode === "light" ? "dark" : t.mode === "dark" ? "auto" : "light");
193
129
  }
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];
130
+ }, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [t.mode === "light" ? createVNode("svg", {
131
+ xmlns: "http://www.w3.org/2000/svg",
132
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
133
+ role: "img",
134
+ width: "1em",
135
+ height: "1em",
136
+ viewBox: "0 0 24 24"
137
+ }, [createVNode("path", {
138
+ fill: "currentColor",
139
+ 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"
140
+ }, null)]) : t.mode === "dark" ? createVNode("svg", {
141
+ xmlns: "http://www.w3.org/2000/svg",
142
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
143
+ role: "img",
144
+ width: "1em",
145
+ height: "1em",
146
+ viewBox: "0 0 24 24"
147
+ }, [createVNode("path", {
148
+ fill: "currentColor",
149
+ 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"
150
+ }, null)]) : createVNode("svg", {
151
+ xmlns: "http://www.w3.org/2000/svg",
152
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
153
+ role: "img",
154
+ width: "1em",
155
+ height: "1em",
156
+ viewBox: "0 0 24 24"
157
+ }, [createVNode("path", {
158
+ fill: "currentColor",
159
+ 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"
160
+ }, null)])] })] }), [[
161
+ vTooltip,
162
+ t.mode === "light" ? r("common.layout.mode.light") : t.mode === "dark" ? r("common.layout.mode.dark") : r("common.layout.mode.auto"),
163
+ void 0,
164
+ { bottom: !0 }
165
+ ]]);
212
166
  }
213
- }, COLLAPSED_INJECTION_KEY = "APP_SIDER_COLLAPSED", IBookmark = () => createVNode("svg", {
167
+ }), COLLAPSED_INJECTION_KEY = "APP_SIDER_COLLAPSED", IBookmark = () => createVNode("svg", {
214
168
  xmlns: "http://www.w3.org/2000/svg",
215
169
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
216
170
  role: "img",
@@ -221,6 +175,113 @@ const vSpin = {
221
175
  fill: "currentColor",
222
176
  d: "m17 18l-5-2.18L7 18V5h10m0-2H7a2 2 0 0 0-2 2v16l7-3l7 3V5a2 2 0 0 0-2-2Z"
223
177
  }, null)]), CTX_INJECTION_KEY = "__APP_CTX__", getCtx = () => inject(CTX_INJECTION_KEY);
178
+ function _isSlot$3(e) {
179
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
180
+ }
181
+ const AppBreadcrumb = /* @__PURE__ */ defineComponent({
182
+ name: "AppBreadcrumb",
183
+ props: {
184
+ items: {
185
+ type: Array,
186
+ default: () => []
187
+ },
188
+ getIcon: {
189
+ type: Function,
190
+ default: void 0
191
+ }
192
+ },
193
+ setup(e) {
194
+ let t = useRouter(), n = Symbol(), r = Symbol();
195
+ return watch(() => e.items, (t) => {
196
+ walkTree(t, (t) => {
197
+ t.icon && (typeof t.icon == "string" ? (t[n] = e.getIcon?.(t.icon), t[r] = () => t[n]?.() || IBookmark()) : t[r] = t.icon);
198
+ });
199
+ }, { immediate: !0 }), () => {
200
+ let n;
201
+ return createVNode(NBreadcrumb, null, _isSlot$3(n = e.items.map((e) => createVNode(NBreadcrumbItem, {
202
+ clickable: e.href?.length > 0,
203
+ separator: e.separator,
204
+ onClick: e.href && ((n) => {
205
+ n.stopPropagation(), t.push(e.href);
206
+ })
207
+ }, { default: () => [e.icon ? createVNode(Fragment, null, [createVNode(NIcon, { component: e[r] }, null), " "]) : void 0, toValue(e.title)] }))) ? n : { default: () => [n] });
208
+ };
209
+ }
210
+ }), AppFullscreen = /* @__PURE__ */ defineComponent({
211
+ name: "AppFullscreen",
212
+ props: {},
213
+ emit: ["change"],
214
+ setup(t, { emit: n }) {
215
+ let { t: r } = useI18n(), { isFullscreen: i, toggle: a } = useFullscreen();
216
+ return () => withDirectives(createVNode(NButton, {
217
+ quaternary: !0,
218
+ style: "--n-padding: 0 12px",
219
+ onClick: () => {
220
+ a(), n("change", i.value);
221
+ }
222
+ }, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [i.value ? createVNode("svg", {
223
+ xmlns: "http://www.w3.org/2000/svg",
224
+ width: "1em",
225
+ height: "1em",
226
+ viewBox: "0 0 24 24"
227
+ }, [createVNode("path", {
228
+ fill: "none",
229
+ stroke: "currentColor",
230
+ "stroke-linecap": "round",
231
+ "stroke-linejoin": "round",
232
+ "stroke-width": "1.5",
233
+ 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"
234
+ }, null)]) : createVNode("svg", {
235
+ xmlns: "http://www.w3.org/2000/svg",
236
+ width: "1em",
237
+ height: "1em",
238
+ viewBox: "0 0 24 24"
239
+ }, [createVNode("path", {
240
+ fill: "none",
241
+ stroke: "currentColor",
242
+ "stroke-linecap": "round",
243
+ "stroke-linejoin": "round",
244
+ "stroke-width": "1.5",
245
+ 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"
246
+ }, null)])] })] }), [[
247
+ vTooltip,
248
+ i.value ? r("common.layout.screen.exitfull") : r("common.layout.screen.full"),
249
+ void 0,
250
+ { bottom: !0 }
251
+ ]]);
252
+ }
253
+ }), AppLanguage = /* @__PURE__ */ defineComponent({
254
+ name: "AppLanguage",
255
+ props: {
256
+ lang: String,
257
+ supports: Array
258
+ },
259
+ emit: ["update:lang"],
260
+ setup(e, { emit: t }) {
261
+ return () => createVNode(NDropdown, {
262
+ options: e.supports,
263
+ keyField: "value",
264
+ showArrow: !0,
265
+ onSelect: (e) => t("update:lang", e)
266
+ }, { default: () => [createVNode(NButton, {
267
+ quaternary: !0,
268
+ style: "--n-padding: 0 12px"
269
+ }, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [createVNode("svg", {
270
+ xmlns: "http://www.w3.org/2000/svg",
271
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
272
+ role: "img",
273
+ width: "1em",
274
+ height: "1em",
275
+ viewBox: "0 0 24 24"
276
+ }, [createVNode("g", {
277
+ fill: "none",
278
+ stroke: "currentColor",
279
+ "stroke-linecap": "round",
280
+ "stroke-linejoin": "round",
281
+ "stroke-width": "1.5"
282
+ }, [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)])])] })] })] });
283
+ }
284
+ });
224
285
  var style = /* @__PURE__ */ c([
225
286
  cB("layout", {
226
287
  display: "grid",
@@ -242,8 +303,7 @@ var style = /* @__PURE__ */ c([
242
303
  gridArea: "header",
243
304
  overflow: "hidden",
244
305
  zIndex: 2,
245
- height: "var(--app-header-height, 44px)",
246
- zIndex: "2"
306
+ height: "var(--app-header-height, 44px)"
247
307
  }),
248
308
  cB("sider", {
249
309
  gridArea: "sider",
@@ -269,7 +329,9 @@ var style = /* @__PURE__ */ c([
269
329
  }),
270
330
  cB("footer", {
271
331
  gridArea: "footer",
272
- lineHeight: "24px"
332
+ lineHeight: "32px",
333
+ textAlign: "center",
334
+ color: "gray"
273
335
  })
274
336
  ]), IFold = () => createVNode("svg", {
275
337
  xmlns: "http://www.w3.org/2000/svg",
@@ -307,28 +369,28 @@ const AppLayout = /* @__PURE__ */ defineComponent({
307
369
  },
308
370
  fullContent: Boolean
309
371
  },
310
- setup(u, { slots: R }) {
372
+ setup(e, { slots: t }) {
311
373
  useStyle("-layout", style, ref("app"), !1);
312
- let B = reactive({
374
+ let r = reactive({
313
375
  siderWidth: "0px",
314
376
  headerHeight: "0px",
315
377
  footerHeight: "0px",
316
378
  hasMultiTab: !1
317
379
  });
318
- return provide(CTX_INJECTION_KEY, B), () => {
319
- let { layout: V } = u;
380
+ return provide(CTX_INJECTION_KEY, r), () => {
381
+ let { layout: n } = e;
320
382
  return createVNode("div", {
321
383
  class: {
322
384
  "app-layout": !0,
323
- "app-layout--full-header": V === "top2bottom",
324
- "app-layout--full-content": u.fullContent
385
+ "app-layout--full-header": n === "top2bottom",
386
+ "app-layout--full-content": e.fullContent
325
387
  },
326
388
  style: {
327
- "--app-sider-width": B.siderWidth,
328
- "--app-header-height": B.headerHeight,
329
- "--app-footer-height": B.footerHeight
389
+ "--app-sider-width": r.siderWidth,
390
+ "--app-header-height": r.headerHeight,
391
+ "--app-footer-height": r.footerHeight
330
392
  }
331
- }, [renderSlot(R, "default")]);
393
+ }, [renderSlot(t, "default")]);
332
394
  };
333
395
  }
334
396
  }), AppHeader = /* @__PURE__ */ defineComponent({
@@ -337,12 +399,12 @@ const AppLayout = /* @__PURE__ */ defineComponent({
337
399
  type: Number,
338
400
  default: 44
339
401
  } },
340
- setup(u, { slots: R }) {
341
- let B = getCtx();
342
- return () => (B.headerHeight = u.height + "px", createVNode("div", { class: "app-header" }, [renderSlot(R, "default")]));
402
+ setup(e, { slots: t }) {
403
+ let n = getCtx();
404
+ return () => (n.headerHeight = e.height + "px", createVNode("div", { class: "app-header" }, [renderSlot(t, "default")]));
343
405
  }
344
- }), AppSider = /* @__PURE__ */ defineComponent({
345
- name: "AppSider",
406
+ }), AppSidebar = /* @__PURE__ */ defineComponent({
407
+ name: "AppSidebar",
346
408
  props: {
347
409
  showCollapseBtn: {
348
410
  type: Boolean,
@@ -359,21 +421,21 @@ const AppLayout = /* @__PURE__ */ defineComponent({
359
421
  }
360
422
  },
361
423
  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, {
424
+ setup(t, { emit: n, slots: r }) {
425
+ provide(COLLAPSED_INJECTION_KEY, toRef(t, "collapsed"));
426
+ let { t: i } = useI18n(), a = getCtx();
427
+ return () => (a.siderWidth = (t.collapsed ? t.collapsedWidth : t.width) + "px", createVNode("div", { class: "app-sider" }, [renderSlot(r, "default"), t.showCollapseBtn ? withDirectives(createVNode(NButton, {
366
428
  class: "app-sider__collapse-btn",
367
429
  quaternary: !0,
368
430
  onClick: () => {
369
- R("update:collapsed", !u.collapsed);
431
+ n("update:collapsed", !t.collapsed);
370
432
  }
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]));
433
+ }, { default: () => [createVNode(NIcon, { size: "20" }, { default: () => [t.collapsed ? createVNode(IUnfold, null, null) : createVNode(IFold, null, null)] })] }), [[vTooltip, t.collapsed ? i("common.layout.sider.expand") : i("common.layout.sider.collapse")]]) : void 0]));
372
434
  }
373
435
  }), AppContent = /* @__PURE__ */ defineComponent({
374
436
  name: "AppContent",
375
- setup(u, { slots: R }) {
376
- return () => createVNode("div", { class: "app-content" }, [renderSlot(R, "default")]);
437
+ setup(e, { slots: t }) {
438
+ return () => createVNode("div", { class: "app-content" }, [renderSlot(t, "default")]);
377
439
  }
378
440
  }), AppFooter = /* @__PURE__ */ defineComponent({
379
441
  name: "AppFooter",
@@ -381,13 +443,13 @@ const AppLayout = /* @__PURE__ */ defineComponent({
381
443
  type: Number,
382
444
  default: 30
383
445
  } },
384
- setup(u, { slots: R }) {
385
- let B = getCtx();
386
- return () => (B.footerHeight = u.height + "px", createVNode("div", { class: "app-footer" }, [renderSlot(R, "default")]));
446
+ setup(e, { slots: t }) {
447
+ let n = getCtx();
448
+ return () => (n.footerHeight = e.height + "px", createVNode("div", { class: "app-footer" }, [renderSlot(t, "default")]));
387
449
  }
388
450
  });
389
- function _isSlot$4(u) {
390
- return typeof u == "function" || Object.prototype.toString.call(u) === "[object Object]" && !isVNode(u);
451
+ function _isSlot$2(e) {
452
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
391
453
  }
392
454
  const AppLogo = /* @__PURE__ */ defineComponent({
393
455
  name: "AppLogo",
@@ -407,47 +469,47 @@ const AppLogo = /* @__PURE__ */ defineComponent({
407
469
  default: !0
408
470
  }
409
471
  },
410
- setup(u, { slots: R }) {
411
- let B = asyncComputed(() => typeof u.src == "function" ? u.src() : u.src), V = inject$1(COLLAPSED_INJECTION_KEY, !1);
472
+ setup(e, { slots: t }) {
473
+ let n = computedAsync(() => typeof e.src == "function" ? e.src() : e.src), r = inject(COLLAPSED_INJECTION_KEY, !1);
412
474
  return () => {
413
- let { name: H, collapsed: U, center: W, link: G } = u;
414
- U ??= unref(V);
415
- let K = U ? 1 : 1 / 1.1;
475
+ let { name: i, collapsed: a, center: o, link: s } = e;
476
+ a ??= unref(r);
477
+ let l = a ? 1 : 1 / 1.1;
416
478
  return createVNode("div", {
417
479
  class: "app-logo",
418
480
  style: {
419
481
  "--app-logo-img-size": "32px",
420
482
  "--app-logo-name-size": "22px",
421
- width: W ? "100%" : "auto",
483
+ width: o ? "100%" : "auto",
422
484
  overflow: "hidden",
423
485
  display: "flex",
424
486
  alignItems: "center",
425
- justifyContent: W ? "center" : "flex-start",
426
- cursor: G ? "pointer" : void 0
487
+ justifyContent: o ? "center" : "flex-start",
488
+ cursor: s ? "pointer" : void 0
427
489
  }
428
- }, [R.default ? R.default() : createVNode("div", {
490
+ }, [t.default ? t.default() : createVNode("div", {
429
491
  class: "app-logo__img",
430
492
  style: `
431
- width: ${U ? "var(--app-sider-width, 60px)" : "56px"};
432
- font-size: ${U ? "calc(var(--app-sider-width, 60px) - 24px)" : "32px"};
493
+ width: ${a ? "var(--app-sider-width, 60px)" : "56px"};
494
+ font-size: ${a ? "calc(var(--app-sider-width, 60px) - 24px)" : "32px"};
433
495
  transition: width 0.2s ease-in-out 0.1s;
434
496
  flex: 0 0 auto;
435
497
  display: flex;
436
498
  justify-content: center
437
499
  `
438
- }, [R.icon ? R.icon() : createVNode("img", {
439
- src: B.value,
500
+ }, [t.icon ? t.icon() : createVNode("img", {
501
+ src: n.value,
440
502
  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, {
503
+ style: `transition: height 0.2s ease-in-out; height: calc(var(--app-logo-img-size) * ${l})`
504
+ }, null)]), i ? createVNode(NText, {
443
505
  class: "app-logo__name",
444
506
  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] }) : ""]);
507
+ }, _isSlot$2(i) ? i : { default: () => [i] }) : ""]);
446
508
  };
447
509
  }
448
510
  });
449
- function _isSlot$3(u) {
450
- return typeof u == "function" || Object.prototype.toString.call(u) === "[object Object]" && !isVNode(u);
511
+ function _isSlot$1(e) {
512
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
451
513
  }
452
514
  const AppMenu = /* @__PURE__ */ defineComponent({
453
515
  name: "AppMenu",
@@ -472,52 +534,52 @@ const AppMenu = /* @__PURE__ */ defineComponent({
472
534
  default: 60
473
535
  }
474
536
  },
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
537
+ setup(e) {
538
+ let t = shallowRef([]);
539
+ watch([() => e.menus, () => e.single], ([n, r]) => {
540
+ if (t.value = [], !n?.length) return;
541
+ let i = (t, n = 0) => {
542
+ let a = [];
543
+ for (let o of t) {
544
+ if (o.type === "action") continue;
545
+ let t = o.type === "view" ? void 0 : i(o.children ?? [], n + 1), s = {
546
+ _: o,
547
+ key: o.key,
548
+ label: () => e.renderLabel?.(o) ?? o.name,
549
+ icon: n === 0 || o.icon ? e.getIcon?.(o.icon) ?? IBookmark : void 0,
550
+ children: r ? void 0 : t,
551
+ path: o.path || (r ? t?.[0]?.path : void 0),
552
+ depth: n
491
553
  };
492
- delete W.type, H.push(W);
554
+ delete s.type, a.push(s);
493
555
  }
494
- return H;
556
+ return a;
495
557
  };
496
- R.value = V(z);
497
- }, { immediate: !0 }), watch([useTemplateRef("menu"), () => u.current], ([u, R]) => {
498
- u?.showOption(R);
558
+ t.value = i(n);
559
+ }, { immediate: !0 }), watch([useTemplateRef("menu"), () => e.current], ([e, t]) => {
560
+ e?.showOption(t);
499
561
  }, { 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,
562
+ let n = inject(COLLAPSED_INJECTION_KEY, !1), r = (t) => {
563
+ let r = e.collapsed ?? unref(n), i;
564
+ if (t._.type === "view") if (t.isExternal && t.externalEmbed) i = createVNode("a", {
565
+ href: t.externalLink,
504
566
  target: "_blank",
505
- onClick: (u) => u.stopPropagation()
506
- }, [R.label()]);
567
+ onClick: (e) => e.stopPropagation()
568
+ }, [t.label()]);
507
569
  else {
508
- let u;
509
- H = createVNode(RouterLink, { to: R.path }, _isSlot$3(u = R.label()) ? u : { default: () => [u] });
570
+ let e;
571
+ i = createVNode(RouterLink, { to: t.path }, _isSlot$1(e = t.label()) ? e : { default: () => [e] });
510
572
  }
511
- else H = createVNode("span", null, [R.label()]);
512
- return H.key = `${R.key}:${V ? 1 : 0}`, R.depth === 0 && !V && (H = withDirectives(H, [[
573
+ else i = createVNode("span", null, [t.label()]);
574
+ return i.key = `${t.key}:${r ? 1 : 0}`, t.depth === 0 && !r && (i = withDirectives(createVNode("div", null, [i]), [[
513
575
  vTooltip,
514
- R.label(),
576
+ t.label(),
515
577
  void 0,
516
578
  {
517
579
  auto: !0,
518
580
  right: !0
519
581
  }
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", {
582
+ ]])), t.isNew && (i = createVNode("div", { style: "display: flex; width: 100%" }, [createVNode("span", { style: "flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis" }, [i]), createVNode("svg", {
521
583
  xmlns: "http://www.w3.org/2000/svg",
522
584
  width: "24",
523
585
  height: "24",
@@ -526,502 +588,48 @@ const AppMenu = /* @__PURE__ */ defineComponent({
526
588
  }, [createVNode("path", {
527
589
  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
590
  fill: "var(--color-danger)"
529
- }, null)])])), H;
591
+ }, null)])])), i;
530
592
  };
531
593
  return () => {
532
- let H = createVNode(NMenu, {
594
+ let i = createVNode(NMenu, {
533
595
  ref: "menu",
534
- options: R.value,
596
+ options: t.value,
535
597
  rootIndent: 16,
536
- accordion: u.accordion,
537
- collapsed: u.collapsed ?? unref(B),
598
+ accordion: e.accordion,
599
+ collapsed: e.collapsed ?? unref(n),
538
600
  dropdownProps: { showArrow: !0 },
539
- mode: u.horizontal ? "horizontal" : "vertical",
540
- value: u.current ?? null,
541
- renderLabel: V,
601
+ mode: e.horizontal ? "horizontal" : "vertical",
602
+ value: e.current ?? null,
603
+ renderLabel: r,
542
604
  responsive: !0,
543
- collapsedWidth: u.collapsedWidth,
544
- width: u.width
605
+ collapsedWidth: e.collapsedWidth,
606
+ width: e.width
545
607
  }, null);
546
- return u.horizontal ? H : createVNode(NScrollbar, null, _isSlot$3(H) ? H : { default: () => [H] });
608
+ return e.horizontal ? i : createVNode(NScrollbar, null, _isSlot$1(i) ? i : { default: () => [i] });
547
609
  };
548
610
  }
549
611
  });
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({
612
+ function useCtxMenu(t, n, r) {
613
+ let { t: i } = useI18n(), a = reactive({
1006
614
  visible: !1,
1007
615
  x: 0,
1008
616
  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 () => {
617
+ }), o = async (e, t) => {
618
+ e.preventDefault(), e.stopPropagation(), !(a.visible && a.tab === t) && (a.tab = t, a.visible && (a.visible = !1, await promiseTimeout(130)), a.visible = !0, a.x = e.clientX, a.y = e.clientY);
619
+ }, s = async () => {
1012
620
  requestIdleCallback(() => {
1013
- U.visible = !1;
621
+ a.visible = !1;
1014
622
  }, { timeout: 30 });
1015
- }, K = useRouter();
623
+ }, l = useRouter();
1016
624
  return {
1017
- ctx: U,
1018
- onCtx: W,
1019
- onClickoutside: G,
625
+ ctx: a,
626
+ onCtx: o,
627
+ onClickOutside: s,
1020
628
  options: computed(() => [
1021
629
  {
1022
630
  key: "reload",
1023
- label: H("common.layout.tabs.reloadTab"),
1024
- disabled: U.tab && U.tab.key !== B.value,
631
+ label: i("common.layout.tabs.reloadTab"),
632
+ disabled: !a.tab || a.tab.key !== n.value,
1025
633
  icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
1026
634
  xmlns: "http://www.w3.org/2000/svg",
1027
635
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
@@ -1036,7 +644,7 @@ function useCtxMenu(u, B, V) {
1036
644
  },
1037
645
  {
1038
646
  key: "fullTab",
1039
- label: H("common.layout.tabs.fullTab"),
647
+ label: i("common.layout.tabs.fullTab"),
1040
648
  icon: () => createVNode(NIcon, { size: 16 }, { default: () => [createVNode("svg", {
1041
649
  xmlns: "http://www.w3.org/2000/svg",
1042
650
  width: "1em",
@@ -1055,8 +663,8 @@ function useCtxMenu(u, B, V) {
1055
663
  },
1056
664
  {
1057
665
  key: "open",
1058
- label: H("common.layout.tabs.openTabBlank"),
1059
- disabled: U.tab?.key !== B.value,
666
+ label: i("common.layout.tabs.openTabBlank"),
667
+ disabled: !a.tab,
1060
668
  icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
1061
669
  xmlns: "http://www.w3.org/2000/svg",
1062
670
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
@@ -1073,7 +681,7 @@ function useCtxMenu(u, B, V) {
1073
681
  },
1074
682
  {
1075
683
  key: "closeAll",
1076
- label: H("common.layout.tabs.closeAllTabs"),
684
+ label: i("common.layout.tabs.closeAllTabs"),
1077
685
  icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
1078
686
  xmlns: "http://www.w3.org/2000/svg",
1079
687
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
@@ -1088,8 +696,8 @@ function useCtxMenu(u, B, V) {
1088
696
  },
1089
697
  {
1090
698
  key: "closeLeft",
1091
- label: H("common.layout.tabs.closeLeftTabs"),
1092
- disabled: !U.tab,
699
+ label: i("common.layout.tabs.closeLeftTabs"),
700
+ disabled: !a.tab,
1093
701
  icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
1094
702
  xmlns: "http://www.w3.org/2000/svg",
1095
703
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
@@ -1104,8 +712,8 @@ function useCtxMenu(u, B, V) {
1104
712
  },
1105
713
  {
1106
714
  key: "closeRight",
1107
- label: H("common.layout.tabs.closeRightTabs"),
1108
- disabled: !U.tab,
715
+ label: i("common.layout.tabs.closeRightTabs"),
716
+ disabled: !a.tab,
1109
717
  icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
1110
718
  xmlns: "http://www.w3.org/2000/svg",
1111
719
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
@@ -1120,8 +728,8 @@ function useCtxMenu(u, B, V) {
1120
728
  },
1121
729
  {
1122
730
  key: "closeOther",
1123
- label: H("common.layout.tabs.closeOtherTabs"),
1124
- disabled: !U.tab,
731
+ label: i("common.layout.tabs.closeOtherTabs"),
732
+ disabled: !a.tab,
1125
733
  icon: () => createVNode(NIcon, { size: 20 }, { default: () => [" ", createVNode("svg", {
1126
734
  xmlns: "http://www.w3.org/2000/svg",
1127
735
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
@@ -1135,75 +743,63 @@ function useCtxMenu(u, B, V) {
1135
743
  }, null)])] })
1136
744
  }
1137
745
  ]),
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);
746
+ onSelect: async (e) => {
747
+ a.visible = !1;
748
+ let i = [...t.value];
749
+ if (e === "closeAll") {
750
+ await l.push("/");
751
+ for (let e of i) e.key !== n.value && e.close(!1);
1144
752
  return;
1145
753
  }
1146
- if (R === "fullTab") {
1147
- V();
754
+ if (e === "fullTab") {
755
+ r();
1148
756
  return;
1149
757
  }
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) {
758
+ if (a.tab) switch (e) {
1163
759
  case "open":
1164
- window.open(U.tab.href, "_blank");
760
+ window.open(a.tab.href, "_blank");
1165
761
  break;
1166
762
  case "reload":
1167
- U.tab.reloading || (U.tab.reloading = !0, await promiseTimeout(220), U.tab.reloading = !1);
763
+ a.tab.reloading || (a.tab.reloading = !0, await promiseTimeout(220), a.tab.reloading = !1);
1168
764
  break;
1169
765
  case "close":
1170
- U.tab?.close();
766
+ a.tab?.close();
1171
767
  break;
1172
768
  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);
769
+ n.value !== a.tab.key && await l.push(a.tab.fullPath);
770
+ for (let e of i) e.key !== a.tab.key && e.close(!1);
1175
771
  break;
1176
772
  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);
773
+ n.value !== a.tab.key && await l.push(a.tab.fullPath);
774
+ for (let e of t.value.slice(0, i.indexOf(a.tab))) e.close(!1);
1179
775
  break;
1180
776
  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);
777
+ n.value !== a.tab.key && await l.push(a.tab.fullPath);
778
+ for (let e of t.value.slice(i.indexOf(a.tab) + 1)) e.close(!1);
1183
779
  break;
1184
780
  }
1185
781
  }
1186
782
  };
1187
783
  }
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({
784
+ function useContentScroll(e, t, n) {
785
+ function r(n) {
786
+ if (n === -1 || !t.value?.children.length) return;
787
+ let r = t.value.children[n];
788
+ e.value.scrollTo({
1193
789
  behavior: "smooth",
1194
- left: Math.max(0, R.value.offsetLeft + B.offsetLeft - u.value.clientWidth / 2 + B.clientWidth / 2 + 10)
790
+ left: Math.max(0, t.value.offsetLeft + r.offsetLeft - e.value.clientWidth / 2 + r.clientWidth / 2 + 10)
1195
791
  });
1196
792
  }
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 }));
793
+ return watchDebounced(useElementHover(e), (e) => {
794
+ e || r(n.value);
795
+ }, { debounce: 333 }), watch(n, r, { flush: "post" }), useEventListener(e, "wheel", (t) => {
796
+ t.deltaMode === WheelEvent.DOM_DELTA_PIXEL && (t.preventDefault(), e.value.scrollBy({ left: t.deltaY }));
1201
797
  }, { passive: !1 }), {
1202
- el: u,
1203
- content: R
798
+ el: e,
799
+ content: t
1204
800
  };
1205
801
  }
1206
- var IBg = (u) => createVNode("svg", u, [
802
+ var IBg = (e) => createVNode("svg", e, [
1207
803
  createVNode("defs", null, [
1208
804
  createVNode("symbol", {
1209
805
  id: "geometry-left",
@@ -1249,39 +845,39 @@ var IBg = (u) => createVNode("svg", u, [
1249
845
  dark: Boolean
1250
846
  },
1251
847
  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";
848
+ setup(e, { emit: t, slots: n }) {
849
+ let r = ref(), i = useElementHover(r), a = ref(), o = ref(), { width: s } = useElementSize(o);
850
+ watch(s, async () => {
851
+ await promiseTimeout(1), a.value.style.width = o.value.scrollWidth + "px";
1256
852
  });
1257
- let q = useThemeVars(), Y = computed(() => ({
853
+ let l = useThemeVars(), u = computed(() => ({
1258
854
  fontSize: "14px",
1259
- color: u.isCurrent ? q.value.primaryColor : q.value.textColor3,
855
+ color: e.isCurrent ? l.value.primaryColor : l.value.textColor3,
1260
856
  maxWidth: "355px",
1261
857
  overflow: "hidden"
1262
- })), X = computed(() => ({
858
+ })), d = computed(() => ({
1263
859
  width: "calc(100% + 27px)",
1264
860
  height: "100%",
1265
861
  position: "absolute",
1266
862
  top: "0",
1267
863
  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"
864
+ zIndex: e.isCurrent ? -1 : -2,
865
+ color: e.isCurrent ? getOpaqueColor(l.value.primaryColor, e.dark ? .3 : .12, e.dark ? "#000" : "#fff") : i.value ? l.value.borderColor : "transparent"
1270
866
  }));
1271
867
  return () => createVNode("div", {
1272
- ref: H,
868
+ ref: r,
1273
869
  style: "position: relative; padding: 2px 10px 5px; cursor: pointer"
1274
870
  }, [
1275
871
  createVNode("div", {
1276
- ref: W,
872
+ ref: a,
1277
873
  style: "transition: width 300ms; overflow: hidden"
1278
874
  }, [createVNode("div", {
1279
- ref: G,
875
+ ref: o,
1280
876
  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, {
877
+ }, [createVNode("span", { style: u.value }, [n.default?.()]), e.closable !== !1 && (e.isCurrent || i.value) ? createVNode("span", { style: "line-height: 0; display: inline-block; text-align: right; padding-top: 2px" }, [createVNode(NButton, {
1282
878
  text: !0,
1283
- onClick: (u) => {
1284
- u.stopPropagation(), B("close");
879
+ onClick: (e) => {
880
+ e.stopPropagation(), t("close");
1285
881
  }
1286
882
  }, { default: () => [createVNode(NIcon, { size: 18 }, { default: () => [createVNode("svg", {
1287
883
  xmlns: "http://www.w3.org/2000/svg",
@@ -1293,7 +889,7 @@ var IBg = (u) => createVNode("svg", u, [
1293
889
  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
890
  }, null)])] })] })]) : void 0])]),
1295
891
  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)
892
+ createVNode(IBg, { style: d.value }, null)
1297
893
  ]);
1298
894
  }
1299
895
  });
@@ -1307,55 +903,309 @@ const AppMultiTabs = /* @__PURE__ */ defineComponent({
1307
903
  dark: Boolean
1308
904
  },
1309
905
  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,
906
+ setup(e, { emit: t, slots: n }) {
907
+ let r = getCtx();
908
+ r.hasMultiTab = !0;
909
+ let i = useRouter(), { ctx: a, onCtx: o, onClickOutside: s, options: l, onSelect: u } = useCtxMenu(toRef(e, "tabs"), computed(() => e.current?.key), () => t("update:fullTab", !e.fullTab)), d = computed(() => e.current ? e.tabs.findIndex((t) => t.key === e.current?.key) : -1), f = ref(), m = ref();
910
+ return useContentScroll(f, m, d), () => createVNode("div", { style: "width: 100%; height: 100%; overflow: hidden; display: flex; justify-content: space-between" }, [createVNode("div", {
911
+ ref: f,
1316
912
  style: "flex: 1 1 100%; height: 100%; display: flex; overflow: hidden; align-items: center; position: relative"
1317
913
  }, [
1318
914
  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
915
  createVNode("div", {
1320
- ref: $,
916
+ ref: m,
1321
917
  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;
918
+ onContextmenu: (e) => o(e)
919
+ }, [e.tabs.map((t, r, a) => {
920
+ let s = e.current?.key === t.key, l = t.title ?? t.path;
1325
921
  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,
922
+ key: t.key,
923
+ isCurrent: s,
924
+ isLast: r === a.length - 1,
925
+ onClose: t.close,
926
+ closable: t.closable,
927
+ dark: e.dark,
1332
928
  onClick: () => {
1333
- W || U.push(R.fullPath);
929
+ s || i.push(t.fullPath);
1334
930
  },
1335
- onContextmenu: (u) => G(u, R)
1336
- }, { default: () => [V.name ? V.name({
1337
- isCurrent: W,
1338
- name: K,
1339
- tab: R
1340
- }) : K] });
931
+ onContextmenu: (e) => o(e, t)
932
+ }, { default: () => [n.name ? n.name({
933
+ isCurrent: s,
934
+ name: l,
935
+ tab: t
936
+ }) : l] });
1341
937
  })]),
1342
938
  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
939
  ]), createVNode(NDropdown, {
1344
940
  placement: "bottom-start",
1345
941
  trigger: "manual",
1346
- show: W.visible,
1347
- x: W.x,
1348
- y: W.y,
1349
- options: q.value,
1350
- onClickoutside: K,
1351
- onSelect: Y
942
+ show: a.visible,
943
+ x: a.x,
944
+ y: a.y,
945
+ options: l.value,
946
+ onClickoutside: s,
947
+ onSelect: u
1352
948
  }, null)]);
1353
949
  }
950
+ });
951
+ function _isSlot(e) {
952
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
953
+ }
954
+ const AppNotification = /* @__PURE__ */ defineComponent({
955
+ name: "AppNotification",
956
+ inheritAttrs: !1,
957
+ props: {
958
+ getUnreadCount: Function,
959
+ getPage: Function,
960
+ markRead: Function,
961
+ markDelete: Function,
962
+ interval: {
963
+ type: Number,
964
+ default: 3e4
965
+ }
966
+ },
967
+ setup(t, { slots: n, attrs: r }) {
968
+ let { t: i } = useI18n(), a = ref(!1), o = ref("unread"), u = reactive({
969
+ page: 1,
970
+ size: 10,
971
+ loading: !1,
972
+ records: [],
973
+ total: 0,
974
+ unread: 0
975
+ }), { sync: d, post: p } = useAtomicBroadcast({
976
+ channel: "__ithinkdt_mc_shared_channel",
977
+ onMsg: (e) => {
978
+ u.unread = e;
979
+ },
980
+ getMsg: () => (a.value && (u.loading = !0, Promise.resolve(t.getPage?.(o.value, u.page, u.size) ?? []).then(({ records: e, total: t }) => {
981
+ u.records = e, o.value === "unread" ? (u.unread = t, p(t)) : u.total = t;
982
+ }).finally(() => {
983
+ u.loading = !1;
984
+ })), t.getUnreadCount?.() ?? 0),
985
+ timeout: () => t.interval,
986
+ immediate: !0
987
+ });
988
+ return () => {
989
+ let e = withDirectives(createVNode(NButton, mergeProps(r, {
990
+ quaternary: !0,
991
+ style: "--n-padding: 0 12px",
992
+ onClick: () => {
993
+ a.value = !0, o.value = u.unread > 0 ? "unread" : "all", setTimeout(d, 300);
994
+ }
995
+ }), { default: () => [n.icon ? n.icon() : createVNode(NBadge, {
996
+ show: u.unread > 0,
997
+ dot: !0,
998
+ offset: [-2, 5],
999
+ processing: !0
1000
+ }, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [createVNode("svg", {
1001
+ xmlns: "http://www.w3.org/2000/svg",
1002
+ width: "1em",
1003
+ height: "1em",
1004
+ viewBox: "0 0 24 24"
1005
+ }, [createVNode("g", {
1006
+ fill: "none",
1007
+ stroke: "currentColor",
1008
+ "stroke-linecap": "round",
1009
+ "stroke-linejoin": "round",
1010
+ "stroke-width": "1.5",
1011
+ color: "currentColor"
1012
+ }, [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)])])] })] })] }), [[
1013
+ vTooltip,
1014
+ i("common.notification.tip", { count: u.unread }),
1015
+ void 0,
1016
+ { bottom: !0 }
1017
+ ]]), p = () => {
1018
+ let e, t;
1019
+ return createVNode("div", { style: "display: flex; align-items: baseline; gap: 20px" }, [
1020
+ createVNode("div", { style: "padding-right: 12px" }, [i("common.notification.title")]),
1021
+ createVNode(NButton, {
1022
+ text: !0,
1023
+ type: o.value === "all" ? "primary" : "default",
1024
+ onClick: () => {
1025
+ o.value = "all", d();
1026
+ }
1027
+ }, _isSlot(e = i("common.notification.all")) ? e : { default: () => [e] }),
1028
+ createVNode(NButton, {
1029
+ text: !0,
1030
+ type: o.value === "unread" ? "primary" : "default",
1031
+ onClick: () => {
1032
+ o.value = "unread", d();
1033
+ }
1034
+ }, _isSlot(t = i("common.notification.unread", { count: u.unread > 99 ? "99+" : u.unread.toString() })) ? t : { default: () => [t] })
1035
+ ]);
1036
+ }, m = (e) => createVNode(NListItem, {
1037
+ key: e.key,
1038
+ onClick: () => {
1039
+ e.status === "unread" && (t.markRead?.([e.key]).then(() => {
1040
+ e.status = "read";
1041
+ }), u.unread--), e.link && window.open(e.link, "_target");
1042
+ }
1043
+ }, { default: () => [createVNode(NThing, {
1044
+ bordered: !1,
1045
+ closable: !0,
1046
+ contentIndented: !0,
1047
+ size: "small",
1048
+ onMouseenter: () => e.hover = !0,
1049
+ onMouseleave: () => e.hover = !1,
1050
+ style: "padding: 0 4px"
1051
+ }, {
1052
+ avatar: () => createVNode(NIcon, {
1053
+ size: 22,
1054
+ color: e.status === "unread" ? "var(--color-primary)" : void 0
1055
+ }, { default: () => [createVNode("svg", {
1056
+ xmlns: "http://www.w3.org/2000/svg",
1057
+ width: "1em",
1058
+ height: "1em",
1059
+ viewBox: "0 0 24 24"
1060
+ }, [createVNode("path", {
1061
+ fill: "currentColor",
1062
+ 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"
1063
+ }, null)])] }),
1064
+ header: () => e.title,
1065
+ "header-extra": () => {
1066
+ let n, r;
1067
+ return e.hover ? createVNode("div", {
1068
+ style: "display: flex; justify-content: end; gap: 12px",
1069
+ onClick: (e) => {
1070
+ e.preventDefault(), e.stopPropagation();
1071
+ }
1072
+ }, [e.status === "unread" ? createVNode(NButton, {
1073
+ text: !0,
1074
+ type: "primary",
1075
+ onClick: () => {
1076
+ t.markRead?.([e.key]).then(() => {
1077
+ e.status = "read", u.unread--;
1078
+ });
1079
+ }
1080
+ }, _isSlot(n = i("common.notification.markRead")) ? n : { default: () => [n] }) : void 0, createVNode(NButton, {
1081
+ text: !0,
1082
+ type: "error",
1083
+ onClick: () => {
1084
+ u.records === 1 ? (u.records = [], d()) : u.records.splice(u.records.findIndex((t) => t.key == e.key), 1), t.markDelete?.([e.key]);
1085
+ }
1086
+ }, _isSlot(r = i("common.notification.markDelete")) ? r : { default: () => [r] })]) : void 0;
1087
+ },
1088
+ default: e.content,
1089
+ footer: () => createVNode("span", { style: "color: gray" }, [e.hover ? format(e.date, i("common.notification.time")) : i("common.timeago", { time: e.date })])
1090
+ })] }), h = () => {
1091
+ let e;
1092
+ return withDirectives(u.records.length > 0 ? createVNode(NList, {
1093
+ clickable: !0,
1094
+ hoverable: !0,
1095
+ style: "min-height: 50vh"
1096
+ }, _isSlot(e = u.records.map((e) => m(e))) ? e : { default: () => [e] }) : createVNode(NEmpty, { style: "margin-top: 30vh" }, null), [[vSpin, u.loading]]);
1097
+ }, g = () => createVNode("div", { style: "display: flex; justify-content: space-between; width: 100%" }, [o.value === "unread" ? createVNode(NButton, {
1098
+ text: !0,
1099
+ type: "primary",
1100
+ disabled: u.records.length === 0,
1101
+ onClick: () => {
1102
+ let e = u.records.filter((e) => e.status === "unread").map((e) => e.key);
1103
+ t.markRead(e).then(() => {
1104
+ for (; u.unread - e.length <= u.size * (u.page - 1);) u.page--;
1105
+ d();
1106
+ });
1107
+ }
1108
+ }, {
1109
+ icon: () => createVNode(NIcon, { size: "20" }, { default: () => [createVNode("svg", {
1110
+ xmlns: "http://www.w3.org/2000/svg",
1111
+ width: "1em",
1112
+ height: "1em",
1113
+ viewBox: "0 0 24 24"
1114
+ }, [createVNode("path", {
1115
+ fill: "currentColor",
1116
+ 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"
1117
+ }, null)])] }),
1118
+ default: () => i("common.notification.markPageRead")
1119
+ }) : createVNode("span", null, null), createVNode(NPagination, {
1120
+ simple: !0,
1121
+ pageSize: u.size,
1122
+ page: u.page,
1123
+ itemCount: o.value === "unread" ? u.unread : u.total,
1124
+ onUpdatePage: (e) => {
1125
+ u.page = e, d();
1126
+ }
1127
+ }, null)]);
1128
+ return createVNode(Fragment, null, [e, createVNode(NDrawer, {
1129
+ show: a.value,
1130
+ "onUpdate:show": (e) => a.value = e,
1131
+ showMask: !1,
1132
+ width: 400
1133
+ }, { default: () => [createVNode(NDrawerContent, {
1134
+ title: i("common.notification.title"),
1135
+ closable: !0,
1136
+ nativeScrollbar: !1,
1137
+ bodyContentStyle: { padding: "0" }
1138
+ }, {
1139
+ header: p,
1140
+ default: h,
1141
+ footer: g
1142
+ })] })]);
1143
+ };
1144
+ }
1145
+ });
1146
+ var ICheck = (e) => createVNode("svg", mergeProps({
1147
+ xmlns: "http://www.w3.org/2000/svg",
1148
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
1149
+ role: "img",
1150
+ width: "1em",
1151
+ height: "1em",
1152
+ viewBox: "0 0 24 24"
1153
+ }, e), [createVNode("path", {
1154
+ fill: "currentColor",
1155
+ d: "m9.55 18l-5.7-5.7l1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"
1156
+ }, null)]);
1157
+ const AppTenant = /* @__PURE__ */ defineComponent({
1158
+ name: "AppTenant",
1159
+ props: {
1160
+ options: Array,
1161
+ current: String
1162
+ },
1163
+ emit: ["update:current"],
1164
+ setup(t, { emit: n }) {
1165
+ let { t: r } = useI18n(), i = (e) => e.disabled ? createVNode("div", null, [e.name]) : createVNode("div", { style: "display: flex; align-items: center; justify-content: space-between; gap: 20px" }, [createVNode("div", { style: "display: flex; align-items: center; gap: 8px" }, [createVNode(NAvatar, {
1166
+ round: !0,
1167
+ size: 22,
1168
+ color: "var(--color-primary-hover)"
1169
+ }, { default: () => [e.icon?.() || e.name[0]] }), createVNode("span", { style: e.id === t.current ? "color: var(--color-primary)" : "" }, [e.name])]), e.id === t.current ? createVNode(ICheck, { style: "color: var(--color-primary); font-size: 20px" }, null) : createVNode("div", null, null)]), a = computed(() => [{
1170
+ id: "___",
1171
+ name: r("common.account.changeTenant"),
1172
+ disabled: !0
1173
+ }, ...t.options ?? []]);
1174
+ return () => {
1175
+ if (!t.options?.length) return;
1176
+ let e = t.options.find((e) => e.id === t.current);
1177
+ return createVNode(NDropdown, {
1178
+ options: a.value,
1179
+ placement: "bottom-end",
1180
+ keyField: "id",
1181
+ labelField: "name",
1182
+ showArrow: !0,
1183
+ renderLabel: i,
1184
+ onSelect: (e) => e !== t.current && n("update:current", e)
1185
+ }, { default: () => [createVNode(NButton, {
1186
+ quaternary: !0,
1187
+ style: "--n-padding: 0 6px"
1188
+ }, {
1189
+ icon: () => createVNode(NIcon, { size: "18" }, { default: () => [createVNode("svg", {
1190
+ xmlns: "http://www.w3.org/2000/svg",
1191
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
1192
+ viewBox: "0 0 1024 1024",
1193
+ width: "1em",
1194
+ height: "1em",
1195
+ role: "img"
1196
+ }, [createVNode("path", {
1197
+ d: "M728 600.2c8.1-13.2 4-30.4-9.1-38.5-30.7-19-63.6-33.8-97.8-44.4 69.4-43 115.6-119.8 115.6-207.4C736.7 175.2 627.5 66 492.8 66S249 175.2 249 309.9c0 88.2 46.8 165.5 117 208.3-12.9 4.1-25.6 8.8-38.1 14.1-51.1 21.8-97 53-136.4 92.7-39.4 39.7-70.3 85.9-91.9 137.4-22.4 53.3-33.7 109.9-33.7 168.2 0 15.5 12.5 28 28 28s28-12.5 28-28c0-207.5 167.4-376.3 373.2-376.3 68.8 0 136.1 19 194.4 55 13.1 8.2 30.4 4.1 38.5-9.1zM305 309.9c0-50.2 19.5-97.4 55-132.8 35.5-35.5 82.7-55 132.8-55 50.2 0 97.4 19.5 132.8 55 35.5 35.5 55 82.7 55 132.8s-19.5 97.4-55 132.8c-35.5 35.5-82.7 55-132.8 55-50.2 0-97.4-19.5-132.8-55-35.5-35.5-55-82.6-55-132.8zM606.2 746.4h325.1c11.3 0 21.5-6.8 25.9-17.3s1.9-22.5-6.1-30.5L844.5 592.1c-10.9-10.9-28.7-10.9-39.6 0-10.9 10.9-10.9 28.7 0 39.6l58.7 58.6H606.2c-15.5 0-28 12.5-28 28s12.6 28.1 28 28.1zM931.4 794.6H606.3c-11.3 0-21.5 6.8-25.9 17.3s-1.9 22.5 6.1 30.5l106.6 106.4c5.5 5.5 12.6 8.2 19.8 8.2 7.2 0 14.4-2.7 19.8-8.2 10.9-10.9 10.9-28.7 0-39.6L674 850.6h257.4c15.5 0 28-12.5 28-28s-12.5-28-28-28z",
1198
+ fill: "currentColor"
1199
+ }, null)])] }),
1200
+ default: () => e?.shotName || e?.name
1201
+ })] });
1202
+ };
1203
+ }
1354
1204
  }), UIProvider = /* @__PURE__ */ defineComponent({
1355
1205
  name: "UIProvider",
1356
1206
  props: { i18n: Function },
1357
- setup(u, { slots: R }) {
1358
- return provide(UI_I18N_INJECTION, toRef(u, "i18n")), () => R.default();
1207
+ setup(e, { slots: n }) {
1208
+ return provide(UI_I18N_INJECTION, toRef(e, "i18n")), () => n.default();
1359
1209
  }
1360
1210
  });
1361
- export { AppAccount, AppAppearance, AppBreadcrumb, AppContent, AppFooter, AppFullscreen, AppHeader, AppLanguage, AppLayout, AppLogo, AppMenu, AppMultiTabs, AppNotification, AppSider, SpinDirectiveProvider, TooltipDirectiveProvider, UIProvider, vSpin, vTooltip };
1211
+ export { AppAccount, AppAppearance, AppBreadcrumb, AppContent, AppFooter, AppFullscreen, AppHeader, AppLanguage, AppLayout, AppLogo, AppMenu, AppMultiTabs, AppNotification, AppSidebar, AppTenant, SpinDirectiveProvider, TooltipDirectiveProvider, UIProvider, vSpin, vTooltip };