@pega/custom-dx-components 0.24.4 → 0.24.6

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.
Files changed (38) hide show
  1. package/package.json +1 -1
  2. package/src/tasks/bundle/builder/webpack.config.js +15 -1
  3. package/src/tasks/create/templates/Constellation/Field/Text/index.tsx.mustache +94 -4
  4. package/src/tasks/create/templates/Constellation/Template/DETAILS/DetailsRender.tsx +10 -4
  5. package/src/tasks/create/templates/Constellation/Template/DETAILS/index.tsx.mustache +9 -16
  6. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/DetailsRender.tsx +10 -4
  7. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.tsx.mustache +6 -5
  8. package/src/tasks/create/templates/Constellation/Template/FORM/DetailsRender.tsx +58 -0
  9. package/src/tasks/create/templates/Constellation/Template/FORM/index.tsx.mustache +31 -5
  10. package/src/tasks/create/templates/Constellation/Template/FORM-region/DetailsRender.tsx +58 -0
  11. package/src/tasks/create/templates/Constellation/Template/FORM-region/index.tsx.mustache +28 -6
  12. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +75 -1
  13. package/src/tasks/create/templates/Constellation/Widget/PAGE/index.tsx.mustache +53 -5
  14. package/src/tasks/init/template/package.json.mustache +1 -1
  15. package/src/tasks/init/template/tsconfig.build.json +3 -1
  16. package/tests/assets/components/create/Pega_DXIL_MyTestText/index.tsx +94 -4
  17. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/DetailsRender.tsx +10 -4
  18. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/index.tsx +6 -13
  19. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/DetailsRender.tsx +58 -0
  20. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/index.tsx +28 -5
  21. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/demo.stories.tsx +75 -1
  22. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/index.tsx +53 -5
  23. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyText/index.tsx +94 -4
  24. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +10 -4
  25. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/index.tsx +3 -2
  26. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/DetailsRender.tsx +58 -0
  27. package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/index.tsx +22 -3
  28. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/DetailsRender.tsx +10 -4
  29. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/index.tsx +6 -13
  30. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/DetailsRender.tsx +58 -0
  31. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/index.tsx +28 -5
  32. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/demo.stories.tsx +75 -1
  33. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/index.tsx +53 -5
  34. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyText/index.tsx +94 -4
  35. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/DetailsRender.tsx +10 -4
  36. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/index.tsx +3 -2
  37. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/DetailsRender.tsx +58 -0
  38. package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/index.tsx +22 -3
@@ -1,4 +1,5 @@
1
- import { withConfiguration } from '@pega/cosmos-react-core';
1
+ import { useEffect, useState } from 'react';
2
+ import { withConfiguration, Table } from '@pega/cosmos-react-core';
2
3
  import { AppAnnouncement as PegaAppAnnouncement } from '@pega/cosmos-react-work';
3
4
  import type { PConnFieldProps } from './PConnProps';
4
5
 
@@ -14,14 +15,13 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
14
15
  image: string;
15
16
  }
16
17
 
17
-
18
- // Duplicated runtime code from Constellation Design System Component
19
-
20
18
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
21
19
  // any default values in config.pros should be set in defaultProps at bottom of this file
22
20
  function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
23
21
 
24
- const { header, description, datasource = [], whatsnewlink, image } = props;
22
+ const { header, description, datasource = [], whatsnewlink, image, getPConnect } = props;
23
+ const [worklist, setWorklist] = useState([]);
24
+ const PConnect = getPConnect();
25
25
  let details = [];
26
26
  // @ts-ignore
27
27
  if (datasource && datasource.source) {
@@ -30,6 +30,48 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
30
30
  return item.name;
31
31
  });
32
32
  }
