com-angel-authorization 1.0.32 → 1.0.34
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 +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +57 -39
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +2 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +58 -40
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +57 -34
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.cts +2 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.js +57 -34
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -171,6 +171,8 @@ type UpdateAuthorizationResourceBody = Partial<AuthorizationResourceFormValues>
|
|
|
171
171
|
type?: ApiResourceType;
|
|
172
172
|
};
|
|
173
173
|
type FetchAuthorizationResourcesParams = {
|
|
174
|
+
/** 按名称 / 标识搜索 */
|
|
175
|
+
keyword?: string;
|
|
174
176
|
pagination?: ListPaginationParams;
|
|
175
177
|
};
|
|
176
178
|
type AuthorizationResourceListResult = {
|
package/dist/react/index.d.ts
CHANGED
|
@@ -171,6 +171,8 @@ type UpdateAuthorizationResourceBody = Partial<AuthorizationResourceFormValues>
|
|
|
171
171
|
type?: ApiResourceType;
|
|
172
172
|
};
|
|
173
173
|
type FetchAuthorizationResourcesParams = {
|
|
174
|
+
/** 按名称 / 标识搜索 */
|
|
175
|
+
keyword?: string;
|
|
174
176
|
pagination?: ListPaginationParams;
|
|
175
177
|
};
|
|
176
178
|
type AuthorizationResourceListResult = {
|
package/dist/react/index.js
CHANGED
|
@@ -517,6 +517,7 @@ function buildListUrl(type, params) {
|
|
|
517
517
|
if (params?.depth !== void 0 && params?.depth !== null && String(params.depth) !== "") {
|
|
518
518
|
appendQueryParam(parts, "depth", String(params.depth));
|
|
519
519
|
}
|
|
520
|
+
appendQueryParam(parts, "keyword", params?.keyword ?? "");
|
|
520
521
|
appendQueryParam(parts, "page-token", params?.pagination?.pageToken ?? "");
|
|
521
522
|
appendQueryParam(parts, "page-size", params?.pagination?.pageSize ?? "20");
|
|
522
523
|
appendQueryParam(parts, "page-direction", params?.pagination?.pageDirection ?? "current");
|
|
@@ -1243,7 +1244,7 @@ import {
|
|
|
1243
1244
|
useMemo as useMemo3,
|
|
1244
1245
|
useState as useState3
|
|
1245
1246
|
} from "react";
|
|
1246
|
-
import {
|
|
1247
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1247
1248
|
var PAGE_SIZE_OPTIONS2 = ["10", "20", "50", "100"];
|
|
1248
1249
|
var emptyForm2 = () => ({
|
|
1249
1250
|
parentId: null,
|
|
@@ -1279,18 +1280,12 @@ function MenuManager({
|
|
|
1279
1280
|
const [deletingRow, setDeletingRow] = useState3(null);
|
|
1280
1281
|
const [deleting, setDeleting] = useState3(false);
|
|
1281
1282
|
const [permissionKeyword, setPermissionKeyword] = useState3("");
|
|
1283
|
+
const [permissionLoading, setPermissionLoading] = useState3(false);
|
|
1282
1284
|
const permissionNameMap = useMemo3(() => {
|
|
1283
1285
|
const map = /* @__PURE__ */ new Map();
|
|
1284
1286
|
permissionPoints.forEach((p) => map.set(p.resourceId, p.name || p.identification));
|
|
1285
1287
|
return map;
|
|
1286
1288
|
}, [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]);
|
|
1294
1289
|
const allKnownMenus = useMemo3(() => {
|
|
1295
1290
|
const map = /* @__PURE__ */ new Map();
|
|
1296
1291
|
records.forEach((row) => map.set(row.resourceId, row));
|
|
@@ -1366,15 +1361,28 @@ function MenuManager({
|
|
|
1366
1361
|
},
|
|
1367
1362
|
[api, pageSize, pageToken]
|
|
1368
1363
|
);
|
|
1369
|
-
const loadPermissionPoints = useCallback3(
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1364
|
+
const loadPermissionPoints = useCallback3(
|
|
1365
|
+
async (keyword = "", signal) => {
|
|
1366
|
+
setPermissionLoading(true);
|
|
1367
|
+
try {
|
|
1368
|
+
const result = await api.listPermissionPoints(
|
|
1369
|
+
{
|
|
1370
|
+
keyword: keyword.trim() || void 0,
|
|
1371
|
+
pagination: { pageSize: "200", pageDirection: "current" }
|
|
1372
|
+
},
|
|
1373
|
+
signal
|
|
1374
|
+
);
|
|
1375
|
+
if (!signal?.aborted) {
|
|
1376
|
+
setPermissionPoints(result.records);
|
|
1377
|
+
}
|
|
1378
|
+
} catch (err) {
|
|
1379
|
+
if (signal?.aborted) return;
|
|
1380
|
+
} finally {
|
|
1381
|
+
if (!signal?.aborted) setPermissionLoading(false);
|
|
1382
|
+
}
|
|
1383
|
+
},
|
|
1384
|
+
[api]
|
|
1385
|
+
);
|
|
1378
1386
|
const toggleExpand = async (row) => {
|
|
1379
1387
|
if (isMenuLeaf(row)) return;
|
|
1380
1388
|
const id = row.resourceId;
|
|
@@ -1400,8 +1408,18 @@ function MenuManager({
|
|
|
1400
1408
|
};
|
|
1401
1409
|
useEffect3(() => {
|
|
1402
1410
|
void loadList("current", "");
|
|
1403
|
-
void loadPermissionPoints();
|
|
1404
1411
|
}, [api, pageSize]);
|
|
1412
|
+
useEffect3(() => {
|
|
1413
|
+
if (!dialogOpen) return;
|
|
1414
|
+
const controller = new AbortController();
|
|
1415
|
+
const timer = window.setTimeout(() => {
|
|
1416
|
+
void loadPermissionPoints(permissionKeyword, controller.signal);
|
|
1417
|
+
}, 300);
|
|
1418
|
+
return () => {
|
|
1419
|
+
controller.abort();
|
|
1420
|
+
window.clearTimeout(timer);
|
|
1421
|
+
};
|
|
1422
|
+
}, [dialogOpen, permissionKeyword, loadPermissionPoints]);
|
|
1405
1423
|
const openCreate = (parent) => {
|
|
1406
1424
|
setEditing(null);
|
|
1407
1425
|
setPermissionKeyword("");
|
|
@@ -1415,7 +1433,6 @@ function MenuManager({
|
|
|
1415
1433
|
setForm(emptyForm2());
|
|
1416
1434
|
}
|
|
1417
1435
|
setDialogOpen(true);
|
|
1418
|
-
void loadPermissionPoints();
|
|
1419
1436
|
};
|
|
1420
1437
|
const openEdit = (row) => {
|
|
1421
1438
|
const parentId = resolveRowParentId(row);
|
|
@@ -1432,7 +1449,6 @@ function MenuManager({
|
|
|
1432
1449
|
sort: Number.isFinite(row.sort) ? row.sort : 0
|
|
1433
1450
|
});
|
|
1434
1451
|
setDialogOpen(true);
|
|
1435
|
-
void loadPermissionPoints();
|
|
1436
1452
|
};
|
|
1437
1453
|
const closeDialog = () => {
|
|
1438
1454
|
if (saving) return;
|
|
@@ -1703,24 +1719,22 @@ function MenuManager({
|
|
|
1703
1719
|
] }),
|
|
1704
1720
|
/* @__PURE__ */ jsxs2("fieldset", { style: styles2.fieldset, children: [
|
|
1705
1721
|
/* @__PURE__ */ jsx3("legend", { style: styles2.label, children: "\u6743\u9650\u6807\u8BC6" }),
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
{
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
] }) : null,
|
|
1723
|
-
/* @__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: [
|
|
1722
|
+
/* @__PURE__ */ jsx3(
|
|
1723
|
+
"input",
|
|
1724
|
+
{
|
|
1725
|
+
style: { ...styles2.input, marginBottom: 8 },
|
|
1726
|
+
value: permissionKeyword,
|
|
1727
|
+
onChange: (e) => setPermissionKeyword(e.target.value),
|
|
1728
|
+
placeholder: "\u641C\u7D22\u6743\u9650\u540D\u79F0 / \u6807\u8BC6"
|
|
1729
|
+
}
|
|
1730
|
+
),
|
|
1731
|
+
/* @__PURE__ */ jsxs2("div", { style: styles2.hint, children: [
|
|
1732
|
+
"\u5DF2\u9009 ",
|
|
1733
|
+
form.permissionPointIds.length,
|
|
1734
|
+
" \u9879",
|
|
1735
|
+
permissionLoading ? " \xB7 \u641C\u7D22\u4E2D\u2026" : permissionKeyword.trim() ? ` \xB7 \u8FD4\u56DE ${permissionPoints.length} \u9879` : ` \xB7 \u5171 ${permissionPoints.length} \u9879`
|
|
1736
|
+
] }),
|
|
1737
|
+
/* @__PURE__ */ jsx3("div", { style: styles2.multiSelect, children: permissionLoading && permissionPoints.length === 0 ? /* @__PURE__ */ jsx3("div", { style: styles2.hint, children: "\u52A0\u8F7D\u4E2D\u2026" }) : permissionPoints.length === 0 ? /* @__PURE__ */ jsx3("div", { style: styles2.hint, children: permissionKeyword.trim() ? "\u65E0\u5339\u914D\u6743\u9650\u70B9" : "\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: [
|
|
1724
1738
|
/* @__PURE__ */ jsx3(
|
|
1725
1739
|
"input",
|
|
1726
1740
|
{
|
|
@@ -3560,11 +3574,15 @@ function UserManager({
|
|
|
3560
3574
|
/* @__PURE__ */ jsx5(
|
|
3561
3575
|
"input",
|
|
3562
3576
|
{
|
|
3563
|
-
style:
|
|
3577
|
+
style: {
|
|
3578
|
+
...styles4.input,
|
|
3579
|
+
...editing ? { background: "#f9fafb", color: "#667085", cursor: "not-allowed" } : null
|
|
3580
|
+
},
|
|
3564
3581
|
value: form.username,
|
|
3565
3582
|
onChange: (e) => setForm((prev) => ({ ...prev, username: e.target.value })),
|
|
3566
3583
|
placeholder: "\u8D26\u53F7\u9700\u5305\u542B\u82F1\u6587\u5B57\u6BCD\uFF0C\u53EF\u642D\u914D\u6570\u5B57\uFF0C\u4E0D\u652F\u6301\u4E2D\u6587\u6216\u7279\u6B8A\u7B26\u53F7\u3002",
|
|
3567
|
-
required: true
|
|
3584
|
+
required: true,
|
|
3585
|
+
readOnly: Boolean(editing)
|
|
3568
3586
|
}
|
|
3569
3587
|
)
|
|
3570
3588
|
] }),
|