x-essential-lib 0.5.39 → 0.5.41

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.
Files changed (2) hide show
  1. package/dist/index.js +49 -45
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
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-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-8c2268ea]{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 i, watch as N, computed as f, onMounted as S, onBeforeUnmount as T, defineComponent as U, resolveComponent as h, openBlock as V, createBlock as E, unref as F, isRef as G, withKeys as M, withModifiers as W, withCtx as w, createVNode as k, createTextVNode as B, toDisplayString as A, createElementBlock as J, normalizeStyle as ge, pushScopeId as ve, popScopeId as me, createElementVNode as m, reactive as he, Fragment as we, renderList as xe, createCommentVNode as ye } from "vue";
2
+ import { ref as i, watch as N, computed as f, onMounted as S, onBeforeUnmount as O, defineComponent as U, resolveComponent as h, openBlock as V, createBlock as E, unref as F, isRef as G, withKeys as M, withModifiers as W, withCtx as w, createVNode as k, createTextVNode as B, toDisplayString as j, createElementBlock as J, normalizeStyle as ge, pushScopeId as ve, popScopeId as me, createElementVNode as m, reactive as he, Fragment as we, renderList as xe, createCommentVNode as ye } from "vue";
3
3
  import { useTheme as H, useLocale as Q, useDisplay as ke } from "vuetify";
4
4
  import { defineStore as le } from "pinia";
5
5
  import be from "axios";
@@ -11,7 +11,9 @@ const Y = le(
11
11
  return N(
12
12
  a,
13
13
  () => {
14
- window.dispatchEvent(new CustomEvent("darkchange", { detail: a.value })), e.global.name.value = a.value ? "dark" : "light";
14
+ window.dispatchEvent(
15
+ new CustomEvent("darkchange", { detail: a.value })
16
+ ), e.global.name.value = a.value ? "dark" : "light";
15
17
  },
16
18
  { immediate: !0 }
17
19
  ), {
@@ -153,7 +155,7 @@ function lt(e) {
153
155
  }
154
156
  ), a.interceptors.response.use(
155
157
  (t) => qe(t),
156
- (t) => Oe(t, e.onError)
158
+ (t) => Te(t, e.onError)
157
159
  ), a;
158
160
  }
