@abpjs/identity 0.9.0 → 1.1.0
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.d.mts +43 -23
- package/dist/index.d.ts +43 -23
- package/dist/index.js +49 -12
- package/dist/index.mjs +49 -12
- package/package.json +10 -7
package/dist/index.d.mts
CHANGED
|
@@ -158,6 +158,11 @@ interface RoleOperationResult {
|
|
|
158
158
|
success: boolean;
|
|
159
159
|
error?: string;
|
|
160
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Sort order type
|
|
163
|
+
* @since 1.0.0
|
|
164
|
+
*/
|
|
165
|
+
type SortOrder = 'asc' | 'desc' | '';
|
|
161
166
|
/**
|
|
162
167
|
* Return type for useRoles hook
|
|
163
168
|
*/
|
|
@@ -172,7 +177,11 @@ interface UseRolesReturn {
|
|
|
172
177
|
isLoading: boolean;
|
|
173
178
|
/** Error message if any */
|
|
174
179
|
error: string | null;
|
|
175
|
-
/**
|
|
180
|
+
/** Current sort key @since 1.0.0 */
|
|
181
|
+
sortKey: string;
|
|
182
|
+
/** Current sort order @since 1.0.0 */
|
|
183
|
+
sortOrder: SortOrder;
|
|
184
|
+
/** Fetch all roles with optional pagination/filtering */
|
|
176
185
|
fetchRoles: (params?: ABP.PageQueryParams) => Promise<RoleOperationResult>;
|
|
177
186
|
/** Get a role by ID and set it as selected */
|
|
178
187
|
getRoleById: (id: string) => Promise<RoleOperationResult>;
|
|
@@ -184,6 +193,10 @@ interface UseRolesReturn {
|
|
|
184
193
|
deleteRole: (id: string) => Promise<RoleOperationResult>;
|
|
185
194
|
/** Set the selected role */
|
|
186
195
|
setSelectedRole: (role: Identity.RoleItem | null) => void;
|
|
196
|
+
/** Set sort key @since 1.0.0 */
|
|
197
|
+
setSortKey: (key: string) => void;
|
|
198
|
+
/** Set sort order @since 1.0.0 */
|
|
199
|
+
setSortOrder: (order: SortOrder) => void;
|
|
187
200
|
/** Reset state */
|
|
188
201
|
reset: () => void;
|
|
189
202
|
}
|
|
@@ -252,6 +265,10 @@ interface UseUsersReturn {
|
|
|
252
265
|
error: string | null;
|
|
253
266
|
/** Current page query parameters */
|
|
254
267
|
pageQuery: ABP.PageQueryParams;
|
|
268
|
+
/** Current sort key @since 1.0.0 */
|
|
269
|
+
sortKey: string;
|
|
270
|
+
/** Current sort order @since 1.0.0 */
|
|
271
|
+
sortOrder: SortOrder;
|
|
255
272
|
/** Fetch users with pagination */
|
|
256
273
|
fetchUsers: (params?: ABP.PageQueryParams) => Promise<UserOperationResult>;
|
|
257
274
|
/** Get a user by ID and set it as selected */
|
|
@@ -268,6 +285,10 @@ interface UseUsersReturn {
|
|
|
268
285
|
setSelectedUser: (user: Identity.UserItem | null) => void;
|
|
269
286
|
/** Set page query parameters */
|
|
270
287
|
setPageQuery: (query: ABP.PageQueryParams) => void;
|
|
288
|
+
/** Set sort key @since 1.0.0 */
|
|
289
|
+
setSortKey: (key: string) => void;
|
|
290
|
+
/** Set sort order @since 1.0.0 */
|
|
291
|
+
setSortOrder: (order: SortOrder) => void;
|
|
271
292
|
/** Reset state */
|
|
272
293
|
reset: () => void;
|
|
273
294
|
}
|
|
@@ -388,6 +409,11 @@ interface RolesComponentProps {
|
|
|
388
409
|
*/
|
|
389
410
|
declare function RolesComponent({ onRoleCreated, onRoleUpdated, onRoleDeleted, }: RolesComponentProps): React.ReactElement;
|
|
390
411
|
|
|
412
|
+
/**
|
|
413
|
+
* Password rule type for validation display
|
|
414
|
+
* @since 1.1.0
|
|
415
|
+
*/
|
|
416
|
+
type PasswordRule = 'number' | 'small' | 'capital' | 'special';
|
|
391
417
|
/**
|
|
392
418
|
* Props for UsersComponent
|
|
393
419
|
*/
|
|
@@ -398,35 +424,29 @@ interface UsersComponentProps {
|
|
|
398
424
|
onUserUpdated?: (user: Identity.UserItem) => void;
|
|
399
425
|
/** Optional callback when a user is deleted */
|
|
400
426
|
onUserDeleted?: (id: string) => void;
|
|
427
|
+
/**
|
|
428
|
+
* Password validation rules to display
|
|
429
|
+
* @since 1.1.0
|
|
430
|
+
*/
|
|
431
|
+
passwordRulesArr?: PasswordRule[];
|
|
432
|
+
/**
|
|
433
|
+
* Required minimum password length
|
|
434
|
+
* @since 1.1.0
|
|
435
|
+
*/
|
|
436
|
+
requiredPasswordLength?: number;
|
|
401
437
|
}
|
|
402
|
-
|
|
403
|
-
* UsersComponent - Component for managing users
|
|
404
|
-
*
|
|
405
|
-
* This is the React equivalent of Angular's UsersComponent.
|
|
406
|
-
* It displays a table of users with CRUD operations, role assignment, and permission management.
|
|
407
|
-
*
|
|
408
|
-
* @example
|
|
409
|
-
* ```tsx
|
|
410
|
-
* function IdentityPage() {
|
|
411
|
-
* return (
|
|
412
|
-
* <UsersComponent
|
|
413
|
-
* onUserCreated={(user) => console.log('User created:', user)}
|
|
414
|
-
* onUserDeleted={(id) => console.log('User deleted:', id)}
|
|
415
|
-
* />
|
|
416
|
-
* );
|
|
417
|
-
* }
|
|
418
|
-
* ```
|
|
419
|
-
*/
|
|
420
|
-
declare function UsersComponent({ onUserCreated, onUserUpdated, onUserDeleted, }: UsersComponentProps): React.ReactElement;
|
|
438
|
+
declare function UsersComponent({ onUserCreated, onUserUpdated, onUserDeleted, passwordRulesArr, requiredPasswordLength, }: UsersComponentProps): React.ReactElement;
|
|
421
439
|
|
|
422
440
|
/**
|
|
423
|
-
* Identity module routes configuration
|
|
441
|
+
* Identity module routes configuration.
|
|
424
442
|
* Translated from @abp/ng.identity IDENTITY_ROUTES.
|
|
425
443
|
*
|
|
426
444
|
* These routes define the navigation structure for the identity module
|
|
427
445
|
* within the ABP Framework application.
|
|
428
446
|
*
|
|
429
|
-
*
|
|
447
|
+
* @deprecated since version 1.0.0. Route configuration is now handled by
|
|
448
|
+
* identity config services. This constant is kept for backwards compatibility
|
|
449
|
+
* but may be removed in future versions.
|
|
430
450
|
*/
|
|
431
451
|
declare const IDENTITY_ROUTES: {
|
|
432
452
|
routes: ABP.FullRoute[];
|
|
@@ -465,4 +485,4 @@ declare const IDENTITY_POLICIES: {
|
|
|
465
485
|
readonly ROLES_DELETE: "AbpIdentity.Roles.Delete";
|
|
466
486
|
};
|
|
467
487
|
|
|
468
|
-
export { IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useIdentity, useRoles, useUsers };
|
|
488
|
+
export { IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type PasswordRule, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useIdentity, useRoles, useUsers };
|
package/dist/index.d.ts
CHANGED
|
@@ -158,6 +158,11 @@ interface RoleOperationResult {
|
|
|
158
158
|
success: boolean;
|
|
159
159
|
error?: string;
|
|
160
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Sort order type
|
|
163
|
+
* @since 1.0.0
|
|
164
|
+
*/
|
|
165
|
+
type SortOrder = 'asc' | 'desc' | '';
|
|
161
166
|
/**
|
|
162
167
|
* Return type for useRoles hook
|
|
163
168
|
*/
|
|
@@ -172,7 +177,11 @@ interface UseRolesReturn {
|
|
|
172
177
|
isLoading: boolean;
|
|
173
178
|
/** Error message if any */
|
|
174
179
|
error: string | null;
|
|
175
|
-
/**
|
|
180
|
+
/** Current sort key @since 1.0.0 */
|
|
181
|
+
sortKey: string;
|
|
182
|
+
/** Current sort order @since 1.0.0 */
|
|
183
|
+
sortOrder: SortOrder;
|
|
184
|
+
/** Fetch all roles with optional pagination/filtering */
|
|
176
185
|
fetchRoles: (params?: ABP.PageQueryParams) => Promise<RoleOperationResult>;
|
|
177
186
|
/** Get a role by ID and set it as selected */
|
|
178
187
|
getRoleById: (id: string) => Promise<RoleOperationResult>;
|
|
@@ -184,6 +193,10 @@ interface UseRolesReturn {
|
|
|
184
193
|
deleteRole: (id: string) => Promise<RoleOperationResult>;
|
|
185
194
|
/** Set the selected role */
|
|
186
195
|
setSelectedRole: (role: Identity.RoleItem | null) => void;
|
|
196
|
+
/** Set sort key @since 1.0.0 */
|
|
197
|
+
setSortKey: (key: string) => void;
|
|
198
|
+
/** Set sort order @since 1.0.0 */
|
|
199
|
+
setSortOrder: (order: SortOrder) => void;
|
|
187
200
|
/** Reset state */
|
|
188
201
|
reset: () => void;
|
|
189
202
|
}
|
|
@@ -252,6 +265,10 @@ interface UseUsersReturn {
|
|
|
252
265
|
error: string | null;
|
|
253
266
|
/** Current page query parameters */
|
|
254
267
|
pageQuery: ABP.PageQueryParams;
|
|
268
|
+
/** Current sort key @since 1.0.0 */
|
|
269
|
+
sortKey: string;
|
|
270
|
+
/** Current sort order @since 1.0.0 */
|
|
271
|
+
sortOrder: SortOrder;
|
|
255
272
|
/** Fetch users with pagination */
|
|
256
273
|
fetchUsers: (params?: ABP.PageQueryParams) => Promise<UserOperationResult>;
|
|
257
274
|
/** Get a user by ID and set it as selected */
|
|
@@ -268,6 +285,10 @@ interface UseUsersReturn {
|
|
|
268
285
|
setSelectedUser: (user: Identity.UserItem | null) => void;
|
|
269
286
|
/** Set page query parameters */
|
|
270
287
|
setPageQuery: (query: ABP.PageQueryParams) => void;
|
|
288
|
+
/** Set sort key @since 1.0.0 */
|
|
289
|
+
setSortKey: (key: string) => void;
|
|
290
|
+
/** Set sort order @since 1.0.0 */
|
|
291
|
+
setSortOrder: (order: SortOrder) => void;
|
|
271
292
|
/** Reset state */
|
|
272
293
|
reset: () => void;
|
|
273
294
|
}
|
|
@@ -388,6 +409,11 @@ interface RolesComponentProps {
|
|
|
388
409
|
*/
|
|
389
410
|
declare function RolesComponent({ onRoleCreated, onRoleUpdated, onRoleDeleted, }: RolesComponentProps): React.ReactElement;
|
|
390
411
|
|
|
412
|
+
/**
|
|
413
|
+
* Password rule type for validation display
|
|
414
|
+
* @since 1.1.0
|
|
415
|
+
*/
|
|
416
|
+
type PasswordRule = 'number' | 'small' | 'capital' | 'special';
|
|
391
417
|
/**
|
|
392
418
|
* Props for UsersComponent
|
|
393
419
|
*/
|
|
@@ -398,35 +424,29 @@ interface UsersComponentProps {
|
|
|
398
424
|
onUserUpdated?: (user: Identity.UserItem) => void;
|
|
399
425
|
/** Optional callback when a user is deleted */
|
|
400
426
|
onUserDeleted?: (id: string) => void;
|
|
427
|
+
/**
|
|
428
|
+
* Password validation rules to display
|
|
429
|
+
* @since 1.1.0
|
|
430
|
+
*/
|
|
431
|
+
passwordRulesArr?: PasswordRule[];
|
|
432
|
+
/**
|
|
433
|
+
* Required minimum password length
|
|
434
|
+
* @since 1.1.0
|
|
435
|
+
*/
|
|
436
|
+
requiredPasswordLength?: number;
|
|
401
437
|
}
|
|
402
|
-
|
|
403
|
-
* UsersComponent - Component for managing users
|
|
404
|
-
*
|
|
405
|
-
* This is the React equivalent of Angular's UsersComponent.
|
|
406
|
-
* It displays a table of users with CRUD operations, role assignment, and permission management.
|
|
407
|
-
*
|
|
408
|
-
* @example
|
|
409
|
-
* ```tsx
|
|
410
|
-
* function IdentityPage() {
|
|
411
|
-
* return (
|
|
412
|
-
* <UsersComponent
|
|
413
|
-
* onUserCreated={(user) => console.log('User created:', user)}
|
|
414
|
-
* onUserDeleted={(id) => console.log('User deleted:', id)}
|
|
415
|
-
* />
|
|
416
|
-
* );
|
|
417
|
-
* }
|
|
418
|
-
* ```
|
|
419
|
-
*/
|
|
420
|
-
declare function UsersComponent({ onUserCreated, onUserUpdated, onUserDeleted, }: UsersComponentProps): React.ReactElement;
|
|
438
|
+
declare function UsersComponent({ onUserCreated, onUserUpdated, onUserDeleted, passwordRulesArr, requiredPasswordLength, }: UsersComponentProps): React.ReactElement;
|
|
421
439
|
|
|
422
440
|
/**
|
|
423
|
-
* Identity module routes configuration
|
|
441
|
+
* Identity module routes configuration.
|
|
424
442
|
* Translated from @abp/ng.identity IDENTITY_ROUTES.
|
|
425
443
|
*
|
|
426
444
|
* These routes define the navigation structure for the identity module
|
|
427
445
|
* within the ABP Framework application.
|
|
428
446
|
*
|
|
429
|
-
*
|
|
447
|
+
* @deprecated since version 1.0.0. Route configuration is now handled by
|
|
448
|
+
* identity config services. This constant is kept for backwards compatibility
|
|
449
|
+
* but may be removed in future versions.
|
|
430
450
|
*/
|
|
431
451
|
declare const IDENTITY_ROUTES: {
|
|
432
452
|
routes: ABP.FullRoute[];
|
|
@@ -465,4 +485,4 @@ declare const IDENTITY_POLICIES: {
|
|
|
465
485
|
readonly ROLES_DELETE: "AbpIdentity.Roles.Delete";
|
|
466
486
|
};
|
|
467
487
|
|
|
468
|
-
export { IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useIdentity, useRoles, useUsers };
|
|
488
|
+
export { IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, type PasswordRule, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useIdentity, useRoles, useUsers };
|
package/dist/index.js
CHANGED
|
@@ -185,6 +185,8 @@ function useRoles() {
|
|
|
185
185
|
const [selectedRole, setSelectedRole] = (0, import_react.useState)(null);
|
|
186
186
|
const [isLoading, setIsLoading] = (0, import_react.useState)(false);
|
|
187
187
|
const [error, setError] = (0, import_react.useState)(null);
|
|
188
|
+
const [sortKey, setSortKey] = (0, import_react.useState)("name");
|
|
189
|
+
const [sortOrder, setSortOrder] = (0, import_react.useState)("");
|
|
188
190
|
const fetchRoles = (0, import_react.useCallback)(async (params) => {
|
|
189
191
|
setIsLoading(true);
|
|
190
192
|
setError(null);
|
|
@@ -283,12 +285,16 @@ function useRoles() {
|
|
|
283
285
|
selectedRole,
|
|
284
286
|
isLoading,
|
|
285
287
|
error,
|
|
288
|
+
sortKey,
|
|
289
|
+
sortOrder,
|
|
286
290
|
fetchRoles,
|
|
287
291
|
getRoleById,
|
|
288
292
|
createRole,
|
|
289
293
|
updateRole,
|
|
290
294
|
deleteRole,
|
|
291
295
|
setSelectedRole,
|
|
296
|
+
setSortKey,
|
|
297
|
+
setSortOrder,
|
|
292
298
|
reset
|
|
293
299
|
};
|
|
294
300
|
}
|
|
@@ -311,6 +317,8 @@ function useUsers() {
|
|
|
311
317
|
const [isLoading, setIsLoading] = (0, import_react2.useState)(false);
|
|
312
318
|
const [error, setError] = (0, import_react2.useState)(null);
|
|
313
319
|
const [pageQuery, setPageQuery] = (0, import_react2.useState)(DEFAULT_PAGE_QUERY);
|
|
320
|
+
const [sortKey, setSortKey] = (0, import_react2.useState)("userName");
|
|
321
|
+
const [sortOrder, setSortOrder] = (0, import_react2.useState)("");
|
|
314
322
|
const fetchUsers = (0, import_react2.useCallback)(
|
|
315
323
|
async (params) => {
|
|
316
324
|
setIsLoading(true);
|
|
@@ -435,6 +443,8 @@ function useUsers() {
|
|
|
435
443
|
isLoading,
|
|
436
444
|
error,
|
|
437
445
|
pageQuery,
|
|
446
|
+
sortKey,
|
|
447
|
+
sortOrder,
|
|
438
448
|
fetchUsers,
|
|
439
449
|
getUserById,
|
|
440
450
|
getUserRoles,
|
|
@@ -443,6 +453,8 @@ function useUsers() {
|
|
|
443
453
|
deleteUser,
|
|
444
454
|
setSelectedUser,
|
|
445
455
|
setPageQuery,
|
|
456
|
+
setSortKey,
|
|
457
|
+
setSortOrder,
|
|
446
458
|
reset
|
|
447
459
|
};
|
|
448
460
|
}
|
|
@@ -721,10 +733,26 @@ var DEFAULT_FORM_STATE2 = {
|
|
|
721
733
|
twoFactorEnabled: true,
|
|
722
734
|
roleNames: []
|
|
723
735
|
};
|
|
736
|
+
function getPasswordRuleLabel(rule, t) {
|
|
737
|
+
switch (rule) {
|
|
738
|
+
case "number":
|
|
739
|
+
return t("AbpIdentity::Password:RequireDigit");
|
|
740
|
+
case "small":
|
|
741
|
+
return t("AbpIdentity::Password:RequireLowercase");
|
|
742
|
+
case "capital":
|
|
743
|
+
return t("AbpIdentity::Password:RequireUppercase");
|
|
744
|
+
case "special":
|
|
745
|
+
return t("AbpIdentity::Password:RequireNonAlphanumeric");
|
|
746
|
+
default:
|
|
747
|
+
return rule;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
724
750
|
function UsersComponent({
|
|
725
751
|
onUserCreated,
|
|
726
752
|
onUserUpdated,
|
|
727
|
-
onUserDeleted
|
|
753
|
+
onUserDeleted,
|
|
754
|
+
passwordRulesArr = [],
|
|
755
|
+
requiredPasswordLength = 0
|
|
728
756
|
}) {
|
|
729
757
|
const { t } = (0, import_core4.useLocalization)();
|
|
730
758
|
const confirmation = (0, import_theme_shared2.useConfirmation)();
|
|
@@ -1020,17 +1048,26 @@ function UsersComponent({
|
|
|
1020
1048
|
}
|
|
1021
1049
|
) })
|
|
1022
1050
|
] }),
|
|
1023
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1051
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_theme_shared2.FormField, { label: t("AbpIdentity::Password"), required: !selectedUser?.id, children: [
|
|
1052
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1053
|
+
import_react7.Input,
|
|
1054
|
+
{
|
|
1055
|
+
type: "password",
|
|
1056
|
+
value: formState.password,
|
|
1057
|
+
onChange: (e) => handleInputChange("password", e.target.value),
|
|
1058
|
+
autoComplete: "new-password",
|
|
1059
|
+
maxLength: 32,
|
|
1060
|
+
placeholder: selectedUser?.id ? t("AbpIdentity::LeaveBlankToKeepCurrent") : ""
|
|
1061
|
+
}
|
|
1062
|
+
),
|
|
1063
|
+
(requiredPasswordLength > 0 || passwordRulesArr.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react7.Box, { mt: 2, fontSize: "sm", color: "gray.500", children: [
|
|
1064
|
+
requiredPasswordLength > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react7.Text, { children: t("AbpIdentity::Password:MinLength", String(requiredPasswordLength)) }),
|
|
1065
|
+
passwordRulesArr.map((rule) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react7.Text, { children: [
|
|
1066
|
+
"\u2022 ",
|
|
1067
|
+
getPasswordRuleLabel(rule, t)
|
|
1068
|
+
] }, rule))
|
|
1069
|
+
] })
|
|
1070
|
+
] }),
|
|
1034
1071
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_theme_shared2.FormField, { label: t("AbpIdentity::EmailAddress"), required: true, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1035
1072
|
import_react7.Input,
|
|
1036
1073
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -151,6 +151,8 @@ function useRoles() {
|
|
|
151
151
|
const [selectedRole, setSelectedRole] = useState(null);
|
|
152
152
|
const [isLoading, setIsLoading] = useState(false);
|
|
153
153
|
const [error, setError] = useState(null);
|
|
154
|
+
const [sortKey, setSortKey] = useState("name");
|
|
155
|
+
const [sortOrder, setSortOrder] = useState("");
|
|
154
156
|
const fetchRoles = useCallback(async (params) => {
|
|
155
157
|
setIsLoading(true);
|
|
156
158
|
setError(null);
|
|
@@ -249,12 +251,16 @@ function useRoles() {
|
|
|
249
251
|
selectedRole,
|
|
250
252
|
isLoading,
|
|
251
253
|
error,
|
|
254
|
+
sortKey,
|
|
255
|
+
sortOrder,
|
|
252
256
|
fetchRoles,
|
|
253
257
|
getRoleById,
|
|
254
258
|
createRole,
|
|
255
259
|
updateRole,
|
|
256
260
|
deleteRole,
|
|
257
261
|
setSelectedRole,
|
|
262
|
+
setSortKey,
|
|
263
|
+
setSortOrder,
|
|
258
264
|
reset
|
|
259
265
|
};
|
|
260
266
|
}
|
|
@@ -277,6 +283,8 @@ function useUsers() {
|
|
|
277
283
|
const [isLoading, setIsLoading] = useState2(false);
|
|
278
284
|
const [error, setError] = useState2(null);
|
|
279
285
|
const [pageQuery, setPageQuery] = useState2(DEFAULT_PAGE_QUERY);
|
|
286
|
+
const [sortKey, setSortKey] = useState2("userName");
|
|
287
|
+
const [sortOrder, setSortOrder] = useState2("");
|
|
280
288
|
const fetchUsers = useCallback2(
|
|
281
289
|
async (params) => {
|
|
282
290
|
setIsLoading(true);
|
|
@@ -401,6 +409,8 @@ function useUsers() {
|
|
|
401
409
|
isLoading,
|
|
402
410
|
error,
|
|
403
411
|
pageQuery,
|
|
412
|
+
sortKey,
|
|
413
|
+
sortOrder,
|
|
404
414
|
fetchUsers,
|
|
405
415
|
getUserById,
|
|
406
416
|
getUserRoles,
|
|
@@ -409,6 +419,8 @@ function useUsers() {
|
|
|
409
419
|
deleteUser,
|
|
410
420
|
setSelectedUser,
|
|
411
421
|
setPageQuery,
|
|
422
|
+
setSortKey,
|
|
423
|
+
setSortOrder,
|
|
412
424
|
reset
|
|
413
425
|
};
|
|
414
426
|
}
|
|
@@ -707,10 +719,26 @@ var DEFAULT_FORM_STATE2 = {
|
|
|
707
719
|
twoFactorEnabled: true,
|
|
708
720
|
roleNames: []
|
|
709
721
|
};
|
|
722
|
+
function getPasswordRuleLabel(rule, t) {
|
|
723
|
+
switch (rule) {
|
|
724
|
+
case "number":
|
|
725
|
+
return t("AbpIdentity::Password:RequireDigit");
|
|
726
|
+
case "small":
|
|
727
|
+
return t("AbpIdentity::Password:RequireLowercase");
|
|
728
|
+
case "capital":
|
|
729
|
+
return t("AbpIdentity::Password:RequireUppercase");
|
|
730
|
+
case "special":
|
|
731
|
+
return t("AbpIdentity::Password:RequireNonAlphanumeric");
|
|
732
|
+
default:
|
|
733
|
+
return rule;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
710
736
|
function UsersComponent({
|
|
711
737
|
onUserCreated,
|
|
712
738
|
onUserUpdated,
|
|
713
|
-
onUserDeleted
|
|
739
|
+
onUserDeleted,
|
|
740
|
+
passwordRulesArr = [],
|
|
741
|
+
requiredPasswordLength = 0
|
|
714
742
|
}) {
|
|
715
743
|
const { t } = useLocalization2();
|
|
716
744
|
const confirmation = useConfirmation2();
|
|
@@ -1006,17 +1034,26 @@ function UsersComponent({
|
|
|
1006
1034
|
}
|
|
1007
1035
|
) })
|
|
1008
1036
|
] }),
|
|
1009
|
-
/* @__PURE__ */
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1037
|
+
/* @__PURE__ */ jsxs2(FormField2, { label: t("AbpIdentity::Password"), required: !selectedUser?.id, children: [
|
|
1038
|
+
/* @__PURE__ */ jsx2(
|
|
1039
|
+
Input2,
|
|
1040
|
+
{
|
|
1041
|
+
type: "password",
|
|
1042
|
+
value: formState.password,
|
|
1043
|
+
onChange: (e) => handleInputChange("password", e.target.value),
|
|
1044
|
+
autoComplete: "new-password",
|
|
1045
|
+
maxLength: 32,
|
|
1046
|
+
placeholder: selectedUser?.id ? t("AbpIdentity::LeaveBlankToKeepCurrent") : ""
|
|
1047
|
+
}
|
|
1048
|
+
),
|
|
1049
|
+
(requiredPasswordLength > 0 || passwordRulesArr.length > 0) && /* @__PURE__ */ jsxs2(Box2, { mt: 2, fontSize: "sm", color: "gray.500", children: [
|
|
1050
|
+
requiredPasswordLength > 0 && /* @__PURE__ */ jsx2(Text2, { children: t("AbpIdentity::Password:MinLength", String(requiredPasswordLength)) }),
|
|
1051
|
+
passwordRulesArr.map((rule) => /* @__PURE__ */ jsxs2(Text2, { children: [
|
|
1052
|
+
"\u2022 ",
|
|
1053
|
+
getPasswordRuleLabel(rule, t)
|
|
1054
|
+
] }, rule))
|
|
1055
|
+
] })
|
|
1056
|
+
] }),
|
|
1020
1057
|
/* @__PURE__ */ jsx2(FormField2, { label: t("AbpIdentity::EmailAddress"), required: true, children: /* @__PURE__ */ jsx2(
|
|
1021
1058
|
Input2,
|
|
1022
1059
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abpjs/identity",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "ABP Framework identity components for React - translated from @abp/ng.identity",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@chakra-ui/react": "^3.2.0",
|
|
27
27
|
"@emotion/react": "^11.11.0",
|
|
28
|
-
"@abpjs/core": "
|
|
29
|
-
"@abpjs/permission-management": "
|
|
30
|
-
"@abpjs/theme-shared": "
|
|
28
|
+
"@abpjs/core": "1.1.0",
|
|
29
|
+
"@abpjs/permission-management": "1.1.0",
|
|
30
|
+
"@abpjs/theme-shared": "1.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@abp/ng.identity": "0.9.0",
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"tailwindcss": "^3.4.0",
|
|
53
53
|
"tsup": "^8.0.0",
|
|
54
54
|
"typescript": "^5.0.0",
|
|
55
|
-
"vitest": "^1.0.0"
|
|
55
|
+
"vitest": "^1.0.0",
|
|
56
|
+
"@vitest/coverage-v8": "^1.0.0"
|
|
56
57
|
},
|
|
57
58
|
"author": "tekthar.com",
|
|
58
59
|
"license": "LGPL-3.0",
|
|
@@ -61,7 +62,8 @@
|
|
|
61
62
|
},
|
|
62
63
|
"repository": {
|
|
63
64
|
"type": "git",
|
|
64
|
-
"url": "https://github.com/abpjs/abp-react"
|
|
65
|
+
"url": "https://github.com/abpjs/abp-react",
|
|
66
|
+
"directory": "packages/identity"
|
|
65
67
|
},
|
|
66
68
|
"homepage": "https://docs.abpjs.io/docs/packages/identity/overview",
|
|
67
69
|
"bugs": {
|
|
@@ -80,6 +82,7 @@
|
|
|
80
82
|
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
|
|
81
83
|
"format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
|
|
82
84
|
"type-check": "tsc --noEmit",
|
|
83
|
-
"test": "vitest"
|
|
85
|
+
"test": "vitest run",
|
|
86
|
+
"test:watch": "vitest"
|
|
84
87
|
}
|
|
85
88
|
}
|