@pega/angular-sdk-overrides 24.2.12 → 25.1.11
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.scss +3 -3
- package/lib/designSystemExtension/alert/alert.component.ts +0 -1
- package/lib/designSystemExtension/alert-banner/alert-banner.component.ts +0 -1
- package/lib/designSystemExtension/banner/banner.component.html +1 -1
- package/lib/designSystemExtension/banner/banner.component.scss +17 -3
- package/lib/designSystemExtension/banner/banner.component.ts +0 -1
- package/lib/designSystemExtension/case-create-stage/case-create-stage.component.ts +0 -1
- package/lib/designSystemExtension/field-group/field-group.component.ts +0 -1
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +6 -3
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +5 -34
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +0 -1
- package/lib/designSystemExtension/material-details/material-details.component.scss +0 -5
- 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.scss +4 -3
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +0 -1
- package/lib/designSystemExtension/material-summary-item/material-summary-item.component.scss +4 -17
- 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-utility/material-utility.component.scss +1 -2
- package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.scss +1 -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 +3 -10
- package/lib/designSystemExtension/operator/operator.component.ts +0 -2
- package/lib/designSystemExtension/pulse/pulse.component.scss +2 -2
- package/lib/designSystemExtension/pulse/pulse.component.ts +0 -1
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.html +4 -17
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.scss +0 -1
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.ts +30 -1
- package/lib/designSystemExtension/wss-quick-create/wss-quick-create.component.scss +16 -9
- 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 +35 -173
- package/lib/field/cancel-alert/cancel-alert.component.html +8 -12
- package/lib/field/cancel-alert/cancel-alert.component.scss +2 -3
- package/lib/field/cancel-alert/cancel-alert.component.ts +24 -37
- package/lib/field/check-box/check-box.component.html +19 -10
- package/lib/field/check-box/check-box.component.scss +6 -1
- package/lib/field/check-box/check-box.component.ts +25 -151
- package/lib/field/currency/currency.component.ts +36 -169
- package/lib/field/date/date.component.html +2 -2
- package/lib/field/date/date.component.ts +30 -151
- package/lib/field/date-time/date-time.component.html +1 -1
- package/lib/field/date-time/date-time.component.ts +34 -149
- package/lib/field/decimal/decimal.component.ts +38 -164
- package/lib/field/dropdown/dropdown.component.ts +29 -152
- package/lib/field/email/email.component.ts +16 -156
- package/lib/field/field.base.ts +149 -0
- package/lib/field/group/group.component.ts +7 -5
- package/lib/field/integer/integer.component.ts +18 -158
- package/lib/field/list-view-action-buttons/list-view-action-buttons.component.ts +0 -1
- package/lib/field/location/config-ext.json +8 -0
- package/lib/field/location/location.component.html +46 -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 +280 -0
- package/lib/field/multiselect/multiselect.component.ts +47 -152
- package/lib/field/multiselect/utils.ts +55 -47
- package/lib/field/object-reference/object-reference.component.html +17 -0
- package/lib/field/object-reference/object-reference.component.scss +0 -0
- package/lib/field/object-reference/object-reference.component.spec.ts +22 -0
- package/lib/field/object-reference/object-reference.component.ts +237 -0
- package/lib/field/percentage/percentage.component.ts +37 -155
- package/lib/field/phone/phone.component.html +18 -19
- package/lib/field/phone/phone.component.scss +4 -0
- package/lib/field/phone/phone.component.ts +43 -145
- package/lib/field/radio-buttons/radio-buttons.component.html +14 -6
- package/lib/field/radio-buttons/radio-buttons.component.scss +4 -2
- package/lib/field/radio-buttons/radio-buttons.component.ts +37 -160
- package/lib/field/rich-text/rich-text.component.html +2 -0
- package/lib/field/rich-text/rich-text.component.scss +172 -0
- package/lib/field/rich-text/rich-text.component.ts +21 -91
- package/lib/field/scalar-list/scalar-list.component.ts +17 -73
- package/lib/field/selectable-card/selectable-card.component.html +70 -0
- package/lib/field/selectable-card/selectable-card.component.scss +11 -0
- package/lib/field/selectable-card/selectable-card.component.spec.ts +22 -0
- package/lib/field/selectable-card/selectable-card.component.ts +219 -0
- package/lib/field/semantic-link/semantic-link.component.html +4 -8
- package/lib/field/semantic-link/semantic-link.component.scss +0 -13
- package/lib/field/semantic-link/semantic-link.component.ts +165 -6
- package/lib/field/text/text.component.scss +0 -1
- package/lib/field/text/text.component.ts +0 -1
- package/lib/field/text-area/text-area.component.ts +18 -153
- package/lib/field/text-content/text-content.component.ts +0 -1
- package/lib/field/text-input/text-input.component.ts +16 -156
- package/lib/field/time/time.component.ts +17 -152
- package/lib/field/url/url.component.ts +16 -155
- package/lib/field/user-reference/user-reference.component.scss +0 -1
- package/lib/field/user-reference/user-reference.component.ts +2 -4
- package/lib/infra/Containers/flow-container/flow-container.component.html +2 -2
- package/lib/infra/Containers/flow-container/flow-container.component.ts +8 -9
- 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.ts +5 -11
- package/lib/infra/Containers/view-container/helper.ts +35 -2
- package/lib/infra/Containers/view-container/view-container.component.ts +1 -2
- package/lib/infra/action-buttons/action-buttons.component.html +13 -8
- package/lib/infra/action-buttons/action-buttons.component.scss +23 -0
- package/lib/infra/action-buttons/action-buttons.component.ts +1 -3
- package/lib/infra/assignment/assignment.component.ts +21 -10
- package/lib/infra/assignment-card/assignment-card.component.html +1 -2
- package/lib/infra/assignment-card/assignment-card.component.scss +0 -4
- package/lib/infra/assignment-card/assignment-card.component.ts +21 -5
- package/lib/infra/dashboard-filter/dashboard-filter.component.ts +0 -1
- package/lib/infra/defer-load/defer-load.component.html +6 -2
- package/lib/infra/defer-load/defer-load.component.ts +22 -12
- package/lib/infra/error-boundary/error-boundary.component.ts +0 -1
- package/lib/infra/multi-step/multi-step.component.html +22 -38
- package/lib/infra/multi-step/multi-step.component.scss +14 -27
- package/lib/infra/multi-step/multi-step.component.ts +0 -1
- package/lib/infra/navbar/navbar.component.html +36 -41
- package/lib/infra/navbar/navbar.component.scss +22 -4
- package/lib/infra/navbar/navbar.component.ts +8 -4
- package/lib/infra/reference/reference.component.ts +5 -0
- package/lib/infra/region/region.component.ts +0 -1
- package/lib/infra/root-container/root-container.component.scss +0 -1
- package/lib/infra/root-container/root-container.component.ts +1 -5
- package/lib/infra/stages/stages.component.html +4 -3
- package/lib/infra/stages/stages.component.scss +12 -36
- package/lib/infra/stages/stages.component.ts +4 -3
- package/lib/infra/view/view.component.html +1 -1
- package/lib/infra/view/view.component.ts +3 -7
- package/lib/template/advanced-search/advanced-search.component.html +12 -0
- package/lib/template/advanced-search/advanced-search.component.scss +0 -0
- package/lib/template/advanced-search/advanced-search.component.spec.ts +0 -0
- package/lib/template/advanced-search/advanced-search.component.ts +112 -0
- package/lib/template/advanced-search/advanced-search.service.ts +27 -0
- package/lib/template/advanced-search/search-group/persist-utils.ts +56 -0
- package/lib/template/advanced-search/search-groups/search-groups.component.html +32 -0
- package/lib/template/advanced-search/search-groups/search-groups.component.scss +0 -0
- package/lib/template/advanced-search/search-groups/search-groups.component.spec.ts +0 -0
- package/lib/template/advanced-search/search-groups/search-groups.component.ts +294 -0
- package/lib/template/advanced-search/search-groups/utils.ts +29 -0
- package/lib/template/app-shell/app-shell.component.html +4 -1
- package/lib/template/app-shell/app-shell.component.scss +0 -3
- package/lib/template/app-shell/app-shell.component.ts +46 -8
- package/lib/template/banner-page/banner-page.component.ts +0 -1
- package/lib/template/case-summary/case-summary.component.scss +0 -2
- package/lib/template/case-summary/case-summary.component.ts +6 -22
- package/lib/template/case-view/case-view.component.html +4 -4
- package/lib/template/case-view/case-view.component.scss +18 -10
- package/lib/template/case-view/case-view.component.ts +1 -11
- package/lib/template/confirmation/confirmation.component.html +1 -1
- package/lib/template/confirmation/confirmation.component.ts +0 -1
- package/lib/template/data-reference/data-reference.component.html +11 -8
- package/lib/template/data-reference/data-reference.component.ts +346 -113
- package/lib/template/data-reference/search-form/search-form.component.html +39 -0
- package/lib/template/data-reference/search-form/search-form.component.scss +11 -0
- package/lib/template/data-reference/search-form/search-form.component.spec.ts +0 -0
- package/lib/template/data-reference/search-form/search-form.component.ts +167 -0
- package/lib/template/data-reference/search-form/tabsData.ts +160 -0
- package/lib/template/data-reference/utils.ts +92 -0
- package/lib/template/default-form/default-form.component.ts +10 -3
- package/lib/template/default-page/default-page.component.html +34 -0
- package/lib/template/default-page/default-page.component.scss +31 -0
- package/lib/template/default-page/default-page.component.spec.ts +24 -0
- package/lib/template/default-page/default-page.component.ts +64 -0
- package/lib/template/details/details.component.ts +0 -1
- package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +0 -1
- package/lib/template/details-one-column/details-one-column.component.ts +0 -1
- package/lib/template/details-sub-tabs/details-sub-tabs.component.ts +0 -1
- package/lib/template/details-three-column/details-three-column.component.ts +0 -1
- package/lib/template/details-two-column/details-two-column.component.ts +0 -1
- package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +0 -1
- package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +0 -1
- package/lib/template/field-group-list/field-group-list.component.scss +0 -1
- package/lib/template/field-group-list/field-group-list.component.ts +0 -1
- package/lib/template/field-group-template/field-group-template.component.ts +14 -28
- 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 +1 -2
- package/lib/template/list-page/list-page.component.ts +0 -1
- package/lib/template/list-view/list-view.component.html +170 -162
- package/lib/template/list-view/list-view.component.scss +25 -21
- package/lib/template/list-view/list-view.component.ts +207 -119
- package/lib/template/list-view/listViewHelpers.ts +1 -4
- package/lib/template/list-view/utils.ts +25 -2
- package/lib/template/multi-reference-readonly/multi-reference-readonly.component.ts +0 -1
- package/lib/template/narrow-wide-form/narrow-wide-form.component.ts +0 -1
- package/lib/template/object-page/object-page.component.html +1 -0
- package/lib/template/object-page/object-page.component.scss +0 -0
- package/lib/template/object-page/object-page.component.spec.ts +22 -0
- package/lib/template/object-page/object-page.component.ts +14 -0
- package/lib/template/one-column/one-column.component.ts +0 -1
- package/lib/template/one-column-page/one-column-page.component.ts +0 -1
- package/lib/template/one-column-tab/one-column-tab.component.scss +1 -1
- package/lib/template/one-column-tab/one-column-tab.component.ts +0 -1
- package/lib/template/page/page.component.ts +0 -1
- package/lib/template/promoted-filters/promoted-filters.component.ts +0 -1
- package/lib/template/repeating-structures/repeating-structures.component.ts +0 -2
- package/lib/template/self-service-case-view/self-service-case-view.component.html +78 -0
- package/lib/template/self-service-case-view/self-service-case-view.component.scss +132 -0
- package/lib/template/self-service-case-view/self-service-case-view.component.spec.ts +24 -0
- package/lib/template/self-service-case-view/self-service-case-view.component.ts +207 -0
- package/lib/template/simple-table/simple-table.component.ts +0 -2
- package/lib/template/simple-table-manual/helpers.ts +117 -3
- package/lib/template/simple-table-manual/simple-table-manual.component.html +4 -4
- package/lib/template/simple-table-manual/simple-table-manual.component.scss +4 -14
- package/lib/template/simple-table-manual/simple-table-manual.component.ts +45 -25
- package/lib/template/simple-table-select/simple-table-select.component.ts +0 -1
- package/lib/template/single-reference-readonly/single-reference-readonly.component.html +4 -1
- package/lib/template/single-reference-readonly/single-reference-readonly.component.scss +21 -0
- package/lib/template/single-reference-readonly/single-reference-readonly.component.ts +104 -4
- package/lib/template/sub-tabs/sub-tabs.component.ts +0 -1
- package/lib/template/three-column/three-column.component.ts +0 -1
- package/lib/template/three-column-page/three-column-page.component.ts +0 -1
- package/lib/template/two-column/two-column.component.ts +0 -1
- package/lib/template/two-column-page/two-column-page.component.ts +0 -1
- package/lib/template/two-column-tab/two-column-tab.component.ts +0 -1
- package/lib/template/utils.ts +42 -0
- package/lib/template/wide-narrow-form/wide-narrow-form.component.ts +0 -1
- package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +0 -1
- package/lib/template/wss-nav-bar/wss-nav-bar.component.html +6 -5
- package/lib/template/wss-nav-bar/wss-nav-bar.component.scss +8 -17
- package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +1 -9
- package/lib/widget/app-announcement/app-announcement.component.html +1 -2
- package/lib/widget/app-announcement/app-announcement.component.scss +2 -2
- package/lib/widget/app-announcement/app-announcement.component.ts +0 -1
- package/lib/widget/attachment/Attachment.types.ts +92 -0
- package/lib/widget/attachment/AttachmentUtils.ts +287 -0
- package/lib/widget/attachment/attachment.component.html +3 -3
- package/lib/widget/attachment/attachment.component.scss +9 -12
- package/lib/widget/attachment/attachment.component.ts +267 -254
- package/lib/widget/case-history/case-history.component.ts +0 -1
- package/lib/widget/feed-container/feed-container.component.scss +3 -9
- package/lib/widget/feed-container/feed-container.component.ts +2 -3
- package/lib/widget/file-utility/file-utility.component.html +3 -3
- package/lib/widget/file-utility/file-utility.component.scss +6 -17
- package/lib/widget/file-utility/file-utility.component.ts +24 -9
- package/lib/widget/list-utility/list-utility.component.scss +4 -5
- package/lib/widget/list-utility/list-utility.component.ts +0 -1
- package/lib/widget/quick-create/quick-create.component.ts +41 -23
- package/lib/widget/todo/todo.component.html +8 -5
- package/lib/widget/todo/todo.component.scss +11 -10
- package/lib/widget/todo/todo.component.ts +7 -4
- package/lib/widget/utility/utility.component.ts +0 -1
- package/package.json +1 -1
|
@@ -2,25 +2,24 @@
|
|
|
2
2
|
<component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
|
|
3
3
|
</div>
|
|
4
4
|
<ng-template #noDisplayMode>
|
|
5
|
-
<div *ngIf="bHasForm$; else noEdit">
|
|
6
|
-
<
|
|
7
|
-
<mat-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
</div>
|
|
5
|
+
<div *ngIf="bHasForm$ && bVisible$; else noEdit">
|
|
6
|
+
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText" floatLabel="always">
|
|
7
|
+
<mat-tel-input
|
|
8
|
+
[attr.data-test-id]="testId"
|
|
9
|
+
[formControl]="fieldControl"
|
|
10
|
+
[preferredCountries]="preferredCountries"
|
|
11
|
+
[enablePlaceholder]="true"
|
|
12
|
+
[enableSearch]="true"
|
|
13
|
+
[placeholder]="placeholder"
|
|
14
|
+
[required]="bRequired$"
|
|
15
|
+
[disabled]="bDisabled$ || bReadonly$"
|
|
16
|
+
(change)="fieldOnChange()"
|
|
17
|
+
(blur)="fieldOnBlur()"
|
|
18
|
+
>
|
|
19
|
+
</mat-tel-input>
|
|
20
|
+
<mat-label>{{ label$ }}</mat-label>
|
|
21
|
+
<mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
|
|
22
|
+
</mat-form-field>
|
|
24
23
|
</div>
|
|
25
24
|
</ng-template>
|
|
26
25
|
<ng-template #noEdit>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, forwardRef } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import {
|
|
3
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
4
4
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import { handleEvent } from '@pega/angular-sdk-components';
|
|
5
|
+
import { MatTelInput } from 'mat-tel-input';
|
|
6
|
+
import { parsePhoneNumberFromString } from 'libphonenumber-js';
|
|
7
|
+
|
|
8
|
+
import { FieldBase } from '@pega/angular-sdk-components';
|
|
10
9
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
10
|
+
import { handleEvent } from '@pega/angular-sdk-components';
|
|
11
11
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
12
12
|
|
|
13
13
|
interface PhoneProps extends PConnFieldProps {
|
|
@@ -18,140 +18,29 @@ interface PhoneProps extends PConnFieldProps {
|
|
|
18
18
|
selector: 'app-phone',
|
|
19
19
|
templateUrl: './phone.component.html',
|
|
20
20
|
styleUrls: ['./phone.component.scss'],
|
|
21
|
-
|
|
22
|
-
imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, NgxMatIntlTelInputComponent, forwardRef(() => ComponentMapperComponent)]
|
|
21
|
+
imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatTelInput, forwardRef(() => ComponentMapperComponent)]
|
|
23
22
|
})
|
|
24
|
-
export class PhoneComponent
|
|
25
|
-
@Input() pConn$: typeof PConnect;
|
|
26
|
-
@Input() formGroup$: FormGroup;
|
|
27
|
-
|
|
28
|
-
// Used with AngularPConnect
|
|
29
|
-
angularPConnectData: AngularPConnectData = {};
|
|
23
|
+
export class PhoneComponent extends FieldBase {
|
|
30
24
|
configProps$: PhoneProps;
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
value$: string;
|
|
34
|
-
bRequired$ = false;
|
|
35
|
-
bReadonly$ = false;
|
|
36
|
-
bDisabled$ = false;
|
|
37
|
-
bVisible$ = true;
|
|
38
|
-
displayMode$?: string = '';
|
|
39
|
-
controlName$: string;
|
|
40
|
-
bHasForm$ = true;
|
|
41
|
-
testId: string;
|
|
42
|
-
helperText: string;
|
|
43
|
-
|
|
44
|
-
fieldControl = new FormControl('', null);
|
|
45
|
-
|
|
46
|
-
actionsApi: Object;
|
|
47
|
-
propName: string;
|
|
48
|
-
|
|
49
|
-
constructor(
|
|
50
|
-
private angularPConnect: AngularPConnectService,
|
|
51
|
-
private cdRef: ChangeDetectorRef,
|
|
52
|
-
private utils: Utils
|
|
53
|
-
) {}
|
|
54
|
-
|
|
55
|
-
ngOnInit(): void {
|
|
56
|
-
// First thing in initialization is registering and subscribing to the AngularPConnect service
|
|
57
|
-
this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
|
|
58
|
-
this.controlName$ = this.angularPConnect.getComponentID(this);
|
|
59
|
-
|
|
60
|
-
// Then, continue on with other initialization
|
|
61
|
-
|
|
62
|
-
// call updateSelf when initializing
|
|
63
|
-
// this.updateSelf();
|
|
64
|
-
this.checkAndUpdate();
|
|
65
|
-
|
|
66
|
-
if (this.formGroup$) {
|
|
67
|
-
// add control to formGroup
|
|
68
|
-
this.formGroup$.addControl(this.controlName$, this.fieldControl);
|
|
69
|
-
this.fieldControl.setValue(this.value$);
|
|
70
|
-
this.bHasForm$ = true;
|
|
71
|
-
} else {
|
|
72
|
-
this.bReadonly$ = true;
|
|
73
|
-
this.bHasForm$ = false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
ngOnDestroy(): void {
|
|
78
|
-
if (this.formGroup$) {
|
|
79
|
-
this.formGroup$.removeControl(this.controlName$);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (this.angularPConnectData.unsubscribeFn) {
|
|
83
|
-
this.angularPConnectData.unsubscribeFn();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Callback passed when subscribing to store change
|
|
88
|
-
onStateChange() {
|
|
89
|
-
this.checkAndUpdate();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
checkAndUpdate() {
|
|
93
|
-
// Should always check the bridge to see if the component should
|
|
94
|
-
// update itself (re-render)
|
|
95
|
-
const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
|
|
26
|
+
preferredCountries: string[] = ['us'];
|
|
96
27
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
// updateSelf
|
|
104
|
-
updateSelf(): void {
|
|
105
|
-
// moved this from ngOnInit() and call this from there instead...
|
|
28
|
+
/**
|
|
29
|
+
* Updates the component when there are changes in the state.
|
|
30
|
+
*/
|
|
31
|
+
override updateSelf(): void {
|
|
32
|
+
// Resolve config properties
|
|
106
33
|
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as PhoneProps;
|
|
107
34
|
|
|
108
|
-
|
|
109
|
-
this.
|
|
110
|
-
this.testId = this.configProps$.testId;
|
|
111
|
-
if (this.configProps$.value != undefined) {
|
|
112
|
-
this.value$ = this.configProps$.value;
|
|
113
|
-
this.fieldControl.setValue(this.value$);
|
|
114
|
-
}
|
|
115
|
-
this.helperText = this.configProps$.helperText;
|
|
116
|
-
|
|
117
|
-
this.actionsApi = this.pConn$.getActionsApi();
|
|
118
|
-
this.propName = this.pConn$.getStateProps().value;
|
|
119
|
-
|
|
120
|
-
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
121
|
-
setTimeout(() => {
|
|
122
|
-
if (this.configProps$.required != null) {
|
|
123
|
-
this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
|
|
124
|
-
}
|
|
125
|
-
this.cdRef.detectChanges();
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
if (this.configProps$.visibility != null) {
|
|
129
|
-
this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// disabled
|
|
133
|
-
if (this.configProps$.disabled != undefined) {
|
|
134
|
-
this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (this.bDisabled$) {
|
|
138
|
-
this.fieldControl.disable();
|
|
139
|
-
} else {
|
|
140
|
-
this.fieldControl.enable();
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (this.configProps$.readOnly != null) {
|
|
144
|
-
this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// trigger display of error message with field control
|
|
148
|
-
if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
|
|
149
|
-
const timer = interval(100).subscribe(() => {
|
|
150
|
-
this.fieldControl.setErrors({ message: true });
|
|
151
|
-
this.fieldControl.markAsTouched();
|
|
35
|
+
// Update component common properties
|
|
36
|
+
this.updateComponentCommonProperties(this.configProps$);
|
|
152
37
|
|
|
153
|
-
|
|
154
|
-
|
|
38
|
+
// Extract and normalize the value property
|
|
39
|
+
const { value } = this.configProps$;
|
|
40
|
+
if (value) {
|
|
41
|
+
this.value$ = value;
|
|
42
|
+
this.fieldControl.setValue(this.value$);
|
|
43
|
+
this.updatePreferredCountries();
|
|
155
44
|
}
|
|
156
45
|
}
|
|
157
46
|
|
|
@@ -164,26 +53,35 @@ export class PhoneComponent implements OnInit, OnDestroy {
|
|
|
164
53
|
const newVal = this.formGroup$.controls[this.controlName$].value;
|
|
165
54
|
const isValueChanged = newVal?.toString() !== oldVal.toString();
|
|
166
55
|
|
|
167
|
-
if (isValueChanged
|
|
168
|
-
|
|
169
|
-
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
56
|
+
if (isValueChanged) {
|
|
57
|
+
handleEvent(this.actionsApi, 'changeNblur', this.propName, newVal);
|
|
170
58
|
}
|
|
171
59
|
}
|
|
172
60
|
|
|
173
|
-
|
|
174
|
-
|
|
61
|
+
updatePreferredCountries() {
|
|
62
|
+
if (this.value$ && typeof this.value$ === 'string') {
|
|
63
|
+
const phoneNumber = parsePhoneNumberFromString(this.value$);
|
|
64
|
+
this.preferredCountries =
|
|
65
|
+
phoneNumber?.country && !this.preferredCountries.includes(phoneNumber?.country.toLowerCase())
|
|
66
|
+
? [phoneNumber?.country?.toLowerCase(), ...this.preferredCountries]
|
|
67
|
+
: this.preferredCountries;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
175
70
|
|
|
71
|
+
override getErrorMessage() {
|
|
176
72
|
// look for validation messages for json, pre-defined or just an error pushed from workitem (400)
|
|
177
73
|
if (this.fieldControl.hasError('message')) {
|
|
178
|
-
|
|
179
|
-
return errMessage;
|
|
74
|
+
return this.angularPConnectData.validateMessage ?? '';
|
|
180
75
|
}
|
|
76
|
+
|
|
181
77
|
if (this.fieldControl.hasError('required')) {
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
78
|
+
return 'You must enter a value';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (this.fieldControl.errors) {
|
|
82
|
+
return 'Invalid Phone';
|
|
185
83
|
}
|
|
186
84
|
|
|
187
|
-
return
|
|
85
|
+
return '';
|
|
188
86
|
}
|
|
189
87
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
<div *ngIf="
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<div *ngIf="variant !== 'card'; else cardMode">
|
|
2
|
+
<div *ngIf="displayMode$; else noDisplayMode">
|
|
3
|
+
<component-mapper
|
|
4
|
+
*ngIf="bVisible$ !== false"
|
|
5
|
+
name="FieldValueList"
|
|
6
|
+
[props]="{ label$, value$: this.localizedValue, displayMode$ }"
|
|
7
|
+
></component-mapper>
|
|
8
|
+
</div>
|
|
7
9
|
</div>
|
|
8
10
|
<ng-template #noDisplayMode>
|
|
9
11
|
<div [formGroup]="formGroup$" *ngIf="bVisible$">
|
|
@@ -32,3 +34,9 @@
|
|
|
32
34
|
</mat-form-field>
|
|
33
35
|
</div>
|
|
34
36
|
</ng-template>
|
|
37
|
+
<ng-template #cardMode>
|
|
38
|
+
<h4>{{ label$ }}</h4>
|
|
39
|
+
<div>
|
|
40
|
+
<component-mapper name="SelectableCard" [props]="{ pConn$: pConn$, type: 'radio' }" [parent]="this"></component-mapper>
|
|
41
|
+
</div>
|
|
42
|
+
</ng-template>
|
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
.psdk-radio-horizontal {
|
|
16
16
|
display: flex;
|
|
17
17
|
flex-direction: row;
|
|
18
|
+
margin-top: 1rem;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
.psdk-radio-vertical {
|
|
21
22
|
display: flex;
|
|
22
23
|
flex-direction: column;
|
|
24
|
+
margin-top: 1rem;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
.psdk-radio-button {
|
|
@@ -30,8 +32,8 @@
|
|
|
30
32
|
width: 100%;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
.psdk-radio-form ::ng-deep .
|
|
34
|
-
|
|
35
|
+
.psdk-radio-form ::ng-deep .mdc-line-ripple {
|
|
36
|
+
display: none;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
.psdk-radio-form ::ng-deep .mat-form-field-label {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, forwardRef } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import {
|
|
3
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
4
4
|
import { MatRadioModule } from '@angular/material/radio';
|
|
5
5
|
import { MatInputModule } from '@angular/material/input';
|
|
6
6
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import { Utils } from '@pega/angular-sdk-components';
|
|
7
|
+
|
|
8
|
+
import { FieldBase } from '@pega/angular-sdk-components';
|
|
10
9
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
11
|
-
import {
|
|
10
|
+
import { Utils } from '@pega/angular-sdk-components';
|
|
12
11
|
import { handleEvent } from '@pega/angular-sdk-components';
|
|
12
|
+
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
13
13
|
|
|
14
14
|
interface IOption {
|
|
15
15
|
key: string;
|
|
@@ -20,6 +20,7 @@ interface RadioButtonsProps extends PConnFieldProps {
|
|
|
20
20
|
// If any, enter additional props that only exist on RadioButtons here
|
|
21
21
|
inline: boolean;
|
|
22
22
|
fieldMetadata?: any;
|
|
23
|
+
variant?: string;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
@Component({
|
|
@@ -27,159 +28,60 @@ interface RadioButtonsProps extends PConnFieldProps {
|
|
|
27
28
|
templateUrl: './radio-buttons.component.html',
|
|
28
29
|
styleUrls: ['./radio-buttons.component.scss'],
|
|
29
30
|
providers: [Utils],
|
|
30
|
-
standalone: true,
|
|
31
31
|
imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, MatRadioModule, forwardRef(() => ComponentMapperComponent)]
|
|
32
32
|
})
|
|
33
|
-
export class RadioButtonsComponent
|
|
34
|
-
@Input() pConn$: typeof PConnect;
|
|
35
|
-
@Input() formGroup$: FormGroup;
|
|
36
|
-
|
|
37
|
-
// Used with AngularPConnect
|
|
38
|
-
angularPConnectData: AngularPConnectData = {};
|
|
33
|
+
export class RadioButtonsComponent extends FieldBase {
|
|
39
34
|
configProps$: RadioButtonsProps;
|
|
40
35
|
|
|
41
|
-
label$ = '';
|
|
42
|
-
value$ = '';
|
|
43
|
-
bRequired$ = false;
|
|
44
|
-
bReadonly$ = false;
|
|
45
|
-
bDisabled$ = false;
|
|
46
|
-
bVisible$ = true;
|
|
47
36
|
bInline$ = false;
|
|
48
|
-
|
|
49
|
-
controlName$: string;
|
|
50
|
-
bHasForm$ = true;
|
|
37
|
+
|
|
51
38
|
options$: IOption[];
|
|
52
39
|
componentReference = '';
|
|
53
|
-
testId: string;
|
|
54
|
-
helperText: string;
|
|
55
|
-
placeholder: string;
|
|
56
|
-
|
|
57
|
-
fieldControl = new FormControl('', null);
|
|
58
40
|
fieldMetadata: any[];
|
|
59
41
|
localeContext = '';
|
|
60
42
|
localeClass = '';
|
|
61
43
|
localeName = '';
|
|
62
44
|
localePath = '';
|
|
63
45
|
localizedValue = '';
|
|
64
|
-
|
|
65
|
-
propName: string;
|
|
66
|
-
|
|
67
|
-
constructor(
|
|
68
|
-
private angularPConnect: AngularPConnectService,
|
|
69
|
-
private cdRef: ChangeDetectorRef,
|
|
70
|
-
private utils: Utils
|
|
71
|
-
) {}
|
|
72
|
-
|
|
73
|
-
ngOnInit(): void {
|
|
74
|
-
// First thing in initialization is registering and subscribing to the AngularPConnect service
|
|
75
|
-
this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
|
|
76
|
-
this.controlName$ = this.angularPConnect.getComponentID(this);
|
|
77
|
-
|
|
78
|
-
// Then, continue on with other initialization
|
|
79
|
-
|
|
80
|
-
// call updateSelf when initializing
|
|
81
|
-
// this.updateSelf();
|
|
82
|
-
this.checkAndUpdate();
|
|
83
|
-
|
|
84
|
-
if (this.formGroup$) {
|
|
85
|
-
// add control to formGroup
|
|
86
|
-
this.formGroup$.addControl(this.controlName$, this.fieldControl);
|
|
87
|
-
this.fieldControl.setValue(this.value$);
|
|
88
|
-
this.bHasForm$ = true;
|
|
89
|
-
} else {
|
|
90
|
-
this.bReadonly$ = true;
|
|
91
|
-
this.bHasForm$ = false;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
ngOnDestroy(): void {
|
|
96
|
-
if (this.formGroup$) {
|
|
97
|
-
this.formGroup$.removeControl(this.controlName$);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (this.angularPConnectData.unsubscribeFn) {
|
|
101
|
-
this.angularPConnectData.unsubscribeFn();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Callback passed when subscribing to store change
|
|
106
|
-
onStateChange() {
|
|
107
|
-
this.checkAndUpdate();
|
|
108
|
-
}
|
|
46
|
+
variant?: string;
|
|
109
47
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
// ONLY call updateSelf when the component should update
|
|
116
|
-
if (bUpdateSelf) {
|
|
117
|
-
this.updateSelf();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// updateSelf
|
|
122
|
-
updateSelf(): void {
|
|
123
|
-
// moved this from ngOnInit() and call this from there instead...
|
|
48
|
+
/**
|
|
49
|
+
* Updates the component when there are changes in the state.
|
|
50
|
+
*/
|
|
51
|
+
override updateSelf(): void {
|
|
52
|
+
// Resolve config properties
|
|
124
53
|
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as RadioButtonsProps;
|
|
125
54
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
this.testId = this.configProps$.testId;
|
|
131
|
-
this.label$ = this.configProps$.label;
|
|
132
|
-
this.displayMode$ = this.configProps$.displayMode;
|
|
133
|
-
this.helperText = this.configProps$.helperText;
|
|
134
|
-
this.placeholder = this.configProps$.placeholder || '';
|
|
135
|
-
|
|
136
|
-
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
137
|
-
setTimeout(() => {
|
|
138
|
-
if (this.configProps$.required != null) {
|
|
139
|
-
this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
|
|
140
|
-
}
|
|
141
|
-
this.cdRef.detectChanges();
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
if (this.configProps$.visibility != null) {
|
|
145
|
-
this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (this.configProps$.inline != null) {
|
|
149
|
-
this.bInline$ = this.utils.getBooleanValue(this.configProps$.inline);
|
|
150
|
-
}
|
|
55
|
+
// Update component common properties
|
|
56
|
+
this.updateComponentCommonProperties(this.configProps$);
|
|
151
57
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
58
|
+
// Extract and normalize the value property
|
|
59
|
+
const { value } = this.configProps$;
|
|
60
|
+
this.value$ = value;
|
|
155
61
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (this.bDisabled$) {
|
|
161
|
-
this.fieldControl.disable();
|
|
162
|
-
} else {
|
|
163
|
-
this.fieldControl.enable();
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (this.configProps$.readOnly != null) {
|
|
167
|
-
this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
|
|
168
|
-
}
|
|
62
|
+
// Set component specific properties
|
|
63
|
+
this.updateRadioButtonsProperties(this.configProps$);
|
|
64
|
+
}
|
|
169
65
|
|
|
170
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Updates radio buttons properties based on the provided config props.
|
|
68
|
+
* @param configProps Configuration properties.
|
|
69
|
+
*/
|
|
70
|
+
protected updateRadioButtonsProperties(configProps) {
|
|
71
|
+
const { inline, fieldMetadata, variant } = configProps;
|
|
171
72
|
|
|
172
|
-
this.
|
|
73
|
+
this.variant = variant;
|
|
74
|
+
this.bInline$ = this.utils.getBooleanValue(inline);
|
|
173
75
|
|
|
174
|
-
|
|
175
|
-
this.
|
|
76
|
+
// Get options from config props and data object
|
|
77
|
+
this.options$ = this.utils.getOptionList(configProps, this.pConn$.getDataObject());
|
|
176
78
|
|
|
79
|
+
// Extract metadata and locale information
|
|
177
80
|
const className = this.pConn$.getCaseInfo().getClassName();
|
|
178
81
|
const refName = this.propName?.slice(this.propName.lastIndexOf('.') + 1);
|
|
82
|
+
const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter(field => field?.classID === className)[0] : fieldMetadata;
|
|
179
83
|
|
|
180
|
-
|
|
181
|
-
const metaData = Array.isArray(this.fieldMetadata) ? this.fieldMetadata.filter(field => field?.classID === className)[0] : this.fieldMetadata;
|
|
182
|
-
|
|
84
|
+
// Determine display name and locale context
|
|
183
85
|
let displayName = metaData?.datasource?.propertyForDisplayText;
|
|
184
86
|
displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
|
|
185
87
|
this.localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';
|
|
@@ -187,20 +89,12 @@ export class RadioButtonsComponent implements OnInit, OnDestroy {
|
|
|
187
89
|
this.localeName = this.localeContext === 'datapage' ? metaData?.datasource?.name : refName;
|
|
188
90
|
this.localePath = this.localeContext === 'datapage' ? displayName : this.localeName;
|
|
189
91
|
|
|
92
|
+
// Get localized value
|
|
190
93
|
this.localizedValue = this.pConn$.getLocalizedValue(
|
|
191
94
|
this.value$,
|
|
192
95
|
this.localePath,
|
|
193
96
|
this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
|
|
194
97
|
);
|
|
195
|
-
// trigger display of error message with field control
|
|
196
|
-
if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
|
|
197
|
-
const timer = interval(100).subscribe(() => {
|
|
198
|
-
this.fieldControl.setErrors({ message: true });
|
|
199
|
-
this.fieldControl.markAsTouched();
|
|
200
|
-
|
|
201
|
-
timer.unsubscribe();
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
98
|
}
|
|
205
99
|
|
|
206
100
|
isSelected(buttonValue: string): boolean {
|
|
@@ -218,21 +112,4 @@ export class RadioButtonsComponent implements OnInit, OnDestroy {
|
|
|
218
112
|
this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
|
|
219
113
|
);
|
|
220
114
|
}
|
|
221
|
-
|
|
222
|
-
getErrorMessage() {
|
|
223
|
-
let errMessage = '';
|
|
224
|
-
|
|
225
|
-
// look for validation messages for json, pre-defined or just an error pushed from workitem (400)
|
|
226
|
-
if (this.fieldControl.hasError('message')) {
|
|
227
|
-
errMessage = this.angularPConnectData.validateMessage ?? '';
|
|
228
|
-
return errMessage;
|
|
229
|
-
}
|
|
230
|
-
if (this.fieldControl.hasError('required')) {
|
|
231
|
-
errMessage = 'You must enter a value';
|
|
232
|
-
} else if (this.fieldControl.errors) {
|
|
233
|
-
errMessage = this.fieldControl.errors.toString();
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return errMessage;
|
|
237
|
-
}
|
|
238
115
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<div *ngIf="displayMode$; else noDisplayMode">
|
|
2
2
|
<component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$, isHtml$: true }"></component-mapper>
|
|
3
3
|
</div>
|
|
4
|
+
|
|
4
5
|
<ng-template #noDisplayMode>
|
|
5
6
|
<div *ngIf="!bReadonly$; else noEdit">
|
|
6
7
|
<div *ngIf="bVisible$">
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
</div>
|
|
14
15
|
</div>
|
|
15
16
|
</ng-template>
|
|
17
|
+
|
|
16
18
|
<ng-template #noEdit>
|
|
17
19
|
<div *ngIf="bVisible$ !== false">
|
|
18
20
|
<component-mapper name="RichTextEditor" [props]="{ label: label$, value: value$, readonly: true, testId }" [parent]="this"></component-mapper>
|