33
+
34
+ // setting up columns for the work list table
35
+ const columns = [
36
+ { renderer: 'caseType', label: PConnect.getLocalizedValue('Case type', '', '') },
37
+ { renderer: 'insKey', label: PConnect.getLocalizedValue('Key', '', '') },
38
+ { renderer: 'status', label: PConnect.getLocalizedValue('Status', '', '') },
39
+ { renderer: 'stage', label: PConnect.getLocalizedValue('Stage', '', '') }
40
+ ];
41
+
42
+ // going to get data for worklist to put into a table
43
+ // data comes from calling a PCore function to get
44
+ // get data from a data page and a PConnect function
45
+ // to get getContextName
46
+ useEffect(() => {
47
+ const dataViewName = 'D_pyMyWorkList';
48
+ const context = PConnect.getContextName();
49
+
50
+ PCore.getDataPageUtils()
51
+ .getDataAsync(dataViewName, context)
52
+ // @ts-ignore
53
+ .then((response: any) => {
54
+ // table requires an index or will get setExtraStackFrame error
55
+ setWorklist(
56
+ response.data.map((entry: any, index: number) => {
57
+ // mapping the data into the column names
58
+ // MUST have an id/index or will get a setExtraStackFrame error
59
+ // put a key in the table
60
+ return {
61
+ caseType: entry.pxProcessName,
62
+ insKey: entry.pxRefObjectInsName,
63
+ status: entry.pyAssignmentStatus,
64
+ stage: entry.pxTaskLabel,
65
+ id: index
66
+ };
67
+ })
68
+ );
69
+ })
70
+ .catch((error: any) => {
71
+ console.log(error);
72
+ });
73
+ }, [PConnect]);
74
+
33
75
  return (
34
76
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
35
77
  <PegaAppAnnouncement
@@ -39,6 +81,12 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
39
81
  whatsNewLink={whatsnewlink}
40
82
  image={image.replace(/ /g, '+')}
41
83
  />
84
+ <br></br>
85
+ <Table
86
+ title={PConnect.getLocalizedValue('Work list', '', '')}
87
+ columns={columns}
88
+ data={worklist}
89
+ />
42
90
  </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
43
91
  );
44
92
 
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "devDependencies": {
71
71
  "@pega/configs": "^0.6.0",
72
- "@pega/custom-dx-components": "0.24.4",
72
+ "@pega/custom-dx-components": "0.24.6",
73
73
  "@pega/pcore-pconnect-typedefs": "~2.1.1",
74
74
  "@storybook/addon-actions": "^7.6.7",
75
75
  "@storybook/addon-essentials": "^7.6.7",
@@ -5,7 +5,9 @@
5
5
  "./src/**/*.stories.ts",
6
6
  "./src/**/*.stories.tsx",
7
7
  "./src/**/*.stories.js",
8
- "./src/**/*.stories.jsx"
8
+ "./src/**/*.stories.jsx",
9
+ "./src/**/*.test.jsx",
10
+ "./src/**/*.test.tsx"
9
11
  ],
