@spacego/fe-components 0.0.5 → 0.0.7
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/lib/config/constants.js +0 -1
- package/lib/fe-layouts/auth-layout/index.js +40 -37
- package/lib/fe-layouts/basics-layout/components/basics-layout/header.js +3 -3
- package/lib/fe-layouts/basics-layout/components/basics-layout/sidebar.js +27 -25
- package/lib/fe-layouts/basics-layout/index.js +56 -54
- package/lib/fe-layouts/context/global-context.provider.js +25 -30
- package/lib/fe-layouts/layout.js +13 -11
- package/lib/hooks/use-auth.hook.js +7 -7
- package/lib/hooks/use-nprogress.hook.js +15 -0
- package/lib/index.css +1 -1
- package/lib/index.js +36 -40
- package/lib/router/index.js +4 -48
- package/lib/store/modules/layout-config.store.js +11 -9
- package/lib/store/modules/theme.store.js +20 -18
- package/lib/types/config/constants.d.ts +0 -1
- package/lib/types/fe-layouts/context/global-context.d.ts +6 -10
- package/lib/types/hooks/index.d.ts +1 -0
- package/lib/types/hooks/use-nprogress.hook.d.ts +4 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/router/index.d.ts +1 -33
- package/package.json +5 -5
- package/lib/router/permission.js +0 -43
- package/lib/router/routes.js +0 -57
- package/lib/types/router/permission.d.ts +0 -23
- package/lib/types/router/routes.d.ts +0 -11
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { LoaderFunctionArgs } from 'react-router-dom';
|
|
2
|
-
export type AuthStatus = {
|
|
3
|
-
token: string | void | null;
|
|
4
|
-
};
|
|
5
|
-
export interface TokenHelpers {
|
|
6
|
-
/** 获取token */
|
|
7
|
-
getToken: () => string | void | null;
|
|
8
|
-
/** 设置token */
|
|
9
|
-
setToken: (token: string) => void;
|
|
10
|
-
/** 移除token */
|
|
11
|
-
removeToken: () => void;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 创建权限相关的 loader 和 action
|
|
15
|
-
* @param tokenHelpers token 操作方法
|
|
16
|
-
*/
|
|
17
|
-
export declare function createPermissionHelpers(tokenHelpers: TokenHelpers): {
|
|
18
|
-
RootLoader: () => AuthStatus;
|
|
19
|
-
ProtectedLoader: ({ request }: LoaderFunctionArgs) => Response | null;
|
|
20
|
-
LoginLoader: () => Promise<Response | null>;
|
|
21
|
-
LoginAction: ({ request }: LoaderFunctionArgs) => Promise<Response | null>;
|
|
22
|
-
LogoutAction: () => Response;
|
|
23
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
|
-
import { RouteObject } from 'react-router-dom';
|
|
3
|
-
import { createPermissionHelpers } from './permission';
|
|
4
|
-
import { TModule } from './utils';
|
|
5
|
-
/**
|
|
6
|
-
* 创建默认路由表
|
|
7
|
-
* @param modules 页面模块集合
|
|
8
|
-
* @param permissionHelpers 权限相关的 loader 和 action
|
|
9
|
-
* @param BaseLayout 基础布局组件
|
|
10
|
-
*/
|
|
11
|
-
export declare function createDefaultRoutes(modules: TModule, permissionHelpers: ReturnType<typeof createPermissionHelpers>, BaseLayout: ComponentType<any>): RouteObject[];
|