x-essential-lib 0.6.4 → 0.6.5
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.js +42 -40
- package/dist/utils/misc.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.id="x-essential-lib",a.appendChild(document.createTextNode('.x-cont[data-v-7ab74c70]{position:absolute;top:0;left:0;bottom:0;right:0;display:flex;align-items:center;justify-content:center}.lds-spinner[data-v-7ab74c70]{color:official;display:inline-block;position:relative;width:40px;height:40px}.lds-spinner div[data-v-7ab74c70]{transform-origin:20px 20px;animation:lds-spinner-7ab74c70 1.2s linear infinite}.lds-spinner div[data-v-7ab74c70]:after{content:" ";display:block;position:absolute;top:3px;left:18px;width:2px;height:6px;border-radius:5%;background:#9e9e9e}.lds-spinner div[data-v-7ab74c70]:nth-child(1){transform:rotate(0);animation-delay:-1.1s}.lds-spinner div[data-v-7ab74c70]:nth-child(2){transform:rotate(30deg);animation-delay:-1s}.lds-spinner div[data-v-7ab74c70]:nth-child(3){transform:rotate(60deg);animation-delay:-.9s}.lds-spinner div[data-v-7ab74c70]:nth-child(4){transform:rotate(90deg);animation-delay:-.8s}.lds-spinner div[data-v-7ab74c70]:nth-child(5){transform:rotate(120deg);animation-delay:-.7s}.lds-spinner div[data-v-7ab74c70]:nth-child(6){transform:rotate(150deg);animation-delay:-.6s}.lds-spinner div[data-v-7ab74c70]:nth-child(7){transform:rotate(180deg);animation-delay:-.5s}.lds-spinner div[data-v-7ab74c70]:nth-child(8){transform:rotate(210deg);animation-delay:-.4s}.lds-spinner div[data-v-7ab74c70]:nth-child(9){transform:rotate(240deg);animation-delay:-.3s}.lds-spinner div[data-v-7ab74c70]:nth-child(10){transform:rotate(270deg);animation-delay:-.2s}.lds-spinner div[data-v-7ab74c70]:nth-child(11){transform:rotate(300deg);animation-delay:-.1s}.lds-spinner div[data-v-7ab74c70]:nth-child(12){transform:rotate(330deg);animation-delay:0s}@keyframes lds-spinner-7ab74c70{0%{opacity:1}to{opacity:0}}.x-item[data-v-d5cfe252]{width:600px}@media (max-width: 600px){.x-item[data-v-d5cfe252]{width:calc(100vw - 16px)}}.x-cont[data-v-d525e6f5]{position:absolute;left:50%;bottom:20px;transform:translate(-50%);z-index:9999}')),document.head.appendChild(a)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
import { ref as d, defineComponent as T, computed as g, onMounted as V, onBeforeUnmount as I, watch as
|
|
3
|
-
import { useI18n as
|
|
2
|
+
import { ref as d, defineComponent as T, computed as g, onMounted as V, onBeforeUnmount as I, watch as Z, resolveComponent as h, openBlock as D, createBlock as O, withKeys as F, withModifiers as W, withCtx as w, createVNode as b, createTextVNode as E, toDisplayString as q, createElementBlock as Q, normalizeStyle as ne, pushScopeId as fe, popScopeId as ge, createElementVNode as v, createCommentVNode as le, unref as re, Fragment as ve, renderList as me, getCurrentScope as he, onScopeDispose as we, watchEffect as ye, getCurrentInstance as xe } from "vue";
|
|
3
|
+
import { useI18n as Y } from "vue-i18n";
|
|
4
4
|
import { defineStore as ce } from "pinia";
|
|
5
5
|
import ke from "axios";
|
|
6
6
|
import { useRouter as ue, useRoute as be } from "vue-router";
|
|
7
|
-
import { useTheme as
|
|
8
|
-
const
|
|
7
|
+
import { useTheme as P, useDisplay as Ce } from "vuetify";
|
|
8
|
+
const G = ce("global", () => {
|
|
9
9
|
const e = d(), a = d("en"), t = d({}), n = d(""), o = d("");
|
|
10
10
|
return {
|
|
11
11
|
dark: e,
|
|
@@ -72,7 +72,7 @@ var De = {
|
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
function
|
|
75
|
+
function J(e, a) {
|
|
76
76
|
function t(o, r, l) {
|
|
77
77
|
if (!(typeof document > "u")) {
|
|
78
78
|
l = X({}, a, l), typeof l.expires == "number" && (l.expires = new Date(Date.now() + l.expires * 864e5)), l.expires && (l.expires = l.expires.toUTCString()), o = encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
@@ -110,10 +110,10 @@ function Y(e, a) {
|
|
|
110
110
|
);
|
|
111
111
|
},
|
|
112
112
|
withAttributes: function(o) {
|
|
113
|
-
return
|
|
113
|
+
return J(this.converter, X({}, this.attributes, o));
|
|
114
114
|
},
|
|
115
115
|
withConverter: function(o) {
|
|
116
|
-
return
|
|
116
|
+
return J(X({}, this.converter, o), this.attributes);
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -122,7 +122,7 @@ function Y(e, a) {
|
|
|
122
122
|
}
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
|
-
var j =
|
|
125
|
+
var j = J(De, { path: "/" });
|
|
126
126
|
function xt(e) {
|
|
127
127
|
const a = ke.create({
|
|
128
128
|
timeout: 6e3
|
|
@@ -186,7 +186,7 @@ async function kt(e) {
|
|
|
186
186
|
setTimeout(a, e);
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
|
-
async function
|
|
189
|
+
async function ee(e, a, t) {
|
|
190
190
|
const n = Date.now();
|
|
191
191
|
return new Promise((o) => {
|
|
192
192
|
const r = async () => {
|
|
@@ -195,9 +195,11 @@ async function G(e, a, t) {
|
|
|
195
195
|
r();
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
-
|
|
198
|
+
function Re(e, a) {
|
|
199
199
|
const t = document.getElementById("single-spa-application:" + e);
|
|
200
|
-
t && (t.classList.remove("app-left", "app-right", "app-reset"), a ? t.classList.add("app-left") : t.classList.add("app-right"),
|
|
200
|
+
t && (t.classList.remove("app-left", "app-right", "app-reset"), a ? t.classList.add("app-left") : t.classList.add("app-right"), setTimeout(() => {
|
|
201
|
+
t.classList.add("app-reset");
|
|
202
|
+
}, 50));
|
|
201
203
|
}
|
|
202
204
|
let ae = Date.now();
|
|
203
205
|
function se() {
|
|
@@ -215,7 +217,7 @@ async function bt(e) {
|
|
|
215
217
|
const n = (r) => {
|
|
216
218
|
t = r, a = !0;
|
|
217
219
|
}, o = pe();
|
|
218
|
-
return s.on("confirmDlgResult" + o, n), s.emit("confirmDlg", { ...e, seq: o }), await
|
|
220
|
+
return s.on("confirmDlgResult" + o, n), s.emit("confirmDlg", { ...e, seq: o }), await ee(() => a), s.off("confirmDlgResult" + o, n), t;
|
|
219
221
|
}
|
|
220
222
|
async function Ct(e) {
|
|
221
223
|
if (!se())
|
|
@@ -224,7 +226,7 @@ async function Ct(e) {
|
|
|
224
226
|
const n = (r) => {
|
|
225
227
|
t = r, a = !0;
|
|
226
228
|
}, o = pe();
|
|
227
|
-
return s.on("promptDlgResult" + o, n), s.emit("promptDlg", { ...e, seq: o }), await
|
|
229
|
+
return s.on("promptDlgResult" + o, n), s.emit("promptDlg", { ...e, seq: o }), await ee(() => a), s.off("promptDlgResult" + o, n), t;
|
|
228
230
|
}
|
|
229
231
|
function Dt(e) {
|
|
230
232
|
s.emit("openWaitDlg", { text: e });
|
|
@@ -377,9 +379,9 @@ function K(e) {
|
|
|
377
379
|
l > 0 && l > t && (a = o, t = l);
|
|
378
380
|
}), a;
|
|
379
381
|
}
|
|
380
|
-
const
|
|
382
|
+
const N = d("");
|
|
381
383
|
function L(e, a) {
|
|
382
|
-
const t =
|
|
384
|
+
const t = G();
|
|
383
385
|
a === "/" && (a = t.lastAppPath);
|
|
384
386
|
const n = K(e), o = K(a);
|
|
385
387
|
if (!n) {
|
|
@@ -389,7 +391,7 @@ function L(e, a) {
|
|
|
389
391
|
if (console.info(`~~~~routeChange~~~~ ${a} -> ${e}`), !o)
|
|
390
392
|
return;
|
|
391
393
|
const r = n.app === o.app, l = n.path === o.path, c = n.level >= o.level;
|
|
392
|
-
r ? l ?
|
|
394
|
+
r ? l ? N.value = "" : N.value = c ? "inner-left" : "inner-right" : (N.value = "", Re(n.app, c));
|
|
393
395
|
}
|
|
394
396
|
function je() {
|
|
395
397
|
return !!j.get("accessToken");
|
|
@@ -440,7 +442,7 @@ function qt(e, a, t) {
|
|
|
440
442
|
const Be = /* @__PURE__ */ T({
|
|
441
443
|
__name: "index",
|
|
442
444
|
setup(e) {
|
|
443
|
-
const { t: a } =
|
|
445
|
+
const { t: a } = Y(), t = $(), n = g({
|
|
444
446
|
get() {
|
|
445
447
|
return t.hasView("confirmDlg");
|
|
446
448
|
},
|
|
@@ -461,7 +463,7 @@ const Be = /* @__PURE__ */ T({
|
|
|
461
463
|
const M = () => {
|
|
462
464
|
n.value = !1, y || (s.emit("confirmDlgResult" + _, !0), y = !0);
|
|
463
465
|
};
|
|
464
|
-
return
|
|
466
|
+
return Z(n, (m) => {
|
|
465
467
|
!m && !y && (s.emit("confirmDlgResult" + _, !1), y = !0);
|
|
466
468
|
}), (m, x) => {
|
|
467
469
|
const C = h("v-card-text"), S = h("v-btn"), R = h("v-card-actions"), f = h("v-card"), k = h("v-dialog");
|
|
@@ -538,11 +540,11 @@ const Be = /* @__PURE__ */ T({
|
|
|
538
540
|
zIndex: { default: 1 }
|
|
539
541
|
},
|
|
540
542
|
setup(e) {
|
|
541
|
-
const a =
|
|
543
|
+
const a = P(), t = e, n = g(() => ({
|
|
542
544
|
background: a.current.value.dark ? "#1e1e1e" : "#ffffff",
|
|
543
545
|
zIndex: t.zIndex
|
|
544
546
|
}));
|
|
545
|
-
return (o, r) => (D(),
|
|
547
|
+
return (o, r) => (D(), Q("div", {
|
|
546
548
|
class: "x-cont",
|
|
547
549
|
style: ne(n.value)
|
|
548
550
|
}, $e, 4));
|
|
@@ -553,8 +555,8 @@ const Be = /* @__PURE__ */ T({
|
|
|
553
555
|
t[n] = o;
|
|
554
556
|
return t;
|
|
555
557
|
}, ze = /* @__PURE__ */ te(He, [["__scopeId", "data-v-7ab74c70"]]);
|
|
556
|
-
var Xe = "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z", Fe = "M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41 10.59L10 14.17L17.59 6.58L19 8L10 17Z", Ke = "M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",
|
|
557
|
-
const
|
|
558
|
+
var Xe = "M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z", Fe = "M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41 10.59L10 14.17L17.59 6.58L19 8L10 17Z", Ke = "M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z", Ze = "M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z", Ge = "M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z";
|
|
559
|
+
const Ne = /* @__PURE__ */ T({
|
|
558
560
|
__name: "item",
|
|
559
561
|
props: {
|
|
560
562
|
id: {},
|
|
@@ -572,9 +574,9 @@ const Ge = /* @__PURE__ */ T({
|
|
|
572
574
|
case "success":
|
|
573
575
|
return Fe;
|
|
574
576
|
case "info":
|
|
575
|
-
return
|
|
577
|
+
return Ge;
|
|
576
578
|
case "error":
|
|
577
|
-
return
|
|
579
|
+
return Ze;
|
|
578
580
|
case "warning":
|
|
579
581
|
return Xe;
|
|
580
582
|
default:
|
|
@@ -585,7 +587,7 @@ const Ge = /* @__PURE__ */ T({
|
|
|
585
587
|
setTimeout(() => {
|
|
586
588
|
l("timeout", t.id);
|
|
587
589
|
}, t.timeout);
|
|
588
|
-
}),
|
|
590
|
+
}), Z(r, (c) => {
|
|
589
591
|
c || l("timeout", t.id);
|
|
590
592
|
}), (c, u) => {
|
|
591
593
|
const p = h("v-icon"), _ = h("v-sheet");
|
|
@@ -613,7 +615,7 @@ const Ge = /* @__PURE__ */ T({
|
|
|
613
615
|
}, 8, ["color"]);
|
|
614
616
|
};
|
|
615
617
|
}
|
|
616
|
-
}), Qe = /* @__PURE__ */ te(
|
|
618
|
+
}), Qe = /* @__PURE__ */ te(Ne, [["__scopeId", "data-v-d5cfe252"]]), Je = /* @__PURE__ */ T({
|
|
617
619
|
__name: "index",
|
|
618
620
|
setup(e) {
|
|
619
621
|
const a = d([]);
|
|
@@ -635,12 +637,12 @@ const Ge = /* @__PURE__ */ T({
|
|
|
635
637
|
const u = a.value.findIndex((p) => p.id === c);
|
|
636
638
|
u >= 0 && a.value.splice(u, 1);
|
|
637
639
|
};
|
|
638
|
-
return (c, u) => (D(),
|
|
640
|
+
return (c, u) => (D(), Q("div", {
|
|
639
641
|
class: "x-cont d-flex flex-column-reverse align-center",
|
|
640
642
|
onClick: u[0] || (u[0] = W(() => {
|
|
641
643
|
}, ["stop"]))
|
|
642
644
|
}, [
|
|
643
|
-
(D(!0),
|
|
645
|
+
(D(!0), Q(ve, null, me(a.value, (p) => (D(), O(Qe, {
|
|
644
646
|
id: p.id,
|
|
645
647
|
key: p.id,
|
|
646
648
|
type: p.type,
|
|
@@ -653,7 +655,7 @@ const Ge = /* @__PURE__ */ T({
|
|
|
653
655
|
}), Ye = /* @__PURE__ */ te(Je, [["__scopeId", "data-v-d525e6f5"]]), Pe = /* @__PURE__ */ T({
|
|
654
656
|
__name: "index",
|
|
655
657
|
setup(e) {
|
|
656
|
-
const { t: a } =
|
|
658
|
+
const { t: a } = Y(), t = $(), n = g({
|
|
657
659
|
get() {
|
|
658
660
|
return t.hasView("promptDlg");
|
|
659
661
|
},
|
|
@@ -664,7 +666,7 @@ const Ge = /* @__PURE__ */ T({
|
|
|
664
666
|
let x = 0, C = !1;
|
|
665
667
|
const S = async (f) => {
|
|
666
668
|
var k, A, H, z, B;
|
|
667
|
-
o.value = f.title, r.value = f.text, l.value = f.label, c.value = f.placeholder, u.value = f.rules, p.value = f.value, _.value = ((k = f.cancel) == null ? void 0 : k.color) ?? "primary", y.value = ((A = f.cancel) == null ? void 0 : A.text) ?? a("dlg.common.cancel"), i.value = ((H = f.confirm) == null ? void 0 : H.color) ?? "primary", M.value = ((z = f.confirm) == null ? void 0 : z.text) ?? a("dlg.common.confirm"), x = f.seq, C = !1, n.value = !0, await
|
|
669
|
+
o.value = f.title, r.value = f.text, l.value = f.label, c.value = f.placeholder, u.value = f.rules, p.value = f.value, _.value = ((k = f.cancel) == null ? void 0 : k.color) ?? "primary", y.value = ((A = f.cancel) == null ? void 0 : A.text) ?? a("dlg.common.cancel"), i.value = ((H = f.confirm) == null ? void 0 : H.color) ?? "primary", M.value = ((z = f.confirm) == null ? void 0 : z.text) ?? a("dlg.common.confirm"), x = f.seq, C = !1, n.value = !0, await ee(() => !!m.value, 1e3), (B = m.value) == null || B.focus();
|
|
668
670
|
};
|
|
669
671
|
V(() => {
|
|
670
672
|
s.on("promptDlg", S);
|
|
@@ -674,7 +676,7 @@ const Ge = /* @__PURE__ */ T({
|
|
|
674
676
|
const R = () => {
|
|
675
677
|
n.value = !1, C || (s.emit("promptDlgResult" + x, p.value ?? ""), C = !0);
|
|
676
678
|
};
|
|
677
|
-
return
|
|
679
|
+
return Z(n, (f) => {
|
|
678
680
|
!f && !C && (s.emit("promptDlgResult" + x, void 0), C = !0);
|
|
679
681
|
}), (f, k) => {
|
|
680
682
|
const A = h("v-card-text"), H = h("v-text-field"), z = h("v-form"), B = h("v-btn"), de = h("v-card-actions"), _e = h("v-card"), ie = h("v-dialog");
|
|
@@ -747,7 +749,7 @@ const Ge = /* @__PURE__ */ T({
|
|
|
747
749
|
}), et = { class: "mx-auto my-auto" }, tt = { class: "w-100 h-100 d-flex align-center justify-center" }, at = { class: "text-body-1" }, ot = /* @__PURE__ */ T({
|
|
748
750
|
__name: "index",
|
|
749
751
|
setup(e) {
|
|
750
|
-
const { t: a } =
|
|
752
|
+
const { t: a } = Y(), t = $(), n = g({
|
|
751
753
|
get() {
|
|
752
754
|
return t.hasView("waitDlg");
|
|
753
755
|
},
|
|
@@ -796,7 +798,7 @@ const Ge = /* @__PURE__ */ T({
|
|
|
796
798
|
e.component("XConfirmDlg", Be), e.component("XLoading", ze), e.component("XMessage", Ye), e.component("XPromptDlg", Pe), e.component("XWaitDlg", ot);
|
|
797
799
|
};
|
|
798
800
|
function Rt() {
|
|
799
|
-
const e =
|
|
801
|
+
const e = P(), a = g(() => e.global.current.value.colors.primary), t = g(() => e.global.current.value.colors.secondary), n = g(() => e.current.value.dark ? "#2e2e2e" : "#bdbdbd"), o = g(() => e.current.value.dark ? "#272727" : "#eeeeee"), r = g(() => e.current.value.dark ? "#1e1e1e" : "#ffffff"), l = g(() => e.current.value.dark ? "#303030" : "#f6f6f6"), c = g(() => e.current.value.dark ? "#ffffff1f" : "#0000001f");
|
|
800
802
|
return {
|
|
801
803
|
primaryColor: a,
|
|
802
804
|
secondaryColor: t,
|
|
@@ -844,12 +846,12 @@ function _t(e) {
|
|
|
844
846
|
return dt("(prefers-color-scheme: dark)", e);
|
|
845
847
|
}
|
|
846
848
|
function it() {
|
|
847
|
-
const e = Ce(), a =
|
|
849
|
+
const e = Ce(), a = G(), t = _t(), n = g(() => typeof a.dark == "boolean" ? a.dark : t.value), o = g(() => !!window.cordova), r = g(() => e.width.value <= 1280 ? e.width.value + "px" : e.width.value <= 1920 ? 1920 / 2.5 + "px" : 2560 / 2.5 + "px");
|
|
848
850
|
return { dark: n, sysBarAvail: o, compactWidth: r };
|
|
849
851
|
}
|
|
850
852
|
function It() {
|
|
851
|
-
const e = be(), a = ue(), t =
|
|
852
|
-
|
|
853
|
+
const e = be(), a = ue(), t = P(), { dark: n } = it(), o = G(), r = $();
|
|
854
|
+
Z(
|
|
853
855
|
n,
|
|
854
856
|
(i) => {
|
|
855
857
|
t.global.name.value = i ? "dark" : "light";
|
|
@@ -896,7 +898,7 @@ function It() {
|
|
|
896
898
|
});
|
|
897
899
|
}
|
|
898
900
|
function Ot() {
|
|
899
|
-
const e =
|
|
901
|
+
const e = G();
|
|
900
902
|
function a(t, n) {
|
|
901
903
|
const o = e.permissionObjects[t];
|
|
902
904
|
return o ? n ? !(!oe(o.includes, n) || oe(o.excludes, n)) : !0 : !1;
|
|
@@ -955,14 +957,14 @@ export {
|
|
|
955
957
|
bt as openConfirmDlg,
|
|
956
958
|
Ct as openPromptDlg,
|
|
957
959
|
Dt as openWaitDlg,
|
|
958
|
-
|
|
960
|
+
N as routeTransName,
|
|
959
961
|
Rt as useColor,
|
|
960
|
-
|
|
962
|
+
G as useGlobalStore,
|
|
961
963
|
It as useMicroApp,
|
|
962
964
|
Ot as usePermission,
|
|
963
965
|
it as useSystem,
|
|
964
966
|
$ as useViewMgrStore,
|
|
965
967
|
Et as useViewStack,
|
|
966
968
|
kt as waitMs,
|
|
967
|
-
|
|
969
|
+
ee as waitUtil
|
|
968
970
|
};
|
package/dist/utils/misc.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { Emitter, EventType } from 'mitt';
|
|
|
2
2
|
export declare const eventBus: Emitter<Record<EventType, unknown>>;
|
|
3
3
|
export declare function waitMs(ms: number): Promise<void>;
|
|
4
4
|
export declare function waitUtil(conditionFunc: () => boolean, timeout?: number, interval?: number): Promise<boolean>;
|
|
5
|
-
export declare function appAppear(name: string, forward: boolean):
|
|
5
|
+
export declare function appAppear(name: string, forward: boolean): void;
|