x-essential-lib 0.10.25 → 0.10.26

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
@@ -1,4 +1,4 @@
1
- import { n as EventType, t as Emitter } from "./vendor.dqdzrw43.js";
1
+ import { n as EventType, t as Emitter } from "./vendor.homyhtbu.js";
2
2
  import { Ref } from "vue";
3
3
  import { AxiosInstance } from "axios";
4
4
  import { RouteLocationNormalized } from "vue-router";
@@ -312,6 +312,11 @@ declare function usePermission(): {
312
312
  verifyPermission: (permission: Permission, instance?: string) => boolean;
313
313
  };
314
314
  //#endregion
315
+ //#region src/composables/routeChange.d.ts
316
+ declare function useRouteChange(routeChange: () => Promise<void>): {
317
+ syncOrg: () => Promise<boolean>;
318
+ };
319
+ //#endregion
315
320
  //#region src/composables/system.d.ts
316
321
  declare function useSystem(): {
317
322
  sysBarAvail: import("vue").ComputedRef<boolean>;
@@ -552,4 +557,4 @@ declare const _default: {
552
557
  install: (app: import("vue").App) => void;
553
558
  };
554
559
  //#endregion
555
- export { GlobalStates, Permission, PermissionObjects, RouteMeta, Type, addView, appAppear, clearViews, closeWaitDlg, createAxios, _default as default, delView, eventBus, getTypeColor, getTypeDefault, globalObjects, hasView, injectDark, injectLocale, injectPermissionObjects, injectViews, isEmpty, isExist, lastView, loadLocaleMessageEssential, matchRouteMeta, messageError, messageInfo, messageSuccess, messageWarning, onBeforeEach, openConfirmDlg, openNumberDlg, openPromptDlg, openWaitDlg, popView, provideDark, provideLocale, providePermissionObjects, provideViews, routeTransName, toPermissionObjects, types, useColor, useGlobalStates, useMicroApp, usePermission, useSystem, useViewStack, verifyPermission, waitMs, waitUtil };
560
+ export { GlobalStates, Permission, PermissionObjects, RouteMeta, Type, addView, appAppear, clearViews, closeWaitDlg, createAxios, _default as default, delView, eventBus, getTypeColor, getTypeDefault, globalObjects, hasView, injectDark, injectLocale, injectPermissionObjects, injectViews, isEmpty, isExist, lastView, loadLocaleMessageEssential, matchRouteMeta, messageError, messageInfo, messageSuccess, messageWarning, onBeforeEach, openConfirmDlg, openNumberDlg, openPromptDlg, openWaitDlg, popView, provideDark, provideLocale, providePermissionObjects, provideViews, routeTransName, toPermissionObjects, types, useColor, useGlobalStates, useMicroApp, usePermission, useRouteChange, useSystem, useViewStack, verifyPermission, waitMs, waitUtil };
package/dist/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  (function(){try{document.getElementById(`x-essential-lib`)?.remove();const e = document.createElement(`style`);e.setAttribute(`id`, `x-essential-lib`);const t = document.createTextNode(`.fade-leave-active[data-v-x-essential-lib-c3545c8d]{transition:opacity .5s}.fade-leave-to[data-v-x-essential-lib-c3545c8d]{opacity:0}.x-cont[data-v-x-essential-lib-c3545c8d]{justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.lds-spinner[data-v-x-essential-lib-c3545c8d]{color:official;width:40px;height:40px;display:inline-block;position:relative}.lds-spinner div[data-v-x-essential-lib-c3545c8d]{transform-origin:20px 20px;animation:1.2s linear infinite lds-spinner-x-essential-lib-c3545c8d}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:after{content:" ";background:#9e9e9e;border-radius:5%;width:2px;height:6px;display:block;position:absolute;top:3px;left:18px}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:first-child{animation-delay:-1.1s;transform:rotate(0)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(2){animation-delay:-1s;transform:rotate(30deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(3){animation-delay:-.9s;transform:rotate(60deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(4){animation-delay:-.8s;transform:rotate(90deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(5){animation-delay:-.7s;transform:rotate(120deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(6){animation-delay:-.6s;transform:rotate(150deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(7){animation-delay:-.5s;transform:rotate(180deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(8){animation-delay:-.4s;transform:rotate(210deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(9){animation-delay:-.3s;transform:rotate(240deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(10){animation-delay:-.2s;transform:rotate(270deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(11){animation-delay:-.1s;transform:rotate(300deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(12){animation-delay:0s;transform:rotate(330deg)}@keyframes lds-spinner-x-essential-lib-c3545c8d{0%{opacity:1}to{opacity:0}}.x-item[data-v-x-essential-lib-cfcda9d9]{width:600px}@media (width<=600px){.x-item[data-v-x-essential-lib-cfcda9d9]{width:calc(100vw - 16px)}}.x-cont[data-v-x-essential-lib-b973907d]{z-index:9999;position:fixed;bottom:20px;left:50%;transform:translate(-50%)}`);e.appendChild(t);document.head.appendChild(e);}catch(e){console.error('rolldown-plugin-inject-css', e);}})()
2
- import { a as api, i as mitt_default, o as usePreferredDark, r as toLower } from "./vendor.dqdzrw43.js";
2
+ import { a as api, i as mitt_default, o as usePreferredDark, r as toLower } from "./vendor.homyhtbu.js";
3
3
  import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, isRef, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, openBlock, provide, ref, renderList, resolveComponent, toDisplayString, unref, useTemplateRef, watch, watchEffect, withCtx, withKeys, withModifiers } from "vue";
