x-essential-lib 0.2.2 → 0.2.4
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 +4 -0
- package/dist/index.js +79 -78
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -71,6 +71,10 @@ interface Options {
|
|
|
71
71
|
|
|
72
72
|
export declare function createAxios(options: Options): AxiosInstance
|
|
73
73
|
|
|
74
|
+
export declare const eventBus: import('mitt').Emitter<
|
|
75
|
+
Record<import('mitt').EventType, unknown>
|
|
76
|
+
>
|
|
77
|
+
|
|
74
78
|
export declare function waitMs(ms: number): Promise<void>
|
|
75
79
|
|
|
76
80
|
export declare function waitUtil(
|
package/dist/index.js
CHANGED
|
@@ -1,9 +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 {
|
|
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
|
|
4
|
-
import { useLocale as H, useTheme as X, useDisplay as
|
|
5
|
-
import
|
|
6
|
-
function
|
|
2
|
+
import { VAlert as pe, VBtn as fe, VCard as me, VCardActions as ve, VCardText as ge, VCardTitle as _e, VDialog as he, VForm as xe, VTextField as ye } 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 we, pushScopeId as ke, popScopeId as be, createElementVNode as g, reactive as Ce, Fragment as Ve, renderList as qe, unref as De, inject as Se } from "vue";
|
|
4
|
+
import { useLocale as H, useTheme as X, useDisplay as Re } from "vuetify/lib/framework.mjs";
|
|
5
|
+
import Te from "axios";
|
|
6
|
+
function Ie(e) {
|
|
7
7
|
return { all: e = e || /* @__PURE__ */ new Map(), on: function(o, t) {
|
|
8
8
|
var n = e.get(o);
|
|
9
9
|
n ? n.push(t) : e.set(o, [t]);
|
|
@@ -19,8 +19,8 @@ function Te(e) {
|
|
|
19
19
|
});
|
|
20
20
|
} };
|
|
21
21
|
}
|
|
22
|
-
const i =
|
|
23
|
-
async function
|
|
22
|
+
const i = Ie();
|
|
23
|
+
async function ct(e) {
|
|
24
24
|
return new Promise((o) => {
|
|
25
25
|
setTimeout(o, e);
|
|
26
26
|
});
|
|
@@ -34,7 +34,7 @@ async function F(e, o, t) {
|
|
|
34
34
|
l();
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
const
|
|
37
|
+
const Pe = /* @__PURE__ */ S({
|
|
38
38
|
__name: "index",
|
|
39
39
|
props: {
|
|
40
40
|
modelValue: { type: Boolean },
|
|
@@ -129,7 +129,7 @@ const Ie = /* @__PURE__ */ S({
|
|
|
129
129
|
}, 8, ["modelValue", "onKeydown"]);
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
}),
|
|
132
|
+
}), Me = (e) => (ke("data-v-a8f3d91f"), e = e(), be(), e), $e = /* @__PURE__ */ Me(() => /* @__PURE__ */ g("div", { class: "lds-spinner" }, [
|
|
133
133
|
/* @__PURE__ */ g("div"),
|
|
134
134
|
/* @__PURE__ */ g("div"),
|
|
135
135
|
/* @__PURE__ */ g("div"),
|
|
@@ -142,9 +142,9 @@ const Ie = /* @__PURE__ */ S({
|
|
|
142
142
|
/* @__PURE__ */ g("div"),
|
|
143
143
|
/* @__PURE__ */ g("div"),
|
|
144
144
|
/* @__PURE__ */ g("div")
|
|
145
|
-
], -1)),
|
|
146
|
-
|
|
147
|
-
],
|
|
145
|
+
], -1)), Ae = [
|
|
146
|
+
$e
|
|
147
|
+
], Be = /* @__PURE__ */ S({
|
|
148
148
|
__name: "index",
|
|
149
149
|
props: {
|
|
150
150
|
zIndex: {
|
|
@@ -159,15 +159,15 @@ const Ie = /* @__PURE__ */ S({
|
|
|
159
159
|
}));
|
|
160
160
|
return (r, l) => (C(), K("div", {
|
|
161
161
|
class: "x-cont",
|
|
162
|
-
style:
|
|
163
|
-
},
|
|
162
|
+
style: we(n.value)
|
|
163
|
+
}, Ae, 4));
|
|
164
164
|
}
|
|
165
165
|
}), oe = (e, o) => {
|
|
166
166
|
const t = e.__vccOpts || e;
|
|
167
167
|
for (const [n, r] of o)
|
|
168
168
|
t[n] = r;
|
|
169
169
|
return t;
|
|
170
|
-
},
|
|
170
|
+
}, Oe = /* @__PURE__ */ oe(Be, [["__scopeId", "data-v-a8f3d91f"]]), je = /* @__PURE__ */ S({
|
|
171
171
|
__name: "item",
|
|
172
172
|
props: {
|
|
173
173
|
id: {
|
|
@@ -230,10 +230,10 @@ const Ie = /* @__PURE__ */ S({
|
|
|
230
230
|
}, null, 8, ["modelValue", "type", "icon", "text"]);
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
}),
|
|
233
|
+
}), Ee = /* @__PURE__ */ S({
|
|
234
234
|
__name: "index",
|
|
235
235
|
setup(e) {
|
|
236
|
-
const o =
|
|
236
|
+
const o = Ce({ items: [] });
|
|
237
237
|
$(() => {
|
|
238
238
|
i.on("message", t);
|
|
239
239
|
}), W(() => {
|
|
@@ -257,7 +257,7 @@ const Ie = /* @__PURE__ */ S({
|
|
|
257
257
|
}, ["stop"])),
|
|
258
258
|
class: "x-cont d-flex flex-column-reverse align-center"
|
|
259
259
|
}, [
|
|
260
|
-
(C(!0), K(
|
|
260
|
+
(C(!0), K(Ve, null, qe(o.items, (p) => (C(), A(je, {
|
|
261
261
|
onTimeout: n,
|
|
262
262
|
id: p.id,
|
|
263
263
|
type: p.type,
|
|
@@ -267,7 +267,7 @@ const Ie = /* @__PURE__ */ S({
|
|
|
267
267
|
}, null, 8, ["id", "type", "text", "timeout"]))), 128))
|
|
268
268
|
]));
|
|
269
269
|
}
|
|
270
|
-
}),
|
|
270
|
+
}), Ue = /* @__PURE__ */ oe(Ee, [["__scopeId", "data-v-70ed4b89"]]), We = /* @__PURE__ */ S({
|
|
271
271
|
__name: "index",
|
|
272
272
|
props: {
|
|
273
273
|
modelValue: { type: Boolean },
|
|
@@ -377,7 +377,7 @@ const Ie = /* @__PURE__ */ S({
|
|
|
377
377
|
}, 8, ["modelValue", "onKeydown"]);
|
|
378
378
|
};
|
|
379
379
|
}
|
|
380
|
-
}),
|
|
380
|
+
}), ze = { class: "mx-auto my-auto" }, Ke = { class: "d-flex align-center justify-center w-100 h-100" }, Le = /* @__PURE__ */ S({
|
|
381
381
|
__name: "index",
|
|
382
382
|
props: {
|
|
383
383
|
modelValue: { type: Boolean },
|
|
@@ -404,15 +404,15 @@ const Ie = /* @__PURE__ */ S({
|
|
|
404
404
|
fullscreen: ""
|
|
405
405
|
}, {
|
|
406
406
|
default: v(() => [
|
|
407
|
-
g("div",
|
|
407
|
+
g("div", ze, [
|
|
408
408
|
h(s, {
|
|
409
409
|
width: "300px",
|
|
410
410
|
height: "80px",
|
|
411
411
|
loading: ""
|
|
412
412
|
}, {
|
|
413
413
|
default: v(() => [
|
|
414
|
-
g("div",
|
|
415
|
-
g("span", null, k(
|
|
414
|
+
g("div", Ke, [
|
|
415
|
+
g("span", null, k(De(o).t("waitingResponse")), 1)
|
|
416
416
|
])
|
|
417
417
|
]),
|
|
418
418
|
_: 1
|
|
@@ -424,7 +424,7 @@ const Ie = /* @__PURE__ */ S({
|
|
|
424
424
|
};
|
|
425
425
|
}
|
|
426
426
|
});
|
|
427
|
-
function
|
|
427
|
+
function it() {
|
|
428
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");
|
|
429
429
|
return {
|
|
430
430
|
primaryColor: o,
|
|
@@ -436,11 +436,11 @@ function ct() {
|
|
|
436
436
|
borderColor: s
|
|
437
437
|
};
|
|
438
438
|
}
|
|
439
|
-
function
|
|
440
|
-
const e = X(), { width: o } =
|
|
439
|
+
function ut() {
|
|
440
|
+
const e = X(), { width: o } = Re(), t = d(() => e.current.value.dark), n = d(() => !!window.cordova), r = d(() => o.value <= 1280 ? o.value + "px" : o.value <= 1920 ? 1920 / 2.5 + "px" : 2560 / 2.5 + "px");
|
|
441
441
|
return { dark: t, sysBarAvail: n, compactWidth: r };
|
|
442
442
|
}
|
|
443
|
-
var
|
|
443
|
+
var Ne = {}, G;
|
|
444
444
|
(function(e) {
|
|
445
445
|
e.pop = "pop", e.push = "push";
|
|
446
446
|
})(G || (G = {}));
|
|
@@ -452,60 +452,60 @@ var Y;
|
|
|
452
452
|
(function(e) {
|
|
453
453
|
e[e.aborted = 4] = "aborted", e[e.cancelled = 8] = "cancelled", e[e.duplicated = 16] = "duplicated";
|
|
454
454
|
})(Y || (Y = {}));
|
|
455
|
-
const
|
|
456
|
-
function
|
|
457
|
-
return
|
|
455
|
+
const He = Symbol(Ne.NODE_ENV !== "production" ? "router" : "");
|
|
456
|
+
function Xe() {
|
|
457
|
+
return Se(He);
|
|
458
458
|
}
|
|
459
459
|
const E = require("js-cookie");
|
|
460
|
-
function
|
|
461
|
-
const o =
|
|
460
|
+
function dt(e) {
|
|
461
|
+
const o = Te.create({
|
|
462
462
|
timeout: 6e3
|
|
463
463
|
});
|
|
464
464
|
return o.defaults.baseURL = e.baseUrl, o.interceptors.request.use(
|
|
465
|
-
(t) =>
|
|
465
|
+
(t) => Fe(t),
|
|
466
466
|
(t) => {
|
|
467
|
-
|
|
467
|
+
Je(t, e.onError);
|
|
468
468
|
}
|
|
469
469
|
), o.interceptors.response.use(
|
|
470
|
-
(t) =>
|
|
471
|
-
(t) =>
|
|
470
|
+
(t) => Ge(t),
|
|
471
|
+
(t) => Qe(t, e.onError)
|
|
472
472
|
), o;
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function Fe(e) {
|
|
475
475
|
const o = E.get("accessToken") ?? "";
|
|
476
476
|
return e.headers.Authorization = "Basic " + o, e.headers["Content-Type"] = "application/json", e.data = JSON.stringify(e.data), e;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function Je(e, o) {
|
|
479
479
|
console.error(e), o("request timeout");
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function Ge(e) {
|
|
482
482
|
return e.data;
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function Qe(e, o) {
|
|
485
485
|
var r;
|
|
486
486
|
const t = e.response;
|
|
487
487
|
if (!t)
|
|
488
488
|
return Promise.reject(e);
|
|
489
|
-
t.status === 401 &&
|
|
489
|
+
t.status === 401 && Ye();
|
|
490
490
|
let n = (r = t.data) == null ? void 0 : r.message;
|
|
491
491
|
return n || (n = {
|
|
492
492
|
code: t.status,
|
|
493
493
|
message: t.statusText
|
|
494
494
|
}), o(n), Promise.reject(e);
|
|
495
495
|
}
|
|
496
|
-
function
|
|
497
|
-
E.remove("accessToken"), E.remove("refreshToken"), E.remove("activeOrg"),
|
|
496
|
+
function Ye() {
|
|
497
|
+
E.remove("accessToken"), E.remove("refreshToken"), E.remove("activeOrg"), Xe().replace({ path: "/passport/login" });
|
|
498
498
|
}
|
|
499
499
|
let Z = Date.now();
|
|
500
500
|
function ne() {
|
|
501
501
|
const e = Date.now();
|
|
502
502
|
return e - Z > 500 ? (Z = e, !0) : !1;
|
|
503
503
|
}
|
|
504
|
-
let
|
|
504
|
+
let Ze = 0;
|
|
505
505
|
function re() {
|
|
506
|
-
return ++
|
|
506
|
+
return ++Ze;
|
|
507
507
|
}
|
|
508
|
-
async function
|
|
508
|
+
async function pt(e) {
|
|
509
509
|
if (!ne())
|
|
510
510
|
return;
|
|
511
511
|
let o = !1, t;
|
|
@@ -514,7 +514,7 @@ async function dt(e) {
|
|
|
514
514
|
}, r = re();
|
|
515
515
|
return i.on("confirmDlgResult" + r, n), i.emit("confirmDlg", { ...e, seq: r }), await F(() => o), i.off("confirmDlgResult" + r, n), t;
|
|
516
516
|
}
|
|
517
|
-
async function
|
|
517
|
+
async function ft(e) {
|
|
518
518
|
if (!ne())
|
|
519
519
|
return;
|
|
520
520
|
let o = !1, t;
|
|
@@ -523,25 +523,25 @@ async function pt(e) {
|
|
|
523
523
|
}, r = re();
|
|
524
524
|
return i.on("promptDlgResult" + r, n), i.emit("promptDlg", { ...e, seq: r }), await F(() => o), i.off("promptDlgResult" + r, n), t;
|
|
525
525
|
}
|
|
526
|
-
function
|
|
526
|
+
function mt() {
|
|
527
527
|
i.emit("openWaitDlg");
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function vt() {
|
|
530
530
|
i.emit("closeWaitDlg");
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function gt(e, o) {
|
|
533
533
|
i.emit("message", { type: "error", text: e, timeout: o });
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function _t(e, o) {
|
|
536
536
|
i.emit("message", { type: "info", text: e, timeout: o });
|
|
537
537
|
}
|
|
538
|
-
function
|
|
538
|
+
function ht(e, o) {
|
|
539
539
|
i.emit("message", { type: "success", text: e, timeout: o });
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function xt(e, o) {
|
|
542
542
|
i.emit("message", { type: "warning", text: e, timeout: o });
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function yt(e) {
|
|
545
545
|
var n, r;
|
|
546
546
|
if (!window.appAppear) {
|
|
547
547
|
window.appAppear = !0;
|
|
@@ -552,7 +552,7 @@ function xt(e) {
|
|
|
552
552
|
t.add("app-reset");
|
|
553
553
|
}, 0));
|
|
554
554
|
}
|
|
555
|
-
const ae = require("js-cookie"),
|
|
555
|
+
const ae = require("js-cookie"), et = [
|
|
556
556
|
{ path: "/passport/login", level: 0 },
|
|
557
557
|
{ path: "/passport/loginAccount", level: 1 },
|
|
558
558
|
{ path: "/passport/register", level: 1 },
|
|
@@ -575,7 +575,7 @@ const ae = require("js-cookie"), Ze = [
|
|
|
575
575
|
function le(e) {
|
|
576
576
|
let o, t = 0;
|
|
577
577
|
const n = e.split("/");
|
|
578
|
-
return
|
|
578
|
+
return et.forEach((r) => {
|
|
579
579
|
const l = r.path.split("/");
|
|
580
580
|
let a = 0;
|
|
581
581
|
for (let s = 0; s < n.length && !(s >= l.length || n[s] !== l[s]); s++)
|
|
@@ -599,14 +599,14 @@ function w(e, o) {
|
|
|
599
599
|
`~~~~before route change~~~~ ${n.path} -> ${t.path} inner=${r} forward=${a}`
|
|
600
600
|
), r ? l ? te.value = "" : te.value = a ? "inner-left" : "inner-right" : window.routeExtras = { forward: a };
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function tt() {
|
|
603
603
|
return !!ae.get("accessToken");
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function ot() {
|
|
606
606
|
return !!ae.get("activeOrg");
|
|
607
607
|
}
|
|
608
|
-
function
|
|
609
|
-
const n =
|
|
608
|
+
function wt(e, o, t) {
|
|
609
|
+
const n = tt(), r = ot(), l = le(e.path);
|
|
610
610
|
if (!l) {
|
|
611
611
|
t();
|
|
612
612
|
return;
|
|
@@ -645,25 +645,26 @@ function yt(e, o, t) {
|
|
|
645
645
|
else
|
|
646
646
|
w(e.path, o.path), t();
|
|
647
647
|
}
|
|
648
|
-
const
|
|
649
|
-
e.component("v-
|
|
650
|
-
},
|
|
648
|
+
const nt = (e) => {
|
|
649
|
+
e.component("v-alert", pe), e.component("v-btn", fe), e.component("v-card", me), e.component("v-card-actions", ve), e.component("v-card-text", ge), e.component("v-card-title", _e), e.component("v-dialog", he), e.component("v-form", xe), e.component("v-text-field", ye), e.component("x-confirm-dlg", Pe), e.component("x-loading", Oe), e.component("x-message", Ue), e.component("x-prompt-dlg", We), e.component("x-wait-dlg", Le);
|
|
650
|
+
}, kt = { install: nt };
|
|
651
651
|
export {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
gt as
|
|
658
|
-
_t as
|
|
659
|
-
ht as
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
pt as
|
|
663
|
-
ft as
|
|
652
|
+
yt as appAppear,
|
|
653
|
+
vt as closeWaitDlg,
|
|
654
|
+
dt as createAxios,
|
|
655
|
+
kt as default,
|
|
656
|
+
i as eventBus,
|
|
657
|
+
gt as messageError,
|
|
658
|
+
_t as messageInfo,
|
|
659
|
+
ht as messageSuccess,
|
|
660
|
+
xt as messageWarning,
|
|
661
|
+
wt as onBeforeEach,
|
|
662
|
+
pt as openConfirmDlg,
|
|
663
|
+
ft as openPromptDlg,
|
|
664
|
+
mt as openWaitDlg,
|
|
664
665
|
te as routeTransName,
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
666
|
+
it as useColor,
|
|
667
|
+
ut as useSystem,
|
|
668
|
+
ct as waitMs,
|
|
668
669
|
F as waitUtil
|
|
669
670
|
};
|