com-angel-authorization 1.0.11 → 1.0.15
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/README.md +52 -3
- package/dist/index.cjs +131 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -5
- package/dist/index.d.ts +74 -5
- package/dist/index.js +124 -2
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +879 -20
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +88 -10
- package/dist/react/index.d.ts +88 -10
- package/dist/react/index.js +874 -19
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +1026 -26
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.cts +129 -16
- package/dist/vue/index.d.ts +129 -16
- package/dist/vue/index.js +1022 -24
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -26,12 +26,25 @@ interface PermissionChecker {
|
|
|
26
26
|
can(codes: PermissionCode | PermissionCode[], options?: CheckOptions): boolean;
|
|
27
27
|
getState(): PermissionState;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* 权限 store 的公共接口(不含 class private 字段)。
|
|
31
|
+
* 用于跨入口(主包 / react / vue)传参,避免重复打包后的名义类型冲突。
|
|
32
|
+
*/
|
|
33
|
+
interface PermissionStoreAPI extends PermissionChecker {
|
|
34
|
+
setState(next: Partial<PermissionState>): void;
|
|
35
|
+
setPermissions(permissions: PermissionCode[]): void;
|
|
36
|
+
setRoles(roles: RoleCode[]): void;
|
|
37
|
+
setSuperAdmin(isSuperAdmin: boolean): void;
|
|
38
|
+
hydrate(payload: Partial<PermissionState>): void;
|
|
39
|
+
clear(): void;
|
|
40
|
+
subscribe(listener: PermissionListener): () => void;
|
|
41
|
+
}
|
|
29
42
|
|
|
30
43
|
/**
|
|
31
44
|
* Mutable permission store shared by React / Vue adapters.
|
|
32
45
|
* Framework-agnostic — safe to use in Node, browser, or any UI lib.
|
|
33
46
|
*/
|
|
34
|
-
declare class PermissionStore implements
|
|
47
|
+
declare class PermissionStore implements PermissionStoreAPI {
|
|
35
48
|
private state;
|
|
36
49
|
private permissionSet;
|
|
37
50
|
private roleSet;
|
|
@@ -53,16 +66,16 @@ declare class PermissionStore implements PermissionChecker {
|
|
|
53
66
|
subscribe(listener: PermissionListener): () => void;
|
|
54
67
|
private emit;
|
|
55
68
|
}
|
|
56
|
-
declare function createPermissionStore(initial?: Partial<PermissionState>):
|
|
69
|
+
declare function createPermissionStore(initial?: Partial<PermissionState>): PermissionStoreAPI;
|
|
57
70
|
|
|
58
71
|
interface PermissionProviderProps {
|
|
59
72
|
children: ReactNode;
|
|
60
73
|
/** Pass an existing store to share across trees, or omit to create one. */
|
|
61
|
-
store?:
|
|
74
|
+
store?: PermissionStoreAPI;
|
|
62
75
|
/** Initial state when the provider creates its own store. */
|
|
63
76
|
initialState?: Partial<PermissionState>;
|
|
64
77
|
}
|
|
65
|
-
declare function PermissionProvider({ children, store: externalStore, initialState, }: PermissionProviderProps): react.FunctionComponentElement<react.ProviderProps<
|
|
78
|
+
declare function PermissionProvider({ children, store: externalStore, initialState, }: PermissionProviderProps): react.FunctionComponentElement<react.ProviderProps<PermissionStoreAPI | null>>;
|
|
66
79
|
interface UsePermissionResult {
|
|
67
80
|
permissions: PermissionCode[];
|
|
68
81
|
roles: RoleCode[];
|
|
@@ -75,7 +88,7 @@ interface UsePermissionResult {
|
|
|
75
88
|
setSuperAdmin: (isSuperAdmin: boolean) => void;
|
|
76
89
|
hydrate: (payload: Partial<PermissionState>) => void;
|
|
77
90
|
clear: () => void;
|
|
78
|
-
store:
|
|
91
|
+
store: PermissionStoreAPI;
|
|
79
92
|
}
|
|
80
93
|
declare function usePermission(): UsePermissionResult;
|
|
81
94
|
/** Returns whether the current user has the given permission(s). */
|
|
@@ -326,7 +339,71 @@ type MenuManagerProps = {
|
|
|
326
339
|
};
|
|
327
340
|
declare function MenuManager({ api, title, pageSize: initialPageSize, toolbarExtra, }: MenuManagerProps): react.JSX.Element;
|
|
328
341
|
|
|
329
|
-
type
|
|
342
|
+
type SystemRole = {
|
|
343
|
+
roleId: string;
|
|
344
|
+
name: string;
|
|
345
|
+
description: string;
|
|
346
|
+
};
|
|
347
|
+
type SystemRoleFormValues = {
|
|
348
|
+
name: string;
|
|
349
|
+
description: string;
|
|
350
|
+
};
|
|
351
|
+
type CreateSystemRoleBody = SystemRoleFormValues;
|
|
352
|
+
type UpdateSystemRoleBody = Partial<SystemRoleFormValues>;
|
|
353
|
+
type FetchSystemRolesParams = {
|
|
354
|
+
keyword?: string;
|
|
355
|
+
pagination?: ListPaginationParams;
|
|
356
|
+
};
|
|
357
|
+
type SystemRoleListResult = {
|
|
358
|
+
records: SystemRole[];
|
|
359
|
+
pageToken: string;
|
|
360
|
+
hasPreviousPage: boolean;
|
|
361
|
+
hasNextPage: boolean;
|
|
362
|
+
};
|
|
363
|
+
/** 角色授权树节点 */
|
|
364
|
+
type RolePermissionTreeNode = {
|
|
365
|
+
resourceId: string;
|
|
366
|
+
name: string;
|
|
367
|
+
children: RolePermissionTreeNode[];
|
|
368
|
+
};
|
|
369
|
+
/** GET /system/roles/{role-id}/permissions */
|
|
370
|
+
type RolePermissionsResult = {
|
|
371
|
+
/** 当前角色已授予的资源 ID,用于树回显勾选 */
|
|
372
|
+
resourceIds: string[];
|
|
373
|
+
resourceTree: RolePermissionTreeNode[];
|
|
374
|
+
};
|
|
375
|
+
/** POST /system/roles/{role-id}/permissions */
|
|
376
|
+
type SaveRolePermissionsBody = {
|
|
377
|
+
resourceIds: string[];
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
type SystemRoleApi = {
|
|
381
|
+
list: (params?: FetchSystemRolesParams, signal?: AbortSignal) => Promise<SystemRoleListResult>;
|
|
382
|
+
create: (values: SystemRoleFormValues, signal?: AbortSignal) => Promise<unknown>;
|
|
383
|
+
update: (roleId: string, values: SystemRoleFormValues, signal?: AbortSignal) => Promise<unknown>;
|
|
384
|
+
remove: (roleId: string, signal?: AbortSignal) => Promise<unknown>;
|
|
385
|
+
getPermissions: (roleId: string, signal?: AbortSignal) => Promise<RolePermissionsResult>;
|
|
386
|
+
savePermissions: (roleId: string, resourceIds: string[], signal?: AbortSignal) => Promise<unknown>;
|
|
387
|
+
};
|
|
388
|
+
declare function mapSystemRole(item: unknown): SystemRole | null;
|
|
389
|
+
declare function mapPermissionTreeNode(item: unknown): RolePermissionTreeNode | null;
|
|
390
|
+
declare function mapRolePermissions(payload: unknown): RolePermissionsResult;
|
|
391
|
+
/** 收集节点及其全部子孙 resourceId */
|
|
392
|
+
declare function collectTreeResourceIds(node: RolePermissionTreeNode): string[];
|
|
393
|
+
declare function buildCreateRoleBody(values: SystemRoleFormValues): CreateSystemRoleBody;
|
|
394
|
+
declare function buildUpdateRoleBody(values: SystemRoleFormValues): UpdateSystemRoleBody;
|
|
395
|
+
declare function buildSavePermissionsBody(resourceIds: string[]): SaveRolePermissionsBody;
|
|
396
|
+
declare function createSystemRoleApi(request: ResourceHttpRequest): SystemRoleApi;
|
|
397
|
+
|
|
398
|
+
type RoleManagerProps = {
|
|
399
|
+
api: SystemRoleApi;
|
|
400
|
+
title?: string;
|
|
401
|
+
pageSize?: string;
|
|
402
|
+
toolbarExtra?: ReactNode;
|
|
403
|
+
};
|
|
404
|
+
declare function RoleManager({ api, title, pageSize: initialPageSize, toolbarExtra, }: RoleManagerProps): react.JSX.Element;
|
|
405
|
+
|
|
406
|
+
type SystemAdminMenuKey = 'menu' | 'resource' | 'role';
|
|
330
407
|
type SystemAdminSubMenu = {
|
|
331
408
|
key: SystemAdminMenuKey;
|
|
332
409
|
label: string;
|
|
@@ -336,13 +413,14 @@ type SystemAdminMenuGroup = {
|
|
|
336
413
|
label: string;
|
|
337
414
|
children: SystemAdminSubMenu[];
|
|
338
415
|
};
|
|
339
|
-
/**
|
|
416
|
+
/** 系统管理菜单结构 */
|
|
340
417
|
declare const SYSTEM_ADMIN_MENU: SystemAdminMenuGroup;
|
|
341
418
|
declare const SYSTEM_ADMIN_DEFAULT_KEY: SystemAdminMenuKey;
|
|
342
419
|
|
|
343
420
|
type SystemAdminProps = {
|
|
344
421
|
menuApi: MenuResourceApi;
|
|
345
422
|
resourceApi: AuthorizationResourceApi;
|
|
423
|
+
roleApi: SystemRoleApi;
|
|
346
424
|
/** 默认选中的子菜单,默认菜单管理 */
|
|
347
425
|
defaultActiveKey?: SystemAdminMenuKey;
|
|
348
426
|
/** 受控选中 key */
|
|
@@ -352,9 +430,9 @@ type SystemAdminProps = {
|
|
|
352
430
|
toolbarExtra?: ReactNode;
|
|
353
431
|
};
|
|
354
432
|
/**
|
|
355
|
-
*
|
|
433
|
+
* 系统管理:侧栏父菜单「系统管理」,子菜单为菜单 / 权限点 / 角色管理。
|
|
356
434
|
*/
|
|
357
|
-
declare function SystemAdmin({ menuApi, resourceApi, defaultActiveKey, activeKey: controlledKey, onActiveKeyChange, title, toolbarExtra, }: SystemAdminProps): react.JSX.Element;
|
|
435
|
+
declare function SystemAdmin({ menuApi, resourceApi, roleApi, defaultActiveKey, activeKey: controlledKey, onActiveKeyChange, title, toolbarExtra, }: SystemAdminProps): react.JSX.Element;
|
|
358
436
|
|
|
359
437
|
interface SnowyflakeOptions {
|
|
360
438
|
epoch?: bigint;
|
|
@@ -386,4 +464,4 @@ declare const snowyflake: ConfigurableSnowflake;
|
|
|
386
464
|
declare function getAppClientId(): string;
|
|
387
465
|
declare function getDeviceWorkerId(): string;
|
|
388
466
|
|
|
389
|
-
export { type ApiResourceType, type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, type CanProps, type CheckOptions, type CreateAuthorizationResourceBody, type CreateDefaultResourceRequestOptions, type CreateMenuResourceBody, type FetchAuthorizationResourcesParams, type FetchMenuResourcesParams, type HttpMethod, type ListPaginationParams, type ListPaginationResult, MENU_LEAF_NO, MENU_LEAF_YES, MENU_LIST_TYPE_PARAM, MENU_TYPE_BUTTON, MENU_TYPE_LABEL, MENU_TYPE_MENU, MENU_TYPE_OPTIONS, MENU_TYPE_PAGE, MENU_VISIBILITY_OPTIONS, type MatchMode, MenuManager, type MenuManagerProps, type MenuResource, type MenuResourceApi, type MenuResourceFormValues, type MenuResourceListResult, type MenuResourceType, type PageDirection, type PermissionChecker, type PermissionCode, type PermissionListener, PermissionProvider, type PermissionProviderProps, type PermissionState, PermissionStore, RESOURCE_PRIVATE_OPTIONS, RESOURCE_STATUS_DISABLED, RESOURCE_STATUS_ENABLED, RESOURCE_STATUS_OPTIONS, RESOURCE_TYPE_API, ROOT_MENU_DEPTH, ROOT_PARENT_ID, type ResourceHttpRequest, ResourceManager, type ResourceManagerProps, type ResourceRequestOptions, type ResourceStatus, type ResourceType, type RoleCode, SYSTEM_ADMIN_DEFAULT_KEY, SYSTEM_ADMIN_MENU, SystemAdmin, type SystemAdminMenuGroup, type SystemAdminMenuKey, type SystemAdminProps, type SystemAdminSubMenu, type UpdateAuthorizationResourceBody, type UpdateMenuResourceBody, type UsePermissionResult, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildUpdateBody, buildUpdateMenuBody, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionStore, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, isMenuLeaf, mapAuthorizationResource, mapMenuResource, resolveMenuDepth, snowyflake, useHasPermission, useHasRole, usePermission };
|
|
467
|
+
export { type ApiResourceType, type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, type CanProps, type CheckOptions, type CreateAuthorizationResourceBody, type CreateDefaultResourceRequestOptions, type CreateMenuResourceBody, type CreateSystemRoleBody, type FetchAuthorizationResourcesParams, type FetchMenuResourcesParams, type FetchSystemRolesParams, type HttpMethod, type ListPaginationParams, type ListPaginationResult, MENU_LEAF_NO, MENU_LEAF_YES, MENU_LIST_TYPE_PARAM, MENU_TYPE_BUTTON, MENU_TYPE_LABEL, MENU_TYPE_MENU, MENU_TYPE_OPTIONS, MENU_TYPE_PAGE, MENU_VISIBILITY_OPTIONS, type MatchMode, MenuManager, type MenuManagerProps, type MenuResource, type MenuResourceApi, type MenuResourceFormValues, type MenuResourceListResult, type MenuResourceType, type PageDirection, type PermissionChecker, type PermissionCode, type PermissionListener, PermissionProvider, type PermissionProviderProps, type PermissionState, PermissionStore, type PermissionStoreAPI, RESOURCE_PRIVATE_OPTIONS, RESOURCE_STATUS_DISABLED, RESOURCE_STATUS_ENABLED, RESOURCE_STATUS_OPTIONS, RESOURCE_TYPE_API, ROOT_MENU_DEPTH, ROOT_PARENT_ID, type ResourceHttpRequest, ResourceManager, type ResourceManagerProps, type ResourceRequestOptions, type ResourceStatus, type ResourceType, type RoleCode, RoleManager, type RoleManagerProps, type RolePermissionTreeNode, type RolePermissionsResult, SYSTEM_ADMIN_DEFAULT_KEY, SYSTEM_ADMIN_MENU, type SaveRolePermissionsBody, SystemAdmin, type SystemAdminMenuGroup, type SystemAdminMenuKey, type SystemAdminProps, type SystemAdminSubMenu, type SystemRole, type SystemRoleApi, type SystemRoleFormValues, type SystemRoleListResult, type UpdateAuthorizationResourceBody, type UpdateMenuResourceBody, type UpdateSystemRoleBody, type UsePermissionResult, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildCreateRoleBody, buildSavePermissionsBody, buildUpdateBody, buildUpdateMenuBody, buildUpdateRoleBody, collectTreeResourceIds, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionStore, createSystemRoleApi, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, isMenuLeaf, mapAuthorizationResource, mapMenuResource, mapPermissionTreeNode, mapRolePermissions, mapSystemRole, resolveMenuDepth, snowyflake, useHasPermission, useHasRole, usePermission };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -26,12 +26,25 @@ interface PermissionChecker {
|
|
|
26
26
|
can(codes: PermissionCode | PermissionCode[], options?: CheckOptions): boolean;
|
|
27
27
|
getState(): PermissionState;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* 权限 store 的公共接口(不含 class private 字段)。
|
|
31
|
+
* 用于跨入口(主包 / react / vue)传参,避免重复打包后的名义类型冲突。
|
|
32
|
+
*/
|
|
33
|
+
interface PermissionStoreAPI extends PermissionChecker {
|
|
34
|
+
setState(next: Partial<PermissionState>): void;
|
|
35
|
+
setPermissions(permissions: PermissionCode[]): void;
|
|
36
|
+
setRoles(roles: RoleCode[]): void;
|
|
37
|
+
setSuperAdmin(isSuperAdmin: boolean): void;
|
|
38
|
+
hydrate(payload: Partial<PermissionState>): void;
|
|
39
|
+
clear(): void;
|
|
40
|
+
subscribe(listener: PermissionListener): () => void;
|
|
41
|
+
}
|
|
29
42
|
|
|
30
43
|
/**
|
|
31
44
|
* Mutable permission store shared by React / Vue adapters.
|
|
32
45
|
* Framework-agnostic — safe to use in Node, browser, or any UI lib.
|
|
33
46
|
*/
|
|
34
|
-
declare class PermissionStore implements
|
|
47
|
+
declare class PermissionStore implements PermissionStoreAPI {
|
|
35
48
|
private state;
|
|
36
49
|
private permissionSet;
|
|
37
50
|
private roleSet;
|
|
@@ -53,16 +66,16 @@ declare class PermissionStore implements PermissionChecker {
|
|
|
53
66
|
subscribe(listener: PermissionListener): () => void;
|
|
54
67
|
private emit;
|
|
55
68
|
}
|
|
56
|
-
declare function createPermissionStore(initial?: Partial<PermissionState>):
|
|
69
|
+
declare function createPermissionStore(initial?: Partial<PermissionState>): PermissionStoreAPI;
|
|
57
70
|
|
|
58
71
|
interface PermissionProviderProps {
|
|
59
72
|
children: ReactNode;
|
|
60
73
|
/** Pass an existing store to share across trees, or omit to create one. */
|
|
61
|
-
store?:
|
|
74
|
+
store?: PermissionStoreAPI;
|
|
62
75
|
/** Initial state when the provider creates its own store. */
|
|
63
76
|
initialState?: Partial<PermissionState>;
|
|
64
77
|
}
|
|
65
|
-
declare function PermissionProvider({ children, store: externalStore, initialState, }: PermissionProviderProps): react.FunctionComponentElement<react.ProviderProps<
|
|
78
|
+
declare function PermissionProvider({ children, store: externalStore, initialState, }: PermissionProviderProps): react.FunctionComponentElement<react.ProviderProps<PermissionStoreAPI | null>>;
|
|
66
79
|
interface UsePermissionResult {
|
|
67
80
|
permissions: PermissionCode[];
|
|
68
81
|
roles: RoleCode[];
|
|
@@ -75,7 +88,7 @@ interface UsePermissionResult {
|
|
|
75
88
|
setSuperAdmin: (isSuperAdmin: boolean) => void;
|
|
76
89
|
hydrate: (payload: Partial<PermissionState>) => void;
|
|
77
90
|
clear: () => void;
|
|
78
|
-
store:
|
|
91
|
+
store: PermissionStoreAPI;
|
|
79
92
|
}
|
|
80
93
|
declare function usePermission(): UsePermissionResult;
|
|
81
94
|
/** Returns whether the current user has the given permission(s). */
|
|
@@ -326,7 +339,71 @@ type MenuManagerProps = {
|
|
|
326
339
|
};
|
|
327
340
|
declare function MenuManager({ api, title, pageSize: initialPageSize, toolbarExtra, }: MenuManagerProps): react.JSX.Element;
|
|
328
341
|
|
|
329
|
-
type
|
|
342
|
+
type SystemRole = {
|
|
343
|
+
roleId: string;
|
|
344
|
+
name: string;
|
|
345
|
+
description: string;
|
|
346
|
+
};
|
|
347
|
+
type SystemRoleFormValues = {
|
|
348
|
+
name: string;
|
|
349
|
+
description: string;
|
|
350
|
+
};
|
|
351
|
+
type CreateSystemRoleBody = SystemRoleFormValues;
|
|
352
|
+
type UpdateSystemRoleBody = Partial<SystemRoleFormValues>;
|
|
353
|
+
type FetchSystemRolesParams = {
|
|
354
|
+
keyword?: string;
|
|
355
|
+
pagination?: ListPaginationParams;
|
|
356
|
+
};
|
|
357
|
+
type SystemRoleListResult = {
|
|
358
|
+
records: SystemRole[];
|
|
359
|
+
pageToken: string;
|
|
360
|
+
hasPreviousPage: boolean;
|
|
361
|
+
hasNextPage: boolean;
|
|
362
|
+
};
|
|
363
|
+
/** 角色授权树节点 */
|
|
364
|
+
type RolePermissionTreeNode = {
|
|
365
|
+
resourceId: string;
|
|
366
|
+
name: string;
|
|
367
|
+
children: RolePermissionTreeNode[];
|
|
368
|
+
};
|
|
369
|
+
/** GET /system/roles/{role-id}/permissions */
|
|
370
|
+
type RolePermissionsResult = {
|
|
371
|
+
/** 当前角色已授予的资源 ID,用于树回显勾选 */
|
|
372
|
+
resourceIds: string[];
|
|
373
|
+
resourceTree: RolePermissionTreeNode[];
|
|
374
|
+
};
|
|
375
|
+
/** POST /system/roles/{role-id}/permissions */
|
|
376
|
+
type SaveRolePermissionsBody = {
|
|
377
|
+
resourceIds: string[];
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
type SystemRoleApi = {
|
|
381
|
+
list: (params?: FetchSystemRolesParams, signal?: AbortSignal) => Promise<SystemRoleListResult>;
|
|
382
|
+
create: (values: SystemRoleFormValues, signal?: AbortSignal) => Promise<unknown>;
|
|
383
|
+
update: (roleId: string, values: SystemRoleFormValues, signal?: AbortSignal) => Promise<unknown>;
|
|
384
|
+
remove: (roleId: string, signal?: AbortSignal) => Promise<unknown>;
|
|
385
|
+
getPermissions: (roleId: string, signal?: AbortSignal) => Promise<RolePermissionsResult>;
|
|
386
|
+
savePermissions: (roleId: string, resourceIds: string[], signal?: AbortSignal) => Promise<unknown>;
|
|
387
|
+
};
|
|
388
|
+
declare function mapSystemRole(item: unknown): SystemRole | null;
|
|
389
|
+
declare function mapPermissionTreeNode(item: unknown): RolePermissionTreeNode | null;
|
|
390
|
+
declare function mapRolePermissions(payload: unknown): RolePermissionsResult;
|
|
391
|
+
/** 收集节点及其全部子孙 resourceId */
|
|
392
|
+
declare function collectTreeResourceIds(node: RolePermissionTreeNode): string[];
|
|
393
|
+
declare function buildCreateRoleBody(values: SystemRoleFormValues): CreateSystemRoleBody;
|
|
394
|
+
declare function buildUpdateRoleBody(values: SystemRoleFormValues): UpdateSystemRoleBody;
|
|
395
|
+
declare function buildSavePermissionsBody(resourceIds: string[]): SaveRolePermissionsBody;
|
|
396
|
+
declare function createSystemRoleApi(request: ResourceHttpRequest): SystemRoleApi;
|
|
397
|
+
|
|
398
|
+
type RoleManagerProps = {
|
|
399
|
+
api: SystemRoleApi;
|
|
400
|
+
title?: string;
|
|
401
|
+
pageSize?: string;
|
|
402
|
+
toolbarExtra?: ReactNode;
|
|
403
|
+
};
|
|
404
|
+
declare function RoleManager({ api, title, pageSize: initialPageSize, toolbarExtra, }: RoleManagerProps): react.JSX.Element;
|
|
405
|
+
|
|
406
|
+
type SystemAdminMenuKey = 'menu' | 'resource' | 'role';
|
|
330
407
|
type SystemAdminSubMenu = {
|
|
331
408
|
key: SystemAdminMenuKey;
|
|
332
409
|
label: string;
|
|
@@ -336,13 +413,14 @@ type SystemAdminMenuGroup = {
|
|
|
336
413
|
label: string;
|
|
337
414
|
children: SystemAdminSubMenu[];
|
|
338
415
|
};
|
|
339
|
-
/**
|
|
416
|
+
/** 系统管理菜单结构 */
|
|
340
417
|
declare const SYSTEM_ADMIN_MENU: SystemAdminMenuGroup;
|
|
341
418
|
declare const SYSTEM_ADMIN_DEFAULT_KEY: SystemAdminMenuKey;
|
|
342
419
|
|
|
343
420
|
type SystemAdminProps = {
|
|
344
421
|
menuApi: MenuResourceApi;
|
|
345
422
|
resourceApi: AuthorizationResourceApi;
|
|
423
|
+
roleApi: SystemRoleApi;
|
|
346
424
|
/** 默认选中的子菜单,默认菜单管理 */
|
|
347
425
|
defaultActiveKey?: SystemAdminMenuKey;
|
|
348
426
|
/** 受控选中 key */
|
|
@@ -352,9 +430,9 @@ type SystemAdminProps = {
|
|
|
352
430
|
toolbarExtra?: ReactNode;
|
|
353
431
|
};
|
|
354
432
|
/**
|
|
355
|
-
*
|
|
433
|
+
* 系统管理:侧栏父菜单「系统管理」,子菜单为菜单 / 权限点 / 角色管理。
|
|
356
434
|
*/
|
|
357
|
-
declare function SystemAdmin({ menuApi, resourceApi, defaultActiveKey, activeKey: controlledKey, onActiveKeyChange, title, toolbarExtra, }: SystemAdminProps): react.JSX.Element;
|
|
435
|
+
declare function SystemAdmin({ menuApi, resourceApi, roleApi, defaultActiveKey, activeKey: controlledKey, onActiveKeyChange, title, toolbarExtra, }: SystemAdminProps): react.JSX.Element;
|
|
358
436
|
|
|
359
437
|
interface SnowyflakeOptions {
|
|
360
438
|
epoch?: bigint;
|
|
@@ -386,4 +464,4 @@ declare const snowyflake: ConfigurableSnowflake;
|
|
|
386
464
|
declare function getAppClientId(): string;
|
|
387
465
|
declare function getDeviceWorkerId(): string;
|
|
388
466
|
|
|
389
|
-
export { type ApiResourceType, type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, type CanProps, type CheckOptions, type CreateAuthorizationResourceBody, type CreateDefaultResourceRequestOptions, type CreateMenuResourceBody, type FetchAuthorizationResourcesParams, type FetchMenuResourcesParams, type HttpMethod, type ListPaginationParams, type ListPaginationResult, MENU_LEAF_NO, MENU_LEAF_YES, MENU_LIST_TYPE_PARAM, MENU_TYPE_BUTTON, MENU_TYPE_LABEL, MENU_TYPE_MENU, MENU_TYPE_OPTIONS, MENU_TYPE_PAGE, MENU_VISIBILITY_OPTIONS, type MatchMode, MenuManager, type MenuManagerProps, type MenuResource, type MenuResourceApi, type MenuResourceFormValues, type MenuResourceListResult, type MenuResourceType, type PageDirection, type PermissionChecker, type PermissionCode, type PermissionListener, PermissionProvider, type PermissionProviderProps, type PermissionState, PermissionStore, RESOURCE_PRIVATE_OPTIONS, RESOURCE_STATUS_DISABLED, RESOURCE_STATUS_ENABLED, RESOURCE_STATUS_OPTIONS, RESOURCE_TYPE_API, ROOT_MENU_DEPTH, ROOT_PARENT_ID, type ResourceHttpRequest, ResourceManager, type ResourceManagerProps, type ResourceRequestOptions, type ResourceStatus, type ResourceType, type RoleCode, SYSTEM_ADMIN_DEFAULT_KEY, SYSTEM_ADMIN_MENU, SystemAdmin, type SystemAdminMenuGroup, type SystemAdminMenuKey, type SystemAdminProps, type SystemAdminSubMenu, type UpdateAuthorizationResourceBody, type UpdateMenuResourceBody, type UsePermissionResult, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildUpdateBody, buildUpdateMenuBody, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionStore, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, isMenuLeaf, mapAuthorizationResource, mapMenuResource, resolveMenuDepth, snowyflake, useHasPermission, useHasRole, usePermission };
|
|
467
|
+
export { type ApiResourceType, type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, type CanProps, type CheckOptions, type CreateAuthorizationResourceBody, type CreateDefaultResourceRequestOptions, type CreateMenuResourceBody, type CreateSystemRoleBody, type FetchAuthorizationResourcesParams, type FetchMenuResourcesParams, type FetchSystemRolesParams, type HttpMethod, type ListPaginationParams, type ListPaginationResult, MENU_LEAF_NO, MENU_LEAF_YES, MENU_LIST_TYPE_PARAM, MENU_TYPE_BUTTON, MENU_TYPE_LABEL, MENU_TYPE_MENU, MENU_TYPE_OPTIONS, MENU_TYPE_PAGE, MENU_VISIBILITY_OPTIONS, type MatchMode, MenuManager, type MenuManagerProps, type MenuResource, type MenuResourceApi, type MenuResourceFormValues, type MenuResourceListResult, type MenuResourceType, type PageDirection, type PermissionChecker, type PermissionCode, type PermissionListener, PermissionProvider, type PermissionProviderProps, type PermissionState, PermissionStore, type PermissionStoreAPI, RESOURCE_PRIVATE_OPTIONS, RESOURCE_STATUS_DISABLED, RESOURCE_STATUS_ENABLED, RESOURCE_STATUS_OPTIONS, RESOURCE_TYPE_API, ROOT_MENU_DEPTH, ROOT_PARENT_ID, type ResourceHttpRequest, ResourceManager, type ResourceManagerProps, type ResourceRequestOptions, type ResourceStatus, type ResourceType, type RoleCode, RoleManager, type RoleManagerProps, type RolePermissionTreeNode, type RolePermissionsResult, SYSTEM_ADMIN_DEFAULT_KEY, SYSTEM_ADMIN_MENU, type SaveRolePermissionsBody, SystemAdmin, type SystemAdminMenuGroup, type SystemAdminMenuKey, type SystemAdminProps, type SystemAdminSubMenu, type SystemRole, type SystemRoleApi, type SystemRoleFormValues, type SystemRoleListResult, type UpdateAuthorizationResourceBody, type UpdateMenuResourceBody, type UpdateSystemRoleBody, type UsePermissionResult, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildCreateRoleBody, buildSavePermissionsBody, buildUpdateBody, buildUpdateMenuBody, buildUpdateRoleBody, collectTreeResourceIds, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionStore, createSystemRoleApi, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, isMenuLeaf, mapAuthorizationResource, mapMenuResource, mapPermissionTreeNode, mapRolePermissions, mapSystemRole, resolveMenuDepth, snowyflake, useHasPermission, useHasRole, usePermission };
|