@pega/custom-dx-components 0.24.3 → 0.24.4
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/Picklist-Autocomplete/index.tsx.mustache +11 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/utils.ts.mustache +3 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/DetailsRender.tsx +52 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/HighlightRender.tsx +50 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.tsx.mustache +42 -21
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/DetailsRender.tsx +52 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/HighlightRender.tsx +50 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.tsx.mustache +41 -20
- package/src/tasks/create/templates/Constellation/Template/PAGE/GetNextWork.tsx.mustache +2 -1
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/tests/assets/components/create/Pega_DXIL_MyDetails.zip +0 -0
- package/tests/assets/components/create/Pega_DXIL_MyTestText/demo.stories.tsx +0 -3
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyBoolean/demo.stories.tsx +3 -13
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyBoolean/index.tsx +8 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/demo.stories.tsx +3 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCurrency/demo.stories.tsx +2 -9
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCurrency/mock.ts +2 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDate/demo.stories.tsx +8 -19
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/demo.stories.tsx +7 -18
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDecimal/demo.stories.tsx +1 -7
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDecimal/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/DetailsRender.tsx +52 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/HighlightRender.tsx +50 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/demo.stories.tsx +5 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/index.tsx +42 -21
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails.zip +0 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyEmail/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/demo.stories.tsx +5 -3
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyInteger/demo.stories.tsx +2 -6
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/GetNextWork.tsx +2 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/demo.stories.tsx +4 -3
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/demo.stories.tsx +5 -4
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +5 -8
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyParagraph/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyParagraph/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPercentage/demo.stories.tsx +2 -6
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPercentage/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPhone/demo.stories.tsx +2 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPhone/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPicklist/demo.stories.tsx +2 -6
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPicklist/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyRadioButtons/demo.stories.tsx +1 -7
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/demo.stories.tsx +2 -8
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/index.tsx +11 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MySearchbox/utils.ts +3 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyText/demo.stories.tsx +0 -3
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/mock.ts +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/demo.stories.tsx +5 -15
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +52 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +50 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +5 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/index.tsx +41 -20
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/demo.stories.tsx +4 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyURL/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyURL/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyBoolean/demo.stories.tsx +3 -13
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyBoolean/index.tsx +8 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCurrency/demo.stories.tsx +2 -9
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCurrency/mock.ts +2 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDate/demo.stories.tsx +8 -19
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/demo.stories.tsx +7 -18
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDecimal/demo.stories.tsx +1 -7
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDecimal/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/DetailsRender.tsx +52 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/HighlightRender.tsx +50 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/demo.stories.tsx +5 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/index.tsx +42 -21
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails.zip +0 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyEmail/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/demo.stories.tsx +5 -3
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyInteger/demo.stories.tsx +2 -6
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/GetNextWork.tsx +2 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/demo.stories.tsx +4 -3
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +5 -8
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyParagraph/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyParagraph/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPercentage/demo.stories.tsx +2 -6
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPercentage/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPhone/demo.stories.tsx +2 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPhone/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPicklist/demo.stories.tsx +2 -6
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPicklist/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyRadioButtons/demo.stories.tsx +1 -7
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/demo.stories.tsx +2 -8
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/index.tsx +11 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MySearchbox/utils.ts +3 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyText/demo.stories.tsx +0 -3
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/mock.ts +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/demo.stories.tsx +5 -15
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +52 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx +50 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx +5 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/index.tsx +41 -20
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/demo.stories.tsx +4 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyURL/demo.stories.tsx +1 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyURL/mock.ts +1 -0
|
@@ -24,19 +24,11 @@ export const BasePegaDxilMySearchbox: Story = args => {
|
|
|
24
24
|
|
|
25
25
|
const props = {
|
|
26
26
|
value,
|
|
27
|
-
placeholder: configProps.placeholder,
|
|
28
|
-
label: configProps.label,
|
|
29
|
-
helperText: configProps.helperText,
|
|
30
|
-
datasource: configProps.datasource,
|
|
31
|
-
testId: configProps.testId,
|
|
32
27
|
hasSuggestions: configProps.hasSuggestions,
|
|
33
28
|
columns: [],
|
|
34
|
-
isTableFormatter: false,
|
|
35
29
|
listType: 'associated',
|
|
36
|
-
parameters: {},
|
|
37
30
|
datasourceMetadata,
|
|
38
31
|
fieldMetadata,
|
|
39
|
-
validatemessage: '',
|
|
40
32
|
getPConnect: () => {
|
|
41
33
|
return {
|
|
42
34
|
getConfigProps: () => {
|
|
@@ -93,9 +85,11 @@ export const BasePegaDxilMySearchbox: Story = args => {
|
|
|
93
85
|
};
|
|
94
86
|
|
|
95
87
|
BasePegaDxilMySearchbox.args = {
|
|
88
|
+
datasource: configProps.datasource,
|
|
96
89
|
label: configProps.label,
|
|
97
90
|
helperText: configProps.helperText,
|
|
98
91
|
placeholder: configProps.placeholder,
|
|
92
|
+
parameters: {},
|
|
99
93
|
isTableFormatter: false,
|
|
100
94
|
testId: configProps.testId,
|
|
101
95
|
readOnly: configProps.readOnly,
|
|
@@ -645,12 +645,14 @@ function PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
|
|
|
645
645
|
PCore.getDataApi()
|
|
646
646
|
.init(dataConfig, contextName)
|
|
647
647
|
.then(dataObj => {
|
|
648
|
+
// @ts-ignore
|
|
648
649
|
setDataApiObj(dataObj);
|
|
649
650
|
// To avoid calling doSearch if someone types/pastes value before the API call is made
|
|
650
651
|
if (!filterValue)
|
|
651
652
|
doSearch(
|
|
652
653
|
'',
|
|
653
654
|
getDisplayFieldsMetaData(dataConfig.columns),
|
|
655
|
+
// @ts-ignore
|
|
654
656
|
dataObj,
|
|
655
657
|
setItems as any,
|
|
656
658
|
setLoading,
|
|
@@ -677,6 +679,7 @@ function PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
|
|
|
677
679
|
PCore.getDataApi()
|
|
678
680
|
.init(dataConfig, contextName)
|
|
679
681
|
.then(dataObj => {
|
|
682
|
+
// @ts-ignore
|
|
680
683
|
setDataApiObj(dataObj);
|
|
681
684
|
// To avoid calling doSearch if someone types/pastes value before the API call is made
|
|
682
685
|
if (!filterValue) {
|
|
@@ -692,6 +695,7 @@ function PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
|
|
|
692
695
|
doSearch(
|
|
693
696
|
'',
|
|
694
697
|
getDisplayFieldsMetaData(dataConfig.columns),
|
|
698
|
+
// @ts-ignore
|
|
695
699
|
dataObj,
|
|
696
700
|
setItems as any,
|
|
697
701
|
setLoading,
|
|
@@ -711,6 +715,7 @@ function PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
|
|
|
711
715
|
doSearch(
|
|
712
716
|
'',
|
|
713
717
|
getDisplayFieldsMetaData(dataConfig.columns),
|
|
718
|
+
// @ts-ignore
|
|
714
719
|
dataObj,
|
|
715
720
|
setItems as any,
|
|
716
721
|
setLoading,
|
|
@@ -770,10 +775,14 @@ function PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
|
|
|
770
775
|
PCore.getDataApi()
|
|
771
776
|
.init(dataConfig, contextName)
|
|
772
777
|
.then(dataObj => {
|
|
778
|
+
// @ts-ignore
|
|
773
779
|
setDataApiObj(dataObj);
|
|
780
|
+
// @ts-ignore
|
|
774
781
|
buildColumnForDisplayValue(dataObj);
|
|
775
782
|
// SET matchPosition to EQUALS to return exact matching record
|
|
783
|
+
// @ts-ignore
|
|
776
784
|
dataObj.matchPosition = 'equals';
|
|
785
|
+
// @ts-ignore
|
|
777
786
|
dataObj
|
|
778
787
|
.fetchData(value)
|
|
779
788
|
.then((displayResponse: { data: Array<never> }) => {
|
|
@@ -822,11 +831,13 @@ function PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
|
|
|
822
831
|
setSelected(searchedItem[0]);
|
|
823
832
|
setActualValue(value);
|
|
824
833
|
// RESET matchPosition
|
|
834
|
+
// @ts-ignore
|
|
825
835
|
dataObj.matchPosition = dataConfig.matchPosition;
|
|
826
836
|
})
|
|
827
837
|
.catch(() => {
|
|
828
838
|
setActualValue(value);
|
|
829
839
|
// RESET matchPosition
|
|
840
|
+
// @ts-ignore
|
|
830
841
|
dataObj.matchPosition = dataConfig.matchPosition;
|
|
831
842
|
});
|
|
832
843
|
});
|
|
@@ -181,7 +181,9 @@ export const updatePropertiesForNewRecord = (
|
|
|
181
181
|
setDataApiObj(dataObj);
|
|
182
182
|
buildColumnForDisplayValue(dataObj);
|
|
183
183
|
// SET matchPosition to EQUALS to return exact matching record
|
|
184
|
+
// @ts-ignore
|
|
184
185
|
dataObj.matchPosition = 'equals';
|
|
186
|
+
// @ts-ignore
|
|
185
187
|
dataObj
|
|
186
188
|
.fetchData(newCaseId)
|
|
187
189
|
// @ts-ignore
|
|
@@ -212,6 +214,7 @@ export const updatePropertiesForNewRecord = (
|
|
|
212
214
|
})
|
|
213
215
|
.finally(() => {
|
|
214
216
|
// RESET matchPosition
|
|
217
|
+
// @ts-ignore
|
|
215
218
|
dataObj.matchPosition = dataConfig.matchPosition;
|
|
216
219
|
});
|
|
217
220
|
});
|
|
@@ -20,13 +20,8 @@ export const BasePegaDxilMyTextInput: Story = args => {
|
|
|
20
20
|
|
|
21
21
|
const props = {
|
|
22
22
|
value: configProps.value,
|
|
23
|
-
placeholder: configProps.placeholder,
|
|
24
|
-
label: configProps.label,
|
|
25
|
-
helperText: configProps.helperText,
|
|
26
|
-
testId: configProps.testId,
|
|
27
23
|
hasSuggestions: configProps.hasSuggestions,
|
|
28
24
|
fieldMetadata,
|
|
29
|
-
validatemessage: '',
|
|
30
25
|
getPConnect: () => {
|
|
31
26
|
return {
|
|
32
27
|
getStateProps: () => {
|
|
@@ -64,5 +59,6 @@ BasePegaDxilMyTextInput.args = {
|
|
|
64
59
|
status: configProps.status,
|
|
65
60
|
hideLabel: configProps.hideLabel,
|
|
66
61
|
displayMode: configProps.displayMode,
|
|
62
|
+
variant: configProps.variant,
|
|
67
63
|
validatemessage: configProps.validatemessage
|
|
68
64
|
};
|
|
@@ -15,6 +15,9 @@ type Story = StoryObj<typeof PegaDxilMyTimeOfDay>;
|
|
|
15
15
|
|
|
16
16
|
export const BasePegaDxilMyTimeOfDay: Story = args => {
|
|
17
17
|
const props = {
|
|
18
|
+
value: configProps.value,
|
|
19
|
+
additionalProps: configProps.additionalProps,
|
|
20
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
18
21
|
getPConnect: () => {
|
|
19
22
|
return {
|
|
20
23
|
getActionsApi: () => {
|
|
@@ -37,21 +40,7 @@ export const BasePegaDxilMyTimeOfDay: Story = args => {
|
|
|
37
40
|
ignoreSuggestion: () => {/* nothing */},
|
|
38
41
|
clearErrorMessages: () => {/* nothing */}
|
|
39
42
|
};
|
|
40
|
-
}
|
|
41
|
-
value: configProps.value,
|
|
42
|
-
validatemessage: configProps.validatemessage,
|
|
43
|
-
label: configProps.label,
|
|
44
|
-
hideLabel: configProps.hideLabel,
|
|
45
|
-
helperText: configProps.helperText,
|
|
46
|
-
withSeconds: configProps.withSeconds,
|
|
47
|
-
testId: configProps.testId,
|
|
48
|
-
additionalProps: configProps.additionalProps,
|
|
49
|
-
displayMode: configProps.displayMode,
|
|
50
|
-
variant: configProps.variant,
|
|
51
|
-
hasSuggestions: configProps.hasSuggestions,
|
|
52
|
-
disabled: configProps.disabled,
|
|
53
|
-
readOnly: configProps.readOnly,
|
|
54
|
-
required: configProps.required
|
|
43
|
+
}
|
|
55
44
|
};
|
|
56
45
|
|
|
57
46
|
return (
|
|
@@ -72,5 +61,6 @@ BasePegaDxilMyTimeOfDay.args = {
|
|
|
72
61
|
status: configProps.status,
|
|
73
62
|
hideLabel: configProps.hideLabel,
|
|
74
63
|
displayMode: configProps.displayMode,
|
|
64
|
+
variant: configProps.variant,
|
|
75
65
|
validatemessage: configProps.validatemessage
|
|
76
66
|
};
|
package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import React, { Fragment } from 'react';
|
|
3
|
+
import { FieldValueList } from '@pega/cosmos-react-core';
|
|
4
|
+
|
|
5
|
+
const DetailsRender = (child: any) => {
|
|
6
|
+
const kids = child.props.getPConnect().getChildren();
|
|
7
|
+
|
|
8
|
+
const displayCompArr: JSX.Element[] = [];
|
|
9
|
+
|
|
10
|
+
Object.values(kids).forEach((value: any) => {
|
|
11
|
+
const { type } = value.getPConnect().getRawMetadata();
|
|
12
|
+
const { hideLabel, variant, testId, label } = value
|
|
13
|
+
.getPConnect()
|
|
14
|
+
.resolveConfigProps(value.getPConnect().getConfigProps());
|
|
15
|
+
|
|
16
|
+
let displayComp;
|
|
17
|
+
const key = JSON.stringify(value.getPConnect());
|
|
18
|
+
|
|
19
|
+
if (type === 'reference') {
|
|
20
|
+
const refElement = value.getPConnect().getComponent();
|
|
21
|
+
|
|
22
|
+
displayCompArr.push(refElement);
|
|
23
|
+
} else {
|
|
24
|
+
const element = value.getPConnect().getComponent();
|
|
25
|
+
const displayEl = <Fragment key={key}>{element}</Fragment>;
|
|
26
|
+
|
|
27
|
+
const fvlStyle = {
|
|
28
|
+
myColGap: {
|
|
29
|
+
columnGap: '0'
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// const myEl = <div>boo</div>;
|
|
34
|
+
displayComp = (
|
|
35
|
+
<Fragment key={key}>
|
|
36
|
+
<FieldValueList
|
|
37
|
+
style={fvlStyle.myColGap}
|
|
38
|
+
variant={hideLabel ? 'stacked' : variant}
|
|
39
|
+
data-testid={testId}
|
|
40
|
+
fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
|
|
41
|
+
/>
|
|
42
|
+
</Fragment>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
displayCompArr.push(displayComp);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return <>{displayCompArr}</>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default DetailsRender;
|
package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/HighlightRender.tsx
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FieldValueList, Text } from '@pega/cosmos-react-core';
|
|
4
|
+
|
|
5
|
+
const HighlightRender = (data: any) => {
|
|
6
|
+
const { getPConnect } = data.props;
|
|
7
|
+
const { field } = data;
|
|
8
|
+
|
|
9
|
+
field.config['displayMode'] = 'DISPLAY_ONLY';
|
|
10
|
+
|
|
11
|
+
// Mark as status display when using pyStatusWork
|
|
12
|
+
if (field.config?.value === '@P .pyStatusWork') {
|
|
13
|
+
field.type = 'TextInput';
|
|
14
|
+
field.config.displayAsStatus = true;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const configProps = getPConnect().resolveConfigProps(field.config);
|
|
18
|
+
|
|
19
|
+
// field.config = configProps;
|
|
20
|
+
|
|
21
|
+
const reactField = getPConnect().createComponent(field);
|
|
22
|
+
// const reactField = field.getPConnect().getComponent();
|
|
23
|
+
|
|
24
|
+
const styles = {
|
|
25
|
+
myWidth: {
|
|
26
|
+
width: 'auto'
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<FieldValueList
|
|
32
|
+
style={styles.myWidth}
|
|
33
|
+
variant='stacked'
|
|
34
|
+
data-testid={field.testId}
|
|
35
|
+
fields={[
|
|
36
|
+
{
|
|
37
|
+
id: '2',
|
|
38
|
+
name: configProps.hideLabel ? '' : configProps.label,
|
|
39
|
+
value: (
|
|
40
|
+
<Text variant='h1' as='span'>
|
|
41
|
+
{reactField}
|
|
42
|
+
</Text>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
]}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default HighlightRender;
|
package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/demo.stories.tsx
CHANGED
|
@@ -86,10 +86,6 @@ const renderField = resolvedProps => {
|
|
|
86
86
|
|
|
87
87
|
export const BasePegaDxilMyTwoColumnDetails: Story = args => {
|
|
88
88
|
const props = {
|
|
89
|
-
template: 'MyCo_MyComponents_NewDetailsTemplate',
|
|
90
|
-
showHighlightedData: true,
|
|
91
|
-
label: 'Test Details',
|
|
92
|
-
showLabel: true,
|
|
93
89
|
getPConnect: () => {
|
|
94
90
|
return {
|
|
95
91
|
getChildren: () => {
|
|
@@ -148,4 +144,8 @@ export const BasePegaDxilMyTwoColumnDetails: Story = args => {
|
|
|
148
144
|
);
|
|
149
145
|
};
|
|
150
146
|
|
|
151
|
-
BasePegaDxilMyTwoColumnDetails.args = {
|
|
147
|
+
BasePegaDxilMyTwoColumnDetails.args = {
|
|
148
|
+
showLabel: true,
|
|
149
|
+
label: 'Details Region template',
|
|
150
|
+
showHighlightedData: true
|
|
151
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Fragment } from 'react';
|
|
2
2
|
import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
|
|
3
3
|
import type { PConnFieldProps } from './PConnProps';
|
|
4
|
+
import DetailsRender from './DetailsRender';
|
|
5
|
+
import HighlightRender from './HighlightRender';
|
|
4
6
|
|
|
5
7
|
import StyledPegaDxilMyTwoColumnDetailsWrapper from './styles';
|
|
6
8
|
|
|
@@ -15,8 +17,6 @@ interface PegaDxilMyTwoColumnDetailsProps extends PConnFieldProps {
|
|
|
15
17
|
children: any;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
// Duplicated runtime code from Constellation Design System Component
|
|
19
|
-
|
|
20
20
|
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
21
21
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
22
22
|
function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
|
|
@@ -24,9 +24,17 @@ function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
|
|
|
24
24
|
const { getPConnect, children, label, showLabel = true, showHighlightedData = false } = props;
|
|
25
25
|
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
26
26
|
|
|
27
|
+
// update children with readonly
|
|
28
|
+
// eslint-disable-next-line guard-for-in
|
|
29
|
+
for (const index in children) {
|
|
30
|
+
const kid = children[index];
|
|
31
|
+
kid.props.getPConnect().setInheritedProp('readOnly', true);
|
|
32
|
+
kid.props.getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
const numRegions = getAllFields(getPConnect)?.length;
|
|
28
36
|
const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
|
|
29
|
-
const gridContainer = { "colGap":
|
|
37
|
+
const gridContainer = { "colGap": 0};
|
|
30
38
|
// @ts-ignore
|
|
31
39
|
gridContainer.cols = gridRepeat;
|
|
32
40
|
// @ts-ignore
|
|
@@ -36,7 +44,7 @@ function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
|
|
|
36
44
|
// @ts-ignore
|
|
37
45
|
gridHighlightContainer.cols = gridRepeat;
|
|
38
46
|
// @ts-ignore
|
|
39
|
-
gridHighlightContainer.alignItems = 'start';
|
|
47
|
+
gridHighlightContainer.alignItems = 'flex-start';
|
|
40
48
|
// @ts-ignore
|
|
41
49
|
gridHighlightContainer.pad = [0, 0, 2, 0];
|
|
42
50
|
|
|
@@ -47,33 +55,46 @@ function PegaDxilMyTwoColumnDetails(props: PegaDxilMyTwoColumnDetailsProps) {
|
|
|
47
55
|
const { highlightedData = [] } = getPConnect().getRawMetadata().config;
|
|
48
56
|
// @ts-ignore
|
|
49
57
|
highlightedDataArr = highlightedData.map((field) => {
|
|
50
|
-
field.config.displayMode = 'STACKED_LARGE_VAL';
|
|
58
|
+
// field.config.displayMode = 'STACKED_LARGE_VAL';
|
|
51
59
|
|
|
52
|
-
// Mark as status display when using pyStatusWork
|
|
53
|
-
if (field.config.value === '@P .pyStatusWork') {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
// @ts-ignore
|
|
58
|
-
return getPConnect().createComponent(field);
|
|
60
|
+
// // Mark as status display when using pyStatusWork
|
|
61
|
+
// if (field.config.value === '@P .pyStatusWork') {
|
|
62
|
+
// field.type = 'TextInput';
|
|
63
|
+
// field.config.displayAsStatus = true;
|
|
64
|
+
// }
|
|
65
|
+
// // @ts-ignore
|
|
66
|
+
// return getPConnect().createComponent(field);
|
|
67
|
+
return <HighlightRender field={field} props={props} />;
|
|
59
68
|
});
|
|
60
69
|
}
|
|
61
70
|
|
|
71
|
+
const hrStyle = {
|
|
72
|
+
line: {
|
|
73
|
+
margin: '0.75rem 0',
|
|
74
|
+
opacity: '50%'
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
62
78
|
return (
|
|
63
79
|
<StyledPegaDxilMyTwoColumnDetailsWrapper>
|
|
64
80
|
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
65
81
|
{showHighlightedData && highlightedDataArr.length > 0 && (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
82
|
+
<>
|
|
83
|
+
<Flex
|
|
84
|
+
container={{ direction: 'row', alignItems: 'start', colGap: 10 }}
|
|
85
|
+
data-testid={`highlighted-column-count-${numRegions}`}
|
|
86
|
+
>
|
|
87
|
+
{highlightedDataArr.map((child: any, i: number) => (
|
|
88
|
+
<Fragment key={`hf-${i + 1}`}>{child}</Fragment>
|
|
89
|
+
))}
|
|
90
|
+
</Flex>
|
|
91
|
+
<hr style={hrStyle.line} />
|
|
92
|
+
</>
|
|
72
93
|
)}
|
|
73
94
|
<Grid container={gridContainer} data-testid={`column-count-${numRegions}`} >
|
|
74
95
|
{children.map((child: any, i: number) => (
|
|
75
|
-
<Flex container={{ direction: 'column'}} key={`r-${i + 1}`}>
|
|
76
|
-
|
|
96
|
+
<Flex container={{ direction: 'column', alignItems: 'start', colGap: 0, rowGap: 1.5 }} key={`r-${i + 1}`}>
|
|
97
|
+
<DetailsRender {...child} />
|
|
77
98
|
</Flex>
|
|
78
99
|
))}
|
|
79
100
|
</Grid>
|
package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/demo.stories.tsx
CHANGED
|
@@ -142,7 +142,6 @@ const renderField = resolvedProps => {
|
|
|
142
142
|
|
|
143
143
|
export const BasePegaDxilMyTwoColumnForm: Story = args => {
|
|
144
144
|
const props = {
|
|
145
|
-
template: 'DefaultForm',
|
|
146
145
|
getPConnect: () => {
|
|
147
146
|
return {
|
|
148
147
|
getChildren: () => {
|
|
@@ -187,4 +186,7 @@ export const BasePegaDxilMyTwoColumnForm: Story = args => {
|
|
|
187
186
|
);
|
|
188
187
|
};
|
|
189
188
|
|
|
190
|
-
BasePegaDxilMyTwoColumnForm.args = {
|
|
189
|
+
BasePegaDxilMyTwoColumnForm.args = {
|
|
190
|
+
showLabel: true,
|
|
191
|
+
label: 'Form Region template',
|
|
192
|
+
};
|
|
@@ -19,12 +19,7 @@ export const BasePegaDxilMyUrl: Story = args => {
|
|
|
19
19
|
|
|
20
20
|
const props = {
|
|
21
21
|
value: configProps.value,
|
|
22
|
-
placeholder: configProps.placeholder,
|
|
23
|
-
label: configProps.label,
|
|
24
|
-
helperText: configProps.helperText,
|
|
25
|
-
testId: configProps.testId,
|
|
26
22
|
hasSuggestions: configProps.hasSuggestions,
|
|
27
|
-
validatemessage: '',
|
|
28
23
|
getPConnect: () => {
|
|
29
24
|
return {
|
|
30
25
|
getStateProps: () => {
|
|
@@ -62,5 +57,6 @@ BasePegaDxilMyUrl.args = {
|
|
|
62
57
|
status: configProps.status,
|
|
63
58
|
hideLabel: configProps.hideLabel,
|
|
64
59
|
displayMode: configProps.displayMode,
|
|
60
|
+
variant: configProps.variant,
|
|
65
61
|
validatemessage: configProps.validatemessage
|
|
66
62
|
};
|