x-essential-lib 0.9.22 → 0.9.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.id="x-essential-lib",a.appendChild(document.createTextNode('.fade-leave-active[data-v-99c4198b]{transition:opacity .5s ease}.fade-leave-to[data-v-99c4198b]{opacity:0}.x-cont[data-v-99c4198b]{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}.lds-spinner[data-v-99c4198b]{color:official;display:inline-block;position:relative;width:40px;height:40px}.lds-spinner div[data-v-99c4198b]{transform-origin:20px 20px;animation:lds-spinner-99c4198b 1.2s linear infinite}.lds-spinner div[data-v-99c4198b]:after{content:" ";display:block;position:absolute;top:3px;left:18px;width:2px;height:6px;border-radius:5%;background:#9e9e9e}.lds-spinner div[data-v-99c4198b]:nth-child(1){transform:rotate(0);animation-delay:-1.1s}.lds-spinner div[data-v-99c4198b]:nth-child(2){transform:rotate(30deg);animation-delay:-1s}.lds-spinner div[data-v-99c4198b]:nth-child(3){transform:rotate(60deg);animation-delay:-.9s}.lds-spinner div[data-v-99c4198b]:nth-child(4){transform:rotate(90deg);animation-delay:-.8s}.lds-spinner div[data-v-99c4198b]:nth-child(5){transform:rotate(120deg);animation-delay:-.7s}.lds-spinner div[data-v-99c4198b]:nth-child(6){transform:rotate(150deg);animation-delay:-.6s}.lds-spinner div[data-v-99c4198b]:nth-child(7){transform:rotate(180deg);animation-delay:-.5s}.lds-spinner div[data-v-99c4198b]:nth-child(8){transform:rotate(210deg);animation-delay:-.4s}.lds-spinner div[data-v-99c4198b]:nth-child(9){transform:rotate(240deg);animation-delay:-.3s}.lds-spinner div[data-v-99c4198b]:nth-child(10){transform:rotate(270deg);animation-delay:-.2s}.lds-spinner div[data-v-99c4198b]:nth-child(11){transform:rotate(300deg);animation-delay:-.1s}.lds-spinner div[data-v-99c4198b]:nth-child(12){transform:rotate(330deg);animation-delay:0s}@keyframes lds-spinner-99c4198b{0%{opacity:1}to{opacity:0}}.x-item[data-v-5b5f6d09]{width:600px}@media(max-width:600px){.x-item[data-v-5b5f6d09]{width:calc(100vw - 16px)}}.x-cont[data-v-b482df18]{position:fixed;left:50%;bottom:20px;transform:translate(-50%);z-index:9999}')),document.head.appendChild(a)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- import { computed as V, provide as U, inject as K, ref as p, watchEffect as ne, onMounted as W, onBeforeUnmount as N, onBeforeMount as De, defineComponent as $, watch as J, resolveComponent as m, createBlock as A, openBlock as q, withKeys as F, unref as E, withModifiers as I, isRef as X, withCtx as v, createVNode as h, createTextVNode as M, toDisplayString as S, Transition as Ce, createElementBlock as ee, createCommentVNode as te, normalizeStyle as se, createElementVNode as D, Fragment as je, renderList as Ve, useTemplateRef as pe } from "vue";
2
+ import { computed as V, provide as U, inject as K, ref as p, watchEffect as ne, onMounted as W, onBeforeUnmount as N, onBeforeMount as De, defineComponent as $, watch as J, resolveComponent as m, createBlock as A, openBlock as q, withKeys as F, unref as E, withModifiers as I, isRef as X, withCtx as v, createVNode as x, createTextVNode as M, toDisplayString as S, Transition as je, createElementBlock as ee, createCommentVNode as te, normalizeStyle as se, createElementVNode as D, Fragment as Ce, renderList as Ve, useTemplateRef as pe } from "vue";
3
3
  import { useI18n as z } from "vue-i18n";
