@pega/angular-sdk-overrides 0.23.7 → 0.24.2

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.
Files changed (39) hide show
  1. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +5 -2
  2. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +3 -1
  3. package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.html +1 -1
  4. package/lib/designSystemExtension/operator/operator.component.ts +6 -4
  5. package/lib/field/check-box/check-box.component.html +16 -15
  6. package/lib/field/check-box/check-box.component.scss +14 -1
  7. package/lib/field/check-box/check-box.component.ts +127 -44
  8. package/lib/field/currency/currency.component.html +4 -4
  9. package/lib/field/currency/currency.component.ts +31 -19
  10. package/lib/field/date-time/date-time.component.html +5 -5
  11. package/lib/field/date-time/date-time.component.ts +8 -39
  12. package/lib/field/decimal/decimal.component.html +13 -4
  13. package/lib/field/decimal/decimal.component.ts +41 -5
  14. package/lib/field/multiselect/multiselect.component.html +34 -0
  15. package/lib/field/multiselect/multiselect.component.scss +7 -0
  16. package/lib/field/multiselect/multiselect.component.spec.ts +21 -0
  17. package/lib/field/multiselect/multiselect.component.ts +363 -0
  18. package/lib/field/multiselect/utils.ts +209 -0
  19. package/lib/field/percentage/percentage.component.html +4 -3
  20. package/lib/field/percentage/percentage.component.ts +24 -5
  21. package/lib/field/user-reference/user-reference.component.html +50 -45
  22. package/lib/field/user-reference/user-reference.component.ts +33 -15
  23. package/lib/infra/Containers/flow-container/flow-container.component.ts +15 -9
  24. package/lib/infra/assignment/assignment.component.ts +30 -1
  25. package/lib/infra/multi-step/multi-step.component.html +1 -1
  26. package/lib/infra/navbar/navbar.component.html +4 -4
  27. package/lib/infra/navbar/navbar.component.ts +7 -3
  28. package/lib/template/case-summary/case-summary.component.ts +37 -3
  29. package/lib/template/case-view/case-view.component.html +1 -1
  30. package/lib/template/wss-nav-bar/wss-nav-bar.component.html +1 -1
  31. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +2 -1
  32. package/lib/widget/attachment/attachment.component.html +9 -1
  33. package/lib/widget/attachment/attachment.component.ts +4 -1
  34. package/lib/widget/case-history/case-history.component.ts +1 -1
  35. package/lib/widget/file-utility/file-utility.component.html +2 -2
  36. package/lib/widget/file-utility/file-utility.component.ts +13 -13
  37. package/lib/widget/list-utility/list-utility.component.html +1 -1
  38. package/lib/widget/todo/todo.component.html +3 -3
  39. package/package.json +1 -1
@@ -3,18 +3,21 @@ import { CommonModule } from '@angular/common';
3
3
  import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
4
4
  import { MatInputModule } from '@angular/material/input';
5
5
  import { MatFormFieldModule } from '@angular/material/form-field';
6
+ import { NgxCurrencyDirective, NgxCurrencyInputMode } from 'ngx-currency';
6
7
  import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
7
8
  import { Utils } from '@pega/angular-sdk-components';
8
9
  import { ComponentMapperComponent } from '@pega/angular-sdk-components';
9
10
  import { handleEvent } from '@pega/angular-sdk-components';
10
- import { ThousandSeparatorDirective } from '@pega/angular-sdk-components';
11
+ import { getCurrencyCharacters, getCurrencyOptions } from '@pega/angular-sdk-components';
11
12
  import { PConnFieldProps } from '@pega/angular-sdk-components';
13
+ import { format } from '@pega/angular-sdk-components';
12
14
 
13
15
  interface DecimalProps extends PConnFieldProps {
14
16
  // If any, enter additional props that only exist on Decimal here
15
17
  currencyISOCode?: string;
16
18
  decimalPrecision?: number;
17
19
  showGroupSeparators?: string;
20
+ formatter?: string;
18
21
  }
19
22
 
20
23
  @Component({
@@ -28,7 +31,7 @@ interface DecimalProps extends PConnFieldProps {
28
31
  FormsModule,
29
32
  MatFormFieldModule,
30
33
  MatInputModule,
31
- ThousandSeparatorDirective,
34
+ NgxCurrencyDirective,
32
35
  forwardRef(() => ComponentMapperComponent)
33
36
  ]
34
37
  })
