@ithinkdt/ui 4.0.0-54 → 4.0.0-600

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,5 +1,5 @@
1
- import "./use-i18n-Dx7V4KrY.js";
2
- import "./directives-DUuJW647.js";
3
- import "./use-style-DcT-1dj4.js";
4
- import { a as NRadios, c as DataSelection, d as useLocaleEdit, f as DataFilter, g as NCheckboxes, h as DataActions, i as renderUsers, l as DataPagination, m as DataCustom, n as DtUserDept, o as DataTable, p as DataForm, r as DtUserRender, s as useDataTableDrag, t as DtDeptRender, u as DataLocaleInput } from "./components-BdbuJNhZ.js";
5
- export { DataActions, DataCustom, DataFilter, DataForm, DataLocaleInput, DataPagination, DataSelection, DataTable, DtDeptRender, DtUserDept, DtUserRender, NCheckboxes, NRadios, renderUsers, useDataTableDrag, useLocaleEdit };
1
+ import "./use-i18n-D-AJ8KbA.js";
2
+ import "./use-style-DrH-89qR.js";
3
+ import "./directives-CB8tcZsk.js";
4
+ import { _ as dataFormActionsProps, a as DtUserRender, b as DataActions, c as DataTable, d as DataPagination, f as DataLocaleInput, g as DataFormActions, h as DataForm, i as DtUserDept, l as useDataTableDrag, m as DataFilter, n as StateButtonProps, o as renderUsers, p as useLocaleEdit, r as DtDeptRender, s as NRadios, t as NStateButton, u as DataSelection, v as DataDescriptions, x as NCheckboxes, y as DataCustom } from "./components-BMKQsJ4d.js";
5
+ export { DataActions, DataCustom, DataDescriptions, DataFilter, DataForm, DataFormActions, DataLocaleInput, DataPagination, DataSelection, DataTable, DtDeptRender, DtUserDept, DtUserRender, NCheckboxes, NRadios, NStateButton, StateButtonProps, dataFormActionsProps, renderUsers, useDataTableDrag, useLocaleEdit };
@@ -0,0 +1,203 @@
1
+ import { g as useStyle, i as cM, n as cB, r as cE, t as c } from "./use-style-DrH-89qR.js";
2
+ import { Fragment, createVNode, defineComponent, h, nextTick, reactive, ref, shallowRef, toRef, watch } from "vue";
3
+ import { promiseTimeout, useEventListener } from "@vueuse/core";
4
+ import { NTooltip } from "ithinkdt-ui";
5
+ import { nanoid } from "nanoid";
6
+ import { debounce, throttle } from "@ithinkdt/common/fn";
7
+ import { useElementIntersectionRect } from "@ithinkdt/common/composables";
8
+ import { string2dom } from "@ithinkdt/common/dom";
9
+ var style$1 = /* @__PURE__ */ c([c(({ props: m }) => `:where(span${m.bPrefix}tooltip-host)`, { display: "inline-block" }), c(({ props: m }) => `:where(${m.bPrefix}tooltip-host)`, {
10
+ maxWidth: "100%",
11
+ whiteSpace: "nowrap",
12
+ overflow: "hidden",
13
+ textOverflow: "ellipsis"
14
+ })]), Tooltip = /* @__PURE__ */ Symbol("tooltip-dir"), current = /* @__PURE__ */ shallowRef();
15
+ function detactOverflow(m) {
16
+ let F = m.firstChild;
17
+ if (!F) return !1;
18
+ let I = F instanceof Text ? {
19
+ width: m.scrollWidth,
20
+ height: m.scrollHeight
21
+ } : F.getBoundingClientRect?.() ?? {
22
+ width: F.clientWidth,
23
+ height: F.clientHeight
24
+ };
25
+ return I.width > m.clientWidth + 1 || I.height > m.clientHeight + 2;
26
+ }
27
+ var _update, _current, clsPrefix$1;
28
+ const TooltipDirectiveProvider = /* @__PURE__ */ defineComponent({
29
+ name: "TooltipDirectiveProvider",
30
+ props: { delay: {
31
+ type: Number,
32
+ default: 180
33
+ } },
34
+ setup(F) {
35
+ clsPrefix$1 = useStyle("-tooltip-directive", style$1);
36
+ let I = shallowRef(), L = reactive({
37
+ show: !1,
38
+ tip: void 0,
39
+ placement: "top",
40
+ x: 0,
41
+ y: 0
42
+ });
43
+ _update = async () => {
44
+ if (!current.value) return;
45
+ F.delay > 0 && await promiseTimeout(F.delay);
46
+ let m = current.value, R = m?.[Tooltip];
47
+ if (!R) return;
48
+ let z = R.tip;
49
+ if (I.value = typeof z == "function" ? z : () => z || m.attributes.getNamedItem("title") || m.textContent, !R.binding.modifiers || detactOverflow(m)) {
50
+ L.show = !0;
51
+ let F = m.getBoundingClientRect();
52
+ switch (L.placement = Object.keys(R.binding.modifiers).find((m) => [
53
+ "top",
54
+ "right",
55
+ "left",
56
+ "bottom"
57
+ ].find((F) => m.startsWith(F))) ?? "top", L.placement.split("-")[0]) {
58
+ case "top":
59
+ L.x = F.left + F.width / 2, L.y = F.top;
60
+ break;
61
+ case "right":
62
+ L.x = F.left + F.width, L.y = F.top + F.height / 2;
63
+ break;
64
+ case "left":
65
+ L.x = F.left, L.y = F.top + F.height / 2;
66
+ break;
67
+ case "bottom":
68
+ L.x = F.left + F.width / 2, L.y = F.bottom;
69
+ break;
70
+ }
71
+ } else L.show &&= !1;
72
+ };
73
+ let R = `ithinkdt-tooltip-${nanoid()}`, z = throttle((m) => {
74
+ !_current || _current.contains(m) || m.closest(`.${R}`) || (L.show = !1, current.value = void 0);
75
+ }, 100, { leading: !1 });
76
+ return useEventListener("mouseover", (m) => {
77
+ _current = current.value, z(m.target);
78
+ }, { capture: !0 }), () => createVNode(NTooltip, {
79
+ trigger: "manual",
80
+ show: !!current.value && L.show,
81
+ x: L.x,
82
+ y: L.y,
83
+ placement: L.placement
84
+ }, { default: () => [createVNode("div", { class: R }, [I.value?.()])] });
85
+ }
86
+ });
87
+ var _listener = (m) => {
88
+ _current = void 0, current.value = m.target, _update?.();
89
+ };
90
+ const vTooltip = {
91
+ mounted(m, F) {
92
+ m[Tooltip] = {
93
+ binding: F,
94
+ tip: F.value
95
+ }, m.addEventListener("mouseenter", _listener), F.modifiers.auto && m.classList.add(`${clsPrefix$1.value}-tooltip-host`);
96
+ },
97
+ updated(m, F) {
98
+ m[Tooltip].binding = F, m[Tooltip].tip = F.value, m.classList.toggle(`${clsPrefix$1.value}-tooltip-host`, F.modifiers.auto), _update();
99
+ },
100
+ beforeUnmount(m) {
101
+ m[Tooltip] && m.removeEventListener("mouseenter", _listener), m.classList.remove(`${clsPrefix$1.value}-tooltip-host`), current.value === m && (current.value = void 0), delete m[Tooltip];
102
+ }
103
+ };
104
+ var clsPrefix, isDark, style = /* @__PURE__ */ c([c(({ props: m }) => `:where(${m.bPrefix}spin-host)`, { position: "relative" }), cB("spin-directive", {
105
+ zIndex: "999999",
106
+ position: "absolute",
107
+ color: "var(--color-primary)",
108
+ display: "flex",
109
+ flexDirection: "column",
110
+ justifyContent: "center",
111
+ alignItems: "center",
112
+ gap: "4px",
113
+ willChange: "background-color",
114
+ backgroundColor: "rgb(var(--host-bg, 255 255 255) / 0)",
115
+ transition: "background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
116
+ }, [
117
+ cE("tip, icon", {
118
+ willChange: "opacity",
119
+ opacity: "0",
120
+ transition: "opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
121
+ }),
122
+ cE("tip:empty", { display: "none" }),
123
+ cM("spining", { backgroundColor: "rgb(var(--host-bg, 255 255 255) / 0.5)" }, [cE("tip, icon", { opacity: "1" })])
124
+ ])]);
125
+ const SpinDirectiveProvider = /* @__PURE__ */ defineComponent({
126
+ name: "SpinDirectiveProvider",
127
+ props: { dark: Boolean },
128
+ setup(F) {
129
+ return clsPrefix = useStyle("-spin-directive", style), isDark = toRef(F, "dark"), () => h(Fragment);
130
+ }
131
+ });
132
+ var Spin = /* @__PURE__ */ Symbol("spin-dir"), updateLoading = (m, { value: F, modifiers: I }) => {
133
+ if (m[Spin].loading.value = !!F, !m[Spin].loading.value) return;
134
+ let L = I.dark || !I.light && isDark.value;
135
+ m[Spin].spinEl.style.setProperty("--host-bg", L ? "0 0 0" : "255 255 255");
136
+ };
137
+ const vSpin = {
138
+ beforeMount(m) {
139
+ if (m.classList.add(`${clsPrefix.value}-spin-host`), m[Spin]) return;
140
+ let F = ref(!1), I = string2dom(`
141
+ <div class="${clsPrefix.value}-spin-directive">
142
+ <svg class="${clsPrefix.value}-spin-directive__icon" width="32" height="32" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
143
+ <g>
144
+ <animateTransform attributeName="transform" type="rotate" values="0 100 100;270 100 100" begin="0s" dur="1.6s" fill="freeze" repeatCount="indefinite"></animateTransform>
145
+ <circle fill="none" stroke="currentColor" stroke-width="18" stroke-linecap="round" cx="100" cy="100" r="92" stroke-dasharray="567" stroke-dashoffset="1848">
146
+ <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>
147
+ <animate attributeName="stroke-dashoffset" values="567;142;567" begin="0s" dur="1.6s" fill="freeze" repeatCount="indefinite"></animate>
148
+ </circle>
149
+ </g>
150
+ </svg>
151
+ <div class="${clsPrefix.value}-spin-directive__tip"></div>
152
+ </div>
153
+ `.trim()), L, { stop: R, update: z } = useElementIntersectionRect(m, (m) => {
154
+ L = m, Object.assign(I.style, {
155
+ left: 0,
156
+ top: 0,
157
+ width: L.width + "px",
158
+ height: L.height + "px"
159
+ });
160
+ }, { interval: 1e3 / 30 }), B, V = watch(F, debounce(() => {
161
+ if (F.value) B === void 0 && (clearTimeout(B), B = void 0), z(), m.append(I), requestAnimationFrame(() => {
162
+ F.value && I.classList.add(`${clsPrefix.value}-spin-directive--spining`);
163
+ });
164
+ else {
165
+ I.classList.remove(`${clsPrefix.value}-spin-directive--spining`);
166
+ let m = () => {
167
+ I.remove(), F && clearTimeout(F), F = null, I.removeEventListener("transitioncancel", m), I.removeEventListener("transitionend", m);
168
+ };
169
+ I.addEventListener("transitioncancel", m), I.addEventListener("transitionend", m);
170
+ let F = setTimeout(m, 300);
171
+ }
172
+ }, 30));
173
+ m[Spin] = {
174
+ loading: F,
175
+ spinEl: I,
176
+ updateTip: () => {
177
+ let F = I.querySelector(`.${clsPrefix.value}-spin-directive__tip`);
178
+ F.textContent = m.dataset.spinTip;
179
+ },
180
+ stop: () => {
181
+ R(), V();
182
+ }
183
+ };
184
+ },
185
+ mounted(m, F) {
186
+ updateLoading(m, F), m[Spin].updateTip(), !m[Spin].observer && nextTick().then(() => {
187
+ (m[Spin].observer = new MutationObserver((F) => {
188
+ for (let I of F) if (I.type === "attributes" && I.attributeName === "data-spin-tip") {
189
+ m[Spin].updateTip();
190
+ return;
191
+ }
192
+ })).observe(m, {
193
+ attributes: !0,
194
+ attributeFilter: ["data-spin-tip"]
195
+ });
196
+ });
197
+ },
198
+ updated: updateLoading,
199
+ beforeUnmount(m) {
200
+ m[Spin].loading.value = !1, m[Spin].stop(), m[Spin].observer?.disconnect(), delete m[Spin];
201
+ }
202
+ };
203
+ export { vTooltip as i, vSpin as n, TooltipDirectiveProvider as r, SpinDirectiveProvider as t };
@@ -1,3 +1,3 @@
1
- import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-DUuJW647.js";
2
- import "./use-style-DcT-1dj4.js";
1
+ import "./use-style-DrH-89qR.js";
2
+ import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-CB8tcZsk.js";
3
3
  export { SpinDirectiveProvider, TooltipDirectiveProvider, vSpin, vTooltip };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as useI18n, t as UI_I18N_INJECTION } from "./use-i18n-Dx7V4KrY.js";