4
4
  import { useTheme as _e, useDisplay as qe } from "vuetify";
5
5
  import { useRouter as de, useRoute as Oe } from "vue-router";
@@ -17,7 +17,7 @@ function Te() {
17
17
  borderColor: n
18
18
  };
19
19
  }
20
- function Ct(e) {
20
+ function jt(e) {
21
21
  const t = Se.create({
22
22
  timeout: 6e3
23
23
  });
@@ -51,7 +51,7 @@ function Ie(e, t) {
51
51
  function $e() {
52
52
  T.remove("accessToken"), T.remove("refreshToken"), T.remove("userId"), T.remove("userName"), T.remove("phone"), T.remove("activeOrg"), de().replace({ path: "/passport/login" });
53
53
  }
54
- const jt = (function() {
54
+ const Ct = (function() {
55
55
  return window.globalObjects || (window.globalObjects = {
56
56
  router: null,
57
57
  i18n: null
@@ -393,10 +393,26 @@ function Wt(e) {
393
393
  return "#9e9e9e";
394
394
  }
395
395
  }
396
+ function Xt(e) {
397
+ switch (e) {
398
+ case "string":
399
+ return "";
400
+ case "number":
401
+ return 0;
402
+ case "boolean":
403
+ return !1;
404
+ case "array":
405
+ return [];
406
+ case "object":
407
+ return {};
408
+ case "any":
409
+ return null;
410
+ }
411
+ }
396
412
  function et(e) {
397
413
  return e.value.length <= 0;
398
414
  }
399
- function Xt(e) {
415
+ function zt(e) {
400
416
  if (e.value.length > 0)
401
417
  return e.value[e.value.length - 1];
402
418
  }
@@ -414,10 +430,10 @@ function at(e, t) {
414
430
  function ot(e) {
415
431
  console.assert(e.value.length > 0), e.value.pop();
416
432
  }
417
- function zt(e) {
433
+ function Ht(e) {
418
434
  e.value = [];
419
435
  }
420
- function Ht(e, t, a, o, l, r) {
436
+ function Ft(e, t, a, o, l, r) {
421
437
  const s = Oe(), n = de(), d = Le(), c = p(!1);
422
438
  ne(() => {
423
439
  let g = !1;
@@ -458,7 +474,7 @@ function Ht(e, t, a, o, l, r) {
458
474
  });
459
475
  const f = (g) => {
460
476
  e.value = g;
461
- }, j = (g) => {
477
+ }, C = (g) => {
462
478
  t.value = g;
463
479
  }, k = (g) => {
464
480
  const R = g;
@@ -467,12 +483,12 @@ function Ht(e, t, a, o, l, r) {
467
483
  l.value = g;
468
484
  };
469
485
  De(() => {
470
- u.on("updateDark", f), u.on("updateLocale", j), u.on("updatePermission", k), u.on("updateLastAppPath", i), u.emit("syncGlobalState");
486
+ u.on("updateDark", f), u.on("updateLocale", C), u.on("updatePermission", k), u.on("updateLastAppPath", i), u.emit("syncGlobalState");
471
487
  }), N(() => {
472
- u.off("updateDark", f), u.off("updateLocale", j), u.off("updatePermission", k), u.off("updateLastAppPath", i);
488
+ u.off("updateDark", f), u.off("updateLocale", C), u.off("updatePermission", k), u.off("updateLastAppPath", i);
473
489
  });
474
490
  }
475
- function Ft() {
491
+ function Gt() {
476
492
  const e = He();
477
493
  function t(a, o) {
478
494
  return Ne(
@@ -483,7 +499,7 @@ function Ft() {
483
499
  }
484
500
  return { verifyPermission: t };
485
501
  }
486
- function Gt() {
502
+ function Jt() {
487
503
  const { locale: e, t } = z(), a = V(() => !!window.cordova), o = qe(), l = V(() => o.width.value <= 1280 ? o.width.value + "px" : o.width.value <= 1920 ? 1920 / 2.5 + "px" : 2560 / 2.5 + "px"), r = V(() => o.xs.value);
488
504
  return {
489
505
  sysBarAvail: a,
@@ -533,44 +549,44 @@ const lt = /* @__PURE__ */ $({
533
549
  };
534
550
  return J(b, (f) => {
535
551
  !f && !_ && (u.emit("confirmDlgResult" + c, !1), _ = !0);
536
- }), (f, j) => {
537
- const k = m("v-card-text"), i = m("v-btn"), g = m("v-card-actions"), R = m("v-card"), x = m("v-dialog");
538
- return q(), A(x, {
552
+ }), (f, C) => {
553
+ const k = m("v-card-text"), i = m("v-btn"), g = m("v-card-actions"), R = m("v-card"), h = m("v-dialog");
554
+ return q(), A(h, {
539
555
  modelValue: E(b),
540
- "onUpdate:modelValue": j[1] || (j[1] = (C) => X(b) ? b.value = C : null),
556
+ "onUpdate:modelValue": C[1] || (C[1] = (j) => X(b) ? b.value = j : null),
541
557
  attach: "",
542
558
  "max-width": "600px",
543
559
  transition: "dialog-top-transition",
544
560
  onKeydown: [
545
561
  F(I(y, ["stop", "prevent"]), ["enter"]),
546
- j[2] || (j[2] = F(I((C) => b.value = !1, ["stop", "prevent"]), ["esc"]))
562
+ C[2] || (C[2] = F(I((j) => b.value = !1, ["stop", "prevent"]), ["esc"]))
547
563
  ]
548
564
  }, {
549
565
  default: v(() => [
550
- h(R, {
566
+ x(R, {
551
567
  subtitle: o.value,
552
568
  title: a.value
553
569
  }, {
554
570
  default: v(() => [
555
- h(k, null, {
571
+ x(k, null, {
556
572
  default: v(() => [
557
573
  M(S(l.value), 1)
558
574
  ]),
559
575
  _: 1
560
576
  }),
561
- h(g, { class: "d-flex justify-end" }, {
577
+ x(g, { class: "d-flex justify-end" }, {
562
578
  default: v(() => [
563
- h(i, {
579
+ x(i, {
564
580
  color: r.value,
565
581
  variant: "text",
566
- onClick: j[0] || (j[0] = (C) => b.value = !1)
582
+ onClick: C[0] || (C[0] = (j) => b.value = !1)
567
583
  }, {
568
584
  default: v(() => [
569
585
  M(S(s.value), 1)
570
586
  ]),
571
587
  _: 1
572
588
  }, 8, ["color"]),
573
- h(i, {
589
+ x(i, {
574
590
  color: n.value,
575
591
  variant: "text",
576
592
  onClick: y
@@ -603,7 +619,7 @@ const lt = /* @__PURE__ */ $({
603
619
  zIndex: e.zIndex
604
620
  }));
605
621
  let o = 0;
606
- return (l, r) => (q(), A(Ce, { name: "fade" }, {
622
+ return (l, r) => (q(), A(je, { name: "fade" }, {
607
623
  default: v(() => [
608
624
  e.open ? (q(), ee("div", {
609
625
  key: X(o) ? ++o.value : ++o,
@@ -683,7 +699,7 @@ const lt = /* @__PURE__ */ $({
683
699
  D("div", {
684
700
  style: se(a.value)
685
701
  }, S(e.text), 5),
686
- h(d, {
702
+ x(d, {
687
703
  class: "mx-1",
688
704
  icon: "mdi-close",
689
705
  onClick: n[0] || (n[0] = (_) => r("timeout", e.id))
@@ -721,7 +737,7 @@ const lt = /* @__PURE__ */ $({
721
737
  onClick: d[0] || (d[0] = I(() => {
722
738
  }, ["stop"]))
723
739
  }, [
724
- (q(!0), ee(je, null, Ve(t.value, (c) => (q(), A(ct, {
740
+ (q(!0), ee(Ce, null, Ve(t.value, (c) => (q(), A(ct, {
725
741
  id: c.id,
726
742
  key: c.id,
727
743
  text: c.text,
@@ -738,13 +754,13 @@ const lt = /* @__PURE__ */ $({
738
754
  let c = 0, _ = !1;
739
755
  const w = pe("target"), b = async (k) => {
740
756
  a.value = k.title, o.value = k.subtitle ?? "", l.value = k.value, r.value = k.precision, s.value = k.min, n.value = k.max, d.value = k.step, c = k.seq, _ = !1, y.value = !0, await H(() => !!w.value), w.value.focus();
741
- }, { open: y } = Q("numberDlg", b), f = p(!1), j = () => {
757
+ }, { open: y } = Q("numberDlg", b), f = p(!1), C = () => {
742
758
  y.value = !1, _ || (u.emit(`numberDlgResult${c}`, l.value), _ = !0);
743
759
  };
744
760
  return J(y, (k) => {
745
761
  !k && !_ && (u.emit(`numberDlgResult${c}`, void 0), _ = !0);
746
762
  }), (k, i) => {
747
- const g = m("v-number-input"), R = m("v-btn"), x = m("v-card-actions"), C = m("v-form"), Y = m("v-card"), Z = m("v-dialog");
763
+ const g = m("v-number-input"), R = m("v-btn"), h = m("v-card-actions"), j = m("v-form"), Y = m("v-card"), Z = m("v-dialog");
748
764
  return q(), A(Z, {
749
765
  modelValue: E(y),
750
766
  "onUpdate:modelValue": i[3] || (i[3] = (O) => X(y) ? y.value = O : null),
@@ -754,16 +770,16 @@ const lt = /* @__PURE__ */ $({
754
770
  onKeydown: i[4] || (i[4] = F(I((O) => y.value = !1, ["stop", "prevent"]), ["esc"]))
755
771
  }, {
756
772
  default: v(() => [
757
- h(Y, { title: a.value }, {
773
+ x(Y, { title: a.value }, {
758
774
  default: v(() => [
759
- h(C, {
775
+ x(j, {
760
776
  modelValue: f.value,
761
777
  "onUpdate:modelValue": i[2] || (i[2] = (O) => f.value = O),
762
778
  class: "mx-3",
763
- onSubmit: I(j, ["prevent"])
779
+ onSubmit: I(C, ["prevent"])
764
780
  }, {
765
781
  default: v(() => [
766
- h(g, {
782
+ x(g, {
767
783
  ref_key: "target",
768
784
  ref: w,
769
785
  modelValue: l.value,
@@ -774,9 +790,9 @@ const lt = /* @__PURE__ */ $({
774
790
  precision: r.value,
775
791
  step: d.value
776
792
  }, null, 8, ["modelValue", "max", "min", "precision", "step"]),
777
- h(x, { class: "d-flex justify-end" }, {
793
+ x(h, { class: "d-flex justify-end" }, {
778
794
  default: v(() => [
779
- h(R, {
795
+ x(R, {
780
796
  color: "primary",
781
797
  variant: "text",
782
798
  onClick: i[1] || (i[1] = (O) => y.value = !1)
@@ -786,7 +802,7 @@ const lt = /* @__PURE__ */ $({
786
802
  ]),
787
803
  _: 1
788
804
  }),
789
- h(R, {
805
+ x(R, {
790
806
  color: "primary",
791
807
  disabled: !f.value,
792
808
  type: "submit",
@@ -816,25 +832,25 @@ const lt = /* @__PURE__ */ $({
816
832
  setup(e) {
817
833
  const { t } = z(), a = p(""), o = p(""), l = p(""), r = p(""), s = p(""), n = p(), d = p(""), c = p(""), _ = p(""), w = p(""), b = p("");
818
834
  let y = 0, f = !1;
819
- const j = pe("target"), k = async (x) => {
820
- a.value = x.title, o.value = x.subtitle ?? "", l.value = x.text, r.value = x.label, s.value = x.placeholder, n.value = x.rules, d.value = x.value, c.value = x.cancel?.color ?? "primary", _.value = x.cancel?.text ?? t("dlg.common.cancel"), w.value = x.confirm?.color ?? "primary", b.value = x.confirm?.text ?? t("dlg.common.confirm"), y = x.seq, f = !1, i.value = !0, await H(() => !!j.value), j.value.focus();
835
+ const C = pe("target"), k = async (h) => {
836
+ a.value = h.title, o.value = h.subtitle ?? "", l.value = h.text, r.value = h.label, s.value = h.placeholder, n.value = h.rules, d.value = h.value, c.value = h.cancel?.color ?? "primary", _.value = h.cancel?.text ?? t("dlg.common.cancel"), w.value = h.confirm?.color ?? "primary", b.value = h.confirm?.text ?? t("dlg.common.confirm"), y = h.seq, f = !1, i.value = !0, await H(() => !!C.value), C.value.focus();
821
837
  }, { open: i } = Q("promptDlg", k), g = p(!1), R = () => {
822
838
  i.value = !1, f || (u.emit("promptDlgResult" + y, d.value ?? ""), f = !0);
823
839
  };
824
- return J(i, (x) => {
825
- !x && !f && (u.emit("promptDlgResult" + y, void 0), f = !0);
826
- }), (x, C) => {
827
- const Y = m("v-card-text"), Z = m("v-text-field"), O = m("v-btn"), we = m("v-card-actions"), xe = m("v-form"), he = m("v-card"), ke = m("v-dialog");
840
+ return J(i, (h) => {
841
+ !h && !f && (u.emit("promptDlgResult" + y, void 0), f = !0);
842
+ }), (h, j) => {
843
+ const Y = m("v-card-text"), Z = m("v-text-field"), O = m("v-btn"), we = m("v-card-actions"), he = m("v-form"), xe = m("v-card"), ke = m("v-dialog");
828
844
  return q(), A(ke, {
829
845
  modelValue: E(i),
830
- "onUpdate:modelValue": C[3] || (C[3] = (B) => X(i) ? i.value = B : null),
846
+ "onUpdate:modelValue": j[3] || (j[3] = (B) => X(i) ? i.value = B : null),
831
847
  attach: "",
832
848
  "max-width": "600px",
833
849
  transition: "dialog-top-transition",
834
- onKeydown: C[4] || (C[4] = F(I((B) => i.value = !1, ["stop", "prevent"]), ["esc"]))
850
+ onKeydown: j[4] || (j[4] = F(I((B) => i.value = !1, ["stop", "prevent"]), ["esc"]))
835
851
  }, {
836
852
  default: v(() => [
837
- h(he, {
853
+ x(xe, {
838
854
  subtitle: o.value,
839
855
  title: a.value
840
856
  }, {
@@ -845,35 +861,35 @@ const lt = /* @__PURE__ */ $({
845
861
  ]),
846
862
  _: 1
847
863
  })) : te("", !0),
848
- h(xe, {
864
+ x(he, {
849
865
  modelValue: g.value,
850
- "onUpdate:modelValue": C[2] || (C[2] = (B) => g.value = B),
866
+ "onUpdate:modelValue": j[2] || (j[2] = (B) => g.value = B),
851
867
  class: "mx-3",
852
868
  onSubmit: I(R, ["prevent"])
853
869
  }, {
854
870
  default: v(() => [
855
- h(Z, {
871
+ x(Z, {
856
872
  ref_key: "target",
857
- ref: j,
873
+ ref: C,
858
874
  modelValue: d.value,
859
- "onUpdate:modelValue": C[0] || (C[0] = (B) => d.value = B),
875
+ "onUpdate:modelValue": j[0] || (j[0] = (B) => d.value = B),
860
876
  label: r.value,
861
877
  placeholder: s.value,
862
878
  rules: n.value
863
879
  }, null, 8, ["modelValue", "label", "placeholder", "rules"]),
864
- h(we, { class: "d-flex justify-end" }, {
880
+ x(we, { class: "d-flex justify-end" }, {
865
881
  default: v(() => [
866
- h(O, {
882
+ x(O, {
867
883
  color: c.value,
868
884
  variant: "text",
869
- onClick: C[1] || (C[1] = (B) => i.value = !1)
885
+ onClick: j[1] || (j[1] = (B) => i.value = !1)
870
886
  }, {
871
887
  default: v(() => [
872
888
  M(S(_.value), 1)
873
889
  ]),
874
890
  _: 1
875
891
  }, 8, ["color"]),
876
- h(O, {
892
+ x(O, {
877
893
  color: w.value,
878
894
  disabled: !g.value,
879
895
  type: "submit",
@@ -923,7 +939,7 @@ const lt = /* @__PURE__ */ $({
923
939
  }, {
924
940
  default: v(() => [
925
941
  D("div", it, [
926
- h(d, {
942
+ x(d, {
927
943
  height: "80px",
928
944
  loading: "",
929
945
  width: "300px"
@@ -949,22 +965,23 @@ const lt = /* @__PURE__ */ $({
949
965
  (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(r.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== a ? ". Note that variables only represent file names one level deep." : ""))));
950
966
  });
951
967
  };
952
- async function Jt(e) {
968
+ async function Qt(e) {
953
969
  return (await bt(/* @__PURE__ */ Object.assign({ "./locales/en/index.ts": () => import("./i18n-en.i529k39u.js"), "./locales/zhHans/index.ts": () => import("./i18n-zhHans.mx7z5jvj.js") }), `./locales/${e}/index.ts`, 4)).default;
954
970
  }
955
- const Qt = { install: mt };
971
+ const Yt = { install: mt };
956
972
  export {
957
973
  Ke as Permission,
958
974
  tt as addView,
959
975
  Ee as appAppear,
960
- zt as clearViews,
976
+ Ht as clearViews,
961
977
  Lt as closeWaitDlg,
962
- Ct as createAxios,
963
- Qt as default,
978
+ jt as createAxios,
979
+ Yt as default,
964
980
  at as delView,
965
981
  u as eventBus,
966
982
  Wt as getTypeColor,
967
- jt as globalObjects,
983
+ Xt as getTypeDefault,
984
+ Ct as globalObjects,
968
985
  ye as hasView,
969
986
  It as injectDark,
970
987
  Ut as injectLastAppPath,
@@ -974,8 +991,8 @@ export {
974
991
  Qe as injectViews,
975
992
  et as isEmpty,
976
993
  ce as isExist,
977
- Xt as lastView,
978
- Jt as loadLocaleMessageEssential,
994
+ zt as lastView,
995
+ Qt as loadLocaleMessageEssential,
979
996
  G as matchRouteMeta,
980
997
  Tt as messageError,
981
998
  At as messageInfo,
@@ -996,9 +1013,9 @@ export {
996
1013
  P as routeTransName,
997
1014
  Nt as types,
998
1015
  Te as useColor,
999
- Ht as useMicroApp,
1000
- Ft as usePermission,
1001
- Gt as useSystem,
1016
+ Ft as useMicroApp,
1017
+ Gt as usePermission,
1018
+ Jt as useSystem,
1002
1019
  Q as useViewStack,
1003
1020
  Ne as verifyPermission,
1004
1021
  Vt as waitMs,
@@ -1,3 +1,4 @@
1
1
  export declare const types: readonly ["string", "number", "boolean", "array", "object", "any"];
2
2
  export type Type = (typeof types)[number];
3
3
  export declare function getTypeColor(type: Type): string;
4
+ export declare function getTypeDefault(type: Type): any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
3
  "private": false,
4
- "version": "0.9.22",
4
+ "version": "0.9.23",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",