com-angel-authorization 1.0.16 → 1.0.18
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 +58 -4
- package/dist/index.cjs +243 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -2
- package/dist/index.d.ts +106 -2
- package/dist/index.js +232 -2
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +1041 -75
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +117 -4
- package/dist/react/index.d.ts +117 -4
- package/dist/react/index.js +1029 -72
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +1234 -114
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.cts +151 -3
- package/dist/vue/index.d.ts +151 -3
- package/dist/vue/index.js +1224 -110
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -390,6 +390,27 @@ declare function mapPermissionTreeNode(item: unknown): RolePermissionTreeNode |
|
|
|
390
390
|
declare function mapRolePermissions(payload: unknown): RolePermissionsResult;
|
|
391
391
|
/** 收集节点及其全部子孙 resourceId */
|
|
392
392
|
declare function collectTreeResourceIds(node: RolePermissionTreeNode): string[];
|
|
393
|
+
type PermissionTreeIndex = {
|
|
394
|
+
parentMap: Map<string, string | null>;
|
|
395
|
+
nodeMap: Map<string, RolePermissionTreeNode>;
|
|
396
|
+
};
|
|
397
|
+
/** 建立父节点索引,供父子联动向上回写 */
|
|
398
|
+
declare function buildPermissionTreeIndex(tree: RolePermissionTreeNode[]): PermissionTreeIndex;
|
|
399
|
+
/**
|
|
400
|
+
* 父子联动勾选:
|
|
401
|
+
* - 勾选:当前节点 + 全部子孙选中,并向上:子节点全选则父节点选中
|
|
402
|
+
* - 取消:当前节点 + 全部子孙取消,并向上:任一子未选则父节点取消(半选由 UI 展示)
|
|
403
|
+
*/
|
|
404
|
+
declare function togglePermissionCheck(tree: RolePermissionTreeNode[], checked: ReadonlySet<string>, node: RolePermissionTreeNode): Set<string>;
|
|
405
|
+
/** 子孙勾选统计(不含自身),用于半选态 */
|
|
406
|
+
declare function countCheckedDescendants(node: RolePermissionTreeNode, checked: ReadonlySet<string>): {
|
|
407
|
+
total: number;
|
|
408
|
+
checkedCount: number;
|
|
409
|
+
};
|
|
410
|
+
/** 是否存在已勾选的子孙节点 */
|
|
411
|
+
declare function hasCheckedDescendant(node: RolePermissionTreeNode, checked: ReadonlySet<string>): boolean;
|
|
412
|
+
/** 半选:自身未勾选,但存在已勾选的子孙 */
|
|
413
|
+
declare function isPermissionNodeIndeterminate(node: RolePermissionTreeNode, checked: ReadonlySet<string>): boolean;
|
|
393
414
|
declare function buildCreateRoleBody(values: SystemRoleFormValues): CreateSystemRoleBody;
|
|
394
415
|
declare function buildUpdateRoleBody(values: SystemRoleFormValues): UpdateSystemRoleBody;
|
|
395
416
|
declare function buildSavePermissionsBody(resourceIds: string[]): SaveRolePermissionsBody;
|
|
@@ -403,7 +424,98 @@ type RoleManagerProps = {
|
|
|
403
424
|
};
|
|
404
425
|
declare function RoleManager({ api, title, pageSize: initialPageSize, toolbarExtra, }: RoleManagerProps): react.JSX.Element;
|
|
405
426
|
|
|
406
|
-
type
|
|
427
|
+
type SystemGroupOption = {
|
|
428
|
+
groupId: string;
|
|
429
|
+
name: string;
|
|
430
|
+
};
|
|
431
|
+
type SystemRoleOption = {
|
|
432
|
+
roleId: string;
|
|
433
|
+
name: string;
|
|
434
|
+
};
|
|
435
|
+
type SystemUser = {
|
|
436
|
+
userId: string;
|
|
437
|
+
username: string;
|
|
438
|
+
name: string;
|
|
439
|
+
groupIds: string[];
|
|
440
|
+
roleIds: string[];
|
|
441
|
+
/** 列表展示用,接口若返回则优先使用 */
|
|
442
|
+
groupNames?: string[];
|
|
443
|
+
roleNames?: string[];
|
|
444
|
+
enabled: boolean;
|
|
445
|
+
};
|
|
446
|
+
type SystemUserFormValues = {
|
|
447
|
+
username: string;
|
|
448
|
+
name: string;
|
|
449
|
+
/** 新增必填;编辑时可留空表示不修改 */
|
|
450
|
+
password: string;
|
|
451
|
+
groupIds: string[];
|
|
452
|
+
roleIds: string[];
|
|
453
|
+
enabled: boolean;
|
|
454
|
+
};
|
|
455
|
+
type CreateSystemUserBody = {
|
|
456
|
+
username: string;
|
|
457
|
+
name: string;
|
|
458
|
+
password: string;
|
|
459
|
+
groupIds: string[];
|
|
460
|
+
roleIds: string[];
|
|
461
|
+
enabled: boolean;
|
|
462
|
+
};
|
|
463
|
+
type UpdateSystemUserBody = {
|
|
464
|
+
username: string;
|
|
465
|
+
name: string;
|
|
466
|
+
password?: string;
|
|
467
|
+
groupIds: string[];
|
|
468
|
+
roleIds: string[];
|
|
469
|
+
enabled: boolean;
|
|
470
|
+
};
|
|
471
|
+
type FetchSystemUsersParams = {
|
|
472
|
+
keyword?: string;
|
|
473
|
+
/** undefined 表示不过滤 */
|
|
474
|
+
enabled?: boolean;
|
|
475
|
+
pagination?: ListPaginationParams;
|
|
476
|
+
};
|
|
477
|
+
type SystemUserListResult = {
|
|
478
|
+
records: SystemUser[];
|
|
479
|
+
pageToken: string;
|
|
480
|
+
hasPreviousPage: boolean;
|
|
481
|
+
hasNextPage: boolean;
|
|
482
|
+
};
|
|
483
|
+
type FetchSystemGroupsParams = {
|
|
484
|
+
keyword?: string;
|
|
485
|
+
};
|
|
486
|
+
type FetchSystemRoleOptionsParams = {
|
|
487
|
+
keyword?: string;
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
type SystemUserApi = {
|
|
491
|
+
list: (params?: FetchSystemUsersParams, signal?: AbortSignal) => Promise<SystemUserListResult>;
|
|
492
|
+
create: (values: SystemUserFormValues, signal?: AbortSignal) => Promise<unknown>;
|
|
493
|
+
update: (userId: string, values: SystemUserFormValues, signal?: AbortSignal) => Promise<unknown>;
|
|
494
|
+
remove: (userId: string, signal?: AbortSignal) => Promise<unknown>;
|
|
495
|
+
listGroups: (params?: FetchSystemGroupsParams, signal?: AbortSignal) => Promise<SystemGroupOption[]>;
|
|
496
|
+
listRoleOptions: (params?: FetchSystemRoleOptionsParams, signal?: AbortSignal) => Promise<SystemRoleOption[]>;
|
|
497
|
+
};
|
|
498
|
+
declare function mapSystemUser(item: unknown): SystemUser | null;
|
|
499
|
+
declare function mapSystemGroupOption(item: unknown): SystemGroupOption | null;
|
|
500
|
+
declare function mapSystemRoleOption(item: unknown): SystemRoleOption | null;
|
|
501
|
+
/**
|
|
502
|
+
* 账号校验:不少于 6 位,且同时包含字母与数字。
|
|
503
|
+
* 通过返回 null,失败返回错误文案。
|
|
504
|
+
*/
|
|
505
|
+
declare function validateUsername(username: string): string | null;
|
|
506
|
+
declare function buildCreateUserBody(values: SystemUserFormValues): CreateSystemUserBody;
|
|
507
|
+
declare function buildUpdateUserBody(values: SystemUserFormValues): UpdateSystemUserBody;
|
|
508
|
+
declare function createSystemUserApi(request: ResourceHttpRequest): SystemUserApi;
|
|
509
|
+
|
|
510
|
+
type UserManagerProps = {
|
|
511
|
+
api: SystemUserApi;
|
|
512
|
+
title?: string;
|
|
513
|
+
pageSize?: string;
|
|
514
|
+
toolbarExtra?: ReactNode;
|
|
515
|
+
};
|
|
516
|
+
declare function UserManager({ api, title, pageSize: initialPageSize, toolbarExtra, }: UserManagerProps): react.JSX.Element;
|
|
517
|
+
|
|
518
|
+
type SystemAdminMenuKey = 'menu' | 'resource' | 'role' | 'user';
|
|
407
519
|
type SystemAdminSubMenu = {
|
|
408
520
|
key: SystemAdminMenuKey;
|
|
409
521
|
label: string;
|
|
@@ -421,6 +533,7 @@ type SystemAdminProps = {
|
|
|
421
533
|
menuApi: MenuResourceApi;
|
|
422
534
|
resourceApi: AuthorizationResourceApi;
|
|
423
535
|
roleApi: SystemRoleApi;
|
|
536
|
+
userApi: SystemUserApi;
|
|
424
537
|
/** 默认选中的子菜单,默认菜单管理 */
|
|
425
538
|
defaultActiveKey?: SystemAdminMenuKey;
|
|
426
539
|
/** 受控选中 key */
|
|
@@ -430,9 +543,9 @@ type SystemAdminProps = {
|
|
|
430
543
|
toolbarExtra?: ReactNode;
|
|
431
544
|
};
|
|
432
545
|
/**
|
|
433
|
-
* 系统管理:侧栏父菜单「系统管理」,子菜单为菜单 / 权限点 /
|
|
546
|
+
* 系统管理:侧栏父菜单「系统管理」,子菜单为菜单 / 权限点 / 角色 / 用户管理。
|
|
434
547
|
*/
|
|
435
|
-
declare function SystemAdmin({ menuApi, resourceApi, roleApi, defaultActiveKey, activeKey: controlledKey, onActiveKeyChange, title, toolbarExtra, }: SystemAdminProps): react.JSX.Element;
|
|
548
|
+
declare function SystemAdmin({ menuApi, resourceApi, roleApi, userApi, defaultActiveKey, activeKey: controlledKey, onActiveKeyChange, title, toolbarExtra, }: SystemAdminProps): react.JSX.Element;
|
|
436
549
|
|
|
437
550
|
interface SnowyflakeOptions {
|
|
438
551
|
epoch?: bigint;
|
|
@@ -464,4 +577,4 @@ declare const snowyflake: ConfigurableSnowflake;
|
|
|
464
577
|
declare function getAppClientId(): string;
|
|
465
578
|
declare function getDeviceWorkerId(): string;
|
|
466
579
|
|
|
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 };
|
|
580
|
+
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 CreateSystemUserBody, type FetchAuthorizationResourcesParams, type FetchMenuResourcesParams, type FetchSystemGroupsParams, type FetchSystemRoleOptionsParams, type FetchSystemRolesParams, type FetchSystemUsersParams, 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 SystemGroupOption, type SystemRole, type SystemRoleApi, type SystemRoleFormValues, type SystemRoleListResult, type SystemRoleOption, type SystemUser, type SystemUserApi, type SystemUserFormValues, type SystemUserListResult, type UpdateAuthorizationResourceBody, type UpdateMenuResourceBody, type UpdateSystemRoleBody, type UpdateSystemUserBody, type UsePermissionResult, UserManager, type UserManagerProps, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildCreateRoleBody, buildCreateUserBody, buildPermissionTreeIndex, buildSavePermissionsBody, buildUpdateBody, buildUpdateMenuBody, buildUpdateRoleBody, buildUpdateUserBody, collectTreeResourceIds, countCheckedDescendants, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionStore, createSystemRoleApi, createSystemUserApi, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, hasCheckedDescendant, isMenuLeaf, isPermissionNodeIndeterminate, mapAuthorizationResource, mapMenuResource, mapPermissionTreeNode, mapRolePermissions, mapSystemGroupOption, mapSystemRole, mapSystemRoleOption, mapSystemUser, resolveMenuDepth, snowyflake, togglePermissionCheck, useHasPermission, useHasRole, usePermission, validateUsername };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -390,6 +390,27 @@ declare function mapPermissionTreeNode(item: unknown): RolePermissionTreeNode |
|
|
|
390
390
|
declare function mapRolePermissions(payload: unknown): RolePermissionsResult;
|
|
391
391
|
/** 收集节点及其全部子孙 resourceId */
|
|
392
392
|
declare function collectTreeResourceIds(node: RolePermissionTreeNode): string[];
|
|
393
|
+
type PermissionTreeIndex = {
|
|
394
|
+
parentMap: Map<string, string | null>;
|
|
395
|
+
nodeMap: Map<string, RolePermissionTreeNode>;
|
|
396
|
+
};
|
|
397
|
+
/** 建立父节点索引,供父子联动向上回写 */
|
|
398
|
+
declare function buildPermissionTreeIndex(tree: RolePermissionTreeNode[]): PermissionTreeIndex;
|
|
399
|
+
/**
|
|
400
|
+
* 父子联动勾选:
|
|
401
|
+
* - 勾选:当前节点 + 全部子孙选中,并向上:子节点全选则父节点选中
|
|
402
|
+
* - 取消:当前节点 + 全部子孙取消,并向上:任一子未选则父节点取消(半选由 UI 展示)
|
|
403
|
+
*/
|
|
404
|
+
declare function togglePermissionCheck(tree: RolePermissionTreeNode[], checked: ReadonlySet<string>, node: RolePermissionTreeNode): Set<string>;
|
|
405
|
+
/** 子孙勾选统计(不含自身),用于半选态 */
|
|
406
|
+
declare function countCheckedDescendants(node: RolePermissionTreeNode, checked: ReadonlySet<string>): {
|
|
407
|
+
total: number;
|
|
408
|
+
checkedCount: number;
|
|
409
|
+
};
|
|
410
|
+
/** 是否存在已勾选的子孙节点 */
|
|
411
|
+
declare function hasCheckedDescendant(node: RolePermissionTreeNode, checked: ReadonlySet<string>): boolean;
|
|
412
|
+
/** 半选:自身未勾选,但存在已勾选的子孙 */
|
|
413
|
+
declare function isPermissionNodeIndeterminate(node: RolePermissionTreeNode, checked: ReadonlySet<string>): boolean;
|
|
393
414
|
declare function buildCreateRoleBody(values: SystemRoleFormValues): CreateSystemRoleBody;
|
|
394
415
|
declare function buildUpdateRoleBody(values: SystemRoleFormValues): UpdateSystemRoleBody;
|
|
395
416
|
declare function buildSavePermissionsBody(resourceIds: string[]): SaveRolePermissionsBody;
|
|
@@ -403,7 +424,98 @@ type RoleManagerProps = {
|
|
|
403
424
|
};
|
|
404
425
|
declare function RoleManager({ api, title, pageSize: initialPageSize, toolbarExtra, }: RoleManagerProps): react.JSX.Element;
|
|
405
426
|
|
|
406
|
-
type
|
|
427
|
+
type SystemGroupOption = {
|
|
428
|
+
groupId: string;
|
|
429
|
+
name: string;
|
|
430
|
+
};
|
|
431
|
+
type SystemRoleOption = {
|
|
432
|
+
roleId: string;
|
|
433
|
+
name: string;
|
|
434
|
+
};
|
|
435
|
+
type SystemUser = {
|
|
436
|
+
userId: string;
|
|
437
|
+
username: string;
|
|
438
|
+
name: string;
|
|
439
|
+
groupIds: string[];
|
|
440
|
+
roleIds: string[];
|
|
441
|
+
/** 列表展示用,接口若返回则优先使用 */
|
|
442
|
+
groupNames?: string[];
|
|
443
|
+
roleNames?: string[];
|
|
444
|
+
enabled: boolean;
|
|
445
|
+
};
|
|
446
|
+
type SystemUserFormValues = {
|
|
447
|
+
username: string;
|
|
448
|
+
name: string;
|
|
449
|
+
/** 新增必填;编辑时可留空表示不修改 */
|
|
450
|
+
password: string;
|
|
451
|
+
groupIds: string[];
|
|
452
|
+
roleIds: string[];
|
|
453
|
+
enabled: boolean;
|
|
454
|
+
};
|
|
455
|
+
type CreateSystemUserBody = {
|
|
456
|
+
username: string;
|
|
457
|
+
name: string;
|
|
458
|
+
password: string;
|
|
459
|
+
groupIds: string[];
|
|
460
|
+
roleIds: string[];
|
|
461
|
+
enabled: boolean;
|
|
462
|
+
};
|
|
463
|
+
type UpdateSystemUserBody = {
|
|
464
|
+
username: string;
|
|
465
|
+
name: string;
|
|
466
|
+
password?: string;
|
|
467
|
+
groupIds: string[];
|
|
468
|
+
roleIds: string[];
|
|
469
|
+
enabled: boolean;
|
|
470
|
+
};
|
|
471
|
+
type FetchSystemUsersParams = {
|
|
472
|
+
keyword?: string;
|
|
473
|
+
/** undefined 表示不过滤 */
|
|
474
|
+
enabled?: boolean;
|
|
475
|
+
pagination?: ListPaginationParams;
|
|
476
|
+
};
|
|
477
|
+
type SystemUserListResult = {
|
|
478
|
+
records: SystemUser[];
|
|
479
|
+
pageToken: string;
|
|
480
|
+
hasPreviousPage: boolean;
|
|
481
|
+
hasNextPage: boolean;
|
|
482
|
+
};
|
|
483
|
+
type FetchSystemGroupsParams = {
|
|
484
|
+
keyword?: string;
|
|
485
|
+
};
|
|
486
|
+
type FetchSystemRoleOptionsParams = {
|
|
487
|
+
keyword?: string;
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
type SystemUserApi = {
|
|
491
|
+
list: (params?: FetchSystemUsersParams, signal?: AbortSignal) => Promise<SystemUserListResult>;
|
|
492
|
+
create: (values: SystemUserFormValues, signal?: AbortSignal) => Promise<unknown>;
|
|
493
|
+
update: (userId: string, values: SystemUserFormValues, signal?: AbortSignal) => Promise<unknown>;
|
|
494
|
+
remove: (userId: string, signal?: AbortSignal) => Promise<unknown>;
|
|
495
|
+
listGroups: (params?: FetchSystemGroupsParams, signal?: AbortSignal) => Promise<SystemGroupOption[]>;
|
|
496
|
+
listRoleOptions: (params?: FetchSystemRoleOptionsParams, signal?: AbortSignal) => Promise<SystemRoleOption[]>;
|
|
497
|
+
};
|
|
498
|
+
declare function mapSystemUser(item: unknown): SystemUser | null;
|
|
499
|
+
declare function mapSystemGroupOption(item: unknown): SystemGroupOption | null;
|
|
500
|
+
declare function mapSystemRoleOption(item: unknown): SystemRoleOption | null;
|
|
501
|
+
/**
|
|
502
|
+
* 账号校验:不少于 6 位,且同时包含字母与数字。
|
|
503
|
+
* 通过返回 null,失败返回错误文案。
|
|
504
|
+
*/
|
|
505
|
+
declare function validateUsername(username: string): string | null;
|
|
506
|
+
declare function buildCreateUserBody(values: SystemUserFormValues): CreateSystemUserBody;
|
|
507
|
+
declare function buildUpdateUserBody(values: SystemUserFormValues): UpdateSystemUserBody;
|
|
508
|
+
declare function createSystemUserApi(request: ResourceHttpRequest): SystemUserApi;
|
|
509
|
+
|
|
510
|
+
type UserManagerProps = {
|
|
511
|
+
api: SystemUserApi;
|
|
512
|
+
title?: string;
|
|
513
|
+
pageSize?: string;
|
|
514
|
+
toolbarExtra?: ReactNode;
|
|
515
|
+
};
|
|
516
|
+
declare function UserManager({ api, title, pageSize: initialPageSize, toolbarExtra, }: UserManagerProps): react.JSX.Element;
|
|
517
|
+
|
|
518
|
+
type SystemAdminMenuKey = 'menu' | 'resource' | 'role' | 'user';
|
|
407
519
|
type SystemAdminSubMenu = {
|
|
408
520
|
key: SystemAdminMenuKey;
|
|
409
521
|
label: string;
|
|
@@ -421,6 +533,7 @@ type SystemAdminProps = {
|
|
|
421
533
|
menuApi: MenuResourceApi;
|
|
422
534
|
resourceApi: AuthorizationResourceApi;
|
|
423
535
|
roleApi: SystemRoleApi;
|
|
536
|
+
userApi: SystemUserApi;
|
|
424
537
|
/** 默认选中的子菜单,默认菜单管理 */
|
|
425
538
|
defaultActiveKey?: SystemAdminMenuKey;
|
|
426
539
|
/** 受控选中 key */
|
|
@@ -430,9 +543,9 @@ type SystemAdminProps = {
|
|
|
430
543
|
toolbarExtra?: ReactNode;
|
|
431
544
|
};
|
|
432
545
|
/**
|
|
433
|
-
* 系统管理:侧栏父菜单「系统管理」,子菜单为菜单 / 权限点 /
|
|
546
|
+
* 系统管理:侧栏父菜单「系统管理」,子菜单为菜单 / 权限点 / 角色 / 用户管理。
|
|
434
547
|
*/
|
|
435
|
-
declare function SystemAdmin({ menuApi, resourceApi, roleApi, defaultActiveKey, activeKey: controlledKey, onActiveKeyChange, title, toolbarExtra, }: SystemAdminProps): react.JSX.Element;
|
|
548
|
+
declare function SystemAdmin({ menuApi, resourceApi, roleApi, userApi, defaultActiveKey, activeKey: controlledKey, onActiveKeyChange, title, toolbarExtra, }: SystemAdminProps): react.JSX.Element;
|
|
436
549
|
|
|
437
550
|
interface SnowyflakeOptions {
|
|
438
551
|
epoch?: bigint;
|
|
@@ -464,4 +577,4 @@ declare const snowyflake: ConfigurableSnowflake;
|
|
|
464
577
|
declare function getAppClientId(): string;
|
|
465
578
|
declare function getDeviceWorkerId(): string;
|
|
466
579
|
|
|
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 };
|
|
580
|
+
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 CreateSystemUserBody, type FetchAuthorizationResourcesParams, type FetchMenuResourcesParams, type FetchSystemGroupsParams, type FetchSystemRoleOptionsParams, type FetchSystemRolesParams, type FetchSystemUsersParams, 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 SystemGroupOption, type SystemRole, type SystemRoleApi, type SystemRoleFormValues, type SystemRoleListResult, type SystemRoleOption, type SystemUser, type SystemUserApi, type SystemUserFormValues, type SystemUserListResult, type UpdateAuthorizationResourceBody, type UpdateMenuResourceBody, type UpdateSystemRoleBody, type UpdateSystemUserBody, type UsePermissionResult, UserManager, type UserManagerProps, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildCreateRoleBody, buildCreateUserBody, buildPermissionTreeIndex, buildSavePermissionsBody, buildUpdateBody, buildUpdateMenuBody, buildUpdateRoleBody, buildUpdateUserBody, collectTreeResourceIds, countCheckedDescendants, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionStore, createSystemRoleApi, createSystemUserApi, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, hasCheckedDescendant, isMenuLeaf, isPermissionNodeIndeterminate, mapAuthorizationResource, mapMenuResource, mapPermissionTreeNode, mapRolePermissions, mapSystemGroupOption, mapSystemRole, mapSystemRoleOption, mapSystemUser, resolveMenuDepth, snowyflake, togglePermissionCheck, useHasPermission, useHasRole, usePermission, validateUsername };
|