com-angel-authorization 1.0.17 → 1.0.20

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.
@@ -2843,34 +2843,1021 @@ var styles3 = {
2843
2843
  }
2844
2844
  };
2845
2845
 
2846
+ // src/react/UserManager.tsx
2847
+ import {
2848
+ useCallback as useCallback5,
2849
+ useEffect as useEffect5,
2850
+ useState as useState5
2851
+ } from "react";
2852
+
2853
+ // src/users/index.ts
2854
+ function asIdList(value) {
2855
+ if (!Array.isArray(value)) return [];
2856
+ return value.map((item) => {
2857
+ if (item === void 0 || item === null || item === "") return "";
2858
+ if (typeof item === "object") {
2859
+ const row = item;
2860
+ const id = row.groupId ?? row.roleId ?? row.id;
2861
+ return id === void 0 || id === null ? "" : String(id);
2862
+ }
2863
+ return String(item);
2864
+ }).filter(Boolean);
2865
+ }
2866
+ function asNameList(value) {
2867
+ if (!Array.isArray(value)) return void 0;
2868
+ const names = value.map((item) => {
2869
+ if (item === void 0 || item === null) return "";
2870
+ if (typeof item === "object") {
2871
+ return String(item.name ?? "");
2872
+ }
2873
+ return String(item);
2874
+ }).filter(Boolean);
2875
+ return names.length ? names : void 0;
2876
+ }
2877
+ function mapSystemUser(item) {
2878
+ if (!item || typeof item !== "object") return null;
2879
+ const row = item;
2880
+ const userId = row.userId ?? row.user_id ?? row.id;
2881
+ if (userId === void 0 || userId === null || userId === "") return null;
2882
+ return {
2883
+ userId: String(userId),
2884
+ username: String(row.username ?? row.account ?? ""),
2885
+ name: String(row.name ?? ""),
2886
+ groupIds: asIdList(row.groupIds ?? row.group_ids ?? row.groups),
2887
+ roleIds: asIdList(row.roleIds ?? row.role_ids ?? row.roles),
2888
+ groupNames: asNameList(row.groupNames ?? row.group_names ?? row.groups),
2889
+ roleNames: asNameList(row.roleNames ?? row.role_names ?? row.roles),
2890
+ enabled: Boolean(row.enabled ?? row.enable ?? true)
2891
+ };
2892
+ }
2893
+ function mapSystemGroupOption(item) {
2894
+ if (!item || typeof item !== "object") return null;
2895
+ const row = item;
2896
+ const groupId = row.groupId ?? row.group_id ?? row.id;
2897
+ if (groupId === void 0 || groupId === null || groupId === "") return null;
2898
+ return {
2899
+ groupId: String(groupId),
2900
+ name: String(row.name ?? "")
2901
+ };
2902
+ }
2903
+ function mapSystemRoleOption(item) {
2904
+ if (!item || typeof item !== "object") return null;
2905
+ const row = item;
2906
+ const roleId = row.roleId ?? row.role_id ?? row.id;
2907
+ if (roleId === void 0 || roleId === null || roleId === "") return null;
2908
+ return {
2909
+ roleId: String(roleId),
2910
+ name: String(row.name ?? "")
2911
+ };
2912
+ }
2913
+ function validateUsername(username) {
2914
+ const value = username.trim();
2915
+ if (value.length < 6) return "\u8D26\u53F7\u957F\u5EA6\u4E0D\u5C11\u4E8E 6 \u4E2A\u5B57\u7B26";
2916
+ if (!/[A-Za-z]/.test(value) || !/[0-9]/.test(value)) {
2917
+ return "\u8D26\u53F7\u9700\u540C\u65F6\u5305\u542B\u5B57\u6BCD\u548C\u6570\u5B57";
2918
+ }
2919
+ return null;
2920
+ }
2921
+ function buildListUrl3(params) {
2922
+ const parts = [];
2923
+ appendQueryParam(parts, "keyword", params?.keyword ?? "");
2924
+ if (params?.enabled !== void 0) {
2925
+ appendQueryParam(parts, "enabled", String(params.enabled));
2926
+ }
2927
+ appendQueryParam(parts, "page-token", params?.pagination?.pageToken ?? "");
2928
+ appendQueryParam(parts, "page-size", params?.pagination?.pageSize ?? "20");
2929
+ appendQueryParam(parts, "page-direction", params?.pagination?.pageDirection ?? "current");
2930
+ return parts.length ? `/system/users?${parts.join("&")}` : "/system/users";
2931
+ }
2932
+ function buildKeywordUrl(base, keyword) {
2933
+ const parts = [];
2934
+ appendQueryParam(parts, "keyword", keyword ?? "");
2935
+ return parts.length ? `${base}?${parts.join("&")}` : base;
2936
+ }
2937
+ function buildCreateUserBody(values) {
2938
+ return {
2939
+ username: values.username.trim(),
2940
+ name: values.name.trim(),
2941
+ password: values.password,
2942
+ groupIds: [...new Set(values.groupIds.map(String))],
2943
+ roleIds: [...new Set(values.roleIds.map(String))],
2944
+ enabled: Boolean(values.enabled)
2945
+ };
2946
+ }
2947
+ function buildUpdateUserBody(values) {
2948
+ const body = {
2949
+ username: values.username.trim(),
2950
+ name: values.name.trim(),
2951
+ groupIds: [...new Set(values.groupIds.map(String))],
2952
+ roleIds: [...new Set(values.roleIds.map(String))],
2953
+ enabled: Boolean(values.enabled)
2954
+ };
2955
+ if (values.password.trim()) {
2956
+ body.password = values.password;
2957
+ }
2958
+ return body;
2959
+ }
2960
+ function createSystemUserApi(request) {
2961
+ return {
2962
+ async list(params, signal) {
2963
+ const json = await request({
2964
+ method: "GET",
2965
+ url: buildListUrl3(params),
2966
+ signal
2967
+ });
2968
+ const records = extractRecords(json).map(mapSystemUser).filter((item) => item !== null);
2969
+ return {
2970
+ records,
2971
+ ...extractPagination(json)
2972
+ };
2973
+ },
2974
+ async create(values, signal) {
2975
+ return request({
2976
+ method: "POST",
2977
+ url: "/system/users",
2978
+ body: buildCreateUserBody(values),
2979
+ signal
2980
+ });
2981
+ },
2982
+ async update(userId, values, signal) {
2983
+ return request({
2984
+ method: "PATCH",
2985
+ url: `/system/users/${encodeURIComponent(userId)}`,
2986
+ body: buildUpdateUserBody(values),
2987
+ signal
2988
+ });
2989
+ },
2990
+ async remove(userId, signal) {
2991
+ return request({
2992
+ method: "DELETE",
2993
+ url: `/system/users/${encodeURIComponent(userId)}`,
2994
+ signal
2995
+ });
2996
+ },
2997
+ async listGroups(params, signal) {
2998
+ const json = await request({
2999
+ method: "GET",
3000
+ url: buildKeywordUrl("/system/groups", params?.keyword),
3001
+ signal
3002
+ });
3003
+ return extractRecords(json).map(mapSystemGroupOption).filter((item) => item !== null);
3004
+ },
3005
+ async listRoleOptions(params, signal) {
3006
+ const json = await request({
3007
+ method: "GET",
3008
+ url: buildKeywordUrl("/system/roles", params?.keyword),
3009
+ signal
3010
+ });
3011
+ return extractRecords(json).map(mapSystemRoleOption).filter((item) => item !== null);
3012
+ }
3013
+ };
3014
+ }
3015
+
3016
+ // src/react/UserManager.tsx
3017
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
3018
+ var PAGE_SIZE_OPTIONS4 = ["10", "20", "50", "100"];
3019
+ var emptyForm4 = () => ({
3020
+ username: "",
3021
+ name: "",
3022
+ password: "",
3023
+ groupIds: [],
3024
+ roleIds: [],
3025
+ enabled: true
3026
+ });
3027
+ function UserManager({
3028
+ api,
3029
+ title = "\u7528\u6237\u7BA1\u7406",
3030
+ pageSize: initialPageSize = "20",
3031
+ toolbarExtra
3032
+ }) {
3033
+ const [records, setRecords] = useState5([]);
3034
+ const [loading, setLoading] = useState5(false);
3035
+ const [error, setError] = useState5("");
3036
+ const [keyword, setKeyword] = useState5("");
3037
+ const [keywordInput, setKeywordInput] = useState5("");
3038
+ const [enabledFilter, setEnabledFilter] = useState5("all");
3039
+ const [pageSize, setPageSize] = useState5(initialPageSize);
3040
+ const [pageToken, setPageToken] = useState5("");
3041
+ const [hasPreviousPage, setHasPreviousPage] = useState5(false);
3042
+ const [hasNextPage, setHasNextPage] = useState5(false);
3043
+ const [dialogOpen, setDialogOpen] = useState5(false);
3044
+ const [editing, setEditing] = useState5(null);
3045
+ const [form, setForm] = useState5(emptyForm4);
3046
+ const [formError, setFormError] = useState5("");
3047
+ const [saving, setSaving] = useState5(false);
3048
+ const [deletingRow, setDeletingRow] = useState5(null);
3049
+ const [deleting, setDeleting] = useState5(false);
3050
+ const [groups, setGroups] = useState5([]);
3051
+ const [roles, setRoles] = useState5([]);
3052
+ const [rolesLoading, setRolesLoading] = useState5(false);
3053
+ const [groupsOpen, setGroupsOpen] = useState5(false);
3054
+ const [groupsLoading, setGroupsLoading] = useState5(false);
3055
+ const [groupsLoaded, setGroupsLoaded] = useState5(false);
3056
+ const enabledParam = enabledFilter === "all" ? void 0 : enabledFilter === "true";
3057
+ const loadList = useCallback5(
3058
+ async (direction = "current", token = pageToken) => {
3059
+ setLoading(true);
3060
+ setError("");
3061
+ try {
3062
+ const result = await api.list({
3063
+ keyword,
3064
+ enabled: enabledParam,
3065
+ pagination: {
3066
+ pageToken: token,
3067
+ pageSize,
3068
+ pageDirection: direction
3069
+ }
3070
+ });
3071
+ setRecords(result.records);
3072
+ setPageToken(result.pageToken);
3073
+ setHasPreviousPage(result.hasPreviousPage);
3074
+ setHasNextPage(result.hasNextPage);
3075
+ } catch (err) {
3076
+ setError(err instanceof Error ? err.message : "\u52A0\u8F7D\u5931\u8D25");
3077
+ } finally {
3078
+ setLoading(false);
3079
+ }
3080
+ },
3081
+ [api, keyword, enabledParam, pageSize, pageToken]
3082
+ );
3083
+ useEffect5(() => {
3084
+ void loadList("current", "");
3085
+ }, [api, pageSize, keyword, enabledFilter]);
3086
+ const loadRoles = useCallback5(async () => {
3087
+ setRolesLoading(true);
3088
+ try {
3089
+ setRoles(await api.listRoleOptions());
3090
+ } catch (err) {
3091
+ setFormError(err instanceof Error ? err.message : "\u52A0\u8F7D\u89D2\u8272\u5931\u8D25");
3092
+ } finally {
3093
+ setRolesLoading(false);
3094
+ }
3095
+ }, [api]);
3096
+ const loadGroups = useCallback5(async () => {
3097
+ if (groupsLoaded || groupsLoading) return;
3098
+ setGroupsLoading(true);
3099
+ try {
3100
+ setGroups(await api.listGroups());
3101
+ setGroupsLoaded(true);
3102
+ } catch (err) {
3103
+ setFormError(err instanceof Error ? err.message : "\u52A0\u8F7D\u90E8\u95E8\u5931\u8D25");
3104
+ } finally {
3105
+ setGroupsLoading(false);
3106
+ }
3107
+ }, [api, groupsLoaded, groupsLoading]);
3108
+ const handleSearch = () => {
3109
+ setPageToken("");
3110
+ setKeyword(keywordInput.trim());
3111
+ };
3112
+ const resetGroupPanel = () => {
3113
+ setGroupsOpen(false);
3114
+ setGroups([]);
3115
+ setGroupsLoaded(false);
3116
+ };
3117
+ const openCreate = () => {
3118
+ setEditing(null);
3119
+ setForm(emptyForm4());
3120
+ setFormError("");
3121
+ resetGroupPanel();
3122
+ setDialogOpen(true);
3123
+ void loadRoles();
3124
+ };
3125
+ const openEdit = (row) => {
3126
+ setEditing(row);
3127
+ setForm({
3128
+ username: row.username,
3129
+ name: row.name,
3130
+ password: "",
3131
+ groupIds: [...row.groupIds],
3132
+ roleIds: [...row.roleIds],
3133
+ enabled: row.enabled
3134
+ });
3135
+ setFormError("");
3136
+ resetGroupPanel();
3137
+ setDialogOpen(true);
3138
+ void loadRoles();
3139
+ };
3140
+ const closeDialog = () => {
3141
+ if (!saving) setDialogOpen(false);
3142
+ };
3143
+ const toggleGroupsPanel = () => {
3144
+ setGroupsOpen((prev) => {
3145
+ const next = !prev;
3146
+ if (next) void loadGroups();
3147
+ return next;
3148
+ });
3149
+ };
3150
+ const toggleId = (field, id) => {
3151
+ setForm((prev) => {
3152
+ const exists = prev[field].includes(id);
3153
+ return {
3154
+ ...prev,
3155
+ [field]: exists ? prev[field].filter((x) => x !== id) : [...prev[field], id]
3156
+ };
3157
+ });
3158
+ };
3159
+ const handleSubmit = async (event) => {
3160
+ event.preventDefault();
3161
+ const usernameError = validateUsername(form.username);
3162
+ if (usernameError) {
3163
+ setFormError(usernameError);
3164
+ return;
3165
+ }
3166
+ if (!form.name.trim()) {
3167
+ setFormError("\u8BF7\u586B\u5199\u7528\u6237\u540D");
3168
+ return;
3169
+ }
3170
+ if (!editing && !form.password.trim()) {
3171
+ setFormError("\u8BF7\u586B\u5199\u521D\u59CB\u5BC6\u7801");
3172
+ return;
3173
+ }
3174
+ if (!form.groupIds.length) {
3175
+ setFormError("\u8BF7\u9009\u62E9\u5F52\u5C5E\u90E8\u95E8");
3176
+ return;
3177
+ }
3178
+ setSaving(true);
3179
+ setFormError("");
3180
+ setError("");
3181
+ try {
3182
+ if (editing) {
3183
+ await api.update(editing.userId, form);
3184
+ } else {
3185
+ await api.create(form);
3186
+ }
3187
+ setDialogOpen(false);
3188
+ await loadList("current", "");
3189
+ } catch (err) {
3190
+ setFormError(err instanceof Error ? err.message : "\u4FDD\u5B58\u5931\u8D25");
3191
+ } finally {
3192
+ setSaving(false);
3193
+ }
3194
+ };
3195
+ const askDelete = (row) => setDeletingRow(row);
3196
+ const closeDeleteDialog = () => {
3197
+ if (!deleting) setDeletingRow(null);
3198
+ };
3199
+ const confirmDelete = async () => {
3200
+ if (!deletingRow) return;
3201
+ setDeleting(true);
3202
+ setError("");
3203
+ try {
3204
+ await api.remove(deletingRow.userId);
3205
+ setDeletingRow(null);
3206
+ await loadList("current", "");
3207
+ } catch (err) {
3208
+ setError(err instanceof Error ? err.message : "\u5220\u9664\u5931\u8D25");
3209
+ } finally {
3210
+ setDeleting(false);
3211
+ }
3212
+ };
3213
+ const groupLabel = (row) => {
3214
+ if (row.groupNames?.length) return row.groupNames.join("\u3001");
3215
+ if (!row.groupIds.length) return "\u2014";
3216
+ return row.groupIds.join("\u3001");
3217
+ };
3218
+ const roleLabel = (row) => {
3219
+ if (row.roleNames?.length) return row.roleNames.join("\u3001");
3220
+ if (!row.roleIds.length) return "\u2014";
3221
+ const map = new Map(roles.map((r) => [r.roleId, r.name]));
3222
+ return row.roleIds.map((id) => map.get(id) || id).join("\u3001");
3223
+ };
3224
+ const selectedGroupSummary = () => {
3225
+ if (!form.groupIds.length) return "\u8BF7\u9009\u62E9\u5F52\u5C5E\u90E8\u95E8";
3226
+ if (groupsLoaded) {
3227
+ const map = new Map(groups.map((g) => [g.groupId, g.name]));
3228
+ return form.groupIds.map((id) => map.get(id) || id).join("\u3001");
3229
+ }
3230
+ if (editing?.groupNames?.length && editing.groupIds.every((id) => form.groupIds.includes(id))) {
3231
+ const map = new Map(editing.groupIds.map((id, i) => [id, editing.groupNames?.[i] || id]));
3232
+ return form.groupIds.map((id) => map.get(id) || id).join("\u3001");
3233
+ }
3234
+ return `\u5DF2\u9009 ${form.groupIds.length} \u4E2A\u90E8\u95E8`;
3235
+ };
3236
+ useEffect5(() => {
3237
+ void (async () => {
3238
+ try {
3239
+ setRoles(await api.listRoleOptions());
3240
+ } catch {
3241
+ }
3242
+ })();
3243
+ }, [api]);
3244
+ return /* @__PURE__ */ jsxs4("div", { style: styles4.root, children: [
3245
+ /* @__PURE__ */ jsxs4("div", { style: styles4.toolbar, children: [
3246
+ /* @__PURE__ */ jsx5("h2", { style: styles4.title, children: title }),
3247
+ /* @__PURE__ */ jsxs4("div", { style: styles4.toolbarRight, children: [
3248
+ toolbarExtra,
3249
+ /* @__PURE__ */ jsx5("button", { type: "button", style: styles4.primaryBtn, onClick: openCreate, children: "\u65B0\u589E\u7528\u6237" })
3250
+ ] })
3251
+ ] }),
3252
+ /* @__PURE__ */ jsxs4("div", { style: styles4.searchBar, children: [
3253
+ /* @__PURE__ */ jsx5(
3254
+ "input",
3255
+ {
3256
+ style: { ...styles4.input, maxWidth: 240 },
3257
+ value: keywordInput,
3258
+ onChange: (e) => setKeywordInput(e.target.value),
3259
+ placeholder: "\u641C\u7D22\u8D26\u53F7 / \u7528\u6237\u540D",
3260
+ onKeyDown: (e) => {
3261
+ if (e.key === "Enter") handleSearch();
3262
+ }
3263
+ }
3264
+ ),
3265
+ /* @__PURE__ */ jsxs4(
3266
+ "select",
3267
+ {
3268
+ style: styles4.select,
3269
+ value: enabledFilter,
3270
+ onChange: (e) => {
3271
+ setPageToken("");
3272
+ setEnabledFilter(e.target.value);
3273
+ },
3274
+ children: [
3275
+ /* @__PURE__ */ jsx5("option", { value: "all", children: "\u5168\u90E8\u72B6\u6001" }),
3276
+ /* @__PURE__ */ jsx5("option", { value: "true", children: "\u5DF2\u542F\u7528" }),
3277
+ /* @__PURE__ */ jsx5("option", { value: "false", children: "\u5DF2\u7981\u7528" })
3278
+ ]
3279
+ }
3280
+ ),
3281
+ /* @__PURE__ */ jsx5("button", { type: "button", style: styles4.secondaryBtn, onClick: handleSearch, children: "\u67E5\u8BE2" }),
3282
+ /* @__PURE__ */ jsx5(
3283
+ "button",
3284
+ {
3285
+ type: "button",
3286
+ style: styles4.secondaryBtn,
3287
+ onClick: () => {
3288
+ setKeywordInput("");
3289
+ setKeyword("");
3290
+ setEnabledFilter("all");
3291
+ setPageToken("");
3292
+ },
3293
+ children: "\u91CD\u7F6E"
3294
+ }
3295
+ )
3296
+ ] }),
3297
+ error ? /* @__PURE__ */ jsx5("div", { style: styles4.error, children: error }) : null,
3298
+ /* @__PURE__ */ jsx5("div", { style: styles4.tableWrap, children: /* @__PURE__ */ jsxs4("table", { style: styles4.table, children: [
3299
+ /* @__PURE__ */ jsx5("thead", { children: /* @__PURE__ */ jsxs4("tr", { children: [
3300
+ /* @__PURE__ */ jsx5("th", { style: styles4.th, children: "\u8D26\u53F7" }),
3301
+ /* @__PURE__ */ jsx5("th", { style: styles4.th, children: "\u7528\u6237\u540D" }),
3302
+ /* @__PURE__ */ jsx5("th", { style: styles4.th, children: "\u5F52\u5C5E\u90E8\u95E8" }),
3303
+ /* @__PURE__ */ jsx5("th", { style: styles4.th, children: "\u7528\u6237\u89D2\u8272" }),
3304
+ /* @__PURE__ */ jsx5("th", { style: { ...styles4.th, width: 90 }, children: "\u72B6\u6001" }),
3305
+ /* @__PURE__ */ jsx5("th", { style: { ...styles4.th, width: 140 }, children: "\u64CD\u4F5C" })
3306
+ ] }) }),
3307
+ /* @__PURE__ */ jsx5("tbody", { children: loading ? /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5("td", { colSpan: 6, style: styles4.empty, children: "\u52A0\u8F7D\u4E2D\u2026" }) }) : records.length === 0 ? /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5("td", { colSpan: 6, style: styles4.empty, children: "\u6682\u65E0\u6570\u636E" }) }) : records.map((row) => /* @__PURE__ */ jsxs4("tr", { children: [
3308
+ /* @__PURE__ */ jsx5("td", { style: styles4.td, children: row.username }),
3309
+ /* @__PURE__ */ jsx5("td", { style: styles4.td, children: row.name }),
3310
+ /* @__PURE__ */ jsx5("td", { style: styles4.td, children: groupLabel(row) }),
3311
+ /* @__PURE__ */ jsx5("td", { style: styles4.td, children: roleLabel(row) }),
3312
+ /* @__PURE__ */ jsx5("td", { style: styles4.td, children: /* @__PURE__ */ jsx5(
3313
+ "span",
3314
+ {
3315
+ style: {
3316
+ ...styles4.badge,
3317
+ ...row.enabled ? styles4.badgeOn : styles4.badgeOff
3318
+ },
3319
+ children: row.enabled ? "\u542F\u7528" : "\u7981\u7528"
3320
+ }
3321
+ ) }),
3322
+ /* @__PURE__ */ jsxs4("td", { style: styles4.td, children: [
3323
+ /* @__PURE__ */ jsx5("button", { type: "button", style: styles4.linkBtn, onClick: () => openEdit(row), children: "\u7F16\u8F91" }),
3324
+ /* @__PURE__ */ jsx5(
3325
+ "button",
3326
+ {
3327
+ type: "button",
3328
+ style: { ...styles4.linkBtn, color: "#d92d20" },
3329
+ onClick: () => askDelete(row),
3330
+ children: "\u5220\u9664"
3331
+ }
3332
+ )
3333
+ ] })
3334
+ ] }, row.userId)) })
3335
+ ] }) }),
3336
+ /* @__PURE__ */ jsxs4("div", { style: styles4.pagination, children: [
3337
+ /* @__PURE__ */ jsxs4("label", { style: styles4.pageSize, children: [
3338
+ "\u6BCF\u9875",
3339
+ /* @__PURE__ */ jsx5(
3340
+ "select",
3341
+ {
3342
+ value: pageSize,
3343
+ onChange: (e) => {
3344
+ setPageToken("");
3345
+ setPageSize(e.target.value);
3346
+ },
3347
+ style: styles4.select,
3348
+ children: PAGE_SIZE_OPTIONS4.map((size) => /* @__PURE__ */ jsx5("option", { value: size, children: size }, size))
3349
+ }
3350
+ )
3351
+ ] }),
3352
+ /* @__PURE__ */ jsxs4("div", { style: styles4.pageBtns, children: [
3353
+ /* @__PURE__ */ jsx5(
3354
+ "button",
3355
+ {
3356
+ type: "button",
3357
+ style: styles4.secondaryBtn,
3358
+ disabled: !hasPreviousPage || loading,
3359
+ onClick: () => void loadList("previous"),
3360
+ children: "\u4E0A\u4E00\u9875"
3361
+ }
3362
+ ),
3363
+ /* @__PURE__ */ jsx5(
3364
+ "button",
3365
+ {
3366
+ type: "button",
3367
+ style: styles4.secondaryBtn,
3368
+ disabled: !hasNextPage || loading,
3369
+ onClick: () => void loadList("next"),
3370
+ children: "\u4E0B\u4E00\u9875"
3371
+ }
3372
+ )
3373
+ ] })
3374
+ ] }),
3375
+ dialogOpen ? /* @__PURE__ */ jsx5("div", { style: styles4.mask, onClick: closeDialog, children: /* @__PURE__ */ jsxs4(
3376
+ "div",
3377
+ {
3378
+ style: { ...styles4.dialog, maxWidth: 560 },
3379
+ onClick: (e) => e.stopPropagation(),
3380
+ role: "dialog",
3381
+ "aria-modal": "true",
3382
+ children: [
3383
+ /* @__PURE__ */ jsxs4("div", { style: styles4.dialogHeader, children: [
3384
+ /* @__PURE__ */ jsx5("h3", { style: styles4.dialogTitle, children: editing ? "\u7F16\u8F91\u7528\u6237" : "\u65B0\u589E\u7528\u6237" }),
3385
+ /* @__PURE__ */ jsx5("button", { type: "button", style: styles4.iconBtn, onClick: closeDialog, "aria-label": "\u5173\u95ED", children: "\xD7" })
3386
+ ] }),
3387
+ /* @__PURE__ */ jsxs4("form", { style: styles4.form, onSubmit: (e) => void handleSubmit(e), children: [
3388
+ formError ? /* @__PURE__ */ jsx5("div", { style: styles4.error, children: formError }) : null,
3389
+ /* @__PURE__ */ jsxs4("label", { style: styles4.field, children: [
3390
+ /* @__PURE__ */ jsx5("span", { style: styles4.label, children: "\u8D26\u53F7" }),
3391
+ /* @__PURE__ */ jsx5(
3392
+ "input",
3393
+ {
3394
+ style: styles4.input,
3395
+ value: form.username,
3396
+ onChange: (e) => setForm((prev) => ({ ...prev, username: e.target.value })),
3397
+ placeholder: "\u81F3\u5C116\u4F4D\uFF0C\u9700\u542B\u5B57\u6BCD\u548C\u6570\u5B57",
3398
+ required: true
3399
+ }
3400
+ )
3401
+ ] }),
3402
+ /* @__PURE__ */ jsxs4("label", { style: styles4.field, children: [
3403
+ /* @__PURE__ */ jsx5("span", { style: styles4.label, children: "\u7528\u6237\u540D" }),
3404
+ /* @__PURE__ */ jsx5(
3405
+ "input",
3406
+ {
3407
+ style: styles4.input,
3408
+ value: form.name,
3409
+ onChange: (e) => setForm((prev) => ({ ...prev, name: e.target.value })),
3410
+ placeholder: "\u8BF7\u8F93\u5165\u7528\u6237\u540D",
3411
+ required: true
3412
+ }
3413
+ )
3414
+ ] }),
3415
+ /* @__PURE__ */ jsxs4("label", { style: styles4.field, children: [
3416
+ /* @__PURE__ */ jsx5("span", { style: styles4.label, children: editing ? "\u5BC6\u7801\uFF08\u7559\u7A7A\u5219\u4E0D\u4FEE\u6539\uFF09" : "\u521D\u59CB\u5BC6\u7801" }),
3417
+ /* @__PURE__ */ jsx5(
3418
+ "input",
3419
+ {
3420
+ style: styles4.input,
3421
+ type: "password",
3422
+ value: form.password,
3423
+ onChange: (e) => setForm((prev) => ({ ...prev, password: e.target.value })),
3424
+ placeholder: editing ? "\u7559\u7A7A\u8868\u793A\u4E0D\u4FEE\u6539\u5BC6\u7801" : "\u8BF7\u8F93\u5165\u521D\u59CB\u5BC6\u7801",
3425
+ required: !editing,
3426
+ autoComplete: "new-password"
3427
+ }
3428
+ )
3429
+ ] }),
3430
+ /* @__PURE__ */ jsxs4("fieldset", { style: styles4.fieldset, children: [
3431
+ /* @__PURE__ */ jsxs4("legend", { style: styles4.label, children: [
3432
+ "\u5F52\u5C5E\u90E8\u95E8 ",
3433
+ /* @__PURE__ */ jsx5("span", { style: styles4.required, children: "*" })
3434
+ ] }),
3435
+ /* @__PURE__ */ jsxs4(
3436
+ "button",
3437
+ {
3438
+ type: "button",
3439
+ style: styles4.selectTrigger,
3440
+ onClick: toggleGroupsPanel,
3441
+ "aria-expanded": groupsOpen,
3442
+ children: [
3443
+ /* @__PURE__ */ jsx5(
3444
+ "span",
3445
+ {
3446
+ style: {
3447
+ ...styles4.selectTriggerText,
3448
+ ...form.groupIds.length ? null : styles4.selectPlaceholder
3449
+ },
3450
+ children: selectedGroupSummary()
3451
+ }
3452
+ ),
3453
+ /* @__PURE__ */ jsx5("span", { style: styles4.selectChevron, children: groupsOpen ? "\u25B2" : "\u25BC" })
3454
+ ]
3455
+ }
3456
+ ),
3457
+ groupsOpen ? /* @__PURE__ */ jsx5("div", { style: styles4.multiSelect, children: groupsLoading ? /* @__PURE__ */ jsx5("div", { style: styles4.hint, children: "\u52A0\u8F7D\u4E2D\u2026" }) : groups.length === 0 ? /* @__PURE__ */ jsx5("div", { style: styles4.hint, children: "\u6682\u65E0\u90E8\u95E8\u6570\u636E" }) : groups.map((g) => /* @__PURE__ */ jsxs4("label", { style: styles4.checkItem, children: [
3458
+ /* @__PURE__ */ jsx5(
3459
+ "input",
3460
+ {
3461
+ type: "checkbox",
3462
+ style: styles4.control,
3463
+ checked: form.groupIds.includes(g.groupId),
3464
+ onChange: () => toggleId("groupIds", g.groupId)
3465
+ }
3466
+ ),
3467
+ /* @__PURE__ */ jsx5("span", { children: g.name || g.groupId })
3468
+ ] }, g.groupId)) }) : null
3469
+ ] }),
3470
+ /* @__PURE__ */ jsxs4("fieldset", { style: styles4.fieldset, children: [
3471
+ /* @__PURE__ */ jsx5("legend", { style: styles4.label, children: "\u7528\u6237\u89D2\u8272" }),
3472
+ /* @__PURE__ */ jsx5("div", { style: styles4.multiSelect, children: rolesLoading ? /* @__PURE__ */ jsx5("div", { style: styles4.hint, children: "\u52A0\u8F7D\u4E2D\u2026" }) : roles.length === 0 ? /* @__PURE__ */ jsx5("div", { style: styles4.hint, children: "\u6682\u65E0\u89D2\u8272\u6570\u636E" }) : roles.map((r) => /* @__PURE__ */ jsxs4("label", { style: styles4.checkItem, children: [
3473
+ /* @__PURE__ */ jsx5(
3474
+ "input",
3475
+ {
3476
+ type: "checkbox",
3477
+ style: styles4.control,
3478
+ checked: form.roleIds.includes(r.roleId),
3479
+ onChange: () => toggleId("roleIds", r.roleId)
3480
+ }
3481
+ ),
3482
+ /* @__PURE__ */ jsx5("span", { children: r.name || r.roleId })
3483
+ ] }, r.roleId)) })
3484
+ ] }),
3485
+ /* @__PURE__ */ jsxs4("div", { style: styles4.switchRow, children: [
3486
+ /* @__PURE__ */ jsx5("span", { style: styles4.label, children: "\u662F\u5426\u542F\u7528" }),
3487
+ /* @__PURE__ */ jsx5(
3488
+ "button",
3489
+ {
3490
+ type: "button",
3491
+ role: "switch",
3492
+ "aria-checked": form.enabled,
3493
+ style: {
3494
+ ...styles4.switchTrack,
3495
+ ...form.enabled ? styles4.switchTrackOn : null
3496
+ },
3497
+ onClick: () => setForm((prev) => ({ ...prev, enabled: !prev.enabled })),
3498
+ children: /* @__PURE__ */ jsx5(
3499
+ "span",
3500
+ {
3501
+ style: {
3502
+ ...styles4.switchThumb,
3503
+ ...form.enabled ? styles4.switchThumbOn : null
3504
+ }
3505
+ }
3506
+ )
3507
+ }
3508
+ )
3509
+ ] }),
3510
+ /* @__PURE__ */ jsxs4("div", { style: styles4.dialogFooter, children: [
3511
+ /* @__PURE__ */ jsx5("button", { type: "button", style: styles4.secondaryBtn, onClick: closeDialog, children: "\u53D6\u6D88" }),
3512
+ /* @__PURE__ */ jsx5("button", { type: "submit", style: styles4.primaryBtn, disabled: saving, children: saving ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58" })
3513
+ ] })
3514
+ ] })
3515
+ ]
3516
+ }
3517
+ ) }) : null,
3518
+ deletingRow ? /* @__PURE__ */ jsx5("div", { style: styles4.mask, onClick: closeDeleteDialog, children: /* @__PURE__ */ jsxs4(
3519
+ "div",
3520
+ {
3521
+ style: { ...styles4.dialog, maxWidth: 420 },
3522
+ onClick: (e) => e.stopPropagation(),
3523
+ role: "dialog",
3524
+ "aria-modal": "true",
3525
+ children: [
3526
+ /* @__PURE__ */ jsxs4("div", { style: styles4.dialogHeader, children: [
3527
+ /* @__PURE__ */ jsx5("h3", { style: styles4.dialogTitle, children: "\u786E\u8BA4\u5220\u9664" }),
3528
+ /* @__PURE__ */ jsx5(
3529
+ "button",
3530
+ {
3531
+ type: "button",
3532
+ style: styles4.iconBtn,
3533
+ onClick: closeDeleteDialog,
3534
+ "aria-label": "\u5173\u95ED",
3535
+ children: "\xD7"
3536
+ }
3537
+ )
3538
+ ] }),
3539
+ /* @__PURE__ */ jsxs4("div", { style: styles4.confirmBody, children: [
3540
+ /* @__PURE__ */ jsxs4("p", { style: styles4.confirmText, children: [
3541
+ "\u786E\u8BA4\u5220\u9664\u7528\u6237\u300C",
3542
+ /* @__PURE__ */ jsx5("strong", { children: deletingRow.name }),
3543
+ "\u300D\uFF08",
3544
+ deletingRow.username,
3545
+ "\uFF09\u5417\uFF1F\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\u3002"
3546
+ ] }),
3547
+ /* @__PURE__ */ jsxs4("div", { style: styles4.dialogFooter, children: [
3548
+ /* @__PURE__ */ jsx5(
3549
+ "button",
3550
+ {
3551
+ type: "button",
3552
+ style: styles4.secondaryBtn,
3553
+ onClick: closeDeleteDialog,
3554
+ disabled: deleting,
3555
+ children: "\u53D6\u6D88"
3556
+ }
3557
+ ),
3558
+ /* @__PURE__ */ jsx5(
3559
+ "button",
3560
+ {
3561
+ type: "button",
3562
+ style: styles4.dangerBtn,
3563
+ onClick: () => void confirmDelete(),
3564
+ disabled: deleting,
3565
+ children: deleting ? "\u5220\u9664\u4E2D\u2026" : "\u786E\u8BA4\u5220\u9664"
3566
+ }
3567
+ )
3568
+ ] })
3569
+ ] })
3570
+ ]
3571
+ }
3572
+ ) }) : null
3573
+ ] });
3574
+ }
3575
+ var styles4 = {
3576
+ root: {
3577
+ display: "flex",
3578
+ flexDirection: "column",
3579
+ gap: 16,
3580
+ padding: 16,
3581
+ color: "#101828",
3582
+ fontFamily: '"PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif'
3583
+ },
3584
+ toolbar: {
3585
+ display: "flex",
3586
+ alignItems: "center",
3587
+ justifyContent: "space-between",
3588
+ gap: 12
3589
+ },
3590
+ title: { margin: 0, fontSize: 18, fontWeight: 600 },
3591
+ toolbarRight: { display: "flex", alignItems: "center", gap: 8 },
3592
+ searchBar: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" },
3593
+ error: {
3594
+ padding: "10px 12px",
3595
+ borderRadius: 8,
3596
+ background: "#fef3f2",
3597
+ color: "#b42318",
3598
+ fontSize: 13
3599
+ },
3600
+ tableWrap: {
3601
+ overflow: "auto",
3602
+ border: "1px solid #eaecf0",
3603
+ borderRadius: 10,
3604
+ background: "#fff"
3605
+ },
3606
+ table: { width: "100%", borderCollapse: "collapse", minWidth: 720 },
3607
+ th: {
3608
+ textAlign: "left",
3609
+ padding: "12px 14px",
3610
+ fontSize: 13,
3611
+ fontWeight: 600,
3612
+ color: "#475467",
3613
+ background: "#f9fafb",
3614
+ borderBottom: "1px solid #eaecf0"
3615
+ },
3616
+ td: {
3617
+ padding: "12px 14px",
3618
+ fontSize: 14,
3619
+ borderBottom: "1px solid #f2f4f7",
3620
+ verticalAlign: "middle"
3621
+ },
3622
+ empty: { padding: 28, textAlign: "center", color: "#98a2b3", fontSize: 14 },
3623
+ linkBtn: {
3624
+ border: "none",
3625
+ background: "transparent",
3626
+ color: "#049BAD",
3627
+ cursor: "pointer",
3628
+ padding: "0 8px 0 0",
3629
+ fontSize: 13
3630
+ },
3631
+ badge: {
3632
+ display: "inline-block",
3633
+ padding: "2px 8px",
3634
+ borderRadius: 999,
3635
+ fontSize: 12,
3636
+ fontWeight: 500
3637
+ },
3638
+ badgeOn: { background: "#ecfdf3", color: "#027a48" },
3639
+ badgeOff: { background: "#f2f4f7", color: "#667085" },
3640
+ pagination: {
3641
+ display: "flex",
3642
+ alignItems: "center",
3643
+ justifyContent: "space-between",
3644
+ gap: 12
3645
+ },
3646
+ pageSize: { display: "flex", alignItems: "center", gap: 8, fontSize: 13, color: "#475467" },
3647
+ pageBtns: { display: "flex", gap: 8 },
3648
+ primaryBtn: {
3649
+ border: "none",
3650
+ background: "#049BAD",
3651
+ color: "#fff",
3652
+ borderRadius: 8,
3653
+ padding: "8px 14px",
3654
+ cursor: "pointer",
3655
+ fontSize: 14
3656
+ },
3657
+ secondaryBtn: {
3658
+ border: "1px solid #d0d5dd",
3659
+ background: "#fff",
3660
+ color: "#344054",
3661
+ borderRadius: 8,
3662
+ padding: "8px 14px",
3663
+ cursor: "pointer",
3664
+ fontSize: 14
3665
+ },
3666
+ dangerBtn: {
3667
+ border: "none",
3668
+ background: "#d92d20",
3669
+ color: "#fff",
3670
+ borderRadius: 8,
3671
+ padding: "8px 14px",
3672
+ cursor: "pointer",
3673
+ fontSize: 14
3674
+ },
3675
+ select: {
3676
+ border: "1px solid #d0d5dd",
3677
+ borderRadius: 6,
3678
+ padding: "4px 8px",
3679
+ fontSize: 13,
3680
+ backgroundColor: "#ffffff",
3681
+ color: "#101828"
3682
+ },
3683
+ mask: {
3684
+ position: "fixed",
3685
+ inset: 0,
3686
+ background: "rgba(16, 24, 40, 0.45)",
3687
+ display: "flex",
3688
+ alignItems: "center",
3689
+ justifyContent: "center",
3690
+ zIndex: 1e3,
3691
+ padding: 16
3692
+ },
3693
+ dialog: {
3694
+ width: "100%",
3695
+ maxWidth: 480,
3696
+ background: "#fff",
3697
+ borderRadius: 12,
3698
+ boxShadow: "0 20px 40px rgba(16,24,40,0.18)",
3699
+ maxHeight: "90vh",
3700
+ overflow: "auto"
3701
+ },
3702
+ dialogHeader: {
3703
+ display: "flex",
3704
+ alignItems: "center",
3705
+ justifyContent: "space-between",
3706
+ padding: "14px 16px",
3707
+ borderBottom: "1px solid #eaecf0",
3708
+ position: "sticky",
3709
+ top: 0,
3710
+ background: "#fff",
3711
+ zIndex: 1
3712
+ },
3713
+ dialogTitle: { margin: 0, fontSize: 16, fontWeight: 600 },
3714
+ iconBtn: {
3715
+ border: "none",
3716
+ background: "transparent",
3717
+ fontSize: 22,
3718
+ lineHeight: 1,
3719
+ cursor: "pointer",
3720
+ color: "#667085"
3721
+ },
3722
+ form: { display: "flex", flexDirection: "column", gap: 12, padding: 16 },
3723
+ confirmBody: { display: "flex", flexDirection: "column", gap: 16, padding: 16 },
3724
+ confirmText: { margin: 0, fontSize: 14, color: "#344054", lineHeight: 1.6 },
3725
+ field: { display: "flex", flexDirection: "column", gap: 6 },
3726
+ fieldset: {
3727
+ border: "1px solid #eaecf0",
3728
+ borderRadius: 8,
3729
+ margin: 0,
3730
+ padding: "10px 12px 12px"
3731
+ },
3732
+ label: { fontSize: 13, color: "#344054", fontWeight: 500 },
3733
+ input: {
3734
+ border: "1px solid #d0d5dd",
3735
+ borderRadius: 8,
3736
+ padding: "8px 10px",
3737
+ fontSize: 14,
3738
+ outline: "none",
3739
+ backgroundColor: "#ffffff",
3740
+ color: "#101828",
3741
+ boxSizing: "border-box",
3742
+ width: "100%"
3743
+ },
3744
+ multiSelect: {
3745
+ display: "flex",
3746
+ flexDirection: "column",
3747
+ gap: 6,
3748
+ maxHeight: 160,
3749
+ overflow: "auto",
3750
+ marginTop: 8
3751
+ },
3752
+ selectTrigger: {
3753
+ display: "flex",
3754
+ alignItems: "center",
3755
+ justifyContent: "space-between",
3756
+ gap: 8,
3757
+ width: "100%",
3758
+ border: "1px solid #d0d5dd",
3759
+ borderRadius: 8,
3760
+ padding: "8px 10px",
3761
+ background: "#fff",
3762
+ cursor: "pointer",
3763
+ fontSize: 14,
3764
+ color: "#101828",
3765
+ boxSizing: "border-box",
3766
+ textAlign: "left"
3767
+ },
3768
+ selectTriggerText: {
3769
+ flex: 1,
3770
+ overflow: "hidden",
3771
+ textOverflow: "ellipsis",
3772
+ whiteSpace: "nowrap"
3773
+ },
3774
+ selectPlaceholder: { color: "#98a2b3" },
3775
+ selectChevron: { color: "#667085", fontSize: 10, flexShrink: 0 },
3776
+ required: { color: "#d92d20", marginLeft: 2 },
3777
+ checkItem: {
3778
+ display: "flex",
3779
+ alignItems: "center",
3780
+ gap: 8,
3781
+ fontSize: 14,
3782
+ color: "#101828",
3783
+ cursor: "pointer"
3784
+ },
3785
+ control: {
3786
+ width: 16,
3787
+ height: 16,
3788
+ accentColor: "#049BAD",
3789
+ cursor: "pointer",
3790
+ colorScheme: "light",
3791
+ backgroundColor: "#ffffff"
3792
+ },
3793
+ hint: { fontSize: 13, color: "#98a2b3", padding: "4px 0" },
3794
+ switchRow: {
3795
+ display: "flex",
3796
+ alignItems: "center",
3797
+ justifyContent: "flex-start",
3798
+ gap: 12
3799
+ },
3800
+ switchTrack: {
3801
+ width: 44,
3802
+ height: 24,
3803
+ borderRadius: 999,
3804
+ border: "none",
3805
+ padding: 2,
3806
+ background: "#d0d5dd",
3807
+ cursor: "pointer",
3808
+ position: "relative",
3809
+ transition: "background 0.15s ease"
3810
+ },
3811
+ switchTrackOn: { background: "#049BAD" },
3812
+ switchThumb: {
3813
+ display: "block",
3814
+ width: 20,
3815
+ height: 20,
3816
+ borderRadius: "50%",
3817
+ background: "#fff",
3818
+ boxShadow: "0 1px 2px rgba(16,24,40,0.2)",
3819
+ transform: "translateX(0)",
3820
+ transition: "transform 0.15s ease"
3821
+ },
3822
+ switchThumbOn: { transform: "translateX(20px)" },
3823
+ dialogFooter: {
3824
+ display: "flex",
3825
+ justifyContent: "flex-end",
3826
+ gap: 8,
3827
+ paddingTop: 4
3828
+ }
3829
+ };
3830
+
2846
3831
  // src/react/SystemAdmin.tsx
