com-angel-authorization 1.0.28 → 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 +27 -3
- 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 +27 -3
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +27 -3
- 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 +27 -3
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/vue/index.cjs
CHANGED
|
@@ -584,6 +584,23 @@ function toStringArray(value) {
|
|
|
584
584
|
}
|
|
585
585
|
return [];
|
|
586
586
|
}
|
|
587
|
+
function mapMenuPermissionPoints(value) {
|
|
588
|
+
if (!Array.isArray(value)) return void 0;
|
|
589
|
+
const points = value.map((item) => {
|
|
590
|
+
if (!item || typeof item !== "object") return null;
|
|
591
|
+
const row = item;
|
|
592
|
+
const name = String(row.name ?? "").trim();
|
|
593
|
+
if (!name) return null;
|
|
594
|
+
const resourceId = row.resourceId ?? row.resource_id ?? row.id;
|
|
595
|
+
const identification = row.identification ?? row.identity;
|
|
596
|
+
return {
|
|
597
|
+
...resourceId !== void 0 && resourceId !== null && resourceId !== "" ? { resourceId: String(resourceId) } : {},
|
|
598
|
+
name,
|
|
599
|
+
...identification !== void 0 && identification !== null && identification !== "" ? { identification: String(identification) } : {}
|
|
600
|
+
};
|
|
601
|
+
}).filter((item) => item !== null);
|
|
602
|
+
return points.length ? points : void 0;
|
|
603
|
+
}
|
|
587
604
|
function toMenuType(value) {
|
|
588
605
|
const v = String(value ?? "").toLowerCase();
|
|
589
606
|
if (v === MENU_TYPE_PAGE || v === MENU_TYPE_MENU || v === MENU_TYPE_BUTTON) {
|
|
@@ -611,11 +628,14 @@ function mapMenuResource(item) {
|
|
|
611
628
|
const row = item;
|
|
612
629
|
const resourceId = row.resourceId ?? row.resource_id ?? row.id;
|
|
613
630
|
if (resourceId === void 0 || resourceId === null || resourceId === "") return null;
|
|
631
|
+
const permissionPoints = mapMenuPermissionPoints(
|
|
632
|
+
row.permissionPoints ?? row.permission_points
|
|
633
|
+
);
|
|
614
634
|
const permissionPointIds = toStringArray(
|
|
615
|
-
row.permissionPointIds ?? row.permission_point_ids ??
|
|
635
|
+
row.permissionPointIds ?? row.permission_point_ids ?? (permissionPoints?.length ? permissionPoints.map((p) => p.resourceId).filter(Boolean) : void 0) ?? row.permissions
|
|
616
636
|
);
|
|
617
637
|
const permissionNamesRaw = row.permissionPointNames ?? row.permission_point_names ?? row.permissionNames;
|
|
618
|
-
const permissionPointNames = Array.isArray(permissionNamesRaw) ? permissionNamesRaw.map((n) => String(n ?? "")).filter(Boolean) :
|
|
638
|
+
const permissionPointNames = Array.isArray(permissionNamesRaw) ? permissionNamesRaw.map((n) => String(n ?? "")).filter(Boolean) : permissionPoints?.map((p) => p.name).filter(Boolean);
|
|
619
639
|
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);
|
|
620
640
|
const parentId = rawParentId === void 0 || rawParentId === null || rawParentId === "" || String(rawParentId) === "0" ? null : String(rawParentId);
|
|
621
641
|
const rawDepth = row.depth;
|
|
@@ -635,7 +655,8 @@ function mapMenuResource(item) {
|
|
|
635
655
|
name: String(row.name ?? ""),
|
|
636
656
|
identification: String(row.identification ?? row.identity ?? row.path ?? ""),
|
|
637
657
|
permissionPointIds,
|
|
638
|
-
|
|
658
|
+
permissionPoints,
|
|
659
|
+
permissionPointNames: permissionPointNames && permissionPointNames.length ? permissionPointNames : void 0,
|
|
639
660
|
status: toResourceStatus(row.status),
|
|
640
661
|
sort
|
|
641
662
|
};
|
|
@@ -2038,6 +2059,9 @@ var MenuManager = (0, import_vue4.defineComponent)({
|
|
|
2038
2059
|
form.permissionPointIds = exists ? form.permissionPointIds.filter((x) => x !== id) : [...form.permissionPointIds, id];
|
|
2039
2060
|
}
|
|
2040
2061
|
function renderPermissionLabels(row) {
|
|
2062
|
+
if (row.permissionPoints?.length) {
|
|
2063
|
+
return row.permissionPoints.map((p) => p.name).filter(Boolean).join("\u3001") || "\u2014";
|
|
2064
|
+
}
|
|
2041
2065
|
if (row.permissionPointNames?.length) {
|
|
2042
2066
|
return row.permissionPointNames.join("\u3001");
|
|
2043
2067
|
}
|