@pega/react-sdk-overrides 0.23.25 → 8.8.20
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/AlertBanner/AlertBanner.tsx +47 -0
- package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/lib/designSystemExtension/Banner/Banner.css +4 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +25 -11
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +15 -10
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +10 -11
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +10 -3
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +11 -5
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +11 -3
- package/lib/designSystemExtension/Operator/Operator.tsx +30 -21
- package/lib/designSystemExtension/Pulse/Pulse.tsx +11 -7
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
- package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.css +6 -2
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +12 -3
- package/lib/field/AutoComplete/AutoComplete.tsx +37 -18
- package/lib/field/CancelAlert/CancelAlert.tsx +21 -12
- package/lib/field/Checkbox/Checkbox.tsx +41 -17
- package/lib/field/Currency/Currency.tsx +23 -15
- package/lib/field/Currency/currency-utils.ts +1 -2
- package/lib/field/Date/Date.tsx +31 -17
- package/lib/field/DateTime/DateTime.tsx +26 -15
- package/lib/field/Decimal/Decimal.tsx +82 -19
- package/lib/field/Dropdown/Dropdown.tsx +57 -14
- package/lib/field/Email/Email.tsx +17 -9
- package/lib/field/Integer/Integer.tsx +15 -7
- package/lib/field/Percentage/Percentage.tsx +15 -7
- package/lib/field/Phone/Phone.tsx +21 -12
- package/lib/field/RadioButtons/RadioButtons.tsx +54 -27
- package/lib/field/RichText/RichText.tsx +93 -0
- package/lib/field/RichText/index.tsx +1 -0
- package/lib/field/ScalarList/ScalarList.tsx +64 -0
- package/lib/field/ScalarList/config-ext.json +8 -0
- package/lib/field/ScalarList/index.tsx +1 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
- package/lib/field/SemanticLink/utils.ts +2 -1
- package/lib/field/TextArea/TextArea.tsx +14 -5
- package/lib/field/TextContent/TextContent.tsx +10 -1
- package/lib/field/TextInput/TextInput.tsx +40 -11
- package/lib/field/Time/Time.tsx +29 -26
- package/lib/field/URL/URL.tsx +24 -8
- package/lib/field/UserReference/UserReference.tsx +52 -60
- package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +5 -5
- package/lib/helpers/auth.js +741 -390
- package/lib/helpers/authManager.ts +933 -0
- package/lib/helpers/case-utils.tsx +103 -0
- package/lib/helpers/common-utils.ts +4 -0
- package/lib/helpers/config_access.js +63 -145
- package/lib/helpers/data_page.ts +2 -1
- package/lib/helpers/date-format-utils.ts +29 -19
- package/lib/helpers/{event-utils.js → event-utils.ts} +1 -1
- package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +4 -3
- package/lib/helpers/formatters/{Currency.js → Currency.ts} +13 -12
- package/lib/helpers/formatters/{CurrencyMap.js → CurrencyMap.ts} +8 -5
- package/lib/helpers/formatters/{Date.js → Date.ts} +2 -2
- package/lib/helpers/formatters/{common.js → common.ts} +4 -4
- package/lib/helpers/formatters/{index.js → index.ts} +3 -3
- package/lib/helpers/simpleTableHelpers.ts +10 -6
- package/lib/helpers/state-utils.tsx +47 -0
- package/lib/helpers/template-utils.ts +3 -4
- package/lib/helpers/utils.ts +12 -4
- package/lib/helpers/versionHelpers.ts +0 -1
- package/lib/infra/ActionButtons/ActionButtons.tsx +13 -18
- package/lib/infra/Assignment/Assignment.tsx +38 -32
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +15 -19
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +76 -64
- package/lib/infra/Containers/FlowContainer/{helpers.js → helpers.ts} +18 -16
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +41 -27
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +19 -28
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +16 -20
- package/lib/infra/DashboardFilter/filterUtils.tsx +3 -1
- package/lib/infra/DeferLoad/DeferLoad.tsx +16 -19
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +20 -19
- package/lib/infra/MultiStep/MultiStep.tsx +24 -24
- package/lib/infra/NavBar/NavBar.tsx +23 -24
- package/lib/infra/Reference/Reference.tsx +13 -18
- package/lib/infra/Region/Region.tsx +8 -6
- package/lib/infra/RootContainer/RootContainer.tsx +32 -39
- package/lib/infra/Stages/Stages.tsx +15 -9
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +8 -1
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +12 -12
- package/lib/infra/View/View.tsx +30 -58
- package/lib/template/AppShell/AppShell.tsx +51 -34
- package/lib/template/BannerPage/BannerPage.tsx +26 -31
- package/lib/template/CaseSummary/CaseSummary.tsx +15 -8
- package/lib/template/CaseView/CaseView.tsx +137 -100
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +27 -27
- package/lib/template/Confirmation/Confirmation.tsx +29 -52
- package/lib/template/DataReference/DataReference.tsx +50 -52
- package/lib/template/DefaultForm/DefaultForm.tsx +29 -20
- package/lib/template/DefaultForm/utils/index.ts +33 -0
- package/lib/template/Details/Details/Details.tsx +16 -17
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +13 -16
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +19 -18
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +20 -18
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -27
- package/lib/template/InlineDashboard/InlineDashboard.tsx +11 -7
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -17
- package/lib/template/ListPage/ListPage.tsx +14 -13
- package/lib/template/ListView/ListView.tsx +140 -152
- package/lib/template/ListView/{hooks.js → hooks.ts} +3 -1
- package/lib/template/ListView/{utils.js → utils.ts} +172 -23
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +12 -17
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +16 -1
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +19 -18
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +9 -1
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +17 -17
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +8 -7
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +10 -10
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +5 -7
- package/lib/template/PromotedFilters/PromotedFilters.tsx +23 -17
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +103 -6
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +28 -7
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +26 -31
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +34 -36
- package/lib/template/SubTabs/SubTabs.tsx +10 -11
- package/lib/template/SubTabs/tabUtils.ts +0 -2
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +10 -15
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +10 -10
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +10 -12
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +17 -3
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +35 -25
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +7 -1
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -17
- package/lib/template/WssNavBar/WssNavBar.tsx +36 -14
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +13 -21
- package/lib/widget/Attachment/Attachment.css +15 -3
- package/lib/widget/Attachment/Attachment.tsx +51 -32
- package/lib/widget/CaseHistory/CaseHistory.tsx +13 -11
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +13 -1
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +40 -26
- package/lib/widget/Followers/Followers.tsx +10 -11
- package/lib/widget/QuickCreate/QuickCreate.tsx +15 -6
- package/lib/widget/SummaryItem/SummaryItem.tsx +12 -4
- package/lib/widget/SummaryList/SummaryList.tsx +17 -3
- package/lib/widget/ToDo/ToDo.tsx +69 -104
- package/package.json +1 -1
- package/lib/helpers/authManager.js +0 -631
- /package/lib/helpers/formatters/{Boolean.js → Boolean.ts} +0 -0
- /package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +0 -0
- /package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +0 -0
|
@@ -13,8 +13,8 @@ const types = ["fromNow", "customFormat"];
|
|
|
13
13
|
|
|
14
14
|
// value should be in ISO 8601 format.
|
|
15
15
|
function DateFormatter(
|
|
16
|
-
value,
|
|
17
|
-
{ type = types[1], format = "DD/MM/YYYY", timezone } = {}
|
|
16
|
+
value: string,
|
|
17
|
+
{ type = types[1], format = "DD/MM/YYYY", timezone = "America/New_York" } = {}
|
|
18
18
|
) {
|
|
19
19
|
if (!value) return value;
|
|
20
20
|
switch (type) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
export function getLocale(locale: string = '') {
|
|
2
3
|
// use locale if specified
|
|
3
4
|
if (locale) return locale;
|
|
4
5
|
// otherwise, use operator locale if it's defined
|
|
5
|
-
if (
|
|
6
|
+
if (PCore.getEnvironmentInfo().getLocale()) return PCore.getEnvironmentInfo().getLocale();
|
|
6
7
|
// fallback
|
|
7
8
|
return Intl.DateTimeFormat().resolvedOptions().locale;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
export function getCurrentTimezone(timezone) {
|
|
11
|
+
export function getCurrentTimezone(timezone: string = "America/New_York" ) {
|
|
11
12
|
if (timezone) return timezone;
|
|
12
|
-
// eslint-disable-next-line no-undef
|
|
13
13
|
return PCore?.getLocaleUtils?.().getTimeZoneInUse?.();
|
|
14
14
|
}
|
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
9
|
...DateFormatter
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
function getDateObject(text) {
|
|
12
|
+
function getDateObject(text): Date {
|
|
13
13
|
// TODO - cleanup formatters util functions as DX APIs are returning values per ISO std now.
|
|
14
14
|
const timeStamp = text.replace(/-/g, "");
|
|
15
15
|
const isDateTime = timeStamp.indexOf("GMT") !== -1;
|
|
@@ -58,8 +58,8 @@ function parseDateInISO(value) {
|
|
|
58
58
|
return value ? getDateObject(value).toISOString() : value;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export function format(value, type, options = {}) {
|
|
62
|
-
let formattedValue;
|
|
61
|
+
export function format(value, type, options = {}): string {
|
|
62
|
+
let formattedValue: string;
|
|
63
63
|
|
|
64
64
|
switch (type?.toLowerCase()) {
|
|
65
65
|
case "currency": {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Utils } from './utils';
|
|
2
2
|
|
|
3
|
-
declare const PCore;
|
|
4
3
|
|
|
5
4
|
export const TABLE_CELL = "SdkRenderer";
|
|
6
5
|
export const DELETE_ICON = "DeleteIcon";
|
|
@@ -8,7 +7,7 @@ export const DELETE_ICON = "DeleteIcon";
|
|
|
8
7
|
// BUG-615253: Workaround for autosize in table with lazy loading components
|
|
9
8
|
/* istanbul ignore next */
|
|
10
9
|
function getFieldWidth(field, label) {
|
|
11
|
-
let width;
|
|
10
|
+
let width: number;
|
|
12
11
|
switch (field.type) {
|
|
13
12
|
case "Time":
|
|
14
13
|
width = 150;
|
|
@@ -46,7 +45,7 @@ function getFieldWidth(field, label) {
|
|
|
46
45
|
export const getContext = (thePConn) => {
|
|
47
46
|
const contextName = thePConn.getContextName();
|
|
48
47
|
const pageReference = thePConn.getPageReference();
|
|
49
|
-
let { referenceList } = thePConn.getStateProps().
|
|
48
|
+
let { referenceList } = thePConn.getStateProps()?.config || thePConn.getStateProps();
|
|
50
49
|
const pageReferenceForRows = referenceList.startsWith(".")
|
|
51
50
|
? `${pageReference}.${referenceList.substring(1)}`
|
|
52
51
|
: referenceList;
|
|
@@ -65,7 +64,7 @@ export const getContext = (thePConn) => {
|
|
|
65
64
|
};
|
|
66
65
|
|
|
67
66
|
export const populateRowKey = (rawData) => {
|
|
68
|
-
return rawData.map((row, index) => {
|
|
67
|
+
return rawData.map((row: any, index: number) => {
|
|
69
68
|
return { ...row, index };
|
|
70
69
|
});
|
|
71
70
|
};
|
|
@@ -103,6 +102,7 @@ export const buildMetaForListView = (
|
|
|
103
102
|
ruleClass,
|
|
104
103
|
name,
|
|
105
104
|
propertyLabel,
|
|
105
|
+
isDataObject,
|
|
106
106
|
parameters
|
|
107
107
|
) => {
|
|
108
108
|
return {
|
|
@@ -112,10 +112,12 @@ export const buildMetaForListView = (
|
|
|
112
112
|
referenceList: fieldMetadata.datasource.name,
|
|
113
113
|
parameters: parameters ?? fieldMetadata.datasource.parameters,
|
|
114
114
|
personalization: false,
|
|
115
|
+
isDataObject,
|
|
115
116
|
grouping: true,
|
|
116
117
|
globalSearch: true,
|
|
117
118
|
reorderFields: true,
|
|
118
119
|
toggleFieldVisibility: true,
|
|
120
|
+
title: propertyLabel,
|
|
119
121
|
personalizationId: "" /* TODO */,
|
|
120
122
|
template: "ListView",
|
|
121
123
|
presets: [
|
|
@@ -207,7 +209,7 @@ export const createMetaForTable = (fields, renderMode) => {
|
|
|
207
209
|
* @param {number} index - index of the page list to add
|
|
208
210
|
*/
|
|
209
211
|
export const getAddRowCallback = (pConnect, index) => {
|
|
210
|
-
return () => pConnect.getListActions().insert({}, index);
|
|
212
|
+
return () => pConnect.getListActions().insert({}, index, ''); // 3rd arg null until typedef marked correctly as optional
|
|
211
213
|
};
|
|
212
214
|
|
|
213
215
|
/**
|
|
@@ -216,7 +218,9 @@ export const getAddRowCallback = (pConnect, index) => {
|
|
|
216
218
|
* @param {string} referenceList - referenceList
|
|
217
219
|
* @param {string} pageReference - pageReference
|
|
218
220
|
*/
|
|
219
|
-
|
|
221
|
+
// NOTE: use of type "any" is required since TypeScript doesn't allow private/protected properties
|
|
222
|
+
// to be exported from a class (TS4094 error)
|
|
223
|
+
export function createPConnect(contextName, referenceList, pageReference): any {
|
|
220
224
|
const options = {
|
|
221
225
|
context: contextName,
|
|
222
226
|
pageReference,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { connect, Provider, shallowEqual } from 'react-redux';
|
|
3
|
+
import ReactReduxContext from '@pega/react-sdk-components/lib/bridge/Context/StoreContext';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const connectToState = (mapStateToProps = () => {}) => {
|
|
7
|
+
return (Component: any) => {
|
|
8
|
+
const ConnectedComponent = connect(mapStateToProps, null, null, {
|
|
9
|
+
areStatePropsEqual: (next, prev: any) => {
|
|
10
|
+
// Compare visibility
|
|
11
|
+
const prevWasVisible = prev.visibility !== false;
|
|
12
|
+
if (next.visibility !== undefined && next.visibility !== prevWasVisible) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
// Compare start props
|
|
16
|
+
const c11nEnv = next.getPConnect();
|
|
17
|
+
const allStateProps = c11nEnv.getStateProps();
|
|
18
|
+
for (const key in allStateProps) {
|
|
19
|
+
if (
|
|
20
|
+
!shallowEqual(next[key], prev[key]) ||
|
|
21
|
+
(next.routingInfo && !PCore.isDeepEqual(next.routingInfo, prev.routingInfo))
|
|
22
|
+
) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/* TODO For some rawConfig we are not getting routingInfo under allStateProps */
|
|
27
|
+
return !(
|
|
28
|
+
'routingInfo' in next &&
|
|
29
|
+
(!shallowEqual(next.routingInfo, prev.routingInfo) ||
|
|
30
|
+
!PCore.isDeepEqual(next.routingInfo, prev.routingInfo))
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
})(Component);
|
|
34
|
+
|
|
35
|
+
return (ownProps = {}) => {
|
|
36
|
+
const { store } = useContext<any>(ReactReduxContext);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Provider store={store}>
|
|
40
|
+
<ConnectedComponent {...ownProps} />
|
|
41
|
+
</Provider>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default connectToState;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// This file is adapted from React DX components/template/utils.js
|
|
2
2
|
|
|
3
|
-
declare const PCore: any;
|
|
4
3
|
|
|
5
4
|
export function getAllFields(pConnect: any) {
|
|
6
5
|
const metadata = pConnect.getRawMetadata();
|
|
7
|
-
let allFields = [];
|
|
6
|
+
let allFields: Array<any> = [];
|
|
8
7
|
if (metadata.children && metadata.children.map) {
|
|
9
8
|
allFields = metadata.children.map(fields => {
|
|
10
9
|
const children = fields.children instanceof Array ? fields.children : [];
|
|
@@ -14,7 +13,7 @@ export function getAllFields(pConnect: any) {
|
|
|
14
13
|
return allFields;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
export function filterForFieldValueList(fields: any) {
|
|
16
|
+
export function filterForFieldValueList(fields: Array<any>) {
|
|
18
17
|
return fields
|
|
19
18
|
.filter(({ visibility }) => visibility !== false)
|
|
20
19
|
.map(({ value, label }) => ({
|
|
@@ -47,7 +46,7 @@ export function getIsAssignmentView(pConnect) {
|
|
|
47
46
|
* @param {Function} pConnect PConnect object for the component
|
|
48
47
|
* @param {string} [instructions="casestep"] 'casestep', 'none', or the html content of a Rule-UI-Paragraph rule (processed via core's paragraph annotation handler)
|
|
49
48
|
*/
|
|
50
|
-
export function getInstructions(pConnect, instructions = 'casestep') {
|
|
49
|
+
export function getInstructions(pConnect, instructions: string = 'casestep'): string | undefined {
|
|
51
50
|
const caseStepInstructions =
|
|
52
51
|
PCore.getConstants().CASE_INFO.INSTRUCTIONS &&
|
|
53
52
|
pConnect.getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS);
|
package/lib/helpers/utils.ts
CHANGED
|
@@ -2,6 +2,7 @@ import dayjs from 'dayjs';
|
|
|
2
2
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
3
3
|
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
|
4
4
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
5
|
+
import { SdkConfigAccess } from './config_access';
|
|
5
6
|
|
|
6
7
|
dayjs.extend(customParseFormat);
|
|
7
8
|
dayjs.extend(localizedFormat);
|
|
@@ -10,6 +11,17 @@ dayjs.extend(relativeTime);
|
|
|
10
11
|
export class Utils {
|
|
11
12
|
static lastControlID: number = 0;
|
|
12
13
|
|
|
14
|
+
static getSDKStaticConentUrl() {
|
|
15
|
+
const sdkConfigServer = SdkConfigAccess.getSdkConfigServer();
|
|
16
|
+
|
|
17
|
+
// NOTE: Needs a trailing slash! So add one if not provided
|
|
18
|
+
if (!sdkConfigServer.sdkContentServerUrl.endsWith('/')) {
|
|
19
|
+
sdkConfigServer.sdkContentServerUrl = `${sdkConfigServer.sdkContentServerUrl}/`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return `${sdkConfigServer.sdkContentServerUrl}constellation/`;
|
|
23
|
+
}
|
|
24
|
+
|
|
13
25
|
static getUniqueControlID(): string {
|
|
14
26
|
const sPrefix = 'control-';
|
|
15
27
|
|
|
@@ -322,10 +334,6 @@ export class Utils {
|
|
|
322
334
|
return text.charAt(text.length - 1);
|
|
323
335
|
}
|
|
324
336
|
|
|
325
|
-
static isEmptyObject(obj: Object): Boolean {
|
|
326
|
-
return Object.keys(obj).length === 0;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
337
|
static isObject(objValue) {
|
|
330
338
|
return objValue && typeof objValue === 'object' && objValue.constructor === Object;
|
|
331
339
|
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import { makeStyles } from '@material-ui/core/styles';
|
|
4
3
|
|
|
5
4
|
import Button from '@material-ui/core/Button';
|
|
6
5
|
import { Grid, Divider } from "@material-ui/core";
|
|
7
6
|
|
|
7
|
+
// ActionButtons does NOT have getPConnect. So, no need to extend from PConnProps
|
|
8
|
+
interface ActionButtonsProps {
|
|
9
|
+
// If any, enter additional props that only exist on this component
|
|
10
|
+
arMainButtons?: Array<any>,
|
|
11
|
+
arSecondaryButtons?: Array<any>,
|
|
12
|
+
onButtonPress: any
|
|
13
|
+
}
|
|
8
14
|
|
|
9
15
|
|
|
10
16
|
const useStyles = makeStyles((/* theme */) => ({
|
|
@@ -18,9 +24,11 @@ const useStyles = makeStyles((/* theme */) => ({
|
|
|
18
24
|
}));
|
|
19
25
|
|
|
20
26
|
|
|
21
|
-
export default function ActionButtons(props) {
|
|
22
|
-
const { arMainButtons, arSecondaryButtons, onButtonPress } = props;
|
|
27
|
+
export default function ActionButtons(props: ActionButtonsProps) {
|
|
28
|
+
const { arMainButtons = [], arSecondaryButtons = [], onButtonPress } = props;
|
|
23
29
|
const classes = useStyles();
|
|
30
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
31
|
+
const localeCategory = 'Assignment';
|
|
24
32
|
|
|
25
33
|
function _onButtonPress(sAction: string, sButtonType: string) {
|
|
26
34
|
|
|
@@ -35,7 +43,7 @@ export default function ActionButtons(props) {
|
|
|
35
43
|
<Grid container spacing={1}>
|
|
36
44
|
{arSecondaryButtons.map((sButton) => (
|
|
37
45
|
<Grid item key={sButton.name}>
|
|
38
|
-
<Button variant="contained" color="secondary" onClick={() => { _onButtonPress(sButton.jsAction, "secondary")}} >{sButton.name}</Button>
|
|
46
|
+
<Button variant="contained" color="secondary" onClick={() => { _onButtonPress(sButton.jsAction, "secondary")}} >{localizedVal(sButton.name, localeCategory)}</Button>
|
|
39
47
|
</Grid>
|
|
40
48
|
))}
|
|
41
49
|
</Grid>
|
|
@@ -44,7 +52,7 @@ export default function ActionButtons(props) {
|
|
|
44
52
|
<Grid container spacing={1}>
|
|
45
53
|
{arMainButtons.map((mButton) => (
|
|
46
54
|
<Grid item key={mButton.name}>
|
|
47
|
-
<Button variant="contained" color="primary" onClick={() => { _onButtonPress(mButton.jsAction, "primary")}} >{mButton.name}</Button>
|
|
55
|
+
<Button variant="contained" color="primary" onClick={() => { _onButtonPress(mButton.jsAction, "primary")}} >{localizedVal(mButton.name, localeCategory)}</Button>
|
|
48
56
|
</Grid>
|
|
49
57
|
))}
|
|
50
58
|
</Grid>
|
|
@@ -55,16 +63,3 @@ export default function ActionButtons(props) {
|
|
|
55
63
|
|
|
56
64
|
)
|
|
57
65
|
}
|
|
58
|
-
|
|
59
|
-
ActionButtons.propTypes = {
|
|
60
|
-
arMainButtons: PropTypes.array,
|
|
61
|
-
arSecondaryButtons: PropTypes.array,
|
|
62
|
-
onButtonPress: PropTypes.func
|
|
63
|
-
// buildName: PropTypes.string
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
ActionButtons.defaultProps = {
|
|
67
|
-
arMainButtons: [],
|
|
68
|
-
arSecondaryButtons: []
|
|
69
|
-
// buildName: null
|
|
70
|
-
};
|
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import AssignmentCard from '@pega/react-sdk-components/lib/components/infra/AssignmentCard';
|
|
5
|
-
import MultiStep from '@pega/react-sdk-components/lib/components/infra/MultiStep';
|
|
6
2
|
import Snackbar from '@material-ui/core/Snackbar';
|
|
7
3
|
import IconButton from '@material-ui/core/IconButton';
|
|
8
4
|
import CloseIcon from '@material-ui/icons/Close';
|
|
5
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
6
|
+
|
|
7
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
|
+
|
|
9
|
+
interface AssignmentProps extends PConnProps {
|
|
10
|
+
// If any, enter additional props that only exist on this component
|
|
11
|
+
children: Array<any>,
|
|
12
|
+
itemKey: string,
|
|
13
|
+
isInModal: boolean,
|
|
14
|
+
banners: Array<any>
|
|
15
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
16
|
+
actionButtons: Array<any>,
|
|
17
|
+
}
|
|
18
|
+
|
|
9
19
|
|
|
10
|
-
|
|
20
|
+
export default function Assignment(props: AssignmentProps) {
|
|
21
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
22
|
+
const AssignmentCard = getComponentFromMap("AssignmentCard");
|
|
23
|
+
const MultiStep = getComponentFromMap("MultiStep");
|
|
11
24
|
|
|
12
|
-
|
|
13
|
-
const { getPConnect, children, itemKey, isInModal } = props;
|
|
25
|
+
const { getPConnect, children, itemKey = '', isInModal = false, banners = [] } = props;
|
|
14
26
|
const thePConn = getPConnect();
|
|
15
27
|
|
|
16
28
|
const [bHasNavigation, setHasNavigation] = useState(false);
|
|
17
|
-
const [actionButtons, setActionButtons] = useState(
|
|
29
|
+
const [actionButtons, setActionButtons] = useState([]);
|
|
18
30
|
const [bIsVertical, setIsVertical] = useState(false);
|
|
19
31
|
const [arCurrentStepIndicies, setArCurrentStepIndicies] = useState<Array<any>>([]);
|
|
20
32
|
const [arNavigationSteps, setArNavigationSteps] = useState<Array<any>>([]);
|
|
21
33
|
|
|
22
34
|
const actionsAPI = thePConn.getActionsApi();
|
|
35
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
36
|
+
const localeCategory = 'Assignment';
|
|
37
|
+
const localeReference = `${getPConnect().getCaseInfo().getClassName()}!CASE!${getPConnect().getCaseInfo().getName()}`.toUpperCase();
|
|
23
38
|
|
|
24
39
|
// store off bound functions to above pointers
|
|
25
40
|
const finishAssignment = actionsAPI.finishAssignment.bind(actionsAPI);
|
|
@@ -66,7 +81,7 @@ export default function Assignment(props) {
|
|
|
66
81
|
|
|
67
82
|
const oWorkItem = children[0].props.getPConnect();
|
|
68
83
|
const oWorkData = oWorkItem.getDataObject();
|
|
69
|
-
const oData = thePConn.getDataObject();
|
|
84
|
+
const oData = thePConn.getDataObject(thePConn.getContextName());
|
|
70
85
|
|
|
71
86
|
if (oWorkData?.caseInfo && oWorkData.caseInfo.assignments !== null) {
|
|
72
87
|
const oCaseInfo = oData.caseInfo;
|
|
@@ -91,8 +106,13 @@ export default function Assignment(props) {
|
|
|
91
106
|
} else {
|
|
92
107
|
setIsVertical(false);
|
|
93
108
|
}
|
|
94
|
-
|
|
95
|
-
|
|
109
|
+
const steps = JSON.parse(JSON.stringify(oCaseInfo?.navigation?.steps));
|
|
110
|
+
steps.forEach(step => {
|
|
111
|
+
if (step.name) {
|
|
112
|
+
step.name = PCore.getLocaleUtils().getLocaleValue(step.name, undefined, localeReference);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
setArNavigationSteps(steps);
|
|
96
116
|
setArCurrentStepIndicies(
|
|
97
117
|
findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0)
|
|
98
118
|
);
|
|
@@ -134,7 +154,7 @@ export default function Assignment(props) {
|
|
|
134
154
|
navigatePromise
|
|
135
155
|
.then(() => {})
|
|
136
156
|
.catch(() => {
|
|
137
|
-
showToast(
|
|
157
|
+
showToast(`${localizedVal('Navigation failed!', localeCategory)}`);
|
|
138
158
|
});
|
|
139
159
|
|
|
140
160
|
break;
|
|
@@ -153,7 +173,7 @@ export default function Assignment(props) {
|
|
|
153
173
|
onSaveActionSuccess({ caseType, caseID, assignmentID });
|
|
154
174
|
})
|
|
155
175
|
.catch(() => {
|
|
156
|
-
showToast('Save failed');
|
|
176
|
+
showToast(`${localizedVal('Save failed', localeCategory)}`);
|
|
157
177
|
});
|
|
158
178
|
|
|
159
179
|
break;
|
|
@@ -167,7 +187,7 @@ export default function Assignment(props) {
|
|
|
167
187
|
const isLocalAction =
|
|
168
188
|
thePConn.getCaseInfo().isLocalAction() ||
|
|
169
189
|
(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION &&
|
|
170
|
-
getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION))
|
|
190
|
+
getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION, ''));// 2nd arg empty string until typedefs allow it to be optional
|
|
171
191
|
if (isAssignmentInCreateStage && isInModal && !isLocalAction) {
|
|
172
192
|
const cancelPromise = cancelCreateStageAssignment(itemKey);
|
|
173
193
|
|
|
@@ -176,7 +196,7 @@ export default function Assignment(props) {
|
|
|
176
196
|
publish(PUB_SUB_EVENTS.EVENT_CANCEL, data);
|
|
177
197
|
})
|
|
178
198
|
.catch(() => {
|
|
179
|
-
showToast(
|
|
199
|
+
showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
|
|
180
200
|
});
|
|
181
201
|
} else {
|
|
182
202
|
const cancelPromise = cancelAssignment(itemKey);
|
|
@@ -186,7 +206,7 @@ export default function Assignment(props) {
|
|
|
186
206
|
publish(PUB_SUB_EVENTS.EVENT_CANCEL, data);
|
|
187
207
|
})
|
|
188
208
|
.catch(() => {
|
|
189
|
-
showToast(
|
|
209
|
+
showToast(`${localizedVal('Cancel failed!', localeCategory)}`);
|
|
190
210
|
});
|
|
191
211
|
}
|
|
192
212
|
break;
|
|
@@ -204,7 +224,7 @@ export default function Assignment(props) {
|
|
|
204
224
|
finishPromise
|
|
205
225
|
.then(() => {})
|
|
206
226
|
.catch(() => {
|
|
207
|
-
showToast(
|
|
227
|
+
showToast(`${localizedVal('Submit failed!', localeCategory)}`);
|
|
208
228
|
});
|
|
209
229
|
|
|
210
230
|
break;
|
|
@@ -218,6 +238,7 @@ export default function Assignment(props) {
|
|
|
218
238
|
|
|
219
239
|
return (
|
|
220
240
|
<div id='Assignment'>
|
|
241
|
+
{banners}
|
|
221
242
|
{bHasNavigation ? (
|
|
222
243
|
<React.Fragment>
|
|
223
244
|
<MultiStep
|
|
@@ -303,18 +324,3 @@ export default function Assignment(props) {
|
|
|
303
324
|
// <lit-toast></lit-toast>
|
|
304
325
|
// </div>`}
|
|
305
326
|
// `;
|
|
306
|
-
|
|
307
|
-
Assignment.propTypes = {
|
|
308
|
-
children: PropTypes.node.isRequired,
|
|
309
|
-
getPConnect: PropTypes.func.isRequired,
|
|
310
|
-
itemKey: PropTypes.string,
|
|
311
|
-
isInModal: PropTypes.bool
|
|
312
|
-
// actionButtons: PropTypes.object
|
|
313
|
-
// buildName: PropTypes.string
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
Assignment.defaultProps = {
|
|
317
|
-
itemKey: null,
|
|
318
|
-
isInModal: false
|
|
319
|
-
// buildName: null
|
|
320
|
-
};
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
|
2
|
-
import
|
|
2
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
3
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
4
|
+
|
|
5
|
+
interface AssignmentCardProps extends PConnProps {
|
|
6
|
+
// If any, enter additional props that only exist on this component
|
|
7
|
+
children: Array<any>,
|
|
8
|
+
actionButtons: any,
|
|
9
|
+
onButtonPress: any,
|
|
10
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
11
|
+
itemKey?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
3
14
|
|
|
4
|
-
|
|
15
|
+
export default function AssignmentCard(props: AssignmentCardProps) {
|
|
16
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
17
|
+
const ActionButtons = getComponentFromMap("ActionButtons");
|
|
5
18
|
|
|
6
|
-
export default function AssignmentCard(props) {
|
|
7
19
|
const { children, actionButtons, onButtonPress} = props;
|
|
8
20
|
|
|
9
21
|
const [arMainButtons, setArMainButtons] = useState([]);
|
|
@@ -29,19 +41,3 @@ export default function AssignmentCard(props) {
|
|
|
29
41
|
</>
|
|
30
42
|
)
|
|
31
43
|
}
|
|
32
|
-
|
|
33
|
-
AssignmentCard.propTypes = {
|
|
34
|
-
children: PropTypes.node.isRequired,
|
|
35
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
36
|
-
getPConnect: PropTypes.func.isRequired,
|
|
37
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
38
|
-
itemKey: PropTypes.string,
|
|
39
|
-
actionButtons: PropTypes.object,
|
|
40
|
-
onButtonPress: PropTypes.func
|
|
41
|
-
// buildName: PropTypes.string
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
AssignmentCard.defaultProps = {
|
|
45
|
-
itemKey: null,
|
|
46
|
-
// buildName: null
|
|
47
|
-
};
|