@flusys/ng-iam 1.0.0-beta → 1.0.0-rc

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.
Files changed (28) hide show
  1. package/README.md +225 -24
  2. package/fesm2022/{flusys-ng-iam-action-form-page.component-0b9GwJqa.mjs → flusys-ng-iam-action-form-page.component-C_BRrrWW.mjs} +175 -203
  3. package/fesm2022/flusys-ng-iam-action-form-page.component-C_BRrrWW.mjs.map +1 -0
  4. package/fesm2022/flusys-ng-iam-action-list-page.component-Daf93zpS.mjs +289 -0
  5. package/fesm2022/flusys-ng-iam-action-list-page.component-Daf93zpS.mjs.map +1 -0
  6. package/fesm2022/{flusys-ng-iam-flusys-ng-iam-C-MQjakK.mjs → flusys-ng-iam-flusys-ng-iam-BPIpfrjN.mjs} +892 -818
  7. package/fesm2022/flusys-ng-iam-flusys-ng-iam-BPIpfrjN.mjs.map +1 -0
  8. package/fesm2022/flusys-ng-iam-iam-container.component-Bn4kQtxW.mjs +92 -0
  9. package/fesm2022/flusys-ng-iam-iam-container.component-Bn4kQtxW.mjs.map +1 -0
  10. package/fesm2022/{flusys-ng-iam-permission-page.component-e_RX5mky.mjs → flusys-ng-iam-permission-page.component-CmxOBJPu.mjs} +42 -13
  11. package/fesm2022/flusys-ng-iam-permission-page.component-CmxOBJPu.mjs.map +1 -0
  12. package/fesm2022/{flusys-ng-iam-role-form-page.component-eZM1EPps.mjs → flusys-ng-iam-role-form-page.component-ByNueI1a.mjs} +107 -135
  13. package/fesm2022/flusys-ng-iam-role-form-page.component-ByNueI1a.mjs.map +1 -0
  14. package/fesm2022/flusys-ng-iam-role-list-page.component-CFly5KnH.mjs +316 -0
  15. package/fesm2022/flusys-ng-iam-role-list-page.component-CFly5KnH.mjs.map +1 -0
  16. package/fesm2022/flusys-ng-iam.mjs +1 -1
  17. package/package.json +5 -5
  18. package/types/flusys-ng-iam.d.ts +87 -23
  19. package/fesm2022/flusys-ng-iam-action-form-page.component-0b9GwJqa.mjs.map +0 -1
  20. package/fesm2022/flusys-ng-iam-action-list-page.component-BpvewEGL.mjs +0 -281
  21. package/fesm2022/flusys-ng-iam-action-list-page.component-BpvewEGL.mjs.map +0 -1
  22. package/fesm2022/flusys-ng-iam-flusys-ng-iam-C-MQjakK.mjs.map +0 -1
  23. package/fesm2022/flusys-ng-iam-iam-container.component-Chl5MDkV.mjs +0 -97
  24. package/fesm2022/flusys-ng-iam-iam-container.component-Chl5MDkV.mjs.map +0 -1
  25. package/fesm2022/flusys-ng-iam-permission-page.component-e_RX5mky.mjs.map +0 -1
  26. package/fesm2022/flusys-ng-iam-role-form-page.component-eZM1EPps.mjs.map +0 -1
  27. package/fesm2022/flusys-ng-iam-role-list-page.component-BgzxmHjk.mjs +0 -266
  28. package/fesm2022/flusys-ng-iam-role-list-page.component-BgzxmHjk.mjs.map +0 -1
package/README.md CHANGED
@@ -14,6 +14,7 @@
14
14
  | Version | 1.0.0 |
15
15
  | Dependencies | ng-core, ng-shared, ng-layout (IMenuItem only) |
16
16
  | NO dependency on | ng-auth (fully independent via Provider Pattern) |
17
+ | CSS Framework | Tailwind CSS (not PrimeFlex) |
17
18
  | Build | `npm run build:ng-iam` |
18
19
  | Entry point | `public-api.ts` |
19
20
 
@@ -64,21 +65,34 @@ ng-iam requires these provider interfaces:
64
65
 
65
66
  ### How Components Use Providers
66
67
 
