@ieeesa-npm/groups 0.1.7 → 0.1.8

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.
@@ -1,10 +1,12 @@
1
- import { EventEmitter, OnDestroy, OnInit } from "@angular/core";
2
- import { FormGroup } from "@angular/forms";
3
- import { FormGrid, FormModel, SelectOption, AlignType } from "@ieeesa-npm/presentation";
4
- import { AlertsService, AlertType, GlobalErrorHandlerService } from "@ieeesa-npm/utility";
5
- import { GroupsService } from "../../services/groups.service";
6
- import { Subject } from "rxjs";
7
- import { GroupInfo } from "../../models/group-info.model";
1
+ import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
+ import { FormGroup } from '@angular/forms';
3
+ import { FormGrid, FormModel, SelectOption, AlignType, FieldConfig } from '@ieeesa-npm/presentation';
4
+ import { AlertsService, AlertType, GlobalErrorHandlerService } from '@ieeesa-npm/utility';
5
+ import { GroupsService } from '../../services/groups.service';
6
+ import { HttpErrorResponse } from '@angular/common/http';
7
+ import { Subject } from 'rxjs';
8
+ import { GroupInfo } from '../../models/group-info.model';
9
+ import { GroupFunctionType } from '../../models/group-function-type.model';
8
10
  import * as i0 from "@angular/core";
9
11
  /**
10
12
  * CreateGroupComponent uses DynamicFormComponent to build create new group form and implement the functionalities of submission of form and handling success and error scenarios.
@@ -82,6 +84,7 @@ export declare class CreateGroupComponent implements OnInit, OnDestroy {
82
84
  groupScope: string;
83
85
  };
84
86
  };
87
+ constants: any;
85
88
  leftButtonLabel: string;
86
89
  rightButtonLabel: string;
87
90
  isLegendVisible: boolean;
@@ -91,7 +94,9 @@ export declare class CreateGroupComponent implements OnInit, OnDestroy {
91
94
  groupTypes: SelectOption[];
92
95
  actionButtonAlign: AlignType;
93
96
  form: FormGroup;
94
- selectedParentGroupInfo: GroupInfo | undefined;
97
+ selectedGroupInfo: GroupInfo | undefined;
98
+ groupFunctionType: GroupFunctionType;
99
+ selectedGroupParentInfo: GroupInfo | undefined;
95
100
  constructor(groupsService: GroupsService, globalErrorHandlerService: GlobalErrorHandlerService, alertService: AlertsService);
96
101
  /**
97
102
  * Initialize the create group form group array and component.
@@ -99,6 +104,12 @@ export declare class CreateGroupComponent implements OnInit, OnDestroy {
99
104
  * @memberof CreateGroupComponent
100
105
  */
101
106
  ngOnInit(): void;
107
+ /**
108
+ * Constructs and returns the group type form field based on edit group or not.
109
+ * @return {FieldConfig} -group type form field.
110
+ * @memberof CreateGroupComponent
111
+ */
112
+ getGroupTypeField(): FieldConfig;
102
113
  /**
103
114
  * Initialize the create group form group array.
104
115
  * @memberof CreateGroupComponent
@@ -107,16 +118,38 @@ export declare class CreateGroupComponent implements OnInit, OnDestroy {
107
118
  /**
108
119
  * Update the create sub group form group array.
109
120
  * @param {GroupInfo} parentGroupInfo -Parent group info.
121
+ * @return -returns nothing
110
122
  * @memberof CreateGroupComponent
111
123
  */
112
124
  updateCreateFormGroup(parentGroupInfo: GroupInfo): void;
113
125
  /**
114
- * Handles client side validation and emits create group information.
126
+ * Handles client side validation and calls create group or edit group methods.
115
127
  * @param {FormGroup[]} form -Array of formGroup
116
128
  * @return -returns nothing
117
129
  * @memberof CreateGroupComponent
118
130
  */
119
131
  onFormSubmit(form: FormGroup[]): void;
