@flusys/ng-auth 3.0.0 → 4.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.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  `@flusys/ng-auth` provides complete authentication functionality including login, registration, token management, company/branch selection, user administration, and permission handling.
6
6
 
7
7
  **Package:** `@flusys/ng-auth`
8
- **Version:** 3.0.0
8
+ **Version:** 4.0.0-rc
9
9
  **Dependencies:** ng-core, ng-shared, ng-layout
10
10
  **Build:** `npm run build:ng-auth`
11
11
 
@@ -526,7 +526,6 @@ getCompanyBranches(companyId); // User's permitted branches in company
526
526
  ## Pages
527
527
 
528
528
  All page components follow Angular 21 best practices:
529
- - `ChangeDetectionStrategy.OnPush` for optimal performance
530
529
  - Signal Forms (`@angular/forms/signals`) with validation
531
530
  - 100% responsive design (mobile-first with Tailwind)
532
531
  - Dark mode compatible (PrimeNG + Tailwind CSS variables)
@@ -582,11 +581,11 @@ All page components follow Angular 21 best practices:
582
581
  **ProfilePageComponent** (`/profile`)
583
582
  - Page title with description
584
583
  - Avatar section with initials fallback
585
- - Profile picture upload (requires `PROFILE_UPLOAD_PROVIDER` from ng-storage)
584
+ - Profile picture upload (requires `FILE_PROVIDER` from ng-storage)
586
585
  - Update name and phone with Signal Forms
587
- - Extra fields support via AUTH_PROFILE_EXTENSION
588
- - Editable fields (user can modify)
589
- - View-only fields (managed by admin)
586
+ - Extra fields support via two providers:
587
+ - `AUTH_PROFILE_EXTENSION` - Fields user can edit
588
+ - `AUTH_USER_FORM_EXTENSION` - Fields displayed as view-only ("Managed by Admin")
590
589
  - Change password section with PrimeNG password strength indicator
591
590
  - Company/branch info (if company feature enabled)
592
591
  - Roles/actions display (requires `PROFILE_PERMISSION_PROVIDER` from ng-iam)
@@ -597,7 +596,7 @@ All page components follow Angular 21 best practices:
597
596
 
598
597
  | Provider | Source | Feature Enabled |
599
598
  |----------|--------|-----------------|
600
- | `PROFILE_UPLOAD_PROVIDER` | ng-storage via `provideStorageProviders()` | Profile picture upload |
599
+ | `FILE_PROVIDER` | ng-storage via `provideStorageProviders()` | Profile picture upload |
601
600
  | `PROFILE_PERMISSION_PROVIDER` | ng-iam via `provideIamProviders()` | Roles/actions display |
602
601
 
603
602
  ### Administration Pages
@@ -639,7 +638,6 @@ All page components follow Angular 21 best practices:
639
638
  ## Dialog Components
640
639
 
641
640
  Both dialog components use Angular 21 patterns:
642
- - `ChangeDetectionStrategy.OnPush`
643
641
  - `input.required<T>()` for required inputs
644
642
  - `output<void>()` for events
645
643
  - `effect()` for reactive data loading
@@ -1127,7 +1125,6 @@ All components follow these patterns:
1127
1125
 
1128
1126
  | Pattern | Implementation |
1129
1127
  |---------|---------------|
1130
- | Change Detection | `ChangeDetectionStrategy.OnPush` |
1131
1128
  | Dependency Injection | `inject()` function |
1132
1129
  | State (private writable) | `private readonly _data = signal<T>(...)` |
1133
1130
  | State (public readonly) | `readonly data = this._data.asReadonly()` |
@@ -1286,6 +1283,7 @@ import {
1286
1283
  AUTH_USER_LIST_EXTENSION,
1287
1284
  AUTH_USER_DETAIL_CONFIG,
1288
1285
  AUTH_PROFILE_EXTENSION,
1286
+ AUTH_USER_FORM_EXTENSION,
1289
1287
  } from '@flusys/ng-auth';
