@pega/dx-component-builder-sdk 0.8.6 → 0.8.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/constants.js +16 -0
- package/src/tasks/create/templates/Constellation/field/Text-Input/index.jsx.mustache +1 -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 +25 -28
- 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 +22 -31
- 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 +18 -38
- package/tests/assets/components/SDK-React/create/override-sdk/field/RichText/RichText.tsx +93 -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 +64 -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 +1 -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 +7 -2
- 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 +28 -49
- 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 +16 -11
- package/tests/assets/components/SDK-React/create/override-sdk/template/SimpleTable/SimpleTable.tsx +96 -13
- 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 -17
- 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 +7 -3
- 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_MyTextInput/index.jsx +1 -1
- 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 +25 -28
- 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 +22 -31
- 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 +18 -38
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/RichText/RichText.tsx +93 -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 +28 -30
- package/tests/assets/components/SDK-React/createAll/override-sdk/field/ScalarList/config-ext.json +7 -22
- 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 +7 -2
- 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 +27 -21
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/Details/Details.tsx +6 -2
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/DetailsThreeColumn/DetailsThreeColumn.tsx +6 -2
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/DetailsTwoColumn/DetailsTwoColumn.tsx +6 -2
- 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 +6 -2
- 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 +16 -11
- package/tests/assets/components/SDK-React/createAll/override-sdk/template/SimpleTable/SimpleTable.tsx +96 -13
- 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 +8 -4
- 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 +7 -3
- 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 +0 -1
- package/tests/functional/localCreateBuildDeleteCustom.test.js +1 -1
- package/tests/functional/localCreateBuildDeleteOverride.test.js +1 -1
- package/tests/functional/localCreatePublishAllDeleteAllCustom.test.js +1 -1
- package/tests/functional/localCreatePublishAllDeleteAllOverride.test.js +0 -5
- package/tests/functional/localCreatePublishDeleteOverride.test.js +1 -4
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
3
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
4
|
+
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
|
+
|
|
6
|
+
interface RichTextProps extends PConnFieldProps {
|
|
7
|
+
// If any, enter additional props that only exist on TextArea here
|
|
8
|
+
additionalProps?: object;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function RichText(props: RichTextProps) {
|
|
12
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
13
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
14
|
+
const RichTextEditor = getComponentFromMap('RichTextEditor');
|
|
15
|
+
|
|
16
|
+
const { getPConnect, value, placeholder, validatemessage, label, hideLabel, helperText, testId, displayMode, additionalProps } = props;
|
|
17
|
+
const pConn = getPConnect();
|
|
18
|
+
const editorRef: any = useRef(null);
|
|
19
|
+
|
|
20
|
+
let { readOnly, required, disabled } = props;
|
|
21
|
+
[readOnly, required, disabled] = [readOnly, required, disabled].map((prop) => prop === true || (typeof prop === 'string' && prop === 'true'));
|
|
22
|
+
|
|
23
|
+
const helperTextToDisplay = validatemessage || helperText;
|
|
24
|
+
|
|
25
|
+
if (displayMode === 'LABELS_LEFT') {
|
|
26
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
30
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let richTextComponent;
|
|
34
|
+
|
|
35
|
+
if (readOnly) {
|
|
36
|
+
// Rich Text read-only component
|
|
37
|
+
richTextComponent = (
|
|
38
|
+
<RichTextEditor
|
|
39
|
+
{...additionalProps}
|
|
40
|
+
label={label}
|
|
41
|
+
labelHidden={hideLabel}
|
|
42
|
+
defaultValue={value}
|
|
43
|
+
testId={testId}
|
|
44
|
+
info={helperTextToDisplay}
|
|
45
|
+
ref={editorRef}
|
|
46
|
+
readOnly
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
} else {
|
|
50
|
+
// Rich Text editable component
|
|
51
|
+
const actionsApi = pConn.getActionsApi();
|
|
52
|
+
let status = '';
|
|
53
|
+
if (validatemessage !== '') {
|
|
54
|
+
status = 'error';
|
|
55
|
+
}
|
|
56
|
+
const handleChange = () => {
|
|
57
|
+
if (status === 'error') {
|
|
58
|
+
const property = pConn.getStateProps().value;
|
|
59
|
+
pConn.clearErrorMessages({
|
|
60
|
+
property
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const handleBlur = () => {
|
|
66
|
+
if (editorRef.current) {
|
|
67
|
+
const editorValue = editorRef.current.getContent({ format: 'html' });
|
|
68
|
+
const property = pConn.getStateProps().value;
|
|
69
|
+
handleEvent(actionsApi, 'changeNblur', property, editorValue);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
richTextComponent = (
|
|
74
|
+
<RichTextEditor
|
|
75
|
+
{...additionalProps}
|
|
76
|
+
label={label}
|
|
77
|
+
labelHidden={hideLabel}
|
|
78
|
+
info={helperTextToDisplay}
|
|
79
|
+
defaultValue={value}
|
|
80
|
+
placeholder={placeholder}
|
|
81
|
+
disabled={disabled}
|
|
82
|
+
required={required}
|
|
83
|
+
testId={testId}
|
|
84
|
+
ref={editorRef}
|
|
85
|
+
error={status === 'error'}
|
|
86
|
+
onBlur={handleBlur}
|
|
87
|
+
onChange={handleChange}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return richTextComponent;
|
|
93
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './RichText';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* eslint-disable react/no-array-index-key */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
4
|
+
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
|
+
|
|
6
|
+
// ScalarListProps can't extend PConnFieldProps because its 'value' has a different type
|
|
7
|
+
interface ScalarListProps extends PConnProps {
|
|
8
|
+
// If any, enter additional props that only exist on this component
|
|
9
|
+
displayInModal: boolean;
|
|
10
|
+
hideLabel: boolean;
|
|
11
|
+
value: Array<any>;
|
|
12
|
+
componentType: string;
|
|
13
|
+
label: string;
|
|
14
|
+
displayMode: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function CommaSeparatedList(props) {
|
|
18
|
+
const { items } = props;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<ul style={{ padding: '0', margin: '0' }}>
|
|
22
|
+
{items.map((value, index) => {
|
|
23
|
+
return <span key={index}>{value}</span>;
|
|
24
|
+
})}
|
|
25
|
+
</ul>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default function ScalarList(props: ScalarListProps) {
|
|
30
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
31
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
32
|
+
const { label, getPConnect, componentType, value: scalarValues, displayMode, hideLabel, ...restProps } = props;
|
|
33
|
+
|
|
34
|
+
const items = scalarValues?.map((scalarValue) => {
|
|
35
|
+
return getPConnect().createComponent(
|
|
36
|
+
{
|
|
37
|
+
type: componentType,
|
|
38
|
+
config: {
|
|
39
|
+
value: scalarValue,
|
|
40
|
+
displayMode: 'LABELS_LEFT',
|
|
41
|
+
label,
|
|
42
|
+
...restProps,
|
|
43
|
+
readOnly: 'true'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
null,
|
|
47
|
+
null,
|
|
48
|
+
{}
|
|
49
|
+
); // 2nd, 3rd, and 4th args empty string/object/null until typedef marked correctly as optional;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (['LABELS_LEFT', 'STACKED_LARGE_VAL', 'DISPLAY_ONLY'].includes(displayMode)) {
|
|
53
|
+
const displayComp = (
|
|
54
|
+
<div>
|
|
55
|
+
<CommaSeparatedList items={items} />
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
return displayComp;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const displayComp = <CommaSeparatedList items={items} />;
|
|
62
|
+
|
|
63
|
+
return <FieldValueList name={hideLabel ? '' : label} value={displayComp} variant="stacked" />;
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ScalarList';
|
package/tests/assets/components/SDK-React/create/override-sdk/field/SemanticLink/SemanticLink.tsx
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import Typography from '@material-ui/core/Typography';
|
|
3
3
|
import Grid from '@material-ui/core/Grid';
|
|
4
4
|
import { makeStyles } from '@material-ui/core/styles';
|
|
5
|
-
import
|
|
5
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
6
6
|
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
/* although this is called the SemanticLink component, we are not yet displaying as a
|
|
10
9
|
SemanticLink in SDK and only showing the value as a read only text field. */
|
|
11
10
|
|
|
@@ -18,7 +17,7 @@ const useStyles = makeStyles((theme) => ({
|
|
|
18
17
|
marginRight: theme.spacing(1),
|
|
19
18
|
marginLeft: theme.spacing(1),
|
|
20
19
|
marginTop: theme.spacing(1),
|
|
21
|
-
marginBottom: theme.spacing(1)
|
|
20
|
+
marginBottom: theme.spacing(1)
|
|
22
21
|
},
|
|
23
22
|
fieldMargin: {
|
|
24
23
|
paddingRight: theme.spacing(1),
|
|
@@ -28,7 +27,7 @@ const useStyles = makeStyles((theme) => ({
|
|
|
28
27
|
marginRight: theme.spacing(1),
|
|
29
28
|
marginLeft: theme.spacing(1),
|
|
30
29
|
marginTop: theme.spacing(1),
|
|
31
|
-
marginBottom: theme.spacing(1)
|
|
30
|
+
marginBottom: theme.spacing(1)
|
|
32
31
|
},
|
|
33
32
|
fieldLabel: {
|
|
34
33
|
fontWeight: 400,
|
|
@@ -43,34 +42,35 @@ const useStyles = makeStyles((theme) => ({
|
|
|
43
42
|
interface SemanticLinkProps extends PConnFieldProps {
|
|
44
43
|
// If any, enter additional props that only exist on SemanticLink here
|
|
45
44
|
// from previous PropTypes
|
|
46
|
-
text: string
|
|
45
|
+
text: string;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
export default function SemanticLink(props: SemanticLinkProps) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
displayMode,
|
|
53
|
-
label,
|
|
54
|
-
hideLabel
|
|
55
|
-
} = props;
|
|
56
|
-
const classes = useStyles();
|
|
49
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
50
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
57
51
|
|
|
52
|
+
const { text, displayMode, label, hideLabel } = props;
|
|
53
|
+
const classes = useStyles();
|
|
58
54
|
|
|
59
|
-
if (displayMode ===
|
|
60
|
-
const value = text ||
|
|
55
|
+
if (displayMode === 'LABELS_LEFT' || (!displayMode && label !== undefined)) {
|
|
56
|
+
const value = text || '---';
|
|
61
57
|
return (
|
|
62
|
-
<Grid container spacing={1} style={{padding:
|
|
58
|
+
<Grid container spacing={1} style={{ padding: '4px 0px' }} id="semantic-link-grid">
|
|
63
59
|
<Grid item xs={6}>
|
|
64
|
-
<Typography variant="body2" component="span" className={`${classes.fieldLabel} ${classes.fieldMargin}`}>
|
|
60
|
+
<Typography variant="body2" component="span" className={`${classes.fieldLabel} ${classes.fieldMargin}`}>
|
|
61
|
+
{label}
|
|
62
|
+
</Typography>
|
|
65
63
|
</Grid>
|
|
66
64
|
<Grid item xs={6}>
|
|
67
|
-
<Typography variant="body2" component="span" className={classes.fieldValue}>
|
|
65
|
+
<Typography variant="body2" component="span" className={classes.fieldValue}>
|
|
66
|
+
{value}
|
|
67
|
+
</Typography>
|
|
68
68
|
</Grid>
|
|
69
69
|
</Grid>
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
74
|
-
return <FieldValueList name={hideLabel ? '' : label} value={text} variant=
|
|
74
|
+
return <FieldValueList name={hideLabel ? '' : label} value={text} variant="stacked" />;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TextField } from '@material-ui/core';
|
|
3
|
-
import
|
|
3
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
4
4
|
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
5
5
|
|
|
6
6
|
interface TextAreaProps extends PConnFieldProps {
|
|
7
7
|
// If any, enter additional props that only exist on TextArea here
|
|
8
|
-
fieldMetadata?: any
|
|
8
|
+
fieldMetadata?: any;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
export default function TextArea(props: TextAreaProps) {
|
|
12
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
13
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
14
|
+
|
|
13
15
|
const {
|
|
14
16
|
label,
|
|
15
17
|
required,
|
|
@@ -37,7 +39,7 @@ export default function TextArea(props: TextAreaProps) {
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
40
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant=
|
|
42
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
if (readOnly) {
|
|
@@ -60,8 +62,8 @@ export default function TextArea(props: TextAreaProps) {
|
|
|
60
62
|
fullWidth
|
|
61
63
|
variant={readOnly ? 'standard' : 'outlined'}
|
|
62
64
|
helperText={helperTextToDisplay}
|
|
63
|
-
placeholder=
|
|
64
|
-
size=
|
|
65
|
+
placeholder=""
|
|
66
|
+
size="small"
|
|
65
67
|
required={required}
|
|
66
68
|
disabled={disabled}
|
|
67
69
|
onChange={onChange}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import React, { 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
|
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
4
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
5
|
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
6
6
|
|
|
7
7
|
interface TextInputProps extends PConnFieldProps {
|
|
8
8
|
// If any, enter additional props that only exist on TextInput here
|
|
9
|
-
fieldMetadata?: any
|
|
9
|
+
fieldMetadata?: any;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
12
|
export default function TextInput(props: TextInputProps) {
|
|
13
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
14
|
+
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
15
|
+
|
|
15
16
|
const {
|
|
16
17
|
getPConnect,
|
|
17
18
|
label,
|
|
@@ -49,7 +50,7 @@ export default function TextInput(props: TextInputProps) {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
52
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant=
|
|
53
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
if (readOnly) {
|
|
@@ -76,8 +77,8 @@ export default function TextInput(props: TextInputProps) {
|
|
|
76
77
|
fullWidth
|
|
77
78
|
variant={readOnly ? 'standard' : 'outlined'}
|
|
78
79
|
helperText={helperTextToDisplay}
|
|
79
|
-
placeholder=
|
|
80
|
-
size=
|
|
80
|
+
placeholder=""
|
|
81
|
+
size="small"
|
|
81
82
|
required={required}
|
|
82
83
|
disabled={disabled}
|
|
83
84
|
onChange={handleChange}
|
|
@@ -1,32 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { KeyboardTimePicker } from '@material-ui/pickers';
|
|
3
|
-
import TextInput from '@pega/react-sdk-components/lib/components/field/TextInput';
|
|
4
|
-
import dayjs from 'dayjs';
|
|
5
3
|
import AccessTimeIcon from '@material-ui/icons/AccessTime';
|
|
6
|
-
import
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
6
|
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
8
7
|
|
|
9
|
-
|
|
10
8
|
interface TimeProps extends PConnFieldProps {
|
|
11
9
|
// If any, enter additional props that only exist on Time here
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
|
|
15
12
|
export default function Time(props: TimeProps) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
validatemessage,
|
|
22
|
-
status,
|
|
23
|
-
onChange,
|
|
24
|
-
readOnly,
|
|
25
|
-
helperText,
|
|
26
|
-
displayMode,
|
|
27
|
-
hideLabel,
|
|
28
|
-
testId
|
|
29
|
-
} = props;
|
|
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;
|
|
30
18
|
const helperTextToDisplay = validatemessage || helperText;
|
|
31
19
|
|
|
32
20
|
if (displayMode === 'LABELS_LEFT') {
|
|
@@ -34,7 +22,7 @@ export default function Time(props: TimeProps) {
|
|
|
34
22
|
}
|
|
35
23
|
|
|
36
24
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
37
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant=
|
|
25
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
|
|
38
26
|
}
|
|
39
27
|
|
|
40
28
|
if (readOnly) {
|
|
@@ -47,14 +35,14 @@ export default function Time(props: TimeProps) {
|
|
|
47
35
|
'data-test-id': testId
|
|
48
36
|
};
|
|
49
37
|
|
|
50
|
-
const handleChange = date => {
|
|
38
|
+
const handleChange = (date) => {
|
|
51
39
|
const theValue = date && date.isValid() ? date.format('HH:mm') : null;
|
|
52
40
|
onChange({ value: theValue });
|
|
53
41
|
};
|
|
54
42
|
|
|
55
43
|
let timeValue: any = null;
|
|
56
44
|
if (value) {
|
|
57
|
-
const timeArray = value.split(':').map(itm => Number(itm));
|
|
45
|
+
const timeArray = value.split(':').map((itm) => Number(itm));
|
|
58
46
|
timeValue = dayjs().hour(timeArray[0]).minute(timeArray[1]);
|
|
59
47
|
}
|
|
60
48
|
|
|
@@ -65,9 +53,9 @@ export default function Time(props: TimeProps) {
|
|
|
65
53
|
|
|
66
54
|
return (
|
|
67
55
|
<KeyboardTimePicker
|
|
68
|
-
variant=
|
|
69
|
-
inputVariant=
|
|
70
|
-
placeholder=
|
|
56
|
+
variant="inline"
|
|
57
|
+
inputVariant="outlined"
|
|
58
|
+
placeholder="hh:mm am"
|
|
71
59
|
keyboardIcon={<AccessTimeIcon />}
|
|
72
60
|
fullWidth
|
|
73
61
|
required={required}
|
|
@@ -75,11 +63,11 @@ export default function Time(props: TimeProps) {
|
|
|
75
63
|
error={status === 'error'}
|
|
76
64
|
helperText={helperTextToDisplay}
|
|
77
65
|
minutesStep={5}
|
|
78
|
-
size=
|
|
66
|
+
size="small"
|
|
79
67
|
label={label}
|
|
80
68
|
autoOk
|
|
81
|
-
mask=
|
|
82
|
-
format=
|
|
69
|
+
mask="__:__ _m"
|
|
70
|
+
format="hh:mm a"
|
|
83
71
|
value={timeValue}
|
|
84
72
|
onChange={handleChange}
|
|
85
73
|
InputProps={{ inputProps: { ...testProp } }}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TextField } from '@material-ui/core';
|
|
3
|
-
import
|
|
4
|
-
import FieldValueList from '@pega/react-sdk-components/lib/components/designSystemExtension/FieldValueList';
|
|
3
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
4
|
import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
6
5
|
|
|
7
6
|
interface URLComponentProps extends PConnFieldProps {
|
|
8
7
|
// If any, enter additional props that only exist on URLComponent here
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
|
|
12
10
|
// NOTE: that we had to change the name from URL to URLComponent
|
|
13
11
|
// Otherwise, we were getting all kinds of weird errors when we
|
|
14
12
|
// referred to URL as a component.
|
|
15
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
|
+
|
|
16
18
|
const {
|
|
17
19
|
label,
|
|
18
20
|
required,
|
|
@@ -35,7 +37,7 @@ export default function URLComponent(props: URLComponentProps) {
|
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
38
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant=
|
|
40
|
+
return <FieldValueList name={hideLabel ? '' : label} value={value} variant="stacked" />;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
if (readOnly) {
|
|
@@ -50,12 +52,12 @@ export default function URLComponent(props: URLComponentProps) {
|
|
|
50
52
|
|
|
51
53
|
return (
|
|
52
54
|
<TextField
|
|
53
|
-
type=
|
|
55
|
+
type="url"
|
|
54
56
|
fullWidth
|
|
55
|
-
variant=
|
|
57
|
+
variant="outlined"
|
|
56
58
|
helperText={helperTextToDisplay}
|
|
57
|
-
placeholder=
|
|
58
|
-
size=
|
|
59
|
+
placeholder=""
|
|
60
|
+
size="small"
|
|
59
61
|
required={required}
|
|
60
62
|
disabled={disabled}
|
|
61
63
|
onChange={onChange}
|
package/tests/assets/components/SDK-React/create/override-sdk/field/UserReference/UserReference.tsx
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { Fragment, memo, useEffect, useState } from 'react';
|
|
2
2
|
import { Typography } from '@material-ui/core';
|
|
3
|
-
import AutoComplete from '@pega/react-sdk-components/lib/components/field/AutoComplete';
|
|
4
|
-
import Dropdown from '@pega/react-sdk-components/lib/components/field/Dropdown';
|
|
5
3
|
import { getUserId, isUserNameAvailable } from './UserReferenceUtils';
|
|
4
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
6
5
|
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
7
6
|
|
|
8
7
|
// Remove this and use "real" PCore type once .d.ts is fixed (currently shows 1 errors)
|
|
@@ -11,35 +10,37 @@ declare const PCore: any;
|
|
|
11
10
|
const DROPDOWN_LIST = 'Drop-down list';
|
|
12
11
|
const SEARCH_BOX = 'Search box';
|
|
13
12
|
|
|
14
|
-
|
|
15
13
|
interface UserReferenceProps extends PConnProps {
|
|
16
14
|
// If any, enter additional props that only exist on URLComponent here
|
|
17
|
-
displayAs?: string
|
|
18
|
-
label?: string
|
|
19
|
-
value?: any
|
|
20
|
-
testId?: string
|
|
21
|
-
placeholder?: string
|
|
22
|
-
helperText?: string
|
|
23
|
-
disabled?: boolean
|
|
24
|
-
readOnly?: boolean
|
|
25
|
-
required?: boolean
|
|
26
|
-
validatemessage?: string
|
|
27
|
-
showAsFormattedText?: boolean
|
|
28
|
-
additionalProps?: object
|
|
29
|
-
hideLabel?: boolean
|
|
30
|
-
variant?: string
|
|
31
|
-
onChange?: any
|
|
15
|
+
displayAs?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
value?: any;
|
|
18
|
+
testId?: string;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
helperText?: string;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
readOnly?: boolean;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
validatemessage?: string;
|
|
25
|
+
showAsFormattedText?: boolean;
|
|
26
|
+
additionalProps?: object;
|
|
27
|
+
hideLabel?: boolean;
|
|
28
|
+
variant?: string;
|
|
29
|
+
onChange?: any;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
|
|
35
32
|
const UserReference = (props: UserReferenceProps) => {
|
|
33
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
34
|
+
const AutoComplete = getComponentFromMap('AutoComplete');
|
|
35
|
+
const Dropdown = getComponentFromMap('Dropdown');
|
|
36
|
+
|
|
36
37
|
const {
|
|
37
38
|
label = '',
|
|
38
39
|
displayAs = '',
|
|
39
40
|
getPConnect,
|
|
40
41
|
value = '',
|
|
41
42
|
testId = '',
|
|
42
|
-
helperText= '',
|
|
43
|
+
helperText = '',
|
|
43
44
|
validatemessage = '',
|
|
44
45
|
placeholder = '',
|
|
45
46
|
showAsFormattedText = false,
|
|
@@ -65,7 +66,7 @@ const UserReference = (props: UserReferenceProps) => {
|
|
|
65
66
|
// if same user ref field is referred in view as editable & readonly formatted text
|
|
66
67
|
// referenced users won't be available, so get user details from dx api
|
|
67
68
|
const { getOperatorDetails } = PCore.getUserApi();
|
|
68
|
-
getOperatorDetails(userId).then(res => {
|
|
69
|
+
getOperatorDetails(userId).then((res) => {
|
|
69
70
|
if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {
|
|
70
71
|
setUserName(res.data.pyOperatorInfo.pyUserName);
|
|
71
72
|
}
|
|
@@ -77,14 +78,14 @@ const UserReference = (props: UserReferenceProps) => {
|
|
|
77
78
|
};
|
|
78
79
|
PCore.getRestClient()
|
|
79
80
|
.invokeRestApi('getListData', { queryPayload })
|
|
80
|
-
.then(res => {
|
|
81
|
-
const ddDataSource = res.data.data.map(listItem => ({
|
|
81
|
+
.then((res) => {
|
|
82
|
+
const ddDataSource = res.data.data.map((listItem) => ({
|
|
82
83
|
key: listItem.pyUserIdentifier,
|
|
83
84
|
value: listItem.pyUserName
|
|
84
85
|
}));
|
|
85
86
|
setDropDownDataSource(ddDataSource);
|
|
86
87
|
})
|
|
87
|
-
.catch(err => {
|
|
88
|
+
.catch((err) => {
|
|
88
89
|
// eslint-disable-next-line no-console
|
|
89
90
|
console.error(err);
|
|
90
91
|
});
|
|
@@ -101,8 +102,8 @@ const UserReference = (props: UserReferenceProps) => {
|
|
|
101
102
|
TODO: This has to be replaced with Operator Component
|
|
102
103
|
*/}
|
|
103
104
|
<div>
|
|
104
|
-
<Typography variant=
|
|
105
|
-
<Typography variant=
|
|
105
|
+
<Typography variant="caption">{label}</Typography>
|
|
106
|
+
<Typography variant="body1">{userName}</Typography>
|
|
106
107
|
</div>
|
|
107
108
|
</Fragment>
|
|
108
109
|
);
|
|
@@ -132,7 +133,7 @@ const UserReference = (props: UserReferenceProps) => {
|
|
|
132
133
|
label={label}
|
|
133
134
|
getPConnect={getPConnect}
|
|
134
135
|
datasource={OPERATORS_DP}
|
|
135
|
-
listType=
|
|
136
|
+
listType="datapage"
|
|
136
137
|
columns={columns}
|
|
137
138
|
testId={testId}
|
|
138
139
|
placeholder={placeholder}
|
|
@@ -152,7 +153,7 @@ const UserReference = (props: UserReferenceProps) => {
|
|
|
152
153
|
<Dropdown
|
|
153
154
|
additionalProps={additionalProps}
|
|
154
155
|
datasource={dropDownDataSource}
|
|
155
|
-
listType=
|
|
156
|
+
listType="associated"
|
|
156
157
|
getPConnect={getPConnect}
|
|
157
158
|
label={label}
|
|
158
159
|
value={userId}
|
|
@@ -173,7 +174,6 @@ const UserReference = (props: UserReferenceProps) => {
|
|
|
173
174
|
return userReferenceComponent;
|
|
174
175
|
};
|
|
175
176
|
|
|
176
|
-
|
|
177
177
|
// as objects are there in props, shallow comparision fails & re-rendering of comp happens even with
|
|
178
178
|
// same key value pairs in obj. hence using custom comparison function on when to re-render
|
|
179
179
|
const comparisonFn = (prevProps, nextProps) => {
|
package/tests/assets/components/SDK-React/create/override-sdk/infra/Assignment/Assignment.tsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import AssignmentCard from '@pega/react-sdk-components/lib/components/infra/AssignmentCard';
|
|
3
|
-
import MultiStep from '@pega/react-sdk-components/lib/components/infra/MultiStep';
|
|
4
2
|
import Snackbar from '@material-ui/core/Snackbar';
|
|
5
3
|
import IconButton from '@material-ui/core/IconButton';
|
|
6
4
|
import CloseIcon from '@material-ui/icons/Close';
|
|
5
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
7
6
|
|
|
8
7
|
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
9
8
|
|
|
@@ -19,6 +18,10 @@ interface AssignmentProps extends PConnProps {
|
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
export default function Assignment(props: AssignmentProps) {
|
|
21
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
22
|
+
const AssignmentCard = getComponentFromMap("AssignmentCard");
|
|
23
|
+
const MultiStep = getComponentFromMap("MultiStep");
|
|
24
|
+
|
|
22
25
|
const { getPConnect, children, itemKey = '', isInModal = false, banners = [] } = props;
|
|
23
26
|
const thePConn = getPConnect();
|
|
24
27
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
|
2
2
|
import type { PConnProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
3
|
-
|
|
4
|
-
import ActionButtons from "@pega/react-sdk-components/lib/components/infra/ActionButtons";
|
|
3
|
+
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
5
4
|
|
|
6
5
|
interface AssignmentCardProps extends PConnProps {
|
|
7
6
|
// If any, enter additional props that only exist on this component
|
|
@@ -14,6 +13,9 @@ interface AssignmentCardProps extends PConnProps {
|
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
export default function AssignmentCard(props: AssignmentCardProps) {
|
|
16
|
+
// Get emitted components from map (so we can get any override that may exist)
|
|
17
|
+
const ActionButtons = getComponentFromMap("ActionButtons");
|
|
18
|
+
|
|
17
19
|
const { children, actionButtons, onButtonPress} = props;
|
|
18
20
|
|
|
19
21
|
const [arMainButtons, setArMainButtons] = useState([]);
|