@pega/angular-sdk-overrides 0.242.3 → 0.242.5
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/material-case-summary/material-case-summary.component.scss +2 -1
- package/lib/field/currency/currency.component.html +3 -3
- package/lib/field/currency/currency.component.ts +14 -11
- package/lib/field/date-time/date-time.component.ts +2 -2
- package/lib/field/decimal/decimal.component.html +3 -3
- package/lib/field/decimal/decimal.component.ts +16 -13
- package/lib/field/dropdown/dropdown.component.ts +122 -7
- package/lib/field/percentage/percentage.component.html +2 -3
- package/lib/field/percentage/percentage.component.ts +16 -10
- package/lib/field/time/time.component.ts +1 -1
- package/lib/infra/view/view.component.html +1 -1
- package/lib/infra/view/view.component.ts +5 -1
- package/lib/template/base/details-template-base.ts +67 -0
- package/lib/template/{form-template-base/form-template-base.component.ts → base/form-template-base.ts} +1 -1
- package/lib/template/case-view/case-view.component.html +4 -4
- package/lib/template/case-view/case-view.component.ts +7 -12
- package/lib/template/default-form/default-form.component.html +0 -4
- package/lib/template/default-form/default-form.component.ts +2 -21
- package/lib/template/details/details.component.ts +5 -39
- package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +5 -38
- package/lib/template/details-one-column/details-one-column.component.ts +5 -40
- 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 +5 -41
- package/lib/template/details-two-column/details-two-column.component.ts +5 -41
- package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +5 -40
- package/lib/template/dynamic-tabs/dynamic-tabs.component.html +3 -0
- package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +6 -1
- package/lib/template/field-value-list/field-value-list.component.scss +1 -0
- 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 +21 -1
- package/lib/template/one-column/one-column.component.ts +2 -2
- package/lib/template/simple-table-manual/simple-table-manual.component.scss +1 -0
- package/lib/template/three-column/three-column.component.ts +2 -2
- package/lib/template/two-column/two-column.component.ts +2 -2
- package/lib/template/wide-narrow-form/wide-narrow-form.component.ts +2 -2
- package/package.json +1 -1
package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
.psdk-case-summary-fields {
|
|
52
|
-
padding: calc(2 * 0.5rem);
|
|
52
|
+
// padding: calc(2 * 0.5rem);
|
|
53
53
|
display: grid;
|
|
54
54
|
grid-row-gap: calc(2 * 0.5rem);
|
|
55
55
|
}
|
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
grid-template-columns: 1fr;
|
|
91
91
|
grid-column-gap: calc(2 * 0.5rem);
|
|
92
92
|
grid-row-gap: calc(1 * 0.5rem);
|
|
93
|
+
margin: 0;
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
.psdk-csf-secondary-field {
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
matInput
|
|
14
14
|
currencyMask
|
|
15
15
|
[options]="{
|
|
16
|
-
prefix:
|
|
17
|
-
thousands:
|
|
18
|
-
decimal:
|
|
16
|
+
prefix: currencySymbol,
|
|
17
|
+
thousands: thousandSeparator,
|
|
18
|
+
decimal: decimalSeparator,
|
|
19
19
|
align: 'left',
|
|
20
20
|
nullable: true,
|
|
21
21
|
precision: decimalPrecision,
|
|
@@ -52,9 +52,9 @@ export class CurrencyComponent implements OnInit, OnDestroy {
|
|
|
52
52
|
currencyOptions: Object = {};
|
|
53
53
|
|
|
54
54
|
fieldControl = new FormControl<number | null>(null, { updateOn: 'blur' });
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
currencySymbol: string;
|
|
56
|
+
thousandSeparator: string;
|
|
57
|
+
decimalSeparator: string;
|
|
58
58
|
inputMode: any;
|
|
59
59
|
decimalPrecision: number | undefined;
|
|
60
60
|
formattedValue: string;
|
|
@@ -136,9 +136,9 @@ export class CurrencyComponent implements OnInit, OnDestroy {
|
|
|
136
136
|
const currencyISOCode = this.configProps$?.currencyISOCode ?? '';
|
|
137
137
|
|
|
138
138
|
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
139
|
-
this.
|
|
140
|
-
this.
|
|
141
|
-
this.
|
|
139
|
+
this.currencySymbol = theSymbols.theCurrencySymbol;
|
|
140
|
+
this.thousandSeparator = theSymbols.theDigitGroupSeparator;
|
|
141
|
+
this.decimalSeparator = theSymbols.theDecimalIndicator;
|
|
142
142
|
this.formatter = this.configProps$.formatter;
|
|
143
143
|
|
|
144
144
|
if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
|
|
@@ -201,11 +201,14 @@ export class CurrencyComponent implements OnInit, OnDestroy {
|
|
|
201
201
|
const propName = this.pConn$?.getStateProps().value;
|
|
202
202
|
let value = event?.target?.value;
|
|
203
203
|
value = value?.substring(1);
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
204
|
+
// replacing thousand separator with empty string as not required in api call
|
|
205
|
+
const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
|
|
206
|
+
let regExp = new RegExp(String.raw`${thousandSep}`, 'g');
|
|
207
|
+
value = value?.replace(regExp, '');
|
|
208
|
+
// replacing decimal separator with '.'
|
|
209
|
+
if (this.decimalSeparator !== '.') {
|
|
210
|
+
regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
|
|
211
|
+
value = value.replace(regExp, '.');
|
|
209
212
|
}
|
|
210
213
|
handleEvent(actionsApi, 'changeNblur', propName, value);
|
|
211
214
|
}
|
|
@@ -76,7 +76,7 @@ export class DateTimeComponent implements OnInit, OnDestroy {
|
|
|
76
76
|
) {}
|
|
77
77
|
|
|
78
78
|
ngOnInit(): void {
|
|
79
|
-
this.placeholder = `${this.theDateFormat.dateFormatStringLC}, hh:mm
|
|
79
|
+
this.placeholder = `${this.theDateFormat.dateFormatStringLC}, hh:mm A`;
|
|
80
80
|
// First thing in initialization is registering and subscribing to the AngularPConnect service
|
|
81
81
|
this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
|
|
82
82
|
this.controlName$ = this.angularPConnect.getComponentID(this);
|
|
@@ -143,7 +143,7 @@ export class DateTimeComponent implements OnInit, OnDestroy {
|
|
|
143
143
|
|
|
144
144
|
if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
|
|
145
145
|
this.formattedValue$ = format(this.value$, 'datetime', {
|
|
146
|
-
format: `${this.theDateFormat.dateFormatString} hh:mm
|
|
146
|
+
format: `${this.theDateFormat.dateFormatString} hh:mm A`
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
matInput
|
|
12
12
|
currencyMask
|
|
13
13
|
[options]="{
|
|
14
|
-
prefix:
|
|
15
|
-
thousands:
|
|
16
|
-
decimal:
|
|
14
|
+
prefix: currencySymbol,
|
|
15
|
+
thousands: thousandSeparator,
|
|
16
|
+
decimal: decimalSeparator,
|
|
17
17
|
align: 'left',
|
|
18
18
|
nullable: true,
|
|
19
19
|
precision: decimalPrecision,
|
|
@@ -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;
|
|
@@ -143,8 +143,8 @@ export class DecimalComponent implements OnInit, OnDestroy {
|
|
|
143
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;
|
|
@@ -183,9 +183,7 @@ 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
|
|
|
@@ -196,11 +194,16 @@ export class DecimalComponent implements OnInit, OnDestroy {
|
|
|
196
194
|
const actionsApi = this.pConn$?.getActionsApi();
|
|
197
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 = '';
|
|
@@ -67,7 +107,8 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
67
107
|
constructor(
|
|
68
108
|
private angularPConnect: AngularPConnectService,
|
|
69
109
|
private cdRef: ChangeDetectorRef,
|
|
70
|
-
private utils: Utils
|
|
110
|
+
private utils: Utils,
|
|
111
|
+
private dataPageService: DatapageService
|
|
71
112
|
) {}
|
|
72
113
|
|
|
73
114
|
ngOnInit(): void {
|
|
@@ -78,8 +119,9 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
78
119
|
// Then, continue on with other initialization
|
|
79
120
|
|
|
80
121
|
// call updateSelf when initializing
|
|
81
|
-
// this.updateSelf();
|
|
82
122
|
this.checkAndUpdate();
|
|
123
|
+
// this should get called afer checkAndUpdate
|
|
124
|
+
this.getDatapageData();
|
|
83
125
|
|
|
84
126
|
if (this.formGroup$) {
|
|
85
127
|
// add control to formGroup
|
|
@@ -122,7 +164,6 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
122
164
|
updateSelf(): void {
|
|
123
165
|
// moved this from ngOnInit() and call this from there instead...
|
|
124
166
|
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as DropdownProps;
|
|
125
|
-
|
|
126
167
|
if (this.configProps$.value != undefined) {
|
|
127
168
|
this.value$ = this.configProps$.value;
|
|
128
169
|
}
|
|
@@ -132,6 +173,7 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
132
173
|
this.label$ = this.configProps$.label;
|
|
133
174
|
this.helperText = this.configProps$.helperText;
|
|
134
175
|
this.hideLabel = this.configProps$.hideLabel;
|
|
176
|
+
const datasource = this.configProps$.datasource;
|
|
135
177
|
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
136
178
|
setTimeout(() => {
|
|
137
179
|
if (this.configProps$.required != null) {
|
|
@@ -140,6 +182,11 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
140
182
|
this.cdRef.detectChanges();
|
|
141
183
|
});
|
|
142
184
|
|
|
185
|
+
if (!isEqual(datasource, this.theDatasource)) {
|
|
186
|
+
// inbound datasource is different, so update theDatasource
|
|
187
|
+
this.theDatasource = datasource || null;
|
|
188
|
+
}
|
|
189
|
+
|
|
143
190
|
if (this.configProps$.visibility != null) {
|
|
144
191
|
this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
|
|
145
192
|
}
|
|
@@ -161,14 +208,18 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
161
208
|
|
|
162
209
|
this.componentReference = this.pConn$.getStateProps().value;
|
|
163
210
|
|
|
164
|
-
const optionsList = [...this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject())];
|
|
165
|
-
optionsList?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
|
|
166
|
-
this.options$ = optionsList;
|
|
167
211
|
if (this.value$ === '' && !this.bReadonly$) {
|
|
168
212
|
this.value$ = 'Select';
|
|
169
213
|
}
|
|
170
214
|
|
|
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
|
+
|
|
171
221
|
this.actionsApi = this.pConn$.getActionsApi();
|
|
222
|
+
|
|
172
223
|
this.propName = this.pConn$.getStateProps().value;
|
|
173
224
|
const className = this.pConn$.getCaseInfo().getClassName();
|
|
174
225
|
const refName = this.propName?.slice(this.propName.lastIndexOf('.') + 1);
|
|
@@ -199,6 +250,70 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
199
250
|
}
|
|
200
251
|
}
|
|
201
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
|
+
|
|
202
317
|
isSelected(buttonValue: string): boolean {
|
|
203
318
|
return this.value$ === buttonValue;
|
|
204
319
|
}
|
|
@@ -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,
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
(change)="fieldOnChange()"
|
|
30
30
|
(blur)="fieldOnBlur($event)"
|
|
31
31
|
[readonly]="bReadonly$"
|
|
32
|
-
[value]="value$"
|
|
33
32
|
/>
|
|
34
33
|
<mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
|
|
35
34
|
</mat-form-field>
|
|
@@ -48,8 +48,8 @@ export class PercentageComponent implements OnInit, OnDestroy {
|
|
|
48
48
|
testId: string;
|
|
49
49
|
helperText: string;
|
|
50
50
|
placeholder: string;
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
decimalSeparator: string;
|
|
52
|
+
thousandSeparator: string;
|
|
53
53
|
inputMode: any;
|
|
54
54
|
decimalPrecision: number | undefined;
|
|
55
55
|
fieldControl = new FormControl<number | null>(null, null);
|
|
@@ -121,20 +121,21 @@ export class PercentageComponent implements OnInit, OnDestroy {
|
|
|
121
121
|
const nValue: any = this.configProps$.value;
|
|
122
122
|
if (nValue) {
|
|
123
123
|
this.value$ = nValue;
|
|
124
|
+
this.fieldControl.setValue(nValue);
|
|
124
125
|
}
|
|
125
126
|
this.helperText = this.configProps$.helperText;
|
|
126
127
|
this.placeholder = this.configProps$.placeholder || '';
|
|
127
128
|
const showGroupSeparators = this.configProps$.showGroupSeparators;
|
|
128
129
|
|
|
129
130
|
const theSymbols = getCurrencyCharacters('');
|
|
130
|
-
this.
|
|
131
|
-
this.
|
|
131
|
+
this.decimalSeparator = theSymbols.theDecimalIndicator;
|
|
132
|
+
this.thousandSeparator = showGroupSeparators ? theSymbols.theDigitGroupSeparator : '';
|
|
132
133
|
|
|
133
134
|
this.actionsApi = this.pConn$.getActionsApi();
|
|
134
135
|
this.propName = this.pConn$.getStateProps().value;
|
|
135
136
|
|
|
136
137
|
if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
|
|
137
|
-
this.formattedValue = format(nValue, 'percentage');
|
|
138
|
+
this.formattedValue = nValue ? format(nValue, 'percentage') : '';
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
@@ -187,11 +188,16 @@ export class PercentageComponent implements OnInit, OnDestroy {
|
|
|
187
188
|
fieldOnBlur(event: any) {
|
|
188
189
|
let value = event?.target?.value;
|
|
189
190
|
value = value ? value.replace(/%/g, '') : '';
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
value = value
|
|
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, '.');
|
|
195
201
|
}
|
|
196
202
|
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
197
203
|
}
|
|
@@ -129,7 +129,7 @@ export class TimeComponent implements OnInit, OnDestroy {
|
|
|
129
129
|
|
|
130
130
|
if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
|
|
131
131
|
this.formattedValue$ = format(this.value$, 'timeonly', {
|
|
132
|
-
format: 'hh:mm
|
|
132
|
+
format: 'hh:mm A'
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div *ngIf="visibility$ !== false" class="ng-view-top">
|
|
2
|
-
<div *ngIf="showLabel$ && label$ && templateName$
|
|
2
|
+
<div *ngIf="showLabel$ && label$ && !noHeaderTemplates.includes(templateName$)" class="template-title-container">
|
|
3
3
|
<span>{{ label$ }}</span>
|
|
4
4
|
</div>
|
|
5
5
|
|
|
@@ -7,6 +7,8 @@ import { getAllFields } from '@pega/angular-sdk-components';
|
|
|
7
7
|
import { ReferenceComponent } from '@pega/angular-sdk-components';
|
|
8
8
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
9
9
|
|
|
10
|
+
const NO_HEADER_TEMPLATES = ['SubTabs', 'SimpleTable', 'Confirmation', 'DynamicTabs', 'DetailsSubTabs'];
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
13
|
* WARNING: It is not expected that this file should be modified. It is part of infrastructure code that works with
|
|
12
14
|
* Redux and creation/update of Redux containers and PConnect. Modifying this code could have undesireable results and
|
|
@@ -77,13 +79,15 @@ export class ViewComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
77
79
|
|
|
78
80
|
angularPConnectData: AngularPConnectData = {};
|
|
79
81
|
|
|
82
|
+
noHeaderTemplates = NO_HEADER_TEMPLATES;
|
|
83
|
+
|
|
80
84
|
configProps$: ViewProps;
|
|
81
85
|
inheritedProps$: any;
|
|
82
86
|
arChildren$: any[];
|
|
83
87
|
templateName$: string;
|
|
84
88
|
title$ = '';
|
|
85
89
|
label$ = '';
|
|
86
|
-
showLabel$ =
|
|
90
|
+
showLabel$ = false;
|
|
87
91
|
visibility$ = true;
|
|
88
92
|
|
|
89
93
|
constructor(
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Directive, OnInit, OnDestroy, Injector, Input } from '@angular/core';
|
|
2
|
+
import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
|
|
3
|
+
|
|
4
|
+
@Directive()
|
|
5
|
+
export class DetailsTemplateBase implements OnInit, OnDestroy {
|
|
6
|
+
@Input() pConn$: typeof PConnect;
|
|
7
|
+
|
|
8
|
+
// For interaction with AngularPConnect
|
|
9
|
+
protected angularPConnectData: AngularPConnectData = {};
|
|
10
|
+
protected angularPConnect;
|
|
11
|
+
|
|
12
|
+
childrenMetadataOld;
|
|
13
|
+
|
|
14
|
+
constructor(injector: Injector) {
|
|
15
|
+
this.angularPConnect = injector.get(AngularPConnectService);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
ngOnInit(): void {
|
|
19
|
+
// First thing in initialization is registering and subscribing to the AngularPConnect service
|
|
20
|
+
this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
|
|
21
|
+
|
|
22
|
+
this.checkAndUpdate();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ngOnDestroy() {
|
|
26
|
+
if (this.angularPConnectData.unsubscribeFn) {
|
|
27
|
+
this.angularPConnectData.unsubscribeFn();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
onStateChange() {
|
|
32
|
+
this.checkAndUpdate();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
checkAndUpdate() {
|
|
36
|
+
// Should always check the bridge to see if the component should update itself (re-render)
|
|
37
|
+
const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
|
|
38
|
+
|
|
39
|
+
// Only call updateSelf when the component should update
|
|
40
|
+
if (bUpdateSelf || this.hasRawMetadataChanged()) {
|
|
41
|
+
this.updateSelf();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// this method will get overriden by the child component
|
|
46
|
+
updateSelf() {}
|
|
47
|
+
|
|
48
|
+
hasRawMetadataChanged(): boolean {
|
|
49
|
+
const newChildrenMetadata = this.fetchChildrenMetadata();
|
|
50
|
+
|
|
51
|
+
if (!PCore.isDeepEqual(newChildrenMetadata, this.childrenMetadataOld)) {
|
|
52
|
+
this.childrenMetadataOld = newChildrenMetadata;
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
fetchChildrenMetadata() {
|
|
60
|
+
const children = this.pConn$.getChildren() || [];
|
|
61
|
+
|
|
62
|
+
return children.map(child => {
|
|
63
|
+
const pConnect = child.getPConnect();
|
|
64
|
+
return pConnect.resolveConfigProps(pConnect.getRawMetadata());
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div class="psdk-case-view" id="case-view">
|
|
2
|
-
<div
|
|
2
|
+
<div class="psdk-case-view-info">
|
|
3
3
|
<mat-toolbar color="primary" class="psdk-case-view-toolbar">
|
|
4
4
|
<mat-toolbar-row style="padding-left: 1rem">
|
|
5
5
|
<div class="psdk-case-icon-div">
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
></component-mapper>
|
|
48
48
|
</div>
|
|
49
49
|
<div class="psdk-case-view-main">
|
|
50
|
-
<div
|
|
50
|
+
<div>
|
|
51
51
|
<div *ngFor="let kid of arChildren$">
|
|
52
52
|
<div
|
|
53
53
|
*ngIf="
|
|
@@ -73,11 +73,11 @@
|
|
|
73
73
|
</div>
|
|
74
74
|
</div>
|
|
75
75
|
|
|
76
|
-
<div
|
|
76
|
+
<div>
|
|
77
77
|
<component-mapper name="DeferLoad" [props]="{ pConn$, loadData$: tabData$, name: tabData$?.config?.name }"></component-mapper>
|
|
78
78
|
</div>
|
|
79
79
|
</div>
|
|
80
|
-
<div
|
|
80
|
+
<div>
|
|
81
81
|
<div *ngIf="arChildren$" class="psdk-case-view-utilities">
|
|
82
82
|
<div *ngFor="let kid of arChildren$">
|
|
83
83
|
<div *ngIf="kid.getPConnect().getRawMetadata()?.type.toLowerCase() == 'region' && kid.getPConnect().getRawMetadata()?.name == 'Utilities'">
|
|
@@ -27,7 +27,6 @@ interface CaseViewProps {
|
|
|
27
27
|
export class CaseViewComponent implements OnInit, OnDestroy {
|
|
28
28
|
@Input() pConn$: typeof PConnect;
|
|
29
29
|
@Input() formGroup$: FormGroup;
|
|
30
|
-
@Input() displayOnlyFA$: boolean;
|
|
31
30
|
|
|
32
31
|
// Used with AngularPConnect
|
|
33
32
|
angularPConnectData: AngularPConnectData = {};
|
|
@@ -161,19 +160,15 @@ export class CaseViewComponent implements OnInit, OnDestroy {
|
|
|
161
160
|
|
|
162
161
|
this.svgCase$ = this.utils.getImageSrc(this.configProps$.icon, this.utils.getSDKStaticContentUrl());
|
|
163
162
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (kidPConn.getRawMetadata().name == 'Tabs') {
|
|
170
|
-
this.mainTabs = kid;
|
|
171
|
-
this.mainTabData = this.mainTabs.getPConnect().getChildren();
|
|
172
|
-
}
|
|
163
|
+
for (const kid of this.arChildren$) {
|
|
164
|
+
const kidPConn = kid.getPConnect();
|
|
165
|
+
if (kidPConn.getRawMetadata().name == 'Tabs') {
|
|
166
|
+
this.mainTabs = kid;
|
|
167
|
+
this.mainTabData = this.mainTabs.getPConnect().getChildren();
|
|
173
168
|
}
|
|
174
|
-
|
|
175
|
-
this.generateTabsData();
|
|
176
169
|
}
|
|
170
|
+
|
|
171
|
+
this.generateTabsData();
|
|
177
172
|
}
|
|
178
173
|
|
|
179
174
|
generateTabsData() {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
<!-- When adding a component here, add the same component in 'region' template as well -->
|
|
2
|
-
<div *ngIf="!NO_HEADER_TEMPLATES.includes(template) && showLabel">
|
|
3
|
-
<div class="template-title-container">{{ label }}</div>
|
|
4
|
-
</div>
|
|
5
1
|
<div *ngIf="instructions" class="psdk-default-form-instruction-text">
|
|
6
2
|
<div key="instructions" id="instruction-text" [innerHTML]="instructions"></div>
|
|
7
3
|
</div>
|