@pega/dx-component-builder-sdk 0.23.15 → 0.23.17
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/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/field/DateTime/demo.stories.tsx.mustache +8 -1
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +5 -3
- package/src/tasks/publish/index.js +3 -1
- package/src/tasks/publish-all/index.js +7 -5
- package/tests/assets/sdk-a/components/create/override-sdk/template/list-view/utils.ts +4 -2
- package/tests/assets/sdk-a/components/createAll/override-sdk/template/list-view/utils.ts +4 -2
- package/tests/assets/sdk-r/components/create/override-sdk/designSystemExtension/Operator/Operator.tsx +5 -3
- package/tests/assets/sdk-r/components/create/override-sdk/field/CancelAlert/CancelAlert.tsx +95 -78
- package/tests/assets/sdk-r/components/create/override-sdk/infra/Assignment/Assignment.tsx +21 -7
- package/tests/assets/sdk-r/components/create/override-sdk/infra/NavBar/NavBar.tsx +5 -3
- package/tests/assets/sdk-r/components/create/override-sdk/template/CaseSummary/CaseSummary.tsx +43 -1
- package/tests/assets/sdk-r/components/create/override-sdk/template/CaseView/CaseView.tsx +1 -1
- package/tests/assets/sdk-r/components/create/override-sdk/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +34 -1
- package/tests/assets/sdk-r/components/create/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +9 -11
- package/tests/assets/sdk-r/components/create/override-sdk/template/WideNarrow/WideNarrow.tsx +1 -1
- package/tests/assets/sdk-r/components/create/override-sdk/template/WssNavBar/WssNavBar.tsx +4 -1
- package/tests/assets/sdk-r/components/create/override-sdk/widget/Attachment/Attachment.tsx +12 -2
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyDateTime/demo.stories.tsx +8 -1
- package/tests/assets/sdk-r/components/createAll/custom-sdk/widget/Pega_DXIL_MyPageCaseWidget/index.tsx +5 -3
- package/tests/assets/sdk-r/components/createAll/override-sdk/designSystemExtension/Operator/Operator.tsx +5 -3
- package/tests/assets/sdk-r/components/createAll/override-sdk/field/CancelAlert/CancelAlert.tsx +95 -78
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/Assignment/Assignment.tsx +21 -7
- package/tests/assets/sdk-r/components/createAll/override-sdk/infra/NavBar/NavBar.tsx +5 -3
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseSummary/CaseSummary.tsx +43 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseView/CaseView.tsx +1 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/CaseViewActionsMenu/CaseViewActionsMenu.tsx +34 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/SimpleTableManual/SimpleTableManual.tsx +9 -11
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/WideNarrow/WideNarrow.tsx +1 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/template/WssNavBar/WssNavBar.tsx +4 -1
- package/tests/assets/sdk-r/components/createAll/override-sdk/widget/Attachment/Attachment.tsx +12 -2
- package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/PConnProps.d.ts +0 -46
- package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/demo.stories.tsx +0 -54
- package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/index.tsx +0 -73
- package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/mock.ts +0 -15
- package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyTestText/styles.ts +0 -15
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/config.json +0 -83
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/demo.stories.tsx +0 -59
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/index.tsx +0 -101
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/mock.ts +0 -16
- package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/styles.js +0 -7
- /package/src/tasks/create/templates/Constellation/field/Boolean/{demo.stories.jsx.mustache → demo.stories.tsx.mustache} +0 -0
- /package/tests/assets/sdk-r/components/createAll/custom-constellation/field/Pega_DXIL_MyBoolean/{demo.stories.jsx → demo.stories.tsx} +0 -0
package/tests/assets/sdk-r/components/createAll/override-sdk/widget/Attachment/Attachment.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-boolean-value */
|
|
2
2
|
/* eslint-disable react/no-array-index-key */
|
|
3
|
+
/* eslint-disable no-nested-ternary */
|
|
3
4
|
import { useState, useEffect, useCallback } from 'react';
|
|
4
5
|
import { CircularProgress, IconButton, Menu, MenuItem, Button } from '@material-ui/core';
|
|
5
6
|
import MoreVertIcon from '@material-ui/icons/MoreVert';
|
|
@@ -39,7 +40,10 @@ export default function Attachment(props: AttachmentProps) {
|
|
|
39
40
|
[required, disabled] = [required, disabled].map(prop => prop === true || (typeof prop === 'string' && prop === 'true'));
|
|
40
41
|
const pConn = getPConnect();
|
|
41
42
|
const caseID = PCore.getStoreValue('.pyID', 'caseInfo.content', pConn.getContextName());
|
|
42
|
-
|
|
43
|
+
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
44
|
+
const localeCategory = 'CosmosFields';
|
|
45
|
+
const uploadMultipleFilesLabel = localizedVal('file_upload_text_multiple', localeCategory);
|
|
46
|
+
const uploadSingleFileLabel = localizedVal('file_upload_text_one', localeCategory);
|
|
43
47
|
let categoryName = '';
|
|
44
48
|
if (value && value.pyCategoryName) {
|
|
45
49
|
categoryName = value.pyCategoryName;
|
|
@@ -379,7 +383,13 @@ export default function Attachment(props: AttachmentProps) {
|
|
|
379
383
|
onChange={onFileAdded}
|
|
380
384
|
/>
|
|
381
385
|
<Button style={{ textTransform: 'none' }} variant='outlined' color='primary' component='span'>
|
|
382
|
-
{allowMultiple === 'true'
|
|
386
|
+
{allowMultiple === 'true'
|
|
387
|
+
? uploadMultipleFilesLabel === 'file_upload_text_multiple'
|
|
388
|
+
? 'Choose files'
|
|
389
|
+
: uploadMultipleFilesLabel
|
|
390
|
+
: uploadSingleFileLabel === 'file_upload_text_one'
|
|
391
|
+
? 'Choose a file'
|
|
392
|
+
: uploadSingleFileLabel}
|
|
383
393
|
</Button>
|
|
384
394
|
</label>
|
|
385
395
|
</div>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {PConnect } from '@pega/pcore-pconnect-typedefs';
|
|
2
|
-
|
|
3
|
-
// PConnProps.d.ts
|
|
4
|
-
// This gives us a place to have each component (which is most DX Components) that is
|
|
5
|
-
// expected to have a getPConnect extend its props (from BaseProps)
|
|
6
|
-
// such that every component will be expected to have a getPConnect() function
|
|
7
|
-
// that returns a PConnect object. (new/better way of doing .propTypes).
|
|
8
|
-
// This PConnProps can be extended to include other props that we know are in every component
|
|
9
|
-
export interface PConnProps {
|
|
10
|
-
// getPConnect should exist for every C11n component. (add @ts-ignore in special cases where it isn't)
|
|
11
|
-
getPConnect: () => typeof PConnect;
|
|
12
|
-
|
|
13
|
-
// Allow any/all other key/value pairs in the BaseProps for now
|
|
14
|
-
// TODO: refine which other props are always expected for various component
|
|
15
|
-
// types and consider further interface "subclassing". For example, we may
|
|
16
|
-
// want to create a "BasePropsForm" that gives guidance on required, readonly, etc.
|
|
17
|
-
// and any other props that every Form component expects.
|
|
18
|
-
// For example, see the PConnFieldProps below.
|
|
19
|
-
// NOTE: if you uncomment the line below, the PConnProps type will allow
|
|
20
|
-
// otherwise undefined types to appear. This can be helpful for debugging
|
|
21
|
-
// or when adding new components whose types aren't yet known.
|
|
22
|
-
// [key: string]: any;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// PConnFieldProps extends PConnProps to bring in the common properties that are
|
|
27
|
-
// associated with most field components (ex: Dropdown, TextInput, etc.) in the
|
|
28
|
-
// components/field directory
|
|
29
|
-
export interface PConnFieldProps extends PConnProps {
|
|
30
|
-
label: string,
|
|
31
|
-
required: boolean,
|
|
32
|
-
disabled: boolean,
|
|
33
|
-
value: any,
|
|
34
|
-
validatemessage: string,
|
|
35
|
-
status?: string,
|
|
36
|
-
onChange?: any,
|
|
37
|
-
onBlur?: any,
|
|
38
|
-
readOnly: boolean,
|
|
39
|
-
testId: string,
|
|
40
|
-
helperText: string,
|
|
41
|
-
displayMode?: string,
|
|
42
|
-
hideLabel: boolean,
|
|
43
|
-
placeholder?: string,
|
|
44
|
-
fieldMetadata?: any,
|
|
45
|
-
additionalProps?: any
|
|
46
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/* eslint-disable react/jsx-no-useless-fragment */
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
import { useState } from 'react';
|
|
5
|
-
import { withKnobs } from '@storybook/addon-knobs';
|
|
6
|
-
|
|
7
|
-
import { stateProps, configProps } from './mock';
|
|
8
|
-
|
|
9
|
-
import PegaDxilMyTestText from './index';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: 'PegaDxilMyTestText',
|
|
13
|
-
decorators: [withKnobs],
|
|
14
|
-
component: PegaDxilMyTestText
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const BasePegaDxilMyTestText = () => {
|
|
18
|
-
|
|
19
|
-
const [value, setValue] = useState(configProps.value);
|
|
20
|
-
|
|
21
|
-
const props = {
|
|
22
|
-
value,
|
|
23
|
-
placeholder: configProps.placeholder,
|
|
24
|
-
label: configProps.label,
|
|
25
|
-
testId: configProps.testId,
|
|
26
|
-
hasSuggestions: configProps.hasSuggestions,
|
|
27
|
-
|
|
28
|
-
getPConnect: () => {
|
|
29
|
-
return {
|
|
30
|
-
getStateProps: () => {
|
|
31
|
-
return stateProps;
|
|
32
|
-
},
|
|
33
|
-
getActionsApi: () => {
|
|
34
|
-
return {
|
|
35
|
-
updateFieldValue: (propName, theValue) => {
|
|
36
|
-
setValue(theValue);
|
|
37
|
-
},
|
|
38
|
-
triggerFieldChange: () => {/* nothing */}
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
ignoreSuggestion: () => {/* nothing */},
|
|
42
|
-
acceptSuggestion: () => {/* nothing */},
|
|
43
|
-
setInheritedProps: () => {/* nothing */},
|
|
44
|
-
resolveConfigProps: () => {/* nothing */}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<>
|
|
51
|
-
<PegaDxilMyTestText {...props} />
|
|
52
|
-
</>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import { Input } from '@pega/cosmos-react-core';
|
|
3
|
-
|
|
4
|
-
import type { PConnFieldProps } from './PConnProps';
|
|
5
|
-
|
|
6
|
-
import StyledPegaDxilMyTestTextWrapper from './styles';
|
|
7
|
-
|
|
8
|
-
// interface for props
|
|
9
|
-
interface PegaDxilMyTestTextProps extends PConnFieldProps {
|
|
10
|
-
// If any, enter additional props that only exist on TextInput here
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// interface for StateProps object
|
|
15
|
-
interface StateProps {
|
|
16
|
-
value: string;
|
|
17
|
-
hasSuggestions: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Duplicated runtime code from Constellation Design System Component
|
|
21
|
-
|
|
22
|
-
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
23
|
-
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
24
|
-
export default function PegaDxilMyTestText(props: PegaDxilMyTestTextProps) {
|
|
25
|
-
const { getPConnect, value, placeholder, disabled, readOnly, required, label, hideLabel, testId } = props;
|
|
26
|
-
|
|
27
|
-
const pConn = getPConnect();
|
|
28
|
-
const actions = pConn.getActionsApi();
|
|
29
|
-
const stateProps = pConn.getStateProps() as StateProps;
|
|
30
|
-
const propName: string = stateProps.value;
|
|
31
|
-
|
|
32
|
-
const handleOnChange = (event: any) => {
|
|
33
|
-
const { value: updatedValue } = event.target;
|
|
34
|
-
actions.updateFieldValue(propName, updatedValue);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<StyledPegaDxilMyTestTextWrapper>
|
|
39
|
-
<Input
|
|
40
|
-
type='text'
|
|
41
|
-
value={value}
|
|
42
|
-
label={label}
|
|
43
|
-
labelHidden={hideLabel}
|
|
44
|
-
placeholder={placeholder}
|
|
45
|
-
disabled={disabled}
|
|
46
|
-
readOnly={readOnly}
|
|
47
|
-
required={required}
|
|
48
|
-
onChange={handleOnChange}
|
|
49
|
-
testId={testId}
|
|
50
|
-
/>
|
|
51
|
-
</StyledPegaDxilMyTestTextWrapper>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
PegaDxilMyTestText.defaultProps = {
|
|
56
|
-
value: '',
|
|
57
|
-
placeholder: '',
|
|
58
|
-
disabled: false,
|
|
59
|
-
readOnly: false,
|
|
60
|
-
required: false,
|
|
61
|
-
testId: ''
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
PegaDxilMyTestText.propTypes = {
|
|
65
|
-
label: PropTypes.string,
|
|
66
|
-
value: PropTypes.string,
|
|
67
|
-
placeholder: PropTypes.string,
|
|
68
|
-
getPConnect: PropTypes.func.isRequired,
|
|
69
|
-
disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
70
|
-
readOnly: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
71
|
-
required: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
72
|
-
testId: PropTypes.string
|
|
73
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
export const configProps = {
|
|
4
|
-
value: '',
|
|
5
|
-
label: 'Text Sample',
|
|
6
|
-
placeholder: 'Text Placeholder',
|
|
7
|
-
helperText: 'Text Helper Text',
|
|
8
|
-
testId: 'Text-12345678',
|
|
9
|
-
hasSuggestions: false
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const stateProps = {
|
|
13
|
-
value: '.TextSample',
|
|
14
|
-
hasSuggestions: false
|
|
15
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// utilizing theming, comment out, if want individual style
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { Configuration } from '@pega/cosmos-react-core';
|
|
5
|
-
|
|
6
|
-
export default styled(Configuration)``;
|
|
7
|
-
|
|
8
|
-
// individual style, comment out above, and uncomment here and add styles
|
|
9
|
-
// import styled, { css } from 'styled-components';
|
|
10
|
-
//
|
|
11
|
-
// export default styled.div(() => {
|
|
12
|
-
// return css`
|
|
13
|
-
// margin: 0px 0;
|
|
14
|
-
// `;
|
|
15
|
-
// });
|
package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/config.json
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Pega_DXIL_MyTestText",
|
|
3
|
-
"label": "My Test Text",
|
|
4
|
-
"description": "My Test Text Description",
|
|
5
|
-
"organization": "Pega",
|
|
6
|
-
"version": "0.0.1",
|
|
7
|
-
"library": "DXIL",
|
|
8
|
-
"allowedApplications": [],
|
|
9
|
-
"componentKey": "Pega_DXIL_MyTestText",
|
|
10
|
-
"type": "Field",
|
|
11
|
-
"subtype": "Text",
|
|
12
|
-
"icon": "images/pz-url-active.svg",
|
|
13
|
-
"properties": [
|
|
14
|
-
{
|
|
15
|
-
"name": "label",
|
|
16
|
-
"label": "Field label",
|
|
17
|
-
"format": "TEXT",
|
|
18
|
-
"required": true
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"name": "readOnly",
|
|
22
|
-
"label": "Edit mode",
|
|
23
|
-
"format": "READONLY"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"label": "Input settings",
|
|
27
|
-
"format": "GROUP",
|
|
28
|
-
"visibility": "(!readOnly = true)",
|
|
29
|
-
"properties": [
|
|
30
|
-
{
|
|
31
|
-
"name": "placeholder",
|
|
32
|
-
"label": "Placeholder",
|
|
33
|
-
"format": "TEXT"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"name": "helperText",
|
|
37
|
-
"label": "Helper text",
|
|
38
|
-
"format": "TEXT"
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"label": "Conditions",
|
|
44
|
-
"format": "GROUP",
|
|
45
|
-
"properties": [
|
|
46
|
-
{
|
|
47
|
-
"name": "required",
|
|
48
|
-
"label": "Required",
|
|
49
|
-
"format": "REQUIRED",
|
|
50
|
-
"visibility": "(!readOnly = true)"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"name": "disabled",
|
|
54
|
-
"label": "Disabled",
|
|
55
|
-
"format": "DISABLED",
|
|
56
|
-
"visibility": "(!readOnly = true)"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"name": "visibility",
|
|
60
|
-
"label": "Visibility",
|
|
61
|
-
"format": "VISIBILITY"
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"label": "Advanced",
|
|
67
|
-
"format": "GROUP",
|
|
68
|
-
"collapsible": true,
|
|
69
|
-
"properties": [
|
|
70
|
-
{
|
|
71
|
-
"name": "testId",
|
|
72
|
-
"label": "Test ID",
|
|
73
|
-
"format": "TEXT",
|
|
74
|
-
"ignorePattern": "[^-_\\p{N}\\p{L}]",
|
|
75
|
-
"includeAnnotations": false
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
"defaultConfig": {
|
|
81
|
-
"label": "@L $this.label"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
|
-
|
|
5
|
-
import PegaDxilMyTestText from './index';
|
|
6
|
-
import { configProps } from './mock';
|
|
7
|
-
|
|
8
|
-
const meta: Meta<typeof PegaDxilMyTestText> = {
|
|
9
|
-
title: 'PegaDxilMyTestText',
|
|
10
|
-
component: PegaDxilMyTestText,
|
|
11
|
-
excludeStories: /.*Data$/
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default meta;
|
|
15
|
-
type Story = StoryObj<typeof PegaDxilMyTestText>;
|
|
16
|
-
|
|
17
|
-
export const BasePegaDxilMyTestText: Story = args => {
|
|
18
|
-
const [value, setValue] = useState(configProps.value);
|
|
19
|
-
|
|
20
|
-
const props = {
|
|
21
|
-
value,
|
|
22
|
-
placeholder: configProps.placeholder,
|
|
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 => {
|
|
38
|
-
setValue(event.target.value);
|
|
39
|
-
},
|
|
40
|
-
onBlur: () => {
|
|
41
|
-
return configProps.value;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return <PegaDxilMyTestText {...props} {...args} />;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
BasePegaDxilMyTestText.args = {
|
|
49
|
-
label: configProps.label,
|
|
50
|
-
helperText: configProps.helperText,
|
|
51
|
-
testId: configProps.testId,
|
|
52
|
-
readOnly: configProps.readOnly,
|
|
53
|
-
disabled: configProps.disabled,
|
|
54
|
-
required: configProps.required,
|
|
55
|
-
status: configProps.status,
|
|
56
|
-
hideLabel: configProps.hideLabel,
|
|
57
|
-
displayMode: configProps.displayMode,
|
|
58
|
-
validatemessage: configProps.validatemessage
|
|
59
|
-
};
|
package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/index.tsx
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
import { TextField } from '@material-ui/core';
|
|
3
|
-
|
|
4
|
-
import handleEvent from '@pega/react-sdk-components/lib/components/helpers/event-utils';
|
|
5
|
-
import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map';
|
|
6
|
-
import { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps';
|
|
7
|
-
import StyledPegaDxilMyTestTextWrapper from './styles';
|
|
8
|
-
|
|
9
|
-
interface PegaDxilMyTestTextProps extends PConnFieldProps {
|
|
10
|
-
// If any, enter additional props that only exist on this componentName
|
|
11
|
-
fieldMetadata?: any;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Duplicated runtime code from React SDK
|
|
15
|
-
|
|
16
|
-
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
17
|
-
export default function PegaDxilMyTestText(props: PegaDxilMyTestTextProps) {
|
|
18
|
-
// Get emitted components from map (so we can get any override that may exist)
|
|
19
|
-
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
20
|
-
|
|
21
|
-
const {
|
|
22
|
-
getPConnect,
|
|
23
|
-
label,
|
|
24
|
-
required,
|
|
25
|
-
disabled,
|
|
26
|
-
value = '',
|
|
27
|
-
validatemessage,
|
|
28
|
-
status,
|
|
29
|
-
/* onChange, onBlur */
|
|
30
|
-
readOnly,
|
|
31
|
-
testId,
|
|
32
|
-
fieldMetadata,
|
|
33
|
-
helperText,
|
|
34
|
-
displayMode,
|
|
35
|
-
hideLabel,
|
|
36
|
-
placeholder
|
|
37
|
-
} = props;
|
|
38
|
-
|
|
39
|
-
const pConn = getPConnect();
|
|
40
|
-
const actions = pConn.getActionsApi();
|
|
41
|
-
const propName = (pConn.getStateProps() as any).value;
|
|
42
|
-
|
|
43
|
-
const helperTextToDisplay = validatemessage || helperText;
|
|
44
|
-
|
|
45
|
-
const [inputValue, setInputValue] = useState('');
|
|
46
|
-
const maxLength = fieldMetadata?.maxLength;
|
|
47
|
-
|
|
48
|
-
let readOnlyProp = {}; // Note: empty if NOT ReadOnly
|
|
49
|
-
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
setInputValue(value);
|
|
52
|
-
}, [value]);
|
|
53
|
-
|
|
54
|
-
if (displayMode === 'LABELS_LEFT') {
|
|
55
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} />;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (displayMode === 'STACKED_LARGE_VAL') {
|
|
59
|
-
return <FieldValueList name={hideLabel ? '' : label} value={value} variant='stacked' />;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (readOnly) {
|
|
63
|
-
readOnlyProp = { readOnly: true };
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let testProp = {};
|
|
67
|
-
|
|
68
|
-
testProp = {
|
|
69
|
-
'data-test-id': testId
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
function handleChange(event) {
|
|
73
|
-
// update internal value
|
|
74
|
-
setInputValue(event?.target?.value);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function handleBlur() {
|
|
78
|
-
handleEvent(actions, 'changeNblur', propName, inputValue);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<StyledPegaDxilMyTestTextWrapper>
|
|
83
|
-
<TextField
|
|
84
|
-
fullWidth
|
|
85
|
-
variant={readOnly ? 'standard' : 'outlined'}
|
|
86
|
-
helperText={helperTextToDisplay}
|
|
87
|
-
placeholder={placeholder ?? ''}
|
|
88
|
-
size='small'
|
|
89
|
-
required={required}
|
|
90
|
-
disabled={disabled}
|
|
91
|
-
onChange={handleChange}
|
|
92
|
-
onBlur={!readOnly ? handleBlur : undefined}
|
|
93
|
-
error={status === 'error'}
|
|
94
|
-
label={label}
|
|
95
|
-
value={inputValue}
|
|
96
|
-
InputProps={{ ...readOnlyProp, inputProps: { maxLength, ...testProp } }}
|
|
97
|
-
/>
|
|
98
|
-
</StyledPegaDxilMyTestTextWrapper>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
|
package/tests/assets/sdk-r/components/createAll/custom-sdk/field/Pega_DXIL_MyTestText/mock.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
2
|
-
export const configProps = {
|
|
3
|
-
value: '',
|
|
4
|
-
label: 'Text Sample',
|
|
5
|
-
placeholder: 'Text Placeholder',
|
|
6
|
-
helperText: 'Text Helper Text',
|
|
7
|
-
testId: 'Text-12345678',
|
|
8
|
-
hasSuggestions: false,
|
|
9
|
-
disabled: false,
|
|
10
|
-
readOnly: false,
|
|
11
|
-
required: false,
|
|
12
|
-
displayMode: '',
|
|
13
|
-
status: '',
|
|
14
|
-
hideLabel: false,
|
|
15
|
-
validatemessage: ''
|
|
16
|
-
};
|
|
File without changes
|