@flusys/ng-shared 8.1.5 → 9.1.0-rc.1

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,15 +1,16 @@
1
1
  {
2
2
  "name": "@flusys/ng-shared",
3
- "version": "8.1.5",
3
+ "version": "9.1.0-rc.1",
4
4
  "description": "Shared components and utilities for FLUSYS Angular packages",
5
5
  "license": "MIT",
6
6
  "peerDependencies": {
7
7
  "@angular/common": ">=22.0.0",
8
8
  "@angular/core": ">=22.0.0",
9
9
  "@angular/forms": ">=22.0.0",
10
+ "@angular/platform-browser": ">=22.0.0",
10
11
  "@angular/router": ">=22.0.0",
11
- "@flusys/ng-core": ">=8.1.5",
12
- "@flusys/ng-ui": ">=8.1.5",
12
+ "@flusys/ng-core": ">=9.1.0-rc.1",
13
+ "@flusys/ng-ui": ">=9.1.0-rc.1",
13
14
  "rxjs": "^7.8.0"
14
15
  },
15
16
  "sideEffects": false,
@@ -8,8 +8,8 @@ import * as _flusys_ng_shared from '@flusys/ng-shared';
8
8
  import { ServiceName } from '@flusys/ng-core';
9
9
  import { ControlValueAccessor } from '@angular/forms';
10
10
  import { FormValueControl } from '@angular/forms/signals';
11
+ import { TreeNode, CheckboxChangeEvent } from '@flusys/ng-ui';
11
12
  import * as _angular_platform_browser from '@angular/platform-browser';
12
- import { CheckboxChangeEvent } from '@flusys/ng-ui';
13
13
 
14
14
  declare const SHARED_MESSAGES: Record<string, string>;
15
15
 
@@ -111,6 +111,27 @@ declare const FORM_RESULT_PERMISSIONS: {
111
111
  readonly UPDATE: "form-result.update";
112
112
  readonly DELETE: "form-result.delete";
113
113
  };
114
+ declare const ENTITY_DEFINITION_PERMISSIONS: {
115
+ readonly CREATE: "entity_builder.entity_definition.create";
116
+ readonly READ: "entity_builder.entity_definition.read";
117
+ readonly UPDATE: "entity_builder.entity_definition.update";
118
+ readonly DELETE: "entity_builder.entity_definition.delete";
119
+ };
120
+ declare const FIELD_DEFINITION_PERMISSIONS: {
121
+ readonly READ: "entity_builder.field_definition.read";
122
+ readonly UPDATE: "entity_builder.field_definition.update";
123
+ };
124
+ declare const FLOW_DEFINITION_PERMISSIONS: {
125
+ readonly CREATE: "entity_builder.flow_definition.create";
126
+ readonly READ: "entity_builder.flow_definition.read";
127
+ readonly UPDATE: "entity_builder.flow_definition.update";
128
+ readonly DELETE: "entity_builder.flow_definition.delete";
129
+ readonly TEST: "entity_builder.flow_definition.test";
130
+ /** Needed to save a flow that runs as the system (bypassing per-entity permissions). */
131
+ readonly SYSTEM: "entity_builder.flow_definition.system";
132
+ /** Needed to save a flow containing a code node (sandboxed JavaScript). */
133
+ readonly CODE: "entity_builder.flow_definition.code";
134
+ };
114
135
  declare const EVENT_PERMISSIONS: {
115
136
  readonly CREATE: "event.create";
116
137
  readonly READ: "event.read";
@@ -505,6 +526,12 @@ interface IFilterData {
505
526
  extraKey?: string[];
506
527
  }
507
528
 
529
+ /** A translatable message from the backend: `messageKey` is looked up and `{{name}}` is filled from `messageVariables`, which may themselves be message references. */
530
+ interface IMessageRef {
531
+ messageKey: string;
532
+ messageVariables?: Record<string, unknown>;
533
+ }
534
+
508
535
  /**
509
536
  * Auth State Provider Interface
510
537
  *
@@ -620,6 +647,25 @@ interface IProfilePermissionProvider {
620
647
  getUserRoles(userId: string, branchId?: string): Observable<ISingleResponse<IProfileRoleInfo[]>>;
621
648
  getUserActions(userId: string, branchId?: string): Observable<ISingleResponse<IProfileActionInfo[]>>;
622
649
  }
650
+ /** A permission action (IAM action code) for pickers */
651
+ interface IActionBasicInfo {
652
+ id: string;
653
+ name: string;
654
+ /** Null for a grouping action that only nests others. */
655
+ code: string | null;
656
+ description?: string | null;
657
+ parentId?: string | null;
658
+ serial?: number | null;
659
+ }
660
+ /**
661
+ * Action Provider Interface - Lists the permission actions a feature package can require,
662
+ * without depending on ng-iam directly.
663
+ */
664
+ interface IActionProvider {
665
+ getActions(): Observable<ISingleResponse<IActionBasicInfo[]>>;
666
+ /** False when the backing service is switched off, so pickers fall back to typing codes. Defaults to available. */
667
+ isAvailable?(): boolean;
668
+ }
623
669
  /**
624
670
  * File Provider Interface - Provides file loading and upload functionality.
625
671
  * Used by FileSelectorDialogComponent to load files and handle uploads.
@@ -721,7 +767,9 @@ declare class TranslateService {
721
767
  private readonly localizationState;
722
768
  private readonly registry;
723
769
  translate(key: string, params?: Record<string, string | unknown>): string;
770
+ translateRef(ref: IMessageRef): string;
724
771
  translateSignal(key: string, params?: Record<string, string | number>): Signal<string>;
772
+ private isMessageRef;
725
773
  private interpolate;
726
774
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TranslateService, never>;
727
775
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<TranslateService>;
@@ -837,7 +885,7 @@ declare class PreventDefaultDirective {
837
885
 
838
886
  declare class TranslatePipe implements PipeTransform {
839
887
  private readonly translateAdapter;
840
- transform(key: string | null | undefined, params?: Record<string, string | number> | null, fallback?: string): string;
888
+ transform(key: string | IMessageRef | null | undefined, params?: Record<string, string | number> | null, fallback?: string): string;
841
889
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TranslatePipe, never>;
842
890
  static ɵpipe: _angular_core.ɵɵPipeDeclaration<TranslatePipe, "translate", true>;
843
891
  }
@@ -854,6 +902,11 @@ declare class TranslatePipe implements PipeTransform {
854
902
  * ```
855
903
  */
856
904
  declare const SKIP_ERROR_TOAST: HttpContextToken<boolean>;
905
+ /**
906
+ * Whether errorCatchingInterceptor already showed this failure as a toast, so a caller's own
907
+ * catch block adds one only for failures the user has not been told about yet.
908
+ */
909
+ declare function isErrorToastShown(error: unknown): boolean;
857
910
  /**
858
911
  * Error Catching Interceptor
859
912
  * Displays error messages for failed HTTP requests using backend response.
@@ -928,7 +981,7 @@ declare abstract class ApiResourceService<DtoT, InterfaceT> implements IApiServi
928
981
  nextPage(): void;
929
982
  resetPagination(): void;
930
983
  reload(): void;
931
- private _post;
984
+ protected post<R>(endpoint: string, body: unknown, params?: HttpParams): Promise<R>;
932
985
  insert(dto: DtoT): Promise<ISingleResponse<InterfaceT>>;
933
986
  insertMany(dtos: DtoT[]): Promise<IBulkResponse<InterfaceT>>;
934
987
  findById(id: string, select?: string[]): Promise<ISingleResponse<InterfaceT>>;
@@ -987,6 +1040,56 @@ declare function provideValueAccessor<T extends new (...args: unknown[]) => Cont
987
1040
  multi: boolean;
988
1041
  };
989
1042
 
1043
+ /** Shared action loading for the single and multi permission pickers. */
1044
+ declare abstract class BaseActionSelectComponent {
1045
+ private readonly provider;
1046
+ readonly placeholder: _angular_core.InputSignal<string>;
1047
+ readonly inputId: _angular_core.InputSignal<string>;
1048
+ readonly disabled: _angular_core.InputSignal<boolean>;
1049
+ readonly hasProvider: boolean;
1050
+ readonly actions: _angular_core.ResourceRef<IActionBasicInfo[] | undefined>;
1051
+ /** Picker mode; typing codes is the fallback when there is no provider or the actions could not be loaded. */
1052
+ readonly useSelect: _angular_core.Signal<boolean>;
1053
+ private readonly actionTree;
1054
+ private readonly knownCodes;
1055
+ /** The action tree plus any saved code that is not (or no longer) an action, so the selection still shows. */
1056
+ protected treeWith(saved: string[]): TreeNode[];
1057
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseActionSelectComponent, never>;
1058
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BaseActionSelectComponent, never, never, { "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1059
+ }
1060
+
1061
+ /**
1062
+ * Picks several permission action codes from the action tree of ACTION_PROVIDER (wired by ng-iam);
1063
+ * without an available provider, or when loading fails, it falls back to typing codes as chips (Enter adds one).
1064
+ *
1065
+ * @example
1066
+ * <lib-action-multi-select [(value)]="actionGroups" inputId="actionGroups" />
1067
+ */
1068
+ declare class ActionMultiSelectComponent extends BaseActionSelectComponent {
1069
+ readonly value: _angular_core.ModelSignal<string[]>;
1070
+ readonly draft: _angular_core.WritableSignal<string>;
1071
+ readonly options: _angular_core.Signal<TreeNode<unknown>[]>;
1072
+ add(event: Event): void;
1073
+ remove(code: string): void;
1074
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ActionMultiSelectComponent, never>;
1075
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ActionMultiSelectComponent, "lib-action-multi-select", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
1076
+ }
1077
+
1078
+ /**
1079
+ * Picks a permission action code from the action tree of ACTION_PROVIDER (wired by ng-iam);
1080
+ * without an available provider, or when loading fails, it falls back to a free-text code input.
1081
+ *
1082
+ * @example
1083
+ * <lib-action-select [(value)]="permissionCode" inputId="permission" [placeholder]="defaultCode" />
1084
+ */
1085
+ declare class ActionSelectComponent extends BaseActionSelectComponent {
1086
+ readonly value: _angular_core.ModelSignal<string | null>;
1087
+ readonly showClear: _angular_core.InputSignal<boolean>;
1088
+ readonly options: _angular_core.Signal<TreeNode<unknown>[]>;
1089
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ActionSelectComponent, never>;
1090
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ActionSelectComponent, "lib-action-select", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "showClear": { "alias": "showClear"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
1091
+ }
1092
+
990
1093
  declare class BaseFormTemplateDirective {
991
1094
  readonly key: _angular_core.InputSignal<string>;
992
1095
  readonly templateRef: TemplateRef<any>;
@@ -1616,6 +1719,14 @@ declare const PROFILE_PERMISSION_PROVIDER: InjectionToken<IProfilePermissionProv
1616
1719
  * ]
1617
1720
  */
1618
1721
  declare const FILE_PROVIDER: InjectionToken<IFileProvider>;
1722
+ /**
1723
+ * Action Provider Token
1724
+ *
1725
+ * Lists permission actions for pickers such as `lib-action-select`.
1726
+ * Optional - if not configured, permission pickers fall back to a free-text code input.
1727
+ * Use with `inject(ACTION_PROVIDER, { optional: true })`.
1728
+ */
1729
+ declare const ACTION_PROVIDER: InjectionToken<IActionProvider>;
1619
1730
 
1620
1731
  /**
1621
1732
  * Permission Guard - Single permission or ILogicNode check.
@@ -1718,5 +1829,11 @@ interface ScrollPaginationConfig {
1718
1829
  */
1719
1830
  declare function checkScrollPagination(event: Event, config: ScrollPaginationConfig): IPagination | null;
1720
1831
 
1721
- export { ACTION_PERMISSIONS, AUTH_STATE_PROVIDER, ApiResourceService, ApiResourceService as ApiService, BRANCH_PERMISSIONS, BaseFormComponent, BaseFormControl, BaseFormTemplateDirective, BaseListComponent, BaseListTemplateDirective, BaseUserSelectComponent, COMPANY_ACTION_PERMISSIONS, COMPANY_API_PROVIDER, COMPANY_PERMISSIONS, CookieService, EMAIL_CONFIG_PERMISSIONS, EMAIL_TEMPLATE_PERMISSIONS, EVENT_PERMISSIONS, EditModeElementChangerDirective, FILE_PERMISSIONS, FILE_PROVIDER, FILE_TYPE_FILTERS, FOLDER_PERMISSIONS, FORM_PERMISSIONS, FORM_RESULT_PERMISSIONS, FaviconService, FileSelectorDialogComponent, FileUploaderComponent, FileUrlService, HasPermissionDirective, IconComponent, IconTypeEnum, InlineSvgComponent, IsEmptyImageDirective, LANGUAGE_PERMISSIONS, LazyMultiSelectComponent, LazySelectComponent, NOTIFICATION_PERMISSIONS, PERMISSIONS, PROFILE_PERMISSION_PROVIDER, PermissionValidatorService, PlatformService, PreventDefaultDirective, ROLE_ACTION_PERMISSIONS, ROLE_PERMISSIONS, RouterTabsComponent, SHARED_MESSAGES, SKIP_ERROR_TOAST, SOCIAL_AUTH_CONFIG_PERMISSIONS, STORAGE_CONFIG_PERMISSIONS, TRANSLATION_KEY_PERMISSIONS, TRANSLATION_PERMISSIONS, TranslatePipe, TranslateService, UPLOAD_CONFIG_PERMISSIONS, USER_ACTION_PERMISSIONS, USER_PERMISSIONS, USER_PERMISSION_PROVIDER, USER_PROVIDER, USER_ROLE_PERMISSIONS, UserMultiSelectComponent, UserSelectComponent, allPermissionsGuard, anyPermissionGuard, authenticatedGuard, checkScrollPagination, errorCatchingInterceptor, evaluateLogicNode, evaluatePermission, formatFileSize, formatInTimezone, getAcceptString, getFileIconClass, getUserTimezone, hasAllPermissions, hasAnyPermission, hasPermission, isFileTypeAllowed, localToUtc, permissionGuard, provideValueAccessor, resolveTranslationModule, utcToLocal };
1722
- export type { ActionSeverity, DeleteType, FilesResponseDto, FormFieldType, IActionNode, IActivatable, IApiService, IAuthStateProvider, IBaseEntity, IBranchBasicInfo, IBulkMeta, IBulkResponse, ICompanyApiProvider, ICompanyBasicInfo, IDeleteData, IDropDown, IFileBasicInfo, IFileProvider, IFileSelectFilter, IFileUploadOptions, IFilter, IFilterData, IFolderBasicInfo, IFormField, IFormSelectOption, IGroupNode, IListResponse, ILoggedUserInfo, ILogicNode, IMessageResponse, IOrderable, IPagination, IPaginationMeta, IProfileActionInfo, IProfilePermissionProvider, IProfileRoleInfo, IRequestMeta, IResolverModuleConfig, ISelectFilter, ISingleResponse, ISoftDeletable, ISort, IStorageConfigBasicInfo, ITableAction, ITableColumn, ITagConfig, ITimestampable, IUploadedFile, IUserBasicInfo, IUserBranchPermission, IUserCompanyInfo, IUserPermissionProvider, IUserProvider, IUserSelectFilter, LoadUsersFn, PermissionCode, RouterTabItem, ScrollPaginationConfig, TableColumnType, UploadFileFn, UploadMultipleFilesFn };
1832
+ /** The translatable reason in a failed HTTP call: the backend's `messageKey`/`messageVariables`, or `fallbackKey` when the response carries none. */
1833
+ declare function errorToMessageRef(error: unknown, fallbackKey?: string): IMessageRef;
1834
+
1835
+ /** Escapes user-authored text interpolated into markup rendered via [innerHTML] (e.g. confirm dialog messages). */
1836
+ declare function escapeHtml(value: string): string;
1837
+
1838
+ export { ACTION_PERMISSIONS, ACTION_PROVIDER, AUTH_STATE_PROVIDER, ActionMultiSelectComponent, ActionSelectComponent, ApiResourceService, ApiResourceService as ApiService, BRANCH_PERMISSIONS, BaseActionSelectComponent, BaseFormComponent, BaseFormControl, BaseFormTemplateDirective, BaseListComponent, BaseListTemplateDirective, BaseUserSelectComponent, COMPANY_ACTION_PERMISSIONS, COMPANY_API_PROVIDER, COMPANY_PERMISSIONS, CookieService, EMAIL_CONFIG_PERMISSIONS, EMAIL_TEMPLATE_PERMISSIONS, ENTITY_DEFINITION_PERMISSIONS, EVENT_PERMISSIONS, EditModeElementChangerDirective, FIELD_DEFINITION_PERMISSIONS, FILE_PERMISSIONS, FILE_PROVIDER, FILE_TYPE_FILTERS, FLOW_DEFINITION_PERMISSIONS, FOLDER_PERMISSIONS, FORM_PERMISSIONS, FORM_RESULT_PERMISSIONS, FaviconService, FileSelectorDialogComponent, FileUploaderComponent, FileUrlService, HasPermissionDirective, IconComponent, IconTypeEnum, InlineSvgComponent, IsEmptyImageDirective, LANGUAGE_PERMISSIONS, LazyMultiSelectComponent, LazySelectComponent, NOTIFICATION_PERMISSIONS, PERMISSIONS, PROFILE_PERMISSION_PROVIDER, PermissionValidatorService, PlatformService, PreventDefaultDirective, ROLE_ACTION_PERMISSIONS, ROLE_PERMISSIONS, RouterTabsComponent, SHARED_MESSAGES, SKIP_ERROR_TOAST, SOCIAL_AUTH_CONFIG_PERMISSIONS, STORAGE_CONFIG_PERMISSIONS, TRANSLATION_KEY_PERMISSIONS, TRANSLATION_PERMISSIONS, TranslatePipe, TranslateService, UPLOAD_CONFIG_PERMISSIONS, USER_ACTION_PERMISSIONS, USER_PERMISSIONS, USER_PERMISSION_PROVIDER, USER_PROVIDER, USER_ROLE_PERMISSIONS, UserMultiSelectComponent, UserSelectComponent, allPermissionsGuard, anyPermissionGuard, authenticatedGuard, checkScrollPagination, errorCatchingInterceptor, errorToMessageRef, escapeHtml, evaluateLogicNode, evaluatePermission, formatFileSize, formatInTimezone, getAcceptString, getFileIconClass, getUserTimezone, hasAllPermissions, hasAnyPermission, hasPermission, isErrorToastShown, isFileTypeAllowed, localToUtc, permissionGuard, provideValueAccessor, resolveTranslationModule, utcToLocal };
1839
+ export type { ActionSeverity, DeleteType, FilesResponseDto, FormFieldType, IActionBasicInfo, IActionNode, IActionProvider, IActivatable, IApiService, IAuthStateProvider, IBaseEntity, IBranchBasicInfo, IBulkMeta, IBulkResponse, ICompanyApiProvider, ICompanyBasicInfo, IDeleteData, IDropDown, IFileBasicInfo, IFileProvider, IFileSelectFilter, IFileUploadOptions, IFilter, IFilterData, IFolderBasicInfo, IFormField, IFormSelectOption, IGroupNode, IListResponse, ILoggedUserInfo, ILogicNode, IMessageRef, IMessageResponse, IOrderable, IPagination, IPaginationMeta, IProfileActionInfo, IProfilePermissionProvider, IProfileRoleInfo, IRequestMeta, IResolverModuleConfig, ISelectFilter, ISingleResponse, ISoftDeletable, ISort, IStorageConfigBasicInfo, ITableAction, ITableColumn, ITagConfig, ITimestampable, IUploadedFile, IUserBasicInfo, IUserBranchPermission, IUserCompanyInfo, IUserPermissionProvider, IUserProvider, IUserSelectFilter, LoadUsersFn, PermissionCode, RouterTabItem, ScrollPaginationConfig, TableColumnType, UploadFileFn, UploadMultipleFilesFn };