1290
1288
  ```
1291
1289
 
@@ -1360,9 +1358,9 @@ Configure user detail view mode.
1360
1358
 
1361
1359
  ### AUTH_PROFILE_EXTENSION
1362
1360
 
1363
- Add extra fields and sections to profile page.
1361
+ Add extra fields that **users can edit** on their own profile page.
1364
1362
 
1365
- **IProfileExtraField:** `key`, `label`, `type` (text|number|select|checkbox|textarea|date|template), `placeholder?`, `editable?` (false=view-only), `required?`, `options?`, `pattern?`, `validationMessage?`, `order?`, `sectionKey?`, `template?`, `component?`, `injector?`
1363
+ **IProfileExtraField:** `key`, `label`, `type` (text|number|select|checkbox|textarea|date|template), `placeholder?`, `required?`, `options?`, `pattern?`, `validationMessage?`, `order?`, `sectionKey?`, `template?`, `component?`, `injector?`
1366
1364
 
1367
1365
  **IProfileExtraSection:** `key`, `title`, `icon?`, `order?`, `component?`, `template?`, `collapsible?`, `collapsed?`, `editPermission?`
1368
1366
 
@@ -1370,7 +1368,7 @@ Add extra fields and sections to profile page.
1370
1368
 
1371
1369
  | Method | Purpose |
1372
1370
  |--------|---------|
1373
- | `getExtraFields?()` | Return field definitions |
1371
+ | `getExtraFields?()` | Return field definitions (user-editable) |
1374
1372
  | `getExtraSections?()` | Return section definitions |
1375
1373
  | `getExtraFieldValues?(userId)` | Fetch values from custom API |
1376
1374
  | `saveExtraFieldValues?(userId, data)` | Save values to custom API |
@@ -1381,6 +1379,34 @@ Add extra fields and sections to profile page.
1381
1379
  // Custom component: inject(PROFILE_FIELD_CONTEXT) for field, value, updateValue()
1382
1380
  ```
1383
1381
 
1382
+ ### AUTH_USER_FORM_EXTENSION
1383
+
1384
+ Add extra fields that **admins can edit** on the user management form (`/administration/users/:id`).
1385
+ These fields appear as **view-only** on the user's profile page with "Managed by Admin" label.
1386
+
1387
+ **IUserFormExtraField:** `key`, `label`, `type` (text|number|select|checkbox|textarea|date|template), `placeholder?`, `required?`, `options?`, `pattern?`, `validationMessage?`, `order?`, `template?`, `component?`, `injector?`
1388
+
1389
+ **IUserFormExtensionProvider Methods:**
1390
+
1391
+ | Method | Purpose |
1392
+ |--------|---------|
1393
+ | `getExtraFields?()` | Return field definitions (admin-editable) |
1394
+ | `getExtraFieldValues?(userId)` | Fetch values from custom API |
1395
+ | `saveExtraFieldValues?(userId, data)` | Save values to custom API |
1396
+ | `validateExtraFields?(data)` | Custom validation, return error message or null |
1397
+
1398
+ ```typescript
1399
+ { provide: AUTH_USER_FORM_EXTENSION, useClass: MyUserFormExtension }
1400
+ // Custom component: inject(USER_FORM_FIELD_CONTEXT) for field, value, updateValue()
1401
+ ```
1402
+
1403
+ **Profile vs Admin Form Pattern:**
1404
+
1405
+ | Provider | Used In | Who Edits | Profile Display |
1406
+ |----------|---------|-----------|-----------------|
1407
+ | `AUTH_PROFILE_EXTENSION` | Profile page | User | Editable fields |
1408
+ | `AUTH_USER_FORM_EXTENSION` | Admin user form | Admin | View-only ("Managed by Admin") |
1409
+
1384
1410
  ### Provider Factory Example
1385
1411
 
1386
1412
  Combine all extensions in a single provider function for app.config.ts:
@@ -1392,7 +1418,8 @@ export function provideAuthExtensions(): Provider[] {
1392
1418
  { provide: AUTH_REGISTRATION_EXTENSION, useClass: MyRegistrationExtension },
1393
1419
  { provide: AUTH_USER_LIST_EXTENSION, useFactory: (r, m) => new MyUserListExtension(r, m), deps: [Router, MessageService] },
1394
1420
  { provide: AUTH_USER_DETAIL_CONFIG, useValue: { viewMode: 'dialog', allowEdit: true } },
1395
- { provide: AUTH_PROFILE_EXTENSION, useClass: MyProfileExtension },
1421
+ { provide: AUTH_PROFILE_EXTENSION, useClass: MyProfileExtension }, // User-editable fields
1422
+ { provide: AUTH_USER_FORM_EXTENSION, useClass: MyUserFormExtension }, // Admin-editable fields
1396
1423
  ];
1397
1424
  }
1398
1425
  // Usage: providers: [...provideAuthExtensions()]
@@ -1419,8 +1446,8 @@ When using extensions, registration data flows as:
1419
1446
 
1420
1447
  ---
1421
1448
 
1422
- **Last Updated:** 2026-02-25
1423
- **Version:** 3.0.0
1449
+ **Last Updated:** 2026-03-01
1450
+ **Version:** 3.0.1
1424
1451
  **Angular Version:** 21
1425
1452
 
1426
- All 15 components use `ChangeDetectionStrategy.OnPush`, responsive design, and dark mode support. Form components use Signal Forms.
1453
+ All 15 components use responsive design and dark mode support. Form components use Signal Forms.