com-angel-authorization 1.0.28 → 1.0.30

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.
@@ -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 };
@@ -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 ?? row.permissionPoints ?? row.permissions
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) : void 0;
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
- permissionPointNames,
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
  }
@@ -2145,15 +2169,14 @@ var MenuManager = defineComponent3({
2145
2169
  ]),
2146
2170
  dialogOpen.value ? h2(
2147
2171
  "div",
2148
- { style: s2.mask, onClick: closeDialog },
2172
+ { style: s2.mask },
2149
2173
  [
2150
2174
  h2(
2151
2175
  "div",
2152
2176
  {
2153
2177
  style: { ...s2.dialog, maxWidth: "520px" },
2154
2178
  role: "dialog",
2155
- "aria-modal": "true",
2156
- onClick: (e) => e.stopPropagation()
2179
+ "aria-modal": "true"
2157
2180
  },
2158
2181
  [
2159
2182
  h2("div", { style: s2.dialogHeader }, [
@@ -2340,15 +2363,6 @@ var MenuManager = defineComponent3({
2340
2363
  )
2341
2364
  ]),
2342
2365
  h2("div", { style: s2.dialogFooter }, [
2343
- h2(
2344
- "button",
2345
- {
2346
- type: "button",
2347
- style: s2.secondaryBtn,
2348
- onClick: closeDialog
2349
- },
2350
- "\u53D6\u6D88"
2351
- ),
2352
2366
  h2(
2353
2367
  "button",
2354
2368
  {