4
4
  import { useI18n } from "vue-i18n";
5
5
  import { useDisplay, useTheme } from "vuetify";
6
6
  import axios from "axios";
7
7
  import { useRoute, useRouter } from "vue-router";
8
+ import { getErrorMessage } from "x-error-lib";
9
+ import { createAxios as createAxios$1, messageError as messageError$1 } from "x-essential-lib";
8
10
 
9
11
  //#region src/composables/color.ts
10
12
  function useColor() {
@@ -792,6 +794,64 @@ function usePermission() {
792
794
  return { verifyPermission: verifyPermission$1 };
793
795
  }
794
796
 
797
+ //#endregion
798
+ //#region src/api/orgbase/instance.ts
799
+ const instance = createAxios$1({
800
+ baseUrl: "http://localhost/orgbase/",
801
+ onError: (error) => {
802
+ messageError$1(getErrorMessage(error));
803
+ }
804
+ });
805
+ if (window.API_URL) instance.defaults.baseURL = window.API_URL + "/orgbase/";
806
+
807
+ //#endregion
808
+ //#region src/api/orgbase/index.ts
809
+ function GetOrgName(request) {
810
+ return instance.post("getOrgName", request);
811
+ }
812
+ function PullPermission(request) {
813
+ return instance.post("pullPermission", request);
814
+ }
815
+
816
+ //#endregion
817
+ //#region src/composables/routeChange.ts
818
+ function useRouteChange(routeChange) {
819
+ const route = useRoute();
820
+ const router = useRouter();
821
+ async function syncOrg() {
822
+ const orgId = route.query.orgId;
823
+ if (!orgId) {
824
+ await router.replace({ path: `/main/${Date.now()}` });
825
+ return false;
826
+ }
827
+ if (orgId === "public") {
828
+ eventBus.emit("updateActiveOrg", [orgId, ""]);
829
+ eventBus.emit("updatePermission", [{}, ""]);
830
+ return true;
831
+ }
832
+ try {
833
+ const { name } = await GetOrgName({ orgId });
834
+ const { permissions } = await PullPermission({
835
+ orgId,
836
+ checksum: ""
837
+ });
838
+ eventBus.emit("updateActiveOrg", [orgId, name]);
839
+ eventBus.emit("updatePermission", [toPermissionObjects(permissions), permissions.checksum ?? ""]);
840
+ return true;
841
+ } catch (e) {
842
+ if (e === "org not found" || e === "org member not found") await router.replace({ path: `/main/${Date.now()}` });
843
+ return false;
844
+ }
845
+ }
846
+ onBeforeMount(async () => {
847
+ await routeChange();
848
+ });
849
+ watch(() => route.path, async () => {
850
+ await routeChange();
851
+ });
852
+ return { syncOrg };
853
+ }
854
+
795
855
  //#endregion
796
856
  //#region src/composables/system.ts
797
857
  function useSystem() {
@@ -1542,4 +1602,4 @@ async function loadLocaleMessageEssential(locale) {
1542
1602
  var src_default = { install };
1543
1603
 
1544
1604
  //#endregion
1545
- export { Permission, addView, appAppear, clearViews, closeWaitDlg, createAxios, src_default as default, delView, eventBus, getTypeColor, getTypeDefault, globalObjects, hasView, injectDark, injectLocale, injectPermissionObjects, injectViews, isEmpty, isExist, lastView, loadLocaleMessageEssential, matchRouteMeta, messageError, messageInfo, messageSuccess, messageWarning, onBeforeEach, openConfirmDlg, openNumberDlg, openPromptDlg, openWaitDlg, popView, provideDark, provideLocale, providePermissionObjects, provideViews, routeTransName, toPermissionObjects, types, useColor, useGlobalStates, useMicroApp, usePermission, useSystem, useViewStack, verifyPermission, waitMs, waitUtil };
1605
+ export { Permission, addView, appAppear, clearViews, closeWaitDlg, createAxios, src_default as default, delView, eventBus, getTypeColor, getTypeDefault, globalObjects, hasView, injectDark, injectLocale, injectPermissionObjects, injectViews, isEmpty, isExist, lastView, loadLocaleMessageEssential, matchRouteMeta, messageError, messageInfo, messageSuccess, messageWarning, onBeforeEach, openConfirmDlg, openNumberDlg, openPromptDlg, openWaitDlg, popView, provideDark, provideLocale, providePermissionObjects, provideViews, routeTransName, toPermissionObjects, types, useColor, useGlobalStates, useMicroApp, usePermission, useRouteChange, useSystem, useViewStack, verifyPermission, waitMs, waitUtil };
@@ -577,12 +577,12 @@ function toLower(value) {
577
577
  //#endregion
578
578
  //#region node_modules/.pnpm/mitt@3.0.1/node_modules/mitt/index.d.ts
579
579
  var EventType = [
580
- 60,
580
+ 61,
581
581
  () => [],
582
582
  []
583
583
  ];
584
584
  var Handler = [
585
- 61,
585
+ 62,
586
586
  (T) => [T],
587
587
  [
588
588
  "",
@@ -591,7 +591,7 @@ var Handler = [
591
591
  ]
592
592
  ];
593
593
  var WildcardHandler = [
594
- 62,
594
+ 63,
595
595
  (T) => [
596
596
  Record,
597
597
  T,
@@ -609,7 +609,7 @@ var WildcardHandler = [
609
609
  ]
610
610
  ];
611
611
  var EventHandlerList = [
612
- 63,
612
+ 64,
613
613
  (T) => [
614
614
  T,
615
615
  Handler,
@@ -623,7 +623,7 @@ var EventHandlerList = [
623
623
  ]
624
624
  ];
625
625
  var WildCardEventHandlerList = [
626
- 64,
626
+ 65,
627
627
  (T) => [
628
628
  Record,
629
629
  T,
@@ -639,7 +639,7 @@ var WildCardEventHandlerList = [
639
639
  ]
640
640
  ];
641
641
  var EventHandlerMap = [
642
- 65,
642
+ 66,
643
643
  (Events) => [
644
644
  EventType,
645
645
  Record,
@@ -665,7 +665,7 @@ var EventHandlerMap = [
665
665
  ]
666
666
  ];
667
667
  var Emitter = [
668
- 66,
668
+ 67,
669
669
  (Key, Events) => [
670
670
  EventType,
671
671
  Record,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
- "version": "0.10.25",
3
+ "version": "0.10.26",
4
4
  "files": [
5
5
  "dist"
6
6
  ],