com-angel-authorization 1.0.25 → 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/README.md +1 -1
- 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 +39 -15
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +39 -15
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +40 -15
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +40 -15
- 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);
|
|
@@ -1667,6 +1671,11 @@ var s2 = {
|
|
|
1667
1671
|
boxSizing: "border-box",
|
|
1668
1672
|
width: "100%"
|
|
1669
1673
|
},
|
|
1674
|
+
inputReadonly: {
|
|
1675
|
+
backgroundColor: "#f9fafb",
|
|
1676
|
+
color: "#667085",
|
|
1677
|
+
cursor: "not-allowed"
|
|
1678
|
+
},
|
|
1670
1679
|
control: {
|
|
1671
1680
|
width: "16px",
|
|
1672
1681
|
height: "16px",
|
|
@@ -1767,12 +1776,31 @@ var MenuManager = defineComponent3({
|
|
|
1767
1776
|
});
|
|
1768
1777
|
return Array.from(map.values());
|
|
1769
1778
|
});
|
|
1770
|
-
|
|
1771
|
-
|
|
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) => ({
|
|
1772
1790
|
value: row.resourceId,
|
|
1773
1791
|
label: `${row.name}\uFF08${MENU_TYPE_LABEL[row.type]}\uFF09`
|
|
1774
|
-
}))
|
|
1775
|
-
|
|
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
|
+
});
|
|
1776
1804
|
const flatRows = computed3(() => {
|
|
1777
1805
|
const rows = [];
|
|
1778
1806
|
const walk = (list) => {
|
|
@@ -1858,10 +1886,11 @@ var MenuManager = defineComponent3({
|
|
|
1858
1886
|
void loadPermissionPoints();
|
|
1859
1887
|
}
|
|
1860
1888
|
function openEdit(row) {
|
|
1889
|
+
const parentId = resolveRowParentId(row);
|
|
1861
1890
|
editing.value = row;
|
|
1862
1891
|
Object.assign(form, {
|
|
1863
|
-
parentId
|
|
1864
|
-
depth:
|
|
1892
|
+
parentId,
|
|
1893
|
+
depth: row.depth > 0 ? row.depth : resolveMenuDepth(parentId, allKnownMenus.value),
|
|
1865
1894
|
type: row.type,
|
|
1866
1895
|
name: row.name,
|
|
1867
1896
|
identification: row.identification,
|
|
@@ -2143,14 +2172,10 @@ var MenuManager = defineComponent3({
|
|
|
2143
2172
|
h2(
|
|
2144
2173
|
"select",
|
|
2145
2174
|
{
|
|
2146
|
-
style: s2.input,
|
|
2175
|
+
style: { ...s2.input, ...s2.inputReadonly },
|
|
2147
2176
|
value: form.parentId ?? ROOT_PARENT_ID,
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
const parentId = value ? value : null;
|
|
2151
|
-
form.parentId = parentId;
|
|
2152
|
-
form.depth = resolveMenuDepth(parentId, allKnownMenus.value);
|
|
2153
|
-
}
|
|
2177
|
+
disabled: true,
|
|
2178
|
+
"aria-readonly": "true"
|
|
2154
2179
|
},
|
|
2155
2180
|
[
|
|
2156
2181
|
h2("option", { value: ROOT_PARENT_ID }, "\u65E0"),
|