132
+ /**
133
+ * Constructs create group payload and calls create group API and emits create group API response.
134
+ * @param formData
135
+ * @return -returns nothing
136
+ * @memberof CreateGroupComponent
137
+ */
138
+ createGroup(formData: any): void;
139
+ /**
140
+ * Constructs edit group payload and calls edit group API and emits create group API response.
141
+ * @param {*} formData
142
+ * @return -returns nothing
143
+ * @memberof CreateGroupComponent
144
+ */
145
+ editGroup(formData: any): void;
146
+ /**
147
+ * Captures the server side errors and handles the errors based on the custom or Http errors.
148
+ * @param {HttpErrorResponse} error
149
+ * @return -returns nothing
150
+ * @memberof CreateGroupComponent
151
+ */
152
+ handleErrors(error: HttpErrorResponse): void;
120
153
  /**
121
154
  * Get form reference.
122
155
  * @param {FormGroup[]} form
@@ -5,6 +5,7 @@ import { FlatTreeControl } from '@angular/cdk/tree';
5
5
  import { BehaviorSubject, Observable, Subject } from 'rxjs';
6
6
  import { MatTreeNodePadding } from '@angular/material/tree';
7
7
  import { GroupInfo } from '../../models/group-info.model';
8
+ import { EditGroupAndParentInfo } from '../../models/edit-group.model';
8
9
  import * as i0 from "@angular/core";
9
10
  /**
10
11
  * Dynamic Flat node creates a node structure
@@ -138,11 +139,11 @@ export declare class TreeViewComponent implements OnInit, AfterViewInit, OnDestr
138
139
  set isGroupSearchOrFilterActive(value: boolean);
139
140
  get isGroupSearchOrFilterActive(): boolean;
140
141
  private deletedGroupId;
141
- set deletedGroupIdInfo(id: string);
142
+ set deletedGroupIdInfo(id: string | undefined);
142
143
  get deletedGroupIdInfo(): string | undefined;
143
144
  toggleGroupClick: EventEmitter<GroupInfo>;
144
145
  createGroupClick: EventEmitter<GroupInfo>;
145
- editGroupClick: EventEmitter<GroupInfo>;
146
+ editGroupClick: EventEmitter<EditGroupAndParentInfo>;
146
147
  deleteGroupClick: EventEmitter<GroupInfo>;
147
148
  constructor(database: Groups, elementRef: ElementRef);
148
149
  /**
@@ -203,7 +204,7 @@ export declare class TreeViewComponent implements OnInit, AfterViewInit, OnDestr
203
204
  * @param {string} deletedGroupId
204
205
  * @memberof TreeViewComponent
205
206
  */