68
+ User selection uses `lib-user-select` component from ng-shared (encapsulates USER_PROVIDER):
69
+
70
+ ```html
71
+ <!-- UserActionSelectorComponent / UserRoleSelectorComponent -->
72
+ <lib-user-select
73
+ [(value)]="selectedUserId"
74
+ [isEditMode]="true"
75
+ placeHolder="Select a user"
76
+ />
77
+ ```
78
+
79
+ Company context is accessed via `LAYOUT_AUTH_STATE`:
80
+
67
81
  ```typescript
68
- // UserActionSelectorComponent / UserRoleSelectorComponent
69
- private readonly userProvider = inject(USER_PROVIDER);
70
82
  private readonly companyContext = inject(LAYOUT_AUTH_STATE);
71
83
 
72
- async loadUsers() {
73
- const response = await firstValueFrom(
74
- this.userProvider.getUsers({
75
- page: 0,
76
- pageSize: MAX_DROPDOWN_ITEMS,
77
- companyId: this.companyContext.currentCompanyInfo()?.id || undefined,
78
- })
79
- );
80
- this.users.set(response?.data ?? []);
81
- }
84
+ // Get current company
85
+ const companyId = this.companyContext.currentCompanyInfo()?.id;
86
+ ```
87
+
88
+ Branch permissions loaded from `USER_PERMISSION_PROVIDER`:
89
+
90
+ ```typescript
91
+ private readonly userPermissionProvider = inject(USER_PERMISSION_PROVIDER);
92
+
93
+ const response = await this.userPermissionProvider
94
+ .getUserBranchPermissions(userId)
95
+ .toPromise();
82
96
  ```
83
97
 
84
98
  ---
@@ -363,12 +377,14 @@ Assigns actions directly to users (DIRECT/FULL mode).
363
377
  | Standalone | Yes |
364
378
  | Change Detection | OnPush |
365
379
 
366
- **Dependencies:** `APP_CONFIG`, `LAYOUT_AUTH_STATE`, `USER_PROVIDER`, `USER_PERMISSION_PROVIDER`, `ActionApiService`, `ActionPermissionLogicService`, `PermissionApiService`, `MessageService`
380
+ **Dependencies:** `APP_CONFIG`, `LAYOUT_AUTH_STATE`, `USER_PERMISSION_PROVIDER`, `ActionApiService`, `ActionPermissionLogicService`, `PermissionApiService`, `MessageService`
367
381
 
368
382
  **Features:**
369
- - User dropdown (loaded from USER_PROVIDER)
383
+ - User dropdown (`lib-user-select` component from ng-shared)
370
384
  - Branch selector (conditional, loaded from USER_PERMISSION_PROVIDER)
371
385
  - Hierarchical TreeTable with checkboxes
386
+ - Responsive table with `overflow-x-auto` container
387
+ - Responsive columns (Code hidden on mobile, Description hidden until lg)
372
388
  - Action type tags (backend/frontend/both)
373
389
  - Prerequisite validation with tooltips
374
390
  - Change tracking with pending add/remove summary
@@ -387,11 +403,13 @@ Assigns roles to users (RBAC/FULL mode).
387
403
  | Standalone | Yes |
388
404
  | Change Detection | OnPush |
389
405
 
390
- **Dependencies:** `APP_CONFIG`, `LAYOUT_AUTH_STATE`, `USER_PROVIDER`, `USER_PERMISSION_PROVIDER`, `RoleApiService`, `PermissionApiService`, `MessageService`
406
+ **Dependencies:** `APP_CONFIG`, `LAYOUT_AUTH_STATE`, `USER_PERMISSION_PROVIDER`, `RoleApiService`, `PermissionApiService`, `MessageService`
391
407
 
392
408
  **Features:**
393
- - User dropdown with branch selector
394
- - DataTable with pagination
409
+ - User dropdown (`lib-user-select` component from ng-shared)
410
+ - Branch selector (conditional)
411
+ - DataTable with pagination and `overflow-x-auto` container
412
+ - Responsive columns (Code hidden on mobile, Description hidden until md)
395
413
  - Change tracking with pending add/remove summary
396
414
  - Select/deselect all
397
415
  - No prerequisite validation (roles are simple assignments)