@@ -41,7 +44,7 @@ export class DecimalComponent implements OnInit, OnDestroy {
41
44
  configProps$: DecimalProps;
42
45
 
43
46
  label$ = '';
44
- value$: number;
47
+ value$: any;
45
48
  bRequired$ = false;
46
49
  bReadonly$ = false;
47
50
  bDisabled$ = false;
@@ -55,6 +58,13 @@ export class DecimalComponent implements OnInit, OnDestroy {
55
58
  placeholder: string;
56
59
 
57
60
  fieldControl = new FormControl<number | null>(null, null);
61
+ currDec: string;
62
+ currSep: string;
63
+ currSym: string;
64
+ decimalPrecision: number | undefined;
65
+ formatter;
66
+ formattedValue: any;
67
+ inputMode: any;
58
68
 
59
69
  constructor(
60
70
  private angularPConnect: AngularPConnectService,
@@ -119,6 +129,7 @@ export class DecimalComponent implements OnInit, OnDestroy {
119
129
  this.testId = this.configProps$.testId;
120
130
  this.label$ = this.configProps$.label;
121
131
  this.displayMode$ = this.configProps$.displayMode;
132
+ this.inputMode = NgxCurrencyInputMode.Natural;
122
133
  let nValue: any = this.configProps$.value;
123
134
  if (nValue) {
124
135
  if (typeof nValue === 'string') {
@@ -128,6 +139,21 @@ export class DecimalComponent implements OnInit, OnDestroy {
128
139
  }
129
140
  this.helperText = this.configProps$.helperText;
130
141
  this.placeholder = this.configProps$.placeholder || '';
142
+ const showGroupSeparators = this.configProps$.showGroupSeparators;
143
+ const currencyISOCode: any = this.configProps$?.currencyISOCode;
144
+
145
+ const theSymbols = getCurrencyCharacters(currencyISOCode);
146
+ this.currDec = theSymbols.theDecimalIndicator;
147
+ this.currSep = showGroupSeparators ? theSymbols.theDigitGroupSeparator : '';
148
+
149
+ const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
150
+ this.formatter = this.configProps$.formatter;
151
+
152
+ if (this.formatter === 'Currency') {
153
+ this.formattedValue = format(this.value$, this.formatter.toLowerCase(), theCurrencyOptions);
154
+ } else {
155
+ this.formattedValue = format(this.value$, this.pConn$.getComponentName().toLowerCase(), theCurrencyOptions);
156
+ }
131
157
 
132
158
  // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
133
159
  setTimeout(() => {
@@ -156,6 +182,12 @@ export class DecimalComponent implements OnInit, OnDestroy {
156
182
  this.fieldControl.enable();
157
183
  }
158
184
 
185
+ if (this.bReadonly$ && this.formatter === 'Currency') {
186
+ this.currSym = theSymbols.theCurrencySymbol;
187
+ } else {
188
+ this.currSym = '';
189
+ }
190
+
159
191
  this.componentReference = (this.pConn$.getStateProps() as any).value;
160
192
  }
161
193
 
@@ -163,8 +195,12 @@ export class DecimalComponent implements OnInit, OnDestroy {
163
195
  const actionsApi = this.pConn$?.getActionsApi();
164
196
  const propName = (this.pConn$?.getStateProps() as any).value;
165
197
  let value = event?.target?.value;
166
- value = value.replace(/,/g, '');
167
- value = value !== '' ? Number(value) : value;
198
+ if (this.currSep === ',') {
199
+ value = value.replace(/,/g, '');
200
+ } else {
201
+ value = value?.replace(/\./g, '');
202
+ value = value?.replace(/,/g, '.');
203
+ }
168
204
  handleEvent(actionsApi, 'changeNblur', propName, value);
169
205
  }
170
206
 
@@ -0,0 +1,34 @@
1
+ <div [formGroup]="formGroup$">
2
+ <mat-form-field class="psdk-full-width" subscriptSizing="dynamic">
3
+ <mat-label>{{ label$ }}</mat-label>
4
+ <mat-chip-grid #chipGrid>
5
+ <ng-container *ngFor="let select of selectedItems">
6
+ <mat-chip-row (removed)="removeChip(select)">
7
+ {{ select.primary }}
8
+ <button matChipRemove>
9
+ <mat-icon>cancel</mat-icon>
10
+ </button>
11
+ </mat-chip-row>
12
+ </ng-container>
13
+ </mat-chip-grid>
14
+ <input
15
+ matInput
16
+ [placeholder]="placeholder"
17
+ [formControl]="fieldControl"
18
+ [value]="value$"
19
+ [required]="bRequired$"
20
+ [matAutocomplete]="auto"
21
+ (input)="fieldOnChange($event)"
22
+ [matChipInputFor]="chipGrid"
23
+ #trigger="matAutocompleteTrigger"
24
+ />
25
+ <mat-autocomplete #auto="matAutocomplete">
26
+ <mat-option *ngFor="let item of itemsTree" [value]="item.primary" (click)="optionClicked($event, item, trigger)">
27
+ <mat-checkbox [checked]="item.selected" (click)="optionClicked($event, item, trigger)">
28
+ <span>{{ item.primary }}</span>
29
+ </mat-checkbox>
30
+ </mat-option>
31
+ </mat-autocomplete>
32
+ <mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
33
+ </mat-form-field>
34
+ </div>
@@ -0,0 +1,7 @@
1
+ .psdk-full-width {
2
+ width: 100%;
3
+ }
4
+
5
+ ::ng-deep .mat-mdc-form-field-infix {
6
+ padding-left: 10px;
7
+ }
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { MultiselectComponent } from './multiselect.component';
4
+
5
+ describe('MultiselectComponent', () => {
6
+ let component: MultiselectComponent;
7
+ let fixture: ComponentFixture<MultiselectComponent>;
8
+
9
+ beforeEach(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [MultiselectComponent]
12
+ });
13
+ fixture = TestBed.createComponent(MultiselectComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,363 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, forwardRef, Input, OnDestroy, OnInit } from '@angular/core';
3
+ import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
4
+ import { MatAutocompleteModule, MatAutocompleteSelectedEvent, MatAutocompleteTrigger } from '@angular/material/autocomplete';
5
+ import { MatChipsModule } from '@angular/material/chips';
6
+ import { MatCheckboxModule } from '@angular/material/checkbox';
7
+ import { MatOptionModule } from '@angular/material/core';
8
+ import { MatFormFieldModule } from '@angular/material/form-field';
9
+ import { MatInputModule } from '@angular/material/input';
10
+ import { MatIconModule } from '@angular/material/icon';
11
+ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
12
+ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
13
+ import { Utils } from '@pega/angular-sdk-components';
14
+ import { doSearch, getDisplayFieldsMetaData, getGroupDataForItemsTree, preProcessColumns } from './utils';
15
+ import { deleteInstruction, insertInstruction } from '@pega/angular-sdk-components';
16
+
17
+ @Component({
18
+ selector: 'app-multiselect',
19
+ templateUrl: './multiselect.component.html',
20
+ styleUrls: ['./multiselect.component.scss'],
21
+ standalone: true,
22
+ imports: [
23
+ CommonModule,
24
+ ReactiveFormsModule,
25
+ MatFormFieldModule,
26
+ MatInputModule,
27
+ MatAutocompleteModule,
28
+ MatOptionModule,
29
+ MatCheckboxModule,
30
+ MatIconModule,
31
+ MatChipsModule,
32
+ forwardRef(() => ComponentMapperComponent)
33
+ ]
34
+ })
35
+ export class MultiselectComponent implements OnInit, OnDestroy {
36
+ @Input() pConn$: typeof PConnect;
37
+ @Input() formGroup$: FormGroup;
38
+
39
+ // Used with AngularPConnect
40
+ angularPConnectData: AngularPConnectData = {};
41
+
42
+ label$ = '';
43
+ value$ = '';
44
+ bRequired$ = false;
45
+ bDisabled$ = false;
46
+ bVisible$ = true;
47
+ controlName$: string;
48
+ bHasForm$ = true;
49
+ listType: string;
50
+ placeholder: string;
51
+ fieldControl = new FormControl('', null);
52
+ parameters: {};
53
+ hideLabel: boolean;
54
+ configProps$: any;
55
+
56
+ referenceList: any;
57
+ selectionKey: string;
58
+ primaryField: string;
59
+ initialCaseClass: any;
60
+ showSecondaryInSearchOnly = false;
61
+ isGroupData = false;
62
+ referenceType;
63
+ secondaryFields;
64
+ groupDataSource = [];
65
+ matchPosition = 'contains';
66
+ maxResultsDisplay;
67
+ groupColumnsConfig = [{}];
68
+ selectionList;
69
+ listActions: any;
70
+ selectedItems: any[] = [];
71
+ itemsTreeBaseData = [];
72
+ displayFieldMeta: any;
73
+ dataApiObj: any;
74
+ itemsTree: any[] = [];
75
+ trigger: any;
76
+
77
+ constructor(
78
+ private angularPConnect: AngularPConnectService,
79
+ private utils: Utils
80
+ ) {}
81
+
82
+ ngOnInit(): void {
83
+ // First thing in initialization is registering and subscribing to the AngularPConnect service
84
+ this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
85
+ this.controlName$ = this.angularPConnect.getComponentID(this);
86
+
87
+ // Then, continue on with other initialization
88
+ this.checkAndUpdate();
89
+
90
+ if (this.formGroup$) {
91
+ // add control to formGroup
92
+ this.formGroup$.addControl(this.controlName$, this.fieldControl);
93
+ this.fieldControl.setValue(this.value$);
94
+ this.bHasForm$ = true;
95
+ } else {
96
+ this.bHasForm$ = false;
97
+ }
98
+ }
99
+
100
+ ngOnDestroy(): void {
101
+ if (this.formGroup$) {
102
+ this.formGroup$.removeControl(this.controlName$);
103
+ }
104
+
105
+ if (this.angularPConnectData.unsubscribeFn) {
106
+ this.angularPConnectData.unsubscribeFn();
107
+ }
108
+ }
109
+
110
+ // Callback passed when subscribing to store change
111
+ onStateChange() {
112
+ this.checkAndUpdate();
113
+ }
114
+
115
+ checkAndUpdate() {
116
+ // Should always check the bridge to see if the component should
117
+ // update itself (re-render)
118
+ const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
119
+
120
+ // ONLY call updateSelf when the component should update
121
+ if (bUpdateSelf) {
122
+ this.updateSelf();
123
+ }
124
+ }
125
+
126
+ // updateSelf
127
+ updateSelf() {
128
+ this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps());
129
+
130
+ let { datasource = [], columns = [{}] } = this.configProps$;
131
+ this.setPropertyValuesFromProps();
132
+
133
+ if (this.referenceList.length > 0) {
134
+ datasource = this.referenceList;
135
+ columns = [
136
+ {
137
+ value: this.primaryField,
138
+ display: 'true',
139
+ useForSearch: true,
140
+ primary: 'true'
141
+ },
142
+ {
143
+ value: this.selectionKey,
144
+ setProperty: this.selectionKey,
145
+ key: 'true'
146
+ }
147
+ ];
148
+ let secondaryColumns: any = [];
149
+ if (this.secondaryFields) {
150
+ secondaryColumns = this.secondaryFields.map(secondaryField => ({
151
+ value: secondaryField,
152
+ display: 'true',
153
+ secondary: 'true',
154
+ useForSearch: 'true'
155
+ }));
156
+ } else {
157
+ secondaryColumns = [
158
+ {
159
+ value: this.selectionKey,
160
+ display: 'true',
161
+ secondary: 'true',
162
+ useForSearch: 'true'
163
+ }
164
+ ];
165
+ }
166
+ if (this.referenceType === 'Case') {
167
+ columns = [...columns, ...secondaryColumns];
168
+ }
169
+ }
170
+
171
+ this.value$ = this.value$ ? this.value$ : '';
172
+ const contextName = this.pConn$.getContextName();
173
+
174
+ const dataConfig = {
175
+ dataSource: datasource,
176
+ groupDataSource: this.groupDataSource,
177
+ isGroupData: this.isGroupData,
178
+ showSecondaryInSearchOnly: this.showSecondaryInSearchOnly,
179
+ parameters: this.parameters,
180
+ matchPosition: this.matchPosition,
181
+ listType: this.listType,
182
+ maxResultsDisplay: this.maxResultsDisplay || '100',
183
+ columns: preProcessColumns(columns),
184
+ groupColumnsConfig: preProcessColumns(this.groupColumnsConfig)
185
+ };
186
+
187
+ const groupsDisplayFieldMeta = this.listType !== 'associated' ? getDisplayFieldsMetaData(dataConfig.groupColumnsConfig) : null;
188
+
189
+ this.itemsTreeBaseData = getGroupDataForItemsTree(this.groupDataSource, groupsDisplayFieldMeta, this.showSecondaryInSearchOnly) || [];
190
+
191
+ this.itemsTree = this.isGroupData ? getGroupDataForItemsTree(this.groupDataSource, groupsDisplayFieldMeta, this.showSecondaryInSearchOnly) : [];
192
+
193
+ this.displayFieldMeta = this.listType !== 'associated' ? getDisplayFieldsMetaData(dataConfig.columns) : null;
194
+
195
+ this.listActions = this.pConn$.getListActions();
196
+ this.pConn$.setReferenceList(this.selectionList);
197
+
198
+ if (this.configProps$.visibility != null) {
199
+ this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
200
+ }
201
+
202
+ // disabled
203
+ if (this.configProps$.disabled != undefined) {
204
+ this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
205
+ }
206
+
207
+ if (this.bDisabled$) {
208
+ this.fieldControl.disable();
209
+ } else {
210
+ this.fieldControl.enable();
211
+ }
212
+
213
+ if (this.listType !== 'associated') {
214
+ PCore.getDataApi()
215
+ ?.init(dataConfig, contextName)
216
+ .then(async dataObj => {
217
+ this.dataApiObj = dataObj;
218
+ if (!this.isGroupData) {
219
+ this.getCaseListBasedOnParams(this.value$ ?? '', '', [...this.selectedItems], [...this.itemsTree]);
220
+ }
221
+ });
222
+ }
223
+ }
224
+
225
+ setPropertyValuesFromProps() {
226
+ this.label$ = this.configProps$.label;
227
+ this.placeholder = this.configProps$.placeholder || '';
228
+ this.listType = this.configProps$.listType ? this.configProps$.listType : '';
229
+ this.hideLabel = this.configProps$.hideLabel;
230
+ this.parameters = this.configProps$?.parameters ? this.configProps$?.parameters : {};
231
+ this.referenceList = this.configProps$?.referenceList;
232
+ this.selectionKey = this.configProps$?.selectionKey;
233
+ this.primaryField = this.configProps$?.primaryField;
234
+ this.initialCaseClass = this.configProps$?.initialCaseClass;
235
+ this.showSecondaryInSearchOnly = this.configProps$?.showSecondaryInSearchOnly ? this.configProps$?.showSecondaryInSearchOnly : false;
236
+ this.isGroupData = this.configProps$?.isGroupData ? this.configProps$.isGroupData : false;
237
+ this.referenceType = this.configProps$?.referenceType;
238
+ this.secondaryFields = this.configProps$?.secondaryFields;
239
+ this.groupDataSource = this.configProps$?.groupDataSource ? this.configProps$?.groupDataSource : [];
240
+ this.matchPosition = this.configProps$?.matchPosition ? this.configProps$?.matchPosition : 'contains';
241
+ this.maxResultsDisplay = this.configProps$?.maxResultsDisplay;
242
+ this.groupColumnsConfig = this.configProps$?.groupColumnsConfig ? this.configProps$?.groupColumnsConfig : [{}];
243
+ this.selectionList = this.configProps$?.selectionList;
244
+ this.value$ = this.configProps$?.value;
245
+ }
246
+
247
+ // main search function trigger
248
+ getCaseListBasedOnParams(searchText, group, selectedRows, currentItemsTree, isTriggeredFromSearch = false) {
249
+ if (this.referenceList && this.referenceList.length > 0) {
250
+ this.listActions.getSelectedRows(true).then(result => {
251
+ selectedRows =
252
+ result.length > 0
253
+ ? result.map(item => {
254
+ return {
255
+ id: item[this.selectionKey.startsWith('.') ? this.selectionKey.substring(1) : this.selectionKey],
256
+ primary: item[this.primaryField.startsWith('.') ? this.primaryField.substring(1) : this.primaryField]
257
+ };
258
+ })
259
+ : [];
260
+ this.selectedItems = selectedRows;
261
+
262
+ const initalItemsTree = isTriggeredFromSearch || !currentItemsTree ? [...this.itemsTreeBaseData] : [...currentItemsTree];
263
+
264
+ doSearch(
265
+ searchText,
266
+ group,
267
+ this.initialCaseClass,
268
+ this.displayFieldMeta,
269
+ this.dataApiObj,
270
+ initalItemsTree,
271
+ this.isGroupData,
272
+ this.showSecondaryInSearchOnly,
273
+ selectedRows || []
274
+ ).then(res => {
275
+ this.itemsTree = res || [];
276
+ if (this.trigger) {
277
+ this.trigger.openPanel();
278
+ }
279
+ });
280
+ });
281
+ }
282
+ }
283
+
284
+ fieldOnChange(event: Event) {
285
+ this.value$ = (event.target as HTMLInputElement).value;
286
+ this.getCaseListBasedOnParams(this.value$, '', [...this.selectedItems], [...this.itemsTree], true);
287
+ }
288
+
289
+ optionChanged(event: MatAutocompleteSelectedEvent) {
290
+ this.angularPConnectData.actions?.onChange(this, event);
291
+ }
292
+
293
+ optionClicked = (event: Event, data: any, trigger?: MatAutocompleteTrigger): void => {
294
+ event.stopPropagation();
295
+ this.toggleSelection(data, trigger);
296
+ };
297
+
298
+ toggleSelection = (data: any, trigger?: MatAutocompleteTrigger): void => {
299
+ data.selected = !data.selected;
300
+ this.trigger = trigger;
301
+ this.itemsTree.map((ele: any) => {
302
+ if (ele.id === data.id) {
303
+ ele.selected = data.selected;
304
+ }
305
+ return ele;
306
+ });
307
+
308
+ if (data.selected === true) {
309
+ this.selectedItems.push(data);
310
+ } else {
311
+ const index = this.selectedItems.findIndex(value => value.id === data.id);
312
+ this.selectedItems.splice(index, 1);
313
+ }
314
+
315
+ this.value$ = '';
316
+ // if this is a referenceList case
317
+ if (this.referenceList) this.setSelectedItemsForReferenceList(data);
318
+
319
+ this.getCaseListBasedOnParams(this.value$, '', [...this.selectedItems], [...this.itemsTree], true);
320
+ };
321
+
322
+ removeChip = (data: any): void => {
323
+ if (data) {
324
+ data = this.itemsTree.filter((ele: any) => {
325
+ return ele.id === data.id;
326
+ });
327
+ this.toggleSelection(data[0]);
328
+ }
329
+ };
330
+
331
+ setSelectedItemsForReferenceList(data: any) {
332
+ // Clear error messages if any
333
+ const propName = (this.pConn$.getStateProps() as any).selectionList;
334
+ this.pConn$.clearErrorMessages({
335
+ property: propName,
336
+ category: '',
337
+ context: ''
338
+ });
339
+ const { selected } = data;
340
+ if (selected) {
341
+ insertInstruction(this.pConn$, this.selectionList, this.selectionKey, this.primaryField, data);
342
+ } else {
343
+ deleteInstruction(this.pConn$, this.selectionList, this.selectionKey, data);
344
+ }
345
+ }
346
+
347
+ getErrorMessage() {
348
+ let errMessage = '';
349
+
350
+ // look for validation messages for json, pre-defined or just an error pushed from workitem (400)
351
+ if (this.fieldControl.hasError('message')) {
352
+ errMessage = this.angularPConnectData.validateMessage ?? '';
353
+ return errMessage;
354
+ }
355
+ if (this.fieldControl.hasError('required')) {
356
+ errMessage = 'You must enter a value';
357
+ } else if (this.fieldControl.errors) {
358
+ errMessage = this.fieldControl.errors.toString();
359
+ }
360
+
361
+ return errMessage;
362
+ }
363
+ }