206
- deleteGroupNode(deletedGroupId: string): void;
207
+ deleteGroupNode(deletedGroupId: string | undefined): void;
207
208
  /**
208
209
  * Sets the selected menu group action
209
210
  * @param {Menu} menu
@@ -1,3 +1,4 @@
1
+ import { HttpErrorResponse } from '@angular/common/http';
1
2
  import { OnDestroy, OnInit } from '@angular/core';
2
3
  import { MatDialog } from '@angular/material/dialog';
3
4
  import { GroupsService } from './services/groups.service';
@@ -5,9 +6,10 @@ import { Subject } from 'rxjs';
5
6
  import { GroupInfo } from './models/group-info.model';
6
7
  import { SelectOption, Legend, IconButton, AlignType } from '@ieeesa-npm/presentation';
7
8
  import { GroupType } from './models/group-types.model';
8
- import { GlobalErrorHandlerService, BreakpointObserverService, AlertsService } from '@ieeesa-npm/utility';
9
+ import { AlertType, GlobalErrorHandlerService, BreakpointObserverService, AlertsService } from '@ieeesa-npm/utility';
9
10
  import { GroupFunctionType } from './models/group-function-type.model';
10
11
  import { GetGroupsPayload } from './models/view-group.model';
12
+ import { EditGroupAndParentInfo } from './models/edit-group.model';
11
13
  import * as i0 from "@angular/core";
12
14
  /**
13
15
  * 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.
@@ -23,6 +25,8 @@ export declare class GroupsComponent implements OnInit, OnDestroy {
23
25
  dialogRef: any;
24
26
  constants: any;
25
27
  viewGroupTexts: any;
28
+ createGroupText: any;
29
+ editGroupTexts: any;
26
30
  isGroupSearchActive: boolean;
27
31
  isGroupFilterActive: boolean;
28
32
  isGroupSearchOrFilterActive: boolean;
@@ -48,61 +52,6 @@ export declare class GroupsComponent implements OnInit, OnDestroy {
48
52
  applicationId: string;
49
53
  apiBaseURL: string;
50
54
  permissions: any;
51
- createGroupText: {
52
- heading: string;
53
- label: {
54
- parentGroup: string;
55
- groupType: string;
56
- groupName: string;
57
- shortName: string;
58
- groupScope: string;
59
- rightButtonLabel: string;
60
- leftButtonLabel: string;
61
- ariaLabel: {
62
- parentGroup: string;
63
- groupType: string;
64
- groupName: string;
65
- shortName: string;
66
- groupScope: string;
67
- };
68
- ariaDescribedById: {
69
- groupType: string;
70
- groupName: string;
71
- shortName: string;
72
- groupScope: string;
73
- };
74
- };
75
- characterLimit: {
76
- character500: number;
77
- character15: number;
78
- character1500: number;
79
- character2000: number;
80
- };
81
- message: {
82
- error: {
83
- required: string;
84
- limit: {
85
- groupName: string;
86
- shortName: string;
87
- groupScope: string;
88
- };
89
- pattern: {
90
- groupName: string;
91
- shortName: string;
92
- groupScope: string;
93
- };
94
- };
95
- success: {
96
- submission: string;
97
- };
98
- };
99
- supportText: {
100
- groupType: string;
101
- groupName: string;
102
- shortName: string;
103
- groupScope: string;
104
- };
105
- };
106
55
  functionType: GroupFunctionType;
107
56
  alignmentType: typeof AlignType;
108
57
  constructor(dialog: MatDialog, groupsService: GroupsService, alertService: AlertsService, breakpointObserverService: BreakpointObserverService, globalErrorHandlerService: GlobalErrorHandlerService);
@@ -113,12 +62,19 @@ export declare class GroupsComponent implements OnInit, OnDestroy {
113
62
  */
114
63
  ngOnInit(): void;
115
64
  /**
116
- * Sets the dialog options for create group modal and calls openModal method.
117
- * @param {GroupInfo} [parentGroupInfo] -An optional parameter. Parent group info to be passed for create child group.
118
- * @return -returns nothing
119
- * @memberof GroupsComponent
120
- */
65
+ * Sets the dialog options for create group modal and calls openModal method.
66
+ * @param {GroupInfo} [parentGroupInfo] -An optional parameter. Parent group info to be passed for create child group.
67
+ * @return -returns nothing
68
+ * @memberof GroupsComponent
69
+ */
121
70
  openCreateGroupForm(parentGroupInfo?: GroupInfo): void;
71
+ /**
72
+ * Sets the dialog options for edit group modal and calls openModal method.
73
+ * @param {EditGroupAndParentInfo} editGroupInfo -editing group and its parent group info to be passed for populating edit group form fields.
74
+ * @return -returns nothing
75
+ * @memberof GroupsComponent
76
+ */
77
+ openEditGroupForm(editGroupInfo: EditGroupAndParentInfo): void;
122
78
  /**
123
79
  * Opens modal component with for received params and handles form submission success and errors.
124
80
  * @param {*} dialogOptions
@@ -187,6 +143,21 @@ export declare class GroupsComponent implements OnInit, OnDestroy {
187
143
  * @memberof GroupsComponent
188
144
  */
