com-angel-authorization 1.0.18 → 1.0.22
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 -2
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +115 -30
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +115 -30
- package/dist/react/index.js.map +1 -1
- package/dist/vue/index.cjs +118 -31
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +118 -31
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/vue/index.cjs
CHANGED
|
@@ -3825,7 +3825,8 @@ var s4 = {
|
|
|
3825
3825
|
flexDirection: "column",
|
|
3826
3826
|
gap: "6px",
|
|
3827
3827
|
maxHeight: "160px",
|
|
3828
|
-
overflow: "auto"
|
|
3828
|
+
overflow: "auto",
|
|
3829
|
+
marginTop: "8px"
|
|
3829
3830
|
},
|
|
3830
3831
|
checkItem: {
|
|
3831
3832
|
display: "flex",
|
|
@@ -3844,10 +3845,35 @@ var s4 = {
|
|
|
3844
3845
|
backgroundColor: "#ffffff"
|
|
3845
3846
|
},
|
|
3846
3847
|
hint: { fontSize: "13px", color: "#98a2b3", padding: "4px 0" },
|
|
3847
|
-
|
|
3848
|
+
selectTrigger: {
|
|
3848
3849
|
display: "flex",
|
|
3849
3850
|
alignItems: "center",
|
|
3850
3851
|
justifyContent: "space-between",
|
|
3852
|
+
gap: "8px",
|
|
3853
|
+
width: "100%",
|
|
3854
|
+
border: "1px solid #d0d5dd",
|
|
3855
|
+
borderRadius: "8px",
|
|
3856
|
+
padding: "8px 10px",
|
|
3857
|
+
background: "#fff",
|
|
3858
|
+
cursor: "pointer",
|
|
3859
|
+
fontSize: "14px",
|
|
3860
|
+
color: "#101828",
|
|
3861
|
+
boxSizing: "border-box",
|
|
3862
|
+
textAlign: "left"
|
|
3863
|
+
},
|
|
3864
|
+
selectTriggerText: {
|
|
3865
|
+
flex: "1",
|
|
3866
|
+
overflow: "hidden",
|
|
3867
|
+
textOverflow: "ellipsis",
|
|
3868
|
+
whiteSpace: "nowrap"
|
|
3869
|
+
},
|
|
3870
|
+
selectPlaceholder: { color: "#98a2b3" },
|
|
3871
|
+
selectChevron: { color: "#667085", fontSize: "10px", flexShrink: "0" },
|
|
3872
|
+
required: { color: "#d92d20", marginLeft: "2px" },
|
|
3873
|
+
switchRow: {
|
|
3874
|
+
display: "flex",
|
|
3875
|
+
alignItems: "center",
|
|
3876
|
+
justifyContent: "flex-start",
|
|
3851
3877
|
gap: "12px"
|
|
3852
3878
|
},
|
|
3853
3879
|
switchTrack: {
|
|
@@ -3916,7 +3942,10 @@ var UserManager = (0, import_vue6.defineComponent)({
|
|
|
3916
3942
|
const deleting = (0, import_vue6.ref)(false);
|
|
3917
3943
|
const groups = (0, import_vue6.ref)([]);
|
|
3918
3944
|
const roles = (0, import_vue6.ref)([]);
|
|
3919
|
-
const
|
|
3945
|
+
const rolesLoading = (0, import_vue6.ref)(false);
|
|
3946
|
+
const groupsOpen = (0, import_vue6.ref)(false);
|
|
3947
|
+
const groupsLoading = (0, import_vue6.ref)(false);
|
|
3948
|
+
const groupsLoaded = (0, import_vue6.ref)(false);
|
|
3920
3949
|
function enabledParam() {
|
|
3921
3950
|
if (enabledFilter.value === "all") return void 0;
|
|
3922
3951
|
return enabledFilter.value === "true";
|
|
@@ -3944,19 +3973,26 @@ var UserManager = (0, import_vue6.defineComponent)({
|
|
|
3944
3973
|
loading.value = false;
|
|
3945
3974
|
}
|
|
3946
3975
|
}
|
|
3947
|
-
async function
|
|
3948
|
-
|
|
3976
|
+
async function loadRoles() {
|
|
3977
|
+
rolesLoading.value = true;
|
|
3949
3978
|
try {
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3979
|
+
roles.value = await props.api.listRoleOptions();
|
|
3980
|
+
} catch (err) {
|
|
3981
|
+
formError.value = err instanceof Error ? err.message : "\u52A0\u8F7D\u89D2\u8272\u5931\u8D25";
|
|
3982
|
+
} finally {
|
|
3983
|
+
rolesLoading.value = false;
|
|
3984
|
+
}
|
|
3985
|
+
}
|
|
3986
|
+
async function loadGroups() {
|
|
3987
|
+
if (groupsLoaded.value || groupsLoading.value) return;
|
|
3988
|
+
groupsLoading.value = true;
|
|
3989
|
+
try {
|
|
3990
|
+
groups.value = await props.api.listGroups();
|
|
3991
|
+
groupsLoaded.value = true;
|
|
3956
3992
|
} catch (err) {
|
|
3957
|
-
formError.value = err instanceof Error ? err.message : "\u52A0\u8F7D\u90E8\u95E8
|
|
3993
|
+
formError.value = err instanceof Error ? err.message : "\u52A0\u8F7D\u90E8\u95E8\u5931\u8D25";
|
|
3958
3994
|
} finally {
|
|
3959
|
-
|
|
3995
|
+
groupsLoading.value = false;
|
|
3960
3996
|
}
|
|
3961
3997
|
}
|
|
3962
3998
|
function handleSearch() {
|
|
@@ -3969,12 +4005,18 @@ var UserManager = (0, import_vue6.defineComponent)({
|
|
|
3969
4005
|
enabledFilter.value = "all";
|
|
3970
4006
|
pageToken.value = "";
|
|
3971
4007
|
}
|
|
4008
|
+
function resetGroupPanel() {
|
|
4009
|
+
groupsOpen.value = false;
|
|
4010
|
+
groups.value = [];
|
|
4011
|
+
groupsLoaded.value = false;
|
|
4012
|
+
}
|
|
3972
4013
|
function openCreate() {
|
|
3973
4014
|
editing.value = null;
|
|
3974
4015
|
Object.assign(form, emptyForm4());
|
|
3975
4016
|
formError.value = "";
|
|
4017
|
+
resetGroupPanel();
|
|
3976
4018
|
dialogOpen.value = true;
|
|
3977
|
-
void
|
|
4019
|
+
void loadRoles();
|
|
3978
4020
|
}
|
|
3979
4021
|
function openEdit(row) {
|
|
3980
4022
|
editing.value = row;
|
|
@@ -3987,12 +4029,17 @@ var UserManager = (0, import_vue6.defineComponent)({
|
|
|
3987
4029
|
enabled: row.enabled
|
|
3988
4030
|
});
|
|
3989
4031
|
formError.value = "";
|
|
4032
|
+
resetGroupPanel();
|
|
3990
4033
|
dialogOpen.value = true;
|
|
3991
|
-
void
|
|
4034
|
+
void loadRoles();
|
|
3992
4035
|
}
|
|
3993
4036
|
function closeDialog() {
|
|
3994
4037
|
if (!saving.value) dialogOpen.value = false;
|
|
3995
4038
|
}
|
|
4039
|
+
function toggleGroupsPanel() {
|
|
4040
|
+
groupsOpen.value = !groupsOpen.value;
|
|
4041
|
+
if (groupsOpen.value) void loadGroups();
|
|
4042
|
+
}
|
|
3996
4043
|
function toggleId(field, id) {
|
|
3997
4044
|
const exists = form[field].includes(id);
|
|
3998
4045
|
form[field] = exists ? form[field].filter((x) => x !== id) : [...form[field], id];
|
|
@@ -4012,6 +4059,10 @@ var UserManager = (0, import_vue6.defineComponent)({
|
|
|
4012
4059
|
formError.value = "\u8BF7\u586B\u5199\u521D\u59CB\u5BC6\u7801";
|
|
4013
4060
|
return;
|
|
4014
4061
|
}
|
|
4062
|
+
if (!form.groupIds.length) {
|
|
4063
|
+
formError.value = "\u8BF7\u9009\u62E9\u5F52\u5C5E\u90E8\u95E8";
|
|
4064
|
+
return;
|
|
4065
|
+
}
|
|
4015
4066
|
saving.value = true;
|
|
4016
4067
|
formError.value = "";
|
|
4017
4068
|
error.value = "";
|
|
@@ -4052,8 +4103,7 @@ var UserManager = (0, import_vue6.defineComponent)({
|
|
|
4052
4103
|
function groupLabel(row) {
|
|
4053
4104
|
if (row.groupNames?.length) return row.groupNames.join("\u3001");
|
|
4054
4105
|
if (!row.groupIds.length) return "\u2014";
|
|
4055
|
-
|
|
4056
|
-
return row.groupIds.map((id) => map.get(id) || id).join("\u3001");
|
|
4106
|
+
return row.groupIds.join("\u3001");
|
|
4057
4107
|
}
|
|
4058
4108
|
function roleLabel(row) {
|
|
4059
4109
|
if (row.roleNames?.length) return row.roleNames.join("\u3001");
|
|
@@ -4061,16 +4111,28 @@ var UserManager = (0, import_vue6.defineComponent)({
|
|
|
4061
4111
|
const map = new Map(roles.value.map((r) => [r.roleId, r.name]));
|
|
4062
4112
|
return row.roleIds.map((id) => map.get(id) || id).join("\u3001");
|
|
4063
4113
|
}
|
|
4114
|
+
function selectedGroupSummary() {
|
|
4115
|
+
if (!form.groupIds.length) return "\u8BF7\u9009\u62E9\u5F52\u5C5E\u90E8\u95E8";
|
|
4116
|
+
if (groupsLoaded.value) {
|
|
4117
|
+
const map = new Map(groups.value.map((g) => [g.groupId, g.name]));
|
|
4118
|
+
return form.groupIds.map((id) => map.get(id) || id).join("\u3001");
|
|
4119
|
+
}
|
|
4120
|
+
if (editing.value?.groupNames?.length) {
|
|
4121
|
+
const map = new Map(
|
|
4122
|
+
editing.value.groupIds.map((id, i) => [
|
|
4123
|
+
id,
|
|
4124
|
+
editing.value?.groupNames?.[i] || id
|
|
4125
|
+
])
|
|
4126
|
+
);
|
|
4127
|
+
return form.groupIds.map((id) => map.get(id) || id).join("\u3001");
|
|
4128
|
+
}
|
|
4129
|
+
return `\u5DF2\u9009 ${form.groupIds.length} \u4E2A\u90E8\u95E8`;
|
|
4130
|
+
}
|
|
4064
4131
|
(0, import_vue6.onMounted)(() => {
|
|
4065
4132
|
void loadList("current", "");
|
|
4066
4133
|
void (async () => {
|
|
4067
4134
|
try {
|
|
4068
|
-
|
|
4069
|
-
props.api.listGroups(),
|
|
4070
|
-
props.api.listRoleOptions()
|
|
4071
|
-
]);
|
|
4072
|
-
groups.value = groupList;
|
|
4073
|
-
roles.value = roleList;
|
|
4135
|
+
roles.value = await props.api.listRoleOptions();
|
|
4074
4136
|
} catch {
|
|
4075
4137
|
}
|
|
4076
4138
|
})();
|
|
@@ -4322,9 +4384,34 @@ var UserManager = (0, import_vue6.defineComponent)({
|
|
|
4322
4384
|
})
|
|
4323
4385
|
]),
|
|
4324
4386
|
(0, import_vue6.h)("fieldset", { style: s4.fieldset }, [
|
|
4325
|
-
(0, import_vue6.h)("legend", { style: s4.label },
|
|
4326
|
-
|
|
4327
|
-
|
|
4387
|
+
(0, import_vue6.h)("legend", { style: s4.label }, [
|
|
4388
|
+
"\u5F52\u5C5E\u90E8\u95E8 ",
|
|
4389
|
+
(0, import_vue6.h)("span", { style: s4.required }, "*")
|
|
4390
|
+
]),
|
|
4391
|
+
(0, import_vue6.h)(
|
|
4392
|
+
"button",
|
|
4393
|
+
{
|
|
4394
|
+
type: "button",
|
|
4395
|
+
style: s4.selectTrigger,
|
|
4396
|
+
"aria-expanded": groupsOpen.value,
|
|
4397
|
+
onClick: toggleGroupsPanel
|
|
4398
|
+
},
|
|
4399
|
+
[
|
|
4400
|
+
(0, import_vue6.h)("span", {
|
|
4401
|
+
style: {
|
|
4402
|
+
...s4.selectTriggerText,
|
|
4403
|
+
...form.groupIds.length ? {} : s4.selectPlaceholder
|
|
4404
|
+
}
|
|
4405
|
+
}, selectedGroupSummary()),
|
|
4406
|
+
(0, import_vue6.h)(
|
|
4407
|
+
"span",
|
|
4408
|
+
{ style: s4.selectChevron },
|
|
4409
|
+
groupsOpen.value ? "\u25B2" : "\u25BC"
|
|
4410
|
+
)
|
|
4411
|
+
]
|
|
4412
|
+
),
|
|
4413
|
+
groupsOpen.value ? (0, import_vue6.h)("div", { style: s4.multiSelect }, [
|
|
4414
|
+
groupsLoading.value ? (0, import_vue6.h)("div", { style: s4.hint }, "\u52A0\u8F7D\u4E2D\u2026") : groups.value.length === 0 ? (0, import_vue6.h)("div", { style: s4.hint }, "\u6682\u65E0\u90E8\u95E8\u6570\u636E") : groups.value.map(
|
|
4328
4415
|
(g) => (0, import_vue6.h)(
|
|
4329
4416
|
"label",
|
|
4330
4417
|
{
|
|
@@ -4344,12 +4431,12 @@ var UserManager = (0, import_vue6.defineComponent)({
|
|
|
4344
4431
|
]
|
|
4345
4432
|
)
|
|
4346
4433
|
)
|
|
4347
|
-
])
|
|
4434
|
+
]) : null
|
|
4348
4435
|
]),
|
|
4349
4436
|
(0, import_vue6.h)("fieldset", { style: s4.fieldset }, [
|
|
4350
4437
|
(0, import_vue6.h)("legend", { style: s4.label }, "\u7528\u6237\u89D2\u8272"),
|
|
4351
4438
|
(0, import_vue6.h)("div", { style: s4.multiSelect }, [
|
|
4352
|
-
|
|
4439
|
+
rolesLoading.value ? (0, import_vue6.h)("div", { style: s4.hint }, "\u52A0\u8F7D\u4E2D\u2026") : roles.value.length === 0 ? (0, import_vue6.h)("div", { style: s4.hint }, "\u6682\u65E0\u89D2\u8272\u6570\u636E") : roles.value.map(
|
|
4353
4440
|
(r) => (0, import_vue6.h)(
|
|
4354
4441
|
"label",
|
|
4355
4442
|
{
|
|
@@ -4491,10 +4578,10 @@ var SYSTEM_ADMIN_MENU = {
|
|
|
4491
4578
|
key: "system",
|
|
4492
4579
|
label: "\u7CFB\u7EDF\u7BA1\u7406",
|
|
4493
4580
|
children: [
|
|
4494
|
-
{ key: "
|
|
4495
|
-
{ key: "resource", label: "\u6743\u9650\u70B9\u7BA1\u7406" },
|
|
4581
|
+
{ key: "user", label: "\u7528\u6237\u7BA1\u7406" },
|
|
4496
4582
|
{ key: "role", label: "\u89D2\u8272\u7BA1\u7406" },
|
|
4497
|
-
{ key: "
|
|
4583
|
+
{ key: "menu", label: "\u83DC\u5355\u7BA1\u7406" },
|
|
4584
|
+
{ key: "resource", label: "\u6743\u9650\u70B9\u7BA1\u7406" }
|
|
4498
4585
|
]
|
|
4499
4586
|
};
|
|
4500
4587
|
var SYSTEM_ADMIN_DEFAULT_KEY = "menu";
|