@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.
Files changed (160) hide show
  1. package/lib/designSystemExtension/alert/alert.component.scss +3 -3
  2. package/lib/designSystemExtension/banner/banner.component.scss +12 -2
  3. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +6 -3
  4. package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +5 -34
  5. package/lib/designSystemExtension/material-details/material-details.component.scss +0 -5
  6. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +2 -2
  7. package/lib/designSystemExtension/material-details-fields/material-details-fields.component.scss +4 -3
  8. package/lib/designSystemExtension/material-summary-item/material-summary-item.component.scss +2 -17
  9. package/lib/designSystemExtension/material-utility/material-utility.component.scss +1 -2
  10. package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.scss +1 -1
  11. package/lib/designSystemExtension/operator/operator.component.html +1 -1
  12. package/lib/designSystemExtension/operator/operator.component.scss +3 -10
  13. package/lib/designSystemExtension/operator/operator.component.ts +0 -1
  14. package/lib/designSystemExtension/pulse/pulse.component.scss +2 -2
  15. package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.scss +0 -1
  16. package/lib/designSystemExtension/wss-quick-create/wss-quick-create.component.scss +16 -8
  17. package/lib/field/auto-complete/auto-complete.component.html +0 -1
  18. package/lib/field/auto-complete/auto-complete.component.ts +35 -172
  19. package/lib/field/cancel-alert/cancel-alert.component.html +8 -12
  20. package/lib/field/cancel-alert/cancel-alert.component.scss +2 -3
  21. package/lib/field/cancel-alert/cancel-alert.component.ts +24 -36
  22. package/lib/field/check-box/check-box.component.html +0 -1
  23. package/lib/field/check-box/check-box.component.scss +0 -1
  24. package/lib/field/check-box/check-box.component.ts +19 -149
  25. package/lib/field/currency/currency.component.ts +36 -168
  26. package/lib/field/date/date.component.html +1 -1
  27. package/lib/field/date/date.component.ts +30 -150
  28. package/lib/field/date-time/date-time.component.ts +31 -149
  29. package/lib/field/decimal/decimal.component.ts +38 -163
  30. package/lib/field/dropdown/dropdown.component.ts +29 -151
  31. package/lib/field/email/email.component.ts +16 -155
  32. package/lib/field/field.base.ts +149 -0
  33. package/lib/field/group/group.component.ts +7 -4
  34. package/lib/field/integer/integer.component.ts +18 -157
  35. package/lib/field/location/location.component.ts +1 -1
  36. package/lib/field/multiselect/multiselect.component.ts +46 -148
  37. package/lib/field/multiselect/utils.ts +55 -47
  38. package/lib/field/object-reference/object-reference.component.html +17 -0
  39. package/lib/field/object-reference/object-reference.component.scss +0 -0
  40. package/lib/field/object-reference/object-reference.component.spec.ts +22 -0
  41. package/lib/field/object-reference/object-reference.component.ts +237 -0
  42. package/lib/field/percentage/percentage.component.ts +37 -154
  43. package/lib/field/phone/phone.component.ts +28 -142
  44. package/lib/field/radio-buttons/radio-buttons.component.scss +4 -2
  45. package/lib/field/radio-buttons/radio-buttons.component.ts +35 -161
  46. package/lib/field/rich-text/rich-text.component.ts +19 -90
  47. package/lib/field/scalar-list/scalar-list.component.ts +17 -72
  48. package/lib/field/selectable-card/selectable-card.component.html +54 -24
  49. package/lib/field/selectable-card/selectable-card.component.scss +11 -0
  50. package/lib/field/selectable-card/selectable-card.component.ts +16 -52
  51. package/lib/field/semantic-link/semantic-link.component.html +4 -8
  52. package/lib/field/semantic-link/semantic-link.component.scss +0 -13
  53. package/lib/field/semantic-link/semantic-link.component.ts +165 -5
  54. package/lib/field/text/text.component.scss +0 -1
  55. package/lib/field/text-area/text-area.component.ts +18 -152
  56. package/lib/field/text-input/text-input.component.ts +16 -155
  57. package/lib/field/time/time.component.ts +17 -151
  58. package/lib/field/url/url.component.ts +16 -154
  59. package/lib/field/user-reference/user-reference.component.scss +0 -1
  60. package/lib/field/user-reference/user-reference.component.ts +2 -3
  61. package/lib/infra/Containers/flow-container/flow-container.component.ts +5 -7
  62. package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +5 -10
  63. package/lib/infra/Containers/view-container/helper.ts +35 -2
  64. package/lib/infra/Containers/view-container/view-container.component.ts +1 -1
  65. package/lib/infra/action-buttons/action-buttons.component.html +13 -8
  66. package/lib/infra/action-buttons/action-buttons.component.scss +23 -0
  67. package/lib/infra/action-buttons/action-buttons.component.ts +1 -2
  68. package/lib/infra/assignment/assignment.component.ts +8 -6
  69. package/lib/infra/assignment-card/assignment-card.component.html +1 -2
  70. package/lib/infra/assignment-card/assignment-card.component.scss +0 -4
  71. package/lib/infra/assignment-card/assignment-card.component.ts +21 -4
  72. package/lib/infra/defer-load/defer-load.component.html +6 -2
  73. package/lib/infra/defer-load/defer-load.component.ts +16 -10
  74. package/lib/infra/multi-step/multi-step.component.scss +1 -21
  75. package/lib/infra/navbar/navbar.component.html +25 -28
  76. package/lib/infra/navbar/navbar.component.scss +16 -4
  77. package/lib/infra/navbar/navbar.component.ts +8 -3
  78. package/lib/infra/root-container/root-container.component.scss +0 -1
  79. package/lib/infra/root-container/root-container.component.ts +1 -2
  80. package/lib/infra/stages/stages.component.html +2 -2
  81. package/lib/infra/stages/stages.component.scss +7 -35
  82. package/lib/infra/stages/stages.component.ts +4 -2
  83. package/lib/infra/view/view.component.html +1 -1
  84. package/lib/infra/view/view.component.ts +0 -2
  85. package/lib/template/advanced-search/advanced-search.component.html +12 -0
  86. package/lib/template/advanced-search/advanced-search.component.scss +0 -0
  87. package/lib/template/advanced-search/advanced-search.component.spec.ts +0 -0
  88. package/lib/template/advanced-search/advanced-search.component.ts +112 -0
  89. package/lib/template/advanced-search/advanced-search.service.ts +27 -0
  90. package/lib/template/advanced-search/search-group/persist-utils.ts +56 -0
  91. package/lib/template/advanced-search/search-groups/search-groups.component.html +32 -0
  92. package/lib/template/advanced-search/search-groups/search-groups.component.scss +0 -0
  93. package/lib/template/advanced-search/search-groups/search-groups.component.spec.ts +0 -0
  94. package/lib/template/advanced-search/search-groups/search-groups.component.ts +294 -0
  95. package/lib/template/advanced-search/search-groups/utils.ts +29 -0
  96. package/lib/template/app-shell/app-shell.component.html +4 -1
  97. package/lib/template/app-shell/app-shell.component.scss +0 -3
  98. package/lib/template/app-shell/app-shell.component.ts +46 -7
  99. package/lib/template/case-summary/case-summary.component.scss +0 -2
  100. package/lib/template/case-view/case-view.component.html +3 -3
  101. package/lib/template/case-view/case-view.component.scss +18 -10
  102. package/lib/template/case-view/case-view.component.ts +1 -1
  103. package/lib/template/data-reference/data-reference-advanced-search.service.ts +16 -0
  104. package/lib/template/data-reference/data-reference.component.html +11 -8
  105. package/lib/template/data-reference/data-reference.component.ts +346 -112
  106. package/lib/template/data-reference/search-form/search-form.component.html +39 -0
  107. package/lib/template/data-reference/search-form/search-form.component.scss +11 -0
  108. package/lib/template/data-reference/search-form/search-form.component.spec.ts +0 -0
  109. package/lib/template/data-reference/search-form/search-form.component.ts +167 -0
  110. package/lib/template/data-reference/search-form/tabsData.ts +160 -0
  111. package/lib/template/data-reference/utils.ts +92 -0
  112. package/lib/template/default-form/default-form.component.ts +10 -2
  113. package/lib/template/default-page/default-page.component.html +34 -0
  114. package/lib/template/default-page/default-page.component.scss +31 -0
  115. package/lib/template/default-page/default-page.component.spec.ts +24 -0
  116. package/lib/template/default-page/default-page.component.ts +64 -0
  117. package/lib/template/field-group-list/field-group-list.component.scss +0 -1
  118. package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +1 -1
  119. package/lib/template/list-view/list-view.component.html +9 -4
  120. package/lib/template/list-view/list-view.component.scss +21 -21
  121. package/lib/template/list-view/list-view.component.ts +154 -84
  122. package/lib/template/list-view/utils.ts +25 -2
  123. package/lib/template/object-page/object-page.component.html +1 -0
  124. package/lib/template/object-page/object-page.component.scss +0 -0
  125. package/lib/template/object-page/object-page.component.spec.ts +22 -0
  126. package/lib/template/object-page/object-page.component.ts +14 -0
  127. package/lib/template/one-column-tab/one-column-tab.component.scss +1 -1
  128. package/lib/template/repeating-structures/repeating-structures.component.ts +0 -1
  129. package/lib/template/self-service-case-view/self-service-case-view.component.html +80 -0
  130. package/lib/template/self-service-case-view/self-service-case-view.component.scss +124 -0
  131. package/lib/template/self-service-case-view/self-service-case-view.component.spec.ts +24 -0
  132. package/lib/template/self-service-case-view/self-service-case-view.component.ts +216 -0
  133. package/lib/template/simple-table/simple-table.component.ts +0 -1
  134. package/lib/template/simple-table-manual/helpers.ts +2 -2
  135. package/lib/template/simple-table-manual/simple-table-manual.component.html +4 -4
  136. package/lib/template/simple-table-manual/simple-table-manual.component.scss +4 -14
  137. package/lib/template/simple-table-manual/simple-table-manual.component.ts +8 -4
  138. package/lib/template/single-reference-readonly/single-reference-readonly.component.html +4 -1
  139. package/lib/template/single-reference-readonly/single-reference-readonly.component.scss +21 -0
  140. package/lib/template/single-reference-readonly/single-reference-readonly.component.ts +104 -3
  141. package/lib/template/utils.ts +42 -0
  142. package/lib/template/wss-nav-bar/wss-nav-bar.component.html +5 -4
  143. package/lib/template/wss-nav-bar/wss-nav-bar.component.scss +2 -8
  144. package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +1 -8
  145. package/lib/widget/app-announcement/app-announcement.component.html +1 -2
  146. package/lib/widget/app-announcement/app-announcement.component.scss +2 -2
  147. package/lib/widget/attachment/Attachment.types.ts +92 -0
  148. package/lib/widget/attachment/AttachmentUtils.ts +287 -0
  149. package/lib/widget/attachment/attachment.component.html +3 -3
  150. package/lib/widget/attachment/attachment.component.scss +2 -5
  151. package/lib/widget/attachment/attachment.component.ts +255 -254
  152. package/lib/widget/feed-container/feed-container.component.scss +3 -9
  153. package/lib/widget/feed-container/feed-container.component.ts +2 -2
  154. package/lib/widget/file-utility/file-utility.component.html +3 -3
  155. package/lib/widget/file-utility/file-utility.component.scss +5 -16
  156. package/lib/widget/list-utility/list-utility.component.scss +3 -5
  157. package/lib/widget/todo/todo.component.html +8 -5
  158. package/lib/widget/todo/todo.component.scss +10 -11
  159. package/lib/widget/todo/todo.component.ts +6 -2
  160. package/package.json +1 -1