159
161
  function Se(e) {
@@ -166,22 +168,22 @@ function Ve(e, a) {
166
168
  function qe(e) {
167
169
  return e.data;
168
170
  }
169
- function Oe(e, a) {
171
+ function Te(e, a) {
170
172
  var o;
171
173
  const t = e.response;
172
174
  if (!t)
173
175
  return Promise.reject(e);
174
- t.status === 401 && Te();
176
+ t.status === 401 && Oe();
175
177
  let l = (o = t.data) == null ? void 0 : o.message;
176
178
  return l || (l = {
177
179
  code: t.status,
178
180
  message: t.statusText
179
181
  }), a(l), Promise.reject(e);
180
182
  }
181
- function Te() {
183
+ function Oe() {
182
184
  R.remove("accessToken"), R.remove("refreshToken"), R.remove("activeOrg"), ne().replace({ path: "/passport/login" });
183
185
  }
184
- function je(e) {
186
+ function Ae(e) {
185
187
  return { all: e = e || /* @__PURE__ */ new Map(), on: function(a, t) {
186
188
  var l = e.get(a);
187
189
  l ? l.push(t) : e.set(a, [t]);
@@ -198,7 +200,7 @@ function je(e) {
198
200
  } };
199
201
  }
200
202
  const s = function() {
201
- return window.eventBus || (window.eventBus = je()), window.eventBus;
203
+ return window.eventBus || (window.eventBus = Ae()), window.eventBus;
202
204
  }();
203
205
  async function nt(e) {
204
206
  return new Promise((a) => {
@@ -214,7 +216,7 @@ async function Z(e, a, t) {
214
216
  r();
215
217
  });
216
218
  }
217
- function Ae(e, a) {
219
+ function je(e, a) {
218
220
  var o;
219
221
  if (!window.appAppear) {
220
222
  window.appAppear = !0;
@@ -405,12 +407,14 @@ function z(e) {
405
407
  }
406
408
  const oe = i("");
407
409
  function D(e, a) {
408
- const { lastAppPath: t } = Y();
409
- a === "/" && (a = t);
410
+ const t = Y();
411
+ a === "/" && (a = t.lastAppPath);
410
412
  const l = z(e), o = z(a), r = (l == null ? void 0 : l.app) === (o == null ? void 0 : o.app), n = (l == null ? void 0 : l.path) === (o == null ? void 0 : o.path), c = ((l == null ? void 0 : l.level) ?? -1) >= ((o == null ? void 0 : o.level) ?? -1);
411
413
  console.info(
412
414
  `~~~~before route change~~~~ ${a} -> ${e} inner=${r} forward=${c}`
413
- ), r ? n ? oe.value = "" : oe.value = c ? "inner-left" : "inner-right" : l && Ae(l.app, c);
415
+ ), r ? n ? oe.value = "" : oe.value = c ? "inner-left" : "inner-right" : l && je(l.app, c), setTimeout(() => {
416
+ t.lastAppPath = "/";
417
+ });
414
418
  }
415
419
  function Ee() {
416
420
  return !!R.get("accessToken");
@@ -471,7 +475,7 @@ function P(e, a) {
471
475
  };
472
476
  return S(() => {
473
477
  s.on(e, o);
474
- }), T(() => {
478
+ }), O(() => {
475
479
  s.off(e, o);
476
480
  }), { open: l };
477
481
  }
@@ -492,13 +496,13 @@ const $e = /* @__PURE__ */ U({
492
496
  return ((u = n.value) == null ? void 0 : u.text) ?? a.t("confirm");
493
497
  });
494
498
  let y = 0, C = !1;
495
- const j = (u) => {
499
+ const A = (u) => {
496
500
  l.value = u.title, o.value = u.text, r.value = u.cancel, n.value = u.confirm, y = u.seq, C = !1, t.value = !0;
497
501
  };
498
502
  S(() => {
499
- s.on("confirmDlg", j);
500
- }), T(() => {
501
- s.off("confirmDlg", j);
503
+ s.on("confirmDlg", A);
504
+ }), O(() => {
505
+ s.off("confirmDlg", A);
502
506
  });
503
507
  const I = () => {
504
508
  t.value = !1, C || (s.emit("confirmDlgResult" + y, !0), C = !0);
@@ -506,7 +510,7 @@ const $e = /* @__PURE__ */ U({
506
510
  return N(t, (u) => {
507
511
  !u && !C && (s.emit("confirmDlgResult" + y, !1), C = !0);
508
512
  }), (u, g) => {
509
- const b = h("v-card-text"), q = h("v-btn"), O = h("v-card-actions"), d = h("v-card"), x = h("v-dialog");
513
+ const b = h("v-card-text"), q = h("v-btn"), T = h("v-card-actions"), d = h("v-card"), x = h("v-dialog");
510
514
  return V(), E(x, {
511
515
  modelValue: F(t),
512
516
  "onUpdate:modelValue": g[1] || (g[1] = ($) => G(t) ? t.value = $ : null),
@@ -522,11 +526,11 @@ const $e = /* @__PURE__ */ U({
522
526
  default: w(() => [
523
527
  k(b, null, {
524
528
  default: w(() => [
525
- B(A(o.value), 1)
529
+ B(j(o.value), 1)
526
530
  ]),
527
531
  _: 1
528
532
  }),
529
- k(O, { class: "d-flex justify-end" }, {
533
+ k(T, { class: "d-flex justify-end" }, {
530
534
  default: w(() => [
531
535
  k(q, {
532
536
  onClick: g[0] || (g[0] = ($) => t.value = !1),
@@ -534,7 +538,7 @@ const $e = /* @__PURE__ */ U({
534
538
  variant: "text"
535
539
  }, {
536
540
  default: w(() => [
537
- B(A(p.value), 1)
541
+ B(j(p.value), 1)
538
542
  ]),
539
543
  _: 1
540
544
  }, 8, ["color"]),
@@ -544,7 +548,7 @@ const $e = /* @__PURE__ */ U({
544
548
  variant: "text"
545
549
  }, {
546
550
  default: w(() => [
547
- B(A(v.value), 1)
551
+ B(j(v.value), 1)
548
552
  ]),
549
553
  _: 1
550
554
  }, 8, ["color"])
@@ -636,7 +640,7 @@ const $e = /* @__PURE__ */ U({
636
640
  const a = he({ items: [] });
637
641
  S(() => {
638
642
  s.on("message", t);
639
- }), T(() => {
643
+ }), O(() => {
640
644
  s.off("message", t);
641
645
  });
642
646
  const t = (c) => {
@@ -676,7 +680,7 @@ const $e = /* @__PURE__ */ U({
676
680
  }), C = f(() => {
677
681
  var d;
678
682
  return ((d = _.value) == null ? void 0 : d.text) ?? a.t("cancel");
679
- }), j = f(() => {
683
+ }), A = f(() => {
680
684
  var d;
681
685
  return ((d = v.value) == null ? void 0 : d.color) ?? "primary";
682
686
  }), I = f(() => {
@@ -690,10 +694,10 @@ const $e = /* @__PURE__ */ U({
690
694
  };
691
695
  S(() => {
692
696
  s.on("promptDlg", q);
693
- }), T(() => {
697
+ }), O(() => {
694
698
  s.off("promptDlg", q);
695
699
  });
696
- const O = () => {
700
+ const T = () => {
697
701
  t.value = !1, b || (s.emit("promptDlgResult" + g, p.value ?? ""), b = !0);
698
702
  };
699
703
  return N(t, (d) => {
@@ -705,7 +709,7 @@ const $e = /* @__PURE__ */ U({
705
709
  "onUpdate:modelValue": x[2] || (x[2] = (K) => G(t) ? t.value = K : null),
706
710
  onKeydown: [
707
711
  x[3] || (x[3] = M(W((K) => t.value = !1, ["stop", "prevent"]), ["esc"])),
708
- M(W(O, ["stop", "prevent"]), ["enter"])
712
+ M(W(T, ["stop", "prevent"]), ["enter"])
709
713
  ],
710
714
  transition: "dialog-top-transition",
711
715
  "max-width": "600px"
@@ -715,7 +719,7 @@ const $e = /* @__PURE__ */ U({
715
719
  default: w(() => [
716
720
  o.value ? (V(), E($, { key: 0 }, {
717
721
  default: w(() => [
718
- B(A(o.value), 1)
722
+ B(j(o.value), 1)
719
723
  ]),
720
724
  _: 1
721
725
  })) : ye("", !0),
@@ -741,17 +745,17 @@ const $e = /* @__PURE__ */ U({
741
745
  variant: "text"
742
746
  }, {
743
747
  default: w(() => [
744
- B(A(C.value), 1)
748
+ B(j(C.value), 1)
745
749
  ]),
746
750
  _: 1
747
751
  }, 8, ["color"]),
748
752
  k(ee, {
749
- onClick: O,
750
- color: j.value,
753
+ onClick: T,
754
+ color: A.value,
751
755
  variant: "text"
752
756
  }, {
753
757
  default: w(() => [
754
- B(A(I.value), 1)
758
+ B(j(I.value), 1)
755
759
  ]),
756
760
  _: 1
757
761
  }, 8, ["color"])
@@ -776,7 +780,7 @@ const $e = /* @__PURE__ */ U({
776
780
  };
777
781
  return S(() => {
778
782
  s.on("openWaitDlg", l), s.on("closeWaitDlg", o);
779
- }), T(() => {
783
+ }), O(() => {
780
784
  s.off("openWaitDlg", l), s.off("closeWaitDlg", o);
781
785
  }), (r, n) => {
782
786
  const c = h("v-card"), p = h("v-dialog");
@@ -796,7 +800,7 @@ const $e = /* @__PURE__ */ U({
796
800
  }, {
797
801
  default: w(() => [
798
802
  m("div", Ge, [
799
- m("span", null, A(F(a).t("waitingResponse")), 1)
803
+ m("span", null, j(F(a).t("waitingResponse")), 1)
800
804
  ])
801
805
  ]),
802
806
  _: 1
@@ -848,7 +852,7 @@ function vt(e, a) {
848
852
  };
849
853
  S(() => {
850
854
  s.on("pause", c), s.on("resume", p), s.on("backbutton", _);
851
- }), T(() => {
855
+ }), O(() => {
852
856
  s.off("pause", c), s.off("resume", p), s.off("backbutton", _);
853
857
  });
854
858
  const v = (u) => {
@@ -867,7 +871,7 @@ function vt(e, a) {
867
871
  };
868
872
  S(() => {
869
873
  window.addEventListener("keydown", v);
870
- }), T(() => {
874
+ }), O(() => {
871
875
  window.removeEventListener("keydown", v);
872
876
  });
873
877
  let y;
@@ -883,26 +887,26 @@ function vt(e, a) {
883
887
  if (!g)
884
888
  return;
885
889
  const q = {};
886
- for (const O in b) {
887
- if (O === "checksum")
890
+ for (const T in b) {
891
+ if (T === "checksum")
888
892
  continue;
889
- const d = b[O];
890
- q[O] = JSON.parse(d);
893
+ const d = b[T];
894
+ q[T] = JSON.parse(d);
891
895
  }
892
896
  o.permissionObjects = q, o.permissionChecksum = b.checksum ?? "";
893
897
  } catch (g) {
894
898
  console.error(g);
895
899
  }
896
- }, j = async (u) => {
900
+ }, A = async (u) => {
897
901
  u && await C(), clearTimeout(y), y = setTimeout(async () => {
898
- await C(), y && j();
902
+ await C(), y && A();
899
903
  }, 3e3);
900
904
  }, I = () => {
901
905
  clearTimeout(y), y = void 0;
902
906
  };
903
907
  S(() => {
904
- a && j(!0);
905
- }), T(() => {
908
+ a && A(!0);
909
+ }), O(() => {
906
910
  I();
907
911
  });
908
912
  }
@@ -921,7 +925,7 @@ function ht() {
921
925
  const wt = { install: Ye };
922
926
  export {
923
927
  Be as Permission,
924
- Ae as appAppear,
928
+ je as appAppear,
925
929
  pt as closeWaitDlg,
926
930
  lt as createAxios,
927
931
  wt as default,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
3
  "private": false,
4
- "version": "0.5.39",
4
+ "version": "0.5.41",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",