@duxweb/dvha-core 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_virtual/_commonjsHelpers.cjs +1 -0
- package/dist/cjs/_virtual/dayjs.min.cjs +1 -0
- package/dist/cjs/_virtual/dayjs.min2.cjs +1 -0
- package/dist/cjs/components/auth/can.cjs +1 -1
- package/dist/cjs/components/loader/iframe.cjs +1 -1
- package/dist/cjs/components/loader/loader.cjs +1 -0
- package/dist/cjs/components/loader/remote/loader.cjs +1 -0
- package/dist/cjs/components/loader/remote/render.cjs +1 -0
- package/dist/cjs/components/overlay/overlay.cjs +1 -1
- package/dist/cjs/components/status/error.cjs +1 -1
- package/dist/cjs/components/status/exception.cjs +1 -0
- package/dist/cjs/components/status/notAuthorized.cjs +1 -1
- package/dist/cjs/components/status/notFound.cjs +1 -1
- package/dist/cjs/directive/permission.cjs +1 -1
- package/dist/cjs/hooks/auth.cjs +1 -1
- package/dist/cjs/hooks/data.cjs +1 -1
- package/dist/cjs/hooks/export.cjs +1 -1
- package/dist/cjs/hooks/form.cjs +1 -1
- package/dist/cjs/hooks/formExtend.cjs +1 -0
- package/dist/cjs/hooks/formValidate.cjs +1 -0
- package/dist/cjs/hooks/i18n.cjs +1 -1
- package/dist/cjs/hooks/importCsv.cjs +1 -1
- package/dist/cjs/hooks/json.cjs +1 -1
- package/dist/cjs/hooks/list.cjs +1 -0
- package/dist/cjs/hooks/manage.cjs +1 -1
- package/dist/cjs/hooks/menu.cjs +1 -1
- package/dist/cjs/hooks/overlay.cjs +1 -1
- package/dist/cjs/hooks/select.cjs +1 -1
- package/dist/cjs/hooks/theme.cjs +2 -2
- package/dist/cjs/hooks/upload.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/main.cjs +1 -1
- package/dist/cjs/node_modules/dayjs/dayjs.min.cjs +1 -0
- package/dist/cjs/node_modules/mitt/dist/mitt.cjs +1 -0
- package/dist/cjs/preset/dataProvider.cjs +1 -1
- package/dist/cjs/preset/i18nProvider.cjs +1 -1
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/cjs/stores/manage.cjs +1 -1
- package/dist/cjs/stores/tab.cjs +1 -1
- package/dist/cjs/stores/theme.cjs +1 -1
- package/dist/cjs/utils/theme.cjs +9 -1
- package/dist/esm/_virtual/_commonjsHelpers.js +6 -0
- package/dist/esm/_virtual/dayjs.min.js +7 -0
- package/dist/esm/_virtual/dayjs.min2.js +4 -0
- package/dist/esm/components/auth/can.js +9 -7
- package/dist/esm/components/loader/loader.js +47 -0
- package/dist/esm/components/loader/remote/loader.js +150 -0
- package/dist/esm/components/loader/remote/render.js +19 -0
- package/dist/esm/components/overlay/overlay.js +22 -31
- package/dist/esm/components/status/error.js +3 -3
- package/dist/esm/components/status/exception.js +23 -0
- package/dist/esm/components/status/notAuthorized.js +2 -2
- package/dist/esm/components/status/notFound.js +4 -4
- package/dist/esm/directive/permission.js +5 -3
- package/dist/esm/hooks/auth.js +67 -67
- package/dist/esm/hooks/data.js +164 -160
- package/dist/esm/hooks/export.js +26 -23
- package/dist/esm/hooks/form.js +38 -35
- package/dist/esm/hooks/formExtend.js +38 -0
- package/dist/esm/hooks/formValidate.js +28 -0
- package/dist/esm/hooks/i18n.js +16 -8
- package/dist/esm/hooks/json.js +57 -57
- package/dist/esm/hooks/list.js +179 -0
- package/dist/esm/hooks/manage.js +19 -14
- package/dist/esm/hooks/overlay.js +6 -4
- package/dist/esm/hooks/theme.js +11 -11
- package/dist/esm/index.js +129 -113
- package/dist/esm/main.js +22 -12
- package/dist/esm/node_modules/dayjs/dayjs.min.js +282 -0
- package/dist/esm/node_modules/mitt/dist/mitt.js +19 -0
- package/dist/esm/preset/i18nProvider.js +17 -18
- package/dist/esm/provider/app.js +61 -53
- package/dist/esm/stores/manage.js +23 -15
- package/dist/esm/stores/tab.js +58 -49
- package/dist/esm/utils/theme.js +89 -76
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/components/loader/loader.d.ts +2 -0
- package/dist/types/components/loader/remote/index.d.ts +2 -0
- package/dist/types/components/loader/remote/loader.d.ts +1 -0
- package/dist/types/components/loader/remote/render.d.ts +1 -0
- package/dist/types/components/status/error.d.ts +1 -2
- package/dist/types/components/status/exception.d.ts +3 -0
- package/dist/types/components/status/index.d.ts +4 -0
- package/dist/types/components/status/notAuthorized.d.ts +1 -2
- package/dist/types/components/status/notFound.d.ts +1 -2
- package/dist/types/config/index.d.ts +1 -0
- package/dist/types/hooks/auth.d.ts +6 -6
- package/dist/types/hooks/data.d.ts +30 -30
- package/dist/types/hooks/form.d.ts +6 -3
- package/dist/types/hooks/formExtend.d.ts +12 -0
- package/dist/types/hooks/formValidate.d.ts +14 -0
- package/dist/types/hooks/i18n.d.ts +2 -0
- package/dist/types/hooks/import.d.ts +1 -2
- package/dist/types/hooks/index.d.ts +4 -1
- package/dist/types/hooks/json.d.ts +1 -1
- package/dist/types/hooks/list.d.ts +66 -0
- package/dist/types/hooks/manage.d.ts +1 -0
- package/dist/types/index.d.ts +6 -5
- package/dist/types/preset/i18nProvider.d.ts +1 -1
- package/dist/types/stores/route.d.ts +180 -180
- package/dist/types/stores/tab.d.ts +1112 -73
- package/dist/types/types/config.d.ts +9 -0
- package/dist/types/types/i18n.d.ts +1 -0
- package/dist/types/types/manage.d.ts +6 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/theme.d.ts +4 -49
- package/package.json +11 -5
- /package/dist/cjs/{hooks/themeColor.cjs → config/color.cjs} +0 -0
- /package/dist/esm/{hooks/themeColor.js → config/color.js} +0 -0
- /package/dist/types/{hooks/themeColor.d.ts → config/color.d.ts} +0 -0
package/dist/esm/provider/app.js
CHANGED
|
@@ -1,63 +1,68 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { OverlaysProvider as
|
|
3
|
-
import { useRouter as
|
|
4
|
-
import { useCan as
|
|
5
|
-
import { useConfig as
|
|
1
|
+
import { defineComponent as V, inject as q, createVNode as B } from "vue";
|
|
2
|
+
import { OverlaysProvider as G } from "@overlastic/vue";
|
|
3
|
+
import { useRouter as H } from "vue-router";
|
|
4
|
+
import { useCan as J } from "../hooks/auth.js";
|
|
5
|
+
import { useConfig as K } from "../hooks/config.js";
|
|
6
6
|
import "@tanstack/vue-query";
|
|
7
|
-
import { useManage as
|
|
7
|
+
import { useManage as Q } from "../hooks/manage.js";
|
|
8
8
|
import "json-2-csv";
|
|
9
9
|
import "lodash-es";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
10
|
+
import "@vee-validate/rules";
|
|
11
|
+
import "vee-validate";
|
|
12
|
+
import { useAuthStore as T } from "../stores/auth.js";
|
|
13
|
+
import { useRouteStore as W } from "../stores/route.js";
|
|
12
14
|
import "pinia";
|
|
13
|
-
import { useManageStore as
|
|
14
|
-
import { useI18nStore as
|
|
15
|
+
import { useManageStore as X } from "../stores/manage.js";
|
|
16
|
+
import { useI18nStore as Y } from "../stores/i18n.js";
|
|
15
17
|
import "@vueuse/core";
|
|
16
18
|
import "../hooks/json/index.js";
|
|
17
|
-
import "clsx";
|
|
18
19
|
import "colorizr";
|
|
19
20
|
import "axios";
|
|
20
|
-
|
|
21
|
+
import "clsx";
|
|
22
|
+
import { DuxError as Z } from "../components/status/error.js";
|
|
23
|
+
import { DuxNotAuthorized as x } from "../components/status/notAuthorized.js";
|
|
24
|
+
import { DuxNotFound as ee } from "../components/status/notFound.js";
|
|
25
|
+
const De = /* @__PURE__ */ V({
|
|
21
26
|
name: "DuxAppProvider",
|
|
22
27
|
props: {},
|
|
23
|
-
setup(
|
|
24
|
-
slots:
|
|
28
|
+
setup(te, {
|
|
29
|
+
slots: c
|
|
25
30
|
}) {
|
|
26
|
-
const f =
|
|
27
|
-
return s.beforeEach(async (
|
|
28
|
-
var P,
|
|
29
|
-
const t =
|
|
31
|
+
const f = q("dux.manage"), u = K(), s = H();
|
|
32
|
+
return s.beforeEach(async (a, oe, n) => {
|
|
33
|
+
var P, b, R, A, S, $, k, M, z, D, w, I, N, C;
|
|
34
|
+
const t = a.meta.manageName, O = a.meta.authorization === !1;
|
|
30
35
|
if (!t) {
|
|
31
|
-
const e =
|
|
36
|
+
const e = u.defaultManage || ((b = (P = u.manages) == null ? void 0 : P[0]) == null ? void 0 : b.name) || "";
|
|
32
37
|
return n({
|
|
33
38
|
path: `/${e}`,
|
|
34
39
|
replace: !0
|
|
35
40
|
});
|
|
36
41
|
}
|
|
37
42
|
f && (f.value = t);
|
|
38
|
-
const h =
|
|
39
|
-
h.isInit() || h.setConfig((
|
|
40
|
-
const i =
|
|
41
|
-
if ((A =
|
|
43
|
+
const h = X(t);
|
|
44
|
+
h.isInit() || h.setConfig((R = u.manages) == null ? void 0 : R.find((e) => e.name === t), u);
|
|
45
|
+
const i = W(t), r = Q(t), d = T(t), l = Y(t);
|
|
46
|
+
if ((A = r.config) != null && A.i18nProvider && !l.isInit()) {
|
|
42
47
|
const e = l.getLocale();
|
|
43
|
-
e && ((S =
|
|
48
|
+
e && ((S = r.config) == null || S.i18nProvider.changeLocale(e));
|
|
44
49
|
}
|
|
45
50
|
if (!d.isLogin())
|
|
46
|
-
return
|
|
47
|
-
path:
|
|
51
|
+
return O ? n() : n({
|
|
52
|
+
path: r.getRoutePath("login"),
|
|
48
53
|
replace: !0
|
|
49
54
|
});
|
|
50
55
|
const g = (e) => e == null ? void 0 : e.map((p) => ({
|
|
51
56
|
...p,
|
|
52
|
-
path: p.path ?
|
|
57
|
+
path: p.path ? r.getRoutePath(p.path) : void 0
|
|
53
58
|
}));
|
|
54
59
|
if (!i.getRouteInit()) {
|
|
55
|
-
const e = (($ =
|
|
60
|
+
const e = (($ = r.config) == null ? void 0 : $.components) || {}, p = [];
|
|
56
61
|
if (p.push({
|
|
57
62
|
name: `${t}.notFound`,
|
|
58
63
|
label: "404",
|
|
59
64
|
path: ":pathMatch(.*)*",
|
|
60
|
-
component: e.notFound ||
|
|
65
|
+
component: e.notFound || ee,
|
|
61
66
|
hidden: !0,
|
|
62
67
|
meta: {
|
|
63
68
|
can: !1
|
|
@@ -66,7 +71,7 @@ const ve = /* @__PURE__ */ O({
|
|
|
66
71
|
name: `${t}.notAuthorized`,
|
|
67
72
|
label: "403",
|
|
68
73
|
path: "notAuthorized",
|
|
69
|
-
component: e.notAuthorized ||
|
|
74
|
+
component: e.notAuthorized || x,
|
|
70
75
|
hidden: !0,
|
|
71
76
|
meta: {
|
|
72
77
|
can: !1
|
|
@@ -75,76 +80,79 @@ const ve = /* @__PURE__ */ O({
|
|
|
75
80
|
name: `${t}.error`,
|
|
76
81
|
label: "500",
|
|
77
82
|
path: "error",
|
|
78
|
-
component: e.error ||
|
|
83
|
+
component: e.error || Z,
|
|
79
84
|
hidden: !0,
|
|
80
85
|
meta: {
|
|
81
86
|
can: !1
|
|
82
87
|
}
|
|
83
|
-
}), i.setRoutes(g(((
|
|
88
|
+
}), i.setRoutes(g(((k = r.config) == null ? void 0 : k.menus) || [])), (M = r.config) != null && M.apiRoutePath)
|
|
84
89
|
try {
|
|
85
|
-
await ((
|
|
86
|
-
path:
|
|
90
|
+
await ((w = (D = (z = r.config) == null ? void 0 : z.dataProvider) == null ? void 0 : D.default) == null ? void 0 : w.custom({
|
|
91
|
+
path: r.config.apiRoutePath,
|
|
87
92
|
meta: {
|
|
88
93
|
timeout: 5e3
|
|
89
94
|
}
|
|
90
|
-
},
|
|
95
|
+
}, r, d.getUser()).then((o) => {
|
|
91
96
|
i.appendRoutes(g(o.data || []));
|
|
92
97
|
}));
|
|
93
98
|
} catch (o) {
|
|
94
99
|
console.error(o);
|
|
95
100
|
}
|
|
96
101
|
return i.appendRoutes(p), i.getRoutes().forEach((o) => {
|
|
97
|
-
var E, F;
|
|
102
|
+
var E, F, y, L;
|
|
98
103
|
if (!o.path)
|
|
99
104
|
return;
|
|
100
|
-
const
|
|
105
|
+
const m = {
|
|
101
106
|
name: o.name,
|
|
102
107
|
path: o.path,
|
|
103
108
|
meta: o.meta
|
|
104
109
|
};
|
|
105
110
|
switch (o.loader) {
|
|
106
111
|
case "iframe":
|
|
107
|
-
|
|
112
|
+
m.component = ((F = (E = r.config) == null ? void 0 : E.components) == null ? void 0 : F.iframe) || (() => import("../components/loader/iframe.js"));
|
|
113
|
+
break;
|
|
114
|
+
case "remote":
|
|
115
|
+
m.component = ((L = (y = r.config) == null ? void 0 : y.components) == null ? void 0 : L.remote) || (() => import("../components/loader/loader.js"));
|
|
108
116
|
break;
|
|
109
117
|
case "link":
|
|
110
|
-
|
|
111
|
-
var
|
|
112
|
-
const
|
|
113
|
-
return
|
|
114
|
-
},
|
|
118
|
+
m.beforeEnter = () => {
|
|
119
|
+
var j;
|
|
120
|
+
const _ = ((j = o.meta) == null ? void 0 : j.url) || o.path;
|
|
121
|
+
return _ && window.open(_, "_blank"), !1;
|
|
122
|
+
}, m.component = () => Promise.resolve({
|
|
115
123
|
template: "<div></div>"
|
|
116
124
|
});
|
|
117
125
|
break;
|
|
118
126
|
default:
|
|
119
|
-
o.component && (
|
|
127
|
+
o.component && (m.component = o.component);
|
|
120
128
|
break;
|
|
121
129
|
}
|
|
122
|
-
s.addRoute(`${t}.auth`,
|
|
130
|
+
s.addRoute(`${t}.auth`, m);
|
|
123
131
|
}), n({
|
|
124
|
-
path: ((
|
|
132
|
+
path: ((I = a.redirectedFrom) == null ? void 0 : I.path) || a.path,
|
|
125
133
|
replace: !0
|
|
126
134
|
});
|
|
127
135
|
}
|
|
128
136
|
const v = ["", "/", `/${t}`, `/${t}/`];
|
|
129
|
-
if (v.includes(
|
|
137
|
+
if (v.includes(a.path)) {
|
|
130
138
|
const e = i.getIndexRoute();
|
|
131
139
|
return !(e != null && e.path) || v.includes(e == null ? void 0 : e.path) ? (console.warn("[Dux] index route not found, skip redirect"), n()) : n({
|
|
132
140
|
path: (e == null ? void 0 : e.path) || "/",
|
|
133
141
|
replace: !0
|
|
134
142
|
});
|
|
135
143
|
}
|
|
136
|
-
const
|
|
137
|
-
return (((
|
|
144
|
+
const U = J(t);
|
|
145
|
+
return (((N = a.meta) == null ? void 0 : N.can) === void 0 || ((C = a.meta) == null ? void 0 : C.can) === !0) && !U(a.name) ? n({
|
|
138
146
|
name: `${t}.notAuthorized`
|
|
139
147
|
}) : n();
|
|
140
|
-
}), () =>
|
|
148
|
+
}), () => B(G, null, {
|
|
141
149
|
default: () => {
|
|
142
|
-
var
|
|
143
|
-
return [(
|
|
150
|
+
var a;
|
|
151
|
+
return [(a = c.default) == null ? void 0 : a.call(c)];
|
|
144
152
|
}
|
|
145
153
|
});
|
|
146
154
|
}
|
|
147
155
|
});
|
|
148
156
|
export {
|
|
149
|
-
|
|
157
|
+
De as DuxAppProvider
|
|
150
158
|
};
|
|
@@ -1,35 +1,43 @@
|
|
|
1
1
|
import { cloneDeep as P } from "lodash-es";
|
|
2
|
-
import { defineStore as
|
|
3
|
-
import { inject as
|
|
4
|
-
function
|
|
2
|
+
import { defineStore as h } from "pinia";
|
|
3
|
+
import { inject as m, ref as u } from "vue";
|
|
4
|
+
function p(e) {
|
|
5
5
|
return e != null && typeof e == "object" && !Array.isArray(e) && typeof e.getList != "function";
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
const i =
|
|
7
|
+
function A(e) {
|
|
8
|
+
const i = m("dux.manage");
|
|
9
9
|
if (e || (e = (i == null ? void 0 : i.value) || ""), !e)
|
|
10
10
|
throw new Error("manage not found");
|
|
11
11
|
return y(e)();
|
|
12
12
|
}
|
|
13
13
|
function y(e) {
|
|
14
|
-
return
|
|
15
|
-
const i =
|
|
14
|
+
return h(`manages-${e}`, () => {
|
|
15
|
+
const i = u(), s = u(!1);
|
|
16
16
|
return {
|
|
17
17
|
config: i,
|
|
18
18
|
isInit: () => {
|
|
19
|
-
const
|
|
20
|
-
return s.value = !0,
|
|
19
|
+
const o = s.value;
|
|
20
|
+
return s.value = !0, o;
|
|
21
21
|
},
|
|
22
|
-
setConfig: (
|
|
23
|
-
const t = P(
|
|
24
|
-
t.title &&
|
|
22
|
+
setConfig: (o, r) => {
|
|
23
|
+
const t = P(o), n = [];
|
|
24
|
+
t.title && n.push(t.title), r.title && n.push(r.title), t.title = n.join(" - "), t.copyright = t.copyright || r.copyright, t.description = t.description || r.description, t.theme = { ...r == null ? void 0 : r.theme, ...t == null ? void 0 : t.theme };
|
|
25
25
|
const d = {};
|
|
26
|
-
r != null && r.dataProvider && (
|
|
26
|
+
r != null && r.dataProvider && (p(r.dataProvider) ? Object.keys(r.dataProvider).forEach((c) => {
|
|
27
27
|
d[c] = r.dataProvider[c];
|
|
28
|
-
}) : d.default = r.dataProvider), t != null && t.dataProvider && (
|
|
28
|
+
}) : d.default = r.dataProvider), t != null && t.dataProvider && (p(t.dataProvider) ? Object.keys(t.dataProvider).forEach((c) => {
|
|
29
29
|
d[c] = t.dataProvider[c];
|
|
30
30
|
}) : d.default = t.dataProvider), t.authProvider = (r == null ? void 0 : r.authProvider) || (t == null ? void 0 : t.authProvider), t.dataProvider = d, t.i18nProvider = (r == null ? void 0 : r.i18nProvider) || (t == null ? void 0 : t.i18nProvider), t.layoutComponent = {
|
|
31
31
|
...r.layoutComponent,
|
|
32
32
|
...t.layoutComponent
|
|
33
|
+
};
|
|
34
|
+
const v = {
|
|
35
|
+
...r.components,
|
|
36
|
+
...t.components
|
|
37
|
+
};
|
|
38
|
+
t.components = v, t.remote = {
|
|
39
|
+
...r.remote,
|
|
40
|
+
...t.remote
|
|
33
41
|
}, i.value = t;
|
|
34
42
|
},
|
|
35
43
|
getConfig: () => i.value
|
|
@@ -37,5 +45,5 @@ function y(e) {
|
|
|
37
45
|
});
|
|
38
46
|
}
|
|
39
47
|
export {
|
|
40
|
-
|
|
48
|
+
A as useManageStore
|
|
41
49
|
};
|
package/dist/esm/stores/tab.js
CHANGED
|
@@ -1,69 +1,78 @@
|
|
|
1
|
-
import { defineStore as
|
|
2
|
-
import { inject as
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
if (
|
|
1
|
+
import { defineStore as p } from "pinia";
|
|
2
|
+
import { inject as c, ref as s, nextTick as h } from "vue";
|
|
3
|
+
function E(i) {
|
|
4
|
+
const u = c("dux.manage");
|
|
5
|
+
if (i || (i = (u == null ? void 0 : u.value) || ""), !i)
|
|
6
6
|
throw new Error("manage not found");
|
|
7
|
-
return
|
|
7
|
+
return T(i)();
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
11
|
-
const o = s(),
|
|
9
|
+
function T(i) {
|
|
10
|
+
return p(`tab-${i}`, () => {
|
|
11
|
+
const u = s(), o = s(), e = s([]);
|
|
12
12
|
return {
|
|
13
|
-
current:
|
|
14
|
-
tabs:
|
|
15
|
-
isTab: (
|
|
16
|
-
addTab: (
|
|
17
|
-
|
|
13
|
+
current: u,
|
|
14
|
+
tabs: e,
|
|
15
|
+
isTab: (t) => e.value.some((a) => a.path === t),
|
|
16
|
+
addTab: (t, a) => {
|
|
17
|
+
t.path && (e.value.some((l) => l.path === t.path) ? (u.value && u.value !== t.path && (o.value = e.value.find((l) => l.path === u.value)), u.value = t.path) : (u.value && (o.value = e.value.find((l) => l.path === u.value)), e.value.push(t), a == null || a(t), u.value = t.path));
|
|
18
18
|
},
|
|
19
|
-
delTab: (
|
|
20
|
-
var
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
19
|
+
delTab: (t, a) => {
|
|
20
|
+
var d;
|
|
21
|
+
const l = e.value.findIndex((r) => r.path === t);
|
|
22
|
+
if (l === -1 || e.value.length <= 1)
|
|
23
23
|
return;
|
|
24
|
-
const n =
|
|
25
|
-
if ((
|
|
24
|
+
const n = e.value[l];
|
|
25
|
+
if ((d = n == null ? void 0 : n.meta) != null && d.lock)
|
|
26
26
|
return;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
let v;
|
|
28
|
+
if (t === u.value && o.value && (v = e.value.find((r) => {
|
|
29
|
+
var f;
|
|
30
|
+
return r.path === ((f = o.value) == null ? void 0 : f.path) && r.path !== t;
|
|
31
|
+
})), !v) {
|
|
32
|
+
const r = e.value[l - 1], f = e.value[l + 1];
|
|
33
|
+
v = r || f;
|
|
34
|
+
}
|
|
35
|
+
e.value.splice(l, 1), a == null || a(v);
|
|
31
36
|
},
|
|
32
|
-
changeTab: (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
a && (e == null || e(a));
|
|
37
|
+
changeTab: (t, a) => {
|
|
38
|
+
const l = e.value.find((n) => n.path === t);
|
|
39
|
+
l && (u.value && u.value !== t && (o.value = e.value.find((n) => n.path === u.value)), u.value = t, a == null || a(l));
|
|
36
40
|
},
|
|
37
|
-
delOther: (
|
|
38
|
-
|
|
41
|
+
delOther: (t, a) => {
|
|
42
|
+
e.value = e.value.filter((l) => {
|
|
39
43
|
var n;
|
|
40
|
-
return
|
|
41
|
-
}),
|
|
44
|
+
return l.path === t || ((n = l.meta) == null ? void 0 : n.lock);
|
|
45
|
+
}), a == null || a();
|
|
42
46
|
},
|
|
43
|
-
delLeft: (
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
delLeft: (t, a) => {
|
|
48
|
+
const l = e.value.findIndex((n) => n.path === t);
|
|
49
|
+
l <= 0 || h(() => {
|
|
50
|
+
e.value = [...e.value.slice(0, l).filter((n) => {
|
|
51
|
+
var v;
|
|
52
|
+
return (v = n.meta) == null ? void 0 : v.lock;
|
|
53
|
+
}), ...e.value.slice(l)], a == null || a();
|
|
54
|
+
});
|
|
49
55
|
},
|
|
50
|
-
delRight: (
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
delRight: (t, a) => {
|
|
57
|
+
const l = e.value.findIndex((n) => n.path === t);
|
|
58
|
+
l === -1 || l === e.value.length - 1 || h(() => {
|
|
59
|
+
e.value = [...e.value.slice(0, l + 1), ...e.value.slice(l + 1).filter((n) => {
|
|
60
|
+
var v;
|
|
61
|
+
return (v = n.meta) == null ? void 0 : v.lock;
|
|
62
|
+
})], a == null || a();
|
|
63
|
+
});
|
|
56
64
|
},
|
|
57
|
-
lockTab: (
|
|
58
|
-
const
|
|
59
|
-
|
|
65
|
+
lockTab: (t) => {
|
|
66
|
+
const a = e.value.findIndex((l) => l.path === t);
|
|
67
|
+
a !== -1 && e.value[a] && (e.value[a].meta || (e.value[a].meta = {}), e.value[a].meta.lock = !e.value[a].meta.lock);
|
|
60
68
|
},
|
|
61
69
|
clearTab: () => {
|
|
62
|
-
o.value = void 0,
|
|
70
|
+
u.value = void 0, o.value = void 0, e.value = [];
|
|
63
71
|
}
|
|
64
72
|
};
|
|
65
73
|
});
|
|
66
74
|
}
|
|
67
75
|
export {
|
|
68
|
-
|
|
76
|
+
T as createTabStore,
|
|
77
|
+
E as useTabStore
|
|
69
78
|
};
|
package/dist/esm/utils/theme.js
CHANGED
|
@@ -1,85 +1,98 @@
|
|
|
1
|
-
function
|
|
2
|
-
return `
|
|
1
|
+
function p(s) {
|
|
2
|
+
return `rgb(var(${s}))`;
|
|
3
3
|
}
|
|
4
|
-
function s
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
function f(s, u) {
|
|
5
|
+
return `color-mix(in oklab, rgb(var(${s})) var(${u}, 100%), transparent)`;
|
|
6
|
+
}
|
|
7
|
+
function C(s) {
|
|
8
|
+
const u = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"], m = ["primary", "info", "success", "warning", "error", "gray"], x = ["hover", "pressed", "focus", "disabled"], n = {
|
|
9
|
+
white: { DEFAULT: p("--ui-color-white") },
|
|
10
|
+
black: { DEFAULT: p("--ui-color-black") }
|
|
11
|
+
};
|
|
12
|
+
Object.keys(s).forEach((r) => {
|
|
13
|
+
n[r] = {}, u.forEach((e) => {
|
|
14
|
+
n[r][e] = p(`--base-color-${r}-${e}`);
|
|
9
15
|
});
|
|
10
|
-
}),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
16
|
+
}), m.forEach((r) => {
|
|
17
|
+
n[r] = {
|
|
18
|
+
DEFAULT: f(`--ui-color-${r}`, "--un-text-opacity")
|
|
19
|
+
}, u.forEach((e) => {
|
|
20
|
+
n[r][e] = f(`--ui-color-${r}-${e}`, "--un-text-opacity");
|
|
21
|
+
}), x.forEach((e) => {
|
|
22
|
+
n[r][e] = f(`--ui-color-${r}-${e}`, "--un-text-opacity");
|
|
15
23
|
});
|
|
16
24
|
});
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return Object.entries(d).forEach(([e, o]) => {
|
|
72
|
-
b.push([
|
|
73
|
-
e,
|
|
74
|
-
o
|
|
25
|
+
const l = {
|
|
26
|
+
text: ["default", "dimmed", "muted", "toned", "highlighted", "inverted"],
|
|
27
|
+
bg: ["default", "muted", "elevated", "accented", "inverted"],
|
|
28
|
+
border: ["default", "muted", "accented", "inverted"]
|
|
29
|
+
};
|
|
30
|
+
function a(r, e, i, t, d) {
|
|
31
|
+
const c = [];
|
|
32
|
+
return i.forEach((o) => {
|
|
33
|
+
const E = `--ui-${d || r}${o === "default" ? "" : `-${o}`}`;
|
|
34
|
+
c.push([
|
|
35
|
+
`${r}-${o}`,
|
|
36
|
+
{
|
|
37
|
+
[e]: `color-mix(in oklab, rgb(var(${E})) var(${t}, 100%), transparent)`,
|
|
38
|
+
[t]: "100%"
|
|
39
|
+
}
|
|
40
|
+
]), c.push([
|
|
41
|
+
new RegExp(`^${r}-${o}\\/(\\d*\\.?\\d+)(%?)$`),
|
|
42
|
+
([, b, A]) => {
|
|
43
|
+
const g = Number(b);
|
|
44
|
+
let h;
|
|
45
|
+
return A || g > 1 ? h = `${g}%` : h = `${g * 100}%`, {
|
|
46
|
+
[e]: `color-mix(in oklab, rgb(var(${E})) var(${t}, 100%), transparent)`,
|
|
47
|
+
[t]: h
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
]), c.push([
|
|
51
|
+
new RegExp(`^${r}-${o}\\[(.+)\\]$`),
|
|
52
|
+
([, b]) => ({
|
|
53
|
+
[e]: b.replace(/_/g, " ")
|
|
54
|
+
})
|
|
55
|
+
]);
|
|
56
|
+
}), c;
|
|
57
|
+
}
|
|
58
|
+
const v = a("text", "color", l.text, "--un-text-opacity"), R = a("bg", "background-color", l.bg, "--un-bg-opacity"), k = a("border", "border-color", l.border, "--un-border-opacity"), w = a("ring", "--un-ring-color", l.border, "--un-ring-opacity", "border"), $ = [];
|
|
59
|
+
l.border.forEach((r) => {
|
|
60
|
+
const e = `--ui-border${r === "default" ? "" : `-${r}`}`;
|
|
61
|
+
$.push([
|
|
62
|
+
new RegExp(`^divide-${r}$`),
|
|
63
|
+
(i, { rawSelector: t }) => `
|
|
64
|
+
.${t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")} > :not(:last-child) {
|
|
65
|
+
border-color: color-mix(in oklab, rgb(var(${e})) var(--un-border-opacity, 100%), transparent);
|
|
66
|
+
--un-border-opacity: 100%;
|
|
67
|
+
}`
|
|
68
|
+
]), $.push([
|
|
69
|
+
new RegExp(`^divide-${r}\\/(\\d*\\.?\\d+)(%?)$`),
|
|
70
|
+
([, i, t], { rawSelector: d }) => {
|
|
71
|
+
const c = Number(i);
|
|
72
|
+
let o;
|
|
73
|
+
return t || c > 1 ? o = `${c}%` : o = `${c * 100}%`, `
|
|
74
|
+
.${d.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")} > :not(:last-child) {
|
|
75
|
+
border-color: color-mix(in oklab, rgb(var(${e})) var(--un-border-opacity, 100%), transparent);
|
|
76
|
+
--un-border-opacity: ${o};
|
|
77
|
+
}`;
|
|
78
|
+
}
|
|
75
79
|
]);
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
});
|
|
81
|
+
const y = [
|
|
82
|
+
...v,
|
|
83
|
+
...R,
|
|
84
|
+
...k,
|
|
85
|
+
...w,
|
|
86
|
+
...$
|
|
87
|
+
];
|
|
88
|
+
return {
|
|
89
|
+
name: "preset-theme",
|
|
90
|
+
theme: {
|
|
91
|
+
colors: n
|
|
92
|
+
},
|
|
93
|
+
rules: y
|
|
81
94
|
};
|
|
82
95
|
}
|
|
83
96
|
export {
|
|
84
|
-
|
|
97
|
+
C as themePreset
|
|
85
98
|
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sfcLoader(path: string): () => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DuxRemoteRender: import("vue").DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default _default;
|
|
1
|
+
export declare const DuxError: import("vue").DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const DuxException: import("vue").DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default _default;
|
|
1
|
+
export declare const DuxNotAuthorized: import("vue").DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export default _default;
|
|
1
|
+
export declare const DuxNotFound: import("vue").DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|