@flusys/ng-shared 5.1.3 → 5.3.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/fesm2022/flusys-ng-shared.mjs +462 -406
- package/fesm2022/flusys-ng-shared.mjs.map +1 -1
- package/package.json +2 -2
- package/types/flusys-ng-shared.d.ts +205 -309
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flusys/ng-shared",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Shared components and utilities for FLUSYS Angular packages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"peerDependencies": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@angular/core": ">=21.0.0",
|
|
9
9
|
"@angular/forms": ">=21.0.0",
|
|
10
10
|
"@angular/router": ">=21.0.0",
|
|
11
|
-
"@flusys/ng-core": ">=5.
|
|
11
|
+
"@flusys/ng-core": ">=5.3.0",
|
|
12
12
|
"@primeuix/themes": ">=1.0.0",
|
|
13
13
|
"primeicons": ">=7.0.0",
|
|
14
14
|
"primeng": ">=21.0.0",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as rxjs from 'rxjs';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import * as _angular_core from '@angular/core';
|
|
4
|
-
import { Signal, PipeTransform, ResourceRef, ResourceStatus, Injector, model, OnDestroy, ElementRef,
|
|
4
|
+
import { Signal, PipeTransform, ResourceRef, ResourceStatus, Injector, model, TemplateRef, OnDestroy, ElementRef, DestroyRef, InjectionToken } from '@angular/core';
|
|
5
5
|
import { HttpContextToken, HttpRequest, HttpHandlerFn, HttpEvent, HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
|
6
6
|
import * as i3 from '@angular/router';
|
|
7
|
-
import { ResolveFn, CanActivateFn
|
|
7
|
+
import { ResolveFn, CanActivateFn } from '@angular/router';
|
|
8
8
|
import * as i1 from '@angular/common';
|
|
9
9
|
import * as i2 from '@angular/forms';
|
|
10
10
|
import { ControlValueAccessor } from '@angular/forms';
|
|
@@ -50,10 +50,9 @@ import * as i38 from 'primeng/treetable';
|
|
|
50
50
|
import * as i39 from 'primeng/progressspinner';
|
|
51
51
|
import * as i40 from 'primeng/colorpicker';
|
|
52
52
|
import * as _flusys_ng_shared from '@flusys/ng-shared';
|
|
53
|
-
import * as _flusys_ng_core from '@flusys/ng-core';
|
|
54
53
|
import { ServiceName } from '@flusys/ng-core';
|
|
55
54
|
import { FormValueControl } from '@angular/forms/signals';
|
|
56
|
-
import
|
|
55
|
+
import * as _angular_platform_browser from '@angular/platform-browser';
|
|
57
56
|
|
|
58
57
|
declare const SHARED_MESSAGES: Record<string, string>;
|
|
59
58
|
|
|
@@ -663,6 +662,17 @@ declare class CookieService {
|
|
|
663
662
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<CookieService>;
|
|
664
663
|
}
|
|
665
664
|
|
|
665
|
+
declare class FaviconService {
|
|
666
|
+
private readonly http;
|
|
667
|
+
private readonly platformService;
|
|
668
|
+
private readonly document;
|
|
669
|
+
private svgTemplate;
|
|
670
|
+
apply(): void;
|
|
671
|
+
private render;
|
|
672
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FaviconService, never>;
|
|
673
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<FaviconService>;
|
|
674
|
+
}
|
|
675
|
+
|
|
666
676
|
interface FilesResponseDto {
|
|
667
677
|
id: string;
|
|
668
678
|
name: string;
|
|
@@ -1000,6 +1010,195 @@ declare function provideValueAccessor<T extends new (...args: unknown[]) => Cont
|
|
|
1000
1010
|
multi: boolean;
|
|
1001
1011
|
};
|
|
1002
1012
|
|
|
1013
|
+
type TableColumnType = 'text' | 'date' | 'tag' | 'boolean' | 'number' | 'custom';
|
|
1014
|
+
type ActionSeverity = 'success' | 'info' | 'warn' | 'danger' | 'secondary' | 'contrast';
|
|
1015
|
+
interface ITagConfig {
|
|
1016
|
+
label?: string;
|
|
1017
|
+
severity: 'success' | 'danger' | 'warn' | 'info' | 'secondary' | 'contrast';
|
|
1018
|
+
}
|
|
1019
|
+
interface ITableColumn {
|
|
1020
|
+
field: string;
|
|
1021
|
+
header: string;
|
|
1022
|
+
type?: TableColumnType;
|
|
1023
|
+
width?: string;
|
|
1024
|
+
minWidth?: string;
|
|
1025
|
+
align?: 'left' | 'center' | 'right';
|
|
1026
|
+
tagMap?: Record<string, ITagConfig>;
|
|
1027
|
+
dateFormat?: string;
|
|
1028
|
+
truncate?: number;
|
|
1029
|
+
hidden?: boolean;
|
|
1030
|
+
}
|
|
1031
|
+
interface ITableAction<T = unknown> {
|
|
1032
|
+
icon: string;
|
|
1033
|
+
tooltip?: string;
|
|
1034
|
+
severity?: ActionSeverity;
|
|
1035
|
+
show?: (item: T) => boolean;
|
|
1036
|
+
disabled?: (item: T) => boolean;
|
|
1037
|
+
handler: (item: T) => void;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
declare class BaseListTemplateDirective {
|
|
1041
|
+
readonly key: _angular_core.InputSignal<string>;
|
|
1042
|
+
readonly templateRef: TemplateRef<any>;
|
|
1043
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseListTemplateDirective, never>;
|
|
1044
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BaseListTemplateDirective, "ng-template[baseListTemplate]", never, { "key": { "alias": "baseListTemplate"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
declare class BaseListComponent {
|
|
1048
|
+
private readonly translateAdapter;
|
|
1049
|
+
private readonly router;
|
|
1050
|
+
private readonly messageService;
|
|
1051
|
+
private readonly confirmationService;
|
|
1052
|
+
readonly columns: _angular_core.InputSignal<ITableColumn[]>;
|
|
1053
|
+
readonly actions: _angular_core.InputSignal<ITableAction<unknown>[]>;
|
|
1054
|
+
readonly title: _angular_core.InputSignal<string>;
|
|
1055
|
+
readonly showCreateButton: _angular_core.InputSignal<boolean>;
|
|
1056
|
+
readonly searchable: _angular_core.InputSignal<boolean>;
|
|
1057
|
+
readonly pageSize: _angular_core.InputSignal<number>;
|
|
1058
|
+
readonly emptyMessage: _angular_core.InputSignal<string>;
|
|
1059
|
+
readonly createButtonLabel: _angular_core.InputSignal<string>;
|
|
1060
|
+
readonly createButtonIcon: _angular_core.InputSignal<string>;
|
|
1061
|
+
readonly data: _angular_core.InputSignal<unknown[]>;
|
|
1062
|
+
readonly total: _angular_core.InputSignal<number>;
|
|
1063
|
+
readonly isLoading: _angular_core.InputSignal<boolean>;
|
|
1064
|
+
readonly service: _angular_core.InputSignal<ApiResourceService<unknown, unknown> | null>;
|
|
1065
|
+
readonly filter: _angular_core.InputSignal<IFilter>;
|
|
1066
|
+
readonly createRoute: _angular_core.InputSignal<string | null>;
|
|
1067
|
+
readonly editRoute: _angular_core.InputSignal<string | null>;
|
|
1068
|
+
readonly deleteConfirmField: _angular_core.InputSignal<string | null>;
|
|
1069
|
+
readonly idField: _angular_core.InputSignal<string>;
|
|
1070
|
+
readonly canEdit: _angular_core.InputSignal<((item: unknown) => boolean) | null>;
|
|
1071
|
+
readonly canDelete: _angular_core.InputSignal<((item: unknown) => boolean) | null>;
|
|
1072
|
+
readonly onCreate: _angular_core.OutputEmitterRef<void>;
|
|
1073
|
+
readonly onLazyLoad: _angular_core.OutputEmitterRef<{
|
|
1074
|
+
first: number;
|
|
1075
|
+
rows: number;
|
|
1076
|
+
}>;
|
|
1077
|
+
readonly onSearch: _angular_core.OutputEmitterRef<string>;
|
|
1078
|
+
readonly columnTemplates: _angular_core.Signal<readonly BaseListTemplateDirective[]>;
|
|
1079
|
+
private readonly _first;
|
|
1080
|
+
private readonly _searchTerm;
|
|
1081
|
+
readonly first: _angular_core.Signal<number>;
|
|
1082
|
+
readonly searchTerm: _angular_core.Signal<string>;
|
|
1083
|
+
readonly effectiveData: _angular_core.Signal<unknown[]>;
|
|
1084
|
+
readonly effectiveTotal: _angular_core.Signal<number>;
|
|
1085
|
+
readonly effectiveIsLoading: _angular_core.Signal<boolean>;
|
|
1086
|
+
readonly effectiveActions: _angular_core.Signal<ITableAction<unknown>[]>;
|
|
1087
|
+
readonly visibleColumns: _angular_core.Signal<ITableColumn[]>;
|
|
1088
|
+
readonly columnCount: _angular_core.Signal<number>;
|
|
1089
|
+
readonly resolvedEmptyMessage: _angular_core.Signal<string>;
|
|
1090
|
+
readonly resolvedCreateLabel: _angular_core.Signal<string>;
|
|
1091
|
+
handleLazyLoad(event: {
|
|
1092
|
+
first?: number | null;
|
|
1093
|
+
rows?: number | null;
|
|
1094
|
+
}): void;
|
|
1095
|
+
onSearchChange(value: string): void;
|
|
1096
|
+
handleCreate(): void;
|
|
1097
|
+
private handleEditItem;
|
|
1098
|
+
private handleDeleteItem;
|
|
1099
|
+
getFieldValue(item: unknown, field: string): unknown;
|
|
1100
|
+
getFieldValueAsString(item: unknown, field: string): string;
|
|
1101
|
+
getTagConfig(col: ITableColumn, value: unknown): ITagConfig | null;
|
|
1102
|
+
getColumnTemplate(field: string): TemplateRef<unknown> | null;
|
|
1103
|
+
truncateText(value: unknown, limit?: number): string;
|
|
1104
|
+
getCellClass(col: ITableColumn): string;
|
|
1105
|
+
t(key: string, vars?: Record<string, string | number>): string;
|
|
1106
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseListComponent, never>;
|
|
1107
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<BaseListComponent, "lib-base-list", never, { "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "actions": { "alias": "actions"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "showCreateButton": { "alias": "showCreateButton"; "required": false; "isSignal": true; }; "searchable": { "alias": "searchable"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "createButtonLabel": { "alias": "createButtonLabel"; "required": false; "isSignal": true; }; "createButtonIcon": { "alias": "createButtonIcon"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "total": { "alias": "total"; "required": false; "isSignal": true; }; "isLoading": { "alias": "isLoading"; "required": false; "isSignal": true; }; "service": { "alias": "service"; "required": false; "isSignal": true; }; "filter": { "alias": "filter"; "required": false; "isSignal": true; }; "createRoute": { "alias": "createRoute"; "required": false; "isSignal": true; }; "editRoute": { "alias": "editRoute"; "required": false; "isSignal": true; }; "deleteConfirmField": { "alias": "deleteConfirmField"; "required": false; "isSignal": true; }; "idField": { "alias": "idField"; "required": false; "isSignal": true; }; "canEdit": { "alias": "canEdit"; "required": false; "isSignal": true; }; "canDelete": { "alias": "canDelete"; "required": false; "isSignal": true; }; }, { "onCreate": "onCreate"; "onLazyLoad": "onLazyLoad"; "onSearch": "onSearch"; }, ["columnTemplates"], never, true, never>;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
type FormFieldType = 'text' | 'email' | 'password' | 'number' | 'textarea' | 'select' | 'multiselect' | 'date' | 'checkbox' | 'toggle' | 'custom';
|
|
1111
|
+
interface IFormSelectOption {
|
|
1112
|
+
label: string;
|
|
1113
|
+
value: unknown;
|
|
1114
|
+
}
|
|
1115
|
+
interface IFormField {
|
|
1116
|
+
key: string;
|
|
1117
|
+
type: FormFieldType;
|
|
1118
|
+
label: string;
|
|
1119
|
+
placeholder?: string;
|
|
1120
|
+
required?: boolean;
|
|
1121
|
+
disabled?: boolean;
|
|
1122
|
+
fullWidth?: boolean;
|
|
1123
|
+
options?: IFormSelectOption[];
|
|
1124
|
+
minDate?: Date;
|
|
1125
|
+
maxDate?: Date;
|
|
1126
|
+
rows?: number;
|
|
1127
|
+
min?: number;
|
|
1128
|
+
max?: number;
|
|
1129
|
+
hint?: string;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
declare class BaseFormTemplateDirective {
|
|
1133
|
+
readonly key: _angular_core.InputSignal<string>;
|
|
1134
|
+
readonly templateRef: TemplateRef<any>;
|
|
1135
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseFormTemplateDirective, never>;
|
|
1136
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BaseFormTemplateDirective, "ng-template[baseFormTemplate]", never, { "key": { "alias": "baseFormTemplate"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
declare class BaseFormComponent {
|
|
1140
|
+
private readonly translateAdapter;
|
|
1141
|
+
private readonly router;
|
|
1142
|
+
private readonly messageService;
|
|
1143
|
+
readonly fields: _angular_core.InputSignal<IFormField[]>;
|
|
1144
|
+
readonly title: _angular_core.InputSignal<string>;
|
|
1145
|
+
readonly createTitle: _angular_core.InputSignal<string>;
|
|
1146
|
+
readonly editTitle: _angular_core.InputSignal<string>;
|
|
1147
|
+
readonly columns: _angular_core.InputSignal<1 | 2 | 3>;
|
|
1148
|
+
readonly submitLabel: _angular_core.InputSignal<string>;
|
|
1149
|
+
readonly cancelLabel: _angular_core.InputSignal<string>;
|
|
1150
|
+
readonly isLoading: _angular_core.InputSignal<boolean>;
|
|
1151
|
+
readonly isEditMode: _angular_core.InputSignal<boolean>;
|
|
1152
|
+
readonly initialValue: _angular_core.InputSignal<Record<string, unknown>>;
|
|
1153
|
+
readonly service: _angular_core.InputSignal<ApiResourceService<unknown, unknown> | null>;
|
|
1154
|
+
readonly editId: _angular_core.InputSignal<string | null>;
|
|
1155
|
+
readonly cancelRoute: _angular_core.InputSignal<string | string[] | null>;
|
|
1156
|
+
readonly navigateOnSuccess: _angular_core.InputSignal<string | string[] | null>;
|
|
1157
|
+
readonly mapToRequest: _angular_core.InputSignal<((data: Record<string, unknown>, editId: string | null) => unknown) | null>;
|
|
1158
|
+
readonly mapFromEntity: _angular_core.InputSignal<((entity: unknown) => Record<string, unknown>) | null>;
|
|
1159
|
+
readonly onSubmit: _angular_core.OutputEmitterRef<Record<string, unknown>>;
|
|
1160
|
+
readonly onCancel: _angular_core.OutputEmitterRef<void>;
|
|
1161
|
+
readonly onValueChange: _angular_core.OutputEmitterRef<Record<string, unknown>>;
|
|
1162
|
+
readonly fieldTemplates: _angular_core.Signal<readonly BaseFormTemplateDirective[]>;
|
|
1163
|
+
private readonly _formData;
|
|
1164
|
+
private readonly _submitted;
|
|
1165
|
+
private readonly _isLoadingInternal;
|
|
1166
|
+
private readonly _touchedFields;
|
|
1167
|
+
readonly formData: _angular_core.Signal<Record<string, unknown>>;
|
|
1168
|
+
readonly submitted: _angular_core.Signal<boolean>;
|
|
1169
|
+
readonly effectiveIsEditMode: _angular_core.Signal<boolean>;
|
|
1170
|
+
readonly effectiveIsLoading: _angular_core.Signal<boolean>;
|
|
1171
|
+
readonly isFormValid: _angular_core.Signal<boolean>;
|
|
1172
|
+
readonly resolvedTitle: _angular_core.Signal<string>;
|
|
1173
|
+
readonly gridClass: _angular_core.Signal<"grid-cols-1" | "grid-cols-1 md:grid-cols-3" | "grid-cols-1 md:grid-cols-2">;
|
|
1174
|
+
constructor();
|
|
1175
|
+
private loadEntity;
|
|
1176
|
+
getFieldValue(key: string): unknown;
|
|
1177
|
+
setFieldValue(key: string, value: unknown): void;
|
|
1178
|
+
markFieldTouched(key: string): void;
|
|
1179
|
+
isFieldInvalid(field: IFormField): boolean;
|
|
1180
|
+
getFieldTemplate(key: string): TemplateRef<unknown> | null;
|
|
1181
|
+
handleSubmit(): Promise<void>;
|
|
1182
|
+
handleCancel(): void;
|
|
1183
|
+
reset(): void;
|
|
1184
|
+
t(key: string, vars?: Record<string, string | number>): string;
|
|
1185
|
+
private managedSubmit;
|
|
1186
|
+
private checkValidity;
|
|
1187
|
+
private navigateTo;
|
|
1188
|
+
private getDefaultValue;
|
|
1189
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseFormComponent, never>;
|
|
1190
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<BaseFormComponent, "lib-base-form", never, { "fields": { "alias": "fields"; "required": true; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "createTitle": { "alias": "createTitle"; "required": false; "isSignal": true; }; "editTitle": { "alias": "editTitle"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "submitLabel": { "alias": "submitLabel"; "required": false; "isSignal": true; }; "cancelLabel": { "alias": "cancelLabel"; "required": false; "isSignal": true; }; "isLoading": { "alias": "isLoading"; "required": false; "isSignal": true; }; "isEditMode": { "alias": "isEditMode"; "required": false; "isSignal": true; }; "initialValue": { "alias": "initialValue"; "required": false; "isSignal": true; }; "service": { "alias": "service"; "required": false; "isSignal": true; }; "editId": { "alias": "editId"; "required": false; "isSignal": true; }; "cancelRoute": { "alias": "cancelRoute"; "required": false; "isSignal": true; }; "navigateOnSuccess": { "alias": "navigateOnSuccess"; "required": false; "isSignal": true; }; "mapToRequest": { "alias": "mapToRequest"; "required": false; "isSignal": true; }; "mapFromEntity": { "alias": "mapFromEntity"; "required": false; "isSignal": true; }; }, { "onSubmit": "onSubmit"; "onCancel": "onCancel"; "onValueChange": "onValueChange"; }, ["fieldTemplates"], never, true, never>;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
declare class InlineSvgComponent {
|
|
1194
|
+
readonly src: _angular_core.InputSignal<string>;
|
|
1195
|
+
private readonly http;
|
|
1196
|
+
private readonly sanitizer;
|
|
1197
|
+
readonly svg: _angular_core.ResourceRef<_angular_platform_browser.SafeHtml | undefined>;
|
|
1198
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<InlineSvgComponent, never>;
|
|
1199
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<InlineSvgComponent, "inline-svg", never, { "src": { "alias": "src"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1003
1202
|
declare class FileSelectorDialogComponent {
|
|
1004
1203
|
private readonly destroyRef;
|
|
1005
1204
|
private readonly translateAdapter;
|
|
@@ -1420,309 +1619,6 @@ declare function anyPermissionGuard(permissions: string[], redirectTo?: string):
|
|
|
1420
1619
|
*/
|
|
1421
1620
|
declare function allPermissionsGuard(permissions: string[], redirectTo?: string): CanActivateFn;
|
|
1422
1621
|
|
|
1423
|
-
/**
|
|
1424
|
-
* Base class for form page components that handle create/edit operations.
|
|
1425
|
-
* Provides common functionality for loading existing items, form submission,
|
|
1426
|
-
* navigation, and toast notifications.
|
|
1427
|
-
*
|
|
1428
|
-
* ## Features
|
|
1429
|
-
* - Automatic route parameter handling (loads item when ID is present)
|
|
1430
|
-
* - Edit mode detection based on existing item
|
|
1431
|
-
* - Unified submit handler for create/update operations
|
|
1432
|
-
* - Cancel navigation
|
|
1433
|
-
* - Toast messages for success/validation errors
|
|
1434
|
-
*
|
|
1435
|
-
* ## Usage
|
|
1436
|
-
*
|
|
1437
|
-
* ```typescript
|
|
1438
|
-
* interface IProductFormModel {
|
|
1439
|
-
* name: string;
|
|
1440
|
-
* price: number;
|
|
1441
|
-
* }
|
|
1442
|
-
*
|
|
1443
|
-
* @Component({
|
|
1444
|
-
* selector: 'app-product-form',
|
|
1445
|
-
* standalone: true,
|
|
1446
|
-
* * template: `...`
|
|
1447
|
-
* })
|
|
1448
|
-
* export class ProductFormComponent extends BaseFormPage<IProduct, IProductFormModel> {
|
|
1449
|
-
* private readonly productService = inject(ProductApiService);
|
|
1450
|
-
*
|
|
1451
|
-
* // Form model signal (private writable, public readonly)
|
|
1452
|
-
* private readonly _formModel = signal<IProductFormModel>({ name: '', price: 0 });
|
|
1453
|
-
* readonly formModel = this._formModel.asReadonly();
|
|
1454
|
-
*
|
|
1455
|
-
* // Required abstract implementations
|
|
1456
|
-
* getFormModel(): Signal<IProductFormModel> {
|
|
1457
|
-
* return this.formModel;
|
|
1458
|
-
* }
|
|
1459
|
-
*
|
|
1460
|
-
* getResourceRoute(): string {
|
|
1461
|
-
* return '/products';
|
|
1462
|
-
* }
|
|
1463
|
-
*
|
|
1464
|
-
* getResourceName(): string {
|
|
1465
|
-
* return 'Product';
|
|
1466
|
-
* }
|
|
1467
|
-
*
|
|
1468
|
-
* isFormValid(): boolean {
|
|
1469
|
-
* const model = this.formModel();
|
|
1470
|
-
* return model.name.trim().length > 0 && model.price > 0;
|
|
1471
|
-
* }
|
|
1472
|
-
*
|
|
1473
|
-
* loadItem(id: string): void {
|
|
1474
|
-
* this.isLoading.set(true);
|
|
1475
|
-
* this.productService.findById(id)
|
|
1476
|
-
* .pipe(takeUntilDestroyed(this.destroyRef))
|
|
1477
|
-
* .subscribe({
|
|
1478
|
-
* next: (response) => {
|
|
1479
|
-
* if (response.success && response.data) {
|
|
1480
|
-
* this.existingItem.set(response.data);
|
|
1481
|
-
* this._formModel.set({
|
|
1482
|
-
* name: response.data.name,
|
|
1483
|
-
* price: response.data.price,
|
|
1484
|
-
* });
|
|
1485
|
-
* }
|
|
1486
|
-
* this.isLoading.set(false);
|
|
1487
|
-
* },
|
|
1488
|
-
* error: () => {
|
|
1489
|
-
* this.router.navigate([this.getResourceRoute()]);
|
|
1490
|
-
* this.isLoading.set(false);
|
|
1491
|
-
* },
|
|
1492
|
-
* });
|
|
1493
|
-
* }
|
|
1494
|
-
*
|
|
1495
|
-
* createItem(model: IProductFormModel): Observable<ISingleResponse<IProduct>> {
|
|
1496
|
-
* return this.productService.insert(model);
|
|
1497
|
-
* }
|
|
1498
|
-
*
|
|
1499
|
-
* updateItem(model: IProductFormModel): Observable<ISingleResponse<IProduct>> {
|
|
1500
|
-
* return this.productService.update({ id: this.existingItem()!.id, ...model });
|
|
1501
|
-
* }
|
|
1502
|
-
* }
|
|
1503
|
-
* ```
|
|
1504
|
-
*
|
|
1505
|
-
* @template T The entity/interface type being edited
|
|
1506
|
-
* @template TFormModel The form model interface
|
|
1507
|
-
*/
|
|
1508
|
-
declare abstract class BaseFormPage<T, TFormModel> {
|
|
1509
|
-
protected readonly router: Router;
|
|
1510
|
-
protected readonly route: ActivatedRoute;
|
|
1511
|
-
protected readonly messageService: MessageService;
|
|
1512
|
-
protected readonly destroyRef: DestroyRef;
|
|
1513
|
-
protected readonly translateAdapter: TranslateService | null;
|
|
1514
|
-
protected readonly routeParams: Signal<i3.ParamMap | undefined>;
|
|
1515
|
-
protected initialized: boolean;
|
|
1516
|
-
/** Loading state for async operations */
|
|
1517
|
-
readonly isLoading: _angular_core.WritableSignal<boolean>;
|
|
1518
|
-
/** The existing item when in edit mode, null when creating */
|
|
1519
|
-
readonly existingItem: _angular_core.WritableSignal<T | null>;
|
|
1520
|
-
/** Whether the form is in edit mode (has existing item) */
|
|
1521
|
-
readonly isEditMode: Signal<boolean>;
|
|
1522
|
-
/**
|
|
1523
|
-
* Get the form model signal.
|
|
1524
|
-
* Returns a readonly Signal - implementations should expose their
|
|
1525
|
-
* WritableSignal as readonly through this method.
|
|
1526
|
-
*/
|
|
1527
|
-
abstract getFormModel(): Signal<TFormModel>;
|
|
1528
|
-
/**
|
|
1529
|
-
* Get the base route for the resource (used for navigation after save/cancel).
|
|
1530
|
-
* @example '/products' or '/administration/users'
|
|
1531
|
-
*/
|
|
1532
|
-
abstract getResourceRoute(): string;
|
|
1533
|
-
/**
|
|
1534
|
-
* Get the display name of the resource for toast messages.
|
|
1535
|
-
* @example 'Product' or 'User'
|
|
1536
|
-
*/
|
|
1537
|
-
abstract getResourceName(): string;
|
|
1538
|
-
/**
|
|
1539
|
-
* Validate the current form model.
|
|
1540
|
-
* Return true if the form is valid and can be submitted.
|
|
1541
|
-
*/
|
|
1542
|
-
abstract isFormValid(): boolean;
|
|
1543
|
-
/**
|
|
1544
|
-
* Load an existing item by ID.
|
|
1545
|
-
* Should set existingItem and populate formModel on success.
|
|
1546
|
-
* Should handle loading state and navigation on error.
|
|
1547
|
-
*/
|
|
1548
|
-
abstract loadItem(id: string): void;
|
|
1549
|
-
/**
|
|
1550
|
-
* Create a new item with the given form model.
|
|
1551
|
-
* Return an Observable that emits the API response.
|
|
1552
|
-
*/
|
|
1553
|
-
abstract createItem(model: TFormModel): Observable<unknown>;
|
|
1554
|
-
/**
|
|
1555
|
-
* Update an existing item with the given form model.
|
|
1556
|
-
* Return an Observable that emits the API response.
|
|
1557
|
-
*/
|
|
1558
|
-
abstract updateItem(model: TFormModel): Observable<unknown>;
|
|
1559
|
-
constructor();
|
|
1560
|
-
/**
|
|
1561
|
-
* Handle form submission.
|
|
1562
|
-
* Validates the form, then calls createItem or updateItem based on mode.
|
|
1563
|
-
* Shows appropriate toast messages and navigates back on success.
|
|
1564
|
-
*/
|
|
1565
|
-
onSubmit(): void;
|
|
1566
|
-
/**
|
|
1567
|
-
* Handle cancel action.
|
|
1568
|
-
* Navigates back to the resource list.
|
|
1569
|
-
*/
|
|
1570
|
-
onCancel(): void;
|
|
1571
|
-
/**
|
|
1572
|
-
* Show validation error toast.
|
|
1573
|
-
* Override to customize the validation error message.
|
|
1574
|
-
*/
|
|
1575
|
-
protected showValidationError(): void;
|
|
1576
|
-
/**
|
|
1577
|
-
* Show success toast.
|
|
1578
|
-
* @param detail The success message to display
|
|
1579
|
-
*/
|
|
1580
|
-
protected showSuccess(detail: string): void;
|
|
1581
|
-
/**
|
|
1582
|
-
* Show error toast.
|
|
1583
|
-
* @param detail The error message to display
|
|
1584
|
-
*/
|
|
1585
|
-
protected showError(detail: string): void;
|
|
1586
|
-
/**
|
|
1587
|
-
* Translate a key using the adapter, fallback to key if not available.
|
|
1588
|
-
*/
|
|
1589
|
-
protected t(key: string, variables?: Record<string, string | number>): string;
|
|
1590
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseFormPage<any, any>, never>;
|
|
1591
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BaseFormPage<any, any>, never, never, {}, {}, never, never, true, never>;
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
/**
|
|
1595
|
-
* Base List Page
|
|
1596
|
-
* Abstract directive providing common signals, computed values, and utilities
|
|
1597
|
-
* for list page components across all feature packages.
|
|
1598
|
-
*
|
|
1599
|
-
* Features:
|
|
1600
|
-
* - Pagination state management (pageSize, currentPage, total)
|
|
1601
|
-
* - Loading state
|
|
1602
|
-
* - CRUD navigation helpers
|
|
1603
|
-
* - Message display utilities
|
|
1604
|
-
* - Delete confirmation with API integration
|
|
1605
|
-
* - Company feature flag support
|
|
1606
|
-
*
|
|
1607
|
-
* Usage:
|
|
1608
|
-
* ```typescript
|
|
1609
|
-
* @Component({ ... })
|
|
1610
|
-
* export class UserListComponent extends BaseListPage<IUser> {
|
|
1611
|
-
* getResourceRoute(): string { return '/users'; }
|
|
1612
|
-
* getDeleteConfirmMessage(user: IUser): string { return `Delete "${user.name}"?`; }
|
|
1613
|
-
* async loadData(): Promise<void> { ... }
|
|
1614
|
-
* }
|
|
1615
|
-
* ```
|
|
1616
|
-
*/
|
|
1617
|
-
declare abstract class BaseListPage<T> {
|
|
1618
|
-
protected readonly router: Router;
|
|
1619
|
-
protected readonly messageService: MessageService;
|
|
1620
|
-
protected readonly appConfig: _flusys_ng_core.IAppConfig;
|
|
1621
|
-
protected readonly confirmationService: ConfirmationService;
|
|
1622
|
-
protected readonly destroyRef: DestroyRef;
|
|
1623
|
-
protected readonly translateAdapter: TranslateService | null;
|
|
1624
|
-
/** Items list */
|
|
1625
|
-
readonly items: _angular_core.WritableSignal<T[]>;
|
|
1626
|
-
/** Loading state */
|
|
1627
|
-
readonly isLoading: _angular_core.WritableSignal<boolean>;
|
|
1628
|
-
/** Total records for pagination */
|
|
1629
|
-
readonly total: _angular_core.WritableSignal<number>;
|
|
1630
|
-
/** Page size */
|
|
1631
|
-
readonly pageSize: _angular_core.WritableSignal<number>;
|
|
1632
|
-
/** First record index (for p-table lazy load) */
|
|
1633
|
-
readonly first: _angular_core.WritableSignal<number>;
|
|
1634
|
-
/** Current page (0-based for API, derived from first/pageSize) */
|
|
1635
|
-
readonly currentPage: _angular_core.Signal<number>;
|
|
1636
|
-
/** Show company info if company feature enabled */
|
|
1637
|
-
readonly showCompanyInfo: _angular_core.Signal<boolean>;
|
|
1638
|
-
/**
|
|
1639
|
-
* Abstract method to load data - must be implemented by subclass
|
|
1640
|
-
*/
|
|
1641
|
-
abstract loadData(): Promise<void>;
|
|
1642
|
-
/**
|
|
1643
|
-
* Get the base route for this resource
|
|
1644
|
-
* Used for navigation to create/edit pages
|
|
1645
|
-
* @example '/administration/users' or '/storage/folders'
|
|
1646
|
-
*/
|
|
1647
|
-
abstract getResourceRoute(): string;
|
|
1648
|
-
/**
|
|
1649
|
-
* Get the confirmation message for deleting an item
|
|
1650
|
-
* @param item The item to delete
|
|
1651
|
-
* @returns Confirmation message string
|
|
1652
|
-
*/
|
|
1653
|
-
abstract getDeleteConfirmMessage(item: T): string;
|
|
1654
|
-
/**
|
|
1655
|
-
* Navigate to create page
|
|
1656
|
-
*/
|
|
1657
|
-
onCreate(): void;
|
|
1658
|
-
/**
|
|
1659
|
-
* Navigate to edit page
|
|
1660
|
-
* @param id The ID of the item to edit
|
|
1661
|
-
*/
|
|
1662
|
-
onEdit(id: string): void;
|
|
1663
|
-
/**
|
|
1664
|
-
* Handle page change from p-table lazy load
|
|
1665
|
-
*/
|
|
1666
|
-
onPageChange(event: {
|
|
1667
|
-
first?: number | null;
|
|
1668
|
-
rows?: number | null;
|
|
1669
|
-
}): void;
|
|
1670
|
-
/**
|
|
1671
|
-
* Get pagination params for API call
|
|
1672
|
-
* Returns 0-based page for backend API
|
|
1673
|
-
*/
|
|
1674
|
-
protected getPaginationParams(): {
|
|
1675
|
-
currentPage: number;
|
|
1676
|
-
pageSize: number;
|
|
1677
|
-
};
|
|
1678
|
-
/**
|
|
1679
|
-
* Show success toast message
|
|
1680
|
-
*/
|
|
1681
|
-
protected showSuccess(detail: string, summary?: string): void;
|
|
1682
|
-
/**
|
|
1683
|
-
* Show error toast message
|
|
1684
|
-
*/
|
|
1685
|
-
protected showError(detail: string, summary?: string): void;
|
|
1686
|
-
/**
|
|
1687
|
-
* Show info toast message
|
|
1688
|
-
*/
|
|
1689
|
-
protected showInfo(detail: string, summary?: string): void;
|
|
1690
|
-
/**
|
|
1691
|
-
* Show warning toast message
|
|
1692
|
-
*/
|
|
1693
|
-
protected showWarn(detail: string, summary?: string): void;
|
|
1694
|
-
/**
|
|
1695
|
-
* Translate a key using the adapter, fallback to key if not available.
|
|
1696
|
-
*/
|
|
1697
|
-
protected t(key: string, variables?: Record<string, string | number>): string;
|
|
1698
|
-
/**
|
|
1699
|
-
* Delete an item with confirmation dialog
|
|
1700
|
-
* @param item The item to delete
|
|
1701
|
-
* @param idGetter Function to extract ID from item
|
|
1702
|
-
* @param deleteApiCall Function that returns Observable for delete API call
|
|
1703
|
-
* @param options Optional configuration
|
|
1704
|
-
*/
|
|
1705
|
-
onDelete(item: T, idGetter: (item: T) => string, deleteApiCall: (id: string) => Observable<unknown> | Promise<unknown>, options?: {
|
|
1706
|
-
header?: string;
|
|
1707
|
-
}): void;
|
|
1708
|
-
/**
|
|
1709
|
-
* Delete an item with confirmation dialog using async/await
|
|
1710
|
-
* @param item The item to delete
|
|
1711
|
-
* @param idGetter Function to extract ID from item
|
|
1712
|
-
* @param deleteApiCall Async function for delete API call
|
|
1713
|
-
* @param options Optional configuration
|
|
1714
|
-
*/
|
|
1715
|
-
onDeleteAsync(item: T, idGetter: (item: T) => string, deleteApiCall: (id: string) => Promise<unknown>, options?: {
|
|
1716
|
-
header?: string;
|
|
1717
|
-
}): Promise<void>;
|
|
1718
|
-
/**
|
|
1719
|
-
* Navigate to a route
|
|
1720
|
-
*/
|
|
1721
|
-
protected navigateTo(path: string[]): void;
|
|
1722
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseListPage<any>, never>;
|
|
1723
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BaseListPage<any>, never, never, {}, {}, never, never, true, never>;
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
1622
|
declare function localToUtc(dateStr: string, timeStr: string, timezone: string): Date;
|
|
1727
1623
|
declare function utcToLocal(utcDate: Date | string, timezone: string): {
|
|
1728
1624
|
date: string;
|
|
@@ -1782,5 +1678,5 @@ interface ScrollPaginationConfig {
|
|
|
1782
1678
|
*/
|
|
1783
1679
|
declare function checkScrollPagination(event: Event, config: ScrollPaginationConfig): IPagination | null;
|
|
1784
1680
|
|
|
1785
|
-
export { ACTION_PERMISSIONS, AUTH_STATE_PROVIDER, AngularModule, ApiResourceService, ApiResourceService as ApiService, BRANCH_PERMISSIONS, BaseFormControl,
|
|
1786
|
-
export type { DeleteType, FilesResponseDto, IActionNode, IActivatable, IApiService, IAuthStateProvider, IBaseEntity, IBulkMeta, IBulkResponse, ICompanyApiProvider, ICompanyBasicInfo, IDeleteData, IDropDown, IFileBasicInfo, IFileProvider, IFileSelectFilter, IFileUploadOptions, IFilter, IFilterData, IFolderBasicInfo, IGroupNode, IListResponse, ILoggedUserInfo, ILogicNode, IMessageResponse, IOrderable, IPagination, IPaginationMeta, IProfileActionInfo, IProfilePermissionProvider, IProfileRoleInfo, IRequestMeta, IResolverModuleConfig, ISelectFilter, ISingleResponse, ISoftDeletable, ISort, IStorageConfigBasicInfo, ITimestampable, IUploadedFile, IUserBasicInfo, IUserBranchPermission, IUserPermissionProvider, IUserProvider, IUserSelectFilter, LoadUsersFn, PermissionCode, ScrollPaginationConfig, UploadFileFn, UploadMultipleFilesFn };
|
|
1681
|
+
export { ACTION_PERMISSIONS, AUTH_STATE_PROVIDER, AngularModule, 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, PrimeModule, ROLE_ACTION_PERMISSIONS, ROLE_PERMISSIONS, SHARED_MESSAGES, SKIP_ERROR_TOAST, 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, checkScrollPagination, errorCatchingInterceptor, evaluateLogicNode, evaluatePermission, formatFileSize, formatInTimezone, getAcceptString, getFileIconClass, getUserTimezone, hasAllPermissions, hasAnyPermission, hasPermission, isFileTypeAllowed, localToUtc, permissionGuard, provideValueAccessor, resolveTranslationModule, utcToLocal };
|
|
1682
|
+
export type { ActionSeverity, DeleteType, FilesResponseDto, FormFieldType, IActionNode, IActivatable, IApiService, IAuthStateProvider, IBaseEntity, 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, IUserPermissionProvider, IUserProvider, IUserSelectFilter, LoadUsersFn, PermissionCode, ScrollPaginationConfig, TableColumnType, UploadFileFn, UploadMultipleFilesFn };
|