@@ -411,12 +429,13 @@ Assigns actions to roles (RBAC/FULL mode).
411
429
  **Dependencies:** `RoleApiService`, `ActionApiService`, `PermissionApiService`, `MessageService`, `ActionPermissionLogicService`
412
430
 
413
431
  **Features:**
414
- - Role dropdown
415
- - Hierarchical TreeTable with checkboxes
432
+ - Role dropdown with filter
433
+ - Hierarchical TreeTable with checkboxes and `overflow-x-auto` container
434
+ - Responsive columns (Code hidden until md, Requirements hidden until lg)
416
435
  - Prerequisite validation with smart dependency handling
417
436
  - Request cancellation with AbortController
418
437
  - Pre-save validation with auto-fix dialog
419
- - Change tracking
438
+ - Change tracking with pending add/remove summary
420
439
 
421
440
  ---
422
441
 
@@ -433,11 +452,14 @@ Manages company action whitelisting (when company feature enabled).
433
452
  **Dependencies:** `COMPANY_API_PROVIDER`, `ActionApiService`, `PermissionApiService`, `MessageService`, `ConfirmationService`, `ActionPermissionLogicService`
434
453
 
435
454
  **Features:**
436
- - Company dropdown (loaded from COMPANY_API_PROVIDER)
455
+ - Company dropdown with filter (loaded from COMPANY_API_PROVIDER)
437
456
  - Full action tree (not filtered by company whitelist)
438
- - Prerequisite validation
457
+ - Hierarchical TreeTable with `overflow-x-auto` container
458
+ - Responsive columns (Code hidden until md, Description hidden until lg)
459
+ - Prerequisite validation with tooltips
439
460
  - Backend prerequisite error handling with auto-fix
440
461
  - Request cancellation with AbortController
462
+ - Change tracking with pending whitelist/remove summary
441
463
 
442
464
  ---
443
465
 
@@ -453,8 +475,34 @@ Tabbed navigation container for IAM pages.
453
475
  |----------|-------|
454
476
  | Selector | `lib-iam-container` |
455
477
  | Tabs | Actions (always), Roles (RBAC/FULL), Permissions (always) |
478
+ | Change Detection | OnPush |
456
479
 
457
- Uses `RouterLink` and `RouterLinkActive` for navigation. Tab visibility based on permission mode.
480
+ **Features:**
481
+ - Responsive page title (`text-xl sm:text-2xl`)
482
+ - Horizontally scrollable tabs on mobile (hidden scrollbar)
483
+ - Uses `RouterLink` and `RouterLinkActive` for navigation
484
+ - Tab visibility based on permission mode
485
+
486
+ **Responsive Patterns:**
487
+
488
+ ```html
489
+ <!-- Page title -->
490
+ <h1 class="text-xl sm:text-2xl font-bold m-0">Identity & Access Management</h1>
491
+
492
+ <!-- Horizontally scrollable tabs (hidden scrollbar) -->
493
+ <div class="scrollbar-hide flex gap-1 overflow-x-auto flex-nowrap">
494
+ <!-- tabs -->
495
+ </div>
496
+ ```
497
+
498
+ **Scrollbar hide CSS:**
499
+ ```css
500
+ .scrollbar-hide {
501
+ -ms-overflow-style: none;
502
+ scrollbar-width: none;
503
+ &::-webkit-scrollbar { display: none; }
504
+ }
505
+ ```
458
506
 
459
507
  ---
460
508
 
@@ -467,6 +515,11 @@ Hierarchical action list with CRUD operations.
467
515
  | Selector | `lib-action-list-page` |
468
516
  | Features | TreeTable display, create/edit/delete, read-only indicators, company context awareness |
469
517
 
518
+ **Responsive features:**
519
+ - TreeTable with `overflow-x-auto -mx-4 sm:mx-0` container
520
+ - Responsive columns: Code (hidden until md), Active (hidden until sm), Read Only (hidden until lg)
521
+ - Responsive header with stacked layout on mobile
522
+
470
523
  Reloads actions when company context changes via effect.
471
524
 
472
525
  ---
@@ -493,6 +546,11 @@ Paginated role list with CRUD operations.
493
546
  | Selector | `lib-role-list-page` |
