@flusys/ng-shared 1.1.1-beta → 2.0.0-rc.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/README.md CHANGED
@@ -178,7 +178,7 @@ FILE_TYPE_FILTERS.ALL // [] (allows all)
178
178
  getAcceptString(['image/*']) // 'image/*'
179
179
  isFileTypeAllowed(file, ['image/*']) // true/false
180
180
  getFileIconClass('image/png') // 'pi pi-image'
181
- formatFileSize('1024') // '1 KB'
181
+ formatFileSize(1024) // '1 KB'
182
182
  ```
183
183
 
184
184
  ### Response Interfaces
@@ -517,7 +517,7 @@ Flexible icon renderer supporting PrimeNG icons, image files, and SVG.
517
517
  <!-- Image file -->
518
518
  <lib-icon icon="/assets/logo.png" [iconType]="IconTypeEnum.IMAGE_FILE_LINK" />
519
519
 
520
- <!-- SVG tag -->
520
+ <!-- SVG tag (shows fallback icon - full SVG rendering coming soon) -->
521
521
  <lib-icon icon="<svg>...</svg>" [iconType]="IconTypeEnum.DIRECT_TAG_SVG" />
522
522
  ```
523
523
 
@@ -1098,6 +1098,101 @@ interface IProfilePermissionProvider {
1098
1098
  }
1099
1099
  ```
1100
1100
 
1101
+ #### IAuthStateProvider / `AUTH_STATE_PROVIDER`
1102
+
1103
+ Auth state access for feature packages (form-builder, etc.) that need to check authentication without depending on ng-auth directly.
1104
+
1105
+ ```typescript
1106
+ interface IAuthStateProvider {
1107
+ /** Signal indicating if user is currently authenticated */
1108
+ isAuthenticated: Signal<boolean>;
1109
+
1110
+ /** Initialize auth state (restore session from cookies/storage) */
1111
+ initialize(): Observable<void>;
1112
+ }
1113
+ ```
1114
+
1115
+ **Usage:**
1116
+
1117
+ ```typescript
1118
+ import { AUTH_STATE_PROVIDER } from '@flusys/ng-shared';
1119
+
1120
+ @Component({...})
1121
+ export class PublicFormComponent {
1122
+ private readonly authState = inject(AUTH_STATE_PROVIDER);
1123
+
1124
+ ngOnInit() {
1125
+ this.authState.initialize().subscribe(() => {
1126
+ if (this.authState.isAuthenticated()) {
1127
+ // User is logged in
1128
+ }
1129
+ });
1130
+ }
1131
+ }
1132
+ ```
1133
+
1134
+ #### IUserListProvider / `USER_LIST_PROVIDER`
1135
+
1136
+ Extends user list pages with extra columns, actions, and data enrichment. Optional provider.
1137
+
1138
+ ```typescript
1139
+ interface IUserListItem {
1140
+ id: string;
1141
+ name: string;
1142
+ email: string;
1143
+ phone?: string;
1144
+ isActive?: boolean;
1145
+ [key: string]: unknown;
1146
+ }
1147
+
1148
+ interface IUserListAction<T = IUserListItem> {
1149
+ id: string;
1150
+ label: string;
1151
+ icon?: string;
1152
+ severity?: 'primary' | 'secondary' | 'success' | 'info' | 'warn' | 'danger';
1153
+ permission?: string;
1154
+ tooltip?: string;
1155
+ disabled?: boolean | ((user: T) => boolean);
1156
+ visible?: boolean | ((user: T) => boolean);
1157
+ }
1158
+
1159
+ interface IUserListColumn {
1160
+ field: string;
1161
+ header: string;
1162
+ width?: string;
1163
+ sortable?: boolean;
1164
+ templateType?: 'text' | 'badge' | 'date' | 'boolean' | 'custom';
1165
+ }
1166
+
1167
+ interface IUserListProvider<T extends IUserListItem = IUserListItem> {
1168
+ getExtraColumns?(): IUserListColumn[];
1169
+ getExtraRowActions?(): IUserListAction<T>[];
1170
+ getExtraToolbarActions?(): IUserListAction<T>[];
1171
+ onRowAction?(actionId: string, user: T): void;
1172
+ onToolbarAction?(actionId: string, selectedUsers: T[]): void;
1173
+ enrichListData?(users: T[]): Observable<T[]>;
1174
+ }
1175
+ ```
1176
+
1177
+ **Usage:**
1178
+
1179
+ ```typescript
1180
+ // In app.config.ts
1181
+ providers: [
1182
+ { provide: USER_LIST_PROVIDER, useClass: MyUserListProvider },
1183
+ ]
1184
+
1185
+ // Implementation
1186
+ @Injectable({ providedIn: 'root' })
1187
+ export class MyUserListProvider implements IUserListProvider {
1188
+ getExtraRowActions() {
1189
+ return [
1190
+ { id: 'assign-role', label: 'Assign Role', icon: 'pi pi-users' },
1191
+ ];
1192
+ }
1193
+ }
1194
+ ```
1195
+
1101
1196
  ### Usage in Consuming Packages
1102
1197
 
1103
1198
  ```typescript
@@ -1269,6 +1364,11 @@ export const appConfig: ApplicationConfig = {
1269
1364
  | `IFileSelectFilter` | File select filter params |
1270
1365
  | `LoadFilesFn` | File loading function type |
1271
1366
  | `UploadFileFn` | File upload function type |
1367
+ | `IAuthStateProvider`| Auth state provider interface |
1368
+ | `IUserListProvider` | User list extensions provider |
1369
+ | `IUserListItem` | Base user for list operations |
1370
+ | `IUserListAction` | User list action definition |
1371
+ | `IUserListColumn` | Extra column for user list |
1272
1372
 
1273
1373
  ### Injection Tokens
1274
1374
 
@@ -1279,6 +1379,8 @@ export const appConfig: ApplicationConfig = {
1279
1379
  | `USER_PERMISSION_PROVIDER` | `IUserPermissionProvider` | User permission queries |
1280
1380
  | `PROFILE_UPLOAD_PROVIDER` | `IProfileUploadProvider` | Profile picture upload (ng-storage) |
1281
1381
  | `PROFILE_PERMISSION_PROVIDER` | `IProfilePermissionProvider` | User permissions for profile (ng-iam) |
1382
+ | `AUTH_STATE_PROVIDER` | `IAuthStateProvider` | Auth state for feature packages |
1383
+ | `USER_LIST_PROVIDER` | `IUserListProvider` | User list extensions (optional) |
1282
1384
 
1283
1385
  ## See Also
1284
1386
 
@@ -1289,5 +1391,5 @@ export const appConfig: ApplicationConfig = {
1289
1391
 
1290
1392
  ---
1291
1393
 
1292
- **Last Updated:** 2026-02-16
1394
+ **Last Updated:** 2026-02-21
1293
1395
  **Angular Version:** 21