@pega/angular-sdk-overrides 24.1.10 → 24.2.10
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/lib/designSystemExtension/alert-banner/alert-banner.component.ts +1 -1
- package/lib/designSystemExtension/case-create-stage/case-create-stage.component.ts +1 -1
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +2 -1
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +1 -1
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +4 -1
- package/lib/designSystemExtension/operator/operator.component.ts +1 -1
- package/lib/designSystemExtension/pulse/pulse.component.ts +7 -7
- package/lib/field/auto-complete/auto-complete.component.ts +16 -13
- package/lib/field/check-box/check-box.component.ts +11 -10
- package/lib/field/currency/currency.component.html +4 -4
- package/lib/field/currency/currency.component.ts +32 -15
- package/lib/field/date/date.component.html +1 -6
- package/lib/field/date/date.component.ts +22 -39
- package/lib/field/date-time/date-time.component.html +1 -2
- package/lib/field/date-time/date-time.component.ts +18 -13
- package/lib/field/decimal/decimal.component.html +3 -3
- package/lib/field/decimal/decimal.component.ts +21 -18
- package/lib/field/dropdown/dropdown.component.ts +132 -18
- package/lib/field/email/email.component.ts +14 -4
- package/lib/field/group/group.component.ts +2 -2
- package/lib/field/integer/integer.component.html +1 -1
- package/lib/field/integer/integer.component.ts +13 -5
- package/lib/field/multiselect/multiselect.component.ts +15 -5
- package/lib/field/percentage/percentage.component.html +4 -4
- package/lib/field/percentage/percentage.component.ts +34 -19
- package/lib/field/phone/phone.component.html +1 -1
- package/lib/field/phone/phone.component.ts +11 -14
- package/lib/field/radio-buttons/radio-buttons.component.ts +9 -9
- package/lib/field/rich-text/rich-text.component.ts +8 -6
- package/lib/field/scalar-list/scalar-list.component.ts +3 -4
- package/lib/field/text/text.component.ts +2 -0
- package/lib/field/text-area/text-area.component.html +2 -1
- package/lib/field/text-area/text-area.component.ts +13 -6
- package/lib/field/text-input/text-input.component.html +1 -1
- package/lib/field/text-input/text-input.component.ts +13 -5
- package/lib/field/time/time.component.html +2 -2
- package/lib/field/time/time.component.ts +21 -7
- package/lib/field/url/url.component.html +1 -1
- package/lib/field/url/url.component.ts +13 -5
- package/lib/field/user-reference/user-reference.component.html +2 -10
- package/lib/field/user-reference/user-reference.component.ts +42 -14
- package/lib/infra/Containers/flow-container/flow-container.component.html +1 -1
- package/lib/infra/Containers/flow-container/flow-container.component.ts +10 -6
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +1 -1
- package/lib/infra/Containers/preview-view-container/preview-view-container.component.ts +1 -1
- package/lib/infra/Containers/view-container/helper.ts +22 -0
- package/lib/infra/Containers/view-container/view-container.component.ts +5 -17
- package/lib/infra/assignment/assignment.component.ts +0 -1
- package/lib/infra/defer-load/defer-load.component.ts +4 -4
- package/lib/infra/navbar/navbar.component.ts +3 -3
- package/lib/infra/root-container/root-container.component.ts +3 -3
- package/lib/infra/stages/stages.component.scss +2 -2
- package/lib/infra/view/view.component.html +7 -20
- package/lib/infra/view/view.component.ts +20 -2
- package/lib/template/app-shell/app-shell.component.ts +20 -2
- package/lib/template/base/details-template-base.ts +67 -0
- package/lib/template/base/form-template-base.ts +10 -0
- package/lib/template/case-summary/case-summary.component.ts +1 -1
- package/lib/template/case-view/case-view.component.html +4 -4
- package/lib/template/case-view/case-view.component.ts +8 -13
- package/lib/template/confirmation/confirmation.component.ts +1 -1
- package/lib/template/data-reference/data-reference.component.ts +36 -40
- package/lib/template/default-form/default-form.component.html +0 -4
- package/lib/template/default-form/default-form.component.ts +7 -23
- package/lib/template/details/details.component.ts +7 -41
- package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +6 -39
- package/lib/template/details-one-column/details-one-column.component.ts +7 -42
- package/lib/template/details-sub-tabs/details-sub-tabs.component.html +1 -2
- package/lib/template/details-sub-tabs/details-sub-tabs.component.ts +5 -37
- package/lib/template/details-three-column/details-three-column.component.ts +7 -43
- package/lib/template/details-two-column/details-two-column.component.ts +8 -44
- package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +7 -42
- package/lib/template/dynamic-tabs/dynamic-tabs.component.html +3 -0
- package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +8 -3
- package/lib/template/field-group-template/field-group-template.component.ts +2 -4
- package/lib/template/field-value-list/field-value-list.component.html +1 -1
- package/lib/template/field-value-list/field-value-list.component.scss +2 -1
- package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -2
- package/lib/template/list-view/list-view.component.html +3 -0
- package/lib/template/list-view/list-view.component.scss +11 -0
- package/lib/template/list-view/list-view.component.ts +24 -4
- package/lib/template/list-view/listViewHelpers.ts +1 -1
- package/lib/template/narrow-wide-form/narrow-wide-form.component.ts +1 -1
- package/lib/template/one-column/one-column.component.ts +4 -3
- package/lib/template/one-column-tab/one-column-tab.component.ts +1 -1
- package/lib/template/page/page.component.ts +1 -1
- package/lib/template/promoted-filters/promoted-filters.component.ts +1 -1
- package/lib/template/repeating-structures/repeating-structures.component.ts +1 -1
- package/lib/template/simple-table-manual/helpers.ts +1 -1
- package/lib/template/simple-table-manual/simple-table-manual.component.scss +1 -0
- package/lib/template/simple-table-manual/simple-table-manual.component.ts +15 -13
- package/lib/template/simple-table-select/simple-table-select.component.ts +3 -3
- package/lib/template/three-column/three-column.component.ts +4 -3
- package/lib/template/two-column/two-column.component.ts +4 -3
- package/lib/template/two-column-tab/two-column-tab.component.ts +1 -1
- package/lib/template/wide-narrow-form/wide-narrow-form.component.ts +4 -3
- package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +1 -1
- package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +3 -3
- package/lib/widget/attachment/attachment.component.ts +7 -9
- package/lib/widget/feed-container/feed-container.component.ts +7 -7
- package/lib/widget/file-utility/file-utility.component.ts +2 -5
- package/lib/widget/todo/todo.component.html +2 -2
- package/lib/widget/todo/todo.component.ts +93 -83
- package/package.json +1 -1
|
@@ -58,9 +58,9 @@ export class DecimalComponent implements OnInit, OnDestroy {
|
|
|
58
58
|
placeholder: string;
|
|
59
59
|
|
|
60
60
|
fieldControl = new FormControl<number | null>(null, null);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
decimalSeparator: string;
|
|
62
|
+
thousandSeparator: string;
|
|
63
|
+
currencySymbol = '';
|
|
64
64
|
decimalPrecision: number | undefined;
|
|
65
65
|
formatter;
|
|
66
66
|
formattedValue: any;
|
|
@@ -140,19 +140,19 @@ export class DecimalComponent implements OnInit, OnDestroy {
|
|
|
140
140
|
this.helperText = this.configProps$.helperText;
|
|
141
141
|
this.placeholder = this.configProps$.placeholder || '';
|
|
142
142
|
const showGroupSeparators = this.configProps$.showGroupSeparators;
|
|
143
|
-
const currencyISOCode
|
|
143
|
+
const currencyISOCode = this.configProps$?.currencyISOCode ?? '';
|
|
144
144
|
|
|
145
145
|
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
146
|
-
this.
|
|
147
|
-
this.
|
|
146
|
+
this.decimalSeparator = theSymbols.theDecimalIndicator;
|
|
147
|
+
this.thousandSeparator = showGroupSeparators ? theSymbols.theDigitGroupSeparator : '';
|
|
148
148
|
|
|
149
149
|
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
150
150
|
this.formatter = this.configProps$.formatter;
|
|
151
151
|
|
|
152
|
-
if (this.formatter
|
|
152
|
+
if (this.formatter) {
|
|
153
153
|
this.formattedValue = format(this.value$, this.formatter.toLowerCase(), theCurrencyOptions);
|
|
154
154
|
} else {
|
|
155
|
-
this.formattedValue = format(this.value$,
|
|
155
|
+
this.formattedValue = format(this.value$, 'decimal', theCurrencyOptions);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
@@ -183,24 +183,27 @@ export class DecimalComponent implements OnInit, OnDestroy {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
if (this.bReadonly$ && this.formatter === 'Currency') {
|
|
186
|
-
this.
|
|
187
|
-
} else {
|
|
188
|
-
this.currSym = '';
|
|
186
|
+
this.currencySymbol = theSymbols.theCurrencySymbol;
|
|
189
187
|
}
|
|
190
188
|
this.decimalPrecision = this.configProps$?.decimalPrecision ?? 2;
|
|
191
189
|
|
|
192
|
-
this.componentReference =
|
|
190
|
+
this.componentReference = this.pConn$.getStateProps().value;
|
|
193
191
|
}
|
|
194
192
|
|
|
195
193
|
fieldOnBlur(event: any) {
|
|
196
194
|
const actionsApi = this.pConn$?.getActionsApi();
|
|
197
|
-
const propName =
|
|
195
|
+
const propName = this.pConn$?.getStateProps().value;
|
|
198
196
|
let value = event?.target?.value;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
value = value?.replace(
|
|
197
|
+
// replacing thousand separator with empty string as not required in api call
|
|
198
|
+
if (this.configProps$.showGroupSeparators) {
|
|
199
|
+
const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
|
|
200
|
+
const regExp = new RegExp(String.raw`${thousandSep}`, 'g');
|
|
201
|
+
value = value?.replace(regExp, '');
|
|
202
|
+
}
|
|
203
|
+
// replacing decimal separator with '.'
|
|
204
|
+
if (this.decimalSeparator !== '.') {
|
|
205
|
+
const regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
|
|
206
|
+
value = value.replace(regExp, '.');
|
|
204
207
|
}
|
|
205
208
|
handleEvent(actionsApi, 'changeNblur', propName, value);
|
|
206
209
|
}
|
|
@@ -5,12 +5,47 @@ import { MatOptionModule } from '@angular/material/core';
|
|
|
5
5
|
import { MatSelectModule } from '@angular/material/select';
|
|
6
6
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
7
7
|
import { interval } from 'rxjs';
|
|
8
|
+
import isEqual from 'fast-deep-equal';
|
|
8
9
|
import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
|
|
10
|
+
import { DatapageService } from '@pega/angular-sdk-components';
|
|
9
11
|
import { Utils } from '@pega/angular-sdk-components';
|
|
10
12
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
11
13
|
import { handleEvent } from '@pega/angular-sdk-components';
|
|
12
14
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
13
15
|
|
|
16
|
+
function flattenParameters(params = {}) {
|
|
17
|
+
const flatParams = {};
|
|
18
|
+
Object.keys(params).forEach(key => {
|
|
19
|
+
const { name, value: theVal } = params[key];
|
|
20
|
+
flatParams[name] = theVal;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return flatParams;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function preProcessColumns(columnList) {
|
|
27
|
+
return columnList.map(col => {
|
|
28
|
+
const tempColObj = { ...col };
|
|
29
|
+
tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;
|
|
30
|
+
return tempColObj;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function getDisplayFieldsMetaData(columnList) {
|
|
35
|
+
const displayColumns = columnList.filter(col => col.display === 'true');
|
|
36
|
+
const metaDataObj: any = { key: '', primary: '', secondary: [] };
|
|
37
|
+
const keyCol = columnList.filter(col => col.key === 'true');
|
|
38
|
+
metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';
|
|
39
|
+
for (let index = 0; index < displayColumns.length; index += 1) {
|
|
40
|
+
if (displayColumns[index].primary === 'true') {
|
|
41
|
+
metaDataObj.primary = displayColumns[index].value;
|
|
42
|
+
} else {
|
|
43
|
+
metaDataObj.secondary.push(displayColumns[index].value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return metaDataObj;
|
|
47
|
+
}
|
|
48
|
+
|
|
14
49
|
interface IOption {
|
|
15
50
|
key: string;
|
|
16
51
|
value: string;
|
|
@@ -22,6 +57,11 @@ interface DropdownProps extends PConnFieldProps {
|
|
|
22
57
|
datasource?: any[];
|
|
23
58
|
onRecordChange?: any;
|
|
24
59
|
fieldMetadata?: any;
|
|
60
|
+
listType?: string;
|
|
61
|
+
columns?: any[];
|
|
62
|
+
deferDatasource?: boolean;
|
|
63
|
+
datasourceMetadata?: any;
|
|
64
|
+
parameters?: any;
|
|
25
65
|
}
|
|
26
66
|
|
|
27
67
|
@Component({
|
|
@@ -53,7 +93,7 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
53
93
|
testId = '';
|
|
54
94
|
helperText: string;
|
|
55
95
|
hideLabel: any;
|
|
56
|
-
|
|
96
|
+
theDatasource: any[] | null;
|
|
57
97
|
fieldControl = new FormControl('', null);
|
|
58
98
|
fieldMetadata: any[];
|
|
59
99
|
localeContext = '';
|
|
@@ -61,11 +101,14 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
61
101
|
localeName = '';
|
|
62
102
|
localePath = '';
|
|
63
103
|
localizedValue = '';
|
|
104
|
+
actionsApi: Object;
|
|
105
|
+
propName: string;
|
|
64
106
|
|
|
65
107
|
constructor(
|
|
66
108
|
private angularPConnect: AngularPConnectService,
|
|
67
109
|
private cdRef: ChangeDetectorRef,
|
|
68
|
-
private utils: Utils
|
|
110
|
+
private utils: Utils,
|
|
111
|
+
private dataPageService: DatapageService
|
|
69
112
|
) {}
|
|
70
113
|
|
|
71
114
|
ngOnInit(): void {
|
|
@@ -76,8 +119,9 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
76
119
|
// Then, continue on with other initialization
|
|
77
120
|
|
|
78
121
|
// call updateSelf when initializing
|
|
79
|
-
// this.updateSelf();
|
|
80
122
|
this.checkAndUpdate();
|
|
123
|
+
// this should get called afer checkAndUpdate
|
|
124
|
+
this.getDatapageData();
|
|
81
125
|
|
|
82
126
|
if (this.formGroup$) {
|
|
83
127
|
// add control to formGroup
|
|
@@ -120,7 +164,6 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
120
164
|
updateSelf(): void {
|
|
121
165
|
// moved this from ngOnInit() and call this from there instead...
|
|
122
166
|
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as DropdownProps;
|
|
123
|
-
|
|
124
167
|
if (this.configProps$.value != undefined) {
|
|
125
168
|
this.value$ = this.configProps$.value;
|
|
126
169
|
}
|
|
@@ -130,6 +173,7 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
130
173
|
this.label$ = this.configProps$.label;
|
|
131
174
|
this.helperText = this.configProps$.helperText;
|
|
132
175
|
this.hideLabel = this.configProps$.hideLabel;
|
|
176
|
+
const datasource = this.configProps$.datasource;
|
|
133
177
|
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
134
178
|
setTimeout(() => {
|
|
135
179
|
if (this.configProps$.required != null) {
|
|
@@ -138,6 +182,11 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
138
182
|
this.cdRef.detectChanges();
|
|
139
183
|
});
|
|
140
184
|
|
|
185
|
+
if (!isEqual(datasource, this.theDatasource)) {
|
|
186
|
+
// inbound datasource is different, so update theDatasource
|
|
187
|
+
this.theDatasource = datasource || null;
|
|
188
|
+
}
|
|
189
|
+
|
|
141
190
|
if (this.configProps$.visibility != null) {
|
|
142
191
|
this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
|
|
143
192
|
}
|
|
@@ -157,18 +206,23 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
157
206
|
this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
|
|
158
207
|
}
|
|
159
208
|
|
|
160
|
-
this.componentReference =
|
|
209
|
+
this.componentReference = this.pConn$.getStateProps().value;
|
|
161
210
|
|
|
162
|
-
const optionsList = [...this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject())];
|
|
163
|
-
optionsList?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
|
|
164
|
-
this.options$ = optionsList;
|
|
165
211
|
if (this.value$ === '' && !this.bReadonly$) {
|
|
166
212
|
this.value$ = 'Select';
|
|
167
213
|
}
|
|
168
214
|
|
|
169
|
-
|
|
215
|
+
if (this.theDatasource) {
|
|
216
|
+
const optionsList = [...this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject())];
|
|
217
|
+
optionsList?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
|
|
218
|
+
this.options$ = optionsList;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
this.actionsApi = this.pConn$.getActionsApi();
|
|
222
|
+
|
|
223
|
+
this.propName = this.pConn$.getStateProps().value;
|
|
170
224
|
const className = this.pConn$.getCaseInfo().getClassName();
|
|
171
|
-
const refName = propName?.slice(propName.lastIndexOf('.') + 1);
|
|
225
|
+
const refName = this.propName?.slice(this.propName.lastIndexOf('.') + 1);
|
|
172
226
|
|
|
173
227
|
this.fieldMetadata = this.configProps$.fieldMetadata;
|
|
174
228
|
const metaData = Array.isArray(this.fieldMetadata) ? this.fieldMetadata.filter(field => field?.classID === className)[0] : this.fieldMetadata;
|
|
@@ -196,6 +250,70 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
196
250
|
}
|
|
197
251
|
}
|
|
198
252
|
|
|
253
|
+
getDatapageData() {
|
|
254
|
+
const configProps = this.pConn$.getConfigProps() as DropdownProps;
|
|
255
|
+
let { listType, parameters, datasource = [], columns = [] } = configProps;
|
|
256
|
+
const { deferDatasource, datasourceMetadata } = configProps;
|
|
257
|
+
const context = this.pConn$.getContextName();
|
|
258
|
+
if (deferDatasource && datasourceMetadata?.datasource?.name) {
|
|
259
|
+
listType = 'datapage';
|
|
260
|
+
datasource = datasourceMetadata.datasource.name;
|
|
261
|
+
const { parameters: dataSourceParameters, propertyForDisplayText, propertyForValue } = datasourceMetadata.datasource;
|
|
262
|
+
parameters = flattenParameters(dataSourceParameters);
|
|
263
|
+
const displayProp = propertyForDisplayText?.startsWith('@P') ? propertyForDisplayText.substring(3) : propertyForDisplayText;
|
|
264
|
+
const valueProp = propertyForValue?.startsWith('@P') ? propertyForValue.substring(3) : propertyForValue;
|
|
265
|
+
columns = [
|
|
266
|
+
{
|
|
267
|
+
key: 'true',
|
|
268
|
+
setProperty: 'Associated property',
|
|
269
|
+
value: valueProp
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
display: 'true',
|
|
273
|
+
primary: 'true',
|
|
274
|
+
useForSearch: true,
|
|
275
|
+
value: displayProp
|
|
276
|
+
}
|
|
277
|
+
];
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
columns = preProcessColumns(columns) || [];
|
|
281
|
+
if (!this.displayMode$ && listType !== 'associated' && typeof datasource === 'string') {
|
|
282
|
+
this.getData(datasource, parameters, columns, context, listType);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
getData(dataSource, parameters, columns, context, listType) {
|
|
287
|
+
const dataConfig: any = {
|
|
288
|
+
columns,
|
|
289
|
+
dataSource,
|
|
290
|
+
deferDatasource: true,
|
|
291
|
+
listType,
|
|
292
|
+
parameters,
|
|
293
|
+
matchPosition: 'contains',
|
|
294
|
+
maxResultsDisplay: '5000',
|
|
295
|
+
cacheLifeSpan: 'form'
|
|
296
|
+
};
|
|
297
|
+
PCore.getDataApi()
|
|
298
|
+
.init(dataConfig, context)
|
|
299
|
+
.then((dataApiObj: any) => {
|
|
300
|
+
const optionsData: any[] = [];
|
|
301
|
+
const displayColumn = getDisplayFieldsMetaData(columns);
|
|
302
|
+
dataApiObj?.fetchData('').then(response => {
|
|
303
|
+
response.data?.forEach(element => {
|
|
304
|
+
const val = element[displayColumn.primary]?.toString();
|
|
305
|
+
const obj = {
|
|
306
|
+
key: element[displayColumn.key] || element.pyGUID,
|
|
307
|
+
value: val
|
|
308
|
+
};
|
|
309
|
+
optionsData.push(obj);
|
|
310
|
+
});
|
|
311
|
+
optionsData?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
|
|
312
|
+
this.options$ = optionsData;
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
|
|
199
317
|
isSelected(buttonValue: string): boolean {
|
|
200
318
|
return this.value$ === buttonValue;
|
|
201
319
|
}
|
|
@@ -204,17 +322,13 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
204
322
|
if (event?.value === 'Select') {
|
|
205
323
|
event.value = '';
|
|
206
324
|
}
|
|
207
|
-
|
|
208
|
-
const propName = (this.pConn$?.getStateProps() as any).value;
|
|
209
|
-
handleEvent(actionsApi, 'changeNblur', propName, event.value);
|
|
325
|
+
handleEvent(this.actionsApi, 'changeNblur', this.propName, event.value);
|
|
210
326
|
if (this.configProps$?.onRecordChange) {
|
|
211
327
|
this.configProps$.onRecordChange(event);
|
|
212
328
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
// PConnect wants to use eventHandler for onBlur
|
|
217
|
-
this.angularPConnectData.actions?.onBlur(this, event);
|
|
329
|
+
this.pConn$.clearErrorMessages({
|
|
330
|
+
property: this.propName
|
|
331
|
+
});
|
|
218
332
|
}
|
|
219
333
|
|
|
220
334
|
getLocalizedOptionValue(opt: IOption) {
|
|
@@ -8,6 +8,7 @@ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-c
|
|
|
8
8
|
import { Utils } from '@pega/angular-sdk-components';
|
|
9
9
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
10
10
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
11
|
+
import { handleEvent } from '@pega/angular-sdk-components';
|
|
11
12
|
|
|
12
13
|
interface EmailProps extends PConnFieldProps {
|
|
13
14
|
// If any, enter additional props that only exist on Email here
|
|
@@ -43,6 +44,8 @@ export class EmailComponent implements OnInit, OnDestroy {
|
|
|
43
44
|
placeholder: string;
|
|
44
45
|
|
|
45
46
|
fieldControl = new FormControl('', null);
|
|
47
|
+
actionsApi: Object;
|
|
48
|
+
propName: string;
|
|
46
49
|
|
|
47
50
|
constructor(
|
|
48
51
|
private angularPConnect: AngularPConnectService,
|
|
@@ -139,7 +142,10 @@ export class EmailComponent implements OnInit, OnDestroy {
|
|
|
139
142
|
this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
|
|
140
143
|
}
|
|
141
144
|
|
|
142
|
-
this.
|
|
145
|
+
this.actionsApi = this.pConn$.getActionsApi();
|
|
146
|
+
this.propName = this.pConn$.getStateProps().value;
|
|
147
|
+
|
|
148
|
+
this.componentReference = this.pConn$.getStateProps().value;
|
|
143
149
|
|
|
144
150
|
// trigger display of error message with field control
|
|
145
151
|
if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
|
|
@@ -153,12 +159,16 @@ export class EmailComponent implements OnInit, OnDestroy {
|
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
fieldOnChange(event: any) {
|
|
156
|
-
|
|
162
|
+
const value = event?.target?.value;
|
|
163
|
+
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
164
|
+
this.pConn$.clearErrorMessages({
|
|
165
|
+
property: this.propName
|
|
166
|
+
});
|
|
157
167
|
}
|
|
158
168
|
|
|
159
169
|
fieldOnBlur(event: any) {
|
|
160
|
-
|
|
161
|
-
this.
|
|
170
|
+
const value = event?.target?.value;
|
|
171
|
+
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
162
172
|
}
|
|
163
173
|
|
|
164
174
|
getErrorMessage() {
|
|
@@ -73,12 +73,12 @@ export class GroupComponent implements OnInit {
|
|
|
73
73
|
this.visibility$ = this.pConn$.getComputedVisibility();
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
if (this.configProps$.displayMode === '
|
|
76
|
+
if (this.configProps$.displayMode === 'DISPLAY_ONLY') {
|
|
77
77
|
if (this.configProps$.visibility === undefined) this.visibility$ = true;
|
|
78
78
|
|
|
79
79
|
this.arChildren$.forEach(child => {
|
|
80
80
|
const pConn = child.getPConnect();
|
|
81
|
-
pConn.setInheritedProp('displayMode', '
|
|
81
|
+
pConn.setInheritedProp('displayMode', 'DISPLAY_ONLY');
|
|
82
82
|
pConn.setInheritedProp('readOnly', true);
|
|
83
83
|
|
|
84
84
|
return child;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
[required]="bRequired$"
|
|
16
16
|
[formControl]="fieldControl"
|
|
17
17
|
[attr.data-test-id]="testId"
|
|
18
|
-
(change)="fieldOnChange(
|
|
18
|
+
(change)="fieldOnChange()"
|
|
19
19
|
(blur)="fieldOnBlur($event)"
|
|
20
20
|
/>
|
|
21
21
|
<mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
|
|
@@ -8,6 +8,7 @@ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-c
|
|
|
8
8
|
import { Utils } from '@pega/angular-sdk-components';
|
|
9
9
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
10
10
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
11
|
+
import { handleEvent } from '@pega/angular-sdk-components';
|
|
11
12
|
|
|
12
13
|
interface IntegerProps extends PConnFieldProps {
|
|
13
14
|
// If any, enter additional props that only exist on Integer here
|
|
@@ -43,6 +44,8 @@ export class IntegerComponent implements OnInit, OnDestroy {
|
|
|
43
44
|
placeholder: string;
|
|
44
45
|
|
|
45
46
|
fieldControl = new FormControl<number | null>(null, null);
|
|
47
|
+
actionsApi: Object;
|
|
48
|
+
propName: string;
|
|
46
49
|
|
|
47
50
|
constructor(
|
|
48
51
|
private angularPConnect: AngularPConnectService,
|
|
@@ -115,6 +118,9 @@ export class IntegerComponent implements OnInit, OnDestroy {
|
|
|
115
118
|
this.helperText = this.configProps$.helperText;
|
|
116
119
|
this.placeholder = this.configProps$.placeholder || '';
|
|
117
120
|
|
|
121
|
+
this.actionsApi = this.pConn$.getActionsApi();
|
|
122
|
+
this.propName = this.pConn$.getStateProps().value;
|
|
123
|
+
|
|
118
124
|
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
119
125
|
setTimeout(() => {
|
|
120
126
|
if (this.configProps$.required != null) {
|
|
@@ -142,7 +148,7 @@ export class IntegerComponent implements OnInit, OnDestroy {
|
|
|
142
148
|
this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
|
|
143
149
|
}
|
|
144
150
|
|
|
145
|
-
this.componentReference =
|
|
151
|
+
this.componentReference = this.pConn$.getStateProps().value;
|
|
146
152
|
|
|
147
153
|
// trigger display of error message with field control
|
|
148
154
|
if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
|
|
@@ -155,13 +161,15 @@ export class IntegerComponent implements OnInit, OnDestroy {
|
|
|
155
161
|
}
|
|
156
162
|
}
|
|
157
163
|
|
|
158
|
-
fieldOnChange(
|
|
159
|
-
this.
|
|
164
|
+
fieldOnChange() {
|
|
165
|
+
this.pConn$.clearErrorMessages({
|
|
166
|
+
property: this.propName
|
|
167
|
+
});
|
|
160
168
|
}
|
|
161
169
|
|
|
162
170
|
fieldOnBlur(event: any) {
|
|
163
|
-
|
|
164
|
-
this.
|
|
171
|
+
const value = event?.target?.value;
|
|
172
|
+
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
165
173
|
}
|
|
166
174
|
|
|
167
175
|
getErrorMessage() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommonModule } from '@angular/common';
|
|
2
2
|
import { Component, forwardRef, Input, OnDestroy, OnInit } from '@angular/core';
|
|
3
3
|
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
-
import { MatAutocompleteModule
|
|
4
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
5
5
|
import { MatChipsModule } from '@angular/material/chips';
|
|
6
6
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
7
7
|
import { MatOptionModule } from '@angular/material/core';
|
|
@@ -13,6 +13,7 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
|
13
13
|
import { Utils } from '@pega/angular-sdk-components';
|
|
14
14
|
import { doSearch, getDisplayFieldsMetaData, getGroupDataForItemsTree, preProcessColumns } from './utils';
|
|
15
15
|
import { deleteInstruction, insertInstruction } from '@pega/angular-sdk-components';
|
|
16
|
+
import { handleEvent } from '@pega/angular-sdk-components';
|
|
16
17
|
|
|
17
18
|
@Component({
|
|
18
19
|
selector: 'app-multiselect',
|
|
@@ -73,6 +74,8 @@ export class MultiselectComponent implements OnInit, OnDestroy {
|
|
|
73
74
|
dataApiObj: any;
|
|
74
75
|
itemsTree: any[] = [];
|
|
75
76
|
trigger: any;
|
|
77
|
+
actionsApi: Object;
|
|
78
|
+
propName: string;
|
|
76
79
|
|
|
77
80
|
constructor(
|
|
78
81
|
private angularPConnect: AngularPConnectService,
|
|
@@ -181,7 +184,9 @@ export class MultiselectComponent implements OnInit, OnDestroy {
|
|
|
181
184
|
listType: this.listType,
|
|
182
185
|
maxResultsDisplay: this.maxResultsDisplay || '100',
|
|
183
186
|
columns: preProcessColumns(columns),
|
|
184
|
-
groupColumnsConfig: preProcessColumns(this.groupColumnsConfig)
|
|
187
|
+
groupColumnsConfig: preProcessColumns(this.groupColumnsConfig),
|
|
188
|
+
associationFilter: undefined,
|
|
189
|
+
ignoreCase: undefined
|
|
185
190
|
};
|
|
186
191
|
|
|
187
192
|
const groupsDisplayFieldMeta = this.listType !== 'associated' ? getDisplayFieldsMetaData(dataConfig.groupColumnsConfig) : null;
|
|
@@ -210,6 +215,9 @@ export class MultiselectComponent implements OnInit, OnDestroy {
|
|
|
210
215
|
this.fieldControl.enable();
|
|
211
216
|
}
|
|
212
217
|
|
|
218
|
+
this.actionsApi = this.pConn$.getActionsApi();
|
|
219
|
+
this.propName = this.pConn$.getStateProps().value;
|
|
220
|
+
|
|
213
221
|
if (this.listType !== 'associated') {
|
|
214
222
|
PCore.getDataApi()
|
|
215
223
|
?.init(dataConfig, contextName)
|
|
@@ -283,8 +291,10 @@ export class MultiselectComponent implements OnInit, OnDestroy {
|
|
|
283
291
|
this.getCaseListBasedOnParams(this.value$, '', [...this.selectedItems], [...this.itemsTree], true);
|
|
284
292
|
}
|
|
285
293
|
|
|
286
|
-
optionChanged(event:
|
|
287
|
-
|
|
294
|
+
optionChanged(event: any) {
|
|
295
|
+
let value = event?.target?.value;
|
|
296
|
+
value = value?.substring(1);
|
|
297
|
+
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
288
298
|
}
|
|
289
299
|
|
|
290
300
|
optionClicked = (event: Event, data: any): void => {
|
|
@@ -326,7 +336,7 @@ export class MultiselectComponent implements OnInit, OnDestroy {
|
|
|
326
336
|
|
|
327
337
|
setSelectedItemsForReferenceList(data: any) {
|
|
328
338
|
// Clear error messages if any
|
|
329
|
-
const propName =
|
|
339
|
+
const propName = this.pConn$.getStateProps().selectionList;
|
|
330
340
|
this.pConn$.clearErrorMessages({
|
|
331
341
|
property: propName,
|
|
332
342
|
category: '',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div *ngIf="displayMode$; else noDisplayMode">
|
|
2
|
-
<component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value
|
|
2
|
+
<component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$: formattedValue, displayMode$ }"></component-mapper>
|
|
3
3
|
</div>
|
|
4
4
|
<ng-template #noDisplayMode>
|
|
5
5
|
<div *ngIf="bHasForm$; else noEdit">
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
[options]="{
|
|
14
14
|
prefix: '',
|
|
15
15
|
suffix: '%',
|
|
16
|
-
thousands:
|
|
17
|
-
decimal:
|
|
16
|
+
thousands: thousandSeparator,
|
|
17
|
+
decimal: decimalSeparator,
|
|
18
18
|
align: 'left',
|
|
19
19
|
nullable: true,
|
|
20
20
|
precision: decimalPrecision,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
[required]="bRequired$"
|
|
27
27
|
[formControl]="fieldControl"
|
|
28
28
|
[attr.data-test-id]="testId"
|
|
29
|
-
(change)="fieldOnChange(
|
|
29
|
+
(change)="fieldOnChange()"
|
|
30
30
|
(blur)="fieldOnBlur($event)"
|
|
31
31
|
[readonly]="bReadonly$"
|
|
32
32
|
/>
|
|
@@ -11,10 +11,12 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
|
11
11
|
import { handleEvent } from '@pega/angular-sdk-components';
|
|
12
12
|
import { getCurrencyCharacters } from '@pega/angular-sdk-components';
|
|
13
13
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
14
|
+
import { format } from '@pega/angular-sdk-components';
|
|
14
15
|
|
|
15
16
|
interface PercentageProps extends PConnFieldProps {
|
|
16
17
|
showGroupSeparators?: string;
|
|
17
18
|
decimalPrecision?: number;
|
|
19
|
+
currencyISOCode?: string;
|
|
18
20
|
// If any, enter additional props that only exist on Percentage here
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -46,11 +48,14 @@ export class PercentageComponent implements OnInit, OnDestroy {
|
|
|
46
48
|
testId: string;
|
|
47
49
|
helperText: string;
|
|
48
50
|
placeholder: string;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
decimalSeparator: string;
|
|
52
|
+
thousandSeparator: string;
|
|
51
53
|
inputMode: any;
|
|
52
54
|
decimalPrecision: number | undefined;
|
|
53
55
|
fieldControl = new FormControl<number | null>(null, null);
|
|
56
|
+
actionsApi: Object;
|
|
57
|
+
propName: string;
|
|
58
|
+
formattedValue: string;
|
|
54
59
|
|
|
55
60
|
constructor(
|
|
56
61
|
private angularPConnect: AngularPConnectService,
|
|
@@ -113,20 +118,25 @@ export class PercentageComponent implements OnInit, OnDestroy {
|
|
|
113
118
|
this.label$ = this.configProps$.label;
|
|
114
119
|
this.displayMode$ = this.configProps$.displayMode;
|
|
115
120
|
this.inputMode = NgxCurrencyInputMode.Natural;
|
|
116
|
-
|
|
121
|
+
const nValue: any = this.configProps$.value;
|
|
117
122
|
if (nValue) {
|
|
118
|
-
if (typeof nValue === 'string') {
|
|
119
|
-
nValue = parseInt(nValue, 10);
|
|
120
|
-
}
|
|
121
123
|
this.value$ = nValue;
|
|
124
|
+
this.fieldControl.setValue(nValue);
|
|
122
125
|
}
|
|
123
126
|
this.helperText = this.configProps$.helperText;
|
|
124
127
|
this.placeholder = this.configProps$.placeholder || '';
|
|
125
128
|
const showGroupSeparators = this.configProps$.showGroupSeparators;
|
|
126
129
|
|
|
127
130
|
const theSymbols = getCurrencyCharacters('');
|
|
128
|
-
this.
|
|
129
|
-
this.
|
|
131
|
+
this.decimalSeparator = theSymbols.theDecimalIndicator;
|
|
132
|
+
this.thousandSeparator = showGroupSeparators ? theSymbols.theDigitGroupSeparator : '';
|
|
133
|
+
|
|
134
|
+
this.actionsApi = this.pConn$.getActionsApi();
|
|
135
|
+
this.propName = this.pConn$.getStateProps().value;
|
|
136
|
+
|
|
137
|
+
if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
|
|
138
|
+
this.formattedValue = nValue ? format(nValue, 'percentage') : '';
|
|
139
|
+
}
|
|
130
140
|
|
|
131
141
|
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
132
142
|
setTimeout(() => {
|
|
@@ -157,7 +167,7 @@ export class PercentageComponent implements OnInit, OnDestroy {
|
|
|
157
167
|
|
|
158
168
|
this.decimalPrecision = this.configProps$?.decimalPrecision ?? 2;
|
|
159
169
|
|
|
160
|
-
this.componentReference =
|
|
170
|
+
this.componentReference = this.pConn$.getStateProps().value;
|
|
161
171
|
|
|
162
172
|
// trigger display of error message with field control
|
|
163
173
|
if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
|
|
@@ -169,22 +179,27 @@ export class PercentageComponent implements OnInit, OnDestroy {
|
|
|
169
179
|
}
|
|
170
180
|
}
|
|
171
181
|
|
|
172
|
-
fieldOnChange(
|
|
173
|
-
this.
|
|
182
|
+
fieldOnChange() {
|
|
183
|
+
this.pConn$.clearErrorMessages({
|
|
184
|
+
property: this.propName
|
|
185
|
+
});
|
|
174
186
|
}
|
|
175
187
|
|
|
176
188
|
fieldOnBlur(event: any) {
|
|
177
|
-
const actionsApi = this.pConn$?.getActionsApi();
|
|
178
|
-
const propName = (this.pConn$?.getStateProps() as any).value;
|
|
179
189
|
let value = event?.target?.value;
|
|
180
190
|
value = value ? value.replace(/%/g, '') : '';
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
value = value?.replace(
|
|
191
|
+
// replacing thousand separator with empty string as not required in api call
|
|
192
|
+
if (this.configProps$.showGroupSeparators) {
|
|
193
|
+
const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
|
|
194
|
+
const regExp = new RegExp(String.raw`${thousandSep}`, 'g');
|
|
195
|
+
value = value?.replace(regExp, '');
|
|
196
|
+
}
|
|
197
|
+
// replacing decimal separator with '.'
|
|
198
|
+
if (this.decimalSeparator !== '.') {
|
|
199
|
+
const regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
|
|
200
|
+
value = value.replace(regExp, '.');
|
|
186
201
|
}
|
|
187
|
-
handleEvent(actionsApi, 'changeNblur', propName, value);
|
|
202
|
+
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
188
203
|
}
|
|
189
204
|
|
|
190
205
|
getErrorMessage() {
|