@pega/angular-sdk-overrides 0.24.1 → 0.24.3
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-vertical-tabs/material-vertical-tabs.component.html +1 -1
- package/lib/field/cancel-alert/cancel-alert.component.ts +0 -2
- package/lib/field/currency/currency.component.html +4 -4
- package/lib/field/currency/currency.component.ts +31 -19
- package/lib/field/date-time/date-time.component.html +5 -5
- package/lib/field/date-time/date-time.component.ts +8 -39
- package/lib/field/decimal/decimal.component.html +13 -4
- package/lib/field/decimal/decimal.component.ts +41 -5
- package/lib/field/dropdown/dropdown.component.ts +0 -3
- package/lib/field/multiselect/utils.ts +1 -1
- package/lib/field/percentage/percentage.component.html +4 -3
- package/lib/field/percentage/percentage.component.ts +24 -5
- package/lib/field/radio-buttons/radio-buttons.component.ts +0 -3
- package/lib/field/scalar-list/scalar-list.component.ts +2 -1
- package/lib/field/text-area/text-area.component.ts +0 -2
- package/lib/field/user-reference/user-reference.component.html +50 -45
- package/lib/field/user-reference/user-reference.component.ts +33 -15
- package/lib/infra/Containers/flow-container/flow-container.component.ts +15 -21
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +0 -1
- package/lib/infra/Containers/view-container/view-container.component.ts +5 -7
- package/lib/infra/assignment/assignment.component.ts +31 -7
- package/lib/infra/dashboard-filter/dashboard-filter.component.ts +0 -1
- package/lib/infra/defer-load/defer-load.component.ts +5 -8
- package/lib/infra/multi-step/multi-step.component.html +1 -1
- package/lib/infra/navbar/navbar.component.html +1 -1
- package/lib/infra/navbar/navbar.component.ts +3 -2
- package/lib/template/case-view/case-view.component.html +3 -3
- package/lib/template/case-view/case-view.component.scss +2 -0
- package/lib/template/case-view/case-view.component.ts +0 -6
- package/lib/template/data-reference/data-reference.component.ts +1 -3
- package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +0 -1
- package/lib/template/field-group-template/field-group-template.component.ts +4 -12
- package/lib/template/list-view/list-view.component.html +2 -2
- package/lib/template/list-view/list-view.component.ts +16 -5
- package/lib/template/list-view/listViewHelpers.ts +0 -1
- package/lib/template/repeating-structures/repeating-structures.component.ts +1 -2
- package/lib/template/simple-table/simple-table.component.ts +0 -2
- package/lib/template/simple-table-manual/simple-table-manual.component.ts +5 -10
- package/lib/template/simple-table-select/simple-table-select.component.ts +2 -4
- package/lib/widget/attachment/attachment.component.html +50 -34
- package/lib/widget/attachment/attachment.component.scss +118 -0
- package/lib/widget/attachment/attachment.component.ts +252 -500
- package/lib/widget/case-history/case-history.component.ts +1 -2
- package/lib/widget/feed-container/feed-container.component.ts +0 -4
- package/lib/widget/file-utility/file-utility.component.html +2 -2
- package/lib/widget/file-utility/file-utility.component.ts +13 -17
- package/lib/widget/list-utility/list-utility.component.html +1 -1
- package/lib/widget/quick-create/quick-create.component.ts +1 -1
- package/lib/widget/todo/todo.component.html +3 -3
- package/lib/widget/todo/todo.component.ts +3 -5
- package/package.json +1 -1
package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.html
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div>
|
|
2
|
-
<mat-button-toggle-group vertical (change)="onChange($event.value)" [value]="selectedTabId$" aria-label="Tabs">
|
|
2
|
+
<mat-button-toggle-group vertical hideSingleSelectionIndicator (change)="onChange($event.value)" [value]="selectedTabId$" aria-label="Tabs">
|
|
3
3
|
<mat-button-toggle *ngFor="let tab of tabConfig$" [value]="tab.id" style="text-align: left">
|
|
4
4
|
<div style="display: flex">
|
|
5
5
|
<div style="flex-grow: 10">{{ tab.name }}</div>
|
|
@@ -71,7 +71,6 @@ export class CancelAlertComponent implements OnChanges {
|
|
|
71
71
|
this.psService.sendMessage(false);
|
|
72
72
|
this.dismissAlert();
|
|
73
73
|
|
|
74
|
-
// @ts-ignore - second parameter “payload” for publish method should be optional
|
|
75
74
|
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CASE_CREATED);
|
|
76
75
|
})
|
|
77
76
|
.catch(() => {
|
|
@@ -92,7 +91,6 @@ export class CancelAlertComponent implements OnChanges {
|
|
|
92
91
|
.then(() => {
|
|
93
92
|
this.psService.sendMessage(false);
|
|
94
93
|
this.dismissAlert();
|
|
95
|
-
// @ts-ignore - second parameter “payload” for publish method should be optional
|
|
96
94
|
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
|
|
97
95
|
})
|
|
98
96
|
.catch(() => {
|
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
|
|
8
8
|
<mat-label>{{ label$ }}</mat-label>
|
|
9
9
|
<div class="psdk-currency-input">
|
|
10
|
-
<span>{{ symbol }}</span>
|
|
11
10
|
<input
|
|
12
11
|
style="margin-left: 5px"
|
|
13
|
-
type="
|
|
12
|
+
type="text"
|
|
14
13
|
matInput
|
|
14
|
+
currencyMask
|
|
15
|
+
[options]="{ prefix: currSym, thousands: currSep, decimal: currDec, align: 'left', nullable: true }"
|
|
15
16
|
[placeholder]="placeholder"
|
|
16
|
-
[
|
|
17
|
+
[formControlName]="controlName$"
|
|
17
18
|
[required]="bRequired$"
|
|
18
19
|
[formControl]="fieldControl"
|
|
19
20
|
[attr.data-test-id]="testId"
|
|
20
|
-
(change)="fieldOnChange($event)"
|
|
21
21
|
(blur)="fieldOnBlur($event)"
|
|
22
22
|
/>
|
|
23
23
|
</div>
|
|
@@ -4,9 +4,11 @@ import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
|
4
4
|
import { MatInputModule } from '@angular/material/input';
|
|
5
5
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
6
6
|
import { interval } from 'rxjs';
|
|
7
|
+
import { NgxCurrencyDirective } from 'ngx-currency';
|
|
7
8
|
import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
|
|
8
9
|
import { Utils } from '@pega/angular-sdk-components';
|
|
9
10
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
11
|
+
import { handleEvent } from '@pega/angular-sdk-components';
|
|
10
12
|
import { getCurrencyCharacters } from '@pega/angular-sdk-components';
|
|
11
13
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
12
14
|
|
|
@@ -20,7 +22,7 @@ interface CurrrencyProps extends PConnFieldProps {
|
|
|
20
22
|
templateUrl: './currency.component.html',
|
|
21
23
|
styleUrls: ['./currency.component.scss'],
|
|
22
24
|
standalone: true,
|
|
23
|
-
imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)]
|
|
25
|
+
imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, NgxCurrencyDirective, forwardRef(() => ComponentMapperComponent)]
|
|
24
26
|
})
|
|
25
27
|
export class CurrencyComponent implements OnInit, OnDestroy {
|
|
26
28
|
@Input() pConn$: typeof PConnect;
|
|
@@ -31,7 +33,7 @@ export class CurrencyComponent implements OnInit, OnDestroy {
|
|
|
31
33
|
configProps$: CurrrencyProps;
|
|
32
34
|
|
|
33
35
|
label$ = '';
|
|
34
|
-
value$:
|
|
36
|
+
value$: any;
|
|
35
37
|
bRequired$ = false;
|
|
36
38
|
bReadonly$ = false;
|
|
37
39
|
bDisabled$ = false;
|
|
@@ -47,9 +49,9 @@ export class CurrencyComponent implements OnInit, OnDestroy {
|
|
|
47
49
|
currencyOptions: Object = {};
|
|
48
50
|
|
|
49
51
|
fieldControl = new FormControl<number | null>(null, { updateOn: 'blur' });
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
currSym: string;
|
|
53
|
+
currSep: string;
|
|
54
|
+
currDec: string;
|
|
53
55
|
|
|
54
56
|
constructor(
|
|
55
57
|
private angularPConnect: AngularPConnectService,
|
|
@@ -114,10 +116,21 @@ export class CurrencyComponent implements OnInit, OnDestroy {
|
|
|
114
116
|
this.testId = this.configProps$.testId;
|
|
115
117
|
this.label$ = this.configProps$.label;
|
|
116
118
|
this.displayMode$ = this.configProps$.displayMode;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
let nValue: any = this.configProps$.value;
|
|
120
|
+
if (nValue) {
|
|
121
|
+
if (typeof nValue === 'string') {
|
|
122
|
+
nValue = parseFloat(nValue);
|
|
123
|
+
}
|
|
124
|
+
this.value$ = nValue;
|
|
125
|
+
}
|
|
119
126
|
this.helperText = this.configProps$.helperText;
|
|
120
127
|
this.placeholder = this.configProps$.placeholder || '';
|
|
128
|
+
const currencyISOCode: any = this.configProps$?.currencyISOCode;
|
|
129
|
+
|
|
130
|
+
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
131
|
+
this.currSym = theSymbols.theCurrencySymbol;
|
|
132
|
+
this.currSep = theSymbols.theDigitGroupSeparator;
|
|
133
|
+
this.currDec = theSymbols.theDecimalIndicator;
|
|
121
134
|
|
|
122
135
|
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
123
136
|
setTimeout(() => {
|
|
@@ -150,11 +163,6 @@ export class CurrencyComponent implements OnInit, OnDestroy {
|
|
|
150
163
|
this.currencyISOCode = this.configProps$.currencyISOCode;
|
|
151
164
|
}
|
|
152
165
|
|
|
153
|
-
const theSymbols = getCurrencyCharacters(this.currencyISOCode);
|
|
154
|
-
this.symbol = theSymbols.theCurrencySymbol;
|
|
155
|
-
this.thousandsSep = theSymbols.theDigitGroupSeparator;
|
|
156
|
-
this.decimalSep = theSymbols.theDecimalIndicator;
|
|
157
|
-
|
|
158
166
|
this.componentReference = (this.pConn$.getStateProps() as any).value;
|
|
159
167
|
|
|
160
168
|
// trigger display of error message with field control
|
|
@@ -168,14 +176,18 @@ export class CurrencyComponent implements OnInit, OnDestroy {
|
|
|
168
176
|
}
|
|
169
177
|
}
|
|
170
178
|
|
|
171
|
-
fieldOnChange(event: any) {
|
|
172
|
-
this.angularPConnectData.actions?.onChange(this, event);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
179
|
fieldOnBlur(event: any) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
180
|
+
const actionsApi = this.pConn$?.getActionsApi();
|
|
181
|
+
const propName = (this.pConn$?.getStateProps() as any).value;
|
|
182
|
+
let value = event?.target?.value;
|
|
183
|
+
value = value?.substring(1);
|
|
184
|
+
if (this.currSep === ',') {
|
|
185
|
+
value = value.replace(/,/g, '');
|
|
186
|
+
} else {
|
|
187
|
+
value = value?.replace(/\./g, '');
|
|
188
|
+
value = value?.replace(/,/g, '.');
|
|
189
|
+
}
|
|
190
|
+
handleEvent(actionsApi, 'changeNblur', propName, value);
|
|
179
191
|
}
|
|
180
192
|
|
|
181
193
|
getErrorMessage() {
|
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
<mat-label>{{ label$ }}</mat-label>
|
|
9
9
|
<input
|
|
10
10
|
matInput
|
|
11
|
+
[owlDateTime]="dtPicker"
|
|
11
12
|
[attr.data-test-id]="testId"
|
|
12
|
-
[ngxMatDatetimePicker]="picker"
|
|
13
13
|
[placeholder]="placeholder"
|
|
14
14
|
[formControl]="fieldControl"
|
|
15
|
-
(dateChange)="fieldOnChange($event)"
|
|
16
15
|
(blur)="fieldOnBlur($event)"
|
|
16
|
+
(dateTimeChange)="fieldOnBlur($event)"
|
|
17
17
|
[value]="value$"
|
|
18
18
|
[required]="bRequired$"
|
|
19
19
|
/>
|
|
20
|
-
<mat-datepicker-toggle matSuffix [for]="$any(
|
|
21
|
-
<
|
|
22
|
-
<mat-error *ngIf="fieldControl
|
|
20
|
+
<mat-datepicker-toggle matSuffix [for]="$any(dtPicker)" [owlDateTimeTrigger]="dtPicker"></mat-datepicker-toggle>
|
|
21
|
+
<owl-date-time #dtPicker></owl-date-time>
|
|
22
|
+
<mat-error *ngIf="fieldControl?.invalid">{{ getErrorMessage() }}</mat-error>
|
|
23
23
|
</mat-form-field>
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
@@ -1,44 +1,21 @@
|
|
|
1
|
-
/* eslint-disable max-classes-per-file */
|
|
2
1
|
import { Component, OnInit, Input, ChangeDetectorRef, forwardRef, OnDestroy } from '@angular/core';
|
|
3
2
|
import { CommonModule } from '@angular/common';
|
|
4
3
|
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
-
import { NgxMatDatetimePickerModule, NgxMatTimepickerModule, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
|
6
|
-
import { NgxMatMomentModule } from '@angular-material-components/moment-adapter';
|
|
7
|
-
import { MomentDateModule } from '@angular/material-moment-adapter';
|
|
8
4
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
9
5
|
import { MatInputModule } from '@angular/material/input';
|
|
10
6
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
7
|
+
import { OwlDateTimeModule, OwlNativeDateTimeModule } from '@danielmoncada/angular-datetime-picker';
|
|
11
8
|
import { interval } from 'rxjs';
|
|
12
9
|
import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
|
|
13
10
|
import { Utils } from '@pega/angular-sdk-components';
|
|
14
11
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
15
12
|
import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/angular-sdk-components';
|
|
16
|
-
import { handleEvent } from '@pega/angular-sdk-components';
|
|
17
13
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
18
14
|
|
|
19
15
|
interface DateTimeProps extends PConnFieldProps {
|
|
20
16
|
// If any, enter additional props that only exist on DateTime here
|
|
21
17
|
}
|
|
22
18
|
|
|
23
|
-
class MyFormat {
|
|
24
|
-
theDateFormat: any = getDateFormatInfo();
|
|
25
|
-
|
|
26
|
-
get display() {
|
|
27
|
-
return {
|
|
28
|
-
dateInput: `${this.theDateFormat.dateFormatString}, LT`,
|
|
29
|
-
monthYearLabel: 'MMM YYYY',
|
|
30
|
-
dateA11yLabel: 'LL',
|
|
31
|
-
monthYearA11yLabel: 'MMMM YYYY'
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
get parse() {
|
|
36
|
-
return {
|
|
37
|
-
dateInput: `${this.theDateFormat.dateFormatString}, LT`
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
19
|
@Component({
|
|
43
20
|
selector: 'app-date-time',
|
|
44
21
|
templateUrl: './date-time.component.html',
|
|
@@ -50,13 +27,10 @@ class MyFormat {
|
|
|
50
27
|
MatFormFieldModule,
|
|
51
28
|
MatInputModule,
|
|
52
29
|
MatDatepickerModule,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
NgxMatTimepickerModule,
|
|
56
|
-
MomentDateModule,
|
|
30
|
+
OwlDateTimeModule,
|
|
31
|
+
OwlNativeDateTimeModule,
|
|
57
32
|
forwardRef(() => ComponentMapperComponent)
|
|
58
|
-
]
|
|
59
|
-
providers: [{ provide: NGX_MAT_DATE_FORMATS, useClass: MyFormat }]
|
|
33
|
+
]
|
|
60
34
|
})
|
|
61
35
|
export class DateTimeComponent implements OnInit, OnDestroy {
|
|
62
36
|
@Input() pConn$: typeof PConnect;
|
|
@@ -194,16 +168,11 @@ export class DateTimeComponent implements OnInit, OnDestroy {
|
|
|
194
168
|
}
|
|
195
169
|
}
|
|
196
170
|
|
|
197
|
-
fieldOnChange(event: any) {
|
|
198
|
-
const value = event.value && event.value.isValid() ? event.value : null;
|
|
199
|
-
const actionsApi = this.pConn$?.getActionsApi();
|
|
200
|
-
const propName = (this.pConn$?.getStateProps() as any).value;
|
|
201
|
-
handleEvent(actionsApi, 'changeNblur', propName, value?.toISOString());
|
|
202
|
-
}
|
|
203
|
-
|
|
204
171
|
fieldOnBlur(event: any) {
|
|
205
|
-
|
|
206
|
-
|
|
172
|
+
if (typeof event.value === 'object') {
|
|
173
|
+
// convert date to pega "date" format
|
|
174
|
+
event.value = event.value?.toISOString();
|
|
175
|
+
}
|
|
207
176
|
|
|
208
177
|
this.angularPConnectData.actions?.onBlur(this, event);
|
|
209
178
|
}
|
|
@@ -1,22 +1,31 @@
|
|
|
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
|
-
<div *ngIf="
|
|
5
|
+
<div *ngIf="bHasForm$; else noEdit">
|
|
6
6
|
<div [formGroup]="formGroup$" *ngIf="bVisible$">
|
|
7
7
|
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
|
|
8
8
|
<mat-label>{{ label$ }}</mat-label>
|
|
9
9
|
<input
|
|
10
10
|
type="text"
|
|
11
11
|
matInput
|
|
12
|
-
|
|
12
|
+
currencyMask
|
|
13
|
+
[options]="{
|
|
14
|
+
prefix: bReadonly$ && formatter === 'Currency' ? currSym : '',
|
|
15
|
+
thousands: currSep,
|
|
16
|
+
decimal: currDec,
|
|
17
|
+
align: 'left',
|
|
18
|
+
nullable: true,
|
|
19
|
+
inputMode: inputMode
|
|
20
|
+
}"
|
|
13
21
|
[placeholder]="placeholder"
|
|
14
22
|
step="0.01"
|
|
15
|
-
[
|
|
23
|
+
[formControlName]="controlName$"
|
|
16
24
|
[required]="bRequired$"
|
|
17
25
|
[formControl]="fieldControl"
|
|
18
26
|
[attr.data-test-id]="testId"
|
|
19
27
|
(blur)="fieldOnBlur($event)"
|
|
28
|
+
[readonly]="bReadonly$"
|
|
20
29
|
/>
|
|
21
30
|
<mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
|
|
22
31
|
</mat-form-field>
|
|
@@ -3,18 +3,21 @@ import { CommonModule } from '@angular/common';
|
|
|
3
3
|
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
4
|
import { MatInputModule } from '@angular/material/input';
|
|
5
5
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
6
|
+
import { NgxCurrencyDirective, NgxCurrencyInputMode } from 'ngx-currency';
|
|
6
7
|
import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
|
|
7
8
|
import { Utils } from '@pega/angular-sdk-components';
|
|
8
9
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
9
10
|
import { handleEvent } from '@pega/angular-sdk-components';
|
|
10
|
-
import {
|
|
11
|
+
import { getCurrencyCharacters, getCurrencyOptions } from '@pega/angular-sdk-components';
|
|
11
12
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
13
|
+
import { format } from '@pega/angular-sdk-components';
|
|
12
14
|
|
|
13
15
|
interface DecimalProps extends PConnFieldProps {
|
|
14
16
|
// If any, enter additional props that only exist on Decimal here
|
|
15
17
|
currencyISOCode?: string;
|
|
16
18
|
decimalPrecision?: number;
|
|
17
19
|
showGroupSeparators?: string;
|
|
20
|
+
formatter?: string;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
@Component({
|
|
@@ -28,7 +31,7 @@ interface DecimalProps extends PConnFieldProps {
|
|
|
28
31
|
FormsModule,
|
|
29
32
|
MatFormFieldModule,
|
|
30
33
|
MatInputModule,
|
|
31
|
-
|
|
34
|
+
NgxCurrencyDirective,
|
|
32
35
|
forwardRef(() => ComponentMapperComponent)
|
|
33
36
|
]
|
|
34
37
|
})
|
|
@@ -41,7 +44,7 @@ export class DecimalComponent implements OnInit, OnDestroy {
|
|
|
41
44
|
configProps$: DecimalProps;
|
|
42
45
|
|
|
43
46
|
label$ = '';
|
|
44
|
-
value$:
|
|
47
|
+
value$: any;
|
|
45
48
|
bRequired$ = false;
|
|
46
49
|
bReadonly$ = false;
|
|
47
50
|
bDisabled$ = false;
|
|
@@ -55,6 +58,13 @@ export class DecimalComponent implements OnInit, OnDestroy {
|
|
|
55
58
|
placeholder: string;
|
|
56
59
|
|
|
57
60
|
fieldControl = new FormControl<number | null>(null, null);
|
|
61
|
+
currDec: string;
|
|
62
|
+
currSep: string;
|
|
63
|
+
currSym: string;
|
|
64
|
+
decimalPrecision: number | undefined;
|
|
65
|
+
formatter;
|
|
66
|
+
formattedValue: any;
|
|
67
|
+
inputMode: any;
|
|
58
68
|
|
|
59
69
|
constructor(
|
|
60
70
|
private angularPConnect: AngularPConnectService,
|
|
@@ -119,6 +129,7 @@ export class DecimalComponent implements OnInit, OnDestroy {
|
|
|
119
129
|
this.testId = this.configProps$.testId;
|
|
120
130
|
this.label$ = this.configProps$.label;
|
|
121
131
|
this.displayMode$ = this.configProps$.displayMode;
|
|
132
|
+
this.inputMode = NgxCurrencyInputMode.Natural;
|
|
122
133
|
let nValue: any = this.configProps$.value;
|
|
123
134
|
if (nValue) {
|
|
124
135
|
if (typeof nValue === 'string') {
|
|
@@ -128,6 +139,21 @@ export class DecimalComponent implements OnInit, OnDestroy {
|
|
|
128
139
|
}
|
|
129
140
|
this.helperText = this.configProps$.helperText;
|
|
130
141
|
this.placeholder = this.configProps$.placeholder || '';
|
|
142
|
+
const showGroupSeparators = this.configProps$.showGroupSeparators;
|
|
143
|
+
const currencyISOCode: any = this.configProps$?.currencyISOCode;
|
|
144
|
+
|
|
145
|
+
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
146
|
+
this.currDec = theSymbols.theDecimalIndicator;
|
|
147
|
+
this.currSep = showGroupSeparators ? theSymbols.theDigitGroupSeparator : '';
|
|
148
|
+
|
|
149
|
+
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
150
|
+
this.formatter = this.configProps$.formatter;
|
|
151
|
+
|
|
152
|
+
if (this.formatter === 'Currency') {
|
|
153
|
+
this.formattedValue = format(this.value$, this.formatter.toLowerCase(), theCurrencyOptions);
|
|
154
|
+
} else {
|
|
155
|
+
this.formattedValue = format(this.value$, this.pConn$.getComponentName().toLowerCase(), theCurrencyOptions);
|
|
156
|
+
}
|
|
131
157
|
|
|
132
158
|
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
133
159
|
setTimeout(() => {
|
|
@@ -156,6 +182,12 @@ export class DecimalComponent implements OnInit, OnDestroy {
|
|
|
156
182
|
this.fieldControl.enable();
|
|
157
183
|
}
|
|
158
184
|
|
|
185
|
+
if (this.bReadonly$ && this.formatter === 'Currency') {
|
|
186
|
+
this.currSym = theSymbols.theCurrencySymbol;
|
|
187
|
+
} else {
|
|
188
|
+
this.currSym = '';
|
|
189
|
+
}
|
|
190
|
+
|
|
159
191
|
this.componentReference = (this.pConn$.getStateProps() as any).value;
|
|
160
192
|
}
|
|
161
193
|
|
|
@@ -163,8 +195,12 @@ export class DecimalComponent implements OnInit, OnDestroy {
|
|
|
163
195
|
const actionsApi = this.pConn$?.getActionsApi();
|
|
164
196
|
const propName = (this.pConn$?.getStateProps() as any).value;
|
|
165
197
|
let value = event?.target?.value;
|
|
166
|
-
|
|
167
|
-
|
|
198
|
+
if (this.currSep === ',') {
|
|
199
|
+
value = value.replace(/,/g, '');
|
|
200
|
+
} else {
|
|
201
|
+
value = value?.replace(/\./g, '');
|
|
202
|
+
value = value?.replace(/,/g, '.');
|
|
203
|
+
}
|
|
168
204
|
handleEvent(actionsApi, 'changeNblur', propName, value);
|
|
169
205
|
}
|
|
170
206
|
|
|
@@ -159,7 +159,6 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
159
159
|
|
|
160
160
|
this.componentReference = (this.pConn$.getStateProps() as any).value;
|
|
161
161
|
|
|
162
|
-
// @ts-ignore - parameter “contextName” for getDataObject method should be optional
|
|
163
162
|
const optionsList = [...this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject())];
|
|
164
163
|
optionsList?.unshift({ key: 'Select', value: this.pConn$.getLocalizedValue('Select...', '', '') });
|
|
165
164
|
this.options$ = optionsList;
|
|
@@ -184,7 +183,6 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
184
183
|
this.localizedValue = this.pConn$.getLocalizedValue(
|
|
185
184
|
this.value$,
|
|
186
185
|
this.localePath,
|
|
187
|
-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'.
|
|
188
186
|
this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
|
|
189
187
|
);
|
|
190
188
|
// trigger display of error message with field control
|
|
@@ -223,7 +221,6 @@ export class DropdownComponent implements OnInit, OnDestroy {
|
|
|
223
221
|
return this.pConn$.getLocalizedValue(
|
|
224
222
|
opt.value,
|
|
225
223
|
this.localePath,
|
|
226
|
-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'.
|
|
227
224
|
this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
|
|
228
225
|
);
|
|
229
226
|
}
|
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
<div [formGroup]="formGroup$" *ngIf="bVisible$">
|
|
7
7
|
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
|
|
8
8
|
<mat-label>{{ label$ }}</mat-label>
|
|
9
|
-
<!-- <span matPrefix>% </span> -->
|
|
10
9
|
<input
|
|
10
|
+
type="text"
|
|
11
11
|
matInput
|
|
12
|
+
currencyMask
|
|
13
|
+
[options]="{ prefix: '', suffix: '%', thousands: currSep, decimal: currDec, align: 'left', nullable: true }"
|
|
12
14
|
[placeholder]="placeholder"
|
|
13
|
-
type="number"
|
|
14
15
|
step=".01"
|
|
15
|
-
[
|
|
16
|
+
[formControlName]="controlName$"
|
|
16
17
|
[required]="bRequired$"
|
|
17
18
|
[formControl]="fieldControl"
|
|
18
19
|
[attr.data-test-id]="testId"
|
|
@@ -4,12 +4,17 @@ import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
|
4
4
|
import { MatInputModule } from '@angular/material/input';
|
|
5
5
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
6
6
|
import { interval } from 'rxjs';
|
|
7
|
+
import { NgxCurrencyDirective } from 'ngx-currency';
|
|
7
8
|
import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
|
|
8
9
|
import { Utils } from '@pega/angular-sdk-components';
|
|
9
10
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
11
|
+
import { handleEvent } from '@pega/angular-sdk-components';
|
|
12
|
+
import { getCurrencyCharacters } from '@pega/angular-sdk-components';
|
|
10
13
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
11
14
|
|
|
12
15
|
interface PercentageProps extends PConnFieldProps {
|
|
16
|
+
showGroupSeparators?: string;
|
|
17
|
+
decimalPrecision?: number;
|
|
13
18
|
// If any, enter additional props that only exist on Percentage here
|
|
14
19
|
}
|
|
15
20
|
|
|
@@ -18,7 +23,7 @@ interface PercentageProps extends PConnFieldProps {
|
|
|
18
23
|
templateUrl: './percentage.component.html',
|
|
19
24
|
styleUrls: ['./percentage.component.scss'],
|
|
20
25
|
standalone: true,
|
|
21
|
-
imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, forwardRef(() => ComponentMapperComponent)]
|
|
26
|
+
imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, NgxCurrencyDirective, forwardRef(() => ComponentMapperComponent)]
|
|
22
27
|
})
|
|
23
28
|
export class PercentageComponent implements OnInit, OnDestroy {
|
|
24
29
|
@Input() pConn$: typeof PConnect;
|
|
@@ -41,7 +46,8 @@ export class PercentageComponent implements OnInit, OnDestroy {
|
|
|
41
46
|
testId: string;
|
|
42
47
|
helperText: string;
|
|
43
48
|
placeholder: string;
|
|
44
|
-
|
|
49
|
+
currDec: string;
|
|
50
|
+
currSep: string;
|
|
45
51
|
fieldControl = new FormControl<number | null>(null, null);
|
|
46
52
|
|
|
47
53
|
constructor(
|
|
@@ -113,6 +119,11 @@ export class PercentageComponent implements OnInit, OnDestroy {
|
|
|
113
119
|
}
|
|
114
120
|
this.helperText = this.configProps$.helperText;
|
|
115
121
|
this.placeholder = this.configProps$.placeholder || '';
|
|
122
|
+
const showGroupSeparators = this.configProps$.showGroupSeparators;
|
|
123
|
+
|
|
124
|
+
const theSymbols = getCurrencyCharacters('');
|
|
125
|
+
this.currDec = theSymbols.theDecimalIndicator || '2';
|
|
126
|
+
this.currSep = showGroupSeparators ? theSymbols.theDigitGroupSeparator : '';
|
|
116
127
|
|
|
117
128
|
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
118
129
|
setTimeout(() => {
|
|
@@ -158,9 +169,17 @@ export class PercentageComponent implements OnInit, OnDestroy {
|
|
|
158
169
|
}
|
|
159
170
|
|
|
160
171
|
fieldOnBlur(event: any) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
172
|
+
const actionsApi = this.pConn$?.getActionsApi();
|
|
173
|
+
const propName = (this.pConn$?.getStateProps() as any).value;
|
|
174
|
+
let value = event?.target?.value;
|
|
175
|
+
value = value?.replace('%', '');
|
|
176
|
+
if (this.currSep === ',') {
|
|
177
|
+
value = value.replace(/,/g, '');
|
|
178
|
+
} else {
|
|
179
|
+
value = value?.replace(/\./g, '');
|
|
180
|
+
value = value?.replace(/,/g, '.');
|
|
181
|
+
}
|
|
182
|
+
handleEvent(actionsApi, 'changeNblur', propName, value);
|
|
164
183
|
}
|
|
165
184
|
|
|
166
185
|
getErrorMessage() {
|
|
@@ -166,7 +166,6 @@ export class RadioButtonsComponent implements OnInit, OnDestroy {
|
|
|
166
166
|
|
|
167
167
|
this.componentReference = (this.pConn$.getStateProps() as any).value;
|
|
168
168
|
|
|
169
|
-
// @ts-ignore - parameter “contextName” for getDataObject method should be optional
|
|
170
169
|
this.options$ = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject());
|
|
171
170
|
|
|
172
171
|
const propName = (this.pConn$.getStateProps() as any).value;
|
|
@@ -186,7 +185,6 @@ export class RadioButtonsComponent implements OnInit, OnDestroy {
|
|
|
186
185
|
this.localizedValue = this.pConn$.getLocalizedValue(
|
|
187
186
|
this.value$,
|
|
188
187
|
this.localePath,
|
|
189
|
-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
190
188
|
this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
|
|
191
189
|
);
|
|
192
190
|
// trigger display of error message with field control
|
|
@@ -217,7 +215,6 @@ export class RadioButtonsComponent implements OnInit, OnDestroy {
|
|
|
217
215
|
return this.pConn$.getLocalizedValue(
|
|
218
216
|
opt.value,
|
|
219
217
|
this.localePath,
|
|
220
|
-
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
221
218
|
this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
|
|
222
219
|
);
|
|
223
220
|
}
|
|
@@ -101,11 +101,12 @@ export class ScalarListComponent implements OnInit, OnDestroy {
|
|
|
101
101
|
{
|
|
102
102
|
type: componentType,
|
|
103
103
|
config: {
|
|
104
|
+
// @ts-ignore - Object literal may only specify known properties, and 'value' does not exist in type 'ComponentMetadataConfig'.
|
|
104
105
|
value: scalarValue,
|
|
105
106
|
displayMode: 'LABELS_LEFT',
|
|
106
107
|
label: this.label$,
|
|
107
108
|
...restProps,
|
|
108
|
-
readOnly:
|
|
109
|
+
readOnly: true
|
|
109
110
|
}
|
|
110
111
|
},
|
|
111
112
|
'',
|
|
@@ -107,8 +107,6 @@ export class TextAreaComponent implements OnInit, OnDestroy {
|
|
|
107
107
|
if (this.configProps$.value != undefined) {
|
|
108
108
|
this.value$ = this.configProps$.value;
|
|
109
109
|
}
|
|
110
|
-
// @ts-ignore - Property 'getFieldMetadata' is private and only accessible within class 'C11nEnv'.
|
|
111
|
-
// @ts-ignore - Property 'getRawConfigProps' is private and only accessible within class 'C11nEnv'
|
|
112
110
|
this.nMaxLength$ = this.pConn$.getFieldMetadata(this.pConn$.getRawConfigProps()?.value)?.maxLength || 100;
|
|
113
111
|
this.testId = this.configProps$.testId;
|
|
114
112
|
this.displayMode$ = this.configProps$.displayMode;
|