@pega/react-sdk-overrides 0.23.26 → 0.23.27
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/LICENSE +201 -0
- package/README.md +17 -0
- package/SECURITY.md +10 -0
- package/lib/designSystemExtension/AlertBanner/AlertBanner.tsx +39 -0
- package/lib/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/lib/designSystemExtension/Banner/Banner.tsx +21 -7
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.css +0 -1
- package/lib/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +36 -26
- package/lib/designSystemExtension/DetailsFields/DetailsFields.tsx +21 -28
- package/lib/designSystemExtension/DetailsFields/index.tsx +1 -1
- package/lib/designSystemExtension/FieldGroup/FieldGroup.tsx +50 -18
- package/lib/designSystemExtension/FieldGroupList/FieldGroupList.tsx +13 -12
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
- package/lib/designSystemExtension/Operator/Operator.tsx +106 -87
- package/lib/designSystemExtension/Pulse/Pulse.tsx +21 -19
- package/lib/designSystemExtension/RichTextEditor/RichTextEditor.tsx +122 -0
- package/lib/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/lib/designSystemExtension/WssQuickCreate/WssQuickCreate.tsx +21 -12
- package/lib/field/AutoComplete/AutoComplete.tsx +33 -16
- package/lib/field/AutoComplete/config-ext.json +2 -3
- package/lib/field/CancelAlert/CancelAlert.tsx +21 -15
- package/lib/field/CancelAlert/index.tsx +1 -1
- package/lib/field/Checkbox/Checkbox.tsx +29 -19
- package/lib/field/Checkbox/config-ext.json +2 -3
- package/lib/field/Currency/Currency.tsx +27 -38
- package/lib/field/Currency/config-ext.json +2 -3
- package/lib/field/Currency/currency-utils.ts +10 -18
- package/lib/field/Date/Date.tsx +33 -15
- package/lib/field/Date/config-ext.json +2 -3
- package/lib/field/DateTime/DateTime.tsx +22 -11
- package/lib/field/DateTime/config-ext.json +1 -2
- package/lib/field/Decimal/Decimal.tsx +64 -17
- package/lib/field/Decimal/config-ext.json +1 -2
- package/lib/field/Decimal/index.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +154 -18
- package/lib/field/Dropdown/config-ext.json +1 -2
- package/lib/field/Email/Email.tsx +16 -7
- package/lib/field/Email/config-ext.json +1 -2
- package/lib/field/Email/index.tsx +1 -1
- package/lib/field/Group/Group.tsx +37 -0
- package/lib/field/Group/config-ext.json +7 -0
- package/lib/field/Group/index.tsx +1 -0
- package/lib/field/Integer/Integer.tsx +15 -6
- package/lib/field/Integer/config-ext.json +1 -2
- package/lib/field/Percentage/Percentage.tsx +14 -6
- package/lib/field/Percentage/config-ext.json +1 -2
- package/lib/field/Phone/Phone.tsx +17 -7
- package/lib/field/Phone/index.tsx +1 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +55 -24
- package/lib/field/RadioButtons/config-ext.json +1 -2
- package/lib/field/RichText/RichText.tsx +96 -0
- package/lib/field/RichText/index.tsx +1 -0
- package/lib/field/ScalarList/ScalarList.tsx +63 -0
- package/lib/field/ScalarList/config-ext.json +7 -0
- package/lib/field/ScalarList/index.tsx +1 -0
- package/lib/field/SemanticLink/SemanticLink.tsx +26 -25
- package/lib/field/SemanticLink/config-ext.json +1 -2
- package/lib/field/SemanticLink/utils.ts +8 -10
- package/lib/field/TextArea/TextArea.tsx +15 -5
- package/lib/field/TextArea/config-ext.json +1 -2
- package/lib/field/TextContent/TextContent.tsx +9 -2
- package/lib/field/TextContent/config-ext.json +1 -2
- package/lib/field/TextInput/TextInput.tsx +41 -10
- package/lib/field/TextInput/config-ext.json +1 -2
- package/lib/field/TextInput/index.tsx +1 -1
- package/lib/field/Time/Time.tsx +21 -18
- package/lib/field/Time/config-ext.json +1 -2
- package/lib/field/URL/URL.tsx +23 -6
- package/lib/field/URL/config-ext.json +1 -2
- package/lib/field/URL/index.tsx +1 -1
- package/lib/field/UserReference/UserReference.tsx +52 -58
- package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
- package/lib/field/UserReference/config-ext.json +1 -2
- package/lib/helpers/{attachmentHelpers.js → attachmentHelpers.ts} +16 -11
- package/lib/helpers/case-utils.tsx +99 -0
- package/lib/helpers/common-utils.ts +8 -0
- package/lib/helpers/data_page.ts +3 -6
- package/lib/helpers/date-format-utils.ts +29 -19
- package/lib/helpers/{event-utils.js → event-utils.ts} +4 -4
- package/lib/helpers/{field-group-utils.js → field-group-utils.ts} +9 -10
- package/lib/helpers/formatters/Boolean.ts +21 -0
- package/lib/helpers/formatters/{Currency.js → Currency.ts} +22 -27
- package/lib/helpers/formatters/CurrencyMap.ts +915 -0
- package/lib/helpers/formatters/{Date.js → Date.ts} +20 -26
- package/lib/helpers/formatters/{common.js → common.ts} +3 -4
- package/lib/helpers/formatters/{index.js → index.ts} +22 -22
- package/lib/helpers/{reactContextHelpers.js → reactContextHelpers.ts} +2 -2
- package/lib/helpers/simpleTableHelpers.ts +65 -85
- package/lib/helpers/state-utils.tsx +43 -0
- package/lib/helpers/template-utils.ts +4 -8
- package/lib/helpers/utils.ts +16 -8
- package/lib/helpers/versionHelpers.ts +1 -5
- package/lib/infra/ActionButtons/ActionButtons.tsx +46 -42
- package/lib/infra/ActionButtons/index.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +99 -84
- package/lib/infra/Assignment/index.tsx +1 -1
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +19 -26
- package/lib/infra/AssignmentCard/index.tsx +1 -1
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +98 -232
- package/lib/infra/Containers/FlowContainer/helpers.ts +138 -0
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +66 -0
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +105 -70
- package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -1
- package/lib/infra/Containers/SimpleView/SimpleView.tsx +48 -0
- package/lib/infra/Containers/SimpleView/helper.ts +125 -0
- package/lib/infra/Containers/SimpleView/index.tsx +1 -0
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +49 -64
- package/lib/infra/Containers/helpers.ts +6 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +26 -51
- package/lib/infra/DashboardFilter/filterUtils.tsx +12 -40
- package/lib/infra/DeferLoad/DeferLoad.tsx +22 -31
- package/lib/infra/DeferLoad/index.tsx +1 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +25 -38
- package/lib/infra/MultiStep/MultiStep.css +11 -15
- package/lib/infra/MultiStep/MultiStep.tsx +180 -216
- package/lib/infra/MultiStep/index.tsx +1 -1
- package/lib/infra/NavBar/NavBar.css +103 -105
- package/lib/infra/NavBar/NavBar.tsx +28 -43
- package/lib/infra/Reference/Reference.tsx +16 -22
- package/lib/infra/Region/Region.tsx +9 -9
- package/lib/infra/RootContainer/RootContainer.tsx +82 -125
- package/lib/infra/RootContainer/index.tsx +1 -1
- package/lib/infra/Stages/Stages.tsx +38 -39
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
- package/lib/infra/View/View.tsx +32 -63
- package/lib/template/AppShell/AppShell.css +22 -23
- package/lib/template/AppShell/AppShell.tsx +51 -69
- package/lib/template/BannerPage/BannerPage.tsx +26 -33
- package/lib/template/CaseSummary/CaseSummary.tsx +23 -18
- package/lib/template/CaseSummary/config-ext.json +1 -2
- package/lib/template/CaseView/CaseView.tsx +122 -114
- package/lib/template/CaseView/config-ext.json +1 -2
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +46 -35
- package/lib/template/Confirmation/Confirmation.tsx +25 -53
- package/lib/template/Confirmation/config-ext.json +1 -2
- package/lib/template/DataReference/DataReference.tsx +112 -140
- package/lib/template/DataReference/config-ext.json +1 -2
- package/lib/template/DefaultForm/DefaultForm.css +7 -3
- package/lib/template/DefaultForm/DefaultForm.tsx +26 -20
- package/lib/template/DefaultForm/config-ext.json +1 -2
- package/lib/template/DefaultForm/utils/index.ts +33 -0
- package/lib/template/Details/Details/Details.tsx +24 -28
- package/lib/template/Details/DetailsSubTabs/DetailsSubTabs.tsx +15 -22
- package/lib/template/Details/DetailsSubTabs/config-ext.json +1 -2
- package/lib/template/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +25 -29
- package/lib/template/Details/DetailsThreeColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +25 -29
- package/lib/template/Details/DetailsTwoColumn/config-ext.json +1 -2
- package/lib/template/Details/DetailsTwoColumn/index.tsx +1 -1
- package/lib/template/Details/DynamicTabs/DynamicTabs.tsx +79 -0
- package/lib/template/Details/DynamicTabs/config.json +36 -0
- package/lib/template/Details/DynamicTabs/index.tsx +1 -0
- package/lib/template/FieldGroupTemplate/FieldGroupTemplate.tsx +24 -34
- package/lib/template/InlineDashboard/InlineDashboard.tsx +16 -14
- package/lib/template/InlineDashboardPage/InlineDashboardPage.tsx +19 -21
- package/lib/template/ListPage/ListPage.tsx +12 -16
- package/lib/template/ListPage/config-ext.json +1 -2
- package/lib/template/ListView/{DefaultViewMeta.js → DefaultViewMeta.ts} +1 -3
- package/lib/template/ListView/ListView.tsx +245 -306
- package/lib/template/ListView/config-ext.json +1 -2
- package/lib/template/ListView/{hooks.js → hooks.ts} +24 -24
- package/lib/template/ListView/{utils.js → utils.ts} +202 -91
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -30
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.css +0 -2
- package/lib/template/NarrowWide/NarrowWide/NarrowWide.tsx +31 -29
- package/lib/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +27 -31
- package/lib/template/NarrowWide/NarrowWideDetails/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.css +0 -2
- package/lib/template/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +17 -19
- package/lib/template/NarrowWide/NarrowWideForm/config-ext.json +1 -2
- package/lib/template/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +16 -26
- package/lib/template/NarrowWide/NarrowWidePage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumn/OneColumn.tsx +17 -17
- package/lib/template/OneColumn/OneColumn/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnPage/OneColumnPage.tsx +9 -16
- package/lib/template/OneColumn/OneColumnPage/config-ext.json +1 -2
- package/lib/template/OneColumn/OneColumnTab/OneColumnTab.tsx +8 -14
- package/lib/template/OneColumn/OneColumnTab/config-ext.json +1 -2
- package/lib/template/PromotedFilters/PromotedFilters.css +1 -1
- package/lib/template/PromotedFilters/PromotedFilters.tsx +44 -34
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +115 -14
- package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +171 -100
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +34 -40
- package/lib/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +45 -48
- package/lib/template/SubTabs/SubTabs.tsx +26 -45
- package/lib/template/SubTabs/config-ext.json +1 -2
- package/lib/template/SubTabs/tabUtils.ts +2 -7
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.css +0 -1
- package/lib/template/TwoColumn/TwoColumn/TwoColumn.tsx +33 -36
- package/lib/template/TwoColumn/TwoColumn/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +9 -16
- package/lib/template/TwoColumn/TwoColumnPage/config-ext.json +1 -2
- package/lib/template/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +33 -33
- package/lib/template/TwoColumn/TwoColumnTab/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.css +0 -2
- package/lib/template/WideNarrow/WideNarrow/WideNarrow.tsx +29 -27
- package/lib/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +39 -33
- package/lib/template/WideNarrow/WideNarrowDetails/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.css +0 -2
- package/lib/template/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +16 -18
- package/lib/template/WideNarrow/WideNarrowForm/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +15 -25
- package/lib/template/WideNarrow/WideNarrowPage/config-ext.json +1 -2
- package/lib/template/WideNarrow/WideNarrowPage/index.tsx +1 -1
- package/lib/template/WssNavBar/WssNavBar.tsx +20 -9
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
- package/lib/widget/AppAnnouncement/config-ext.json +1 -2
- package/lib/widget/Attachment/Attachment.css +75 -4
- package/lib/widget/Attachment/Attachment.tsx +370 -388
- package/lib/widget/Attachment/index.tsx +1 -1
- package/lib/widget/CaseHistory/CaseHistory.tsx +67 -67
- package/lib/widget/CaseHistory/config-ext.json +1 -2
- package/lib/widget/CaseHistory/index.tsx +1 -1
- package/lib/widget/FileUtility/ActionButtonsForFileUtil/ActionButtonsForFileUtil.tsx +19 -9
- package/lib/widget/FileUtility/FileUtility/FileUtility.css +2 -2
- package/lib/widget/FileUtility/FileUtility/FileUtility.tsx +324 -246
- package/lib/widget/FileUtility/FileUtility/config-ext.json +1 -2
- package/lib/widget/Followers/Followers.tsx +27 -25
- package/lib/widget/Followers/config-ext.json +1 -2
- package/lib/widget/QuickCreate/QuickCreate.tsx +24 -16
- package/lib/widget/SummaryItem/SummaryItem.css +9 -9
- package/lib/widget/SummaryItem/SummaryItem.tsx +62 -54
- package/lib/widget/SummaryItem/index.tsx +1 -1
- package/lib/widget/SummaryList/SummaryList.tsx +15 -4
- package/lib/widget/ToDo/ToDo.css +4 -4
- package/lib/widget/ToDo/ToDo.tsx +80 -116
- package/lib/widget/ToDo/config-ext.json +1 -2
- package/package.json +5 -2
- package/lib/helpers/auth.js +0 -483
- package/lib/helpers/authManager.js +0 -631
- package/lib/helpers/config_access.js +0 -268
- package/lib/helpers/formatters/Boolean.js +0 -38
- package/lib/helpers/formatters/CurrencyMap.js +0 -908
- package/lib/infra/Containers/FlowContainer/helpers.js +0 -147
|
@@ -1,30 +1,52 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
2
|
import { TextField } from '@material-ui/core';
|
|
3
|
-
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
5
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
6
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
7
|
+
|
|
8
|
+
interface TextInputProps extends PConnFieldProps {
|
|
9
|
+
// If any, enter additional props that only exist on TextInput here
|
|
10
|
+
fieldMetadata?: any;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function TextInput(props: TextInputProps) {
|
|
14
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
15
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
16
|
+
|
|
6
17
|
const {
|
|
18
|
+
getPConnect,
|
|
7
19
|
label,
|
|
8
20
|
required,
|
|
9
21
|
disabled,
|
|
10
22
|
value = '',
|
|
11
23
|
validatemessage,
|
|
12
24
|
status,
|
|
13
|
-
onChange,
|
|
14
|
-
onBlur,
|
|
25
|
+
/* onChange, onBlur */
|
|
15
26
|
readOnly,
|
|
16
27
|
testId,
|
|
17
28
|
fieldMetadata,
|
|
18
29
|
helperText,
|
|
19
30
|
displayMode,
|
|
20
|
-
hideLabel
|
|
31
|
+
hideLabel,
|
|
32
|
+
placeholder
|
|
21
33
|
} = props;
|
|
34
|
+
|
|
35
|
+
const pConn = getPConnect();
|
|
36
|
+
const actions = pConn.getActionsApi();
|
|
37
|
+
const propName = (pConn.getStateProps() as any).value;
|
|
38
|
+
|
|
22
39
|
const helperTextToDisplay = validatemessage || helperText;
|
|
23
40
|
|
|
41
|
+
const [inputValue, setInputValue] = useState('');
|
|
24
42
|
const maxLength = fieldMetadata?.maxLength;
|
|
25
43
|
|
|
26
44
|
let readOnlyProp = {}; // Note: empty if NOT ReadOnly
|
|
27
45
|
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
setInputValue(value);
|
|
48
|
+
}, [value]);
|
|
49
|
+
|
|
28
50
|
if (displayMode === 'LABELS_LEFT') {
|
|
29
51
|
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
30
52
|
}
|
|
@@ -43,20 +65,29 @@ export default function TextInput(props) {
|
|
|
43
65
|
'data-test-id': testId
|
|
44
66
|
};
|
|
45
67
|
|
|
68
|
+
function handleChange(event) {
|
|
69
|
+
// update internal value
|
|
70
|
+
setInputValue(event?.target?.value);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function handleBlur() {
|
|
74
|
+
handleEvent(actions, 'changeNblur', propName, inputValue);
|
|
75
|
+
}
|
|
76
|
+
|
|
46
77
|
return (
|
|
47
78
|
<TextField
|
|
48
79
|
fullWidth
|
|
49
80
|
variant={readOnly ? 'standard' : 'outlined'}
|
|
50
81
|
helperText={helperTextToDisplay}
|
|
51
|
-
placeholder=''
|
|
82
|
+
placeholder={placeholder ?? ''}
|
|
52
83
|
size='small'
|
|
53
84
|
required={required}
|
|
54
85
|
disabled={disabled}
|
|
55
|
-
onChange={
|
|
56
|
-
onBlur={!readOnly ?
|
|
86
|
+
onChange={handleChange}
|
|
87
|
+
onBlur={!readOnly ? handleBlur : undefined}
|
|
57
88
|
error={status === 'error'}
|
|
58
89
|
label={label}
|
|
59
|
-
value={
|
|
90
|
+
value={inputValue}
|
|
60
91
|
InputProps={{ ...readOnlyProp, inputProps: { maxLength, ...testProp } }}
|
|
61
92
|
/>
|
|
62
93
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './TextInput';
|
|
1
|
+
export { default } from './TextInput';
|
package/lib/field/Time/Time.tsx
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { KeyboardTimePicker } from '@material-ui/pickers';
|
|
3
|
-
import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
|
|
4
|
-
import dayjs from 'dayjs';
|
|
5
2
|
import AccessTimeIcon from '@material-ui/icons/AccessTime';
|
|
6
|
-
import
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
|
|
5
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
6
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
7
|
+
|
|
8
|
+
interface TimeProps extends PConnFieldProps {
|
|
9
|
+
// If any, enter additional props that only exist on Time here
|
|
10
|
+
}
|
|
7
11
|
|
|
8
|
-
export default function Time(props) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
validatemessage,
|
|
15
|
-
status,
|
|
16
|
-
onChange,
|
|
17
|
-
readOnly,
|
|
18
|
-
helperText,
|
|
19
|
-
displayMode,
|
|
20
|
-
hideLabel
|
|
21
|
-
} = props;
|
|
12
|
+
export default function Time(props: TimeProps) {
|
|
13
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
14
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
15
|
+
const TextInput = getComponentFromMap('TextInput');
|
|
16
|
+
|
|
17
|
+
const { label, required, disabled, value = '', validatemessage, status, onChange, readOnly, helperText, displayMode, hideLabel, testId } = props;
|
|
22
18
|
const helperTextToDisplay = validatemessage || helperText;
|
|
23
19
|
|
|
24
20
|
if (displayMode === 'LABELS_LEFT') {
|
|
@@ -33,6 +29,12 @@ export default function Time(props) {
|
|
|
33
29
|
return <TextInput {...props} />;
|
|
34
30
|
}
|
|
35
31
|
|
|
32
|
+
let testProp = {};
|
|
33
|
+
|
|
34
|
+
testProp = {
|
|
35
|
+
'data-test-id': testId
|
|
36
|
+
};
|
|
37
|
+
|
|
36
38
|
const handleChange = date => {
|
|
37
39
|
const theValue = date && date.isValid() ? date.format('HH:mm') : null;
|
|
38
40
|
onChange({ value: theValue });
|
|
@@ -68,6 +70,7 @@ export default function Time(props) {
|
|
|
68
70
|
format='hh:mm a'
|
|
69
71
|
value={timeValue}
|
|
70
72
|
onChange={handleChange}
|
|
73
|
+
InputProps={{ inputProps: { ...testProp } }}
|
|
71
74
|
/>
|
|
72
75
|
);
|
|
73
76
|
}
|
package/lib/field/URL/URL.tsx
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { TextField } from '@material-ui/core';
|
|
3
|
-
|
|
4
|
-
import
|
|
2
|
+
|
|
3
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
4
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
|
+
|
|
6
|
+
interface URLComponentProps extends PConnFieldProps {
|
|
7
|
+
// If any, enter additional props that only exist on URLComponent here
|
|
8
|
+
}
|
|
5
9
|
|
|
6
10
|
// NOTE: that we had to change the name from URL to URLComponent
|
|
7
11
|
// Otherwise, we were getting all kinds of weird errors when we
|
|
8
12
|
// referred to URL as a component.
|
|
9
|
-
export default function URLComponent(props) {
|
|
13
|
+
export default function URLComponent(props: URLComponentProps) {
|
|
14
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
15
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
16
|
+
const TextInput = getComponentFromMap('TextInput');
|
|
17
|
+
|
|
10
18
|
const {
|
|
11
19
|
label,
|
|
12
20
|
required,
|
|
@@ -17,9 +25,11 @@ export default function URLComponent(props) {
|
|
|
17
25
|
onChange,
|
|
18
26
|
onBlur,
|
|
19
27
|
readOnly,
|
|
28
|
+
testId,
|
|
20
29
|
helperText,
|
|
21
30
|
displayMode,
|
|
22
|
-
hideLabel
|
|
31
|
+
hideLabel,
|
|
32
|
+
placeholder
|
|
23
33
|
} = props;
|
|
24
34
|
const helperTextToDisplay = validatemessage || helperText;
|
|
25
35
|
|
|
@@ -35,13 +45,19 @@ export default function URLComponent(props) {
|
|
|
35
45
|
return <TextInput {...props} />;
|
|
36
46
|
}
|
|
37
47
|
|
|
48
|
+
let testProp = {};
|
|
49
|
+
|
|
50
|
+
testProp = {
|
|
51
|
+
'data-test-id': testId
|
|
52
|
+
};
|
|
53
|
+
|
|
38
54
|
return (
|
|
39
55
|
<TextField
|
|
40
56
|
type='url'
|
|
41
57
|
fullWidth
|
|
42
58
|
variant='outlined'
|
|
43
59
|
helperText={helperTextToDisplay}
|
|
44
|
-
placeholder=''
|
|
60
|
+
placeholder={placeholder ?? ''}
|
|
45
61
|
size='small'
|
|
46
62
|
required={required}
|
|
47
63
|
disabled={disabled}
|
|
@@ -50,6 +66,7 @@ export default function URLComponent(props) {
|
|
|
50
66
|
error={status === 'error'}
|
|
51
67
|
label={label}
|
|
52
68
|
value={value}
|
|
69
|
+
InputProps={{ inputProps: { ...testProp } }}
|
|
53
70
|
/>
|
|
54
71
|
);
|
|
55
72
|
}
|
package/lib/field/URL/index.tsx
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './URL';
|
|
1
|
+
export { default } from './URL';
|
|
@@ -1,31 +1,56 @@
|
|
|
1
|
-
import
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import { memo, useEffect, useState } from 'react';
|
|
3
2
|
import { Typography } from '@material-ui/core';
|
|
4
|
-
|
|
5
|
-
import
|
|
3
|
+
|
|
4
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
|
+
import { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
6
|
+
|
|
6
7
|
import { getUserId, isUserNameAvailable } from './UserReferenceUtils';
|
|
7
8
|
|
|
8
|
-
declare const PCore: any;
|
|
9
9
|
const DROPDOWN_LIST = 'Drop-down list';
|
|
10
10
|
const SEARCH_BOX = 'Search box';
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
interface UserReferenceProps extends PConnProps {
|
|
13
|
+
// If any, enter additional props that only exist on URLComponent here
|
|
14
|
+
displayAs?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
value?: any;
|
|
17
|
+
testId?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
helperText?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
readOnly?: boolean;
|
|
22
|
+
required?: boolean;
|
|
23
|
+
validatemessage?: string;
|
|
24
|
+
showAsFormattedText?: boolean;
|
|
25
|
+
additionalProps?: object;
|
|
26
|
+
hideLabel?: boolean;
|
|
27
|
+
variant?: string;
|
|
28
|
+
onChange?: any;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const UserReference = (props: UserReferenceProps) => {
|
|
32
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
33
|
+
const AutoComplete = getComponentFromMap('AutoComplete');
|
|
34
|
+
const Dropdown = getComponentFromMap('Dropdown');
|
|
35
|
+
|
|
13
36
|
const {
|
|
14
|
-
label,
|
|
15
|
-
displayAs,
|
|
37
|
+
label = '',
|
|
38
|
+
displayAs = '',
|
|
16
39
|
getPConnect,
|
|
17
|
-
value,
|
|
18
|
-
testId,
|
|
19
|
-
helperText,
|
|
20
|
-
validatemessage,
|
|
21
|
-
placeholder,
|
|
22
|
-
showAsFormattedText,
|
|
23
|
-
additionalProps,
|
|
24
|
-
hideLabel,
|
|
25
|
-
readOnly,
|
|
26
|
-
required,
|
|
27
|
-
disabled,
|
|
28
|
-
onChange
|
|
40
|
+
value = '',
|
|
41
|
+
testId = '',
|
|
42
|
+
helperText = '',
|
|
43
|
+
validatemessage = '',
|
|
44
|
+
placeholder = '',
|
|
45
|
+
showAsFormattedText = false,
|
|
46
|
+
additionalProps = {},
|
|
47
|
+
hideLabel = false,
|
|
48
|
+
readOnly = false,
|
|
49
|
+
required = false,
|
|
50
|
+
disabled = false,
|
|
51
|
+
onChange,
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
53
|
+
variant = 'inline'
|
|
29
54
|
} = props;
|
|
30
55
|
const [dropDownDataSource, setDropDownDataSource] = useState([]);
|
|
31
56
|
const [userName, setUserName] = useState('');
|
|
@@ -40,7 +65,7 @@ const UserReference = props => {
|
|
|
40
65
|
// if same user ref field is referred in view as editable & readonly formatted text
|
|
41
66
|
// referenced users won't be available, so get user details from dx api
|
|
42
67
|
const { getOperatorDetails } = PCore.getUserApi();
|
|
43
|
-
getOperatorDetails(userId).then(res => {
|
|
68
|
+
getOperatorDetails(userId).then((res: any) => {
|
|
44
69
|
if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {
|
|
45
70
|
setUserName(res.data.pyOperatorInfo.pyUserName);
|
|
46
71
|
}
|
|
@@ -50,9 +75,12 @@ const UserReference = props => {
|
|
|
50
75
|
const queryPayload = {
|
|
51
76
|
dataViewName: OPERATORS_DP
|
|
52
77
|
};
|
|
78
|
+
|
|
53
79
|
PCore.getRestClient()
|
|
80
|
+
// @ts-ignore - Argument of type '{ queryPayload: { dataViewName: string; }; }' is not assignable to parameter of type 'RestApiOptionsObject'
|
|
81
|
+
// @ts-ignore - Expected 3 arguments, but got 2
|
|
54
82
|
.invokeRestApi('getListData', { queryPayload })
|
|
55
|
-
.then(res => {
|
|
83
|
+
.then((res: any) => {
|
|
56
84
|
const ddDataSource = res.data.data.map(listItem => ({
|
|
57
85
|
key: listItem.pyUserIdentifier,
|
|
58
86
|
value: listItem.pyUserName
|
|
@@ -71,7 +99,7 @@ const UserReference = props => {
|
|
|
71
99
|
if (readOnly && showAsFormattedText) {
|
|
72
100
|
if (userId) {
|
|
73
101
|
userReferenceComponent = (
|
|
74
|
-
|
|
102
|
+
<>
|
|
75
103
|
{/*
|
|
76
104
|
TODO: This has to be replaced with Operator Component
|
|
77
105
|
*/}
|
|
@@ -79,7 +107,7 @@ const UserReference = props => {
|
|
|
79
107
|
<Typography variant='caption'>{label}</Typography>
|
|
80
108
|
<Typography variant='body1'>{userName}</Typography>
|
|
81
109
|
</div>
|
|
82
|
-
|
|
110
|
+
</>
|
|
83
111
|
);
|
|
84
112
|
}
|
|
85
113
|
} else {
|
|
@@ -148,40 +176,6 @@ const UserReference = props => {
|
|
|
148
176
|
return userReferenceComponent;
|
|
149
177
|
};
|
|
150
178
|
|
|
151
|
-
UserReference.propTypes = {
|
|
152
|
-
getPConnect: PropTypes.func.isRequired,
|
|
153
|
-
displayAs: PropTypes.string,
|
|
154
|
-
label: PropTypes.string,
|
|
155
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.objectOf(PropTypes.any)]),
|
|
156
|
-
testId: PropTypes.string,
|
|
157
|
-
placeholder: PropTypes.string,
|
|
158
|
-
helperText: PropTypes.string,
|
|
159
|
-
disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
160
|
-
readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
161
|
-
required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
162
|
-
validatemessage: PropTypes.string,
|
|
163
|
-
showAsFormattedText: PropTypes.bool,
|
|
164
|
-
additionalProps: PropTypes.objectOf(PropTypes.any),
|
|
165
|
-
hideLabel: PropTypes.bool
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
UserReference.defaultProps = {
|
|
169
|
-
displayAs: null,
|
|
170
|
-
label: null,
|
|
171
|
-
value: null,
|
|
172
|
-
readOnly: false,
|
|
173
|
-
testId: null,
|
|
174
|
-
placeholder: null,
|
|
175
|
-
helperText: null,
|
|
176
|
-
disabled: false,
|
|
177
|
-
required: false,
|
|
178
|
-
validatemessage: null,
|
|
179
|
-
showAsFormattedText: false,
|
|
180
|
-
additionalProps: {},
|
|
181
|
-
variant: 'inline',
|
|
182
|
-
hideLabel: false
|
|
183
|
-
};
|
|
184
|
-
|
|
185
179
|
// as objects are there in props, shallow comparision fails & re-rendering of comp happens even with
|
|
186
180
|
// same key value pairs in obj. hence using custom comparison function on when to re-render
|
|
187
181
|
const comparisonFn = (prevProps, nextProps) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const getUserId =
|
|
1
|
+
export const getUserId = user => {
|
|
2
2
|
let userId = '';
|
|
3
3
|
if (typeof user === 'object' && user !== null && user.userId) {
|
|
4
4
|
userId = user.userId;
|
|
@@ -8,6 +8,6 @@ export const getUserId = (user) => {
|
|
|
8
8
|
return userId;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
export const isUserNameAvailable =
|
|
11
|
+
export const isUserNameAvailable = user => {
|
|
12
12
|
return typeof user === 'object' && user !== null && user.userName;
|
|
13
13
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import download from 'downloadjs';
|
|
2
2
|
|
|
3
|
-
export const validateMaxSize = (fileObj, maxSizeInMB) => {
|
|
3
|
+
export const validateMaxSize = (fileObj: any, maxSizeInMB: string): boolean => {
|
|
4
4
|
const fileSize = (fileObj.size / 1048576).toFixed(2);
|
|
5
5
|
return parseFloat(fileSize) < parseFloat(maxSizeInMB);
|
|
6
6
|
};
|
|
@@ -15,7 +15,7 @@ export const fileDownload = (data, fileName, ext) => {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export const getIconFromFileType = (fileType) => {
|
|
18
|
+
export const getIconFromFileType = (fileType): string => {
|
|
19
19
|
let icon = 'document-doc';
|
|
20
20
|
if (!fileType) return icon;
|
|
21
21
|
if (fileType.startsWith('audio')) {
|
|
@@ -28,8 +28,8 @@ export const getIconFromFileType = (fileType) => {
|
|
|
28
28
|
icon = 'document-pdf';
|
|
29
29
|
} else {
|
|
30
30
|
const [, subtype] = fileType.split('/');
|
|
31
|
-
const foundMatch =
|
|
32
|
-
return sources.some(
|
|
31
|
+
const foundMatch = sources => {
|
|
32
|
+
return sources.some(key => subtype.includes(key));
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
if (foundMatch(['excel', 'spreadsheet'])) {
|
|
@@ -42,22 +42,27 @@ export const getIconFromFileType = (fileType) => {
|
|
|
42
42
|
return icon;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
export const getIconForAttachment = (attachment) => {
|
|
45
|
+
export const getIconForAttachment = (inThis: any, attachment: any): string => {
|
|
46
46
|
let icon;
|
|
47
47
|
switch (attachment.type) {
|
|
48
|
-
case
|
|
49
|
-
icon =
|
|
48
|
+
case 'FILE':
|
|
49
|
+
icon = inThis.getIconFromFileType(attachment.mimeType);
|
|
50
50
|
break;
|
|
51
|
-
case
|
|
52
|
-
icon =
|
|
51
|
+
case 'URL':
|
|
52
|
+
icon = 'chain';
|
|
53
53
|
break;
|
|
54
54
|
default:
|
|
55
|
-
icon =
|
|
55
|
+
icon = 'document-doc';
|
|
56
56
|
}
|
|
57
57
|
return icon;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
export const buildFilePropsFromResponse = (
|
|
60
|
+
export const buildFilePropsFromResponse = (
|
|
61
|
+
respObj
|
|
62
|
+
): {
|
|
63
|
+
props: { meta: string; name: string; icon: string };
|
|
64
|
+
responseProps: any;
|
|
65
|
+
} => {
|
|
61
66
|
return {
|
|
62
67
|
props: {
|
|
63
68
|
meta: `${respObj.pyCategoryName}, ${respObj.pxCreateOperator}`,
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Function that accepts array of messages as input and group them by their type and returns the resulting object
|
|
5
|
+
* @param {Array} inputMessages
|
|
6
|
+
* Eg: [
|
|
7
|
+
* {message: 'First Name is required', type: 'error'},
|
|
8
|
+
* {message: 'Last Name is required', type: 'error'},
|
|
9
|
+
* {message: 'Address field should be clear and precise', type: 'info'}
|
|
10
|
+
* ]
|
|
11
|
+
*
|
|
12
|
+
* @returns {object}
|
|
13
|
+
*
|
|
14
|
+
* Eg: {
|
|
15
|
+
* error: ['First Name is required', 'Last Name is required'],
|
|
16
|
+
* info: ['Address field should be clear and precise']
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function getMessagesGrouped(inputMessages) {
|
|
21
|
+
const messages = {};
|
|
22
|
+
|
|
23
|
+
if (inputMessages && inputMessages instanceof Array && inputMessages.length > 0) {
|
|
24
|
+
inputMessages.forEach(item => {
|
|
25
|
+
const { message, type } = item;
|
|
26
|
+
messages[type] = [...(messages[type] || []), message];
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return messages;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Function accepts a error type and variant of the banner
|
|
34
|
+
* @param {string} type
|
|
35
|
+
* Eg: 'error'
|
|
36
|
+
* @returns {string}
|
|
37
|
+
* Eg: 'urgent'
|
|
38
|
+
*/
|
|
39
|
+
function getVariant(type) {
|
|
40
|
+
const { BANNER_VARIANT_SUCCESS, BANNER_VARIANT_INFO, BANNER_VARIANT_URGENT, MESSAGES } = PCore.getConstants();
|
|
41
|
+
const { MESSAGES_TYPE_ERROR, MESSAGES_TYPE_INFO, MESSAGES_TYPE_SUCCESS } = MESSAGES;
|
|
42
|
+
|
|
43
|
+
let variant;
|
|
44
|
+
switch (type) {
|
|
45
|
+
case MESSAGES_TYPE_ERROR:
|
|
46
|
+
variant = BANNER_VARIANT_URGENT;
|
|
47
|
+
break;
|
|
48
|
+
case MESSAGES_TYPE_INFO:
|
|
49
|
+
variant = BANNER_VARIANT_INFO;
|
|
50
|
+
break;
|
|
51
|
+
case MESSAGES_TYPE_SUCCESS:
|
|
52
|
+
variant = BANNER_VARIANT_SUCCESS;
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
variant = '';
|
|
56
|
+
}
|
|
57
|
+
return variant;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function getBanners(config) {
|
|
61
|
+
const AlertBanner = getComponentFromMap('AlertBanner');
|
|
62
|
+
const { target, pageMessages, httpMessages } = config;
|
|
63
|
+
const { PAGE } = PCore.getConstants();
|
|
64
|
+
const { clearMessages } = PCore.getMessageManager();
|
|
65
|
+
const banners: any = [];
|
|
66
|
+
const groupedPageMessages = getMessagesGrouped(pageMessages);
|
|
67
|
+
|
|
68
|
+
Object.keys(groupedPageMessages).forEach(type => {
|
|
69
|
+
const messagesByType = groupedPageMessages[type];
|
|
70
|
+
const variant = getVariant(type);
|
|
71
|
+
const pageMessagesBannerID = `${target}_${PAGE}_${type}`.toLowerCase().replace('/', '_');
|
|
72
|
+
banners.push(
|
|
73
|
+
<AlertBanner
|
|
74
|
+
id={pageMessagesBannerID}
|
|
75
|
+
variant={variant}
|
|
76
|
+
messages={messagesByType}
|
|
77
|
+
onDismiss={
|
|
78
|
+
variant === 'urgent'
|
|
79
|
+
? ''
|
|
80
|
+
: () => {
|
|
81
|
+
clearMessages({
|
|
82
|
+
category: PAGE,
|
|
83
|
+
type,
|
|
84
|
+
context: target
|
|
85
|
+
} as any);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
if (httpMessages && httpMessages.length > 0) {
|
|
93
|
+
banners.push(<AlertBanner id='modalViewContainerBanner' variant='urgent' messages={httpMessages} />);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return banners;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { getMessagesGrouped, getBanners };
|
package/lib/helpers/data_page.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
declare const PCore;
|
|
2
|
-
|
|
3
1
|
// eslint-disable-next-line import/prefer-default-export
|
|
4
2
|
export const getDataPage = (dataPageName, parameters, context) => {
|
|
5
3
|
let dataViewParams;
|
|
6
|
-
if(parameters){
|
|
4
|
+
if (parameters) {
|
|
7
5
|
dataViewParams = {
|
|
8
|
-
|
|
6
|
+
dataViewParameters: parameters
|
|
9
7
|
};
|
|
10
8
|
}
|
|
11
9
|
return new Promise((resolve, reject) => {
|
|
12
|
-
PCore.getDataApiUtils()
|
|
13
|
-
.getData(dataPageName, dataViewParams, context)
|
|
10
|
+
(PCore.getDataApiUtils().getData(dataPageName, dataViewParams, context) as any)
|
|
14
11
|
.then(response => {
|
|
15
12
|
resolve(response.data.data);
|
|
16
13
|
})
|