@litianxiang/portal-core 0.1.17 → 0.1.19
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 +43 -1
- package/dist/index.js +45 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -302,4 +302,46 @@ interface FetchUserMenuForStoreOptions {
|
|
|
302
302
|
*/
|
|
303
303
|
declare function fetchUserMenuForStore(store: CoreUserStoreLike, options: FetchUserMenuForStoreOptions): Promise<boolean>;
|
|
304
304
|
|
|
305
|
-
|
|
305
|
+
interface LoadingState {
|
|
306
|
+
loadingCount: number;
|
|
307
|
+
isLoading: boolean;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* 为 Pinia 创建通用的 Loading Store 配置
|
|
311
|
+
*/
|
|
312
|
+
declare function createLoadingStoreOptions(): {
|
|
313
|
+
state: () => LoadingState;
|
|
314
|
+
actions: {
|
|
315
|
+
startLoading(this: LoadingState & Record<string, any>): void;
|
|
316
|
+
stopLoading(this: LoadingState & Record<string, any>): void;
|
|
317
|
+
resetLoading(this: LoadingState & Record<string, any>): void;
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* 统一登录、SSO 相关的配置常量
|
|
323
|
+
*
|
|
324
|
+
* - DEFAULT_SSO_STORAGE_KEY: 统一登录站点在 localStorage 中使用的 key
|
|
325
|
+
* - DEFAULT_AUTH_LOGIN_ENV_KEY: 前端项目中约定的统一登录地址环境变量名
|
|
326
|
+
* - DEFAULT_AUTH_LOGIN_PATH: 统一登录站点在当前域下的默认路径
|
|
327
|
+
*/
|
|
328
|
+
declare const DEFAULT_SSO_STORAGE_KEY = "user-store";
|
|
329
|
+
declare const DEFAULT_AUTH_LOGIN_ENV_KEY = "VITE_AUTH_LOGIN_URL";
|
|
330
|
+
declare const DEFAULT_AUTH_LOGIN_PATH = "/auth/#/login";
|
|
331
|
+
/**
|
|
332
|
+
* 根据当前 window.location 生成统一登录地址
|
|
333
|
+
*
|
|
334
|
+
* 在 SSR 环境下会返回空字符串,前端项目可自行兜底。
|
|
335
|
+
*/
|
|
336
|
+
declare function getDefaultAuthLoginUrl(): string;
|
|
337
|
+
interface AuthConfig {
|
|
338
|
+
/** 统一登录站点在 localStorage 中使用的 key,默认 user-store */
|
|
339
|
+
ssoStorageKey: string;
|
|
340
|
+
/** 前端项目中约定的统一登录地址环境变量名,默认 VITE_AUTH_LOGIN_URL */
|
|
341
|
+
authLoginEnvKey: string;
|
|
342
|
+
/** 统一登录站点在当前域下的默认路径,默认 /auth/#/login */
|
|
343
|
+
authLoginPath: string;
|
|
344
|
+
}
|
|
345
|
+
declare const AUTH_CONFIG: AuthConfig;
|
|
346
|
+
|
|
347
|
+
export { AUTH_CONFIG, type AppRouterOptions, type AuthConfig, type BreadcrumbItem, type CoreMenuItem, type CoreUserStoreLike, type CreateAuthHttpClientOptions, DEFAULT_AUTH_LOGIN_ENV_KEY, DEFAULT_AUTH_LOGIN_PATH, DEFAULT_HOME_PATH, DEFAULT_SSO_STORAGE_KEY, type FetchUserMenuForStoreOptions, type FontSize, type InactivityConfig, type InactivityResult, type LoadingState, type LogoutToAuthOptions, type MenuHelper, type MenuHelperOptions, type PermissionHelper, type PermissionHelperOptions, type PresetRangeKey, type SidebarMenuFilterOptions, type SyncFromAuthStoreOptions, type TabItem, type ThemeConfig, type ThemeMode, type TimeInput, type TimeRange, type TransformMenuOptions, addTab, applyTheme, buildAllMenuTree, buildPageMenuList, calcInactivityAction, closeAll, closeLeft, closeOthers, closeRight, createAppRouter, createAuthHttpClient, createLoadingStoreOptions, createLogoutToAuth, createMenuHelper, createPermissionHelper, createRange, fetchUserMenuForStore, filterSidebarMenu, findFirstPagePath, formatRange, formatTime, formatToMonthDay, formatToWanShou, formatToYi, formatWanYuanToYi, getDefaultAuthLoginUrl, getPresetRange, humanizeTime, initTheme, isInRange, removeTab, syncFromAuthStoreToStore, timeDiff, transformMenuTree, useThemeWatcher, useTime };
|
package/dist/index.js
CHANGED
|
@@ -818,8 +818,51 @@ async function fetchUserMenuForStore(store, options) {
|
|
|
818
818
|
return false;
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
|
+
|
|
822
|
+
// src/loading/loading.ts
|
|
823
|
+
function createLoadingStoreOptions() {
|
|
824
|
+
return {
|
|
825
|
+
state: () => ({
|
|
826
|
+
loadingCount: 0,
|
|
827
|
+
isLoading: false
|
|
828
|
+
}),
|
|
829
|
+
actions: {
|
|
830
|
+
startLoading() {
|
|
831
|
+
this.loadingCount++;
|
|
832
|
+
this.isLoading = this.loadingCount > 0;
|
|
833
|
+
},
|
|
834
|
+
stopLoading() {
|
|
835
|
+
this.loadingCount = Math.max(0, this.loadingCount - 1);
|
|
836
|
+
this.isLoading = this.loadingCount > 0;
|
|
837
|
+
},
|
|
838
|
+
resetLoading() {
|
|
839
|
+
this.loadingCount = 0;
|
|
840
|
+
this.isLoading = false;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
// src/config/auth-config.ts
|
|
847
|
+
var DEFAULT_SSO_STORAGE_KEY = "user-store";
|
|
848
|
+
var DEFAULT_AUTH_LOGIN_ENV_KEY = "VITE_AUTH_LOGIN_URL";
|
|
849
|
+
var DEFAULT_AUTH_LOGIN_PATH = "/auth/#/login";
|
|
850
|
+
function getDefaultAuthLoginUrl() {
|
|
851
|
+
if (typeof window === "undefined") return "";
|
|
852
|
+
const origin = window.location.origin || "";
|
|
853
|
+
return `${origin}${DEFAULT_AUTH_LOGIN_PATH}`;
|
|
854
|
+
}
|
|
855
|
+
var AUTH_CONFIG = {
|
|
856
|
+
ssoStorageKey: DEFAULT_SSO_STORAGE_KEY,
|
|
857
|
+
authLoginEnvKey: DEFAULT_AUTH_LOGIN_ENV_KEY,
|
|
858
|
+
authLoginPath: DEFAULT_AUTH_LOGIN_PATH
|
|
859
|
+
};
|
|
821
860
|
export {
|
|
861
|
+
AUTH_CONFIG,
|
|
862
|
+
DEFAULT_AUTH_LOGIN_ENV_KEY,
|
|
863
|
+
DEFAULT_AUTH_LOGIN_PATH,
|
|
822
864
|
DEFAULT_HOME_PATH,
|
|
865
|
+
DEFAULT_SSO_STORAGE_KEY,
|
|
823
866
|
addTab,
|
|
824
867
|
applyTheme,
|
|
825
868
|
buildAllMenuTree,
|
|
@@ -831,6 +874,7 @@ export {
|
|
|
831
874
|
closeRight,
|
|
832
875
|
createAppRouter,
|
|
833
876
|
createAuthHttpClient,
|
|
877
|
+
createLoadingStoreOptions,
|
|
834
878
|
createLogoutToAuth,
|
|
835
879
|
createMenuHelper,
|
|
836
880
|
createPermissionHelper,
|
|
@@ -844,6 +888,7 @@ export {
|
|
|
844
888
|
formatToWanShou,
|
|
845
889
|
formatToYi,
|
|
846
890
|
formatWanYuanToYi,
|
|
891
|
+
getDefaultAuthLoginUrl,
|
|
847
892
|
getPresetRange,
|
|
848
893
|
humanizeTime,
|
|
849
894
|
initTheme,
|