x-essential-lib 0.2.5 → 0.2.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +209 -0
  2. package/dist/index.js +206 -187
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -133,3 +133,212 @@ export declare function onBeforeEach(
133
133
  from: RouteLocationNormalized,
134
134
  next: NavigationGuardNext
135
135
  ): void
136
+
137
+ export enum Permission {
138
+ //----------------------------------------------------------------------
139
+ // 应用
140
+ //----------------------------------------------------------------------
141
+
142
+ // 后端
143
+
144
+ list_app_group = 'list_app_group',
145
+ create_app_group = 'create_app_group',
146
+ delete_app_group = 'delete_app_group',
147
+ update_app_group = 'update_app_group',
148
+ arrange_app_group = 'arrange_app_group',
149
+
150
+ list_app = 'list_group',
151
+ get_app = 'get_app',
152
+ create_app = 'create_app',
153
+ delete_app = 'delete_app',
154
+ update_app = 'update_app',
155
+
156
+ list_app_release = 'list_app_release',
157
+ get_app_release = 'get_app_release',
158
+ create_app_release = 'create_app_release',
159
+ delete_app_release = 'delete_app_release',
160
+ deploy_app_release = 'deploy_app_release',
161
+
162
+ // 前端
163
+
164
+ open_app_layer = 'open_app_layer',
165
+ open_app = 'open_app',
166
+
167
+ //----------------------------------------------------------------------
168
+ // 计算
169
+ //----------------------------------------------------------------------
170
+
171
+ // 后端
172
+
173
+ list_calc_space = 'list_calc_space',
174
+ get_calc_space = 'get_calc_space',
175
+ create_calc_space = 'create_calc_space',
176
+ delete_calc_space = 'delete_calc_space',
177
+ update_calc_space = 'update_calc_space',
178
+ arrange_calc_space = 'arrange_calc_space',
179
+
180
+ list_func_group = 'list_func_group',
181
+ create_func_group = 'create_func_group',
182
+ delete_func_group = 'delete_func_group',
183
+ update_func_group = 'update_func_group',
184
+ arrange_func_group = 'arrange_func_group',
185
+
186
+ list_func = 'list_func',
187
+ get_func = 'get_func',
188
+ create_func = 'create_func',
189
+ delete_func = 'delete_func',
190
+ update_func = 'update_func',
191
+ debug_func = 'debug_func',
192
+ call_func = 'call_func',
193
+
194
+ list_func_release = 'list_func_release',
195
+ get_func_release = 'get_func_release',
196
+ create_func_release = 'create_func_release',
197
+ delete_func_release = 'delete_func_release',
198
+ deploy_func_release = 'deploy_func_release',
199
+
200
+ list_flow_group = 'list_flow_group',
201
+ create_flow_group = 'create_flow_group',
202
+ delete_flow_group = 'delete_flow_group',
203
+ update_flow_group = 'update_flow_group',
204
+ arrange_flow_group = 'arrange_flow_group',
205
+
206
+ list_flow = 'list_flow',
207
+ get_flow = 'get_flow',
208
+ create_flow = 'create_flow',
209
+ delete_flow = 'delete_flow',
210
+ update_flow = 'update_flow',
211
+ call_flow = 'call_flow',
212
+
213
+ list_flow_release = 'list_flow_release',
214
+ get_flow_release = 'get_flow_release',
215
+ create_flow_release = 'create_flow_release',
216
+ delete_flow_release = 'delete_flow_release',
217
+ deploy_flow_release = 'deploy_flow_release',
218
+
219
+ list_task = 'list_task',
220
+ get_task = 'get_task',
221
+ create_task = 'create_task',
222
+ delete_task = 'delete_task',
223
+ update_task = 'update_task',
224
+ call_task = 'call_task',
225
+
226
+ // 前端
227
+
228
+ open_calc_layer = 'open_calc_layer',
229
+
230
+ //----------------------------------------------------------------------
231
+ // 数据
232
+ //----------------------------------------------------------------------
233
+
234
+ list_db_space = 'list_db_space',
235
+ get_db_space = 'get_db_space',
236
+ create_db_space = 'create_db_space',
237
+ delete_db_space = 'delete_db_space',
238
+ update_db_space = 'update_db_space',
239
+ arrange_db_space = 'arrange_db_space',
240
+
241
+ list_model_group = 'list_model_group',
242
+ create_model_group = 'create_model_group',
243
+ delete_model_group = 'delete_model_group',
244
+ update_model_group = 'update_model_group',
245
+ arrange_model_group = 'arrange_model_group',
246
+
247
+ list_model = 'list_model',
248
+ get_model = 'get_model',
249
+ create_model = 'create_model',
250
+ delete_model = 'delete_model',
251
+ update_model = 'update_model',
252
+
253
+ get_model_data = 'get_model_data',
254
+ create_model_data = 'create_model_data',
255
+ delete_model_data = 'delete_model_data',
256
+ update_model_data = 'update_model_data',
257
+
258
+ get_graph = 'get_graph',
259
+ update_graph = 'update_graph',
260
+
261
+ list_change = 'list_change',
262
+ apply_change = 'apply_change',
263
+
264
+ // 前端
265
+
266
+ open_data_layer = 'open_data_layer',
267
+
268
+ //----------------------------------------------------------------------
269
+ // 资料
270
+ //----------------------------------------------------------------------
271
+
272
+ // 后端
273
+
274
+ list_asset_space = 'list_asset_space',
275
+ get_asset_space = 'get_asset_space',
276
+ create_asset_space = 'create_asset_space',
277
+ delete_asset_space = 'delete_asset_space',
278
+ update_asset_space = 'update_asset_space',
279
+ arrange_asset_space = 'arrange_asset_space',
280
+
281
+ list_dir = 'list_dir',
282
+ create_dir = 'create_dir',
283
+ delete_dir = 'delete_dir',
284
+ update_dir = 'update_dir',
285
+ move_dir = 'move_dir',
286
+
287
+ list_asset = 'list_asset',
288
+ get_asset = 'get_asset',
289
+ create_asset = 'create_asset',
290
+ delete_asset = 'delete_asset',
291
+ update_asset = 'update_asset',
292
+ move_asset = 'move_asset',
293
+
294
+ // 后端
295
+
296
+ open_asset_layer = 'open_asset_layer',
297
+
298
+ //----------------------------------------------------------------------
299
+ // 组织
300
+ //----------------------------------------------------------------------
301
+
302
+ // 后端
303
+
304
+ list_org_member = 'list_org_member',
305
+ add_org_member = 'add_org_member',
306
+ remove_org_member = 'remove_org_member',
307
+ update_org_member = 'update_org_member',
308
+
309
+ list_org_role = 'list_org_role',
310
+ get_org_role = 'get_org_role',
311
+ create_org_role = 'create_org_role',
312
+ delete_org_role = 'delete_org_role',
313
+ update_org_role = 'update_org_role',
314
+ arrange_org_role = 'arrange_org_role',
315
+
316
+ get_org_structure = 'get_org_structure',
317
+ update_org_structure = 'update_org_structure',
318
+
319
+ //----------------------------------------------------------------------
320
+ // 过滤
321
+ //----------------------------------------------------------------------
322
+
323
+ filter_model = 'filter_model'
324
+ }
325
+
326
+ type InstanceTree = {
327
+ [key: string]: InstanceTree
328
+ }
329
+
330
+ type PermissionObject = {
331
+ includes: InstanceTree
332
+ excludes: InstanceTree
333
+ }
334
+
335
+ type PermissionObjects = {
336
+ [key: string]: PermissionObject
337
+ }
338
+
339
+ export declare function setPermissionObject(permissonObjects: PermissionObjects)
340
+
341
+ export declare function verifyPermission(
342
+ permission: Permission,
343
+ instance: string | undefined
344
+ ): boolean
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
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 pe, VBtn as fe, VCard as me, VCardActions as ve, VCardText as ge, VCardTitle as _e, VDialog as he, VForm as xe, VTextField as ye } from "vuetify/lib/components/index.mjs";
3
- import { defineComponent as S, useModel as L, ref as _, computed as d, onMounted as $, onBeforeUnmount as W, watch as N, resolveComponent as m, openBlock as C, createBlock as A, withKeys as U, withModifiers as M, withCtx as v, createVNode as h, createTextVNode as b, toDisplayString as k, createElementBlock as K, normalizeStyle as we, pushScopeId as ke, popScopeId as be, createElementVNode as g, reactive as Ce, Fragment as Ve, renderList as qe, unref as De, inject as Se } from "vue";
4
- import { useLocale as H, useTheme as X, useDisplay as Re } from "vuetify/lib/framework.mjs";
5
- import Te from "axios";
6
- function Ie(e) {
2
+ import { VAlert as fe, VBtn as me, VCard as ve, VCardActions as ge, VCardText as _e, VCardTitle as he, VDialog as xe, VForm as ye, VTextField as we } from "vuetify/lib/components/index.mjs";
3
+ import { defineComponent as S, useModel as L, ref as _, computed as d, onMounted as j, onBeforeUnmount as W, watch as N, resolveComponent as m, openBlock as C, createBlock as M, withKeys as U, withModifiers as I, withCtx as v, createVNode as h, createTextVNode as b, toDisplayString as k, createElementBlock as K, normalizeStyle as ke, pushScopeId as be, popScopeId as Ce, createElementVNode as g, reactive as Ve, Fragment as qe, renderList as De, unref as Se, inject as Re } from "vue";
4
+ import { useLocale as H, useTheme as X, useDisplay as Te } from "vuetify/lib/framework.mjs";
5
+ import Oe from "axios";
6
+ function Pe(e) {
7
7
  return { all: e = e || /* @__PURE__ */ new Map(), on: function(o, t) {
8
8
  var n = e.get(o);
9
9
  n ? n.push(t) : e.set(o, [t]);
@@ -19,8 +19,8 @@ function Ie(e) {
19
19
  });
20
20
  } };
21
21
  }
