com-angel-authorization 1.0.26 → 1.0.28
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 +60 -7
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +61 -8
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +62 -10
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +62 -10
- 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);
|
|
@@ -1757,6 +1761,7 @@ var MenuManager = defineComponent3({
|
|
|
1757
1761
|
const saving = ref2(false);
|
|
1758
1762
|
const deletingRow = ref2(null);
|
|
1759
1763
|
const deleting = ref2(false);
|
|
1764
|
+
const permissionKeyword = ref2("");
|
|
1760
1765
|
const permissionNameMap = computed3(() => {
|
|
1761
1766
|
const map = /* @__PURE__ */ new Map();
|
|
1762
1767
|
permissionPoints.value.forEach(
|
|
@@ -1764,6 +1769,13 @@ var MenuManager = defineComponent3({
|
|
|
1764
1769
|
);
|
|
1765
1770
|
return map;
|
|
1766
1771
|
});
|
|
1772
|
+
const filteredPermissionPoints = computed3(() => {
|
|
1773
|
+
const kw = permissionKeyword.value.trim().toLowerCase();
|
|
1774
|
+
if (!kw) return permissionPoints.value;
|
|
1775
|
+
return permissionPoints.value.filter(
|
|
1776
|
+
(p) => p.name.toLowerCase().includes(kw) || p.identification.toLowerCase().includes(kw)
|
|
1777
|
+
);
|
|
1778
|
+
});
|
|
1767
1779
|
const allKnownMenus = computed3(() => {
|
|
1768
1780
|
const map = /* @__PURE__ */ new Map();
|
|
1769
1781
|
records.value.forEach((row) => map.set(row.resourceId, row));
|
|
@@ -1772,12 +1784,31 @@ var MenuManager = defineComponent3({
|
|
|
1772
1784
|
});
|
|
1773
1785
|
return Array.from(map.values());
|
|
1774
1786
|
});
|
|
1775
|
-
|
|
1776
|
-
|
|
1787
|
+
function resolveRowParentId(row) {
|
|
1788
|
+
if (row.parentId) return row.parentId;
|
|
1789
|
+
for (const [parentId, children] of Object.entries(childrenMap.value)) {
|
|
1790
|
+
if (children.some((child) => child.resourceId === row.resourceId)) {
|
|
1791
|
+
return parentId;
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
return null;
|
|
1795
|
+
}
|
|
1796
|
+
const parentOptions = computed3(() => {
|
|
1797
|
+
const opts = allKnownMenus.value.filter((row) => !editing.value || row.resourceId !== editing.value.resourceId).map((row) => ({
|
|
1777
1798
|
value: row.resourceId,
|
|
1778
1799
|
label: `${row.name}\uFF08${MENU_TYPE_LABEL[row.type]}\uFF09`
|
|
1779
|
-
}))
|
|
1780
|
-
|
|
1800
|
+
}));
|
|
1801
|
+
if (form.parentId && !opts.some((opt) => opt.value === form.parentId)) {
|
|
1802
|
+
const parent = allKnownMenus.value.find(
|
|
1803
|
+
(row) => row.resourceId === form.parentId
|
|
1804
|
+
);
|
|
1805
|
+
opts.unshift({
|
|
1806
|
+
value: form.parentId,
|
|
1807
|
+
label: parent ? `${parent.name}\uFF08${MENU_TYPE_LABEL[parent.type]}\uFF09` : form.parentId
|
|
1808
|
+
});
|
|
1809
|
+
}
|
|
1810
|
+
return opts;
|
|
1811
|
+
});
|
|
1781
1812
|
const flatRows = computed3(() => {
|
|
1782
1813
|
const rows = [];
|
|
1783
1814
|
const walk = (list) => {
|
|
@@ -1850,6 +1881,7 @@ var MenuManager = defineComponent3({
|
|
|
1850
1881
|
}
|
|
1851
1882
|
function openCreate(parent) {
|
|
1852
1883
|
editing.value = null;
|
|
1884
|
+
permissionKeyword.value = "";
|
|
1853
1885
|
if (parent) {
|
|
1854
1886
|
Object.assign(form, {
|
|
1855
1887
|
...emptyForm2(),
|
|
@@ -1863,10 +1895,12 @@ var MenuManager = defineComponent3({
|
|
|
1863
1895
|
void loadPermissionPoints();
|
|
1864
1896
|
}
|
|
1865
1897
|
function openEdit(row) {
|
|
1898
|
+
const parentId = resolveRowParentId(row);
|
|
1866
1899
|
editing.value = row;
|
|
1900
|
+
permissionKeyword.value = "";
|
|
1867
1901
|
Object.assign(form, {
|
|
1868
|
-
parentId
|
|
1869
|
-
depth:
|
|
1902
|
+
parentId,
|
|
1903
|
+
depth: row.depth > 0 ? row.depth : resolveMenuDepth(parentId, allKnownMenus.value),
|
|
1870
1904
|
type: row.type,
|
|
1871
1905
|
name: row.name,
|
|
1872
1906
|
identification: row.identification,
|
|
@@ -1878,7 +1912,10 @@ var MenuManager = defineComponent3({
|
|
|
1878
1912
|
void loadPermissionPoints();
|
|
1879
1913
|
}
|
|
1880
1914
|
function closeDialog() {
|
|
1881
|
-
if (!saving.value)
|
|
1915
|
+
if (!saving.value) {
|
|
1916
|
+
dialogOpen.value = false;
|
|
1917
|
+
permissionKeyword.value = "";
|
|
1918
|
+
}
|
|
1882
1919
|
}
|
|
1883
1920
|
async function handleSubmit(event) {
|
|
1884
1921
|
event.preventDefault();
|
|
@@ -2226,6 +2263,21 @@ var MenuManager = defineComponent3({
|
|
|
2226
2263
|
]),
|
|
2227
2264
|
h2("fieldset", { style: s2.fieldset }, [
|
|
2228
2265
|
h2("legend", { style: s2.label }, "\u6743\u9650\u6807\u8BC6"),
|
|
2266
|
+
permissionPoints.value.length > 0 ? [
|
|
2267
|
+
h2("input", {
|
|
2268
|
+
style: { ...s2.input, marginBottom: "8px" },
|
|
2269
|
+
value: permissionKeyword.value,
|
|
2270
|
+
placeholder: "\u641C\u7D22\u6743\u9650\u540D\u79F0 / \u6807\u8BC6",
|
|
2271
|
+
onInput: (e) => {
|
|
2272
|
+
permissionKeyword.value = e.target.value;
|
|
2273
|
+
}
|
|
2274
|
+
}),
|
|
2275
|
+
h2(
|
|
2276
|
+
"div",
|
|
2277
|
+
{ style: s2.hint },
|
|
2278
|
+
permissionKeyword.value.trim() ? `\u5DF2\u9009 ${form.permissionPointIds.length} \u9879 \xB7 \u5339\u914D ${filteredPermissionPoints.value.length} / ${permissionPoints.value.length}` : `\u5DF2\u9009 ${form.permissionPointIds.length} \u9879 \xB7 \u5171 ${permissionPoints.value.length} \u9879`
|
|
2279
|
+
)
|
|
2280
|
+
] : null,
|
|
2229
2281
|
h2(
|
|
2230
2282
|
"div",
|
|
2231
2283
|
{ style: s2.multiSelect },
|
|
@@ -2235,7 +2287,7 @@ var MenuManager = defineComponent3({
|
|
|
2235
2287
|
{ style: s2.hint },
|
|
2236
2288
|
"\u6682\u65E0\u6743\u9650\u70B9\uFF0C\u8BF7\u5148\u5728\u6743\u9650\u70B9\u7BA1\u7406\u4E2D\u65B0\u589E"
|
|
2237
2289
|
)
|
|
2238
|
-
] :
|
|
2290
|
+
] : filteredPermissionPoints.value.length === 0 ? [h2("div", { style: s2.hint }, "\u65E0\u5339\u914D\u6743\u9650\u70B9")] : filteredPermissionPoints.value.map(
|
|
2239
2291
|
(p) => h2(
|
|
2240
2292
|
"label",
|
|
2241
2293
|
{ key: p.resourceId, style: s2.checkItem },
|