x-essential-lib 0.10.31 → 0.10.33

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,7 +1,6 @@
1
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
- import { RouteLocationNormalized } from "vue-router";
5
4
 
6
5
  //#region src/composables/color.d.ts
7
6
  declare function useColor(): {
@@ -269,9 +268,7 @@ interface RouteMeta {
269
268
  }
270
269
  declare function matchRouteMeta(path: string): RouteMeta | undefined;
271
270
  declare const routeTransName: import("vue").Ref<string, string>;
272
- declare function onBeforeEach(to: RouteLocationNormalized, from: RouteLocationNormalized, lastAppPath: string): Promise<{
273
- path: string;
274
- } | undefined>;
271
+ declare function onBeforeEnter(toPath: string, fromPath: string, lastAppPath: string): void;
275
272
  //#endregion
276
273
  //#region src/utils/type.d.ts
277
274
  declare const types: readonly ["string", "number", "boolean", "array", "object", "any"];
@@ -557,4 +554,4 @@ declare const _default: {
557
554
  install: (app: import("vue").App) => void;
558
555
  };
559
556
  //#endregion
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 };
557
+ 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, onBeforeEnter, 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
@@ -583,7 +583,7 @@ function matchRouteMeta(path) {
583
583
  return target;
584
584
  }
585
585
  const routeTransName = ref("");
586
- function onBeforeChange(toPath, fromPath, lastAppPath) {
586
+ function onBeforeEnter(toPath, fromPath, lastAppPath) {
587
587
  if (fromPath === "/") fromPath = lastAppPath;
588
588
  const toRouteMeta = matchRouteMeta(toPath);
589
589
  const fromRouteMeta = matchRouteMeta(fromPath);
@@ -600,17 +600,6 @@ function onBeforeChange(toPath, fromPath, lastAppPath) {
600
600
  appAppear(toRouteMeta.app, diff);
601
601
  }
602
602
  }
603
- function isHasAccessToken() {
604
- return !!api.get("accessToken");
605
- }
606
- async function onBeforeEach(to, from, lastAppPath) {
607
- const hasAccessToken = isHasAccessToken();
608
- const toRouteMeta = matchRouteMeta(to.path);
609
- if (!toRouteMeta) return { path: `/main` };
610
- if (toRouteMeta.requireAuth && !hasAccessToken) return { path: `/passport/login` };
611
- if (hasAccessToken && to.path.startsWith("/passport/")) return { path: `/main` };
612
- onBeforeChange(to.path, from.path, lastAppPath);
613
- }
614
603
 
615
604
  //#endregion
616
605
  //#region src/utils/type.ts
@@ -1604,4 +1593,4 @@ async function loadLocaleMessageEssential(locale) {
1604
1593
  var src_default = { install };
1605
1594
 
1606
1595
  //#endregion
1607
- 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 };
1596
+ 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, onBeforeEnter, openConfirmDlg, openNumberDlg, openPromptDlg, openWaitDlg, popView, provideDark, provideLocale, providePermissionObjects, provideViews, routeTransName, toPermissionObjects, types, useColor, useGlobalStates, useMicroApp, usePermission, useRouteChange, useSystem, useViewStack, verifyPermission, waitMs, waitUtil };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
- "version": "0.10.31",
3
+ "version": "0.10.33",
4
4
  "files": [
5
5
  "dist"
6
6
  ],