x-essential-lib 0.3.5 → 0.3.7

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