x-essential-lib 0.1.14 → 0.2.1
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/index.d.ts +10 -0
- package/dist/index.js +259 -201
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios'
|
|
1
2
|
import { DefineComponent, ComputedRef, Ref } from 'vue'
|
|
2
3
|
import { RouteLocationNormalized, NavigationGuardNext } from 'vue-router'
|
|
3
4
|
|
|
@@ -61,6 +62,15 @@ export declare function useSystem(): {
|
|
|
61
62
|
compactWidth: ComputedRef<string>
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
type OnError = (error: any) => void
|
|
66
|
+
|
|
67
|
+
interface Options {
|
|
68
|
+
baseUrl: string
|
|
69
|
+
onError: OnError
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export declare function createAxios(options: Options): AxiosInstance
|
|
73
|
+
|
|
64
74
|
export declare function waitMs(ms: number): Promise<void>
|
|
65
75
|
|
|
66
76
|
export declare function waitUtil(
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.inner-left-enter-active,.inner-right-enter-active{transition:transform .35s ease}.inner-left-enter-from{transform:translate(-100%)}.inner-right-enter-from{transform:translate(100%)}.inner-left-enter-to,.inner-right-enter-to{transform:translate(0)}.x-cont[data-v-a8f3d91f]{position:absolute;top:0;left:0;bottom:0;right:0;display:flex;align-items:center;justify-content:center}.lds-spinner[data-v-a8f3d91f]{color:official;display:inline-block;position:relative;width:40px;height:40px}.lds-spinner div[data-v-a8f3d91f]{transform-origin:20px 20px;animation:lds-spinner-a8f3d91f 1.2s linear infinite}.lds-spinner div[data-v-a8f3d91f]:after{content:" ";display:block;position:absolute;top:3px;left:18px;width:2px;height:6px;border-radius:5%;background:#9e9e9e}.lds-spinner div[data-v-a8f3d91f]:nth-child(1){transform:rotate(0);animation-delay:-1.1s}.lds-spinner div[data-v-a8f3d91f]:nth-child(2){transform:rotate(30deg);animation-delay:-1s}.lds-spinner div[data-v-a8f3d91f]:nth-child(3){transform:rotate(60deg);animation-delay:-.9s}.lds-spinner div[data-v-a8f3d91f]:nth-child(4){transform:rotate(90deg);animation-delay:-.8s}.lds-spinner div[data-v-a8f3d91f]:nth-child(5){transform:rotate(120deg);animation-delay:-.7s}.lds-spinner div[data-v-a8f3d91f]:nth-child(6){transform:rotate(150deg);animation-delay:-.6s}.lds-spinner div[data-v-a8f3d91f]:nth-child(7){transform:rotate(180deg);animation-delay:-.5s}.lds-spinner div[data-v-a8f3d91f]:nth-child(8){transform:rotate(210deg);animation-delay:-.4s}.lds-spinner div[data-v-a8f3d91f]:nth-child(9){transform:rotate(240deg);animation-delay:-.3s}.lds-spinner div[data-v-a8f3d91f]:nth-child(10){transform:rotate(270deg);animation-delay:-.2s}.lds-spinner div[data-v-a8f3d91f]:nth-child(11){transform:rotate(300deg);animation-delay:-.1s}.lds-spinner div[data-v-a8f3d91f]:nth-child(12){transform:rotate(330deg);animation-delay:0s}@keyframes lds-spinner-a8f3d91f{0%{opacity:1}to{opacity:0}}.x-cont[data-v-70ed4b89]{position:absolute;left:50%;bottom:20px;transform:translate(-50%);z-index:9999}')),document.head.appendChild(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
|
|
2
|
-
import { VBtn as
|
|
3
|
-
import { defineComponent as S, useModel as
|
|
4
|
-
import { useLocale as
|
|
5
|
-
|
|
2
|
+
import { VBtn as pe, VCard as fe, VCardActions as me, VCardText as ve, VCardTitle as ge, VDialog as _e, VForm as he, VTextField as xe } from "vuetify/lib/components/index.mjs";
|
|
3
|
+
import { defineComponent as S, useModel as L, ref as _, computed as d, onMounted as $, onBeforeUnmount as W, watch as N, resolveComponent as m, openBlock as C, createBlock as A, withKeys as U, withModifiers as M, withCtx as v, createVNode as h, createTextVNode as b, toDisplayString as k, createElementBlock as K, normalizeStyle as ye, pushScopeId as we, popScopeId as ke, createElementVNode as g, reactive as be, Fragment as Ce, renderList as Ve, unref as qe, inject as De } from "vue";
|
|
4
|
+
import { useLocale as H, useTheme as X, useDisplay as Se } from "vuetify/lib/framework.mjs";
|
|
5
|
+
import Re from "axios";
|
|
6
|
+
function Te(e) {
|
|
6
7
|
return { all: e = e || /* @__PURE__ */ new Map(), on: function(o, t) {
|
|
7
8
|
var n = e.get(o);
|
|
8
9
|
n ? n.push(t) : e.set(o, [t]);
|
|
@@ -11,29 +12,29 @@ function Ve(e) {
|
|
|
11
12
|
n && (t ? n.splice(n.indexOf(t) >>> 0, 1) : e.set(o, []));
|
|
12
13
|
}, emit: function(o, t) {
|
|
13
14
|
var n = e.get(o);
|
|
14
|
-
n && n.slice().map(function(
|
|
15
|
-
|
|
16
|
-
}), (n = e.get("*")) && n.slice().map(function(
|
|
17
|
-
|
|
15
|
+
n && n.slice().map(function(r) {
|
|
16
|
+
r(t);
|
|
17
|
+
}), (n = e.get("*")) && n.slice().map(function(r) {
|
|
18
|
+
r(o, t);
|
|
18
19
|
});
|
|
19
20
|
} };
|
|
20
21
|
}
|
|
21
|
-
const i =
|
|
22
|
-
async function
|
|
22
|
+
const i = Te();
|
|
23
|
+
async function st(e) {
|
|
23
24
|
return new Promise((o) => {
|
|
24
25
|
setTimeout(o, e);
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
|
-
async function
|
|
28
|
+
async function F(e, o, t) {
|
|
28
29
|
const n = Date.now();
|
|
29
|
-
return new Promise((
|
|
30
|
-
const
|
|
31
|
-
e() ?
|
|
30
|
+
return new Promise((r) => {
|
|
31
|
+
const l = async () => {
|
|
32
|
+
e() ? r(!0) : o && Date.now() - n > o ? r(!1) : setTimeout(l, t ?? 30);
|
|
32
33
|
};
|
|
33
|
-
|
|
34
|
+
l();
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
|
-
const
|
|
37
|
+
const Ie = /* @__PURE__ */ S({
|
|
37
38
|
__name: "index",
|
|
38
39
|
props: {
|
|
39
40
|
modelValue: { type: Boolean },
|
|
@@ -41,41 +42,41 @@ const be = /* @__PURE__ */ S({
|
|
|
41
42
|
},
|
|
42
43
|
emits: ["update:modelValue"],
|
|
43
44
|
setup(e) {
|
|
44
|
-
const o =
|
|
45
|
+
const o = H(), t = L(e, "modelValue"), n = _(""), r = _(""), l = _(), a = _(), s = d(() => {
|
|
45
46
|
var u;
|
|
46
|
-
return ((u =
|
|
47
|
+
return ((u = l.value) == null ? void 0 : u.color) ?? "primary";
|
|
47
48
|
}), f = d(() => {
|
|
48
49
|
var u;
|
|
49
|
-
return ((u =
|
|
50
|
+
return ((u = l.value) == null ? void 0 : u.text) ?? o.t("cancel");
|
|
50
51
|
}), p = d(() => {
|
|
51
52
|
var u;
|
|
52
53
|
return ((u = a.value) == null ? void 0 : u.color) ?? "primary";
|
|
53
|
-
}),
|
|
54
|
+
}), V = d(() => {
|
|
54
55
|
var u;
|
|
55
56
|
return ((u = a.value) == null ? void 0 : u.text) ?? o.t("confirm");
|
|
56
57
|
});
|
|
57
|
-
let
|
|
58
|
-
const
|
|
59
|
-
n.value = u.title,
|
|
58
|
+
let R = 0, q = !1;
|
|
59
|
+
const B = (u) => {
|
|
60
|
+
n.value = u.title, r.value = u.text, l.value = u.cancel, a.value = u.confirm, R = u.seq, q = !1, t.value = !0;
|
|
60
61
|
};
|
|
61
|
-
|
|
62
|
-
i.on("confirmDlg",
|
|
63
|
-
}),
|
|
64
|
-
i.off("confirmDlg",
|
|
62
|
+
$(() => {
|
|
63
|
+
i.on("confirmDlg", B);
|
|
64
|
+
}), W(() => {
|
|
65
|
+
i.off("confirmDlg", B);
|
|
65
66
|
});
|
|
66
67
|
const O = () => {
|
|
67
|
-
t.value = !1,
|
|
68
|
+
t.value = !1, q || (i.emit("confirmDlgResult" + R, !0), q = !0);
|
|
68
69
|
};
|
|
69
|
-
return
|
|
70
|
-
!u && !
|
|
70
|
+
return N(t, (u) => {
|
|
71
|
+
!u && !q && (i.emit("confirmDlgResult" + R, !1), q = !0);
|
|
71
72
|
}), (u, y) => {
|
|
72
|
-
const
|
|
73
|
-
return
|
|
73
|
+
const D = m("v-card-title"), j = m("v-card-text"), T = m("v-btn"), c = m("v-card-actions"), x = m("v-card"), z = m("v-dialog");
|
|
74
|
+
return C(), A(z, {
|
|
74
75
|
modelValue: t.value,
|
|
75
|
-
"onUpdate:modelValue": y[1] || (y[1] = (
|
|
76
|
+
"onUpdate:modelValue": y[1] || (y[1] = (I) => t.value = I),
|
|
76
77
|
onKeydown: [
|
|
77
|
-
y[2] || (y[2] =
|
|
78
|
-
|
|
78
|
+
y[2] || (y[2] = U(M((I) => t.value = !1, ["stop", "prevent"]), ["esc"])),
|
|
79
|
+
U(M(O, ["stop", "prevent"]), ["enter"])
|
|
79
80
|
],
|
|
80
81
|
transition: "dialog-top-transition",
|
|
81
82
|
"max-width": "600px"
|
|
@@ -83,37 +84,37 @@ const be = /* @__PURE__ */ S({
|
|
|
83
84
|
default: v(() => [
|
|
84
85
|
h(x, null, {
|
|
85
86
|
default: v(() => [
|
|
86
|
-
h(
|
|
87
|
+
h(D, null, {
|
|
87
88
|
default: v(() => [
|
|
88
|
-
|
|
89
|
+
b(k(n.value), 1)
|
|
89
90
|
]),
|
|
90
91
|
_: 1
|
|
91
92
|
}),
|
|
92
|
-
h(
|
|
93
|
+
h(j, null, {
|
|
93
94
|
default: v(() => [
|
|
94
|
-
|
|
95
|
+
b(k(r.value), 1)
|
|
95
96
|
]),
|
|
96
97
|
_: 1
|
|
97
98
|
}),
|
|
98
99
|
h(c, { class: "d-flex justify-end" }, {
|
|
99
100
|
default: v(() => [
|
|
100
|
-
h(
|
|
101
|
-
onClick: y[0] || (y[0] = (
|
|
101
|
+
h(T, {
|
|
102
|
+
onClick: y[0] || (y[0] = (I) => t.value = !1),
|
|
102
103
|
color: s.value,
|
|
103
104
|
variant: "text"
|
|
104
105
|
}, {
|
|
105
106
|
default: v(() => [
|
|
106
|
-
|
|
107
|
+
b(k(f.value), 1)
|
|
107
108
|
]),
|
|
108
109
|
_: 1
|
|
109
110
|
}, 8, ["color"]),
|
|
110
|
-
h(
|
|
111
|
+
h(T, {
|
|
111
112
|
onClick: O,
|
|
112
113
|
color: p.value,
|
|
113
114
|
variant: "text"
|
|
114
115
|
}, {
|
|
115
116
|
default: v(() => [
|
|
116
|
-
|
|
117
|
+
b(k(V.value), 1)
|
|
117
118
|
]),
|
|
118
119
|
_: 1
|
|
119
120
|
}, 8, ["color"])
|
|
@@ -128,7 +129,7 @@ const be = /* @__PURE__ */ S({
|
|
|
128
129
|
}, 8, ["modelValue", "onKeydown"]);
|
|
129
130
|
};
|
|
130
131
|
}
|
|
131
|
-
}),
|
|
132
|
+
}), Pe = (e) => (we("data-v-a8f3d91f"), e = e(), ke(), e), Me = /* @__PURE__ */ Pe(() => /* @__PURE__ */ g("div", { class: "lds-spinner" }, [
|
|
132
133
|
/* @__PURE__ */ g("div"),
|
|
133
134
|
/* @__PURE__ */ g("div"),
|
|
134
135
|
/* @__PURE__ */ g("div"),
|
|
@@ -141,9 +142,9 @@ const be = /* @__PURE__ */ S({
|
|
|
141
142
|
/* @__PURE__ */ g("div"),
|
|
142
143
|
/* @__PURE__ */ g("div"),
|
|
143
144
|
/* @__PURE__ */ g("div")
|
|
144
|
-
], -1)),
|
|
145
|
-
|
|
146
|
-
],
|
|
145
|
+
], -1)), $e = [
|
|
146
|
+
Me
|
|
147
|
+
], Ae = /* @__PURE__ */ S({
|
|
147
148
|
__name: "index",
|
|
148
149
|
props: {
|
|
149
150
|
zIndex: {
|
|
@@ -152,21 +153,21 @@ const be = /* @__PURE__ */ S({
|
|
|
152
153
|
}
|
|
153
154
|
},
|
|
154
155
|
setup(e) {
|
|
155
|
-
const o =
|
|
156
|
+
const o = X(), t = e, n = d(() => ({
|
|
156
157
|
background: o.current.value.dark ? "#1e1e1e" : "#ffffff",
|
|
157
158
|
zIndex: t.zIndex
|
|
158
159
|
}));
|
|
159
|
-
return (
|
|
160
|
+
return (r, l) => (C(), K("div", {
|
|
160
161
|
class: "x-cont",
|
|
161
|
-
style:
|
|
162
|
-
},
|
|
162
|
+
style: ye(n.value)
|
|
163
|
+
}, $e, 4));
|
|
163
164
|
}
|
|
164
|
-
}),
|
|
165
|
+
}), oe = (e, o) => {
|
|
165
166
|
const t = e.__vccOpts || e;
|
|
166
|
-
for (const [n,
|
|
167
|
-
t[n] =
|
|
167
|
+
for (const [n, r] of o)
|
|
168
|
+
t[n] = r;
|
|
168
169
|
return t;
|
|
169
|
-
},
|
|
170
|
+
}, Be = /* @__PURE__ */ oe(Ae, [["__scopeId", "data-v-a8f3d91f"]]), Oe = /* @__PURE__ */ S({
|
|
170
171
|
__name: "item",
|
|
171
172
|
props: {
|
|
172
173
|
id: {
|
|
@@ -188,7 +189,7 @@ const be = /* @__PURE__ */ S({
|
|
|
188
189
|
},
|
|
189
190
|
emits: ["timeout"],
|
|
190
191
|
setup(e, { emit: o }) {
|
|
191
|
-
const t = e, n = _(!0),
|
|
192
|
+
const t = e, n = _(!0), r = o, l = d(() => {
|
|
192
193
|
let a = "";
|
|
193
194
|
switch (t.type) {
|
|
194
195
|
case "error":
|
|
@@ -206,20 +207,20 @@ const be = /* @__PURE__ */ S({
|
|
|
206
207
|
}
|
|
207
208
|
return a;
|
|
208
209
|
});
|
|
209
|
-
return
|
|
210
|
+
return $(() => {
|
|
210
211
|
setTimeout(() => {
|
|
211
|
-
|
|
212
|
+
r("timeout", t.id);
|
|
212
213
|
}, t.timeout);
|
|
213
|
-
}),
|
|
214
|
-
a ||
|
|
214
|
+
}), N(n, (a) => {
|
|
215
|
+
a || r("timeout", t.id);
|
|
215
216
|
}), (a, s) => {
|
|
216
217
|
const f = m("v-alert");
|
|
217
|
-
return
|
|
218
|
+
return C(), A(f, {
|
|
218
219
|
modelValue: n.value,
|
|
219
220
|
"onUpdate:modelValue": s[0] || (s[0] = (p) => n.value = p),
|
|
220
221
|
class: "mt-2",
|
|
221
222
|
type: e.type,
|
|
222
|
-
icon:
|
|
223
|
+
icon: l.value,
|
|
223
224
|
text: e.text,
|
|
224
225
|
"max-width": "90%",
|
|
225
226
|
width: "500px",
|
|
@@ -229,34 +230,34 @@ const be = /* @__PURE__ */ S({
|
|
|
229
230
|
}, null, 8, ["modelValue", "type", "icon", "text"]);
|
|
230
231
|
};
|
|
231
232
|
}
|
|
232
|
-
}),
|
|
233
|
+
}), je = /* @__PURE__ */ S({
|
|
233
234
|
__name: "index",
|
|
234
235
|
setup(e) {
|
|
235
|
-
const o =
|
|
236
|
-
|
|
236
|
+
const o = be({ items: [] });
|
|
237
|
+
$(() => {
|
|
237
238
|
i.on("message", t);
|
|
238
|
-
}),
|
|
239
|
+
}), W(() => {
|
|
239
240
|
i.off("message", t);
|
|
240
241
|
});
|
|
241
242
|
const t = (s) => {
|
|
242
|
-
|
|
243
|
+
l(s.type, s.text, s.timeout);
|
|
243
244
|
}, n = (s) => {
|
|
244
245
|
a(s);
|
|
245
246
|
};
|
|
246
|
-
let
|
|
247
|
-
const
|
|
248
|
-
const
|
|
249
|
-
o.items.push({ id:
|
|
247
|
+
let r = 0;
|
|
248
|
+
const l = (s, f, p) => {
|
|
249
|
+
const V = r++;
|
|
250
|
+
o.items.push({ id: V, type: s, text: f, timeout: p });
|
|
250
251
|
}, a = (s) => {
|
|
251
252
|
const f = o.items.findIndex((p) => p.id === s);
|
|
252
253
|
f >= 0 && o.items.splice(f, 1);
|
|
253
254
|
};
|
|
254
|
-
return (s, f) => (
|
|
255
|
-
onClick: f[0] || (f[0] =
|
|
255
|
+
return (s, f) => (C(), K("div", {
|
|
256
|
+
onClick: f[0] || (f[0] = M(() => {
|
|
256
257
|
}, ["stop"])),
|
|
257
258
|
class: "x-cont d-flex flex-column-reverse align-center"
|
|
258
259
|
}, [
|
|
259
|
-
(
|
|
260
|
+
(C(!0), K(Ce, null, Ve(o.items, (p) => (C(), A(Oe, {
|
|
260
261
|
onTimeout: n,
|
|
261
262
|
id: p.id,
|
|
262
263
|
type: p.type,
|
|
@@ -266,7 +267,7 @@ const be = /* @__PURE__ */ S({
|
|
|
266
267
|
}, null, 8, ["id", "type", "text", "timeout"]))), 128))
|
|
267
268
|
]));
|
|
268
269
|
}
|
|
269
|
-
}),
|
|
270
|
+
}), Ee = /* @__PURE__ */ oe(je, [["__scopeId", "data-v-70ed4b89"]]), Ue = /* @__PURE__ */ S({
|
|
270
271
|
__name: "index",
|
|
271
272
|
props: {
|
|
272
273
|
modelValue: { type: Boolean },
|
|
@@ -274,67 +275,67 @@ const be = /* @__PURE__ */ S({
|
|
|
274
275
|
},
|
|
275
276
|
emits: ["update:modelValue"],
|
|
276
277
|
setup(e) {
|
|
277
|
-
const o =
|
|
278
|
+
const o = H(), t = L(e, "modelValue"), n = _(""), r = _(""), l = _(), a = _(), s = _(), f = _(""), p = _(), V = _(), R = d(() => {
|
|
278
279
|
var c;
|
|
279
280
|
return ((c = p.value) == null ? void 0 : c.color) ?? "primary";
|
|
280
|
-
}),
|
|
281
|
+
}), q = d(() => {
|
|
281
282
|
var c;
|
|
282
283
|
return ((c = p.value) == null ? void 0 : c.text) ?? o.t("cancel");
|
|
283
|
-
}),
|
|
284
|
+
}), B = d(() => {
|
|
284
285
|
var c;
|
|
285
|
-
return ((c =
|
|
286
|
+
return ((c = V.value) == null ? void 0 : c.color) ?? "primary";
|
|
286
287
|
}), O = d(() => {
|
|
287
288
|
var c;
|
|
288
|
-
return ((c =
|
|
289
|
+
return ((c = V.value) == null ? void 0 : c.text) ?? o.t("confirm");
|
|
289
290
|
}), u = _();
|
|
290
|
-
let y = 0,
|
|
291
|
-
const
|
|
291
|
+
let y = 0, D = !1;
|
|
292
|
+
const j = async (c) => {
|
|
292
293
|
var x;
|
|
293
|
-
n.value = c.title,
|
|
294
|
+
n.value = c.title, r.value = c.text, l.value = c.label, a.value = c.placeholder, s.value = c.rules, f.value = c.value, p.value = c.cancel, V.value = c.confirm, y = c.seq, D = !1, t.value = !0, await F(() => u.value !== void 0, 1e3), (x = u.value) == null || x.focus();
|
|
294
295
|
};
|
|
295
|
-
|
|
296
|
-
i.on("promptDlg",
|
|
297
|
-
}),
|
|
298
|
-
i.off("promptDlg",
|
|
296
|
+
$(() => {
|
|
297
|
+
i.on("promptDlg", j);
|
|
298
|
+
}), W(() => {
|
|
299
|
+
i.off("promptDlg", j);
|
|
299
300
|
});
|
|
300
|
-
const
|
|
301
|
-
t.value = !1,
|
|
301
|
+
const T = () => {
|
|
302
|
+
t.value = !1, D || (i.emit("promptDlgResult" + y, f.value ?? ""), D = !0);
|
|
302
303
|
};
|
|
303
|
-
return
|
|
304
|
-
!c && !
|
|
304
|
+
return N(t, (c) => {
|
|
305
|
+
!c && !D && (i.emit("promptDlgResult" + y, void 0), D = !0);
|
|
305
306
|
}), (c, x) => {
|
|
306
|
-
const
|
|
307
|
-
return
|
|
307
|
+
const z = m("v-card-title"), I = m("v-card-text"), se = m("v-text-field"), ce = m("v-form"), J = m("v-btn"), ie = m("v-card-actions"), ue = m("v-card"), de = m("v-dialog");
|
|
308
|
+
return C(), A(de, {
|
|
308
309
|
modelValue: t.value,
|
|
309
310
|
"onUpdate:modelValue": x[2] || (x[2] = (P) => t.value = P),
|
|
310
311
|
onKeydown: [
|
|
311
|
-
x[3] || (x[3] =
|
|
312
|
-
|
|
312
|
+
x[3] || (x[3] = U(M((P) => t.value = !1, ["stop", "prevent"]), ["esc"])),
|
|
313
|
+
U(M(T, ["stop", "prevent"]), ["enter"])
|
|
313
314
|
],
|
|
314
315
|
transition: "dialog-top-transition",
|
|
315
316
|
"max-width": "600px"
|
|
316
317
|
}, {
|
|
317
318
|
default: v(() => [
|
|
318
|
-
h(
|
|
319
|
+
h(ue, null, {
|
|
319
320
|
default: v(() => [
|
|
320
|
-
h(
|
|
321
|
+
h(z, null, {
|
|
321
322
|
default: v(() => [
|
|
322
|
-
|
|
323
|
+
b(k(n.value), 1)
|
|
323
324
|
]),
|
|
324
325
|
_: 1
|
|
325
326
|
}),
|
|
326
|
-
h(
|
|
327
|
+
h(I, null, {
|
|
327
328
|
default: v(() => [
|
|
328
|
-
|
|
329
|
+
b(k(r.value), 1)
|
|
329
330
|
]),
|
|
330
331
|
_: 1
|
|
331
332
|
}),
|
|
332
|
-
h(
|
|
333
|
+
h(ce, { class: "mx-3" }, {
|
|
333
334
|
default: v(() => [
|
|
334
|
-
h(
|
|
335
|
+
h(se, {
|
|
335
336
|
modelValue: f.value,
|
|
336
337
|
"onUpdate:modelValue": x[0] || (x[0] = (P) => f.value = P),
|
|
337
|
-
label:
|
|
338
|
+
label: l.value,
|
|
338
339
|
placeholder: a.value,
|
|
339
340
|
rules: s.value,
|
|
340
341
|
ref_key: "target",
|
|
@@ -343,25 +344,25 @@ const be = /* @__PURE__ */ S({
|
|
|
343
344
|
]),
|
|
344
345
|
_: 1
|
|
345
346
|
}),
|
|
346
|
-
h(
|
|
347
|
+
h(ie, { class: "d-flex justify-end" }, {
|
|
347
348
|
default: v(() => [
|
|
348
|
-
h(
|
|
349
|
+
h(J, {
|
|
349
350
|
onClick: x[1] || (x[1] = (P) => t.value = !1),
|
|
350
|
-
color:
|
|
351
|
+
color: R.value,
|
|
351
352
|
variant: "text"
|
|
352
353
|
}, {
|
|
353
354
|
default: v(() => [
|
|
354
|
-
|
|
355
|
+
b(k(q.value), 1)
|
|
355
356
|
]),
|
|
356
357
|
_: 1
|
|
357
358
|
}, 8, ["color"]),
|
|
358
|
-
h(
|
|
359
|
-
onClick:
|
|
360
|
-
color:
|
|
359
|
+
h(J, {
|
|
360
|
+
onClick: T,
|
|
361
|
+
color: B.value,
|
|
361
362
|
variant: "text"
|
|
362
363
|
}, {
|
|
363
364
|
default: v(() => [
|
|
364
|
-
|
|
365
|
+
b(k(O.value), 1)
|
|
365
366
|
]),
|
|
366
367
|
_: 1
|
|
367
368
|
}, 8, ["color"])
|
|
@@ -376,7 +377,7 @@ const be = /* @__PURE__ */ S({
|
|
|
376
377
|
}, 8, ["modelValue", "onKeydown"]);
|
|
377
378
|
};
|
|
378
379
|
}
|
|
379
|
-
}),
|
|
380
|
+
}), We = { class: "mx-auto my-auto" }, ze = { class: "d-flex align-center justify-center w-100 h-100" }, Ke = /* @__PURE__ */ S({
|
|
380
381
|
__name: "index",
|
|
381
382
|
props: {
|
|
382
383
|
modelValue: { type: Boolean },
|
|
@@ -384,18 +385,18 @@ const be = /* @__PURE__ */ S({
|
|
|
384
385
|
},
|
|
385
386
|
emits: ["update:modelValue"],
|
|
386
387
|
setup(e) {
|
|
387
|
-
const o =
|
|
388
|
+
const o = H(), t = L(e, "modelValue"), n = () => {
|
|
388
389
|
t.value = !0;
|
|
389
|
-
},
|
|
390
|
+
}, r = () => {
|
|
390
391
|
t.value = !1;
|
|
391
392
|
};
|
|
392
|
-
return
|
|
393
|
-
i.on("openWaitDlg", n), i.on("closeWaitDlg",
|
|
394
|
-
}),
|
|
395
|
-
i.off("openWaitDlg", n), i.off("closeWaitDlg",
|
|
396
|
-
}), (
|
|
393
|
+
return $(() => {
|
|
394
|
+
i.on("openWaitDlg", n), i.on("closeWaitDlg", r);
|
|
395
|
+
}), W(() => {
|
|
396
|
+
i.off("openWaitDlg", n), i.off("closeWaitDlg", r);
|
|
397
|
+
}), (l, a) => {
|
|
397
398
|
const s = m("v-card"), f = m("v-dialog");
|
|
398
|
-
return
|
|
399
|
+
return C(), A(f, {
|
|
399
400
|
modelValue: t.value,
|
|
400
401
|
"onUpdate:modelValue": a[0] || (a[0] = (p) => t.value = p),
|
|
401
402
|
persistent: "",
|
|
@@ -403,15 +404,15 @@ const be = /* @__PURE__ */ S({
|
|
|
403
404
|
fullscreen: ""
|
|
404
405
|
}, {
|
|
405
406
|
default: v(() => [
|
|
406
|
-
g("div",
|
|
407
|
+
g("div", We, [
|
|
407
408
|
h(s, {
|
|
408
409
|
width: "300px",
|
|
409
410
|
height: "80px",
|
|
410
411
|
loading: ""
|
|
411
412
|
}, {
|
|
412
413
|
default: v(() => [
|
|
413
|
-
g("div",
|
|
414
|
-
g("span", null, k(
|
|
414
|
+
g("div", ze, [
|
|
415
|
+
g("span", null, k(qe(o).t("waitingResponse")), 1)
|
|
415
416
|
])
|
|
416
417
|
]),
|
|
417
418
|
_: 1
|
|
@@ -423,79 +424,135 @@ const be = /* @__PURE__ */ S({
|
|
|
423
424
|
};
|
|
424
425
|
}
|
|
425
426
|
});
|
|
426
|
-
function
|
|
427
|
-
const e =
|
|
427
|
+
function ct() {
|
|
428
|
+
const e = X(), o = d(() => e.global.current.value.colors.primary), t = d(() => e.global.current.value.colors.secondary), n = d(() => e.current.value.dark ? "#2e2e2e" : "#bdbdbd"), r = d(() => e.current.value.dark ? "#272727" : "#eeeeee"), l = d(() => e.current.value.dark ? "#1e1e1e" : "#ffffff"), a = d(() => e.current.value.dark ? "#303030" : "#f6f6f6"), s = d(() => e.current.value.dark ? "#ffffff1f" : "#0000001f");
|
|
428
429
|
return {
|
|
429
430
|
primaryColor: o,
|
|
430
431
|
secondaryColor: t,
|
|
431
432
|
backgroundColor0: n,
|
|
432
|
-
backgroundColor1:
|
|
433
|
-
backgroundColor2:
|
|
433
|
+
backgroundColor1: r,
|
|
434
|
+
backgroundColor2: l,
|
|
434
435
|
highlightColor: a,
|
|
435
436
|
borderColor: s
|
|
436
437
|
};
|
|
437
438
|
}
|
|
438
|
-
function
|
|
439
|
-
const e =
|
|
440
|
-
return { dark: t, routeTransName: n, sysBarAvail:
|
|
439
|
+
function it() {
|
|
440
|
+
const e = X(), { width: o } = Se(), t = d(() => e.current.value.dark), n = _(""), r = d(() => !!window.cordova), l = d(() => o.value <= 1280 ? o.value + "px" : o.value <= 1920 ? 1920 / 2.5 + "px" : 2560 / 2.5 + "px");
|
|
441
|
+
return { dark: t, routeTransName: n, sysBarAvail: r, compactWidth: l };
|
|
442
|
+
}
|
|
443
|
+
var Le = {}, G;
|
|
444
|
+
(function(e) {
|
|
445
|
+
e.pop = "pop", e.push = "push";
|
|
446
|
+
})(G || (G = {}));
|
|
447
|
+
var Q;
|
|
448
|
+
(function(e) {
|
|
449
|
+
e.back = "back", e.forward = "forward", e.unknown = "";
|
|
450
|
+
})(Q || (Q = {}));
|
|
451
|
+
var Y;
|
|
452
|
+
(function(e) {
|
|
453
|
+
e[e.aborted = 4] = "aborted", e[e.cancelled = 8] = "cancelled", e[e.duplicated = 16] = "duplicated";
|
|
454
|
+
})(Y || (Y = {}));
|
|
455
|
+
const Ne = Symbol(Le.NODE_ENV !== "production" ? "router" : "");
|
|
456
|
+
function He() {
|
|
457
|
+
return De(Ne);
|
|
458
|
+
}
|
|
459
|
+
const E = require("js-cookie");
|
|
460
|
+
function ut(e) {
|
|
461
|
+
const o = Re.create({
|
|
462
|
+
timeout: 6e3
|
|
463
|
+
});
|
|
464
|
+
return o.defaults.baseURL = e.baseUrl, o.interceptors.request.use(
|
|
465
|
+
(t) => Xe(t),
|
|
466
|
+
(t) => {
|
|
467
|
+
Fe(t, e.onError);
|
|
468
|
+
}
|
|
469
|
+
), o.interceptors.response.use(
|
|
470
|
+
(t) => Je(t),
|
|
471
|
+
(t) => Ge(t, e.onError)
|
|
472
|
+
), o;
|
|
473
|
+
}
|
|
474
|
+
function Xe(e) {
|
|
475
|
+
const o = E.get("accessToken") ?? "";
|
|
476
|
+
return e.headers.Authorization = "Basic " + o, e.headers["Content-Type"] = "application/json", e.data = JSON.stringify(e.data), e;
|
|
441
477
|
}
|
|
442
|
-
|
|
443
|
-
|
|
478
|
+
function Fe(e, o) {
|
|
479
|
+
console.error(e), o("request timeout");
|
|
480
|
+
}
|
|
481
|
+
function Je(e) {
|
|
482
|
+
return e.data;
|
|
483
|
+
}
|
|
484
|
+
function Ge(e, o) {
|
|
485
|
+
var r;
|
|
486
|
+
const t = e.response;
|
|
487
|
+
if (!t)
|
|
488
|
+
return Promise.reject(e);
|
|
489
|
+
t.status === 401 && Qe();
|
|
490
|
+
let n = (r = t.data) == null ? void 0 : r.message;
|
|
491
|
+
return n || (n = {
|
|
492
|
+
code: t.status,
|
|
493
|
+
message: t.statusText
|
|
494
|
+
}), o(n), Promise.reject(e);
|
|
495
|
+
}
|
|
496
|
+
function Qe() {
|
|
497
|
+
E.remove("accessToken"), E.remove("refreshToken"), E.remove("activeOrg"), He().replace({ path: "/passport/login" });
|
|
498
|
+
}
|
|
499
|
+
let Z = Date.now();
|
|
500
|
+
function ne() {
|
|
444
501
|
const e = Date.now();
|
|
445
|
-
return e -
|
|
502
|
+
return e - Z > 500 ? (Z = e, !0) : !1;
|
|
446
503
|
}
|
|
447
|
-
let
|
|
448
|
-
function
|
|
449
|
-
return ++
|
|
504
|
+
let Ye = 0;
|
|
505
|
+
function re() {
|
|
506
|
+
return ++Ye;
|
|
450
507
|
}
|
|
451
|
-
async function
|
|
452
|
-
if (!
|
|
508
|
+
async function dt(e) {
|
|
509
|
+
if (!ne())
|
|
453
510
|
return;
|
|
454
511
|
let o = !1, t;
|
|
455
|
-
const n = (
|
|
456
|
-
t =
|
|
457
|
-
},
|
|
458
|
-
return i.on("confirmDlgResult" +
|
|
512
|
+
const n = (l) => {
|
|
513
|
+
t = l, o = !0;
|
|
514
|
+
}, r = re();
|
|
515
|
+
return i.on("confirmDlgResult" + r, n), i.emit("confirmDlg", { ...e, seq: r }), await F(() => o), i.off("confirmDlgResult" + r, n), t;
|
|
459
516
|
}
|
|
460
|
-
async function
|
|
461
|
-
if (!
|
|
517
|
+
async function pt(e) {
|
|
518
|
+
if (!ne())
|
|
462
519
|
return;
|
|
463
520
|
let o = !1, t;
|
|
464
|
-
const n = (
|
|
465
|
-
t =
|
|
466
|
-
},
|
|
467
|
-
return i.on("promptDlgResult" +
|
|
521
|
+
const n = (l) => {
|
|
522
|
+
t = l, o = !0;
|
|
523
|
+
}, r = re();
|
|
524
|
+
return i.on("promptDlgResult" + r, n), i.emit("promptDlg", { ...e, seq: r }), await F(() => o), i.off("promptDlgResult" + r, n), t;
|
|
468
525
|
}
|
|
469
|
-
function
|
|
526
|
+
function ft() {
|
|
470
527
|
i.emit("openWaitDlg");
|
|
471
528
|
}
|
|
472
|
-
function
|
|
529
|
+
function mt() {
|
|
473
530
|
i.emit("closeWaitDlg");
|
|
474
531
|
}
|
|
475
|
-
function
|
|
532
|
+
function vt(e, o) {
|
|
476
533
|
i.emit("message", { type: "error", text: e, timeout: o });
|
|
477
534
|
}
|
|
478
|
-
function
|
|
535
|
+
function gt(e, o) {
|
|
479
536
|
i.emit("message", { type: "info", text: e, timeout: o });
|
|
480
537
|
}
|
|
481
|
-
function
|
|
538
|
+
function _t(e, o) {
|
|
482
539
|
i.emit("message", { type: "success", text: e, timeout: o });
|
|
483
540
|
}
|
|
484
|
-
function
|
|
541
|
+
function ht(e, o) {
|
|
485
542
|
i.emit("message", { type: "warning", text: e, timeout: o });
|
|
486
543
|
}
|
|
487
|
-
function
|
|
488
|
-
var n,
|
|
544
|
+
function xt(e) {
|
|
545
|
+
var n, r;
|
|
489
546
|
if (!window.appAppear) {
|
|
490
547
|
window.appAppear = !0;
|
|
491
548
|
return;
|
|
492
549
|
}
|
|
493
550
|
const o = "single-spa-application:" + e, t = (n = document.getElementById(o)) == null ? void 0 : n.classList;
|
|
494
|
-
t && (t.remove("app-left", "app-right", "app-reset"), (
|
|
551
|
+
t && (t.remove("app-left", "app-right", "app-reset"), (r = window.routeExtras) != null && r.forward ? t.add("app-left") : t.add("app-right"), setTimeout(() => {
|
|
495
552
|
t.add("app-reset");
|
|
496
553
|
}, 0));
|
|
497
554
|
}
|
|
498
|
-
const
|
|
555
|
+
const ae = require("js-cookie"), Ze = [
|
|
499
556
|
{ path: "/passport/login", level: 0 },
|
|
500
557
|
{ path: "/passport/loginAccount", level: 1 },
|
|
501
558
|
{ path: "/passport/register", level: 1 },
|
|
@@ -515,48 +572,48 @@ const te = require("js-cookie"), Ee = [
|
|
|
515
572
|
{ path: "/calc", level: 1, requiredState: "org" },
|
|
516
573
|
{ path: "/data", level: 1, requiredState: "org" }
|
|
517
574
|
];
|
|
518
|
-
function
|
|
575
|
+
function le(e) {
|
|
519
576
|
let o, t = 0;
|
|
520
577
|
const n = e.split("/");
|
|
521
|
-
return
|
|
522
|
-
const
|
|
578
|
+
return Ze.forEach((r) => {
|
|
579
|
+
const l = r.path.split("/");
|
|
523
580
|
let a = 0;
|
|
524
|
-
for (let s = 0; s < n.length && !(s >=
|
|
581
|
+
for (let s = 0; s < n.length && !(s >= l.length || n[s] !== l[s]); s++)
|
|
525
582
|
a++;
|
|
526
|
-
a >= t && (o =
|
|
583
|
+
a >= t && (o = r, t = a);
|
|
527
584
|
}), o;
|
|
528
585
|
}
|
|
529
|
-
function
|
|
586
|
+
function ee(e) {
|
|
530
587
|
if (e === "/")
|
|
531
588
|
return { app: "", path: "/", level: -1 };
|
|
532
|
-
const o =
|
|
589
|
+
const o = le(e);
|
|
533
590
|
if (!o)
|
|
534
591
|
return { app: "invalidApp", path: "/invalidApp/invalidRoute", level: -1 };
|
|
535
592
|
const t = e.split("/");
|
|
536
593
|
return console.assert(t.length >= 2), { app: t[1], path: o.path, level: o.level };
|
|
537
594
|
}
|
|
538
|
-
const
|
|
595
|
+
const te = _("");
|
|
539
596
|
function w(e, o) {
|
|
540
|
-
const t =
|
|
597
|
+
const t = ee(e), n = ee(o), r = t.app === n.app, l = t.path === n.path, a = t.level >= n.level;
|
|
541
598
|
console.info(
|
|
542
|
-
`~~~~before route change~~~~ ${n.path} -> ${t.path} inner=${
|
|
543
|
-
),
|
|
599
|
+
`~~~~before route change~~~~ ${n.path} -> ${t.path} inner=${r} forward=${a}`
|
|
600
|
+
), r ? l ? te.value = "" : te.value = a ? "inner-left" : "inner-right" : window.routeExtras = { forward: a };
|
|
544
601
|
}
|
|
545
|
-
function
|
|
546
|
-
return !!
|
|
602
|
+
function et() {
|
|
603
|
+
return !!ae.get("accessToken");
|
|
547
604
|
}
|
|
548
|
-
function
|
|
549
|
-
return !!
|
|
605
|
+
function tt() {
|
|
606
|
+
return !!ae.get("activeOrg");
|
|
550
607
|
}
|
|
551
|
-
function
|
|
552
|
-
const n =
|
|
553
|
-
if (!
|
|
608
|
+
function yt(e, o, t) {
|
|
609
|
+
const n = et(), r = tt(), l = le(e.path);
|
|
610
|
+
if (!l) {
|
|
554
611
|
t();
|
|
555
612
|
return;
|
|
556
613
|
}
|
|
557
|
-
if (
|
|
614
|
+
if (l.requiredState === "auth")
|
|
558
615
|
if (n)
|
|
559
|
-
if (
|
|
616
|
+
if (r) {
|
|
560
617
|
const a = "/main";
|
|
561
618
|
w(a, o.path), t({ path: a });
|
|
562
619
|
} else
|
|
@@ -565,9 +622,9 @@ function lt(e, o, t) {
|
|
|
565
622
|
const a = "/passport/login";
|
|
566
623
|
w(a, o.path), t({ path: a });
|
|
567
624
|
}
|
|
568
|
-
else if (
|
|
625
|
+
else if (l.requiredState === "org")
|
|
569
626
|
if (n)
|
|
570
|
-
if (
|
|
627
|
+
if (r)
|
|
571
628
|
w(e.path, o.path), t();
|
|
572
629
|
else {
|
|
573
630
|
const a = "/org/joinOrCreate";
|
|
@@ -578,7 +635,7 @@ function lt(e, o, t) {
|
|
|
578
635
|
w(a, o.path), t({ path: a });
|
|
579
636
|
}
|
|
580
637
|
else if (n)
|
|
581
|
-
if (
|
|
638
|
+
if (r) {
|
|
582
639
|
const a = "/main";
|
|
583
640
|
w(a, o.path), t({ path: a });
|
|
584
641
|
} else {
|
|
@@ -588,24 +645,25 @@ function lt(e, o, t) {
|
|
|
588
645
|
else
|
|
589
646
|
w(e.path, o.path), t();
|
|
590
647
|
}
|
|
591
|
-
const
|
|
592
|
-
e.component("v-btn",
|
|
593
|
-
},
|
|
648
|
+
const ot = (e) => {
|
|
649
|
+
e.component("v-btn", pe), e.component("v-card", fe), e.component("v-card-actions", me), e.component("v-card-text", ve), e.component("v-card-title", ge), e.component("v-dialog", _e), e.component("v-form", he), e.component("v-text-field", xe), e.component("x-confirm-dlg", Ie), e.component("x-loading", Be), e.component("x-message", Ee), e.component("x-prompt-dlg", Ue), e.component("x-wait-dlg", Ke);
|
|
650
|
+
}, wt = { install: ot };
|
|
594
651
|
export {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
652
|
+
xt as appAppear,
|
|
653
|
+
mt as closeWaitDlg,
|
|
654
|
+
ut as createAxios,
|
|
655
|
+
wt as default,
|
|
656
|
+
vt as messageError,
|
|
657
|
+
gt as messageInfo,
|
|
658
|
+
_t as messageSuccess,
|
|
659
|
+
ht as messageWarning,
|
|
660
|
+
yt as onBeforeEach,
|
|
661
|
+
dt as openConfirmDlg,
|
|
662
|
+
pt as openPromptDlg,
|
|
663
|
+
ft as openWaitDlg,
|
|
664
|
+
te as routeTransName,
|
|
665
|
+
ct as useColor,
|
|
666
|
+
it as useSystem,
|
|
667
|
+
st as waitMs,
|
|
668
|
+
F as waitUtil
|
|
611
669
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x-essential-lib",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"mitt": "^3.0.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
+
"axios": "^1.6.8",
|
|
29
30
|
"vue": "^3.4.23",
|
|
30
31
|
"vue-router": "^4.3.2",
|
|
31
32
|
"vuetify": "^3.5.16"
|