@pega/custom-dx-components 2.0.18 → 2.0.19
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/Boolean/demo.stories.jsx.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +11 -6
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +11 -7
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +9 -8
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +16 -10
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +9 -7
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +8 -8
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +6 -6
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +6 -6
- package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +3 -174
- package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.js.mustache +172 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +10 -5
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +59 -51
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +64 -59
- package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +43 -39
- package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +46 -46
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +24 -25
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +2 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +2 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +6 -6
- package/src/tasks/init/template/package.json.mustache +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { withKnobs
|
|
1
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
2
2
|
import { configProps, stateProps } from './mock.stories';
|
|
3
3
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
4
4
|
|
|
@@ -26,8 +26,13 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
26
26
|
return {
|
|
27
27
|
getActionsApi: () => {
|
|
28
28
|
return {
|
|
29
|
-
updateFieldValue: () => {},
|
|
30
|
-
triggerFieldChange: () => {}
|
|
29
|
+
updateFieldValue: () => {/* nothing */},
|
|
30
|
+
triggerFieldChange: () => {/* nothing */}
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
getValidationApi: () => {
|
|
34
|
+
return {
|
|
35
|
+
validate: () => {/* nothing */}
|
|
31
36
|
};
|
|
32
37
|
},
|
|
33
38
|
getStateProps: () => {
|
|
@@ -36,9 +41,9 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
36
41
|
getConfigProps: () => {
|
|
37
42
|
return configProps;
|
|
38
43
|
},
|
|
39
|
-
ignoreSuggestion: () => {},
|
|
40
|
-
acceptSuggestion: () => {},
|
|
41
|
-
clearErrorMessages: () => {}
|
|
44
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
45
|
+
acceptSuggestion: () => {/* nothing */},
|
|
46
|
+
clearErrorMessages: () => {/* nothing */}
|
|
42
47
|
};
|
|
43
48
|
},
|
|
44
49
|
value: configProps.value,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
|
|
1
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
2
|
import { configProps, stateProps } from './mock.stories';
|
|
4
3
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
5
4
|
|
|
@@ -27,8 +26,13 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
27
26
|
return {
|
|
28
27
|
getActionsApi: () => {
|
|
29
28
|
return {
|
|
30
|
-
updateFieldValue: () => {},
|
|
31
|
-
triggerFieldChange: () => {}
|
|
29
|
+
updateFieldValue: () => {/* nothing */},
|
|
30
|
+
triggerFieldChange: () => {/* nothing */}
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
getValidationApi: () => {
|
|
34
|
+
return {
|
|
35
|
+
validate: () => {/* nothing */}
|
|
32
36
|
};
|
|
33
37
|
},
|
|
34
38
|
getStateProps: () => {
|
|
@@ -37,9 +41,9 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
37
41
|
getConfigProps: () => {
|
|
38
42
|
return configProps;
|
|
39
43
|
},
|
|
40
|
-
ignoreSuggestion: () => {},
|
|
41
|
-
acceptSuggestion: () => {},
|
|
42
|
-
clearErrorMessages: () => {}
|
|
44
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
45
|
+
acceptSuggestion: () => {/* nothing */},
|
|
46
|
+
clearErrorMessages: () => {/* nothing */}
|
|
43
47
|
};
|
|
44
48
|
},
|
|
45
49
|
value: configProps.value,
|
|
@@ -20,7 +20,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
20
20
|
showGroupSeparators: configProps.showGroupSeparators,
|
|
21
21
|
hasSuggestions: configProps.hasSuggestions,
|
|
22
22
|
testId: configProps.testId,
|
|
23
|
-
fieldMetadata
|
|
23
|
+
fieldMetadata,
|
|
24
24
|
|
|
25
25
|
getPConnect: () => {
|
|
26
26
|
return {
|
|
@@ -29,14 +29,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
29
29
|
},
|
|
30
30
|
getActionsApi: () => {
|
|
31
31
|
return {
|
|
32
|
-
updateFieldValue: () => {},
|
|
33
|
-
triggerFieldChange: () => {}
|
|
32
|
+
updateFieldValue: () => {/* nothing */},
|
|
33
|
+
triggerFieldChange: () => {/* nothing */}
|
|
34
34
|
};
|
|
35
35
|
},
|
|
36
|
-
ignoreSuggestion: () => {},
|
|
37
|
-
acceptSuggestion: () => {},
|
|
38
|
-
setInheritedProps: () => {},
|
|
39
|
-
resolveConfigProps: () => {}
|
|
36
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
37
|
+
acceptSuggestion: () => {/* nothing */},
|
|
38
|
+
setInheritedProps: () => {/* nothing */},
|
|
39
|
+
resolveConfigProps: () => {/* nothing */}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
};
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache
CHANGED
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
14
14
|
|
|
15
15
|
const props = {
|
|
16
|
-
value: configProps.value,
|
|
16
|
+
value: Number(configProps.value),
|
|
17
17
|
placeholder: configProps.placeholder,
|
|
18
18
|
label: configProps.label,
|
|
19
19
|
helperText: configProps.helperText,
|
|
@@ -23,7 +23,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
23
23
|
alwaysShowISOCode: configProps.alwaysShowISOCode,
|
|
24
24
|
hasSuggestions: configProps.hasSuggestions,
|
|
25
25
|
testId: configProps.testId,
|
|
26
|
-
fieldMetadata
|
|
26
|
+
fieldMetadata,
|
|
27
27
|
|
|
28
28
|
getPConnect: () => {
|
|
29
29
|
return {
|
|
@@ -32,14 +32,15 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
32
32
|
},
|
|
33
33
|
getActionsApi: () => {
|
|
34
34
|
return {
|
|
35
|
-
updateFieldValue: () => {},
|
|
36
|
-
triggerFieldChange: () => {}
|
|
35
|
+
updateFieldValue: () => {/* nothing */},
|
|
36
|
+
triggerFieldChange: () => {/* nothing */}
|
|
37
37
|
};
|
|
38
38
|
},
|
|
39
|
-
ignoreSuggestion: () => {},
|
|
40
|
-
acceptSuggestion: () => {},
|
|
41
|
-
setInheritedProps: () => {},
|
|
42
|
-
resolveConfigProps: () => {}
|
|
39
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
40
|
+
acceptSuggestion: () => {/* nothing */},
|
|
41
|
+
setInheritedProps: () => {/* nothing */},
|
|
42
|
+
resolveConfigProps: () => {/* nothing */},
|
|
43
|
+
clearErrorMessages: () => {/* nothing */}
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
};
|
package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache
CHANGED
|
@@ -20,7 +20,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
20
20
|
showGroupSeparators: configProps.showGroupSeparators,
|
|
21
21
|
hasSuggestions: configProps.hasSuggestions,
|
|
22
22
|
testId: configProps.testId,
|
|
23
|
-
fieldMetadata
|
|
23
|
+
fieldMetadata,
|
|
24
24
|
|
|
25
25
|
getPConnect: () => {
|
|
26
26
|
return {
|
|
@@ -29,14 +29,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
29
29
|
},
|
|
30
30
|
getActionsApi: () => {
|
|
31
31
|
return {
|
|
32
|
-
updateFieldValue: () => {},
|
|
33
|
-
triggerFieldChange: () => {}
|
|
32
|
+
updateFieldValue: () => {/* nothing */},
|
|
33
|
+
triggerFieldChange: () => {/* nothing */}
|
|
34
34
|
};
|
|
35
35
|
},
|
|
36
|
-
ignoreSuggestion: () => {},
|
|
37
|
-
acceptSuggestion: () => {},
|
|
38
|
-
setInheritedProps: () => {},
|
|
39
|
-
resolveConfigProps: () => {}
|
|
36
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
37
|
+
acceptSuggestion: () => {/* nothing */},
|
|
38
|
+
setInheritedProps: () => {/* nothing */},
|
|
39
|
+
resolveConfigProps: () => {/* nothing */}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
};
|
|
@@ -20,7 +20,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
20
20
|
showGroupSeparators: configProps.showGroupSeparators,
|
|
21
21
|
hasSuggestions: configProps.hasSuggestions,
|
|
22
22
|
testId: configProps.testId,
|
|
23
|
-
fieldMetadata
|
|
23
|
+
fieldMetadata,
|
|
24
24
|
|
|
25
25
|
getPConnect: () => {
|
|
26
26
|
return {
|
|
@@ -29,14 +29,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
29
29
|
},
|
|
30
30
|
getActionsApi: () => {
|
|
31
31
|
return {
|
|
32
|
-
updateFieldValue: () => {},
|
|
33
|
-
triggerFieldChange: () => {}
|
|
32
|
+
updateFieldValue: () => {/* nothing */},
|
|
33
|
+
triggerFieldChange: () => {/* nothing */}
|
|
34
34
|
};
|
|
35
35
|
},
|
|
36
|
-
ignoreSuggestion: () => {},
|
|
37
|
-
acceptSuggestion: () => {},
|
|
38
|
-
setInheritedProps: () => {},
|
|
39
|
-
resolveConfigProps: () => {}
|
|
36
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
37
|
+
acceptSuggestion: () => {/* nothing */},
|
|
38
|
+
setInheritedProps: () => {/* nothing */},
|
|
39
|
+
resolveConfigProps: () => {/* nothing */}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
};
|
|
@@ -12,6 +12,7 @@ export default {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
15
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
15
16
|
const [value, setValue] = useState(configProps.value);
|
|
16
17
|
|
|
17
18
|
const props = {
|
|
@@ -22,7 +23,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
22
23
|
datasource: configProps.datasource,
|
|
23
24
|
testId: configProps.testId,
|
|
24
25
|
hasSuggestions: configProps.hasSuggestions,
|
|
25
|
-
fieldMetadata
|
|
26
|
+
fieldMetadata,
|
|
26
27
|
|
|
27
28
|
getPConnect: () => {
|
|
28
29
|
return {
|
|
@@ -32,8 +33,8 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
32
33
|
getStateProps: () => {
|
|
33
34
|
return stateProps;
|
|
34
35
|
},
|
|
35
|
-
getLocalizedValue:
|
|
36
|
-
return
|
|
36
|
+
getLocalizedValue: val => {
|
|
37
|
+
return val;
|
|
37
38
|
},
|
|
38
39
|
getLocaleRuleNameFromKeys: (localeClass, localeContext, localeName) => {
|
|
39
40
|
return `${localeClass}!${localeContext}!${localeName}`;
|
|
@@ -50,16 +51,21 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
50
51
|
},
|
|
51
52
|
getActionsApi: () => {
|
|
52
53
|
return {
|
|
53
|
-
updateFieldValue: (propName,
|
|
54
|
-
setValue(
|
|
54
|
+
updateFieldValue: (propName, theValue) => {
|
|
55
|
+
setValue(theValue);
|
|
55
56
|
},
|
|
56
|
-
triggerFieldChange: () => {}
|
|
57
|
+
triggerFieldChange: () => {/* nothing */}
|
|
57
58
|
};
|
|
58
59
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
getValidationApi: () => {
|
|
61
|
+
return {
|
|
62
|
+
validate: () => {/* nothing */}
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
66
|
+
acceptSuggestion: () => {/* nothing */},
|
|
67
|
+
setInheritedProps: () => {/* nothing */},
|
|
68
|
+
resolveConfigProps: () => {/* nothing */}
|
|
63
69
|
};
|
|
64
70
|
}
|
|
65
71
|
};
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
15
|
-
|
|
15
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
16
16
|
const [value, setValue] = useState(configProps.value);
|
|
17
17
|
|
|
18
18
|
const props = {
|
|
@@ -29,14 +29,16 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
29
29
|
},
|
|
30
30
|
getActionsApi: () => {
|
|
31
31
|
return {
|
|
32
|
-
updateFieldValue: () => {
|
|
33
|
-
|
|
32
|
+
updateFieldValue: (propName, theValue) => {
|
|
33
|
+
setValue(theValue);
|
|
34
|
+
},
|
|
35
|
+
triggerFieldChange: () => {/* nothing */}
|
|
34
36
|
};
|
|
35
37
|
},
|
|
36
|
-
ignoreSuggestion: () => {},
|
|
37
|
-
acceptSuggestion: () => {},
|
|
38
|
-
setInheritedProps: () => {},
|
|
39
|
-
resolveConfigProps: () => {}
|
|
38
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
39
|
+
acceptSuggestion: () => {/* nothing */},
|
|
40
|
+
setInheritedProps: () => {/* nothing */},
|
|
41
|
+
resolveConfigProps: () => {/* nothing */}
|
|
40
42
|
};
|
|
41
43
|
}
|
|
42
44
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { withKnobs
|
|
1
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
2
2
|
|
|
3
3
|
import {{COMPONENT_CLASS_NAME}} from './index.jsx';
|
|
4
4
|
|
|
@@ -19,7 +19,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
19
19
|
helperText: configProps.helperText,
|
|
20
20
|
testId: configProps.testId,
|
|
21
21
|
hasSuggestions: configProps.hasSuggestions,
|
|
22
|
-
fieldMetadata
|
|
22
|
+
fieldMetadata,
|
|
23
23
|
|
|
24
24
|
getPConnect: () => {
|
|
25
25
|
return {
|
|
@@ -28,14 +28,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
28
28
|
},
|
|
29
29
|
getActionsApi: () => {
|
|
30
30
|
return {
|
|
31
|
-
updateFieldValue: () => {},
|
|
32
|
-
triggerFieldChange: () => {}
|
|
31
|
+
updateFieldValue: () => {/* nothing */},
|
|
32
|
+
triggerFieldChange: () => {/* nothing */}
|
|
33
33
|
};
|
|
34
34
|
},
|
|
35
|
-
ignoreSuggestion: () => {},
|
|
36
|
-
acceptSuggestion: () => {},
|
|
37
|
-
setInheritedProps: () => {},
|
|
38
|
-
resolveConfigProps: () => {}
|
|
35
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
36
|
+
acceptSuggestion: () => {/* nothing */},
|
|
37
|
+
setInheritedProps: () => {/* nothing */},
|
|
38
|
+
resolveConfigProps: () => {/* nothing */}
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
};
|
|
@@ -19,7 +19,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
19
19
|
helperText: configProps.helperText,
|
|
20
20
|
testId: configProps.testId,
|
|
21
21
|
hasSuggestions: configProps.hasSuggestions,
|
|
22
|
-
fieldMetadata
|
|
22
|
+
fieldMetadata,
|
|
23
23
|
|
|
24
24
|
getPConnect: () => {
|
|
25
25
|
return {
|
|
@@ -28,14 +28,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
28
28
|
},
|
|
29
29
|
getActionsApi: () => {
|
|
30
30
|
return {
|
|
31
|
-
updateFieldValue: () => {},
|
|
32
|
-
triggerFieldChange: () => {}
|
|
31
|
+
updateFieldValue: () => {/* nothing */},
|
|
32
|
+
triggerFieldChange: () => {/* nothing */}
|
|
33
33
|
};
|
|
34
34
|
},
|
|
35
|
-
ignoreSuggestion: () => {},
|
|
36
|
-
acceptSuggestion: () => {},
|
|
37
|
-
setInheritedProps: () => {},
|
|
38
|
-
resolveConfigProps: () => {}
|
|
35
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
36
|
+
acceptSuggestion: () => {/* nothing */},
|
|
37
|
+
setInheritedProps: () => {/* nothing */},
|
|
38
|
+
resolveConfigProps: () => {/* nothing */}
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
};
|
package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache
CHANGED
|
@@ -19,7 +19,7 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
19
19
|
helperText: configProps.helperText,
|
|
20
20
|
testId: configProps.testId,
|
|
21
21
|
hasSuggestions: configProps.hasSuggestions,
|
|
22
|
-
fieldMetadata
|
|
22
|
+
fieldMetadata,
|
|
23
23
|
|
|
24
24
|
getPConnect: () => {
|
|
25
25
|
return {
|
|
@@ -28,14 +28,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
28
28
|
},
|
|
29
29
|
getActionsApi: () => {
|
|
30
30
|
return {
|
|
31
|
-
updateFieldValue: () => {},
|
|
32
|
-
triggerFieldChange: () => {}
|
|
31
|
+
updateFieldValue: () => {/* nothing */},
|
|
32
|
+
triggerFieldChange: () => {/* nothing */}
|
|
33
33
|
};
|
|
34
34
|
},
|
|
35
|
-
ignoreSuggestion: () => {},
|
|
36
|
-
acceptSuggestion: () => {},
|
|
37
|
-
setInheritedProps: () => {},
|
|
38
|
-
resolveConfigProps: () => {}
|
|
35
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
36
|
+
acceptSuggestion: () => {/* nothing */},
|
|
37
|
+
setInheritedProps: () => {/* nothing */},
|
|
38
|
+
resolveConfigProps: () => {/* nothing */}
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
};
|
|
@@ -26,14 +26,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
26
26
|
},
|
|
27
27
|
getActionsApi: () => {
|
|
28
28
|
return {
|
|
29
|
-
updateFieldValue: () => {},
|
|
30
|
-
triggerFieldChange: () => {}
|
|
29
|
+
updateFieldValue: () => {/* nothing */},
|
|
30
|
+
triggerFieldChange: () => {/* nothing */}
|
|
31
31
|
};
|
|
32
32
|
},
|
|
33
|
-
ignoreSuggestion: () => {},
|
|
34
|
-
acceptSuggestion: () => {},
|
|
35
|
-
setInheritedProps: () => {},
|
|
36
|
-
resolveConfigProps: () => {}
|
|
33
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
34
|
+
acceptSuggestion: () => {/* nothing */},
|
|
35
|
+
setInheritedProps: () => {/* nothing */},
|
|
36
|
+
resolveConfigProps: () => {/* nothing */}
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
};
|
|
@@ -245,7 +245,7 @@ const {{COMPONENT_CLASS_NAME}} = props => {
|
|
|
245
245
|
{{COMPONENT_CLASS_NAME}}.propTypes = {
|
|
246
246
|
value: PropTypes.string,
|
|
247
247
|
placeholder: PropTypes.string,
|
|
248
|
-
datasource: PropTypes.
|
|
248
|
+
datasource: PropTypes.objectOf(PropTypes.any),
|
|
249
249
|
label: PropTypes.string.isRequired,
|
|
250
250
|
hideLabel: PropTypes.bool,
|
|
251
251
|
getPConnect: PropTypes.func.isRequired,
|
|
@@ -26,14 +26,14 @@ export const base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
26
26
|
},
|
|
27
27
|
getActionsApi: () => {
|
|
28
28
|
return {
|
|
29
|
-
updateFieldValue: () => {},
|
|
30
|
-
triggerFieldChange: () => {}
|
|
29
|
+
updateFieldValue: () => {/* nothing */},
|
|
30
|
+
triggerFieldChange: () => {/* nothing */}
|
|
31
31
|
};
|
|
32
32
|
},
|
|
33
|
-
ignoreSuggestion: () => {},
|
|
34
|
-
acceptSuggestion: () => {},
|
|
35
|
-
setInheritedProps: () => {},
|
|
36
|
-
resolveConfigProps: () => {}
|
|
33
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
34
|
+
acceptSuggestion: () => {/* nothing */},
|
|
35
|
+
setInheritedProps: () => {/* nothing */},
|
|
36
|
+
resolveConfigProps: () => {/* nothing */}
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
};
|
|
@@ -1,185 +1,14 @@
|
|
|
1
|
-
import { useState, useEffect, useRef
|
|
2
|
-
import { Input, FieldValueList, Text
|
|
1
|
+
import { useState, useEffect, useRef} from "react";
|
|
2
|
+
import { Input, FieldValueList, Text } from "@pega/cosmos-react-core";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
|
|
5
5
|
// includes in bundle
|
|
6
|
+
import {formatExists,textFormatter, urlFormatter, suggestionHandler} from "./text-url";
|
|
6
7
|
import handleEvent from "./event-utils";
|
|
7
8
|
import { suggestionsHandler } from './suggestions-handler';
|
|
8
9
|
|
|
9
10
|
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
10
11
|
|
|
11
|
-
export const formatExists = (formatterVal) => {
|
|
12
|
-
const formatterValues = [
|
|
13
|
-
"TextInput",
|
|
14
|
-
"WorkStatus",
|
|
15
|
-
"RichText",
|
|
16
|
-
"Email",
|
|
17
|
-
"Phone",
|
|
18
|
-
"URL",
|
|
19
|
-
"Operator"
|
|
20
|
-
];
|
|
21
|
-
let isformatter = false;
|
|
22
|
-
if (formatterValues.includes(formatterVal)) {
|
|
23
|
-
isformatter = true;
|
|
24
|
-
}
|
|
25
|
-
return isformatter;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const urlLabelVal = (urlLabelSelection, btnVal, urlLabel, propUrlLabel) => {
|
|
29
|
-
if ((urlLabel !== '' || propUrlLabel !== '') && btnVal !== null) {
|
|
30
|
-
switch (urlLabelSelection) {
|
|
31
|
-
case 'constant': {
|
|
32
|
-
btnVal = urlLabel;
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
case 'propertyRef': {
|
|
36
|
-
btnVal = propUrlLabel;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
// no default
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return btnVal;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const isImage = (url) => /\.(jpg|jpeg|png|webp|avif|gif|svg)$/.test(url);
|
|
46
|
-
|
|
47
|
-
const TableImage = (imageProps) => {
|
|
48
|
-
const { value, altText, altTextOfImage, propaltTextOfImage, urlLabelSelection, urlLabel, propUrlLabel } = imageProps;
|
|
49
|
-
const demoButtonRef = useRef(null);
|
|
50
|
-
let imageDisplayComp = null;
|
|
51
|
-
const [images, setImages] = useState(null);
|
|
52
|
-
const imgDescription = {
|
|
53
|
-
id: 'url',
|
|
54
|
-
name: urlLabelSelection === 'constant' ? urlLabel : propUrlLabel,
|
|
55
|
-
description: altText === 'constant' ? altTextOfImage : propaltTextOfImage,
|
|
56
|
-
src: value
|
|
57
|
-
};
|
|
58
|
-
const onClick = () => {
|
|
59
|
-
setImages([imgDescription]);
|
|
60
|
-
};
|
|
61
|
-
const onItemDownload = async (id) => {
|
|
62
|
-
const a = document.createElement('a');
|
|
63
|
-
a.href = await fetch(images[0].src)
|
|
64
|
-
.then((response) => {
|
|
65
|
-
return response.blob();
|
|
66
|
-
})
|
|
67
|
-
.then((blob) => {
|
|
68
|
-
return URL.createObjectURL(blob);
|
|
69
|
-
});
|
|
70
|
-
a.download = images?.find((image) => image.id === id)?.name ?? id;
|
|
71
|
-
document.body.appendChild(a);
|
|
72
|
-
a.click();
|
|
73
|
-
document.body.removeChild(a);
|
|
74
|
-
};
|
|
75
|
-
let btnVal = value;
|
|
76
|
-
btnVal = urlLabelVal(urlLabelSelection, btnVal, urlLabel, propUrlLabel);
|
|
77
|
-
imageDisplayComp = (
|
|
78
|
-
<React.Fragment>
|
|
79
|
-
{btnVal !== null && (
|
|
80
|
-
<Button ref={demoButtonRef} variant='link' compact={false} onClick={onClick} autoFocus>
|
|
81
|
-
{btnVal}
|
|
82
|
-
</Button>
|
|
83
|
-
)}
|
|
84
|
-
{images && (
|
|
85
|
-
<Lightbox
|
|
86
|
-
items={images}
|
|
87
|
-
cycle={false}
|
|
88
|
-
onAfterClose={() => {
|
|
89
|
-
setImages(null);
|
|
90
|
-
demoButtonRef.current?.focus();
|
|
91
|
-
}}
|
|
92
|
-
onItemDownload={isImage(images[0].src) ? onItemDownload : undefined}
|
|
93
|
-
/>
|
|
94
|
-
)}
|
|
95
|
-
</React.Fragment>
|
|
96
|
-
);
|
|
97
|
-
return imageDisplayComp;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export const textFormatter = (formatter,value) => {
|
|
101
|
-
let displayComponent = null;
|
|
102
|
-
switch(formatter){
|
|
103
|
-
case "TextInput" : {
|
|
104
|
-
displayComponent = value;
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
case "Email" : {
|
|
108
|
-
displayComponent = (<EmailDisplay value={value} displayText={value} variant="link" />);
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
case "Phone" : {
|
|
112
|
-
displayComponent = (<PhoneDisplay value={value} variant="link" />);
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
case "URL" : {
|
|
116
|
-
displayComponent = (<URLDisplay target="_blank" value={value} displayText={value} variant="link" />);
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
// no default
|
|
120
|
-
}
|
|
121
|
-
return displayComponent;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Returns a URL display component based on the options
|
|
126
|
-
* @function urlFormatter
|
|
127
|
-
* @param {string} value value
|
|
128
|
-
* @param {object} options options for formatting
|
|
129
|
-
* { displayAs,tableDisplayAs,isTableFormatter,altText,altTextOfImage,propaltTextOfImage,urlLabelSelection, urlLabel,propUrlLabel, widthSel, customWidth}
|
|
130
|
-
*/
|
|
131
|
-
export const urlFormatter = (value, options) => {
|
|
132
|
-
const {
|
|
133
|
-
displayAs,
|
|
134
|
-
tableDisplayAs,
|
|
135
|
-
isTableFormatter,
|
|
136
|
-
altText,
|
|
137
|
-
altTextOfImage,
|
|
138
|
-
propaltTextOfImage,
|
|
139
|
-
urlLabelSelection,
|
|
140
|
-
urlLabel,
|
|
141
|
-
propUrlLabel,
|
|
142
|
-
widthSel,
|
|
143
|
-
customWidth
|
|
144
|
-
} = options;
|
|
145
|
-
|
|
146
|
-
let urlFormatComp = null;
|
|
147
|
-
if (
|
|
148
|
-
(displayAs === 'labelText' || (isTableFormatter && tableDisplayAs === 'link')) &&
|
|
149
|
-
(urlLabel !== '' || propUrlLabel !== '')
|
|
150
|
-
) {
|
|
151
|
-
urlFormatComp = (
|
|
152
|
-
<URLDisplay
|
|
153
|
-
target='_blank'
|
|
154
|
-
value={value}
|
|
155
|
-
displayText={urlLabelSelection === 'constant' ? urlLabel : propUrlLabel}
|
|
156
|
-
variant='link'
|
|
157
|
-
/>
|
|
158
|
-
);
|
|
159
|
-
} else if ((displayAs === 'Image' || tableDisplayAs === 'Image') && !!value) {
|
|
160
|
-
if (isTableFormatter) {
|
|
161
|
-
urlFormatComp = TableImage({
|
|
162
|
-
value,
|
|
163
|
-
altText,
|
|
164
|
-
altTextOfImage,
|
|
165
|
-
propaltTextOfImage,
|
|
166
|
-
urlLabelSelection,
|
|
167
|
-
urlLabel,
|
|
168
|
-
propUrlLabel
|
|
169
|
-
});
|
|
170
|
-
} else {
|
|
171
|
-
const width = widthSel === 'widthpx' ? customWidth : null;
|
|
172
|
-
urlFormatComp = (
|
|
173
|
-
<Image src={value} width={width} alt={altText === 'constant' ? altTextOfImage : propaltTextOfImage} />
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
} else {
|
|
177
|
-
urlFormatComp = <URLDisplay target='_blank' value={value} displayText={value} variant='link' />;
|
|
178
|
-
}
|
|
179
|
-
return urlFormatComp;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
|
|
183
12
|
|
|
184
13
|
// Duplicated runtime code from Constellation Design System Component
|
|
185
14
|
|