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/vue/index.d.cts
CHANGED
|
@@ -233,6 +233,11 @@ type AuthorizationResourceListResult = {
|
|
|
233
233
|
hasPreviousPage: boolean;
|
|
234
234
|
hasNextPage: boolean;
|
|
235
235
|
};
|
|
236
|
+
type MenuPermissionPoint = {
|
|
237
|
+
resourceId?: string;
|
|
238
|
+
name: string;
|
|
239
|
+
identification?: string;
|
|
240
|
+
};
|
|
236
241
|
type MenuResource = {
|
|
237
242
|
resourceId: string;
|
|
238
243
|
/** 上级菜单 ID;无上级时为 null */
|
|
@@ -249,6 +254,8 @@ type MenuResource = {
|
|
|
249
254
|
name: string;
|
|
250
255
|
identification: string;
|
|
251
256
|
permissionPointIds: string[];
|
|
257
|
+
/** 关联权限点对象(列表展示优先取其中 name) */
|
|
258
|
+
permissionPoints?: MenuPermissionPoint[];
|
|
252
259
|
/** 关联权限点名称(列表展示用,后端可能返回) */
|
|
253
260
|
permissionPointNames?: string[];
|
|
254
261
|
status: ResourceStatus;
|
|
@@ -803,4 +810,4 @@ declare const snowyflake: ConfigurableSnowflake;
|
|
|
803
810
|
declare function getAppClientId(): string;
|
|
804
811
|
declare function getDeviceWorkerId(): string;
|
|
805
812
|
|
|
806
|
-
export { type ApiResourceType, type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, 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 MenuResource, type MenuResourceApi, type MenuResourceFormValues, type MenuResourceListResult, type MenuResourceType, PERMISSION_STORE_KEY, type PageDirection, type PermissionChecker, type PermissionCode, type PermissionDirectiveValue, type PermissionListener, type PermissionPluginOptions, 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 ResourceRequestOptions, type ResourceStatus, type ResourceType, type RoleCode, RoleManager, type RolePermissionTreeNode, type RolePermissionsResult, SYSTEM_ADMIN_DEFAULT_KEY, SYSTEM_ADMIN_MENU, type SaveRolePermissionsBody, SystemAdmin, type SystemAdminMenuGroup, type SystemAdminMenuKey, 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, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildCreateRoleBody, buildCreateUserBody, buildPermissionTreeIndex, buildSavePermissionsBody, buildUpdateBody, buildUpdateMenuBody, buildUpdateRoleBody, buildUpdateUserBody, collectTreeResourceIds, countCheckedDescendants, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionPlugin, createPermissionStore, createSystemRoleApi, createSystemUserApi, createVPermission, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, hasCheckedDescendant, isMenuLeaf, isPermissionNodeIndeterminate, mapAuthorizationResource, mapMenuResource, mapPermissionTreeNode, mapRolePermissions, mapSystemGroupOption, mapSystemRole, mapSystemRoleOption, mapSystemUser, resolveMenuDepth, snowyflake, togglePermissionCheck, useHasPermission, useHasRole, usePermission, validateUsername };
|
|
813
|
+
export { type ApiResourceType, type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, 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 MenuPermissionPoint, type MenuResource, type MenuResourceApi, type MenuResourceFormValues, type MenuResourceListResult, type MenuResourceType, PERMISSION_STORE_KEY, type PageDirection, type PermissionChecker, type PermissionCode, type PermissionDirectiveValue, type PermissionListener, type PermissionPluginOptions, 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 ResourceRequestOptions, type ResourceStatus, type ResourceType, type RoleCode, RoleManager, type RolePermissionTreeNode, type RolePermissionsResult, SYSTEM_ADMIN_DEFAULT_KEY, SYSTEM_ADMIN_MENU, type SaveRolePermissionsBody, SystemAdmin, type SystemAdminMenuGroup, type SystemAdminMenuKey, 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, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildCreateRoleBody, buildCreateUserBody, buildPermissionTreeIndex, buildSavePermissionsBody, buildUpdateBody, buildUpdateMenuBody, buildUpdateRoleBody, buildUpdateUserBody, collectTreeResourceIds, countCheckedDescendants, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionPlugin, createPermissionStore, createSystemRoleApi, createSystemUserApi, createVPermission, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, hasCheckedDescendant, isMenuLeaf, isPermissionNodeIndeterminate, mapAuthorizationResource, mapMenuResource, mapPermissionTreeNode, mapRolePermissions, mapSystemGroupOption, mapSystemRole, mapSystemRoleOption, mapSystemUser, resolveMenuDepth, snowyflake, togglePermissionCheck, useHasPermission, useHasRole, usePermission, validateUsername };
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -233,6 +233,11 @@ type AuthorizationResourceListResult = {
|
|
|
233
233
|
hasPreviousPage: boolean;
|
|
234
234
|
hasNextPage: boolean;
|
|
235
235
|
};
|
|
236
|
+
type MenuPermissionPoint = {
|
|
237
|
+
resourceId?: string;
|
|
238
|
+
name: string;
|
|
239
|
+
identification?: string;
|
|
240
|
+
};
|
|
236
241
|
type MenuResource = {
|
|
237
242
|
resourceId: string;
|
|
238
243
|
/** 上级菜单 ID;无上级时为 null */
|
|
@@ -249,6 +254,8 @@ type MenuResource = {
|
|
|
249
254
|
name: string;
|
|
250
255
|
identification: string;
|
|
251
256
|
permissionPointIds: string[];
|
|
257
|
+
/** 关联权限点对象(列表展示优先取其中 name) */
|
|
258
|
+
permissionPoints?: MenuPermissionPoint[];
|
|
252
259
|
/** 关联权限点名称(列表展示用,后端可能返回) */
|
|
253
260
|
permissionPointNames?: string[];
|
|
254
261
|
status: ResourceStatus;
|
|
@@ -803,4 +810,4 @@ declare const snowyflake: ConfigurableSnowflake;
|
|
|
803
810
|
declare function getAppClientId(): string;
|
|
804
811
|
declare function getDeviceWorkerId(): string;
|
|
805
812
|
|
|
806
|
-
export { type ApiResourceType, type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, 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 MenuResource, type MenuResourceApi, type MenuResourceFormValues, type MenuResourceListResult, type MenuResourceType, PERMISSION_STORE_KEY, type PageDirection, type PermissionChecker, type PermissionCode, type PermissionDirectiveValue, type PermissionListener, type PermissionPluginOptions, 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 ResourceRequestOptions, type ResourceStatus, type ResourceType, type RoleCode, RoleManager, type RolePermissionTreeNode, type RolePermissionsResult, SYSTEM_ADMIN_DEFAULT_KEY, SYSTEM_ADMIN_MENU, type SaveRolePermissionsBody, SystemAdmin, type SystemAdminMenuGroup, type SystemAdminMenuKey, 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, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildCreateRoleBody, buildCreateUserBody, buildPermissionTreeIndex, buildSavePermissionsBody, buildUpdateBody, buildUpdateMenuBody, buildUpdateRoleBody, buildUpdateUserBody, collectTreeResourceIds, countCheckedDescendants, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionPlugin, createPermissionStore, createSystemRoleApi, createSystemUserApi, createVPermission, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, hasCheckedDescendant, isMenuLeaf, isPermissionNodeIndeterminate, mapAuthorizationResource, mapMenuResource, mapPermissionTreeNode, mapRolePermissions, mapSystemGroupOption, mapSystemRole, mapSystemRoleOption, mapSystemUser, resolveMenuDepth, snowyflake, togglePermissionCheck, useHasPermission, useHasRole, usePermission, validateUsername };
|
|
813
|
+
export { type ApiResourceType, type AuthorizationResource, type AuthorizationResourceApi, type AuthorizationResourceFormValues, type AuthorizationResourceListResult, Can, 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 MenuPermissionPoint, type MenuResource, type MenuResourceApi, type MenuResourceFormValues, type MenuResourceListResult, type MenuResourceType, PERMISSION_STORE_KEY, type PageDirection, type PermissionChecker, type PermissionCode, type PermissionDirectiveValue, type PermissionListener, type PermissionPluginOptions, 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 ResourceRequestOptions, type ResourceStatus, type ResourceType, type RoleCode, RoleManager, type RolePermissionTreeNode, type RolePermissionsResult, SYSTEM_ADMIN_DEFAULT_KEY, SYSTEM_ADMIN_MENU, type SaveRolePermissionsBody, SystemAdmin, type SystemAdminMenuGroup, type SystemAdminMenuKey, 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, appendQueryParam, buildCreateBody, buildCreateMenuBody, buildCreateRoleBody, buildCreateUserBody, buildPermissionTreeIndex, buildSavePermissionsBody, buildUpdateBody, buildUpdateMenuBody, buildUpdateRoleBody, buildUpdateUserBody, collectTreeResourceIds, countCheckedDescendants, createAuthorizationResourceApi, createDefaultResourceRequest, createMenuResourceApi, createPermissionPlugin, createPermissionStore, createSystemRoleApi, createSystemUserApi, createVPermission, extractPagination, extractRecords, getAppClientId, getDeviceWorkerId, hasCheckedDescendant, isMenuLeaf, isPermissionNodeIndeterminate, mapAuthorizationResource, mapMenuResource, mapPermissionTreeNode, mapRolePermissions, mapSystemGroupOption, mapSystemRole, mapSystemRoleOption, mapSystemUser, resolveMenuDepth, snowyflake, togglePermissionCheck, useHasPermission, useHasRole, usePermission, validateUsername };
|
package/dist/vue/index.js
CHANGED
|
@@ -502,6 +502,23 @@ function toStringArray(value) {
|
|
|
502
502
|
}
|
|
503
503
|
return [];
|
|
504
504
|
}
|
|
505
|
+
function mapMenuPermissionPoints(value) {
|
|
506
|
+
if (!Array.isArray(value)) return void 0;
|
|
507
|
+
const points = value.map((item) => {
|
|
508
|
+
if (!item || typeof item !== "object") return null;
|
|
509
|
+
const row = item;
|
|
510
|
+
const name = String(row.name ?? "").trim();
|
|
511
|
+
if (!name) return null;
|
|
512
|
+
const resourceId = row.resourceId ?? row.resource_id ?? row.id;
|
|
513
|
+
const identification = row.identification ?? row.identity;
|
|
514
|
+
return {
|
|
515
|
+
...resourceId !== void 0 && resourceId !== null && resourceId !== "" ? { resourceId: String(resourceId) } : {},
|
|
516
|
+
name,
|
|
517
|
+
...identification !== void 0 && identification !== null && identification !== "" ? { identification: String(identification) } : {}
|
|
518
|
+
};
|
|
519
|
+
}).filter((item) => item !== null);
|
|
520
|
+
return points.length ? points : void 0;
|
|
521
|
+
}
|
|
505
522
|
function toMenuType(value) {
|
|
506
523
|
const v = String(value ?? "").toLowerCase();
|
|
507
524
|
if (v === MENU_TYPE_PAGE || v === MENU_TYPE_MENU || v === MENU_TYPE_BUTTON) {
|
|
@@ -529,11 +546,14 @@ function mapMenuResource(item) {
|
|
|
529
546
|
const row = item;
|
|
530
547
|
const resourceId = row.resourceId ?? row.resource_id ?? row.id;
|
|
531
548
|
if (resourceId === void 0 || resourceId === null || resourceId === "") return null;
|
|
549
|
+
const permissionPoints = mapMenuPermissionPoints(
|
|
550
|
+
row.permissionPoints ?? row.permission_points
|
|
551
|
+
);
|
|
532
552
|
const permissionPointIds = toStringArray(
|
|
533
|
-
row.permissionPointIds ?? row.permission_point_ids ??
|
|
553
|
+
row.permissionPointIds ?? row.permission_point_ids ?? (permissionPoints?.length ? permissionPoints.map((p) => p.resourceId).filter(Boolean) : void 0) ?? row.permissions
|
|
534
554
|
);
|
|
535
555
|
const permissionNamesRaw = row.permissionPointNames ?? row.permission_point_names ?? row.permissionNames;
|
|
536
|
-
const permissionPointNames = Array.isArray(permissionNamesRaw) ? permissionNamesRaw.map((n) => String(n ?? "")).filter(Boolean) :
|
|
556
|
+
const permissionPointNames = Array.isArray(permissionNamesRaw) ? permissionNamesRaw.map((n) => String(n ?? "")).filter(Boolean) : permissionPoints?.map((p) => p.name).filter(Boolean);
|
|
537
557
|
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);
|
|
538
558
|
const parentId = rawParentId === void 0 || rawParentId === null || rawParentId === "" || String(rawParentId) === "0" ? null : String(rawParentId);
|
|
539
559
|
const rawDepth = row.depth;
|
|
@@ -553,7 +573,8 @@ function mapMenuResource(item) {
|
|
|
553
573
|
name: String(row.name ?? ""),
|
|
554
574
|
identification: String(row.identification ?? row.identity ?? row.path ?? ""),
|
|
555
575
|
permissionPointIds,
|
|
556
|
-
|
|
576
|
+
permissionPoints,
|
|
577
|
+
permissionPointNames: permissionPointNames && permissionPointNames.length ? permissionPointNames : void 0,
|
|
557
578
|
status: toResourceStatus(row.status),
|
|
558
579
|
sort
|
|
559
580
|
};
|
|
@@ -1964,6 +1985,9 @@ var MenuManager = defineComponent3({
|
|
|
1964
1985
|
form.permissionPointIds = exists ? form.permissionPointIds.filter((x) => x !== id) : [...form.permissionPointIds, id];
|
|
1965
1986
|
}
|
|
1966
1987
|
function renderPermissionLabels(row) {
|
|
1988
|
+
if (row.permissionPoints?.length) {
|
|
1989
|
+
return row.permissionPoints.map((p) => p.name).filter(Boolean).join("\u3001") || "\u2014";
|
|
1990
|
+
}
|
|
1967
1991
|
if (row.permissionPointNames?.length) {
|
|
1968
1992
|
return row.permissionPointNames.join("\u3001");
|
|
1969
1993
|
}
|