com-angel-authorization 1.0.26 → 1.0.27
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/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +31 -6
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +31 -6
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +32 -8
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +32 -8
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/vue/index.js
CHANGED
|
@@ -534,7 +534,7 @@ function mapMenuResource(item) {
|
|
|
534
534
|
);
|
|
535
535
|
const permissionNamesRaw = row.permissionPointNames ?? row.permission_point_names ?? row.permissionNames;
|
|
536
536
|
const permissionPointNames = Array.isArray(permissionNamesRaw) ? permissionNamesRaw.map((n) => String(n ?? "")).filter(Boolean) : void 0;
|
|
537
|
-
const rawParentId = row.parentId ?? row.parent_id;
|
|
537
|
+
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);
|
|
538
538
|
const parentId = rawParentId === void 0 || rawParentId === null || rawParentId === "" || String(rawParentId) === "0" ? null : String(rawParentId);
|
|
539
539
|
const rawDepth = row.depth;
|
|
540
540
|
const parsedDepth = Number(rawDepth);
|
|
@@ -691,7 +691,11 @@ function createMenuResourceApi(request) {
|
|
|
691
691
|
url: `/authorization-resources/${encodeURIComponent(resourceId)}/sub-resources`,
|
|
692
692
|
signal
|
|
693
693
|
});
|
|
694
|
-
return extractRecords(json).map(mapMenuResource).filter((item) => item !== null)
|
|
694
|
+
return extractRecords(json).map(mapMenuResource).filter((item) => item !== null).map((item) => ({
|
|
695
|
+
...item,
|
|
696
|
+
// 子资源接口常不回 parentId,用请求路径上的父级补齐
|
|
697
|
+
parentId: item.parentId ?? resourceId
|
|
698
|
+
}));
|
|
695
699
|
},
|
|
696
700
|
listPermissionPoints(params, signal) {
|
|
697
701
|
return permissionApi.list(params, signal);
|
|
@@ -1772,12 +1776,31 @@ var MenuManager = defineComponent3({
|
|
|
1772
1776
|
});
|
|
1773
1777
|
return Array.from(map.values());
|
|
1774
1778
|
});
|
|
1775
|
-
|
|
1776
|
-
|
|
1779
|
+
function resolveRowParentId(row) {
|
|
1780
|
+
if (row.parentId) return row.parentId;
|
|
1781
|
+
for (const [parentId, children] of Object.entries(childrenMap.value)) {
|
|
1782
|
+
if (children.some((child) => child.resourceId === row.resourceId)) {
|
|
1783
|
+
return parentId;
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
return null;
|
|
1787
|
+
}
|
|
1788
|
+
const parentOptions = computed3(() => {
|
|
1789
|
+
const opts = allKnownMenus.value.filter((row) => !editing.value || row.resourceId !== editing.value.resourceId).map((row) => ({
|
|
1777
1790
|
value: row.resourceId,
|
|
1778
1791
|
label: `${row.name}\uFF08${MENU_TYPE_LABEL[row.type]}\uFF09`
|
|
1779
|
-
}))
|
|
1780
|
-
|
|
1792
|
+
}));
|
|
1793
|
+
if (form.parentId && !opts.some((opt) => opt.value === form.parentId)) {
|
|
1794
|
+
const parent = allKnownMenus.value.find(
|
|
1795
|
+
(row) => row.resourceId === form.parentId
|
|
1796
|
+
);
|
|
1797
|
+
opts.unshift({
|
|
1798
|
+
value: form.parentId,
|
|
1799
|
+
label: parent ? `${parent.name}\uFF08${MENU_TYPE_LABEL[parent.type]}\uFF09` : form.parentId
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
return opts;
|
|
1803
|
+
});
|
|
1781
1804
|
const flatRows = computed3(() => {
|
|
1782
1805
|
const rows = [];
|
|
1783
1806
|
const walk = (list) => {
|
|
@@ -1863,10 +1886,11 @@ var MenuManager = defineComponent3({
|
|
|
1863
1886
|
void loadPermissionPoints();
|
|
1864
1887
|
}
|
|
1865
1888
|
function openEdit(row) {
|
|
1889
|
+
const parentId = resolveRowParentId(row);
|
|
1866
1890
|
editing.value = row;
|
|
1867
1891
|
Object.assign(form, {
|
|
1868
|
-
parentId
|
|
1869
|
-
depth:
|
|
1892
|
+
parentId,
|
|
1893
|
+
depth: row.depth > 0 ? row.depth : resolveMenuDepth(parentId, allKnownMenus.value),
|
|
1870
1894
|
type: row.type,
|
|
1871
1895
|
name: row.name,
|
|
1872
1896
|
identification: row.identification,
|