@flusys/ng-shared 1.0.0-beta → 1.1.1-beta

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/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@flusys/ng-shared",
3
- "version": "1.0.0-beta",
3
+ "version": "1.1.1-beta",
4
4
  "description": "Shared components and utilities for FLUSYS Angular packages",
5
5
  "license": "MIT",
6
6
  "peerDependencies": {
7
7
  "@angular/common": "^21.0.0",
8
8
  "@angular/core": "^21.0.0",
9
9
  "@angular/forms": "^21.0.0",
10
- "@flusys/ng-core": "^1.0.0-beta",
10
+ "@flusys/ng-core": "^1.1.1-beta",
11
11
  "@primeuix/themes": "^1.0.0",
12
12
  "primeicons": "^7.0.0",
13
13
  "primeng": "^21.0.0"
@@ -6,40 +6,44 @@ import * as i2 from '@angular/forms';
6
6
  import { ControlValueAccessor } from '@angular/forms';
7
7
  import * as i3 from '@angular/router';
8
8
  import { CanActivateFn } from '@angular/router';
9
- import * as i1$1 from 'primeng/inputtext';
10
- import * as i2$1 from 'primeng/tag';
11
- import * as i3$1 from 'primeng/selectbutton';
12
- import * as i4 from 'primeng/password';
13
- import * as i5 from 'primeng/button';
14
- import * as i6 from 'primeng/tooltip';
15
- import * as i7 from 'primeng/checkbox';
9
+ import * as i1$1 from 'primeng/autocomplete';
10
+ import * as i2$1 from 'primeng/avatar';
11
+ import * as i3$1 from 'primeng/button';
12
+ import * as i4 from 'primeng/card';
13
+ import * as i5 from 'primeng/checkbox';
16
14
  import { CheckboxChangeEvent } from 'primeng/checkbox';
17
- import * as i8 from 'primeng/steps';
18
- import * as i9 from 'primeng/ripple';
19
- import * as i10 from 'primeng/panel';
20
- import * as i11 from 'primeng/paginator';
21
- import * as i12 from 'primeng/table';
22
- import * as i13 from 'primeng/inputnumber';
23
- import * as i14 from 'primeng/textarea';
24
- import * as i15 from 'primeng/progressbar';
25
- import * as i16 from 'primeng/fileupload';
26
- import * as i17 from 'primeng/card';
27
- import * as i18 from 'primeng/select';
28
- import * as i19 from 'primeng/inputicon';
29
- import * as i20 from 'primeng/iconfield';
15
+ import * as i6 from 'primeng/confirmdialog';
16
+ import * as i7 from 'primeng/datepicker';
17
+ import * as i8 from 'primeng/dialog';
18
+ import * as i9 from 'primeng/divider';
19
+ import * as i10 from 'primeng/fileupload';
20
+ import * as i11 from 'primeng/iconfield';
21
+ import * as i12 from 'primeng/image';
22
+ import * as i13 from 'primeng/inputicon';
23
+ import * as i14 from 'primeng/inputnumber';
24
+ import * as i15 from 'primeng/inputtext';
25
+ import * as i16 from 'primeng/listbox';
26
+ import * as i17 from 'primeng/multiselect';
27
+ import * as i18 from 'primeng/paginator';
28
+ import * as i19 from 'primeng/panel';
29
+ import * as i20 from 'primeng/password';
30
30
  import * as i21 from 'primeng/popover';
31
- import * as i22 from 'primeng/listbox';
31
+ import * as i22 from 'primeng/progressbar';
32
32
  import * as i23 from 'primeng/radiobutton';
33
- import * as i24 from 'primeng/toggleswitch';
34
- import * as i25 from 'primeng/image';
35
- import * as i26 from 'primeng/datepicker';
36
- import * as i27 from 'primeng/splitbutton';
37
- import * as i28 from 'primeng/divider';
38
- import * as i29 from 'primeng/multiselect';
39
- import * as i30 from 'primeng/autocomplete';
33
+ import * as i24 from 'primeng/ripple';
34
+ import * as i25 from 'primeng/selectbutton';
35
+ import * as i26 from 'primeng/select';
36
+ import * as i27 from 'primeng/skeleton';
37
+ import * as i28 from 'primeng/splitbutton';
38
+ import * as i29 from 'primeng/steps';
39
+ import * as i30 from 'primeng/table';
40
40
  import * as i31 from 'primeng/tabs';
41
- import * as i32 from 'primeng/dialog';
42
- import * as i33 from 'primeng/treetable';
41
+ import * as i32 from 'primeng/tag';
42
+ import * as i33 from 'primeng/textarea';
43
+ import * as i34 from 'primeng/toast';
44
+ import * as i35 from 'primeng/toggleswitch';
45
+ import * as i36 from 'primeng/tooltip';
46
+ import * as i37 from 'primeng/treetable';
43
47
  import * as _flusys_ng_shared from '@flusys/ng-shared';
44
48
  import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
45
49
  import { ApiLoaderService } from '@flusys/ng-core';
@@ -457,6 +461,7 @@ interface IFileUploadOptions {
457
461
  * Uploaded file response
458
462
  */
459
463
  interface IUploadedFile {
464
+ id?: string;
460
465
  name: string;
461
466
  key: string;
462
467
  size: number;
@@ -512,6 +517,249 @@ declare function getFileIconClass(contentType: string): string;
512
517
  */
513
518
  declare function formatFileSize(sizeInKb: string | number): string;
514
519
 
520
+ /**
521
+ * User role info for profile display
522
+ */
523
+ interface IProfileRoleInfo {
524
+ id: string;
525
+ name: string;
526
+ description?: string | null;
527
+ }
528
+ /**
529
+ * User action info for profile display
530
+ */
531
+ interface IProfileActionInfo {
532
+ id: string;
533
+ name: string;
534
+ code: string;
535
+ description?: string | null;
536
+ }
537
+ /**
538
+ * Profile Permission Provider Interface
539
+ *
540
+ * Abstracts permission data access for profile page.
541
+ * Implemented by ng-iam, consumed by ng-auth profile page.
542
+ * Optional injection - if not provided, permissions section is hidden.
543
+ *
544
+ * @example
545
+ * // In profile component
546
+ * private readonly permissionProvider = inject(PROFILE_PERMISSION_PROVIDER, { optional: true });
547
+ *
548
+ * ngOnInit() {
549
+ * if (this.permissionProvider) {
550
+ * this.loadPermissions();
551
+ * }
552
+ * }
553
+ */
554
+ interface IProfilePermissionProvider {
555
+ /**
556
+ * Get user's assigned roles
557
+ * @param userId User ID
558
+ * @param branchId Optional branch ID for branch-scoped roles
559
+ */
560
+ getUserRoles(userId: string, branchId?: string): Observable<ISingleResponse<IProfileRoleInfo[]>>;
561
+ /**
562
+ * Get user's direct actions
563
+ * @param userId User ID
564
+ * @param branchId Optional branch ID for branch-scoped actions
565
+ */
566
+ getUserActions(userId: string, branchId?: string): Observable<ISingleResponse<IProfileActionInfo[]>>;
567
+ }
568
+
569
+ /**
570
+ * Uploaded file result with file manager ID
571
+ */
572
+ interface IProfileUploadResult {
573
+ /** File manager ID (UUID) for storing in profilePictureId */
574
+ id: string;
575
+ /** Original file name */
576
+ name: string;
577
+ /** Storage key/path */
578
+ key: string;
579
+ /** File size in bytes */
580
+ size: number;
581
+ /** MIME type */
582
+ contentType: string;
583
+ }
584
+ /**
585
+ * Profile Upload Options
586
+ */
587
+ interface IProfileUploadOptions {
588
+ /** Folder path for organizing uploads */
589
+ folderPath?: string;
590
+ /** Enable image compression */
591
+ compress?: boolean;
592
+ /** Max width for image compression */
593
+ maxWidth?: number;
594
+ /** Max height for image compression */
595
+ maxHeight?: number;
596
+ }
597
+ /**
598
+ * Profile Upload Provider Interface
599
+ *
600
+ * Provides file upload functionality for profile pictures.
601
+ * Implemented by ng-storage, consumed by ng-auth profile page.
602
+ *
603
+ * This interface enables ng-auth to use storage functionality
604
+ * without directly depending on ng-storage package.
605
+ */
606
+ interface IProfileUploadProvider {
607
+ /**
608
+ * Upload profile picture and register in file manager
609
+ * Returns file manager ID (UUID) for storing in user.profilePictureId
610
+ *
611
+ * @param file - File to upload
612
+ * @param options - Upload options (compression, folder, etc.)
613
+ * @returns Observable with upload result including file manager ID
614
+ */
615
+ uploadProfilePicture(file: File, options?: IProfileUploadOptions): Observable<ISingleResponse<IProfileUploadResult>>;
616
+ }
617
+
618
+ /**
619
+ * Base user interface for list operations
620
+ * Extends this with app-specific user fields
621
+ */
622
+ interface IUserListItem {
623
+ id: string;
624
+ name: string;
625
+ email: string;
626
+ phone?: string;
627
+ isActive?: boolean;
628
+ [key: string]: unknown;
629
+ }
630
+ /**
631
+ * User list action definition
632
+ * @template T User type, defaults to IUserListItem
633
+ */
634
+ interface IUserListAction<T = IUserListItem> {
635
+ /** Unique action identifier */
636
+ id: string;
637
+ /** Display label */
638
+ label: string;
639
+ /** PrimeNG icon class (e.g., 'pi pi-pencil') */
640
+ icon?: string;
641
+ /** Severity for styling (e.g., 'primary', 'danger', 'warning') */
642
+ severity?: 'primary' | 'secondary' | 'success' | 'info' | 'warn' | 'danger' | 'help' | 'contrast';
643
+ /** Permission code required (checked via hasPermission) */
644
+ permission?: string;
645
+ /** Tooltip text */
646
+ tooltip?: string;
647
+ /** Whether action is disabled */
648
+ disabled?: boolean | ((user: T) => boolean);
649
+ /** Whether action is visible */
650
+ visible?: boolean | ((user: T) => boolean);
651
+ }
652
+ /**
653
+ * Extra column definition for user list
654
+ */
655
+ interface IUserListColumn {
656
+ /** Column field name */
657
+ field: string;
658
+ /** Column header label */
659
+ header: string;
660
+ /** Column width */
661
+ width?: string;
662
+ /** Whether column is sortable */
663
+ sortable?: boolean;
664
+ /** Whether column is filterable */
665
+ filterable?: boolean;
666
+ /** Custom template type for rendering */
667
+ templateType?: 'text' | 'badge' | 'date' | 'boolean' | 'custom';
668
+ }
669
+ /**
670
+ * User List Provider Interface
671
+ *
672
+ * Allows consuming applications to extend user list pages with:
673
+ * - Extra columns
674
+ * - Extra row actions
675
+ * - Extra toolbar actions
676
+ * - Custom data enrichment
677
+ *
678
+ * This follows the Provider Interface Pattern:
679
+ * - ng-shared defines the interface (this file)
680
+ * - Consuming apps (via ng-iam or app-specific) implement the interface
681
+ * - ng-auth user list optionally injects and uses the implementation
682
+ *
683
+ * @template T User type, defaults to IUserListItem
684
+ *
685
+ * @example
686
+ * // In app.config.ts
687
+ * providers: [
688
+ * { provide: USER_LIST_PROVIDER, useClass: MyUserListProvider },
689
+ * ]
690
+ *
691
+ * // Implementation
692
+ * @Injectable({ providedIn: 'root' })
693
+ * export class MyUserListProvider implements IUserListProvider {
694
+ * getExtraRowActions() {
695
+ * return [
696
+ * { id: 'assign-role', label: 'Assign Role', icon: 'pi pi-users' },
697
+ * ];
698
+ * }
699
+ * }
700
+ */
701
+ interface IUserListProvider<T extends IUserListItem = IUserListItem> {
702
+ /**
703
+ * Get extra columns to display in user list
704
+ * @returns Array of extra column definitions
705
+ */
706
+ getExtraColumns?(): IUserListColumn[];
707
+ /**
708
+ * Get extra row-level actions (per-user actions)
709
+ * Displayed in actions column for each row
710
+ * @returns Array of action definitions
711
+ */
712
+ getExtraRowActions?(): IUserListAction<T>[];
713
+ /**
714
+ * Get extra toolbar actions
715
+ * Displayed in toolbar above the list
716
+ * @returns Array of action definitions
717
+ */
718
+ getExtraToolbarActions?(): IUserListAction<T>[];
719
+ /**
720
+ * Handle row action click
721
+ * @param actionId Action identifier
722
+ * @param user User data from the row
723
+ */
724
+ onRowAction?(actionId: string, user: T): void;
725
+ /**
726
+ * Handle toolbar action click
727
+ * @param actionId Action identifier
728
+ * @param selectedUsers Currently selected users (for bulk actions)
729
+ */
730
+ onToolbarAction?(actionId: string, selectedUsers: T[]): void;
731
+ /**
732
+ * Enrich user list data with extra fields
733
+ * Called after data is loaded from API
734
+ * @param users List of users from API
735
+ * @returns Observable of enriched users
736
+ */
737
+ enrichListData?(users: T[]): Observable<T[]>;
738
+ /**
739
+ * Get extra filters for user list
740
+ * @returns Array of filter definitions
741
+ */
742
+ getExtraFilters?(): IUserListFilter[];
743
+ }
744
+ /**
745
+ * Extra filter definition for user list
746
+ */
747
+ interface IUserListFilter {
748
+ /** Filter field name */
749
+ field: string;
750
+ /** Filter label */
751
+ label: string;
752
+ /** Filter type */
753
+ type: 'text' | 'dropdown' | 'multiselect' | 'date' | 'boolean';
754
+ /** Options for dropdown/multiselect */
755
+ options?: {
756
+ label: string;
757
+ value: string | number | boolean;
758
+ }[];
759
+ /** Placeholder text */
760
+ placeholder?: string;
761
+ }
762
+
515
763
  declare enum ContactTypeEnum {
516
764
  PHONE = 1,
517
765
  EMAIL = 2
@@ -570,14 +818,16 @@ declare class FileUrlService {
570
818
  fileUrlSignal(fileId: string | null | undefined): _angular_core.Signal<string | null>;
571
819
  /**
572
820
  * Fetch file URLs from backend and update cache.
573
- * Returns Observable of fetched files.
821
+ * Skips IDs already in cache to prevent duplicate calls.
822
+ * Returns Observable of fetched files (including cached ones).
574
823
  */
575
- fetchFileUrls(fileIds: string[]): Observable<FilesResponseDto[]>;
824
+ fetchFileUrls(fileIds: string[], forceRefresh?: boolean): Observable<FilesResponseDto[]>;
576
825
  /**
577
826
  * Fetch a single file URL.
827
+ * Uses cache if available to prevent duplicate calls.
578
828
  * Returns Observable of file info or null if not found.
579
829
  */
580
- fetchSingleFileUrl(fileId: string): Observable<FilesResponseDto | null>;
830
+ fetchSingleFileUrl(fileId: string, forceRefresh?: boolean): Observable<FilesResponseDto | null>;
581
831
  /**
582
832
  * Clear the URL cache.
583
833
  * Useful on logout or when switching contexts.
@@ -784,7 +1034,7 @@ declare class AngularModule {
784
1034
 
785
1035
  declare class PrimeModule {
786
1036
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<PrimeModule, never>;
787
- static ɵmod: _angular_core.ɵɵNgModuleDeclaration<PrimeModule, never, never, [typeof i1$1.InputTextModule, typeof i2$1.TagModule, typeof i3$1.SelectButtonModule, typeof i4.PasswordModule, typeof i5.ButtonModule, typeof i6.TooltipModule, typeof i7.CheckboxModule, typeof i8.StepsModule, typeof i9.RippleModule, typeof i10.PanelModule, typeof i11.PaginatorModule, typeof i12.TableModule, typeof i13.InputNumberModule, typeof i14.TextareaModule, typeof i15.ProgressBarModule, typeof i16.FileUploadModule, typeof i17.CardModule, typeof i18.SelectModule, typeof i19.InputIconModule, typeof i20.IconFieldModule, typeof i21.PopoverModule, typeof i22.ListboxModule, typeof i23.RadioButtonModule, typeof i24.ToggleSwitchModule, typeof i25.ImageModule, typeof i26.DatePickerModule, typeof i27.SplitButtonModule, typeof i28.DividerModule, typeof i29.MultiSelectModule, typeof i30.AutoCompleteModule, typeof i31.TabsModule, typeof i32.DialogModule, typeof i33.TreeTableModule]>;
1037
+ static ɵmod: _angular_core.ɵɵNgModuleDeclaration<PrimeModule, never, never, [typeof i1$1.AutoCompleteModule, typeof i2$1.AvatarModule, typeof i3$1.ButtonModule, typeof i4.CardModule, typeof i5.CheckboxModule, typeof i6.ConfirmDialogModule, typeof i7.DatePickerModule, typeof i8.DialogModule, typeof i9.DividerModule, typeof i10.FileUploadModule, typeof i11.IconFieldModule, typeof i12.ImageModule, typeof i13.InputIconModule, typeof i14.InputNumberModule, typeof i15.InputTextModule, typeof i16.ListboxModule, typeof i17.MultiSelectModule, typeof i18.PaginatorModule, typeof i19.PanelModule, typeof i20.PasswordModule, typeof i21.PopoverModule, typeof i22.ProgressBarModule, typeof i23.RadioButtonModule, typeof i24.RippleModule, typeof i25.SelectButtonModule, typeof i26.SelectModule, typeof i27.SkeletonModule, typeof i28.SplitButtonModule, typeof i29.StepsModule, typeof i30.TableModule, typeof i31.TabsModule, typeof i32.TagModule, typeof i33.TextareaModule, typeof i34.ToastModule, typeof i35.ToggleSwitchModule, typeof i36.TooltipModule, typeof i37.TreeTableModule]>;
788
1038
  static ɵinj: _angular_core.ɵɵInjectorDeclaration<PrimeModule>;
789
1039
  }
790
1040
 
@@ -1457,6 +1707,36 @@ declare const USER_PERMISSION_PROVIDER: InjectionToken<IUserPermissionProvider>;
1457
1707
  * Provides auth state access for feature packages (form-builder, etc.)
1458
1708
  */
1459
1709
  declare const AUTH_STATE_PROVIDER: InjectionToken<IAuthStateProvider>;
1710
+ /**
1711
+ * Profile Permission Provider Token
1712
+ *
1713
+ * Provides user permission data for profile display.
1714
+ * Optional - if not configured, profile permissions section is hidden.
1715
+ * Use with `inject(PROFILE_PERMISSION_PROVIDER, { optional: true })`.
1716
+ */
1717
+ declare const PROFILE_PERMISSION_PROVIDER: InjectionToken<IProfilePermissionProvider>;
1718
+ /**
1719
+ * Profile Upload Provider Token
1720
+ *
1721
+ * Provides file upload functionality for profile pictures.
1722
+ * Optional - if not configured or storage not enabled, upload section is hidden.
1723
+ * Use with `inject(PROFILE_UPLOAD_PROVIDER, { optional: true })`.
1724
+ */
1725
+ declare const PROFILE_UPLOAD_PROVIDER: InjectionToken<IProfileUploadProvider>;
1726
+ /**
1727
+ * User List Provider Token
1728
+ *
1729
+ * Provides extra actions, columns, and data enrichment for user list.
1730
+ * Optional - if not configured, default user list behavior is used.
1731
+ * Use with `inject(USER_LIST_PROVIDER, { optional: true })`.
1732
+ *
1733
+ * @example
1734
+ * // In app.config.ts
1735
+ * providers: [
1736
+ * { provide: USER_LIST_PROVIDER, useClass: MyUserListProvider },
1737
+ * ]
1738
+ */
1739
+ declare const USER_LIST_PROVIDER: InjectionToken<IUserListProvider<IUserListItem>>;
1460
1740
 
1461
1741
  /**
1462
1742
  * Permission Guard
@@ -1525,5 +1805,5 @@ declare function hasAnyPermission(permissionCodes: string[], permissions: string
1525
1805
  /** Check if user has ALL of the specified permissions (AND logic) */
1526
1806
  declare function hasAllPermissions(permissionCodes: string[], permissions: string[]): boolean;
1527
1807
 
1528
- export { AUTH_STATE_PROVIDER, AngularModule, ApiResourceService, ApiResourceService as ApiService, COMPANY_API_PROVIDER, ContactTypeEnum, CookieService, EditModeElementChangerDirective, FILE_TYPE_FILTERS, FileSelectorDialogComponent, FileUploaderComponent, FileUrlService, HasPermissionDirective, IconComponent, IconTypeEnum, IsEmptyImageDirective, LazyMultiSelectComponent, LazySelectComponent, PermissionValidatorService, PlatformService, PreventDefaultDirective, PrimeModule, USER_PERMISSION_PROVIDER, USER_PROVIDER, UserMultiSelectComponent, UserSelectComponent, allPermissionsGuard, anyPermissionGuard, evaluateLogicNode, evaluatePermission, formatFileSize, getAcceptString, getFileIconClass, hasAllPermissions, hasAnyPermission, isFileTypeAllowed, permissionGuard };
1529
- export type { ApiResponse, DeleteType, FilesResponseDto, GetFileUrlsFn, GetFilesRequestDto, IActionNode, IActivatable, IApiService, IAuthStateProvider, IBaseEntity, IBulkMeta, IBulkResponse, ICompanyApiProvider, ICompanyBasicInfo, IDeleteData, IDropDown, IErrorResponse, IFileBasicInfo, IFileData, IFileSelectFilter, IFileUploadOptions, IFilter, IFilterData, IGroupNode, IListResponse, ILoggedUserInfo, ILogicNode, ILoginResponse, ILoginUserData, IMessageResponse, IMetadata, IOrderable, IPagination, IPaginationMeta, IRefreshTokenResponse, IRequestMeta, ISingleResponse, ISoftDeletable, ISort, ITimestampable, IUploadedFile, IUserBasicInfo, IUserBranchPayload, IUserCompanyPayload, IUserPermissionProvider, IUserProvider, IUserSelectFilter, IValidationError, LoadFilesFn, LoadUsersFn, UploadFileFn };
1808
+ export { AUTH_STATE_PROVIDER, AngularModule, ApiResourceService, ApiResourceService as ApiService, COMPANY_API_PROVIDER, ContactTypeEnum, CookieService, EditModeElementChangerDirective, FILE_TYPE_FILTERS, FileSelectorDialogComponent, FileUploaderComponent, FileUrlService, HasPermissionDirective, IconComponent, IconTypeEnum, IsEmptyImageDirective, LazyMultiSelectComponent, LazySelectComponent, PROFILE_PERMISSION_PROVIDER, PROFILE_UPLOAD_PROVIDER, PermissionValidatorService, PlatformService, PreventDefaultDirective, PrimeModule, USER_LIST_PROVIDER, USER_PERMISSION_PROVIDER, USER_PROVIDER, UserMultiSelectComponent, UserSelectComponent, allPermissionsGuard, anyPermissionGuard, evaluateLogicNode, evaluatePermission, formatFileSize, getAcceptString, getFileIconClass, hasAllPermissions, hasAnyPermission, isFileTypeAllowed, permissionGuard };
1809
+ export type { ApiResponse, DeleteType, FilesResponseDto, GetFileUrlsFn, GetFilesRequestDto, IActionNode, IActivatable, IApiService, IAuthStateProvider, IBaseEntity, IBulkMeta, IBulkResponse, ICompanyApiProvider, ICompanyBasicInfo, IDeleteData, IDropDown, IErrorResponse, IFileBasicInfo, IFileData, IFileSelectFilter, IFileUploadOptions, IFilter, IFilterData, IGroupNode, IListResponse, ILoggedUserInfo, ILogicNode, ILoginResponse, ILoginUserData, IMessageResponse, IMetadata, IOrderable, IPagination, IPaginationMeta, IProfileActionInfo, IProfilePermissionProvider, IProfileRoleInfo, IProfileUploadOptions, IProfileUploadProvider, IProfileUploadResult, IRefreshTokenResponse, IRequestMeta, ISingleResponse, ISoftDeletable, ISort, ITimestampable, IUploadedFile, IUserBasicInfo, IUserBranchPayload, IUserCompanyPayload, IUserListAction, IUserListColumn, IUserListFilter, IUserListItem, IUserListProvider, IUserPermissionProvider, IUserProvider, IUserSelectFilter, IValidationError, LoadFilesFn, LoadUsersFn, UploadFileFn };