x-essential-lib 0.5.37 → 0.5.39

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 +97 -97
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,15 +3,15 @@ import { ref as i, watch as N, computed as f, 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 = i(), t = i("en"), l = i({}), o = i(""), n = i("/");
10
+ const e = H(), a = i(), t = i("en"), l = i({}), o = i(""), r = i("/");
11
11
  return N(
12
12
  a,
13
13
  () => {
14
- e.global.name.value = a.value ? "dark" : "light";
14
+ window.dispatchEvent(new CustomEvent("darkchange", { detail: a.value })), e.global.name.value = a.value ? "dark" : "light";
15
15
  },
16
16
  { immediate: !0 }
17
17
  ), {
@@ -19,7 +19,7 @@ const Y = le(
19
19
  locale: t,
20
20
  permissionObjects: l,
21
21
  permissionChecksum: o,
22
- lastAppPath: n
22
+ lastAppPath: r
23
23
  };
24
24
  },
25
25
  {
@@ -34,7 +34,7 @@ const Y = le(
34
34
  }
35
35
  ]
36
36
  }
37
- ), ne = le("viewMgr", () => {
37
+ ), re = le("viewMgr", () => {
38
38
  const e = i([]);
39
39
  function a() {
40
40
  return e.value.length <= 0;
@@ -50,11 +50,11 @@ const Y = le(
50
50
  function o(p) {
51
51
  e.value.push(p);
52
52
  }
53
- function n(p) {
53
+ function r(p) {
54
54
  const _ = e.value.findIndex((v) => v === p);
55
55
  _ !== -1 && e.value.splice(_, e.value.length - _);
56
56
  }
57
- function r() {
57
+ function n() {
58
58
  console.assert(e.value.length > 0), e.value.pop();
59
59
  }
60
60
  function c() {
@@ -66,8 +66,8 @@ const Y = le(
66
66
  lastView: t,
67
67
  hasView: l,
68
68
  addView: o,
69
- delView: n,
70
- popView: r,
69
+ delView: r,
70
+ popView: n,
71
71
  clearViews: c
72
72
  };
73
73
  });
@@ -92,38 +92,38 @@ var De = {
92
92
  }
93
93
  };
94
94
  function X(e, a) {
95
- function t(o, n, r) {
95
+ function t(o, r, n) {
96
96
  if (!(typeof document > "u")) {
97
- r = L({}, 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);
97
+ n = L({}, 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);
98
98
  var c = "";
99
- for (var p in r)
100
- r[p] && (c += "; " + p, r[p] !== !0 && (c += "=" + r[p].split(";")[0]));
101
- return document.cookie = o + "=" + e.write(n, o) + c;
99
+ for (var p in n)
100
+ n[p] && (c += "; " + p, n[p] !== !0 && (c += "=" + n[p].split(";")[0]));
101
+ return document.cookie = o + "=" + e.write(r, o) + c;
102
102
  }
103
103
  }
104
104
  function l(o) {
105
105
  if (!(typeof document > "u" || arguments.length && !o)) {
106
- for (var n = document.cookie ? document.cookie.split("; ") : [], r = {}, c = 0; c < n.length; c++) {
107
- var p = n[c].split("="), _ = p.slice(1).join("=");
106
+ for (var r = document.cookie ? document.cookie.split("; ") : [], n = {}, c = 0; c < r.length; c++) {
107
+ var p = r[c].split("="), _ = p.slice(1).join("=");
108
108
  try {
109
109
  var v = decodeURIComponent(p[0]);
110
- if (r[v] = e.read(_, v), o === v)
110
+ if (n[v] = e.read(_, v), o === v)
111
111
  break;
112
112
  } catch {
113
113
  }
114
114
  }
115
- return o ? r[o] : r;
115
+ return o ? n[o] : n;
116
116
  }
117
117
  }
118
118
  return Object.create(
119
119
  {
120
120
  set: t,
121
121
  get: l,
122
- remove: function(o, n) {
122
+ remove: function(o, r) {
123
123
  t(
124
124
  o,
125
125
  "",
126
- L({}, n, {
126
+ L({}, r, {
127
127
  expires: -1
128
128
  })
129
129
  );
@@ -179,7 +179,7 @@ function Oe(e, a) {
179
179
  }), a(l), Promise.reject(e);
180
180
  }
181
181
  function Te() {
182
- R.remove("accessToken"), R.remove("refreshToken"), R.remove("activeOrg"), re().replace({ path: "/passport/login" });
182
+ R.remove("accessToken"), R.remove("refreshToken"), R.remove("activeOrg"), ne().replace({ path: "/passport/login" });
183
183
  }
184
184
  function je(e) {
185
185
  return { all: e = e || /* @__PURE__ */ new Map(), on: function(a, t) {
@@ -200,7 +200,7 @@ function je(e) {
200
200
  const s = function() {
201
201
  return window.eventBus || (window.eventBus = je()), window.eventBus;
202
202
  }();
203
- async function rt(e) {
203
+ async function nt(e) {
204
204
  return new Promise((a) => {
205
205
  setTimeout(a, e);
206
206
  });
@@ -208,10 +208,10 @@ async function rt(e) {
208
208
  async function Z(e, a, t) {
209
209
  const l = Date.now();
210
210
  return new Promise((o) => {
211
- const n = async () => {
212
- e() ? o(!0) : a && Date.now() - l > a ? o(!1) : setTimeout(n, t ?? 30);
211
+ const r = async () => {
212
+ e() ? o(!0) : a && Date.now() - l > a ? o(!1) : setTimeout(r, t ?? 30);
213
213
  };
214
- n();
214
+ r();
215
215
  });
216
216
  }
217
217
  function Ae(e, a) {
@@ -221,9 +221,9 @@ function Ae(e, a) {
221
221
  return;
222
222
  }
223
223
  const t = "single-spa-application:" + e, l = (o = document.getElementById(t)) == null ? void 0 : o.classList;
224
- l && (l.remove("app-left", "app-right", "app-reset"), a ? l.add("app-right") : l.add("app-left"), setTimeout(() => {
224
+ l && (l.remove("app-left", "app-right", "app-reset"), a ? l.add("app-left") : l.add("app-right"), setTimeout(() => {
225
225
  l.add("app-reset");
226
- }, 0));
226
+ }, 50));
227
227
  }
228
228
  let te = Date.now();
229
229
  function ce() {
@@ -234,12 +234,12 @@ let Ie = 0;
234
234
  function ue() {
235
235
  return ++Ie;
236
236
  }
237
- async function nt(e) {
237
+ async function rt(e) {
238
238
  if (!ce())
239
239
  return;
240
240
  let a = !1, t;
241
- const l = (n) => {
242
- t = n, a = !0;
241
+ const l = (r) => {
242
+ t = r, a = !0;
243
243
  }, o = ue();
244
244
  return s.on("confirmDlgResult" + o, l), s.emit("confirmDlg", { ...e, seq: o }), await Z(() => a), s.off("confirmDlgResult" + o, l), t;
245
245
  }
@@ -247,8 +247,8 @@ async function ct(e) {
247
247
  if (!ce())
248
248
  return;
249
249
  let a = !1, t;
250
- const l = (n) => {
251
- t = n, a = !0;
250
+ const l = (r) => {
251
+ t = r, a = !0;
252
252
  }, o = ue();
253
253
  return s.on("promptDlgResult" + o, l), s.emit("promptDlg", { ...e, seq: o }), await Z(() => a), s.off("promptDlgResult" + o, l), t;
254
254
  }
@@ -396,21 +396,21 @@ function z(e) {
396
396
  let a, t = 0;
397
397
  const l = e.split("/").filter((o) => o.trim() !== "");
398
398
  return Re.forEach((o) => {
399
- const n = o.path.split("/").filter((c) => c.trim() !== "");
400
- let r = 0;
401
- for (let c = 0; c < l.length && !(c >= n.length || l[c] !== n[c]); c++)
402
- r++;
403
- r > 0 && r >= t && (a = o, t = r);
399
+ const r = o.path.split("/").filter((c) => c.trim() !== "");
400
+ let n = 0;
401
+ for (let c = 0; c < l.length && !(c >= r.length || l[c] !== r[c]); c++)
402
+ n++;
403
+ n > 0 && n >= t && (a = o, t = n);
404
404
  }), a;
405
405
  }
406
406
  const oe = i("");
407
407
  function D(e, a) {
408
408
  const { lastAppPath: t } = Y();
409
409
  a === "/" && (a = t);
410
- const l = z(e), o = z(a), n = (l == null ? void 0 : l.app) === (o == null ? void 0 : o.app), r = (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);
410
+ 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
411
  console.info(
412
- `~~~~before route change~~~~ ${a} -> ${e} inner=${n} forward=${c}`
413
- ), n ? r ? oe.value = "" : oe.value = c ? "inner-left" : "inner-right" : l && Ae(l.app, c);
412
+ `~~~~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);
414
414
  }
415
415
  function Ee() {
416
416
  return !!R.get("accessToken");
@@ -419,55 +419,55 @@ function Ue() {
419
419
  return !!R.get("activeOrg");
420
420
  }
421
421
  function ft(e, a, t) {
422
- const l = Ee(), o = Ue(), n = z(e.path);
423
- if (!n) {
422
+ const l = Ee(), o = Ue(), r = z(e.path);
423
+ if (!r) {
424
424
  t();
425
425
  return;
426
426
  }
427
- if (n.requiredState === "auth")
427
+ if (r.requiredState === "auth")
428
428
  if (l)
429
429
  if (o) {
430
- const r = "/main";
431
- D(r, a.path), t({ path: r });
430
+ const n = "/main";
431
+ D(n, a.path), t({ path: n });
432
432
  } else
433
433
  D(e.path, a.path), t();
434
434
  else {
435
- const r = "/passport/login";
436
- D(r, a.path), t({ path: r });
435
+ const n = "/passport/login";
436
+ D(n, a.path), t({ path: n });
437
437
  }
438
- else if (n.requiredState === "org")
438
+ else if (r.requiredState === "org")
439
439
  if (l)
440
440
  if (o)
441
441
  D(e.path, a.path), t();
442
442
  else {
443
- const r = "/org/joinOrCreate";
444
- D(r, a.path), t({ path: r });
443
+ const n = "/org/joinOrCreate";
444
+ D(n, a.path), t({ path: n });
445
445
  }
446
446
  else {
447
- const r = "/passport/login";
448
- D(r, a.path), t({ path: r });
447
+ const n = "/passport/login";
448
+ D(n, a.path), t({ path: n });
449
449
  }
450
450
  else if (l)
451
451
  if (o) {
452
- const r = "/main";
453
- D(r, a.path), t({ path: r });
452
+ const n = "/main";
453
+ D(n, a.path), t({ path: n });
454
454
  } else {
455
- const r = "/org/joinOrCreate";
456
- D(r, a.path), t({ path: r });
455
+ const n = "/org/joinOrCreate";
456
+ D(n, a.path), t({ path: n });
457
457
  }
458
458
  else
459
459
  D(e.path, a.path), t();
460
460
  }
461
461
  function P(e, a) {
462
- const t = ne(), l = f({
462
+ const t = re(), l = f({
463
463
  get() {
464
464
  return t.hasView(e);
465
465
  },
466
- set(n) {
467
- n ? t.addView(e) : t.delView(e);
466
+ set(r) {
467
+ r ? t.addView(e) : t.delView(e);
468
468
  }
469
- }), o = (n) => {
470
- a == null || a(n), l.value = !0;
469
+ }), o = (r) => {
470
+ a == null || a(r), l.value = !0;
471
471
  };
472
472
  return S(() => {
473
473
  s.on(e, o);
@@ -478,22 +478,22 @@ function P(e, a) {
478
478
  const $e = /* @__PURE__ */ U({
479
479
  __name: "index",
480
480
  setup(e) {
481
- const a = Q(), { open: t } = P("confirmDlg"), l = i(""), o = i(""), n = i(), r = i(), c = f(() => {
481
+ const a = Q(), { open: t } = P("confirmDlg"), l = i(""), o = i(""), r = i(), n = i(), c = f(() => {
482
482
  var u;
483
- return ((u = n.value) == null ? void 0 : u.color) ?? "primary";
483
+ return ((u = r.value) == null ? void 0 : u.color) ?? "primary";
484
484
  }), p = f(() => {
485
485
  var u;
486
- return ((u = n.value) == null ? void 0 : u.text) ?? a.t("cancel");
486
+ return ((u = r.value) == null ? void 0 : u.text) ?? a.t("cancel");
487
487
  }), _ = f(() => {
488
488
  var u;
489
- return ((u = r.value) == null ? void 0 : u.color) ?? "primary";
489
+ return ((u = n.value) == null ? void 0 : u.color) ?? "primary";
490
490
  }), v = f(() => {
491
491
  var u;
492
- return ((u = r.value) == null ? void 0 : u.text) ?? a.t("confirm");
492
+ return ((u = n.value) == null ? void 0 : u.text) ?? a.t("confirm");
493
493
  });
494
494
  let y = 0, C = !1;
495
495
  const j = (u) => {
496
- l.value = u.title, o.value = u.text, n.value = u.cancel, r.value = u.confirm, y = u.seq, C = !1, t.value = !0;
496
+ 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
497
  };
498
498
  S(() => {
499
499
  s.on("confirmDlg", j);
@@ -587,7 +587,7 @@ const $e = /* @__PURE__ */ U({
587
587
  background: a.current.value.dark ? "#1e1e1e" : "#ffffff",
588
588
  zIndex: t.zIndex
589
589
  }));
590
- return (o, n) => (V(), J("div", {
590
+ return (o, r) => (V(), J("div", {
591
591
  class: "x-cont",
592
592
  style: ge(l.value)
593
593
  }, ze, 4));
@@ -612,21 +612,21 @@ const $e = /* @__PURE__ */ U({
612
612
  setTimeout(() => {
613
613
  o("timeout", t.id);
614
614
  }, t.timeout);
615
- }), N(l, (n) => {
616
- n || o("timeout", t.id);
617
- }), (n, r) => {
615
+ }), N(l, (r) => {
616
+ r || o("timeout", t.id);
617
+ }), (r, n) => {
618
618
  const c = h("v-alert");
619
619
  return V(), E(c, {
620
620
  modelValue: l.value,
621
- "onUpdate:modelValue": r[0] || (r[0] = (p) => l.value = p),
621
+ "onUpdate:modelValue": n[0] || (n[0] = (p) => l.value = p),
622
622
  class: "mt-2",
623
623
  "max-width": "90%",
624
624
  width: "500px",
625
625
  elevation: "1",
626
626
  density: "compact",
627
627
  closable: "",
628
- type: n.type,
629
- text: n.text
628
+ type: r.type,
629
+ text: r.text
630
630
  }, null, 8, ["modelValue", "type", "text"]);
631
631
  };
632
632
  }
@@ -640,15 +640,15 @@ const $e = /* @__PURE__ */ U({
640
640
  s.off("message", t);
641
641
  });
642
642
  const t = (c) => {
643
- n(c.type, c.text, c.timeout);
643
+ r(c.type, c.text, c.timeout);
644
644
  }, l = (c) => {
645
- r(c);
645
+ n(c);
646
646
  };
647
647
  let o = 0;
648
- const n = (c, p, _) => {
648
+ const r = (c, p, _) => {
649
649
  const v = o++;
650
650
  a.items.push({ id: v, type: c, text: p, timeout: _ });
651
- }, r = (c) => {
651
+ }, n = (c) => {
652
652
  const p = a.items.findIndex((_) => _.id === c);
653
653
  p >= 0 && a.items.splice(p, 1);
654
654
  };
@@ -670,7 +670,7 @@ const $e = /* @__PURE__ */ U({
670
670
  }), He = /* @__PURE__ */ pe(Ne, [["__scopeId", "data-v-8c2268ea"]]), Je = /* @__PURE__ */ U({
671
671
  __name: "index",
672
672
  setup(e) {
673
- const a = Q(), { open: t } = P("promptDlg"), l = i(""), o = i(""), n = i(), r = i(), c = i(), p = i(""), _ = i(), v = i(), y = f(() => {
673
+ const a = Q(), { open: t } = P("promptDlg"), l = i(""), o = i(""), r = i(), n = i(), c = i(), p = i(""), _ = i(), v = i(), y = f(() => {
674
674
  var d;
675
675
  return ((d = _.value) == null ? void 0 : d.color) ?? "primary";
676
676
  }), C = f(() => {
@@ -686,7 +686,7 @@ const $e = /* @__PURE__ */ U({
686
686
  let g = 0, b = !1;
687
687
  const q = async (d) => {
688
688
  var x;
689
- 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();
689
+ 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();
690
690
  };
691
691
  S(() => {
692
692
  s.on("promptDlg", q);
@@ -724,8 +724,8 @@ const $e = /* @__PURE__ */ U({
724
724
  k(se, {
725
725
  modelValue: p.value,
726
726
  "onUpdate:modelValue": x[0] || (x[0] = (K) => p.value = K),
727
- label: n.value,
728
- placeholder: r.value,
727
+ label: r.value,
728
+ placeholder: n.value,
729
729
  rules: c.value,
730
730
  ref_key: "target",
731
731
  ref: u
@@ -778,11 +778,11 @@ const $e = /* @__PURE__ */ U({
778
778
  s.on("openWaitDlg", l), s.on("closeWaitDlg", o);
779
779
  }), T(() => {
780
780
  s.off("openWaitDlg", l), s.off("closeWaitDlg", o);
781
- }), (n, r) => {
781
+ }), (r, n) => {
782
782
  const c = h("v-card"), p = h("v-dialog");
783
783
  return V(), E(p, {
784
784
  modelValue: F(t),
785
- "onUpdate:modelValue": r[0] || (r[0] = (_) => G(t) ? t.value = _ : null),
785
+ "onUpdate:modelValue": n[0] || (n[0] = (_) => G(t) ? t.value = _ : null),
786
786
  persistent: "",
787
787
  "no-click-animation": "",
788
788
  fullscreen: ""
@@ -811,14 +811,14 @@ const $e = /* @__PURE__ */ U({
811
811
  e.component("x-confirm-dlg", $e), e.component("x-loading", Fe), e.component("x-message", He), e.component("x-prompt-dlg", Je), e.component("x-wait-dlg", Qe);
812
812
  };
813
813
  function gt() {
814
- const e = H(), a = f(() => e.global.current.value.colors.primary), t = f(() => e.global.current.value.colors.secondary), l = f(() => e.current.value.dark ? "#2e2e2e" : "#bdbdbd"), o = f(() => e.current.value.dark ? "#272727" : "#eeeeee"), n = f(() => e.current.value.dark ? "#1e1e1e" : "#ffffff"), r = f(() => e.current.value.dark ? "#303030" : "#f6f6f6"), c = f(() => e.current.value.dark ? "#ffffff1f" : "#0000001f");
814
+ const e = H(), a = f(() => e.global.current.value.colors.primary), t = f(() => e.global.current.value.colors.secondary), l = f(() => e.current.value.dark ? "#2e2e2e" : "#bdbdbd"), o = f(() => e.current.value.dark ? "#272727" : "#eeeeee"), r = f(() => e.current.value.dark ? "#1e1e1e" : "#ffffff"), n = f(() => e.current.value.dark ? "#303030" : "#f6f6f6"), c = f(() => e.current.value.dark ? "#ffffff1f" : "#0000001f");
815
815
  return {
816
816
  primaryColor: a,
817
817
  secondaryColor: t,
818
818
  backgroundColor0: l,
819
819
  backgroundColor1: o,
820
- backgroundColor2: n,
821
- highlightColor: r,
820
+ backgroundColor2: r,
821
+ highlightColor: n,
822
822
  borderColor: c
823
823
  };
824
824
  }
@@ -826,16 +826,16 @@ function Ze(e, a) {
826
826
  return e.post("pullPermission", a);
827
827
  }
828
828
  function vt(e, a) {
829
- const t = Ce(), l = re(), o = Y(), n = ne();
830
- let r = !0;
829
+ const t = Ce(), l = ne(), o = Y(), r = re();
830
+ let n = !0;
831
831
  const c = () => {
832
- r = !1;
832
+ n = !1;
833
833
  }, p = () => {
834
- r = !0;
834
+ n = !0;
835
835
  }, _ = () => {
836
836
  var g;
837
- if (!n.isEmpty()) {
838
- n.hasView("waitDlg") || n.popView();
837
+ if (!r.isEmpty()) {
838
+ r.hasView("waitDlg") || r.popView();
839
839
  return;
840
840
  }
841
841
  const u = z(t.path);
@@ -872,7 +872,7 @@ function vt(e, a) {
872
872
  });
873
873
  let y;
874
874
  const C = async () => {
875
- if (!r)
875
+ if (!n)
876
876
  return;
877
877
  const u = z(t.path);
878
878
  if (!(!u || u.requiredState !== "org"))
@@ -933,7 +933,7 @@ export {
933
933
  dt as messageSuccess,
934
934
  it as messageWarning,
935
935
  ft as onBeforeEach,
936
- nt as openConfirmDlg,
936
+ rt as openConfirmDlg,
937
937
  ct as openPromptDlg,
938
938
  ut as openWaitDlg,
939
939
  oe as routeTransName,
@@ -942,8 +942,8 @@ export {
942
942
  vt as useMicroApp,
943
943
  mt as usePermission,
944
944
  ht as useSystem,
945
- ne as useViewMgrStore,
945
+ re as useViewMgrStore,
946
946
  P as useViewStack,
947
- rt as waitMs,
947
+ nt as waitMs,
948
948
  Z as waitUtil
949
949
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
3
  "private": false,
4
- "version": "0.5.37",
4
+ "version": "0.5.39",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",