@pega/dx-component-builder-sdk 0.23.5 → 0.23.7
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/package.json +1 -1
- package/src/tasks/create/templates/Constellation/field/Text/index.jsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/field/Text-Input/index.jsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +30 -29
- package/src/tasks/create/templates/SDK-React/field/Date/index.tsx.mustache +6 -2
- package/src/tasks/create/templates/SDK-React/field/DateTime/index.tsx.mustache +6 -2
- package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +4 -1
- package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +4 -1
- package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +5 -2
- package/src/tasks/create/templates/SDK-React/field/Integer/index.tsx.mustache +6 -2
- package/src/tasks/create/templates/SDK-React/field/Picklist/index.tsx.mustache +4 -1
- package/src/tasks/create/templates/SDK-React/field/Text/index.tsx.mustache +4 -1
- package/src/tasks/create/templates/SDK-React/field/Text-Email/index.tsx.mustache +6 -2
- package/src/tasks/create/templates/SDK-React/field/Text-Input/index.tsx.mustache +4 -1
- package/src/tasks/create/templates/SDK-React/field/Text-Paragraph/index.tsx.mustache +4 -1
- package/src/tasks/create/templates/SDK-React/field/Text-Phone/index.tsx.mustache +4 -1
- package/src/tasks/create/templates/SDK-React/field/Text-URL/index.tsx.mustache +6 -2
- package/src/tasks/create/templates/SDK-React/field/TimeOfDay/index.tsx.mustache +6 -2
- package/src/tasks/create/templates/SDK-React/template/DETAILS/index.tsx.mustache +4 -2
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/index.tsx.mustache +4 -2
- package/src/tasks/create/templates/SDK-React/template/PAGE/OneColumn.tsx.mustache +7 -6
- package/tests/assets/components/SDK-React/create/custom-constellation/field/Pega_DXIL_MyTestText/index.jsx +1 -1
- package/tests/assets/components/SDK-React/create/custom-sdk/field/Pega_DXIL_MyTestText/index.tsx +4 -1
- package/tests/assets/components/SDK-React/create/override-sdk/designSystemExtension/AlertBanner/AlertBanner.tsx +47 -0
- package/tests/assets/components/SDK-React/create/override-sdk/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/tests/assets/components/SDK-React/create/override-sdk/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +5 -3
- package/tests/assets/components/SDK-React/create/override-sdk/designSystemExtension/FieldValueList/FieldValueList.tsx +1 -1
- package/tests/assets/components/SDK-React/create/override-sdk/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
- package/tests/assets/components/SDK-React/create/override-sdk/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/tests/assets/components/SDK-React/create/override-sdk/field/AutoComplete/AutoComplete.tsx +29 -27
- package/tests/assets/components/SDK-React/create/override-sdk/field/Checkbox/Checkbox.tsx +10 -6
- package/tests/assets/components/SDK-React/create/override-sdk/field/Currency/Currency.tsx +16 -15
- package/tests/assets/components/SDK-React/create/override-sdk/field/Date/Date.tsx +16 -15
- package/tests/assets/components/SDK-React/create/override-sdk/field/DateTime/DateTime.tsx +19 -14
- package/tests/assets/components/SDK-React/create/override-sdk/field/Decimal/Decimal.tsx +18 -16
- package/tests/assets/components/SDK-React/create/override-sdk/field/Dropdown/Dropdown.tsx +17 -25
- package/tests/assets/components/SDK-React/create/override-sdk/field/Email/Email.tsx +11 -11
- package/tests/assets/components/SDK-React/create/override-sdk/field/Integer/Integer.tsx +9 -7
- package/tests/assets/components/SDK-React/create/override-sdk/field/Percentage/Percentage.tsx +9 -9
- package/tests/assets/components/SDK-React/create/override-sdk/field/Phone/Phone.tsx +13 -12
- package/tests/assets/components/SDK-React/create/override-sdk/field/RadioButtons/RadioButtons.tsx +16 -35
- package/tests/assets/components/SDK-React/create/override-sdk/field/RichText/RichText.tsx +95 -0
- package/tests/assets/components/SDK-React/create/override-sdk/field/RichText/index.tsx +1 -0
- package/tests/assets/components/SDK-React/create/override-sdk/field/ScalarList/ScalarList.tsx +73 -0
- package/tests/assets/components/SDK-React/create/override-sdk/field/ScalarList/config-ext.json +8 -0
- package/tests/assets/components/SDK-React/create/override-sdk/field/ScalarList/index.tsx +1 -0
- package/tests/assets/components/SDK-React/create/override-sdk/field/SemanticLink/SemanticLink.tsx +19 -19
- package/tests/assets/components/SDK-React/create/override-sdk/field/TextArea/TextArea.tsx +8 -6
- package/tests/assets/components/SDK-React/create/override-sdk/field/TextInput/TextInput.tsx +8 -7
- package/tests/assets/components/SDK-React/create/override-sdk/field/Time/Time.tsx +16 -28
- package/tests/assets/components/SDK-React/create/override-sdk/field/URL/URL.tsx +10 -8
- package/tests/assets/components/SDK-React/create/override-sdk/field/UserReference/UserReference.tsx +29 -29
- package/tests/assets/components/SDK-React/create/override-sdk/infra/Assignment/Assignment.tsx +5 -2
- package/tests/assets/components/SDK-React/create/override-sdk/infra/AssignmentCard/AssignmentCard.tsx +4 -2
- package/tests/assets/components/SDK-React/create/override-sdk/infra/DashboardFilter/DashboardFilter.tsx +13 -13
- package/tests/assets/components/SDK-React/create/override-sdk/infra/DashboardFilter/filterUtils.tsx +2 -1
- package/tests/assets/components/SDK-React/create/override-sdk/infra/DeferLoad/DeferLoad.tsx +172 -0
- package/tests/assets/components/SDK-React/create/override-sdk/infra/DeferLoad/index.tsx +1 -0
- package/tests/assets/components/SDK-React/create/override-sdk/infra/MultiStep/MultiStep.tsx +4 -3
- package/tests/assets/components/SDK-React/create/override-sdk/infra/NavBar/NavBar.tsx +2 -1
- package/tests/assets/components/SDK-React/create/override-sdk/infra/VerticalTabs/VerticalTabs.tsx +4 -1
- package/tests/assets/components/SDK-React/create/override-sdk/template/AppShell/AppShell.tsx +6 -4
- package/tests/assets/components/SDK-React/create/override-sdk/template/BannerPage/BannerPage.tsx +4 -1
- package/tests/assets/components/SDK-React/create/override-sdk/template/CaseSummary/CaseSummary.tsx +4 -1
- package/tests/assets/components/SDK-React/create/override-sdk/template/CaseView/CaseView.tsx +10 -13
- package/tests/assets/components/SDK-React/create/override-sdk/template/Confirmation/Confirmation.tsx +23 -44
- package/tests/assets/components/SDK-React/create/override-sdk/template/DataReference/DataReference.tsx +43 -64
- package/tests/assets/components/SDK-React/create/override-sdk/template/Details/Details.tsx +8 -4
- package/tests/assets/components/SDK-React/create/override-sdk/template/DetailsThreeColumn/DetailsThreeColumn.tsx +8 -4
- package/tests/assets/components/SDK-React/create/override-sdk/template/DetailsTwoColumn/DetailsTwoColumn.tsx +8 -4
- package/tests/assets/components/SDK-React/create/override-sdk/template/FieldGroupTemplate/FieldGroupTemplate.tsx +6 -2
- package/tests/assets/components/SDK-React/create/override-sdk/template/InlineDashboardPage/InlineDashboardPage.tsx +5 -1
- package/tests/assets/components/SDK-React/create/override-sdk/template/ListPage/ListPage.tsx +6 -3
- package/tests/assets/components/SDK-React/create/override-sdk/template/ListView/ListView.tsx +89 -93
- package/tests/assets/components/SDK-React/create/override-sdk/template/ListView/utils.ts +170 -23
- package/tests/assets/components/SDK-React/create/override-sdk/template/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +9 -9
- package/tests/assets/components/SDK-React/create/override-sdk/template/NarrowWideDetails/NarrowWideDetails.tsx +8 -4
- package/tests/assets/components/SDK-React/create/override-sdk/template/NarrowWidePage/NarrowWidePage.tsx +4 -1
- package/tests/assets/components/SDK-React/create/override-sdk/template/OneColumnPage/OneColumnPage.tsx +3 -1
- package/tests/assets/components/SDK-React/create/override-sdk/template/PromotedFilters/PromotedFilters.tsx +4 -1
- package/tests/assets/components/SDK-React/create/override-sdk/template/SimpleTable/SimpleTable.tsx +88 -5
- package/tests/assets/components/SDK-React/create/override-sdk/template/SimpleTableSelect/SimpleTableSelect.tsx +6 -4
- package/tests/assets/components/SDK-React/create/override-sdk/template/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +22 -18
- package/tests/assets/components/SDK-React/create/override-sdk/template/TwoColumnPage/TwoColumnPage.tsx +3 -2
- package/tests/assets/components/SDK-React/create/override-sdk/template/WideNarrowDetails/WideNarrowDetails.tsx +8 -3
- package/tests/assets/components/SDK-React/create/override-sdk/template/WideNarrowPage/WideNarrowPage.tsx +4 -3
- package/tests/assets/components/SDK-React/create/override-sdk/widget/Attachment/Attachment.tsx +5 -1
- package/tests/assets/components/SDK-React/create/override-sdk/widget/FileUtility/FileUtility.tsx +8 -2
- package/tests/assets/components/SDK-React/create/override-sdk/widget/QuickCreate/QuickCreate.tsx +4 -1
- package/tests/assets/components/SDK-React/create/override-sdk/widget/SummaryList/SummaryList.tsx +4 -1
- package/tests/assets/components/SDK-React/create/override-sdk/widget/ToDo/ToDo.tsx +53 -82
- package/tests/assets/components/SDK-React/createAll/custom-constellation/field/Pega_DXIL_MyText/index.jsx +1 -1
- package/tests/assets/components/SDK-React/createAll/custom-constellation/field/Pega_DXIL_MyTextInput/index.jsx +1 -1
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyBoolean/index.tsx +30 -29
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyCurrency/index.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyDate/index.tsx +6 -2
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyDateTime/index.tsx +6 -2
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyDecimal/index.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyEmail/index.tsx +6 -2
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyInteger/index.tsx +6 -2
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyParagraph/index.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyPercentage/index.tsx +5 -2
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyPhone/index.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyPicklist/index.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyText/index.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyTextInput/index.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyTimeOfDay/index.tsx +6 -2
- package/tests/assets/components/SDK-React/createAll/custom-sdk/field/Pega_DXIL_MyURL/index.tsx +6 -2
- package/tests/assets/components/SDK-React/createAll/custom-sdk/template/Pega_DXIL_MyDetails/index.tsx +4 -2
- package/tests/assets/components/SDK-React/createAll/custom-sdk/template/Pega_DXIL_MyPage/OneColumn.tsx +7 -6
- package/tests/assets/components/SDK-React/createAll/custom-sdk/template/Pega_DXIL_MyTwoColumnDetails/index.tsx +4 -2
- package/tests/assets/components/SDK-React/createAll/override-sdk/designSystemExtension/AlertBanner/AlertBanner.tsx +47 -0
- package/tests/assets/components/SDK-React/createAll/override-sdk/designSystemExtension/AlertBanner/index.tsx +1 -0
- package/tests/assets/components/SDK-React/createAll/override-sdk/designSystemExtension/CaseSummaryFields/CaseSummaryFields.tsx +5 -3
- package/tests/assets/components/SDK-React/createAll/override-sdk/designSystemExtension/RichTextEditor/RichTextEditor.tsx +121 -0
- package/tests/assets/components/SDK-React/createAll/override-sdk/designSystemExtension/RichTextEditor/index.tsx +1 -0
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/AutoComplete/AutoComplete.tsx +29 -27
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/Checkbox/Checkbox.tsx +10 -6
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/Currency/Currency.tsx +16 -15
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/Date/Date.tsx +16 -15
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/DateTime/DateTime.tsx +19 -14
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/Decimal/Decimal.tsx +18 -16
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/Dropdown/Dropdown.tsx +17 -25
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/Email/Email.tsx +11 -11
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/Integer/Integer.tsx +9 -7
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/Percentage/Percentage.tsx +9 -9
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/Phone/Phone.tsx +13 -12
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/RadioButtons/RadioButtons.tsx +16 -35
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/RichText/RichText.tsx +95 -0
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/RichText/index.tsx +1 -0
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/ScalarList/ScalarList.tsx +25 -18
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/SemanticLink/SemanticLink.tsx +19 -19
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/TextArea/TextArea.tsx +8 -6
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/TextInput/TextInput.tsx +8 -7
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/Time/Time.tsx +16 -28
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/URL/URL.tsx +10 -8
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/UserReference/UserReference.tsx +29 -29
- package/tests/assets/components/SDK-React/createAll/override-sdk/infra/Assignment/Assignment.tsx +5 -2
- package/tests/assets/components/SDK-React/createAll/override-sdk/infra/AssignmentCard/AssignmentCard.tsx +4 -2
- package/tests/assets/components/SDK-React/createAll/override-sdk/infra/DeferLoad/DeferLoad.tsx +172 -0
- package/tests/assets/components/SDK-React/createAll/override-sdk/infra/DeferLoad/index.tsx +1 -0
- package/tests/assets/components/SDK-React/createAll/override-sdk/infra/MultiStep/MultiStep.tsx +4 -3
- package/tests/assets/components/SDK-React/createAll/override-sdk/infra/VerticalTabs/VerticalTabs.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/AppShell/AppShell.tsx +6 -4
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/BannerPage/BannerPage.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/CaseSummary/CaseSummary.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/CaseView/CaseView.tsx +6 -3
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/Confirmation/Confirmation.tsx +23 -44
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/DataReference/DataReference.tsx +6 -2
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/Details/Details.tsx +5 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/DetailsThreeColumn/DetailsThreeColumn.tsx +5 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/DetailsTwoColumn/DetailsTwoColumn.tsx +5 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/FieldGroupTemplate/FieldGroupTemplate.tsx +6 -2
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/InlineDashboardPage/InlineDashboardPage.tsx +5 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/ListPage/ListPage.tsx +6 -3
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/ListView/ListView.tsx +89 -93
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/ListView/utils.ts +170 -23
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/NarrowWideDetails/NarrowWideDetails.tsx +5 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/NarrowWidePage/NarrowWidePage.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/OneColumnPage/OneColumnPage.tsx +3 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/PromotedFilters/PromotedFilters.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/SimpleTable/SimpleTable.tsx +88 -5
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/SimpleTableSelect/SimpleTableSelect.tsx +6 -4
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/TwoColumnPage/TwoColumnPage.tsx +3 -2
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/WideNarrowDetails/WideNarrowDetails.tsx +5 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/WideNarrowPage/WideNarrowPage.tsx +4 -3
- package/tests/assets/components/SDK-React/createAll/override-sdk/widget/Attachment/Attachment.tsx +5 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/widget/FileUtility/FileUtility.tsx +8 -2
- package/tests/assets/components/SDK-React/createAll/override-sdk/widget/QuickCreate/QuickCreate.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/widget/SummaryList/SummaryList.tsx +4 -1
- package/tests/assets/components/SDK-React/createAll/override-sdk/widget/ToDo/ToDo.tsx +53 -82
- package/tests/functional/localCreateBuildAllDeleteAllCustom.test.js +1 -1
- package/tests/functional/localCreateBuildDeleteCustom.test.js +14 -1
- package/tests/functional/localCreateBuildDeleteOverride.test.js +2 -1
- package/tests/functional/localCreatePublishAllDeleteAllCustom.test.js +5 -3
- package/tests/functional/localCreatePublishAllDeleteAllOverride.test.js +3 -5
- package/tests/functional/localCreatePublishDeleteCustom.test.js +4 -3
- package/tests/functional/localCreatePublishDeleteOverride.test.js +2 -5
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { Editor } from '@tinymce/tinymce-react';
|
|
3
|
+
import { FormControl, FormHelperText, InputLabel, makeStyles } from '@material-ui/core';
|
|
4
|
+
import { useAfterInitialEffect, useConsolidatedRef, useUID } from '@pega/react-sdk-components/lib/hooks';
|
|
5
|
+
|
|
6
|
+
const useStyles = makeStyles((theme) => ({
|
|
7
|
+
fieldLabel: {
|
|
8
|
+
position: 'relative',
|
|
9
|
+
transform: 'translate(0, 0px) scale(1)',
|
|
10
|
+
marginBottom: '5px',
|
|
11
|
+
color: theme.palette.text.secondary
|
|
12
|
+
}
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
interface RichTextEditorProps {
|
|
16
|
+
id?: string;
|
|
17
|
+
defaultValue: string;
|
|
18
|
+
label: string;
|
|
19
|
+
labelHidden: boolean;
|
|
20
|
+
info: string;
|
|
21
|
+
testId: string;
|
|
22
|
+
placeholder: string;
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
required: boolean;
|
|
25
|
+
readOnly: boolean;
|
|
26
|
+
error: boolean;
|
|
27
|
+
onBlur: React.EventHandler<any>;
|
|
28
|
+
onChange: React.EventHandler<any>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const RichTextEditor = forwardRef(function RichTextEditor(props: RichTextEditorProps, ref) {
|
|
32
|
+
const classes = useStyles();
|
|
33
|
+
const uid = useUID();
|
|
34
|
+
const { id = uid, defaultValue, label, labelHidden, info, testId, placeholder, disabled, required, readOnly, error, onBlur, onChange } = props;
|
|
35
|
+
|
|
36
|
+
const editorRef: any = useConsolidatedRef(ref);
|
|
37
|
+
let richTextComponent: any = null;
|
|
38
|
+
|
|
39
|
+
useAfterInitialEffect(() => {
|
|
40
|
+
editorRef?.current.mode.set(readOnly || disabled ? 'readonly' : 'design');
|
|
41
|
+
}, [readOnly, disabled]);
|
|
42
|
+
|
|
43
|
+
const filePickerCallback = (cb) => {
|
|
44
|
+
const input = document.createElement('input');
|
|
45
|
+
input.setAttribute('type', 'file');
|
|
46
|
+
input.setAttribute('accept', 'image/*');
|
|
47
|
+
|
|
48
|
+
input.addEventListener('change', (e: any) => {
|
|
49
|
+
const file = e.target.files[0];
|
|
50
|
+
|
|
51
|
+
const reader: any = new FileReader();
|
|
52
|
+
reader.addEventListener('load', () => {
|
|
53
|
+
/*
|
|
54
|
+
Note: Now we need to register the blob in TinyMCEs image blob
|
|
55
|
+
registry. In the next release this part hopefully won't be
|
|
56
|
+
necessary, as we are looking to handle it internally.
|
|
57
|
+
*/
|
|
58
|
+
const blobId = `blobid${new Date().getTime()}`;
|
|
59
|
+
const blobCache = editorRef.current.editorUpload.blobCache;
|
|
60
|
+
const base64 = reader.result.split(',')[1];
|
|
61
|
+
const blobInfo = blobCache.create(blobId, file, base64);
|
|
62
|
+
blobCache.add(blobInfo);
|
|
63
|
+
|
|
64
|
+
/* call the callback and populate the Title field with the file name */
|
|
65
|
+
cb(blobInfo.blobUri(), { title: file.name });
|
|
66
|
+
});
|
|
67
|
+
reader.readAsDataURL(file);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
input.click();
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
if (readOnly) {
|
|
74
|
+
const value = defaultValue || '--';
|
|
75
|
+
// eslint-disable-next-line react/no-danger
|
|
76
|
+
richTextComponent = <div key={id} id={id} className="readonly-richtext-editor" dangerouslySetInnerHTML={{ __html: value }} />;
|
|
77
|
+
} else {
|
|
78
|
+
richTextComponent = (
|
|
79
|
+
<Editor
|
|
80
|
+
tinymceScriptSrc="tinymce/tinymce.min.js"
|
|
81
|
+
onInit={(_evt, editor) => {
|
|
82
|
+
editorRef.current = editor;
|
|
83
|
+
}}
|
|
84
|
+
id={id}
|
|
85
|
+
initialValue={defaultValue}
|
|
86
|
+
disabled={disabled}
|
|
87
|
+
init={{
|
|
88
|
+
placeholder,
|
|
89
|
+
menubar: false,
|
|
90
|
+
statusbar: false,
|
|
91
|
+
min_height: 130,
|
|
92
|
+
plugins: ['lists', 'advlist', 'autolink', 'image', 'link', 'autoresize'],
|
|
93
|
+
autoresize_bottom_margin: 0,
|
|
94
|
+
toolbar: disabled ? false : 'blocks | bold italic strikethrough | bullist numlist outdent indent | link image',
|
|
95
|
+
toolbar_location: 'bottom',
|
|
96
|
+
content_style: 'body { font-family:Helvetica, Arial,sans-serif; font-size:14px }',
|
|
97
|
+
branding: false,
|
|
98
|
+
paste_data_images: true,
|
|
99
|
+
file_picker_types: 'image',
|
|
100
|
+
file_picker_callback: filePickerCallback
|
|
101
|
+
}}
|
|
102
|
+
onBlur={onBlur}
|
|
103
|
+
onEditorChange={onChange}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<FormControl data-test-id={testId} error={error} required={required}>
|
|
110
|
+
{!labelHidden && (
|
|
111
|
+
<InputLabel id="demo-simple-select-error-label" className={classes.fieldLabel}>
|
|
112
|
+
{label}
|
|
113
|
+
</InputLabel>
|
|
114
|
+
)}
|
|
115
|
+
{richTextComponent}
|
|
116
|
+
{info && <FormHelperText>{info}</FormHelperText>}
|
|
117
|
+
</FormControl>
|
|
118
|
+
);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
export default RichTextEditor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './RichTextEditor';
|
package/tests/assets/components/SDK-React/create/override-sdk/field/AutoComplete/AutoComplete.tsx
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { TextField } from '@material-ui/core';
|
|
3
3
|
import Autocomplete from '@material-ui/lab/Autocomplete';
|
|
4
|
-
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
5
|
-
import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
|
|
6
4
|
import isDeepEqual from 'fast-deep-equal/react';
|
|
5
|
+
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
7
6
|
import { getDataPage } from '@pega/react-sdk-components/lib/components/helpers/data_page';
|
|
8
7
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
9
|
-
import
|
|
8
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
10
9
|
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
11
10
|
|
|
12
11
|
interface IOption {
|
|
@@ -14,18 +13,18 @@ interface IOption {
|
|
|
14
13
|
value: string;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
const preProcessColumns = columnList => {
|
|
18
|
-
return columnList.map(col => {
|
|
16
|
+
const preProcessColumns = (columnList) => {
|
|
17
|
+
return columnList.map((col) => {
|
|
19
18
|
const tempColObj = { ...col };
|
|
20
19
|
tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;
|
|
21
20
|
return tempColObj;
|
|
22
21
|
});
|
|
23
22
|
};
|
|
24
23
|
|
|
25
|
-
const getDisplayFieldsMetaData = columnList => {
|
|
26
|
-
const displayColumns = columnList.filter(col => col.display === 'true');
|
|
24
|
+
const getDisplayFieldsMetaData = (columnList) => {
|
|
25
|
+
const displayColumns = columnList.filter((col) => col.display === 'true');
|
|
27
26
|
const metaDataObj: any = { key: '', primary: '', secondary: [] };
|
|
28
|
-
const keyCol = columnList.filter(col => col.key === 'true');
|
|
27
|
+
const keyCol = columnList.filter((col) => col.key === 'true');
|
|
29
28
|
metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';
|
|
30
29
|
for (let index = 0; index < displayColumns.length; index += 1) {
|
|
31
30
|
if (displayColumns[index].primary === 'true') {
|
|
@@ -39,20 +38,23 @@ const getDisplayFieldsMetaData = columnList => {
|
|
|
39
38
|
|
|
40
39
|
interface AutoCompleteProps extends PConnFieldProps {
|
|
41
40
|
// If any, enter additional props that only exist on AutoComplete here'
|
|
42
|
-
displayMode?: string
|
|
43
|
-
deferDatasource?: boolean
|
|
44
|
-
datasourceMetadata?: any
|
|
45
|
-
status?: string
|
|
46
|
-
onRecordChange?: any
|
|
47
|
-
additionalProps?: object
|
|
48
|
-
listType: string
|
|
49
|
-
parameters?: any
|
|
50
|
-
datasource: any
|
|
51
|
-
columns: Array<any
|
|
41
|
+
displayMode?: string;
|
|
42
|
+
deferDatasource?: boolean;
|
|
43
|
+
datasourceMetadata?: any;
|
|
44
|
+
status?: string;
|
|
45
|
+
onRecordChange?: any;
|
|
46
|
+
additionalProps?: object;
|
|
47
|
+
listType: string;
|
|
48
|
+
parameters?: any;
|
|
49
|
+
datasource: any;
|
|
50
|
+
columns: Array<any>;
|
|
52
51
|
}
|
|
53
52
|
|
|
53
|
+
export default function AutoComplete(props: AutoCompleteProps) {
|
|
54
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
55
|
+
const TextInput = getComponentFromMap('TextInput');
|
|
56
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
54
57
|
|
|
55
|
-
export default function AutoComplete(props:AutoCompleteProps) {
|
|
56
58
|
const {
|
|
57
59
|
getPConnect,
|
|
58
60
|
label,
|
|
@@ -90,7 +92,7 @@ export default function AutoComplete(props:AutoCompleteProps) {
|
|
|
90
92
|
|
|
91
93
|
const flattenParameters = (params = {}) => {
|
|
92
94
|
const flatParams = {};
|
|
93
|
-
Object.keys(params).forEach(key => {
|
|
95
|
+
Object.keys(params).forEach((key) => {
|
|
94
96
|
const { name, value: theVal } = params[key];
|
|
95
97
|
flatParams[name] = theVal;
|
|
96
98
|
});
|
|
@@ -137,7 +139,7 @@ export default function AutoComplete(props:AutoCompleteProps) {
|
|
|
137
139
|
getDataPage(datasource, parameters, context).then((results: any) => {
|
|
138
140
|
const optionsData: Array<any> = [];
|
|
139
141
|
const displayColumn = getDisplayFieldsMetaData(columns);
|
|
140
|
-
results?.forEach(element => {
|
|
142
|
+
results?.forEach((element) => {
|
|
141
143
|
const val = element[displayColumn.primary]?.toString();
|
|
142
144
|
const obj = {
|
|
143
145
|
key: element[displayColumn.key] || element.pyGUID,
|
|
@@ -155,11 +157,11 @@ export default function AutoComplete(props:AutoCompleteProps) {
|
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
158
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant=
|
|
160
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
if (value) {
|
|
162
|
-
const index = options?.findIndex(element => element.key === value);
|
|
164
|
+
const index = options?.findIndex((element) => element.key === value);
|
|
163
165
|
if (index > -1) {
|
|
164
166
|
selectedValue = options[index].value;
|
|
165
167
|
} else {
|
|
@@ -180,7 +182,7 @@ export default function AutoComplete(props:AutoCompleteProps) {
|
|
|
180
182
|
};
|
|
181
183
|
|
|
182
184
|
if (readOnly) {
|
|
183
|
-
const theValAsString = options?.find(opt => opt.key === value)?.value;
|
|
185
|
+
const theValAsString = options?.find((opt) => opt.key === value)?.value;
|
|
184
186
|
return <TextInput {...props} value={theValAsString} />;
|
|
185
187
|
}
|
|
186
188
|
// Need to use both getOptionLabel and getOptionSelected to map our
|
|
@@ -199,14 +201,14 @@ export default function AutoComplete(props:AutoCompleteProps) {
|
|
|
199
201
|
value={selectedValue}
|
|
200
202
|
inputValue={inputValue || selectedValue}
|
|
201
203
|
onInputChange={handleInputValue}
|
|
202
|
-
renderInput={params => (
|
|
204
|
+
renderInput={(params) => (
|
|
203
205
|
<TextField
|
|
204
206
|
{...params}
|
|
205
207
|
fullWidth
|
|
206
|
-
variant=
|
|
208
|
+
variant="outlined"
|
|
207
209
|
helperText={helperTextToDisplay}
|
|
208
210
|
placeholder={placeholder}
|
|
209
|
-
size=
|
|
211
|
+
size="small"
|
|
210
212
|
required={required}
|
|
211
213
|
error={status === 'error'}
|
|
212
214
|
label={label}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
FormHelperText
|
|
8
8
|
} from '@material-ui/core';
|
|
9
9
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
10
|
-
import
|
|
10
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
11
11
|
// import type { PConnProps } from '../../../types/PConnProps';
|
|
12
12
|
|
|
13
13
|
// Checkbox passes in 'value' as a boolean. So can't use the default
|
|
@@ -36,8 +36,10 @@ import FieldValueList from '@pega/react-sdk-components/lib/components/designSyst
|
|
|
36
36
|
// // eslint-disable-next-line react/no-unused-prop-types
|
|
37
37
|
// placeholder?: string
|
|
38
38
|
// }
|
|
39
|
-
|
|
40
39
|
export default function CheckboxComponent(props /* : CheckboxProps */) {
|
|
40
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
41
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
42
|
+
|
|
41
43
|
const {
|
|
42
44
|
getPConnect,
|
|
43
45
|
label,
|
|
@@ -56,9 +58,9 @@ export default function CheckboxComponent(props /* : CheckboxProps */) {
|
|
|
56
58
|
|
|
57
59
|
const thePConn = getPConnect();
|
|
58
60
|
const theConfigProps = thePConn.getConfigProps();
|
|
59
|
-
const caption = theConfigProps[
|
|
61
|
+
const caption = theConfigProps['caption'];
|
|
60
62
|
const actionsApi = thePConn.getActionsApi();
|
|
61
|
-
const propName = thePConn.getStateProps()[
|
|
63
|
+
const propName = thePConn.getStateProps()['value'];
|
|
62
64
|
|
|
63
65
|
const [checked, setChecked] = useState(false);
|
|
64
66
|
useEffect(() => {
|
|
@@ -71,7 +73,9 @@ export default function CheckboxComponent(props /* : CheckboxProps */) {
|
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
74
|
-
return
|
|
76
|
+
return (
|
|
77
|
+
<FieldValueList name={hideLabel ? '' : label} value={value.toString()} variant='stacked' />
|
|
78
|
+
);
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
const handleChange = event => {
|
|
@@ -79,7 +83,7 @@ export default function CheckboxComponent(props /* : CheckboxProps */) {
|
|
|
79
83
|
};
|
|
80
84
|
|
|
81
85
|
const handleBlur = event => {
|
|
82
|
-
thePConn.getValidationApi().validate(event.target.checked,
|
|
86
|
+
thePConn.getValidationApi().validate(event.target.checked, ''); // 2nd arg empty string until typedef marked correctly as optional
|
|
83
87
|
};
|
|
84
88
|
|
|
85
89
|
let theCheckbox = <Checkbox color='primary' disabled={disabled} />;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
// import { TextField } from "@material-ui/core";
|
|
3
2
|
import CurrencyTextField from '@unicef/material-ui-currency-textfield';
|
|
4
3
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
5
|
-
import
|
|
6
|
-
import { format } from "@pega/react-sdk-components/lib/components/helpers/formatters";
|
|
4
|
+
import { format } from '@pega/react-sdk-components/lib/components/helpers/formatters';
|
|
7
5
|
import { getCurrencyCharacters, getCurrencyOptions } from './currency-utils';
|
|
6
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
8
7
|
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
9
8
|
|
|
10
9
|
// Using control from: https://github.com/unicef/material-ui-currency-textfield
|
|
11
10
|
|
|
12
11
|
interface CurrrencyProps extends PConnFieldProps {
|
|
13
12
|
// If any, enter additional props that only exist on Currency here
|
|
14
|
-
currencyISOCode?: string
|
|
13
|
+
currencyISOCode?: string;
|
|
15
14
|
}
|
|
16
15
|
|
|
16
|
+
export default function Currency(props: CurrrencyProps) {
|
|
17
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
18
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
17
19
|
|
|
18
|
-
export default function Currency(props:CurrrencyProps) {
|
|
19
20
|
const {
|
|
20
21
|
getPConnect,
|
|
21
22
|
label,
|
|
@@ -30,7 +31,7 @@ export default function Currency(props:CurrrencyProps) {
|
|
|
30
31
|
helperText,
|
|
31
32
|
displayMode,
|
|
32
33
|
hideLabel,
|
|
33
|
-
currencyISOCode =
|
|
34
|
+
currencyISOCode = 'USD'
|
|
34
35
|
} = props;
|
|
35
36
|
|
|
36
37
|
const pConn = getPConnect();
|
|
@@ -53,9 +54,9 @@ export default function Currency(props:CurrrencyProps) {
|
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
const [currValue, setCurrValue] = useState('');
|
|
56
|
-
const [theCurrSym, setCurrSym] = useState(
|
|
57
|
-
const [theCurrDec, setCurrDec] = useState(
|
|
58
|
-
const [theCurrSep, setCurrSep] = useState(
|
|
57
|
+
const [theCurrSym, setCurrSym] = useState('$');
|
|
58
|
+
const [theCurrDec, setCurrDec] = useState('.');
|
|
59
|
+
const [theCurrSep, setCurrSep] = useState(',');
|
|
59
60
|
|
|
60
61
|
useEffect(() => {
|
|
61
62
|
// currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
|
|
@@ -78,7 +79,7 @@ export default function Currency(props:CurrrencyProps) {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
81
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant=
|
|
82
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant="stacked" />;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
@@ -101,8 +102,8 @@ export default function Currency(props:CurrrencyProps) {
|
|
|
101
102
|
fullWidth
|
|
102
103
|
variant={readOnly ? 'standard' : 'outlined'}
|
|
103
104
|
helperText={helperTextToDisplay}
|
|
104
|
-
placeholder=
|
|
105
|
-
size=
|
|
105
|
+
placeholder=""
|
|
106
|
+
size="small"
|
|
106
107
|
required={required}
|
|
107
108
|
disabled={disabled}
|
|
108
109
|
onChange={currOnChange}
|
|
@@ -110,9 +111,9 @@ export default function Currency(props:CurrrencyProps) {
|
|
|
110
111
|
error={status === 'error'}
|
|
111
112
|
label={label}
|
|
112
113
|
value={currValue}
|
|
113
|
-
type=
|
|
114
|
-
outputFormat=
|
|
115
|
-
textAlign=
|
|
114
|
+
type="text"
|
|
115
|
+
outputFormat="number"
|
|
116
|
+
textAlign="left"
|
|
116
117
|
InputProps={{ ...readOnlyProp, inputProps: { ...testProp, value: currValue } }}
|
|
117
118
|
currencySymbol={theCurrSym}
|
|
118
119
|
decimalCharacter={theCurrDec}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { KeyboardDatePicker } from '@material-ui/pickers';
|
|
3
|
-
import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
|
|
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';
|
|
8
7
|
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
9
8
|
|
|
10
9
|
// Will return the date string in YYYY-MM-DD format which we'll be POSTing to the server
|
|
11
|
-
function getFormattedDate(date){
|
|
10
|
+
function getFormattedDate(date) {
|
|
12
11
|
return `${date.$y.toString()}-${(date.$M + 1).toString().padStart(2, '0')}-${date.$D.toString().padStart(2, '0')}`;
|
|
13
12
|
}
|
|
14
13
|
|
|
@@ -16,8 +15,11 @@ interface DateProps extends PConnFieldProps {
|
|
|
16
15
|
// If any, enter additional props that only exist on Date here
|
|
17
16
|
}
|
|
18
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');
|
|
19
22
|
|
|
20
|
-
export default function Date(props:DateProps) {
|
|
21
23
|
const {
|
|
22
24
|
getPConnect,
|
|
23
25
|
label,
|
|
@@ -43,12 +45,11 @@ export default function Date(props:DateProps) {
|
|
|
43
45
|
// Start with default dateFormatInfo
|
|
44
46
|
const dateFormatInfo = dateFormatInfoDefault;
|
|
45
47
|
// and then update, as needed, based on locale, etc.
|
|
46
|
-
const theDateFormat = getDateFormatInfo()
|
|
48
|
+
const theDateFormat = getDateFormatInfo();
|
|
47
49
|
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
48
50
|
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
49
51
|
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
50
52
|
|
|
51
|
-
|
|
52
53
|
if (displayMode === 'LABELS_LEFT') {
|
|
53
54
|
const formattedDate = format(props.value, 'date', { format: dateFormatInfo.dateFormatString });
|
|
54
55
|
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} />;
|
|
@@ -56,7 +57,7 @@ export default function Date(props:DateProps) {
|
|
|
56
57
|
|
|
57
58
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
58
59
|
const formattedDate = format(props.value, 'date', { format: dateFormatInfo.dateFormatString });
|
|
59
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant=
|
|
60
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant="stacked" />;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
if (readOnly) {
|
|
@@ -70,14 +71,14 @@ export default function Date(props:DateProps) {
|
|
|
70
71
|
'data-test-id': testId
|
|
71
72
|
};
|
|
72
73
|
|
|
73
|
-
const handleChange = date => {
|
|
74
|
-
if(date && date.isValid()){
|
|
74
|
+
const handleChange = (date) => {
|
|
75
|
+
if (date && date.isValid()) {
|
|
75
76
|
onChange({ value: getFormattedDate(date) });
|
|
76
77
|
}
|
|
77
78
|
};
|
|
78
79
|
|
|
79
|
-
const handleAccept = date => {
|
|
80
|
-
if(date && date.isValid()){
|
|
80
|
+
const handleAccept = (date) => {
|
|
81
|
+
if (date && date.isValid()) {
|
|
81
82
|
handleEvent(actions, 'changeNblur', propName, getFormattedDate(date));
|
|
82
83
|
}
|
|
83
84
|
};
|
|
@@ -85,8 +86,8 @@ export default function Date(props:DateProps) {
|
|
|
85
86
|
return (
|
|
86
87
|
<KeyboardDatePicker
|
|
87
88
|
disableToolbar
|
|
88
|
-
variant=
|
|
89
|
-
inputVariant=
|
|
89
|
+
variant="inline"
|
|
90
|
+
inputVariant="outlined"
|
|
90
91
|
placeholder={dateFormatInfo.dateFormatStringLC}
|
|
91
92
|
format={dateFormatInfo.dateFormatString}
|
|
92
93
|
mask={dateFormatInfo.dateFormatMask}
|
|
@@ -96,7 +97,7 @@ export default function Date(props:DateProps) {
|
|
|
96
97
|
disabled={disabled}
|
|
97
98
|
error={status === 'error'}
|
|
98
99
|
helperText={helperTextToDisplay}
|
|
99
|
-
size=
|
|
100
|
+
size="small"
|
|
100
101
|
label={label}
|
|
101
102
|
value={value || null}
|
|
102
103
|
onChange={handleChange}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { KeyboardDateTimePicker } from '@material-ui/pickers';
|
|
3
|
-
import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
|
|
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';
|
|
8
7
|
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
9
8
|
|
|
10
9
|
interface DateTimeProps extends PConnFieldProps {
|
|
11
10
|
// If any, enter additional props that only exist on DateTime here
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
|
|
15
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');
|
|
17
|
+
|
|
16
18
|
const {
|
|
17
19
|
getPConnect,
|
|
18
20
|
label,
|
|
@@ -37,20 +39,23 @@ export default function DateTime(props: DateTimeProps) {
|
|
|
37
39
|
// Start with default dateFormatInfo
|
|
38
40
|
const dateFormatInfo = dateFormatInfoDefault;
|
|
39
41
|
// and then update, as needed, based on locale, etc.
|
|
40
|
-
const theDateFormat = getDateFormatInfo()
|
|
42
|
+
const theDateFormat = getDateFormatInfo();
|
|
41
43
|
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
42
44
|
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
43
45
|
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
44
46
|
|
|
45
|
-
|
|
46
47
|
if (displayMode === 'LABELS_LEFT') {
|
|
47
|
-
const formattedDateTime = format(props.value, 'datetime', {
|
|
48
|
+
const formattedDateTime = format(props.value, 'datetime', {
|
|
49
|
+
format: `${dateFormatInfo.dateFormatString} hh:mm a`
|
|
50
|
+
});
|
|
48
51
|
return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} />;
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
52
|
-
const formattedDateTime = format(props.value, 'datetime', {
|
|
53
|
-
|
|
55
|
+
const formattedDateTime = format(props.value, 'datetime', {
|
|
56
|
+
format: `${dateFormatInfo.dateFormatString} hh:mm a`
|
|
57
|
+
});
|
|
58
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} variant="stacked" />;
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
if (readOnly) {
|
|
@@ -58,12 +63,12 @@ export default function DateTime(props: DateTimeProps) {
|
|
|
58
63
|
return <TextInput {...props} value={formattedDateTime} />;
|
|
59
64
|
}
|
|
60
65
|
|
|
61
|
-
const handleChange = date => {
|
|
66
|
+
const handleChange = (date) => {
|
|
62
67
|
const changeValue = date && date.isValid() ? date.toISOString() : null;
|
|
63
68
|
onChange({ value: changeValue });
|
|
64
69
|
};
|
|
65
70
|
|
|
66
|
-
const handleAccept = date => {
|
|
71
|
+
const handleAccept = (date) => {
|
|
67
72
|
const changeValue = date && date.isValid() ? date.toISOString() : null;
|
|
68
73
|
handleEvent(actions, 'changeNblur', propName, changeValue);
|
|
69
74
|
};
|
|
@@ -75,8 +80,8 @@ export default function DateTime(props: DateTimeProps) {
|
|
|
75
80
|
|
|
76
81
|
return (
|
|
77
82
|
<KeyboardDateTimePicker
|
|
78
|
-
variant=
|
|
79
|
-
inputVariant=
|
|
83
|
+
variant="inline"
|
|
84
|
+
inputVariant="outlined"
|
|
80
85
|
fullWidth
|
|
81
86
|
autoOk
|
|
82
87
|
required={required}
|
|
@@ -87,7 +92,7 @@ export default function DateTime(props: DateTimeProps) {
|
|
|
87
92
|
minutesStep={5}
|
|
88
93
|
error={status === 'error'}
|
|
89
94
|
helperText={helperTextToDisplay}
|
|
90
|
-
size=
|
|
95
|
+
size="small"
|
|
91
96
|
label={label}
|
|
92
97
|
value={value || null}
|
|
93
98
|
onChange={handleChange}
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import CurrencyTextField from '@unicef/material-ui-currency-textfield';
|
|
3
|
-
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
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
7
|
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
8
|
|
|
9
9
|
// Using control from: https://github.com/unicef/material-ui-currency-textfield
|
|
10
10
|
|
|
11
11
|
interface DecimalProps extends PConnFieldProps {
|
|
12
12
|
// If any, enter additional props that only exist on Decimal here
|
|
13
|
-
currencyISOCode?: string
|
|
14
|
-
decimalPrecision?: number
|
|
15
|
-
showGroupSeparators?: string
|
|
13
|
+
currencyISOCode?: string;
|
|
14
|
+
decimalPrecision?: number;
|
|
15
|
+
showGroupSeparators?: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
18
|
export default function Decimal(props: DecimalProps) {
|
|
19
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
20
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
21
|
+
|
|
20
22
|
const {
|
|
21
23
|
getPConnect,
|
|
22
24
|
label,
|
|
@@ -30,7 +32,7 @@ export default function Decimal(props: DecimalProps) {
|
|
|
30
32
|
helperText,
|
|
31
33
|
displayMode,
|
|
32
34
|
hideLabel,
|
|
33
|
-
currencyISOCode =
|
|
35
|
+
currencyISOCode = 'USD',
|
|
34
36
|
decimalPrecision = 2,
|
|
35
37
|
showGroupSeparators = true,
|
|
36
38
|
testId
|
|
@@ -42,8 +44,8 @@ export default function Decimal(props: DecimalProps) {
|
|
|
42
44
|
const helperTextToDisplay = validatemessage || helperText;
|
|
43
45
|
|
|
44
46
|
const [decValue, setDecimalvalue] = useState('');
|
|
45
|
-
const [theCurrDec, setCurrDec] = useState(
|
|
46
|
-
const [theCurrSep, setCurrSep] = useState(
|
|
47
|
+
const [theCurrDec, setCurrDec] = useState('.');
|
|
48
|
+
const [theCurrSep, setCurrSep] = useState(',');
|
|
47
49
|
|
|
48
50
|
useEffect(() => {
|
|
49
51
|
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
@@ -63,7 +65,7 @@ export default function Decimal(props: DecimalProps) {
|
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
66
|
-
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant=
|
|
68
|
+
return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant="stacked" />;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
let readOnlyProp = {}; // Note: empty if NOT ReadOnly
|
|
@@ -92,8 +94,8 @@ export default function Decimal(props: DecimalProps) {
|
|
|
92
94
|
fullWidth
|
|
93
95
|
variant={readOnly ? 'standard' : 'outlined'}
|
|
94
96
|
helperText={helperTextToDisplay}
|
|
95
|
-
placeholder=
|
|
96
|
-
size=
|
|
97
|
+
placeholder=""
|
|
98
|
+
size="small"
|
|
97
99
|
required={required}
|
|
98
100
|
disabled={disabled}
|
|
99
101
|
onChange={decimalOnChange}
|
|
@@ -101,11 +103,11 @@ export default function Decimal(props: DecimalProps) {
|
|
|
101
103
|
error={status === 'error'}
|
|
102
104
|
label={label}
|
|
103
105
|
value={decValue}
|
|
104
|
-
type=
|
|
105
|
-
outputFormat=
|
|
106
|
-
textAlign=
|
|
106
|
+
type="text"
|
|
107
|
+
outputFormat="number"
|
|
108
|
+
textAlign="left"
|
|
107
109
|
InputProps={{ ...readOnlyProp, inputProps: { ...testProp, value: decValue } }}
|
|
108
|
-
currencySymbol=
|
|
110
|
+
currencySymbol=""
|
|
109
111
|
decimalCharacter={theCurrDec}
|
|
110
112
|
digitGroupSeparator={showGroupSeparators ? theCurrSep : ''}
|
|
111
113
|
decimalPlaces={decimalPrecision}
|