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.cjs
CHANGED
|
@@ -616,7 +616,7 @@ function mapMenuResource(item) {
|
|
|
616
616
|
);
|
|
617
617
|
const permissionNamesRaw = row.permissionPointNames ?? row.permission_point_names ?? row.permissionNames;
|
|
618
618
|
const permissionPointNames = Array.isArray(permissionNamesRaw) ? permissionNamesRaw.map((n) => String(n ?? "")).filter(Boolean) : void 0;
|
|
619
|
-
const rawParentId = row.parentId ?? row.parent_id;
|
|
619
|
+
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
620
|
const parentId = rawParentId === void 0 || rawParentId === null || rawParentId === "" || String(rawParentId) === "0" ? null : String(rawParentId);
|
|
621
621
|
const rawDepth = row.depth;
|
|
622
622
|
const parsedDepth = Number(rawDepth);
|
|
@@ -773,7 +773,11 @@ function createMenuResourceApi(request) {
|
|
|
773
773
|
url: `/authorization-resources/${encodeURIComponent(resourceId)}/sub-resources`,
|
|
774
774
|
signal
|
|
775
775
|
});
|
|
776
|
-
return extractRecords(json).map(mapMenuResource).filter((item) => item !== null)
|
|
776
|
+
return extractRecords(json).map(mapMenuResource).filter((item) => item !== null).map((item) => ({
|
|
777
|
+
...item,
|
|
778
|
+
// 子资源接口常不回 parentId,用请求路径上的父级补齐
|
|
779
|
+
parentId: item.parentId ?? resourceId
|
|
780
|
+
}));
|
|
777
781
|
},
|
|
778
782
|
listPermissionPoints(params, signal) {
|
|
779
783
|
return permissionApi.list(params, signal);
|
|
@@ -1846,12 +1850,31 @@ var MenuManager = (0, import_vue4.defineComponent)({
|
|
|
1846
1850
|
});
|
|
1847
1851
|
return Array.from(map.values());
|
|
1848
1852
|
});
|
|
1849
|
-
|
|
1850
|
-
|
|
1853
|
+
function resolveRowParentId(row) {
|
|
1854
|
+
if (row.parentId) return row.parentId;
|
|
1855
|
+
for (const [parentId, children] of Object.entries(childrenMap.value)) {
|
|
1856
|
+
if (children.some((child) => child.resourceId === row.resourceId)) {
|
|
1857
|
+
return parentId;
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
return null;
|
|
1861
|
+
}
|
|
1862
|
+
const parentOptions = (0, import_vue4.computed)(() => {
|
|
1863
|
+
const opts = allKnownMenus.value.filter((row) => !editing.value || row.resourceId !== editing.value.resourceId).map((row) => ({
|
|
1851
1864
|
value: row.resourceId,
|
|
1852
1865
|
label: `${row.name}\uFF08${MENU_TYPE_LABEL[row.type]}\uFF09`
|
|
1853
|
-
}))
|
|
1854
|
-
|
|
1866
|
+
}));
|
|
1867
|
+
if (form.parentId && !opts.some((opt) => opt.value === form.parentId)) {
|
|
1868
|
+
const parent = allKnownMenus.value.find(
|
|
1869
|
+
(row) => row.resourceId === form.parentId
|
|
1870
|
+
);
|
|
1871
|
+
opts.unshift({
|
|
1872
|
+
value: form.parentId,
|
|
1873
|
+
label: parent ? `${parent.name}\uFF08${MENU_TYPE_LABEL[parent.type]}\uFF09` : form.parentId
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1876
|
+
return opts;
|
|
1877
|
+
});
|
|
1855
1878
|
const flatRows = (0, import_vue4.computed)(() => {
|
|
1856
1879
|
const rows = [];
|
|
1857
1880
|
const walk = (list) => {
|
|
@@ -1937,10 +1960,11 @@ var MenuManager = (0, import_vue4.defineComponent)({
|
|
|
1937
1960
|
void loadPermissionPoints();
|
|
1938
1961
|
}
|
|
1939
1962
|
function openEdit(row) {
|
|
1963
|
+
const parentId = resolveRowParentId(row);
|
|
1940
1964
|
editing.value = row;
|
|
1941
1965
|
Object.assign(form, {
|
|
1942
|
-
parentId
|
|
1943
|
-
depth:
|
|
1966
|
+
parentId,
|
|
1967
|
+
depth: row.depth > 0 ? row.depth : resolveMenuDepth(parentId, allKnownMenus.value),
|
|
1944
1968
|
type: row.type,
|
|
1945
1969
|
name: row.name,
|
|
1946
1970
|
identification: row.identification,
|