22
- const i = Ie();
23
- async function ct(e) {
22
+ const i = Pe();
23
+ async function ut(e) {
24
24
  return new Promise((o) => {
25
25
  setTimeout(o, e);
26
26
  });
@@ -28,13 +28,13 @@ async function ct(e) {
28
28
  async function F(e, o, t) {
29
29
  const n = Date.now();
30
30
  return new Promise((r) => {
31
- const l = async () => {
32
- e() ? r(!0) : o && Date.now() - n > o ? r(!1) : setTimeout(l, t ?? 30);
31
+ const a = async () => {
32
+ e() ? r(!0) : o && Date.now() - n > o ? r(!1) : setTimeout(a, t ?? 30);
33
33
  };
34
- l();
34
+ a();
35
35
  });
36
36
  }
37
- const Pe = /* @__PURE__ */ S({
37
+ const Ie = /* @__PURE__ */ S({
38
38
  __name: "index",
39
39
  props: {
40
40
  modelValue: { type: Boolean },
@@ -42,41 +42,41 @@ const Pe = /* @__PURE__ */ S({
42
42
  },
43
43
  emits: ["update:modelValue"],
44
44
  setup(e) {
45
- const o = H(), t = L(e, "modelValue"), n = _(""), r = _(""), l = _(), a = _(), s = d(() => {
45
+ const o = H(), t = L(e, "modelValue"), n = _(""), r = _(""), a = _(), l = _(), s = d(() => {
46
46
  var u;
47
- return ((u = l.value) == null ? void 0 : u.color) ?? "primary";
47
+ return ((u = a.value) == null ? void 0 : u.color) ?? "primary";
48
48
  }), f = d(() => {
49
49
  var u;
50
- return ((u = l.value) == null ? void 0 : u.text) ?? o.t("cancel");
50
+ return ((u = a.value) == null ? void 0 : u.text) ?? o.t("cancel");
51
51
  }), p = d(() => {
52
52
  var u;
53
- return ((u = a.value) == null ? void 0 : u.color) ?? "primary";
53
+ return ((u = l.value) == null ? void 0 : u.color) ?? "primary";
54
54
  }), V = d(() => {
55
55
  var u;
56
- return ((u = a.value) == null ? void 0 : u.text) ?? o.t("confirm");
56
+ return ((u = l.value) == null ? void 0 : u.text) ?? o.t("confirm");
57
57
  });
58
58
  let R = 0, q = !1;
59
- const B = (u) => {
60
- n.value = u.title, r.value = u.text, l.value = u.cancel, a.value = u.confirm, R = u.seq, q = !1, t.value = !0;
59
+ const $ = (u) => {
60
+ n.value = u.title, r.value = u.text, a.value = u.cancel, l.value = u.confirm, R = u.seq, q = !1, t.value = !0;
61
61
  };
62
- $(() => {
63
- i.on("confirmDlg", B);
62
+ j(() => {
63
+ i.on("confirmDlg", $);
64
64
  }), W(() => {
65
- i.off("confirmDlg", B);
65
+ i.off("confirmDlg", $);
66
66
  });
67
- const O = () => {
67
+ const A = () => {
68
68
  t.value = !1, q || (i.emit("confirmDlgResult" + R, !0), q = !0);
69
69
  };
70
70
  return N(t, (u) => {
71
71
  !u && !q && (i.emit("confirmDlgResult" + R, !1), q = !0);
72
72
  }), (u, y) => {
73
- const D = m("v-card-title"), j = m("v-card-text"), T = m("v-btn"), c = m("v-card-actions"), x = m("v-card"), z = m("v-dialog");
74
- return C(), A(z, {
73
+ const D = m("v-card-title"), B = m("v-card-text"), T = m("v-btn"), c = m("v-card-actions"), x = m("v-card"), z = m("v-dialog");
74
+ return C(), M(z, {
75
75
  modelValue: t.value,
76
- "onUpdate:modelValue": y[1] || (y[1] = (I) => t.value = I),
76
+ "onUpdate:modelValue": y[1] || (y[1] = (O) => t.value = O),
77
77
  onKeydown: [
78
- y[2] || (y[2] = U(M((I) => t.value = !1, ["stop", "prevent"]), ["esc"])),
79
- U(M(O, ["stop", "prevent"]), ["enter"])
78
+ y[2] || (y[2] = U(I((O) => t.value = !1, ["stop", "prevent"]), ["esc"])),
79
+ U(I(A, ["stop", "prevent"]), ["enter"])
80
80
  ],
81
81
  transition: "dialog-top-transition",
82
82
  "max-width": "600px"
@@ -90,7 +90,7 @@ const Pe = /* @__PURE__ */ S({
90
90
  ]),
91
91
  _: 1
92
92
  }),
93
- h(j, null, {
93
+ h(B, null, {
94
94
  default: v(() => [
95
95
  b(k(r.value), 1)
96
96
  ]),
@@ -99,7 +99,7 @@ const Pe = /* @__PURE__ */ S({
99
99
  h(c, { class: "d-flex justify-end" }, {
100
100
  default: v(() => [
101
101
  h(T, {
102
- onClick: y[0] || (y[0] = (I) => t.value = !1),
102
+ onClick: y[0] || (y[0] = (O) => t.value = !1),
103
103
  color: s.value,
104
104
  variant: "text"
105
105
  }, {
@@ -109,7 +109,7 @@ const Pe = /* @__PURE__ */ S({
109
109
  _: 1
110
110
  }, 8, ["color"]),
111
111
  h(T, {
112
- onClick: O,
112
+ onClick: A,
113
113
  color: p.value,
114
114
  variant: "text"
115
115
  }, {
@@ -129,7 +129,7 @@ const Pe = /* @__PURE__ */ S({
129
129
  }, 8, ["modelValue", "onKeydown"]);
130
130
  };
131
131
  }
132
- }), Me = (e) => (ke("data-v-a8f3d91f"), e = e(), be(), e), $e = /* @__PURE__ */ Me(() => /* @__PURE__ */ g("div", { class: "lds-spinner" }, [
132
+ }), je = (e) => (be("data-v-a8f3d91f"), e = e(), Ce(), e), Me = /* @__PURE__ */ je(() => /* @__PURE__ */ g("div", { class: "lds-spinner" }, [
133
133
  /* @__PURE__ */ g("div"),
134
134
  /* @__PURE__ */ g("div"),
135
135
  /* @__PURE__ */ g("div"),
@@ -142,9 +142,9 @@ const Pe = /* @__PURE__ */ S({
142
142
  /* @__PURE__ */ g("div"),
143
143
  /* @__PURE__ */ g("div"),
144
144
  /* @__PURE__ */ g("div")
145
- ], -1)), Ae = [
146
- $e
147
- ], Be = /* @__PURE__ */ S({
145
+ ], -1)), $e = [
146
+ Me
147
+ ], Ae = /* @__PURE__ */ S({
148
148
  __name: "index",
149
149
  props: {
150
150
  zIndex: {
@@ -157,17 +157,17 @@ const Pe = /* @__PURE__ */ S({
157
157
  background: o.current.value.dark ? "#1e1e1e" : "#ffffff",
158
158
  zIndex: t.zIndex
159
159
  }));
160
- return (r, l) => (C(), K("div", {
160
+ return (r, a) => (C(), K("div", {
161
161
  class: "x-cont",
162
- style: we(n.value)
163
- }, Ae, 4));
162
+ style: ke(n.value)
163
+ }, $e, 4));
164
164
  }
165
- }), oe = (e, o) => {
165
+ }), ne = (e, o) => {
166
166
  const t = e.__vccOpts || e;
167
167
  for (const [n, r] of o)
168
168
  t[n] = r;
169
169
  return t;
170
- }, Oe = /* @__PURE__ */ oe(Be, [["__scopeId", "data-v-a8f3d91f"]]), je = /* @__PURE__ */ S({
170
+ }, Be = /* @__PURE__ */ ne(Ae, [["__scopeId", "data-v-a8f3d91f"]]), Ee = /* @__PURE__ */ S({
171
171
  __name: "item",
172
172
  props: {
173
173
  id: {
@@ -189,38 +189,38 @@ const Pe = /* @__PURE__ */ S({
189
189
  },
190
190
  emits: ["timeout"],
191
191
  setup(e, { emit: o }) {
192
- const t = e, n = _(!0), r = o, l = d(() => {
193
- let a = "";
192
+ const t = e, n = _(!0), r = o, a = d(() => {
193
+ let l = "";
194
194
  switch (t.type) {
195
195
  case "error":
196
- a = "cancel";
196
+ l = "cancel";
197
197
  break;
198
198
  case "info":
199
- a = "info";
199
+ l = "info";
200
200
  break;
201
201
  case "success":
202
- a = "check-circle";
202
+ l = "check-circle";
203
203
  break;
204
204
  case "warning":
205
- a = "error";
205
+ l = "error";
206
206
  break;
207
207
  }
208
- return a;
208
+ return l;
209
209
  });
210
- return $(() => {
210
+ return j(() => {
211
211
  setTimeout(() => {
212
212
  r("timeout", t.id);
213
213
  }, t.timeout);
214
- }), N(n, (a) => {
215
- a || r("timeout", t.id);
216
- }), (a, s) => {
214
+ }), N(n, (l) => {
215
+ l || r("timeout", t.id);
216
+ }), (l, s) => {
217
217
  const f = m("v-alert");
218
- return C(), A(f, {
218
+ return C(), M(f, {
219
219
  modelValue: n.value,
220
220
  "onUpdate:modelValue": s[0] || (s[0] = (p) => n.value = p),
221
221
  class: "mt-2",
222
222
  type: e.type,
223
- icon: l.value,
223
+ icon: a.value,
224
224
  text: e.text,
225
225
  "max-width": "90%",
226
226
  width: "500px",
@@ -230,34 +230,34 @@ const Pe = /* @__PURE__ */ S({
230
230
  }, null, 8, ["modelValue", "type", "icon", "text"]);
231
231
  };
232
232
  }
233
- }), Ee = /* @__PURE__ */ S({
233
+ }), Ue = /* @__PURE__ */ S({
234
234
  __name: "index",
235
235
  setup(e) {
236
- const o = Ce({ items: [] });
237
- $(() => {
236
+ const o = Ve({ items: [] });
237
+ j(() => {
238
238
  i.on("message", t);
239
239
  }), W(() => {
240
240
  i.off("message", t);
241
241
  });
242
242
  const t = (s) => {
243
- l(s.type, s.text, s.timeout);
243
+ a(s.type, s.text, s.timeout);
244
244
  }, n = (s) => {
245
- a(s);
245
+ l(s);
246
246
  };
247
247
  let r = 0;
248
- const l = (s, f, p) => {
248
+ const a = (s, f, p) => {
249
249
  const V = r++;
250
250
  o.items.push({ id: V, type: s, text: f, timeout: p });
251
- }, a = (s) => {
251
+ }, l = (s) => {
252
252
  const f = o.items.findIndex((p) => p.id === s);
253
253
  f >= 0 && o.items.splice(f, 1);
254
254
  };
255
255
  return (s, f) => (C(), K("div", {
256
- onClick: f[0] || (f[0] = M(() => {
256
+ onClick: f[0] || (f[0] = I(() => {
257
257
  }, ["stop"])),
258
258
  class: "x-cont d-flex flex-column-reverse align-center"
259
259
  }, [
260
- (C(!0), K(Ve, null, qe(o.items, (p) => (C(), A(je, {
260
+ (C(!0), K(qe, null, De(o.items, (p) => (C(), M(Ee, {
261
261
  onTimeout: n,
262
262
  id: p.id,
263
263
  type: p.type,
@@ -267,7 +267,7 @@ const Pe = /* @__PURE__ */ S({
267
267
  }, null, 8, ["id", "type", "text", "timeout"]))), 128))
268
268
  ]));
269
269
  }
270
- }), Ue = /* @__PURE__ */ oe(Ee, [["__scopeId", "data-v-70ed4b89"]]), We = /* @__PURE__ */ S({
270
+ }), We = /* @__PURE__ */ ne(Ue, [["__scopeId", "data-v-70ed4b89"]]), ze = /* @__PURE__ */ S({
271
271
  __name: "index",
272
272
  props: {
273
273
  modelValue: { type: Boolean },
@@ -275,28 +275,28 @@ const Pe = /* @__PURE__ */ S({
275
275
  },
276
276
  emits: ["update:modelValue"],
277
277
  setup(e) {
278
- const o = H(), t = L(e, "modelValue"), n = _(""), r = _(""), l = _(), a = _(), s = _(), f = _(""), p = _(), V = _(), R = d(() => {
278
+ const o = H(), t = L(e, "modelValue"), n = _(""), r = _(""), a = _(), l = _(), s = _(), f = _(""), p = _(), V = _(), R = d(() => {
279
279
  var c;
280
280
  return ((c = p.value) == null ? void 0 : c.color) ?? "primary";
281
281
  }), q = d(() => {
282
282
  var c;
283
283
  return ((c = p.value) == null ? void 0 : c.text) ?? o.t("cancel");
284
- }), B = d(() => {
284
+ }), $ = d(() => {
285
285
  var c;
286
286
  return ((c = V.value) == null ? void 0 : c.color) ?? "primary";
287
- }), O = d(() => {
287
+ }), A = d(() => {
288
288
  var c;
289
289
  return ((c = V.value) == null ? void 0 : c.text) ?? o.t("confirm");
290
290
  }), u = _();
291
291
  let y = 0, D = !1;
292
- const j = async (c) => {
292
+ const B = async (c) => {
293
293
  var x;
294
- n.value = c.title, r.value = c.text, l.value = c.label, a.value = c.placeholder, s.value = c.rules, f.value = c.value, p.value = c.cancel, V.value = c.confirm, y = c.seq, D = !1, t.value = !0, await F(() => u.value !== void 0, 1e3), (x = u.value) == null || x.focus();
294
+ n.value = c.title, r.value = c.text, a.value = c.label, l.value = c.placeholder, s.value = c.rules, f.value = c.value, p.value = c.cancel, V.value = c.confirm, y = c.seq, D = !1, t.value = !0, await F(() => u.value !== void 0, 1e3), (x = u.value) == null || x.focus();
295
295
  };
296
- $(() => {
297
- i.on("promptDlg", j);
296
+ j(() => {
297
+ i.on("promptDlg", B);
298
298
  }), W(() => {
299
- i.off("promptDlg", j);
299
+ i.off("promptDlg", B);
300
300
  });
301
301
  const T = () => {
302
302
  t.value = !1, D || (i.emit("promptDlgResult" + y, f.value ?? ""), D = !0);
@@ -304,19 +304,19 @@ const Pe = /* @__PURE__ */ S({
304
304
  return N(t, (c) => {
305
305
  !c && !D && (i.emit("promptDlgResult" + y, void 0), D = !0);
306
306
  }), (c, x) => {
307
- const z = m("v-card-title"), I = m("v-card-text"), se = m("v-text-field"), ce = m("v-form"), J = m("v-btn"), ie = m("v-card-actions"), ue = m("v-card"), de = m("v-dialog");
308
- return C(), A(de, {
307
+ const z = m("v-card-title"), O = m("v-card-text"), ce = m("v-text-field"), ie = m("v-form"), J = m("v-btn"), ue = m("v-card-actions"), de = m("v-card"), pe = m("v-dialog");
308
+ return C(), M(pe, {
309
309
  modelValue: t.value,
310
310
  "onUpdate:modelValue": x[2] || (x[2] = (P) => t.value = P),
311
311
  onKeydown: [
312
- x[3] || (x[3] = U(M((P) => t.value = !1, ["stop", "prevent"]), ["esc"])),
313
- U(M(T, ["stop", "prevent"]), ["enter"])
312
+ x[3] || (x[3] = U(I((P) => t.value = !1, ["stop", "prevent"]), ["esc"])),
313
+ U(I(T, ["stop", "prevent"]), ["enter"])
314
314
  ],
315
315
  transition: "dialog-top-transition",
316
316
  "max-width": "600px"
317
317
  }, {
318
318
  default: v(() => [
319
- h(ue, null, {
319
+ h(de, null, {
320
320
  default: v(() => [
321
321
  h(z, null, {
322
322
  default: v(() => [
@@ -324,19 +324,19 @@ const Pe = /* @__PURE__ */ S({
324
324
  ]),
325
325
  _: 1
326
326
  }),
327
- h(I, null, {
327
+ h(O, null, {
328
328
  default: v(() => [
329
329
  b(k(r.value), 1)
330
330
  ]),
331
331
  _: 1
332
332
  }),
333
- h(ce, { class: "mx-3" }, {
333
+ h(ie, { class: "mx-3" }, {
334
334
  default: v(() => [
335
- h(se, {
335
+ h(ce, {
336
336
  modelValue: f.value,
337
337
  "onUpdate:modelValue": x[0] || (x[0] = (P) => f.value = P),
338
- label: l.value,
339
- placeholder: a.value,
338
+ label: a.value,
339
+ placeholder: l.value,
340
340
  rules: s.value,
341
341
  ref_key: "target",
342
342
  ref: u
@@ -344,7 +344,7 @@ const Pe = /* @__PURE__ */ S({
344
344
  ]),
345
345
  _: 1
346
346
  }),
347
- h(ie, { class: "d-flex justify-end" }, {
347
+ h(ue, { class: "d-flex justify-end" }, {
348
348
  default: v(() => [
349
349
  h(J, {
350
350
  onClick: x[1] || (x[1] = (P) => t.value = !1),
@@ -358,11 +358,11 @@ const Pe = /* @__PURE__ */ S({
358
358
  }, 8, ["color"]),
359
359
  h(J, {
360
360
  onClick: T,
361
- color: B.value,
361
+ color: $.value,
362
362
  variant: "text"
363
363
  }, {
364
364
  default: v(() => [
365
- b(k(O.value), 1)
365
+ b(k(A.value), 1)
366
366
  ]),
367
367
  _: 1
368
368
  }, 8, ["color"])
@@ -377,7 +377,7 @@ const Pe = /* @__PURE__ */ S({
377
377
  }, 8, ["modelValue", "onKeydown"]);
378
378
  };
379
379
  }
380
- }), ze = { class: "mx-auto my-auto" }, Ke = { class: "d-flex align-center justify-center w-100 h-100" }, Le = /* @__PURE__ */ S({
380
+ }), Ke = { class: "mx-auto my-auto" }, Le = { class: "d-flex align-center justify-center w-100 h-100" }, Ne = /* @__PURE__ */ S({
381
381
  __name: "index",
382
382
  props: {
383
383
  modelValue: { type: Boolean },
@@ -390,29 +390,29 @@ const Pe = /* @__PURE__ */ S({
390
390
  }, r = () => {
391
391
  t.value = !1;
392
392
  };
393
- return $(() => {
393
+ return j(() => {
394
394
  i.on("openWaitDlg", n), i.on("closeWaitDlg", r);
395
395
  }), W(() => {
396
396
  i.off("openWaitDlg", n), i.off("closeWaitDlg", r);
397
- }), (l, a) => {
397
+ }), (a, l) => {
398
398
  const s = m("v-card"), f = m("v-dialog");
399
- return C(), A(f, {
399
+ return C(), M(f, {
400
400
  modelValue: t.value,
401
- "onUpdate:modelValue": a[0] || (a[0] = (p) => t.value = p),
401
+ "onUpdate:modelValue": l[0] || (l[0] = (p) => t.value = p),
402
402
  persistent: "",
403
403
  "no-click-animation": "",
404
404
  fullscreen: ""
405
405
  }, {
406
406
  default: v(() => [
407
- g("div", ze, [
407
+ g("div", Ke, [
408
408
  h(s, {
409
409
  width: "300px",
410
410
  height: "80px",
411
411
  loading: ""
412
412
  }, {
413
413
  default: v(() => [
414
- g("div", Ke, [
415
- g("span", null, k(De(o).t("waitingResponse")), 1)
414
+ g("div", Le, [
415
+ g("span", null, k(Se(o).t("waitingResponse")), 1)
416
416
  ])
417
417
  ]),
418
418
  _: 1
@@ -424,23 +424,23 @@ const Pe = /* @__PURE__ */ S({
424
424
  };
425
425
  }
426
426
  });
427
- function it() {
428
- const e = X(), o = d(() => e.global.current.value.colors.primary), t = d(() => e.global.current.value.colors.secondary), n = d(() => e.current.value.dark ? "#2e2e2e" : "#bdbdbd"), r = d(() => e.current.value.dark ? "#272727" : "#eeeeee"), l = d(() => e.current.value.dark ? "#1e1e1e" : "#ffffff"), a = d(() => e.current.value.dark ? "#303030" : "#f6f6f6"), s = d(() => e.current.value.dark ? "#ffffff1f" : "#0000001f");
427
+ function dt() {
428
+ const e = X(), o = d(() => e.global.current.value.colors.primary), t = d(() => e.global.current.value.colors.secondary), n = d(() => e.current.value.dark ? "#2e2e2e" : "#bdbdbd"), r = d(() => e.current.value.dark ? "#272727" : "#eeeeee"), a = d(() => e.current.value.dark ? "#1e1e1e" : "#ffffff"), l = d(() => e.current.value.dark ? "#303030" : "#f6f6f6"), s = d(() => e.current.value.dark ? "#ffffff1f" : "#0000001f");
429
429
  return {
430
430
  primaryColor: o,
431
431
  secondaryColor: t,
432
432
  backgroundColor0: n,
433
433
  backgroundColor1: r,
434
- backgroundColor2: l,
435
- highlightColor: a,
434
+ backgroundColor2: a,
435
+ highlightColor: l,
436
436
  borderColor: s
437
437
  };
438
438
  }
439
- function ut() {
440
- const e = X(), { width: o } = Re(), t = d(() => e.current.value.dark), n = d(() => !!window.cordova), r = d(() => o.value <= 1280 ? o.value + "px" : o.value <= 1920 ? 1920 / 2.5 + "px" : 2560 / 2.5 + "px");
439
+ function pt() {
440
+ const e = X(), { width: o } = Te(), t = d(() => e.current.value.dark), n = d(() => !!window.cordova), r = d(() => o.value <= 1280 ? o.value + "px" : o.value <= 1920 ? 1920 / 2.5 + "px" : 2560 / 2.5 + "px");
441
441
  return { dark: t, sysBarAvail: n, compactWidth: r };
442
442
  }
443
- var Ne = {}, G;
443
+ var He = {}, G;
444
444
  (function(e) {
445
445
  e.pop = "pop", e.push = "push";
446
446
  })(G || (G = {}));
@@ -452,96 +452,96 @@ var Y;
452
452
  (function(e) {
453
453
  e[e.aborted = 4] = "aborted", e[e.cancelled = 8] = "cancelled", e[e.duplicated = 16] = "duplicated";
454
454
  })(Y || (Y = {}));
455
- const He = Symbol(Ne.NODE_ENV !== "production" ? "router" : "");
456
- function Xe() {
457
- return Se(He);
455
+ const Xe = Symbol(He.NODE_ENV !== "production" ? "router" : "");
456
+ function Fe() {
457
+ return Re(Xe);
458
458
  }
459
459
  const E = require("js-cookie");
460
- function dt(e) {
461
- const o = Te.create({
460
+ function ft(e) {
461
+ const o = Oe.create({
462
462
  timeout: 6e3
463
463
  });
464
464
  return o.defaults.baseURL = e.baseUrl, o.interceptors.request.use(
465
- (t) => Fe(t),
465
+ (t) => Je(t),
466
466
  (t) => {
467
- Je(t, e.onError);
467
+ Ge(t, e.onError);
468
468
  }
469
469
  ), o.interceptors.response.use(
470
- (t) => Ge(t),
471
- (t) => Qe(t, e.onError)
470
+ (t) => Qe(t),
471
+ (t) => Ye(t, e.onError)
472
472
  ), o;
473
473
  }
474
- function Fe(e) {
474
+ function Je(e) {
475
475
  const o = E.get("accessToken") ?? "";
476
476
  return e.headers.Authorization = "Basic " + o, e.headers["Content-Type"] = "application/json", e.data = JSON.stringify(e.data), e;
477
477
  }
478
- function Je(e, o) {
478
+ function Ge(e, o) {
479
479
  console.error(e), o("request timeout");
480
480
  }
481
- function Ge(e) {
481
+ function Qe(e) {
482
482
  return e.data;
483
483
  }
484
- function Qe(e, o) {
484
+ function Ye(e, o) {
485
485
  var r;
486
486
  const t = e.response;
487
487
  if (!t)
488
488
  return Promise.reject(e);
489
- t.status === 401 && Ye();
489
+ t.status === 401 && Ze();
490
490
  let n = (r = t.data) == null ? void 0 : r.message;
491
491
  return n || (n = {
492
492
  code: t.status,
493
493
  message: t.statusText
494
494
  }), o(n), Promise.reject(e);
495
495
  }
496
- function Ye() {
497
- E.remove("accessToken"), E.remove("refreshToken"), E.remove("activeOrg"), Xe().replace({ path: "/passport/login" });
496
+ function Ze() {
497
+ E.remove("accessToken"), E.remove("refreshToken"), E.remove("activeOrg"), Fe().replace({ path: "/passport/login" });
498
498
  }
499
499
  let Z = Date.now();
500
- function ne() {
500
+ function re() {
501
501
  const e = Date.now();
502
502
  return e - Z > 500 ? (Z = e, !0) : !1;
503
503
  }
504
- let Ze = 0;
505
- function re() {
506
- return ++Ze;
504
+ let et = 0;
505
+ function le() {
506
+ return ++et;
507
507
  }
508
- async function pt(e) {
509
- if (!ne())
508
+ async function mt(e) {
509
+ if (!re())
510
510
  return;
511
511
  let o = !1, t;
512
- const n = (l) => {
513
- t = l, o = !0;
514
- }, r = re();
512
+ const n = (a) => {
513
+ t = a, o = !0;
514
+ }, r = le();
515
515
  return i.on("confirmDlgResult" + r, n), i.emit("confirmDlg", { ...e, seq: r }), await F(() => o), i.off("confirmDlgResult" + r, n), t;
516
516
  }
517
- async function ft(e) {
518
- if (!ne())
517
+ async function vt(e) {
518
+ if (!re())
519
519
  return;
520
520
  let o = !1, t;
521
- const n = (l) => {
522
- t = l, o = !0;
523
- }, r = re();
521
+ const n = (a) => {
522
+ t = a, o = !0;
523
+ }, r = le();
524
524
  return i.on("promptDlgResult" + r, n), i.emit("promptDlg", { ...e, seq: r }), await F(() => o), i.off("promptDlgResult" + r, n), t;
525
525
  }
526
- function mt() {
526
+ function gt() {
527
527
  i.emit("openWaitDlg");
528
528
  }
529
- function vt() {
529
+ function _t() {
530
530
  i.emit("closeWaitDlg");
531
531
  }
532
- function gt(e, o) {
532
+ function ht(e, o) {
533
533
  i.emit("message", { type: "error", text: e, timeout: o });
534
534
  }
535
- function _t(e, o) {
535
+ function xt(e, o) {
536
536
  i.emit("message", { type: "info", text: e, timeout: o });
537
537
  }
538
- function ht(e, o) {
538
+ function yt(e, o) {
539
539
  i.emit("message", { type: "success", text: e, timeout: o });
540
540
  }
541
- function xt(e, o) {
541
+ function wt(e, o) {
542
542
  i.emit("message", { type: "warning", text: e, timeout: o });
543
543
  }
544
- function yt(e) {
544
+ function kt(e) {
545
545
  var n, r;
546
546
  if (!window.appAppear) {
547
547
  window.appAppear = !0;
@@ -552,7 +552,25 @@ function yt(e) {
552
552
  t.add("app-reset");
553
553
  }, 0));
554
554
  }
555
- const ae = require("js-cookie"), et = [
555
+ let tt = {};
556
+ function ee(e, o) {
557
+ if (!e)
558
+ return !1;
559
+ let t = e;
560
+ return Object.keys(t).length <= 0 || (o.split("/").forEach((r) => {
561
+ if (Object.keys(t).length <= 0)
562
+ return !0;
563
+ if (t[r])
564
+ t = t[r];
565
+ else
566
+ return !1;
567
+ }), Object.keys(t).length <= 0);
568
+ }
569
+ function bt(e, o) {
570
+ const t = tt[e];
571
+ return t ? o ? (!ee(t.includes, o) || ee(t.excludes, o), !1) : !0 : !1;
572
+ }
573
+ const ae = require("js-cookie"), ot = [
556
574
  { path: "/passport/login", level: 0 },
557
575
  { path: "/passport/loginAccount", level: 1 },
558
576
  { path: "/passport/register", level: 1 },
@@ -572,99 +590,100 @@ const ae = require("js-cookie"), et = [
572
590
  { path: "/calc", level: 1, requiredState: "org" },
573
591
  { path: "/data", level: 1, requiredState: "org" }
574
592
  ];
575
- function le(e) {
593
+ function se(e) {
576
594
  let o, t = 0;
577
595
  const n = e.split("/");
578
- return et.forEach((r) => {
579
- const l = r.path.split("/");
580
- let a = 0;
581
- for (let s = 0; s < n.length && !(s >= l.length || n[s] !== l[s]); s++)
582
- a++;
583
- a >= t && (o = r, t = a);
596
+ return ot.forEach((r) => {
597
+ const a = r.path.split("/");
598
+ let l = 0;
599
+ for (let s = 0; s < n.length && !(s >= a.length || n[s] !== a[s]); s++)
600
+ l++;
601
+ l >= t && (o = r, t = l);
584
602
  }), o;
585
603
  }
586
- function ee(e) {
604
+ function te(e) {
587
605
  if (e === "/")
588
606
  return { app: "", path: "/", level: -1 };
589
- const o = le(e);
607
+ const o = se(e);
590
608
  if (!o)
591
609
  return { app: "invalidApp", path: "/invalidApp/invalidRoute", level: -1 };
592
610
  const t = e.split("/");
593
611
  return console.assert(t.length >= 2), { app: t[1], path: o.path, level: o.level };
594
612
  }
595
- const te = _("");
613
+ const oe = _("");
596
614
  function w(e, o) {
597
- const t = ee(e), n = ee(o), r = t.app === n.app, l = t.path === n.path, a = t.level >= n.level;
615
+ const t = te(e), n = te(o), r = t.app === n.app, a = t.path === n.path, l = t.level >= n.level;
598
616
  console.info(
599
- `~~~~before route change~~~~ ${n.path} -> ${t.path} inner=${r} forward=${a}`
600
- ), r ? l ? te.value = "" : te.value = a ? "inner-left" : "inner-right" : window.routeExtras = { forward: a };
617
+ `~~~~before route change~~~~ ${n.path} -> ${t.path} inner=${r} forward=${l}`
618
+ ), r ? a ? oe.value = "" : oe.value = l ? "inner-left" : "inner-right" : window.routeExtras = { forward: l };
601
619
  }
602
- function tt() {
620
+ function nt() {
603
621
  return !!ae.get("accessToken");
604
622
  }
605
- function ot() {
623
+ function rt() {
606
624
  return !!ae.get("activeOrg");
607
625
  }
608
- function wt(e, o, t) {
609
- const n = tt(), r = ot(), l = le(e.path);
610
- if (!l) {
626
+ function Ct(e, o, t) {
627
+ const n = nt(), r = rt(), a = se(e.path);
628
+ if (!a) {
611
629
  t();
612
630
  return;
613
631
  }
614
- if (l.requiredState === "auth")
632
+ if (a.requiredState === "auth")
615
633
  if (n)
616
634
  if (r) {
617
- const a = "/main";
618
- w(a, o.path), t({ path: a });
635
+ const l = "/main";
636
+ w(l, o.path), t({ path: l });
619
637
  } else
620
638
  w(e.path, o.path), t();
621
639
  else {
622
- const a = "/passport/login";
623
- w(a, o.path), t({ path: a });
640
+ const l = "/passport/login";
641
+ w(l, o.path), t({ path: l });
624
642
  }
625
- else if (l.requiredState === "org")
643
+ else if (a.requiredState === "org")
626
644
  if (n)
627
645
  if (r)
628
646
  w(e.path, o.path), t();
629
647
  else {
630
- const a = "/org/joinOrCreate";
631
- w(a, o.path), t({ path: a });
648
+ const l = "/org/joinOrCreate";
649
+ w(l, o.path), t({ path: l });
632
650
  }
633
651
  else {
634
- const a = "/passport/login";
635
- w(a, o.path), t({ path: a });
652
+ const l = "/passport/login";
653
+ w(l, o.path), t({ path: l });
636
654
  }
637
655
  else if (n)
638
656
  if (r) {
639
- const a = "/main";
640
- w(a, o.path), t({ path: a });
657
+ const l = "/main";
658
+ w(l, o.path), t({ path: l });
641
659
  } else {
642
- const a = "/org/joinOrCreate";
643
- w(a, o.path), t({ path: a });
660
+ const l = "/org/joinOrCreate";
661
+ w(l, o.path), t({ path: l });
644
662
  }
645
663
  else
646
664
  w(e.path, o.path), t();
647
665
  }
648
- const nt = (e) => {
649
- e.component("v-alert", pe), e.component("v-btn", fe), e.component("v-card", me), e.component("v-card-actions", ve), e.component("v-card-text", ge), e.component("v-card-title", _e), e.component("v-dialog", he), e.component("v-form", xe), e.component("v-text-field", ye), e.component("x-confirm-dlg", Pe), e.component("x-loading", Oe), e.component("x-message", Ue), e.component("x-prompt-dlg", We), e.component("x-wait-dlg", Le);
650
- }, kt = { install: nt };
666
+ const lt = (e) => {
667
+ e.component("v-alert", fe), e.component("v-btn", me), e.component("v-card", ve), e.component("v-card-actions", ge), e.component("v-card-text", _e), e.component("v-card-title", he), e.component("v-dialog", xe), e.component("v-form", ye), e.component("v-text-field", we), e.component("x-confirm-dlg", Ie), e.component("x-loading", Be), e.component("x-message", We), e.component("x-prompt-dlg", ze), e.component("x-wait-dlg", Ne);
668
+ }, Vt = { install: lt };
651
669
  export {
652
- yt as appAppear,
653
- vt as closeWaitDlg,
654
- dt as createAxios,
655
- kt as default,
670
+ kt as appAppear,
671
+ _t as closeWaitDlg,
672
+ ft as createAxios,
673
+ Vt as default,
656
674
  i as eventBus,
657
- gt as messageError,
658
- _t as messageInfo,
659
- ht as messageSuccess,
660
- xt as messageWarning,
661
- wt as onBeforeEach,
662
- pt as openConfirmDlg,
663
- ft as openPromptDlg,
664
- mt as openWaitDlg,
665
- te as routeTransName,
666
- it as useColor,
667
- ut as useSystem,
668
- ct as waitMs,
675
+ ht as messageError,
676
+ xt as messageInfo,
677
+ yt as messageSuccess,
678
+ wt as messageWarning,
679
+ Ct as onBeforeEach,
680
+ mt as openConfirmDlg,
681
+ vt as openPromptDlg,
682
+ gt as openWaitDlg,
683
+ oe as routeTransName,
684
+ dt as useColor,
685
+ pt as useSystem,
686
+ bt as verifyPermission,
687
+ ut as waitMs,
669
688
  F as waitUtil
670
689
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
3
  "private": false,
4
- "version": "0.2.5",
4
+ "version": "0.2.7",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",