189
145
  getGroupTypes(): void;
146
+ /**
147
+ * Handles alerts for success, error and warning.
148
+ * @param {(string | string[])} message -success or error or warning message.
149
+ * @param {AlertType} alertType
150
+ * @return -returns nothing
151
+ * @memberof GroupsComponent
152
+ */
153
+ showAlertMessage(alertType: AlertType, message: string | string[]): void;
154
+ /**
155
+ * Captures the server side errors and handles it based on the custom or Http errors.
156
+ * @param {HttpErrorResponse} error
157
+ * @return -returns nothing
158
+ * @memberof GroupsComponent
159
+ */
160
+ handleErrors(error: HttpErrorResponse): void;
190
161
  /**
191
162
  * NgOnDestroy performs necessary cleanup tasks, such as unsubscribing from subscription when the component is being destroyed.
192
163
  * @memberof GroupsComponent
@@ -0,0 +1,14 @@
1
+ import { GroupInfo } from './group-info.model';
2
+ export interface EditGroupPayload {
3
+ payload: {
4
+ groupName: string;
5
+ groupShortName: string;
6
+ groupDesc: string;
7
+ groupParentId: string | null;
8
+ groupId: string;
9
+ };
10
+ }
11
+ export interface EditGroupAndParentInfo {
12
+ groupInfo: GroupInfo;
13
+ parentGroupInfo: GroupInfo | undefined;
14
+ }
@@ -3,7 +3,9 @@ export interface GroupInfo {
3
3
  groupId: string;
4
4
  groupName: string;
5
5
  groupAcronym: string;
6
+ groupDesc?: string;
6
7
  groupType: string;
8
+ groupShortName: string;
7
9
  groupParentId: string | null;
8
10
  hasChildren: boolean;
9
11
  groupLevel: number;
@@ -1,10 +1,12 @@
1
- import { Observable } from "rxjs";
2
- import { CreateGroupPayload, CreateGroupResponse } from "../models/create-group.model";
3
- import { GroupTypeResponse } from "../models/group-types.model";
4
- import { AlertsService, HttpService } from "@ieeesa-npm/utility";
5
- import { GetGroupResponse, GetGroupsPayload } from "../models/view-group.model";
1
+ import { Observable } from 'rxjs';
2
+ import { CreateGroupPayload, CreateGroupResponse } from '../models/create-group.model';
3
+ import { GroupTypeResponse } from '../models/group-types.model';
4
+ import { AlertsService, HttpService } from '@ieeesa-npm/utility';
5
+ import { GetGroupResponse, GetGroupsPayload } from '../models/view-group.model';
6
6
  import { DeleteGroupPayload } from '../models/delete-group.model';
7
- import { GroupInfo } from "../models/group-info.model";
7
+ import { GroupInfo } from '../models/group-info.model';
8
+ import { EditGroupPayload } from '../models/edit-group.model';
9
+ import { GroupFunctionType } from '../models/group-function-type.model';
8
10
  import * as i0 from "@angular/core";
9
11
  /**
10
12
  * Groups service is an abstract layer and responsible for managing groups REST API calls.
@@ -36,6 +38,8 @@ export declare class GroupsService {
36
38
  apiBaseUrl: string;
37
39
  userPermission: any;
38
40
  selectedGroupInfo: GroupInfo | undefined;
41
+ groupFunctionType: GroupFunctionType;
42
+ selectedGroupParentInfo: GroupInfo | undefined;
39
43
  constructor(httpService: HttpService, alertService: AlertsService);
40
44
  setAppConfig(apiBaseUrl: string, userPermission: any): void;
41
45
  /**
@@ -61,10 +65,17 @@ export declare class GroupsService {
61
65
  /**
62
66
  * Posts create group form data to server using HttpService for creating new group.
63
67
  * @param {CreateGroupPayload} createGroupPayload -create group form data which includes group name, type, short name, scope.
64
- * @return {Observable<any>} -returns create group API response (success or error) as an observable.
68
+ * @return {Observable<CreateGroupResponse>} -returns create group API response (success or error) as an observable.
65
69
  * @memberof GroupsService
66
70
  */