494
547
  | Features | Paginated table (10/25/50), create/edit/delete, company context filtering, read-only indicators |
495
548
 
549
+ **Responsive features:**
550
+ - Table with `overflow-x-auto -mx-4 sm:mx-0` container
551
+ - Responsive columns: Description (hidden until md), Read Only (hidden until sm)
552
+ - Conditional paginator (only shown when data exists)
553
+
496
554
  ---
497
555
 
498
556
  ### RoleFormPageComponent
@@ -883,6 +941,96 @@ GET /iam/permissions/company-actions/:id # Get company's whitelisted action
883
941
 
884
942
  ---
885
943
 
944
+ ## Responsive Table Patterns
945
+
946
+ All IAM tables and tree tables use consistent responsive patterns with Tailwind CSS.
947
+
948
+ ### Table Container Pattern
949
+
950
+ ```html
951
+ <!-- Wrapper enables horizontal scroll on mobile, full-width on desktop -->
952
+ <div class="overflow-x-auto -mx-4 sm:mx-0">
953
+ <p-treeTable
954
+ [value]="treeNodes()"
955
+ dataKey="id"
956
+ styleClass="p-treetable-sm"
957
+ [tableStyle]="{ 'min-width': '50rem' }"
958
+ >
959
+ <!-- ... -->
960
+ </p-treeTable>
961
+ </div>
962
+ ```
963
+
964
+ **Key properties:**
965
+ - `overflow-x-auto` - Enables horizontal scroll when content exceeds container
966
+ - `-mx-4 sm:mx-0` - Edge-to-edge on mobile, normal margins on desktop
967
+ - `[tableStyle]="{ 'min-width': '50rem' }"` - Minimum width ensures consistent layout
968
+
969
+ ### Responsive Column Visibility
970
+
971
+ ```html
972
+ <ng-template #header>
973
+ <tr>
974
+ <th class="w-12"><!-- checkbox --></th>
975
+ <th>Name</th> <!-- Always visible -->
976
+ <th class="hidden sm:table-cell">Code</th> <!-- Hidden on xs -->
977
+ <th>Type</th> <!-- Always visible -->
978
+ <th class="hidden md:table-cell">Status</th> <!-- Hidden until md -->
979
+ <th class="hidden lg:table-cell">Description</th> <!-- Hidden until lg -->
980
+ </tr>
981
+ </ng-template>
982
+ ```
983
+
984
+ **Breakpoint classes:**
985
+ | Class | Visibility |
986
+ |-------|------------|
987
+ | (none) | Always visible |
988
+ | `hidden sm:table-cell` | Visible at 640px+ |
989
+ | `hidden md:table-cell` | Visible at 768px+ |
990
+ | `hidden lg:table-cell` | Visible at 1024px+ |
991
+
992
+ ### Header Layout Pattern
993
+
994
+ ```html
995
+ <div class="flex flex-col md:flex-row justify-between items-start md:items-center gap-3 mb-4">
996
+ <div>
997
+ <h5 class="m-0 mb-1">Section Title</h5>
998
+ <p class="text-sm text-muted-color m-0">{{ count }} items available</p>
999
+ </div>
1000
+ <div class="flex flex-wrap gap-2">
1001
+ <!-- Action buttons -->
1002
+ </div>
1003
+ </div>
1004
+ ```
1005
+
1006
+ ### Dark Mode Styling
1007
+
1008
+ ```css
1009
+ /* Light mode */
1010
+ .validation-warning {
1011
+ background-color: var(--p-yellow-50, #fefce8);
1012
+ border-left: 4px solid var(--p-yellow-500, #eab308);
1013
+ color: var(--p-yellow-700, #a16207);
1014
+ }
1015
+
1016
+ /* Dark mode */
1017
+ :host-context(.p-dark) .validation-warning {
1018
+ background-color: rgba(234, 179, 8, 0.1);
1019
+ color: var(--p-yellow-400, #facc15);
1020
+ }
1021
+ ```
1022
+
1023
+ **Color classes (Tailwind):**
1024
+ | Purpose | Class |
1025
+ |---------|-------|
1026
+ | Muted text | `text-muted-color` |
1027
+ | Success | `text-green-500` |
1028
+ | Danger | `text-red-500` |
1029
+ | Warning | `text-orange-500` |
1030
+ | Primary | `text-primary` |
1031
+
1032
+ ---
1033
+
886
1034
  ## Best Practices
