@abpjs/identity-pro 2.7.0 → 2.9.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 +469 -4
- package/dist/index.d.ts +469 -4
- package/dist/index.js +465 -3
- package/dist/index.mjs +454 -3
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
|
-
import { ABP, RestService } from '@abpjs/core';
|
|
1
|
+
import { PagedResultDto, ABP, PagedAndSortedResultRequestDto, RestService } from '@abpjs/core';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Organization Unit With Details DTO
|
|
6
|
+
* Translated from @volo/abp.ng.identity v2.9.0
|
|
7
|
+
* @since 2.9.0
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Represents an organization unit with full details.
|
|
11
|
+
* Used for displaying and managing organization units in the hierarchy.
|
|
12
|
+
*/
|
|
13
|
+
interface OrganizationUnitWithDetailsDto {
|
|
14
|
+
/** Parent organization unit ID (null for root units) */
|
|
15
|
+
parentId?: string;
|
|
16
|
+
/** Hierarchical code of the organization unit (e.g., "00001.00002") */
|
|
17
|
+
code: string;
|
|
18
|
+
/** Display name of the organization unit */
|
|
19
|
+
displayName: string;
|
|
20
|
+
/** Roles assigned to this organization unit */
|
|
21
|
+
roles: unknown[];
|
|
22
|
+
/** Whether this unit has been soft-deleted */
|
|
23
|
+
isDeleted: boolean;
|
|
24
|
+
/** ID of the user who deleted this unit */
|
|
25
|
+
deleterId?: string;
|
|
26
|
+
/** Date and time when the unit was deleted */
|
|
27
|
+
deletionTime?: string;
|
|
28
|
+
/** Date and time of last modification */
|
|
29
|
+
lastModificationTime?: string;
|
|
30
|
+
/** ID of the user who last modified this unit */
|
|
31
|
+
lastModifierId?: string;
|
|
32
|
+
/** Date and time when the unit was created */
|
|
33
|
+
creationTime: string;
|
|
34
|
+
/** ID of the user who created this unit */
|
|
35
|
+
creatorId?: string;
|
|
36
|
+
/** Unique identifier of the organization unit */
|
|
37
|
+
id: string;
|
|
38
|
+
/** Extra properties for extensibility */
|
|
39
|
+
extraProperties: unknown[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Factory function to create an OrganizationUnitWithDetailsDto with defaults.
|
|
43
|
+
* @param initialValues - Partial values to initialize the DTO
|
|
44
|
+
* @returns A new OrganizationUnitWithDetailsDto instance
|
|
45
|
+
*/
|
|
46
|
+
declare function createOrganizationUnitWithDetailsDto(initialValues?: Partial<OrganizationUnitWithDetailsDto>): OrganizationUnitWithDetailsDto;
|
|
47
|
+
|
|
4
48
|
/**
|
|
5
49
|
* Identity namespace containing all types related to identity management.
|
|
6
50
|
* Translated from @volo/abp.ng.identity Identity namespace.
|
|
@@ -8,8 +52,10 @@ import React from 'react';
|
|
|
8
52
|
* Pro features include:
|
|
9
53
|
* - Claim type management
|
|
10
54
|
* - User/Role claims management
|
|
55
|
+
* - Organization unit management (v2.9.0)
|
|
11
56
|
*
|
|
12
57
|
* @since 0.7.2
|
|
58
|
+
* @updated 2.9.0 - Added organization units support
|
|
13
59
|
*/
|
|
14
60
|
declare namespace Identity {
|
|
15
61
|
/**
|
|
@@ -27,6 +73,8 @@ declare namespace Identity {
|
|
|
27
73
|
claims: ClaimResponse;
|
|
28
74
|
/** Pro: Selected claim type for editing */
|
|
29
75
|
selectedClaim: ClaimType;
|
|
76
|
+
/** Pro: Organization units (v2.9.0) */
|
|
77
|
+
organizationUnits: PagedResultDto<OrganizationUnitWithDetailsDto>;
|
|
30
78
|
}
|
|
31
79
|
/**
|
|
32
80
|
* Paginated response for roles
|
|
@@ -77,10 +125,13 @@ declare namespace Identity {
|
|
|
77
125
|
}
|
|
78
126
|
/**
|
|
79
127
|
* Request payload for creating/updating a user
|
|
128
|
+
* @updated 2.9.0 - Added organizationUnitIds
|
|
80
129
|
*/
|
|
81
130
|
interface UserSaveRequest extends User {
|
|
82
131
|
password: string;
|
|
83
132
|
roleNames: string[];
|
|
133
|
+
/** Organization unit IDs the user belongs to (v2.9.0) */
|
|
134
|
+
organizationUnitIds: string[];
|
|
84
135
|
}
|
|
85
136
|
/**
|
|
86
137
|
* Request payload for changing a user's password (admin action)
|
|
@@ -152,20 +203,169 @@ declare namespace Identity {
|
|
|
152
203
|
}
|
|
153
204
|
}
|
|
154
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Get Organization Unit Input
|
|
208
|
+
* Translated from @volo/abp.ng.identity v2.9.0
|
|
209
|
+
* @since 2.9.0
|
|
210
|
+
*/
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Input parameters for querying organization units.
|
|
214
|
+
* Extends PagedAndSortedResultRequestDto for pagination and sorting support.
|
|
215
|
+
*/
|
|
216
|
+
interface GetOrganizationUnitInput extends PagedAndSortedResultRequestDto {
|
|
217
|
+
/** Filter string for searching organization units */
|
|
218
|
+
filter?: string;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Factory function to create a GetOrganizationUnitInput with defaults.
|
|
222
|
+
* @param initialValues - Partial values to initialize the input
|
|
223
|
+
* @returns A new GetOrganizationUnitInput instance
|
|
224
|
+
*/
|
|
225
|
+
declare function createGetOrganizationUnitInput(initialValues?: Partial<GetOrganizationUnitInput>): GetOrganizationUnitInput;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Organization Unit Create/Update Base DTO
|
|
229
|
+
* Translated from @volo/abp.ng.identity v2.9.0
|
|
230
|
+
* @since 2.9.0
|
|
231
|
+
*/
|
|
232
|
+
/**
|
|
233
|
+
* Base interface for creating or updating organization units.
|
|
234
|
+
* Contains common properties shared between create and update operations.
|
|
235
|
+
*/
|
|
236
|
+
interface OrganizationUnitCreateOrUpdateDtoBase {
|
|
237
|
+
/** Display name of the organization unit */
|
|
238
|
+
displayName: string;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Factory function to create an OrganizationUnitCreateOrUpdateDtoBase with defaults.
|
|
242
|
+
* @param initialValues - Partial values to initialize the DTO
|
|
243
|
+
* @returns A new OrganizationUnitCreateOrUpdateDtoBase instance
|
|
244
|
+
*/
|
|
245
|
+
declare function createOrganizationUnitCreateOrUpdateDtoBase(initialValues?: Partial<OrganizationUnitCreateOrUpdateDtoBase>): OrganizationUnitCreateOrUpdateDtoBase;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Organization Unit Create DTO
|
|
249
|
+
* Translated from @volo/abp.ng.identity v2.9.0
|
|
250
|
+
* @since 2.9.0
|
|
251
|
+
*/
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* DTO for creating a new organization unit.
|
|
255
|
+
* Extends the base DTO with parent ID for hierarchy placement.
|
|
256
|
+
*/
|
|
257
|
+
interface OrganizationUnitCreateDto extends OrganizationUnitCreateOrUpdateDtoBase {
|
|
258
|
+
/** Parent organization unit ID (optional, null for root units) */
|
|
259
|
+
parentId?: string;
|
|
260
|
+
/** Extra properties for extensibility */
|
|
261
|
+
extraProperties?: unknown[];
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Factory function to create an OrganizationUnitCreateDto with defaults.
|
|
265
|
+
* @param initialValues - Partial values to initialize the DTO
|
|
266
|
+
* @returns A new OrganizationUnitCreateDto instance
|
|
267
|
+
*/
|
|
268
|
+
declare function createOrganizationUnitCreateDto(initialValues?: Partial<OrganizationUnitCreateDto>): OrganizationUnitCreateDto;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Organization Unit Move Input
|
|
272
|
+
* Translated from @volo/abp.ng.identity v2.9.0
|
|
273
|
+
* @since 2.9.0
|
|
274
|
+
*/
|
|
275
|
+
/**
|
|
276
|
+
* Input for moving an organization unit to a new parent.
|
|
277
|
+
* Used when reorganizing the hierarchy tree.
|
|
278
|
+
*/
|
|
279
|
+
interface OrganizationUnitMoveInput {
|
|
280
|
+
/** New parent organization unit ID (null to move to root level) */
|
|
281
|
+
newParentId?: string;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Factory function to create an OrganizationUnitMoveInput with defaults.
|
|
285
|
+
* @param initialValues - Partial values to initialize the input
|
|
286
|
+
* @returns A new OrganizationUnitMoveInput instance
|
|
287
|
+
*/
|
|
288
|
+
declare function createOrganizationUnitMoveInput(initialValues?: Partial<OrganizationUnitMoveInput>): OrganizationUnitMoveInput;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Organization Unit Role Input
|
|
292
|
+
* Translated from @volo/abp.ng.identity v2.9.0
|
|
293
|
+
* @since 2.9.0
|
|
294
|
+
*/
|
|
295
|
+
/**
|
|
296
|
+
* Input for adding roles to an organization unit.
|
|
297
|
+
* Used when assigning roles to organization units.
|
|
298
|
+
*/
|
|
299
|
+
interface OrganizationUnitRoleInput {
|
|
300
|
+
/** Array of role IDs to add to the organization unit */
|
|
301
|
+
roleIds: string[];
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Factory function to create an OrganizationUnitRoleInput with defaults.
|
|
305
|
+
* @param initialValues - Partial values to initialize the input
|
|
306
|
+
* @returns A new OrganizationUnitRoleInput instance
|
|
307
|
+
*/
|
|
308
|
+
declare function createOrganizationUnitRoleInput(initialValues?: Partial<OrganizationUnitRoleInput>): OrganizationUnitRoleInput;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Organization Unit Update DTO
|
|
312
|
+
* Translated from @volo/abp.ng.identity v2.9.0
|
|
313
|
+
* @since 2.9.0
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* DTO for updating an existing organization unit.
|
|
318
|
+
* Extends the base DTO with optional extra properties.
|
|
319
|
+
*/
|
|
320
|
+
interface OrganizationUnitUpdateDto extends OrganizationUnitCreateOrUpdateDtoBase {
|
|
321
|
+
/** Extra properties for extensibility */
|
|
322
|
+
extraProperties?: unknown[];
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Factory function to create an OrganizationUnitUpdateDto with defaults.
|
|
326
|
+
* @param initialValues - Partial values to initialize the DTO
|
|
327
|
+
* @returns A new OrganizationUnitUpdateDto instance
|
|
328
|
+
*/
|
|
329
|
+
declare function createOrganizationUnitUpdateDto(initialValues?: Partial<OrganizationUnitUpdateDto>): OrganizationUnitUpdateDto;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Organization Unit User Input
|
|
333
|
+
* Translated from @volo/abp.ng.identity v2.9.0
|
|
334
|
+
* @since 2.9.0
|
|
335
|
+
*/
|
|
336
|
+
/**
|
|
337
|
+
* Input for adding users (members) to an organization unit.
|
|
338
|
+
* Used when assigning members to organization units.
|
|
339
|
+
*/
|
|
340
|
+
interface OrganizationUnitUserInput {
|
|
341
|
+
/** Array of user IDs to add to the organization unit */
|
|
342
|
+
userIds: string[];
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Factory function to create an OrganizationUnitUserInput with defaults.
|
|
346
|
+
* @param initialValues - Partial values to initialize the input
|
|
347
|
+
* @returns A new OrganizationUnitUserInput instance
|
|
348
|
+
*/
|
|
349
|
+
declare function createOrganizationUnitUserInput(initialValues?: Partial<OrganizationUnitUserInput>): OrganizationUnitUserInput;
|
|
350
|
+
|
|
155
351
|
/**
|
|
156
352
|
* Identity Pro Component Identifiers
|
|
157
|
-
* Translated from @volo/abp.ng.identity v2.
|
|
353
|
+
* Translated from @volo/abp.ng.identity v2.9.0
|
|
158
354
|
*/
|
|
159
355
|
/**
|
|
160
356
|
* Enum-like const object for identity component identifiers.
|
|
161
357
|
* Used for component registration and identification.
|
|
162
358
|
* @since 2.4.0
|
|
163
359
|
* @updated 2.7.0 - Changed from enum to const object
|
|
360
|
+
* @updated 2.9.0 - Added OrganizationUnits, OrganizationMembers, OrganizationRoles
|
|
164
361
|
*/
|
|
165
362
|
declare const eIdentityComponents: {
|
|
166
363
|
readonly Claims: "Identity.ClaimsComponent";
|
|
167
364
|
readonly Roles: "Identity.RolesComponent";
|
|
168
365
|
readonly Users: "Identity.UsersComponent";
|
|
366
|
+
readonly OrganizationUnits: "Identity.OrganizationUnitsComponent";
|
|
367
|
+
readonly OrganizationMembers: "Identity.OrganizationMembersComponent";
|
|
368
|
+
readonly OrganizationRoles: "Identity.OrganizationRolesComponent";
|
|
169
369
|
};
|
|
170
370
|
/**
|
|
171
371
|
* Type for identity component key values
|
|
@@ -174,12 +374,13 @@ type IdentityComponentKey = (typeof eIdentityComponents)[keyof typeof eIdentityC
|
|
|
174
374
|
|
|
175
375
|
/**
|
|
176
376
|
* Identity Pro Route Names
|
|
177
|
-
* Translated from @volo/abp.ng.identity v2.
|
|
377
|
+
* Translated from @volo/abp.ng.identity v2.9.0
|
|
178
378
|
*/
|
|
179
379
|
/**
|
|
180
380
|
* Enum-like const object for identity route names.
|
|
181
381
|
* Used for localization and navigation configuration.
|
|
182
382
|
* @since 2.7.0
|
|
383
|
+
* @updated 2.9.0 - Added OrganizationUnits
|
|
183
384
|
*/
|
|
184
385
|
declare const eIdentityRouteNames: {
|
|
185
386
|
readonly Administration: "AbpUiNavigation::Menu:Administration";
|
|
@@ -187,6 +388,7 @@ declare const eIdentityRouteNames: {
|
|
|
187
388
|
readonly Roles: "AbpIdentity::Roles";
|
|
188
389
|
readonly Users: "AbpIdentity::Users";
|
|
189
390
|
readonly ClaimTypes: "AbpIdentity::ClaimTypes";
|
|
391
|
+
readonly OrganizationUnits: "AbpIdentity::OrganizationUnits";
|
|
190
392
|
};
|
|
191
393
|
/**
|
|
192
394
|
* Type for identity route name values
|
|
@@ -267,6 +469,13 @@ declare class IdentityService {
|
|
|
267
469
|
* @returns Promise with the user's roles
|
|
268
470
|
*/
|
|
269
471
|
getUserRoles(id: string): Promise<Identity.RoleResponse>;
|
|
472
|
+
/**
|
|
473
|
+
* Get organization units assigned to a user
|
|
474
|
+
* @since 2.9.0
|
|
475
|
+
* @param id - The user ID
|
|
476
|
+
* @returns Promise with the user's organization units
|
|
477
|
+
*/
|
|
478
|
+
getUserOrganizationUnits(id: string): Promise<OrganizationUnitWithDetailsDto[]>;
|
|
270
479
|
/**
|
|
271
480
|
* Change a user's password (admin action)
|
|
272
481
|
* @since 2.7.0
|
|
@@ -543,6 +752,102 @@ declare class IdentityStateService {
|
|
|
543
752
|
dispatchGetUserRoles(id: string): Promise<Identity.RoleItem[]>;
|
|
544
753
|
}
|
|
545
754
|
|
|
755
|
+
/**
|
|
756
|
+
* Service for managing organization unit operations.
|
|
757
|
+
* Handles CRUD operations for organization units hierarchy.
|
|
758
|
+
*
|
|
759
|
+
* Translated from @volo/abp.ng.identity OrganizationUnitService
|
|
760
|
+
* @since 2.9.0
|
|
761
|
+
*/
|
|
762
|
+
declare class OrganizationUnitService {
|
|
763
|
+
/**
|
|
764
|
+
* The API name used for REST requests.
|
|
765
|
+
*/
|
|
766
|
+
apiName: string;
|
|
767
|
+
private rest;
|
|
768
|
+
constructor(rest: RestService);
|
|
769
|
+
/**
|
|
770
|
+
* Add roles to an organization unit
|
|
771
|
+
* @param body - The role IDs to add
|
|
772
|
+
* @param id - The organization unit ID
|
|
773
|
+
* @returns Promise resolving when complete
|
|
774
|
+
*/
|
|
775
|
+
addRolesByIdAndInput(body: OrganizationUnitRoleInput, id: string): Promise<void>;
|
|
776
|
+
/**
|
|
777
|
+
* Add members (users) to an organization unit
|
|
778
|
+
* @param body - The user IDs to add
|
|
779
|
+
* @param id - The organization unit ID
|
|
780
|
+
* @returns Promise resolving when complete
|
|
781
|
+
*/
|
|
782
|
+
addMembersByIdAndInput(body: OrganizationUnitUserInput, id: string): Promise<void>;
|
|
783
|
+
/**
|
|
784
|
+
* Create a new organization unit
|
|
785
|
+
* @param body - The organization unit data
|
|
786
|
+
* @returns Promise with the created organization unit
|
|
787
|
+
*/
|
|
788
|
+
createByInput(body: OrganizationUnitCreateDto): Promise<OrganizationUnitWithDetailsDto>;
|
|
789
|
+
/**
|
|
790
|
+
* Delete an organization unit
|
|
791
|
+
* @param id - The organization unit ID to delete
|
|
792
|
+
* @returns Promise resolving when complete
|
|
793
|
+
*/
|
|
794
|
+
deleteById(id: string): Promise<void>;
|
|
795
|
+
/**
|
|
796
|
+
* Get an organization unit by ID
|
|
797
|
+
* @param id - The organization unit ID
|
|
798
|
+
* @returns Promise with the organization unit
|
|
799
|
+
*/
|
|
800
|
+
getById(id: string): Promise<OrganizationUnitWithDetailsDto>;
|
|
801
|
+
/**
|
|
802
|
+
* Get organization units with optional filtering and pagination
|
|
803
|
+
* @param params - Query parameters for filtering and pagination
|
|
804
|
+
* @returns Promise with paginated organization units
|
|
805
|
+
*/
|
|
806
|
+
getListByInput(params?: GetOrganizationUnitInput): Promise<PagedResultDto<OrganizationUnitWithDetailsDto>>;
|
|
807
|
+
/**
|
|
808
|
+
* Get roles assigned to an organization unit
|
|
809
|
+
* @param params - Query parameters for pagination
|
|
810
|
+
* @param id - The organization unit ID
|
|
811
|
+
* @returns Promise with paginated roles
|
|
812
|
+
*/
|
|
813
|
+
getRolesById(params: ABP.PageQueryParams, id: string): Promise<PagedResultDto<Identity.RoleItem>>;
|
|
814
|
+
/**
|
|
815
|
+
* Get members (users) of an organization unit
|
|
816
|
+
* @param params - Query parameters for pagination
|
|
817
|
+
* @param id - The organization unit ID
|
|
818
|
+
* @returns Promise with paginated users
|
|
819
|
+
*/
|
|
820
|
+
getMembersById(params: ABP.PageQueryParams, id: string): Promise<PagedResultDto<Identity.UserItem>>;
|
|
821
|
+
/**
|
|
822
|
+
* Move an organization unit to a new parent
|
|
823
|
+
* @param body - The move input with new parent ID
|
|
824
|
+
* @param id - The organization unit ID to move
|
|
825
|
+
* @returns Promise resolving when complete
|
|
826
|
+
*/
|
|
827
|
+
moveByIdAndInput(body: OrganizationUnitMoveInput, id: string): Promise<void>;
|
|
828
|
+
/**
|
|
829
|
+
* Update an organization unit
|
|
830
|
+
* @param body - The updated organization unit data
|
|
831
|
+
* @param id - The organization unit ID to update
|
|
832
|
+
* @returns Promise with the updated organization unit
|
|
833
|
+
*/
|
|
834
|
+
updateByIdAndInput(body: OrganizationUnitUpdateDto, id: string): Promise<OrganizationUnitWithDetailsDto>;
|
|
835
|
+
/**
|
|
836
|
+
* Remove a member (user) from an organization unit
|
|
837
|
+
* @param id - The organization unit ID
|
|
838
|
+
* @param memberId - The user ID to remove
|
|
839
|
+
* @returns Promise resolving when complete
|
|
840
|
+
*/
|
|
841
|
+
removeMemberByIdAndMemberId(id: string, memberId: string): Promise<void>;
|
|
842
|
+
/**
|
|
843
|
+
* Remove a role from an organization unit
|
|
844
|
+
* @param id - The organization unit ID
|
|
845
|
+
* @param roleId - The role ID to remove
|
|
846
|
+
* @returns Promise resolving when complete
|
|
847
|
+
*/
|
|
848
|
+
removeRoleByIdAndRoleId(id: string, roleId: string): Promise<void>;
|
|
849
|
+
}
|
|
850
|
+
|
|
546
851
|
/**
|
|
547
852
|
* Result from role operations
|
|
548
853
|
*/
|
|
@@ -1073,4 +1378,164 @@ declare const IDENTITY_POLICIES: {
|
|
|
1073
1378
|
readonly ROLES_DELETE: "AbpIdentity.Roles.Delete";
|
|
1074
1379
|
};
|
|
1075
1380
|
|
|
1076
|
-
|
|
1381
|
+
/**
|
|
1382
|
+
* Tree Adapter Utility
|
|
1383
|
+
* Translated from @volo/abp.ng.identity v2.9.0
|
|
1384
|
+
* @since 2.9.0
|
|
1385
|
+
*
|
|
1386
|
+
* Provides utility classes for converting flat lists to tree structures.
|
|
1387
|
+
* Used primarily for organization unit hierarchy management.
|
|
1388
|
+
*/
|
|
1389
|
+
/**
|
|
1390
|
+
* Base node interface for tree structures.
|
|
1391
|
+
* Entities must implement this interface to be used with TreeAdapter.
|
|
1392
|
+
*/
|
|
1393
|
+
interface BaseNode {
|
|
1394
|
+
/** Unique identifier */
|
|
1395
|
+
id: string;
|
|
1396
|
+
/** Parent node ID (null for root nodes) */
|
|
1397
|
+
parentId: string | null;
|
|
1398
|
+
/** Optional name property */
|
|
1399
|
+
name?: string;
|
|
1400
|
+
/** Optional display name property */
|
|
1401
|
+
displayName?: string;
|
|
1402
|
+
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Tree node wrapping an entity for tree display.
|
|
1405
|
+
* Compatible with various tree UI libraries.
|
|
1406
|
+
*/
|
|
1407
|
+
interface TreeNode<T extends BaseNode> {
|
|
1408
|
+
/** The wrapped entity */
|
|
1409
|
+
entity: T;
|
|
1410
|
+
/** Display title (resolved from name or displayName) */
|
|
1411
|
+
title: string;
|
|
1412
|
+
/** Unique key (same as entity id) */
|
|
1413
|
+
key: string;
|
|
1414
|
+
/** Optional icon */
|
|
1415
|
+
icon: string | null;
|
|
1416
|
+
/** Child nodes */
|
|
1417
|
+
children: TreeNode<T>[];
|
|
1418
|
+
/** Whether this is a leaf node (no children) */
|
|
1419
|
+
isLeaf: boolean;
|
|
1420
|
+
/** Whether this node is checked */
|
|
1421
|
+
checked: boolean;
|
|
1422
|
+
/** Whether this node is selected */
|
|
1423
|
+
selected: boolean;
|
|
1424
|
+
/** Whether this node is expanded */
|
|
1425
|
+
expanded: boolean;
|
|
1426
|
+
/** Whether this node can be selected */
|
|
1427
|
+
selectable: boolean;
|
|
1428
|
+
/** Whether this node is disabled */
|
|
1429
|
+
disabled: boolean;
|
|
1430
|
+
/** Whether the checkbox is disabled */
|
|
1431
|
+
disableCheckbox: boolean;
|
|
1432
|
+
/** Reference to parent node */
|
|
1433
|
+
parentNode: TreeNode<T> | null;
|
|
1434
|
+
/** Parent ID from entity */
|
|
1435
|
+
parentId: string | null;
|
|
1436
|
+
/** ID from entity */
|
|
1437
|
+
id: string;
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* Creates a TreeNode from an entity.
|
|
1441
|
+
* @param entity - The entity to wrap
|
|
1442
|
+
* @param nameResolver - Optional function to resolve display name
|
|
1443
|
+
* @returns A new TreeNode instance
|
|
1444
|
+
*/
|
|
1445
|
+
declare function createTreeNode<T extends BaseNode>(entity: T, nameResolver?: (ent: T) => string): TreeNode<T>;
|
|
1446
|
+
/**
|
|
1447
|
+
* TreeAdapter class for managing hierarchical data.
|
|
1448
|
+
* Converts flat lists into tree structures for UI rendering.
|
|
1449
|
+
*
|
|
1450
|
+
* @example
|
|
1451
|
+
* ```tsx
|
|
1452
|
+
* const units = await organizationUnitService.getListByInput();
|
|
1453
|
+
* const adapter = new TreeAdapter(units.items);
|
|
1454
|
+
* const treeNodes = adapter.getTree();
|
|
1455
|
+
* ```
|
|
1456
|
+
*/
|
|
1457
|
+
declare class TreeAdapter<T extends BaseNode = BaseNode> {
|
|
1458
|
+
private nameResolver?;
|
|
1459
|
+
private list;
|
|
1460
|
+
private tree;
|
|
1461
|
+
private nodeMap;
|
|
1462
|
+
/**
|
|
1463
|
+
* Creates a new TreeAdapter instance.
|
|
1464
|
+
* @param list - Optional initial list of entities
|
|
1465
|
+
* @param nameResolver - Optional function to resolve display names
|
|
1466
|
+
*/
|
|
1467
|
+
constructor(list?: T[], nameResolver?: ((ent: T) => string) | undefined);
|
|
1468
|
+
/**
|
|
1469
|
+
* Sets the list and rebuilds the tree.
|
|
1470
|
+
* @param list - The new list of entities
|
|
1471
|
+
*/
|
|
1472
|
+
setList(list: T[]): void;
|
|
1473
|
+
/**
|
|
1474
|
+
* Gets the original flat list.
|
|
1475
|
+
* @returns The flat list of entities
|
|
1476
|
+
*/
|
|
1477
|
+
getList(): T[];
|
|
1478
|
+
/**
|
|
1479
|
+
* Gets the tree structure.
|
|
1480
|
+
* @returns Array of root TreeNodes
|
|
1481
|
+
*/
|
|
1482
|
+
getTree(): TreeNode<T>[];
|
|
1483
|
+
/**
|
|
1484
|
+
* Gets a node by its ID.
|
|
1485
|
+
* @param id - The node ID
|
|
1486
|
+
* @returns The TreeNode or undefined
|
|
1487
|
+
*/
|
|
1488
|
+
getNodeById(id: string): TreeNode<T> | undefined;
|
|
1489
|
+
/**
|
|
1490
|
+
* Handles a drop operation (moving a node).
|
|
1491
|
+
* Updates the internal structure after drag-and-drop.
|
|
1492
|
+
* @param node - The node that was dropped
|
|
1493
|
+
*/
|
|
1494
|
+
handleDrop(node: TreeNode<T>): void;
|
|
1495
|
+
/**
|
|
1496
|
+
* Handles removing a node from the tree.
|
|
1497
|
+
* @param node - The node to remove
|
|
1498
|
+
*/
|
|
1499
|
+
handleRemove(node: TreeNode<T>): void;
|
|
1500
|
+
/**
|
|
1501
|
+
* Builds the tree structure from the flat list.
|
|
1502
|
+
*/
|
|
1503
|
+
private buildTree;
|
|
1504
|
+
/**
|
|
1505
|
+
* Recursively sorts children by title.
|
|
1506
|
+
* @param nodes - Array of nodes to sort
|
|
1507
|
+
*/
|
|
1508
|
+
private sortChildren;
|
|
1509
|
+
/**
|
|
1510
|
+
* Expands all nodes in the tree.
|
|
1511
|
+
*/
|
|
1512
|
+
expandAll(): void;
|
|
1513
|
+
/**
|
|
1514
|
+
* Collapses all nodes in the tree.
|
|
1515
|
+
*/
|
|
1516
|
+
collapseAll(): void;
|
|
1517
|
+
/**
|
|
1518
|
+
* Gets all expanded node keys.
|
|
1519
|
+
* @returns Array of expanded node IDs
|
|
1520
|
+
*/
|
|
1521
|
+
getExpandedKeys(): string[];
|
|
1522
|
+
/**
|
|
1523
|
+
* Sets expanded state for specific nodes.
|
|
1524
|
+
* @param keys - Array of node IDs to expand
|
|
1525
|
+
*/
|
|
1526
|
+
setExpandedKeys(keys: string[]): void;
|
|
1527
|
+
/**
|
|
1528
|
+
* Finds a node and all its ancestors.
|
|
1529
|
+
* Useful for expanding path to a specific node.
|
|
1530
|
+
* @param id - The target node ID
|
|
1531
|
+
* @returns Array of nodes from root to target
|
|
1532
|
+
*/
|
|
1533
|
+
getPathToNode(id: string): TreeNode<T>[];
|
|
1534
|
+
/**
|
|
1535
|
+
* Expands the path to a specific node.
|
|
1536
|
+
* @param id - The target node ID
|
|
1537
|
+
*/
|
|
1538
|
+
expandPathToNode(id: string): void;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
export { type BaseNode, ClaimModal, type ClaimModalProps, type ClaimOperationResult, ClaimsComponent, type ClaimsComponentProps, type GetOrganizationUnitInput, IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, type IdentityComponentKey, type IdentityRouteNameKey, IdentityService, IdentityStateService, type OrganizationUnitCreateDto, type OrganizationUnitCreateOrUpdateDtoBase, type OrganizationUnitMoveInput, type OrganizationUnitRoleInput, OrganizationUnitService, type OrganizationUnitUpdateDto, type OrganizationUnitUserInput, type OrganizationUnitWithDetailsDto, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, TreeAdapter, type TreeNode, type UseClaimsReturn, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, createGetOrganizationUnitInput, createOrganizationUnitCreateDto, createOrganizationUnitCreateOrUpdateDtoBase, createOrganizationUnitMoveInput, createOrganizationUnitRoleInput, createOrganizationUnitUpdateDto, createOrganizationUnitUserInput, createOrganizationUnitWithDetailsDto, createTreeNode, eIdentityComponents, eIdentityRouteNames, useClaims, useIdentity, useRoles, useUsers };
|