@pega/dx-component-builder-sdk 0.242.11 → 0.242.13
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/package.json +1 -1
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.html.mustache +3 -3
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.ts.mustache +16 -13
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.html.mustache +3 -3
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.ts.mustache +14 -11
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.html.mustache +2 -3
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.ts.mustache +15 -9
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/demo.stories.tsx.mustache +1 -0
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.ts.mustache +82 -67
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.ts.mustache +5 -39
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.ts.mustache +6 -42
- package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.ts.mustache +2 -2
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.ts.mustache +2 -2
- package/tests/assets/sdk-a/components/create/override-sdk/field/currency/currency.component.html +3 -3
- package/tests/assets/sdk-a/components/create/override-sdk/field/currency/currency.component.ts +14 -11
- package/tests/assets/sdk-a/components/create/override-sdk/field/decimal/decimal.component.html +3 -3
- package/tests/assets/sdk-a/components/create/override-sdk/field/decimal/decimal.component.ts +16 -13
- package/tests/assets/sdk-a/components/create/override-sdk/field/percentage/percentage.component.html +2 -3
- package/tests/assets/sdk-a/components/create/override-sdk/field/percentage/percentage.component.ts +15 -9
- package/tests/assets/sdk-a/components/create/override-sdk/template/list-view/list-view.component.html +3 -0
- package/tests/assets/sdk-a/components/create/override-sdk/template/list-view/list-view.component.scss +11 -0
- package/tests/assets/sdk-a/components/create/override-sdk/template/list-view/list-view.component.ts +21 -1
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.html +3 -3
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-currency/pega-dxil-my-currency.component.ts +14 -11
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.html +3 -3
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-decimal/pega-dxil-my-decimal.component.ts +16 -13
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.html +2 -3
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-percentage/pega-dxil-my-percentage.component.ts +15 -9
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-picklist/demo.stories.tsx +1 -0
- package/tests/assets/sdk-a/components/createAll/custom-sdk/field/pega-dxil-my-picklist/pega-dxil-my-picklist.component.ts +82 -67
- package/tests/assets/sdk-a/components/createAll/override-sdk/field/currency/currency.component.html +3 -3
- package/tests/assets/sdk-a/components/createAll/override-sdk/field/currency/currency.component.ts +14 -11
- package/tests/assets/sdk-a/components/createAll/override-sdk/field/decimal/decimal.component.html +3 -3
- package/tests/assets/sdk-a/components/createAll/override-sdk/field/decimal/decimal.component.ts +16 -13
- package/tests/assets/sdk-a/components/createAll/override-sdk/field/percentage/percentage.component.html +2 -3
- package/tests/assets/sdk-a/components/createAll/override-sdk/field/percentage/percentage.component.ts +15 -9
- package/tests/assets/sdk-a/components/createAll/override-sdk/template/list-view/list-view.component.html +3 -0
- package/tests/assets/sdk-a/components/createAll/override-sdk/template/list-view/list-view.component.scss +11 -0
- package/tests/assets/sdk-a/components/createAll/override-sdk/template/list-view/list-view.component.ts +21 -1
- package/tests/functional/sdk-a/localCreatePublishDeleteOverride.test.js +1 -1
package/tests/assets/sdk-a/components/create/override-sdk/field/currency/currency.component.ts
CHANGED
|
@@ -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
|
}
|
package/tests/assets/sdk-a/components/create/override-sdk/field/decimal/decimal.component.html
CHANGED
|
@@ -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,
|
package/tests/assets/sdk-a/components/create/override-sdk/field/decimal/decimal.component.ts
CHANGED
|
@@ -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
|
}
|
package/tests/assets/sdk-a/components/create/override-sdk/field/percentage/percentage.component.html
CHANGED
|
@@ -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>
|
package/tests/assets/sdk-a/components/create/override-sdk/field/percentage/percentage.component.ts
CHANGED
|
@@ -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,14 +121,15 @@ 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;
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<div class="psdk-list-header">
|
|
2
2
|
<div>
|
|
3
|
+
<h3 *ngIf="label" class="label" style="font-weight: bold">
|
|
4
|
+
{{ label }} <span class="results-count">{{ getResultsText() }}</span>
|
|
5
|
+
</h3>
|
|
3
6
|
<mat-form-field class="psdk-search" *ngIf="bShowSearch$">
|
|
4
7
|
<mat-label><img class="psdk-icon-search" src="{{ searchIcon$ }}" /> <span class="psdk-search-label">Search</span> </mat-label>
|
|
5
8
|
<input matInput id="search" (keyup)="applySearch($event)" placeholder="" />
|
|
@@ -165,3 +165,14 @@ tr.mat-mdc-row {
|
|
|
165
165
|
background-color: transparent;
|
|
166
166
|
align-items: center;
|
|
167
167
|
}
|
|
168
|
+
|
|
169
|
+
.results-count {
|
|
170
|
+
opacity: 0.7;
|
|
171
|
+
font-size: 0.8rem;
|
|
172
|
+
font-weight: bold;
|
|
173
|
+
margin-inline-start: 0.625rem;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.label {
|
|
177
|
+
margin: 8px;
|
|
178
|
+
}
|
package/tests/assets/sdk-a/components/create/override-sdk/template/list-view/list-view.component.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable max-classes-per-file */
|
|
2
1
|
import { Component, OnInit, Input, ViewChild, forwardRef, OnDestroy } from '@angular/core';
|
|
3
2
|
import { CommonModule } from '@angular/common';
|
|
4
3
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
@@ -29,6 +28,8 @@ declare const window: any;
|
|
|
29
28
|
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
30
29
|
|
|
31
30
|
interface ListViewProps {
|
|
31
|
+
inheritedProps: any;
|
|
32
|
+
title: string | undefined;
|
|
32
33
|
// If any, enter additional props that only exist on this component
|
|
33
34
|
globalSearch?: boolean;
|
|
34
35
|
referenceList?: any;
|
|
@@ -42,6 +43,7 @@ interface ListViewProps {
|
|
|
42
43
|
grouping: string | boolean;
|
|
43
44
|
value: any;
|
|
44
45
|
readonlyContextList: any;
|
|
46
|
+
label?: string;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
export class Group {
|
|
@@ -159,6 +161,7 @@ export class ListViewComponent implements OnInit, OnDestroy {
|
|
|
159
161
|
xRayApis = PCore.getDebugger().getXRayRuntime();
|
|
160
162
|
xRayUid = this.xRayApis.startXRay();
|
|
161
163
|
checkBoxValue: string;
|
|
164
|
+
label?: string = '';
|
|
162
165
|
|
|
163
166
|
constructor(
|
|
164
167
|
private psService: ProgressSpinnerService,
|
|
@@ -192,6 +195,18 @@ export class ListViewComponent implements OnInit, OnDestroy {
|
|
|
192
195
|
this.arFilterMainButtons$.push({ actionID: 'submit', jsAction: 'submit', name: 'Submit' });
|
|
193
196
|
this.arFilterSecondaryButtons$.push({ actionID: 'cancel', jsAction: 'cancel', name: 'Cancel' });
|
|
194
197
|
|
|
198
|
+
let title = this.configProps$?.title || this.configProps$?.label || 'List';
|
|
199
|
+
const inheritedProps = this.configProps$?.inheritedProps;
|
|
200
|
+
if (title === 'List' && inheritedProps) {
|
|
201
|
+
for (const inheritedProp of inheritedProps) {
|
|
202
|
+
if (inheritedProp?.prop === 'label') {
|
|
203
|
+
title = inheritedProp?.value;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
this.label = title;
|
|
209
|
+
|
|
195
210
|
this.searchIcon$ = this.utils.getImageSrc('search', this.utils.getSDKStaticContentUrl());
|
|
196
211
|
setTimeout(() => {
|
|
197
212
|
PCore.getPubSubUtils().subscribe(
|
|
@@ -1380,6 +1395,11 @@ export class ListViewComponent implements OnInit, OnDestroy {
|
|
|
1380
1395
|
return listFields;
|
|
1381
1396
|
}
|
|
1382
1397
|
|
|
1398
|
+
getResultsText() {
|
|
1399
|
+
const recordsCount = this.repeatList$?.paginator?.length || 0;
|
|
1400
|
+
return `${recordsCount || 0} result${recordsCount > 1 ? 's' : ''}`;
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1383
1403
|
getField(fieldDefs, columnId) {
|
|
1384
1404
|
const fieldsMap = this.getFieldsMap(fieldDefs);
|
|
1385
1405
|
return fieldsMap.get(columnId);
|
|
@@ -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 PegaDxilMyCurrencyComponent 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 PegaDxilMyCurrencyComponent 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 PegaDxilMyCurrencyComponent 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
|
}
|
|
@@ -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 PegaDxilMyDecimalComponent 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 PegaDxilMyDecimalComponent 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 PegaDxilMyDecimalComponent 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 PegaDxilMyDecimalComponent 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
|
}
|
|
@@ -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 PegaDxilMyPercentageComponent 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,14 +121,15 @@ export class PegaDxilMyPercentageComponent 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;
|
|
@@ -187,11 +188,16 @@ export class PegaDxilMyPercentageComponent 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
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { moduleMetadata } from '@storybook/angular';
|
|
2
3
|
import { FormBuilder } from '@angular/forms';
|
|
3
4
|
import { DatapageService } from '@pega/angular-sdk-components';
|
|
4
5
|
import { configProps, stateProps } from './mock';
|