x-essential-lib 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -64,10 +64,12 @@ export declare function useSystem(): {
64
64
 
65
65
  type OnError = (error: any) => void
66
66
 
67
- export declare function createAxios(
68
- baseUrl: string,
67
+ interface Options {
68
+ baseUrl: string
69
69
  onError: OnError
70
- ): AxiosInstance
70
+ }
71
+
72
+ export declare function createAxios(options: Options): AxiosInstance
71
73
 
72
74
  export declare function waitMs(ms: number): Promise<void>
73
75
 
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
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
2
  import { VBtn as pe, VCard as fe, VCardActions as me, VCardText as ve, VCardTitle as ge, VDialog as _e, VForm as he, VTextField as xe } from "vuetify/lib/components/index.mjs";
3
- import { defineComponent as S, useModel as L, ref as _, computed as d, onMounted as $, onBeforeUnmount as U, watch as N, resolveComponent as m, openBlock as b, createBlock as A, withKeys as E, withModifiers as M, withCtx as v, createVNode as h, createTextVNode as C, toDisplayString as k, createElementBlock as K, normalizeStyle as ye, pushScopeId as we, popScopeId as ke, createElementVNode as g, reactive as Ce, Fragment as be, renderList as Ve, unref as qe, inject as De } from "vue";
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 ye, pushScopeId as we, popScopeId as ke, createElementVNode as g, reactive as be, Fragment as Ce, renderList as Ve, unref as qe, inject as De } from "vue";
4
4
  import { useLocale as H, useTheme as X, useDisplay as Se } from "vuetify/lib/framework.mjs";
5
5
  import Re from "axios";
