@pega/dx-component-builder-sdk 0.23.21 → 0.24.1
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/cli.js +1 -1
- package/src/constants.js +4 -0
- package/src/tasks/build-all/helper.js +6 -0
- package/src/tasks/build-comp/helper.js +6 -0
- package/src/tasks/bundle/builderAngular/webpack.config.js +14 -1
- package/src/tasks/bundle/builderAssociated/webpack.config.js +13 -0
- package/src/tasks/bundle/builderReact/webpack.config.js +14 -1
- package/src/tasks/create/templates/Constellation/field/Boolean/index.tsx.mustache +3 -2
- package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/PConnProps.d.ts.mustache +46 -0
- package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/config.json.mustache +64 -0
- package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/demo.stories.tsx.mustache +99 -0
- package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/index.tsx.mustache +204 -0
- package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/mock.ts.mustache +5 -0
- package/src/tasks/create/templates/Constellation/field/Icon-Button-URL/styles.ts.mustache +8 -0
- 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/field/Text/index.tsx.mustache +94 -4
- package/src/tasks/create/templates/Constellation/template/DETAILS/Avatar.tsx.mustache +78 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS/DetailsRender.tsx.mustache +55 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS/HighlightRender.tsx.mustache +49 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS/Operator.tsx.mustache +218 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS/demo.stories.tsx.mustache +77 -23
- package/src/tasks/create/templates/Constellation/template/DETAILS/index.tsx.mustache +51 -40
- package/src/tasks/create/templates/Constellation/template/DETAILS/mock.ts.mustache +78 -20
- package/src/tasks/create/templates/Constellation/template/DETAILS/styles.ts.mustache +16 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/Avatar.tsx.mustache +78 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/DetailsRender.tsx.mustache +55 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/HighlightRender.tsx.mustache +49 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/Operator.tsx.mustache +218 -0
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/demo.stories.tsx.mustache +95 -26
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/index.tsx.mustache +43 -40
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/mock.ts.mustache +68 -10
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/styles.ts.mustache +15 -0
- package/src/tasks/create/templates/Constellation/template/FORM/DetailsRender.tsx +59 -0
- package/src/tasks/create/templates/Constellation/template/FORM/index.tsx.mustache +31 -5
- package/src/tasks/create/templates/Constellation/template/FORM-region/DetailsRender.tsx +59 -0
- package/src/tasks/create/templates/Constellation/template/FORM-region/index.tsx.mustache +29 -7
- package/src/tasks/create/templates/Constellation/template/PAGE/GetNextWork.tsx.mustache +2 -1
- package/src/tasks/create/templates/Constellation/template/PAGE/localizations.json.mustache +4 -2
- package/src/tasks/create/templates/Constellation/widget/PAGE/demo.stories.tsx.mustache +87 -6
- package/src/tasks/create/templates/Constellation/widget/PAGE/index.tsx.mustache +67 -5
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/config.json.mustache +64 -0
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/demo.stories.tsx.mustache +42 -0
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/mock.ts.mustache +17 -0
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/text-url.component.html.mustache +29 -0
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/text-url.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/text-url.component.spec.ts.mustache +26 -0
- package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/text-url.component.ts.mustache +179 -0
- package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/config.json.mustache +64 -0
- package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/demo.stories.tsx.mustache +58 -0
- package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/index.tsx.mustache +79 -0
- package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/mock.ts.mustache +16 -0
- package/src/tasks/create/templates/SDK-React/field/Icon-Button-URL/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/template/DETAILS/demo.stories.tsx.mustache +0 -3
- package/src/tasks/create/templates/SDK-React/template/DETAILS/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/demo.stories.tsx.mustache +0 -3
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/index.tsx.mustache +1 -1
- package/src/tasks/create-all/index.js +3 -0
- package/src/tasks/publish/helper.js +4 -0
- package/src/tasks/publish-all/helper.js +6 -2
- package/src/tasks/validator/index.js +7 -1
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
marginLineStart: 0
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// const myEl = <div>boo</div>;
|
|
41
|
+
displayComp = (
|
|
42
|
+
<Fragment key={key}>
|
|
43
|
+
<FieldValueList
|
|
44
|
+
style={fvlStyle.myColGap}
|
|
45
|
+
variant={hideLabel ? 'stacked' : variant}
|
|
46
|
+
data-testid={testId}
|
|
47
|
+
fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
|
|
48
|
+
/>
|
|
49
|
+
</Fragment>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
displayCompArr.push(displayComp);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return <>{displayCompArr}</>;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
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 Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
7
8
|
|
|
@@ -13,19 +14,44 @@ interface {{COMPONENT_CLASS_NAME}}Props 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 {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
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, 'margin-line-start': 0 };
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
gridContainer.cols = gridRepeat;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
36
|
+
{{! pick new delimiters for mustache }}
|
|
37
|
+
{{=<% %>=}}
|
|
38
|
+
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
39
|
+
<Grid container={gridContainer} data-testid={`column-count-${numRegions}`}>
|
|
40
|
+
{children.map((child: any, i: number) => (
|
|
41
|
+
<Flex
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
container={{ direction: 'column', alignItems: 'normal', colGap: 1, rowGap: 1.5 }}
|
|
44
|
+
key={`r-${i + 1}`}
|
|
45
|
+
>
|
|
46
|
+
<DetailsRender child={child} />
|
|
47
|
+
</Flex>
|
|
48
|
+
))}
|
|
49
|
+
</Grid>
|
|
50
|
+
</FieldGroup>
|
|
51
|
+
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
52
|
+
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
29
55
|
return (
|
|
30
56
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
31
57
|
{{! pick new delimiters for mustache }}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
marginLineStart: 0
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// const myEl = <div>boo</div>;
|
|
41
|
+
displayComp = (
|
|
42
|
+
<Fragment key={key}>
|
|
43
|
+
<FieldValueList
|
|
44
|
+
style={fvlStyle.myColGap}
|
|
45
|
+
variant={hideLabel ? 'stacked' : variant}
|
|
46
|
+
data-testid={testId}
|
|
47
|
+
fields={[{ id: '1', name: hideLabel ? '' : label, value: displayEl }]}
|
|
48
|
+
/>
|
|
49
|
+
</Fragment>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
displayCompArr.push(displayComp);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return <>{displayCompArr}</>;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default DetailsRender;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Grid, Flex, FieldGroup, withConfiguration } from '@pega/cosmos-react-core';
|
|
2
2
|
|
|
3
3
|
import type { PConnFieldProps } from './PConnProps';
|
|
4
|
+
import DetailsRender from './DetailsRender';
|
|
4
5
|
|
|
5
6
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
6
7
|
|
|
@@ -11,19 +12,17 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
|
|
|
11
12
|
children: any;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
// Duplicated runtime code from Constellation Design System Component
|
|
15
|
-
|
|
16
15
|
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
17
16
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
18
17
|
function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
19
18
|
|
|
20
19
|
|
|
21
|
-
const { children = [], label, showLabel, getPConnect } = props;
|
|
20
|
+
const { children = [], label, showLabel, getPConnect, readOnly, displayMode } = props;
|
|
22
21
|
const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
|
|
23
22
|
|
|
24
23
|
const numRegions = children?.length;
|
|
25
24
|
const gridRepeat = "repeat(".concat(numRegions).concat(", 1fr)");
|
|
26
|
-
const gridContainer = {"colGap" :
|
|
25
|
+
const gridContainer = {"colGap" : 6};
|
|
27
26
|
// @ts-ignore
|
|
28
27
|
gridContainer.cols = gridRepeat;
|
|
29
28
|
// @ts-ignore
|
|
@@ -33,10 +32,33 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
33
32
|
// @ts-ignore
|
|
34
33
|
flexContainer.gap = 2;
|
|
35
34
|
|
|
35
|
+
if (readOnly && readOnly === true && displayMode && displayMode === 'DISPLAY_ONLY') {
|
|
36
|
+
return (
|
|
37
|
+
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
38
|
+
{{! pick new delimiters for mustache }}
|
|
39
|
+
{{=<% %>=}}
|
|
40
|
+
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
41
|
+
<Grid container={gridContainer} data-testid={`column-count-${numRegions}`}>
|
|
42
|
+
{children.map((child: any, i: number) => (
|
|
43
|
+
<Flex
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
container={{ direction: 'column', alignItems: 'normal', colGap: 1, rowGap: 1.5 }}
|
|
46
|
+
key={`r-${i + 1}`}
|
|
47
|
+
>
|
|
48
|
+
<DetailsRender child={child} />
|
|
49
|
+
</Flex>
|
|
50
|
+
))}
|
|
51
|
+
</Grid>
|
|
52
|
+
</FieldGroup>
|
|
53
|
+
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
54
|
+
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
36
58
|
return (
|
|
37
59
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
38
|
-
|
|
39
|
-
|
|
60
|
+
{{! pick new delimiters for mustache }}
|
|
61
|
+
{{=<% %>=}}
|
|
40
62
|
<FieldGroup name={propsToUse.showLabel ? propsToUse.label : ''}>
|
|
41
63
|
<Grid container={gridContainer}>
|
|
42
64
|
{children.map((child: any, i: number) => (
|
|
@@ -47,7 +69,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
47
69
|
))}
|
|
48
70
|
</Grid>
|
|
49
71
|
</FieldGroup>
|
|
50
|
-
|
|
72
|
+
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
51
73
|
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
52
74
|
);
|
|
53
75
|
|
|
@@ -18,6 +18,7 @@ export default function GetNextWork(props: {{COMPONENT_CLASS_NAME}}WorkProps) {
|
|
|
18
18
|
const toasterCtx = useToaster();
|
|
19
19
|
|
|
20
20
|
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
21
|
+
const localeCategory = 'Case';
|
|
21
22
|
|
|
22
23
|
const getNextWork = () => {
|
|
23
24
|
|
|
@@ -30,7 +31,7 @@ export default function GetNextWork(props: {{COMPONENT_CLASS_NAME}}WorkProps) {
|
|
|
30
31
|
console.log(err);
|
|
31
32
|
if (err[0].status === 404) {
|
|
32
33
|
toasterCtx.push({
|
|
33
|
-
content: localizedVal('No task currently available')
|
|
34
|
+
content: localizedVal('No task currently available', localeCategory)
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
});
|
|
@@ -17,17 +17,98 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
|
|
|
17
17
|
export default meta;
|
|
18
18
|
type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
|
|
19
19
|
|
|
20
|
+
if (!window.PCore) {
|
|
21
|
+
window.PCore = {};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const worklistData = {
|
|
25
|
+
data: {
|
|
26
|
+
data: [
|
|
27
|
+
{
|
|
28
|
+
pxProcessName: 'Loan',
|
|
29
|
+
pxRefObjectInsName: ' A-8002',
|
|
30
|
+
pyAssignmentStatus: 'New',
|
|
31
|
+
pxTaskLabel: 'Details'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
pxProcessName: 'Loan',
|
|
35
|
+
pxRefObjectInsName: ' A-7001',
|
|
36
|
+
pyAssignmentStatus: 'Open',
|
|
37
|
+
pxTaskLabel: 'Info'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
pxProcessName: 'Loan',
|
|
41
|
+
pxRefObjectInsName: ' A-9000',
|
|
42
|
+
pyAssignmentStatus: 'Open',
|
|
43
|
+
pxTaskLabel: 'Amount'
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
window.PCore.getDataApiUtils = () => {
|
|
50
|
+
return {
|
|
51
|
+
getData: () => {
|
|
52
|
+
return new Promise(resolve => {
|
|
53
|
+
resolve(worklistData);
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
getDataAsync: () => {
|
|
57
|
+
return new Promise(resolve => {
|
|
58
|
+
resolve(worklistData);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
20
66
|
export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
|
|
21
67
|
|
|
22
68
|
const props = {
|
|
23
|
-
|
|
69
|
+
...configProps,
|
|
70
|
+
getPConnect: () => {
|
|
71
|
+
return {
|
|
72
|
+
getValue: value => {
|
|
73
|
+
return value;
|
|
74
|
+
},
|
|
75
|
+
getContextName: () => {
|
|
76
|
+
return 'app/primary_1';
|
|
77
|
+
},
|
|
78
|
+
getLocalizedValue: value => {
|
|
79
|
+
return value;
|
|
80
|
+
},
|
|
81
|
+
getActionsApi: () => {
|
|
82
|
+
return {
|
|
83
|
+
updateFieldValue: () => {
|
|
84
|
+
/* nothing */
|
|
85
|
+
},
|
|
86
|
+
triggerFieldChange: () => {
|
|
87
|
+
/* nothing */
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
ignoreSuggestion: () => {
|
|
92
|
+
/* nothing */
|
|
93
|
+
},
|
|
94
|
+
acceptSuggestion: () => {
|
|
95
|
+
/* nothing */
|
|
96
|
+
},
|
|
97
|
+
setInheritedProps: () => {
|
|
98
|
+
/* nothing */
|
|
99
|
+
},
|
|
100
|
+
resolveConfigProps: () => {
|
|
101
|
+
/* nothing */
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
24
105
|
};
|
|
25
106
|
|
|
26
|
-
return (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
107
|
+
return (
|
|
108
|
+
<>
|
|
109
|
+
<{{COMPONENT_CLASS_NAME}} {...props} {...args} />
|
|
110
|
+
</>
|
|
111
|
+
);
|
|
31
112
|
};
|
|
32
113
|
|
|
33
114
|
Base{{COMPONENT_CLASS_NAME}}.args = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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,17 @@ 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 [isLoading, setIsLoading] = useState(true);
|
|
25
|
+
const PConnect = getPConnect();
|
|
26
|
+
const dataViewName = 'D_pyMyWorkList';
|
|
27
|
+
const context = PConnect.getContextName();
|
|
28
|
+
|
|
25
29
|
let details = [];
|
|
26
30
|
// @ts-ignore
|
|
27
31
|
if (datasource && datasource.source) {
|
|
@@ -30,6 +34,56 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
30
34
|
return item.name;
|
|
31
35
|
});
|
|
32
36
|
}
|
|
37
|
+
|
|
38
|
+
// setting up columns for the work list table
|
|
39
|
+
const columns = [
|
|
40
|
+
{ renderer: 'caseType', label: PConnect.getLocalizedValue('Case type', '', '') },
|
|
41
|
+
{ renderer: 'insKey', label: PConnect.getLocalizedValue('Key', '', '') },
|
|
42
|
+
{ renderer: 'status', label: PConnect.getLocalizedValue('Status', '', '') },
|
|
43
|
+
{ renderer: 'stage', label: PConnect.getLocalizedValue('Stage', '', '') }
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
// going to get data for worklist to put into a table
|
|
47
|
+
// data comes from calling a PCore function to get
|
|
48
|
+
// get data from a data page and a PConnect function
|
|
49
|
+
// to get getContextName
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
|
|
52
|
+
PCore.getDataApiUtils()
|
|
53
|
+
.getData(dataViewName, {}, context)
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
.then((response: any) => {
|
|
56
|
+
setIsLoading(false);
|
|
57
|
+
if (response.data.data !== null) {
|
|
58
|
+
// table requires an index or will get setExtraStackFrame error
|
|
59
|
+
setWorklist(
|
|
60
|
+
response.data.data.map((entry: any, index: number) => {
|
|
61
|
+
// mapping the data into the column names
|
|
62
|
+
// MUST have an id/index or will get a setExtraStackFrame error
|
|
63
|
+
// put a key in the table
|
|
64
|
+
return {
|
|
65
|
+
caseType: entry.pxProcessName,
|
|
66
|
+
insKey: entry.pxRefObjectInsName,
|
|
67
|
+
status: entry.pyAssignmentStatus,
|
|
68
|
+
stage: entry.pxTaskLabel,
|
|
69
|
+
id: index
|
|
70
|
+
};
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
setWorklist([]);
|
|
76
|
+
setIsLoading(false);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
})
|
|
80
|
+
.catch((error: any) => {
|
|
81
|
+
setWorklist([]);
|
|
82
|
+
setIsLoading(false);
|
|
83
|
+
console.log(error);
|
|
84
|
+
});
|
|
85
|
+
}, [context]);
|
|
86
|
+
|
|
33
87
|
return (
|
|
34
88
|
<Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
35
89
|
<PegaAppAnnouncement
|
|
@@ -39,6 +93,14 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
|
|
|
39
93
|
whatsNewLink={whatsnewlink}
|
|
40
94
|
image={image.replace(/ /g, '+')}
|
|
41
95
|
/>
|
|
96
|
+
<br />
|
|
97
|
+
<Table
|
|
98
|
+
title={PConnect.getLocalizedValue('Work list', '', '')}
|
|
99
|
+
columns={columns}
|
|
100
|
+
data={worklist}
|
|
101
|
+
loading={isLoading}
|
|
102
|
+
loadingMessage={PConnect.getLocalizedValue('Loading Work list', '', '')}
|
|
103
|
+
/>
|
|
42
104
|
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>
|
|
43
105
|
);
|
|
44
106
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{COMPONENT_KEY}}",
|
|
3
|
+
"label": "{{COMPONENT_LABEL}}",
|
|
4
|
+
"description": "{{DESCRIPTION}}",
|
|
5
|
+
"organization": "{{ORGANIZATION}}",
|
|
6
|
+
"version": "{{VERSION}}",
|
|
7
|
+
"library": "{{LIBRARY}}",
|
|
8
|
+
"allowedApplications": {{{ALLOWEDAPPS}}},
|
|
9
|
+
"componentKey": "{{COMPONENT_KEY}}",
|
|
10
|
+
"type": "{{TYPE}}",
|
|
11
|
+
"subtype": {{{SUB_TYPE}}},
|
|
12
|
+
"icon": "images/pz-url-active.svg",
|
|
13
|
+
"properties": [
|
|
14
|
+
{
|
|
15
|
+
"format": "SELECT",
|
|
16
|
+
"name": "countryCode",
|
|
17
|
+
"label": "Country code",
|
|
18
|
+
"defaultValue": "USA",
|
|
19
|
+
"source": [
|
|
20
|
+
{
|
|
21
|
+
"key": "USA",
|
|
22
|
+
"value": "United States"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"key": "CAN",
|
|
26
|
+
"value": "Canada"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"key": "AUS",
|
|
30
|
+
"value": "Australia"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"key": "JPN",
|
|
34
|
+
"value": "Japan"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"key": "IND",
|
|
38
|
+
"value": "India"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"key": "TUR",
|
|
42
|
+
"value": "Turkey"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"label": "Advanced",
|
|
48
|
+
"format": "GROUP",
|
|
49
|
+
"collapsible": true,
|
|
50
|
+
"properties": [
|
|
51
|
+
{
|
|
52
|
+
"name": "testId",
|
|
53
|
+
"label": "Test ID",
|
|
54
|
+
"format": "TEXT",
|
|
55
|
+
"ignorePattern": "[^-_\\p{N}\\p{L}]",
|
|
56
|
+
"includeAnnotations": false
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"defaultConfig": {
|
|
62
|
+
"label": "@L $this.label"
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/tasks/create/templates/SDK-Angular/field/Icon-Button-URL/demo.stories.tsx.mustache
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { FormBuilder } from '@angular/forms';
|
|
3
|
+
|
|
4
|
+
import { configProps, stateProps } from './mock';
|
|
5
|
+
|
|
6
|
+
import {{! pick new delimiters for mustache }}{{=<% %>=}}{<%={{ }}=%> {{COMPONENT_CLASS_NAME}}Component {{=<% %>=}}}<%={{ }}=%>{{! revert delimiters for mustache }} from './{{COMPONENT_CLASS_NAME_KEBAB}}.component';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<{{COMPONENT_CLASS_NAME}}Component> = {
|
|
9
|
+
title: '{{COMPONENT_CLASS_NAME}}',
|
|
10
|
+
component: {{COMPONENT_CLASS_NAME}}Component,
|
|
11
|
+
excludeStories: /.*Data$/,
|
|
12
|
+
render: (args: {{COMPONENT_CLASS_NAME}}Component) => ({
|
|
13
|
+
props: {
|
|
14
|
+
...args,
|
|
15
|
+
pConn$: {
|
|
16
|
+
resolveConfigProps: (props) => props,
|
|
17
|
+
getConfigProps: () => {
|
|
18
|
+
return configProps;
|
|
19
|
+
},
|
|
20
|
+
getStateProps: () => {
|
|
21
|
+
return stateProps;
|
|
22
|
+
}
|
|
23
|
+
} as any,
|
|
24
|
+
formGroup$: new FormBuilder().group({})
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<{{COMPONENT_CLASS_NAME}}Component>;
|
|
31
|
+
|
|
32
|
+
export const {{COMPONENT_CLASS_NAME}}: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
label$: configProps.label,
|
|
35
|
+
helperText: configProps.helperText,
|
|
36
|
+
placeholder: configProps.placeholder,
|
|
37
|
+
bReadonly$: configProps.readOnly,
|
|
38
|
+
bDisabled$: configProps.disabled,
|
|
39
|
+
bRequired$: configProps.required,
|
|
40
|
+
displayMode$: configProps.displayMode
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
value: '',
|
|
3
|
+
label: 'URL Sample',
|
|
4
|
+
placeholder: 'URL Placeholder',
|
|
5
|
+
helperText: 'URL Helper Text',
|
|
6
|
+
testId: 'url-12345678',
|
|
7
|
+
hasSuggestions: false,
|
|
8
|
+
required: false,
|
|
9
|
+
disabled: false,
|
|
10
|
+
readOnly: false,
|
|
11
|
+
displayMode: ''
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const stateProps = {
|
|
15
|
+
value: '.URLSample',
|
|
16
|
+
hasSuggestions: false
|
|
17
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<div *ngIf="displayMode$; else noDisplayMode">
|
|
2
|
+
<component-mapper *ngIf="bVisible$ !== false" name="FieldValueList" [props]="{ label$, value$, displayMode$ }"></component-mapper>
|
|
3
|
+
</div>
|
|
4
|
+
{{! pick new delimiters for mustache }}
|
|
5
|
+
{{=<% %>=}}
|
|
6
|
+
<ng-template #noDisplayMode>
|
|
7
|
+
<div *ngIf="!bReadonly$ && bHasForm$; else noEdit">
|
|
8
|
+
<div [formGroup]="formGroup$" *ngIf="bVisible$">
|
|
9
|
+
<mat-form-field class="psdk-full-width" subscriptSizing="dynamic" [hintLabel]="helperText">
|
|
10
|
+
<mat-label>{{ label$ }}</mat-label>
|
|
11
|
+
<input
|
|
12
|
+
matInput
|
|
13
|
+
[placeholder]="placeholder"
|
|
14
|
+
type="url"
|
|
15
|
+
[value]="value$"
|
|
16
|
+
[required]="bRequired$"
|
|
17
|
+
[formControl]="fieldControl"
|
|
18
|
+
(change)="fieldOnChange($event)"
|
|
19
|
+
(blur)="fieldOnBlur($event)"
|
|
20
|
+
/>
|
|
21
|
+
<mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
|
|
22
|
+
</mat-form-field>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</ng-template>
|
|
26
|
+
<%={{ }}=%> {{! revert delimiters for mustache }}
|
|
27
|
+
<ng-template #noEdit>
|
|
28
|
+
<component-mapper *ngIf="bVisible$ !== false" name="Text" [props]="{ pConn$, formatAs$: 'url' }"></component-mapper>
|
|
29
|
+
</ng-template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.psdk-full-width {
|
|
2
|
+
width: 100%;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.psdk-label-readonly {
|
|
6
|
+
font-size: 1rem;
|
|
7
|
+
display: block;
|
|
8
|
+
transform: translateY(-1.28125em) scale(0.75) perspective(100px) translateZ(0.001px);
|
|
9
|
+
-ms-transform: translateY(-1.28125em) scale(0.75);
|
|
10
|
+
width: 133.33333%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.psdk-data-readonly {
|
|
14
|
+
padding-top: 0.625rem;
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
::ng-deep .mat-mdc-form-field-infix {
|
|
19
|
+
width: auto;
|
|
20
|
+
}
|