x-essential-lib 0.3.11 → 0.3.12

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 CHANGED
@@ -2,87 +2,95 @@
2
2
  import { VAlert as ve, VBtn as me, VCard as he, VCardActions as we, VCardText as ye, VCardTitle as xe, VDialog as ke, VForm as be, VTextField as Ce } from "vuetify/lib/components/index.mjs";
3
3
  import { ref as i, computed as f, onMounted as D, onBeforeUnmount as T, defineComponent as O, watch as H, resolveComponent as g, openBlock as V, createBlock as A, unref as W, isRef as J, withKeys as N, withModifiers as $, withCtx as v, createVNode as h, createTextVNode as C, toDisplayString as b, createElementBlock as F, normalizeStyle as Ve, pushScopeId as De, popScopeId as qe, createElementVNode as m, reactive as Se, Fragment as Te, renderList as Oe } from "vue";
4
4
  import { useLocale as X, useTheme as K, useDisplay as Re } from "vuetify/lib/framework.mjs";
5
- import { defineStore as le } from "pinia";
5
+ import { defineStore as oe } from "pinia";
6
6
  import { useRouter as re, useRoute as je } from "vue-router";
7
7
  import Ie from "axios";
8
- const ne = le("viewMgr", () => {
8
+ const ne = oe("viewMgr", () => {
9
9
  const e = i([]);
10
10
  function a() {
11
11
  return e.value.length <= 0;
12
12
  }
13
- function t(r) {
14
- return e.value.find((c) => c === r) !== void 0;
13
+ function t() {
14
+ const s = e.value.length;
15
+ if (s > 0)
16
+ return e.value[s - 1];
15
17
  }
16
- function o(r) {
17
- l(r), e.value.push(r);
18
+ function l(s) {
19
+ return e.value.find((c) => c === s) !== void 0;
18
20
  }
19
- function l(r) {
20
- const c = e.value.findIndex((_) => _ === r);
21
+ function o(s) {
22
+ n(s), e.value.push(s);
23
+ }
24
+ function n(s) {
25
+ const c = e.value.findIndex((y) => y === s);
21
26
  c !== -1 && e.value.splice(c, 1);
22
27
  }
23
- function n() {
28
+ function r() {
24
29
  e.value.pop();
25
30
  }
26
- return { isEmpty: a, hasView: t, addView: o, delView: l, popView: n };
31
+ function u() {
32
+ e.value = [];
33
+ }
34
+ return { isEmpty: a, lastView: t, hasView: l, addView: o, delView: n, popView: r, clearViews: u };
27
35
  });
28
36
  function Ee(e) {
29
37
  return { all: e = e || /* @__PURE__ */ new Map(), on: function(a, t) {
30
- var o = e.get(a);
31
- o ? o.push(t) : e.set(a, [t]);
38
+ var l = e.get(a);
39
+ l ? l.push(t) : e.set(a, [t]);
32
40
  }, off: function(a, t) {
33
- var o = e.get(a);
34
- o && (t ? o.splice(o.indexOf(t) >>> 0, 1) : e.set(a, []));
41
+ var l = e.get(a);
42
+ l && (t ? l.splice(l.indexOf(t) >>> 0, 1) : e.set(a, []));
35
43
  }, emit: function(a, t) {
36
- var o = e.get(a);
37
- o && o.slice().map(function(l) {
38
- l(t);
39
- }), (o = e.get("*")) && o.slice().map(function(l) {
40
- l(a, t);
44
+ var l = e.get(a);
45
+ l && l.slice().map(function(o) {
46
+ o(t);
47
+ }), (l = e.get("*")) && l.slice().map(function(o) {
48
+ o(a, t);
41
49
  });
42
50
  } };
43
51
  }
44
- const s = Ee();
52
+ const _ = Ee();
45
53
  async function dt(e) {
46
54
  return new Promise((a) => {
47
55
  setTimeout(a, e);
48
56
  });
49
57
  }
50
58
  async function G(e, a, t) {
51
- const o = Date.now();
52
- return new Promise((l) => {
59
+ const l = Date.now();
60
+ return new Promise((o) => {
53
61
  const n = async () => {
54
- e() ? l(!0) : a && Date.now() - o > a ? l(!1) : setTimeout(n, t ?? 30);
62
+ e() ? o(!0) : a && Date.now() - l > a ? o(!1) : setTimeout(n, t ?? 30);
55
63
  };
56
64
  n();
57
65
  });
58
66
  }
59
67
  function Q(e, a) {
60
- const t = ne(), o = f({
68
+ const t = ne(), l = f({
61
69
  get() {
62
70
  return t.hasView(e);
63
71
  },
64
72
  set(n) {
65
73
  n ? t.addView(e) : t.delView(e);
66
74
  }
67
- }), l = (n) => {
68
- a == null || a(n), o.value = !0;
75
+ }), o = (n) => {
76
+ a == null || a(n), l.value = !0;
69
77
  };
70
78
  return D(() => {
71
- s.on(e, l);
79
+ _.on(e, o);
72
80
  }), T(() => {
73
- s.off(e, l);
74
- }), { open: o };
81
+ _.off(e, o);
82
+ }), { open: l };
75
83
  }
76
84
  const $e = /* @__PURE__ */ O({
77
85
  __name: "index",
78
86
  setup(e) {
79
- const a = X(), { open: t } = Q("confirmDlg"), o = i(""), l = i(""), n = i(), r = i(), c = f(() => {
87
+ const a = X(), { open: t } = Q("confirmDlg"), l = i(""), o = i(""), n = i(), r = i(), u = f(() => {
80
88
  var d;
81
89
  return ((d = n.value) == null ? void 0 : d.color) ?? "primary";
82
- }), _ = f(() => {
90
+ }), s = f(() => {
83
91
  var d;
84
92
  return ((d = n.value) == null ? void 0 : d.text) ?? a.t("cancel");
85
- }), u = f(() => {
93
+ }), c = f(() => {
86
94
  var d;
87
95
  return ((d = r.value) == null ? void 0 : d.color) ?? "primary";
88
96
  }), y = f(() => {
@@ -91,18 +99,18 @@ const $e = /* @__PURE__ */ O({
91
99
  });
92
100
  let R = 0, q = !1;
93
101
  const M = (d) => {
94
- o.value = d.title, l.value = d.text, n.value = d.cancel, r.value = d.confirm, R = d.seq, q = !1, t.value = !0;
102
+ l.value = d.title, o.value = d.text, n.value = d.cancel, r.value = d.confirm, R = d.seq, q = !1, t.value = !0;
95
103
  };
96
104
  D(() => {
97
- s.on("confirmDlg", M);
105
+ _.on("confirmDlg", M);
98
106
  }), T(() => {
99
- s.off("confirmDlg", M);
107
+ _.off("confirmDlg", M);
100
108
  });
101
109
  const B = () => {
102
- t.value = !1, q || (s.emit("confirmDlgResult" + R, !0), q = !0);
110
+ t.value = !1, q || (_.emit("confirmDlgResult" + R, !0), q = !0);
103
111
  };
104
112
  return H(t, (d) => {
105
- !d && !q && (s.emit("confirmDlgResult" + R, !1), q = !0);
113
+ !d && !q && (_.emit("confirmDlgResult" + R, !1), q = !0);
106
114
  }), (d, x) => {
107
115
  const S = g("v-card-title"), L = g("v-card-text"), j = g("v-btn"), p = g("v-card-actions"), w = g("v-card"), z = g("v-dialog");
108
116
  return V(), A(z, {
@@ -120,13 +128,13 @@ const $e = /* @__PURE__ */ O({
120
128
  default: v(() => [
121
129
  h(S, null, {
122
130
  default: v(() => [
123
- C(b(o.value), 1)
131
+ C(b(l.value), 1)
124
132
  ]),
125
133
  _: 1
126
134
  }),
127
135
  h(L, null, {
128
136
  default: v(() => [
129
- C(b(l.value), 1)
137
+ C(b(o.value), 1)
130
138
  ]),
131
139
  _: 1
132
140
  }),
@@ -134,17 +142,17 @@ const $e = /* @__PURE__ */ O({
134
142
  default: v(() => [
135
143
  h(j, {
136
144
  onClick: x[0] || (x[0] = (I) => t.value = !1),
137
- color: c.value,
145
+ color: u.value,
138
146
  variant: "text"
139
147
  }, {
140
148
  default: v(() => [
141
- C(b(_.value), 1)
149
+ C(b(s.value), 1)
142
150
  ]),
143
151
  _: 1
144
152
  }, 8, ["color"]),
145
153
  h(j, {
146
154
  onClick: B,
147
- color: u.value,
155
+ color: c.value,
148
156
  variant: "text"
149
157
  }, {
150
158
  default: v(() => [
@@ -187,19 +195,19 @@ const $e = /* @__PURE__ */ O({
187
195
  }
188
196
  },
189
197
  setup(e) {
190
- const a = K(), t = e, o = f(() => ({
198
+ const a = K(), t = e, l = f(() => ({
191
199
  background: a.current.value.dark ? "#1e1e1e" : "#ffffff",
192
200
  zIndex: t.zIndex
193
201
  }));
194
- return (l, n) => (V(), F("div", {
202
+ return (o, n) => (V(), F("div", {
195
203
  class: "x-cont",
196
- style: Ve(o.value)
204
+ style: Ve(l.value)
197
205
  }, Be, 4));
198
206
  }
199
207
  }), ce = (e, a) => {
200
208
  const t = e.__vccOpts || e;
201
- for (const [o, l] of a)
202
- t[o] = l;
209
+ for (const [l, o] of a)
210
+ t[l] = o;
203
211
  return t;
204
212
  }, Ue = /* @__PURE__ */ ce(Le, [["__scopeId", "data-v-a8f3d91f"]]), We = /* @__PURE__ */ O({
205
213
  __name: "item",
@@ -223,7 +231,7 @@ const $e = /* @__PURE__ */ O({
223
231
  },
224
232
  emits: ["timeout"],
225
233
  setup(e, { emit: a }) {
226
- const t = e, o = i(!0), l = a, n = f(() => {
234
+ const t = e, l = i(!0), o = a, n = f(() => {
227
235
  let r = "";
228
236
  switch (t.type) {
229
237
  case "error":
@@ -243,15 +251,15 @@ const $e = /* @__PURE__ */ O({
243
251
  });
244
252
  return D(() => {
245
253
  setTimeout(() => {
246
- l("timeout", t.id);
254
+ o("timeout", t.id);
247
255
  }, t.timeout);
248
- }), H(o, (r) => {
249
- r || l("timeout", t.id);
250
- }), (r, c) => {
251
- const _ = g("v-alert");
252
- return V(), A(_, {
253
- modelValue: o.value,
254
- "onUpdate:modelValue": c[0] || (c[0] = (u) => o.value = u),
256
+ }), H(l, (r) => {
257
+ r || o("timeout", t.id);
258
+ }), (r, u) => {
259
+ const s = g("v-alert");
260
+ return V(), A(s, {
261
+ modelValue: l.value,
262
+ "onUpdate:modelValue": u[0] || (u[0] = (c) => l.value = c),
255
263
  class: "mt-2",
256
264
  type: e.type,
257
265
  icon: n.value,
@@ -269,47 +277,47 @@ const $e = /* @__PURE__ */ O({
269
277
  setup(e) {
270
278
  const a = Se({ items: [] });
271
279
  D(() => {
272
- s.on("message", t);
280
+ _.on("message", t);
273
281
  }), T(() => {
274
- s.off("message", t);
282
+ _.off("message", t);
275
283
  });
276
- const t = (c) => {
277
- n(c.type, c.text, c.timeout);
278
- }, o = (c) => {
279
- r(c);
284
+ const t = (u) => {
285
+ n(u.type, u.text, u.timeout);
286
+ }, l = (u) => {
287
+ r(u);
280
288
  };
281
- let l = 0;
282
- const n = (c, _, u) => {
283
- const y = l++;
284
- a.items.push({ id: y, type: c, text: _, timeout: u });
285
- }, r = (c) => {
286
- const _ = a.items.findIndex((u) => u.id === c);
287
- _ >= 0 && a.items.splice(_, 1);
289
+ let o = 0;
290
+ const n = (u, s, c) => {
291
+ const y = o++;
292
+ a.items.push({ id: y, type: u, text: s, timeout: c });
293
+ }, r = (u) => {
294
+ const s = a.items.findIndex((c) => c.id === u);
295
+ s >= 0 && a.items.splice(s, 1);
288
296
  };
289
- return (c, _) => (V(), F("div", {
290
- onClick: _[0] || (_[0] = $(() => {
297
+ return (u, s) => (V(), F("div", {
298
+ onClick: s[0] || (s[0] = $(() => {
291
299
  }, ["stop"])),
292
300
  class: "x-cont d-flex flex-column-reverse align-center"
293
301
  }, [
294
- (V(!0), F(Te, null, Oe(a.items, (u) => (V(), A(We, {
295
- onTimeout: o,
296
- id: u.id,
297
- type: u.type,
298
- text: u.text,
299
- timeout: u.timeout,
300
- key: u.id
302
+ (V(!0), F(Te, null, Oe(a.items, (c) => (V(), A(We, {
303
+ onTimeout: l,
304
+ id: c.id,
305
+ type: c.type,
306
+ text: c.text,
307
+ timeout: c.timeout,
308
+ key: c.id
301
309
  }, null, 8, ["id", "type", "text", "timeout"]))), 128))
302
310
  ]));
303
311
  }
304
312
  }), He = /* @__PURE__ */ ce(Ne, [["__scopeId", "data-v-70ed4b89"]]), Ke = /* @__PURE__ */ O({
305
313
  __name: "index",
306
314
  setup(e) {
307
- const a = X(), { open: t } = Q("promptDlg"), o = i(""), l = i(""), n = i(), r = i(), c = i(), _ = i(""), u = i(), y = i(), R = f(() => {
315
+ const a = X(), { open: t } = Q("promptDlg"), l = i(""), o = i(""), n = i(), r = i(), u = i(), s = i(""), c = i(), y = i(), R = f(() => {
308
316
  var p;
309
- return ((p = u.value) == null ? void 0 : p.color) ?? "primary";
317
+ return ((p = c.value) == null ? void 0 : p.color) ?? "primary";
310
318
  }), q = f(() => {
311
319
  var p;
312
- return ((p = u.value) == null ? void 0 : p.text) ?? a.t("cancel");
320
+ return ((p = c.value) == null ? void 0 : p.text) ?? a.t("cancel");
313
321
  }), M = f(() => {
314
322
  var p;
315
323
  return ((p = y.value) == null ? void 0 : p.color) ?? "primary";
@@ -320,18 +328,18 @@ const $e = /* @__PURE__ */ O({
320
328
  let x = 0, S = !1;
321
329
  const L = async (p) => {
322
330
  var w;
323
- o.value = p.title, l.value = p.text, n.value = p.label, r.value = p.placeholder, c.value = p.rules, _.value = p.value, u.value = p.cancel, y.value = p.confirm, x = p.seq, S = !1, t.value = !0, await G(() => d.value !== void 0, 1e3), (w = d.value) == null || w.focus();
331
+ l.value = p.title, o.value = p.text, n.value = p.label, r.value = p.placeholder, u.value = p.rules, s.value = p.value, c.value = p.cancel, y.value = p.confirm, x = p.seq, S = !1, t.value = !0, await G(() => d.value !== void 0, 1e3), (w = d.value) == null || w.focus();
324
332
  };
325
333
  D(() => {
326
- s.on("promptDlg", L);
334
+ _.on("promptDlg", L);
327
335
  }), T(() => {
328
- s.off("promptDlg", L);
336
+ _.off("promptDlg", L);
329
337
  });
330
338
  const j = () => {
331
- t.value = !1, S || (s.emit("promptDlgResult" + x, _.value ?? ""), S = !0);
339
+ t.value = !1, S || (_.emit("promptDlgResult" + x, s.value ?? ""), S = !0);
332
340
  };
333
341
  return H(t, (p) => {
334
- !p && !S && (s.emit("promptDlgResult" + x, void 0), S = !0);
342
+ !p && !S && (_.emit("promptDlgResult" + x, void 0), S = !0);
335
343
  }), (p, w) => {
336
344
  const z = g("v-card-title"), I = g("v-card-text"), pe = g("v-text-field"), de = g("v-form"), P = g("v-btn"), fe = g("v-card-actions"), ie = g("v-card"), ge = g("v-dialog");
337
345
  return V(), A(ge, {
@@ -349,24 +357,24 @@ const $e = /* @__PURE__ */ O({
349
357
  default: v(() => [
350
358
  h(z, null, {
351
359
  default: v(() => [
352
- C(b(o.value), 1)
360
+ C(b(l.value), 1)
353
361
  ]),
354
362
  _: 1
355
363
  }),
356
364
  h(I, null, {
357
365
  default: v(() => [
358
- C(b(l.value), 1)
366
+ C(b(o.value), 1)
359
367
  ]),
360
368
  _: 1
361
369
  }),
362
370
  h(de, { class: "mx-3" }, {
363
371
  default: v(() => [
364
372
  h(pe, {
365
- modelValue: _.value,
366
- "onUpdate:modelValue": w[0] || (w[0] = (E) => _.value = E),
373
+ modelValue: s.value,
374
+ "onUpdate:modelValue": w[0] || (w[0] = (E) => s.value = E),
367
375
  label: n.value,
368
376
  placeholder: r.value,
369
- rules: c.value,
377
+ rules: u.value,
370
378
  ref_key: "target",
371
379
  ref: d
372
380
  }, null, 8, ["modelValue", "label", "placeholder", "rules"])
@@ -409,27 +417,27 @@ const $e = /* @__PURE__ */ O({
409
417
  }), ze = { class: "mx-auto my-auto" }, Fe = { class: "d-flex align-center justify-center w-100 h-100" }, Je = /* @__PURE__ */ O({
410
418
  __name: "index",
411
419
  setup(e) {
412
- const a = X(), { open: t } = Q("waitDlg"), o = () => {
420
+ const a = X(), { open: t } = Q("waitDlg"), l = () => {
413
421
  t.value = !0;
414
- }, l = () => {
422
+ }, o = () => {
415
423
  t.value = !1;
416
424
  };
417
425
  return D(() => {
418
- s.on("openWaitDlg", o), s.on("closeWaitDlg", l);
426
+ _.on("openWaitDlg", l), _.on("closeWaitDlg", o);
419
427
  }), T(() => {
420
- s.off("openWaitDlg", o), s.off("closeWaitDlg", l);
428
+ _.off("openWaitDlg", l), _.off("closeWaitDlg", o);
421
429
  }), (n, r) => {
422
- const c = g("v-card"), _ = g("v-dialog");
423
- return V(), A(_, {
430
+ const u = g("v-card"), s = g("v-dialog");
431
+ return V(), A(s, {
424
432
  modelValue: W(t),
425
- "onUpdate:modelValue": r[0] || (r[0] = (u) => J(t) ? t.value = u : null),
433
+ "onUpdate:modelValue": r[0] || (r[0] = (c) => J(t) ? t.value = c : null),
426
434
  persistent: "",
427
435
  "no-click-animation": "",
428
436
  fullscreen: ""
429
437
  }, {
430
438
  default: v(() => [
431
439
  m("div", ze, [
432
- h(c, {
440
+ h(u, {
433
441
  width: "300px",
434
442
  height: "80px",
435
443
  loading: ""
@@ -451,18 +459,18 @@ const $e = /* @__PURE__ */ O({
451
459
  e.component("v-alert", ve), e.component("v-btn", me), e.component("v-card", he), e.component("v-card-actions", we), e.component("v-card-text", ye), e.component("v-card-title", xe), e.component("v-dialog", ke), e.component("v-form", be), e.component("v-text-field", Ce), e.component("x-confirm-dlg", $e), e.component("x-loading", Ue), e.component("x-message", He), e.component("x-prompt-dlg", Ke), e.component("x-wait-dlg", Je);
452
460
  };
453
461
  function ft() {
454
- const e = K(), a = f(() => e.global.current.value.colors.primary), t = f(() => e.global.current.value.colors.secondary), o = f(() => e.current.value.dark ? "#2e2e2e" : "#bdbdbd"), l = 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");
462
+ const e = K(), 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"), u = f(() => e.current.value.dark ? "#ffffff1f" : "#0000001f");
455
463
  return {
456
464
  primaryColor: a,
457
465
  secondaryColor: t,
458
- backgroundColor0: o,
459
- backgroundColor1: l,
466
+ backgroundColor0: l,
467
+ backgroundColor1: o,
460
468
  backgroundColor2: n,
461
469
  highlightColor: r,
462
- borderColor: c
470
+ borderColor: u
463
471
  };
464
472
  }
465
- const Y = le(
473
+ const Y = oe(
466
474
  "global",
467
475
  () => {
468
476
  const e = K(), a = i(!1);
@@ -475,12 +483,12 @@ const Y = le(
475
483
  immediate: !0
476
484
  }
477
485
  );
478
- const t = i("en"), o = i({}), l = i("");
486
+ const t = i("en"), l = i({}), o = i("");
479
487
  return {
480
488
  dark: a,
481
489
  locale: t,
482
- permissionObjects: o,
483
- permissionChecksum: l
490
+ permissionObjects: l,
491
+ permissionChecksum: o
484
492
  };
485
493
  },
486
494
  {
@@ -517,16 +525,16 @@ function Ye(e) {
517
525
  return e.data;
518
526
  }
519
527
  function Ze(e, a) {
520
- var l;
528
+ var o;
521
529
  const t = e.response;
522
530
  if (!t)
523
531
  return Promise.reject(e);
524
532
  t.status === 401 && Pe();
525
- let o = (l = t.data) == null ? void 0 : l.message;
526
- return o || (o = {
533
+ let l = (o = t.data) == null ? void 0 : o.message;
534
+ return l || (l = {
527
535
  code: t.status,
528
536
  message: t.statusText
529
- }), a(o), Promise.reject(e);
537
+ }), a(l), Promise.reject(e);
530
538
  }
531
539
  function Pe() {
532
540
  U.remove("accessToken"), U.remove("refreshToken"), U.remove("activeOrg"), re().replace({ path: "/passport/login" });
@@ -544,46 +552,46 @@ async function gt(e) {
544
552
  if (!ue())
545
553
  return;
546
554
  let a = !1, t;
547
- const o = (n) => {
555
+ const l = (n) => {
548
556
  t = n, a = !0;
549
- }, l = se();
550
- return s.on("confirmDlgResult" + l, o), s.emit("confirmDlg", { ...e, seq: l }), await G(() => a), s.off("confirmDlgResult" + l, o), t;
557
+ }, o = se();
558
+ return _.on("confirmDlgResult" + o, l), _.emit("confirmDlg", { ...e, seq: o }), await G(() => a), _.off("confirmDlgResult" + o, l), t;
551
559
  }
552
560
  async function vt(e) {
553
561
  if (!ue())
554
562
  return;
555
563
  let a = !1, t;
556
- const o = (n) => {
564
+ const l = (n) => {
557
565
  t = n, a = !0;
558
- }, l = se();
559
- return s.on("promptDlgResult" + l, o), s.emit("promptDlg", { ...e, seq: l }), await G(() => a), s.off("promptDlgResult" + l, o), t;
566
+ }, o = se();
567
+ return _.on("promptDlgResult" + o, l), _.emit("promptDlg", { ...e, seq: o }), await G(() => a), _.off("promptDlgResult" + o, l), t;
560
568
  }
561
569
  function mt() {
562
- s.emit("openWaitDlg");
570
+ _.emit("openWaitDlg");
563
571
  }
564
572
  function ht() {
565
- s.emit("closeWaitDlg");
573
+ _.emit("closeWaitDlg");
566
574
  }
567
575
  function wt(e, a) {
568
- s.emit("message", { type: "error", text: e, timeout: a });
576
+ _.emit("message", { type: "error", text: e, timeout: a });
569
577
  }
570
578
  function yt(e, a) {
571
- s.emit("message", { type: "info", text: e, timeout: a });
579
+ _.emit("message", { type: "info", text: e, timeout: a });
572
580
  }
573
581
  function xt(e, a) {
574
- s.emit("message", { type: "success", text: e, timeout: a });
582
+ _.emit("message", { type: "success", text: e, timeout: a });
575
583
  }
576
584
  function kt(e, a) {
577
- s.emit("message", { type: "warning", text: e, timeout: a });
585
+ _.emit("message", { type: "warning", text: e, timeout: a });
578
586
  }
579
587
  function bt(e) {
580
- var o, l;
588
+ var l, o;
581
589
  if (!window.appAppear) {
582
590
  window.appAppear = !0;
583
591
  return;
584
592
  }
585
- const a = "single-spa-application:" + e, t = (o = document.getElementById(a)) == null ? void 0 : o.classList;
586
- t && (t.remove("app-left", "app-right", "app-reset"), (l = window.routeExtras) != null && l.forward ? t.add("app-left") : t.add("app-right"), setTimeout(() => {
593
+ const a = "single-spa-application:" + e, t = (l = document.getElementById(a)) == null ? void 0 : l.classList;
594
+ t && (t.remove("app-left", "app-right", "app-reset"), (o = window.routeExtras) != null && o.forward ? t.add("app-left") : t.add("app-right"), setTimeout(() => {
587
595
  t.add("app-reset");
588
596
  }, 0));
589
597
  }
@@ -592,11 +600,11 @@ function te(e, a) {
592
600
  if (!e)
593
601
  return !1;
594
602
  let t = e;
595
- return Object.keys(t).length <= 0 || (a.split("/").forEach((l) => {
603
+ return Object.keys(t).length <= 0 || (a.split("/").forEach((o) => {
596
604
  if (Object.keys(t).length <= 0)
597
605
  return !0;
598
- if (t[l])
599
- t = t[l];
606
+ if (t[o])
607
+ t = t[o];
600
608
  else
601
609
  return !1;
602
610
  }), Object.keys(t).length <= 0);
@@ -623,13 +631,13 @@ const _e = require("js-cookie"), at = [
623
631
  ];
624
632
  function Z(e) {
625
633
  let a, t = 0;
626
- const o = e.split("/");
627
- return at.forEach((l) => {
628
- const n = l.path.split("/");
634
+ const l = e.split("/");
635
+ return at.forEach((o) => {
636
+ const n = o.path.split("/");
629
637
  let r = 0;
630
- for (let c = 0; c < o.length && !(c >= n.length || o[c] !== n[c]); c++)
638
+ for (let u = 0; u < l.length && !(u >= n.length || l[u] !== n[u]); u++)
631
639
  r++;
632
- r >= t && (a = l, t = r);
640
+ r >= t && (a = o, t = r);
633
641
  }), a;
634
642
  }
635
643
  function ae(e) {
@@ -641,28 +649,28 @@ function ae(e) {
641
649
  const t = e.split("/");
642
650
  return console.assert(t.length >= 2), { app: t[1], path: a.path, level: a.level };
643
651
  }
644
- const oe = i("");
652
+ const le = i("");
645
653
  function k(e, a) {
646
- const t = ae(e), o = ae(a), l = t.app === o.app, n = t.path === o.path, r = t.level >= o.level;
654
+ const t = ae(e), l = ae(a), o = t.app === l.app, n = t.path === l.path, r = t.level >= l.level;
647
655
  console.info(
648
- `~~~~before route change~~~~ ${o.path} -> ${t.path} inner=${l} forward=${r}`
649
- ), l ? n ? oe.value = "" : oe.value = r ? "inner-left" : "inner-right" : window.routeExtras = { forward: r };
656
+ `~~~~before route change~~~~ ${l.path} -> ${t.path} inner=${o} forward=${r}`
657
+ ), o ? n ? le.value = "" : le.value = r ? "inner-left" : "inner-right" : window.routeExtras = { forward: r };
650
658
  }
651
- function ot() {
659
+ function lt() {
652
660
  return !!_e.get("accessToken");
653
661
  }
654
- function lt() {
662
+ function ot() {
655
663
  return !!_e.get("activeOrg");
656
664
  }
657
665
  function Ct(e, a, t) {
658
- const o = ot(), l = lt(), n = Z(e.path);
666
+ const l = lt(), o = ot(), n = Z(e.path);
659
667
  if (!n) {
660
668
  t();
661
669
  return;
662
670
  }
663
671
  if (n.requiredState === "auth")
664
- if (o)
665
- if (l) {
672
+ if (l)
673
+ if (o) {
666
674
  const r = "/main";
667
675
  k(r, a.path), t({ path: r });
668
676
  } else
@@ -672,8 +680,8 @@ function Ct(e, a, t) {
672
680
  k(r, a.path), t({ path: r });
673
681
  }
674
682
  else if (n.requiredState === "org")
675
- if (o)
676
- if (l)
683
+ if (l)
684
+ if (o)
677
685
  k(e.path, a.path), t();
678
686
  else {
679
687
  const r = "/org/joinOrCreate";
@@ -683,8 +691,8 @@ function Ct(e, a, t) {
683
691
  const r = "/passport/login";
684
692
  k(r, a.path), t({ path: r });
685
693
  }
686
- else if (o)
687
- if (l) {
694
+ else if (l)
695
+ if (o) {
688
696
  const r = "/main";
689
697
  k(r, a.path), t({ path: r });
690
698
  } else {
@@ -695,36 +703,36 @@ function Ct(e, a, t) {
695
703
  k(e.path, a.path), t();
696
704
  }
697
705
  function Vt(e) {
698
- const a = je(), t = re(), o = Y(), l = ne(), n = (u) => {
699
- if (u.key === "Escape") {
706
+ const a = je(), t = re(), l = Y(), o = ne(), n = (c) => {
707
+ if (c.key === "Escape") {
700
708
  r();
701
709
  return;
702
710
  }
703
- if (!e && u.ctrlKey && u.key.toLowerCase() === "d") {
704
- c();
711
+ if (!e && c.ctrlKey && c.key.toLowerCase() === "d") {
712
+ u();
705
713
  return;
706
714
  }
707
- if (!e && u.ctrlKey && u.key.toLowerCase() === "l") {
708
- _();
715
+ if (!e && c.ctrlKey && c.key.toLowerCase() === "l") {
716
+ s();
709
717
  return;
710
718
  }
711
719
  }, r = () => {
712
720
  var y;
713
- if (!l.isEmpty()) {
714
- l.hasView("waitDlg") || l.popView();
721
+ if (!o.isEmpty()) {
722
+ o.hasView("waitDlg") || o.popView();
715
723
  return;
716
724
  }
717
- const u = Z(a.path);
718
- (u == null ? void 0 : u.level) === 0 ? (y = navigator == null ? void 0 : navigator.Backbutton) == null || y.goHome(
725
+ const c = Z(a.path);
726
+ (c == null ? void 0 : c.level) === 0 ? (y = navigator == null ? void 0 : navigator.Backbutton) == null || y.goHome(
719
727
  () => {
720
728
  },
721
729
  () => {
722
730
  }
723
731
  ) : t.back();
724
- }, c = () => {
725
- o.dark = !o.dark;
726
- }, _ = () => {
727
- o.locale === "en" ? o.locale = "zhHans" : o.locale = "en";
732
+ }, u = () => {
733
+ l.dark = !l.dark;
734
+ }, s = () => {
735
+ l.locale === "en" ? l.locale = "zhHans" : l.locale = "en";
728
736
  };
729
737
  return D(() => {
730
738
  window.addEventListener("keydown", n, !1);
@@ -734,9 +742,9 @@ function Vt(e) {
734
742
  }
735
743
  function Dt() {
736
744
  const e = Y();
737
- function a(t, o) {
738
- const l = e.permissionObjects[t];
739
- return l ? o ? !(!te(l.includes, o) || te(l.excludes, o)) : !0 : !1;
745
+ function a(t, l) {
746
+ const o = e.permissionObjects[t];
747
+ return o ? l ? !(!te(o.includes, l) || te(o.excludes, l)) : !0 : !1;
740
748
  }
741
749
  return { verifyPermission: a };
742
750
  }
@@ -746,38 +754,38 @@ function rt(e, a) {
746
754
  function qt(e) {
747
755
  const a = Y();
748
756
  let t;
749
- const o = () => {
757
+ const l = () => {
750
758
  clearTimeout(t), t = setTimeout(async () => {
751
- await l(), t && o();
759
+ await o(), t && l();
752
760
  }, 3e3);
753
- }, l = async () => {
761
+ }, o = async () => {
754
762
  try {
755
763
  const { update: n, permissions: r } = await rt(e, {
756
764
  checksum: a.permissionChecksum
757
765
  });
758
766
  if (!n)
759
767
  return;
760
- const c = {};
761
- for (const _ in r) {
762
- if (_ === "checksum")
768
+ const u = {};
769
+ for (const s in r) {
770
+ if (s === "checksum")
763
771
  continue;
764
- const u = r[_];
765
- c[_] = JSON.parse(u);
772
+ const c = r[s];
773
+ u[s] = JSON.parse(c);
766
774
  }
767
- a.permissionObjects = c, a.permissionChecksum = r.checksum ?? "";
775
+ a.permissionObjects = u, a.permissionChecksum = r.checksum ?? "";
768
776
  } catch (n) {
769
777
  console.error(n);
770
778
  }
771
779
  };
772
780
  return D(() => {
773
- l(), o();
781
+ o(), l();
774
782
  }), T(() => {
775
783
  clearTimeout(t), t = void 0;
776
784
  }), {};
777
785
  }
778
786
  function St() {
779
- const e = K(), { width: a } = Re(), t = f(() => e.global.name.value), o = f(() => !!window.cordova), l = f(() => a.value <= 1280 ? a.value + "px" : a.value <= 1920 ? 1920 / 2.5 + "px" : 2560 / 2.5 + "px");
780
- return { dark: t, sysBarAvail: o, compactWidth: l };
787
+ const e = K(), { width: a } = Re(), t = f(() => e.global.name.value), l = f(() => !!window.cordova), o = f(() => a.value <= 1280 ? a.value + "px" : a.value <= 1920 ? 1920 / 2.5 + "px" : 2560 / 2.5 + "px");
788
+ return { dark: t, sysBarAvail: l, compactWidth: o };
781
789
  }
782
790
  const Tt = { install: Xe };
783
791
  export {
@@ -786,7 +794,7 @@ export {
786
794
  ht as closeWaitDlg,
787
795
  it as createAxios,
788
796
  Tt as default,
789
- s as eventBus,
797
+ _ as eventBus,
790
798
  te as isExist,
791
799
  Z as matchRouteMeta,
792
800
  wt as messageError,
@@ -797,7 +805,7 @@ export {
797
805
  gt as openConfirmDlg,
798
806
  vt as openPromptDlg,
799
807
  mt as openWaitDlg,
800
- oe as routeTransName,
808
+ le as routeTransName,
801
809
  ft as useColor,
802
810
  Y as useGlobalStore,
803
811
  Vt as useHotkey,
@@ -1,19 +1,25 @@
1
1
  export declare const useViewMgrStore: import("pinia").StoreDefinition<"viewMgr", import("pinia")._UnwrapAll<Pick<{
2
2
  isEmpty: () => boolean;
3
+ lastView: () => string | undefined;
3
4
  hasView: (name: string) => boolean;
4
5
  addView: (name: string) => void;
5
6
  delView: (name: string) => void;
6
7
  popView: () => void;
8
+ clearViews: () => void;
7
9
  }, never>>, Pick<{
8
10
  isEmpty: () => boolean;
11
+ lastView: () => string | undefined;
9
12
  hasView: (name: string) => boolean;
10
13
  addView: (name: string) => void;
11
14
  delView: (name: string) => void;
12
15
  popView: () => void;
16
+ clearViews: () => void;
13
17
  }, never>, Pick<{
14
18
  isEmpty: () => boolean;
19
+ lastView: () => string | undefined;
15
20
  hasView: (name: string) => boolean;
16
21
  addView: (name: string) => void;
17
22
  delView: (name: string) => void;
18
23
  popView: () => void;
19
- }, "isEmpty" | "hasView" | "addView" | "delView" | "popView">>;
24
+ clearViews: () => void;
25
+ }, "isEmpty" | "lastView" | "hasView" | "addView" | "delView" | "popView" | "clearViews">>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
3
  "private": false,
4
- "version": "0.3.11",
4
+ "version": "0.3.12",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",