@pega/angular-sdk-overrides 0.25.1 → 0.25.2
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/banner/banner.component.scss +12 -2
- 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-details/material-details.component.scss +0 -5
- 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-summary-item/material-summary-item.component.scss +2 -17
- 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/operator/operator.component.html +1 -1
- package/lib/designSystemExtension/operator/operator.component.scss +3 -10
- package/lib/designSystemExtension/operator/operator.component.ts +0 -1
- package/lib/designSystemExtension/pulse/pulse.component.scss +2 -2
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.scss +0 -1
- package/lib/designSystemExtension/wss-quick-create/wss-quick-create.component.scss +16 -8
- package/lib/field/auto-complete/auto-complete.component.html +0 -1
- package/lib/field/auto-complete/auto-complete.component.ts +35 -172
- 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 -36
- package/lib/field/check-box/check-box.component.html +0 -1
- package/lib/field/check-box/check-box.component.scss +0 -1
- package/lib/field/check-box/check-box.component.ts +19 -149
- package/lib/field/currency/currency.component.ts +36 -168
- package/lib/field/date/date.component.html +1 -1
- package/lib/field/date/date.component.ts +30 -150
- package/lib/field/date-time/date-time.component.ts +31 -149
- package/lib/field/decimal/decimal.component.ts +38 -163
- package/lib/field/dropdown/dropdown.component.ts +29 -151
- package/lib/field/email/email.component.ts +16 -155
- package/lib/field/field.base.ts +149 -0
- package/lib/field/group/group.component.ts +7 -4
- package/lib/field/integer/integer.component.ts +18 -157
- package/lib/field/location/location.component.ts +1 -1
- package/lib/field/multiselect/multiselect.component.ts +46 -148
- 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 -154
- package/lib/field/phone/phone.component.ts +28 -142
- package/lib/field/radio-buttons/radio-buttons.component.scss +4 -2
- package/lib/field/radio-buttons/radio-buttons.component.ts +35 -161
- package/lib/field/rich-text/rich-text.component.ts +19 -90
- package/lib/field/scalar-list/scalar-list.component.ts +17 -72
- package/lib/field/selectable-card/selectable-card.component.html +54 -24
- package/lib/field/selectable-card/selectable-card.component.scss +11 -0
- package/lib/field/selectable-card/selectable-card.component.ts +16 -52
- 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 -5
- package/lib/field/text/text.component.scss +0 -1
- package/lib/field/text-area/text-area.component.ts +18 -152
- package/lib/field/text-input/text-input.component.ts +16 -155
- package/lib/field/time/time.component.ts +17 -151
- package/lib/field/url/url.component.ts +16 -154
- package/lib/field/user-reference/user-reference.component.scss +0 -1
- package/lib/field/user-reference/user-reference.component.ts +2 -3
- package/lib/infra/Containers/flow-container/flow-container.component.ts +5 -7
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +5 -10
- package/lib/infra/Containers/view-container/helper.ts +35 -2
- package/lib/infra/Containers/view-container/view-container.component.ts +1 -1
- 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 -2
- package/lib/infra/assignment/assignment.component.ts +8 -6
- 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 -4
- package/lib/infra/defer-load/defer-load.component.html +6 -2
- package/lib/infra/defer-load/defer-load.component.ts +16 -10
- package/lib/infra/multi-step/multi-step.component.scss +1 -21
- package/lib/infra/navbar/navbar.component.html +25 -28
- package/lib/infra/navbar/navbar.component.scss +16 -4
- package/lib/infra/navbar/navbar.component.ts +8 -3
- package/lib/infra/root-container/root-container.component.scss +0 -1
- package/lib/infra/root-container/root-container.component.ts +1 -2
- package/lib/infra/stages/stages.component.html +2 -2
- package/lib/infra/stages/stages.component.scss +7 -35
- package/lib/infra/stages/stages.component.ts +4 -2
- package/lib/infra/view/view.component.html +1 -1
- package/lib/infra/view/view.component.ts +0 -2
- 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 -7
- package/lib/template/case-summary/case-summary.component.scss +0 -2
- package/lib/template/case-view/case-view.component.html +3 -3
- package/lib/template/case-view/case-view.component.scss +18 -10
- package/lib/template/case-view/case-view.component.ts +1 -1
- package/lib/template/data-reference/data-reference-advanced-search.service.ts +16 -0
- package/lib/template/data-reference/data-reference.component.html +11 -8
- package/lib/template/data-reference/data-reference.component.ts +346 -112
- 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 -2
- 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/field-group-list/field-group-list.component.scss +0 -1
- package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +1 -1
- package/lib/template/list-view/list-view.component.html +9 -4
- package/lib/template/list-view/list-view.component.scss +21 -21
- package/lib/template/list-view/list-view.component.ts +154 -84
- package/lib/template/list-view/utils.ts +25 -2
- 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-tab/one-column-tab.component.scss +1 -1
- package/lib/template/repeating-structures/repeating-structures.component.ts +0 -1
- package/lib/template/self-service-case-view/self-service-case-view.component.html +80 -0
- package/lib/template/self-service-case-view/self-service-case-view.component.scss +124 -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 +216 -0
- package/lib/template/simple-table/simple-table.component.ts +0 -1
- package/lib/template/simple-table-manual/helpers.ts +2 -2
- 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 +8 -4
- 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 -3
- package/lib/template/utils.ts +42 -0
- package/lib/template/wss-nav-bar/wss-nav-bar.component.html +5 -4
- package/lib/template/wss-nav-bar/wss-nav-bar.component.scss +2 -8
- package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +1 -8
- 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/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 +2 -5
- package/lib/widget/attachment/attachment.component.ts +255 -254
- package/lib/widget/feed-container/feed-container.component.scss +3 -9
- package/lib/widget/feed-container/feed-container.component.ts +2 -2
- package/lib/widget/file-utility/file-utility.component.html +3 -3
- package/lib/widget/file-utility/file-utility.component.scss +5 -16
- package/lib/widget/list-utility/list-utility.component.scss +3 -5
- package/lib/widget/todo/todo.component.html +8 -5
- package/lib/widget/todo/todo.component.scss +10 -11
- package/lib/widget/todo/todo.component.ts +6 -2
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, EventEmitter, OnInit, Output, forwardRef, inject } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import {
|
|
3
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
4
4
|
import { MatOptionModule } from '@angular/material/core';
|
|
5
5
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
6
6
|
import { MatInputModule } from '@angular/material/input';
|
|
7
7
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
8
|
-
import {
|
|
8
|
+
import { Observable } from 'rxjs';
|
|
9
9
|
import { map, startWith } from 'rxjs/operators';
|
|
10
|
-
|
|
11
|
-
import {
|
|
10
|
+
|
|
11
|
+
import { FieldBase } from '@pega/angular-sdk-components';
|
|
12
12
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
13
13
|
import { DatapageService } from '@pega/angular-sdk-components';
|
|
14
14
|
import { handleEvent } from '@pega/angular-sdk-components';
|
|
@@ -42,68 +42,26 @@ interface AutoCompleteProps extends PConnFieldProps {
|
|
|
42
42
|
MatAutocompleteModule,
|
|
43
43
|
MatOptionModule,
|
|
44
44
|
forwardRef(() => ComponentMapperComponent)
|
|
45
|
-
]
|
|
45
|
+
],
|
|
46
|
+
providers: [DatapageService]
|
|
46
47
|
})
|
|
47
|
-
export class AutoCompleteComponent implements OnInit
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
export class AutoCompleteComponent extends FieldBase implements OnInit {
|
|
49
|
+
protected dataPageService = inject(DatapageService);
|
|
50
|
+
|
|
51
|
+
@Output() onRecordChange: EventEmitter<any> = new EventEmitter();
|
|
50
52
|
|
|
51
|
-
// Used with AngularPConnect
|
|
52
|
-
angularPConnectData: AngularPConnectData = {};
|
|
53
53
|
configProps$: AutoCompleteProps;
|
|
54
54
|
|
|
55
|
-
label$ = '';
|
|
56
|
-
value$ = '';
|
|
57
|
-
bRequired$ = false;
|
|
58
|
-
bReadonly$ = false;
|
|
59
|
-
bDisabled$ = false;
|
|
60
|
-
bVisible$ = true;
|
|
61
|
-
displayMode$?: string = '';
|
|
62
|
-
controlName$: string;
|
|
63
|
-
bHasForm$ = true;
|
|
64
55
|
options$: any[];
|
|
65
|
-
componentReference = '';
|
|
66
|
-
testId: string;
|
|
67
56
|
listType: string;
|
|
68
57
|
columns = [];
|
|
69
|
-
helperText: string;
|
|
70
|
-
placeholder: string;
|
|
71
|
-
|
|
72
|
-
fieldControl = new FormControl('', null);
|
|
73
58
|
parameters: {};
|
|
74
|
-
hideLabel: boolean;
|
|
75
59
|
filteredOptions: Observable<any[]>;
|
|
76
60
|
filterValue = '';
|
|
77
|
-
actionsApi: Object;
|
|
78
|
-
propName: string;
|
|
79
|
-
|
|
80
|
-
constructor(
|
|
81
|
-
private angularPConnect: AngularPConnectService,
|
|
82
|
-
private cdRef: ChangeDetectorRef,
|
|
83
|
-
private utils: Utils,
|
|
84
|
-
private dataPageService: DatapageService
|
|
85
|
-
) {}
|
|
86
|
-
|
|
87
|
-
async ngOnInit(): Promise<void> {
|
|
88
|
-
// First thing in initialization is registering and subscribing to the AngularPConnect service
|
|
89
|
-
this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
|
|
90
|
-
this.controlName$ = this.angularPConnect.getComponentID(this);
|
|
91
|
-
|
|
92
|
-
// Then, continue on with other initialization
|
|
93
61
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (this.formGroup$) {
|
|
99
|
-
// add control to formGroup
|
|
100
|
-
this.formGroup$.addControl(this.controlName$, this.fieldControl);
|
|
101
|
-
this.fieldControl.setValue(this.value$);
|
|
102
|
-
this.bHasForm$ = true;
|
|
103
|
-
} else {
|
|
104
|
-
this.bReadonly$ = true;
|
|
105
|
-
this.bHasForm$ = false;
|
|
106
|
-
}
|
|
62
|
+
// Override ngOnInit method
|
|
63
|
+
override async ngOnInit(): Promise<void> {
|
|
64
|
+
super.ngOnInit();
|
|
107
65
|
|
|
108
66
|
this.filteredOptions = this.fieldControl.valueChanges.pipe(
|
|
109
67
|
startWith(''),
|
|
@@ -118,54 +76,32 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
|
|
|
118
76
|
this.fieldControl.setValue(this.value$);
|
|
119
77
|
}
|
|
120
78
|
|
|
121
|
-
ngOnDestroy(): void {
|
|
122
|
-
if (this.formGroup$) {
|
|
123
|
-
this.formGroup$.removeControl(this.controlName$);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (this.angularPConnectData.unsubscribeFn) {
|
|
127
|
-
this.angularPConnectData.unsubscribeFn();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
79
|
private _filter(value: string): string[] {
|
|
132
80
|
const filterVal = (value || this.filterValue).toLowerCase();
|
|
133
81
|
return this.options$?.filter(option => option.value?.toLowerCase().includes(filterVal));
|
|
134
82
|
}
|
|
135
83
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
// Should always check the bridge to see if the component should
|
|
143
|
-
// update itself (re-render)
|
|
144
|
-
const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
|
|
145
|
-
|
|
146
|
-
// ONLY call updateSelf when the component should update
|
|
147
|
-
if (bUpdateSelf) {
|
|
148
|
-
await this.updateSelf();
|
|
149
|
-
}
|
|
150
|
-
}
|
|
84
|
+
/**
|
|
85
|
+
* Updates the component when there are changes in the state.
|
|
86
|
+
*/
|
|
87
|
+
override async updateSelf(): Promise<void> {
|
|
88
|
+
// Resolve configuration properties
|
|
89
|
+
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as AutoCompleteProps;
|
|
151
90
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
// starting very simple...
|
|
91
|
+
// Update component common properties
|
|
92
|
+
this.updateComponentCommonProperties(this.configProps$);
|
|
155
93
|
|
|
156
|
-
//
|
|
157
|
-
|
|
94
|
+
// Set component specific properties
|
|
95
|
+
const { value, listType, parameters } = this.configProps$;
|
|
158
96
|
|
|
159
|
-
if (
|
|
160
|
-
const index = this.options$?.findIndex(element => element.key ===
|
|
161
|
-
this.value$ = index > -1 ? this.options$[index].value :
|
|
97
|
+
if (value != undefined) {
|
|
98
|
+
const index = this.options$?.findIndex(element => element.key === value);
|
|
99
|
+
this.value$ = index > -1 ? this.options$[index].value : value;
|
|
162
100
|
this.fieldControl.setValue(this.value$);
|
|
163
101
|
}
|
|
164
102
|
|
|
165
|
-
this.
|
|
166
|
-
|
|
167
|
-
this.actionsApi = this.pConn$.getActionsApi();
|
|
168
|
-
this.propName = this.pConn$.getStateProps().value;
|
|
103
|
+
this.listType = listType;
|
|
104
|
+
this.parameters = parameters;
|
|
169
105
|
|
|
170
106
|
const context = this.pConn$.getContextName();
|
|
171
107
|
const { columns, datasource } = this.generateColumnsAndDataSource();
|
|
@@ -173,34 +109,7 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
|
|
|
173
109
|
if (columns) {
|
|
174
110
|
this.columns = this.preProcessColumns(columns);
|
|
175
111
|
}
|
|
176
|
-
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
177
|
-
setTimeout(() => {
|
|
178
|
-
if (this.configProps$.required != null) {
|
|
179
|
-
this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
|
|
180
|
-
}
|
|
181
|
-
this.cdRef.detectChanges();
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
if (this.configProps$.visibility != null) {
|
|
185
|
-
this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// disabled
|
|
189
|
-
if (this.configProps$.disabled != undefined) {
|
|
190
|
-
this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
|
|
191
|
-
}
|
|
192
112
|
|
|
193
|
-
if (this.bDisabled$) {
|
|
194
|
-
this.fieldControl.disable();
|
|
195
|
-
} else {
|
|
196
|
-
this.fieldControl.enable();
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (this.configProps$.readOnly != null) {
|
|
200
|
-
this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
this.componentReference = this.pConn$.getStateProps().value;
|
|
204
113
|
if (this.listType === 'associated') {
|
|
205
114
|
const optionsList = this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject('')); // 1st arg empty string until typedef marked correctly
|
|
206
115
|
this.setOptions(optionsList);
|
|
@@ -210,27 +119,6 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
|
|
|
210
119
|
const results = await this.dataPageService.getDataPageData(datasource, this.parameters, context);
|
|
211
120
|
this.fillOptions(results);
|
|
212
121
|
}
|
|
213
|
-
|
|
214
|
-
// trigger display of error message with field control
|
|
215
|
-
if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
|
|
216
|
-
const timer = interval(100).subscribe(() => {
|
|
217
|
-
this.fieldControl.setErrors({ message: true });
|
|
218
|
-
this.fieldControl.markAsTouched();
|
|
219
|
-
|
|
220
|
-
timer.unsubscribe();
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
setPropertyValuesFromProps() {
|
|
226
|
-
this.testId = this.configProps$.testId;
|
|
227
|
-
this.label$ = this.configProps$.label;
|
|
228
|
-
this.placeholder = this.configProps$.placeholder || '';
|
|
229
|
-
this.displayMode$ = this.configProps$.displayMode;
|
|
230
|
-
this.listType = this.configProps$.listType;
|
|
231
|
-
this.hideLabel = this.configProps$.hideLabel;
|
|
232
|
-
this.helperText = this.configProps$.helperText;
|
|
233
|
-
this.parameters = this.configProps$?.parameters;
|
|
234
122
|
}
|
|
235
123
|
|
|
236
124
|
generateColumnsAndDataSource() {
|
|
@@ -312,49 +200,24 @@ export class AutoCompleteComponent implements OnInit, OnDestroy {
|
|
|
312
200
|
}
|
|
313
201
|
|
|
314
202
|
fieldOnChange(event: Event) {
|
|
315
|
-
// this works - this.pConn$.setValue( this.componentReference, `property: ${this.componentReference}`);
|
|
316
|
-
// this works - this.pConn$.setValue( this.componentReference, this.fieldControl.value);
|
|
317
|
-
// PConnect wants to use changeHandler for onChange
|
|
318
|
-
// this.angularPConnect.changeHandler( this, event);
|
|
319
203
|
const value = (event.target as HTMLInputElement).value;
|
|
320
204
|
this.filterValue = value;
|
|
321
205
|
handleEvent(this.actionsApi, 'change', this.propName, value);
|
|
322
206
|
}
|
|
323
207
|
|
|
324
208
|
optionChanged(event: any) {
|
|
325
|
-
const
|
|
326
|
-
handleEvent(this.actionsApi, 'change', this.propName, value);
|
|
327
|
-
}
|
|
209
|
+
const val = event?.option?.value;
|
|
328
210
|
|
|
329
|
-
fieldOnBlur(event: Event) {
|
|
330
211
|
let key = '';
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
key = index > -1 ? (key = this.options$[index].key) : el.value;
|
|
212
|
+
if (val) {
|
|
213
|
+
const index = this.options$?.findIndex(element => element.value === val);
|
|
214
|
+
key = index > -1 ? (key = this.options$[index].key) : val;
|
|
335
215
|
}
|
|
336
216
|
const value = key;
|
|
337
217
|
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
338
|
-
if (this.configProps$?.onRecordChange) {
|
|
339
|
-
el.value = value;
|
|
340
|
-
this.configProps$.onRecordChange(event);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
getErrorMessage() {
|
|
345
|
-
let errMessage = '';
|
|
346
218
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
errMessage = this.angularPConnectData.validateMessage ?? '';
|
|
350
|
-
return errMessage;
|
|
219
|
+
if (this.onRecordChange) {
|
|
220
|
+
this.onRecordChange.emit(value);
|
|
351
221
|
}
|
|
352
|
-
if (this.fieldControl.hasError('required')) {
|
|
353
|
-
errMessage = 'You must enter a value';
|
|
354
|
-
} else if (this.fieldControl.errors) {
|
|
355
|
-
errMessage = this.fieldControl.errors.toString();
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
return errMessage;
|
|
359
222
|
}
|
|
360
223
|
}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
<div *ngIf="bShowAlert$" class="psdk-cancel-alert-background">
|
|
2
2
|
<div class="psdk-cancel-alert-top">
|
|
3
|
-
<h3
|
|
3
|
+
<h3>{{ localizedVal('Discard unsaved changes?', localeCategory) }}</h3>
|
|
4
4
|
<div>
|
|
5
|
-
<p>{{
|
|
6
|
-
<p>{{ body2$ }}</p>
|
|
5
|
+
<p>{{ localizedVal('You have unsaved changes. You can discard them or go back to keep working.', localeCategory) }}</p>
|
|
7
6
|
</div>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<button mat-raised-button color="primary" (click)="buttonClick('delete')">{{ localizedVal('Delete', localeCategory) }}</button>
|
|
15
|
-
</mat-grid-tile>
|
|
16
|
-
</mat-grid-list>
|
|
7
|
+
<component-mapper
|
|
8
|
+
name="ActionButtons"
|
|
9
|
+
[props]="{ arMainButtons$: [discardButton], arSecondaryButtons$: [goBackButton] }"
|
|
10
|
+
[parent]="this"
|
|
11
|
+
[outputEvents]="{ actionButtonClick: buttonClick }"
|
|
12
|
+
></component-mapper>
|
|
17
13
|
</div>
|
|
18
14
|
</div>
|
|
@@ -5,20 +5,19 @@
|
|
|
5
5
|
align-items: center;
|
|
6
6
|
height: 100%;
|
|
7
7
|
width: 100%;
|
|
8
|
-
background-color: var(--app-dialog-background-color);
|
|
9
8
|
position: fixed;
|
|
10
9
|
z-index: 9999;
|
|
11
10
|
top: 0px;
|
|
12
11
|
left: 0px;
|
|
12
|
+
background: rgba(0, 0, 0, 0.5);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.psdk-cancel-alert-top {
|
|
16
|
-
display: table;
|
|
17
16
|
margin: auto;
|
|
18
17
|
min-width: 550px;
|
|
19
|
-
background-color: var(--app-form-color);
|
|
20
18
|
border: 1px solid var(--app-inverse-form-color);
|
|
21
19
|
border-radius: 10px;
|
|
22
20
|
padding: 20px;
|
|
23
21
|
box-shadow: 0 0 10px 3px var(--app-box-shadow-color);
|
|
22
|
+
background-color: var(--mat-sys-surface-container);
|
|
24
23
|
}
|
|
@@ -1,53 +1,44 @@
|
|
|
1
|
-
import { Component, Input, Output, EventEmitter, OnChanges } from '@angular/core';
|
|
1
|
+
import { Component, Input, Output, EventEmitter, OnChanges, forwardRef } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import { MatButtonModule } from '@angular/material/button';
|
|
4
4
|
import { MatGridListModule } from '@angular/material/grid-list';
|
|
5
5
|
import { ProgressSpinnerService } from '@pega/angular-sdk-components';
|
|
6
|
+
import { ComponentMapperComponent } from 'packages/angular-sdk-components/src/public-api';
|
|
6
7
|
|
|
7
8
|
@Component({
|
|
8
9
|
selector: 'app-cancel-alert',
|
|
9
10
|
templateUrl: './cancel-alert.component.html',
|
|
10
11
|
styleUrls: ['./cancel-alert.component.scss'],
|
|
11
|
-
imports: [CommonModule, MatGridListModule, MatButtonModule]
|
|
12
|
+
imports: [CommonModule, MatGridListModule, MatButtonModule, forwardRef(() => ComponentMapperComponent)]
|
|
12
13
|
})
|
|
13
14
|
export class CancelAlertComponent implements OnChanges {
|
|
14
15
|
@Input() pConn$: typeof PConnect;
|
|
15
16
|
@Input() bShowAlert$: boolean;
|
|
16
17
|
@Output() onAlertState$: EventEmitter<boolean> = new EventEmitter<boolean>();
|
|
17
18
|
|
|
18
|
-
heading$: string;
|
|
19
|
-
body1$: string;
|
|
20
|
-
body2$: string;
|
|
21
19
|
itemKey: string;
|
|
22
20
|
localizedVal: Function;
|
|
23
21
|
localeCategory = 'ModalContainer';
|
|
22
|
+
discardButton: any;
|
|
23
|
+
goBackButton: any;
|
|
24
24
|
|
|
25
25
|
constructor(private psService: ProgressSpinnerService) {}
|
|
26
26
|
ngOnChanges() {
|
|
27
27
|
if (this.bShowAlert$) {
|
|
28
28
|
this.psService.sendMessage(false);
|
|
29
|
-
|
|
30
29
|
const contextName = this.pConn$.getContextName();
|
|
31
|
-
const caseInfo = this.pConn$.getCaseInfo();
|
|
32
|
-
const caseName = caseInfo.getName();
|
|
33
|
-
const ID = caseInfo.getID();
|
|
34
30
|
this.localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
35
|
-
|
|
36
31
|
this.itemKey = contextName;
|
|
37
|
-
this.
|
|
38
|
-
this.body1$ = `${this.localizedVal('Are you sure you want to delete ', this.localeCategory) + caseName} (${ID})?`;
|
|
39
|
-
this.body2$ = this.localizedVal('Alternatively, you can continue working or save your work for later.', this.localeCategory);
|
|
40
|
-
|
|
41
|
-
// this.onAlertState$.emit(true);
|
|
32
|
+
this.createCancelAlertButtons();
|
|
42
33
|
}
|
|
43
34
|
}
|
|
44
35
|
|
|
45
|
-
|
|
36
|
+
dismissAlertOnly() {
|
|
46
37
|
this.bShowAlert$ = false;
|
|
47
38
|
this.onAlertState$.emit(false);
|
|
48
39
|
}
|
|
49
40
|
|
|
50
|
-
|
|
41
|
+
dismissAlert() {
|
|
51
42
|
this.bShowAlert$ = false;
|
|
52
43
|
this.onAlertState$.emit(true);
|
|
53
44
|
}
|
|
@@ -56,31 +47,28 @@ export class CancelAlertComponent implements OnChanges {
|
|
|
56
47
|
alert(sMessage);
|
|
57
48
|
}
|
|
58
49
|
|
|
59
|
-
|
|
50
|
+
createCancelAlertButtons() {
|
|
51
|
+
this.discardButton = {
|
|
52
|
+
actionID: 'discard',
|
|
53
|
+
jsAction: 'discard',
|
|
54
|
+
name: this.pConn$.getLocalizedValue('Discard', '', '')
|
|
55
|
+
};
|
|
56
|
+
this.goBackButton = {
|
|
57
|
+
actionID: 'continue',
|
|
58
|
+
jsAction: 'continue',
|
|
59
|
+
name: this.pConn$.getLocalizedValue('Go back', '', '')
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
buttonClick({ action }) {
|
|
60
64
|
const actionsAPI = this.pConn$.getActionsApi();
|
|
61
65
|
this.localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
62
66
|
|
|
63
|
-
switch (
|
|
64
|
-
case 'save':
|
|
65
|
-
this.psService.sendMessage(true);
|
|
66
|
-
// eslint-disable-next-line no-case-declarations
|
|
67
|
-
const savePromise = actionsAPI.saveAndClose(this.itemKey);
|
|
68
|
-
savePromise
|
|
69
|
-
.then(() => {
|
|
70
|
-
this.psService.sendMessage(false);
|
|
71
|
-
this.dismissAlert();
|
|
72
|
-
|
|
73
|
-
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CASE_CREATED);
|
|
74
|
-
})
|
|
75
|
-
.catch(() => {
|
|
76
|
-
this.psService.sendMessage(false);
|
|
77
|
-
this.sendMessage(this.localizedVal('Save failed', this.localeCategory));
|
|
78
|
-
});
|
|
79
|
-
break;
|
|
67
|
+
switch (action) {
|
|
80
68
|
case 'continue':
|
|
81
69
|
this.dismissAlertOnly();
|
|
82
70
|
break;
|
|
83
|
-
case '
|
|
71
|
+
case 'discard':
|
|
84
72
|
this.psService.sendMessage(true);
|
|
85
73
|
|
|
86
74
|
// eslint-disable-next-line no-case-declarations
|