@pega/custom-dx-components 0.242.16 → 0.242.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.
Files changed (90) hide show
  1. package/package.json +1 -1
  2. package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.tsx.mustache +2 -3
  3. package/src/tasks/create/templates/Constellation/Field/Boolean/index.tsx.mustache +0 -1
  4. package/src/tasks/create/templates/Constellation/Field/Boolean/mock.ts.mustache +0 -1
  5. package/src/tasks/create/templates/Constellation/Field/Date/index.tsx.mustache +3 -5
  6. package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.tsx.mustache +1 -2
  7. package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.tsx.mustache +1 -2
  8. package/src/tasks/create/templates/Constellation/Field/Decimal/event-utils.ts.mustache +1 -1
  9. package/src/tasks/create/templates/Constellation/Field/Decimal/index.tsx.mustache +1 -4
  10. package/src/tasks/create/templates/Constellation/Field/Decimal/mock.ts.mustache +0 -1
  11. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.tsx.mustache +1 -2
  12. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/event-utils.ts.mustache +1 -1
  13. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.tsx.mustache +0 -2
  14. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.ts.mustache +0 -2
  15. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.tsx.mustache +1 -2
  16. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/event-utils.ts.mustache +1 -1
  17. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.tsx.mustache +1 -4
  18. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.ts.mustache +2 -3
  19. package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/demo.stories.tsx.mustache +4 -5
  20. package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/index.tsx.mustache +0 -2
  21. package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/mock.ts.mustache +0 -1
  22. package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.tsx.mustache +1 -2
  23. package/src/tasks/create/templates/Constellation/Field/Integer/event-utils.ts.mustache +1 -1
  24. package/src/tasks/create/templates/Constellation/Field/Integer/index.tsx.mustache +2 -9
  25. package/src/tasks/create/templates/Constellation/Field/Integer/mock.ts.mustache +3 -2
  26. package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.tsx.mustache +4 -6
  27. package/src/tasks/create/templates/Constellation/Field/Picklist/index.tsx.mustache +7 -14
  28. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/demo.stories.tsx.mustache +4 -6
  29. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/embed-utils.ts.mustache +26 -23
  30. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/index.tsx.mustache +10 -52
  31. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/mock.ts.mustache +0 -1
  32. package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/demo.stories.tsx.mustache +4 -6
  33. package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/index.tsx.mustache +1 -6
  34. package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/mock.ts.mustache +0 -2
  35. package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.tsx.mustache +2 -3
  36. package/src/tasks/create/templates/Constellation/Field/Text/mock.ts.mustache +0 -1
  37. package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.tsx.mustache +1 -2
  38. package/src/tasks/create/templates/Constellation/Field/Text-Email/index.tsx.mustache +0 -2
  39. package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.ts.mustache +2 -2
  40. package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.tsx.mustache +1 -2
  41. package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.ts.mustache +0 -1
  42. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.tsx.mustache +1 -2
  43. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.tsx.mustache +0 -2
  44. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.ts.mustache +0 -2
  45. package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.tsx.mustache +1 -3
  46. package/src/tasks/create/templates/Constellation/Field/Text-Phone/event-utils.ts.mustache +1 -1
  47. package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.tsx.mustache +2 -6
  48. package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.ts.mustache +0 -2
  49. package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.tsx.mustache +1 -3
  50. package/src/tasks/create/templates/Constellation/Field/Text-URL/index.tsx.mustache +0 -2
  51. package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.ts.mustache +0 -2
  52. package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.tsx.mustache +13 -8
  53. package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.tsx.mustache +1 -2
  54. package/src/tasks/create/templates/Constellation/Field/TimeofDay/mock.ts.mustache +0 -2
  55. package/src/tasks/create/templates/Constellation/Template/DETAILS/Avatar.tsx.mustache +3 -5
  56. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.tsx.mustache +8 -7
  57. package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.ts.mustache +0 -2
  58. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/Avatar.tsx.mustache +1 -3
  59. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.tsx.mustache +15 -14
  60. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.tsx.mustache +2 -5
  61. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.ts.mustache +1 -3
  62. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.ts.mustache +4 -8
  63. package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.tsx.mustache +67 -7
  64. package/src/tasks/create/templates/Constellation/Template/FORM/index.tsx.mustache +3 -3
  65. package/src/tasks/create/templates/Constellation/Template/FORM-region/index.tsx.mustache +1 -1
  66. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.tsx.mustache +4 -5
  67. package/src/tasks/create/templates/Constellation/Template/PAGE/index.tsx.mustache +0 -1
  68. package/src/tasks/create/templates/Constellation/Template/PAGE/mock.ts.mustache +0 -2
  69. package/src/tasks/create/templates/Constellation/Template/PAGE/utils.ts.mustache +6 -19
  70. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.tsx.mustache +4 -6
  71. package/src/tasks/create/templates/Constellation/Widget/CASE/index.tsx.mustache +1 -4
  72. package/src/tasks/create/templates/Constellation/Widget/CASE/mock.ts.mustache +0 -1
  73. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.tsx.mustache +3 -4
  74. package/src/tasks/create/templates/Constellation/Widget/PAGE/index.tsx.mustache +2 -6
  75. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Avatar.tsx.mustache +2 -5
  76. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.tsx.mustache +2 -3
  77. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.ts.mustache +0 -1
  78. package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/demo.stories.tsx.mustache +4 -5
  79. package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/index.tsx.mustache +0 -2
  80. package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/mock.ts.mustache +0 -1
  81. package/src/tasks/create/templates/Launchpad/Widget/CASE/demo.stories.tsx.mustache +4 -6
  82. package/src/tasks/create/templates/Launchpad/Widget/CASE/index.tsx.mustache +1 -4
  83. package/src/tasks/create/templates/Launchpad/Widget/CASE/mock.ts.mustache +1 -1
  84. package/src/tasks/create/templates/Launchpad/Widget/PAGE/demo.stories.tsx.mustache +3 -5
  85. package/src/tasks/create/templates/Launchpad/Widget/PAGE/index.tsx.mustache +2 -6
  86. package/src/tasks/create/templates/Launchpad/Widget/PAGE/mock.ts.mustache +0 -1
  87. package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/Avatar.tsx.mustache +1 -3
  88. package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/demo.stories.tsx.mustache +2 -3
  89. package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/mock.ts.mustache +0 -1
  90. package/src/tasks/init/template/package.json.mustache +1 -1
