@pega/angular-sdk-overrides 0.24.9 → 0.25.1
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/alert.component.ts +0 -1
- package/lib/designSystemExtension/alert-banner/alert-banner.component.ts +1 -2
- package/lib/designSystemExtension/banner/banner.component.ts +0 -1
- package/lib/designSystemExtension/case-create-stage/case-create-stage.component.ts +1 -2
- package/lib/designSystemExtension/field-group/field-group.component.ts +0 -1
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +2 -1
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +0 -2
- package/lib/designSystemExtension/material-details/material-details.component.ts +0 -1
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +2 -2
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +10 -2
- package/lib/designSystemExtension/material-summary-item/material-summary-item.component.ts +0 -1
- package/lib/designSystemExtension/material-summary-list/material-summary-list.component.ts +0 -1
- package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.ts +0 -1
- package/lib/designSystemExtension/operator/operator.component.html +1 -1
- package/lib/designSystemExtension/operator/operator.component.scss +10 -2
- package/lib/designSystemExtension/operator/operator.component.ts +5 -5
- package/lib/designSystemExtension/pulse/pulse.component.ts +7 -8
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.ts +0 -1
- package/lib/designSystemExtension/wss-quick-create/wss-quick-create.component.ts +0 -1
- package/lib/field/auto-complete/auto-complete.component.html +0 -1
- package/lib/field/auto-complete/auto-complete.component.ts +31 -16
- package/lib/field/cancel-alert/cancel-alert.component.ts +0 -1
- package/lib/field/check-box/check-box.component.html +18 -6
- package/lib/field/check-box/check-box.component.ts +17 -12
- package/lib/field/currency/currency.component.html +4 -4
- package/lib/field/currency/currency.component.ts +42 -20
- package/lib/field/date/date.component.html +3 -7
- package/lib/field/date/date.component.ts +22 -40
- package/lib/field/date-time/date-time.component.html +3 -4
- package/lib/field/date-time/date-time.component.ts +35 -17
- package/lib/field/decimal/decimal.component.html +4 -3
- package/lib/field/decimal/decimal.component.ts +47 -22
- package/lib/field/dropdown/dropdown.component.html +1 -0
- package/lib/field/dropdown/dropdown.component.ts +146 -19
- package/lib/field/email/email.component.ts +24 -5
- package/lib/field/group/group.component.ts +2 -3
- package/lib/field/integer/integer.component.ts +22 -5
- package/lib/field/list-view-action-buttons/list-view-action-buttons.component.html +1 -1
- package/lib/field/list-view-action-buttons/list-view-action-buttons.component.ts +3 -3
- package/lib/field/location/config-ext.json +8 -0
- package/lib/field/location/location.component.html +45 -0
- package/lib/field/location/location.component.scss +18 -0
- package/lib/field/location/location.component.spec.ts +22 -0
- package/lib/field/location/location.component.ts +385 -0
- package/lib/field/multiselect/multiselect.component.ts +17 -10
- package/lib/field/percentage/percentage.component.html +3 -3
- package/lib/field/percentage/percentage.component.ts +45 -21
- package/lib/field/phone/config-ext.json +1 -1
- package/lib/field/phone/phone.component.html +9 -6
- package/lib/field/phone/phone.component.scss +9 -0
- package/lib/field/phone/phone.component.ts +30 -27
- package/lib/field/radio-buttons/radio-buttons.component.html +17 -12
- package/lib/field/radio-buttons/radio-buttons.component.ts +13 -10
- package/lib/field/rich-text/rich-text.component.ts +19 -9
- package/lib/field/scalar-list/scalar-list.component.ts +3 -5
- package/lib/field/selectable-card/selectable-card.component.html +40 -0
- package/lib/field/selectable-card/selectable-card.component.scss +0 -0
- package/lib/field/selectable-card/selectable-card.component.spec.ts +22 -0
- package/lib/field/selectable-card/selectable-card.component.ts +255 -0
- package/lib/field/semantic-link/semantic-link.component.ts +0 -1
- package/lib/field/text/text.component.ts +8 -5
- package/lib/field/text-area/text-area.component.html +4 -1
- package/lib/field/text-area/text-area.component.ts +22 -6
- package/lib/field/text-content/text-content.component.ts +0 -1
- package/lib/field/text-input/text-input.component.ts +22 -5
- package/lib/field/time/time.component.html +2 -2
- package/lib/field/time/time.component.ts +35 -7
- package/lib/field/url/url.component.ts +22 -5
- package/lib/field/user-reference/user-reference.component.html +40 -46
- package/lib/field/user-reference/user-reference.component.ts +111 -21
- package/lib/infra/Containers/flow-container/flow-container.component.html +1 -1
- package/lib/infra/Containers/flow-container/flow-container.component.ts +25 -48
- package/lib/infra/Containers/flow-container/helpers.ts +2 -2
- package/lib/infra/Containers/hybrid-view-container/hybrid-view-container.component.ts +0 -1
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +1 -11
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +1 -9
- 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 -18
- package/lib/infra/action-buttons/action-buttons.component.html +1 -1
- package/lib/infra/action-buttons/action-buttons.component.ts +0 -1
- package/lib/infra/assignment/assignment.component.html +1 -1
- package/lib/infra/assignment/assignment.component.ts +82 -41
- package/lib/infra/assignment-card/assignment-card.component.html +1 -0
- package/lib/infra/assignment-card/assignment-card.component.ts +0 -1
- package/lib/infra/dashboard-filter/dashboard-filter.component.ts +0 -1
- package/lib/infra/defer-load/defer-load.component.ts +8 -6
- package/lib/infra/error-boundary/error-boundary.component.ts +0 -1
- package/lib/infra/multi-step/multi-step.component.ts +0 -1
- package/lib/infra/navbar/navbar.component.ts +3 -6
- package/lib/infra/reference/reference.component.ts +77 -90
- package/lib/infra/region/region.component.ts +0 -1
- package/lib/infra/root-container/root-container.component.html +2 -15
- package/lib/infra/root-container/root-container.component.ts +27 -33
- package/lib/infra/stages/stages.component.scss +2 -2
- package/lib/infra/stages/stages.component.ts +0 -1
- package/lib/infra/view/view.component.html +7 -20
- package/lib/infra/view/view.component.ts +20 -3
- package/lib/template/app-shell/app-shell.component.ts +20 -3
- package/lib/template/banner-page/banner-page.component.ts +0 -1
- package/lib/template/base/details-template-base.ts +67 -0
- package/lib/template/base/form-template-base.ts +16 -0
- package/lib/template/case-summary/case-summary.component.ts +7 -23
- package/lib/template/case-view/case-view.component.html +4 -4
- package/lib/template/case-view/case-view.component.ts +8 -14
- package/lib/template/confirmation/confirmation.component.html +1 -1
- package/lib/template/confirmation/confirmation.component.ts +1 -2
- package/lib/template/data-reference/data-reference.component.ts +36 -41
- package/lib/template/default-form/default-form.component.html +0 -4
- package/lib/template/default-form/default-form.component.ts +41 -25
- package/lib/template/details/details.component.ts +7 -42
- package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +6 -40
- package/lib/template/details-one-column/details-one-column.component.ts +7 -43
- 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 -38
- package/lib/template/details-three-column/details-three-column.component.ts +7 -44
- package/lib/template/details-two-column/details-two-column.component.ts +8 -45
- package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +7 -43
- package/lib/template/dynamic-tabs/dynamic-tabs.component.html +3 -0
- package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +8 -4
- package/lib/template/field-group-list/field-group-list.component.ts +0 -1
- package/lib/template/field-group-template/field-group-template.component.html +7 -7
- package/lib/template/field-group-template/field-group-template.component.scss +8 -0
- package/lib/template/field-group-template/field-group-template.component.ts +68 -48
- package/lib/template/field-value-list/field-value-list.component.html +2 -2
- package/lib/template/field-value-list/field-value-list.component.scss +6 -1
- package/lib/template/field-value-list/field-value-list.component.ts +0 -1
- package/lib/template/inline-dashboard/inline-dashboard.component.ts +0 -1
- package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -3
- package/lib/template/list-page/list-page.component.ts +0 -1
- package/lib/template/list-view/list-view.component.html +6 -1
- package/lib/template/list-view/list-view.component.scss +11 -0
- package/lib/template/list-view/list-view.component.ts +25 -11
- package/lib/template/list-view/listViewHelpers.ts +4 -10
- package/lib/template/list-view/utils.ts +2 -5
- package/lib/template/multi-reference-readonly/multi-reference-readonly.component.ts +0 -1
- package/lib/template/narrow-wide-form/narrow-wide-form.component.ts +1 -2
- package/lib/template/one-column/one-column.component.ts +4 -4
- package/lib/template/one-column-page/one-column-page.component.ts +0 -1
- package/lib/template/one-column-tab/one-column-tab.component.ts +1 -2
- package/lib/template/page/page.component.ts +1 -2
- package/lib/template/promoted-filters/promoted-filters.component.ts +1 -2
- package/lib/template/repeating-structures/repeating-structures.component.ts +1 -2
- package/lib/template/simple-table/simple-table.component.ts +0 -1
- package/lib/template/simple-table-manual/helpers.ts +126 -10
- package/lib/template/simple-table-manual/simple-table-manual.component.html +25 -6
- package/lib/template/simple-table-manual/simple-table-manual.component.scss +12 -3
- package/lib/template/simple-table-manual/simple-table-manual.component.ts +110 -54
- package/lib/template/simple-table-select/simple-table-select.component.ts +3 -4
- package/lib/template/single-reference-readonly/single-reference-readonly.component.ts +0 -1
- package/lib/template/sub-tabs/sub-tabs.component.ts +0 -1
- package/lib/template/three-column/three-column.component.ts +4 -4
- package/lib/template/three-column-page/three-column-page.component.ts +0 -1
- package/lib/template/two-column/two-column.component.ts +4 -4
- package/lib/template/two-column-page/two-column-page.component.ts +0 -1
- package/lib/template/two-column-tab/two-column-tab.component.ts +1 -2
- package/lib/template/utils.ts +16 -0
- package/lib/template/wide-narrow-form/wide-narrow-form.component.ts +4 -4
- package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +1 -2
- package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +3 -4
- package/lib/widget/app-announcement/app-announcement.component.ts +0 -1
- package/lib/widget/attachment/attachment.component.ts +9 -13
- package/lib/widget/case-history/case-history.component.ts +0 -1
- package/lib/widget/feed-container/feed-container.component.ts +7 -10
- package/lib/widget/file-utility/file-utility.component.ts +2 -6
- package/lib/widget/list-utility/list-utility.component.ts +0 -1
- package/lib/widget/quick-create/quick-create.component.ts +0 -1
- package/lib/widget/todo/todo.component.html +5 -6
- package/lib/widget/todo/todo.component.scss +9 -0
- package/lib/widget/todo/todo.component.ts +95 -85
- package/lib/widget/utility/utility.component.ts +0 -1
- package/package.json +1 -1
|
@@ -9,20 +9,21 @@ import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-c
|
|
|
9
9
|
import { Utils } from '@pega/angular-sdk-components';
|
|
10
10
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
11
11
|
import { handleEvent } from '@pega/angular-sdk-components';
|
|
12
|
-
import { getCurrencyCharacters } from '@pega/angular-sdk-components';
|
|
12
|
+
import { getCurrencyCharacters, getCurrencyOptions } 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 CurrrencyProps extends PConnFieldProps {
|
|
16
17
|
// If any, enter additional props that only exist on Currency here
|
|
17
18
|
currencyISOCode?: string;
|
|
18
19
|
allowDecimals: boolean;
|
|
20
|
+
formatter?: string;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
@Component({
|
|
22
24
|
selector: 'app-currency',
|
|
23
25
|
templateUrl: './currency.component.html',
|
|
24
26
|
styleUrls: ['./currency.component.scss'],
|
|
25
|
-
standalone: true,
|
|
26
27
|
imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, NgxCurrencyDirective, forwardRef(() => ComponentMapperComponent)]
|
|
27
28
|
})
|
|
28
29
|
export class CurrencyComponent implements OnInit, OnDestroy {
|
|
@@ -50,11 +51,13 @@ export class CurrencyComponent implements OnInit, OnDestroy {
|
|
|
50
51
|
currencyOptions: Object = {};
|
|
51
52
|
|
|
52
53
|
fieldControl = new FormControl<number | null>(null, { updateOn: 'blur' });
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
currencySymbol: string;
|
|
55
|
+
thousandSeparator: string;
|
|
56
|
+
decimalSeparator: string;
|
|
56
57
|
inputMode: any;
|
|
57
58
|
decimalPrecision: number | undefined;
|
|
59
|
+
formattedValue: string;
|
|
60
|
+
formatter;
|
|
58
61
|
|
|
59
62
|
constructor(
|
|
60
63
|
private angularPConnect: AngularPConnectService,
|
|
@@ -126,15 +129,26 @@ export class CurrencyComponent implements OnInit, OnDestroy {
|
|
|
126
129
|
nValue = parseFloat(nValue);
|
|
127
130
|
}
|
|
128
131
|
this.value$ = nValue;
|
|
132
|
+
this.fieldControl.setValue(this.value$);
|
|
129
133
|
}
|
|
130
134
|
this.helperText = this.configProps$.helperText;
|
|
131
135
|
this.placeholder = this.configProps$.placeholder || '';
|
|
132
|
-
const currencyISOCode
|
|
136
|
+
const currencyISOCode = this.configProps$?.currencyISOCode ?? '';
|
|
133
137
|
|
|
134
138
|
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
135
|
-
this.
|
|
136
|
-
this.
|
|
137
|
-
this.
|
|
139
|
+
this.currencySymbol = theSymbols.theCurrencySymbol;
|
|
140
|
+
this.thousandSeparator = theSymbols.theDigitGroupSeparator;
|
|
141
|
+
this.decimalSeparator = theSymbols.theDecimalIndicator;
|
|
142
|
+
this.formatter = this.configProps$.formatter;
|
|
143
|
+
|
|
144
|
+
if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
|
|
145
|
+
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
146
|
+
if (this.formatter) {
|
|
147
|
+
this.formattedValue = format(this.value$, this.formatter.toLowerCase(), theCurrencyOptions);
|
|
148
|
+
} else {
|
|
149
|
+
this.formattedValue = format(this.value$, 'currency', theCurrencyOptions);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
138
152
|
|
|
139
153
|
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
140
154
|
setTimeout(() => {
|
|
@@ -169,7 +183,7 @@ export class CurrencyComponent implements OnInit, OnDestroy {
|
|
|
169
183
|
|
|
170
184
|
this.decimalPrecision = this.configProps$?.allowDecimals ? 2 : 0;
|
|
171
185
|
|
|
172
|
-
this.componentReference =
|
|
186
|
+
this.componentReference = this.pConn$.getStateProps().value;
|
|
173
187
|
|
|
174
188
|
// trigger display of error message with field control
|
|
175
189
|
if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
|
|
@@ -183,17 +197,25 @@ export class CurrencyComponent implements OnInit, OnDestroy {
|
|
|
183
197
|
}
|
|
184
198
|
|
|
185
199
|
fieldOnBlur(event: any) {
|
|
186
|
-
const
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
value = value?.
|
|
194
|
-
|
|
200
|
+
const oldVal = this.value$ ?? '';
|
|
201
|
+
const isValueChanged = event.target.value.toString() !== oldVal.toString();
|
|
202
|
+
|
|
203
|
+
if (isValueChanged) {
|
|
204
|
+
const actionsApi = this.pConn$?.getActionsApi();
|
|
205
|
+
const propName = this.pConn$?.getStateProps().value;
|
|
206
|
+
let value = event?.target?.value;
|
|
207
|
+
value = value?.substring(1);
|
|
208
|
+
// replacing thousand separator with empty string as not required in api call
|
|
209
|
+
const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
|
|
210
|
+
let regExp = new RegExp(String.raw`${thousandSep}`, 'g');
|
|
211
|
+
value = value?.replace(regExp, '');
|
|
212
|
+
// replacing decimal separator with '.'
|
|
213
|
+
if (this.decimalSeparator !== '.') {
|
|
214
|
+
regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
|
|
215
|
+
value = value.replace(regExp, '.');
|
|
216
|
+
}
|
|
217
|
+
handleEvent(actionsApi, 'changeNblur', propName, value);
|
|
195
218
|
}
|
|
196
|
-
handleEvent(actionsApi, 'changeNblur', propName, value);
|
|
197
219
|
}
|
|
198
220
|
|
|
199
221
|
getErrorMessage() {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
<div *ngIf="displayMode$; else noDisplayMode">
|
|
2
|
-
<component-mapper
|
|
3
|
-
*ngIf="bVisible$ !== false"
|
|
4
|
-
name="FieldValueList"
|
|
5
|
-
[props]="{ label$, value$: getFormattedValue(), displayMode$ }"
|
|
6
|
-
></component-mapper>
|
|
2
|
+
<component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$: formattedValue$, displayMode$ }"></component-mapper>
|
|
7
3
|
</div>
|
|
8
4
|
<ng-template #noDisplayMode>
|
|
9
5
|
<div *ngIf="!bReadonly$ && bHasForm$; else noEdit">
|
|
@@ -19,11 +15,11 @@
|
|
|
19
15
|
type="text"
|
|
20
16
|
[value]="value$"
|
|
21
17
|
[required]="bRequired$"
|
|
18
|
+
[disabled]="bDisabled$"
|
|
22
19
|
[formControl]="fieldControl"
|
|
23
20
|
(dateChange)="fieldOnDateChange($event)"
|
|
24
|
-
(blur)="fieldOnBlur($event)"
|
|
25
21
|
/>
|
|
26
|
-
<mat-datepicker-toggle matSuffix [for]="pegadate"></mat-datepicker-toggle>
|
|
22
|
+
<mat-datepicker-toggle matSuffix [for]="pegadate" [disabled]="bDisabled$"></mat-datepicker-toggle>
|
|
27
23
|
<mat-datepicker #pegadate [startAt]="value$"></mat-datepicker>
|
|
28
24
|
<mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
|
|
29
25
|
</mat-form-field>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable max-classes-per-file */
|
|
2
1
|
import { Component, OnInit, Input, ChangeDetectorRef, forwardRef, Inject, OnDestroy } from '@angular/core';
|
|
3
2
|
import { CommonModule } from '@angular/common';
|
|
4
3
|
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
@@ -15,13 +14,14 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
|
15
14
|
import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/angular-sdk-components';
|
|
16
15
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
17
16
|
import { format } from '@pega/angular-sdk-components';
|
|
17
|
+
import { handleEvent } from '@pega/angular-sdk-components';
|
|
18
18
|
|
|
19
19
|
interface DateProps extends PConnFieldProps {
|
|
20
20
|
// If any, enter additional props that only exist on Date here
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
class MyFormat {
|
|
24
|
-
theDateFormat
|
|
24
|
+
theDateFormat = getDateFormatInfo();
|
|
25
25
|
|
|
26
26
|
get display() {
|
|
27
27
|
return {
|
|
@@ -43,7 +43,6 @@ class MyFormat {
|
|
|
43
43
|
selector: 'app-date',
|
|
44
44
|
templateUrl: './date.component.html',
|
|
45
45
|
styleUrls: ['./date.component.scss'],
|
|
46
|
-
standalone: true,
|
|
47
46
|
imports: [
|
|
48
47
|
CommonModule,
|
|
49
48
|
ReactiveFormsModule,
|
|
@@ -83,7 +82,10 @@ export class DateComponent implements OnInit, OnDestroy {
|
|
|
83
82
|
// Start with default dateFormatInfo
|
|
84
83
|
dateFormatInfo = dateFormatInfoDefault;
|
|
85
84
|
// and then update, as needed, based on locale, etc.
|
|
86
|
-
theDateFormat
|
|
85
|
+
theDateFormat = getDateFormatInfo();
|
|
86
|
+
actionsApi: Object;
|
|
87
|
+
propName: string;
|
|
88
|
+
formattedValue$: any;
|
|
87
89
|
|
|
88
90
|
constructor(
|
|
89
91
|
private angularPConnect: AngularPConnectService,
|
|
@@ -146,27 +148,16 @@ export class DateComponent implements OnInit, OnDestroy {
|
|
|
146
148
|
// moved this from ngOnInit() and call this from there instead...
|
|
147
149
|
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as DateProps;
|
|
148
150
|
|
|
149
|
-
|
|
150
|
-
let sDateValue: any = '';
|
|
151
|
-
sDateValue = this.configProps$.value;
|
|
152
|
-
|
|
153
|
-
if (sDateValue != '') {
|
|
154
|
-
if (typeof sDateValue === 'object') {
|
|
155
|
-
sDateValue = sDateValue.toISOString();
|
|
156
|
-
} else if (sDateValue.indexOf('/') < 0) {
|
|
157
|
-
// if we have the "pega" format, then for display, convert to standard format (US)
|
|
158
|
-
// sDateValue = this.formatDate(sDateValue);
|
|
159
|
-
sDateValue = this.utils.generateDate(sDateValue, 'Date-Long-Custom-YYYY');
|
|
160
|
-
}
|
|
161
|
-
this.value$ = new Date(sDateValue);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
151
|
+
this.value$ = this.configProps$.value;
|
|
164
152
|
this.testId = this.configProps$.testId;
|
|
165
153
|
this.label$ = this.configProps$.label;
|
|
166
154
|
this.displayMode$ = this.configProps$.displayMode;
|
|
167
155
|
this.helperText = this.configProps$.helperText;
|
|
168
156
|
this.placeholder = this.configProps$.placeholder || '';
|
|
169
157
|
|
|
158
|
+
this.actionsApi = this.pConn$.getActionsApi();
|
|
159
|
+
this.propName = this.pConn$.getStateProps().value;
|
|
160
|
+
|
|
170
161
|
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
171
162
|
setTimeout(() => {
|
|
172
163
|
if (this.configProps$.required != null) {
|
|
@@ -175,6 +166,12 @@ export class DateComponent implements OnInit, OnDestroy {
|
|
|
175
166
|
this.cdRef.detectChanges();
|
|
176
167
|
});
|
|
177
168
|
|
|
169
|
+
if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
|
|
170
|
+
this.formattedValue$ = format(this.value$, 'date', {
|
|
171
|
+
format: this.theDateFormat.dateFormatString
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
178
175
|
if (this.configProps$.visibility != null) {
|
|
179
176
|
this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
|
|
180
177
|
}
|
|
@@ -194,7 +191,7 @@ export class DateComponent implements OnInit, OnDestroy {
|
|
|
194
191
|
this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
|
|
195
192
|
}
|
|
196
193
|
|
|
197
|
-
this.componentReference =
|
|
194
|
+
this.componentReference = this.pConn$.getStateProps().value;
|
|
198
195
|
|
|
199
196
|
// trigger display of error message with field control
|
|
200
197
|
if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
|
|
@@ -209,20 +206,11 @@ export class DateComponent implements OnInit, OnDestroy {
|
|
|
209
206
|
|
|
210
207
|
fieldOnDateChange(event: any) {
|
|
211
208
|
// this comes from the date pop up
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
fieldOnBlur(event: any) {
|
|
220
|
-
// PConnect wants to use eventHandler for onBlur
|
|
221
|
-
if (typeof event.value === 'object') {
|
|
222
|
-
// convert date to pega "date" format
|
|
223
|
-
event.value = event.value?.toISOString();
|
|
224
|
-
}
|
|
225
|
-
this.angularPConnectData.actions?.onBlur(this, { value: event.value });
|
|
209
|
+
const value = event?.target?.value.format('YYYY-MM-DD');
|
|
210
|
+
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
211
|
+
this.pConn$.clearErrorMessages({
|
|
212
|
+
property: this.propName
|
|
213
|
+
});
|
|
226
214
|
}
|
|
227
215
|
|
|
228
216
|
hasErrors() {
|
|
@@ -243,10 +231,4 @@ export class DateComponent implements OnInit, OnDestroy {
|
|
|
243
231
|
}
|
|
244
232
|
return errMessage;
|
|
245
233
|
}
|
|
246
|
-
|
|
247
|
-
getFormattedValue() {
|
|
248
|
-
return format(this.value$, 'date', {
|
|
249
|
-
format: this.theDateFormat.dateFormatString
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
234
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div *ngIf="displayMode$; else noDisplayMode">
|
|
2
|
-
<component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
|
|
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="!bReadonly$ && bHasForm$; else noEdit">
|
|
@@ -12,13 +12,12 @@
|
|
|
12
12
|
[attr.data-test-id]="testId"
|
|
13
13
|
[placeholder]="placeholder"
|
|
14
14
|
[formControl]="fieldControl"
|
|
15
|
-
(blur)="fieldOnBlur($event)"
|
|
16
15
|
(dateTimeChange)="fieldOnDateChange($event)"
|
|
17
|
-
[value]="value$"
|
|
18
16
|
[required]="bRequired$"
|
|
17
|
+
[readonly]="bDisabled$"
|
|
19
18
|
/>
|
|
20
19
|
<mat-datepicker-toggle matSuffix [owlDateTimeTrigger]="dtPicker"></mat-datepicker-toggle>
|
|
21
|
-
<owl-date-time #dtPicker></owl-date-time>
|
|
20
|
+
<owl-date-time #dtPicker [disabled]="bDisabled$"></owl-date-time>
|
|
22
21
|
<mat-error *ngIf="fieldControl?.invalid">{{ getErrorMessage() }}</mat-error>
|
|
23
22
|
</mat-form-field>
|
|
24
23
|
</div>
|
|
@@ -6,11 +6,15 @@ import { MatInputModule } from '@angular/material/input';
|
|
|
6
6
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
7
7
|
import { OwlDateTimeModule, OwlNativeDateTimeModule } from '@danielmoncada/angular-datetime-picker';
|
|
8
8
|
import { interval } from 'rxjs';
|
|
9
|
+
import dayjs from 'dayjs';
|
|
9
10
|
import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
|
|
10
11
|
import { Utils } from '@pega/angular-sdk-components';
|
|
11
12
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
12
13
|
import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/angular-sdk-components';
|
|
13
14
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
15
|
+
import { handleEvent } from '@pega/angular-sdk-components';
|
|
16
|
+
import { format } from '@pega/angular-sdk-components';
|
|
17
|
+
import { DateFormatters } from '@pega/angular-sdk-components';
|
|
14
18
|
|
|
15
19
|
interface DateTimeProps extends PConnFieldProps {
|
|
16
20
|
// If any, enter additional props that only exist on DateTime here
|
|
@@ -20,7 +24,6 @@ interface DateTimeProps extends PConnFieldProps {
|
|
|
20
24
|
selector: 'app-date-time',
|
|
21
25
|
templateUrl: './date-time.component.html',
|
|
22
26
|
styleUrls: ['./date-time.component.scss'],
|
|
23
|
-
standalone: true,
|
|
24
27
|
imports: [
|
|
25
28
|
CommonModule,
|
|
26
29
|
ReactiveFormsModule,
|
|
@@ -61,8 +64,12 @@ export class DateTimeComponent implements OnInit, OnDestroy {
|
|
|
61
64
|
// Start with default dateFormatInfo
|
|
62
65
|
dateFormatInfo = dateFormatInfoDefault;
|
|
63
66
|
// and then update, as needed, based on locale, etc.
|
|
64
|
-
theDateFormat
|
|
67
|
+
theDateFormat = getDateFormatInfo();
|
|
65
68
|
placeholder: string;
|
|
69
|
+
actionsApi: Object;
|
|
70
|
+
propName: string;
|
|
71
|
+
formattedValue$: any;
|
|
72
|
+
timezone = PCore.getEnvironmentInfo()?.getTimeZone();
|
|
66
73
|
|
|
67
74
|
constructor(
|
|
68
75
|
private angularPConnect: AngularPConnectService,
|
|
@@ -71,7 +78,7 @@ export class DateTimeComponent implements OnInit, OnDestroy {
|
|
|
71
78
|
) {}
|
|
72
79
|
|
|
73
80
|
ngOnInit(): void {
|
|
74
|
-
this.placeholder = `${this.theDateFormat.dateFormatStringLC}, hh:mm
|
|
81
|
+
this.placeholder = `${this.theDateFormat.dateFormatStringLC}, hh:mm A`;
|
|
75
82
|
// First thing in initialization is registering and subscribing to the AngularPConnect service
|
|
76
83
|
this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
|
|
77
84
|
this.controlName$ = this.angularPConnect.getComponentID(this);
|
|
@@ -83,7 +90,12 @@ export class DateTimeComponent implements OnInit, OnDestroy {
|
|
|
83
90
|
if (this.formGroup$) {
|
|
84
91
|
// add control to formGroup
|
|
85
92
|
this.formGroup$.addControl(this.controlName$, this.fieldControl);
|
|
86
|
-
this.
|
|
93
|
+
let dateTimeValue = this.value$ ?? '';
|
|
94
|
+
|
|
95
|
+
if (this.value$) {
|
|
96
|
+
dateTimeValue = dayjs(DateFormatters?.convertToTimezone(this.value$, { timezone: this.timezone }))?.toISOString();
|
|
97
|
+
}
|
|
98
|
+
this.fieldControl.setValue(dateTimeValue);
|
|
87
99
|
this.bHasForm$ = true;
|
|
88
100
|
} else {
|
|
89
101
|
this.bReadonly$ = true;
|
|
@@ -127,7 +139,11 @@ export class DateTimeComponent implements OnInit, OnDestroy {
|
|
|
127
139
|
this.testId = this.configProps$.testId;
|
|
128
140
|
this.helperText = this.configProps$.helperText;
|
|
129
141
|
this.value$ = this.configProps$?.value;
|
|
130
|
-
this.
|
|
142
|
+
let dateTimeValue = this.configProps$?.value ?? '';
|
|
143
|
+
if (this.value$) {
|
|
144
|
+
dateTimeValue = dayjs(DateFormatters?.convertToTimezone(this.value$, { timezone: this.timezone }))?.toISOString();
|
|
145
|
+
}
|
|
146
|
+
this.fieldControl.setValue(dateTimeValue);
|
|
131
147
|
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
132
148
|
setTimeout(() => {
|
|
133
149
|
if (this.configProps$.required != null) {
|
|
@@ -136,6 +152,12 @@ export class DateTimeComponent implements OnInit, OnDestroy {
|
|
|
136
152
|
this.cdRef.detectChanges();
|
|
137
153
|
});
|
|
138
154
|
|
|
155
|
+
if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
|
|
156
|
+
this.formattedValue$ = format(this.value$, 'datetime', {
|
|
157
|
+
format: `${this.theDateFormat.dateFormatString} hh:mm A`
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
139
161
|
if (this.configProps$.visibility != null) {
|
|
140
162
|
this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
|
|
141
163
|
}
|
|
@@ -155,7 +177,10 @@ export class DateTimeComponent implements OnInit, OnDestroy {
|
|
|
155
177
|
this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
|
|
156
178
|
}
|
|
157
179
|
|
|
158
|
-
this.componentReference =
|
|
180
|
+
this.componentReference = this.pConn$.getStateProps().value;
|
|
181
|
+
|
|
182
|
+
this.actionsApi = this.pConn$.getActionsApi();
|
|
183
|
+
this.propName = this.pConn$.getStateProps().value;
|
|
159
184
|
|
|
160
185
|
// trigger display of error message with field control
|
|
161
186
|
if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
|
|
@@ -172,18 +197,11 @@ export class DateTimeComponent implements OnInit, OnDestroy {
|
|
|
172
197
|
// this comes from the date pop up
|
|
173
198
|
if (typeof event.value === 'object') {
|
|
174
199
|
// convert date to pega "date" format
|
|
175
|
-
|
|
200
|
+
const dateTime = dayjs(event.value?.toISOString());
|
|
201
|
+
const timeZoneDateTime = (dayjs as any).tz(dateTime.format('YYYY-MM-DDTHH:mm:ss'), this.timezone);
|
|
202
|
+
event.value = timeZoneDateTime && timeZoneDateTime.isValid() ? timeZoneDateTime.toISOString() : '';
|
|
176
203
|
}
|
|
177
|
-
this.
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
fieldOnBlur(event: any) {
|
|
181
|
-
if (typeof event.value === 'object') {
|
|
182
|
-
// convert date to pega "date" format
|
|
183
|
-
event.value = event.value?.toISOString();
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
this.angularPConnectData.actions?.onBlur(this, event);
|
|
204
|
+
handleEvent(this.actionsApi, 'changeNblur', this.propName, event.value);
|
|
187
205
|
}
|
|
188
206
|
|
|
189
207
|
getErrorMessage() {
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
matInput
|
|
12
12
|
currencyMask
|
|
13
13
|
[options]="{
|
|
14
|
-
prefix:
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
prefix: currencySymbol,
|
|
15
|
+
suffix: suffix,
|
|
16
|
+
thousands: thousandSeparator,
|
|
17
|
+
decimal: decimalSeparator,
|
|
17
18
|
align: 'left',
|
|
18
19
|
nullable: true,
|
|
19
20
|
precision: decimalPrecision,
|
|
@@ -4,6 +4,7 @@ import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angul
|
|
|
4
4
|
import { MatInputModule } from '@angular/material/input';
|
|
5
5
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
6
6
|
import { NgxCurrencyDirective, NgxCurrencyInputMode } from 'ngx-currency';
|
|
7
|
+
import { interval } from 'rxjs';
|
|
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';
|
|
@@ -24,7 +25,6 @@ interface DecimalProps extends PConnFieldProps {
|
|
|
24
25
|
selector: 'app-decimal',
|
|
25
26
|
templateUrl: './decimal.component.html',
|
|
26
27
|
styleUrls: ['./decimal.component.scss'],
|
|
27
|
-
standalone: true,
|
|
28
28
|
imports: [
|
|
29
29
|
CommonModule,
|
|
30
30
|
ReactiveFormsModule,
|
|
@@ -58,13 +58,14 @@ 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;
|
|
67
67
|
inputMode: any;
|
|
68
|
+
suffix = '';
|
|
68
69
|
|
|
69
70
|
constructor(
|
|
70
71
|
private angularPConnect: AngularPConnectService,
|
|
@@ -136,23 +137,24 @@ export class DecimalComponent implements OnInit, OnDestroy {
|
|
|
136
137
|
nValue = parseFloat(nValue);
|
|
137
138
|
}
|
|
138
139
|
this.value$ = nValue;
|
|
140
|
+
this.fieldControl.setValue(this.value$);
|
|
139
141
|
}
|
|
140
142
|
this.helperText = this.configProps$.helperText;
|
|
141
143
|
this.placeholder = this.configProps$.placeholder || '';
|
|
142
144
|
const showGroupSeparators = this.configProps$.showGroupSeparators;
|
|
143
|
-
const currencyISOCode
|
|
145
|
+
const currencyISOCode = this.configProps$?.currencyISOCode ?? '';
|
|
144
146
|
|
|
145
147
|
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
146
|
-
this.
|
|
147
|
-
this.
|
|
148
|
+
this.decimalSeparator = theSymbols.theDecimalIndicator;
|
|
149
|
+
this.thousandSeparator = showGroupSeparators ? theSymbols.theDigitGroupSeparator : '';
|
|
148
150
|
|
|
149
151
|
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
150
152
|
this.formatter = this.configProps$.formatter;
|
|
151
153
|
|
|
152
|
-
if (this.formatter
|
|
154
|
+
if (this.formatter) {
|
|
153
155
|
this.formattedValue = format(this.value$, this.formatter.toLowerCase(), theCurrencyOptions);
|
|
154
156
|
} else {
|
|
155
|
-
this.formattedValue = format(this.value$,
|
|
157
|
+
this.formattedValue = format(this.value$, 'decimal', theCurrencyOptions);
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
@@ -183,26 +185,49 @@ export class DecimalComponent implements OnInit, OnDestroy {
|
|
|
183
185
|
}
|
|
184
186
|
|
|
185
187
|
if (this.bReadonly$ && this.formatter === 'Currency') {
|
|
186
|
-
this.
|
|
187
|
-
}
|
|
188
|
-
|
|
188
|
+
this.currencySymbol = theSymbols.theCurrencySymbol;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (this.bReadonly$ && this.formatter === 'Percentage') {
|
|
192
|
+
this.suffix = '%';
|
|
189
193
|
}
|
|
194
|
+
|
|
190
195
|
this.decimalPrecision = this.configProps$?.decimalPrecision ?? 2;
|
|
191
196
|
|
|
192
|
-
this.componentReference =
|
|
197
|
+
this.componentReference = this.pConn$.getStateProps().value;
|
|
198
|
+
|
|
199
|
+
// trigger display of error message with field control
|
|
200
|
+
if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
|
|
201
|
+
const timer = interval(100).subscribe(() => {
|
|
202
|
+
this.fieldControl.setErrors({ message: true });
|
|
203
|
+
this.fieldControl.markAsTouched();
|
|
204
|
+
|
|
205
|
+
timer.unsubscribe();
|
|
206
|
+
});
|
|
207
|
+
}
|
|
193
208
|
}
|
|
194
209
|
|
|
195
210
|
fieldOnBlur(event: any) {
|
|
196
|
-
const
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
value = value
|
|
203
|
-
|
|
211
|
+
const oldVal = this.value$ ?? '';
|
|
212
|
+
const isValueChanged = event.target.value.toString() !== oldVal.toString();
|
|
213
|
+
|
|
214
|
+
if (isValueChanged) {
|
|
215
|
+
const actionsApi = this.pConn$?.getActionsApi();
|
|
216
|
+
const propName = this.pConn$?.getStateProps().value;
|
|
217
|
+
let value = event?.target?.value;
|
|
218
|
+
// replacing thousand separator with empty string as not required in api call
|
|
219
|
+
if (this.configProps$.showGroupSeparators) {
|
|
220
|
+
const thousandSep = this.thousandSeparator === '.' ? '\\.' : this.thousandSeparator;
|
|
221
|
+
const regExp = new RegExp(String.raw`${thousandSep}`, 'g');
|
|
222
|
+
value = value?.replace(regExp, '');
|
|
223
|
+
}
|
|
224
|
+
// replacing decimal separator with '.'
|
|
225
|
+
if (this.decimalSeparator !== '.') {
|
|
226
|
+
const regExp = new RegExp(String.raw`${this.decimalSeparator}`, 'g');
|
|
227
|
+
value = value.replace(regExp, '.');
|
|
228
|
+
}
|
|
229
|
+
handleEvent(actionsApi, 'changeNblur', propName, value);
|
|
204
230
|
}
|
|
205
|
-
handleEvent(actionsApi, 'changeNblur', propName, value);
|
|
206
231
|
}
|
|
207
232
|
|
|
208
233
|
getErrorMessage() {
|