@pega/custom-dx-components 0.23.33 → 0.23.35
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/README.md +2 -2
- package/package.json +1 -1
- package/src/constants.js +2 -2
- package/src/tasks/create/templates/Constellation/Field/Boolean/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Operator.tsx.mustache +45 -75
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/Operator.tsx.mustache +34 -106
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/util.js +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/Operator.tsx +45 -75
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyRadioButtons/config.json +4 -4
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyRadioButtons/demo.stories.tsx +5 -5
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyRadioButtons/index.tsx +7 -7
- package/tests/assets/components/createAll/{Launchpad/Pega_DXIL_MyAutocomplete → Constellation/Pega_DXIL_MySearchbox}/config.json +4 -4
- package/tests/assets/components/createAll/{Launchpad/Pega_DXIL_MyAutocomplete → Constellation/Pega_DXIL_MySearchbox}/demo.stories.tsx +5 -5
- package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/index.tsx +12 -12
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/Operator.tsx +34 -106
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyRadioButtons/config.json +4 -4
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyRadioButtons/demo.stories.tsx +5 -5
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyRadioButtons/index.tsx +7 -7
- package/tests/assets/components/createAll/{Constellation/Pega_DXIL_MyAutocomplete → Launchpad/Pega_DXIL_MySearchbox}/config.json +4 -4
- package/tests/assets/components/createAll/{Constellation/Pega_DXIL_MyAutocomplete → Launchpad/Pega_DXIL_MySearchbox}/demo.stories.tsx +5 -5
- package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/index.tsx +12 -12
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/PConnProps.d.ts +0 -0
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/component-constants.js +0 -0
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/date.js +0 -0
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/embed-utils.js +0 -0
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/event-utils.ts +0 -0
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/format-constants.js +0 -0
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/mock.ts +0 -0
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/picklist-utils.js +0 -0
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/repeat-constants.js +0 -0
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/repeat-utils.js +0 -0
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/styles.ts +0 -0
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/suggestions-handler.ts +0 -0
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/textformat-utils.jsx +0 -0
- /package/tests/assets/components/createAll/Constellation/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/utils.ts +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/PConnProps.d.ts +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/component-constants.js +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/date.js +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/embed-utils.js +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/event-utils.ts +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/format-constants.js +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/mock.ts +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/picklist-utils.js +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/repeat-constants.js +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/repeat-utils.js +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/styles.ts +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/suggestions-handler.ts +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/textformat-utils.jsx +0 -0
- /package/tests/assets/components/createAll/Launchpad/{Pega_DXIL_MyAutocomplete → Pega_DXIL_MySearchbox}/utils.ts +0 -0
package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/Operator.tsx
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
//
|
|
2
|
-
import React from 'react';
|
|
1
|
+
// @ts-nocheck
|
|
3
2
|
import { useState, useEffect, Fragment } from 'react';
|
|
4
3
|
import {
|
|
5
4
|
Link,
|
|
6
5
|
Button,
|
|
7
6
|
Popover,
|
|
8
|
-
Flex,
|
|
9
7
|
useOuterEvent,
|
|
10
8
|
useElement,
|
|
11
9
|
Progress,
|
|
@@ -13,6 +11,7 @@ import {
|
|
|
13
11
|
useTheme
|
|
14
12
|
} from '@pega/cosmos-react-core';
|
|
15
13
|
import { Glimpse } from '@pega/cosmos-react-work';
|
|
14
|
+
import { EmailDisplay } from '@pega/cosmos-react-core';
|
|
16
15
|
import PropTypes from 'prop-types';
|
|
17
16
|
|
|
18
17
|
import type { PConnFieldProps } from './PConnProps';
|
|
@@ -30,19 +29,19 @@ interface PegaDxilMyPageCaseWidgetOperatorProps extends PConnFieldProps {
|
|
|
30
29
|
externalUser: any;
|
|
31
30
|
}
|
|
32
31
|
|
|
32
|
+
let pTarget = null;
|
|
33
33
|
|
|
34
34
|
export default function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
|
|
35
35
|
const { id, name, label, testId, helperText, externalUser, metaObj } = props;
|
|
36
36
|
const [isOpen, setIsOpen] = useState(false);
|
|
37
37
|
const [isLoading, setIsLoading] = useState(true);
|
|
38
|
-
const [popoverTarget, setPopoverTarget] = useState(null);
|
|
39
38
|
const [popoverEl, setPopoverEl] = useElement(null);
|
|
40
39
|
const [popoverContent, setpopoverContent] = useState(null);
|
|
41
40
|
const theme: any = useTheme();
|
|
42
41
|
|
|
43
42
|
/* If the id has changed, we need to reset the popover */
|
|
44
43
|
useEffect(() => {
|
|
45
|
-
|
|
44
|
+
pTarget = null;
|
|
46
45
|
}, [id]);
|
|
47
46
|
|
|
48
47
|
|
|
@@ -51,7 +50,6 @@ export default function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
|
|
|
51
50
|
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
52
51
|
const localeCategory = 'Operator';
|
|
53
52
|
setpopoverContent(
|
|
54
|
-
// @ts-ignore
|
|
55
53
|
<Progress variant='ring' message={localizedVal('Loading operator...', localeCategory)} placement='local' />
|
|
56
54
|
);
|
|
57
55
|
if (externalUser && externalUser.classID !== 'Data-Party-Operator') {
|
|
@@ -75,10 +73,8 @@ export default function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
|
|
|
75
73
|
];
|
|
76
74
|
setIsLoading(false);
|
|
77
75
|
setpopoverContent(
|
|
78
|
-
// @ts-ignore
|
|
79
76
|
<Glimpse
|
|
80
77
|
visual={
|
|
81
|
-
// @ts-ignore
|
|
82
78
|
<Avatar
|
|
83
79
|
metaObj={{
|
|
84
80
|
name: externalUser.name
|
|
@@ -88,88 +84,63 @@ export default function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
|
|
|
88
84
|
primary={externalUser.name}
|
|
89
85
|
secondary={[externalUser.position]}
|
|
90
86
|
fields={fields}
|
|
87
|
+
target={pTarget}
|
|
91
88
|
/>
|
|
92
89
|
);
|
|
93
90
|
} else {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
.then(
|
|
97
|
-
if (res.data
|
|
98
|
-
const fields = [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
{res.data.pyOperatorInfo.pyTelephone}
|
|
111
|
-
</Link>
|
|
112
|
-
) : (
|
|
113
|
-
''
|
|
114
|
-
)
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
id: 'pyEmailAddress',
|
|
91
|
+
return PCore.getUserApi()
|
|
92
|
+
.getOperatorDetails(id, true)
|
|
93
|
+
.then(res => {
|
|
94
|
+
if (res.data?.pyOperatorInfo) {
|
|
95
|
+
const fields = [];
|
|
96
|
+
const data = res.data;
|
|
97
|
+
if (data.pyOperatorInfo && data.pyOperatorInfo.pyUserName) {
|
|
98
|
+
fields.push({
|
|
99
|
+
id: 'Name',
|
|
100
|
+
name: localizedVal('Name', localeCategory),
|
|
101
|
+
value: data.pyOperatorInfo.pyUserName
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (data.pyOperatorInfo && data.pyOperatorInfo.pyEmailAddress) {
|
|
105
|
+
fields.push({
|
|
106
|
+
id: 'Email',
|
|
118
107
|
name: localizedVal('Email address', localeCategory),
|
|
119
|
-
value:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
value: res.data.pyOperatorInfo.pyReportToUserName
|
|
132
|
-
}
|
|
133
|
-
];
|
|
108
|
+
value: <EmailDisplay value={data.pyOperatorInfo.pyEmailAddress} />
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
const opAvatar = (
|
|
112
|
+
<Avatar
|
|
113
|
+
metaObj={{
|
|
114
|
+
image: '',
|
|
115
|
+
name: data.pyOperatorInfo.pyUserName
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
|
|
134
120
|
setIsLoading(false);
|
|
135
121
|
setpopoverContent(
|
|
136
|
-
// @ts-ignore
|
|
137
122
|
<Glimpse
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
name: res.data.pyOperatorInfo.pyUserName
|
|
144
|
-
}}
|
|
145
|
-
/>
|
|
146
|
-
}
|
|
147
|
-
primary={res.data.pyOperatorInfo.pyUserName}
|
|
148
|
-
secondary={[res.data.pyOperatorInfo.pyPosition]}
|
|
123
|
+
heading={{
|
|
124
|
+
primary: data.pyOperatorInfo.pyUserName,
|
|
125
|
+
secondary: data.pyOperatorInfo.pyEmailAddress,
|
|
126
|
+
visual: opAvatar
|
|
127
|
+
}}
|
|
149
128
|
fields={fields}
|
|
129
|
+
target={pTarget}
|
|
130
|
+
onDismiss={() => {pTarget = null;}}
|
|
150
131
|
/>
|
|
151
132
|
);
|
|
152
|
-
} else {
|
|
153
|
-
setIsLoading(false);
|
|
154
|
-
// @ts-ignore
|
|
155
|
-
setpopoverContent(<Flex container={{ pad: 1 }}>{localizedVal('Operator not found', localeCategory)}</Flex>);
|
|
156
133
|
}
|
|
157
|
-
})
|
|
158
|
-
.catch(() => {
|
|
159
|
-
setIsLoading(false);
|
|
160
|
-
setpopoverContent(
|
|
161
|
-
// @ts-ignore
|
|
162
|
-
<Flex container={{ pad: 1 }}>{localizedVal('Error loading the operator profile', localeCategory)}</Flex>
|
|
163
|
-
);
|
|
164
134
|
});
|
|
165
135
|
}
|
|
166
136
|
};
|
|
167
137
|
|
|
168
138
|
|
|
169
139
|
const clickAction = (e: any) => {
|
|
170
|
-
|
|
140
|
+
|
|
171
141
|
setIsOpen(!isOpen);
|
|
172
|
-
if (
|
|
142
|
+
if (pTarget === null) {
|
|
143
|
+
pTarget = e.currentTarget;
|
|
173
144
|
OperatorPreview();
|
|
174
145
|
}
|
|
175
146
|
};
|
|
@@ -180,8 +151,7 @@ export default function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
|
|
|
180
151
|
}
|
|
181
152
|
};
|
|
182
153
|
|
|
183
|
-
//
|
|
184
|
-
useOuterEvent('mousedown', [popoverEl, popoverTarget], hidePopover); // Call the method on clicking outside these elements
|
|
154
|
+
useOuterEvent('mousedown', [popoverEl], hidePopover); // Call the method on clicking outside these elements
|
|
185
155
|
|
|
186
156
|
const hideOnEscape = (e: any) => {
|
|
187
157
|
if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed
|
|
@@ -219,7 +189,7 @@ export default function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
|
|
|
219
189
|
<Popover
|
|
220
190
|
ref={setPopoverEl}
|
|
221
191
|
groupId='operator'
|
|
222
|
-
target={
|
|
192
|
+
target={pTarget}
|
|
223
193
|
placement='bottom-start'
|
|
224
194
|
style={isLoading ? { position: 'relative', width: '10rem', minHeight: '4rem' } : undefined}
|
|
225
195
|
strategy='fixed'
|
package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyRadioButtons/config.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"label": "My Radio
|
|
4
|
-
"description": "My Radio
|
|
2
|
+
"name": "Pega_DXIL_MyRadiobuttons",
|
|
3
|
+
"label": "My Radio buttons",
|
|
4
|
+
"description": "My Radio buttons",
|
|
5
5
|
"organization": "Pega",
|
|
6
6
|
"version": "0.0.1",
|
|
7
7
|
"library": "DXIL",
|
|
8
8
|
"allowedApplications": [],
|
|
9
|
-
"componentKey": "
|
|
9
|
+
"componentKey": "Pega_DXIL_MyRadiobuttons",
|
|
10
10
|
"type": "Field",
|
|
11
11
|
"subtype": "Picklist",
|
|
12
12
|
"icon": "images/pz-dropdown-active.svg",
|
package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyRadioButtons/demo.stories.tsx
CHANGED
|
@@ -6,15 +6,15 @@ import { withKnobs } from '@storybook/addon-knobs';
|
|
|
6
6
|
|
|
7
7
|
import { configProps, rawMetadata, fieldMetadata, stateProps } from './mock';
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import PegaDxilMyRadiobuttons from './index';
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
|
-
title: '
|
|
12
|
+
title: 'PegaDxilMyRadiobuttons',
|
|
13
13
|
decorators: [withKnobs],
|
|
14
|
-
component:
|
|
14
|
+
component: PegaDxilMyRadiobuttons
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const
|
|
17
|
+
export const BasePegaDxilMyRadiobuttons = () => {
|
|
18
18
|
|
|
19
19
|
const [value, setValue] = useState(configProps.value);
|
|
20
20
|
|
|
@@ -79,7 +79,7 @@ export const BasePegaDxilMyRadioButtons = () => {
|
|
|
79
79
|
|
|
80
80
|
return (
|
|
81
81
|
<>
|
|
82
|
-
<
|
|
82
|
+
<PegaDxilMyRadiobuttons {...props} />
|
|
83
83
|
</>
|
|
84
84
|
);
|
|
85
85
|
};
|
|
@@ -8,11 +8,11 @@ import type { PConnFieldProps } from './PConnProps';
|
|
|
8
8
|
import { formatExists, textFormatter } from './textformat-utils.jsx';
|
|
9
9
|
import handleEvent from './event-utils';
|
|
10
10
|
|
|
11
|
-
import
|
|
11
|
+
import StyledPegaDxilMyRadiobuttonsWrapper from './styles';
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
// interface for props
|
|
15
|
-
interface
|
|
15
|
+
interface PegaDxilMyRadiobuttonsProps extends PConnFieldProps {
|
|
16
16
|
// If any, enter additional props that only exist on TextInput here
|
|
17
17
|
isTableFormatter?: boolean;
|
|
18
18
|
hasSuggestions?: boolean;
|
|
@@ -53,7 +53,7 @@ const getDisplayValue = (dataSource: any, value: any, isDatapage: boolean) => {
|
|
|
53
53
|
|
|
54
54
|
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
55
55
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
56
|
-
export default function
|
|
56
|
+
export default function PegaDxilMyRadiobuttons(props: PegaDxilMyRadiobuttonsProps) {
|
|
57
57
|
const {
|
|
58
58
|
getPConnect,
|
|
59
59
|
value,
|
|
@@ -165,7 +165,7 @@ export default function PegaDxilMyRadioButtons(props: PegaDxilMyRadioButtonsProp
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
return (
|
|
168
|
-
<
|
|
168
|
+
<StyledPegaDxilMyRadiobuttonsWrapper>
|
|
169
169
|
<RadioButtonGroup
|
|
170
170
|
{...additionalProps}
|
|
171
171
|
label={label}
|
|
@@ -193,12 +193,12 @@ export default function PegaDxilMyRadioButtons(props: PegaDxilMyRadioButtonsProp
|
|
|
193
193
|
>
|
|
194
194
|
{items}
|
|
195
195
|
</RadioButtonGroup>
|
|
196
|
-
</
|
|
196
|
+
</StyledPegaDxilMyRadiobuttonsWrapper>
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
PegaDxilMyRadiobuttons.defaultProps = {
|
|
202
202
|
value: '',
|
|
203
203
|
validatemessage: '',
|
|
204
204
|
helperText: '',
|
|
@@ -219,7 +219,7 @@ PegaDxilMyRadioButtons.defaultProps = {
|
|
|
219
219
|
isTableFormatter: false
|
|
220
220
|
};
|
|
221
221
|
|
|
222
|
-
|
|
222
|
+
PegaDxilMyRadiobuttons.propTypes = {
|
|
223
223
|
getPConnect: PropTypes.func.isRequired,
|
|
224
224
|
value: PropTypes.string,
|
|
225
225
|
label: PropTypes.string.isRequired,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"label": "My
|
|
4
|
-
"description": "My
|
|
2
|
+
"name": "Pega_DXIL_MySearchbox",
|
|
3
|
+
"label": "My Search box",
|
|
4
|
+
"description": "My Search box",
|
|
5
5
|
"organization": "Pega",
|
|
6
6
|
"version": "0.0.1",
|
|
7
7
|
"library": "DXIL",
|
|
8
8
|
"allowedApplications": [],
|
|
9
|
-
"componentKey": "
|
|
9
|
+
"componentKey": "Pega_DXIL_MySearchbox",
|
|
10
10
|
"type": "Field",
|
|
11
11
|
"subtype": "Picklist",
|
|
12
12
|
"icon": "images/pz-dropdown-active.svg",
|
|
@@ -6,15 +6,15 @@ import { withKnobs } from '@storybook/addon-knobs';
|
|
|
6
6
|
|
|
7
7
|
import { configProps, rawMetadata, fieldMetadata, stateProps } from './mock';
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import PegaDxilMySearchbox from './index';
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
|
-
title: '
|
|
12
|
+
title: 'PegaDxilMySearchbox',
|
|
13
13
|
decorators: [withKnobs],
|
|
14
|
-
component:
|
|
14
|
+
component: PegaDxilMySearchbox
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const
|
|
17
|
+
export const BasePegaDxilMySearchbox = () => {
|
|
18
18
|
|
|
19
19
|
const [value, setValue] = useState(configProps.value);
|
|
20
20
|
const datasourceMetadata = fieldMetadata;
|
|
@@ -84,7 +84,7 @@ export const BasePegaDxilMyAutocomplete = () => {
|
|
|
84
84
|
|
|
85
85
|
return (
|
|
86
86
|
<>
|
|
87
|
-
<
|
|
87
|
+
<PegaDxilMySearchbox {...props} />
|
|
88
88
|
</>
|
|
89
89
|
);
|
|
90
90
|
};
|
|
@@ -17,10 +17,10 @@ import { getFieldNameFromEmbeddedFieldName } from './embed-utils.js';
|
|
|
17
17
|
|
|
18
18
|
import { usePaginate, useDeepMemo, useIsMount, updatePropertiesForNewRecord } from './utils';
|
|
19
19
|
|
|
20
|
-
import
|
|
20
|
+
import StyledPegaDxilMySearchboxWrapper from './styles';
|
|
21
21
|
|
|
22
22
|
// interface for props
|
|
23
|
-
interface
|
|
23
|
+
interface PegaDxilMySearchboxProps extends PConnFieldProps {
|
|
24
24
|
// If any, enter additional props that only exist on TextInput here
|
|
25
25
|
isTableFormatter?: boolean;
|
|
26
26
|
hasSuggestions?: boolean;
|
|
@@ -47,7 +47,7 @@ interface PegaDxilMyAutocompleteProps extends PConnFieldProps {
|
|
|
47
47
|
isSearchableOnKey: boolean;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
interface
|
|
50
|
+
interface PegaDxilMySearchboxPropsSubSet {
|
|
51
51
|
selected: any;
|
|
52
52
|
actualValue: any;
|
|
53
53
|
isTableFormatter?: boolean;
|
|
@@ -361,7 +361,7 @@ export const setValueToAssocProp = (
|
|
|
361
361
|
return retValue;
|
|
362
362
|
};
|
|
363
363
|
|
|
364
|
-
const DisplayComponent = (props:
|
|
364
|
+
const DisplayComponent = (props: PegaDxilMySearchboxPropsSubSet) => {
|
|
365
365
|
const { selected, actualValue, isTableFormatter, formatter } = props;
|
|
366
366
|
|
|
367
367
|
const displayCompValue = selected ? selected.primary : actualValue;
|
|
@@ -378,7 +378,7 @@ const DisplayComponent = (props: PegaDxilMyAutocompletePropsSubSet) => {
|
|
|
378
378
|
|
|
379
379
|
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
380
380
|
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
381
|
-
export function
|
|
381
|
+
export function PegaDxilMySearchbox(props: PegaDxilMySearchboxProps) {
|
|
382
382
|
const {
|
|
383
383
|
getPConnect,
|
|
384
384
|
value,
|
|
@@ -1072,9 +1072,9 @@ export function PegaDxilMyAutocomplete(props: PegaDxilMyAutocompleteProps) {
|
|
|
1072
1072
|
};
|
|
1073
1073
|
|
|
1074
1074
|
const displayComponent = useMemo(() => {
|
|
1075
|
-
return <
|
|
1075
|
+
return <StyledPegaDxilMySearchboxWrapper>
|
|
1076
1076
|
<DisplayComponent {...{ selected, actualValue, isTableFormatter, formatter }} />
|
|
1077
|
-
</
|
|
1077
|
+
</StyledPegaDxilMySearchboxWrapper>;
|
|
1078
1078
|
}, [selected, actualValue, isTableFormatter, formatter]);
|
|
1079
1079
|
|
|
1080
1080
|
if (displayMode) {
|
|
@@ -1122,7 +1122,7 @@ export function PegaDxilMyAutocomplete(props: PegaDxilMyAutocompleteProps) {
|
|
|
1122
1122
|
|
|
1123
1123
|
|
|
1124
1124
|
return (
|
|
1125
|
-
<
|
|
1125
|
+
<StyledPegaDxilMySearchboxWrapper>
|
|
1126
1126
|
<ComboBox
|
|
1127
1127
|
{...additionalProps}
|
|
1128
1128
|
testId={testId ?? label}
|
|
@@ -1168,13 +1168,13 @@ export function PegaDxilMyAutocomplete(props: PegaDxilMyAutocompleteProps) {
|
|
|
1168
1168
|
mode={AC_TYPE}
|
|
1169
1169
|
onResolveSuggestion={onResolveSuggestionHandler}
|
|
1170
1170
|
/>
|
|
1171
|
-
</
|
|
1171
|
+
</StyledPegaDxilMySearchboxWrapper>
|
|
1172
1172
|
);
|
|
1173
1173
|
}
|
|
1174
1174
|
|
|
1175
|
-
export default memo(
|
|
1175
|
+
export default memo(PegaDxilMySearchbox);
|
|
1176
1176
|
|
|
1177
|
-
|
|
1177
|
+
PegaDxilMySearchbox.defaultProps = {
|
|
1178
1178
|
value: '',
|
|
1179
1179
|
matchPosition: 'contains',
|
|
1180
1180
|
maxResultsDisplay: '',
|
|
@@ -1203,7 +1203,7 @@ PegaDxilMyAutocomplete.defaultProps = {
|
|
|
1203
1203
|
hasSuggestions: false
|
|
1204
1204
|
};
|
|
1205
1205
|
|
|
1206
|
-
|
|
1206
|
+
PegaDxilMySearchbox.propTypes = {
|
|
1207
1207
|
value: PropTypes.string,
|
|
1208
1208
|
maxResultsDisplay: PropTypes.string,
|
|
1209
1209
|
matchPosition: PropTypes.string,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
import { useState, useEffect, Fragment } from 'react';
|
|
2
3
|
import {
|
|
3
4
|
Link,
|
|
@@ -27,18 +28,19 @@ interface PegaDxilMyPageCaseWidgetOperatorProps extends PConnFieldProps {
|
|
|
27
28
|
externalUser: any;
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
let pTarget = null;
|
|
32
|
+
|
|
30
33
|
export default function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
|
|
31
34
|
const { id, name, label, testId, helperText, externalUser, metaObj } = props;
|
|
32
35
|
const [isOpen, setIsOpen] = useState(false);
|
|
33
36
|
const [isLoading, setIsLoading] = useState(true);
|
|
34
|
-
const [popoverTarget, setPopoverTarget] = useState(null);
|
|
35
37
|
const [popoverEl, setPopoverEl] = useElement(null);
|
|
36
38
|
const [popoverContent, setpopoverContent] = useState(null);
|
|
37
39
|
const theme = useTheme();
|
|
38
40
|
|
|
39
41
|
/* If the id has changed, we need to reset the popover */
|
|
40
42
|
useEffect(() => {
|
|
41
|
-
|
|
43
|
+
pTarget = null;
|
|
42
44
|
}, [id]);
|
|
43
45
|
|
|
44
46
|
|
|
@@ -47,7 +49,6 @@ export default function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
|
|
|
47
49
|
let localizedVal = PCore.getLocaleUtils().getLocaleValue;
|
|
48
50
|
let localeCategory = 'Operator';
|
|
49
51
|
setpopoverContent(
|
|
50
|
-
// @ts-ignore
|
|
51
52
|
<Progress variant='ring' message={localizedVal('Loading operator...', localeCategory)} placement='local' />
|
|
52
53
|
);
|
|
53
54
|
if (externalUser && externalUser.classID !== 'Data-Party-Operator') {
|
|
@@ -71,10 +72,8 @@ export default function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
|
|
|
71
72
|
];
|
|
72
73
|
setIsLoading(false);
|
|
73
74
|
setpopoverContent(
|
|
74
|
-
// @ts-ignore
|
|
75
75
|
<Glimpse
|
|
76
76
|
visual={
|
|
77
|
-
// @ts-ignore
|
|
78
77
|
<Avatar
|
|
79
78
|
metaObj={{
|
|
80
79
|
name: externalUser.name
|
|
@@ -84,6 +83,7 @@ export default function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
|
|
|
84
83
|
primary={externalUser.name}
|
|
85
84
|
secondary={[externalUser.position]}
|
|
86
85
|
fields={fields}
|
|
86
|
+
target={pTarget}
|
|
87
87
|
/>
|
|
88
88
|
);
|
|
89
89
|
} else {
|
|
@@ -106,111 +106,40 @@ export default function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
|
|
|
106
106
|
name: localizedVal('Email address', localeCategory),
|
|
107
107
|
value: <EmailDisplay value={res.data.data[0].BusinessID} />
|
|
108
108
|
});
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
/*
|
|
134
|
-
const { getOperatorDetails } = PCore.getUserApi();
|
|
135
|
-
getOperatorDetails(id)
|
|
136
|
-
.then((res) => {
|
|
137
|
-
if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {
|
|
138
|
-
const fields = [
|
|
139
|
-
{
|
|
140
|
-
id: 'pyOrganization',
|
|
141
|
-
name: localizedVal('Organization', localeCategory),
|
|
142
|
-
value: res.data.pyOperatorInfo.pyOrganization
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
id: 'pyTelephone',
|
|
146
|
-
name: localizedVal('Telephone', localeCategory),
|
|
147
|
-
value:
|
|
148
|
-
res.data.pyOperatorInfo.pyTelephone !== '' ? (
|
|
149
|
-
<Link href={`tel:${res.data.pyOperatorInfo.pyTelephone}`}>
|
|
150
|
-
{res.data.pyOperatorInfo.pyTelephone}
|
|
151
|
-
</Link>
|
|
152
|
-
) : (
|
|
153
|
-
''
|
|
154
|
-
)
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
id: 'pyEmailAddress',
|
|
158
|
-
name: localizedVal('Email address', localeCategory),
|
|
159
|
-
value:
|
|
160
|
-
res.data.pyOperatorInfo.pyEmailAddress !== '' ? (
|
|
161
|
-
<Link href={`mailto:${res.data.pyOperatorInfo.pyEmailAddress}`}>
|
|
162
|
-
{res.data.pyOperatorInfo.pyEmailAddress}
|
|
163
|
-
</Link>
|
|
164
|
-
) : (
|
|
165
|
-
''
|
|
166
|
-
)
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
id: 'ReportToUserName',
|
|
170
|
-
name: localizedVal('Reports to', localeCategory),
|
|
171
|
-
value: res.data.pyOperatorInfo.pyReportToUserName
|
|
172
|
-
}
|
|
173
|
-
];
|
|
174
|
-
setIsLoading(false);
|
|
175
|
-
setpopoverContent(
|
|
176
|
-
// @ts-ignore
|
|
177
|
-
<Glimpse
|
|
178
|
-
visual={
|
|
179
|
-
// @ts-ignore
|
|
180
|
-
<Avatar
|
|
181
|
-
metaObj={{
|
|
182
|
-
image: res.data.pyOperatorInfo.pyImageInsKey || '',
|
|
183
|
-
name: res.data.pyOperatorInfo.pyUserName
|
|
184
|
-
}}
|
|
185
|
-
/>
|
|
186
|
-
}
|
|
187
|
-
primary={res.data.pyOperatorInfo.pyUserName}
|
|
188
|
-
secondary={[res.data.pyOperatorInfo.pyPosition]}
|
|
189
|
-
fields={fields}
|
|
190
|
-
/>
|
|
191
|
-
);
|
|
192
|
-
} else {
|
|
193
|
-
setIsLoading(false);
|
|
194
|
-
// @ts-ignore
|
|
195
|
-
setpopoverContent(<Flex container={{ pad: 1 }}>{localizedVal('Operator not found', localeCategory)}</Flex>);
|
|
109
|
+
|
|
110
|
+
setIsLoading(false);
|
|
111
|
+
setpopoverContent(
|
|
112
|
+
<Glimpse
|
|
113
|
+
heading={{
|
|
114
|
+
primary: res.data.data[0].Name,
|
|
115
|
+
secondary: res.data.data[0].BusinessID,
|
|
116
|
+
visual: (
|
|
117
|
+
<Avatar
|
|
118
|
+
metaObj={{
|
|
119
|
+
image: '',
|
|
120
|
+
name: res.data.data[0].Name
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
)
|
|
124
|
+
}}
|
|
125
|
+
fields={fields}
|
|
126
|
+
target={pTarget}
|
|
127
|
+
onDismiss={() => {pTarget = null;})}
|
|
128
|
+
/>
|
|
129
|
+
);
|
|
130
|
+
|
|
196
131
|
}
|
|
197
|
-
})
|
|
198
|
-
.catch(() => {
|
|
199
|
-
setIsLoading(false);
|
|
200
|
-
setpopoverContent(
|
|
201
|
-
// @ts-ignore
|
|
202
|
-
<Flex container={{ pad: 1 }}>{localizedVal('Error loading the operator profile', localeCategory)}</Flex>
|
|
203
|
-
);
|
|
204
132
|
});
|
|
205
|
-
|
|
133
|
+
|
|
206
134
|
}
|
|
207
135
|
};
|
|
208
136
|
|
|
209
137
|
|
|
210
|
-
const clickAction = (e: any) =>
|
|
211
|
-
|
|
138
|
+
const clickAction = (e: any) =>
|
|
139
|
+
|
|
212
140
|
setIsOpen(!isOpen);
|
|
213
|
-
if (
|
|
141
|
+
if (pTarget === null) {
|
|
142
|
+
pTarget = e.currentTarget;
|
|
214
143
|
OperatorPreview();
|
|
215
144
|
}
|
|
216
145
|
};
|
|
@@ -221,8 +150,7 @@ export default function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
|
|
|
221
150
|
}
|
|
222
151
|
};
|
|
223
152
|
|
|
224
|
-
//
|
|
225
|
-
useOuterEvent('mousedown', [popoverEl, popoverTarget], hidePopover); // Call the method on clicking outside these elements
|
|
153
|
+
useOuterEvent('mousedown', [popoverEl], hidePopover); // Call the method on clicking outside these elements
|
|
226
154
|
const hideOnEscape = (e: any) => {
|
|
227
155
|
if (e.key === 'Escape') hidePopover(); // Call the method when Escape key is pressed
|
|
228
156
|
};
|
|
@@ -259,7 +187,7 @@ export default function Operator(props: PegaDxilMyPageCaseWidgetOperatorProps) {
|
|
|
259
187
|
<Popover
|
|
260
188
|
ref={setPopoverEl}
|
|
261
189
|
groupId='operator'
|
|
262
|
-
target={
|
|
190
|
+
target={pTarget}
|
|
263
191
|
placement='bottom-start'
|
|
264
192
|
style={isLoading ? { position: 'relative', width: '10rem', minHeight: '4rem' } : undefined}
|
|
265
193
|
strategy='fixed'
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"label": "My Radio
|
|
4
|
-
"description": "My Radio
|
|
2
|
+
"name": "Pega_DXIL_MyRadiobuttons",
|
|
3
|
+
"label": "My Radio buttons",
|
|
4
|
+
"description": "My Radio buttons",
|
|
5
5
|
"organization": "Pega",
|
|
6
6
|
"version": "0.0.1",
|
|
7
7
|
"library": "DXIL",
|
|
8
8
|
"allowedApplications": [],
|
|
9
|
-
"componentKey": "
|
|
9
|
+
"componentKey": "Pega_DXIL_MyRadiobuttons",
|
|
10
10
|
"type": "Field",
|
|
11
11
|
"subtype": "Picklist",
|
|
12
12
|
"icon": "images/pz-dropdown-active.svg",
|