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