10
12
  "compilerOptions": {
11
13
  "noEmit": false,
@@ -1,4 +1,12 @@
1
- import { Input, withConfiguration } from '@pega/cosmos-react-core';
1
+ import {
2
+ Input,
3
+ FieldValueList,
4
+ Text,
5
+ EmailDisplay,
6
+ PhoneDisplay,
7
+ URLDisplay,
8
+ withConfiguration
9
+ } from '@pega/cosmos-react-core';
2
10
 
3
11
  import type { PConnFieldProps } from './PConnProps';
4
12
 
@@ -7,7 +15,9 @@ import StyledPegaDxilMyTestTextWrapper from './styles';
7
15
  // interface for props
8
16
  interface PegaDxilMyTestTextProps extends PConnFieldProps {
9
17
  // If any, enter additional props that only exist on TextInput here
10
-
18
+ isTableFormatter?: boolean;
19
+ formatter: string;
20
+ variant?: any;
11
21
  }
12
22
 
13
23
  // interface for StateProps object
@@ -16,23 +26,103 @@ interface StateProps {
16
26
  hasSuggestions: boolean;
17
27
  }
18
28
 
19
- // Duplicated runtime code from Constellation Design System Component
29
+ export const formatExists = (formatterVal: string) => {
30
+ const formatterValues = [
31
+ 'TextInput',
32
+ 'WorkStatus',
33
+ 'RichText',
34
+ 'Email',
35
+ 'Phone',
36
+ 'URL',
37
+ 'Operator'
38
+ ];
39
+ let isformatter = false;
40
+ if (formatterValues.includes(formatterVal)) {
41
+ isformatter = true;
42
+ }
43
+ return isformatter;
44
+ };
45
+
46
+ export const textFormatter = (formatter: string, value: string) => {
47
+ let displayComponent: any = null;
48
+ switch (formatter) {
49
+ case 'TextInput': {
50
+ displayComponent = value;
51
+ break;
52
+ }
53
+ case 'Email': {
54
+ displayComponent = <EmailDisplay value={value} displayText={value} variant='link' />;
55
+ break;
56
+ }
57
+ case 'Phone': {
58
+ displayComponent = <PhoneDisplay value={value} variant='link' />;
59
+ break;
60
+ }
61
+ case 'URL': {
62
+ displayComponent = (
63
+ <URLDisplay target='_blank' value={value} displayText={value} variant='link' />
64
+ );
65
+ break;
66
+ }
67
+ // no default
68
+ }
69
+ return displayComponent;
70
+ };
20
71
 
21
72
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
22
73
  // any default values in config.pros should be set in defaultProps at bottom of this file
23
74
  function PegaDxilMyTestText(props: PegaDxilMyTestTextProps) {
24
- const { getPConnect, value, placeholder, disabled = false, readOnly = false, required = false, label, hideLabel = false, testId } = props;
75
+ const { getPConnect, value, placeholder, disabled = false, displayMode, readOnly = false, required = false, label, hideLabel = false, testId, isTableFormatter = false, variant = 'inline' } = props;
25
76
 
26
77
  const pConn = getPConnect();
27
78
  const actions = pConn.getActionsApi();
28
79
  const stateProps = pConn.getStateProps() as StateProps;
29
80
  const propName: string = stateProps.value;
81
+ const { formatter } = props;
30
82
 
31
83
  const handleOnChange = (event: any) => {
32
84
  const { value: updatedValue } = event.target;
33
85
  actions.updateFieldValue(propName, updatedValue);
34
86
  };
35
87
 
88
+ if (displayMode === 'LABELS_LEFT' || displayMode === 'DISPLAY_ONLY') {
89
+ let displayComp = value || <span aria-hidden='true'>&ndash;&ndash;</span>;
90
+ if (isTableFormatter && formatExists(formatter)) {
91
+ displayComp = textFormatter(formatter, value);
92
+ }
93
+ return displayMode === 'DISPLAY_ONLY' ? (
94
+ <StyledPegaDxilMyTestTextWrapper> {displayComp} </StyledPegaDxilMyTestTextWrapper>
95
+ ) : (
96
+ <StyledPegaDxilMyTestTextWrapper>
97
+ <FieldValueList
98
+ variant={hideLabel ? 'stacked' : variant}
99
+ data-testid={testId}
100
+ fields={[{ id: '1', name: hideLabel ? '' : label, value: displayComp }]}
101
+ />
102
+ </StyledPegaDxilMyTestTextWrapper>
103
+ );
104
+ }
105
+
106
+ if (displayMode === 'STACKED_LARGE_VAL') {
107
+ const isValDefined = typeof value !== 'undefined' && value !== '';
108
+ const val = isValDefined ? (
109
+ <Text variant='h1' as='span'>
110
+ {value}
111
+ </Text>
112
+ ) : (
113
+ ''
114
+ );
115
+ return (
116
+ <StyledPegaDxilMyTestTextWrapper>
117
+ <FieldValueList
118
+ variant='stacked'
119
+ data-testid={testId}
120
+ fields={[{ id: '2', name: hideLabel ? '' : label, value: val }]}
121
+ />
122
+ </StyledPegaDxilMyTestTextWrapper>
123
+ );
124
+ }
125
+
36
126
  return (
37
127
  <StyledPegaDxilMyTestTextWrapper>
38
128
  <Input
@@ -1,11 +1,17 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
- import React, { Fragment } from 'react';
1
+ import { Fragment, ReactElement } from 'react';
3
2
  import { FieldValueList } from '@pega/cosmos-react-core';
4
3
 
5
- const DetailsRender = (child: any) => {
4
+ interface DetailsRenderProps {
5
+ children?: never;
6
+ child: NonNullable<ReactElement>;
7
+ }
8
+
9
+ const DetailsRender = (props: DetailsRenderProps) => {
10
+ const { child } = props;
11
+
6
12
  const kids = child.props.getPConnect().getChildren();
7
13
 
8
- const displayCompArr: JSX.Element[] = [];
14
+ const displayCompArr: ReactElement[] = [];
9
15
 
10
16
  Object.values(kids).forEach((value: any) => {
11
17
  const { type } = value.getPConnect().getRawMetadata();
@@ -9,7 +9,6 @@ import StyledPegaDxilMyDetailsWrapper from './styles';
9
9
  // includes in bundle
10
10
  import { getAllFields } from './utils';
11
11
 
12
-
13
12
  // interface for props
14
13
  interface PegaDxilMyDetailsProps extends PConnFieldProps {
15
14
  // If any, enter additional props that only exist on TextInput here
@@ -56,16 +55,8 @@ function PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
56
55
  const { highlightedData = [] } = getPConnect().getRawMetadata().config;
57
56
  // @ts-ignore
58
57
  highlightedDataArr = highlightedData.map((field) => {
59
- // field.config.displayMode = 'STACKED_LARGE_VAL';
60
58
 
61
- // // Mark as status display when using pyStatusWork
62
- // if (field.config.value === '@P .pyStatusWork') {
63
- // field.type = 'TextInput';
64
- // field.config.displayAsStatus = true;
65
- // }
66
- // // @ts-ignore
67
- // return getPConnect().createComponent(field);
68
- return <HighlightRender field={field} props={props} />;
59
+ return <HighlightRender field={field} props={props} />;
69
60
  });
70
61
  }
71
62
 
@@ -82,7 +73,8 @@ function PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
82
73
  {showHighlightedData && highlightedDataArr.length > 0 && (
83
74
  <>
84
75
  <Flex
85
- container={{ direction: 'row', alignItems: 'start', colGap: 10 }}
76
+ // @ts-ignore
77
+ container={{ direction: 'row', alignItems: 'normal', colGap: 10 }}
86
78
  data-testid={`highlighted-column-count-${numRegions}`}
87
79
  >
88
80
  {highlightedDataArr.map((child: any, i: number) => (
@@ -94,8 +86,9 @@ function PegaDxilMyDetails(props: PegaDxilMyDetailsProps) {
94
86
  )}
95
87
  <Grid container={gridContainer} data-testid={`column-count-${numRegions}`} >
96
88
  {children.map((child: any, i: number) => (
97
- <Flex container={{ direction: 'column', alignItems: 'start', colGap: 0, rowGap: 1.5 }} key={`r-${i + 1}`}>
98
- <DetailsRender {...child} />
89
+ // @ts-ignore
90
+ <Flex container={{ direction: 'column', alignItems: 'normal', colGap: 0, rowGap: 1.5 }} key={`r-${i + 1}`}>
91
+ <DetailsRender child={child} />
99
92
  </Flex>
100
93
  ))}
101
94
  </Grid>
@@ -0,0 +1,58 @@
1
+ import { Fragment, ReactElement } from 'react';
2
+ import { FieldValueList } from '@pega/cosmos-react-core';
3
+
4
+ interface DetailsRenderProps {
5
+ children?: never;
6
+ child: NonNullable<ReactElement>;
7
+ }
8
+
9
+ const DetailsRender = (props: DetailsRenderProps) => {
10
+ const { child } = props;
11
+
12
+ const kids = child.props.getPConnect().getChildren();
13
+
14
+ const displayCompArr: ReactElement[] = [];
15
+
16
+ Object.values(kids).forEach((value: any) => {
17
+ const { type } = value.getPConnect().getRawMetadata();
18
+ const { hideLabel, variant, testId, label } = value
19
+ .getPConnect()
20
+ .resolveConfigProps(value.getPConnect().getConfigProps());
21
+
22
+ let displayComp;
23
+ const key = JSON.stringify(value.getPConnect());
24
+
25
+ if (type === 'reference') {
26
+ const refElement = value.getPConnect().getComponent();
27
+
28
+ displayCompArr.push(refElement);
29
+ } else {
30
+ const element = value.getPConnect().getComponent();
31
+ const displayEl = <Fragment key={key}>{element}</Fragment>;
32
+
33
+ const fvlStyle = {
34
+ myColGap: {
35
+ columnGap: '0'
36
+ }
37
+ };
38
+
39
+ // const myEl = <div>boo</div>;
40
+ displayComp = (
41
+ <Fragment key={key}>
42
+ <FieldValueList
43
+ style={fvlStyle.myColGap}
44
+ variant={hideLabel ? 'stacked' : variant}
45
+ data-testid={testId}
46
+ fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
47
+ />
48
+ </Fragment>
49
+ );
50
+
51
+ displayCompArr.push(displayComp);
52
+ }
53
+ });
54
+
55
+ return <>{displayCompArr}</>;
56
+ };
57
+
58
+ export default DetailsRender;
@@ -1,7 +1,8 @@
1
- import { Grid, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
1
+ import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
2
2
 
3
3
 
4
4
  import type { PConnFieldProps } from './PConnProps';
5
+ import DetailsRender from './DetailsRender';
5
6
 
6
7
  import StyledPegaDxilMyFormWrapper from './styles';
7
8
 
@@ -13,19 +14,41 @@ interface PegaDxilMyFormProps extends PConnFieldProps {
13
14
  children: any;
14
15
  }
15
16
 
16
- // Duplicated runtime code from Constellation Design System Component
17
-
18
17
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
19
18
  // any default values in config.pros should be set in defaultProps at bottom of this file
20
19
  function PegaDxilMyForm(props: PegaDxilMyFormProps) {
21
20
 
22
- const { children = [], NumCols = '1', label, showLabel, getPConnect } = props;
21
+ const { children = [], NumCols = '1', label, showLabel, getPConnect, readOnly, displayMode } = props;
23
22
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
24
23
 
25
24
  const nCols = parseInt(NumCols, 10);
26
25
 
27
- // console.log(`Rendering ${getPConnect()?.getComponentName()} with ${template} with ${children?.length} Region(s)`);
28
26
 
27
+ if (readOnly && readOnly === true && displayMode && displayMode === 'DISPLAY_ONLY') {
28
+ const numRegions = '1';
29
+ const gridRepeat = 'repeat('.concat(numRegions).concat(', 1fr)');
30
+ const gridContainer = { colGap: 0 };
31
+ // @ts-ignore
32
+ gridContainer.cols = gridRepeat;
33
+
34
+ return (
35
+ <StyledPegaDxilMyFormWrapper>
36
+ <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
37
+ <Grid container={gridContainer} data-testid={`column-count-${numRegions}`}>
38
+ {children.map((child: any, i: number) => (
39
+ <Flex
40
+ // @ts-ignore
41
+ container={{ direction: 'column', alignItems: 'normal', colGap: 0, rowGap: 1.5 }}
42
+ key={`r-${i + 1}`}
43
+ >
44
+ <DetailsRender child={child} />
45
+ </Flex>
46
+ ))}
47
+ </Grid>
48
+ </FieldGroup>
49
+ </StyledPegaDxilMyFormWrapper>
50
+ );
51
+ }
29
52
  return (
30
53
  <StyledPegaDxilMyFormWrapper>
31
54
  <FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
@@ -17,10 +17,84 @@ const meta: Meta<typeof PegaDxilMyPageWidget> = {
17
17
  export default meta;
18
18
  type Story = StoryObj<typeof PegaDxilMyPageWidget>;
19
19
 
20
+ if (!window.PCore) {
21
+ window.PCore = {};
22
+ }
23
+
24
+ const worklistData = {
25
+ data: [
26
+ {
27
+ pxProcessName: 'Loan',
28
+ pxRefObjectInsName: ' A-8002',
29
+ pyAssignmentStatus: 'New',
30
+ pxTaskLabel: 'Details'
31
+ },
32
+ {
33
+ pxProcessName: 'Loan',
34
+ pxRefObjectInsName: ' A-7001',
35
+ pyAssignmentStatus: 'Open',
36
+ pxTaskLabel: 'Info'
37
+ },
38
+ {
39
+ pxProcessName: 'Loan',
40
+ pxRefObjectInsName: ' A-9000',
41
+ pyAssignmentStatus: 'Open',
42
+ pxTaskLabel: 'Amount'
43
+ }
44
+ ]
45
+ };
46
+
47
+ window.PCore.getDataPageUtils = () => {
48
+ return {
49
+ getDataAsync: () => {
50
+ return new Promise(resolve => {
51
+ resolve(worklistData);
52
+ });
53
+ }
54
+ };
55
+ };
56
+
57
+
58
+
20
59
  export const BasePegaDxilMyPageWidget: Story = args => {
21
60
 
22
61
  const props = {
23
- image: configProps.image
62
+ image: configProps.image,
63
+ getPConnect: () => {
64
+ return {
65
+ getValue: value => {
66
+ return value;
67
+ },
68
+ getContextName: () => {
69
+ return 'app/primary_1';
70
+ },
71
+ getLocalizedValue: value => {
72
+ return value;
73
+ },
74
+ getActionsApi: () => {
75
+ return {
76
+ updateFieldValue: () => {
77
+ /* nothing */
78
+ },
79
+ triggerFieldChange: () => {
80
+ /* nothing */
81
+ }
82
+ };
83
+ },
84
+ ignoreSuggestion: () => {
85
+ /* nothing */
86
+ },
87
+ acceptSuggestion: () => {
88
+ /* nothing */
89
+ },
90
+ setInheritedProps: () => {
91
+ /* nothing */
92
+ },
93
+ resolveConfigProps: () => {
94
+ /* nothing */
95
+ }
96
+ };
97
+ }
24
98
  };
25
99
 
26
100
  return (
@@ -1,4 +1,5 @@
1
- import { withConfiguration } from '@pega/cosmos-react-core';
1
+ import { useEffect, useState } from 'react';
2
+ import { withConfiguration, Table } from '@pega/cosmos-react-core';
2
3
  import { AppAnnouncement as PegaAppAnnouncement } from '@pega/cosmos-react-work';
3
4
  import type { PConnFieldProps } from './PConnProps';
4
5
 
@@ -14,14 +15,13 @@ interface PegaDxilMyPageWidgetProps extends PConnFieldProps {
14
15
  image: string;
15
16
  }
16
17
 
17
-
18
- // Duplicated runtime code from Constellation Design System Component
19
-
20
18
  // props passed in combination of props from property panel (config.json) and run time props from Constellation
21
19
  // any default values in config.pros should be set in defaultProps at bottom of this file
22
20
  function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
23
21
 
24
- const { header, description, datasource = [], whatsnewlink, image } = props;
22
+ const { header, description, datasource = [], whatsnewlink, image, getPConnect } = props;
23
+ const [worklist, setWorklist] = useState([]);
24
+ const PConnect = getPConnect();
25
25
  let details = [];
26
26
  // @ts-ignore
27
27
  if (datasource && datasource.source) {
@@ -30,6 +30,48 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
30
30
  return item.name;
31
31
  });
32
32
  }
33
+
34
+ // setting up columns for the work list table
35
+ const columns = [
36
+ { renderer: 'caseType', label: PConnect.getLocalizedValue('Case type', '', '') },
37
+ { renderer: 'insKey', label: PConnect.getLocalizedValue('Key', '', '') },
38
+ { renderer: 'status', label: PConnect.getLocalizedValue('Status', '', '') },
39
+ { renderer: 'stage', label: PConnect.getLocalizedValue('Stage', '', '') }
40
+ ];
41
+
42
+ // going to get data for worklist to put into a table
43
+ // data comes from calling a PCore function to get
44
+ // get data from a data page and a PConnect function
45
+ // to get getContextName
46
+ useEffect(() => {
47
+ const dataViewName = 'D_pyMyWorkList';
48
+ const context = PConnect.getContextName();
49
+
50
+ PCore.getDataPageUtils()
51
+ .getDataAsync(dataViewName, context)
52
+ // @ts-ignore
53
+ .then((response: any) => {
54
+ // table requires an index or will get setExtraStackFrame error
55
+ setWorklist(
56
+ response.data.map((entry: any, index: number) => {
57
+ // mapping the data into the column names
58
+ // MUST have an id/index or will get a setExtraStackFrame error
59
+ // put a key in the table
60
+ return {
61
+ caseType: entry.pxProcessName,
62
+ insKey: entry.pxRefObjectInsName,
63
+ status: entry.pyAssignmentStatus,
64
+ stage: entry.pxTaskLabel,
65
+ id: index
66
+ };
67
+ })
68
+ );
69
+ })
70
+ .catch((error: any) => {
71
+ console.log(error);
72
+ });
73
+ }, [PConnect]);
74
+
33
75
  return (
34
76
  <StyledPegaDxilMyPageWidgetWrapper>
35
77
  <PegaAppAnnouncement
@@ -39,6 +81,12 @@ function PegaDxilMyPageWidget(props: PegaDxilMyPageWidgetProps) {
39
81
  whatsNewLink={whatsnewlink}
40
82
  image={image.replace(/ /g, '+')}
41
83
  />
84
+ <br></br>
85
+ <Table
86
+ title={PConnect.getLocalizedValue('Work list', '', '')}
87
+ columns={columns}
88
+ data={worklist}
89
+ />
42
90
  </StyledPegaDxilMyPageWidgetWrapper>
43
91
  );
44
92