887
1035
 
888
1036
  ### Permission Loading
@@ -986,6 +1134,9 @@ const logic: ILogicNode = {
986
1134
  | 401 on IAM endpoints with external auth | Auth token not forwarded | Ensure your auth interceptor adds `Authorization` header to IAM requests |
987
1135
  | Provider not configured error | Missing DI registration | Add required providers to `app.config.ts` (USER_PROVIDER, LAYOUT_AUTH_STATE) |
988
1136
  | Empty user/company dropdowns | API response format mismatch | Ensure adapters return `IListResponse<T>` format with `data` array |
1137
+ | TreeTable has excessive whitespace | Using `scrollHeight="flex"` without fixed-height parent | Remove `scrollHeight="flex"` and `[scrollable]="true"`, use `overflow-x-auto` container instead |
1138
+ | Table not horizontally scrollable on mobile | Missing responsive wrapper | Add `<div class="overflow-x-auto -mx-4 sm:mx-0">` around table |
1139
+ | Columns visible on mobile causing overflow | Missing responsive column classes | Add `hidden sm:table-cell` or `hidden md:table-cell` to non-essential columns |
989
1140
 
990
1141
  ---
991
1142
 
@@ -1015,6 +1166,56 @@ IAM_PERMISSION_MODE=FULL # DIRECT, RBAC, or FULL
1015
1166
 
1016
1167
  ---
1017
1168
 
1169
+ ## Provider Functions
1170
+
1171
+ ### provideIamProviders()
1172
+
1173
+ Registers provider adapters that enable other packages (ng-auth) to access IAM functionality without direct dependencies.
1174
+
1175
+ ```typescript
1176
+ import { provideIamProviders } from '@flusys/ng-iam';
1177
+
1178
+ // app.config.ts
1179
+ export const appConfig: ApplicationConfig = {
1180
+ providers: [
1181
+ ...provideIamProviders(), // Register IAM providers
1182
+ ],
1183
+ };
1184
+ ```
1185
+
1186
+ **Registers:**
1187
+
1188
+ | Token | Adapter | Purpose |
1189
+ |-------|---------|---------|
1190
+ | `PROFILE_PERMISSION_PROVIDER` | `ProfilePermissionProviderAdapter` | User roles/actions for profile page |
1191
+
1192
+ ### ProfilePermissionProviderAdapter
1193
+
1194
+ Implements `IProfilePermissionProvider` from ng-shared. Enables ng-auth's profile page to display user permissions.
1195
+
1196
+ ```typescript
1197
+ interface IProfilePermissionProvider {
1198
+ getUserRoles(userId: string, branchId?: string): Observable<ISingleResponse<IProfileRoleInfo[]>>;
1199
+ getUserActions(userId: string, branchId?: string): Observable<ISingleResponse<IProfileActionInfo[]>>;
1200
+ }
1201
+ ```
1202
+
1203
+ **Usage in ng-auth profile page:**
1204
+
1205
+ ```typescript
1206
+ // Optional injection - graceful degradation when IAM disabled
1207
+ private readonly permissionProvider = inject(PROFILE_PERMISSION_PROVIDER, { optional: true });
1208
+
1209
+ // Load user permissions
1210
+ if (this.permissionProvider) {
1211
+ this.permissionProvider.getUserRoles(userId, branchId).subscribe(response => {
1212
+ this.roles.set(response.data ?? []);
1213
+ });
1214
+ }
1215
+ ```
1216
+
1217
+ ---
1218
+
1018
1219
  ## See Also
1019
1220
 
1020
1221
  - **[CORE-GUIDE.md](./CORE-GUIDE.md)** - Configuration system (APP_CONFIG)
@@ -1024,5 +1225,5 @@ IAM_PERMISSION_MODE=FULL # DIRECT, RBAC, or FULL
1024
1225
 
1025
1226
  ---
1026
1227
 
1027
- **Last Updated:** 2026-02-15
1228
+ **Last Updated:** 2026-02-18 (Updated responsive patterns documentation)
1028
1229
  **Angular Version:** 21