6
6
  function Te(e) {
@@ -61,7 +61,7 @@ const Ie = /* @__PURE__ */ S({
61
61
  };
62
62
  $(() => {
63
63
  i.on("confirmDlg", B);
64
- }), U(() => {
64
+ }), W(() => {
65
65
  i.off("confirmDlg", B);
66
66
  });
67
67
  const O = () => {
@@ -71,12 +71,12 @@ const Ie = /* @__PURE__ */ S({
71
71
  !u && !q && (i.emit("confirmDlgResult" + R, !1), q = !0);
72
72
  }), (u, y) => {
73
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 b(), A(z, {
74
+ return C(), A(z, {
75
75
  modelValue: t.value,
76
76
  "onUpdate:modelValue": y[1] || (y[1] = (I) => t.value = I),
77
77
  onKeydown: [
78
- y[2] || (y[2] = E(M((I) => t.value = !1, ["stop", "prevent"]), ["esc"])),
79
- E(M(O, ["stop", "prevent"]), ["enter"])
78
+ y[2] || (y[2] = U(M((I) => t.value = !1, ["stop", "prevent"]), ["esc"])),
79
+ U(M(O, ["stop", "prevent"]), ["enter"])
80
80
  ],
81
81
  transition: "dialog-top-transition",
82
82
  "max-width": "600px"
@@ -86,13 +86,13 @@ const Ie = /* @__PURE__ */ S({
86
86
  default: v(() => [
87
87
  h(D, null, {
88
88
  default: v(() => [
89
- C(k(n.value), 1)
89
+ b(k(n.value), 1)
90
90
  ]),
91
91
  _: 1
92
92
  }),
93
93
  h(j, null, {
94
94
  default: v(() => [
95
- C(k(r.value), 1)
95
+ b(k(r.value), 1)
96
96
  ]),
97
97
  _: 1
98
98
  }),
@@ -104,7 +104,7 @@ const Ie = /* @__PURE__ */ S({
104
104
  variant: "text"
105
105
  }, {
106
106
  default: v(() => [
107
- C(k(f.value), 1)
107
+ b(k(f.value), 1)
108
108
  ]),
109
109
  _: 1
110
110
  }, 8, ["color"]),
@@ -114,7 +114,7 @@ const Ie = /* @__PURE__ */ S({
114
114
  variant: "text"
115
115
  }, {
116
116
  default: v(() => [
117
- C(k(V.value), 1)
117
+ b(k(V.value), 1)
118
118
  ]),
119
119
  _: 1
120
120
  }, 8, ["color"])
@@ -157,7 +157,7 @@ const Ie = /* @__PURE__ */ S({
157
157
  background: o.current.value.dark ? "#1e1e1e" : "#ffffff",
158
158
  zIndex: t.zIndex
159
159
  }));
160
- return (r, l) => (b(), K("div", {
160
+ return (r, l) => (C(), K("div", {
161
161
  class: "x-cont",
162
162
  style: ye(n.value)
163
163
  }, $e, 4));
@@ -215,7 +215,7 @@ const Ie = /* @__PURE__ */ S({
215
215
  a || r("timeout", t.id);
216
216
  }), (a, s) => {
217
217
  const f = m("v-alert");
218
- return b(), A(f, {
218
+ return C(), A(f, {
219
219
  modelValue: n.value,
220
220
  "onUpdate:modelValue": s[0] || (s[0] = (p) => n.value = p),
221
221
  class: "mt-2",
@@ -233,10 +233,10 @@ const Ie = /* @__PURE__ */ S({
233
233
  }), je = /* @__PURE__ */ S({
234
234
  __name: "index",
235
235
  setup(e) {
236
- const o = Ce({ items: [] });
236
+ const o = be({ items: [] });
237
237
  $(() => {
238
238
  i.on("message", t);
239
- }), U(() => {
239
+ }), W(() => {
240
240
  i.off("message", t);
241
241
  });
242
242
  const t = (s) => {
@@ -252,12 +252,12 @@ const Ie = /* @__PURE__ */ S({
252
252
  const f = o.items.findIndex((p) => p.id === s);
253
253
  f >= 0 && o.items.splice(f, 1);
254
254
  };
255
- return (s, f) => (b(), K("div", {
255
+ return (s, f) => (C(), K("div", {
256
256
  onClick: f[0] || (f[0] = M(() => {
257
257
  }, ["stop"])),
258
258
  class: "x-cont d-flex flex-column-reverse align-center"
259
259
  }, [
260
- (b(!0), K(be, null, Ve(o.items, (p) => (b(), A(Oe, {
260
+ (C(!0), K(Ce, null, Ve(o.items, (p) => (C(), A(Oe, {
261
261
  onTimeout: n,
262
262
  id: p.id,
263
263
  type: p.type,
@@ -267,7 +267,7 @@ const Ie = /* @__PURE__ */ S({
267
267
  }, null, 8, ["id", "type", "text", "timeout"]))), 128))
268
268
  ]));
269
269
  }
270
- }), We = /* @__PURE__ */ oe(je, [["__scopeId", "data-v-70ed4b89"]]), Ee = /* @__PURE__ */ S({
270
+ }), Ee = /* @__PURE__ */ oe(je, [["__scopeId", "data-v-70ed4b89"]]), Ue = /* @__PURE__ */ S({
271
271
  __name: "index",
272
272
  props: {
273
273
  modelValue: { type: Boolean },
@@ -295,7 +295,7 @@ const Ie = /* @__PURE__ */ S({
295
295
  };
296
296
  $(() => {
297
297
  i.on("promptDlg", j);
298
- }), U(() => {
298
+ }), W(() => {
299
299
  i.off("promptDlg", j);
300
300
  });
301
301
  const T = () => {
@@ -305,12 +305,12 @@ const Ie = /* @__PURE__ */ S({
305
305
  !c && !D && (i.emit("promptDlgResult" + y, void 0), D = !0);
306
306
  }), (c, x) => {
307
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 b(), A(de, {
308
+ return C(), A(de, {
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] = E(M((P) => t.value = !1, ["stop", "prevent"]), ["esc"])),
313
- E(M(T, ["stop", "prevent"]), ["enter"])
312
+ x[3] || (x[3] = U(M((P) => t.value = !1, ["stop", "prevent"]), ["esc"])),
313
+ U(M(T, ["stop", "prevent"]), ["enter"])
314
314
  ],
315
315
  transition: "dialog-top-transition",
316
316
  "max-width": "600px"
@@ -320,13 +320,13 @@ const Ie = /* @__PURE__ */ S({
320
320
  default: v(() => [
321
321
  h(z, null, {
322
322
  default: v(() => [
323
- C(k(n.value), 1)
323
+ b(k(n.value), 1)
324
324
  ]),
325
325
  _: 1
326
326
  }),
327
327
  h(I, null, {
328
328
  default: v(() => [
329
- C(k(r.value), 1)
329
+ b(k(r.value), 1)
330
330
  ]),
331
331
  _: 1
332
332
  }),
@@ -352,7 +352,7 @@ const Ie = /* @__PURE__ */ S({
352
352
  variant: "text"
353
353
  }, {
354
354
  default: v(() => [
355
- C(k(q.value), 1)
355
+ b(k(q.value), 1)
356
356
  ]),
357
357
  _: 1
358
358
  }, 8, ["color"]),
@@ -362,7 +362,7 @@ const Ie = /* @__PURE__ */ S({
362
362
  variant: "text"
363
363
  }, {
364
364
  default: v(() => [
365
- C(k(O.value), 1)
365
+ b(k(O.value), 1)
366
366
  ]),
367
367
  _: 1
368
368
  }, 8, ["color"])
@@ -377,7 +377,7 @@ const Ie = /* @__PURE__ */ S({
377
377
  }, 8, ["modelValue", "onKeydown"]);
378
378
  };
379
379
  }
380
- }), Ue = { class: "mx-auto my-auto" }, ze = { class: "d-flex align-center justify-center w-100 h-100" }, Ke = /* @__PURE__ */ S({
380
+ }), We = { class: "mx-auto my-auto" }, ze = { class: "d-flex align-center justify-center w-100 h-100" }, Ke = /* @__PURE__ */ S({
381
381
  __name: "index",
382
382
  props: {
383
383
  modelValue: { type: Boolean },
@@ -392,11 +392,11 @@ const Ie = /* @__PURE__ */ S({
392
392
  };
393
393
  return $(() => {
394
394
  i.on("openWaitDlg", n), i.on("closeWaitDlg", r);
395
- }), U(() => {
395
+ }), W(() => {
396
396
  i.off("openWaitDlg", n), i.off("closeWaitDlg", r);
397
397
  }), (l, a) => {
398
398
  const s = m("v-card"), f = m("v-dialog");
399
- return b(), A(f, {
399
+ return C(), A(f, {
400
400
  modelValue: t.value,
401
401
  "onUpdate:modelValue": a[0] || (a[0] = (p) => t.value = p),
402
402
  persistent: "",
@@ -404,7 +404,7 @@ const Ie = /* @__PURE__ */ S({
404
404
  fullscreen: ""
405
405
  }, {
406
406
  default: v(() => [
407
- g("div", Ue, [
407
+ g("div", We, [
408
408
  h(s, {
409
409
  width: "300px",
410
410
  height: "80px",
@@ -456,23 +456,23 @@ const Ne = Symbol(Le.NODE_ENV !== "production" ? "router" : "");
456
456
  function He() {
457
457
  return De(Ne);
458
458
  }
459
- const W = require("js-cookie");
460
- function ut(e, o) {
461
- const t = Re.create({
459
+ const E = require("js-cookie");
460
+ function ut(e) {
461
+ const o = Re.create({
462
462
  timeout: 6e3
463
463
  });
464
- return t.defaults.baseURL = e, t.interceptors.request.use(
465
- (n) => Xe(n),
466
- (n) => {
467
- Fe(n, o);
464
+ return o.defaults.baseURL = e.baseUrl, o.interceptors.request.use(
465
+ (t) => Xe(t),
466
+ (t) => {
467
+ Fe(t, e.onError);
468
468
  }
469
- ), t.interceptors.response.use(
470
- (n) => Je(n),
471
- (n) => Ge(n, o)
472
- ), t;
469
+ ), o.interceptors.response.use(
470
+ (t) => Je(t),
471
+ (t) => Ge(t, e.onError)
472
+ ), o;
473
473
  }
474
474
  function Xe(e) {
475
- const o = W.get("accessToken") ?? "";
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
478
  function Fe(e, o) {
@@ -494,7 +494,7 @@ function Ge(e, o) {
494
494
  }), o(n), Promise.reject(e);
495
495
  }
496
496
  function Qe() {
497
- W.remove("accessToken"), W.remove("refreshToken"), W.remove("activeOrg"), He().replace({ path: "/passport/login" });
497
+ E.remove("accessToken"), E.remove("refreshToken"), E.remove("activeOrg"), He().replace({ path: "/passport/login" });
498
498
  }
499
499
  let Z = Date.now();
500
500
  function ne() {
@@ -646,7 +646,7 @@ function yt(e, o, t) {
646
646
  w(e.path, o.path), t();
647
647
  }
648
648
  const ot = (e) => {
649
- e.component("v-btn", pe), e.component("v-card", fe), e.component("v-card-actions", me), e.component("v-card-text", ve), e.component("v-card-title", ge), e.component("v-dialog", _e), e.component("v-form", he), e.component("v-text-field", xe), e.component("x-confirm-dlg", Ie), e.component("x-loading", Be), e.component("x-message", We), e.component("x-prompt-dlg", Ee), e.component("x-wait-dlg", Ke);
649
+ e.component("v-btn", pe), e.component("v-card", fe), e.component("v-card-actions", me), e.component("v-card-text", ve), e.component("v-card-title", ge), e.component("v-dialog", _e), e.component("v-form", he), e.component("v-text-field", xe), e.component("x-confirm-dlg", Ie), e.component("x-loading", Be), e.component("x-message", Ee), e.component("x-prompt-dlg", Ue), e.component("x-wait-dlg", Ke);
650
650
  }, wt = { install: ot };
651
651
  export {
652
652
  xt as appAppear,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
3
  "private": false,
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",