x-essential-lib 0.5.49 → 0.5.50

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 +96 -96
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,11 +3,11 @@ import { ref as f, watch as N, computed as i, onMounted as S, onBeforeUnmount as
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";
6
- import { useRouter as re, useRoute as Ce } from "vue-router";
6
+ import { useRouter as ne, useRoute as Ce } from "vue-router";
7
7
  const Y = le(
8
8
  "global",
9
9
  () => {
10
- const e = H(), a = f(), t = f("en"), l = f({}), o = f(""), n = f("");
10
+ const e = H(), a = f(), t = f("en"), l = f({}), o = f(""), r = f("");
11
11
  return N(
12
12
  a,
13
13
  () => {
@@ -21,7 +21,7 @@ const Y = le(
21
21
  locale: t,
22
22
  permissionObjects: l,
23
23
  permissionChecksum: o,
24
- lastAppPath: n
24
+ lastAppPath: r
25
25
  };
26
26
  },
27
27
  {
@@ -36,7 +36,7 @@ const Y = le(
36
36
  }
37
37
  ]
38
38
  }
39
- ), ne = le("viewMgr", () => {
39
+ ), re = le("viewMgr", () => {
40
40
  const e = f([]);
41
41
  function a() {
42
42
  return e.value.length <= 0;
@@ -52,11 +52,11 @@ const Y = le(
52
52
  function o(p) {
53
53
  e.value.push(p);
54
54
  }
55
- function n(p) {
55
+ function r(p) {
56
56
  const _ = e.value.findIndex((v) => v === p);
57
57
  _ !== -1 && e.value.splice(_, e.value.length - _);
58
58
  }
59
- function r() {
59
+ function n() {
60
60
  console.assert(e.value.length > 0), e.value.pop();
61
61
  }
62
62
  function c() {
@@ -68,8 +68,8 @@ const Y = le(
68
68
  lastView: t,
69
69
  hasView: l,
70
70
  addView: o,
71
- delView: n,
72
- popView: r,
71
+ delView: r,
72
+ popView: n,
73
73
  clearViews: c
74
74
  };
75
75
  });
@@ -94,38 +94,38 @@ var De = {
94
94
  }
95
95
  };
96
96
  function X(e, a) {
97
- function t(o, n, r) {
97
+ function t(o, r, n) {
98
98
  if (!(typeof document > "u")) {
99
- r = z({}, a, r), typeof r.expires == "number" && (r.expires = new Date(Date.now() + r.expires * 864e5)), r.expires && (r.expires = r.expires.toUTCString()), o = encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
99
+ n = z({}, a, n), typeof n.expires == "number" && (n.expires = new Date(Date.now() + n.expires * 864e5)), n.expires && (n.expires = n.expires.toUTCString()), o = encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
100
100
  var c = "";
101
- for (var p in r)
102
- r[p] && (c += "; " + p, r[p] !== !0 && (c += "=" + r[p].split(";")[0]));
103
- return document.cookie = o + "=" + e.write(n, o) + c;
101
+ for (var p in n)
102
+ n[p] && (c += "; " + p, n[p] !== !0 && (c += "=" + n[p].split(";")[0]));
103
+ return document.cookie = o + "=" + e.write(r, o) + c;
104
104
  }
105
105
  }
106
106
  function l(o) {
107
107
  if (!(typeof document > "u" || arguments.length && !o)) {
108
- for (var n = document.cookie ? document.cookie.split("; ") : [], r = {}, c = 0; c < n.length; c++) {
109
- var p = n[c].split("="), _ = p.slice(1).join("=");
108
+ for (var r = document.cookie ? document.cookie.split("; ") : [], n = {}, c = 0; c < r.length; c++) {
109
+ var p = r[c].split("="), _ = p.slice(1).join("=");
110
110
  try {
111
111
  var v = decodeURIComponent(p[0]);
112
- if (r[v] = e.read(_, v), o === v)
112
+ if (n[v] = e.read(_, v), o === v)
113
113
  break;
114
114
  } catch {
115
115
  }
116
116
  }
117
- return o ? r[o] : r;
117
+ return o ? n[o] : n;
118
118
  }
119
119
  }
120
120
  return Object.create(
121
121
  {
122
122
  set: t,
123
123
  get: l,
124
- remove: function(o, n) {
124
+ remove: function(o, r) {
125
125
  t(
126
126
  o,
127
127
  "",
128
- z({}, n, {
128
+ z({}, r, {
129
129
  expires: -1
130
130
  })
131
131
  );
@@ -181,7 +181,7 @@ function qe(e, a) {
181
181
  }), a(l), Promise.reject(e);
182
182
  }
183
183
  function Oe() {
184
- B.remove("accessToken"), B.remove("refreshToken"), B.remove("activeOrg"), re().replace({ path: "/passport/login" });
184
+ B.remove("accessToken"), B.remove("refreshToken"), B.remove("activeOrg"), ne().replace({ path: "/passport/login" });
185
185
  }
186
186
  function Te(e) {
187
187
  return { all: e = e || /* @__PURE__ */ new Map(), on: function(a, t) {
@@ -202,7 +202,7 @@ function Te(e) {
202
202
  const s = function() {
203
203
  return window.eventBus || (window.eventBus = Te()), window.eventBus;
204
204
  }();
205
- async function rt(e) {
205
+ async function nt(e) {
206
206
  return new Promise((a) => {
207
207
  setTimeout(a, e);
208
208
  });
@@ -210,18 +210,18 @@ async function rt(e) {
210
210
  async function Z(e, a, t) {
211
211
  const l = Date.now();
212
212
  return new Promise((o) => {
213
- const n = async () => {
214
- e() ? o(!0) : a && Date.now() - l > a ? o(!1) : setTimeout(n, t ?? 30);
213
+ const r = async () => {
214
+ e() ? o(!0) : a && Date.now() - l > a ? o(!1) : setTimeout(r, t ?? 30);
215
215
  };
216
- n();
216
+ r();
217
217
  });
218
218
  }
219
219
  function je(e, a) {
220
220
  var o;
221
221
  const t = "single-spa-application:" + e, l = (o = document.getElementById(t)) == null ? void 0 : o.classList;
222
- l && (l.remove("app-left", "app-right", "app-reset"), a ? l.add("app-left") : l.add("app-right"), setTimeout(() => {
223
- l.add("app-reset");
224
- }, 1));
222
+ l && (l.remove("app-left", "app-right"), setTimeout(() => {
223
+ a ? l.add("app-left") : l.add("app-right");
224
+ }, 0));
225
225
  }
226
226
  let te = Date.now();
227
227
  function ce() {
@@ -232,12 +232,12 @@ let Ae = 0;
232
232
  function ue() {
233
233
  return ++Ae;
234
234
  }
235
- async function nt(e) {
235
+ async function rt(e) {
236
236
  if (!ce())
237
237
  return;
238
238
  let a = !1, t;
239
- const l = (n) => {
240
- t = n, a = !0;
239
+ const l = (r) => {
240
+ t = r, a = !0;
241
241
  }, o = ue();
242
242
  return s.on("confirmDlgResult" + o, l), s.emit("confirmDlg", { ...e, seq: o }), await Z(() => a), s.off("confirmDlgResult" + o, l), t;
243
243
  }
@@ -245,8 +245,8 @@ async function ct(e) {
245
245
  if (!ce())
246
246
  return;
247
247
  let a = !1, t;
248
- const l = (n) => {
249
- t = n, a = !0;
248
+ const l = (r) => {
249
+ t = r, a = !0;
250
250
  }, o = ue();
251
251
  return s.on("promptDlgResult" + o, l), s.emit("promptDlg", { ...e, seq: o }), await Z(() => a), s.off("promptDlgResult" + o, l), t;
252
252
  }
@@ -394,11 +394,11 @@ function W(e) {
394
394
  let a, t = 0;
395
395
  const l = e.split("/").filter((o) => o.trim() !== "");
396
396
  return Be.forEach((o) => {
397
- const n = o.path.split("/").filter((c) => c.trim() !== "");
398
- let r = 0;
399
- for (let c = 0; c < l.length && !(c >= n.length || l[c] !== n[c]); c++)
400
- r++;
401
- r > 0 && r >= t && (a = o, t = r);
397
+ const r = o.path.split("/").filter((c) => c.trim() !== "");
398
+ let n = 0;
399
+ for (let c = 0; c < l.length && !(c >= r.length || l[c] !== r[c]); c++)
400
+ n++;
401
+ n > 0 && n >= t && (a = o, t = n);
402
402
  }), a;
403
403
  }
404
404
  const oe = f("");
@@ -412,8 +412,8 @@ function D(e, a) {
412
412
  }
413
413
  if (console.info(`~~~~routeChange~~~~ ${a} -> ${e}`), !o)
414
414
  return;
415
- const n = l.app === o.app, r = l.path === o.path, c = l.level >= o.level;
416
- n ? r ? oe.value = "" : oe.value = c ? "inner-left" : "inner-right" : je(l.app, c);
415
+ const r = l.app === o.app, n = l.path === o.path, c = l.level >= o.level;
416
+ r ? n ? oe.value = "" : oe.value = c ? "inner-left" : "inner-right" : je(l.app, c);
417
417
  }
418
418
  function Ee() {
419
419
  return !!B.get("accessToken");
@@ -422,55 +422,55 @@ function Me() {
422
422
  return !!B.get("activeOrg");
423
423
  }
424
424
  function it(e, a, t) {
425
- const l = Ee(), o = Me(), n = W(e.path);
426
- if (!n) {
425
+ const l = Ee(), o = Me(), r = W(e.path);
426
+ if (!r) {
427
427
  t();
428
428
  return;
429
429
  }
430
- if (n.requiredState === "auth")
430
+ if (r.requiredState === "auth")
431
431
  if (l)
432
432
  if (o) {
433
- const r = "/main";
434
- D(r, a.path), t({ path: r });
433
+ const n = "/main";
434
+ D(n, a.path), t({ path: n });
435
435
  } else
436
436
  D(e.path, a.path), t();
437
437
  else {
438
- const r = "/passport/login";
439
- D(r, a.path), t({ path: r });
438
+ const n = "/passport/login";
439
+ D(n, a.path), t({ path: n });
440
440
  }
441
- else if (n.requiredState === "org")
441
+ else if (r.requiredState === "org")
442
442
  if (l)
443
443
  if (o)
444
444
  D(e.path, a.path), t();
445
445
  else {
446
- const r = "/org/joinOrCreate";
447
- D(r, a.path), t({ path: r });
446
+ const n = "/org/joinOrCreate";
447
+ D(n, a.path), t({ path: n });
448
448
  }
449
449
  else {
450
- const r = "/passport/login";
451
- D(r, a.path), t({ path: r });
450
+ const n = "/passport/login";
451
+ D(n, a.path), t({ path: n });
452
452
  }
453
453
  else if (l)
454
454
  if (o) {
455
- const r = "/main";
456
- D(r, a.path), t({ path: r });
455
+ const n = "/main";
456
+ D(n, a.path), t({ path: n });
457
457
  } else {
458
- const r = "/org/joinOrCreate";
459
- D(r, a.path), t({ path: r });
458
+ const n = "/org/joinOrCreate";
459
+ D(n, a.path), t({ path: n });
460
460
  }
461
461
  else
462
462
  D(e.path, a.path), t();
463
463
  }
464
464
  function P(e, a) {
465
- const t = ne(), l = i({
465
+ const t = re(), l = i({
466
466
  get() {
467
467
  return t.hasView(e);
468
468
  },
469
- set(n) {
470
- n ? t.addView(e) : t.delView(e);
469
+ set(r) {
470
+ r ? t.addView(e) : t.delView(e);
471
471
  }
472
- }), o = (n) => {
473
- a == null || a(n), l.value = !0;
472
+ }), o = (r) => {
473
+ a == null || a(r), l.value = !0;
474
474
  };
475
475
  return S(() => {
476
476
  s.on(e, o);
@@ -481,22 +481,22 @@ function P(e, a) {
481
481
  const Ue = /* @__PURE__ */ M({
482
482
  __name: "index",
483
483
  setup(e) {
484
- const a = Q(), { open: t } = P("confirmDlg"), l = f(""), o = f(""), n = f(), r = f(), c = i(() => {
484
+ const a = Q(), { open: t } = P("confirmDlg"), l = f(""), o = f(""), r = f(), n = f(), c = i(() => {
485
485
  var u;
486
- return ((u = n.value) == null ? void 0 : u.color) ?? "primary";
486
+ return ((u = r.value) == null ? void 0 : u.color) ?? "primary";
487
487
  }), p = i(() => {
488
488
  var u;
489
- return ((u = n.value) == null ? void 0 : u.text) ?? a.t("cancel");
489
+ return ((u = r.value) == null ? void 0 : u.text) ?? a.t("cancel");
490
490
  }), _ = i(() => {
491
491
  var u;
492
- return ((u = r.value) == null ? void 0 : u.color) ?? "primary";
492
+ return ((u = n.value) == null ? void 0 : u.color) ?? "primary";
493
493
  }), v = i(() => {
494
494
  var u;
495
- return ((u = r.value) == null ? void 0 : u.text) ?? a.t("confirm");
495
+ return ((u = n.value) == null ? void 0 : u.text) ?? a.t("confirm");
496
496
  });
497
497
  let y = 0, C = !1;
498
498
  const T = (u) => {
499
- l.value = u.title, o.value = u.text, n.value = u.cancel, r.value = u.confirm, y = u.seq, C = !1, t.value = !0;
499
+ l.value = u.title, o.value = u.text, r.value = u.cancel, n.value = u.confirm, y = u.seq, C = !1, t.value = !0;
500
500
  };
501
501
  S(() => {
502
502
  s.on("confirmDlg", T);
@@ -590,7 +590,7 @@ const Ue = /* @__PURE__ */ M({
590
590
  background: a.current.value.dark ? "#1e1e1e" : "#ffffff",
591
591
  zIndex: t.zIndex
592
592
  }));
593
- return (o, n) => (R(), J("div", {
593
+ return (o, r) => (R(), J("div", {
594
594
  class: "x-cont",
595
595
  style: ge(l.value)
596
596
  }, We, 4));
@@ -615,21 +615,21 @@ const Ue = /* @__PURE__ */ M({
615
615
  setTimeout(() => {
616
616
  o("timeout", t.id);
617
617
  }, t.timeout);
618
- }), N(l, (n) => {
619
- n || o("timeout", t.id);
620
- }), (n, r) => {
618
+ }), N(l, (r) => {
619
+ r || o("timeout", t.id);
620
+ }), (r, n) => {
621
621
  const c = h("v-alert");
622
622
  return R(), E(c, {
623
623
  modelValue: l.value,
624
- "onUpdate:modelValue": r[0] || (r[0] = (p) => l.value = p),
624
+ "onUpdate:modelValue": n[0] || (n[0] = (p) => l.value = p),
625
625
  class: "mt-2",
626
626
  "max-width": "90%",
627
627
  width: "500px",
628
628
  elevation: "1",
629
629
  density: "compact",
630
630
  closable: "",
631
- type: n.type,
632
- text: n.text
631
+ type: r.type,
632
+ text: r.text
633
633
  }, null, 8, ["modelValue", "type", "text"]);
634
634
  };
635
635
  }
@@ -643,15 +643,15 @@ const Ue = /* @__PURE__ */ M({
643
643
  s.off("message", t);
644
644
  });
645
645
  const t = (c) => {
646
- n(c.type, c.text, c.timeout);
646
+ r(c.type, c.text, c.timeout);
647
647
  }, l = (c) => {
648
- r(c);
648
+ n(c);
649
649
  };
650
650
  let o = 0;
651
- const n = (c, p, _) => {
651
+ const r = (c, p, _) => {
652
652
  const v = o++;
653
653
  a.items.push({ id: v, type: c, text: p, timeout: _ });
654
- }, r = (c) => {
654
+ }, n = (c) => {
655
655
  const p = a.items.findIndex((_) => _.id === c);
656
656
  p >= 0 && a.items.splice(p, 1);
657
657
  };
@@ -673,7 +673,7 @@ const Ue = /* @__PURE__ */ M({
673
673
  }), He = /* @__PURE__ */ pe(Ne, [["__scopeId", "data-v-8c2268ea"]]), Je = /* @__PURE__ */ M({
674
674
  __name: "index",
675
675
  setup(e) {
676
- const a = Q(), { open: t } = P("promptDlg"), l = f(""), o = f(""), n = f(), r = f(), c = f(), p = f(""), _ = f(), v = f(), y = i(() => {
676
+ const a = Q(), { open: t } = P("promptDlg"), l = f(""), o = f(""), r = f(), n = f(), c = f(), p = f(""), _ = f(), v = f(), y = i(() => {
677
677
  var d;
678
678
  return ((d = _.value) == null ? void 0 : d.color) ?? "primary";
679
679
  }), C = i(() => {
@@ -689,7 +689,7 @@ const Ue = /* @__PURE__ */ M({
689
689
  let g = 0, b = !1;
690
690
  const V = async (d) => {
691
691
  var x;
692
- l.value = d.title, o.value = d.text, n.value = d.label, r.value = d.placeholder, c.value = d.rules, p.value = d.value, _.value = d.cancel, v.value = d.confirm, g = d.seq, b = !1, t.value = !0, await Z(() => u.value !== void 0, 1e3), (x = u.value) == null || x.focus();
692
+ l.value = d.title, o.value = d.text, r.value = d.label, n.value = d.placeholder, c.value = d.rules, p.value = d.value, _.value = d.cancel, v.value = d.confirm, g = d.seq, b = !1, t.value = !0, await Z(() => u.value !== void 0, 1e3), (x = u.value) == null || x.focus();
693
693
  };
694
694
  S(() => {
695
695
  s.on("promptDlg", V);
@@ -727,8 +727,8 @@ const Ue = /* @__PURE__ */ M({
727
727
  k(se, {
728
728
  modelValue: p.value,
729
729
  "onUpdate:modelValue": x[0] || (x[0] = ($) => p.value = $),
730
- label: n.value,
731
- placeholder: r.value,
730
+ label: r.value,
731
+ placeholder: n.value,
732
732
  rules: c.value,
733
733
  ref_key: "target",
734
734
  ref: u
@@ -781,11 +781,11 @@ const Ue = /* @__PURE__ */ M({
781
781
  s.on("openWaitDlg", l), s.on("closeWaitDlg", o);
782
782
  }), O(() => {
783
783
  s.off("openWaitDlg", l), s.off("closeWaitDlg", o);
784
- }), (n, r) => {
784
+ }), (r, n) => {
785
785
  const c = h("v-card"), p = h("v-dialog");
786
786
  return R(), E(p, {
787
787
  modelValue: L(t),
788
- "onUpdate:modelValue": r[0] || (r[0] = (_) => G(t) ? t.value = _ : null),
788
+ "onUpdate:modelValue": n[0] || (n[0] = (_) => G(t) ? t.value = _ : null),
789
789
  persistent: "",
790
790
  "no-click-animation": "",
791
791
  fullscreen: ""
@@ -814,14 +814,14 @@ const Ue = /* @__PURE__ */ M({
814
814
  e.component("x-confirm-dlg", Ue), e.component("x-loading", Le), e.component("x-message", He), e.component("x-prompt-dlg", Je), e.component("x-wait-dlg", Qe);
815
815
  };
816
816
  function gt() {
817
- const e = H(), a = i(() => e.global.current.value.colors.primary), t = i(() => e.global.current.value.colors.secondary), l = i(() => e.current.value.dark ? "#2e2e2e" : "#bdbdbd"), o = i(() => e.current.value.dark ? "#272727" : "#eeeeee"), n = i(() => e.current.value.dark ? "#1e1e1e" : "#ffffff"), r = i(() => e.current.value.dark ? "#303030" : "#f6f6f6"), c = i(() => e.current.value.dark ? "#ffffff1f" : "#0000001f");
817
+ const e = H(), a = i(() => e.global.current.value.colors.primary), t = i(() => e.global.current.value.colors.secondary), l = i(() => e.current.value.dark ? "#2e2e2e" : "#bdbdbd"), o = i(() => e.current.value.dark ? "#272727" : "#eeeeee"), r = i(() => e.current.value.dark ? "#1e1e1e" : "#ffffff"), n = i(() => e.current.value.dark ? "#303030" : "#f6f6f6"), c = i(() => e.current.value.dark ? "#ffffff1f" : "#0000001f");
818
818
  return {
819
819
  primaryColor: a,
820
820
  secondaryColor: t,
821
821
  backgroundColor0: l,
822
822
  backgroundColor1: o,
823
- backgroundColor2: n,
824
- highlightColor: r,
823
+ backgroundColor2: r,
824
+ highlightColor: n,
825
825
  borderColor: c
826
826
  };
827
827
  }
@@ -829,16 +829,16 @@ function Ze(e, a) {
829
829
  return e.post("pullPermission", a);
830
830
  }
831
831
  function vt(e, a) {
832
- const t = Ce(), l = re(), o = Y(), n = ne();
833
- let r = !0;
832
+ const t = Ce(), l = ne(), o = Y(), r = re();
833
+ let n = !0;
834
834
  const c = () => {
835
- r = !1;
835
+ n = !1;
836
836
  }, p = () => {
837
- r = !0;
837
+ n = !0;
838
838
  }, _ = () => {
839
839
  var g;
840
- if (!n.isEmpty()) {
841
- n.hasView("waitDlg") || n.popView();
840
+ if (!r.isEmpty()) {
841
+ r.hasView("waitDlg") || r.popView();
842
842
  return;
843
843
  }
844
844
  const u = W(t.path);
@@ -875,7 +875,7 @@ function vt(e, a) {
875
875
  });
876
876
  let y;
877
877
  const C = async () => {
878
- if (!r)
878
+ if (!n)
879
879
  return;
880
880
  const u = W(t.path);
881
881
  if (!(!u || u.requiredState !== "org"))
@@ -936,7 +936,7 @@ export {
936
936
  dt as messageSuccess,
937
937
  ft as messageWarning,
938
938
  it as onBeforeEach,
939
- nt as openConfirmDlg,
939
+ rt as openConfirmDlg,
940
940
  ct as openPromptDlg,
941
941
  ut as openWaitDlg,
942
942
  oe as routeTransName,
@@ -945,8 +945,8 @@ export {
945
945
  vt as useMicroApp,
946
946
  mt as usePermission,
947
947
  ht as useSystem,
948
- ne as useViewMgrStore,
948
+ re as useViewMgrStore,
949
949
  P as useViewStack,
950
- rt as waitMs,
950
+ nt as waitMs,
951
951
  Z as waitUtil
952
952
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
3
  "private": false,
4
- "version": "0.5.49",
4
+ "version": "0.5.50",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",