2847
- import { useMemo as useMemo4, useState as useState5 } from "react";
3832
+ import { useMemo as useMemo4, useState as useState6 } from "react";
2848
3833
 
2849
3834
  // src/admin/menu.ts
2850
3835
  var SYSTEM_ADMIN_MENU = {
2851
3836
  key: "system",
2852
3837
  label: "\u7CFB\u7EDF\u7BA1\u7406",
2853
3838
  children: [
3839
+ { key: "user", label: "\u7528\u6237\u7BA1\u7406" },
3840
+ { key: "role", label: "\u89D2\u8272\u7BA1\u7406" },
2854
3841
  { key: "menu", label: "\u83DC\u5355\u7BA1\u7406" },
2855
- { key: "resource", label: "\u6743\u9650\u70B9\u7BA1\u7406" },
2856
- { key: "role", label: "\u89D2\u8272\u7BA1\u7406" }
3842
+ { key: "resource", label: "\u6743\u9650\u70B9\u7BA1\u7406" }
2857
3843
  ]
2858
3844
  };
2859
3845
  var SYSTEM_ADMIN_DEFAULT_KEY = "menu";
2860
3846
 
2861
3847
  // src/react/SystemAdmin.tsx
2862
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
3848
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
2863
3849
  function SystemAdmin({
2864
3850
  menuApi,
2865
3851
  resourceApi,
2866
3852
  roleApi,
3853
+ userApi,
2867
3854
  defaultActiveKey = SYSTEM_ADMIN_DEFAULT_KEY,
2868
3855
  activeKey: controlledKey,
2869
3856
  onActiveKeyChange,
2870
3857
  title = SYSTEM_ADMIN_MENU.label,
2871
3858
  toolbarExtra
2872
3859
  }) {
2873
- const [innerKey, setInnerKey] = useState5(defaultActiveKey);
3860
+ const [innerKey, setInnerKey] = useState6(defaultActiveKey);
2874
3861
  const activeKey = controlledKey ?? innerKey;
2875
3862
  const setActiveKey = (key) => {
2876
3863
  if (controlledKey === void 0) setInnerKey(key);
@@ -2880,18 +3867,18 @@ function SystemAdmin({
2880
3867
  () => SYSTEM_ADMIN_MENU.children.find((item) => item.key === activeKey)?.label ?? "",
2881
3868
  [activeKey]
2882
3869
  );
2883
- return /* @__PURE__ */ jsxs4("div", { style: styles4.root, children: [
2884
- /* @__PURE__ */ jsxs4("aside", { style: styles4.sidebar, children: [
2885
- /* @__PURE__ */ jsx5("div", { style: styles4.sidebarTitle, children: title }),
2886
- /* @__PURE__ */ jsx5("nav", { style: styles4.nav, children: SYSTEM_ADMIN_MENU.children.map((item) => {
3870
+ return /* @__PURE__ */ jsxs5("div", { style: styles5.root, children: [
3871
+ /* @__PURE__ */ jsxs5("aside", { style: styles5.sidebar, children: [
3872
+ /* @__PURE__ */ jsx6("div", { style: styles5.sidebarTitle, children: title }),
3873
+ /* @__PURE__ */ jsx6("nav", { style: styles5.nav, children: SYSTEM_ADMIN_MENU.children.map((item) => {
2887
3874
  const active = item.key === activeKey;
2888
- return /* @__PURE__ */ jsx5(
3875
+ return /* @__PURE__ */ jsx6(
2889
3876
  "button",
2890
3877
  {
2891
3878
  type: "button",
2892
3879
  style: {
2893
- ...styles4.navItem,
2894
- ...active ? styles4.navItemActive : null
3880
+ ...styles5.navItem,
3881
+ ...active ? styles5.navItemActive : null
2895
3882
  },
2896
3883
  onClick: () => setActiveKey(item.key),
2897
3884
  children: item.label
@@ -2900,20 +3887,20 @@ function SystemAdmin({
2900
3887
  );
2901
3888
  }) })
2902
3889
  ] }),
2903
- /* @__PURE__ */ jsxs4("main", { style: styles4.content, children: [
2904
- /* @__PURE__ */ jsxs4("div", { style: styles4.contentHeader, children: [
2905
- /* @__PURE__ */ jsxs4("div", { style: styles4.breadcrumb, children: [
2906
- /* @__PURE__ */ jsx5("span", { style: styles4.breadcrumbParent, children: title }),
2907
- /* @__PURE__ */ jsx5("span", { style: styles4.breadcrumbSep, children: "/" }),
2908
- /* @__PURE__ */ jsx5("span", { style: styles4.breadcrumbCurrent, children: activeLabel })
3890
+ /* @__PURE__ */ jsxs5("main", { style: styles5.content, children: [
3891
+ /* @__PURE__ */ jsxs5("div", { style: styles5.contentHeader, children: [
3892
+ /* @__PURE__ */ jsxs5("div", { style: styles5.breadcrumb, children: [
3893
+ /* @__PURE__ */ jsx6("span", { style: styles5.breadcrumbParent, children: title }),
3894
+ /* @__PURE__ */ jsx6("span", { style: styles5.breadcrumbSep, children: "/" }),
3895
+ /* @__PURE__ */ jsx6("span", { style: styles5.breadcrumbCurrent, children: activeLabel })
2909
3896
  ] }),
2910
3897
  toolbarExtra
2911
3898
  ] }),
2912
- /* @__PURE__ */ jsx5("div", { style: styles4.panel, children: activeKey === "menu" ? /* @__PURE__ */ jsx5(MenuManager, { api: menuApi, title: "\u83DC\u5355\u7BA1\u7406" }) : activeKey === "resource" ? /* @__PURE__ */ jsx5(ResourceManager, { api: resourceApi, title: "\u6743\u9650\u70B9\u7BA1\u7406" }) : /* @__PURE__ */ jsx5(RoleManager, { api: roleApi, title: "\u89D2\u8272\u7BA1\u7406" }) })
3899
+ /* @__PURE__ */ jsx6("div", { style: styles5.panel, children: activeKey === "menu" ? /* @__PURE__ */ jsx6(MenuManager, { api: menuApi, title: "\u83DC\u5355\u7BA1\u7406" }) : activeKey === "resource" ? /* @__PURE__ */ jsx6(ResourceManager, { api: resourceApi, title: "\u6743\u9650\u70B9\u7BA1\u7406" }) : activeKey === "role" ? /* @__PURE__ */ jsx6(RoleManager, { api: roleApi, title: "\u89D2\u8272\u7BA1\u7406" }) : /* @__PURE__ */ jsx6(UserManager, { api: userApi, title: "\u7528\u6237\u7BA1\u7406" }) })
2913
3900
  ] })
2914
3901
  ] });
2915
3902
  }
2916
- var styles4 = {
3903
+ var styles5 = {
2917
3904
  root: {
2918
3905
  display: "flex",
2919
3906
  minHeight: 560,
@@ -3013,15 +4000,18 @@ export {
3013
4000
  SYSTEM_ADMIN_DEFAULT_KEY,
3014
4001
  SYSTEM_ADMIN_MENU,
3015
4002
  SystemAdmin,
4003
+ UserManager,
3016
4004
  appendQueryParam,
3017
4005
  buildCreateBody,
3018
4006
  buildCreateMenuBody,
3019
4007
  buildCreateRoleBody,
4008
+ buildCreateUserBody,
3020
4009
  buildPermissionTreeIndex,
3021
4010
  buildSavePermissionsBody,
3022
4011
  buildUpdateBody,
3023
4012
  buildUpdateMenuBody,
3024
4013
  buildUpdateRoleBody,
4014
+ buildUpdateUserBody,
3025
4015
  collectTreeResourceIds,
3026
4016
  countCheckedDescendants,
3027
4017
  createAuthorizationResourceApi,
@@ -3029,6 +4019,7 @@ export {
3029
4019
  createMenuResourceApi,
3030
4020
  createPermissionStore,
3031
4021
  createSystemRoleApi,
4022
+ createSystemUserApi,
3032
4023
  extractPagination,
3033
4024
  extractRecords,
3034
4025
  getAppClientId,
@@ -3040,12 +4031,16 @@ export {
3040
4031
  mapMenuResource,
3041
4032
  mapPermissionTreeNode,
3042
4033
  mapRolePermissions,
4034
+ mapSystemGroupOption,
3043
4035
  mapSystemRole,
4036
+ mapSystemRoleOption,
4037
+ mapSystemUser,
3044
4038
  resolveMenuDepth,
3045
4039
  snowyflake,
3046
4040
  togglePermissionCheck,
3047
4041
  useHasPermission,
3048
4042
  useHasRole,
3049
- usePermission
4043
+ usePermission,
4044
+ validateUsername
3050
4045
  };
3051
4046
  //# sourceMappingURL=index.js.map