com-angel-authorization 1.0.28 → 1.0.29
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 +2 -0
- package/dist/index.cjs +24 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +27 -3
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +8 -1
- package/dist/react/index.d.ts +8 -1
- package/dist/react/index.js +27 -3
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +27 -3
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.cts +8 -1
- package/dist/vue/index.d.ts +8 -1
- package/dist/vue/index.js +27 -3
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -179,6 +179,11 @@ type AuthorizationResourceListResult = {
|
|
|
179
179
|
hasPreviousPage: boolean;
|
|
180
180
|
hasNextPage: boolean;
|
|
181
181
|
};
|
|
182
|
+
type MenuPermissionPoint = {
|
|
183
|
+
resourceId?: string;
|
|
184
|
+
name: string;
|
|
185
|
+
identification?: string;
|
|
186
|
+
};
|
|
182
187
|
type MenuResource = {
|
|
183
188
|
resourceId: string;
|
|
184
189
|
/** 上级菜单 ID;无上级时为 null */
|
|
@@ -195,6 +200,8 @@ type MenuResource = {
|
|
|
195
200
|
name: string;
|
|
196
201
|
identification: string;
|
|
197
202
|
permissionPointIds: string[];
|
|
203
|
+
/** 关联权限点对象(列表展示优先取其中 name) */
|
|
204
|
+
permissionPoints?: MenuPermissionPoint[];
|
|
198
205
|
/** 关联权限点名称(列表展示用,后端可能返回) */
|
|
199
206
|
permissionPointNames?: string[];
|
|
200
207
|
status: ResourceStatus;
|
|
@@ -581,4 +588,4 @@ declare const snowyflake: ConfigurableSnowflake;
|
|
|
581
588
|
declare function getAppClientId(): string;
|
|
582
589
|
declare function getDeviceWorkerId(): string;
|
|
583
590
|
|
|
584
|
-
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 };
|
|
591
|
+
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 MenuPermissionPoint, 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
|
@@ -179,6 +179,11 @@ type AuthorizationResourceListResult = {
|
|
|
179
179
|
hasPreviousPage: boolean;
|
|
180
180
|
hasNextPage: boolean;
|
|
181
181
|
};
|
|
182
|
+
type MenuPermissionPoint = {
|
|
183
|
+
resourceId?: string;
|
|
184
|
+
name: string;
|
|
185
|
+
identification?: string;
|
|
186
|
+
};
|
|
182
187
|
type MenuResource = {
|
|
183
188
|
resourceId: string;
|
|
184
189
|
/** 上级菜单 ID;无上级时为 null */
|
|
@@ -195,6 +200,8 @@ type MenuResource = {
|
|
|
195
200
|
name: string;
|
|
196
201
|
identification: string;
|
|
197
202
|
permissionPointIds: string[];
|
|
203
|
+
/** 关联权限点对象(列表展示优先取其中 name) */
|
|
204
|
+
permissionPoints?: MenuPermissionPoint[];
|
|
198
205
|
/** 关联权限点名称(列表展示用,后端可能返回) */
|
|
199
206
|
permissionPointNames?: string[];
|
|
200
207
|
status: ResourceStatus;
|
|
@@ -581,4 +588,4 @@ declare const snowyflake: ConfigurableSnowflake;
|
|
|
581
588
|
declare function getAppClientId(): string;
|
|
582
589
|
declare function getDeviceWorkerId(): string;
|
|
583
590
|
|
|
584
|
-
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 };
|
|
591
|
+
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 MenuPermissionPoint, 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.js
CHANGED
|
@@ -425,6 +425,23 @@ function toStringArray(value) {
|
|
|
425
425
|
}
|
|
426
426
|
return [];
|
|
427
427
|
}
|
|
428
|
+
function mapMenuPermissionPoints(value) {
|
|
429
|
+
if (!Array.isArray(value)) return void 0;
|
|
430
|
+
const points = value.map((item) => {
|
|
431
|
+
if (!item || typeof item !== "object") return null;
|
|
432
|
+
const row = item;
|
|
433
|
+
const name = String(row.name ?? "").trim();
|
|
434
|
+
if (!name) return null;
|
|
435
|
+
const resourceId = row.resourceId ?? row.resource_id ?? row.id;
|
|
436
|
+
const identification = row.identification ?? row.identity;
|
|
437
|
+
return {
|
|
438
|
+
...resourceId !== void 0 && resourceId !== null && resourceId !== "" ? { resourceId: String(resourceId) } : {},
|
|
439
|
+
name,
|
|
440
|
+
...identification !== void 0 && identification !== null && identification !== "" ? { identification: String(identification) } : {}
|
|
441
|
+
};
|
|
442
|
+
}).filter((item) => item !== null);
|
|
443
|
+
return points.length ? points : void 0;
|
|
444
|
+
}
|
|
428
445
|
function toMenuType(value) {
|
|
429
446
|
const v = String(value ?? "").toLowerCase();
|
|
430
447
|
if (v === MENU_TYPE_PAGE || v === MENU_TYPE_MENU || v === MENU_TYPE_BUTTON) {
|
|
@@ -452,11 +469,14 @@ function mapMenuResource(item) {
|
|
|
452
469
|
const row = item;
|
|
453
470
|
const resourceId = row.resourceId ?? row.resource_id ?? row.id;
|
|
454
471
|
if (resourceId === void 0 || resourceId === null || resourceId === "") return null;
|
|
472
|
+
const permissionPoints = mapMenuPermissionPoints(
|
|
473
|
+
row.permissionPoints ?? row.permission_points
|
|
474
|
+
);
|
|
455
475
|
const permissionPointIds = toStringArray(
|
|
456
|
-
row.permissionPointIds ?? row.permission_point_ids ??
|
|
476
|
+
row.permissionPointIds ?? row.permission_point_ids ?? (permissionPoints?.length ? permissionPoints.map((p) => p.resourceId).filter(Boolean) : void 0) ?? row.permissions
|
|
457
477
|
);
|
|
458
478
|
const permissionNamesRaw = row.permissionPointNames ?? row.permission_point_names ?? row.permissionNames;
|
|
459
|
-
const permissionPointNames = Array.isArray(permissionNamesRaw) ? permissionNamesRaw.map((n) => String(n ?? "")).filter(Boolean) :
|
|
479
|
+
const permissionPointNames = Array.isArray(permissionNamesRaw) ? permissionNamesRaw.map((n) => String(n ?? "")).filter(Boolean) : permissionPoints?.map((p) => p.name).filter(Boolean);
|
|
460
480
|
const rawParentId = row.parentId ?? row.parent_id ?? (row.parent && typeof row.parent === "object" ? row.parent.resourceId ?? row.parent.resource_id ?? row.parent.id : void 0);
|
|
461
481
|
const parentId = rawParentId === void 0 || rawParentId === null || rawParentId === "" || String(rawParentId) === "0" ? null : String(rawParentId);
|
|
462
482
|
const rawDepth = row.depth;
|
|
@@ -476,7 +496,8 @@ function mapMenuResource(item) {
|
|
|
476
496
|
name: String(row.name ?? ""),
|
|
477
497
|
identification: String(row.identification ?? row.identity ?? row.path ?? ""),
|
|
478
498
|
permissionPointIds,
|
|
479
|
-
|
|
499
|
+
permissionPoints,
|
|
500
|
+
permissionPointNames: permissionPointNames && permissionPointNames.length ? permissionPointNames : void 0,
|
|
480
501
|
status: toResourceStatus(row.status),
|
|
481
502
|
sort
|
|
482
503
|
};
|
|
@@ -1468,6 +1489,9 @@ function MenuManager({
|
|
|
1468
1489
|
});
|
|
1469
1490
|
};
|
|
1470
1491
|
const renderPermissionLabels = (row) => {
|
|
1492
|
+
if (row.permissionPoints?.length) {
|
|
1493
|
+
return row.permissionPoints.map((p) => p.name).filter(Boolean).join("\u3001") || "\u2014";
|
|
1494
|
+
}
|
|
1471
1495
|
if (row.permissionPointNames?.length) {
|
|
1472
1496
|
return row.permissionPointNames.join("\u3001");
|
|
1473
1497
|
}
|