@ieeesa-npm/groups 0.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.
@@ -0,0 +1,60 @@
1
+ import { Injectable } from "@angular/core";
2
+ import { map, catchError } from "rxjs";
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "@ieeesa-npm/utility";
5
+ /**
6
+ * Groups service is an abstract layer and responsible for managing groups REST API calls.
7
+ * @class GroupsService
8
+ * @implements {OnDestroy}
9
+ */
10
+ export class GroupsService {
11
+ // eslint-disable-next-line no-empty-function, no-unused-vars
12
+ constructor(httpService) {
13
+ this.httpService = httpService;
14
+ }
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ setAppConfig(apiBaseUrl, userPermission) {
17
+ this.apiBaseUrl = apiBaseUrl;
18
+ this.userPermission = userPermission;
19
+ }
20
+ /**
21
+ * Gets application group types from API and returns it as an observable.
22
+ * @return {Observable<GroupTypeResponse>} -It returns group types if success else error.
23
+ * @memberof GroupsService
24
+ */
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
+ getGroupTypes() {
27
+ return this.httpService
28
+ .getData(`${this.apiBaseUrl}/configurations/group_type`)
29
+ .pipe(map((response) => {
30
+ return response;
31
+ }), catchError((error) => {
32
+ throw error;
33
+ }));
34
+ }
35
+ /**
36
+ * Posts create group form data to server using HttpService for creating new group.
37
+ * @param {CreateGroupPayload} createGroupPayload -create group form data which includes group name, type, short name, scope.
38
+ * @return {Observable<any>} -returns create group API response (success or error) as an observable.
39
+ * @memberof GroupsService
40
+ */
41
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
+ createGroup(createGroupPayload) {
43
+ return this.httpService
44
+ .postData(`${this.apiBaseUrl}/groups/create`, createGroupPayload)
45
+ .pipe(map((response) => {
46
+ return response;
47
+ }), catchError((error) => {
48
+ throw error;
49
+ }));
50
+ }
51
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: GroupsService, deps: [{ token: i1.HttpService }], target: i0.ɵɵFactoryTarget.Injectable }); }
52
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: GroupsService, providedIn: "root" }); }
53
+ }
54
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: GroupsService, decorators: [{
55
+ type: Injectable,
56
+ args: [{
57
+ providedIn: "root",
58
+ }]
59
+ }], ctorParameters: function () { return [{ type: i1.HttpService }]; } });
60
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3JvdXBzLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9ncm91cHMvc3JjL2xpYi9zZXJ2aWNlcy9ncm91cHMuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBTTNDLE9BQU8sRUFBYyxHQUFHLEVBQUUsVUFBVSxFQUFFLE1BQU0sTUFBTSxDQUFDOzs7QUFHbkQ7Ozs7R0FJRztBQUlILE1BQU0sT0FBTyxhQUFhO0lBSXhCLDZEQUE2RDtJQUM3RCxZQUFvQixXQUF3QjtRQUF4QixnQkFBVyxHQUFYLFdBQVcsQ0FBYTtJQUFHLENBQUM7SUFFaEQsOERBQThEO0lBQzlELFlBQVksQ0FBQyxVQUFrQixFQUFFLGNBQW1CO1FBQ2xELElBQUksQ0FBQyxVQUFVLEdBQUcsVUFBVSxDQUFDO1FBQzdCLElBQUksQ0FBQyxjQUFjLEdBQUcsY0FBYyxDQUFDO0lBQ3ZDLENBQUM7SUFFRDs7OztPQUlHO0lBQ0gsOERBQThEO0lBQzlELGFBQWE7UUFDWCxPQUFPLElBQUksQ0FBQyxXQU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lib/components/create-group/create-group.component";
5
+ export * from "./lib/groups.component";
6
+ export * from "./lib/services/groups.service";
7
+ export * from "./lib/models/create-group.model";
8
+ export * from "./lib/models/group-types.model";
9
+ export * from "./lib/models/group-function-type.model";
10
+ export * from "./lib/assets/form-validations";
11
+ export * from "./lib/groups.module";
12
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2dyb3Vwcy9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUNILGNBQWMsc0RBQXNELENBQUM7QUFDckUsY0FBYyx3QkFBd0IsQ0FBQztBQUV2QyxjQUFjLCtCQUErQixDQUFDO0FBRTlDLGNBQWMsaUNBQWlDLENBQUM7QUFDaEQsY0FBYyxnQ0FBZ0MsQ0FBQztBQUMvQyxjQUFjLHdDQUF3QyxDQUFDO0FBRXZELGNBQWMsK0JBQStCLENBQUM7QUFFOUMsY0FBYyxxQkFBcUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXHJcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBncm91cHNcclxuICovXHJcbmV4cG9ydCAqIGZyb20gXCIuL2xpYi9jb21wb25lbnRzL2NyZWF0ZS1ncm91cC9jcmVhdGUtZ3JvdXAuY29tcG9uZW50XCI7XHJcbmV4cG9ydCAqIGZyb20gXCIuL2xpYi9ncm91cHMuY29tcG9uZW50XCI7XHJcblxyXG5leHBvcnQgKiBmcm9tIFwiLi9saWIvc2VydmljZXMvZ3JvdXBzLnNlcnZpY2VcIjtcclxuXHJcbmV4cG9ydCAqIGZyb20gXCIuL2xpYi9tb2RlbHMvY3JlYXRlLWdyb3VwLm1vZGVsXCI7XHJcbmV4cG9ydCAqIGZyb20gXCIuL2xpYi9tb2RlbHMvZ3JvdXAtdHlwZXMubW9kZWxcIjtcclxuZXhwb3J0ICogZnJvbSBcIi4vbGliL21vZGVscy9ncm91cC1mdW5jdGlvbi10eXBlLm1vZGVsXCI7XHJcblxyXG5leHBvcnQgKiBmcm9tIFwiLi9saWIvYXNzZXRzL2Zvcm0tdmFsaWRhdGlvbnNcIjtcclxuXHJcbmV4cG9ydCAqIGZyb20gXCIuL2xpYi9ncm91cHMubW9kdWxlXCI7Il19
@@ -0,0 +1,520 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, EventEmitter, Component, ViewEncapsulation, Output, Input, NgModule } from '@angular/core';
3
+ import * as i3 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import { Validators } from '@angular/forms';
6
+ import { AlignType, FormControlType, DynamicFormComponent, ModalComponent } from '@ieeesa-npm/presentation';
7
+ import * as i2 from '@ieeesa-npm/utility';
8
+ import { AlertType, AlertsService, ModalType } from '@ieeesa-npm/utility';
9
+ import { HttpErrorResponse } from '@angular/common/http';
10
+ import * as i1 from '@angular/material/dialog';
11
+ import { MatDialogModule } from '@angular/material/dialog';
12
+ import { map, catchError, Subject, takeUntil } from 'rxjs';
13
+
14
+ var createGroup = {
15
+ heading: "New Group",
16
+ label: {
17
+ groupType: "Group Type",
18
+ groupName: "Group Name",
19
+ shortName: "Group Short Name",
20
+ groupScope: "Group Scope",
21
+ rightButtonLabel: "Submit",
22
+ leftButtonLabel: "Cancel",
23
+ ariaLabel: {
24
+ groupType: "Group type required.",
25
+ groupName: "Group name required.",
26
+ shortName: "Group short name required.",
27
+ groupScope: "Group scope."
28
+ },
29
+ ariaDescribedById: {
30
+ groupType: "ariaGroupType",
31
+ groupName: "ariaGroupName",
32
+ shortName: "ariaShortName",
33
+ groupScope: "ariaGroupScope"
34
+ }
35
+ },
36
+ characterLimit: {
37
+ character500: 500,
38
+ character15: 15,
39
+ character1500: 1500,
40
+ character2000: 2000
41
+ },
42
+ message: {
43
+ error: {
44
+ required: "This field is required.",
45
+ limit: {
46
+ groupName: "Group Name must not be greater than 500 characters long.",
47
+ shortName: "Group Short Name must not be greater than 15 characters long.",
48
+ groupScope: "Group Scope must not be greater than 1500 characters long."
49
+ },
50
+ pattern: {
51
+ groupName: "Group Name contains invalid characters. Please enter alphanumeric, special characters and whitespace only.",
52
+ shortName: "Group Short Name contains invalid characters. Please enter '.',',' , '/', '-' , '_' only.",
53
+ groupScope: "Group Scope contains invalid characters. Please enter alphanumeric, special characters and whitespace only."
54
+ },
55
+ unique: {
56
+ "1001": "Group Name already in use.",
57
+ "1002": "Group Short Name already in use."
58
+ }
59
+ },
60
+ success: {
61
+ submission: "New Group added successfully."
62
+ }
63
+ },
64
+ supportText: {
65
+ groupType: "Choose a group type from the available list.",
66
+ groupName: "Enter the name of the group.",
67
+ shortName: "Enter the abbreviation of the group.",
68
+ groupScope: "Enter a brief description for the scope of the group."
69
+ }
70
+ };
71
+ var constants = {
72
+ createGroup: createGroup
73
+ };
74
+
75
+ /* eslint-disable no-useless-escape */
76
+ const GroupsValidationPatterns = {
77
+ // Group Name field regular expression, which accept Alpha Numeric, Special Characters (ASCII) and whitespace.
78
+ groupName: /^[\w\s!"#$%&'()*+,-./:;<=>?@\[\]^_`{|}~]+$/,
79
+ // Group Short Name field regular expression which accept letters, numbers and ".","," , "/", "-" , "_" characters.
80
+ shortName: /^[a-zA-Z0-9.,\/\-_ ]+$/,
81
+ // Group Scope field regular expression which accept Alpha Numeric, Special Characters and whitespace.
82
+ groupScope: /^[\w\s!"#$%&'()*+,-./:;<=>?@\[\]^_`{|}~]+$/,
83
+ };
84
+
85
+ /**
86
+ * Groups service is an abstract layer and responsible for managing groups REST API calls.
87
+ * @class GroupsService
88
+ * @implements {OnDestroy}
89
+ */
90
+ class GroupsService {
91
+ // eslint-disable-next-line no-empty-function, no-unused-vars
92
+ constructor(httpService) {
93
+ this.httpService = httpService;
94
+ }
95
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
+ setAppConfig(apiBaseUrl, userPermission) {
97
+ this.apiBaseUrl = apiBaseUrl;
98
+ this.userPermission = userPermission;
99
+ }
100
+ /**
101
+ * Gets application group types from API and returns it as an observable.
102
+ * @return {Observable<GroupTypeResponse>} -It returns group types if success else error.
103
+ * @memberof GroupsService
104
+ */
105
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
106
+ getGroupTypes() {
107
+ return this.httpService
108
+ .getData(`${this.apiBaseUrl}/configurations/group_type`)
109
+ .pipe(map((response) => {
110
+ return response;
111
+ }), catchError((error) => {
112
+ throw error;
113
+ }));
114
+ }
115
+ /**
116
+ * Posts create group form data to server using HttpService for creating new group.
117
+ * @param {CreateGroupPayload} createGroupPayload -create group form data which includes group name, type, short name, scope.
118
+ * @return {Observable<any>} -returns create group API response (success or error) as an observable.
119
+ * @memberof GroupsService
120
+ */
121
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
122
+ createGroup(createGroupPayload) {
123
+ return this.httpService
124
+ .postData(`${this.apiBaseUrl}/groups/create`, createGroupPayload)
125
+ .pipe(map((response) => {
126
+ return response;
127
+ }), catchError((error) => {
128
+ throw error;
129
+ }));
130
+ }
131
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: GroupsService, deps: [{ token: i2.HttpService }], target: i0.ɵɵFactoryTarget.Injectable }); }
132
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: GroupsService, providedIn: "root" }); }
133
+ }
134
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: GroupsService, decorators: [{
135
+ type: Injectable,
136
+ args: [{
137
+ providedIn: "root",
138
+ }]
139
+ }], ctorParameters: function () { return [{ type: i2.HttpService }]; } });
140
+
141
+ /**
142
+ * CreateGroupComponent uses DynamicFormComponent to build create new group form and implement the functionalities of submission of form and handling success and error scenarios.
143
+ * @class CreateGroupComponent
144
+ * @implements {OnInit}
145
+ * @implements {OnDestroy}
146
+ */
147
+ class CreateGroupComponent {
148
+ // eslint-disable-next-line no-unused-vars, no-empty-function
149
+ constructor(
150
+ // eslint-disable-next-line no-unused-vars
151
+ groupsService,
152
+ // eslint-disable-next-line no-unused-vars
153
+ globalErrorHandlerService,
154
+ // eslint-disable-next-line no-unused-vars
155
+ alertService // eslint-disable-next-line no-empty-function
156
+ ) {
157
+ this.groupsService = groupsService;
158
+ this.globalErrorHandlerService = globalErrorHandlerService;
159
+ this.alertService = alertService;
160
+ this.destroy$ = new Subject();
161
+ /**
162
+ * Event emitted when the form is successfully submitted.
163
+ * @memberof CreateGroupComponent
164
+ */
165
+ this.submitFormResponse = new EventEmitter();
166
+ /**
167
+ * Event emitted when the form is cancelled.
168
+ * @memberof CreateGroupComponent
169
+ */
170
+ this.formCancel = new EventEmitter();
171
+ this.createGroupText = createGroup;
172
+ this.leftButtonLabel = this.createGroupText?.label?.leftButtonLabel;
173
+ this.rightButtonLabel = this.createGroupText?.label?.rightButtonLabel;
174
+ this.isLegendVisible = false;
175
+ this.isLeftButtonNeeded = true;
176
+ this.colWidth = { xs: 12, xl: 12, sm: 12, md: 12, lg: 12 };
177
+ this.actionButtonAlign = AlignType.LEFT;
178
+ }
179
+ /**
180
+ * Initialize the create group form group array and component.
181
+ * @return -returns nothing
182
+ * @memberof CreateGroupComponent
183
+ */
184
+ ngOnInit() {
185
+ this.groupsService
186
+ .getGroupTypes()
187
+ .pipe(takeUntil(this.destroy$))
188
+ .subscribe({
189
+ next: (res) => {
190
+ if (res?.status) {
191
+ this.groupTypes = Object.entries(res.body.configFieldValue).map(
192
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
193
+ ([id, item]) => ({
194
+ id: id,
195
+ name: item.name,
196
+ }));
197
+ if (this.groupTypes.length) {
198
+ this.createFormGroup();
199
+ }
200
+ }
201
+ },
202
+ error: (error) => {
203
+ if (error && error instanceof HttpErrorResponse) {
204
+ this.globalErrorHandlerService.handleError(error);
205
+ }
206
+ },
207
+ });
208
+ }
209
+ /**
210
+ * Initialize the create group form group array.
211
+ * @memberof CreateGroupComponent
212
+ */
213
+ createFormGroup() {
214
+ this.formGroup = {
215
+ formGroup: [
216
+ {
217
+ legend: "",
218
+ controls: [
219
+ {
220
+ type: FormControlType.SELECT,
221
+ label: this.createGroupText?.label?.groupType + "*",
222
+ controlName: "groupType",
223
+ requiredErrorMessage: this.createGroupText?.message?.error
224
+ ?.required,
225
+ value: "",
226
+ validation: [Validators.required],
227
+ dropdownOptions: this.groupTypes,
228
+ supportMessage: this.createGroupText?.supportText?.groupType,
229
+ ariaLabel: this.createGroupText?.label?.ariaLabel?.groupType,
230
+ placeholder: "",
231
+ ariaDescribedById: this.createGroupText?.label?.ariaDescribedById
232
+ ?.groupType,
233
+ },
234
+ {
235
+ type: FormControlType.INPUT,
236
+ label: this.createGroupText?.label?.groupName + "*",
237
+ controlName: "groupName",
238
+ requiredErrorMessage: this.createGroupText?.message?.error
239
+ ?.required,
240
+ value: "",
241
+ placeholder: "",
242
+ supportMessage: this.createGroupText?.supportText?.groupName,
243
+ patternErrorMessage: this.createGroupText?.message?.error?.pattern
244
+ ?.groupName,
245
+ validation: [
246
+ Validators.required,
247
+ Validators.maxLength(createGroup?.characterLimit?.character500),
248
+ Validators.pattern(GroupsValidationPatterns.groupName),
249
+ ],
250
+ maxErrorMessage: this.createGroupText?.message?.error?.limit
251
+ ?.groupName,
252
+ ariaLabel: this.createGroupText?.label?.ariaLabel?.groupName,
253
+ ariaDescribedById: this.createGroupText?.label?.ariaDescribedById
254
+ ?.groupName,
255
+ },
256
+ {
257
+ type: FormControlType.INPUT,
258
+ label: this.createGroupText?.label?.shortName + "*",
259
+ controlName: "shortName",
260
+ requiredErrorMessage: this.createGroupText?.message?.error
261
+ ?.required,
262
+ value: "",
263
+ patternErrorMessage: this.createGroupText?.message?.error?.pattern
264
+ ?.shortName,
265
+ placeholder: "",
266
+ supportMessage: this.createGroupText?.supportText?.shortName,
267
+ validation: [
268
+ Validators.required,
269
+ Validators.maxLength(createGroup?.characterLimit?.character15),
270
+ Validators.pattern(GroupsValidationPatterns.shortName),
271
+ ],
272
+ maxErrorMessage: this.createGroupText?.message?.error?.limit
273
+ ?.shortName,
274
+ ariaLabel: this.createGroupText?.label?.ariaLabel?.shortName,
275
+ ariaDescribedById: this.createGroupText?.label?.ariaDescribedById
276
+ ?.shortName,
277
+ },
278
+ {
279
+ type: FormControlType.TEXT_AREA,
280
+ label: this.createGroupText?.label?.groupScope,
281
+ controlName: "groupScope",
282
+ patternErrorMessage: this.createGroupText?.message?.error?.pattern
283
+ ?.groupScope,
284
+ value: "",
285
+ placeholder: "",
286
+ supportMessage: this.createGroupText?.supportText?.groupScope,
287
+ isResize: true,
288
+ maxLength: createGroup?.characterLimit?.character2000,
289
+ validation: [
290
+ Validators.maxLength(createGroup?.characterLimit?.character1500),
291
+ Validators.pattern(GroupsValidationPatterns.groupScope),
292
+ ],
293
+ maxErrorMessage: this.createGroupText?.message?.error?.limit
294
+ ?.groupScope,
295
+ ariaLabel: this.createGroupText?.label?.ariaLabel?.groupScope,
296
+ ariaDescribedById: this.createGroupText?.label?.ariaDescribedById
297
+ ?.groupScope,
298
+ },
299
+ ],
300
+ },
301
+ ],
302
+ };
303
+ }
304
+ /**
305
+ * Handles client side validation and emits create group information.
306
+ * @param {FormGroup[]} form -Array of formGroup
307
+ * @return -returns nothing
308
+ * @memberof CreateGroupComponent
309
+ */
310
+ onFormSubmit(form) {
311
+ form[0]?.markAllAsTouched();
312
+ if (form[0].status === "VALID") {
313
+ const formResponse = form[0].getRawValue();
314
+ const createGroupPayload = {
315
+ payload: {
316
+ groupName: formResponse?.groupName,
317
+ groupShortName: formResponse?.shortName,
318
+ groupType: formResponse?.groupType?.name,
319
+ groupDesc: formResponse?.groupScope,
320
+ groupParentId: null,
321
+ },
322
+ };
323
+ this.groupsService
324
+ .createGroup(createGroupPayload)
325
+ .pipe(takeUntil(this.destroy$))
326
+ .subscribe({
327
+ next: (res) => {
328
+ if (res?.status) {
329
+ this.submitFormResponse.emit(res);
330
+ }
331
+ },
332
+ error: (error) => {
333
+ const errorCodeArr = error?.error?.body?.errorCodes;
334
+ if (Array.isArray(errorCodeArr)) {
335
+ const errorMessage = [];
336
+ errorCodeArr.forEach((item, index) => {
337
+ const errorMessageKey = errorCodeArr[index];
338
+ errorMessage.push(this.createGroupText?.message?.error?.unique[errorMessageKey]);
339
+ });
340
+ this.alertService.showMessage({
341
+ status: "custom",
342
+ message: errorMessage,
343
+ alertType: AlertType.ERROR,
344
+ isCloseNeeded: true,
345
+ });
346
+ }
347
+ else if (error && error instanceof HttpErrorResponse) {
348
+ this.globalErrorHandlerService.handleError(error);
349
+ }
350
+ },
351
+ });
352
+ }
353
+ }
354
+ /**
355
+ * Get form reference.
356
+ * @param {FormGroup[]} form
357
+ * @memberof CreateGroupComponent
358
+ */
359
+ getFormGroupReference(form) {
360
+ this.form = form[0];
361
+ }
362
+ /**
363
+ * Emits form cancel event.
364
+ * @return -returns nothing
365
+ * @memberof CreateGroupComponent
366
+ */
367
+ createGroupCancelled() {
368
+ this.formCancel.emit();
369
+ }
370
+ /**
371
+ * NgOnDestroy performs necessary cleanup tasks, such as unsubscribing from subscription when the component is being destroyed.
372
+ * @memberof CreateGroupComponent
373
+ */
374
+ ngOnDestroy() {
375
+ this.destroy$.next(true);
376
+ this.destroy$.unsubscribe();
377
+ }
378
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CreateGroupComponent, deps: [{ token: GroupsService }, { token: i2.GlobalErrorHandlerService }, { token: i2.AlertsService }], target: i0.ɵɵFactoryTarget.Component }); }
379
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: CreateGroupComponent, isStandalone: true, selector: "ieeesa-create-group", outputs: { submitFormResponse: "submitFormResponse", formCancel: "formCancel" }, providers: [AlertsService], ngImport: i0, template: "<ieeesa-dynamic-form\r\n *ngIf=\"formGroup\"\r\n [leftButtonLabel]=\"leftButtonLabel\"\r\n [rightButtonLabel]=\"rightButtonLabel\"\r\n [isLegendVisible]=\"isLegendVisible\"\r\n [colWidth]=\"colWidth\"\r\n [actionButtonAlign]=\"actionButtonAlign\"\r\n [formGroups]=\"formGroup\"\r\n [isLeftButtonNeeded]=\"isLeftButtonNeeded\"\r\n (formSubmit)=\"onFormSubmit($event)\"\r\n (formLeftButtonClicked)=\"createGroupCancelled()\"\r\n (formGroupsReference)=\"getFormGroupReference($event)\"\r\n></ieeesa-dynamic-form>", styles: [".ieeesa-subtitle{text-align:left;font-family:Calibri Regular;font-size:1.56em;letter-spacing:0;color:#000;opacity:1}.ieeesa-body{text-align:left;font-family:Calibri Regular;font-size:1.25em;letter-spacing:0;color:#000;opacity:1}.ieeesa-display-lg-57{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:3.5625em;line-height:64px;color:#000;letter-spacing:0}.ieeesa-display-md-47{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:2.9375em;line-height:52px;color:#000;letter-spacing:0}.ieeesa-display-sm-38{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:2.375em;line-height:44px;color:#000;letter-spacing:0}.ieeesa-headline-lg-34{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:2.125em;line-height:40px;color:#000;letter-spacing:0}.ieeesa-headline-md-30{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1.875em;line-height:36px;color:#000;letter-spacing:0}.ieeesa-headline-sm-26{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1.625em;line-height:32px;color:#000;letter-spacing:0}.ieeesa-title-lg-bold-24{font-family:Calibri Regular;font-style:normal;font-weight:700;font-size:1.5em;line-height:28px;color:#000;letter-spacing:0}.ieeesa-title-lg-24{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1.5em;line-height:28px;color:#000;letter-spacing:0}.ieeesa-title-md-18{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1.125em;line-height:24px;color:#000;letter-spacing:.009375em}.ieeesa-title-sm-16{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1em;line-height:20px;color:#000;letter-spacing:.00625em}.ieeesa-label-lg-bold-16{font-family:Calibri Regular;font-style:normal;font-weight:700;font-size:1em;line-height:20px;color:#000;letter-spacing:.00625em}.ieeesa-label-lg-16{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1em;line-height:20px;color:#000;letter-spacing:.00625em}.ieeesa-label-md-14{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:.875em;line-height:16px;color:#000;letter-spacing:.03125em}.ieeesa-label-sm-13{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:.8125em;line-height:16px;color:#000;letter-spacing:.03125em}.ieeesa-body-lg-bold-18{font-family:Calibri Regular;font-style:normal;font-weight:700;font-size:1.125em;line-height:24px;color:#000;letter-spacing:.03125em}.ieeesa-body-lg-18{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1.125em;line-height:24px;color:#000;letter-spacing:.03125em}.ieeesa-body-md-16{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1em;line-height:20px;color:#000;letter-spacing:.015625em}.ieeesa-body-sm-14{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:.875em;line-height:16px;color:#000;letter-spacing:.025em}.ieeesa-title-inter-lg-bold-24{font-family:Inter Bold;font-style:normal;font-weight:700;font-size:1.5em;line-height:29px;color:#000;letter-spacing:0}.mat-mdc-button.mat-mdc-button-base.mat-primary-button,.mat-mdc-button.mat-mdc-button-base.mat-secondary-button,.mat-mdc-button.mat-mdc-button-base.mat-tertiary-button{min-width:103px;width:auto;min-height:40px;height:auto;border-radius:3px;text-align:center;padding:.625em 1.5em;border:none;font-family:Calibri Regular;font-style:normal;font-weight:700;font-size:1em;line-height:20px;color:#000;letter-spacing:.00625em}.mat-mdc-button.mat-mdc-button-base>.mat-icon{margin-right:11px}.mat-mdc-button.mat-mdc-button-base.mat-primary-button{background-color:#00629b;color:#fff}.mat-mdc-button.mat-mdc-button-base.mat-primary-button:hover{background-color:#003e65}.mat-mdc-button.mat-mdc-button-base.mat-primary-button:active{background-color:#00629b}.mat-mdc-button.mat-mdc-button-base.mat-primary-button:disabled{background-color:#1c1b1f1f}.mat-mdc-button.mat-mdc-button-base.mat-secondary-button{color:#fff;background:#a7a8aa;box-shadow:0 1px 2px #0000004d,0 2px 6px 2px #00000026}.mat-mdc-button.mat-mdc-button-base.mat-secondary-button:hover{background:#a7a8aa}.mat-mdc-button.mat-mdc-button-base.mat-secondary-button:active{background:rgba(29,25,43,.12)}.mat-mdc-button.mat-mdc-button-base.mat-secondary-button:disabled{background:rgba(28,27,31,.12);color:#1c1b1f;opacity:.38}.mat-mdc-button.mat-mdc-button-base.mat-tertiary-button{background-color:#fff;border:1px solid #00629b;color:#00629b}.mat-mdc-button.mat-mdc-button-base.mat-tertiary-button:hover{background-color:#6750a414}.mat-mdc-button.mat-mdc-button-base.mat-tertiary-button:active{background:rgba(103,80,164,.12)}.mat-mdc-button.mat-mdc-button-base.mat-tertiary-button:disabled{border:1px solid rgba(28,27,31,.12);color:#1c1b1f;opacity:.38}.ieeesa-text-button{color:#cac4d0;background:none;border:none}.flex-align-center{display:flex;align-items:center;justify-content:center}.mat-button-toggle-checked{background-color:#a7a8aa}.mat-button-toggle-checked .mat-button-toggle-label-content:before{font-family:\"Font Awesome 5 Free\";font-weight:900;content:\"\\f00c\";padding-right:.5625em}.mat-button-toggle-group .mat-button-toggle-label-content{font-family:Calibri Regular;font-style:normal;font-weight:700;font-size:1em;line-height:20px;color:#1c1b1f;letter-spacing:.00625em}.no-bg-color-btn{color:#00629b;border-radius:3px;border:1px solid #00629b;min-height:40px;height:auto}@media (max-width: 768px){.mat-button-toggle-group .mat-button-toggle-label-content{max-width:8ch;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:relative}}.cdk-overlay-pane{width:100%;min-width:312px}.mat-mdc-form-field{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1.125em;line-height:24px;color:#49454f;letter-spacing:.03125em}.ieeesa-modal-dialog.ieeesa-create-group .mat-mdc-dialog-container{box-shadow:none}.ieeesa-modal-dialog.ieeesa-create-group .mat-mdc-dialog-surface{border-radius:0;margin:1em 0}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal{box-shadow:0 3px #11b7e5 inset,0 4px 24px #00000080;padding-bottom:.5em}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-dynamic-form__actions{flex-direction:row-reverse;gap:1.5em;padding:3em 1em .75em 0}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-dynamic-form__form-field{margin-bottom:1em;padding:0}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .mat-mdc-form-field-flex{width:62.5em}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-input-field .mat-mdc-form-field{display:flex}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-input-field .mat-mdc-text-field-wrapper{padding:.5em 1em}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-input-field__label,.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-input-field__support-text,.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-select-field__label,.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-select-field__support-text{color:#49454f}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .short-name .ieeesa-input-field .mat-mdc-form-field{width:40%}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .group-type .ieeesa-select-field .mat-mdc-form-field{display:flex;width:43%}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-form-error--text{padding:.25em 1em 0}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .mat-mdc-form-field-subscript-wrapper{display:none}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .mat-mdc-dialog-content{padding:1.5em 1em .75em!important}@media (max-width: 767px){.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .group-type .ieeesa-select-field .mat-mdc-form-field,.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .short-name .ieeesa-input-field .mat-mdc-form-field{width:100%}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: DynamicFormComponent, selector: "ieeesa-dynamic-form", inputs: ["formGroups", "submitResponse", "searchResponse", "colWidth", "isLegendVisible", "rightButtonLabel", "leftButtonLabel", "isSubmitButtonDisabled", "isLeftButtonDisabled", "isLeftButtonNeeded", "actionButtonAlign"], outputs: ["formSubmit", "formChange", "formInput", "formLeftButtonClicked", "formSearchApply", "formGroupsReference", "dropdownChange", "formDateSelected", "formSelectSearch", "formControlChange", "formAutoCompleteSearch", "autoCompleteOptionSelected", "formAfterContentInit", "formSelectedDateRange"], exportAs: ["dynamicForm"] }, { kind: "ngmodule", type: MatDialogModule }], encapsulation: i0.ViewEncapsulation.None }); }
380
+ }
381
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CreateGroupComponent, decorators: [{
382
+ type: Component,
383
+ args: [{ selector: "ieeesa-create-group", standalone: true, imports: [CommonModule, DynamicFormComponent, MatDialogModule], encapsulation: ViewEncapsulation.None, providers: [AlertsService], template: "<ieeesa-dynamic-form\r\n *ngIf=\"formGroup\"\r\n [leftButtonLabel]=\"leftButtonLabel\"\r\n [rightButtonLabel]=\"rightButtonLabel\"\r\n [isLegendVisible]=\"isLegendVisible\"\r\n [colWidth]=\"colWidth\"\r\n [actionButtonAlign]=\"actionButtonAlign\"\r\n [formGroups]=\"formGroup\"\r\n [isLeftButtonNeeded]=\"isLeftButtonNeeded\"\r\n (formSubmit)=\"onFormSubmit($event)\"\r\n (formLeftButtonClicked)=\"createGroupCancelled()\"\r\n (formGroupsReference)=\"getFormGroupReference($event)\"\r\n></ieeesa-dynamic-form>", styles: [".ieeesa-subtitle{text-align:left;font-family:Calibri Regular;font-size:1.56em;letter-spacing:0;color:#000;opacity:1}.ieeesa-body{text-align:left;font-family:Calibri Regular;font-size:1.25em;letter-spacing:0;color:#000;opacity:1}.ieeesa-display-lg-57{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:3.5625em;line-height:64px;color:#000;letter-spacing:0}.ieeesa-display-md-47{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:2.9375em;line-height:52px;color:#000;letter-spacing:0}.ieeesa-display-sm-38{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:2.375em;line-height:44px;color:#000;letter-spacing:0}.ieeesa-headline-lg-34{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:2.125em;line-height:40px;color:#000;letter-spacing:0}.ieeesa-headline-md-30{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1.875em;line-height:36px;color:#000;letter-spacing:0}.ieeesa-headline-sm-26{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1.625em;line-height:32px;color:#000;letter-spacing:0}.ieeesa-title-lg-bold-24{font-family:Calibri Regular;font-style:normal;font-weight:700;font-size:1.5em;line-height:28px;color:#000;letter-spacing:0}.ieeesa-title-lg-24{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1.5em;line-height:28px;color:#000;letter-spacing:0}.ieeesa-title-md-18{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1.125em;line-height:24px;color:#000;letter-spacing:.009375em}.ieeesa-title-sm-16{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1em;line-height:20px;color:#000;letter-spacing:.00625em}.ieeesa-label-lg-bold-16{font-family:Calibri Regular;font-style:normal;font-weight:700;font-size:1em;line-height:20px;color:#000;letter-spacing:.00625em}.ieeesa-label-lg-16{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1em;line-height:20px;color:#000;letter-spacing:.00625em}.ieeesa-label-md-14{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:.875em;line-height:16px;color:#000;letter-spacing:.03125em}.ieeesa-label-sm-13{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:.8125em;line-height:16px;color:#000;letter-spacing:.03125em}.ieeesa-body-lg-bold-18{font-family:Calibri Regular;font-style:normal;font-weight:700;font-size:1.125em;line-height:24px;color:#000;letter-spacing:.03125em}.ieeesa-body-lg-18{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1.125em;line-height:24px;color:#000;letter-spacing:.03125em}.ieeesa-body-md-16{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1em;line-height:20px;color:#000;letter-spacing:.015625em}.ieeesa-body-sm-14{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:.875em;line-height:16px;color:#000;letter-spacing:.025em}.ieeesa-title-inter-lg-bold-24{font-family:Inter Bold;font-style:normal;font-weight:700;font-size:1.5em;line-height:29px;color:#000;letter-spacing:0}.mat-mdc-button.mat-mdc-button-base.mat-primary-button,.mat-mdc-button.mat-mdc-button-base.mat-secondary-button,.mat-mdc-button.mat-mdc-button-base.mat-tertiary-button{min-width:103px;width:auto;min-height:40px;height:auto;border-radius:3px;text-align:center;padding:.625em 1.5em;border:none;font-family:Calibri Regular;font-style:normal;font-weight:700;font-size:1em;line-height:20px;color:#000;letter-spacing:.00625em}.mat-mdc-button.mat-mdc-button-base>.mat-icon{margin-right:11px}.mat-mdc-button.mat-mdc-button-base.mat-primary-button{background-color:#00629b;color:#fff}.mat-mdc-button.mat-mdc-button-base.mat-primary-button:hover{background-color:#003e65}.mat-mdc-button.mat-mdc-button-base.mat-primary-button:active{background-color:#00629b}.mat-mdc-button.mat-mdc-button-base.mat-primary-button:disabled{background-color:#1c1b1f1f}.mat-mdc-button.mat-mdc-button-base.mat-secondary-button{color:#fff;background:#a7a8aa;box-shadow:0 1px 2px #0000004d,0 2px 6px 2px #00000026}.mat-mdc-button.mat-mdc-button-base.mat-secondary-button:hover{background:#a7a8aa}.mat-mdc-button.mat-mdc-button-base.mat-secondary-button:active{background:rgba(29,25,43,.12)}.mat-mdc-button.mat-mdc-button-base.mat-secondary-button:disabled{background:rgba(28,27,31,.12);color:#1c1b1f;opacity:.38}.mat-mdc-button.mat-mdc-button-base.mat-tertiary-button{background-color:#fff;border:1px solid #00629b;color:#00629b}.mat-mdc-button.mat-mdc-button-base.mat-tertiary-button:hover{background-color:#6750a414}.mat-mdc-button.mat-mdc-button-base.mat-tertiary-button:active{background:rgba(103,80,164,.12)}.mat-mdc-button.mat-mdc-button-base.mat-tertiary-button:disabled{border:1px solid rgba(28,27,31,.12);color:#1c1b1f;opacity:.38}.ieeesa-text-button{color:#cac4d0;background:none;border:none}.flex-align-center{display:flex;align-items:center;justify-content:center}.mat-button-toggle-checked{background-color:#a7a8aa}.mat-button-toggle-checked .mat-button-toggle-label-content:before{font-family:\"Font Awesome 5 Free\";font-weight:900;content:\"\\f00c\";padding-right:.5625em}.mat-button-toggle-group .mat-button-toggle-label-content{font-family:Calibri Regular;font-style:normal;font-weight:700;font-size:1em;line-height:20px;color:#1c1b1f;letter-spacing:.00625em}.no-bg-color-btn{color:#00629b;border-radius:3px;border:1px solid #00629b;min-height:40px;height:auto}@media (max-width: 768px){.mat-button-toggle-group .mat-button-toggle-label-content{max-width:8ch;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:relative}}.cdk-overlay-pane{width:100%;min-width:312px}.mat-mdc-form-field{font-family:Calibri Regular;font-style:normal;font-weight:400;font-size:1.125em;line-height:24px;color:#49454f;letter-spacing:.03125em}.ieeesa-modal-dialog.ieeesa-create-group .mat-mdc-dialog-container{box-shadow:none}.ieeesa-modal-dialog.ieeesa-create-group .mat-mdc-dialog-surface{border-radius:0;margin:1em 0}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal{box-shadow:0 3px #11b7e5 inset,0 4px 24px #00000080;padding-bottom:.5em}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-dynamic-form__actions{flex-direction:row-reverse;gap:1.5em;padding:3em 1em .75em 0}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-dynamic-form__form-field{margin-bottom:1em;padding:0}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .mat-mdc-form-field-flex{width:62.5em}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-input-field .mat-mdc-form-field{display:flex}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-input-field .mat-mdc-text-field-wrapper{padding:.5em 1em}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-input-field__label,.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-input-field__support-text,.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-select-field__label,.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-select-field__support-text{color:#49454f}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .short-name .ieeesa-input-field .mat-mdc-form-field{width:40%}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .group-type .ieeesa-select-field .mat-mdc-form-field{display:flex;width:43%}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .ieeesa-form-error--text{padding:.25em 1em 0}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .mat-mdc-form-field-subscript-wrapper{display:none}.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .mat-mdc-dialog-content{padding:1.5em 1em .75em!important}@media (max-width: 767px){.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .group-type .ieeesa-select-field .mat-mdc-form-field,.ieeesa-modal-dialog.ieeesa-create-group .ieeesa-modal .short-name .ieeesa-input-field .mat-mdc-form-field{width:100%}}\n"] }]
384
+ }], ctorParameters: function () { return [{ type: GroupsService }, { type: i2.GlobalErrorHandlerService }, { type: i2.AlertsService }]; }, propDecorators: { submitFormResponse: [{
385
+ type: Output
386
+ }], formCancel: [{
387
+ type: Output
388
+ }] } });
389
+
390
+ /* eslint-disable no-unused-vars */
391
+ var GroupFunctionType;
392
+ (function (GroupFunctionType) {
393
+ GroupFunctionType["CREATE"] = "CREATE";
394
+ GroupFunctionType["EDIT"] = "EDIT";
395
+ })(GroupFunctionType || (GroupFunctionType = {}));
396
+
397
+ /**
398
+ * Groups component is a wrapper or container component for groups management reusable component and in this component integrates all group management functionalities and this will be entry component for managing groups when it is consumed in other applications.
399
+ * @class GroupsComponent
400
+ */
401
+ class GroupsComponent {
402
+ constructor(
403
+ // eslint-disable-next-line no-unused-vars
404
+ dialog,
405
+ // eslint-disable-next-line no-unused-vars
406
+ groupsService,
407
+ // eslint-disable-next-line no-unused-vars
408
+ alertService // eslint-disable-next-line no-empty-function
409
+ ) {
410
+ this.dialog = dialog;
411
+ this.groupsService = groupsService;
412
+ this.alertService = alertService;
413
+ this.destroy$ = new Subject();
414
+ this.createGroupText = createGroup;
415
+ }
416
+ /**
417
+ * Initialize the groups component.
418
+ * @return -returns nothing
419
+ * @memberof GroupsComponent
420
+ */
421
+ ngOnInit() {
422
+ this.groupsService.setAppConfig(this.apiBaseURL, this.permissions);
423
+ }
424
+ /**
425
+ * Sets the dialog options for create group modal and calls openModal method.
426
+ * @return -returns nothing
427
+ * @memberof GroupsComponent
428
+ */
429
+ openCreateGroupForm() {
430
+ const dialogOptions = {
431
+ heading: this.createGroupText?.heading,
432
+ isCloseNeeded: true,
433
+ componentReference: CreateGroupComponent,
434
+ modalType: ModalType.FORM,
435
+ };
436
+ this.functionType = GroupFunctionType.CREATE;
437
+ this.openModal(dialogOptions, "ieeesa-create-group");
438
+ }
439
+ /**
440
+ * Opens modal component with for received params and handles form submission success and errors.
441
+ * @param {*} dialogOptions
442
+ * @param {string} [className]
443
+ * @return -returns nothing
444
+ * @memberof GroupsComponent
445
+ */
446
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-inferrable-types
447
+ openModal(dialogOptions, className) {
448
+ className = className ?? "";
449
+ this.dialogRef = this.dialog.open(ModalComponent, {
450
+ data: dialogOptions,
451
+ width: "auto",
452
+ panelClass: ["ieeesa-modal-dialog", className],
453
+ ariaModal: true,
454
+ });
455
+ this.dialogRef?.componentInstance?.submitFormResponse
456
+ .pipe(takeUntil(this.destroy$))
457
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, no-unused-vars
458
+ .subscribe((result) => {
459
+ this.dialogRef.close();
460
+ if (this.functionType === GroupFunctionType.CREATE) {
461
+ this.alertService.showMessage({
462
+ status: "custom",
463
+ alertType: AlertType.SUCCESS,
464
+ isCloseNeeded: true,
465
+ message: this.createGroupText?.message?.success?.submission,
466
+ });
467
+ }
468
+ });
469
+ this.dialogRef?.componentInstance?.formCancel
470
+ .pipe(takeUntil(this.destroy$))
471
+ .subscribe(() => {
472
+ this.dialogRef.close();
473
+ });
474
+ }
475
+ /**
476
+ * NgOnDestroy performs necessary cleanup tasks, such as unsubscribing from subscription when the component is being destroyed.
477
+ * @memberof GroupsComponent
478
+ */
479
+ ngOnDestroy() {
480
+ this.destroy$.next(true);
481
+ this.destroy$.unsubscribe();
482
+ }
483
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: GroupsComponent, deps: [{ token: i1.MatDialog }, { token: GroupsService }, { token: i2.AlertsService }], target: i0.ɵɵFactoryTarget.Component }); }
484
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: GroupsComponent, isStandalone: true, selector: "ieeesa-groups", inputs: { applicationId: "applicationId", apiBaseURL: "apiBaseURL", permissions: "permissions" }, providers: [AlertsService], ngImport: i0, template: "<button type=\"button\" (click)=\"openCreateGroupForm()\">Create Group</button>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatDialogModule }], encapsulation: i0.ViewEncapsulation.None }); }
485
+ }
486
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: GroupsComponent, decorators: [{
487
+ type: Component,
488
+ args: [{ selector: "ieeesa-groups", standalone: true, imports: [CommonModule, MatDialogModule], encapsulation: ViewEncapsulation.None, providers: [AlertsService], template: "<button type=\"button\" (click)=\"openCreateGroupForm()\">Create Group</button>" }]
489
+ }], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: GroupsService }, { type: i2.AlertsService }]; }, propDecorators: { applicationId: [{
490
+ type: Input
491
+ }], apiBaseURL: [{
492
+ type: Input
493
+ }], permissions: [{
494
+ type: Input
495
+ }] } });
496
+
497
+ class GroupsModule {
498
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: GroupsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
499
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.3", ngImport: i0, type: GroupsModule }); }
500
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: GroupsModule }); }
501
+ }
502
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: GroupsModule, decorators: [{
503
+ type: NgModule,
504
+ args: [{
505
+ declarations: [],
506
+ imports: [],
507
+ exports: []
508
+ }]
509
+ }] });
510
+
511
+ /*
512
+ * Public API Surface of groups
513
+ */
514
+
515
+ /**
516
+ * Generated bundle index. Do not edit.
517
+ */
518
+
519
+ export { CreateGroupComponent, GroupFunctionType, GroupsComponent, GroupsModule, GroupsService, GroupsValidationPatterns };
520
+ //# sourceMappingURL=ieeesa-npm-groups.mjs.map