@pega/angular-sdk-overrides 24.2.12 → 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 -1
- 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 +2 -2
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.scss +4 -3
- package/lib/designSystemExtension/material-details-fields/material-details-fields.component.ts +0 -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 +1 -1
- package/lib/designSystemExtension/operator/operator.component.scss +3 -10
- package/lib/designSystemExtension/operator/operator.component.ts +0 -2
- 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 -1
- package/lib/field/auto-complete/auto-complete.component.ts +35 -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 +14 -7
- 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 +36 -169
- package/lib/field/date/date.component.html +2 -2
- package/lib/field/date/date.component.ts +30 -151
- package/lib/field/date-time/date-time.component.html +1 -1
- package/lib/field/date-time/date-time.component.ts +34 -149
- package/lib/field/decimal/decimal.component.ts +38 -164
- package/lib/field/dropdown/dropdown.component.ts +29 -152
- package/lib/field/email/email.component.ts +16 -156
- package/lib/field/field.base.ts +149 -0
- package/lib/field/group/group.component.ts +7 -5
- package/lib/field/integer/integer.component.ts +18 -158
- package/lib/field/list-view-action-buttons/list-view-action-buttons.component.ts +0 -1
- 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.ts +37 -155
- package/lib/field/phone/phone.component.html +18 -19
- package/lib/field/phone/phone.component.scss +4 -0
- package/lib/field/phone/phone.component.ts +43 -145
- package/lib/field/radio-buttons/radio-buttons.component.html +14 -6
- 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 +21 -91
- 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 +0 -1
- package/lib/field/text-area/text-area.component.ts +18 -153
- package/lib/field/text-content/text-content.component.ts +0 -1
- package/lib/field/text-input/text-input.component.ts +16 -156
- package/lib/field/time/time.component.ts +17 -152
- package/lib/field/url/url.component.ts +16 -155
- package/lib/field/user-reference/user-reference.component.scss +0 -1
- package/lib/field/user-reference/user-reference.component.ts +2 -4
- package/lib/infra/Containers/flow-container/flow-container.component.html +2 -2
- package/lib/infra/Containers/flow-container/flow-container.component.ts +8 -9
- 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.ts +5 -11
- 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.ts +21 -10
- package/lib/infra/assignment-card/assignment-card.component.html +1 -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 +22 -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 -4
- package/lib/infra/reference/reference.component.ts +5 -0
- package/lib/infra/region/region.component.ts +0 -1
- package/lib/infra/root-container/root-container.component.scss +0 -1
- package/lib/infra/root-container/root-container.component.ts +1 -5
- 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/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 +1 -1
- 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 +10 -3
- 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.ts +14 -28
- 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 -162
- package/lib/template/list-view/list-view.component.scss +25 -21
- package/lib/template/list-view/list-view.component.ts +207 -119
- package/lib/template/list-view/listViewHelpers.ts +1 -4
- package/lib/template/list-view/utils.ts +25 -2
- 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 +117 -3
- package/lib/template/simple-table-manual/simple-table-manual.component.html +4 -4
- package/lib/template/simple-table-manual/simple-table-manual.component.scss +4 -14
- package/lib/template/simple-table-manual/simple-table-manual.component.ts +45 -25
- 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 +42 -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 -3
- 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 +8 -5
- package/lib/widget/todo/todo.component.scss +11 -10
- package/lib/widget/todo/todo.component.ts +7 -4
- 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
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, forwardRef } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { FormControl,
|
|
3
|
+
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
4
4
|
import { MatInputModule } from '@angular/material/input';
|
|
5
5
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
6
|
-
import { interval } from 'rxjs';
|
|
7
6
|
import { NgxCurrencyDirective, NgxCurrencyInputMode } from 'ngx-currency';
|
|
8
|
-
|
|
9
|
-
import {
|
|
7
|
+
|
|
8
|
+
import { FieldBase } from '@pega/angular-sdk-components';
|
|
10
9
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
11
10
|
import { handleEvent } from '@pega/angular-sdk-components';
|
|
12
11
|
import { getCurrencyCharacters } from '@pega/angular-sdk-components';
|
|
13
|
-
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
14
12
|
import { format } from '@pega/angular-sdk-components';
|
|
13
|
+
import { PConnFieldProps } from '@pega/angular-sdk-components';
|
|
15
14
|
|
|
16
|
-
interface PercentageProps extends PConnFieldProps {
|
|
15
|
+
interface PercentageProps extends Omit<PConnFieldProps, 'value'> {
|
|
16
|
+
value?: number;
|
|
17
17
|
showGroupSeparators?: string;
|
|
18
18
|
decimalPrecision?: number;
|
|
19
19
|
currencyISOCode?: string;
|
|
@@ -24,158 +24,56 @@ interface PercentageProps extends PConnFieldProps {
|
|
|
24
24
|
selector: 'app-percentage',
|
|
25
25
|
templateUrl: './percentage.component.html',
|
|
26
26
|
styleUrls: ['./percentage.component.scss'],
|
|
27
|
-
standalone: true,
|
|
28
27
|
imports: [CommonModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule, NgxCurrencyDirective, forwardRef(() => ComponentMapperComponent)]
|
|
29
28
|
})
|
|
30
|
-
export class PercentageComponent
|
|
31
|
-
@Input() pConn$: typeof PConnect;
|
|
32
|
-
@Input() formGroup$: FormGroup;
|
|
33
|
-
|
|
34
|
-
// Used with AngularPConnect
|
|
35
|
-
angularPConnectData: AngularPConnectData = {};
|
|
29
|
+
export class PercentageComponent extends FieldBase {
|
|
36
30
|
configProps$: PercentageProps;
|
|
31
|
+
override fieldControl = new FormControl<number | null>(null, null);
|
|
37
32
|
|
|
38
|
-
label$ = '';
|
|
39
|
-
value$: number;
|
|
40
|
-
bRequired$ = false;
|
|
41
|
-
bReadonly$ = false;
|
|
42
|
-
bDisabled$ = false;
|
|
43
|
-
bVisible$ = true;
|
|
44
|
-
displayMode$?: string = '';
|
|
45
|
-
controlName$: string;
|
|
46
|
-
bHasForm$ = true;
|
|
47
|
-
componentReference = '';
|
|
48
|
-
testId: string;
|
|
49
|
-
helperText: string;
|
|
50
|
-
placeholder: string;
|
|
51
33
|
decimalSeparator: string;
|
|
52
34
|
thousandSeparator: string;
|
|
53
|
-
inputMode: any;
|
|
35
|
+
inputMode: any = NgxCurrencyInputMode.Natural;
|
|
54
36
|
decimalPrecision: number | undefined;
|
|
55
|
-
fieldControl = new FormControl<number | null>(null, null);
|
|
56
|
-
actionsApi: Object;
|
|
57
|
-
propName: string;
|
|
58
37
|
formattedValue: string;
|
|
59
38
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
ngOnInit(): void {
|
|
67
|
-
// First thing in initialization is registering and subscribing to the AngularPConnect service
|
|
68
|
-
this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange);
|
|
69
|
-
this.controlName$ = this.angularPConnect.getComponentID(this);
|
|
39
|
+
/**
|
|
40
|
+
* Updates the component when there are changes in the state.
|
|
41
|
+
*/
|
|
42
|
+
override updateSelf(): void {
|
|
43
|
+
// Resolve configuration properties
|
|
44
|
+
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as PercentageProps;
|
|
70
45
|
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
// this.updateSelf();
|
|
74
|
-
this.checkAndUpdate();
|
|
46
|
+
// Update component common properties
|
|
47
|
+
this.updateComponentCommonProperties(this.configProps$);
|
|
75
48
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
this.
|
|
80
|
-
this.
|
|
81
|
-
} else {
|
|
82
|
-
this.bReadonly$ = true;
|
|
83
|
-
this.bHasForm$ = false;
|
|
49
|
+
// Set component specific properties
|
|
50
|
+
const { value } = this.configProps$;
|
|
51
|
+
if (value) {
|
|
52
|
+
this.value$ = value;
|
|
53
|
+
this.fieldControl.setValue(value);
|
|
84
54
|
}
|
|
85
|
-
}
|
|
86
55
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this.formGroup$.removeControl(this.controlName$);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (this.angularPConnectData.unsubscribeFn) {
|
|
93
|
-
this.angularPConnectData.unsubscribeFn();
|
|
94
|
-
}
|
|
56
|
+
// update percentage properties
|
|
57
|
+
this.updatePercentageProperties(this.configProps$);
|
|
95
58
|
}
|
|
96
59
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
// ONLY call updateSelf when the component should update
|
|
108
|
-
if (bUpdateSelf) {
|
|
109
|
-
this.updateSelf();
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// updateSelf
|
|
114
|
-
updateSelf(): void {
|
|
115
|
-
// moved this from ngOnInit() and call this from there instead...
|
|
116
|
-
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as PercentageProps;
|
|
117
|
-
this.testId = this.configProps$.testId;
|
|
118
|
-
this.label$ = this.configProps$.label;
|
|
119
|
-
this.displayMode$ = this.configProps$.displayMode;
|
|
120
|
-
this.inputMode = NgxCurrencyInputMode.Natural;
|
|
121
|
-
const nValue: any = this.configProps$.value;
|
|
122
|
-
if (nValue) {
|
|
123
|
-
this.value$ = nValue;
|
|
124
|
-
this.fieldControl.setValue(nValue);
|
|
125
|
-
}
|
|
126
|
-
this.helperText = this.configProps$.helperText;
|
|
127
|
-
this.placeholder = this.configProps$.placeholder || '';
|
|
128
|
-
const showGroupSeparators = this.configProps$.showGroupSeparators;
|
|
60
|
+
/**
|
|
61
|
+
* Updates the percentage properties
|
|
62
|
+
*
|
|
63
|
+
* @param {Object} configProps - Configuration properties.
|
|
64
|
+
* @param {boolean} configProps.showGroupSeparators - Whether to show group separators.
|
|
65
|
+
* @param {number} configProps.decimalPrecision - The number of decimal places to display.
|
|
66
|
+
*/
|
|
67
|
+
updatePercentageProperties(configProps): void {
|
|
68
|
+
const { showGroupSeparators, decimalPrecision } = configProps;
|
|
129
69
|
|
|
130
70
|
const theSymbols = getCurrencyCharacters('');
|
|
131
71
|
this.decimalSeparator = theSymbols.theDecimalIndicator;
|
|
132
72
|
this.thousandSeparator = showGroupSeparators ? theSymbols.theDigitGroupSeparator : '';
|
|
73
|
+
this.decimalPrecision = decimalPrecision ?? 2;
|
|
133
74
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (this.displayMode$ === 'DISPLAY_ONLY' || this.displayMode$ === 'STACKED_LARGE_VAL') {
|
|
138
|
-
this.formattedValue = nValue ? format(nValue, 'percentage') : '';
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
|
|
142
|
-
setTimeout(() => {
|
|
143
|
-
if (this.configProps$.required != null) {
|
|
144
|
-
this.bRequired$ = this.utils.getBooleanValue(this.configProps$.required);
|
|
145
|
-
}
|
|
146
|
-
this.cdRef.detectChanges();
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
if (this.configProps$.visibility != null) {
|
|
150
|
-
this.bVisible$ = this.utils.getBooleanValue(this.configProps$.visibility);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// disabled
|
|
154
|
-
if (this.configProps$.disabled != undefined) {
|
|
155
|
-
this.bDisabled$ = this.utils.getBooleanValue(this.configProps$.disabled);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (this.bDisabled$) {
|
|
159
|
-
this.fieldControl.disable();
|
|
160
|
-
} else {
|
|
161
|
-
this.fieldControl.enable();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (this.configProps$.readOnly != null) {
|
|
165
|
-
this.bReadonly$ = this.utils.getBooleanValue(this.configProps$.readOnly);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
this.decimalPrecision = this.configProps$?.decimalPrecision ?? 2;
|
|
169
|
-
|
|
170
|
-
this.componentReference = this.pConn$.getStateProps().value;
|
|
171
|
-
|
|
172
|
-
// trigger display of error message with field control
|
|
173
|
-
if (this.angularPConnectData.validateMessage != null && this.angularPConnectData.validateMessage != '') {
|
|
174
|
-
const timer = interval(100).subscribe(() => {
|
|
175
|
-
this.fieldControl.setErrors({ message: true });
|
|
176
|
-
this.fieldControl.markAsTouched();
|
|
177
|
-
timer.unsubscribe();
|
|
178
|
-
});
|
|
75
|
+
if (['DISPLAY_ONLY', 'STACKED_LARGE_VAL'].includes(this.displayMode$)) {
|
|
76
|
+
this.formattedValue = this.value$ ? format(this.value$, 'percentage') : '';
|
|
179
77
|
}
|
|
180
78
|
}
|
|
181
79
|
|
|
@@ -211,20 +109,4 @@ export class PercentageComponent implements OnInit, OnDestroy {
|
|
|
211
109
|
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
|
|
212
110
|
}
|
|
213
111
|
}
|
|
214
|
-
|
|
215
|
-
getErrorMessage() {
|
|
216
|
-
// field control gets error message from here
|
|
217
|
-
let errMessage = '';
|
|
218
|
-
// look for validation messages for json, pre-defined or just an error pushed from workitem (400)
|
|
219
|
-
if (this.fieldControl.hasError('message')) {
|
|
220
|
-
errMessage = this.angularPConnectData.validateMessage ?? '';
|
|
221
|
-
return errMessage;
|
|
222
|
-
}
|
|
223
|
-
if (this.fieldControl.hasError('required')) {
|
|
224
|
-
errMessage = 'You must enter a value';
|
|
225
|
-
} else if (this.fieldControl.errors) {
|
|
226
|
-
errMessage = this.fieldControl.errors.toString();
|
|
227
|
-
}
|
|
228
|
-
return errMessage;
|
|
229
|
-
}
|
|
230
112
|
}
|