@pega/angular-sdk-overrides 25.1.12 → 26.1.10
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.html +4 -1
- package/lib/designSystemExtension/alert/alert.component.scss +9 -10
- package/lib/designSystemExtension/alert/alert.component.ts +6 -2
- package/lib/designSystemExtension/field-group/field-group.component.ts +11 -3
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +51 -36
- 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/operator/operator.component.ts +2 -1
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.html +100 -10
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.scss +141 -1
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.spec.ts +1 -1
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.ts +240 -72
- package/lib/field/auto-complete/auto-complete.component.html +46 -5
- package/lib/field/auto-complete/auto-complete.component.scss +92 -0
- package/lib/field/auto-complete/auto-complete.component.ts +350 -23
- package/lib/field/cancel-alert/cancel-alert.component.ts +38 -15
- package/lib/field/check-box/check-box.component.html +8 -6
- package/lib/field/check-box/check-box.component.ts +9 -2
- package/lib/field/currency/currency.component.html +2 -1
- package/lib/field/currency/currency.component.ts +10 -1
- package/lib/field/date/date.component.html +2 -1
- package/lib/field/date/date.component.ts +2 -0
- package/lib/field/date-time/date-time.component.html +2 -1
- package/lib/field/date-time/date-time.component.scss +46 -40
- package/lib/field/date-time/date-time.component.ts +29 -0
- package/lib/field/decimal/decimal.component.html +2 -1
- package/lib/field/decimal/decimal.component.ts +2 -0
- package/lib/field/dropdown/dropdown.component.html +4 -1
- package/lib/field/dropdown/dropdown.component.ts +18 -19
- package/lib/field/email/email.component.html +2 -1
- package/lib/field/email/email.component.ts +2 -2
- package/lib/field/embedded-data-multi/embedded-data-multi.component.html +3 -0
- package/lib/field/embedded-data-multi/embedded-data-multi.component.scss +0 -0
- package/lib/field/embedded-data-multi/embedded-data-multi.component.ts +173 -0
- package/lib/field/field.base.ts +27 -1
- package/lib/field/group/group.component.html +1 -1
- package/lib/field/group/group.component.ts +16 -7
- package/lib/field/integer/integer.component.html +2 -1
- package/lib/field/integer/integer.component.ts +4 -2
- package/lib/field/location/location.component.html +2 -1
- package/lib/field/location/location.component.ts +3 -1
- package/lib/field/multiselect/multiselect.component.html +1 -1
- package/lib/field/multiselect/multiselect.component.ts +23 -4
- package/lib/field/multiselect/utils.ts +5 -3
- package/lib/field/object-reference/object-reference.component.html +30 -15
- package/lib/field/object-reference/object-reference.component.ts +818 -94
- package/lib/field/percentage/percentage.component.html +2 -1
- package/lib/field/percentage/percentage.component.ts +10 -1
- package/lib/field/phone/phone.component.html +2 -1
- package/lib/field/phone/phone.component.ts +2 -1
- package/lib/field/radio-buttons/radio-buttons.component.html +2 -1
- package/lib/field/radio-buttons/radio-buttons.component.ts +10 -1
- package/lib/field/rich-text/rich-text.component.scss +1 -166
- package/lib/field/rich-text/rich-text.component.spec.ts +1 -1
- package/lib/field/rich-text/rich-text.component.ts +1 -1
- package/lib/field/selectable-card/selectable-card.component.html +1 -0
- package/lib/field/selectable-card/selectable-card.component.ts +31 -16
- package/lib/field/semantic-link/semantic-link.component.html +1 -1
- package/lib/field/semantic-link/semantic-link.component.scss +4 -0
- package/lib/field/semantic-link/semantic-link.component.ts +13 -7
- package/lib/field/text-area/text-area.component.html +2 -1
- package/lib/field/text-area/text-area.component.ts +2 -1
- package/lib/field/text-input/text-input.component.html +2 -1
- package/lib/field/text-input/text-input.component.ts +2 -1
- package/lib/field/time/time.component.html +2 -1
- package/lib/field/time/time.component.ts +2 -1
- package/lib/field/url/url.component.html +2 -1
- package/lib/field/url/url.component.ts +2 -1
- package/lib/field/user-reference/user-reference.component.html +4 -2
- package/lib/field/user-reference/user-reference.component.ts +11 -6
- package/lib/infra/Containers/flow-container/flow-container.component.html +2 -2
- package/lib/infra/Containers/flow-container/flow-container.component.ts +34 -42
- package/lib/infra/Containers/modal-view-container/data-view-action-buttons/data-view-action-buttons.component.html +12 -0
- package/lib/infra/Containers/modal-view-container/data-view-action-buttons/data-view-action-buttons.component.spec.ts +130 -0
- package/lib/infra/Containers/modal-view-container/data-view-action-buttons/data-view-action-buttons.component.ts +77 -0
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +35 -8
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +185 -196
- package/lib/infra/Containers/view-container/view-container.component.html +1 -1
- package/lib/infra/Containers/view-container/view-container.component.ts +36 -43
- package/lib/infra/assignment/assignment.component.html +2 -1
- package/lib/infra/assignment/assignment.component.ts +44 -22
- package/lib/infra/assignment-card/assignment-card.component.html +1 -0
- package/lib/infra/assignment-card/assignment-card.component.ts +2 -8
- package/lib/infra/defer-load/defer-load.component.ts +7 -5
- package/lib/infra/multi-step/multi-step.component.html +25 -33
- package/lib/infra/multi-step/multi-step.component.scss +67 -125
- package/lib/infra/multi-step/multi-step.component.ts +11 -0
- package/lib/infra/navbar/navbar.component.ts +33 -36
- package/lib/infra/reference/reference.component.html +7 -1
- package/lib/infra/reference/reference.component.ts +63 -109
- package/lib/infra/region/region.component.ts +1 -3
- package/lib/infra/root-container/root-container.component.html +1 -0
- package/lib/infra/root-container/root-container.component.ts +34 -42
- package/lib/infra/view/view.component.ts +22 -46
- package/lib/template/advanced-search/advanced-search.component.ts +0 -1
- package/lib/template/advanced-search/search-groups/search-groups.component.ts +2 -3
- package/lib/template/app-shell/app-shell.component.ts +13 -13
- package/lib/template/banner-page/banner-page.component.ts +1 -2
- package/lib/template/base/details-template-base.ts +41 -14
- package/lib/template/base/form-template-base.ts +0 -2
- package/lib/template/case-summary/case-summary.component.ts +15 -7
- package/lib/template/case-view/case-view.component.html +14 -2
- package/lib/template/case-view/case-view.component.spec.ts +119 -10
- package/lib/template/case-view/case-view.component.ts +52 -3
- package/lib/template/data-reference/data-reference.component.ts +29 -22
- package/lib/template/data-reference/search-form/search-form.component.html +1 -1
- package/lib/template/data-reference/search-form/search-form.component.ts +9 -1
- package/lib/template/data-reference/search-form/tabsData.ts +0 -1
- package/lib/template/default-form/default-form.component.html +20 -4
- package/lib/template/default-form/default-form.component.ts +14 -5
- package/lib/template/default-page/default-page.component.ts +1 -2
- package/lib/template/details/details.component.html +23 -3
- package/lib/template/details/details.component.scss +9 -2
- package/lib/template/details/details.component.ts +3 -70
- package/lib/template/details-narrow-wide/details-narrow-wide.component.html +21 -2
- package/lib/template/details-narrow-wide/details-narrow-wide.component.scss +8 -1
- package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +3 -39
- package/lib/template/details-one-column/details-one-column.component.html +23 -1
- package/lib/template/details-one-column/details-one-column.component.scss +14 -0
- package/lib/template/details-one-column/details-one-column.component.ts +3 -40
- package/lib/template/details-three-column/details-three-column.component.html +21 -2
- package/lib/template/details-three-column/details-three-column.component.scss +8 -1
- package/lib/template/details-three-column/details-three-column.component.ts +3 -48
- package/lib/template/details-two-column/details-two-column.component.html +21 -2
- package/lib/template/details-two-column/details-two-column.component.scss +8 -1
- package/lib/template/details-two-column/details-two-column.component.ts +3 -46
- package/lib/template/details-wide-narrow/details-wide-narrow.component.html +21 -2
- package/lib/template/details-wide-narrow/details-wide-narrow.component.scss +8 -1
- package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +3 -43
- package/lib/template/dynamic-tabs/dynamic-tabs.component.html +1 -0
- package/lib/template/field-group-template/field-group-template.component.ts +19 -6
- package/lib/template/field-value-list/field-value-list.component.scss +17 -0
- package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +2 -10
- package/lib/template/list-view/list-view.component.ts +47 -11
- package/lib/template/one-column/one-column.component.html +3 -0
- package/lib/template/one-column-tab/one-column-tab.component.html +1 -0
- package/lib/template/page/page.component.html +1 -0
- package/lib/template/self-service-case-view/self-service-case-view.component.html +13 -1
- package/lib/template/self-service-case-view/self-service-case-view.component.spec.ts +96 -11
- package/lib/template/self-service-case-view/self-service-case-view.component.ts +52 -3
- package/lib/template/simple-table/simple-table.component.ts +11 -1
- package/lib/template/simple-table-manual/helpers.ts +84 -16
- package/lib/template/simple-table-manual/simple-table-manual.component.html +30 -14
- package/lib/template/simple-table-manual/simple-table-manual.component.scss +8 -2
- package/lib/template/simple-table-manual/simple-table-manual.component.ts +142 -46
- package/lib/template/single-reference-readonly/single-reference-readonly.component.html +0 -0
- package/lib/template/single-reference-readonly/single-reference-readonly.component.scss +2 -3
- package/lib/template/single-reference-readonly/single-reference-readonly.component.ts +7 -8
- package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +0 -3
- package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +19 -21
- package/lib/widget/attachment/AttachmentUtils.ts +19 -11
- package/lib/widget/attachment/attachment.component.html +16 -6
- package/lib/widget/attachment/attachment.component.ts +14 -4
- package/lib/widget/case-history/case-history.component.ts +6 -2
- package/lib/widget/feed-container/feed-container.component.ts +1 -199
- package/lib/widget/file-utility/file-utility.component.ts +26 -30
- package/lib/widget/todo/todo.component.ts +7 -2
- package/package.json +2 -2
- package/lib/designSystemExtension/material-details/material-details.component.html +0 -40
- package/lib/designSystemExtension/material-details/material-details.component.scss +0 -116
- package/lib/designSystemExtension/material-details/material-details.component.spec.ts +0 -24
- package/lib/designSystemExtension/material-details/material-details.component.ts +0 -31
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +0 -29
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.scss +0 -34
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.spec.ts +0 -22
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +0 -37
|
@@ -4,7 +4,19 @@ import { FormGroup } from '@angular/forms';
|
|
|
4
4
|
import { ComponentMetadataConfig } from '@pega/pcore-pconnect-typedefs/interpreter/types';
|
|
5
5
|
import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
|
|
6
6
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
SELECTION_MODE,
|
|
9
|
+
SIMPLE_TABLE_MANUAL_READONLY,
|
|
10
|
+
generateColumns,
|
|
11
|
+
addCompositeKeysToConfig,
|
|
12
|
+
getDataRelationshipContextFromKey,
|
|
13
|
+
generateDetailsDisplay,
|
|
14
|
+
createNewRecord,
|
|
15
|
+
getAdditionalInfo,
|
|
16
|
+
camelCase
|
|
17
|
+
} from '@pega/angular-sdk-components';
|
|
18
|
+
import { componentCachePersistUtils, getMappedKey } from '@pega/angular-sdk-components';
|
|
19
|
+
import { DataReferenceAdvancedSearchService } from '@pega/angular-sdk-components';
|
|
8
20
|
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
9
21
|
|
|
10
22
|
interface ObjectReferenceProps extends PConnFieldProps {
|
|
@@ -14,8 +26,17 @@ interface ObjectReferenceProps extends PConnFieldProps {
|
|
|
14
26
|
mode: string;
|
|
15
27
|
targetObjectType: any;
|
|
16
28
|
allowAndPersistChangesInReviewMode: boolean;
|
|
29
|
+
allowCreatingRecords?: boolean;
|
|
30
|
+
linkReference?: boolean;
|
|
31
|
+
matchPosition?: string;
|
|
32
|
+
additionalFields?: any;
|
|
17
33
|
}
|
|
18
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Rendering modes for the template
|
|
37
|
+
*/
|
|
38
|
+
type RenderMode = 'singleReferenceReadonly' | 'multiReferenceReadonly' | 'semanticLink' | 'searchAndSelect' | 'dynamicComponent';
|
|
39
|
+
|
|
19
40
|
@Component({
|
|
20
41
|
selector: 'app-object-reference',
|
|
21
42
|
imports: [CommonModule, forwardRef(() => ComponentMapperComponent)],
|
|
@@ -28,17 +49,34 @@ export class ObjectReferenceComponent implements OnInit, OnDestroy {
|
|
|
28
49
|
|
|
29
50
|
angularPConnectData: AngularPConnectData = {};
|
|
30
51
|
configProps: ObjectReferenceProps;
|
|
31
|
-
value: { [key: string]: any };
|
|
32
52
|
readOnly: boolean;
|
|
33
|
-
isForm: boolean;
|
|
34
53
|
type: string;
|
|
35
54
|
isDisplayModeEnabled: boolean;
|
|
36
55
|
canBeChangedInReviewMode: boolean;
|
|
37
56
|
newComponentName: string;
|
|
38
57
|
newPconn: typeof PConnect;
|
|
39
58
|
rawViewMetadata: ComponentMetadataConfig | undefined;
|
|
59
|
+
dataRelationshipContext: string | null = null;
|
|
60
|
+
|
|
61
|
+
// Rendering mode
|
|
62
|
+
renderMode: RenderMode = 'dynamicComponent';
|
|
63
|
+
|
|
64
|
+
// Whether the dynamic component supports @Output() onRecordChange binding
|
|
65
|
+
useOutputEvents = false;
|
|
66
|
+
|
|
67
|
+
// Visibility flag — prevents rendering when platform sets visibility to false
|
|
68
|
+
bVisible$ = true;
|
|
69
|
+
|
|
70
|
+
// For SearchAndSelect
|
|
71
|
+
searchSelectCacheKey: string;
|
|
72
|
+
|
|
73
|
+
// For parameterized CheckboxGroup datasource
|
|
74
|
+
parameterizedDataSource: any[] = [];
|
|
40
75
|
|
|
41
|
-
constructor(
|
|
76
|
+
constructor(
|
|
77
|
+
private angularPConnect: AngularPConnectService,
|
|
78
|
+
private dataRefAdvancedSearchService: DataReferenceAdvancedSearchService
|
|
79
|
+
) {}
|
|
42
80
|
|
|
43
81
|
ngOnInit() {
|
|
44
82
|
this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
|
|
@@ -63,85 +101,263 @@ export class ObjectReferenceComponent implements OnInit, OnDestroy {
|
|
|
63
101
|
}
|
|
64
102
|
|
|
65
103
|
updateSelf() {
|
|
104
|
+
this.useOutputEvents = false;
|
|
66
105
|
this.configProps = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as ObjectReferenceProps;
|
|
106
|
+
|
|
107
|
+
const { visibility = true } = this.configProps;
|
|
108
|
+
this.bVisible$ = visibility !== false;
|
|
67
109
|
const {
|
|
68
|
-
displayMode,
|
|
69
110
|
allowAndPersistChangesInReviewMode: editableInReview = false,
|
|
111
|
+
allowCreatingRecords,
|
|
70
112
|
targetObjectType,
|
|
71
|
-
mode,
|
|
113
|
+
mode = '',
|
|
72
114
|
parameters,
|
|
73
|
-
hideLabel,
|
|
74
|
-
inline,
|
|
75
|
-
showPromotedFilters
|
|
115
|
+
hideLabel = false,
|
|
116
|
+
inline = false,
|
|
117
|
+
showPromotedFilters = false,
|
|
118
|
+
linkReference,
|
|
119
|
+
matchPosition = 'contains'
|
|
76
120
|
} = this.configProps;
|
|
77
121
|
|
|
78
|
-
|
|
122
|
+
let displayMode = this.configProps.displayMode ?? '';
|
|
123
|
+
|
|
124
|
+
const referenceType: string = targetObjectType?.toLowerCase() === 'case' ? 'Case' : 'Data';
|
|
79
125
|
this.rawViewMetadata = this.pConn$.getRawMetadata();
|
|
80
|
-
const
|
|
81
|
-
|
|
126
|
+
const rawConfig = this.rawViewMetadata?.config as any;
|
|
127
|
+
|
|
128
|
+
const refFieldMetadata = this.pConn$.getFieldMetadata(
|
|
129
|
+
rawConfig?.mode === SELECTION_MODE.SINGLE ? rawConfig?.value?.split('.', 2)[1] : rawConfig?.pagelistValue?.substring(4)
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const propsToUse: any = { ...this.pConn$.getInheritedProps(), ...this.configProps };
|
|
133
|
+
if (!propsToUse.label) {
|
|
134
|
+
propsToUse.label = this.configProps.label;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
this.normalizeComboboxType(rawConfig, mode);
|
|
138
|
+
|
|
139
|
+
if (rawConfig?.parameters && ['CheckboxGroup'].includes(rawConfig.componentType)) {
|
|
140
|
+
this.loadParameterizedDataSource(rawConfig, parameters ?? {});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
displayMode = this.resolveDisplayMode(rawConfig, displayMode, mode);
|
|
82
144
|
|
|
83
145
|
this.isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY';
|
|
84
|
-
this.type =
|
|
85
|
-
this.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
...this.rawViewMetadata?.config,
|
|
90
|
-
primaryField: (this.rawViewMetadata?.config as any).displayField,
|
|
91
|
-
caseClass: (this.rawViewMetadata?.config as any).targetObjectClass,
|
|
92
|
-
text: (this.rawViewMetadata?.config as any).displayField,
|
|
93
|
-
caseID: (this.rawViewMetadata?.config as any).value,
|
|
94
|
-
contextPage: `@P .${(this.rawViewMetadata?.config as any).displayField ? getDataRelationshipContextFromKey((this.rawViewMetadata?.config as any).displayField) : null}`,
|
|
95
|
-
resourceParams: { workID: (this.rawViewMetadata?.config as any).value },
|
|
96
|
-
resourcePayload: { caseClassName: (this.rawViewMetadata?.config as any).targetObjectClass }
|
|
97
|
-
};
|
|
98
|
-
this.createSemanticLinkPConnect(config, displayMode ?? '', referenceType, hideLabel);
|
|
146
|
+
this.type = rawConfig?.componentType;
|
|
147
|
+
this.dataRelationshipContext = rawConfig?.displayField ? getDataRelationshipContextFromKey(rawConfig.displayField) : null;
|
|
148
|
+
this.canBeChangedInReviewMode = editableInReview && ['AutoComplete', 'Dropdown'].includes(this.type);
|
|
149
|
+
|
|
150
|
+
if (this.handleReadOnlyMode(rawConfig, mode)) {
|
|
99
151
|
return;
|
|
100
152
|
}
|
|
101
153
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
154
|
+
this.routeToEditableComponent(
|
|
155
|
+
rawConfig,
|
|
156
|
+
mode,
|
|
157
|
+
refFieldMetadata,
|
|
158
|
+
propsToUse,
|
|
159
|
+
referenceType,
|
|
160
|
+
displayMode,
|
|
161
|
+
parameters,
|
|
162
|
+
hideLabel,
|
|
163
|
+
inline,
|
|
164
|
+
showPromotedFilters,
|
|
165
|
+
matchPosition,
|
|
166
|
+
linkReference,
|
|
167
|
+
targetObjectType,
|
|
168
|
+
allowCreatingRecords
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
private normalizeComboboxType(rawConfig: any, mode: string): void {
|
|
173
|
+
if (rawConfig?.componentType === 'Combobox') {
|
|
174
|
+
rawConfig.componentType = mode === SELECTION_MODE.MULTI ? 'Multiselect' : 'AutoComplete';
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private resolveDisplayMode(rawConfig: any, displayMode: string, mode: string): string {
|
|
179
|
+
if (displayMode === 'DISPLAY_ONLY' || !this.configProps.readOnly) {
|
|
180
|
+
return displayMode;
|
|
181
|
+
}
|
|
182
|
+
if (rawConfig?.componentType === 'Multiselect') {
|
|
183
|
+
rawConfig.componentType = 'SemanticLink';
|
|
184
|
+
return displayMode;
|
|
185
|
+
}
|
|
186
|
+
if (mode === 'readonly-single') {
|
|
187
|
+
return this.configProps.displayMode ?? displayMode;
|
|
188
|
+
}
|
|
189
|
+
return 'DISPLAY_ONLY';
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private handleReadOnlyMode(rawConfig: any, mode: string): boolean {
|
|
193
|
+
const isReadOnlyOrSemanticLink = (this.configProps.readOnly || this.type === 'SemanticLink') && !this.canBeChangedInReviewMode;
|
|
194
|
+
if (isReadOnlyOrSemanticLink) {
|
|
195
|
+
if (mode !== 'readonly-multi') {
|
|
196
|
+
this.buildSingleReferenceReadonly(rawConfig);
|
|
197
|
+
} else {
|
|
198
|
+
this.buildMultiReferenceReadonly();
|
|
113
199
|
}
|
|
114
|
-
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
if (this.isDisplayModeEnabled && !this.canBeChangedInReviewMode) {
|
|
203
|
+
this.buildSingleReferenceReadonly(rawConfig);
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
115
208
|
|
|
116
|
-
|
|
209
|
+
private resolveCreatePermissions(rawConfig: any, allowCreatingRecords: boolean | undefined) {
|
|
210
|
+
const { disableStartingFieldsForReference = false } = (PCore as any).getEnvironmentInfo().environmentInfoObject?.features?.form || {};
|
|
211
|
+
const contextClass = rawConfig.targetObjectClass;
|
|
212
|
+
const formFeaturesAvailable = (PCore as any).getEnvironmentInfo().environmentInfoObject?.features?.form;
|
|
213
|
+
const createAuthoringEnabled = allowCreatingRecords ?? formFeaturesAvailable?.isCreateNewReferenceEnabled;
|
|
214
|
+
const userHasCreateAccess = formFeaturesAvailable
|
|
215
|
+
? formFeaturesAvailable.isCreateNewReferenceEnabled && PCore.getAccessPrivilege().hasCreateAccess(contextClass)
|
|
216
|
+
: PCore.getAccessPrivilege().hasCreateAccess(contextClass);
|
|
217
|
+
return {
|
|
218
|
+
isCreateNewReferenceEnabled: createAuthoringEnabled && userHasCreateAccess,
|
|
219
|
+
disableStartingFieldsForReference,
|
|
220
|
+
contextClass
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
private routeToEditableComponent(
|
|
225
|
+
rawConfig: any,
|
|
226
|
+
mode: string,
|
|
227
|
+
refFieldMetadata: any,
|
|
228
|
+
propsToUse: any,
|
|
229
|
+
referenceType: string,
|
|
230
|
+
displayMode: string,
|
|
231
|
+
parameters: any,
|
|
232
|
+
hideLabel: boolean,
|
|
233
|
+
inline: boolean,
|
|
234
|
+
showPromotedFilters: boolean,
|
|
235
|
+
matchPosition: string,
|
|
236
|
+
linkReference: any,
|
|
237
|
+
targetObjectType: any,
|
|
238
|
+
allowCreatingRecords: boolean | undefined
|
|
239
|
+
): void {
|
|
240
|
+
if (this.type === 'EmbeddedInsightTable') {
|
|
241
|
+
this.buildEmbeddedInsightTableChild(rawConfig, referenceType, propsToUse);
|
|
242
|
+
this.renderMode = 'dynamicComponent';
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (this.type === 'Cards') {
|
|
246
|
+
this.buildCardsChild(rawConfig);
|
|
247
|
+
this.renderMode = 'dynamicComponent';
|
|
248
|
+
return;
|
|
117
249
|
}
|
|
250
|
+
if (this.type === 'Map') {
|
|
251
|
+
this.buildMapChild(rawConfig, targetObjectType);
|
|
252
|
+
this.renderMode = 'dynamicComponent';
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (this.type === 'CheckboxGroup') {
|
|
256
|
+
this.buildCheckboxGroupChild(rawConfig, mode, refFieldMetadata, propsToUse, hideLabel);
|
|
257
|
+
this.renderMode = 'dynamicComponent';
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (this.type === 'Table' || this.type === 'SimpleTable') {
|
|
261
|
+
this.buildTableChild(this.type, rawConfig, mode, referenceType, propsToUse);
|
|
262
|
+
this.renderMode = 'dynamicComponent';
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
generateColumns(rawConfig, this.pConn$, referenceType);
|
|
267
|
+
addCompositeKeysToConfig(rawConfig, this.pConn$);
|
|
268
|
+
rawConfig.deferDatasource = true;
|
|
269
|
+
rawConfig.listType = 'datapage';
|
|
270
|
+
if (['Dropdown', 'AutoComplete'].includes(this.type) && !rawConfig.placeholder) {
|
|
271
|
+
rawConfig.placeholder = '@L Select...';
|
|
272
|
+
}
|
|
273
|
+
rawConfig.showPromotedFilters = showPromotedFilters;
|
|
274
|
+
if (!this.canBeChangedInReviewMode) {
|
|
275
|
+
rawConfig.displayMode = displayMode;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const fieldMetaData = this.buildFieldMetaData(rawConfig, parameters);
|
|
279
|
+
const { isCreateNewReferenceEnabled, disableStartingFieldsForReference, contextClass } = this.resolveCreatePermissions(
|
|
280
|
+
rawConfig,
|
|
281
|
+
allowCreatingRecords
|
|
282
|
+
);
|
|
283
|
+
|
|
284
|
+
if (this.type === 'SearchAndSelect') {
|
|
285
|
+
this.buildSearchAndSelectChild(
|
|
286
|
+
rawConfig,
|
|
287
|
+
refFieldMetadata,
|
|
288
|
+
propsToUse,
|
|
289
|
+
referenceType,
|
|
290
|
+
hideLabel,
|
|
291
|
+
inline,
|
|
292
|
+
matchPosition,
|
|
293
|
+
isCreateNewReferenceEnabled,
|
|
294
|
+
disableStartingFieldsForReference
|
|
295
|
+
);
|
|
296
|
+
this.renderMode = 'searchAndSelect';
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (this.type === 'Multiselect') {
|
|
300
|
+
this.buildMultiselectChild(
|
|
301
|
+
rawConfig,
|
|
302
|
+
mode,
|
|
303
|
+
refFieldMetadata,
|
|
304
|
+
fieldMetaData,
|
|
305
|
+
propsToUse,
|
|
306
|
+
referenceType,
|
|
307
|
+
hideLabel,
|
|
308
|
+
inline,
|
|
309
|
+
isCreateNewReferenceEnabled,
|
|
310
|
+
disableStartingFieldsForReference,
|
|
311
|
+
contextClass
|
|
312
|
+
);
|
|
313
|
+
this.renderMode = 'dynamicComponent';
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
this.buildDefaultChild(
|
|
317
|
+
rawConfig,
|
|
318
|
+
mode,
|
|
319
|
+
refFieldMetadata,
|
|
320
|
+
fieldMetaData,
|
|
321
|
+
propsToUse,
|
|
322
|
+
referenceType,
|
|
323
|
+
hideLabel,
|
|
324
|
+
inline,
|
|
325
|
+
isCreateNewReferenceEnabled,
|
|
326
|
+
disableStartingFieldsForReference,
|
|
327
|
+
contextClass,
|
|
328
|
+
linkReference
|
|
329
|
+
);
|
|
330
|
+
this.renderMode = 'dynamicComponent';
|
|
118
331
|
}
|
|
119
332
|
|
|
120
|
-
onRecordChange
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
refreshOptions
|
|
333
|
+
onRecordChange = event => {
|
|
334
|
+
const pConn = this.pConn$;
|
|
335
|
+
const caseKey = pConn.getCaseInfo().getKey() ?? '';
|
|
336
|
+
const refreshOptions: any = { autoDetectRefresh: true, propertyName: '' };
|
|
337
|
+
refreshOptions.propertyName = (this.rawViewMetadata?.config as any)?.value ?? '';
|
|
338
|
+
|
|
339
|
+
const { allowImplicitRefresh } = (PCore as any).getFieldDefaultUtils().fieldDefaults.DataReference || {};
|
|
124
340
|
|
|
125
|
-
if (!this.canBeChangedInReviewMode || !
|
|
126
|
-
const pgRef =
|
|
341
|
+
if (!this.canBeChangedInReviewMode || !pConn.getValue('__currentPageTabViewName') || allowImplicitRefresh) {
|
|
342
|
+
const pgRef = pConn.getPageReference().replace('caseInfo.content', '') ?? '';
|
|
127
343
|
const viewName = this.rawViewMetadata?.name;
|
|
128
344
|
if (viewName && viewName.length > 0) {
|
|
129
|
-
|
|
345
|
+
pConn.getActionsApi().refreshCaseView(caseKey, viewName, pgRef, refreshOptions);
|
|
130
346
|
}
|
|
131
347
|
}
|
|
132
348
|
|
|
133
|
-
const propValue = value;
|
|
349
|
+
const propValue = event?.id || event?.target?.value || event;
|
|
134
350
|
const propName =
|
|
135
|
-
this.rawViewMetadata?.type === 'SimpleTableSelect' && this.configProps.mode ===
|
|
136
|
-
? PCore.getAnnotationUtils().getPropertyName(this.rawViewMetadata?.config?.selectionList ?? '')
|
|
137
|
-
: PCore.getAnnotationUtils().getPropertyName(this.rawViewMetadata?.config?.value ?? '');
|
|
351
|
+
this.rawViewMetadata?.type === 'SimpleTableSelect' && this.configProps.mode === SELECTION_MODE.MULTI
|
|
352
|
+
? PCore.getAnnotationUtils().getPropertyName((this.rawViewMetadata?.config as any)?.selectionList ?? '')
|
|
353
|
+
: PCore.getAnnotationUtils().getPropertyName((this.rawViewMetadata?.config as any)?.value ?? '');
|
|
138
354
|
|
|
139
355
|
if (propValue && this.canBeChangedInReviewMode && this.isDisplayModeEnabled) {
|
|
140
356
|
PCore.getCaseUtils()
|
|
141
357
|
.getCaseEditLock(caseKey, '')
|
|
142
358
|
.then(caseResponse => {
|
|
143
|
-
const pageTokens =
|
|
144
|
-
let curr = {};
|
|
359
|
+
const pageTokens = pConn.getPageReference().replace('caseInfo.content', '').split('.');
|
|
360
|
+
let curr: any = {};
|
|
145
361
|
const commitData = curr;
|
|
146
362
|
|
|
147
363
|
pageTokens?.forEach(el => {
|
|
@@ -151,7 +367,6 @@ export class ObjectReferenceComponent implements OnInit, OnDestroy {
|
|
|
151
367
|
}
|
|
152
368
|
});
|
|
153
369
|
|
|
154
|
-
// expecting format like {Customer: {pyID:"C-100"}}
|
|
155
370
|
const propArr = propName.split('.');
|
|
156
371
|
propArr.forEach((element, idx) => {
|
|
157
372
|
if (idx + 1 === propArr.length) {
|
|
@@ -163,75 +378,584 @@ export class ObjectReferenceComponent implements OnInit, OnDestroy {
|
|
|
163
378
|
});
|
|
164
379
|
|
|
165
380
|
PCore.getCaseUtils()
|
|
166
|
-
.updateCaseEditFieldsData(caseKey, { [caseKey]: commitData }, caseResponse.headers.etag,
|
|
381
|
+
.updateCaseEditFieldsData(caseKey, { [caseKey]: commitData }, caseResponse.headers.etag, pConn.getContextName() ?? '')
|
|
167
382
|
.then(response => {
|
|
168
|
-
PCore.getContainerUtils().updateParentLastUpdateTime(
|
|
169
|
-
PCore.getContainerUtils().updateRelatedContextEtag(
|
|
383
|
+
PCore.getContainerUtils().updateParentLastUpdateTime(pConn.getContextName() ?? '', (response.data as any).data.caseInfo.lastUpdateTime);
|
|
384
|
+
PCore.getContainerUtils().updateRelatedContextEtag(pConn.getContextName() ?? '', response.headers.etag);
|
|
170
385
|
});
|
|
171
386
|
});
|
|
172
387
|
}
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
private loadParameterizedDataSource(rawConfig: any, parameters: any) {
|
|
391
|
+
const { value, key, text } = {
|
|
392
|
+
key: `@P ${rawConfig.selectionKey}`,
|
|
393
|
+
text: `@P ${rawConfig.displayField}`,
|
|
394
|
+
value: `@P ${rawConfig.selectionKey}`
|
|
395
|
+
};
|
|
396
|
+
const refList = rawConfig.referenceList;
|
|
397
|
+
(PCore as any)
|
|
398
|
+
.getDataApiUtils()
|
|
399
|
+
.getData(refList, { dataViewParameters: parameters })
|
|
400
|
+
.then((res: any) => {
|
|
401
|
+
if (res.data.data !== null) {
|
|
402
|
+
this.parameterizedDataSource = res.data.data
|
|
403
|
+
.map((listItem: any) => ({
|
|
404
|
+
key: listItem[key.split(' .', 2)[1]],
|
|
405
|
+
text: listItem[text.split(' .', 2)[1]],
|
|
406
|
+
value: listItem[value.split(' .', 2)[1]]
|
|
407
|
+
}))
|
|
408
|
+
.filter((item: any) => item.key);
|
|
409
|
+
} else {
|
|
410
|
+
this.parameterizedDataSource = [];
|
|
411
|
+
}
|
|
412
|
+
})
|
|
413
|
+
.catch(() => {
|
|
414
|
+
this.parameterizedDataSource = [];
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
private buildFieldMetaData(rawConfig: any, parameters: any) {
|
|
419
|
+
const fieldMetaData: any = {
|
|
420
|
+
datasourceMetadata: { datasource: { parameters: {} } }
|
|
421
|
+
};
|
|
422
|
+
if (rawConfig.parameters) {
|
|
423
|
+
fieldMetaData.datasourceMetadata.datasource.parameters = parameters;
|
|
424
|
+
}
|
|
425
|
+
fieldMetaData.datasourceMetadata.datasource.propertyForDisplayText = rawConfig.datasource?.fields?.text?.startsWith('@P')
|
|
426
|
+
? rawConfig.datasource.fields.text.substring(3)
|
|
427
|
+
: rawConfig.datasource?.fields?.text;
|
|
428
|
+
fieldMetaData.datasourceMetadata.datasource.propertyForValue = rawConfig.datasource?.fields?.value?.startsWith('@P')
|
|
429
|
+
? rawConfig.datasource.fields.value.substring(3)
|
|
430
|
+
: rawConfig.datasource?.fields?.value;
|
|
431
|
+
fieldMetaData.datasourceMetadata.datasource.name = rawConfig.referenceList;
|
|
432
|
+
return fieldMetaData;
|
|
173
433
|
}
|
|
174
434
|
|
|
175
|
-
private
|
|
176
|
-
//
|
|
177
|
-
|
|
435
|
+
private buildSingleReferenceReadonly(rawConfig: any) {
|
|
436
|
+
// SingleReferenceReadonly is rendered via component-mapper with pConn$ which internally resolves config
|
|
437
|
+
// Setting properties needed by the child component on config
|
|
438
|
+
rawConfig.primaryField = rawConfig.displayField;
|
|
439
|
+
rawConfig.text = rawConfig.displayField;
|
|
440
|
+
rawConfig.caseClass = rawConfig.targetObjectClass;
|
|
441
|
+
rawConfig.caseID = rawConfig.value;
|
|
442
|
+
rawConfig.contextPage = `@P .${rawConfig.displayField ? getDataRelationshipContextFromKey(rawConfig.displayField) : null}`;
|
|
443
|
+
this.renderMode = 'singleReferenceReadonly';
|
|
178
444
|
}
|
|
179
445
|
|
|
180
|
-
private
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
446
|
+
private buildMultiReferenceReadonly() {
|
|
447
|
+
this.renderMode = 'multiReferenceReadonly';
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
private buildCardsChild(rawConfig: any) {
|
|
451
|
+
const selectionMode = rawConfig.mode;
|
|
452
|
+
const datasourceKeyField =
|
|
453
|
+
rawConfig.selectionKey || (rawConfig.isCalculated ? '.pzInsKey' : `.${rawConfig.value.trim().split('.').pop()?.trim()}`);
|
|
454
|
+
|
|
455
|
+
const componentMeta = {
|
|
456
|
+
type: selectionMode === 'single' ? 'RadioButtons' : 'Checkbox',
|
|
457
|
+
config: {
|
|
458
|
+
...rawConfig,
|
|
459
|
+
label: rawConfig.label,
|
|
460
|
+
value: selectionMode === 'single' ? rawConfig.value : undefined,
|
|
461
|
+
referenceList: rawConfig.referenceList,
|
|
462
|
+
contextClass: rawConfig.targetObjectClass,
|
|
463
|
+
referenceType: rawConfig.targetObjectType === 'case' ? 'Case' : 'Data',
|
|
464
|
+
readonlyContextList: selectionMode.includes('multi') ? rawConfig.pagelistValue : undefined,
|
|
465
|
+
...(selectionMode.includes('multi')
|
|
466
|
+
? {
|
|
467
|
+
selectionList: rawConfig.pagelistValue.substring(3),
|
|
468
|
+
selectionKey: rawConfig.selectionKey || (rawConfig.isCalculated ? '.pzInsKey' : undefined)
|
|
469
|
+
}
|
|
470
|
+
: { selectionList: rawConfig.contextPage?.substring(3) }),
|
|
471
|
+
selectionMode: selectionMode.includes('multi') ? 'multi' : undefined,
|
|
472
|
+
displayMode: rawConfig.isCalculated ? 'DISPLAY_ONLY' : undefined,
|
|
473
|
+
renderMode: !rawConfig.isCalculated && rawConfig.mode === 'readonly-multi' ? 'ReadOnly' : undefined,
|
|
474
|
+
variant: 'card',
|
|
475
|
+
inlineDisplay: rawConfig.inlineDisplay ?? true,
|
|
476
|
+
hideFieldLabels: rawConfig.hideFieldLabels,
|
|
477
|
+
presets: [
|
|
478
|
+
{
|
|
479
|
+
children: [
|
|
480
|
+
{
|
|
481
|
+
children: rawConfig.secondaryFields,
|
|
482
|
+
name: 'AdditionalDetails',
|
|
483
|
+
type: 'Region'
|
|
484
|
+
}
|
|
485
|
+
],
|
|
486
|
+
config: {},
|
|
487
|
+
id: 'P_',
|
|
488
|
+
label: '',
|
|
489
|
+
name: 'presets',
|
|
490
|
+
template: 'Cards'
|
|
491
|
+
}
|
|
492
|
+
],
|
|
493
|
+
datasource: {
|
|
494
|
+
fields: {
|
|
495
|
+
key: `@P ${datasourceKeyField}`,
|
|
496
|
+
text:
|
|
497
|
+
typeof rawConfig.displayField === 'string' && rawConfig.displayField.trim()
|
|
498
|
+
? `@P .${rawConfig.displayField.trim().split('.').pop()?.trim()}`
|
|
499
|
+
: `@P ${datasourceKeyField}`,
|
|
500
|
+
value: `@P ${datasourceKeyField}`
|
|
501
|
+
},
|
|
502
|
+
filterDownloadedFields: true,
|
|
503
|
+
source: `@DATASOURCE ${rawConfig.referenceList}.pxResults`
|
|
504
|
+
},
|
|
505
|
+
displayAs: 'cards',
|
|
506
|
+
hideLabel: rawConfig.hideLabel,
|
|
507
|
+
imagePosition: rawConfig.imagePosition,
|
|
508
|
+
image: rawConfig.image,
|
|
509
|
+
imageSize: rawConfig.imageSize,
|
|
510
|
+
showImageDescription: rawConfig.showImageDescription,
|
|
511
|
+
imageDescription: rawConfig.imageDescription,
|
|
512
|
+
required: rawConfig.required,
|
|
513
|
+
readOnly: !!rawConfig.isCalculated,
|
|
514
|
+
disabled: rawConfig.disabled,
|
|
515
|
+
labelOption: rawConfig.labelOption,
|
|
516
|
+
primaryField: rawConfig.displayField || datasourceKeyField,
|
|
517
|
+
dataRelationshipContext: rawConfig.displayField ? getDataRelationshipContextFromKey(rawConfig.displayField) : null
|
|
518
|
+
}
|
|
187
519
|
};
|
|
188
520
|
|
|
189
|
-
const component = this.pConn$.createComponent(
|
|
521
|
+
const component = this.pConn$.createComponent(componentMeta as any, '', 0, {});
|
|
522
|
+
this.newComponentName = component?.getPConnect().getComponentName();
|
|
190
523
|
this.newPconn = component?.getPConnect();
|
|
524
|
+
|
|
525
|
+
// For multi-mode, pre-set the reference list on the child PConnect so that
|
|
526
|
+
// getListActions() resolves the correct path even if the child's updateSelf()
|
|
527
|
+
// doesn't re-run after a setInput update.
|
|
528
|
+
if (selectionMode.includes('multi') && this.newPconn) {
|
|
529
|
+
const selectionList = rawConfig.pagelistValue.substring(3);
|
|
530
|
+
this.newPconn.setReferenceList(selectionList);
|
|
531
|
+
}
|
|
191
532
|
}
|
|
192
533
|
|
|
193
|
-
private
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
534
|
+
private buildMapChild(rawConfig: any, targetObjectType: any) {
|
|
535
|
+
const displayField = getDataRelationshipContextFromKey(rawConfig.displayField);
|
|
536
|
+
const displayFieldMetadata = this.pConn$.getFieldMetadata(displayField);
|
|
537
|
+
|
|
538
|
+
const componentMeta = {
|
|
539
|
+
type: 'MapView',
|
|
540
|
+
config: {
|
|
541
|
+
contextClass: rawConfig.targetObjectClass,
|
|
542
|
+
displayAs: 'map',
|
|
543
|
+
hideLabel: false,
|
|
544
|
+
label: rawConfig.label,
|
|
545
|
+
referenceType: targetObjectType?.toLowerCase() === 'case' ? 'Case' : 'Data',
|
|
546
|
+
localeReference: rawConfig.localeReference,
|
|
547
|
+
classId: SIMPLE_TABLE_MANUAL_READONLY,
|
|
548
|
+
detailsDisplay: generateDetailsDisplay({
|
|
549
|
+
isCaseType: targetObjectType?.toLowerCase() === 'case',
|
|
550
|
+
fieldForDisplay: displayField,
|
|
551
|
+
fieldNameForKey: rawConfig.selectionKey,
|
|
552
|
+
displayFieldMetadata
|
|
553
|
+
}),
|
|
554
|
+
presets: [
|
|
555
|
+
{
|
|
556
|
+
children: [
|
|
557
|
+
{
|
|
558
|
+
children: [],
|
|
559
|
+
name: 'Columns',
|
|
560
|
+
type: 'Region'
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
children: rawConfig.secondaryFields,
|
|
564
|
+
name: 'AdditionalDetails',
|
|
565
|
+
type: 'Region'
|
|
566
|
+
}
|
|
567
|
+
],
|
|
568
|
+
config: {},
|
|
569
|
+
id: 'P_',
|
|
570
|
+
label: '',
|
|
571
|
+
name: 'presets',
|
|
572
|
+
locationDetails: rawConfig.locationDetails,
|
|
573
|
+
template: 'Map'
|
|
574
|
+
}
|
|
575
|
+
],
|
|
576
|
+
readonlyContextList: rawConfig.pagelistValue,
|
|
577
|
+
referenceList: rawConfig.pagelistValue,
|
|
578
|
+
renderMode: 'ReadOnly',
|
|
579
|
+
selectionMode: 'multi',
|
|
580
|
+
required: rawConfig.required,
|
|
581
|
+
readOnly: false,
|
|
582
|
+
disabled: rawConfig.disabled,
|
|
583
|
+
visibility: rawConfig.visibility
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
const component = this.pConn$.createComponent(componentMeta as any, '', 0, {});
|
|
588
|
+
this.newComponentName = component?.getPConnect().getComponentName();
|
|
589
|
+
this.newPconn = component?.getPConnect();
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
private buildCheckboxGroupChild(rawConfig: any, mode: string, refFieldMetadata: any, propsToUse: any, hideLabel: boolean) {
|
|
593
|
+
const displayField = rawConfig.displayField;
|
|
594
|
+
const primaryField = displayField?.startsWith('@P') ? displayField?.substring(3) : displayField;
|
|
595
|
+
const readOnly = !(mode === 'multi' || mode === 'single');
|
|
596
|
+
const pageListValueFromConfig = rawConfig.pagelistValue;
|
|
597
|
+
const selectionList = pageListValueFromConfig?.startsWith('@P') ? pageListValueFromConfig?.substring(3) : pageListValueFromConfig;
|
|
598
|
+
|
|
599
|
+
const component = this.pConn$.createComponent(
|
|
600
|
+
{
|
|
601
|
+
type: 'Checkbox',
|
|
602
|
+
config: {
|
|
603
|
+
...rawConfig,
|
|
604
|
+
contextClass: rawConfig.targetObjectClass,
|
|
605
|
+
datasource: {
|
|
606
|
+
fields: {
|
|
607
|
+
key: `@P ${rawConfig.selectionKey}`,
|
|
608
|
+
text: `@P ${rawConfig.displayField}`,
|
|
609
|
+
value: `@P ${rawConfig.selectionKey}`
|
|
610
|
+
},
|
|
611
|
+
source: !rawConfig.parameters ? `@DATASOURCE ${rawConfig.referenceList}.pxResults` : this.parameterizedDataSource
|
|
612
|
+
},
|
|
613
|
+
descriptors: mode === SELECTION_MODE.SINGLE ? refFieldMetadata?.descriptors : null,
|
|
614
|
+
displayAs: 'checkboxgroup',
|
|
615
|
+
hideLabel,
|
|
616
|
+
inline: rawConfig.inline ?? false,
|
|
617
|
+
label: propsToUse.label,
|
|
618
|
+
primaryField,
|
|
619
|
+
readOnly,
|
|
620
|
+
readonlyContextList: pageListValueFromConfig,
|
|
621
|
+
referenceType: rawConfig.targetObjectType,
|
|
622
|
+
selectionKey: rawConfig.selectionKey,
|
|
623
|
+
selectionList,
|
|
624
|
+
selectionMode: mode,
|
|
625
|
+
disabled: propsToUse.disabled,
|
|
626
|
+
required: propsToUse.required,
|
|
627
|
+
visibility: propsToUse.visibility,
|
|
628
|
+
additionalInfo: refFieldMetadata?.additionalInformation ? { content: refFieldMetadata.additionalInformation } : undefined
|
|
629
|
+
}
|
|
630
|
+
} as any,
|
|
631
|
+
'',
|
|
632
|
+
0,
|
|
633
|
+
{}
|
|
634
|
+
);
|
|
635
|
+
this.newComponentName = component?.getPConnect().getComponentName();
|
|
636
|
+
this.newPconn = component?.getPConnect();
|
|
637
|
+
|
|
638
|
+
// For multi-mode, pre-set the reference list on the child PConnect so that
|
|
639
|
+
// getListActions() resolves the correct path on every re-render.
|
|
640
|
+
if (mode === 'multi' && this.newPconn && selectionList) {
|
|
641
|
+
this.newPconn.setReferenceList(selectionList);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
private buildTableChild(type: string, rawConfig: any, mode: string, referenceType: string, propsToUse: any) {
|
|
646
|
+
const presets = [
|
|
647
|
+
{
|
|
648
|
+
children: [{ children: rawConfig.columns, name: 'Columns', type: 'Region' }],
|
|
649
|
+
config: { filterExpression: rawConfig.filterExpression },
|
|
650
|
+
id: 'P_',
|
|
651
|
+
label: '',
|
|
652
|
+
name: 'presets',
|
|
653
|
+
template: 'Table'
|
|
654
|
+
}
|
|
655
|
+
];
|
|
656
|
+
const tableDisplayAs = camelCase(type);
|
|
657
|
+
|
|
658
|
+
let componentConfig: any;
|
|
659
|
+
|
|
660
|
+
if (mode === 'readonly-multi') {
|
|
661
|
+
componentConfig = {
|
|
662
|
+
type: 'SimpleTableSelect',
|
|
663
|
+
config: {
|
|
664
|
+
contextClass: rawConfig.targetObjectClass,
|
|
665
|
+
defaultRowHeight: rawConfig.defaultRowHeight,
|
|
666
|
+
displayAs: tableDisplayAs,
|
|
667
|
+
hideLabel: false,
|
|
668
|
+
label: propsToUse.label,
|
|
669
|
+
localeReference: rawConfig.localeReference,
|
|
670
|
+
presets,
|
|
671
|
+
readOnly: true,
|
|
672
|
+
readonlyContextList: rawConfig.pagelistValue,
|
|
673
|
+
referenceList: rawConfig.pagelistValue,
|
|
674
|
+
referenceType,
|
|
675
|
+
renderMode: 'ReadOnly',
|
|
676
|
+
rowHeader: rawConfig.rowHeader,
|
|
677
|
+
selectionMode: 'multi',
|
|
678
|
+
required: propsToUse.required,
|
|
679
|
+
visibility: propsToUse.visibility,
|
|
680
|
+
disabled: propsToUse.disabled,
|
|
681
|
+
toggleFieldVisibility: rawConfig.toggleFieldVisibility
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
} else if (mode === 'single' || mode === 'multi') {
|
|
685
|
+
const contextPageFromConfig = mode === 'single' ? rawConfig.contextPage : rawConfig.pagelistValue;
|
|
686
|
+
const contextPageValue = contextPageFromConfig?.startsWith('@P') ? contextPageFromConfig?.substring(3) : contextPageFromConfig;
|
|
687
|
+
|
|
688
|
+
componentConfig = {
|
|
689
|
+
type: 'SimpleTableSelect',
|
|
690
|
+
config: {
|
|
691
|
+
...(mode === 'single' ? { selectionKey: rawConfig.value, value: rawConfig.value } : {}),
|
|
692
|
+
dataRelationshipContext: contextPageValue,
|
|
693
|
+
defaultRowHeight: rawConfig.defaultRowHeight,
|
|
694
|
+
displayAs: tableDisplayAs,
|
|
695
|
+
hideLabel: false,
|
|
696
|
+
inline: false,
|
|
697
|
+
label: propsToUse.label,
|
|
698
|
+
localeReference: rawConfig.localeReference,
|
|
699
|
+
presets,
|
|
700
|
+
readOnly: false,
|
|
701
|
+
referenceList: rawConfig.referenceList,
|
|
702
|
+
referenceType,
|
|
703
|
+
rowHeader: rawConfig.rowHeader,
|
|
704
|
+
parameters: rawConfig.parameters,
|
|
705
|
+
selectionList: contextPageValue,
|
|
706
|
+
selectionMode: mode,
|
|
707
|
+
showPromotedFilters: false,
|
|
708
|
+
required: propsToUse.required,
|
|
709
|
+
visibility: propsToUse.visibility,
|
|
710
|
+
disabled: propsToUse.disabled,
|
|
711
|
+
toggleFieldVisibility: rawConfig.toggleFieldVisibility
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
if (componentConfig) {
|
|
717
|
+
const component = this.pConn$.createComponent(componentConfig, '', 0, {});
|
|
718
|
+
this.newComponentName = component?.getPConnect().getComponentName();
|
|
719
|
+
this.newPconn = component?.getPConnect();
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
private buildSearchAndSelectChild(
|
|
724
|
+
rawConfig: any,
|
|
197
725
|
refFieldMetadata: any,
|
|
726
|
+
propsToUse: any,
|
|
198
727
|
referenceType: string,
|
|
199
728
|
hideLabel: boolean,
|
|
200
|
-
inline: boolean
|
|
729
|
+
inline: boolean,
|
|
730
|
+
matchPosition: string,
|
|
731
|
+
isCreateNewReferenceEnabled: boolean,
|
|
732
|
+
disableStartingFieldsForReference: boolean
|
|
201
733
|
) {
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
};
|
|
734
|
+
const selectionMode = rawConfig.mode;
|
|
735
|
+
const firstChildMeta = structuredClone((this.rawViewMetadata as any)?.children?.[0]);
|
|
736
|
+
const pyID = getMappedKey('pyID');
|
|
737
|
+
const additionalInfo = refFieldMetadata?.additionalInformation ? { content: refFieldMetadata.additionalInformation } : undefined;
|
|
738
|
+
const pageListValueFromConfig = rawConfig.pagelistValue;
|
|
739
|
+
const selectionList = pageListValueFromConfig?.startsWith('@P') ? pageListValueFromConfig?.substring(3) : pageListValueFromConfig;
|
|
740
|
+
const contextPageFromConfig = rawConfig.contextPage;
|
|
741
|
+
const unannotatedContextPageFromConfig = contextPageFromConfig?.startsWith('@P') ? contextPageFromConfig?.substring(3) : contextPageFromConfig;
|
|
742
|
+
const name = (selectionList ?? unannotatedContextPageFromConfig)?.replace(/^\./, '');
|
|
212
743
|
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
744
|
+
const dataReferenceConfigToChild: any = {
|
|
745
|
+
selectionMode,
|
|
746
|
+
additionalInfo,
|
|
747
|
+
descriptors: selectionMode === SELECTION_MODE.SINGLE ? refFieldMetadata?.descriptors : null,
|
|
217
748
|
required: propsToUse.required,
|
|
218
749
|
visibility: propsToUse.visibility,
|
|
219
750
|
disabled: propsToUse.disabled,
|
|
220
751
|
label: propsToUse.label,
|
|
752
|
+
displayAs: 'advancedSearch',
|
|
221
753
|
readOnly: false,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
754
|
+
matchPosition,
|
|
755
|
+
...(selectionMode === SELECTION_MODE.SINGLE && { referenceType }),
|
|
756
|
+
...(selectionMode === SELECTION_MODE.SINGLE && {
|
|
757
|
+
value: rawConfig.value,
|
|
758
|
+
contextPage: contextPageFromConfig
|
|
759
|
+
}),
|
|
760
|
+
...(selectionMode === SELECTION_MODE.MULTI && {
|
|
761
|
+
selectionList,
|
|
762
|
+
readonlyContextList: pageListValueFromConfig,
|
|
763
|
+
referenceType: referenceType || firstChildMeta?.config?.referenceType
|
|
764
|
+
}),
|
|
765
|
+
dataRelationshipContext: rawConfig.targetObjectClass && name ? name : null,
|
|
226
766
|
hideLabel,
|
|
767
|
+
onRecordChange: this.onRecordChange,
|
|
768
|
+
getAdditionalInfo: getAdditionalInfo.bind(this, this.pConn$, rawConfig?.authorContext),
|
|
769
|
+
createNewRecord: isCreateNewReferenceEnabled ? createNewRecord : undefined,
|
|
227
770
|
inline
|
|
228
771
|
};
|
|
229
772
|
|
|
230
|
-
|
|
773
|
+
this.searchSelectCacheKey = componentCachePersistUtils.getComponentStateKey(this.pConn$, name);
|
|
774
|
+
|
|
775
|
+
// Set advanced search context via service
|
|
776
|
+
this.dataRefAdvancedSearchService.setConfig({
|
|
777
|
+
dataReferenceConfigToChild,
|
|
778
|
+
isCreateNewReferenceEnabled,
|
|
779
|
+
disableStartingFieldsForReference,
|
|
780
|
+
pyID,
|
|
781
|
+
searchSelectKey: this.searchSelectCacheKey
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
private buildMultiselectChild(
|
|
786
|
+
rawConfig: any,
|
|
787
|
+
mode: string,
|
|
788
|
+
refFieldMetadata: any,
|
|
789
|
+
fieldMetaData: any,
|
|
790
|
+
propsToUse: any,
|
|
791
|
+
referenceType: string,
|
|
792
|
+
hideLabel: boolean,
|
|
793
|
+
inline: boolean,
|
|
794
|
+
isCreateNewReferenceEnabled: boolean,
|
|
795
|
+
disableStartingFieldsForReference: boolean,
|
|
796
|
+
contextClass: string
|
|
797
|
+
) {
|
|
798
|
+
const component = this.pConn$.createComponent(
|
|
799
|
+
{
|
|
800
|
+
type: 'Multiselect',
|
|
801
|
+
config: {
|
|
802
|
+
...rawConfig,
|
|
803
|
+
descriptors: refFieldMetadata?.descriptors,
|
|
804
|
+
datasourceMetadata: fieldMetaData?.datasourceMetadata,
|
|
805
|
+
selectionList: rawConfig.pagelistValue?.substring(3),
|
|
806
|
+
readonlyContextList: rawConfig.pagelistValue,
|
|
807
|
+
selectionKey: rawConfig.selectionKey,
|
|
808
|
+
selectionMode: SELECTION_MODE.MULTI,
|
|
809
|
+
required: propsToUse.required,
|
|
810
|
+
visibility: propsToUse.visibility,
|
|
811
|
+
disabled: propsToUse.disabled,
|
|
812
|
+
label: propsToUse.label,
|
|
813
|
+
parameters: rawConfig.parameters,
|
|
814
|
+
readOnly: false,
|
|
815
|
+
localeReference: rawConfig.localeReference,
|
|
816
|
+
...(mode === SELECTION_MODE.MULTI ? { referenceType } : {}),
|
|
817
|
+
contextClass: rawConfig.targetObjectClass,
|
|
818
|
+
primaryField: rawConfig.displayField?.startsWith('@P') ? rawConfig.displayField.slice(3) : rawConfig.displayField,
|
|
819
|
+
dataRelationshipContext: rawConfig.pagelistValue?.substring(4),
|
|
820
|
+
hideLabel: hideLabel ?? false,
|
|
821
|
+
onRecordChange: this.onRecordChange,
|
|
822
|
+
createNewRecord: isCreateNewReferenceEnabled
|
|
823
|
+
? () =>
|
|
824
|
+
createNewRecord({
|
|
825
|
+
referenceType: rawConfig.targetObjectType === 'case' ? 'Case' : 'Data',
|
|
826
|
+
pConn: this.pConn$,
|
|
827
|
+
getPConnect: () => this.pConn$,
|
|
828
|
+
disableStartingFieldsForReference,
|
|
829
|
+
startingFields: {},
|
|
830
|
+
contextClass
|
|
831
|
+
})
|
|
832
|
+
: undefined,
|
|
833
|
+
inline,
|
|
834
|
+
columnsFormatter: rawConfig.secondaryFields,
|
|
835
|
+
additionalInfo: refFieldMetadata?.additionalInformation ? { content: refFieldMetadata.additionalInformation } : undefined
|
|
836
|
+
}
|
|
837
|
+
} as any,
|
|
838
|
+
'',
|
|
839
|
+
0,
|
|
840
|
+
{}
|
|
841
|
+
);
|
|
231
842
|
this.newComponentName = component?.getPConnect().getComponentName();
|
|
232
843
|
this.newPconn = component?.getPConnect();
|
|
233
|
-
|
|
234
|
-
|
|
844
|
+
|
|
845
|
+
// Pre-set the reference list on the child PConnect so that
|
|
846
|
+
// getListActions() resolves the correct path on every re-render.
|
|
847
|
+
const selectionList = rawConfig.pagelistValue?.substring(3);
|
|
848
|
+
if (this.newPconn && selectionList) {
|
|
849
|
+
this.newPconn.setReferenceList(selectionList);
|
|
235
850
|
}
|
|
236
851
|
}
|
|
852
|
+
|
|
853
|
+
private buildEmbeddedInsightTableChild(rawConfig: any, referenceType: string, propsToUse: any) {
|
|
854
|
+
// Extract columns from insightModel.query.columns and convert to presets format
|
|
855
|
+
const insightModel = propsToUse.insightModel;
|
|
856
|
+
const insightColumns: any[] = insightModel?.query?.columns ?? [];
|
|
857
|
+
|
|
858
|
+
const columnChildren = insightColumns
|
|
859
|
+
.filter((col: any) => col.type === 'column' && col.field)
|
|
860
|
+
.map((col: any) => ({
|
|
861
|
+
type: 'TextInput',
|
|
862
|
+
config: {
|
|
863
|
+
value: `@P .${col.field.fieldID}`,
|
|
864
|
+
label: col.field.name || col.field.fieldID
|
|
865
|
+
}
|
|
866
|
+
}));
|
|
867
|
+
|
|
868
|
+
const presets = [
|
|
869
|
+
{
|
|
870
|
+
children: [{ children: columnChildren, name: 'Columns', type: 'Region' }],
|
|
871
|
+
config: {},
|
|
872
|
+
id: 'P_',
|
|
873
|
+
label: '',
|
|
874
|
+
name: 'presets',
|
|
875
|
+
template: 'Table'
|
|
876
|
+
}
|
|
877
|
+
];
|
|
878
|
+
|
|
879
|
+
const componentConfig = {
|
|
880
|
+
type: 'SimpleTableManual',
|
|
881
|
+
config: {
|
|
882
|
+
contextClass: rawConfig.targetObjectClass,
|
|
883
|
+
presets,
|
|
884
|
+
label: propsToUse.label,
|
|
885
|
+
readonlyContextList: rawConfig.pagelistValue,
|
|
886
|
+
referenceList: rawConfig.pagelistValue,
|
|
887
|
+
renderMode: 'ReadOnly',
|
|
888
|
+
dataPageName: rawConfig.referenceList,
|
|
889
|
+
fieldMetadata: {
|
|
890
|
+
datasource: {
|
|
891
|
+
parameters: this.configProps.parameters ?? {}
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
const component = this.pConn$.createComponent(componentConfig as any, '', 0, {});
|
|
898
|
+
this.newComponentName = component?.getPConnect().getComponentName();
|
|
899
|
+
this.newPconn = component?.getPConnect();
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
private buildDefaultChild(
|
|
903
|
+
rawConfig: any,
|
|
904
|
+
mode: string,
|
|
905
|
+
refFieldMetadata: any,
|
|
906
|
+
fieldMetaData: any,
|
|
907
|
+
propsToUse: any,
|
|
908
|
+
referenceType: string,
|
|
909
|
+
hideLabel: boolean,
|
|
910
|
+
inline: boolean,
|
|
911
|
+
isCreateNewReferenceEnabled: boolean,
|
|
912
|
+
disableStartingFieldsForReference: boolean,
|
|
913
|
+
contextClass: string,
|
|
914
|
+
linkReference: any
|
|
915
|
+
) {
|
|
916
|
+
this.useOutputEvents = true;
|
|
917
|
+
const component = this.pConn$.createComponent(
|
|
918
|
+
{
|
|
919
|
+
type: this.type,
|
|
920
|
+
config: {
|
|
921
|
+
...rawConfig,
|
|
922
|
+
descriptors: mode === SELECTION_MODE.SINGLE ? refFieldMetadata?.descriptors : null,
|
|
923
|
+
datasourceMetadata: fieldMetaData?.datasourceMetadata,
|
|
924
|
+
required: propsToUse.required,
|
|
925
|
+
visibility: propsToUse.visibility,
|
|
926
|
+
disabled: propsToUse.disabled,
|
|
927
|
+
label: propsToUse.label,
|
|
928
|
+
parameters: rawConfig.parameters,
|
|
929
|
+
readOnly: false,
|
|
930
|
+
localeReference: rawConfig.localeReference,
|
|
931
|
+
...(mode === SELECTION_MODE.SINGLE ? { referenceType } : {}),
|
|
932
|
+
contextClass: rawConfig.targetObjectClass,
|
|
933
|
+
primaryField: rawConfig.displayField,
|
|
934
|
+
dataRelationshipContext: rawConfig.displayField ? getDataRelationshipContextFromKey(rawConfig.displayField) : null,
|
|
935
|
+
hideLabel,
|
|
936
|
+
onRecordChange: this.onRecordChange,
|
|
937
|
+
createNewRecord: isCreateNewReferenceEnabled
|
|
938
|
+
? () =>
|
|
939
|
+
createNewRecord({
|
|
940
|
+
referenceType: rawConfig.targetObjectType === 'case' ? 'Case' : 'Data',
|
|
941
|
+
pConn: this.pConn$,
|
|
942
|
+
getPConnect: () => this.pConn$,
|
|
943
|
+
disableStartingFieldsForReference,
|
|
944
|
+
startingFields: {},
|
|
945
|
+
contextClass
|
|
946
|
+
})
|
|
947
|
+
: undefined,
|
|
948
|
+
inline,
|
|
949
|
+
columnsFormatter: rawConfig.secondaryFields,
|
|
950
|
+
getAdditionalInfo: getAdditionalInfo.bind(this, this.pConn$, rawConfig.displayField),
|
|
951
|
+
linkReference: this.type === 'AutoComplete' ? linkReference : undefined
|
|
952
|
+
}
|
|
953
|
+
} as any,
|
|
954
|
+
'',
|
|
955
|
+
0,
|
|
956
|
+
{}
|
|
957
|
+
);
|
|
958
|
+
this.newComponentName = component?.getPConnect().getComponentName();
|
|
959
|
+
this.newPconn = component?.getPConnect();
|
|
960
|
+
}
|
|
237
961
|
}
|