67
71
  createGroup(createGroupPayload: CreateGroupPayload): Observable<CreateGroupResponse>;
72
+ /**
73
+ * Updates group form data to server using HttpService.
74
+ * @param {EditGroupPayload} editGroupPayload -edit group form data which includes group name, short name, scope.
75
+ * @return {Observable<EditGroupPayload>} -returns edit group API response (success or error) as an observable.
76
+ * @memberof GroupsService
77
+ */
78
+ editGroup(editGroupPayload: EditGroupPayload): Observable<CreateGroupResponse>;
68
79
  /**
69
80
  * This method will parse the error codes and return the respective error message for each code.
70
81
  * @param {string[]} errorCodes
@@ -75,15 +86,34 @@ export declare class GroupsService {
75
86
  /**
76
87
  * Sets selected group info.
77
88
  * @param {(GroupInfo | undefined)} selectedGroupInfo -selected group info.
89
+ * @param {(GroupInfo | undefined)} [selectedGroupParentInfo] -selected parent group info.
78
90
  * @memberof GroupsService
79
91
  */
80
- setSelectedGroupInfo(selectedGroupInfo: GroupInfo | undefined): void;
92
+ setSelectedGroupInfo(selectedGroupInfo: GroupInfo | undefined, selectedGroupParentInfo?: GroupInfo | undefined): void;
81
93
  /**
82
94
  * Returns the selected group info.
83
95
  * @return {(GroupInfo | undefined)} -group info.
84
96
  * @memberof GroupsService
85
97
  */
86
98
  getSelectedGroupInfo(): GroupInfo | undefined;
99
+ /**
100
+ * Returns the selected group parent group info.
101
+ * @return {(GroupInfo | undefined)} -group info.
102
+ * @memberof GroupsService
103
+ */
104
+ getSelectedGroupParentInfo(): GroupInfo | undefined;
105
+ /**
106
+ * Sets group function type.
107
+ * @param {GroupFunctionType} groupFunctionType -group function type.
108
+ * @memberof GroupsService
109
+ */
110
+ setGroupFunctionType(groupFunctionType: GroupFunctionType): void;
111
+ /**
112
+ * Returns group function type.
113
+ * @return {GroupFunctionType} -group function type.
114
+ * @memberof GroupsService
115
+ */
116
+ getGroupFunctionType(): GroupFunctionType;
87
117
  static ɵfac: i0.ɵɵFactoryDeclaration<GroupsService, never>;
88
118
  static ɵprov: i0.ɵɵInjectableDeclaration<GroupsService>;
89
119
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ieeesa-npm/groups",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^16.1.0",
6
6
  "@angular/core": "^16.1.0",
7
- "@ieeesa-npm/presentation": "^0.4.2",
8
- "@ieeesa-npm/shared-styles": "^0.0.9",
9
- "@ieeesa-npm/utility": "^0.3.3"
7
+ "@ieeesa-npm/presentation": "^0.4.3",
8
+ "@ieeesa-npm/shared-styles": "^0.1.0",
9
+ "@ieeesa-npm/utility": "^0.3.4"
10
10
  },
11
11
  "dependencies": {
12
12
  "tslib": "^2.3.0"
package/public-api.d.ts CHANGED
@@ -7,6 +7,9 @@ export * from './lib/models/group-function-type.model';
7
7
  export * from './lib/models/group-info.model';
8
8
  export * from './lib/models/group-types.model';
9
9
  export * from './lib/models/view-group.model';
10
+ export * from './lib/models/edit-group.model';
11
+ export * from './lib/models/form-status.model';
12
+ export * from './lib/models/delete-group.model';
10
13
  export * from './lib/services/groups.service';
11
14
  export * from './lib/assets/form-validations';
12
15
  export * from './lib/groups.module';