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.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
|
{
|
|
@@ -3553,7 +3567,10 @@ function UserManager({
|
|
|
3553
3567
|
/* @__PURE__ */ jsxs4("form", { style: styles4.form, onSubmit: (e) => void handleSubmit(e), children: [
|
|
3554
3568
|
formError ? /* @__PURE__ */ jsx5("div", { style: styles4.error, children: formError }) : null,
|
|
3555
3569
|
/* @__PURE__ */ jsxs4("label", { style: styles4.field, children: [
|
|
3556
|
-
/* @__PURE__ */
|
|
3570
|
+
/* @__PURE__ */ jsxs4("span", { style: styles4.label, children: [
|
|
3571
|
+
"\u8D26\u53F7 ",
|
|
3572
|
+
/* @__PURE__ */ jsx5("span", { style: styles4.required, children: "*" })
|
|
3573
|
+
] }),
|
|
3557
3574
|
/* @__PURE__ */ jsx5(
|
|
3558
3575
|
"input",
|
|
3559
3576
|
{
|
|
@@ -3566,7 +3583,10 @@ function UserManager({
|
|
|
3566
3583
|
)
|
|
3567
3584
|
] }),
|
|
3568
3585
|
/* @__PURE__ */ jsxs4("label", { style: styles4.field, children: [
|
|
3569
|
-
/* @__PURE__ */
|
|
3586
|
+
/* @__PURE__ */ jsxs4("span", { style: styles4.label, children: [
|
|
3587
|
+
"\u7528\u6237\u540D ",
|
|
3588
|
+
/* @__PURE__ */ jsx5("span", { style: styles4.required, children: "*" })
|
|
3589
|
+
] }),
|
|
3570
3590
|
/* @__PURE__ */ jsx5(
|
|
3571
3591
|
"input",
|
|
3572
3592
|
{
|
|
@@ -3578,8 +3598,11 @@ function UserManager({
|
|
|
3578
3598
|
}
|
|
3579
3599
|
)
|
|
3580
3600
|
] }),
|
|
3581
|
-
/* @__PURE__ */ jsxs4("label", { style: styles4.field, children: [
|
|
3582
|
-
/* @__PURE__ */
|
|
3601
|
+
!editing ? /* @__PURE__ */ jsxs4("label", { style: styles4.field, children: [
|
|
3602
|
+
/* @__PURE__ */ jsxs4("span", { style: styles4.label, children: [
|
|
3603
|
+
"\u521D\u59CB\u5BC6\u7801 ",
|
|
3604
|
+
/* @__PURE__ */ jsx5("span", { style: styles4.required, children: "*" })
|
|
3605
|
+
] }),
|
|
3583
3606
|
/* @__PURE__ */ jsx5(
|
|
3584
3607
|
"input",
|
|
3585
3608
|
{
|
|
@@ -3587,12 +3610,12 @@ function UserManager({
|
|
|
3587
3610
|
type: "password",
|
|
3588
3611
|
value: form.password,
|
|
3589
3612
|
onChange: (e) => setForm((prev) => ({ ...prev, password: e.target.value })),
|
|
3590
|
-
placeholder:
|
|
3591
|
-
required:
|
|
3613
|
+
placeholder: "\u8BF7\u8F93\u5165\u521D\u59CB\u5BC6\u7801",
|
|
3614
|
+
required: true,
|
|
3592
3615
|
autoComplete: "new-password"
|
|
3593
3616
|
}
|
|
3594
3617
|
)
|
|
3595
|
-
] }),
|
|
3618
|
+
] }) : null,
|
|
3596
3619
|
/* @__PURE__ */ jsxs4("fieldset", { style: styles4.fieldset, children: [
|
|
3597
3620
|
/* @__PURE__ */ jsxs4("legend", { style: styles4.label, children: [
|
|
3598
3621
|
"\u5F52\u5C5E\u90E8\u95E8 ",
|