x-essential-lib 0.10.12 → 0.10.13
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.
|
|
1
|
+
import { n as EventType, t as Emitter } from "./vendor.bri8m5ch.js";
|
|
2
2
|
import { Ref } from "vue";
|
|
3
3
|
import { RouteLocationNormalized } from "vue-router";
|
|
4
4
|
import { AxiosInstance } from "axios";
|
|
@@ -256,6 +256,8 @@ declare function provideLocale(locale: Ref<string>): void;
|
|
|
256
256
|
declare function injectLocale(): Ref<string>;
|
|
257
257
|
declare function provideActiveOrg(activeOrg: Ref<string>): void;
|
|
258
258
|
declare function injectActiveOrg(): Ref<string>;
|
|
259
|
+
declare function provideActiveOrgName(activeOrgName: Ref<string>): void;
|
|
260
|
+
declare function injectActiveOrgName(): Ref<string>;
|
|
259
261
|
declare function providePermissionObjects(permissionObjects: Ref<PermissionObjects>): void;
|
|
260
262
|
declare function injectPermissionObjects(): Ref<PermissionObjects>;
|
|
261
263
|
declare function providePermissionChecksum(permissionChecksum: Ref<string>): void;
|
|
@@ -305,6 +307,7 @@ interface GlobalStates {
|
|
|
305
307
|
dark: Ref<boolean | undefined>;
|
|
306
308
|
locale: Ref<string>;
|
|
307
309
|
activeOrg: Ref<string>;
|
|
310
|
+
activeOrgName: Ref<string>;
|
|
308
311
|
permissionObjects: Ref<PermissionObjects>;
|
|
309
312
|
permissionChecksum: Ref<string>;
|
|
310
313
|
lastAppPath: Ref<string>;
|
|
@@ -546,6 +549,9 @@ declare function loadLocaleMessageEssential(locale: string): Promise<{
|
|
|
546
549
|
};
|
|
547
550
|
};
|
|
548
551
|
};
|
|
552
|
+
'x-essential-lib': {
|
|
553
|
+
publicDomain: string;
|
|
554
|
+
};
|
|
549
555
|
}>;
|
|
550
556
|
//#endregion
|
|
551
557
|
//#region src/index.d.ts
|
|
@@ -553,4 +559,4 @@ declare const _default: {
|
|
|
553
559
|
install: (app: import("vue").App) => void;
|
|
554
560
|
};
|
|
555
561
|
//#endregion
|
|
556
|
-
export { Permission, PermissionObjects, RouteMeta, Type, addView, appAppear, clearViews, closeWaitDlg, createAxios, _default as default, delView, eventBus, getTypeColor, getTypeDefault, globalObjects, hasView, injectActiveOrg, injectDark, injectLastAppPath, injectLocale, injectPermissionChecksum, injectPermissionObjects, injectViews, isEmpty, isExist, lastView, loadLocaleMessageEssential, matchRouteMeta, messageError, messageInfo, messageSuccess, messageWarning, onBeforeEach, openConfirmDlg, openNumberDlg, openPromptDlg, openWaitDlg, popView, provideActiveOrg, provideDark, provideLastAppPath, provideLocale, providePermissionChecksum, providePermissionObjects, provideViews, routeTransName, toPermissionObjects, types, useColor, useMicroApp, usePermission, useSystem, useViewStack, verifyPermission, waitMs, waitUtil };
|
|
562
|
+
export { Permission, PermissionObjects, RouteMeta, Type, addView, appAppear, clearViews, closeWaitDlg, createAxios, _default as default, delView, eventBus, getTypeColor, getTypeDefault, globalObjects, hasView, injectActiveOrg, injectActiveOrgName, injectDark, injectLastAppPath, injectLocale, injectPermissionChecksum, injectPermissionObjects, injectViews, isEmpty, isExist, lastView, loadLocaleMessageEssential, matchRouteMeta, messageError, messageInfo, messageSuccess, messageWarning, onBeforeEach, openConfirmDlg, openNumberDlg, openPromptDlg, openWaitDlg, popView, provideActiveOrg, provideActiveOrgName, provideDark, provideLastAppPath, provideLocale, providePermissionChecksum, providePermissionObjects, provideViews, routeTransName, toPermissionObjects, types, useColor, useMicroApp, usePermission, useSystem, useViewStack, verifyPermission, waitMs, waitUtil };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.
|
|
2
|
+
import { a as api, i as mitt_default, o as usePreferredDark, r as toLower } from "./vendor.bri8m5ch.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";
|
|
@@ -48,6 +48,9 @@ if (window.API_URL) instance.defaults.baseURL = window.API_URL + "/orgbase/";
|
|
|
48
48
|
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/api/orgbase/index.ts
|
|
51
|
+
function GetOrgName(request) {
|
|
52
|
+
return instance.post("getOrgName", request);
|
|
53
|
+
}
|
|
51
54
|
function PullPermission(request) {
|
|
52
55
|
return instance.post("pullPermission", request);
|
|
53
56
|
}
|
|
@@ -433,6 +436,12 @@ function provideActiveOrg(activeOrg) {
|
|
|
433
436
|
function injectActiveOrg() {
|
|
434
437
|
return inject("essentialActiveOrg");
|
|
435
438
|
}
|
|
439
|
+
function provideActiveOrgName(activeOrgName) {
|
|
440
|
+
provide("essentialActiveOrgName", activeOrgName);
|
|
441
|
+
}
|
|
442
|
+
function injectActiveOrgName() {
|
|
443
|
+
return inject("essentialActiveOrgName");
|
|
444
|
+
}
|
|
436
445
|
function providePermissionObjects(permissionObjects) {
|
|
437
446
|
provide("essentialPermissionObjects", permissionObjects);
|
|
438
447
|
}
|
|
@@ -633,12 +642,20 @@ function onBeforeChange(toPath, fromPath, lastAppPath) {
|
|
|
633
642
|
function isHasAccessToken() {
|
|
634
643
|
return !!api.get("accessToken");
|
|
635
644
|
}
|
|
645
|
+
async function syncOrg(orgId) {
|
|
646
|
+
if (orgId !== "public") {
|
|
647
|
+
const { name } = await GetOrgName({ orgId });
|
|
648
|
+
eventBus.emit("updateActiveOrg", [orgId, name]);
|
|
649
|
+
} else eventBus.emit("updateActiveOrg", [orgId, ""]);
|
|
650
|
+
}
|
|
636
651
|
async function syncPermission(orgId) {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
652
|
+
if (orgId !== "public") {
|
|
653
|
+
const { permissions } = await PullPermission({
|
|
654
|
+
orgId,
|
|
655
|
+
checksum: ""
|
|
656
|
+
});
|
|
657
|
+
eventBus.emit("updatePermission", [toPermissionObjects(permissions), permissions["checksum"] ?? ""]);
|
|
658
|
+
} else eventBus.emit("updatePermission", [{}, ""]);
|
|
642
659
|
}
|
|
643
660
|
async function onBeforeEach(to, from, lastAppPath) {
|
|
644
661
|
const hasAccessToken = isHasAccessToken();
|
|
@@ -650,8 +667,8 @@ async function onBeforeEach(to, from, lastAppPath) {
|
|
|
650
667
|
if (to.path.startsWith("/passport/")) onBeforeChange(to.path, from.path, lastAppPath);
|
|
651
668
|
else if (to.path.startsWith("/main")) try {
|
|
652
669
|
if (!orgId) throw new Error(`orgId not specified`);
|
|
670
|
+
await syncOrg(orgId);
|
|
653
671
|
await syncPermission(orgId);
|
|
654
|
-
eventBus.emit("updateActiveOrg", orgId);
|
|
655
672
|
onBeforeChange(to.path, from.path, lastAppPath);
|
|
656
673
|
} catch {
|
|
657
674
|
return {
|
|
@@ -661,8 +678,8 @@ async function onBeforeEach(to, from, lastAppPath) {
|
|
|
661
678
|
}
|
|
662
679
|
else try {
|
|
663
680
|
if (!orgId) throw new Error(`orgId not specified`);
|
|
681
|
+
await syncOrg(orgId);
|
|
664
682
|
await syncPermission(orgId);
|
|
665
|
-
eventBus.emit("updateActiveOrg", orgId);
|
|
666
683
|
onBeforeChange(to.path, from.path, lastAppPath);
|
|
667
684
|
} catch {
|
|
668
685
|
return { path: `/main` };
|
|
@@ -732,9 +749,10 @@ function clearViews(views) {
|
|
|
732
749
|
//#endregion
|
|
733
750
|
//#region src/composables/microApp.ts
|
|
734
751
|
function useMicroApp(globalStates, syncLocale, base, customBack) {
|
|
752
|
+
const { t } = useI18n();
|
|
735
753
|
const route = useRoute();
|
|
736
754
|
const router = useRouter();
|
|
737
|
-
const { dark, locale, activeOrg, permissionObjects, permissionChecksum, lastAppPath, views } = globalStates;
|
|
755
|
+
const { dark, locale, activeOrg, activeOrgName, permissionObjects, permissionChecksum, lastAppPath, views } = globalStates;
|
|
738
756
|
const prefDark = usePreferredDark();
|
|
739
757
|
const finalDark = ref(false);
|
|
740
758
|
watchEffect(() => {
|
|
@@ -760,6 +778,7 @@ function useMicroApp(globalStates, syncLocale, base, customBack) {
|
|
|
760
778
|
provideDark(finalDark);
|
|
761
779
|
provideLocale(locale);
|
|
762
780
|
provideActiveOrg(activeOrg);
|
|
781
|
+
provideActiveOrgName(activeOrgName);
|
|
763
782
|
providePermissionObjects(permissionObjects);
|
|
764
783
|
providePermissionChecksum(permissionChecksum);
|
|
765
784
|
provideLastAppPath(lastAppPath);
|
|
@@ -881,8 +900,14 @@ function useMicroApp(globalStates, syncLocale, base, customBack) {
|
|
|
881
900
|
function onUpdateLocale(val) {
|
|
882
901
|
locale.value = val;
|
|
883
902
|
}
|
|
903
|
+
const activeOrgNameRaw = ref("");
|
|
904
|
+
watchEffect(() => {
|
|
905
|
+
if (activeOrg.value === "public") activeOrgName.value = t("x-essential-lib.publicDomain");
|
|
906
|
+
else activeOrgName.value = activeOrgNameRaw.value;
|
|
907
|
+
});
|
|
884
908
|
function onUpdateActiveOrg(val) {
|
|
885
|
-
activeOrg.value = val;
|
|
909
|
+
activeOrg.value = val[0];
|
|
910
|
+
activeOrgNameRaw.value = val[1];
|
|
886
911
|
}
|
|
887
912
|
function onUpdatePermission(val) {
|
|
888
913
|
permissionObjects.value = val[0];
|
|
@@ -894,7 +919,7 @@ function useMicroApp(globalStates, syncLocale, base, customBack) {
|
|
|
894
919
|
function onSyncGlobalStates() {
|
|
895
920
|
eventBus.emit("updateDark", dark.value);
|
|
896
921
|
eventBus.emit("updateLocale", locale.value);
|
|
897
|
-
eventBus.emit("updateActiveOrg", activeOrg.value);
|
|
922
|
+
eventBus.emit("updateActiveOrg", [activeOrg.value, activeOrgNameRaw.value]);
|
|
898
923
|
eventBus.emit("updatePermission", [permissionObjects.value, permissionChecksum.value]);
|
|
899
924
|
eventBus.emit("updateLastAppPath", lastAppPath.value);
|
|
900
925
|
}
|
|
@@ -1667,8 +1692,8 @@ const install = (app) => {
|
|
|
1667
1692
|
//#endregion
|
|
1668
1693
|
//#region src/i18n/index.ts
|
|
1669
1694
|
async function loadLocaleMessageEssential(locale) {
|
|
1670
|
-
if (locale === "en") return (await import("./i18n-en.
|
|
1671
|
-
else if (locale === "zhHans") return (await import("./i18n-zhHans.
|
|
1695
|
+
if (locale === "en") return (await import("./i18n-en.m7512rls.js").then((n) => n.t)).default;
|
|
1696
|
+
else if (locale === "zhHans") return (await import("./i18n-zhHans.nfr7wfgr.js").then((n) => n.t)).default;
|
|
1672
1697
|
else throw new Error(`invalid locale=${locale}`);
|
|
1673
1698
|
}
|
|
1674
1699
|
|
|
@@ -1677,4 +1702,4 @@ async function loadLocaleMessageEssential(locale) {
|
|
|
1677
1702
|
var src_default = { install };
|
|
1678
1703
|
|
|
1679
1704
|
//#endregion
|
|
1680
|
-
export { Permission, addView, appAppear, clearViews, closeWaitDlg, createAxios, src_default as default, delView, eventBus, getTypeColor, getTypeDefault, globalObjects, hasView, injectActiveOrg, injectDark, injectLastAppPath, injectLocale, injectPermissionChecksum, injectPermissionObjects, injectViews, isEmpty, isExist, lastView, loadLocaleMessageEssential, matchRouteMeta, messageError, messageInfo, messageSuccess, messageWarning, onBeforeEach, openConfirmDlg, openNumberDlg, openPromptDlg, openWaitDlg, popView, provideActiveOrg, provideDark, provideLastAppPath, provideLocale, providePermissionChecksum, providePermissionObjects, provideViews, routeTransName, toPermissionObjects, types, useColor, useMicroApp, usePermission, useSystem, useViewStack, verifyPermission, waitMs, waitUtil };
|
|
1705
|
+
export { Permission, addView, appAppear, clearViews, closeWaitDlg, createAxios, src_default as default, delView, eventBus, getTypeColor, getTypeDefault, globalObjects, hasView, injectActiveOrg, injectActiveOrgName, injectDark, injectLastAppPath, injectLocale, injectPermissionChecksum, injectPermissionObjects, injectViews, isEmpty, isExist, lastView, loadLocaleMessageEssential, matchRouteMeta, messageError, messageInfo, messageSuccess, messageWarning, onBeforeEach, openConfirmDlg, openNumberDlg, openPromptDlg, openWaitDlg, popView, provideActiveOrg, provideActiveOrgName, provideDark, provideLastAppPath, provideLocale, providePermissionChecksum, providePermissionObjects, provideViews, routeTransName, toPermissionObjects, types, useColor, useMicroApp, usePermission, 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
|
-
|
|
580
|
+
67,
|
|
581
581
|
() => [],
|
|
582
582
|
[]
|
|
583
583
|
];
|
|
584
584
|
var Handler = [
|
|
585
|
-
|
|
585
|
+
68,
|
|
586
586
|
(T) => [T],
|
|
587
587
|
[
|
|
588
588
|
"",
|
|
@@ -591,7 +591,7 @@ var Handler = [
|
|
|
591
591
|
]
|
|
592
592
|
];
|
|
593
593
|
var WildcardHandler = [
|
|
594
|
-
|
|
594
|
+
69,
|
|
595
595
|
(T) => [
|
|
596
596
|
Record,
|
|
597
597
|
T,
|
|
@@ -609,7 +609,7 @@ var WildcardHandler = [
|
|
|
609
609
|
]
|
|
610
610
|
];
|
|
611
611
|
var EventHandlerList = [
|
|
612
|
-
|
|
612
|
+
70,
|
|
613
613
|
(T) => [
|
|
614
614
|
T,
|
|
615
615
|
Handler,
|
|
@@ -623,7 +623,7 @@ var EventHandlerList = [
|
|
|
623
623
|
]
|
|
624
624
|
];
|
|
625
625
|
var WildCardEventHandlerList = [
|
|
626
|
-
|
|
626
|
+
71,
|
|
627
627
|
(T) => [
|
|
628
628
|
Record,
|
|
629
629
|
T,
|
|
@@ -639,7 +639,7 @@ var WildCardEventHandlerList = [
|
|
|
639
639
|
]
|
|
640
640
|
];
|
|
641
641
|
var EventHandlerMap = [
|
|
642
|
-
|
|
642
|
+
72,
|
|
643
643
|
(Events) => [
|
|
644
644
|
EventType,
|
|
645
645
|
Record,
|
|
@@ -665,7 +665,7 @@ var EventHandlerMap = [
|
|
|
665
665
|
]
|
|
666
666
|
];
|
|
667
667
|
var Emitter = [
|
|
668
|
-
|
|
668
|
+
73,
|
|
669
669
|
(Key, Events) => [
|
|
670
670
|
EventType,
|
|
671
671
|
Record,
|