2
- import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-DUuJW647.js";
3
- import { g as useStyle, i as cM, n as cB, r as cE, t as c } from "./use-style-DcT-1dj4.js";
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-DrH-89qR.js";
3
+ import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-CB8tcZsk.js";
4
4
  import { Fragment, computed, createVNode, defineComponent, inject, isVNode, mergeProps, provide, reactive, ref, renderSlot, shallowRef, toRef, toValue, unref, useTemplateRef, watch, withDirectives } from "vue";
5
5
  import { computedAsync, promiseTimeout, useElementHover, useElementSize, useEventListener, useFullscreen, watchDebounced } from "@vueuse/core";
6
6
  import { NAvatar, NBadge, NBreadcrumb, NBreadcrumbItem, NButton, NDrawer, NDrawerContent, NDropdown, NEmpty, NIcon, NList, NListItem, NMenu, NPagination, NPopover, NScrollbar, NText, NThing, useThemeVars } from "ithinkdt-ui";
@@ -28,8 +28,8 @@ const AppAccount = /* @__PURE__ */ defineComponent({
28
28
  }
29
29
  },
30
30
  emit: ["logout", "change-pwd"],
31
- setup(z, { emit: V, slots: H }) {
32
- let U = computed(() => /^[\u4E00-\u9FA5]+$/.test(z.nickname) ? z.nickname?.slice(z.nickname?.length > 3 ? 2 : 1) : z.nickname?.split(" ")[0]), { t: W } = useI18n(), G = createVNode(NIcon, { size: "28" }, { default: () => [createVNode("svg", {
31
+ setup(z, { emit: B, slots: V }) {
32
+ let H = computed(() => /^[\u4E00-\u9FA5]+$/.test(z.nickname) ? z.nickname?.slice(z.nickname?.length > 3 ? 2 : 1) : z.nickname?.split(" ")[0]), { t: U } = useI18n(), W = createVNode(NIcon, { size: "28" }, { default: () => [createVNode("svg", {
33
33
  xmlns: "http://www.w3.org/2000/svg",
34
34
  width: "1em",
35
35
  height: "1em",
@@ -59,15 +59,15 @@ const AppAccount = /* @__PURE__ */ defineComponent({
59
59
  radix: .78,
60
60
  color: "var(--color-primary-hover)"
61
61
  }, {
62
- fallback: () => G,
63
- placeholder: () => G,
64
- default: z.head ? void 0 : () => U.value
62
+ fallback: () => W,
63
+ placeholder: () => W,
64
+ default: z.head ? void 0 : () => H.value
65
65
  }), createVNode("span", { style: "font-size: 14px" }, [z.username ?? ""])])] }),
66
66
  default: () => {
67
67
  let d = () => z.showChangePwd ? createVNode(NButton, {
68
68
  quaternary: !0,
69
69
  style: "justify-content: left",
70
- onClick: () => V("change-pwd")
70
+ onClick: () => B("change-pwd")
71
71
  }, {
72
72
  icon: () => createVNode(NIcon, null, { default: () => [createVNode("svg", {
73
73
  xmlns: "http://www.w3.org/2000/svg",
@@ -83,33 +83,33 @@ const AppAccount = /* @__PURE__ */ defineComponent({
83
83
  r: "2",
84
84
  fill: "currentColor"
85
85
  }, null)])] }),
86
- default: () => W("common.account.changePwd")
87
- }) : void 0, B = () => z.showLogoutButton ? void 0 : createVNode(NButton, {
86
+ default: () => U("common.account.changePwd")
87
+ }) : void 0, H = () => z.showLogoutButton ? void 0 : createVNode(NButton, {
88
88
  quaternary: !0,
89
89
  style: "justify-content: left",
90
- onClick: () => V("logout")
90
+ onClick: () => B("logout")
91
91
  }, {
92
92
  icon: () => createVNode(NIcon, null, _isSlot$4(K) ? K : { default: () => [K] }),
93
- default: () => W("common.account.logout")
93
+ default: () => U("common.account.logout")
94
94
  });
95
- return H.dropdown ? H.dropdown({
95
+ return V.dropdown ? V.dropdown({
96
96
  pwd: d,
97
- logout: B
97
+ logout: H
98
98
  }) : createVNode("div", { style: "display: flex; flex-direction: column" }, [
99
99
  d(),
100
- H.dropdownExtra?.(),
101
- B()
100
+ V.dropdownExtra?.(),
101
+ H()
102
102
  ]);
103
103
  }
104
104
  }),
105
- H.extra?.(),
105
+ V.extra?.(),
106
106
  z.showLogoutButton ? withDirectives(createVNode(NButton, {
107
107
  quaternary: !0,
108
108
  style: "--n-padding: 0 12px",
109
- onClick: () => z.username && V("logout")
110
- }, { default: () => [H.logoutButton?.() ?? createVNode(NIcon, { size: "16" }, _isSlot$4(K) ? K : { default: () => [K] })] }), [[
109
+ onClick: () => z.username && B("logout")
110
+ }, { default: () => [V.logoutButton?.() ?? createVNode(NIcon, { size: "16" }, _isSlot$4(K) ? K : { default: () => [K] })] }), [[
111
111
  vTooltip,
112
- W("common.account.logout"),
112
+ U("common.account.logout"),
113
113
  void 0,
114
114
  { "bottom-end": !0 }
115
115
  ]]) : void 0
@@ -119,13 +119,13 @@ const AppAccount = /* @__PURE__ */ defineComponent({
119
119
  name: "AppAppearance",
120
120
  props: { mode: String },
121
121
  emit: ["update:mode"],
122
- setup(z, { emit: V }) {
123
- let { t: H } = useI18n();
122
+ setup(z, { emit: B }) {
123
+ let { t: V } = useI18n();
124
124
  return () => withDirectives(createVNode(NButton, {
125
125
  quaternary: !0,
126
126
  style: "--n-padding: 0 12px",
127
127
  onClick: () => {
128
- V("update:mode", z.mode === "light" ? "dark" : z.mode === "dark" ? "auto" : "light");
128
+ B("update:mode", z.mode === "light" ? "dark" : z.mode === "dark" ? "auto" : "light");
129
129
  }
130
130
  }, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [z.mode === "light" ? createVNode("svg", {
131
131
  xmlns: "http://www.w3.org/2000/svg",
@@ -159,7 +159,7 @@ const AppAccount = /* @__PURE__ */ defineComponent({
159
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
160
  }, null)])] })] }), [[
161
161
  vTooltip,
162
- z.mode === "light" ? H("common.layout.mode.light") : z.mode === "dark" ? H("common.layout.mode.dark") : H("common.layout.mode.auto"),
162
+ z.mode === "light" ? V("common.layout.mode.light") : z.mode === "dark" ? V("common.layout.mode.dark") : V("common.layout.mode.auto"),
163
163
  void 0,
164
164
  { bottom: !0 }
165
165
  ]]);
@@ -211,15 +211,15 @@ const AppBreadcrumb = /* @__PURE__ */ defineComponent({
211
211
  name: "AppFullscreen",
212
212
  props: {},
213
213
  emit: ["change"],
214
- setup(z, { emit: V }) {
215
- let { t: H } = useI18n(), { isFullscreen: U, toggle: W } = useFullscreen();
214
+ setup(z, { emit: B }) {
215
+ let { t: V } = useI18n(), { isFullscreen: H, toggle: U } = useFullscreen();
216
216
  return () => withDirectives(createVNode(NButton, {
217
217
  quaternary: !0,
218
218
  style: "--n-padding: 0 12px",
219
219
  onClick: () => {
220
- W(), V("change", U.value);
220
+ U(), B("change", H.value);
221
221
  }
222
- }, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [U.value ? createVNode("svg", {
222
+ }, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [H.value ? createVNode("svg", {
223
223
  xmlns: "http://www.w3.org/2000/svg",
224
224
  width: "1em",
225
225
  height: "1em",
@@ -245,7 +245,7 @@ const AppBreadcrumb = /* @__PURE__ */ defineComponent({
245
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
246
  }, null)])] })] }), [[
247
247
  vTooltip,
248
- U.value ? H("common.layout.screen.exitfull") : H("common.layout.screen.full"),
248
+ H.value ? V("common.layout.screen.exitfull") : V("common.layout.screen.full"),
249
249
  void 0,
250
250
  { bottom: !0 }
251
251
  ]]);
@@ -372,24 +372,24 @@ const AppLayout = /* @__PURE__ */ defineComponent({
372
372
  },
373
373
  setup(d, { slots: z }) {
374
374
  useStyle("-layout", style, ref("app"), !1);
375
- let B = reactive({
375
+ let V = reactive({
376
376
  siderWidth: "0px",
377
377
  headerHeight: "0px",
378
378
  footerHeight: "0px",
379
379
  hasMultiTab: !1
380
380
  });
381
- return provide(CTX_INJECTION_KEY, B), () => {
382
- let { layout: V } = d;
381
+ return provide(CTX_INJECTION_KEY, V), () => {
382
+ let { layout: B } = d;
383
383
  return createVNode("div", {
384
384
  class: {
385
385
  "app-layout": !0,
386
- "app-layout--full-header": V === "top2bottom",
386
+ "app-layout--full-header": B === "top2bottom",
387
387
  "app-layout--full-content": d.fullContent
388
388
  },
389
389
  style: {
390
- "--app-sider-width": B.siderWidth,
391
- "--app-header-height": B.headerHeight,
392
- "--app-footer-height": B.footerHeight
390
+ "--app-sider-width": V.siderWidth,
391
+ "--app-header-height": V.headerHeight,
392
+ "--app-footer-height": V.footerHeight
393
393
  }
394
394
  }, [renderSlot(z, "default")]);
395
395
  };
@@ -422,16 +422,16 @@ const AppLayout = /* @__PURE__ */ defineComponent({
422
422
  }
423
423
  },
424
424
  emits: { "update:collapsed": () => !0 },
425
- setup(z, { emit: V, slots: H }) {
425
+ setup(z, { emit: B, slots: V }) {
426
426
  provide(COLLAPSED_INJECTION_KEY, toRef(z, "collapsed"));
427
- let { t: U } = useI18n(), W = getCtx();
428
- return () => (W.siderWidth = (z.collapsed ? z.collapsedWidth : z.width) + "px", createVNode("div", { class: "app-sider" }, [renderSlot(H, "default"), z.showCollapseBtn ? withDirectives(createVNode(NButton, {
427
+ let { t: H } = useI18n(), U = getCtx();
428
+ return () => (U.siderWidth = (z.collapsed ? z.collapsedWidth : z.width) + "px", createVNode("div", { class: "app-sider" }, [renderSlot(V, "default"), z.showCollapseBtn ? withDirectives(createVNode(NButton, {
429
429
  class: "app-sider__collapse-btn",
430
430
  quaternary: !0,
431
431
  onClick: () => {
432
- V("update:collapsed", !z.collapsed);
432
+ B("update:collapsed", !z.collapsed);
433
433
  }
434
- }, { default: () => [createVNode(NIcon, { size: "20" }, { default: () => [z.collapsed ? createVNode(IUnfold, null, null) : createVNode(IFold, null, null)] })] }), [[vTooltip, z.collapsed ? U("common.layout.sider.expand") : U("common.layout.sider.collapse")]]) : void 0]));
434
+ }, { default: () => [createVNode(NIcon, { size: "20" }, { default: () => [z.collapsed ? createVNode(IUnfold, null, null) : createVNode(IFold, null, null)] })] }), [[vTooltip, z.collapsed ? H("common.layout.sider.expand") : H("common.layout.sider.collapse")]]) : void 0]));
435
435
  }
436
436
  }), AppContent = /* @__PURE__ */ defineComponent({
437
437
  name: "AppContent",
@@ -560,19 +560,19 @@ const AppMenu = /* @__PURE__ */ defineComponent({
560
560
  }, { immediate: !0 }), watch([useTemplateRef("menu"), () => d.current], ([d, z]) => {
561
561
  d?.showOption(z);
562
562
  }, { immediate: !0 });
563
- let V = inject(COLLAPSED_INJECTION_KEY, !1), H = (z) => {
564
- let H = d.collapsed ?? unref(V), U;
565
- if (z._.type === "view") if (z.isExternal && z.externalEmbed) U = createVNode("a", {
563
+ let B = inject(COLLAPSED_INJECTION_KEY, !1), V = (z) => {
564
+ let V = d.collapsed ?? unref(B), H;
565
+ if (z._.type === "view") if (z.isExternal && z.externalEmbed) H = createVNode("a", {
566
566
  href: z.externalLink,
567
567
  target: "_blank",
568
568
  onClick: (d) => d.stopPropagation()
569
569
  }, [z.label()]);
570
570
  else {
571
571
  let d;
572
- U = createVNode(RouterLink, { to: z.path }, _isSlot$1(d = z.label()) ? d : { default: () => [d] });
572
+ H = createVNode(RouterLink, { to: z.path }, _isSlot$1(d = z.label()) ? d : { default: () => [d] });
573
573
  }
574
- else U = createVNode("span", null, [z.label()]);
575
- return U.key = `${z.key}:${H ? 1 : 0}`, z.depth === 0 && !H && (U = withDirectives(U, [[
574
+ else H = createVNode("span", null, [z.label()]);
575
+ return H.key = `${z.key}:${V ? 1 : 0}`, z.depth === 0 && !V && (H = withDirectives(createVNode("div", null, [H]), [[
576
576
  vTooltip,
577
577
  z.label(),
578
578
  void 0,
@@ -580,7 +580,7 @@ const AppMenu = /* @__PURE__ */ defineComponent({
580
580
  auto: !0,
581
581
  right: !0
582
582
  }
583
- ]])), z.isNew && (U = createVNode("div", { style: "display: flex; width: 100%" }, [createVNode("span", { style: "flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis" }, [U]), createVNode("svg", {
583
+ ]])), z.isNew && (H = createVNode("div", { style: "display: flex; width: 100%" }, [createVNode("span", { style: "flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis" }, [H]), createVNode("svg", {
584
584
  xmlns: "http://www.w3.org/2000/svg",
585
585
  width: "24",
586
586
  height: "24",
@@ -589,24 +589,24 @@ const AppMenu = /* @__PURE__ */ defineComponent({
589
589
  }, [createVNode("path", {
590
590
  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",
591
591
  fill: "var(--color-danger)"
592
- }, null)])])), U;
592
+ }, null)])])), H;
593
593
  };
594
594
  return () => {
595
- let B = createVNode(NMenu, {
595
+ let H = createVNode(NMenu, {
596
596
  ref: "menu",
597
597
  options: z.value,
598
598
  rootIndent: 16,
599
599
  accordion: d.accordion,
600
- collapsed: d.collapsed ?? unref(V),
600
+ collapsed: d.collapsed ?? unref(B),
601
601
  dropdownProps: { showArrow: !0 },
602
602
  mode: d.horizontal ? "horizontal" : "vertical",
603
603
  value: d.current ?? null,
604
- renderLabel: H,
604
+ renderLabel: V,
605
605
  responsive: !0,
606
606
  collapsedWidth: d.collapsedWidth,
607
607
  width: d.width
608
608
  }, null);
609
- return d.horizontal ? B : createVNode(NScrollbar, null, _isSlot$1(B) ? B : { default: () => [B] });
609
+ return d.horizontal ? H : createVNode(NScrollbar, null, _isSlot$1(H) ? H : { default: () => [H] });
610
610
  };
611
611
  }
612
612
  });
@@ -630,7 +630,7 @@ function useCtxMenu(z, B, V) {
630
630
  {
631
631
  key: "reload",
632
632
  label: H("common.layout.tabs.reloadTab"),
633
- disabled: U.tab && U.tab.key !== B.value,
633
+ disabled: !U.tab || U.tab.key !== B.value,
634
634
  icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
635
635
  xmlns: "http://www.w3.org/2000/svg",
636
636
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
@@ -665,7 +665,7 @@ function useCtxMenu(z, B, V) {
665
665
  {
666
666
  key: "open",
667
667
  label: H("common.layout.tabs.openTabBlank"),
668
- disabled: U.tab?.key !== B.value,
668
+ disabled: !U.tab,
669
669
  icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
670
670
  xmlns: "http://www.w3.org/2000/svg",
671
671
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
@@ -756,19 +756,7 @@ function useCtxMenu(z, B, V) {
756
756
  V();
757
757
  return;
758
758
  }
759
- if (!U.tab) {
760
- let z = H.find((d) => d.key === B.value);
761
- switch (d) {
762
- case "open":
763
- window.open(z.href, "_blank");
764
- break;
765
- case "reload":
766
- z.reloading ||= (z.reloading = !0, await promiseTimeout(220), !1);
767
- break;
768
- }
769
- return;
770
- }
771
- switch (d) {
759
+ if (U.tab) switch (d) {
772
760
  case "open":
773
761
  window.open(U.tab.href, "_blank");
774
762
  break;
@@ -977,8 +965,8 @@ const AppNotification = /* @__PURE__ */ defineComponent({
977
965
  default: 3e4
978
966
  }
979
967
  },
980
- setup(z, { slots: H, attrs: U }) {
981
- let { t: W } = useI18n(), G = ref(!1), K = ref("unread"), q = reactive({
968
+ setup(z, { slots: B, attrs: V }) {
969
+ let { t: H } = useI18n(), U = ref(!1), W = ref("unread"), q = reactive({
982
970
  page: 1,
983
971
  size: 10,
984
972
  loading: !1,
@@ -990,8 +978,8 @@ const AppNotification = /* @__PURE__ */ defineComponent({
990
978
  onMsg: (d) => {
991
979
  q.unread = d;
992
980
  },
993
- getMsg: () => (G.value && (q.loading = !0, Promise.resolve(z.getPage?.(K.value, q.page, q.size) ?? []).then(({ records: d, total: z }) => {
994
- q.records = d, K.value === "unread" ? (q.unread = z, X(z)) : q.total = z;
981
+ getMsg: () => (U.value && (q.loading = !0, Promise.resolve(z.getPage?.(W.value, q.page, q.size) ?? []).then(({ records: d, total: z }) => {
982
+ q.records = d, W.value === "unread" ? (q.unread = z, X(z)) : q.total = z;
995
983
  }).finally(() => {
996
984
  q.loading = !1;
997
985
  })), z.getUnreadCount?.() ?? 0),
@@ -999,13 +987,13 @@ const AppNotification = /* @__PURE__ */ defineComponent({
999
987
  immediate: !0
1000
988
  });
1001
989
  return () => {
1002
- let d = withDirectives(createVNode(NButton, mergeProps(U, {
990
+ let d = withDirectives(createVNode(NButton, mergeProps(V, {
1003
991
  quaternary: !0,
1004
992
  style: "--n-padding: 0 12px",
1005
993
  onClick: () => {
1006
- G.value = !0, K.value = q.unread > 0 ? "unread" : "all", setTimeout(J, 300);
994
+ U.value = !0, W.value = q.unread > 0 ? "unread" : "all", setTimeout(J, 300);
1007
995
  }
1008
- }), { default: () => [H.icon ? H.icon() : createVNode(NBadge, {
996
+ }), { default: () => [B.icon ? B.icon() : createVNode(NBadge, {
1009
997
  show: q.unread > 0,
1010
998
  dot: !0,
1011
999
  offset: [-2, 5],
@@ -1024,27 +1012,27 @@ const AppNotification = /* @__PURE__ */ defineComponent({
1024
1012
  color: "currentColor"
1025
1013
  }, [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)])])] })] })] }), [[
1026
1014
  vTooltip,
1027
- W("common.notification.tip", { count: q.unread }),
1015
+ H("common.notification.tip", { count: q.unread }),
1028
1016
  void 0,
1029
1017
  { bottom: !0 }
1030
1018
  ]]), X = () => {
1031
1019
  let d, z;
1032
1020
  return createVNode("div", { style: "display: flex; align-items: baseline; gap: 20px" }, [
1033
- createVNode("div", { style: "padding-right: 12px" }, [W("common.notification.title")]),
1021
+ createVNode("div", { style: "padding-right: 12px" }, [H("common.notification.title")]),
1034
1022
  createVNode(NButton, {
1035
1023
  text: !0,
1036
- type: K.value === "all" ? "primary" : "default",
1024
+ type: W.value === "all" ? "primary" : "default",
1037
1025
  onClick: () => {
1038
- K.value = "all", J();
1026
+ W.value = "all", J();
1039
1027
  }
1040
- }, _isSlot(d = W("common.notification.all")) ? d : { default: () => [d] }),
1028
+ }, _isSlot(d = H("common.notification.all")) ? d : { default: () => [d] }),
1041
1029
  createVNode(NButton, {
1042
1030
  text: !0,
1043
- type: K.value === "unread" ? "primary" : "default",
1031
+ type: W.value === "unread" ? "primary" : "default",
1044
1032
  onClick: () => {
1045
- K.value = "unread", J();
1033
+ W.value = "unread", J();
1046
1034
  }
1047
- }, _isSlot(z = W("common.notification.unread", { count: q.unread > 99 ? "99+" : q.unread.toString() })) ? z : { default: () => [z] })
1035
+ }, _isSlot(z = H("common.notification.unread", { count: q.unread > 99 ? "99+" : q.unread.toString() })) ? z : { default: () => [z] })
1048
1036
  ]);
1049
1037
  }, Z = (d) => createVNode(NListItem, {
1050
1038
  key: d.key,
@@ -1090,16 +1078,16 @@ const AppNotification = /* @__PURE__ */ defineComponent({
1090
1078
  d.status = "read", q.unread--;
1091
1079
  });
1092
1080
  }
1093
- }, _isSlot(B = W("common.notification.markRead")) ? B : { default: () => [B] }) : void 0, createVNode(NButton, {
1081
+ }, _isSlot(B = H("common.notification.markRead")) ? B : { default: () => [B] }) : void 0, createVNode(NButton, {
1094
1082
  text: !0,
1095
1083
  type: "error",
1096
1084
  onClick: () => {
1097
1085
  q.records === 1 ? (q.records = [], J()) : q.records.splice(q.records.findIndex((z) => z.key == d.key), 1), z.markDelete?.([d.key]);
1098
1086
  }
1099
- }, _isSlot(V = W("common.notification.markDelete")) ? V : { default: () => [V] })]) : void 0;
1087
+ }, _isSlot(V = H("common.notification.markDelete")) ? V : { default: () => [V] })]) : void 0;
1100
1088
  },
1101
1089
  default: d.content,
1102
- footer: () => createVNode("span", { style: "color: gray" }, [d.hover ? format(d.date, W("common.notification.time")) : W("common.timeago", { time: d.date })])
1090
+ footer: () => createVNode("span", { style: "color: gray" }, [d.hover ? format(d.date, H("common.notification.time")) : H("common.timeago", { time: d.date })])
1103
1091
  })] }), Q = () => {
1104
1092
  let d;
1105
1093
  return withDirectives(q.records.length > 0 ? createVNode(NList, {
@@ -1107,7 +1095,7 @@ const AppNotification = /* @__PURE__ */ defineComponent({
1107
1095
  hoverable: !0,
1108
1096
  style: "min-height: 50vh"
1109
1097
  }, _isSlot(d = q.records.map((d) => Z(d))) ? d : { default: () => [d] }) : createVNode(NEmpty, { style: "margin-top: 30vh" }, null), [[vSpin, q.loading]]);
1110
- }, $ = () => createVNode("div", { style: "display: flex; justify-content: space-between; width: 100%" }, [K.value === "unread" ? createVNode(NButton, {
1098
+ }, $ = () => createVNode("div", { style: "display: flex; justify-content: space-between; width: 100%" }, [W.value === "unread" ? createVNode(NButton, {
1111
1099
  text: !0,
1112
1100
  type: "primary",
1113
1101
  disabled: q.records.length === 0,
@@ -1128,23 +1116,23 @@ const AppNotification = /* @__PURE__ */ defineComponent({
1128
1116
  fill: "currentColor",
1129
1117
  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"
1130
1118
  }, null)])] }),
1131
- default: () => W("common.notification.markPageRead")
1119
+ default: () => H("common.notification.markPageRead")
1132
1120
  }) : createVNode("span", null, null), createVNode(NPagination, {
1133
1121
  simple: !0,
1134
1122
  pageSize: q.size,
1135
1123
  page: q.page,
1136
- itemCount: K.value === "unread" ? q.unread : q.total,
1124
+ itemCount: W.value === "unread" ? q.unread : q.total,
1137
1125
  onUpdatePage: (d) => {
1138
1126
  q.page = d, J();
1139
1127
  }
1140
1128
  }, null)]);
1141
1129
  return createVNode(Fragment, null, [d, createVNode(NDrawer, {
1142
- show: G.value,
1143
- "onUpdate:show": (d) => G.value = d,
1130
+ show: U.value,
1131
+ "onUpdate:show": (d) => U.value = d,
1144
1132
  showMask: !1,
1145
1133
  width: 400
1146
1134
  }, { default: () => [createVNode(NDrawerContent, {
1147
- title: W("common.notification.title"),
1135
+ title: H("common.notification.title"),
1148
1136
  closable: !0,
1149
1137
  nativeScrollbar: !1,
1150
1138
  bodyContentStyle: { padding: "0" }