@pega/custom-dx-components 0.23.49 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/cli.js +8 -2
- package/src/tasks/build-jest-assets/index.js +171 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.tsx.mustache +3 -13
- package/src/tasks/create/templates/Constellation/Field/Boolean/index.tsx.mustache +8 -5
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.tsx.mustache +8 -19
- package/src/tasks/create/templates/Constellation/Field/Date/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.tsx.mustache +7 -18
- package/src/tasks/create/templates/Constellation/Field/DateTime/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.tsx.mustache +1 -7
- package/src/tasks/create/templates/Constellation/Field/Decimal/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.tsx.mustache +2 -9
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.ts.mustache +2 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.tsx.mustache +2 -6
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.tsx.mustache +2 -6
- package/src/tasks/create/templates/Constellation/Field/Integer/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.tsx.mustache +2 -6
- package/src/tasks/create/templates/Constellation/Field/Picklist/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/demo.stories.tsx.mustache +2 -8
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/demo.stories.tsx.mustache +1 -7
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.tsx.mustache +0 -3
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.tsx.mustache +1 -5
- package/src/tasks/create/templates/Constellation/Field/Text-Email/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Input/StatusWork.tsx +3 -9
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.tsx.mustache +1 -5
- package/src/tasks/create/templates/Constellation/Field/Text-Input/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.tsx.mustache +1 -5
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.tsx.mustache +2 -5
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.tsx.mustache +1 -5
- package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.tsx.mustache +5 -15
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Template/DETAILS/StatusWork.tsx.mustache +17 -19
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.tsx.mustache +5 -5
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.tsx.mustache +17 -19
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.tsx.mustache +5 -5
- package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.tsx.mustache +5 -3
- package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.tsx.mustache +4 -2
- package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.tsx.mustache +4 -3
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.tsx.mustache +3 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +5 -8
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.tsx.mustache +5 -4
- package/src/tasks/index.js +1 -0
- package/src/tasks/init/template/.storybook/preview.js +3 -0
- package/src/tasks/init/template/package.json.mustache +7 -6
- package/src/util.js +18 -0
- package/tests/assets/components/create/_components.md +1 -0
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyBoolean/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCurrency/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDate/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDecimal/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/StatusWork.tsx +17 -19
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyEmail/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyInteger/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyParagraph/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPercentage/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPhone/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPicklist/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/StatusWork.tsx +3 -9
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/index.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/StatusWork.tsx +17 -19
- package/tests/assets/components/createAll/Constellation/_components.md +1 -0
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyBoolean/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCurrency/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDate/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDecimal/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/StatusWork.tsx +17 -19
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyEmail/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyInteger/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyParagraph/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPercentage/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPhone/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPicklist/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/StatusWork.tsx +3 -9
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/index.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/StatusWork.tsx +17 -19
- package/tests/assets/components/createAll/Launchpad/_components.md +1 -0
package/src/util.js
CHANGED
|
@@ -262,6 +262,24 @@ export const getComponentDefaults = async () => {
|
|
|
262
262
|
return config.component;
|
|
263
263
|
};
|
|
264
264
|
|
|
265
|
+
export const getServerType = async () => {
|
|
266
|
+
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
267
|
+
return defaultPegaServerConfig.serverType;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export const setServerType = async(serverType) => {
|
|
271
|
+
const currentDirectory = process.cwd();
|
|
272
|
+
const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
273
|
+
let configData = await getPegaConfig();
|
|
274
|
+
let serverConfig = configData['server-config'];
|
|
275
|
+
serverConfig.serverType = serverType;
|
|
276
|
+
|
|
277
|
+
// update file
|
|
278
|
+
// stringify "4", makes the json string look like JSON in the file, formated instead of a single line
|
|
279
|
+
fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(configData, null, 4), { encoding: 'utf8' });
|
|
280
|
+
|
|
281
|
+
}
|
|
282
|
+
|
|
265
283
|
export const getComponentDirectoryPath = async componentKey => {
|
|
266
284
|
const currentDirectory = process.cwd();
|
|
267
285
|
const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# directory for components #
|
|
@@ -104,7 +104,7 @@ function PegaDxilMyBoolean(props: PegaDxilMyBooleanProps) {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
if (displayMode === 'DISPLAY_ONLY') {
|
|
107
|
-
return ( <StyledPegaDxilMyBooleanWrapper> displayComponent </StyledPegaDxilMyBooleanWrapper>);
|
|
107
|
+
return ( <StyledPegaDxilMyBooleanWrapper> {displayComponent} </StyledPegaDxilMyBooleanWrapper>);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
if (displayMode === "LABELS_LEFT") {
|
|
@@ -189,7 +189,7 @@ function PegaDxilMyCurrency(props: PegaDxilMyCurrencyProps) {
|
|
|
189
189
|
|
|
190
190
|
switch (displayMode) {
|
|
191
191
|
case 'DISPLAY_ONLY': {
|
|
192
|
-
return (<StyledPegaDxilMyCurrencyWrapper> displayComp </StyledPegaDxilMyCurrencyWrapper>) ;
|
|
192
|
+
return (<StyledPegaDxilMyCurrencyWrapper> {displayComp} </StyledPegaDxilMyCurrencyWrapper>) ;
|
|
193
193
|
}
|
|
194
194
|
case 'LABELS_LEFT': {
|
|
195
195
|
return (
|
|
@@ -175,7 +175,7 @@ function PegaDxilMyDate (props: PegaDxilMyDateProps) {
|
|
|
175
175
|
);
|
|
176
176
|
switch(displayMode){
|
|
177
177
|
case 'DISPLAY_ONLY': {
|
|
178
|
-
return ( <StyledPegaDxilMyDateWrapper> displayComp </StyledPegaDxilMyDateWrapper>);
|
|
178
|
+
return ( <StyledPegaDxilMyDateWrapper> {displayComp} </StyledPegaDxilMyDateWrapper>);
|
|
179
179
|
}
|
|
180
180
|
case "LABELS_LEFT" : {
|
|
181
181
|
return (
|
|
@@ -181,7 +181,7 @@ function PegaDxilMyDateTime (props: PegaDxilMyDateTimeProps) {
|
|
|
181
181
|
);
|
|
182
182
|
switch (displayMode) {
|
|
183
183
|
case 'DISPLAY_ONLY': {
|
|
184
|
-
return ( <StyledPegaDxilMyDateTimeWrapper> displayComp </StyledPegaDxilMyDateTimeWrapper>);
|
|
184
|
+
return ( <StyledPegaDxilMyDateTimeWrapper> {displayComp} </StyledPegaDxilMyDateTimeWrapper>);
|
|
185
185
|
}
|
|
186
186
|
case 'LABELS_LEFT': {
|
|
187
187
|
return (
|
|
@@ -158,7 +158,7 @@ function PegaDxilMyDecimal(props: PegaDxilMyDecimalProps) {
|
|
|
158
158
|
|
|
159
159
|
switch (displayMode) {
|
|
160
160
|
case 'DISPLAY_ONLY': {
|
|
161
|
-
return (<StyledPegaDxilMyDecimalWrapper> displayComp </StyledPegaDxilMyDecimalWrapper>);
|
|
161
|
+
return (<StyledPegaDxilMyDecimalWrapper> {displayComp} </StyledPegaDxilMyDecimalWrapper>);
|
|
162
162
|
}
|
|
163
163
|
case 'LABELS_LEFT': {
|
|
164
164
|
return (
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Status } from
|
|
3
|
+
import { Status } from '@pega/cosmos-react-core';
|
|
4
4
|
|
|
5
5
|
export default function StatusWorkRenderer({ value }: any) {
|
|
6
|
-
|
|
6
|
+
// need to cast variant
|
|
7
|
+
let variant: 'success' | 'urgent' | 'warn' | 'pending' | 'info';
|
|
8
|
+
variant = 'info';
|
|
7
9
|
|
|
8
|
-
const warnStrings = [
|
|
9
|
-
const infoStrings = [
|
|
10
|
-
const successStrings = [
|
|
11
|
-
const pendingStrings = [
|
|
10
|
+
const warnStrings = ['fail', 'cancel', 'reject', 'revoke', 'stopped', 'warn'];
|
|
11
|
+
const infoStrings = ['open', 'hold', 'info', 'new'];
|
|
12
|
+
const successStrings = ['resolved', 'completed', 'success'];
|
|
13
|
+
const pendingStrings = ['pending'];
|
|
12
14
|
|
|
13
|
-
if (new RegExp(warnStrings.join(
|
|
14
|
-
variant =
|
|
15
|
-
} else if (new RegExp(infoStrings.join(
|
|
16
|
-
variant =
|
|
17
|
-
} else if (new RegExp(successStrings.join(
|
|
18
|
-
variant =
|
|
19
|
-
} else if (new RegExp(pendingStrings.join(
|
|
20
|
-
variant =
|
|
15
|
+
if (new RegExp(warnStrings.join('|'), 'i').test(value)) {
|
|
16
|
+
variant = 'warn';
|
|
17
|
+
} else if (new RegExp(infoStrings.join('|'), 'i').test(value)) {
|
|
18
|
+
variant = 'info';
|
|
19
|
+
} else if (new RegExp(successStrings.join('|'), 'i').test(value)) {
|
|
20
|
+
variant = 'success';
|
|
21
|
+
} else if (new RegExp(pendingStrings.join('|'), 'i').test(value)) {
|
|
22
|
+
variant = 'pending';
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
return
|
|
24
|
-
<Status type="rectangle" variant={variant}>
|
|
25
|
-
{value}
|
|
26
|
-
</Status>
|
|
27
|
-
);
|
|
25
|
+
return <Status variant={variant}>{value}</Status>;
|
|
28
26
|
}
|
|
@@ -128,7 +128,7 @@ function PegaDxilMyEmail(props: PegaDxilMyEmailProps) {
|
|
|
128
128
|
}
|
|
129
129
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
130
130
|
<StyledPegaDxilMyEmailWrapper>
|
|
131
|
-
displayComp
|
|
131
|
+
{displayComp}
|
|
132
132
|
</StyledPegaDxilMyEmailWrapper>
|
|
133
133
|
) : (
|
|
134
134
|
<StyledPegaDxilMyEmailWrapper>
|
|
@@ -184,7 +184,7 @@ function PegaDxilMyInteger(props: PegaDxilMyIntegerProps) {
|
|
|
184
184
|
|
|
185
185
|
switch (displayMode) {
|
|
186
186
|
case 'DISPLAY_ONLY': {
|
|
187
|
-
return (<StyledPegaDxilMyIntegerWrapper> displayComp </StyledPegaDxilMyIntegerWrapper>);
|
|
187
|
+
return (<StyledPegaDxilMyIntegerWrapper> {displayComp} </StyledPegaDxilMyIntegerWrapper>);
|
|
188
188
|
}
|
|
189
189
|
case 'LABELS_LEFT': {
|
|
190
190
|
return (
|
|
@@ -126,7 +126,7 @@ function PegaDxilMyParagraph(props: PegaDxilMyParagraphProps) {
|
|
|
126
126
|
}
|
|
127
127
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
128
128
|
<StyledPegaDxilMyParagraphWrapper>
|
|
129
|
-
displayComp
|
|
129
|
+
{displayComp}
|
|
130
130
|
</StyledPegaDxilMyParagraphWrapper>
|
|
131
131
|
) : (
|
|
132
132
|
<StyledPegaDxilMyParagraphWrapper>
|
|
@@ -165,7 +165,7 @@ function PegaDxilMyPercentage(props: PegaDxilMyPercentageProps) {
|
|
|
165
165
|
|
|
166
166
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
167
167
|
<StyledPegaDxilMyPercentageWrapper>
|
|
168
|
-
displayComp
|
|
168
|
+
{displayComp}
|
|
169
169
|
</StyledPegaDxilMyPercentageWrapper>
|
|
170
170
|
) : (
|
|
171
171
|
<StyledPegaDxilMyPercentageWrapper>
|
|
@@ -164,7 +164,7 @@ function PegaDxilMyPhone(props: PegaDxilMyPhoneProps) {
|
|
|
164
164
|
}
|
|
165
165
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
166
166
|
<StyledPegaDxilMyPhoneWrapper>
|
|
167
|
-
displayComp
|
|
167
|
+
{displayComp}
|
|
168
168
|
</StyledPegaDxilMyPhoneWrapper>
|
|
169
169
|
) : (
|
|
170
170
|
<StyledPegaDxilMyPhoneWrapper>
|
|
@@ -256,7 +256,7 @@ function PegaDxilMyPicklist(props: PegaDxilMyPicklistProps) {
|
|
|
256
256
|
|
|
257
257
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
258
258
|
<StyledPegaDxilMyPicklistWrapper>
|
|
259
|
-
displayComp
|
|
259
|
+
{displayComp}
|
|
260
260
|
</StyledPegaDxilMyPicklistWrapper>
|
|
261
261
|
) : (
|
|
262
262
|
<StyledPegaDxilMyPicklistWrapper>
|
package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/StatusWork.tsx
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Status } from '@pega/cosmos-react-core';
|
|
4
4
|
|
|
5
|
-
export default function StatusWorkRenderer({ value }
|
|
5
|
+
export default function StatusWorkRenderer({ value }: any) {
|
|
6
6
|
// need to cast variant
|
|
7
|
-
let variant
|
|
7
|
+
let variant: 'success' | 'urgent' | 'warn' | 'pending' | 'info';
|
|
8
8
|
variant = 'info';
|
|
9
9
|
|
|
10
10
|
const warnStrings = ['fail', 'cancel', 'reject', 'revoke', 'stopped', 'warn'];
|
|
@@ -22,11 +22,5 @@ export default function StatusWorkRenderer({ value } : any) {
|
|
|
22
22
|
variant = 'pending';
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Status type='rectangle' variant={variant} >
|
|
29
|
-
{value}
|
|
30
|
-
</Status>
|
|
31
|
-
);
|
|
25
|
+
return <Status variant={variant}>{value}</Status>;
|
|
32
26
|
}
|
|
@@ -143,7 +143,7 @@ function PegaDxilMyTextInput(props: PegaDxilMyTextInputProps) {
|
|
|
143
143
|
displayComp = textFormatter(formatter, value);
|
|
144
144
|
}
|
|
145
145
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
146
|
-
<StyledPegaDxilMyTextInputWrapper> displayComp </StyledPegaDxilMyTextInputWrapper>
|
|
146
|
+
<StyledPegaDxilMyTextInputWrapper> {displayComp} </StyledPegaDxilMyTextInputWrapper>
|
|
147
147
|
) : (
|
|
148
148
|
<StyledPegaDxilMyTextInputWrapper>
|
|
149
149
|
<FieldValueList
|
|
@@ -140,7 +140,7 @@ function PegaDxilMyTimeOfDay (props: PegaDxilMyTimeOfDayProps) {
|
|
|
140
140
|
);
|
|
141
141
|
switch (displayMode) {
|
|
142
142
|
case 'DISPLAY_ONLY': {
|
|
143
|
-
return ( <StyledPegaDxilMyTimeOfDayWrapper> displayComp </StyledPegaDxilMyTimeOfDayWrapper>);
|
|
143
|
+
return ( <StyledPegaDxilMyTimeOfDayWrapper> {displayComp} </StyledPegaDxilMyTimeOfDayWrapper>);
|
|
144
144
|
}
|
|
145
145
|
case 'LABELS_LEFT': {
|
|
146
146
|
return (
|
package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/StatusWork.tsx
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Status } from
|
|
3
|
+
import { Status } from '@pega/cosmos-react-core';
|
|
4
4
|
|
|
5
5
|
export default function StatusWorkRenderer({ value }: any) {
|
|
6
|
-
|
|
6
|
+
// need to cast variant
|
|
7
|
+
let variant: 'success' | 'urgent' | 'warn' | 'pending' | 'info';
|
|
8
|
+
variant = 'info';
|
|
7
9
|
|
|
8
|
-
const warnStrings = [
|
|
9
|
-
const infoStrings = [
|
|
10
|
-
const successStrings = [
|
|
11
|
-
const pendingStrings = [
|
|
10
|
+
const warnStrings = ['fail', 'cancel', 'reject', 'revoke', 'stopped', 'warn'];
|
|
11
|
+
const infoStrings = ['open', 'hold', 'info', 'new'];
|
|
12
|
+
const successStrings = ['resolved', 'completed', 'success'];
|
|
13
|
+
const pendingStrings = ['pending'];
|
|
12
14
|
|
|
13
|
-
if (new RegExp(warnStrings.join(
|
|
14
|
-
variant =
|
|
15
|
-
} else if (new RegExp(infoStrings.join(
|
|
16
|
-
variant =
|
|
17
|
-
} else if (new RegExp(successStrings.join(
|
|
18
|
-
variant =
|
|
19
|
-
} else if (new RegExp(pendingStrings.join(
|
|
20
|
-
variant =
|
|
15
|
+
if (new RegExp(warnStrings.join('|'), 'i').test(value)) {
|
|
16
|
+
variant = 'warn';
|
|
17
|
+
} else if (new RegExp(infoStrings.join('|'), 'i').test(value)) {
|
|
18
|
+
variant = 'info';
|
|
19
|
+
} else if (new RegExp(successStrings.join('|'), 'i').test(value)) {
|
|
20
|
+
variant = 'success';
|
|
21
|
+
} else if (new RegExp(pendingStrings.join('|'), 'i').test(value)) {
|
|
22
|
+
variant = 'pending';
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
return
|
|
24
|
-
<Status type="rectangle" variant={variant}>
|
|
25
|
-
{value}
|
|
26
|
-
</Status>
|
|
27
|
-
);
|
|
25
|
+
return <Status variant={variant}>{value}</Status>;
|
|
28
26
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# directory for components #
|
|
@@ -104,7 +104,7 @@ function PegaDxilMyBoolean(props: PegaDxilMyBooleanProps) {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
if (displayMode === 'DISPLAY_ONLY') {
|
|
107
|
-
return ( <StyledPegaDxilMyBooleanWrapper> displayComponent </StyledPegaDxilMyBooleanWrapper>);
|
|
107
|
+
return ( <StyledPegaDxilMyBooleanWrapper> {displayComponent} </StyledPegaDxilMyBooleanWrapper>);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
if (displayMode === "LABELS_LEFT") {
|
|
@@ -189,7 +189,7 @@ function PegaDxilMyCurrency(props: PegaDxilMyCurrencyProps) {
|
|
|
189
189
|
|
|
190
190
|
switch (displayMode) {
|
|
191
191
|
case 'DISPLAY_ONLY': {
|
|
192
|
-
return (<StyledPegaDxilMyCurrencyWrapper> displayComp </StyledPegaDxilMyCurrencyWrapper>) ;
|
|
192
|
+
return (<StyledPegaDxilMyCurrencyWrapper> {displayComp} </StyledPegaDxilMyCurrencyWrapper>) ;
|
|
193
193
|
}
|
|
194
194
|
case 'LABELS_LEFT': {
|
|
195
195
|
return (
|
|
@@ -175,7 +175,7 @@ function PegaDxilMyDate (props: PegaDxilMyDateProps) {
|
|
|
175
175
|
);
|
|
176
176
|
switch(displayMode){
|
|
177
177
|
case 'DISPLAY_ONLY': {
|
|
178
|
-
return ( <StyledPegaDxilMyDateWrapper> displayComp </StyledPegaDxilMyDateWrapper>);
|
|
178
|
+
return ( <StyledPegaDxilMyDateWrapper> {displayComp} </StyledPegaDxilMyDateWrapper>);
|
|
179
179
|
}
|
|
180
180
|
case "LABELS_LEFT" : {
|
|
181
181
|
return (
|
|
@@ -181,7 +181,7 @@ function PegaDxilMyDateTime (props: PegaDxilMyDateTimeProps) {
|
|
|
181
181
|
);
|
|
182
182
|
switch (displayMode) {
|
|
183
183
|
case 'DISPLAY_ONLY': {
|
|
184
|
-
return ( <StyledPegaDxilMyDateTimeWrapper> displayComp </StyledPegaDxilMyDateTimeWrapper>);
|
|
184
|
+
return ( <StyledPegaDxilMyDateTimeWrapper> {displayComp} </StyledPegaDxilMyDateTimeWrapper>);
|
|
185
185
|
}
|
|
186
186
|
case 'LABELS_LEFT': {
|
|
187
187
|
return (
|
|
@@ -158,7 +158,7 @@ function PegaDxilMyDecimal(props: PegaDxilMyDecimalProps) {
|
|
|
158
158
|
|
|
159
159
|
switch (displayMode) {
|
|
160
160
|
case 'DISPLAY_ONLY': {
|
|
161
|
-
return (<StyledPegaDxilMyDecimalWrapper> displayComp </StyledPegaDxilMyDecimalWrapper>);
|
|
161
|
+
return (<StyledPegaDxilMyDecimalWrapper> {displayComp} </StyledPegaDxilMyDecimalWrapper>);
|
|
162
162
|
}
|
|
163
163
|
case 'LABELS_LEFT': {
|
|
164
164
|
return (
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Status } from
|
|
3
|
+
import { Status } from '@pega/cosmos-react-core';
|
|
4
4
|
|
|
5
5
|
export default function StatusWorkRenderer({ value }: any) {
|
|
6
|
-
|
|
6
|
+
// need to cast variant
|
|
7
|
+
let variant: 'success' | 'urgent' | 'warn' | 'pending' | 'info';
|
|
8
|
+
variant = 'info';
|
|
7
9
|
|
|
8
|
-
const warnStrings = [
|
|
9
|
-
const infoStrings = [
|
|
10
|
-
const successStrings = [
|
|
11
|
-
const pendingStrings = [
|
|
10
|
+
const warnStrings = ['fail', 'cancel', 'reject', 'revoke', 'stopped', 'warn'];
|
|
11
|
+
const infoStrings = ['open', 'hold', 'info', 'new'];
|
|
12
|
+
const successStrings = ['resolved', 'completed', 'success'];
|
|
13
|
+
const pendingStrings = ['pending'];
|
|
12
14
|
|
|
13
|
-
if (new RegExp(warnStrings.join(
|
|
14
|
-
variant =
|
|
15
|
-
} else if (new RegExp(infoStrings.join(
|
|
16
|
-
variant =
|
|
17
|
-
} else if (new RegExp(successStrings.join(
|
|
18
|
-
variant =
|
|
19
|
-
} else if (new RegExp(pendingStrings.join(
|
|
20
|
-
variant =
|
|
15
|
+
if (new RegExp(warnStrings.join('|'), 'i').test(value)) {
|
|
16
|
+
variant = 'warn';
|
|
17
|
+
} else if (new RegExp(infoStrings.join('|'), 'i').test(value)) {
|
|
18
|
+
variant = 'info';
|
|
19
|
+
} else if (new RegExp(successStrings.join('|'), 'i').test(value)) {
|
|
20
|
+
variant = 'success';
|
|
21
|
+
} else if (new RegExp(pendingStrings.join('|'), 'i').test(value)) {
|
|
22
|
+
variant = 'pending';
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
return
|
|
24
|
-
<Status type="rectangle" variant={variant}>
|
|
25
|
-
{value}
|
|
26
|
-
</Status>
|
|
27
|
-
);
|
|
25
|
+
return <Status variant={variant}>{value}</Status>;
|
|
28
26
|
}
|
|
@@ -128,7 +128,7 @@ function PegaDxilMyEmail(props: PegaDxilMyEmailProps) {
|
|
|
128
128
|
}
|
|
129
129
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
130
130
|
<StyledPegaDxilMyEmailWrapper>
|
|
131
|
-
displayComp
|
|
131
|
+
{displayComp}
|
|
132
132
|
</StyledPegaDxilMyEmailWrapper>
|
|
133
133
|
) : (
|
|
134
134
|
<StyledPegaDxilMyEmailWrapper>
|
|
@@ -184,7 +184,7 @@ function PegaDxilMyInteger(props: PegaDxilMyIntegerProps) {
|
|
|
184
184
|
|
|
185
185
|
switch (displayMode) {
|
|
186
186
|
case 'DISPLAY_ONLY': {
|
|
187
|
-
return (<StyledPegaDxilMyIntegerWrapper> displayComp </StyledPegaDxilMyIntegerWrapper>);
|
|
187
|
+
return (<StyledPegaDxilMyIntegerWrapper> {displayComp} </StyledPegaDxilMyIntegerWrapper>);
|
|
188
188
|
}
|
|
189
189
|
case 'LABELS_LEFT': {
|
|
190
190
|
return (
|
|
@@ -126,7 +126,7 @@ function PegaDxilMyParagraph(props: PegaDxilMyParagraphProps) {
|
|
|
126
126
|
}
|
|
127
127
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
128
128
|
<StyledPegaDxilMyParagraphWrapper>
|
|
129
|
-
displayComp
|
|
129
|
+
{displayComp}
|
|
130
130
|
</StyledPegaDxilMyParagraphWrapper>
|
|
131
131
|
) : (
|
|
132
132
|
<StyledPegaDxilMyParagraphWrapper>
|
|
@@ -165,7 +165,7 @@ function PegaDxilMyPercentage(props: PegaDxilMyPercentageProps) {
|
|
|
165
165
|
|
|
166
166
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
167
167
|
<StyledPegaDxilMyPercentageWrapper>
|
|
168
|
-
displayComp
|
|
168
|
+
{displayComp}
|
|
169
169
|
</StyledPegaDxilMyPercentageWrapper>
|
|
170
170
|
) : (
|
|
171
171
|
<StyledPegaDxilMyPercentageWrapper>
|
|
@@ -164,7 +164,7 @@ function PegaDxilMyPhone(props: PegaDxilMyPhoneProps) {
|
|
|
164
164
|
}
|
|
165
165
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
166
166
|
<StyledPegaDxilMyPhoneWrapper>
|
|
167
|
-
displayComp
|
|
167
|
+
{displayComp}
|
|
168
168
|
</StyledPegaDxilMyPhoneWrapper>
|
|
169
169
|
) : (
|
|
170
170
|
<StyledPegaDxilMyPhoneWrapper>
|
|
@@ -256,7 +256,7 @@ function PegaDxilMyPicklist(props: PegaDxilMyPicklistProps) {
|
|
|
256
256
|
|
|
257
257
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
258
258
|
<StyledPegaDxilMyPicklistWrapper>
|
|
259
|
-
displayComp
|
|
259
|
+
{displayComp}
|
|
260
260
|
</StyledPegaDxilMyPicklistWrapper>
|
|
261
261
|
) : (
|
|
262
262
|
<StyledPegaDxilMyPicklistWrapper>
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Status } from '@pega/cosmos-react-core';
|
|
4
4
|
|
|
5
|
-
export default function StatusWorkRenderer({ value }
|
|
5
|
+
export default function StatusWorkRenderer({ value }: any) {
|
|
6
6
|
// need to cast variant
|
|
7
|
-
let variant
|
|
7
|
+
let variant: 'success' | 'urgent' | 'warn' | 'pending' | 'info';
|
|
8
8
|
variant = 'info';
|
|
9
9
|
|
|
10
10
|
const warnStrings = ['fail', 'cancel', 'reject', 'revoke', 'stopped', 'warn'];
|
|
@@ -22,11 +22,5 @@ export default function StatusWorkRenderer({ value } : any) {
|
|
|
22
22
|
variant = 'pending';
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Status type='rectangle' variant={variant} >
|
|
29
|
-
{value}
|
|
30
|
-
</Status>
|
|
31
|
-
);
|
|
25
|
+
return <Status variant={variant}>{value}</Status>;
|
|
32
26
|
}
|
|
@@ -143,7 +143,7 @@ function PegaDxilMyTextInput(props: PegaDxilMyTextInputProps) {
|
|
|
143
143
|
displayComp = textFormatter(formatter, value);
|
|
144
144
|
}
|
|
145
145
|
return displayMode === 'DISPLAY_ONLY' ? (
|
|
146
|
-
<StyledPegaDxilMyTextInputWrapper> displayComp </StyledPegaDxilMyTextInputWrapper>
|
|
146
|
+
<StyledPegaDxilMyTextInputWrapper> {displayComp} </StyledPegaDxilMyTextInputWrapper>
|
|
147
147
|
) : (
|
|
148
148
|
<StyledPegaDxilMyTextInputWrapper>
|
|
149
149
|
<FieldValueList
|
|
@@ -140,7 +140,7 @@ function PegaDxilMyTimeOfDay (props: PegaDxilMyTimeOfDayProps) {
|
|
|
140
140
|
);
|
|
141
141
|
switch (displayMode) {
|
|
142
142
|
case 'DISPLAY_ONLY': {
|
|
143
|
-
return ( <StyledPegaDxilMyTimeOfDayWrapper> displayComp </StyledPegaDxilMyTimeOfDayWrapper>);
|
|
143
|
+
return ( <StyledPegaDxilMyTimeOfDayWrapper> {displayComp} </StyledPegaDxilMyTimeOfDayWrapper>);
|
|
144
144
|
}
|
|
145
145
|
case 'LABELS_LEFT': {
|
|
146
146
|
return (
|
package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/StatusWork.tsx
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Status } from
|
|
3
|
+
import { Status } from '@pega/cosmos-react-core';
|
|
4
4
|
|
|
5
5
|
export default function StatusWorkRenderer({ value }: any) {
|
|
6
|
-
|
|
6
|
+
// need to cast variant
|
|
7
|
+
let variant: 'success' | 'urgent' | 'warn' | 'pending' | 'info';
|
|
8
|
+
variant = 'info';
|
|
7
9
|
|
|
8
|
-
const warnStrings = [
|
|
9
|
-
const infoStrings = [
|
|
10
|
-
const successStrings = [
|
|
11
|
-
const pendingStrings = [
|
|
10
|
+
const warnStrings = ['fail', 'cancel', 'reject', 'revoke', 'stopped', 'warn'];
|
|
11
|
+
const infoStrings = ['open', 'hold', 'info', 'new'];
|
|
12
|
+
const successStrings = ['resolved', 'completed', 'success'];
|
|
13
|
+
const pendingStrings = ['pending'];
|
|
12
14
|
|
|
13
|
-
if (new RegExp(warnStrings.join(
|
|
14
|
-
variant =
|
|
15
|
-
} else if (new RegExp(infoStrings.join(
|
|
16
|
-
variant =
|
|
17
|
-
} else if (new RegExp(successStrings.join(
|
|
18
|
-
variant =
|
|
19
|
-
} else if (new RegExp(pendingStrings.join(
|
|
20
|
-
variant =
|
|
15
|
+
if (new RegExp(warnStrings.join('|'), 'i').test(value)) {
|
|
16
|
+
variant = 'warn';
|
|
17
|
+
} else if (new RegExp(infoStrings.join('|'), 'i').test(value)) {
|
|
18
|
+
variant = 'info';
|
|
19
|
+
} else if (new RegExp(successStrings.join('|'), 'i').test(value)) {
|
|
20
|
+
variant = 'success';
|
|
21
|
+
} else if (new RegExp(pendingStrings.join('|'), 'i').test(value)) {
|
|
22
|
+
variant = 'pending';
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
return
|
|
24
|
-
<Status type="rectangle" variant={variant}>
|
|
25
|
-
{value}
|
|
26
|
-
</Status>
|
|
27
|
-
);
|
|
25
|
+
return <Status variant={variant}>{value}</Status>;
|
|
28
26
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# directory for components #
|