com-angel-authorization 1.0.27 → 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 +56 -4
- 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 +57 -5
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +57 -5
- 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 +57 -5
- 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
|
};
|
|
@@ -1222,7 +1243,7 @@ import {
|
|
|
1222
1243
|
useMemo as useMemo3,
|
|
1223
1244
|
useState as useState3
|
|
1224
1245
|
} from "react";
|
|
1225
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1246
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1226
1247
|
var PAGE_SIZE_OPTIONS2 = ["10", "20", "50", "100"];
|
|
1227
1248
|
var emptyForm2 = () => ({
|
|
1228
1249
|
parentId: null,
|
|
@@ -1257,11 +1278,19 @@ function MenuManager({
|
|
|
1257
1278
|
const [saving, setSaving] = useState3(false);
|
|
1258
1279
|
const [deletingRow, setDeletingRow] = useState3(null);
|
|
1259
1280
|
const [deleting, setDeleting] = useState3(false);
|
|
1281
|
+
const [permissionKeyword, setPermissionKeyword] = useState3("");
|
|
1260
1282
|
const permissionNameMap = useMemo3(() => {
|
|
1261
1283
|
const map = /* @__PURE__ */ new Map();
|
|
1262
1284
|
permissionPoints.forEach((p) => map.set(p.resourceId, p.name || p.identification));
|
|
1263
1285
|
return map;
|
|
1264
1286
|
}, [permissionPoints]);
|
|
1287
|
+
const filteredPermissionPoints = useMemo3(() => {
|
|
1288
|
+
const kw = permissionKeyword.trim().toLowerCase();
|
|
1289
|
+
if (!kw) return permissionPoints;
|
|
1290
|
+
return permissionPoints.filter(
|
|
1291
|
+
(p) => p.name.toLowerCase().includes(kw) || p.identification.toLowerCase().includes(kw)
|
|
1292
|
+
);
|
|
1293
|
+
}, [permissionPoints, permissionKeyword]);
|
|
1265
1294
|
const allKnownMenus = useMemo3(() => {
|
|
1266
1295
|
const map = /* @__PURE__ */ new Map();
|
|
1267
1296
|
records.forEach((row) => map.set(row.resourceId, row));
|
|
@@ -1375,6 +1404,7 @@ function MenuManager({
|
|
|
1375
1404
|
}, [api, pageSize]);
|
|
1376
1405
|
const openCreate = (parent) => {
|
|
1377
1406
|
setEditing(null);
|
|
1407
|
+
setPermissionKeyword("");
|
|
1378
1408
|
if (parent) {
|
|
1379
1409
|
setForm({
|
|
1380
1410
|
...emptyForm2(),
|
|
@@ -1390,6 +1420,7 @@ function MenuManager({
|
|
|
1390
1420
|
const openEdit = (row) => {
|
|
1391
1421
|
const parentId = resolveRowParentId(row);
|
|
1392
1422
|
setEditing(row);
|
|
1423
|
+
setPermissionKeyword("");
|
|
1393
1424
|
setForm({
|
|
1394
1425
|
parentId,
|
|
1395
1426
|
depth: row.depth > 0 ? row.depth : resolveMenuDepth(parentId, allKnownMenus),
|
|
@@ -1406,6 +1437,7 @@ function MenuManager({
|
|
|
1406
1437
|
const closeDialog = () => {
|
|
1407
1438
|
if (saving) return;
|
|
1408
1439
|
setDialogOpen(false);
|
|
1440
|
+
setPermissionKeyword("");
|
|
1409
1441
|
};
|
|
1410
1442
|
const handleSubmit = async (event) => {
|
|
1411
1443
|
event.preventDefault();
|
|
@@ -1457,6 +1489,9 @@ function MenuManager({
|
|
|
1457
1489
|
});
|
|
1458
1490
|
};
|
|
1459
1491
|
const renderPermissionLabels = (row) => {
|
|
1492
|
+
if (row.permissionPoints?.length) {
|
|
1493
|
+
return row.permissionPoints.map((p) => p.name).filter(Boolean).join("\u3001") || "\u2014";
|
|
1494
|
+
}
|
|
1460
1495
|
if (row.permissionPointNames?.length) {
|
|
1461
1496
|
return row.permissionPointNames.join("\u3001");
|
|
1462
1497
|
}
|
|
@@ -1669,7 +1704,24 @@ function MenuManager({
|
|
|
1669
1704
|
] }),
|
|
1670
1705
|
/* @__PURE__ */ jsxs2("fieldset", { style: styles2.fieldset, children: [
|
|
1671
1706
|
/* @__PURE__ */ jsx3("legend", { style: styles2.label, children: "\u6743\u9650\u6807\u8BC6" }),
|
|
1672
|
-
|
|
1707
|
+
permissionPoints.length > 0 ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
1708
|
+
/* @__PURE__ */ jsx3(
|
|
1709
|
+
"input",
|
|
1710
|
+
{
|
|
1711
|
+
style: { ...styles2.input, marginBottom: 8 },
|
|
1712
|
+
value: permissionKeyword,
|
|
1713
|
+
onChange: (e) => setPermissionKeyword(e.target.value),
|
|
1714
|
+
placeholder: "\u641C\u7D22\u6743\u9650\u540D\u79F0 / \u6807\u8BC6"
|
|
1715
|
+
}
|
|
1716
|
+
),
|
|
1717
|
+
/* @__PURE__ */ jsxs2("div", { style: styles2.hint, children: [
|
|
1718
|
+
"\u5DF2\u9009 ",
|
|
1719
|
+
form.permissionPointIds.length,
|
|
1720
|
+
" \u9879",
|
|
1721
|
+
permissionKeyword.trim() ? ` \xB7 \u5339\u914D ${filteredPermissionPoints.length} / ${permissionPoints.length}` : ` \xB7 \u5171 ${permissionPoints.length} \u9879`
|
|
1722
|
+
] })
|
|
1723
|
+
] }) : null,
|
|
1724
|
+
/* @__PURE__ */ jsx3("div", { style: styles2.multiSelect, children: permissionPoints.length === 0 ? /* @__PURE__ */ jsx3("div", { style: styles2.hint, children: "\u6682\u65E0\u6743\u9650\u70B9\uFF0C\u8BF7\u5148\u5728\u6743\u9650\u70B9\u7BA1\u7406\u4E2D\u65B0\u589E" }) : filteredPermissionPoints.length === 0 ? /* @__PURE__ */ jsx3("div", { style: styles2.hint, children: "\u65E0\u5339\u914D\u6743\u9650\u70B9" }) : filteredPermissionPoints.map((p) => /* @__PURE__ */ jsxs2("label", { style: styles2.checkItem, children: [
|
|
1673
1725
|
/* @__PURE__ */ jsx3(
|
|
1674
1726
|
"input",
|
|
1675
1727
|
{
|