@pega/react-sdk-overrides 8.23.11 → 23.1.11
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 +12 -16
- 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 +14 -11
- package/lib/designSystemExtension/FieldValueList/FieldValueList.tsx +18 -27
- package/lib/designSystemExtension/Operator/Operator.tsx +100 -84
- 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 +100 -81
- package/lib/field/CancelAlert/index.tsx +1 -1
- package/lib/field/Checkbox/Checkbox.tsx +27 -16
- package/lib/field/Checkbox/config-ext.json +2 -3
- package/lib/field/Currency/Currency.tsx +30 -47
- package/lib/field/Currency/config-ext.json +2 -3
- package/lib/field/Currency/currency-utils.ts +10 -21
- package/lib/field/Date/Date.tsx +24 -13
- package/lib/field/Date/config-ext.json +2 -3
- package/lib/field/DateTime/DateTime.tsx +21 -10
- package/lib/field/DateTime/config-ext.json +1 -2
- package/lib/field/Decimal/Decimal.tsx +31 -40
- package/lib/field/Decimal/config-ext.json +1 -2
- package/lib/field/Decimal/index.tsx +1 -1
- package/lib/field/Dropdown/Dropdown.tsx +128 -31
- 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 +39 -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 +52 -39
- package/lib/field/Percentage/config-ext.json +1 -2
- package/lib/field/Phone/Phone.tsx +15 -6
- package/lib/field/Phone/index.tsx +1 -1
- package/lib/field/RadioButtons/RadioButtons.tsx +26 -34
- 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 -11
- 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 +18 -7
- package/lib/field/TextInput/config-ext.json +1 -2
- package/lib/field/TextInput/index.tsx +1 -1
- package/lib/field/Time/Time.tsx +14 -19
- package/lib/field/Time/config-ext.json +1 -2
- package/lib/field/URL/URL.tsx +15 -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 -60
- package/lib/field/UserReference/UserReferenceUtils.ts +2 -2
- package/lib/field/UserReference/config-ext.json +1 -2
- package/lib/helpers/attachmentHelpers.ts +15 -10
- package/lib/helpers/case-utils.tsx +5 -10
- package/lib/helpers/common-utils.ts +6 -2
- package/lib/helpers/data_page.ts +3 -7
- package/lib/helpers/date-format-utils.ts +4 -4
- package/lib/helpers/event-utils.ts +4 -4
- package/lib/helpers/field-group-utils.ts +6 -8
- package/lib/helpers/formatters/Boolean.ts +9 -26
- package/lib/helpers/formatters/Currency.ts +22 -28
- package/lib/helpers/formatters/CurrencyMap.ts +512 -505
- package/lib/helpers/formatters/Date.ts +20 -26
- package/lib/helpers/formatters/common.ts +2 -7
- package/lib/helpers/formatters/index.ts +29 -22
- package/lib/helpers/reactContextHelpers.ts +2 -2
- package/lib/helpers/simpleTableHelpers.ts +63 -87
- package/lib/helpers/state-utils.tsx +5 -12
- package/lib/helpers/template-utils.ts +4 -10
- package/lib/helpers/utils.ts +5 -5
- package/lib/helpers/versionHelpers.ts +1 -7
- package/lib/infra/ActionButtons/ActionButtons.tsx +44 -45
- package/lib/infra/ActionButtons/index.tsx +1 -1
- package/lib/infra/Assignment/Assignment.tsx +102 -86
- 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 +93 -240
- package/lib/infra/Containers/FlowContainer/helpers.ts +34 -48
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -1
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +65 -0
- package/lib/infra/Containers/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +229 -223
- 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 +47 -64
- package/lib/infra/Containers/helpers.ts +6 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +25 -54
- package/lib/infra/DashboardFilter/filterUtils.tsx +12 -42
- package/lib/infra/DeferLoad/DeferLoad.tsx +21 -33
- package/lib/infra/DeferLoad/index.tsx +1 -1
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +21 -39
- 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 +26 -45
- package/lib/infra/Reference/Reference.tsx +16 -22
- package/lib/infra/Region/Region.tsx +9 -9
- package/lib/infra/RootContainer/RootContainer.tsx +75 -120
- package/lib/infra/RootContainer/index.tsx +1 -1
- package/lib/infra/Stages/Stages.tsx +36 -41
- package/lib/infra/VerticalTabs/LeftAlignVerticalTabs/LeftAlignVerticalTabs.tsx +17 -10
- package/lib/infra/VerticalTabs/VerticalTabs/VerticalTabs.tsx +29 -36
- package/lib/infra/View/View.tsx +25 -29
- package/lib/template/AppShell/AppShell.css +22 -23
- package/lib/template/AppShell/AppShell.tsx +47 -71
- package/lib/template/BannerPage/BannerPage.tsx +26 -33
- package/lib/template/CaseSummary/CaseSummary.tsx +66 -19
- package/lib/template/CaseSummary/config-ext.json +1 -2
- package/lib/template/CaseView/CaseView.tsx +44 -74
- package/lib/template/CaseView/config-ext.json +1 -2
- package/lib/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +66 -31
- package/lib/template/Confirmation/Confirmation.tsx +24 -55
- package/lib/template/Confirmation/config-ext.json +1 -2
- package/lib/template/DataReference/DataReference.tsx +112 -142
- package/lib/template/DataReference/config-ext.json +1 -2
- package/lib/template/DefaultForm/DefaultForm.css +7 -3
- package/lib/template/DefaultForm/DefaultForm.tsx +15 -16
- package/lib/template/DefaultForm/config-ext.json +1 -2
- 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 +22 -35
- 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.ts +1 -3
- package/lib/template/ListView/ListView.tsx +247 -309
- package/lib/template/ListView/config-ext.json +1 -2
- package/lib/template/ListView/hooks.ts +24 -26
- package/lib/template/ListView/utils.ts +205 -94
- package/lib/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +25 -34
- 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 +39 -33
- package/lib/template/SimpleTable/SimpleTable/SimpleTable.tsx +113 -15
- package/lib/template/SimpleTable/SimpleTable/config-ext.json +1 -2
- package/lib/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +187 -104
- package/lib/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +33 -44
- 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 -9
- 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 +24 -10
- package/lib/widget/AppAnnouncement/AppAnnouncement.tsx +34 -41
- package/lib/widget/AppAnnouncement/config-ext.json +1 -2
- package/lib/widget/Attachment/Attachment.css +60 -1
- package/lib/widget/Attachment/Attachment.tsx +379 -394
- 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 +322 -245
- 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 +71 -39
- package/lib/widget/SummaryItem/SummaryItem.css +9 -9
- package/lib/widget/SummaryItem/SummaryItem.tsx +62 -52
- 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 +72 -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 -634
- package/lib/helpers/config_access.js +0 -259
package/lib/field/Date/Date.tsx
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { KeyboardDatePicker } from '@material-ui/pickers';
|
|
3
|
-
|
|
2
|
+
|
|
4
3
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
5
|
-
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
6
4
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
7
|
-
import { dateFormatInfoDefault, getDateFormatInfo} from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
5
|
+
import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
6
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
8
|
|
|
9
9
|
// Will return the date string in YYYY-MM-DD format which we'll be POSTing to the server
|
|
10
|
-
function getFormattedDate(date){
|
|
10
|
+
function getFormattedDate(date) {
|
|
11
11
|
return `${date.$y.toString()}-${(date.$M + 1).toString().padStart(2, '0')}-${date.$D.toString().padStart(2, '0')}`;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
interface DateProps extends PConnFieldProps {
|
|
15
|
+
// If any, enter additional props that only exist on Date here
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function Date(props: DateProps) {
|
|
19
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
20
|
+
const TextInput = getComponentFromMap('TextInput');
|
|
21
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
22
|
+
|
|
15
23
|
const {
|
|
16
24
|
getPConnect,
|
|
17
25
|
label,
|
|
@@ -31,25 +39,28 @@ export default function Date(props) {
|
|
|
31
39
|
|
|
32
40
|
const pConn = getPConnect();
|
|
33
41
|
const actions = pConn.getActionsApi();
|
|
34
|
-
const propName = pConn.getStateProps().value;
|
|
42
|
+
const propName = (pConn.getStateProps() as any).value;
|
|
35
43
|
const helperTextToDisplay = validatemessage || helperText;
|
|
36
44
|
|
|
37
45
|
// Start with default dateFormatInfo
|
|
38
46
|
const dateFormatInfo = dateFormatInfoDefault;
|
|
39
47
|
// and then update, as needed, based on locale, etc.
|
|
40
|
-
const theDateFormat = getDateFormatInfo()
|
|
48
|
+
const theDateFormat = getDateFormatInfo();
|
|
41
49
|
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
42
50
|
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
43
51
|
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
44
52
|
|
|
45
|
-
|
|
46
53
|
if (displayMode === 'LABELS_LEFT') {
|
|
47
|
-
const formattedDate = format(props.value, 'date', {
|
|
54
|
+
const formattedDate = format(props.value, 'date', {
|
|
55
|
+
format: dateFormatInfo.dateFormatString
|
|
56
|
+
});
|
|
48
57
|
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} />;
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
52
|
-
const formattedDate = format(props.value, 'date', {
|
|
61
|
+
const formattedDate = format(props.value, 'date', {
|
|
62
|
+
format: dateFormatInfo.dateFormatString
|
|
63
|
+
});
|
|
53
64
|
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant='stacked' />;
|
|
54
65
|
}
|
|
55
66
|
|
|
@@ -65,13 +76,13 @@ export default function Date(props) {
|
|
|
65
76
|
};
|
|
66
77
|
|
|
67
78
|
const handleChange = date => {
|
|
68
|
-
if(date && date.isValid()){
|
|
79
|
+
if (date && date.isValid()) {
|
|
69
80
|
onChange({ value: getFormattedDate(date) });
|
|
70
81
|
}
|
|
71
82
|
};
|
|
72
83
|
|
|
73
84
|
const handleAccept = date => {
|
|
74
|
-
if(date && date.isValid()){
|
|
85
|
+
if (date && date.isValid()) {
|
|
75
86
|
handleEvent(actions, 'changeNblur', propName, getFormattedDate(date));
|
|
76
87
|
}
|
|
77
88
|
};
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { KeyboardDateTimePicker } from '@material-ui/pickers';
|
|
3
|
-
|
|
2
|
+
|
|
4
3
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
5
|
-
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
6
4
|
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
7
|
-
import { dateFormatInfoDefault, getDateFormatInfo} from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
5
|
+
import { dateFormatInfoDefault, getDateFormatInfo } from '@pega/react-sdk-components/lib/components/helpers/date-format-utils';
|
|
6
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
|
+
|
|
9
|
+
interface DateTimeProps extends PConnFieldProps {
|
|
10
|
+
// If any, enter additional props that only exist on DateTime here
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function DateTime(props: DateTimeProps) {
|
|
14
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
15
|
+
const TextInput = getComponentFromMap('TextInput');
|
|
16
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
8
17
|
|
|
9
|
-
export default function DateTime(props) {
|
|
10
18
|
const {
|
|
11
19
|
getPConnect,
|
|
12
20
|
label,
|
|
@@ -25,25 +33,28 @@ export default function DateTime(props) {
|
|
|
25
33
|
|
|
26
34
|
const pConn = getPConnect();
|
|
27
35
|
const actions = pConn.getActionsApi();
|
|
28
|
-
const propName = pConn.getStateProps().value;
|
|
36
|
+
const propName = (pConn.getStateProps() as any).value;
|
|
29
37
|
const helperTextToDisplay = validatemessage || helperText;
|
|
30
38
|
|
|
31
39
|
// Start with default dateFormatInfo
|
|
32
40
|
const dateFormatInfo = dateFormatInfoDefault;
|
|
33
41
|
// and then update, as needed, based on locale, etc.
|
|
34
|
-
const theDateFormat = getDateFormatInfo()
|
|
42
|
+
const theDateFormat = getDateFormatInfo();
|
|
35
43
|
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
36
44
|
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
37
45
|
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
38
46
|
|
|
39
|
-
|
|
40
47
|
if (displayMode === 'LABELS_LEFT') {
|
|
41
|
-
const formattedDateTime = format(props.value, 'datetime', {
|
|
48
|
+
const formattedDateTime = format(props.value, 'datetime', {
|
|
49
|
+
format: `${dateFormatInfo.dateFormatString} hh:mm a`
|
|
50
|
+
});
|
|
42
51
|
return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} />;
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
46
|
-
const formattedDateTime = format(props.value, 'datetime', {
|
|
55
|
+
const formattedDateTime = format(props.value, 'datetime', {
|
|
56
|
+
format: `${dateFormatInfo.dateFormatString} hh:mm a`
|
|
57
|
+
});
|
|
47
58
|
return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} variant='stacked' />;
|
|
48
59
|
}
|
|
49
60
|
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
1
|
import CurrencyTextField from '@unicef/material-ui-currency-textfield';
|
|
3
|
-
|
|
2
|
+
|
|
4
3
|
import { getCurrencyCharacters, getCurrencyOptions } from '@pega/react-sdk-components/lib/components/field/Currency/currency-utils';
|
|
5
4
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
6
|
-
import { format } from
|
|
5
|
+
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
6
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
|
+
|
|
9
|
+
/* Using @unicef/material-ui-currency-textfield component here, since it allows formatting decimal values,
|
|
10
|
+
as per the locale.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface DecimalProps extends PConnFieldProps {
|
|
14
|
+
// If any, enter additional props that only exist on Decimal here
|
|
15
|
+
currencyISOCode?: string;
|
|
16
|
+
decimalPrecision?: number;
|
|
17
|
+
showGroupSeparators?: string;
|
|
18
|
+
}
|
|
7
19
|
|
|
8
|
-
|
|
20
|
+
export default function Decimal(props: DecimalProps) {
|
|
21
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
22
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
9
23
|
|
|
10
|
-
export default function Decimal(props) {
|
|
11
24
|
const {
|
|
12
25
|
getPConnect,
|
|
13
26
|
label,
|
|
@@ -21,30 +34,21 @@ export default function Decimal(props) {
|
|
|
21
34
|
helperText,
|
|
22
35
|
displayMode,
|
|
23
36
|
hideLabel,
|
|
24
|
-
currencyISOCode =
|
|
37
|
+
currencyISOCode = 'USD',
|
|
25
38
|
decimalPrecision = 2,
|
|
26
39
|
showGroupSeparators = true,
|
|
27
|
-
testId
|
|
40
|
+
testId,
|
|
41
|
+
placeholder
|
|
28
42
|
} = props;
|
|
29
43
|
|
|
30
44
|
const pConn = getPConnect();
|
|
31
45
|
const actions = pConn.getActionsApi();
|
|
32
|
-
const propName = pConn.getStateProps().value;
|
|
46
|
+
const propName = (pConn.getStateProps() as any).value;
|
|
33
47
|
const helperTextToDisplay = validatemessage || helperText;
|
|
34
48
|
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
41
|
-
setCurrDec(theSymbols.theDecimalIndicator);
|
|
42
|
-
setCurrSep(theSymbols.theDigitGroupSeparator);
|
|
43
|
-
}, [currencyISOCode]);
|
|
44
|
-
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
setDecimalvalue(value.toString());
|
|
47
|
-
}, [value]);
|
|
49
|
+
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
50
|
+
const theCurrDec = theSymbols.theDecimalIndicator;
|
|
51
|
+
const theCurrSep = theSymbols.theDigitGroupSeparator;
|
|
48
52
|
|
|
49
53
|
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
50
54
|
const formattedValue = format(value, pConn.getComponentName().toLowerCase(), theCurrencyOptions);
|
|
@@ -57,23 +61,10 @@ export default function Decimal(props) {
|
|
|
57
61
|
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;
|
|
58
62
|
}
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (readOnly) {
|
|
63
|
-
readOnlyProp = { readOnly: true };
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let testProp = {};
|
|
67
|
-
|
|
68
|
-
testProp = {
|
|
64
|
+
const testProp = {
|
|
69
65
|
'data-test-id': testId
|
|
70
66
|
};
|
|
71
67
|
|
|
72
|
-
function decimalOnChange(event) {
|
|
73
|
-
// update internal value
|
|
74
|
-
setDecimalvalue(event?.target?.value);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
68
|
function decimalOnBlur(event, inValue) {
|
|
78
69
|
handleEvent(actions, 'changeNblur', propName, inValue !== '' ? Number(inValue) : inValue);
|
|
79
70
|
}
|
|
@@ -83,23 +74,23 @@ export default function Decimal(props) {
|
|
|
83
74
|
fullWidth
|
|
84
75
|
variant={readOnly ? 'standard' : 'outlined'}
|
|
85
76
|
helperText={helperTextToDisplay}
|
|
86
|
-
placeholder=''
|
|
77
|
+
placeholder={placeholder ?? ''}
|
|
87
78
|
size='small'
|
|
88
79
|
required={required}
|
|
89
80
|
disabled={disabled}
|
|
90
|
-
onChange={decimalOnChange}
|
|
91
|
-
onBlur={!readOnly ? decimalOnBlur : undefined}
|
|
92
81
|
error={status === 'error'}
|
|
93
82
|
label={label}
|
|
94
|
-
value={
|
|
83
|
+
value={value}
|
|
84
|
+
readOnly={!!readOnly}
|
|
95
85
|
type='text'
|
|
96
86
|
outputFormat='number'
|
|
97
87
|
textAlign='left'
|
|
98
|
-
InputProps={{
|
|
88
|
+
InputProps={{ inputProps: { ...testProp } }}
|
|
99
89
|
currencySymbol=''
|
|
100
90
|
decimalCharacter={theCurrDec}
|
|
101
91
|
digitGroupSeparator={showGroupSeparators ? theCurrSep : ''}
|
|
102
92
|
decimalPlaces={decimalPrecision}
|
|
93
|
+
onBlur={!readOnly ? decimalOnBlur : undefined}
|
|
103
94
|
/>
|
|
104
95
|
);
|
|
105
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './Decimal';
|
|
1
|
+
export { default } from './Decimal';
|
|
@@ -1,54 +1,160 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import { TextField } from '@material-ui/core';
|
|
3
3
|
import MenuItem from '@material-ui/core/MenuItem';
|
|
4
|
+
import isDeepEqual from 'fast-deep-equal/react';
|
|
4
5
|
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
6
|
+
import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
|
|
5
7
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
6
|
-
import
|
|
8
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
9
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
7
10
|
|
|
8
11
|
interface IOption {
|
|
9
12
|
key: string;
|
|
10
13
|
value: string;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
const flattenParameters = (params = {}) => {
|
|
17
|
+
const flatParams = {};
|
|
18
|
+
Object.keys(params).forEach(key => {
|
|
19
|
+
const { name, value: theVal } = params[key];
|
|
20
|
+
flatParams[name] = theVal;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return flatParams;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const preProcessColumns = columnList => {
|
|
27
|
+
return columnList.map(col => {
|
|
28
|
+
const tempColObj = { ...col };
|
|
29
|
+
tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;
|
|
30
|
+
return tempColObj;
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const getDisplayFieldsMetaData = columnList => {
|
|
35
|
+
const displayColumns = columnList.filter(col => col.display === 'true');
|
|
36
|
+
const metaDataObj: any = { key: '', primary: '', secondary: [] };
|
|
37
|
+
const keyCol = columnList.filter(col => col.key === 'true');
|
|
38
|
+
metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';
|
|
39
|
+
for (let index = 0; index < displayColumns.length; index += 1) {
|
|
40
|
+
if (displayColumns[index].primary === 'true') {
|
|
41
|
+
metaDataObj.primary = displayColumns[index].value;
|
|
42
|
+
} else {
|
|
43
|
+
metaDataObj.secondary.push(displayColumns[index].value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return metaDataObj;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
interface DropdownProps extends PConnFieldProps {
|
|
50
|
+
// If any, enter additional props that only exist on Dropdown here
|
|
51
|
+
datasource?: any[];
|
|
52
|
+
onRecordChange?: any;
|
|
53
|
+
fieldMetadata?: any;
|
|
54
|
+
listType: string;
|
|
55
|
+
deferDatasource?: boolean;
|
|
56
|
+
datasourceMetadata?: any;
|
|
57
|
+
parameters?: any;
|
|
58
|
+
columns: any[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default function Dropdown(props: DropdownProps) {
|
|
62
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
63
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
64
|
+
|
|
14
65
|
const {
|
|
15
66
|
getPConnect,
|
|
16
67
|
label,
|
|
17
68
|
required,
|
|
18
69
|
disabled,
|
|
19
70
|
value = '',
|
|
20
|
-
datasource = [],
|
|
21
71
|
validatemessage,
|
|
22
72
|
status,
|
|
23
73
|
readOnly,
|
|
24
74
|
testId,
|
|
25
75
|
helperText,
|
|
26
76
|
displayMode,
|
|
77
|
+
deferDatasource,
|
|
78
|
+
datasourceMetadata,
|
|
27
79
|
hideLabel,
|
|
28
80
|
onRecordChange,
|
|
29
81
|
fieldMetadata
|
|
30
82
|
} = props;
|
|
31
|
-
let { placeholder } = props;
|
|
83
|
+
let { placeholder = '' } = props;
|
|
84
|
+
const context = getPConnect().getContextName();
|
|
85
|
+
let { listType, parameters, datasource = [], columns = [] } = props;
|
|
32
86
|
placeholder = placeholder || 'Select...';
|
|
33
|
-
const [options, setOptions] = useState<
|
|
87
|
+
const [options, setOptions] = useState<IOption[]>([]);
|
|
88
|
+
const [theDatasource, setDatasource] = useState<any[] | null>(null);
|
|
34
89
|
const helperTextToDisplay = validatemessage || helperText;
|
|
35
90
|
|
|
36
91
|
const thePConn = getPConnect();
|
|
37
92
|
const actionsApi = thePConn.getActionsApi();
|
|
38
|
-
const propName = thePConn.getStateProps().value;
|
|
93
|
+
const propName = (thePConn.getStateProps() as any).value;
|
|
39
94
|
const className = thePConn.getCaseInfo().getClassName();
|
|
40
95
|
const refName = propName?.slice(propName.lastIndexOf('.') + 1);
|
|
41
96
|
|
|
97
|
+
if (!isDeepEqual(datasource, theDatasource)) {
|
|
98
|
+
// inbound datasource is different, so update theDatasource (to trigger useEffect)
|
|
99
|
+
setDatasource(datasource);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// convert associated to datapage listtype and transform props
|
|
103
|
+
// Process deferDatasource when datapage name is present. WHhen tableType is promptList / localList
|
|
104
|
+
if (deferDatasource && datasourceMetadata?.datasource?.name) {
|
|
105
|
+
listType = 'datapage';
|
|
106
|
+
datasource = datasourceMetadata.datasource.name;
|
|
107
|
+
const { parameters: dataSourceParameters, propertyForDisplayText, propertyForValue } = datasourceMetadata.datasource;
|
|
108
|
+
parameters = flattenParameters(dataSourceParameters);
|
|
109
|
+
const displayProp = propertyForDisplayText.startsWith('@P') ? propertyForDisplayText.substring(3) : propertyForDisplayText;
|
|
110
|
+
const valueProp = propertyForValue.startsWith('@P') ? propertyForValue.substring(3) : propertyForValue;
|
|
111
|
+
columns = [
|
|
112
|
+
{
|
|
113
|
+
key: 'true',
|
|
114
|
+
setProperty: 'Associated property',
|
|
115
|
+
value: valueProp
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
display: 'true',
|
|
119
|
+
primary: 'true',
|
|
120
|
+
useForSearch: true,
|
|
121
|
+
value: displayProp
|
|
122
|
+
}
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
columns = preProcessColumns(columns);
|
|
126
|
+
|
|
42
127
|
useEffect(() => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
128
|
+
if (theDatasource) {
|
|
129
|
+
const list = Utils.getOptionList(props, getPConnect().getDataObject('')); // 1st arg empty string until typedef marked correctly
|
|
130
|
+
const optionsList = [...list];
|
|
131
|
+
optionsList.unshift({
|
|
132
|
+
key: placeholder,
|
|
133
|
+
value: thePConn.getLocalizedValue(placeholder, '', '')
|
|
134
|
+
}); // 2nd and 3rd args empty string until typedef marked correctly
|
|
135
|
+
setOptions(optionsList);
|
|
136
|
+
}
|
|
137
|
+
}, [theDatasource]);
|
|
138
|
+
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if (!displayMode && listType !== 'associated' && typeof datasource === 'string') {
|
|
141
|
+
getDataPage(datasource, parameters, context).then((results: any) => {
|
|
142
|
+
const optionsData: any[] = [];
|
|
143
|
+
const displayColumn = getDisplayFieldsMetaData(columns);
|
|
144
|
+
results?.forEach(element => {
|
|
145
|
+
const val = element[displayColumn.primary]?.toString();
|
|
146
|
+
const obj = {
|
|
147
|
+
key: element[displayColumn.key] || element.pyGUID,
|
|
148
|
+
value: val
|
|
149
|
+
};
|
|
150
|
+
optionsData.push(obj);
|
|
151
|
+
});
|
|
152
|
+
setOptions(optionsData);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}, []);
|
|
48
156
|
|
|
49
|
-
const metaData = Array.isArray(fieldMetadata)
|
|
50
|
-
? fieldMetadata.filter(field => field?.classID === className)[0]
|
|
51
|
-
: fieldMetadata;
|
|
157
|
+
const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter(field => field?.classID === className)[0] : fieldMetadata;
|
|
52
158
|
|
|
53
159
|
let displayName = metaData?.datasource?.propertyForDisplayText;
|
|
54
160
|
displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);
|
|
@@ -63,11 +169,8 @@ export default function Dropdown(props) {
|
|
|
63
169
|
return (
|
|
64
170
|
<FieldValueList
|
|
65
171
|
name={hideLabel ? '' : label}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
localePath,
|
|
69
|
-
thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
|
|
70
|
-
)}
|
|
172
|
+
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
173
|
+
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
71
174
|
/>
|
|
72
175
|
);
|
|
73
176
|
}
|
|
@@ -76,11 +179,8 @@ export default function Dropdown(props) {
|
|
|
76
179
|
return (
|
|
77
180
|
<FieldValueList
|
|
78
181
|
name={hideLabel ? '' : label}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
localePath,
|
|
82
|
-
thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
|
|
83
|
-
)}
|
|
182
|
+
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
183
|
+
value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
84
184
|
variant='stacked'
|
|
85
185
|
/>
|
|
86
186
|
);
|
|
@@ -111,7 +211,7 @@ export default function Dropdown(props) {
|
|
|
111
211
|
fullWidth
|
|
112
212
|
variant={readOnly ? 'standard' : 'outlined'}
|
|
113
213
|
helperText={helperTextToDisplay}
|
|
114
|
-
placeholder={thePConn.getLocalizedValue(placeholder)}
|
|
214
|
+
placeholder={thePConn.getLocalizedValue(placeholder, '', '')} // 2nd and 3rd args empty string until typedef marked correctly
|
|
115
215
|
size='small'
|
|
116
216
|
required={required}
|
|
117
217
|
disabled={disabled}
|
|
@@ -124,11 +224,8 @@ export default function Dropdown(props) {
|
|
|
124
224
|
>
|
|
125
225
|
{options.map((option: any) => (
|
|
126
226
|
<MenuItem key={option.key} value={option.key}>
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
localePath,
|
|
130
|
-
thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)
|
|
131
|
-
)}
|
|
227
|
+
{/* @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv' */}
|
|
228
|
+
{thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}
|
|
132
229
|
</MenuItem>
|
|
133
230
|
))}
|
|
134
231
|
</TextField>
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TextField, InputAdornment } from '@material-ui/core';
|
|
1
|
+
import { InputAdornment, TextField } from '@material-ui/core';
|
|
3
2
|
import MailOutlineIcon from '@material-ui/icons/MailOutline';
|
|
4
|
-
import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
|
|
5
|
-
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
6
3
|
|
|
7
|
-
|
|
4
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
6
|
+
|
|
7
|
+
interface EmailProps extends PConnFieldProps {
|
|
8
|
+
// If any, enter additional props that only exist on Date here
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function Email(props: EmailProps) {
|
|
12
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
13
|
+
const TextInput = getComponentFromMap('TextInput');
|
|
14
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
15
|
+
|
|
8
16
|
const {
|
|
9
17
|
label,
|
|
10
18
|
required,
|
|
@@ -18,7 +26,8 @@ export default function Email(props) {
|
|
|
18
26
|
testId,
|
|
19
27
|
helperText,
|
|
20
28
|
displayMode,
|
|
21
|
-
hideLabel
|
|
29
|
+
hideLabel,
|
|
30
|
+
placeholder
|
|
22
31
|
} = props;
|
|
23
32
|
const helperTextToDisplay = validatemessage || helperText;
|
|
24
33
|
|
|
@@ -45,7 +54,7 @@ export default function Email(props) {
|
|
|
45
54
|
fullWidth
|
|
46
55
|
variant='outlined'
|
|
47
56
|
helperText={helperTextToDisplay}
|
|
48
|
-
placeholder=''
|
|
57
|
+
placeholder={placeholder ?? ''}
|
|
49
58
|
size='small'
|
|
50
59
|
required={required}
|
|
51
60
|
disabled={disabled}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './Email';
|
|
1
|
+
export { default } from './Email';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactElement, useMemo } from 'react';
|
|
2
|
+
import { Grid } from '@material-ui/core';
|
|
3
|
+
import FieldGroup from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldGroup';
|
|
4
|
+
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
|
+
|
|
6
|
+
interface GroupProps extends PConnFieldProps {
|
|
7
|
+
children: ReactElement[];
|
|
8
|
+
heading: string;
|
|
9
|
+
showHeading: boolean;
|
|
10
|
+
instructions?: string;
|
|
11
|
+
collapsible: boolean;
|
|
12
|
+
type: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function Group(props: GroupProps) {
|
|
16
|
+
const { children, heading, showHeading, instructions, collapsible, displayMode, type } = props;
|
|
17
|
+
|
|
18
|
+
const isReadOnly = displayMode === 'LABELS_LEFT';
|
|
19
|
+
|
|
20
|
+
const content = useMemo(() => {
|
|
21
|
+
return (
|
|
22
|
+
<Grid container spacing={2}>
|
|
23
|
+
{children?.map(child => (
|
|
24
|
+
<Grid item xs={12} key={child.key}>
|
|
25
|
+
{child}
|
|
26
|
+
</Grid>
|
|
27
|
+
))}
|
|
28
|
+
</Grid>
|
|
29
|
+
);
|
|
30
|
+
}, [children, type, isReadOnly]);
|
|
31
|
+
|
|
32
|
+
if (!children) return null;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<FieldGroup name={showHeading ? heading : undefined} collapsible={collapsible} instructions={instructions}>
|
|
36
|
+
{content}
|
|
37
|
+
</FieldGroup>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Group';
|