@pega/angular-sdk-overrides 24.2.10 → 25.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.scss +3 -3
- package/lib/designSystemExtension/alert/alert.component.ts +0 -1
- package/lib/designSystemExtension/alert-banner/alert-banner.component.ts +0 -1
- package/lib/designSystemExtension/banner/banner.component.html +1 -1
- package/lib/designSystemExtension/banner/banner.component.scss +17 -3
- package/lib/designSystemExtension/banner/banner.component.ts +0 -1
- package/lib/designSystemExtension/case-create-stage/case-create-stage.component.ts +0 -1
- package/lib/designSystemExtension/field-group/field-group.component.ts +0 -1
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.html +6 -3
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.scss +5 -34
- package/lib/designSystemExtension/material-case-summary/material-case-summary.component.ts +0 -2
- package/lib/designSystemExtension/material-details/material-details.component.scss +0 -5
- package/lib/designSystemExtension/material-details/material-details.component.ts +0 -1
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.html +3 -3
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.scss +4 -3
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +6 -1
- package/lib/designSystemExtension/material-summary-item/material-summary-item.component.scss +4 -17
- package/lib/designSystemExtension/material-summary-item/material-summary-item.component.ts +0 -1
- package/lib/designSystemExtension/material-summary-list/material-summary-list.component.ts +0 -1
- package/lib/designSystemExtension/material-utility/material-utility.component.scss +1 -2
- package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.scss +1 -1
- package/lib/designSystemExtension/material-vertical-tabs/material-vertical-tabs.component.ts +0 -1
- package/lib/designSystemExtension/operator/operator.component.html +2 -2
- package/lib/designSystemExtension/operator/operator.component.scss +13 -12
- package/lib/designSystemExtension/operator/operator.component.ts +4 -5
- package/lib/designSystemExtension/pulse/pulse.component.scss +2 -2
- package/lib/designSystemExtension/pulse/pulse.component.ts +0 -1
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.html +4 -17
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.scss +0 -1
- package/lib/designSystemExtension/rich-text-editor/rich-text-editor.component.ts +30 -1
- package/lib/designSystemExtension/wss-quick-create/wss-quick-create.component.scss +16 -9
- package/lib/designSystemExtension/wss-quick-create/wss-quick-create.component.ts +0 -1
- package/lib/field/auto-complete/auto-complete.component.html +0 -2
- package/lib/field/auto-complete/auto-complete.component.ts +48 -173
- package/lib/field/cancel-alert/cancel-alert.component.html +8 -12
- package/lib/field/cancel-alert/cancel-alert.component.scss +2 -3
- package/lib/field/cancel-alert/cancel-alert.component.ts +24 -37
- package/lib/field/check-box/check-box.component.html +17 -6
- package/lib/field/check-box/check-box.component.scss +0 -1
- package/lib/field/check-box/check-box.component.ts +25 -151
- package/lib/field/currency/currency.component.ts +54 -181
- package/lib/field/date/date.component.html +4 -3
- package/lib/field/date/date.component.ts +30 -151
- package/lib/field/date-time/date-time.component.html +2 -2
- package/lib/field/date-time/date-time.component.ts +47 -148
- package/lib/field/decimal/decimal.component.html +1 -0
- package/lib/field/decimal/decimal.component.ts +61 -164
- package/lib/field/dropdown/dropdown.component.html +1 -0
- package/lib/field/dropdown/dropdown.component.ts +43 -152
- package/lib/field/email/email.component.ts +28 -158
- package/lib/field/field.base.ts +149 -0
- package/lib/field/group/group.component.ts +7 -5
- package/lib/field/integer/integer.component.html +1 -1
- package/lib/field/integer/integer.component.ts +30 -160
- package/lib/field/list-view-action-buttons/list-view-action-buttons.component.html +1 -1
- package/lib/field/list-view-action-buttons/list-view-action-buttons.component.ts +3 -3
- package/lib/field/location/config-ext.json +8 -0
- package/lib/field/location/location.component.html +45 -0
- package/lib/field/location/location.component.scss +18 -0
- package/lib/field/location/location.component.spec.ts +22 -0
- package/lib/field/location/location.component.ts +280 -0
- package/lib/field/multiselect/multiselect.component.ts +47 -152
- package/lib/field/multiselect/utils.ts +55 -47
- package/lib/field/object-reference/object-reference.component.html +17 -0
- package/lib/field/object-reference/object-reference.component.scss +0 -0
- package/lib/field/object-reference/object-reference.component.spec.ts +22 -0
- package/lib/field/object-reference/object-reference.component.ts +237 -0
- package/lib/field/percentage/percentage.component.html +1 -1
- package/lib/field/percentage/percentage.component.ts +62 -170
- package/lib/field/phone/config-ext.json +1 -1
- package/lib/field/phone/phone.component.html +18 -17
- package/lib/field/phone/phone.component.scss +4 -0
- package/lib/field/phone/phone.component.ts +47 -156
- package/lib/field/radio-buttons/radio-buttons.component.html +17 -12
- package/lib/field/radio-buttons/radio-buttons.component.scss +4 -2
- package/lib/field/radio-buttons/radio-buttons.component.ts +37 -160
- package/lib/field/rich-text/rich-text.component.html +2 -0
- package/lib/field/rich-text/rich-text.component.scss +172 -0
- package/lib/field/rich-text/rich-text.component.ts +32 -93
- package/lib/field/scalar-list/scalar-list.component.ts +17 -73
- package/lib/field/selectable-card/selectable-card.component.html +70 -0
- package/lib/field/selectable-card/selectable-card.component.scss +11 -0
- package/lib/field/selectable-card/selectable-card.component.spec.ts +22 -0
- package/lib/field/selectable-card/selectable-card.component.ts +219 -0
- package/lib/field/semantic-link/semantic-link.component.html +4 -8
- package/lib/field/semantic-link/semantic-link.component.scss +0 -13
- package/lib/field/semantic-link/semantic-link.component.ts +165 -6
- package/lib/field/text/text.component.scss +0 -1
- package/lib/field/text/text.component.ts +6 -5
- package/lib/field/text-area/text-area.component.html +4 -2
- package/lib/field/text-area/text-area.component.ts +30 -155
- package/lib/field/text-content/text-content.component.ts +0 -1
- package/lib/field/text-input/text-input.component.html +1 -1
- package/lib/field/text-input/text-input.component.ts +28 -158
- package/lib/field/time/time.component.html +2 -2
- package/lib/field/time/time.component.ts +34 -154
- package/lib/field/url/url.component.html +1 -1
- package/lib/field/url/url.component.ts +28 -157
- package/lib/field/user-reference/user-reference.component.html +40 -38
- package/lib/field/user-reference/user-reference.component.scss +0 -1
- package/lib/field/user-reference/user-reference.component.ts +70 -9
- package/lib/infra/Containers/flow-container/flow-container.component.html +2 -2
- package/lib/infra/Containers/flow-container/flow-container.component.ts +24 -51
- package/lib/infra/Containers/flow-container/helpers.ts +2 -2
- package/lib/infra/Containers/hybrid-view-container/hybrid-view-container.component.ts +0 -1
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.html +1 -11
- package/lib/infra/Containers/modal-view-container/modal-view-container.component.ts +5 -18
- package/lib/infra/Containers/view-container/helper.ts +35 -2
- package/lib/infra/Containers/view-container/view-container.component.ts +1 -2
- package/lib/infra/action-buttons/action-buttons.component.html +13 -8
- package/lib/infra/action-buttons/action-buttons.component.scss +23 -0
- package/lib/infra/action-buttons/action-buttons.component.ts +1 -3
- package/lib/infra/assignment/assignment.component.html +1 -1
- package/lib/infra/assignment/assignment.component.ts +100 -46
- package/lib/infra/assignment-card/assignment-card.component.html +2 -2
- package/lib/infra/assignment-card/assignment-card.component.scss +0 -4
- package/lib/infra/assignment-card/assignment-card.component.ts +21 -5
- package/lib/infra/dashboard-filter/dashboard-filter.component.ts +0 -1
- package/lib/infra/defer-load/defer-load.component.html +6 -2
- package/lib/infra/defer-load/defer-load.component.ts +25 -12
- package/lib/infra/error-boundary/error-boundary.component.ts +0 -1
- package/lib/infra/multi-step/multi-step.component.html +22 -38
- package/lib/infra/multi-step/multi-step.component.scss +14 -27
- package/lib/infra/multi-step/multi-step.component.ts +0 -1
- package/lib/infra/navbar/navbar.component.html +36 -41
- package/lib/infra/navbar/navbar.component.scss +22 -4
- package/lib/infra/navbar/navbar.component.ts +8 -6
- package/lib/infra/reference/reference.component.ts +82 -90
- package/lib/infra/region/region.component.ts +0 -1
- package/lib/infra/root-container/root-container.component.html +2 -15
- package/lib/infra/root-container/root-container.component.scss +0 -1
- package/lib/infra/root-container/root-container.component.ts +25 -32
- package/lib/infra/stages/stages.component.html +4 -3
- package/lib/infra/stages/stages.component.scss +12 -36
- package/lib/infra/stages/stages.component.ts +4 -3
- package/lib/infra/view/view.component.html +1 -1
- package/lib/infra/view/view.component.ts +3 -7
- package/lib/template/advanced-search/advanced-search.component.html +12 -0
- package/lib/template/advanced-search/advanced-search.component.scss +0 -0
- package/lib/template/advanced-search/advanced-search.component.spec.ts +0 -0
- package/lib/template/advanced-search/advanced-search.component.ts +112 -0
- package/lib/template/advanced-search/advanced-search.service.ts +27 -0
- package/lib/template/advanced-search/search-group/persist-utils.ts +56 -0
- package/lib/template/advanced-search/search-groups/search-groups.component.html +32 -0
- package/lib/template/advanced-search/search-groups/search-groups.component.scss +0 -0
- package/lib/template/advanced-search/search-groups/search-groups.component.spec.ts +0 -0
- package/lib/template/advanced-search/search-groups/search-groups.component.ts +294 -0
- package/lib/template/advanced-search/search-groups/utils.ts +29 -0
- package/lib/template/app-shell/app-shell.component.html +4 -1
- package/lib/template/app-shell/app-shell.component.scss +0 -3
- package/lib/template/app-shell/app-shell.component.ts +46 -8
- package/lib/template/banner-page/banner-page.component.ts +0 -1
- package/lib/template/base/form-template-base.ts +6 -0
- package/lib/template/case-summary/case-summary.component.scss +0 -2
- package/lib/template/case-summary/case-summary.component.ts +6 -22
- package/lib/template/case-view/case-view.component.html +4 -4
- package/lib/template/case-view/case-view.component.scss +18 -10
- package/lib/template/case-view/case-view.component.ts +1 -11
- package/lib/template/confirmation/confirmation.component.html +2 -2
- package/lib/template/confirmation/confirmation.component.ts +0 -1
- package/lib/template/data-reference/data-reference.component.html +11 -8
- package/lib/template/data-reference/data-reference.component.ts +346 -113
- package/lib/template/data-reference/search-form/search-form.component.html +39 -0
- package/lib/template/data-reference/search-form/search-form.component.scss +11 -0
- package/lib/template/data-reference/search-form/search-form.component.spec.ts +0 -0
- package/lib/template/data-reference/search-form/search-form.component.ts +167 -0
- package/lib/template/data-reference/search-form/tabsData.ts +160 -0
- package/lib/template/data-reference/utils.ts +92 -0
- package/lib/template/default-form/default-form.component.ts +45 -5
- package/lib/template/default-page/default-page.component.html +34 -0
- package/lib/template/default-page/default-page.component.scss +31 -0
- package/lib/template/default-page/default-page.component.spec.ts +24 -0
- package/lib/template/default-page/default-page.component.ts +64 -0
- package/lib/template/details/details.component.ts +0 -1
- package/lib/template/details-narrow-wide/details-narrow-wide.component.ts +0 -1
- package/lib/template/details-one-column/details-one-column.component.ts +0 -1
- package/lib/template/details-sub-tabs/details-sub-tabs.component.ts +0 -1
- package/lib/template/details-three-column/details-three-column.component.ts +0 -1
- package/lib/template/details-two-column/details-two-column.component.ts +0 -1
- package/lib/template/details-wide-narrow/details-wide-narrow.component.ts +0 -1
- package/lib/template/dynamic-tabs/dynamic-tabs.component.ts +0 -1
- package/lib/template/field-group-list/field-group-list.component.scss +0 -1
- package/lib/template/field-group-list/field-group-list.component.ts +0 -1
- package/lib/template/field-group-template/field-group-template.component.html +7 -7
- package/lib/template/field-group-template/field-group-template.component.scss +8 -0
- package/lib/template/field-group-template/field-group-template.component.ts +64 -55
- package/lib/template/field-value-list/field-value-list.component.html +2 -2
- package/lib/template/field-value-list/field-value-list.component.scss +4 -0
- package/lib/template/field-value-list/field-value-list.component.ts +0 -1
- package/lib/template/inline-dashboard/inline-dashboard.component.ts +0 -1
- package/lib/template/inline-dashboard-page/inline-dashboard-page.component.ts +1 -2
- package/lib/template/list-page/list-page.component.ts +0 -1
- package/lib/template/list-view/list-view.component.html +170 -160
- package/lib/template/list-view/list-view.component.scss +25 -21
- package/lib/template/list-view/list-view.component.ts +208 -122
- package/lib/template/list-view/listViewHelpers.ts +3 -9
- package/lib/template/list-view/utils.ts +27 -7
- package/lib/template/multi-reference-readonly/multi-reference-readonly.component.ts +0 -1
- package/lib/template/narrow-wide-form/narrow-wide-form.component.ts +0 -1
- package/lib/template/object-page/object-page.component.html +1 -0
- package/lib/template/object-page/object-page.component.scss +0 -0
- package/lib/template/object-page/object-page.component.spec.ts +22 -0
- package/lib/template/object-page/object-page.component.ts +14 -0
- package/lib/template/one-column/one-column.component.ts +0 -1
- package/lib/template/one-column-page/one-column-page.component.ts +0 -1
- package/lib/template/one-column-tab/one-column-tab.component.scss +1 -1
- package/lib/template/one-column-tab/one-column-tab.component.ts +0 -1
- package/lib/template/page/page.component.ts +0 -1
- package/lib/template/promoted-filters/promoted-filters.component.ts +0 -1
- package/lib/template/repeating-structures/repeating-structures.component.ts +0 -2
- package/lib/template/self-service-case-view/self-service-case-view.component.html +78 -0
- package/lib/template/self-service-case-view/self-service-case-view.component.scss +132 -0
- package/lib/template/self-service-case-view/self-service-case-view.component.spec.ts +24 -0
- package/lib/template/self-service-case-view/self-service-case-view.component.ts +207 -0
- package/lib/template/simple-table/simple-table.component.ts +0 -2
- package/lib/template/simple-table-manual/helpers.ts +126 -10
- package/lib/template/simple-table-manual/simple-table-manual.component.html +27 -8
- package/lib/template/simple-table-manual/simple-table-manual.component.scss +15 -17
- package/lib/template/simple-table-manual/simple-table-manual.component.ts +103 -45
- package/lib/template/simple-table-select/simple-table-select.component.ts +0 -1
- package/lib/template/single-reference-readonly/single-reference-readonly.component.html +4 -1
- package/lib/template/single-reference-readonly/single-reference-readonly.component.scss +21 -0
- package/lib/template/single-reference-readonly/single-reference-readonly.component.ts +104 -4
- package/lib/template/sub-tabs/sub-tabs.component.ts +0 -1
- package/lib/template/three-column/three-column.component.ts +0 -1
- package/lib/template/three-column-page/three-column-page.component.ts +0 -1
- package/lib/template/two-column/two-column.component.ts +0 -1
- package/lib/template/two-column-page/two-column-page.component.ts +0 -1
- package/lib/template/two-column-tab/two-column-tab.component.ts +0 -1
- package/lib/template/utils.ts +58 -0
- package/lib/template/wide-narrow-form/wide-narrow-form.component.ts +0 -1
- package/lib/template/wide-narrow-page/wide-narrow-page.component.ts +0 -1
- package/lib/template/wss-nav-bar/wss-nav-bar.component.html +6 -5
- package/lib/template/wss-nav-bar/wss-nav-bar.component.scss +8 -17
- package/lib/template/wss-nav-bar/wss-nav-bar.component.ts +1 -9
- package/lib/widget/app-announcement/app-announcement.component.html +1 -2
- package/lib/widget/app-announcement/app-announcement.component.scss +2 -2
- package/lib/widget/app-announcement/app-announcement.component.ts +0 -1
- package/lib/widget/attachment/Attachment.types.ts +92 -0
- package/lib/widget/attachment/AttachmentUtils.ts +287 -0
- package/lib/widget/attachment/attachment.component.html +3 -3
- package/lib/widget/attachment/attachment.component.scss +9 -12
- package/lib/widget/attachment/attachment.component.ts +267 -254
- package/lib/widget/case-history/case-history.component.ts +0 -1
- package/lib/widget/feed-container/feed-container.component.scss +3 -9
- package/lib/widget/feed-container/feed-container.component.ts +2 -5
- package/lib/widget/file-utility/file-utility.component.html +3 -3
- package/lib/widget/file-utility/file-utility.component.scss +6 -17
- package/lib/widget/file-utility/file-utility.component.ts +24 -9
- package/lib/widget/list-utility/list-utility.component.scss +4 -5
- package/lib/widget/list-utility/list-utility.component.ts +0 -1
- package/lib/widget/quick-create/quick-create.component.ts +41 -23
- package/lib/widget/todo/todo.component.html +12 -10
- package/lib/widget/todo/todo.component.scss +20 -10
- package/lib/widget/todo/todo.component.ts +11 -7
- package/lib/widget/utility/utility.component.ts +0 -1
- package/package.json +1 -1
|
@@ -85,6 +85,31 @@ function prepareSearchResults(listObjData, displayFieldMeta) {
|
|
|
85
85
|
return searchResults;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
function handleGroupedDataSearch(dataApiObj, searchText, clickedGroup, initialCaseClass, itemsTree) {
|
|
89
|
+
const localDataApiObj = cloneDeep(dataApiObj);
|
|
90
|
+
localDataApiObj.fetchedNQData = false;
|
|
91
|
+
localDataApiObj.cache = {};
|
|
92
|
+
|
|
93
|
+
if (!searchText && !clickedGroup) {
|
|
94
|
+
return { shouldReturn: true, value: itemsTree };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
localDataApiObj.parameters[Object.keys(localDataApiObj.parameters)[1]] = searchText;
|
|
98
|
+
localDataApiObj.parameters[Object.keys(localDataApiObj.parameters)[0]] = initialCaseClass;
|
|
99
|
+
|
|
100
|
+
if (clickedGroup) {
|
|
101
|
+
if (!searchText) {
|
|
102
|
+
const containsData = itemsTree.find(item => item.id === clickedGroup);
|
|
103
|
+
if (containsData?.items?.length) {
|
|
104
|
+
return { shouldReturn: true, value: itemsTree };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
localDataApiObj.parameters[Object.keys(localDataApiObj.parameters)[0]] = JSON.stringify([clickedGroup]);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return { shouldReturn: false, value: localDataApiObj };
|
|
111
|
+
}
|
|
112
|
+
|
|
88
113
|
async function doSearch(
|
|
89
114
|
searchText,
|
|
90
115
|
clickedGroup,
|
|
@@ -96,61 +121,44 @@ async function doSearch(
|
|
|
96
121
|
showSecondaryInSearchOnly,
|
|
97
122
|
selected
|
|
98
123
|
) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (isGroupData) {
|
|
103
|
-
dataApiObj = cloneDeep(dataApiObj);
|
|
104
|
-
dataApiObj.fetchedNQData = false;
|
|
105
|
-
dataApiObj.cache = {};
|
|
106
|
-
|
|
107
|
-
// if we have no search text and no group selected, return the original tree
|
|
108
|
-
if (searchText === '' && clickedGroup === '') {
|
|
109
|
-
return itemsTree;
|
|
110
|
-
}
|
|
124
|
+
if (!dataApiObj) {
|
|
125
|
+
return itemsTree;
|
|
126
|
+
}
|
|
111
127
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
dataApiObj.parameters[Object.keys(dataApiObj.parameters)[0]] = initialCaseClass;
|
|
115
|
-
|
|
116
|
-
// if we have a selected group
|
|
117
|
-
if (clickedGroup) {
|
|
118
|
-
// check if the data for this group is already present and no search text
|
|
119
|
-
if (searchText === '') {
|
|
120
|
-
const containsData = itemsTree.find(item => item.id === clickedGroup);
|
|
121
|
-
// do not make API call when items of respective group are already fetched
|
|
122
|
-
if (containsData?.items?.length) return itemsTree;
|
|
123
|
-
}
|
|
128
|
+
let searchTextForApi = '';
|
|
129
|
+
let localDataApiObj = dataApiObj;
|
|
124
130
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
131
|
+
if (isGroupData) {
|
|
132
|
+
const groupResult = handleGroupedDataSearch(dataApiObj, searchText, clickedGroup, initialCaseClass, itemsTree);
|
|
133
|
+
if (groupResult.shouldReturn) {
|
|
134
|
+
return groupResult.value;
|
|
129
135
|
}
|
|
136
|
+
localDataApiObj = groupResult.value;
|
|
137
|
+
} else {
|
|
138
|
+
searchTextForApi = searchText;
|
|
139
|
+
}
|
|
130
140
|
|
|
131
|
-
|
|
132
|
-
const response = await dataApiObj.fetchData(searchTextForUngroupedData).catch(() => {
|
|
133
|
-
return itemsTree;
|
|
134
|
-
});
|
|
141
|
+
const response = await localDataApiObj.fetchData(searchTextForApi).catch(() => ({ data: undefined }));
|
|
135
142
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const showSecondaryData = showSecondaryInSearchOnly ? !!searchText : true;
|
|
147
|
-
if (listObjData !== undefined && listObjData.length > 0) {
|
|
148
|
-
newItemsTree = listObjData.map(entry => createSingleTreeObejct(entry, displayFieldMeta, showSecondaryData, selected));
|
|
143
|
+
let listObjData = response.data;
|
|
144
|
+
if (!listObjData) {
|
|
145
|
+
return itemsTree;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (isGroupData) {
|
|
149
|
+
if (searchText) {
|
|
150
|
+
listObjData = prepareSearchResults(listObjData, displayFieldMeta);
|
|
151
|
+
} else {
|
|
152
|
+
return putItemsDataInItemsTree(listObjData, displayFieldMeta, itemsTree, showSecondaryInSearchOnly, selected);
|
|
149
153
|
}
|
|
150
|
-
return newItemsTree;
|
|
151
154
|
}
|
|
152
155
|
|
|
153
|
-
|
|
156
|
+
if (listObjData.length === 0) {
|
|
157
|
+
return [];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const showSecondaryData = showSecondaryInSearchOnly ? !!searchText : true;
|
|
161
|
+
return listObjData.map(entry => createSingleTreeObejct(entry, displayFieldMeta, showSecondaryData, selected));
|
|
154
162
|
}
|
|
155
163
|
|
|
156
164
|
function setValuesToPropertyList(searchText, assocProp, items, columns, actions, updatePropertyInRedux = true) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<div *ngIf="isDisplayModeEnabled && !canBeChangedInReviewMode; else semanticLinkCheck">
|
|
2
|
+
<component-mapper name="SingleReferenceReadOnly" [props]="{ pConn$ }"></component-mapper>
|
|
3
|
+
</div>
|
|
4
|
+
<ng-template #semanticLinkCheck>
|
|
5
|
+
<div *ngIf="type === 'SemanticLink' && !canBeChangedInReviewMode; else loadDynamicComp">
|
|
6
|
+
<component-mapper name="SemanticLink" [props]="{ pConn$: newPconn }"></component-mapper>
|
|
7
|
+
</div>
|
|
8
|
+
</ng-template>
|
|
9
|
+
<ng-template #loadDynamicComp>
|
|
10
|
+
<component-mapper
|
|
11
|
+
*ngIf="newComponentName"
|
|
12
|
+
[name]="newComponentName"
|
|
13
|
+
[props]="{ pConn$: newPconn, formGroup$ }"
|
|
14
|
+
[parent]="this"
|
|
15
|
+
[outputEvents]="{ onRecordChange: onRecordChange }"
|
|
16
|
+
></component-mapper>
|
|
17
|
+
</ng-template>
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ObjectReferenceComponent } from './object-reference.component';
|
|
4
|
+
|
|
5
|
+
describe('ObjectReferenceComponent', () => {
|
|
6
|
+
let component: ObjectReferenceComponent;
|
|
7
|
+
let fixture: ComponentFixture<ObjectReferenceComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [ObjectReferenceComponent]
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
|
|
14
|
+
fixture = TestBed.createComponent(ObjectReferenceComponent);
|
|
15
|
+
component = fixture.componentInstance;
|
|
16
|
+
fixture.detectChanges();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should create', () => {
|
|
20
|
+
expect(component).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, Input, OnInit, forwardRef, OnDestroy } from '@angular/core';
|
|
3
|
+
import { FormGroup } from '@angular/forms';
|
|
4
|
+
import { ComponentMetadataConfig } from '@pega/pcore-pconnect-typedefs/interpreter/types';
|
|
5
|
+
import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components';
|
|
6
|
+
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
7
|
+
import { generateColumns, getDataRelationshipContextFromKey } from '@pega/angular-sdk-components';
|
|
8
|
+
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
9
|
+
|
|
10
|
+
interface ObjectReferenceProps extends PConnFieldProps {
|
|
11
|
+
showPromotedFilters: boolean;
|
|
12
|
+
inline: boolean;
|
|
13
|
+
parameters: object;
|
|
14
|
+
mode: string;
|
|
15
|
+
targetObjectType: any;
|
|
16
|
+
allowAndPersistChangesInReviewMode: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'app-object-reference',
|
|
21
|
+
imports: [CommonModule, forwardRef(() => ComponentMapperComponent)],
|
|
22
|
+
templateUrl: './object-reference.component.html',
|
|
23
|
+
styleUrl: './object-reference.component.scss'
|
|
24
|
+
})
|
|
25
|
+
export class ObjectReferenceComponent implements OnInit, OnDestroy {
|
|
26
|
+
@Input() pConn$: typeof PConnect;
|
|
27
|
+
@Input() formGroup$: FormGroup;
|
|
28
|
+
|
|
29
|
+
angularPConnectData: AngularPConnectData = {};
|
|
30
|
+
configProps: ObjectReferenceProps;
|
|
31
|
+
value: { [key: string]: any };
|
|
32
|
+
readOnly: boolean;
|
|
33
|
+
isForm: boolean;
|
|
34
|
+
type: string;
|
|
35
|
+
isDisplayModeEnabled: boolean;
|
|
36
|
+
canBeChangedInReviewMode: boolean;
|
|
37
|
+
newComponentName: string;
|
|
38
|
+
newPconn: typeof PConnect;
|
|
39
|
+
rawViewMetadata: ComponentMetadataConfig | undefined;
|
|
40
|
+
|
|
41
|
+
constructor(private angularPConnect: AngularPConnectService) {}
|
|
42
|
+
|
|
43
|
+
ngOnInit() {
|
|
44
|
+
this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
|
|
45
|
+
this.checkAndUpdate();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
onStateChange() {
|
|
49
|
+
this.checkAndUpdate();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
ngOnDestroy() {
|
|
53
|
+
if (this.angularPConnectData.unsubscribeFn) {
|
|
54
|
+
this.angularPConnectData.unsubscribeFn();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
checkAndUpdate() {
|
|
59
|
+
const shouldUpdate = this.angularPConnect.shouldComponentUpdate(this);
|
|
60
|
+
if (shouldUpdate) {
|
|
61
|
+
this.updateSelf();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
updateSelf() {
|
|
66
|
+
this.configProps = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as ObjectReferenceProps;
|
|
67
|
+
const {
|
|
68
|
+
displayMode,
|
|
69
|
+
allowAndPersistChangesInReviewMode: editableInReview = false,
|
|
70
|
+
targetObjectType,
|
|
71
|
+
mode,
|
|
72
|
+
parameters,
|
|
73
|
+
hideLabel,
|
|
74
|
+
inline,
|
|
75
|
+
showPromotedFilters
|
|
76
|
+
} = this.configProps;
|
|
77
|
+
|
|
78
|
+
const referenceType: string = targetObjectType === 'case' ? 'Case' : 'Data';
|
|
79
|
+
this.rawViewMetadata = this.pConn$.getRawMetadata();
|
|
80
|
+
const refFieldMetadata = this.pConn$.getFieldMetadata(this.rawViewMetadata?.config?.value?.split('.', 2)[1] ?? '');
|
|
81
|
+
const propsToUse = { ...this.pConn$.getInheritedProps(), ...this.configProps };
|
|
82
|
+
|
|
83
|
+
this.isDisplayModeEnabled = displayMode === 'DISPLAY_ONLY';
|
|
84
|
+
this.type = this.getComponentType();
|
|
85
|
+
this.canBeChangedInReviewMode = editableInReview && ['Autocomplete', 'Dropdown'].includes(this.type);
|
|
86
|
+
|
|
87
|
+
if (this.type === 'SemanticLink' && !this.canBeChangedInReviewMode) {
|
|
88
|
+
const config: any = {
|
|
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);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (this.type !== 'SemanticLink' && !this.isDisplayModeEnabled) {
|
|
103
|
+
const config: any = { ...this.rawViewMetadata?.config };
|
|
104
|
+
generateColumns(config, this.pConn$, referenceType);
|
|
105
|
+
config.deferDatasource = true;
|
|
106
|
+
config.listType = 'datapage';
|
|
107
|
+
if (['Dropdown', 'AutoComplete'].includes(this.type) && !config.placeholder) {
|
|
108
|
+
config.placeholder = '@L Select...';
|
|
109
|
+
}
|
|
110
|
+
config.showPromotedFilters = showPromotedFilters;
|
|
111
|
+
if (!this.canBeChangedInReviewMode) {
|
|
112
|
+
config.displayMode = displayMode;
|
|
113
|
+
}
|
|
114
|
+
config.parameters = parameters;
|
|
115
|
+
|
|
116
|
+
this.createOtherComponentPConnect(config, propsToUse, mode, refFieldMetadata, referenceType, hideLabel, inline);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
onRecordChange(value) {
|
|
121
|
+
const caseKey = this.pConn$.getCaseInfo().getKey() ?? '';
|
|
122
|
+
const refreshOptions = { autoDetectRefresh: true, propertyName: '' };
|
|
123
|
+
refreshOptions.propertyName = this.rawViewMetadata?.config?.value ?? '';
|
|
124
|
+
|
|
125
|
+
if (!this.canBeChangedInReviewMode || !this.pConn$.getValue('__currentPageTabViewName')) {
|
|
126
|
+
const pgRef = this.pConn$.getPageReference().replace('caseInfo.content', '') ?? '';
|
|
127
|
+
const viewName = this.rawViewMetadata?.name;
|
|
128
|
+
if (viewName && viewName.length > 0) {
|
|
129
|
+
getPConnect().getActionsApi().refreshCaseView(caseKey, viewName, pgRef, refreshOptions);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const propValue = value;
|
|
134
|
+
const propName =
|
|
135
|
+
this.rawViewMetadata?.type === 'SimpleTableSelect' && this.configProps.mode === 'multi'
|
|
136
|
+
? PCore.getAnnotationUtils().getPropertyName(this.rawViewMetadata?.config?.selectionList ?? '')
|
|
137
|
+
: PCore.getAnnotationUtils().getPropertyName(this.rawViewMetadata?.config?.value ?? '');
|
|
138
|
+
|
|
139
|
+
if (propValue && this.canBeChangedInReviewMode && this.isDisplayModeEnabled) {
|
|
140
|
+
PCore.getCaseUtils()
|
|
141
|
+
.getCaseEditLock(caseKey, '')
|
|
142
|
+
.then(caseResponse => {
|
|
143
|
+
const pageTokens = this.pConn$.getPageReference().replace('caseInfo.content', '').split('.');
|
|
144
|
+
let curr = {};
|
|
145
|
+
const commitData = curr;
|
|
146
|
+
|
|
147
|
+
pageTokens?.forEach(el => {
|
|
148
|
+
if (el !== '') {
|
|
149
|
+
curr[el] = {};
|
|
150
|
+
curr = curr[el];
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// expecting format like {Customer: {pyID:"C-100"}}
|
|
155
|
+
const propArr = propName.split('.');
|
|
156
|
+
propArr.forEach((element, idx) => {
|
|
157
|
+
if (idx + 1 === propArr.length) {
|
|
158
|
+
curr[element] = propValue;
|
|
159
|
+
} else {
|
|
160
|
+
curr[element] = {};
|
|
161
|
+
curr = curr[element];
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
PCore.getCaseUtils()
|
|
166
|
+
.updateCaseEditFieldsData(caseKey, { [caseKey]: commitData }, caseResponse.headers.etag, this.pConn$?.getContextName() ?? '')
|
|
167
|
+
.then(response => {
|
|
168
|
+
PCore.getContainerUtils().updateParentLastUpdateTime(this.pConn$.getContextName() ?? '', response.data.data.caseInfo.lastUpdateTime);
|
|
169
|
+
PCore.getContainerUtils().updateRelatedContextEtag(this.pConn$.getContextName() ?? '', response.headers.etag);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private getComponentType(): string {
|
|
176
|
+
// componentType is not defined in ComponentMetadataConfig type so using any
|
|
177
|
+
return (this.rawViewMetadata?.config as any)?.componentType;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
private createSemanticLinkPConnect(config: any, displayMode: string, referenceType: string, hideLabel: boolean) {
|
|
181
|
+
const semanticLinkConfig = {
|
|
182
|
+
...config,
|
|
183
|
+
displayMode,
|
|
184
|
+
referenceType,
|
|
185
|
+
hideLabel,
|
|
186
|
+
dataRelationshipContext: config.displayField ? getDataRelationshipContextFromKey(config.displayField) : null
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const component = this.pConn$.createComponent({ type: 'SemanticLink', config: semanticLinkConfig }, '', 0, {});
|
|
190
|
+
this.newPconn = component?.getPConnect();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private createOtherComponentPConnect(
|
|
194
|
+
config: any,
|
|
195
|
+
propsToUse: any,
|
|
196
|
+
mode: string,
|
|
197
|
+
refFieldMetadata: any,
|
|
198
|
+
referenceType: string,
|
|
199
|
+
hideLabel: boolean,
|
|
200
|
+
inline: boolean
|
|
201
|
+
) {
|
|
202
|
+
const fieldMetaData = {
|
|
203
|
+
datasourceMetadata: {
|
|
204
|
+
datasource: {
|
|
205
|
+
parameters: config.parameters ?? {},
|
|
206
|
+
propertyForDisplayText: config.datasource?.fields?.text?.substring(3) ?? config.datasource?.fields?.text,
|
|
207
|
+
propertyForValue: config.datasource?.fields?.value?.substring(3) ?? config.datasource?.fields?.value,
|
|
208
|
+
name: config.referenceList ?? ''
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const componentConfig = {
|
|
214
|
+
...config,
|
|
215
|
+
descriptors: mode === 'single' ? refFieldMetadata?.descriptors : null,
|
|
216
|
+
datasourceMetadata: fieldMetaData.datasourceMetadata,
|
|
217
|
+
required: propsToUse.required,
|
|
218
|
+
visibility: propsToUse.visibility,
|
|
219
|
+
disabled: propsToUse.disabled,
|
|
220
|
+
label: propsToUse.label,
|
|
221
|
+
readOnly: false,
|
|
222
|
+
...(mode === 'single' && { referenceType }),
|
|
223
|
+
contextClass: config.targetObjectClass,
|
|
224
|
+
primaryField: config.displayField,
|
|
225
|
+
dataRelationshipContext: config.displayField ? getDataRelationshipContextFromKey(config.displayField) : null,
|
|
226
|
+
hideLabel,
|
|
227
|
+
inline
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const component = this.pConn$.createComponent({ type: this.type, config: componentConfig }, '', 0, {});
|
|
231
|
+
this.newComponentName = component?.getPConnect().getComponentName();
|
|
232
|
+
this.newPconn = component?.getPConnect();
|
|
233
|
+
if (this.rawViewMetadata?.config) {
|
|
234
|
+
this.rawViewMetadata.config = { ...config };
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|