@@ -1,5 +1,3 @@
1
-
2
- // @ts-nocheck
3
1
  export const configProps = {
4
2
  value: '',
5
3
  label: 'Paragraph Sample',
@@ -1,6 +1,4 @@
1
-
2
1
  /* eslint-disable react/jsx-no-useless-fragment */
3
- // @ts-nocheck
4
2
  import type { Meta, StoryObj } from '@storybook/react';
5
3
 
6
4
  import {{COMPONENT_CLASS_NAME}} from './index';
@@ -15,7 +13,7 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
15
13
  export default meta;
16
14
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
17
15
 
18
- export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
16
+ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
19
17
 
20
18
  const props = {
21
19
  value: configProps.value,
@@ -1,4 +1,4 @@
1
- const handleEvent = (actions: any, eventType: string, propName: string, value: string) => {
1
+ const handleEvent = (actions: any, eventType: string, propName: string, value: string | number) => {
2
2
  switch (eventType) {
3
3
  case 'change':
4
4
  actions.updateFieldValue(propName, value);
@@ -25,7 +25,7 @@ interface {{COMPONENT_CLASS_NAME}}Props extends PConnFieldProps {
25
25
  hasSuggestions?: boolean;
26
26
  variant?: any;
27
27
  formatter: string;
28
- datasource: Array<any>;
28
+ datasource: any;
29
29
  showCountryCode: boolean;
30
30
  }
31
31
 
@@ -109,10 +109,8 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
109
109
  const hasValueChange = useRef(false);
110
110
 
111
111
  let callingCodesList: Array<any> = [];
112
- // @ts-ignore
113
112
  if (datasource?.source?.length > 0) {
114
- // @ts-ignore
115
- datasource.source.forEach((element) => {
113
+ datasource.source.forEach((element: { value: any; }) => {
116
114
  callingCodesList.push(element.value);
117
115
  });
118
116
  } else {
@@ -225,14 +223,12 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
225
223
  }
226
224
  setInputValue(enteredValue);
227
225
  if (value !== enteredValue) {
228
- // @ts-ignore
229
226
  handleEvent(actions, 'change', propName, enteredValue);
230
227
  }
231
228
  hasValueChange.current = true;
232
229
  }}
233
230
  onBlur={(enteredValue: any) => {
234
231
  if (!value || hasValueChange.current) {
235
- // @ts-ignore
236
232
  handleChangeBlur(enteredValue, 'blur');
237
233
  if (hasSuggestions) {
238
234
  pConn.ignoreSuggestion('');
@@ -1,5 +1,3 @@
1
-
2
- // @ts-nocheck
3
1
  export const configProps = {
4
2
  value: '',
5
3
  label: 'Phone Sample',
@@ -1,6 +1,4 @@
1
-
2
1
  /* eslint-disable react/jsx-no-useless-fragment */
3
- // @ts-nocheck
4
2
  import type { Meta, StoryObj } from '@storybook/react';
5
3
 
6
4
  import {{COMPONENT_CLASS_NAME}} from './index';
@@ -15,7 +13,7 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
15
13
  export default meta;
16
14
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
17
15
 
18
- export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
16
+ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
19
17
 
20
18
  const props = {
21
19
  value: configProps.value,
@@ -178,14 +178,12 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
178
178
  }
179
179
  setInputValue(event.target.value);
180
180
  if (value !== event.target.value) {
181
- // @ts-ignore
182
181
  handleEvent(actions, 'change', propName, event.target.value);
183
182
  hasValueChange.current = true;
184
183
  }
185
184
  }}
186
185
  onBlur={(event: any) => {
187
186
  if (!value || hasValueChange.current) {
188
- // @ts-ignore
189
187
  handleEvent(actions, 'blur', propName, event.target.value);
190
188
  if (hasSuggestions) {
191
189
  pConn.ignoreSuggestion('');
@@ -1,5 +1,3 @@
1
-
2
- // @ts-nocheck
3
1
  export const configProps = {
4
2
  value: '',
5
3
  label: 'URL Sample',
@@ -1,8 +1,7 @@
1
- // @ts-nocheck
2
1
  import { useState, useRef, Fragment} from "react";
3
2
  import { EmailDisplay, PhoneDisplay, URLDisplay, Image, Button, Lightbox } from '@pega/cosmos-react-core';
4
3
 
5
- export const formatExists = (formatterVal) => {
4
+ export const formatExists = (formatterVal: string) => {
6
5
  const formatterValues = [
7
6
  "TextInput",
8
7
  "WorkStatus",
@@ -19,7 +18,7 @@ export const formatExists = (formatterVal) => {
19
18
  return isformatter;
20
19
  };
21
20
 
22
- const urlLabelVal = (urlLabelSelection, btnVal, urlLabel, propUrlLabel) => {
21
+ const urlLabelVal = (urlLabelSelection: string, btnVal: string, urlLabel: string, propUrlLabel: string) => {
23
22
  if ((urlLabel !== '' || propUrlLabel !== '') && btnVal !== null) {
24
23
  switch (urlLabelSelection) {
25
24
  case 'constant': {
@@ -36,9 +35,9 @@ const urlLabelVal = (urlLabelSelection, btnVal, urlLabel, propUrlLabel) => {
36
35
  return btnVal;
37
36
  };
38
37
 
39
- const isImage = (url) => /\.(jpg|jpeg|png|webp|avif|gif|svg)$/.test(url);
38
+ const isImage = (url: string) => /\.(jpg|jpeg|png|webp|avif|gif|svg)$/.test(url);
40
39
 
41
- const TableImage = (imageProps) => {
40
+ const TableImage = (imageProps: any) => {
42
41
  const { value, altText, altTextOfImage, propaltTextOfImage, urlLabelSelection, urlLabel, propUrlLabel } = imageProps;
43
42
  const demoButtonRef = useRef(null);
44
43
  let imageDisplayComp = null;
@@ -50,10 +49,12 @@ const TableImage = (imageProps) => {
50
49
  src: value
51
50
  };
52
51
  const onClick = () => {
52
+ // @ts-ignore
53
53
  setImages([imgDescription]);
54
54
  };
55
- const onItemDownload = async (id) => {
55
+ const onItemDownload = async (id: string) => {
56
56
  const a = document.createElement('a');
57
+ // @ts-ignore
57
58
  a.href = await fetch(images[0].src)
58
59
  .then((response) => {
59
60
  return response.blob();
@@ -61,6 +62,8 @@ const TableImage = (imageProps) => {
61
62
  .then((blob) => {
62
63
  return URL.createObjectURL(blob);
63
64
  });
65
+
66
+ // @ts-ignore
64
67
  a.download = images?.find((image) => image.id === id)?.name ?? id;
65
68
  document.body.appendChild(a);
66
69
  a.click();
@@ -81,8 +84,10 @@ const TableImage = (imageProps) => {
81
84
  cycle={false}
82
85
  onAfterClose={() => {
83
86
  setImages(null);
87
+ // @ts-ignore
84
88
  demoButtonRef.current?.focus();
85
89
  }}
90
+ // @ts-ignore
86
91
  onItemDownload={isImage(images[0].src) ? onItemDownload : undefined}
87
92
  />
88
93
  )}
@@ -91,7 +96,7 @@ const TableImage = (imageProps) => {
91
96
  return imageDisplayComp;
92
97
  };
93
98
 
94
- export const textFormatter = (formatter,value) => {
99
+ export const textFormatter = (formatter: string, value: any) => {
95
100
  let displayComponent = null;
96
101
  switch(formatter){
97
102
  case "TextInput" : {
@@ -122,7 +127,7 @@ export const textFormatter = (formatter,value) => {
122
127
  * @param {object} options options for formatting
123
128
  * { displayAs,tableDisplayAs,isTableFormatter,altText,altTextOfImage,propaltTextOfImage,urlLabelSelection, urlLabel,propUrlLabel, widthSel, customWidth}
124
129
  */
125
- export const urlFormatter = (value, options) => {
130
+ export const urlFormatter = (value: string, options: any) => {
126
131
  const {
127
132
  displayAs,
128
133
  tableDisplayAs,
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable react/jsx-no-useless-fragment */
2
- // @ts-nocheck
3
2
  import type { Meta, StoryObj } from '@storybook/react';
4
3
  import { configProps, stateProps } from './mock';
5
4
  import {{COMPONENT_CLASS_NAME}} from './index';
@@ -13,7 +12,7 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
13
12
  export default meta;
14
13
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
15
14
 
16
- export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
15
+ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
17
16
  const props = {
18
17
  value: configProps.value,
19
18
  additionalProps: configProps.additionalProps,
@@ -1,5 +1,3 @@
1
-
2
- // @ts-nocheck
3
1
  export const configProps = {
4
2
  value: '13:30',
5
3
  validatemessage: '',
@@ -46,22 +46,20 @@ function Avatar(props: {{COMPONENT_CLASS_NAME}}AvatarProps) {
46
46
  const currentState = PCore.getMessagingServiceManager().getUserPresence().getUserState(userIdentifier);
47
47
  const [userState, setUserState]: any = useState(currentState === 'online' ? 'active' : 'inactive');
48
48
 
49
- // @ts-ignore
50
- const handleUserStateChange = ({ state }) => {
49
+ const handleUserStateChange = ({ state }: any) => {
51
50
  setUserState(state === 'online' ? 'active' : 'inactive');
52
51
  };
53
52
 
54
53
  useEffect(() => {
55
54
  const subId = PCore.getMessagingServiceManager()
56
55
  .getUserPresence()
57
- // @ts-ignore
58
- .subscribe(userIdentifier, handleUserStateChange);
56
+ .subscribe(userIdentifier, handleUserStateChange, '');
59
57
 
60
58
  return function cleanup() {
61
59
  PCore.getMessagingServiceManager().getUserPresence().unsubscribe(userIdentifier, subId);
62
60
  };
63
61
  }, [userIdentifier, handleUserStateChange]);
64
- // @ts-ignore
62
+
65
63
  return <CosmosAvatar name={userName} imageSrc={imageBlobUrl as React.SetStateAction<any>} status={userState} />;
66
64
  }
67
65
 
@@ -1,6 +1,5 @@
1
1
 
2
2
  /* eslint-disable react/jsx-no-useless-fragment */
3
- // @ts-nocheck
4
3
  import type { Meta, StoryObj } from '@storybook/react';
5
4
  import { Text, FieldValueList, Button, DateTimeDisplay, useTheme } from '@pega/cosmos-react-core';
6
5
  import {{COMPONENT_CLASS_NAME}} from './index';
@@ -26,7 +25,7 @@ if (!window.PCore) {
26
25
 
27
26
  window.PCore.getLocaleUtils = () => {
28
27
  return {
29
- getLocaleValue: value => {
28
+ getLocaleValue: (value: any) => {
30
29
  return value;
31
30
  }
32
31
  };
@@ -42,12 +41,12 @@ window.PCore.getUserApi = () => {
42
41
  };
43
42
  };
44
43
 
45
- const Region = props => {
44
+ const Region = (props: any) => {
46
45
  return <></>;
47
46
  };
48
47
 
49
48
 
50
- const renderField = resolvedProps => {
49
+ const renderField = (resolvedProps: any) => {
51
50
  const {
52
51
  displayAsStatus = false,
53
52
  displayMode,
@@ -105,7 +104,9 @@ const renderField = resolvedProps => {
105
104
  metaObj={undefined}
106
105
  testId=''
107
106
  helperText=''
108
- />
107
+ getPConnect={function (): C11nEnv {
108
+ throw new Error('Function not implemented.');
109
+ } } />
109
110
  );
110
111
 
111
112
  if (variant === 'inline') {
@@ -124,7 +125,7 @@ const renderField = resolvedProps => {
124
125
  return <FieldValueList variant={variant} fields={[{ name: label, value: val }]} key={key} />;
125
126
  };
126
127
 
127
- export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
128
+ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
128
129
  const props = {
129
130
  getPConnect: () => {
130
131
  return {
@@ -162,7 +163,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
162
163
  setInheritedProp: () => {
163
164
  /* nothing */
164
165
  },
165
- resolveConfigProps: config => {
166
+ resolveConfigProps: (config: any) => {
166
167
  return config;
167
168
  }
168
169
  };
@@ -1,5 +1,3 @@
1
-
2
- // @ts-nocheck
3
1
  export const pyReviewRaw = {
4
2
  name: 'pyReview',
5
3
  type: 'View',
@@ -46,8 +46,7 @@ function Avatar(props: {{COMPONENT_CLASS_NAME}}AvatarProps) {
46
46
  const currentState = PCore.getMessagingServiceManager().getUserPresence().getUserState(userIdentifier);
47
47
  const [userState, setUserState]: any = useState(currentState === 'online' ? 'active' : 'inactive');
48
48
 
49
- // @ts-ignore
50
- const handleUserStateChange = ({ state }) => {
49
+ const handleUserStateChange = ({ state } : any) => {
51
50
  setUserState(state === 'online' ? 'active' : 'inactive');
52
51
  };
53
52
 
@@ -61,7 +60,6 @@ function Avatar(props: {{COMPONENT_CLASS_NAME}}AvatarProps) {
61
60
  PCore.getMessagingServiceManager().getUserPresence().unsubscribe(userIdentifier, subId);
62
61
  };
63
62
  }, [userIdentifier, handleUserStateChange]);
64
- // @ts-ignore
65
63
  return <CosmosAvatar name={userName} imageSrc={imageBlobUrl as React.SetStateAction<any>} status={userState} />;
66
64
  }
67
65
 
@@ -1,12 +1,11 @@
1
1
 
2
-
3
- // @ts-nocheck
4
2
  import type { Meta, StoryObj } from '@storybook/react';
5
3
  import { Text, FieldValueList, Button, DateTimeDisplay, useTheme } from '@pega/cosmos-react-core';
6
4
  import {{COMPONENT_CLASS_NAME}} from './index';
7
5
  import { pyReviewRaw, pyReviewResolved, regionChildrenResolved, operatorDetails, configProps } from './mock';
8
6
  import StatusWorkRenderer from './StatusWork';
9
7
  import Operator from './Operator';
8
+ import type C11nEnv from '@pega/pcore-pconnect-typedefs/interpreter/c11n-env';
10
9
 
11
10
  const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
12
11
  title: '{{COMPONENT_CLASS_NAME}}',
@@ -26,7 +25,7 @@ if (!window.PCore) {
26
25
 
27
26
  window.PCore.getLocaleUtils = () => {
28
27
  return {
29
- getLocaleValue: value => {
28
+ getLocaleValue: (value: any) => {
30
29
  return value;
31
30
  }
32
31
  };
@@ -42,11 +41,11 @@ window.PCore.getUserApi = () => {
42
41
  };
43
42
  };
44
43
 
45
- const Region = props => {
44
+ const Region = (props: any) => {
46
45
  return <></>;
47
46
  };
48
47
 
49
- const renderField = resolvedProps => {
48
+ const renderField = (resolvedProps: any) => {
50
49
  const {
51
50
  displayAsStatus = false,
52
51
  displayMode,
@@ -74,7 +73,7 @@ const renderField = resolvedProps => {
74
73
  value={value}
75
74
  variant='datetime'
76
75
  format='long'
77
- clockFormat={null}
76
+ clockFormat={undefined}
78
77
  key={key}
79
78
  />
80
79
  );
@@ -104,7 +103,9 @@ const renderField = resolvedProps => {
104
103
  metaObj={undefined}
105
104
  testId=''
106
105
  helperText=''
107
- />
106
+ getPConnect={function (): C11nEnv {
107
+ throw new Error('Function not implemented.');
108
+ } } />
108
109
  );
109
110
 
110
111
  if (variant === 'inline') {
@@ -123,7 +124,7 @@ const renderField = resolvedProps => {
123
124
  return <FieldValueList variant={variant} fields={[{ name: label, value: val }]} key={key} />;
124
125
  };
125
126
 
126
- export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
127
+ export const Base{{COMPONENT_CLASS_NAME}}: Story = (args: any) => {
127
128
  const props = {
128
129
  getPConnect: () => {
129
130
  return {
@@ -139,7 +140,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
139
140
  getInheritedProps: () => {
140
141
  return pyReviewRaw.config.inheritedProps;
141
142
  },
142
- createComponent: config => {
143
+ createComponent: (config: any) => {
143
144
  // eslint-disable-next-line default-case
144
145
  switch (config.config.value) {
145
146
  case '@P .pyStatusWork':
@@ -161,7 +162,7 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
161
162
  setInheritedProp: () => {
162
163
  /* nothing */
163
164
  },
164
- resolveConfigProps: config => {
165
+ resolveConfigProps: (config: any) => {
165
166
  return config;
166
167
  }
167
168
  };
@@ -176,13 +177,13 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
176
177
  getPConnect: () => ({
177
178
  setInheritedProp: () => {},
178
179
  getChildren: () =>
179
- pyReviewRaw.children[0].children.map((child, index) => {
180
+ pyReviewRaw.children[0].children.map((child: any, index: number) => {
180
181
  return {
181
182
  getPConnect: () => ({
182
183
  getRawMetadata: () => pyReviewRaw.children[0].children[index],
183
184
  getConfigProps: () => {},
184
185
  resolveConfigProps: () => regionChildrenResolved[index],
185
- getComponent: config =>
186
+ getComponent: () =>
186
187
  props.getPConnect().createComponent(pyReviewRaw.children[0].children[index])
187
188
  })
188
189
  };
@@ -195,13 +196,13 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
195
196
  getPConnect: () => ({
196
197
  setInheritedProp: () => {},
197
198
  getChildren: () =>
198
- pyReviewRaw.children[1].children.map((child, index) => {
199
+ pyReviewRaw.children[1].children.map((child: any, index: number) => {
199
200
  return {
200
201
  getPConnect: () => ({
201
202
  getRawMetadata: () => pyReviewRaw.children[1].children[index],
202
203
  getConfigProps: () => {},
203
204
  resolveConfigProps: () => regionChildrenResolved[index],
204
- getComponent: config =>
205
+ getComponent: () =>
205
206
  props.getPConnect().createComponent(pyReviewRaw.children[1].children[index])
206
207
  })
207
208
  };
@@ -25,10 +25,8 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
25
25
  const propsToUse = { label, showLabel, ...getPConnect().getInheritedProps() };
26
26
 
27
27
  // update children with readonly
28
- Children.toArray(children).forEach(child => {
29
- // @ts-ignore
28
+ Children.toArray(children).forEach((child : any) => {
30
29
  child.props.getPConnect().setInheritedProp('readOnly', true);
31
- // @ts-ignore
32
30
  child.props.getPConnect().setInheritedProp('displayMode', 'DISPLAY_ONLY');
33
31
  });
34
32
 
@@ -44,8 +42,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
44
42
  if (showHighlightedData) {
45
43
  // @ts-ignore
46
44
  const { highlightedData = [] } = getPConnect().getRawMetadata().config;
47
- // @ts-ignore
48
- highlightedDataArr = highlightedData.map((field) => {
45
+ highlightedDataArr = highlightedData.map((field: any) => {
49
46
  return <HighlightRender field={field} getPConnect={props.getPConnect} />;
50
47
  });
51
48
  }
@@ -1,6 +1,4 @@
1
-
2
- // @ts-nocheck
3
- export const pyReviewRaw = {
1
+ export const pyReviewRaw: any = {
4
2
  name: 'pyReview',
5
3
  type: 'View',
6
4
  config: {
@@ -101,16 +101,13 @@ export function getLayoutDataFromRegion(regionData: any) {
101
101
  export function getIsAssignmentView(pConnect: Function) {
102
102
  // Get caseInfo content from the store which contains the view info about the current assignment/step
103
103
  // TODO To be replaced with pConnect.getCaseInfo().getCurrentAssignmentView when it's available
104
- // @ts-ignore
105
- const assignmentViewClass = pConnect.getValue(PCore.getConstants().CASE_INFO.CASE_INFO_CLASSID);
106
- // @ts-ignore
107
- const assignmentViewName = pConnect.getValue(PCore.getConstants().CASE_INFO.ASSIGNMENTACTION_ID);
104
+ const assignmentViewClass = pConnect().getValue(PCore.getConstants().CASE_INFO.CASE_INFO_CLASSID);
105
+ const assignmentViewName = pConnect().getValue(PCore.getConstants().CASE_INFO.ASSIGNMENTACTION_ID);
108
106
 
109
107
  const assignmentViewId = `${assignmentViewName}!${assignmentViewClass}`;
110
108
 
111
109
  // Get the info about the current view from pConnect
112
- // @ts-ignore
113
- const currentViewId = `${pConnect.getCurrentView()}!${pConnect.getCurrentClassID()}`;
110
+ const currentViewId = `${pConnect().getCurrentView()}!${pConnect().getCurrentClassID()}`;
114
111
 
115
112
  return assignmentViewId === currentViewId;
116
113
  }
@@ -121,8 +118,7 @@ export function getIsAssignmentView(pConnect: Function) {
121
118
  * @param {string} [instructions="casestep"] 'casestep', 'none', or the html content of a Rule-UI-Paragraph rule (processed via core's paragraph annotation handler)
122
119
  */
123
120
  export function getInstructions(pConnect: Function, instructions = 'casestep') {
124
- // @ts-ignore
125
- const caseStepInstructions = pConnect.getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS);
121
+ const caseStepInstructions = pConnect().getValue(PCore.getConstants().CASE_INFO.INSTRUCTIONS);
126
122
 
127
123
  // Determine if this view is the current assignment/step view
128
124
  const isCurrentAssignmentView = getIsAssignmentView(pConnect);
@@ -5,7 +5,7 @@ import { useState } from 'react';
5
5
  import type { Meta, StoryObj } from '@storybook/react';
6
6
 
7
7
  import {{COMPONENT_CLASS_NAME}} from './index';
8
- import { DateInput, Input, FieldValueList, Text } from '@pega/cosmos-react-core';
8
+ import { DateInput, Input, FieldValueList, Text, EmptyState } from '@pega/cosmos-react-core';
9
9
  import { PhoneInput as CosmosPhone } from '@pega/cosmos-react-core';
10
10
  import { pyReviewRaw, regionChildrenResolved } from './mock';
11
11
 
@@ -21,6 +21,9 @@ const meta: Meta<typeof {{COMPONENT_CLASS_NAME}}> = {
21
21
  export default meta;
22
22
  type Story = StoryObj<typeof {{COMPONENT_CLASS_NAME}}>;
23
23
 
24
+ // Below constant will define whether we're in readonly mode or not
25
+ const readOnly = true;
26
+
24
27
  const renderField = resolvedProps => {
25
28
  const { displayMode, value = '', label = '', key } = resolvedProps;
26
29
 
@@ -131,6 +134,44 @@ const renderField = resolvedProps => {
131
134
  </Text>
132
135
  );
133
136
  }
137
+
138
+ if (readOnly) {
139
+ return (
140
+ <EmptyState
141
+ key={Math.random()}
142
+ getPConnect={() => {
143
+ return {
144
+ getChildren: () => {
145
+ return [
146
+ {
147
+ getPConnect: () => {
148
+ return {
149
+ getRawMetadata: () => {
150
+ return {};
151
+ },
152
+ resolveConfigProps: props => {
153
+ return props;
154
+ },
155
+ getConfigProps: () => {
156
+ return {
157
+ value: '',
158
+ label: label,
159
+ displayMode: 'LABELS_LEFT'
160
+ };
161
+ },
162
+ getComponent: () => {
163
+ return val;
164
+ }
165
+ };
166
+ }
167
+ }
168
+ ];
169
+ }
170
+ };
171
+ }}
172
+ ></EmptyState>
173
+ );
174
+ }
134
175
  return (
135
176
  <FieldValueList
136
177
  variant={variant}
@@ -142,6 +183,7 @@ const renderField = resolvedProps => {
142
183
 
143
184
  export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
144
185
  const props = {
186
+ readOnly: readOnly,
145
187
  getPConnect: () => {
146
188
  return {
147
189
  getChildren: () => {
@@ -154,17 +196,35 @@ export const Base{{COMPONENT_CLASS_NAME}}: Story = args => {
154
196
  // eslint-disable-next-line default-case
155
197
  switch (config.config.value) {
156
198
  case '@P .FirstName':
157
- return renderField(regionChildrenResolved[0]);
199
+ return renderField({
200
+ ...regionChildrenResolved[0],
201
+ displayMode: readOnly ? 'LABELS_LEFT' : ''
202
+ });
158
203
  case '@P .MiddleName':
159
- return renderField(regionChildrenResolved[1]);
204
+ return renderField({
205
+ ...regionChildrenResolved[1],
206
+ displayMode: readOnly ? 'LABELS_LEFT' : ''
207
+ });
160
208
  case '@P .LastName':
161
- return renderField(regionChildrenResolved[2]);
209
+ return renderField({
210
+ ...regionChildrenResolved[2],
211
+ displayMode: readOnly ? 'LABELS_LEFT' : ''
212
+ });
162
213
  case '@P .Email':
163
- return renderField(regionChildrenResolved[3]);
214
+ return renderField({
215
+ ...regionChildrenResolved[3],
216
+ displayMode: readOnly ? 'LABELS_LEFT' : ''
217
+ });
164
218
  case '@P .PhoneNumber':
165
- return renderField(regionChildrenResolved[4]);
219
+ return renderField({
220
+ ...regionChildrenResolved[4],
221
+ displayMode: readOnly ? 'LABELS_LEFT' : ''
222
+ });
166
223
  case '@P .ServiceDate':
167
- return renderField(regionChildrenResolved[5]);
224
+ return renderField({
225
+ ...regionChildrenResolved[5],
226
+ displayMode: readOnly ? 'LABELS_LEFT' : ''
227
+ });
168
228
  }
169
229
  }
170
230
  };
@@ -24,12 +24,14 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
24
24
  const nCols = parseInt(NumCols, 10);
25
25
 
26
26
 
27
- if (readOnly && readOnly === true && displayMode && displayMode === 'DISPLAY_ONLY') {
27
+ if (readOnly && readOnly === true || displayMode && displayMode === 'DISPLAY_ONLY') {
28
28
  const numRegions = '1';
29
29
  const gridRepeat = 'repeat('.concat(numRegions).concat(', 1fr)');
30
30
  const gridContainer = { colGap: 0, 'margin-line-start': 0 };
31
31
  // @ts-ignore
32
32
  gridContainer.cols = gridRepeat;
33
+ // @ts-ignore
34
+ gridContainer.gap = 2;
33
35
 
34
36
  return (
35
37
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
@@ -67,8 +69,6 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
67
69
  <%={{ }}=%> {{! revert delimiters for mustache }}
68
70
  </Styled{{COMPONENT_CLASS_NAME}}Wrapper>
69
71
  );
70
-
71
-
72
72
  }
73
73
 
74
74
  export default withConfiguration({{COMPONENT_CLASS_NAME}});
@@ -32,7 +32,7 @@ function {{COMPONENT_CLASS_NAME}}(props: {{COMPONENT_CLASS_NAME}}Props) {
32
32
  // @ts-ignore
33
33
  flexContainer.gap = 2;
34
34
 
35
- if (readOnly && readOnly === true && displayMode && displayMode === 'DISPLAY_ONLY') {
35
+ if (readOnly && readOnly === true || displayMode && displayMode === 'DISPLAY_ONLY') {
36
36
  return (
37
37
  <Styled{{COMPONENT_CLASS_NAME}}Wrapper>
38
38
  {{! pick new delimiters for mustache }}