com-angel-authorization 1.0.31 → 1.0.33
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 -2
- 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 +67 -44
- 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 +68 -45
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +63 -44
- 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 +63 -44
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -595,6 +595,7 @@ function buildListUrl(type, params) {
|
|
|
595
595
|
if (params?.depth !== void 0 && params?.depth !== null && String(params.depth) !== "") {
|
|
596
596
|
appendQueryParam(parts, "depth", String(params.depth));
|
|
597
597
|
}
|
|
598
|
+
appendQueryParam(parts, "keyword", params?.keyword ?? "");
|
|
598
599
|
appendQueryParam(parts, "page-token", params?.pagination?.pageToken ?? "");
|
|
599
600
|
appendQueryParam(parts, "page-size", params?.pagination?.pageSize ?? "20");
|
|
600
601
|
appendQueryParam(parts, "page-direction", params?.pagination?.pageDirection ?? "current");
|
|
@@ -1352,18 +1353,12 @@ function MenuManager({
|
|
|
1352
1353
|
const [deletingRow, setDeletingRow] = (0, import_react3.useState)(null);
|
|
1353
1354
|
const [deleting, setDeleting] = (0, import_react3.useState)(false);
|
|
1354
1355
|
const [permissionKeyword, setPermissionKeyword] = (0, import_react3.useState)("");
|
|
1356
|
+
const [permissionLoading, setPermissionLoading] = (0, import_react3.useState)(false);
|
|
1355
1357
|
const permissionNameMap = (0, import_react3.useMemo)(() => {
|
|
1356
1358
|
const map = /* @__PURE__ */ new Map();
|
|
1357
1359
|
permissionPoints.forEach((p) => map.set(p.resourceId, p.name || p.identification));
|
|
1358
1360
|
return map;
|
|
1359
1361
|
}, [permissionPoints]);
|
|
1360
|
-
const filteredPermissionPoints = (0, import_react3.useMemo)(() => {
|
|
1361
|
-
const kw = permissionKeyword.trim().toLowerCase();
|
|
1362
|
-
if (!kw) return permissionPoints;
|
|
1363
|
-
return permissionPoints.filter(
|
|
1364
|
-
(p) => p.name.toLowerCase().includes(kw) || p.identification.toLowerCase().includes(kw)
|
|
1365
|
-
);
|
|
1366
|
-
}, [permissionPoints, permissionKeyword]);
|
|
1367
1362
|
const allKnownMenus = (0, import_react3.useMemo)(() => {
|
|
1368
1363
|
const map = /* @__PURE__ */ new Map();
|
|
1369
1364
|
records.forEach((row) => map.set(row.resourceId, row));
|
|
@@ -1439,15 +1434,28 @@ function MenuManager({
|
|
|
1439
1434
|
},
|
|
1440
1435
|
[api, pageSize, pageToken]
|
|
1441
1436
|
);
|
|
1442
|
-
const loadPermissionPoints = (0, import_react3.useCallback)(
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1437
|
+
const loadPermissionPoints = (0, import_react3.useCallback)(
|
|
1438
|
+
async (keyword = "", signal) => {
|
|
1439
|
+
setPermissionLoading(true);
|
|
1440
|
+
try {
|
|
1441
|
+
const result = await api.listPermissionPoints(
|
|
1442
|
+
{
|
|
1443
|
+
keyword: keyword.trim() || void 0,
|
|
1444
|
+
pagination: { pageSize: "200", pageDirection: "current" }
|
|
1445
|
+
},
|
|
1446
|
+
signal
|
|
1447
|
+
);
|
|
1448
|
+
if (!signal?.aborted) {
|
|
1449
|
+
setPermissionPoints(result.records);
|
|
1450
|
+
}
|
|
1451
|
+
} catch (err) {
|
|
1452
|
+
if (signal?.aborted) return;
|
|
1453
|
+
} finally {
|
|
1454
|
+
if (!signal?.aborted) setPermissionLoading(false);
|
|
1455
|
+
}
|
|
1456
|
+
},
|
|
1457
|
+
[api]
|
|
1458
|
+
);
|
|
1451
1459
|
const toggleExpand = async (row) => {
|
|
1452
1460
|
if (isMenuLeaf(row)) return;
|
|
1453
1461
|
const id = row.resourceId;
|
|
@@ -1473,8 +1481,18 @@ function MenuManager({
|
|
|
1473
1481
|
};
|
|
1474
1482
|
(0, import_react3.useEffect)(() => {
|
|
1475
1483
|
void loadList("current", "");
|
|
1476
|
-
void loadPermissionPoints();
|
|
1477
1484
|
}, [api, pageSize]);
|
|
1485
|
+
(0, import_react3.useEffect)(() => {
|
|
1486
|
+
if (!dialogOpen) return;
|
|
1487
|
+
const controller = new AbortController();
|
|
1488
|
+
const timer = window.setTimeout(() => {
|
|
1489
|
+
void loadPermissionPoints(permissionKeyword, controller.signal);
|
|
1490
|
+
}, 300);
|
|
1491
|
+
return () => {
|
|
1492
|
+
controller.abort();
|
|
1493
|
+
window.clearTimeout(timer);
|
|
1494
|
+
};
|
|
1495
|
+
}, [dialogOpen, permissionKeyword, loadPermissionPoints]);
|
|
1478
1496
|
const openCreate = (parent) => {
|
|
1479
1497
|
setEditing(null);
|
|
1480
1498
|
setPermissionKeyword("");
|
|
@@ -1488,7 +1506,6 @@ function MenuManager({
|
|
|
1488
1506
|
setForm(emptyForm2());
|
|
1489
1507
|
}
|
|
1490
1508
|
setDialogOpen(true);
|
|
1491
|
-
void loadPermissionPoints();
|
|
1492
1509
|
};
|
|
1493
1510
|
const openEdit = (row) => {
|
|
1494
1511
|
const parentId = resolveRowParentId(row);
|
|
@@ -1505,7 +1522,6 @@ function MenuManager({
|
|
|
1505
1522
|
sort: Number.isFinite(row.sort) ? row.sort : 0
|
|
1506
1523
|
});
|
|
1507
1524
|
setDialogOpen(true);
|
|
1508
|
-
void loadPermissionPoints();
|
|
1509
1525
|
};
|
|
1510
1526
|
const closeDialog = () => {
|
|
1511
1527
|
if (saving) return;
|
|
@@ -1776,24 +1792,22 @@ function MenuManager({
|
|
|
1776
1792
|
] }),
|
|
1777
1793
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("fieldset", { style: styles2.fieldset, children: [
|
|
1778
1794
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("legend", { style: styles2.label, children: "\u6743\u9650\u6807\u8BC6" }),
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
{
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
] }) : null,
|
|
1796
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: styles2.multiSelect, children: permissionPoints.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("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__ */ (0, import_jsx_runtime3.jsx)("div", { style: styles2.hint, children: "\u65E0\u5339\u914D\u6743\u9650\u70B9" }) : filteredPermissionPoints.map((p) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { style: styles2.checkItem, children: [
|
|
1795
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1796
|
+
"input",
|
|
1797
|
+
{
|
|
1798
|
+
style: { ...styles2.input, marginBottom: 8 },
|
|
1799
|
+
value: permissionKeyword,
|
|
1800
|
+
onChange: (e) => setPermissionKeyword(e.target.value),
|
|
1801
|
+
placeholder: "\u641C\u7D22\u6743\u9650\u540D\u79F0 / \u6807\u8BC6"
|
|
1802
|
+
}
|
|
1803
|
+
),
|
|
1804
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: styles2.hint, children: [
|
|
1805
|
+
"\u5DF2\u9009 ",
|
|
1806
|
+
form.permissionPointIds.length,
|
|
1807
|
+
" \u9879",
|
|
1808
|
+
permissionLoading ? " \xB7 \u641C\u7D22\u4E2D\u2026" : permissionKeyword.trim() ? ` \xB7 \u8FD4\u56DE ${permissionPoints.length} \u9879` : ` \xB7 \u5171 ${permissionPoints.length} \u9879`
|
|
1809
|
+
] }),
|
|
1810
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: styles2.multiSelect, children: permissionLoading && permissionPoints.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: styles2.hint, children: "\u52A0\u8F7D\u4E2D\u2026" }) : permissionPoints.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("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__ */ (0, import_jsx_runtime3.jsxs)("label", { style: styles2.checkItem, children: [
|
|
1797
1811
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1798
1812
|
"input",
|
|
1799
1813
|
{
|
|
@@ -3617,7 +3631,10 @@ function UserManager({
|
|
|
3617
3631
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { style: styles4.form, onSubmit: (e) => void handleSubmit(e), children: [
|
|
3618
3632
|
formError ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: styles4.error, children: formError }) : null,
|
|
3619
3633
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: styles4.field, children: [
|
|
3620
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
3634
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: styles4.label, children: [
|
|
3635
|
+
"\u8D26\u53F7 ",
|
|
3636
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles4.required, children: "*" })
|
|
3637
|
+
] }),
|
|
3621
3638
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3622
3639
|
"input",
|
|
3623
3640
|
{
|
|
@@ -3630,7 +3647,10 @@ function UserManager({
|
|
|
3630
3647
|
)
|
|
3631
3648
|
] }),
|
|
3632
3649
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: styles4.field, children: [
|
|
3633
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
3650
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: styles4.label, children: [
|
|
3651
|
+
"\u7528\u6237\u540D ",
|
|
3652
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles4.required, children: "*" })
|
|
3653
|
+
] }),
|
|
3634
3654
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3635
3655
|
"input",
|
|
3636
3656
|
{
|
|
@@ -3642,8 +3662,11 @@ function UserManager({
|
|
|
3642
3662
|
}
|
|
3643
3663
|
)
|
|
3644
3664
|
] }),
|
|
3645
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: styles4.field, children: [
|
|
3646
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
3665
|
+
!editing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { style: styles4.field, children: [
|
|
3666
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: styles4.label, children: [
|
|
3667
|
+
"\u521D\u59CB\u5BC6\u7801 ",
|
|
3668
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: styles4.required, children: "*" })
|
|
3669
|
+
] }),
|
|
3647
3670
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3648
3671
|
"input",
|
|
3649
3672
|
{
|
|
@@ -3651,12 +3674,12 @@ function UserManager({
|
|
|
3651
3674
|
type: "password",
|
|
3652
3675
|
value: form.password,
|
|
3653
3676
|
onChange: (e) => setForm((prev) => ({ ...prev, password: e.target.value })),
|
|
3654
|
-
placeholder:
|
|
3655
|
-
required:
|
|
3677
|
+
placeholder: "\u8BF7\u8F93\u5165\u521D\u59CB\u5BC6\u7801",
|
|
3678
|
+
required: true,
|
|
3656
3679
|
autoComplete: "new-password"
|
|
3657
3680
|
}
|
|
3658
3681
|
)
|
|
3659
|
-
] }),
|
|
3682
|
+
] }) : null,
|
|
3660
3683
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("fieldset", { style: styles4.fieldset, children: [
|
|
3661
3684
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("legend", { style: styles4.label, children: [
|
|
3662
3685
|
"\u5F52\u5C5E\u90E8\u95E8 ",
|