x-essential-lib 0.5.5 → 0.5.7
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 +55 -46
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.id="x-essential-lib",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-f4ad116e]{position:absolute;top:0;left:0;bottom:0;right:0;display:flex;align-items:center;justify-content:center}.lds-spinner[data-v-f4ad116e]{color:official;display:inline-block;position:relative;width:40px;height:40px}.lds-spinner div[data-v-f4ad116e]{transform-origin:20px 20px;animation:lds-spinner-f4ad116e 1.2s linear infinite}.lds-spinner div[data-v-f4ad116e]:after{content:" ";display:block;position:absolute;top:3px;left:18px;width:2px;height:6px;border-radius:5%;background:#9e9e9e}.lds-spinner div[data-v-f4ad116e]:nth-child(1){transform:rotate(0);animation-delay:-1.1s}.lds-spinner div[data-v-f4ad116e]:nth-child(2){transform:rotate(30deg);animation-delay:-1s}.lds-spinner div[data-v-f4ad116e]:nth-child(3){transform:rotate(60deg);animation-delay:-.9s}.lds-spinner div[data-v-f4ad116e]:nth-child(4){transform:rotate(90deg);animation-delay:-.8s}.lds-spinner div[data-v-f4ad116e]:nth-child(5){transform:rotate(120deg);animation-delay:-.7s}.lds-spinner div[data-v-f4ad116e]:nth-child(6){transform:rotate(150deg);animation-delay:-.6s}.lds-spinner div[data-v-f4ad116e]:nth-child(7){transform:rotate(180deg);animation-delay:-.5s}.lds-spinner div[data-v-f4ad116e]:nth-child(8){transform:rotate(210deg);animation-delay:-.4s}.lds-spinner div[data-v-f4ad116e]:nth-child(9){transform:rotate(240deg);animation-delay:-.3s}.lds-spinner div[data-v-f4ad116e]:nth-child(10){transform:rotate(270deg);animation-delay:-.2s}.lds-spinner div[data-v-f4ad116e]:nth-child(11){transform:rotate(300deg);animation-delay:-.1s}.lds-spinner div[data-v-f4ad116e]:nth-child(12){transform:rotate(330deg);animation-delay:0s}@keyframes lds-spinner-f4ad116e{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 { ref as i, computed as g, onMounted as V, onBeforeUnmount as O, defineComponent as M,
|
|
3
|
-
import {
|
|
2
|
+
import { ref as i, watch as F, computed as g, onMounted as V, onBeforeUnmount as O, defineComponent as M, resolveComponent as h, openBlock as R, createBlock as E, unref as W, isRef as G, withKeys as z, withModifiers as K, withCtx as w, createVNode as k, createTextVNode as A, toDisplayString as T, createElementBlock as J, normalizeStyle as ve, pushScopeId as me, popScopeId as he, createElementVNode as m, reactive as we, Fragment as ye, renderList as xe, createCommentVNode as ke } from "vue";
|
|
3
|
+
import { useTheme as H, useLocale as Q, useDisplay as be } from "vuetify";
|
|
4
4
|
import { defineStore as re } from "pinia";
|
|
5
5
|
import Ce from "axios";
|
|
6
6
|
import { useRouter as le, useRoute as De } from "vue-router";
|
|
7
7
|
const ne = re(
|
|
8
8
|
"global",
|
|
9
9
|
() => {
|
|
10
|
-
const e = i(!0),
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const e = H(), a = i(!0), t = i(1), r = i(), o = i("en"), n = i({}), l = i("");
|
|
11
|
+
return F(
|
|
12
|
+
r,
|
|
13
|
+
() => {
|
|
14
|
+
const c = !!r.value;
|
|
15
|
+
c ? StatusBar == null || StatusBar.styleLightContent() : StatusBar == null || StatusBar.styleDefault(), e.global.name.value = c ? "dark" : "light";
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
immediate: !0
|
|
19
|
+
}
|
|
20
|
+
), {
|
|
21
|
+
running: a,
|
|
22
|
+
mainActive: t,
|
|
23
|
+
dark: r,
|
|
24
|
+
locale: o,
|
|
25
|
+
permissionObjects: n,
|
|
26
|
+
permissionChecksum: l
|
|
18
27
|
};
|
|
19
28
|
},
|
|
20
29
|
{
|
|
@@ -88,7 +97,7 @@ var Se = {
|
|
|
88
97
|
);
|
|
89
98
|
}
|
|
90
99
|
};
|
|
91
|
-
function
|
|
100
|
+
function X(e, a) {
|
|
92
101
|
function t(o, n, l) {
|
|
93
102
|
if (!(typeof document > "u")) {
|
|
94
103
|
l = L({}, 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);
|
|
@@ -126,10 +135,10 @@ function H(e, a) {
|
|
|
126
135
|
);
|
|
127
136
|
},
|
|
128
137
|
withAttributes: function(o) {
|
|
129
|
-
return
|
|
138
|
+
return X(this.converter, L({}, this.attributes, o));
|
|
130
139
|
},
|
|
131
140
|
withConverter: function(o) {
|
|
132
|
-
return
|
|
141
|
+
return X(L({}, this.converter, o), this.attributes);
|
|
133
142
|
}
|
|
134
143
|
},
|
|
135
144
|
{
|
|
@@ -138,7 +147,7 @@ function H(e, a) {
|
|
|
138
147
|
}
|
|
139
148
|
);
|
|
140
149
|
}
|
|
141
|
-
var
|
|
150
|
+
var B = X(Se, { path: "/" });
|
|
142
151
|
function rt(e) {
|
|
143
152
|
const a = Ce.create({
|
|
144
153
|
timeout: 6e3
|
|
@@ -154,7 +163,7 @@ function rt(e) {
|
|
|
154
163
|
), a;
|
|
155
164
|
}
|
|
156
165
|
function qe(e) {
|
|
157
|
-
const a =
|
|
166
|
+
const a = B.get("accessToken") ?? "";
|
|
158
167
|
return e.headers.Authorization = "Basic " + a, e.headers["Content-Type"] = "application/json", e.data = JSON.stringify(e.data), e;
|
|
159
168
|
}
|
|
160
169
|
function Ve(e, a) {
|
|
@@ -176,7 +185,7 @@ function Oe(e, a) {
|
|
|
176
185
|
}), a(r), Promise.reject(e);
|
|
177
186
|
}
|
|
178
187
|
function Te() {
|
|
179
|
-
|
|
188
|
+
B.remove("accessToken"), B.remove("refreshToken"), B.remove("activeOrg"), le().replace({ path: "/passport/login" });
|
|
180
189
|
}
|
|
181
190
|
function je(e) {
|
|
182
191
|
return { all: e = e || /* @__PURE__ */ new Map(), on: function(a, t) {
|
|
@@ -279,7 +288,7 @@ function te(e, a) {
|
|
|
279
288
|
return !1;
|
|
280
289
|
}), Object.keys(t).length <= 0);
|
|
281
290
|
}
|
|
282
|
-
const
|
|
291
|
+
const Be = [
|
|
283
292
|
{ path: "/passport/login", level: 0 },
|
|
284
293
|
{ path: "/passport/loginAccount", level: 1 },
|
|
285
294
|
{ path: "/passport/register", level: 1 },
|
|
@@ -301,7 +310,7 @@ const Ee = [
|
|
|
301
310
|
function N(e) {
|
|
302
311
|
let a, t = 0;
|
|
303
312
|
const r = e.split("/").filter((o) => o.trim() !== "");
|
|
304
|
-
return
|
|
313
|
+
return Be.forEach((o) => {
|
|
305
314
|
const n = o.path.split("/").filter((c) => c.trim() !== "");
|
|
306
315
|
let l = 0;
|
|
307
316
|
for (let c = 0; c < r.length && !(c >= n.length || r[c] !== n[c]); c++)
|
|
@@ -325,14 +334,14 @@ function q(e, a) {
|
|
|
325
334
|
`~~~~before route change~~~~ ${r.path} -> ${t.path} inner=${o} forward=${l}`
|
|
326
335
|
), o ? n ? oe.value = "" : oe.value = l ? "inner-left" : "inner-right" : window.routeExtras = { forward: l };
|
|
327
336
|
}
|
|
328
|
-
function
|
|
329
|
-
return !!
|
|
337
|
+
function Ee() {
|
|
338
|
+
return !!B.get("accessToken");
|
|
330
339
|
}
|
|
331
340
|
function Me() {
|
|
332
|
-
return !!
|
|
341
|
+
return !!B.get("activeOrg");
|
|
333
342
|
}
|
|
334
343
|
function gt(e, a, t) {
|
|
335
|
-
const r =
|
|
344
|
+
const r = Ee(), o = Me(), n = N(e.path);
|
|
336
345
|
if (!n) {
|
|
337
346
|
t();
|
|
338
347
|
return;
|
|
@@ -391,7 +400,7 @@ function Z(e, a) {
|
|
|
391
400
|
const Ue = /* @__PURE__ */ M({
|
|
392
401
|
__name: "index",
|
|
393
402
|
setup(e) {
|
|
394
|
-
const a =
|
|
403
|
+
const a = Q(), { open: t } = Z("confirmDlg"), r = i(""), o = i(""), n = i(), l = i(), c = g(() => {
|
|
395
404
|
var p;
|
|
396
405
|
return ((p = n.value) == null ? void 0 : p.color) ?? "primary";
|
|
397
406
|
}), u = g(() => {
|
|
@@ -416,13 +425,13 @@ const Ue = /* @__PURE__ */ M({
|
|
|
416
425
|
const f = () => {
|
|
417
426
|
t.value = !1, b || (s.emit("confirmDlgResult" + D, !0), b = !0);
|
|
418
427
|
};
|
|
419
|
-
return
|
|
428
|
+
return F(t, (p) => {
|
|
420
429
|
!p && !b && (s.emit("confirmDlgResult" + D, !1), b = !0);
|
|
421
430
|
}), (p, y) => {
|
|
422
431
|
const C = h("v-card-text"), S = h("v-btn"), I = h("v-card-actions"), d = h("v-card"), x = h("v-dialog");
|
|
423
|
-
return R(),
|
|
432
|
+
return R(), E(x, {
|
|
424
433
|
modelValue: W(t),
|
|
425
|
-
"onUpdate:modelValue": y[1] || (y[1] = (U) =>
|
|
434
|
+
"onUpdate:modelValue": y[1] || (y[1] = (U) => G(t) ? t.value = U : null),
|
|
426
435
|
onKeydown: [
|
|
427
436
|
y[2] || (y[2] = z(K((U) => t.value = !1, ["stop", "prevent"]), ["esc"])),
|
|
428
437
|
z(K(f, ["stop", "prevent"]), ["enter"])
|
|
@@ -496,11 +505,11 @@ const Ue = /* @__PURE__ */ M({
|
|
|
496
505
|
}
|
|
497
506
|
},
|
|
498
507
|
setup(e) {
|
|
499
|
-
const a =
|
|
508
|
+
const a = H(), t = e, r = g(() => ({
|
|
500
509
|
background: a.current.value.dark ? "#1e1e1e" : "#ffffff",
|
|
501
510
|
zIndex: t.zIndex
|
|
502
511
|
}));
|
|
503
|
-
return (o, n) => (R(),
|
|
512
|
+
return (o, n) => (R(), J("div", {
|
|
504
513
|
class: "x-cont",
|
|
505
514
|
style: ve(r.value)
|
|
506
515
|
}, Le, 4));
|
|
@@ -554,11 +563,11 @@ const Ue = /* @__PURE__ */ M({
|
|
|
554
563
|
setTimeout(() => {
|
|
555
564
|
o("timeout", t.id);
|
|
556
565
|
}, t.timeout);
|
|
557
|
-
}),
|
|
566
|
+
}), F(r, (l) => {
|
|
558
567
|
l || o("timeout", t.id);
|
|
559
568
|
}), (l, c) => {
|
|
560
569
|
const u = h("v-alert");
|
|
561
|
-
return R(),
|
|
570
|
+
return R(), E(u, {
|
|
562
571
|
modelValue: r.value,
|
|
563
572
|
"onUpdate:modelValue": c[0] || (c[0] = (_) => r.value = _),
|
|
564
573
|
class: "mt-2",
|
|
@@ -595,12 +604,12 @@ const Ue = /* @__PURE__ */ M({
|
|
|
595
604
|
const u = a.items.findIndex((_) => _.id === c);
|
|
596
605
|
u >= 0 && a.items.splice(u, 1);
|
|
597
606
|
};
|
|
598
|
-
return (c, u) => (R(),
|
|
607
|
+
return (c, u) => (R(), J("div", {
|
|
599
608
|
onClick: u[0] || (u[0] = K(() => {
|
|
600
609
|
}, ["stop"])),
|
|
601
610
|
class: "x-cont d-flex flex-column-reverse align-center"
|
|
602
611
|
}, [
|
|
603
|
-
(R(!0),
|
|
612
|
+
(R(!0), J(ye, null, xe(a.items, (_) => (R(), E(Ne, {
|
|
604
613
|
onTimeout: r,
|
|
605
614
|
id: _.id,
|
|
606
615
|
type: _.type,
|
|
@@ -613,7 +622,7 @@ const Ue = /* @__PURE__ */ M({
|
|
|
613
622
|
}), He = /* @__PURE__ */ pe(Fe, [["__scopeId", "data-v-70ed4b89"]]), Je = /* @__PURE__ */ M({
|
|
614
623
|
__name: "index",
|
|
615
624
|
setup(e) {
|
|
616
|
-
const a =
|
|
625
|
+
const a = Q(), { open: t } = Z("promptDlg"), r = i(""), o = i(""), n = i(), l = i(), c = i(), u = i(""), _ = i(), v = i(), D = g(() => {
|
|
617
626
|
var d;
|
|
618
627
|
return ((d = _.value) == null ? void 0 : d.color) ?? "primary";
|
|
619
628
|
}), b = g(() => {
|
|
@@ -639,13 +648,13 @@ const Ue = /* @__PURE__ */ M({
|
|
|
639
648
|
const I = () => {
|
|
640
649
|
t.value = !1, C || (s.emit("promptDlgResult" + y, u.value ?? ""), C = !0);
|
|
641
650
|
};
|
|
642
|
-
return
|
|
651
|
+
return F(t, (d) => {
|
|
643
652
|
!d && !C && (s.emit("promptDlgResult" + y, void 0), C = !0);
|
|
644
653
|
}), (d, x) => {
|
|
645
654
|
const U = h("v-card-text"), _e = h("v-text-field"), de = h("v-form"), P = h("v-btn"), ie = h("v-card-actions"), fe = h("v-card"), ge = h("v-dialog");
|
|
646
|
-
return R(),
|
|
655
|
+
return R(), E(ge, {
|
|
647
656
|
modelValue: W(t),
|
|
648
|
-
"onUpdate:modelValue": x[2] || (x[2] = ($) =>
|
|
657
|
+
"onUpdate:modelValue": x[2] || (x[2] = ($) => G(t) ? t.value = $ : null),
|
|
649
658
|
onKeydown: [
|
|
650
659
|
x[3] || (x[3] = z(K(($) => t.value = !1, ["stop", "prevent"]), ["esc"])),
|
|
651
660
|
z(K(I, ["stop", "prevent"]), ["enter"])
|
|
@@ -656,7 +665,7 @@ const Ue = /* @__PURE__ */ M({
|
|
|
656
665
|
default: w(() => [
|
|
657
666
|
k(fe, { title: r.value }, {
|
|
658
667
|
default: w(() => [
|
|
659
|
-
o.value ? (R(),
|
|
668
|
+
o.value ? (R(), E(U, { key: 0 }, {
|
|
660
669
|
default: w(() => [
|
|
661
670
|
A(T(o.value), 1)
|
|
662
671
|
]),
|
|
@@ -712,7 +721,7 @@ const Ue = /* @__PURE__ */ M({
|
|
|
712
721
|
}), Xe = { class: "mx-auto my-auto" }, Ge = { class: "d-flex align-center justify-center w-100 h-100" }, Qe = /* @__PURE__ */ M({
|
|
713
722
|
__name: "index",
|
|
714
723
|
setup(e) {
|
|
715
|
-
const a =
|
|
724
|
+
const a = Q(), { open: t } = Z("waitDlg"), r = () => {
|
|
716
725
|
t.value = !0;
|
|
717
726
|
}, o = () => {
|
|
718
727
|
t.value = !1;
|
|
@@ -723,9 +732,9 @@ const Ue = /* @__PURE__ */ M({
|
|
|
723
732
|
s.off("openWaitDlg", r), s.off("closeWaitDlg", o);
|
|
724
733
|
}), (n, l) => {
|
|
725
734
|
const c = h("v-card"), u = h("v-dialog");
|
|
726
|
-
return R(),
|
|
735
|
+
return R(), E(u, {
|
|
727
736
|
modelValue: W(t),
|
|
728
|
-
"onUpdate:modelValue": l[0] || (l[0] = (_) =>
|
|
737
|
+
"onUpdate:modelValue": l[0] || (l[0] = (_) => G(t) ? t.value = _ : null),
|
|
729
738
|
persistent: "",
|
|
730
739
|
"no-click-animation": "",
|
|
731
740
|
fullscreen: ""
|
|
@@ -754,7 +763,7 @@ const Ue = /* @__PURE__ */ M({
|
|
|
754
763
|
e.component("x-confirm-dlg", Ue), e.component("x-loading", ze), e.component("x-message", He), e.component("x-prompt-dlg", Je), e.component("x-wait-dlg", Qe);
|
|
755
764
|
};
|
|
756
765
|
function vt() {
|
|
757
|
-
const e =
|
|
766
|
+
const e = H(), a = g(() => e.global.current.value.colors.primary), t = g(() => e.global.current.value.colors.secondary), r = g(() => e.current.value.dark ? "#2e2e2e" : "#bdbdbd"), o = g(() => e.current.value.dark ? "#272727" : "#eeeeee"), n = g(() => e.current.value.dark ? "#1e1e1e" : "#ffffff"), l = g(() => e.current.value.dark ? "#303030" : "#f6f6f6"), c = g(() => e.current.value.dark ? "#ffffff1f" : "#0000001f");
|
|
758
767
|
return {
|
|
759
768
|
primaryColor: a,
|
|
760
769
|
secondaryColor: t,
|
|
@@ -797,19 +806,19 @@ function mt(e, a) {
|
|
|
797
806
|
u();
|
|
798
807
|
return;
|
|
799
808
|
}
|
|
800
|
-
if (!e && f.ctrlKey && f.
|
|
809
|
+
if (!e && f.ctrlKey && f.altKey && f.code === "KeyD") {
|
|
801
810
|
o.dark = !o.dark;
|
|
802
811
|
return;
|
|
803
812
|
}
|
|
804
|
-
if (!e && f.ctrlKey && f.
|
|
813
|
+
if (!e && f.ctrlKey && f.altKey && f.code === "KeyL") {
|
|
805
814
|
o.locale === "en" ? o.locale = "zhHans" : o.locale = "en";
|
|
806
815
|
return;
|
|
807
816
|
}
|
|
808
817
|
};
|
|
809
818
|
V(() => {
|
|
810
|
-
window.addEventListener("keydown", _
|
|
819
|
+
window.addEventListener("keydown", _);
|
|
811
820
|
}), O(() => {
|
|
812
|
-
window.removeEventListener("keydown", _
|
|
821
|
+
window.removeEventListener("keydown", _);
|
|
813
822
|
});
|
|
814
823
|
let v;
|
|
815
824
|
const D = async () => {
|
|
@@ -856,7 +865,7 @@ function ht() {
|
|
|
856
865
|
return { verifyPermission: a };
|
|
857
866
|
}
|
|
858
867
|
function wt() {
|
|
859
|
-
const e =
|
|
868
|
+
const e = H(), a = be(), t = g(() => e.current.value.dark), r = g(() => !!window.cordova), o = g(() => a.width.value <= 1280 ? a.width.value + "px" : a.width.value <= 1920 ? 1920 / 2.5 + "px" : 2560 / 2.5 + "px");
|
|
860
869
|
return { dark: t, sysBarAvail: r, compactWidth: o };
|
|
861
870
|
}
|
|
862
871
|
const yt = { install: Ye };
|