@pega/dx-component-builder-sdk 0.1.4 → 0.1.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.
- package/package.json +1 -1
- package/src/tasks/create/index.js +48 -3
- package/src/tasks/create/templates/SDK-React/Field/Boolean/demo.stories.jsx.mustache +26 -14
- package/src/tasks/create/templates/SDK-React/Field/Boolean/mock.stories.js.mustache +15 -0
- package/src/tasks/create/templates/SDK-React/Field/Date/demo.stories.jsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/Field/Date/index.tsx.mustache +3 -1
- package/src/tasks/create/templates/SDK-React/Field/DateTime/demo.stories.jsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/Field/DateTime/index.tsx.mustache +3 -1
- package/src/tasks/create/templates/SDK-React/Field/Decimal/demo.stories.jsx.mustache +17 -10
- package/src/tasks/create/templates/SDK-React/Field/Decimal/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/demo.stories.jsx.mustache +16 -10
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/demo.stories.jsx.mustache +17 -10
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/demo.stories.jsx.mustache +16 -10
- package/src/tasks/create/templates/SDK-React/Field/Integer/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/demo.stories.jsx.mustache +25 -16
- package/src/tasks/create/templates/SDK-React/Field/Picklist/mock.stories.js.mustache +30 -0
- package/src/tasks/create/templates/SDK-React/Field/Text/demo.stories.jsx.mustache +19 -3
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/demo.stories.jsx.mustache +20 -4
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/demo.stories.jsx.mustache +20 -3
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/demo.stories.jsx.mustache +19 -4
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/demo.stories.jsx.mustache +21 -3
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/demo.stories.jsx.mustache +20 -4
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/demo.stories.jsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/index.tsx.mustache +1 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/demo.stories.jsx.mustache +70 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/mock.stories.js.mustache +390 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/demo.stories.jsx.mustache +60 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/mock.stories.js.mustache +52 -0
- package/src/tasks/delete/helper.js +3 -0
- package/src/tasks/delete-all/helper.js +3 -0
- package/src/util.js +13 -7
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
2
3
|
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
4
|
import { configProps } from './mock.stories';
|
|
4
5
|
|
|
@@ -9,9 +10,10 @@ export default {
|
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
12
|
-
|
|
13
|
+
const [value, setValue] = useState(configProps.value);
|
|
14
|
+
|
|
13
15
|
const props = {
|
|
14
|
-
value
|
|
16
|
+
value,
|
|
15
17
|
placeholder: configProps.placeholder,
|
|
16
18
|
label: configProps.label,
|
|
17
19
|
testId: configProps.testId,
|
|
@@ -21,7 +23,21 @@ export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
21
23
|
required: configProps.required,
|
|
22
24
|
readOnly: configProps.readOnly,
|
|
23
25
|
displayMode: configProps.displayMode,
|
|
24
|
-
|
|
26
|
+
getPConnect: () => {
|
|
27
|
+
return {
|
|
28
|
+
getActionsApi: () => {
|
|
29
|
+
return {
|
|
30
|
+
updateFieldValue: (propName, theValue) => {
|
|
31
|
+
setValue(theValue);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
getStateProps: () => {
|
|
36
|
+
return { value: '.name' };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
onChange: (event) => { setValue(event.target.value); },
|
|
25
41
|
onBlur: () => { return configProps.value; }
|
|
26
42
|
};
|
|
27
43
|
return (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
2
3
|
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
4
|
import { configProps, fieldMetadata } from './mock.stories';
|
|
4
5
|
|
|
@@ -9,15 +10,31 @@ export default {
|
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
+
const [value, setValue] = useState(configProps.value);
|
|
14
|
+
|
|
12
15
|
const props = {
|
|
13
|
-
value
|
|
16
|
+
value,
|
|
14
17
|
placeholder: configProps.placeholder,
|
|
15
18
|
label: configProps.label,
|
|
16
19
|
helperText: configProps.helperText,
|
|
17
20
|
testId: configProps.testId,
|
|
18
21
|
hasSuggestions: configProps.hasSuggestions,
|
|
19
22
|
fieldMetadata,
|
|
20
|
-
|
|
23
|
+
getPConnect: () => {
|
|
24
|
+
return {
|
|
25
|
+
getActionsApi: () => {
|
|
26
|
+
return {
|
|
27
|
+
updateFieldValue: (propName, theValue) => {
|
|
28
|
+
setValue(theValue);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
getStateProps: () => {
|
|
33
|
+
return { value: '.name' };
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
onChange: (event) => { setValue(event.target.value); },
|
|
21
38
|
onBlur: () => { return configProps.value; }
|
|
22
39
|
};
|
|
23
40
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {{COMPONENT_CLASS_NAME}} from './index.
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
3
3
|
import { configProps, fieldMetadata } from './mock.stories';
|
|
4
4
|
import { withKnobs } from '@storybook/addon-knobs';
|
|
5
5
|
|
|
@@ -10,9 +10,10 @@ export default {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
+
const [value, setValue] = useState(configProps.value);
|
|
13
14
|
|
|
14
15
|
const props = {
|
|
15
|
-
value
|
|
16
|
+
value,
|
|
16
17
|
placeholder: configProps.placeholder,
|
|
17
18
|
label: configProps.label,
|
|
18
19
|
testId: configProps.testId,
|
|
@@ -23,7 +24,21 @@ export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
23
24
|
readOnly: configProps.readOnly,
|
|
24
25
|
displayMode: configProps.displayMode,
|
|
25
26
|
fieldMetadata,
|
|
26
|
-
|
|
27
|
+
getPConnect: () => {
|
|
28
|
+
return {
|
|
29
|
+
getActionsApi: () => {
|
|
30
|
+
return {
|
|
31
|
+
updateFieldValue: (propName, theValue) => {
|
|
32
|
+
setValue(theValue);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
getStateProps: () => {
|
|
37
|
+
return { value: '.name' };
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
onChange: (event) => { setValue(event.target.value); },
|
|
27
42
|
onBlur: () => { return configProps.value; }
|
|
28
43
|
};
|
|
29
44
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
2
3
|
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
4
|
import { configProps } from './mock.stories';
|
|
4
5
|
|
|
@@ -9,9 +10,10 @@ export default {
|
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
+
const [value, setValue] = useState(configProps.value);
|
|
12
14
|
|
|
13
15
|
const props = {
|
|
14
|
-
value
|
|
16
|
+
value,
|
|
15
17
|
placeholder: configProps.placeholder,
|
|
16
18
|
label: configProps.label,
|
|
17
19
|
testId: configProps.testId,
|
|
@@ -21,7 +23,23 @@ export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
21
23
|
required: configProps.required,
|
|
22
24
|
readOnly: configProps.readOnly,
|
|
23
25
|
displayMode: configProps.displayMode,
|
|
24
|
-
|
|
26
|
+
getPConnect: () => {
|
|
27
|
+
return {
|
|
28
|
+
getActionsApi: () => {
|
|
29
|
+
return {
|
|
30
|
+
updateFieldValue: (propName, theValue) => {
|
|
31
|
+
setValue(theValue);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
getStateProps: () => {
|
|
36
|
+
return { value: '.name' };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
onChange: phone => {
|
|
41
|
+
setValue(phone.value);
|
|
42
|
+
},
|
|
25
43
|
onBlur: () => { return configProps.value; }
|
|
26
44
|
};
|
|
27
45
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
1
2
|
import { withKnobs } from '@storybook/addon-knobs';
|
|
2
|
-
import {{COMPONENT_CLASS_NAME}} from './index.
|
|
3
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
3
4
|
import { configProps } from './mock.stories';
|
|
4
5
|
|
|
5
6
|
export default {
|
|
@@ -9,9 +10,10 @@ export default {
|
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
+
const [value, setValue] = useState(configProps.value);
|
|
12
14
|
|
|
13
15
|
const props = {
|
|
14
|
-
value
|
|
16
|
+
value,
|
|
15
17
|
placeholder: configProps.placeholder,
|
|
16
18
|
label: configProps.label,
|
|
17
19
|
testId: configProps.testId,
|
|
@@ -21,8 +23,22 @@ export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
21
23
|
required: configProps.required,
|
|
22
24
|
readOnly: configProps.readOnly,
|
|
23
25
|
displayMode: configProps.displayMode,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
getPConnect: () => {
|
|
27
|
+
return {
|
|
28
|
+
getActionsApi: () => {
|
|
29
|
+
return {
|
|
30
|
+
updateFieldValue: (propName, theValue) => {
|
|
31
|
+
setValue(theValue);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
getStateProps: () => {
|
|
36
|
+
return { value: '.name' };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
onChange: (event) => { setValue(event.target.value); },
|
|
41
|
+
onBlur: () => { return configProps.value; }
|
|
26
42
|
};
|
|
27
43
|
|
|
28
44
|
return (
|
|
@@ -3,7 +3,7 @@ import { withKnobs } from '@storybook/addon-knobs';
|
|
|
3
3
|
|
|
4
4
|
import { configProps, stateProps } from './mock.stories';
|
|
5
5
|
|
|
6
|
-
import {{COMPONENT_CLASS_NAME}} from './index.
|
|
6
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
title: '{{COMPONENT_CLASS_NAME}}',
|
|
@@ -9,6 +9,7 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
|
|
10
10
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
// Duplicated runtime code from React SDK
|
|
13
14
|
|
|
14
15
|
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
2
|
+
|
|
3
|
+
import { historyData } from './mock.stories';
|
|
4
|
+
|
|
5
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: '{{COMPONENT_CLASS_NAME}}',
|
|
9
|
+
decorators: [withKnobs],
|
|
10
|
+
component: {{COMPONENT_CLASS_NAME}}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
if (!window.PCore) {
|
|
14
|
+
window.PCore = {};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
window.PCore.getConstants = () => {
|
|
18
|
+
return {
|
|
19
|
+
CASE_INFO: {
|
|
20
|
+
CASE_INFO_ID: 'caseInfo.ID'
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
window.PCore.getDataApiUtils = () => {
|
|
26
|
+
return {
|
|
27
|
+
getData: () => {
|
|
28
|
+
return new Promise(resolve => {
|
|
29
|
+
resolve(historyData);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
36
|
+
|
|
37
|
+
const props = {
|
|
38
|
+
label: 'Case history',
|
|
39
|
+
|
|
40
|
+
getPConnect: () => {
|
|
41
|
+
return {
|
|
42
|
+
getValue: value => {
|
|
43
|
+
return value;
|
|
44
|
+
},
|
|
45
|
+
getContextName: () => {
|
|
46
|
+
return 'app/primary_1';
|
|
47
|
+
},
|
|
48
|
+
getLocalizedValue: value => {
|
|
49
|
+
return value;
|
|
50
|
+
},
|
|
51
|
+
getActionsApi: () => {
|
|
52
|
+
return {
|
|
53
|
+
updateFieldValue: () => {/* nothing */},
|
|
54
|
+
triggerFieldChange: () => {/* nothing */}
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
58
|
+
acceptSuggestion: () => {/* nothing */},
|
|
59
|
+
setInheritedProps: () => {/* nothing */},
|
|
60
|
+
resolveConfigProps: () => {/* nothing */}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<>
|
|
67
|
+
<{{COMPONENT_CLASS_NAME}} {...props} />
|
|
68
|
+
</>
|
|
69
|
+
);
|
|
70
|
+
};
|