@@ -1,14 +1,14 @@
1
- import { Component, OnInit, Input, ChangeDetectorRef, forwardRef, OnDestroy } from '@angular/core';
1
+ import { Component, EventEmitter, OnInit, Output, forwardRef, inject } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
- import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
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 { interval, Observable } from 'rxjs';
8
+ import { Observable } from 'rxjs';
9
9
  import { map, startWith } from 'rxjs/operators';
10
- import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
11
- import { Utils } from '@pega/angular-sdk-components';
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, OnDestroy {
48
- @Input() pConn$: typeof PConnect;
49
- @Input() formGroup$: FormGroup;
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
- // call updateSelf when initializing
95
- // this.updateSelf();
96
- await this.checkAndUpdate();
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
- // Callback passed when subscribing to store change
137
- async onStateChange() {
138
- await this.checkAndUpdate();
139
- }
140
-
141
- async checkAndUpdate() {
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
- // updateSelf
153
- async updateSelf(): Promise<void> {
154
- // starting very simple...
91
+ // Update component common properties
92
+ this.updateComponentCommonProperties(this.configProps$);
155
93
 
156
- // moved this from ngOnInit() and call this from there instead...
157
- this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as AutoCompleteProps;
94
+ // Set component specific properties
95
+ const { value, listType, parameters } = this.configProps$;
158
96
 
159
- if (this.configProps$.value != undefined) {
160
- const index = this.options$?.findIndex(element => element.key === this.configProps$.value);
161
- this.value$ = index > -1 ? this.options$[index].value : this.configProps$.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.setPropertyValuesFromProps();
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 value = event?.option?.value;
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
- const el = event?.target as HTMLInputElement;
332
- if (el?.value) {
333
- const index = this.options$?.findIndex(element => element.value === el.value);
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
- // look for validation messages for json, pre-defined or just an error pushed from workitem (400)
348
- if (this.fieldControl.hasError('message')) {
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 *ngIf="heading$ != ''">{{ heading$ }}</h3>
3
+ <h3>{{ localizedVal('Discard unsaved changes?', localeCategory) }}</h3>
4
4
  <div>
5
- <p>{{ body1$ }}</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
- <mat-grid-list cols="2" rowHeight="6.25rem">
9
- <mat-grid-tile>
10
- <button mat-raised-button color="secondary" (click)="buttonClick('save')">{{ localizedVal('Save for later', localeCategory) }}</button>
11
- </mat-grid-tile>
12
- <mat-grid-tile>
13
- <button mat-raised-button color="secondary" (click)="buttonClick('continue')">{{ localizedVal('Continue Working', localeCategory) }}</button>
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.heading$ = `Delete ${caseName} (${ID})`;
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
- dismissAlert() {
36
+ dismissAlertOnly() {
46
37
  this.bShowAlert$ = false;
47
38
  this.onAlertState$.emit(false);
48
39
  }
49
40
 
50
- dismissAlertOnly() {
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
- buttonClick(sAction) {
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 (sAction) {
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 'delete':
71
+ case 'discard':
84
72
  this.psService.sendMessage(true);
85
73
 
86
74
  // eslint-disable-next-line no-case-declarations
@@ -20,7 +20,6 @@
20
20
  <mat-checkbox
21
21
  [labelPosition]="'after'"
22
22
  [checked]="item.selected"
23
- [disabled]="bDisabled$ || bReadonly$"
24
23
  [required]="bRequired$"
25
24
  [attr.data-test-id]="testId + ':' + item.value"
26
25
  (change)="handleChangeMultiMode($event, item)"
@@ -11,7 +11,6 @@
11
11
  transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px);
12
12
  -ms-transform: translateY(-1.28125em) scale(0.75);
13
13
  width: 133.33333%;
14
- color: rgba(0, 0, 0, 0.6);
15
14
  }
16
15
 
17
16
  .psdk-data-readonly {