@flusys/ng-shared 3.0.0 → 3.0.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/README.md +282 -344
- package/fesm2022/flusys-ng-shared.mjs +113 -232
- package/fesm2022/flusys-ng-shared.mjs.map +1 -1
- package/package.json +2 -2
- package/types/flusys-ng-shared.d.ts +57 -182
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, PLATFORM_ID, Injectable, DOCUMENT, REQUEST, signal, computed, ElementRef, input, effect, Directive, TemplateRef, ViewContainerRef, output, NgModule, Injector, runInInjectionContext, resource, model, untracked, forwardRef, ChangeDetectionStrategy, Component,
|
|
3
|
-
import
|
|
4
|
-
import { isPlatformServer, CommonModule, NgOptimizedImage, NgComponentOutlet, DatePipe } from '@angular/common';
|
|
2
|
+
import { inject, PLATFORM_ID, Injectable, DOCUMENT, REQUEST, signal, computed, ElementRef, input, effect, Directive, TemplateRef, ViewContainerRef, output, NgModule, Injector, runInInjectionContext, resource, model, untracked, forwardRef, ChangeDetectionStrategy, Component, ApplicationRef, viewChild, afterNextRender, ViewEncapsulation, DestroyRef, InjectionToken, isDevMode } from '@angular/core';
|
|
3
|
+
import { isPlatformServer, CommonModule, NgOptimizedImage, NgComponentOutlet, DatePipe, DOCUMENT as DOCUMENT$1 } from '@angular/common';
|
|
5
4
|
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
|
6
5
|
import { APP_CONFIG, getServiceUrl } from '@flusys/ng-core';
|
|
7
6
|
import { of, firstValueFrom, map as map$1 } from 'rxjs';
|
|
@@ -38,7 +37,7 @@ import * as i2$1 from 'primeng/progressbar';
|
|
|
38
37
|
import { ProgressBarModule } from 'primeng/progressbar';
|
|
39
38
|
import { RadioButtonModule } from 'primeng/radiobutton';
|
|
40
39
|
import { RippleModule } from 'primeng/ripple';
|
|
41
|
-
import * as i3
|
|
40
|
+
import * as i3 from 'primeng/select';
|
|
42
41
|
import { SelectModule } from 'primeng/select';
|
|
43
42
|
import { SelectButtonModule } from 'primeng/selectbutton';
|
|
44
43
|
import { SkeletonModule } from 'primeng/skeleton';
|
|
@@ -49,23 +48,15 @@ import { TabsModule } from 'primeng/tabs';
|
|
|
49
48
|
import { TagModule } from 'primeng/tag';
|
|
50
49
|
import { TextareaModule } from 'primeng/textarea';
|
|
51
50
|
import { ToastModule } from 'primeng/toast';
|
|
51
|
+
import { ToggleButtonModule } from 'primeng/togglebutton';
|
|
52
52
|
import { ToggleSwitchModule } from 'primeng/toggleswitch';
|
|
53
53
|
import { TooltipModule } from 'primeng/tooltip';
|
|
54
54
|
import { TreeTableModule } from 'primeng/treetable';
|
|
55
|
+
import { ProgressSpinnerModule } from 'primeng/progressspinner';
|
|
56
|
+
import { ColorPickerModule } from 'primeng/colorpicker';
|
|
55
57
|
import { MessageService, ConfirmationService } from 'primeng/api';
|
|
56
58
|
import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
57
59
|
|
|
58
|
-
/**
|
|
59
|
-
* Centralized Permission Codes
|
|
60
|
-
*
|
|
61
|
-
* Single source of truth for all permission codes used across the application.
|
|
62
|
-
* Use these constants instead of hardcoded strings to prevent typos and enable easy refactoring.
|
|
63
|
-
*
|
|
64
|
-
* Naming Convention: <entity>.<action>
|
|
65
|
-
* - entity: The resource being accessed (e.g., user, role, company)
|
|
66
|
-
* - action: The operation being performed (create, read, update, delete, assign)
|
|
67
|
-
*/
|
|
68
|
-
// ==================== AUTH MODULE ====================
|
|
69
60
|
const USER_PERMISSIONS = {
|
|
70
61
|
CREATE: 'user.create',
|
|
71
62
|
READ: 'user.read',
|
|
@@ -84,7 +75,6 @@ const BRANCH_PERMISSIONS = {
|
|
|
84
75
|
UPDATE: 'branch.update',
|
|
85
76
|
DELETE: 'branch.delete',
|
|
86
77
|
};
|
|
87
|
-
// ==================== IAM MODULE ====================
|
|
88
78
|
const ACTION_PERMISSIONS = {
|
|
89
79
|
CREATE: 'action.create',
|
|
90
80
|
READ: 'action.read',
|
|
@@ -113,7 +103,6 @@ const COMPANY_ACTION_PERMISSIONS = {
|
|
|
113
103
|
READ: 'company-action.read',
|
|
114
104
|
ASSIGN: 'company-action.assign',
|
|
115
105
|
};
|
|
116
|
-
// ==================== STORAGE MODULE ====================
|
|
117
106
|
const FILE_PERMISSIONS = {
|
|
118
107
|
CREATE: 'file.create',
|
|
119
108
|
READ: 'file.read',
|
|
@@ -132,7 +121,6 @@ const STORAGE_CONFIG_PERMISSIONS = {
|
|
|
132
121
|
UPDATE: 'storage-config.update',
|
|
133
122
|
DELETE: 'storage-config.delete',
|
|
134
123
|
};
|
|
135
|
-
// ==================== EMAIL MODULE ====================
|
|
136
124
|
const EMAIL_CONFIG_PERMISSIONS = {
|
|
137
125
|
CREATE: 'email-config.create',
|
|
138
126
|
READ: 'email-config.read',
|
|
@@ -145,38 +133,49 @@ const EMAIL_TEMPLATE_PERMISSIONS = {
|
|
|
145
133
|
UPDATE: 'email-template.update',
|
|
146
134
|
DELETE: 'email-template.delete',
|
|
147
135
|
};
|
|
148
|
-
// ==================== FORM BUILDER MODULE ====================
|
|
149
136
|
const FORM_PERMISSIONS = {
|
|
150
137
|
CREATE: 'form.create',
|
|
151
138
|
READ: 'form.read',
|
|
152
139
|
UPDATE: 'form.update',
|
|
153
140
|
DELETE: 'form.delete',
|
|
154
141
|
};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
142
|
+
const EVENT_PERMISSIONS = {
|
|
143
|
+
CREATE: 'event.create',
|
|
144
|
+
READ: 'event.read',
|
|
145
|
+
UPDATE: 'event.update',
|
|
146
|
+
DELETE: 'event.delete',
|
|
147
|
+
};
|
|
148
|
+
const EVENT_PARTICIPANT_PERMISSIONS = {
|
|
149
|
+
CREATE: 'event-participant.create',
|
|
150
|
+
READ: 'event-participant.read',
|
|
151
|
+
UPDATE: 'event-participant.update',
|
|
152
|
+
DELETE: 'event-participant.delete',
|
|
153
|
+
};
|
|
154
|
+
const NOTIFICATION_PERMISSIONS = {
|
|
155
|
+
CREATE: 'notification.create',
|
|
156
|
+
READ: 'notification.read',
|
|
157
|
+
UPDATE: 'notification.update',
|
|
158
|
+
DELETE: 'notification.delete',
|
|
159
|
+
};
|
|
159
160
|
const PERMISSIONS = {
|
|
160
|
-
// Auth
|
|
161
161
|
USER: USER_PERMISSIONS,
|
|
162
162
|
COMPANY: COMPANY_PERMISSIONS,
|
|
163
163
|
BRANCH: BRANCH_PERMISSIONS,
|
|
164
|
-
// IAM
|
|
165
164
|
ACTION: ACTION_PERMISSIONS,
|
|
166
165
|
ROLE: ROLE_PERMISSIONS,
|
|
167
166
|
ROLE_ACTION: ROLE_ACTION_PERMISSIONS,
|
|
168
167
|
USER_ROLE: USER_ROLE_PERMISSIONS,
|
|
169
168
|
USER_ACTION: USER_ACTION_PERMISSIONS,
|
|
170
169
|
COMPANY_ACTION: COMPANY_ACTION_PERMISSIONS,
|
|
171
|
-
// Storage
|
|
172
170
|
FILE: FILE_PERMISSIONS,
|
|
173
171
|
FOLDER: FOLDER_PERMISSIONS,
|
|
174
172
|
STORAGE_CONFIG: STORAGE_CONFIG_PERMISSIONS,
|
|
175
|
-
// Email
|
|
176
173
|
EMAIL_CONFIG: EMAIL_CONFIG_PERMISSIONS,
|
|
177
174
|
EMAIL_TEMPLATE: EMAIL_TEMPLATE_PERMISSIONS,
|
|
178
|
-
// Form Builder
|
|
179
175
|
FORM: FORM_PERMISSIONS,
|
|
176
|
+
EVENT: EVENT_PERMISSIONS,
|
|
177
|
+
EVENT_PARTICIPANT: EVENT_PARTICIPANT_PERMISSIONS,
|
|
178
|
+
NOTIFICATION: NOTIFICATION_PERMISSIONS,
|
|
180
179
|
};
|
|
181
180
|
|
|
182
181
|
/**
|
|
@@ -814,9 +813,12 @@ class PrimeModule {
|
|
|
814
813
|
TagModule,
|
|
815
814
|
TextareaModule,
|
|
816
815
|
ToastModule,
|
|
816
|
+
ToggleButtonModule,
|
|
817
817
|
ToggleSwitchModule,
|
|
818
818
|
TooltipModule,
|
|
819
|
-
TreeTableModule
|
|
819
|
+
TreeTableModule,
|
|
820
|
+
ProgressSpinnerModule,
|
|
821
|
+
ColorPickerModule] });
|
|
820
822
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: PrimeModule, imports: [AutoCompleteModule,
|
|
821
823
|
AvatarModule,
|
|
822
824
|
ButtonModule,
|
|
@@ -851,9 +853,12 @@ class PrimeModule {
|
|
|
851
853
|
TagModule,
|
|
852
854
|
TextareaModule,
|
|
853
855
|
ToastModule,
|
|
856
|
+
ToggleButtonModule,
|
|
854
857
|
ToggleSwitchModule,
|
|
855
858
|
TooltipModule,
|
|
856
|
-
TreeTableModule
|
|
859
|
+
TreeTableModule,
|
|
860
|
+
ProgressSpinnerModule,
|
|
861
|
+
ColorPickerModule] });
|
|
857
862
|
}
|
|
858
863
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: PrimeModule, decorators: [{
|
|
859
864
|
type: NgModule,
|
|
@@ -893,64 +898,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
893
898
|
TagModule,
|
|
894
899
|
TextareaModule,
|
|
895
900
|
ToastModule,
|
|
901
|
+
ToggleButtonModule,
|
|
896
902
|
ToggleSwitchModule,
|
|
897
903
|
TooltipModule,
|
|
898
904
|
TreeTableModule,
|
|
905
|
+
ProgressSpinnerModule,
|
|
906
|
+
ColorPickerModule,
|
|
899
907
|
],
|
|
900
908
|
}]
|
|
901
909
|
}] });
|
|
902
910
|
|
|
903
|
-
// =============================================================================
|
|
904
|
-
// API Resource Service - Signal-based CRUD with Angular Resource API
|
|
905
|
-
// =============================================================================
|
|
906
911
|
/**
|
|
907
912
|
* Abstract base class for API services using Angular 21 resource() API.
|
|
908
913
|
* Provides signal-based reactive data fetching with automatic loading states.
|
|
909
|
-
* Response types match FLUSYS_NEST backend DTOs.
|
|
910
|
-
*
|
|
911
|
-
* ## Endpoint Mapping
|
|
912
|
-
*
|
|
913
|
-
* All endpoints use POST method (RPC-style API):
|
|
914
|
-
* - `POST /{resource}/insert` - Create single item
|
|
915
|
-
* - `POST /{resource}/insert-many` - Create multiple items
|
|
916
|
-
* - `POST /{resource}/get/:id` - Get single item by ID
|
|
917
|
-
* - `POST /{resource}/get-all?q=` - List with pagination/filter
|
|
918
|
-
* - `POST /{resource}/update` - Update single item
|
|
919
|
-
* - `POST /{resource}/update-many` - Update multiple items
|
|
920
|
-
* - `POST /{resource}/delete` - Delete/restore/permanent delete
|
|
921
914
|
*
|
|
922
915
|
* @example
|
|
923
916
|
* ```typescript
|
|
924
|
-
* // Define service with global apiBaseUrl
|
|
925
917
|
* @Injectable({ providedIn: 'root' })
|
|
926
918
|
* export class UserService extends ApiResourceService<UserDto, User> {
|
|
927
919
|
* constructor() {
|
|
928
920
|
* super('auth/users', inject(HttpClient));
|
|
929
921
|
* }
|
|
930
922
|
* }
|
|
931
|
-
*
|
|
932
|
-
* // Define service with feature-specific baseUrl
|
|
933
|
-
* @Injectable({ providedIn: 'root' })
|
|
934
|
-
* export class FormService extends ApiResourceService<FormDto, Form> {
|
|
935
|
-
* constructor() {
|
|
936
|
-
* super('form', inject(HttpClient), 'formBuilder');
|
|
937
|
-
* // URL: services.formBuilder.baseUrl + '/form'
|
|
938
|
-
* }
|
|
939
|
-
* }
|
|
940
|
-
*
|
|
941
|
-
* // In component - use signals
|
|
942
|
-
* userService = inject(UserService);
|
|
943
|
-
* users = this.userService.data; // Signal<User[]>
|
|
944
|
-
* isLoading = this.userService.isLoading; // Signal<boolean>
|
|
945
|
-
* total = this.userService.total; // Signal<number>
|
|
946
|
-
*
|
|
947
|
-
* // Trigger fetch
|
|
948
|
-
* this.userService.fetchList('search', { pagination: { currentPage: 0, pageSize: 10 } });
|
|
949
|
-
*
|
|
950
|
-
* // CRUD operations
|
|
951
|
-
* await this.userService.insertAsync({ name: 'John', email: 'john@example.com' });
|
|
952
|
-
* await this.userService.updateAsync({ id: '123', name: 'John Updated' });
|
|
953
|
-
* await this.userService.deleteAsync({ id: '123', type: 'delete' });
|
|
954
923
|
* ```
|
|
955
924
|
*/
|
|
956
925
|
class ApiResourceService {
|
|
@@ -958,43 +927,22 @@ class ApiResourceService {
|
|
|
958
927
|
injector = inject(Injector);
|
|
959
928
|
http;
|
|
960
929
|
moduleApiName;
|
|
961
|
-
// ==========================================================================
|
|
962
|
-
// State Signals for List Queries
|
|
963
|
-
// ==========================================================================
|
|
964
|
-
/** Current search term */
|
|
965
930
|
searchTerm = signal('', ...(ngDevMode ? [{ debugName: "searchTerm" }] : []));
|
|
966
|
-
/** Current filter and pagination state */
|
|
967
931
|
filterData = signal({
|
|
968
932
|
pagination: { currentPage: 0, pageSize: 10 },
|
|
969
933
|
filter: {},
|
|
970
934
|
select: [],
|
|
971
935
|
sort: {},
|
|
972
936
|
}, ...(ngDevMode ? [{ debugName: "filterData" }] : []));
|
|
973
|
-
/**
|
|
974
|
-
* Resource for list data - lazy initialized to prevent auto-fetch on service injection.
|
|
975
|
-
* Call initListResource() or any list method (fetchList, reload, etc.) to initialize.
|
|
976
|
-
*/
|
|
977
937
|
_listResource = null;
|
|
978
|
-
/** Whether the list resource has been initialized */
|
|
979
938
|
_resourceInitialized = false;
|
|
980
|
-
/**
|
|
981
|
-
* Signal to track resource initialization for computed signals.
|
|
982
|
-
* This allows computed signals to re-evaluate when the resource is created.
|
|
983
|
-
* Without this, computed signals would not detect when _listResource changes from null.
|
|
984
|
-
*/
|
|
985
939
|
_resourceInitSignal = signal(false, ...(ngDevMode ? [{ debugName: "_resourceInitSignal" }] : []));
|
|
986
|
-
/** Get or create the list resource (lazy initialization) */
|
|
987
940
|
get listResource() {
|
|
988
941
|
if (!this._listResource) {
|
|
989
942
|
this.initListResource();
|
|
990
943
|
}
|
|
991
944
|
return this._listResource;
|
|
992
945
|
}
|
|
993
|
-
/**
|
|
994
|
-
* Initialize the list resource. Called automatically when accessing listResource
|
|
995
|
-
* or any list-related computed signals/methods.
|
|
996
|
-
* Uses runInInjectionContext to support lazy initialization outside constructor.
|
|
997
|
-
*/
|
|
998
946
|
initListResource() {
|
|
999
947
|
if (this._resourceInitialized)
|
|
1000
948
|
return;
|
|
@@ -1004,88 +952,49 @@ class ApiResourceService {
|
|
|
1004
952
|
search: this.searchTerm(),
|
|
1005
953
|
filter: this.filterData(),
|
|
1006
954
|
}),
|
|
1007
|
-
loader: async ({ params }) =>
|
|
1008
|
-
const { search, filter } = params;
|
|
1009
|
-
return this.fetchAllAsync(search, filter);
|
|
1010
|
-
} });
|
|
955
|
+
loader: async ({ params }) => this.getAllAsync(params.filter, params.search) });
|
|
1011
956
|
});
|
|
1012
|
-
// Signal that resource is now initialized - triggers computed re-evaluation
|
|
1013
957
|
this._resourceInitSignal.set(true);
|
|
1014
958
|
}
|
|
1015
|
-
// ==========================================================================
|
|
1016
|
-
// Computed State Accessors
|
|
1017
|
-
// ==========================================================================
|
|
1018
|
-
/**
|
|
1019
|
-
* Whether data is currently loading.
|
|
1020
|
-
* Tracks _resourceInitSignal to re-evaluate when resource is created.
|
|
1021
|
-
*/
|
|
1022
959
|
isLoading = computed(() => {
|
|
1023
|
-
this._resourceInitSignal();
|
|
960
|
+
this._resourceInitSignal();
|
|
1024
961
|
return this._listResource?.isLoading() ?? false;
|
|
1025
962
|
}, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
|
|
1026
|
-
/**
|
|
1027
|
-
* List data array.
|
|
1028
|
-
* Tracks _resourceInitSignal to re-evaluate when resource is created.
|
|
1029
|
-
*/
|
|
1030
963
|
data = computed(() => {
|
|
1031
|
-
this._resourceInitSignal();
|
|
964
|
+
this._resourceInitSignal();
|
|
1032
965
|
return this._listResource?.value()?.data ?? [];
|
|
1033
966
|
}, ...(ngDevMode ? [{ debugName: "data" }] : []));
|
|
1034
|
-
/**
|
|
1035
|
-
* Total count of items.
|
|
1036
|
-
* Tracks _resourceInitSignal to re-evaluate when resource is created.
|
|
1037
|
-
*/
|
|
1038
967
|
total = computed(() => {
|
|
1039
|
-
this._resourceInitSignal();
|
|
968
|
+
this._resourceInitSignal();
|
|
1040
969
|
return this._listResource?.value()?.meta?.total ?? 0;
|
|
1041
970
|
}, ...(ngDevMode ? [{ debugName: "total" }] : []));
|
|
1042
|
-
/**
|
|
1043
|
-
* Pagination metadata.
|
|
1044
|
-
* Tracks _resourceInitSignal to re-evaluate when resource is created.
|
|
1045
|
-
*/
|
|
1046
971
|
pageInfo = computed(() => {
|
|
1047
|
-
this._resourceInitSignal();
|
|
972
|
+
this._resourceInitSignal();
|
|
1048
973
|
return this._listResource?.value()?.meta;
|
|
1049
974
|
}, ...(ngDevMode ? [{ debugName: "pageInfo" }] : []));
|
|
1050
|
-
/**
|
|
1051
|
-
* Whether there are more pages.
|
|
1052
|
-
* Tracks _resourceInitSignal to re-evaluate when resource is created.
|
|
1053
|
-
*/
|
|
1054
975
|
hasMore = computed(() => {
|
|
1055
|
-
this._resourceInitSignal();
|
|
976
|
+
this._resourceInitSignal();
|
|
1056
977
|
const meta = this._listResource?.value()?.meta;
|
|
1057
978
|
if (!meta)
|
|
1058
979
|
return false;
|
|
1059
980
|
return meta.hasMore ?? (meta.page + 1) * meta.pageSize < meta.total;
|
|
1060
981
|
}, ...(ngDevMode ? [{ debugName: "hasMore" }] : []));
|
|
1061
|
-
/**
|
|
1062
|
-
* @param moduleApiName - The API resource path (e.g., 'form' for /form-builder/form)
|
|
1063
|
-
* @param http - HttpClient instance
|
|
1064
|
-
* @param serviceName - Optional service name for feature-specific base URL (e.g., 'formBuilder')
|
|
1065
|
-
*/
|
|
1066
982
|
constructor(moduleApiName, http, serviceName) {
|
|
1067
|
-
this.moduleApiName = moduleApiName;
|
|
983
|
+
this.moduleApiName = moduleApiName || serviceName || 'api';
|
|
1068
984
|
const config = inject(APP_CONFIG);
|
|
1069
|
-
// Use service-specific URL if provided, otherwise fallback to global apiBaseUrl
|
|
1070
985
|
const serviceBaseUrl = serviceName ? getServiceUrl(config, serviceName) : config.apiBaseUrl;
|
|
1071
|
-
this.baseUrl = `${serviceBaseUrl}/${moduleApiName}
|
|
986
|
+
this.baseUrl = moduleApiName ? `${serviceBaseUrl}/${moduleApiName}` : serviceBaseUrl;
|
|
1072
987
|
this.http = http;
|
|
1073
|
-
// Resource is now lazy-initialized, not created in constructor
|
|
1074
988
|
}
|
|
1075
989
|
getHttpOptions(endpoint, params) {
|
|
1076
990
|
return {
|
|
1077
|
-
headers: new HttpHeaders({
|
|
1078
|
-
'x-loader-tag': `${this.moduleApiName}/${endpoint}`,
|
|
1079
|
-
}),
|
|
991
|
+
headers: new HttpHeaders({ 'x-loader-tag': `${this.moduleApiName}/${endpoint}` }),
|
|
1080
992
|
...(params ? { params } : {}),
|
|
1081
993
|
};
|
|
1082
994
|
}
|
|
1083
995
|
// ==========================================================================
|
|
1084
|
-
// List Management
|
|
996
|
+
// List Management
|
|
1085
997
|
// ==========================================================================
|
|
1086
|
-
/**
|
|
1087
|
-
* Fetch list data (triggers resource initialization and reload)
|
|
1088
|
-
*/
|
|
1089
998
|
fetchList(search = '', filter) {
|
|
1090
999
|
this.initListResource();
|
|
1091
1000
|
this.searchTerm.set(search);
|
|
@@ -1093,16 +1002,10 @@ class ApiResourceService {
|
|
|
1093
1002
|
this.filterData.update((prev) => ({ ...prev, ...filter }));
|
|
1094
1003
|
}
|
|
1095
1004
|
}
|
|
1096
|
-
/**
|
|
1097
|
-
* Update pagination
|
|
1098
|
-
*/
|
|
1099
1005
|
setPagination(pagination) {
|
|
1100
1006
|
this.initListResource();
|
|
1101
1007
|
this.filterData.update((prev) => ({ ...prev, pagination }));
|
|
1102
1008
|
}
|
|
1103
|
-
/**
|
|
1104
|
-
* Go to next page
|
|
1105
|
-
*/
|
|
1106
1009
|
nextPage() {
|
|
1107
1010
|
this.initListResource();
|
|
1108
1011
|
this.filterData.update((prev) => ({
|
|
@@ -1113,9 +1016,6 @@ class ApiResourceService {
|
|
|
1113
1016
|
},
|
|
1114
1017
|
}));
|
|
1115
1018
|
}
|
|
1116
|
-
/**
|
|
1117
|
-
* Reset to first page
|
|
1118
|
-
*/
|
|
1119
1019
|
resetPagination() {
|
|
1120
1020
|
this.initListResource();
|
|
1121
1021
|
this.filterData.update((prev) => ({
|
|
@@ -1123,42 +1023,21 @@ class ApiResourceService {
|
|
|
1123
1023
|
pagination: { currentPage: 0, pageSize: prev.pagination?.pageSize ?? 10 },
|
|
1124
1024
|
}));
|
|
1125
1025
|
}
|
|
1126
|
-
/**
|
|
1127
|
-
* Reload current data
|
|
1128
|
-
*/
|
|
1129
1026
|
reload() {
|
|
1130
|
-
|
|
1131
|
-
this._listResource.reload();
|
|
1132
|
-
}
|
|
1027
|
+
this._listResource?.reload();
|
|
1133
1028
|
}
|
|
1134
1029
|
// ==========================================================================
|
|
1135
|
-
// Observable
|
|
1030
|
+
// Observable API (IApiService interface)
|
|
1136
1031
|
// ==========================================================================
|
|
1137
|
-
/**
|
|
1138
|
-
* Insert single item (Observable)
|
|
1139
|
-
* POST /{resource}/insert
|
|
1140
|
-
*/
|
|
1141
1032
|
insert(dto) {
|
|
1142
1033
|
return this.http.post(`${this.baseUrl}/insert`, dto, this.getHttpOptions('insert'));
|
|
1143
1034
|
}
|
|
1144
|
-
/**
|
|
1145
|
-
* Insert multiple items (Observable)
|
|
1146
|
-
* POST /{resource}/insert-many
|
|
1147
|
-
*/
|
|
1148
1035
|
insertMany(dtos) {
|
|
1149
1036
|
return this.http.post(`${this.baseUrl}/insert-many`, dtos, this.getHttpOptions('insert-many'));
|
|
1150
1037
|
}
|
|
1151
|
-
/**
|
|
1152
|
-
* Find single item by ID (Observable)
|
|
1153
|
-
* POST /{resource}/get/:id
|
|
1154
|
-
*/
|
|
1155
1038
|
findById(id, select) {
|
|
1156
1039
|
return this.http.post(`${this.baseUrl}/get/${id}`, { select }, this.getHttpOptions(`get/${id}`));
|
|
1157
1040
|
}
|
|
1158
|
-
/**
|
|
1159
|
-
* Get all items with pagination (Observable)
|
|
1160
|
-
* POST /{resource}/get-all?q=search
|
|
1161
|
-
*/
|
|
1162
1041
|
getAll(search, filter) {
|
|
1163
1042
|
let params = new HttpParams();
|
|
1164
1043
|
if (search) {
|
|
@@ -1166,70 +1045,36 @@ class ApiResourceService {
|
|
|
1166
1045
|
}
|
|
1167
1046
|
return this.http.post(`${this.baseUrl}/get-all`, filter, this.getHttpOptions('get-all', params));
|
|
1168
1047
|
}
|
|
1169
|
-
/**
|
|
1170
|
-
* Update single item (Observable)
|
|
1171
|
-
* POST /{resource}/update
|
|
1172
|
-
*/
|
|
1173
1048
|
update(dto) {
|
|
1174
1049
|
return this.http.post(`${this.baseUrl}/update`, dto, this.getHttpOptions('update'));
|
|
1175
1050
|
}
|
|
1176
|
-
/**
|
|
1177
|
-
* Update multiple items (Observable)
|
|
1178
|
-
* POST /{resource}/update-many
|
|
1179
|
-
*/
|
|
1180
1051
|
updateMany(dtos) {
|
|
1181
1052
|
return this.http.post(`${this.baseUrl}/update-many`, dtos, this.getHttpOptions('update-many'));
|
|
1182
1053
|
}
|
|
1183
|
-
/**
|
|
1184
|
-
* Delete items (Observable)
|
|
1185
|
-
* POST /{resource}/delete
|
|
1186
|
-
* @param deleteDto - { id: string | string[], type: 'delete' | 'restore' | 'permanent' }
|
|
1187
|
-
*/
|
|
1188
1054
|
delete(deleteDto) {
|
|
1189
1055
|
return this.http.post(`${this.baseUrl}/delete`, deleteDto, this.getHttpOptions('delete'));
|
|
1190
1056
|
}
|
|
1191
1057
|
// ==========================================================================
|
|
1192
|
-
//
|
|
1058
|
+
// Async API
|
|
1193
1059
|
// ==========================================================================
|
|
1194
|
-
|
|
1195
|
-
* Fetch paginated list (async)
|
|
1196
|
-
*/
|
|
1197
|
-
async fetchAllAsync(search, filter) {
|
|
1060
|
+
async getAllAsync(filter, search = '') {
|
|
1198
1061
|
return firstValueFrom(this.getAll(search, filter));
|
|
1199
1062
|
}
|
|
1200
|
-
/**
|
|
1201
|
-
* Find single item by ID (async)
|
|
1202
|
-
*/
|
|
1203
1063
|
async findByIdAsync(id, select) {
|
|
1204
1064
|
return firstValueFrom(this.findById(id, select));
|
|
1205
1065
|
}
|
|
1206
|
-
/**
|
|
1207
|
-
* Insert single item (async)
|
|
1208
|
-
*/
|
|
1209
1066
|
async insertAsync(dto) {
|
|
1210
1067
|
return firstValueFrom(this.insert(dto));
|
|
1211
1068
|
}
|
|
1212
|
-
/**
|
|
1213
|
-
* Insert multiple items (async)
|
|
1214
|
-
*/
|
|
1215
1069
|
async insertManyAsync(dtos) {
|
|
1216
1070
|
return firstValueFrom(this.insertMany(dtos));
|
|
1217
1071
|
}
|
|
1218
|
-
/**
|
|
1219
|
-
* Update single item (async)
|
|
1220
|
-
*/
|
|
1221
1072
|
async updateAsync(dto) {
|
|
1222
1073
|
return firstValueFrom(this.update(dto));
|
|
1223
1074
|
}
|
|
1224
|
-
/**
|
|
1225
|
-
* Update multiple items (async)
|
|
1226
|
-
*/
|
|
1227
1075
|
async updateManyAsync(dtos) {
|
|
1228
1076
|
return firstValueFrom(this.updateMany(dtos));
|
|
1229
1077
|
}
|
|
1230
|
-
/**
|
|
1231
|
-
* Delete items (async)
|
|
1232
|
-
*/
|
|
1233
1078
|
async deleteAsync(deleteDto) {
|
|
1234
1079
|
return firstValueFrom(this.delete(deleteDto));
|
|
1235
1080
|
}
|
|
@@ -1438,11 +1283,14 @@ function checkScrollPagination(event, config) {
|
|
|
1438
1283
|
* - Signal forms: `[formField]="formTree.field"`
|
|
1439
1284
|
*/
|
|
1440
1285
|
class LazyMultiSelectComponent extends BaseFormControl {
|
|
1441
|
-
|
|
1286
|
+
document = inject(DOCUMENT$1);
|
|
1287
|
+
appRef = inject(ApplicationRef);
|
|
1442
1288
|
onDocumentClickBound = this.handleDocumentClick.bind(this);
|
|
1443
|
-
isDestroyed = false;
|
|
1444
1289
|
// View references
|
|
1445
1290
|
pSelectRef = viewChild.required('pSelect');
|
|
1291
|
+
overlayTemplate = viewChild.required('overlayTpl');
|
|
1292
|
+
// Portal state
|
|
1293
|
+
overlayViewRef = null;
|
|
1446
1294
|
// Inputs
|
|
1447
1295
|
placeHolder = input('Select Options', ...(ngDevMode ? [{ debugName: "placeHolder" }] : []));
|
|
1448
1296
|
isEditMode = input.required(...(ngDevMode ? [{ debugName: "isEditMode" }] : []));
|
|
@@ -1503,16 +1351,16 @@ class LazyMultiSelectComponent extends BaseFormControl {
|
|
|
1503
1351
|
});
|
|
1504
1352
|
});
|
|
1505
1353
|
// Document click listener for closing dropdown
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
afterNextRender(() => {
|
|
1511
|
-
if (!this.isDestroyed) {
|
|
1512
|
-
document.addEventListener('click', this.onDocumentClickBound);
|
|
1513
|
-
}
|
|
1354
|
+
afterNextRender({
|
|
1355
|
+
write: () => {
|
|
1356
|
+
this.document.addEventListener('click', this.onDocumentClickBound);
|
|
1357
|
+
},
|
|
1514
1358
|
});
|
|
1515
1359
|
}
|
|
1360
|
+
ngOnDestroy() {
|
|
1361
|
+
this.document.removeEventListener('click', this.onDocumentClickBound);
|
|
1362
|
+
this.closeOverlay();
|
|
1363
|
+
}
|
|
1516
1364
|
onScroll(event) {
|
|
1517
1365
|
const nextPagination = checkScrollPagination(event, {
|
|
1518
1366
|
pagination: this.pagination(),
|
|
@@ -1523,29 +1371,62 @@ class LazyMultiSelectComponent extends BaseFormControl {
|
|
|
1523
1371
|
this.onPagination.emit(nextPagination);
|
|
1524
1372
|
}
|
|
1525
1373
|
}
|
|
1526
|
-
onSelectClick(
|
|
1527
|
-
if (this.disabled())
|
|
1374
|
+
onSelectClick() {
|
|
1375
|
+
if (this.disabled() || !this.isEditMode())
|
|
1528
1376
|
return;
|
|
1377
|
+
if (this.openOptions()) {
|
|
1378
|
+
this.closeOverlay();
|
|
1379
|
+
}
|
|
1380
|
+
else {
|
|
1381
|
+
this.openOverlay();
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
openOverlay() {
|
|
1529
1385
|
this.pSelectRef()?.nativeElement.classList.add('p-focus');
|
|
1530
|
-
this.openOptions.
|
|
1386
|
+
this.openOptions.set(true);
|
|
1387
|
+
// Create embedded view and append to body (portal pattern)
|
|
1388
|
+
this.overlayViewRef = this.overlayTemplate().createEmbeddedView({});
|
|
1389
|
+
this.appRef.attachView(this.overlayViewRef);
|
|
1390
|
+
const overlayEl = this.overlayViewRef.rootNodes[0];
|
|
1391
|
+
this.document.body.appendChild(overlayEl);
|
|
1392
|
+
// Override positioning for portal (CSS class handles visual styles)
|
|
1393
|
+
const rect = this.pSelectRef()?.nativeElement.getBoundingClientRect();
|
|
1394
|
+
if (rect) {
|
|
1395
|
+
overlayEl.style.cssText = `
|
|
1396
|
+
position: fixed !important;
|
|
1397
|
+
top: ${rect.bottom + 2}px !important;
|
|
1398
|
+
left: ${rect.left}px !important;
|
|
1399
|
+
width: ${rect.width}px !important;
|
|
1400
|
+
max-width: ${rect.width}px !important;
|
|
1401
|
+
min-width: ${rect.width}px !important;
|
|
1402
|
+
z-index: 999999999999 !important;
|
|
1403
|
+
`;
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
closeOverlay() {
|
|
1407
|
+
this.openOptions.set(false);
|
|
1408
|
+
this.pSelectRef()?.nativeElement.classList.remove('p-focus');
|
|
1409
|
+
if (this.overlayViewRef) {
|
|
1410
|
+
this.appRef.detachView(this.overlayViewRef);
|
|
1411
|
+
this.overlayViewRef.destroy();
|
|
1412
|
+
this.overlayViewRef = null;
|
|
1413
|
+
}
|
|
1531
1414
|
}
|
|
1532
1415
|
onOverlayClick(event) {
|
|
1533
1416
|
event.stopPropagation();
|
|
1534
1417
|
}
|
|
1535
1418
|
handleDocumentClick(event) {
|
|
1536
|
-
const
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1419
|
+
const target = event.target;
|
|
1420
|
+
const clickedInSelect = this.pSelectRef()?.nativeElement.contains(target);
|
|
1421
|
+
const clickedInOverlay = this.overlayViewRef?.rootNodes[0]?.contains(target);
|
|
1422
|
+
if (!clickedInSelect && !clickedInOverlay) {
|
|
1423
|
+
this.closeOverlay();
|
|
1540
1424
|
this.markAsTouched();
|
|
1541
1425
|
}
|
|
1542
1426
|
}
|
|
1543
1427
|
isSelected(data) {
|
|
1544
1428
|
return this.value()?.includes(data.value) ?? false;
|
|
1545
1429
|
}
|
|
1546
|
-
key(option) {
|
|
1547
|
-
return option.value;
|
|
1548
|
-
}
|
|
1549
1430
|
selectValue(event, option) {
|
|
1550
1431
|
const previousValue = this.value() ?? [];
|
|
1551
1432
|
if (event.checked) {
|
|
@@ -1570,12 +1451,12 @@ class LazyMultiSelectComponent extends BaseFormControl {
|
|
|
1570
1451
|
this.value.set([]);
|
|
1571
1452
|
}
|
|
1572
1453
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: LazyMultiSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1573
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: LazyMultiSelectComponent, isStandalone: true, selector: "lib-lazy-multi-select", inputs: { placeHolder: { classPropertyName: "placeHolder", publicName: "placeHolder", isSignal: true, isRequired: false, transformFunction: null }, isEditMode: { classPropertyName: "isEditMode", publicName: "isEditMode", isSignal: true, isRequired: true, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: true, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: true, transformFunction: null }, pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: true, transformFunction: null }, selectDataList: { classPropertyName: "selectDataList", publicName: "selectDataList", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", onSearch: "onSearch", onPagination: "onPagination" }, providers: [provideValueAccessor(LazyMultiSelectComponent)], viewQueries: [{ propertyName: "pSelectRef", first: true, predicate: ["pSelect"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div
|
|
1454
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: LazyMultiSelectComponent, isStandalone: true, selector: "lib-lazy-multi-select", inputs: { placeHolder: { classPropertyName: "placeHolder", publicName: "placeHolder", isSignal: true, isRequired: false, transformFunction: null }, isEditMode: { classPropertyName: "isEditMode", publicName: "isEditMode", isSignal: true, isRequired: true, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: true, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: true, transformFunction: null }, pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: true, transformFunction: null }, selectDataList: { classPropertyName: "selectDataList", publicName: "selectDataList", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", onSearch: "onSearch", onPagination: "onPagination" }, providers: [provideValueAccessor(LazyMultiSelectComponent)], viewQueries: [{ propertyName: "pSelectRef", first: true, predicate: ["pSelect"], descendants: true, isSignal: true }, { propertyName: "overlayTemplate", first: true, predicate: ["overlayTpl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"p-select w-full\"\n #pSelect\n (click)=\"onSelectClick()\"\n [class.p-disabled]=\"disabled()\"\n [class.edit-mode-element-css]=\"!isEditMode()\"\n [class.overflow-hidden]=\"!isEditMode()\"\n>\n @if (selectedValueDisplay()) {\n <span class=\"p-select-label\" [class.edit-mode-element-css]=\"!isEditMode()\">\n {{ selectedValueDisplay() }}\n </span>\n } @else {\n <span class=\"p-select-label p-placeholder\">{{ placeHolder() }}</span>\n }\n\n @if (isEditMode()) {\n <span class=\"p-select-clear-icon\" (click)=\"clear($event)\">\n <i class=\"pi pi-times\"></i>\n </span>\n\n <div class=\"p-select-dropdown\">\n <span class=\"p-select-dropdown-icon flex items-center\">\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"p-multiselect-dropdown-icon p-icon\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M7.01744 10.398C6.91269 10.3985 6.8089 10.378 6.71215 10.3379C6.61541 10.2977 6.52766 10.2386 6.45405 10.1641L1.13907 4.84913C1.03306 4.69404 0.985221 4.5065 1.00399 4.31958C1.02276 4.13266 1.10693 3.95838 1.24166 3.82747C1.37639 3.69655 1.55301 3.61742 1.74039 3.60402C1.92777 3.59062 2.11386 3.64382 2.26584 3.75424L7.01744 8.47394L11.769 3.75424C11.9189 3.65709 12.097 3.61306 12.2748 3.62921C12.4527 3.64535 12.6199 3.72073 12.7498 3.84328C12.8797 3.96582 12.9647 4.12842 12.9912 4.30502C13.0177 4.48162 12.9841 4.662 12.8958 4.81724L7.58083 10.1322C7.50996 10.2125 7.42344 10.2775 7.32656 10.3232C7.22968 10.3689 7.12449 10.3944 7.01744 10.398Z\"\n fill=\"currentColor\"\n />\n </svg>\n </span>\n </div>\n }\n</div>\n\n<ng-template #overlayTpl>\n <div class=\"p-select-overlay\" (click)=\"onOverlayClick($event)\">\n <div class=\"p-select-header flex flex-row gap-2 items-center\">\n <p-checkbox\n [binary]=\"true\"\n [ngModel]=\"isSelectAll()\"\n [disabled]=\"disabled()\"\n (onChange)=\"changeSelectAll($event)\"\n />\n <input\n type=\"text\"\n pInputText\n class=\"w-full\"\n placeholder=\"Search...\"\n [ngModel]=\"searchTerm()\"\n (ngModelChange)=\"searchTerm.set($event)\"\n />\n </div>\n <div class=\"p-select-list-container\" (scroll)=\"onScroll($event)\">\n <ul class=\"p-select-list\">\n @for (data of selectDataList(); track data.value) {\n <li\n class=\"p-select-option flex flex-row gap-2 items-center\"\n [class.p-select-option-selected]=\"isSelected(data)\"\n >\n <p-checkbox\n [binary]=\"true\"\n [ngModel]=\"isSelected(data)\"\n [disabled]=\"disabled()\"\n (onChange)=\"selectValue($event, data)\"\n />\n <span>{{ data.label }}</span>\n </li>\n }\n </ul>\n </div>\n </div>\n</ng-template>\n", styles: [".p-select-overlay{display:flex;flex-direction:column;max-height:250px;overflow:hidden}.p-select-header{padding:.75rem;border-bottom:1px solid var(--p-surface-border);background:var(--p-content-hover-background);flex-shrink:0;width:100%;box-sizing:border-box}.p-select-header input{background:var(--p-form-field-background);border-color:var(--p-form-field-border-color);color:var(--p-text-color)}.p-select-header input::placeholder{color:var(--p-text-muted-color)}.p-select-list-container{flex:1;overflow-y:auto;min-height:0;width:100%}.p-select-list{margin:0;padding:.25rem 0;list-style:none;background:var(--p-surface-overlay);color:var(--p-text-color);width:100%}.p-select-option{padding:.5rem .75rem;cursor:pointer;transition:background-color .2s ease;color:var(--p-text-color)}.p-select-option:hover{background:var(--p-content-hover-background)}.p-select-option.p-select-option-selected{background:var(--p-highlight-background);color:var(--p-highlight-color)}.p-select-option.p-select-option-selected:hover{background:var(--p-highlight-focus-background);color:var(--p-highlight-focus-color)}.p-select-clear-icon{display:flex;align-items:center;padding:0 .5rem;color:var(--p-text-muted-color);cursor:pointer;transition:color .2s ease}.p-select-clear-icon:hover{color:var(--p-text-color)}\n"], dependencies: [{ kind: "ngmodule", type: PrimeModule }, { kind: "component", type: i1.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["hostName", "value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "styleClass", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "directive", type: i2.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: AngularModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1574
1455
|
}
|
|
1575
1456
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: LazyMultiSelectComponent, decorators: [{
|
|
1576
1457
|
type: Component,
|
|
1577
|
-
args: [{ selector: 'lib-lazy-multi-select', imports: [PrimeModule, AngularModule], changeDetection: ChangeDetectionStrategy.OnPush, providers: [provideValueAccessor(LazyMultiSelectComponent)], template: "<div
|
|
1578
|
-
}], ctorParameters: () => [], propDecorators: { pSelectRef: [{ type: i0.ViewChild, args: ['pSelect', { isSignal: true }] }], placeHolder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeHolder", required: false }] }], isEditMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "isEditMode", required: true }] }], isLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "isLoading", required: true }] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: true }] }], pagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "pagination", required: true }] }], selectDataList: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectDataList", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], onSearch: [{ type: i0.Output, args: ["onSearch"] }], onPagination: [{ type: i0.Output, args: ["onPagination"] }] } });
|
|
1458
|
+
args: [{ selector: 'lib-lazy-multi-select', imports: [PrimeModule, AngularModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [provideValueAccessor(LazyMultiSelectComponent)], template: "<div\n class=\"p-select w-full\"\n #pSelect\n (click)=\"onSelectClick()\"\n [class.p-disabled]=\"disabled()\"\n [class.edit-mode-element-css]=\"!isEditMode()\"\n [class.overflow-hidden]=\"!isEditMode()\"\n>\n @if (selectedValueDisplay()) {\n <span class=\"p-select-label\" [class.edit-mode-element-css]=\"!isEditMode()\">\n {{ selectedValueDisplay() }}\n </span>\n } @else {\n <span class=\"p-select-label p-placeholder\">{{ placeHolder() }}</span>\n }\n\n @if (isEditMode()) {\n <span class=\"p-select-clear-icon\" (click)=\"clear($event)\">\n <i class=\"pi pi-times\"></i>\n </span>\n\n <div class=\"p-select-dropdown\">\n <span class=\"p-select-dropdown-icon flex items-center\">\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"p-multiselect-dropdown-icon p-icon\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M7.01744 10.398C6.91269 10.3985 6.8089 10.378 6.71215 10.3379C6.61541 10.2977 6.52766 10.2386 6.45405 10.1641L1.13907 4.84913C1.03306 4.69404 0.985221 4.5065 1.00399 4.31958C1.02276 4.13266 1.10693 3.95838 1.24166 3.82747C1.37639 3.69655 1.55301 3.61742 1.74039 3.60402C1.92777 3.59062 2.11386 3.64382 2.26584 3.75424L7.01744 8.47394L11.769 3.75424C11.9189 3.65709 12.097 3.61306 12.2748 3.62921C12.4527 3.64535 12.6199 3.72073 12.7498 3.84328C12.8797 3.96582 12.9647 4.12842 12.9912 4.30502C13.0177 4.48162 12.9841 4.662 12.8958 4.81724L7.58083 10.1322C7.50996 10.2125 7.42344 10.2775 7.32656 10.3232C7.22968 10.3689 7.12449 10.3944 7.01744 10.398Z\"\n fill=\"currentColor\"\n />\n </svg>\n </span>\n </div>\n }\n</div>\n\n<ng-template #overlayTpl>\n <div class=\"p-select-overlay\" (click)=\"onOverlayClick($event)\">\n <div class=\"p-select-header flex flex-row gap-2 items-center\">\n <p-checkbox\n [binary]=\"true\"\n [ngModel]=\"isSelectAll()\"\n [disabled]=\"disabled()\"\n (onChange)=\"changeSelectAll($event)\"\n />\n <input\n type=\"text\"\n pInputText\n class=\"w-full\"\n placeholder=\"Search...\"\n [ngModel]=\"searchTerm()\"\n (ngModelChange)=\"searchTerm.set($event)\"\n />\n </div>\n <div class=\"p-select-list-container\" (scroll)=\"onScroll($event)\">\n <ul class=\"p-select-list\">\n @for (data of selectDataList(); track data.value) {\n <li\n class=\"p-select-option flex flex-row gap-2 items-center\"\n [class.p-select-option-selected]=\"isSelected(data)\"\n >\n <p-checkbox\n [binary]=\"true\"\n [ngModel]=\"isSelected(data)\"\n [disabled]=\"disabled()\"\n (onChange)=\"selectValue($event, data)\"\n />\n <span>{{ data.label }}</span>\n </li>\n }\n </ul>\n </div>\n </div>\n</ng-template>\n", styles: [".p-select-overlay{display:flex;flex-direction:column;max-height:250px;overflow:hidden}.p-select-header{padding:.75rem;border-bottom:1px solid var(--p-surface-border);background:var(--p-content-hover-background);flex-shrink:0;width:100%;box-sizing:border-box}.p-select-header input{background:var(--p-form-field-background);border-color:var(--p-form-field-border-color);color:var(--p-text-color)}.p-select-header input::placeholder{color:var(--p-text-muted-color)}.p-select-list-container{flex:1;overflow-y:auto;min-height:0;width:100%}.p-select-list{margin:0;padding:.25rem 0;list-style:none;background:var(--p-surface-overlay);color:var(--p-text-color);width:100%}.p-select-option{padding:.5rem .75rem;cursor:pointer;transition:background-color .2s ease;color:var(--p-text-color)}.p-select-option:hover{background:var(--p-content-hover-background)}.p-select-option.p-select-option-selected{background:var(--p-highlight-background);color:var(--p-highlight-color)}.p-select-option.p-select-option-selected:hover{background:var(--p-highlight-focus-background);color:var(--p-highlight-focus-color)}.p-select-clear-icon{display:flex;align-items:center;padding:0 .5rem;color:var(--p-text-muted-color);cursor:pointer;transition:color .2s ease}.p-select-clear-icon:hover{color:var(--p-text-color)}\n"] }]
|
|
1459
|
+
}], ctorParameters: () => [], propDecorators: { pSelectRef: [{ type: i0.ViewChild, args: ['pSelect', { isSignal: true }] }], overlayTemplate: [{ type: i0.ViewChild, args: ['overlayTpl', { isSignal: true }] }], placeHolder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeHolder", required: false }] }], isEditMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "isEditMode", required: true }] }], isLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "isLoading", required: true }] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: true }] }], pagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "pagination", required: true }] }], selectDataList: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectDataList", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], onSearch: [{ type: i0.Output, args: ["onSearch"] }], onPagination: [{ type: i0.Output, args: ["onPagination"] }] } });
|
|
1579
1460
|
|
|
1580
1461
|
/**
|
|
1581
1462
|
* Lazy-loading single select component with search and pagination.
|
|
@@ -1677,7 +1558,7 @@ class LazySelectComponent extends BaseFormControl {
|
|
|
1677
1558
|
this.markAsTouched();
|
|
1678
1559
|
}
|
|
1679
1560
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: LazySelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1680
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.1.5", type: LazySelectComponent, isStandalone: true, selector: "lib-lazy-select", inputs: { placeHolder: { classPropertyName: "placeHolder", publicName: "placeHolder", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: true, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: true, transformFunction: null }, isEditMode: { classPropertyName: "isEditMode", publicName: "isEditMode", isSignal: true, isRequired: true, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: true, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: true, transformFunction: null }, pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: true, transformFunction: null }, selectDataList: { classPropertyName: "selectDataList", publicName: "selectDataList", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", onSearch: "onSearch", onPagination: "onPagination" }, providers: [provideValueAccessor(LazySelectComponent)], viewQueries: [{ propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div #scrollContainer class=\"lib-scroll-container\">\n <p-select\n class=\"w-full\"\n [options]=\"selectDataList()\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n [filter]=\"true\"\n [showClear]=\"true\"\n [placeholder]=\"placeHolder()\"\n [disabled]=\"disabled()\"\n [(ngModel)]=\"value\"\n appEditModeElementChanger\n [isEditMode]=\"isEditMode()\"\n (click)=\"showPanel()\"\n (onBlur)=\"onBlur()\"\n >\n <ng-template #filter let-filter>\n <input\n pInputText\n class=\"w-full\"\n [ngModel]=\"searchTerm()\"\n [ngModelOptions]=\"{ standalone: true }\"\n (ngModelChange)=\"searchTerm.set($event)\"\n />\n </ng-template>\n <ng-template #selectedItem let-selectedOption>\n {{ selectedOption[optionLabel()] }}\n </ng-template>\n <ng-template #item let-item>\n {{ item[optionLabel()] }}\n </ng-template>\n </p-select>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: AngularModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: PrimeModule }, { kind: "directive", type: i2.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "component", type: i3
|
|
1561
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.1.5", type: LazySelectComponent, isStandalone: true, selector: "lib-lazy-select", inputs: { placeHolder: { classPropertyName: "placeHolder", publicName: "placeHolder", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: true, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: true, transformFunction: null }, isEditMode: { classPropertyName: "isEditMode", publicName: "isEditMode", isSignal: true, isRequired: true, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: true, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: true, transformFunction: null }, pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: true, transformFunction: null }, selectDataList: { classPropertyName: "selectDataList", publicName: "selectDataList", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", onSearch: "onSearch", onPagination: "onPagination" }, providers: [provideValueAccessor(LazySelectComponent)], viewQueries: [{ propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div #scrollContainer class=\"lib-scroll-container\">\n <p-select\n class=\"w-full\"\n [options]=\"selectDataList()\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n [filter]=\"true\"\n [showClear]=\"true\"\n [placeholder]=\"placeHolder()\"\n [disabled]=\"disabled()\"\n [(ngModel)]=\"value\"\n appEditModeElementChanger\n [isEditMode]=\"isEditMode()\"\n (click)=\"showPanel()\"\n (onBlur)=\"onBlur()\"\n >\n <ng-template #filter let-filter>\n <input\n pInputText\n class=\"w-full\"\n [ngModel]=\"searchTerm()\"\n [ngModelOptions]=\"{ standalone: true }\"\n (ngModelChange)=\"searchTerm.set($event)\"\n />\n </ng-template>\n <ng-template #selectedItem let-selectedOption>\n {{ selectedOption[optionLabel()] }}\n </ng-template>\n <ng-template #item let-item>\n {{ item[optionLabel()] }}\n </ng-template>\n </p-select>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: AngularModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: PrimeModule }, { kind: "directive", type: i2.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "component", type: i3.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo", "motionOptions"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "directive", type: EditModeElementChangerDirective, selector: "[appEditModeElementChanger]", inputs: ["isEditMode"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1681
1562
|
}
|
|
1682
1563
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: LazySelectComponent, decorators: [{
|
|
1683
1564
|
type: Component,
|
|
@@ -3281,5 +3162,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImpor
|
|
|
3281
3162
|
* Generated bundle index. Do not edit.
|
|
3282
3163
|
*/
|
|
3283
3164
|
|
|
3284
|
-
export { ACTION_PERMISSIONS, AUTH_STATE_PROVIDER, AngularModule, ApiResourceService, ApiResourceService as ApiService, BRANCH_PERMISSIONS, BaseFormControl, BaseFormPage, BaseListPage, BaseUserSelectComponent, COMPANY_ACTION_PERMISSIONS, COMPANY_API_PROVIDER, COMPANY_PERMISSIONS, ContactTypeEnum, CookieService, EMAIL_CONFIG_PERMISSIONS, EMAIL_TEMPLATE_PERMISSIONS, EditModeElementChangerDirective, FILE_PERMISSIONS, FILE_TYPE_FILTERS, FOLDER_PERMISSIONS, FORM_PERMISSIONS, FileSelectorDialogComponent, FileUploaderComponent, FileUrlService, HasPermissionDirective, IconComponent, IconTypeEnum, IsEmptyImageDirective, LazyMultiSelectComponent, LazySelectComponent, PERMISSIONS, PROFILE_PERMISSION_PROVIDER, PROFILE_UPLOAD_PROVIDER, PermissionValidatorService, PlatformService, PreventDefaultDirective, PrimeModule, ROLE_ACTION_PERMISSIONS, ROLE_PERMISSIONS, STORAGE_CONFIG_PERMISSIONS, USER_ACTION_PERMISSIONS, USER_LIST_PROVIDER, USER_PERMISSIONS, USER_PERMISSION_PROVIDER, USER_PROVIDER, USER_ROLE_PERMISSIONS, UserMultiSelectComponent, UserSelectComponent, allPermissionsGuard, anyPermissionGuard, checkScrollPagination, evaluateLogicNode, evaluatePermission, formatFileSize, getAcceptString, getFileIconClass, hasAllPermissions, hasAnyPermission, hasPermission, isFileTypeAllowed, permissionGuard, provideValueAccessor };
|
|
3165
|
+
export { ACTION_PERMISSIONS, AUTH_STATE_PROVIDER, AngularModule, ApiResourceService, ApiResourceService as ApiService, BRANCH_PERMISSIONS, BaseFormControl, BaseFormPage, BaseListPage, BaseUserSelectComponent, COMPANY_ACTION_PERMISSIONS, COMPANY_API_PROVIDER, COMPANY_PERMISSIONS, ContactTypeEnum, CookieService, EMAIL_CONFIG_PERMISSIONS, EMAIL_TEMPLATE_PERMISSIONS, EVENT_PARTICIPANT_PERMISSIONS, EVENT_PERMISSIONS, EditModeElementChangerDirective, FILE_PERMISSIONS, FILE_TYPE_FILTERS, FOLDER_PERMISSIONS, FORM_PERMISSIONS, FileSelectorDialogComponent, FileUploaderComponent, FileUrlService, HasPermissionDirective, IconComponent, IconTypeEnum, IsEmptyImageDirective, LazyMultiSelectComponent, LazySelectComponent, NOTIFICATION_PERMISSIONS, PERMISSIONS, PROFILE_PERMISSION_PROVIDER, PROFILE_UPLOAD_PROVIDER, PermissionValidatorService, PlatformService, PreventDefaultDirective, PrimeModule, ROLE_ACTION_PERMISSIONS, ROLE_PERMISSIONS, STORAGE_CONFIG_PERMISSIONS, USER_ACTION_PERMISSIONS, USER_LIST_PROVIDER, USER_PERMISSIONS, USER_PERMISSION_PROVIDER, USER_PROVIDER, USER_ROLE_PERMISSIONS, UserMultiSelectComponent, UserSelectComponent, allPermissionsGuard, anyPermissionGuard, checkScrollPagination, evaluateLogicNode, evaluatePermission, formatFileSize, getAcceptString, getFileIconClass, hasAllPermissions, hasAnyPermission, hasPermission, isFileTypeAllowed, permissionGuard, provideValueAccessor };
|
|
3285
3166
|
//# sourceMappingURL=flusys-ng-shared.mjs.map
|