@pega/angular-sdk-overrides 0.26.4 → 0.26.5
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/material-case-summary/material-case-summary.component.html +48 -42
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +12 -0
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +11 -0
- package/lib/designSystemExtension/operator/operator.component.html +5 -3
- package/lib/designSystemExtension/operator/operator.component.scss +7 -0
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.spec.ts +1 -1
- package/lib/field/dropdown/dropdown.component.ts +9 -4
- package/lib/field/multiselect/multiselect.component.html +1 -1
- package/lib/field/object-reference/object-reference.component.html +1 -1
- package/lib/field/object-reference/object-reference.component.ts +0 -1
- package/lib/field/rich-text/rich-text.component.spec.ts +1 -1
- package/lib/field/semantic-link/semantic-link.component.ts +4 -2
- package/lib/infra/assignment/assignment.component.ts +12 -2
- package/lib/infra/view/view.component.ts +2 -1
- package/lib/template/single-reference-readonly/single-reference-readonly.component.html +1 -1
- package/lib/template/single-reference-readonly/single-reference-readonly.component.scss +0 -1
- package/lib/template/single-reference-readonly/single-reference-readonly.component.ts +4 -5
- package/lib/widget/feed-container/feed-container.component.ts +0 -198
- package/package.json +1 -1
package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html
CHANGED
|
@@ -1,67 +1,73 @@
|
|
|
1
1
|
<div class="psdk-case-summary-fields">
|
|
2
2
|
<dl class="psdk-case-summary-fields-primary">
|
|
3
3
|
<div *ngFor="let field of primaryFieldsWithStatus$" class="psdk-csf-primary-field">
|
|
4
|
-
<dt
|
|
4
|
+
<dt
|
|
5
|
+
*ngIf="
|
|
6
|
+
field.type.toLowerCase() !== 'objectreference' && field.type.toLowerCase() !== 'reference' && field.type.toLowerCase() !== 'caseoperator'
|
|
7
|
+
"
|
|
8
|
+
class="psdk-csf-primary-field-header"
|
|
9
|
+
>
|
|
5
10
|
{{ field.config?.label }}
|
|
6
11
|
</dt>
|
|
7
|
-
<dd
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
<dd class="psdk-csf-primary-field-data" [ngSwitch]="field.type.toLowerCase()">
|
|
13
|
+
<span *ngSwitchCase="'textinput'" class="psdk-csf-text-style">{{ field.config.value || '---' }}</span>
|
|
14
|
+
<span *ngSwitchCase="'status'" class="psdk-csf-status-style">{{ field.config.value || '---' }}</span>
|
|
15
|
+
<a *ngSwitchCase="'phone'" class="psdk-primary-color" as="a" href="tel: {{ field.config.value }}">{{ field.config.value || '---' }}</a>
|
|
16
|
+
<a *ngSwitchCase="'email'" class="psdk-primary-color" href="mailto: {{ field.config.value }}">{{ field.config.value || '---' }}</a>
|
|
17
|
+
<span *ngSwitchCase="'date'" class="psdk-csf-text-style">{{ field.config.value || '---' }}</span>
|
|
18
|
+
<div class="psdk-case-summary-operator" *ngSwitchCase="'caseoperator'">
|
|
19
|
+
<component-mapper
|
|
20
|
+
name="Operator"
|
|
21
|
+
[props]="{ pConn$: field?.kid, displayLabel: field?.displayLabel || field?.config.displayLabel }"
|
|
22
|
+
></component-mapper>
|
|
23
|
+
</div>
|
|
24
|
+
<div *ngSwitchCase="'objectreference'">
|
|
25
|
+
<component-mapper name="ObjectReference" [props]="{ pConn$: field.kid }"></component-mapper>
|
|
26
|
+
</div>
|
|
27
|
+
<div *ngSwitchCase="'reference'" class="psdk-csf-object-reference-value">
|
|
28
|
+
<component-mapper name="reference" [props]="{ pConn$: field.kid }"></component-mapper>
|
|
29
|
+
</div>
|
|
30
|
+
<span *ngSwitchDefault class="psdk-csf-text-style">{{ field.config.value || '---' }}</span>
|
|
12
31
|
</dd>
|
|
13
|
-
<ng-template #hasValue>
|
|
14
|
-
<dd class="psdk-csf-primary-field-data" [ngSwitch]="field.type.toLowerCase()">
|
|
15
|
-
<span *ngSwitchCase="'textinput'" class="psdk-csf-text-style">{{ field.config.value }}</span>
|
|
16
|
-
<span *ngSwitchCase="'status'" class="psdk-csf-status-style">{{ field.config.value }}</span>
|
|
17
|
-
<a *ngSwitchCase="'phone'" class="psdk-primary-color" as="a" href="tel: {{ field.config.value }}">{{ field.config.value }}</a>
|
|
18
|
-
<a *ngSwitchCase="'email'" class="psdk-primary-color" href="mailto: {{ field.config.value }}">{{ field.config.value }}</a>
|
|
19
|
-
<span *ngSwitchCase="'date'" class="psdk-csf-text-style">{{ field.config.value }}</span>
|
|
20
|
-
<label *ngSwitchCase="'caseoperator'">operator</label>
|
|
21
|
-
<div *ngSwitchCase="'objectreference'" class="psdk-csf-object-reference-value">
|
|
22
|
-
<component-mapper name="ObjectReference" [props]="{ pConn$: field.kid, displayMode: 'DISPLAY_ONLY', hideLabel: true }"></component-mapper>
|
|
23
|
-
</div>
|
|
24
|
-
<span *ngSwitchDefault class="psdk-csf-text-style">{{ field.config.value }}</span>
|
|
25
|
-
</dd>
|
|
26
|
-
</ng-template>
|
|
27
32
|
</div>
|
|
28
33
|
</dl>
|
|
29
34
|
</div>
|
|
30
35
|
<div class="psdk-case-summary-fields">
|
|
31
36
|
<dl *ngFor="let field of secondaryFields$" class="psdk-case-summary-fields-secondary">
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
@if (
|
|
38
|
+
field?.config?.label?.toLowerCase() == 'create operator' ||
|
|
39
|
+
field?.displayLabel?.toLowerCase() == 'create operator' ||
|
|
40
|
+
field?.config?.label?.toLowerCase() == 'update operator' ||
|
|
41
|
+
field?.displayLabel?.toLowerCase() == 'update operator'
|
|
42
|
+
) {
|
|
43
|
+
<div>
|
|
44
|
+
<component-mapper
|
|
45
|
+
name="Operator"
|
|
46
|
+
[props]="{ pConn$: field?.kid, displayLabel: field?.displayLabel || field?.config.displayLabel }"
|
|
47
|
+
></component-mapper>
|
|
48
|
+
</div>
|
|
49
|
+
} @else if (field.type.toLowerCase() === 'objectreference') {
|
|
50
|
+
<div class="psdk-csf-object-reference-value">
|
|
51
|
+
<component-mapper name="ObjectReference" [props]="{ pConn$: field.kid, displayMode: 'DISPLAY_ONLY', hideLabel: true }"></component-mapper>
|
|
52
|
+
</div>
|
|
53
|
+
} @else if (field.type.toLowerCase() === 'reference') {
|
|
54
|
+
<div class="psdk-csf-object-reference-value">
|
|
55
|
+
<component-mapper name="reference" [props]="{ pConn$: field.kid }"></component-mapper>
|
|
56
|
+
</div>
|
|
57
|
+
} @else {
|
|
47
58
|
<div class="psdk-csf-secondary-field">
|
|
48
59
|
<dt class="psdk-csf-secondary-field-header">
|
|
49
60
|
{{ field.config?.displayLabel || field.config?.label }}
|
|
50
61
|
</dt>
|
|
62
|
+
|
|
51
63
|
<dd class="psdk-csf-secondary-field-data">
|
|
52
64
|
<div [ngSwitch]="field.type.toLowerCase()">
|
|
53
65
|
<label *ngSwitchCase="'userreference'" class="psdk-secondary-value">{{ field.config.value.userName || '---' }}</label>
|
|
54
66
|
<label *ngSwitchCase="'checkbox'" class="psdk-secondary-value">{{ field.config.falseLabel || '---' }}</label>
|
|
55
|
-
<div *ngSwitchCase="'objectreference'" class="psdk-csf-object-reference-value">
|
|
56
|
-
<component-mapper
|
|
57
|
-
name="ObjectReference"
|
|
58
|
-
[props]="{ pConn$: field.kid, displayMode: 'DISPLAY_ONLY', hideLabel: true }"
|
|
59
|
-
></component-mapper>
|
|
60
|
-
</div>
|
|
61
67
|
<label *ngSwitchDefault class="psdk-secondary-value">{{ field.config.value || '---' }}</label>
|
|
62
68
|
</div>
|
|
63
69
|
</dd>
|
|
64
70
|
</div>
|
|
65
|
-
|
|
71
|
+
}
|
|
66
72
|
</dl>
|
|
67
73
|
</div>
|
package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss
CHANGED
|
@@ -110,3 +110,15 @@ span.psdk-csf-status-style {
|
|
|
110
110
|
.psdk-primary-color {
|
|
111
111
|
color: var(--mat-sys-primary);
|
|
112
112
|
}
|
|
113
|
+
|
|
114
|
+
.psdk-case-summary-operator {
|
|
115
|
+
::ng-deep .psdk-operator {
|
|
116
|
+
flex-direction: column !important;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.psdk-csf-object-reference-value {
|
|
121
|
+
::ng-deep .psdk-grid-label {
|
|
122
|
+
font-size: 0.8125rem !important;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -53,6 +53,17 @@ export class MaterialCaseSummaryComponent implements OnInit, OnChanges {
|
|
|
53
53
|
case 'checkbox':
|
|
54
54
|
field.config.displayLabel = field.config.caption;
|
|
55
55
|
break;
|
|
56
|
+
case 'reference': {
|
|
57
|
+
const referenceLabel = field.kid.getInheritedProps()?.label;
|
|
58
|
+
if (referenceLabel) {
|
|
59
|
+
field.config.label = referenceLabel;
|
|
60
|
+
}
|
|
61
|
+
field.kid.setInheritedProp('displayMode', 'DISPLAY_ONLY');
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case 'objectreference':
|
|
65
|
+
field.kid.setInheritedProp('displayMode', 'DISPLAY_ONLY');
|
|
66
|
+
break;
|
|
56
67
|
default:
|
|
57
68
|
break;
|
|
58
69
|
}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
<div class="psdk-label">
|
|
3
3
|
{{ label$ }}
|
|
4
4
|
</div>
|
|
5
|
-
<div class="psdk-
|
|
6
|
-
<
|
|
5
|
+
<div class="psdk-operator-details">
|
|
6
|
+
<div class="psdk-double">
|
|
7
|
+
<button mat-button color="primary" style="text-decoration: underline" (click)="showOperator()">{{ name$ }}</button>
|
|
8
|
+
</div>
|
|
9
|
+
<div>{{ date$ }}</div>
|
|
7
10
|
</div>
|
|
8
|
-
<div>{{ date$ }}</div>
|
|
9
11
|
</div>
|
|
10
12
|
|
|
11
13
|
<div>
|
|
@@ -2,7 +2,7 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
|
2
2
|
|
|
3
3
|
import { RichTextEditorComponent } from './rich-text-editor.component';
|
|
4
4
|
|
|
5
|
-
describe('
|
|
5
|
+
describe('RichTextEditorComponent', () => {
|
|
6
6
|
let component: RichTextEditorComponent;
|
|
7
7
|
let fixture: ComponentFixture<RichTextEditorComponent>;
|
|
8
8
|
|
|
@@ -93,9 +93,9 @@ export class DropdownComponent extends FieldBase implements OnInit, OnDestroy {
|
|
|
93
93
|
set options(options: IOption[]) {
|
|
94
94
|
this.options$ = options;
|
|
95
95
|
if (this.displayMode$) {
|
|
96
|
-
this.value$ = this.options$?.find(option => option.key === this.value$)?.value || this.value$;
|
|
96
|
+
this.value$ = this.value$ === 'Select' ? '' : this.options$?.find(option => option.key === this.value$)?.value || this.value$;
|
|
97
97
|
this.localizedValue = this.pConn$.getLocalizedValue(
|
|
98
|
-
this.value
|
|
98
|
+
this.value$,
|
|
99
99
|
this.localePath,
|
|
100
100
|
this.pConn$.getLocaleRuleNameFromKeys(this.localeClass, this.localeContext, this.localeName)
|
|
101
101
|
);
|
|
@@ -136,7 +136,7 @@ export class DropdownComponent extends FieldBase implements OnInit, OnDestroy {
|
|
|
136
136
|
|
|
137
137
|
if (this.theDatasource) {
|
|
138
138
|
const optionsList = [...this.utils.getOptionList(this.configProps$, this.pConn$.getDataObject())];
|
|
139
|
-
optionsList?.unshift(
|
|
139
|
+
optionsList?.unshift(this.getPlaceholderOption());
|
|
140
140
|
this.options = optionsList;
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -224,12 +224,17 @@ export class DropdownComponent extends FieldBase implements OnInit, OnDestroy {
|
|
|
224
224
|
};
|
|
225
225
|
optionsData.push(obj);
|
|
226
226
|
});
|
|
227
|
-
optionsData?.unshift(
|
|
227
|
+
optionsData?.unshift(this.getPlaceholderOption());
|
|
228
228
|
this.options = optionsData;
|
|
229
229
|
});
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
// Uses the authored placeholder, falling back to 'Select...' when none is authored
|
|
234
|
+
private getPlaceholderOption(): IOption {
|
|
235
|
+
return { key: 'Select', value: this.pConn$.getLocalizedValue(this.placeholder || 'Select...', '', '') };
|
|
236
|
+
}
|
|
237
|
+
|
|
233
238
|
isSelected(buttonValue: string): boolean {
|
|
234
239
|
return this.value$ === buttonValue;
|
|
235
240
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div [formGroup]="formGroup$">
|
|
2
2
|
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic">
|
|
3
3
|
<mat-label>{{ label$ }}</mat-label>
|
|
4
|
-
<mat-chip-grid #chipGrid>
|
|
4
|
+
<mat-chip-grid #chipGrid [required]="bRequired$">
|
|
5
5
|
<ng-container *ngFor="let select of selectedItems">
|
|
6
6
|
<mat-chip-row (removed)="removeChip(select)">
|
|
7
7
|
{{ select.primary }}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<ng-container *ngIf="bVisible$" [ngSwitch]="renderMode">
|
|
2
2
|
<!-- SingleReferenceReadOnly mode -->
|
|
3
3
|
<div *ngSwitchCase="'singleReferenceReadonly'">
|
|
4
|
-
<component-mapper name="SingleReferenceReadOnly" [props]="{ pConn$,
|
|
4
|
+
<component-mapper name="SingleReferenceReadOnly" [props]="{ pConn$, dataRelationshipContext }"></component-mapper>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
<!-- MultiReferenceReadonly mode -->
|
|
@@ -46,7 +46,6 @@ type RenderMode = 'singleReferenceReadonly' | 'multiReferenceReadonly' | 'semant
|
|
|
46
46
|
export class ObjectReferenceComponent implements OnInit, OnDestroy {
|
|
47
47
|
@Input() pConn$: typeof PConnect;
|
|
48
48
|
@Input() formGroup$: FormGroup;
|
|
49
|
-
@Input() isDetails$ = false;
|
|
50
49
|
|
|
51
50
|
angularPConnectData: AngularPConnectData = {};
|
|
52
51
|
configProps: ObjectReferenceProps;
|
|
@@ -2,7 +2,7 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
|
2
2
|
|
|
3
3
|
import { RichTextComponent } from './rich-text.component';
|
|
4
4
|
|
|
5
|
-
describe('
|
|
5
|
+
describe('RichTextFieldComponent', () => {
|
|
6
6
|
let component: RichTextComponent;
|
|
7
7
|
let fixture: ComponentFixture<RichTextComponent>;
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, OnInit, Input, OnDestroy } from '@angular/core';
|
|
1
|
+
import { ChangeDetectorRef, Component, OnInit, Input, OnDestroy } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import { FormGroup } from '@angular/forms';
|
|
4
4
|
import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
|
|
@@ -46,7 +46,8 @@ export class SemanticLinkComponent implements OnInit, OnDestroy {
|
|
|
46
46
|
|
|
47
47
|
constructor(
|
|
48
48
|
private angularPConnect: AngularPConnectService,
|
|
49
|
-
private utils: Utils
|
|
49
|
+
private utils: Utils,
|
|
50
|
+
private cdr: ChangeDetectorRef
|
|
50
51
|
) {}
|
|
51
52
|
|
|
52
53
|
ngOnInit(): void {
|
|
@@ -81,6 +82,7 @@ export class SemanticLinkComponent implements OnInit, OnDestroy {
|
|
|
81
82
|
const isData = this.buildDataPayload();
|
|
82
83
|
this.linkURL = this.buildLinkURL(isData);
|
|
83
84
|
this.isLinkTextEmpty = isLinkTextEmpty(this.value$);
|
|
85
|
+
this.cdr.detectChanges();
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
showDataAction() {
|
|
@@ -100,6 +100,9 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
100
100
|
|
|
101
101
|
this.initComponent();
|
|
102
102
|
|
|
103
|
+
// ngOnChanges runs before ngOnInit, so updateChanges() never registers on first render.
|
|
104
|
+
this.registerForRefresh();
|
|
105
|
+
|
|
103
106
|
this.angularPConnect.shouldComponentUpdate(this);
|
|
104
107
|
|
|
105
108
|
this.bInitialized = true;
|
|
@@ -130,6 +133,9 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
130
133
|
// AND removing the "gate" that was put there since shouldComponentUpdate
|
|
131
134
|
// should be the real "gate"
|
|
132
135
|
if (bUpdateSelf) {
|
|
136
|
+
// The engine drops registrations when it cleans the context cache, so re-register on each update (as React does per render).
|
|
137
|
+
this.registerForRefresh();
|
|
138
|
+
|
|
133
139
|
let loadingInfo;
|
|
134
140
|
try {
|
|
135
141
|
// loadingInfo = this.pConn$.getLoadingStatus();
|
|
@@ -491,7 +497,11 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
491
497
|
}
|
|
492
498
|
|
|
493
499
|
registerForRefresh() {
|
|
494
|
-
const
|
|
500
|
+
const caseInfo = this.pConn$.getCaseInfo();
|
|
501
|
+
if (!caseInfo) {
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
const refreshConditions = caseInfo.getActionRefreshConditions();
|
|
495
505
|
const pageReference = this.pConn$.getPageReference();
|
|
496
506
|
const context = this.pConn$.getContextName();
|
|
497
507
|
|
|
@@ -500,7 +510,7 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
500
510
|
|
|
501
511
|
// refresh api registration
|
|
502
512
|
const refreshProps = getRefreshProps(refreshConditions);
|
|
503
|
-
const caseKey =
|
|
513
|
+
const caseKey = caseInfo.getKey();
|
|
504
514
|
const refreshOptions = {
|
|
505
515
|
autoDetectRefresh: true,
|
|
506
516
|
preserveClientChanges: false
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div [ngClass]="displayMode ? 'psdk-grid-display' : 'psdk-grid-nondisplay'"
|
|
1
|
+
<div [ngClass]="displayMode ? 'psdk-grid-display' : 'psdk-grid-nondisplay'">
|
|
2
2
|
<div *ngIf="label" class="psdk-grid-label">{{ label }}</div>
|
|
3
3
|
<component-mapper name="SemanticLink" [props]="{ pConn$: newPconn, formGroup$ }"></component-mapper>
|
|
4
4
|
</div>
|
|
@@ -15,7 +15,6 @@ export class SingleReferenceReadonlyComponent implements OnInit, OnDestroy {
|
|
|
15
15
|
@Input() pConn$: typeof PConnect;
|
|
16
16
|
@Input() formGroup$: FormGroup;
|
|
17
17
|
@Input() dataRelationshipContext: any = null;
|
|
18
|
-
@Input() isDetails$ = false;
|
|
19
18
|
|
|
20
19
|
angularPConnectData: AngularPConnectData = {};
|
|
21
20
|
configProps: any;
|
|
@@ -59,13 +58,13 @@ export class SingleReferenceReadonlyComponent implements OnInit, OnDestroy {
|
|
|
59
58
|
const rawViewMetadata = this.pConn$.getRawMetadata();
|
|
60
59
|
const label = this.configProps.label;
|
|
61
60
|
const showLabel = this.configProps.showLabel;
|
|
62
|
-
const
|
|
63
|
-
const
|
|
61
|
+
const inheritedProps = this.pConn$.getInheritedProps();
|
|
62
|
+
const propsToUse = { label: label || inheritedProps.label, showLabel: inheritedProps.showLabel || showLabel };
|
|
63
|
+
const type = (rawViewMetadata?.config as any)?.componentType ?? rawViewMetadata?.type;
|
|
64
64
|
this.displayMode = this.configProps.displayMode;
|
|
65
65
|
const targetObjectType = this.configProps.targetObjectType;
|
|
66
66
|
const referenceType = targetObjectType === 'case' ? 'Case' : 'Data';
|
|
67
67
|
const hideLabel = this.configProps.hideLabel;
|
|
68
|
-
// const additionalFields = this.configProps.additionalFields;
|
|
69
68
|
const displayAs = this.configProps.displayAs ?? 'readonly';
|
|
70
69
|
const dataRelationshipContext =
|
|
71
70
|
this.dataRelationshipContext ?? getDataRelationshipContextFromKey((rawViewMetadata?.config as any)?.displayField ?? '');
|
|
@@ -77,7 +76,7 @@ export class SingleReferenceReadonlyComponent implements OnInit, OnDestroy {
|
|
|
77
76
|
const editableComponents = ['AutoComplete', 'SimpleTableSelect', 'Dropdown', 'RadioButtons'];
|
|
78
77
|
const config: any = {
|
|
79
78
|
...rawViewMetadata?.config,
|
|
80
|
-
primaryField: (rawViewMetadata?.config as any)?.displayField,
|
|
79
|
+
primaryField: (rawViewMetadata?.config as any)?.displayField ?? (rawViewMetadata?.config as any)?.primaryField,
|
|
81
80
|
label: this.label
|
|
82
81
|
};
|
|
83
82
|
|
|
@@ -156,204 +156,6 @@ export class FeedContainerComponent implements OnInit, OnDestroy {
|
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
158
|
|
|
159
|
-
/*
|
|
160
|
-
|
|
161
|
-
const { getPConnect, messageIDs } = props;
|
|
162
|
-
const [mentionResults, setMentionResults] = useState([]);
|
|
163
|
-
const [tagResults, setTagResults] = useState([]);
|
|
164
|
-
const [attachments, setAttachments] = useState([]);
|
|
165
|
-
const [feedFilters, setFeedFilters] = useState();
|
|
166
|
-
const {
|
|
167
|
-
fetchMessages,
|
|
168
|
-
postMessage,
|
|
169
|
-
getMentionSuggestions,
|
|
170
|
-
getTagSuggestions
|
|
171
|
-
} = FeedApi(getPConnect());
|
|
172
|
-
const appName = PCore.getEnvironmentInfo().getApplicationName();
|
|
173
|
-
let value = "";
|
|
174
|
-
let feedID = "";
|
|
175
|
-
let feedClass = "";
|
|
176
|
-
if (getPConnect().getCaseSummary().ID) {
|
|
177
|
-
value = getPConnect().getCaseSummary().ID;
|
|
178
|
-
feedID = "pyCaseFeed";
|
|
179
|
-
feedClass = getPConnect().getCaseSummary().content.classID;
|
|
180
|
-
} else {
|
|
181
|
-
value = `DATA-PORTAL $${appName}`;
|
|
182
|
-
feedID = "pyDashboardFeed";
|
|
183
|
-
feedClass = "@baseclass";
|
|
184
|
-
}
|
|
185
|
-
// For cancelling fetchrequest for filetrs
|
|
186
|
-
const fetchMessagesCancelTokenSource = useRef([]);
|
|
187
|
-
|
|
188
|
-
useEffect(() => {
|
|
189
|
-
fetchMessages(
|
|
190
|
-
value,
|
|
191
|
-
feedID,
|
|
192
|
-
feedClass,
|
|
193
|
-
null,
|
|
194
|
-
fetchMessagesCancelTokenSource.current
|
|
195
|
-
).then((res) => {
|
|
196
|
-
setFeedFilters(res);
|
|
197
|
-
});
|
|
198
|
-
PCore.getAssetLoader().getLoader("component-loader")(["Activity"]);
|
|
199
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
200
|
-
}, []);
|
|
201
|
-
|
|
202
|
-
const onUploadProgress = useCallback((file) => {
|
|
203
|
-
return ({ loaded, total }) => {
|
|
204
|
-
file.progress = Math.floor((loaded / total) * 100);
|
|
205
|
-
setAttachments((current) => {
|
|
206
|
-
return current.map((currFile) => {
|
|
207
|
-
return currFile.name === file.name ? file : currFile;
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
};
|
|
211
|
-
}, []);
|
|
212
|
-
|
|
213
|
-
const errorHandler = useCallback((isFetchCanceled, file) => {
|
|
214
|
-
return (error) => {
|
|
215
|
-
if (!isFetchCanceled(error)) {
|
|
216
|
-
let localizedValue = "Upload failed";
|
|
217
|
-
if (
|
|
218
|
-
error.response &&
|
|
219
|
-
error.response.data &&
|
|
220
|
-
error.response.data.errorDetails
|
|
221
|
-
) {
|
|
222
|
-
localizedValue = error.response.data.errorDetails[0].localizedValue;
|
|
223
|
-
}
|
|
224
|
-
delete file.progress;
|
|
225
|
-
setAttachments((current) => {
|
|
226
|
-
return current.map((currFile) => {
|
|
227
|
-
if (currFile.name === file.name) {
|
|
228
|
-
currFile.meta = localizedValue;
|
|
229
|
-
currFile.error = true;
|
|
230
|
-
}
|
|
231
|
-
return currFile;
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
error.isHandled = true;
|
|
235
|
-
}
|
|
236
|
-
throw error;
|
|
237
|
-
};
|
|
238
|
-
}, []);
|
|
239
|
-
|
|
240
|
-
const postComment = ({ value: message, clear }) => {
|
|
241
|
-
const attachmentIDs = [];
|
|
242
|
-
const attachmentUtils = PCore.getAttachmentUtils();
|
|
243
|
-
if (attachments && !!attachments.length) {
|
|
244
|
-
attachments
|
|
245
|
-
.filter((file) => !file.error)
|
|
246
|
-
.map((file) => {
|
|
247
|
-
return attachmentUtils
|
|
248
|
-
.uploadAttachment(file, onUploadProgress, errorHandler)
|
|
249
|
-
.then((fileResponse) => {
|
|
250
|
-
const fileConfig = {
|
|
251
|
-
type: "File",
|
|
252
|
-
category: "File",
|
|
253
|
-
fileName: file.name,
|
|
254
|
-
ID: fileResponse.data.ID
|
|
255
|
-
};
|
|
256
|
-
attachmentIDs.push(fileConfig);
|
|
257
|
-
if (attachments.length === attachmentIDs.length) {
|
|
258
|
-
postMessage(
|
|
259
|
-
value,
|
|
260
|
-
transformMarkdownToMsg(message),
|
|
261
|
-
attachmentIDs
|
|
262
|
-
);
|
|
263
|
-
clear();
|
|
264
|
-
setAttachments([]);
|
|
265
|
-
}
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
.catch(console.error);
|
|
269
|
-
});
|
|
270
|
-
} else {
|
|
271
|
-
postMessage(value, transformMarkdownToMsg(message));
|
|
272
|
-
clear();
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
*/
|
|
277
|
-
|
|
278
|
-
/* On search is called when @ character is entered and will display the mention */
|
|
279
|
-
|
|
280
|
-
/*
|
|
281
|
-
const onSearch = debounce((event) => {
|
|
282
|
-
if (event.type === "mention") {
|
|
283
|
-
getMentionSuggestions({
|
|
284
|
-
pulseContext: value,
|
|
285
|
-
searchFor: event.search
|
|
286
|
-
}).then((res) => {
|
|
287
|
-
setMentionResults(res);
|
|
288
|
-
});
|
|
289
|
-
} else {
|
|
290
|
-
getTagSuggestions({
|
|
291
|
-
searchFor: event.search
|
|
292
|
-
}).then((res) => {
|
|
293
|
-
setTagResults(res);
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
}, 150);
|
|
297
|
-
|
|
298
|
-
const userName = getPConnect().getEnvironmentInfo().getOperatorName();
|
|
299
|
-
const imageKey = getPConnect().getEnvironmentInfo().getOperatorImageInsKey();
|
|
300
|
-
|
|
301
|
-
const onFilesAdded = useCallback((newlyAddedFiles) => {
|
|
302
|
-
setAttachments((current) => [
|
|
303
|
-
...newlyAddedFiles.map((file) => {
|
|
304
|
-
if (!validateMaxSize(file, 5)) {
|
|
305
|
-
file.error = true;
|
|
306
|
-
file.meta = "File is too big. Max allowed size is 5MB.";
|
|
307
|
-
}
|
|
308
|
-
file.icon = getIconFromFileType(file.type);
|
|
309
|
-
file.onDelete = () => {
|
|
310
|
-
setAttachments((c) => c.filter((f) => f.name !== file.name));
|
|
311
|
-
};
|
|
312
|
-
return file;
|
|
313
|
-
}),
|
|
314
|
-
...current
|
|
315
|
-
]);
|
|
316
|
-
}, []);
|
|
317
|
-
|
|
318
|
-
const onFilterChange = useCallback(
|
|
319
|
-
(filterID) => {
|
|
320
|
-
const updatedFilters = [...feedFilters];
|
|
321
|
-
const filterToUpdate = updatedFilters.find(
|
|
322
|
-
(feedItem) => feedItem.id === filterID
|
|
323
|
-
);
|
|
324
|
-
filterToUpdate.on = !filterToUpdate.on;
|
|
325
|
-
if (filterID === "All")
|
|
326
|
-
updatedFilters.forEach((feedFilter) => {
|
|
327
|
-
feedFilter.on = filterToUpdate.on;
|
|
328
|
-
});
|
|
329
|
-
else if (
|
|
330
|
-
updatedFilters.find(
|
|
331
|
-
(feedItem) => feedItem.on === false && feedItem.id !== "All"
|
|
332
|
-
)
|
|
333
|
-
)
|
|
334
|
-
updatedFilters.find((feedItem) => feedItem.id === "All").on = false;
|
|
335
|
-
else updatedFilters.find((feedItem) => feedItem.id === "All").on = true;
|
|
336
|
-
setFeedFilters(updatedFilters);
|
|
337
|
-
fetchMessages(
|
|
338
|
-
value,
|
|
339
|
-
feedID,
|
|
340
|
-
feedClass,
|
|
341
|
-
feedFilters,
|
|
342
|
-
fetchMessagesCancelTokenSource.current
|
|
343
|
-
);
|
|
344
|
-
},
|
|
345
|
-
[
|
|
346
|
-
value,
|
|
347
|
-
feedID,
|
|
348
|
-
feedClass,
|
|
349
|
-
feedFilters,
|
|
350
|
-
fetchMessagesCancelTokenSource,
|
|
351
|
-
fetchMessages
|
|
352
|
-
]
|
|
353
|
-
);
|
|
354
|
-
|
|
355
|
-
*/
|
|
356
|
-
|
|
357
159
|
// set up svg images
|
|
358
160
|
this.svgComment$ = this.utils.getImageSrc('chat', this.utils.getSDKStaticContentUrl());
|
|
359
161
|
this.svgLike$ = this.utils.getImageSrc('thumbs-up', this.utils.getSDKStaticContentUrl());
|