com-angel-authorization 1.0.27 → 1.0.28

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.
@@ -1222,7 +1222,7 @@ import {
1222
1222
  useMemo as useMemo3,
1223
1223
  useState as useState3
1224
1224
  } from "react";
1225
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
1225
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
1226
1226
  var PAGE_SIZE_OPTIONS2 = ["10", "20", "50", "100"];
1227
1227
  var emptyForm2 = () => ({
1228
1228
  parentId: null,
@@ -1257,11 +1257,19 @@ function MenuManager({
1257
1257
  const [saving, setSaving] = useState3(false);
1258
1258
  const [deletingRow, setDeletingRow] = useState3(null);
1259
1259
  const [deleting, setDeleting] = useState3(false);
1260
+ const [permissionKeyword, setPermissionKeyword] = useState3("");
1260
1261
  const permissionNameMap = useMemo3(() => {
1261
1262
  const map = /* @__PURE__ */ new Map();
1262
1263
  permissionPoints.forEach((p) => map.set(p.resourceId, p.name || p.identification));
1263
1264
  return map;
1264
1265
  }, [permissionPoints]);
1266
+ const filteredPermissionPoints = useMemo3(() => {
1267
+ const kw = permissionKeyword.trim().toLowerCase();
1268
+ if (!kw) return permissionPoints;
1269
+ return permissionPoints.filter(
1270
+ (p) => p.name.toLowerCase().includes(kw) || p.identification.toLowerCase().includes(kw)
1271
+ );
1272
+ }, [permissionPoints, permissionKeyword]);
1265
1273
  const allKnownMenus = useMemo3(() => {
1266
1274
  const map = /* @__PURE__ */ new Map();
1267
1275
  records.forEach((row) => map.set(row.resourceId, row));
@@ -1375,6 +1383,7 @@ function MenuManager({
1375
1383
  }, [api, pageSize]);
1376
1384
  const openCreate = (parent) => {
1377
1385
  setEditing(null);
1386
+ setPermissionKeyword("");
1378
1387
  if (parent) {
1379
1388
  setForm({
1380
1389
  ...emptyForm2(),
@@ -1390,6 +1399,7 @@ function MenuManager({
1390
1399
  const openEdit = (row) => {
1391
1400
  const parentId = resolveRowParentId(row);
1392
1401
  setEditing(row);
1402
+ setPermissionKeyword("");
1393
1403
  setForm({
1394
1404
  parentId,
1395
1405
  depth: row.depth > 0 ? row.depth : resolveMenuDepth(parentId, allKnownMenus),
@@ -1406,6 +1416,7 @@ function MenuManager({
1406
1416
  const closeDialog = () => {
1407
1417
  if (saving) return;
1408
1418
  setDialogOpen(false);
1419
+ setPermissionKeyword("");
1409
1420
  };
1410
1421
  const handleSubmit = async (event) => {
1411
1422
  event.preventDefault();
@@ -1669,7 +1680,24 @@ function MenuManager({
1669
1680
  ] }),
1670
1681
  /* @__PURE__ */ jsxs2("fieldset", { style: styles2.fieldset, children: [
1671
1682
  /* @__PURE__ */ jsx3("legend", { style: styles2.label, children: "\u6743\u9650\u6807\u8BC6" }),
1672
- /* @__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" }) : permissionPoints.map((p) => /* @__PURE__ */ jsxs2("label", { style: styles2.checkItem, children: [
1683
+ permissionPoints.length > 0 ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
1684
+ /* @__PURE__ */ jsx3(
1685
+ "input",
1686
+ {
1687
+ style: { ...styles2.input, marginBottom: 8 },
1688
+ value: permissionKeyword,
1689
+ onChange: (e) => setPermissionKeyword(e.target.value),
1690
+ placeholder: "\u641C\u7D22\u6743\u9650\u540D\u79F0 / \u6807\u8BC6"
1691
+ }
1692
+ ),
1693
+ /* @__PURE__ */ jsxs2("div", { style: styles2.hint, children: [
1694
+ "\u5DF2\u9009 ",
1695
+ form.permissionPointIds.length,
1696
+ " \u9879",
1697
+ permissionKeyword.trim() ? ` \xB7 \u5339\u914D ${filteredPermissionPoints.length} / ${permissionPoints.length}` : ` \xB7 \u5171 ${permissionPoints.length} \u9879`
1698
+ ] })
1699
+ ] }) : null,
1700
+ /* @__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
1701
  /* @__PURE__ */ jsx3(
1674
1702
  "input",
1675
1703
  {