@pega/angular-sdk-overrides 0.23.10 → 0.23.12
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.
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Component, OnInit, Input, Output, EventEmitter, forwardRef, OnChanges } from '@angular/core';
|
|
1
|
+
import { Component, OnInit, Input, Output, EventEmitter, forwardRef, OnChanges, OnDestroy } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import { FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
4
4
|
import { ReferenceComponent } from '@pega/angular-sdk-components';
|
|
5
5
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
6
|
+
import { IdleDetectionService } from '@pega/angular-sdk-components';
|
|
7
|
+
import { ServerConfigService } from '@pega/angular-sdk-components';
|
|
6
8
|
|
|
7
9
|
@Component({
|
|
8
10
|
selector: 'app-assignment-card',
|
|
@@ -11,7 +13,7 @@ import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
|
11
13
|
standalone: true,
|
|
12
14
|
imports: [CommonModule, ReactiveFormsModule, forwardRef(() => ComponentMapperComponent)]
|
|
13
15
|
})
|
|
14
|
-
export class AssignmentCardComponent implements OnInit, OnChanges {
|
|
16
|
+
export class AssignmentCardComponent implements OnInit, OnChanges, OnDestroy {
|
|
15
17
|
@Input() pConn$: typeof PConnect;
|
|
16
18
|
@Input() formGroup$: FormGroup;
|
|
17
19
|
@Input() arMainButtons$: any[];
|
|
@@ -21,19 +23,44 @@ export class AssignmentCardComponent implements OnInit, OnChanges {
|
|
|
21
23
|
|
|
22
24
|
@Output() actionButtonClick: EventEmitter<any> = new EventEmitter();
|
|
23
25
|
|
|
26
|
+
constructor(
|
|
27
|
+
private idleService: IdleDetectionService,
|
|
28
|
+
private scservice: ServerConfigService
|
|
29
|
+
) {}
|
|
30
|
+
|
|
24
31
|
ngOnInit(): void {
|
|
25
|
-
// Children may contain 'reference' component, so we need to
|
|
26
|
-
// normalize them
|
|
32
|
+
// Children may contain 'reference' component, so we need to normalize them
|
|
27
33
|
this.arChildren$ = ReferenceComponent.normalizePConnArray(this.arChildren$);
|
|
34
|
+
|
|
35
|
+
this.checkAndEnableAutoSave();
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
ngOnChanges() {
|
|
31
|
-
// Children may contain 'reference' component, so we need to
|
|
32
|
-
// normalize them
|
|
39
|
+
// Children may contain 'reference' component, so we need to normalize them
|
|
33
40
|
this.arChildren$ = ReferenceComponent.normalizePConnArray(this.arChildren$);
|
|
34
41
|
}
|
|
35
42
|
|
|
43
|
+
ngOnDestroy() {
|
|
44
|
+
this.idleService.stopWatching();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async checkAndEnableAutoSave() {
|
|
48
|
+
const sdkConfig = await this.scservice.getSdkConfig();
|
|
49
|
+
const autoSave = sdkConfig.serverConfig.autoSave;
|
|
50
|
+
|
|
51
|
+
if (autoSave) {
|
|
52
|
+
this.idleService.startWatching(() => this.autoSave(), autoSave);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
36
56
|
onActionButtonClick(oData: any) {
|
|
37
57
|
this.actionButtonClick.emit(oData);
|
|
38
58
|
}
|
|
59
|
+
|
|
60
|
+
autoSave() {
|
|
61
|
+
const context = this.pConn$.getContextName();
|
|
62
|
+
if (PCore.getFormUtils().isStateModified(context)) {
|
|
63
|
+
this.pConn$.getActionsApi().saveAssignment(context);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
39
66
|
}
|
|
@@ -108,7 +108,7 @@ export class DefaultFormComponent implements OnInit, OnDestroy {
|
|
|
108
108
|
// normalize them
|
|
109
109
|
const children = ReferenceComponent.normalizePConnArray(kids[0].getPConnect().getChildren());
|
|
110
110
|
|
|
111
|
-
const visibleChildren = children
|
|
111
|
+
const visibleChildren = children?.filter(child => child !== undefined) || [];
|
|
112
112
|
|
|
113
113
|
if (areViewsChanged(this.arChildren$, visibleChildren)) {
|
|
114
114
|
this.arChildren$ = visibleChildren;
|
|
@@ -44,18 +44,19 @@ function getFieldWidth(field, label) {
|
|
|
44
44
|
export const getContext = thePConn => {
|
|
45
45
|
const contextName = thePConn.getContextName();
|
|
46
46
|
const pageReference = thePConn.getPageReference();
|
|
47
|
-
|
|
48
|
-
// not always in config of state props
|
|
49
|
-
let { referenceList } = thePConn.getStateProps()?.config || thePConn.getStateProps();
|
|
47
|
+
const { readonlyContextList, referenceList = readonlyContextList } = thePConn.getStateProps()?.config || thePConn.getStateProps();
|
|
50
48
|
const pageReferenceForRows = referenceList.startsWith('.') ? `${pageReference}.${referenceList.substring(1)}` : referenceList;
|
|
49
|
+
const viewName = thePConn.viewName;
|
|
51
50
|
|
|
52
51
|
// removing "caseInfo.content" prefix to avoid setting it as a target while preparing pageInstructions
|
|
53
|
-
|
|
52
|
+
// skipping the removal as StateMachine itself is removing this case info prefix while preparing pageInstructions
|
|
53
|
+
// referenceList = pageReferenceForRows.replace(PCore.getConstants().CASE_INFO.CASE_INFO_CONTENT, '');
|
|
54
54
|
|
|
55
55
|
return {
|
|
56
56
|
contextName,
|
|
57
57
|
referenceListStr: referenceList,
|
|
58
|
-
pageReferenceForRows
|
|
58
|
+
pageReferenceForRows,
|
|
59
|
+
viewName
|
|
59
60
|
};
|
|
60
61
|
};
|
|
61
62
|
|