@pega/custom-dx-components 0.23.31 → 0.23.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/custom-dx-components",
3
- "version": "0.23.31",
3
+ "version": "0.23.32",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -25,7 +25,10 @@
25
25
  "!.storybook",
26
26
  ".storybook/public",
27
27
  "**/demo.stories.jsx",
28
- "/**/mock.stories.js"
28
+ "**/mock.stories.js",
29
+ "**/demo.stories.tsx",
30
+ "**/mock.stories.ts",
31
+ "**/*.mdx"
29
32
  ],
30
33
  "rules": {
31
34
  // Prettier recommends running separately from a linter.
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "devDependencies": {
71
71
  "@pega/configs": "^0.6.0",
72
- "@pega/custom-dx-components": "0.23.31",
72
+ "@pega/custom-dx-components": "0.23.32",
73
73
  "@pega/pcore-pconnect-typedefs": "2.0.0",
74
74
  "@storybook/addon-actions": "^7.6.7",
75
75
  "@storybook/addon-essentials": "^7.6.7",
@@ -1,10 +1,4 @@
1
- import {
2
- isEmbeddedField,
3
- isPageListInPath,
4
- PAGE,
5
- PAGELIST,
6
- buildAggOrCalcId
7
- } from './repeat-utils.js';
1
+ import { isEmbeddedField, isPageListInPath, PAGE, PAGELIST, buildAggOrCalcId } from './repeat-utils.js';
8
2
 
9
3
  export const AT_FILTEREDLIST = '@FILTERED_LIST';
10
4
  export const AT_PROPERTY = '@P';
@@ -58,7 +52,7 @@ export function getEmbeddedFieldName(propertyName, classID) {
58
52
  * @param {Array} metaFields Fields metadata Array. Contains metadata of all the fields.
59
53
  */
60
54
  export function updateMetaEmbeddedFieldID(metaFields) {
61
- return metaFields.forEach(metaField => {
55
+ return metaFields.forEach((metaField) => {
62
56
  if (metaField.fieldID?.startsWith(PAGE) || metaField.fieldID?.startsWith(PAGELIST)) {
63
57
  metaField.fieldID = getFieldNameFromEmbeddedFieldName(metaField.fieldID);
64
58
  }
@@ -75,7 +69,7 @@ export function updateMetaEmbeddedFieldID(metaFields) {
75
69
  */
76
70
  export function getConfigEmbeddedFieldsMeta(configFields, classID) {
77
71
  const configEmbeddedFieldsMeta = [];
78
- configFields.forEach(field => {
72
+ configFields.forEach((field) => {
79
73
  let value = field;
80
74
  if (isEmbeddedField(value)) {
81
75
  // conversion Page.PageList[].property => Page.PageList.property
@@ -99,8 +93,8 @@ export function getConfigEmbeddedFieldsMeta(configFields, classID) {
99
93
  */
100
94
  export function mergeConfigEmbeddedFieldsMeta(configEmbeddedFieldsMeta, metaFields) {
101
95
  const mergedMetaFields = [...metaFields];
102
- configEmbeddedFieldsMeta.forEach(configFieldMeta => {
103
- const fieldMeta = metaFields.find(metaField => metaField.fieldID === configFieldMeta.fieldID);
96
+ configEmbeddedFieldsMeta.forEach((configFieldMeta) => {
97
+ const fieldMeta = metaFields.find((metaField) => metaField.fieldID === configFieldMeta.fieldID);
104
98
  if (!fieldMeta) mergedMetaFields.push(configFieldMeta);
105
99
  });
106
100
  return mergedMetaFields;
@@ -158,7 +152,7 @@ export function preparePropertyValue(value) {
158
152
  // FIXME #EmbeddedPropertyPatch
159
153
  // TODO: Remove this utility when we have nested response for queryable pageList and supports scalarList component
160
154
  export function updatePageListFieldsConfig(configFields) {
161
- return configFields.forEach(item => {
155
+ return configFields.forEach((item) => {
162
156
  if (item.type === 'ScalarList') {
163
157
  if (!item.config.originalValue) {
164
158
  item.config.originalValue = item.config.value;
@@ -172,7 +166,7 @@ export function updatePageListFieldsConfig(configFields) {
172
166
  * Update the renderer type for the properties of type Page.
173
167
  */
174
168
  export function updatePageFieldsConfig(configFields, parentClassID) {
175
- return configFields.forEach(item => {
169
+ return configFields.forEach((item) => {
176
170
  const {
177
171
  type,
178
172
  config: { value }
@@ -262,7 +256,7 @@ export function preparePropertyMaps(fields, classID, context) {
262
256
  export function getPageListFields(fields) {
263
257
  const parentPaths = new Set();
264
258
  const pageListFields = [];
265
- fields.forEach(field => {
259
+ fields.forEach((field) => {
266
260
  const { name } = field;
267
261
  if (isPageListProperty(name)) {
268
262
  const parentPath = name.substring(0, name.lastIndexOf(':'));
@@ -275,12 +269,7 @@ export function getPageListFields(fields) {
275
269
  return pageListFields;
276
270
  }
277
271
 
278
- export function mergePageListFieldAggregation(
279
- pageListName,
280
- select,
281
- existingAggregations,
282
- existingAggregationsName
283
- ) {
272
+ export function mergePageListFieldAggregation(pageListName, select, existingAggregations, existingAggregationsName) {
284
273
  // Build a dummy genericAggregationId to check if any type of aggregation for that pagelist is included in existing aggregations.
285
274
  const genericAggregationId = buildAggOrCalcId(pageListName, '');
286
275
  if (existingAggregationsName.includes(genericAggregationId)) {
@@ -295,7 +284,7 @@ export function mergePageListFieldsAggregation(fields, select, existingAggregati
295
284
  const parentPaths = new Set();
296
285
  const existingAggregationsName = Object.keys(existingAggregations).toString();
297
286
  const pageListFields = [];
298
- fields.forEach(field => {
287
+ fields.forEach((field) => {
299
288
  const { name } = field;
300
289
  if (isPageListProperty(name)) {
301
290
  const parentPath = name.substring(0, name.lastIndexOf(':'));
@@ -317,5 +306,5 @@ export function mergePageListFieldsAggregation(fields, select, existingAggregati
317
306
  * @returns {object | undefined} value of first pageListProperty found
318
307
  */
319
308
  export function hasPageListProperty(fieldDefs) {
320
- return fieldDefs?.find(field => isPageListProperty(field.name));
309
+ return fieldDefs?.find((field) => isPageListProperty(field.name));
321
310
  }
@@ -1,4 +1,4 @@
1
- import dayjs from 'dayjs';
1
+ import dayjs from "dayjs";
2
2
  import relativeTime from 'dayjs/plugin/relativeTime.js';
3
3
  import localizedFormat from 'dayjs/plugin/localizedFormat.js';
4
4
  import utc from 'dayjs/plugin/utc.js';
@@ -16,11 +16,11 @@ dayjs.extend(timezone);
16
16
  * @param {string} text datetime
17
17
  * @returns {object} datetime as a dayjs object
18
18
  */
19
- export const getDayJSObject = text => {
19
+ export const getDayJSObject = (text) => {
20
20
  const momObj = dayjs(text);
21
21
  if (momObj.isValid()) return momObj;
22
22
  const timeStamp = text;
23
- const isDateTime = timeStamp.indexOf('GMT') !== -1;
23
+ const isDateTime = timeStamp.indexOf("GMT") !== -1;
24
24
  const year = parseInt(timeStamp.substr(0, 4), 10);
25
25
  const month = parseInt(timeStamp.substr(4, 2), 10) - 1;
26
26
  const day = parseInt(timeStamp.substr(6, 2), 10);
@@ -46,7 +46,7 @@ export const getDayJSObject = text => {
46
46
  }
47
47
 
48
48
  mom = dayjs(
49
- mom.toLocaleString('en-US', {
49
+ mom.toLocaleString("en-US", {
50
50
  timeZone: CurrentTz
51
51
  })
52
52
  );
@@ -60,8 +60,8 @@ export const getDayJSObject = text => {
60
60
  * @param {string} time datetime
61
61
  * @returns {object} relative time from now
62
62
  */
63
- export const getRelativeTime = time => {
64
- let relativetime = '';
63
+ export const getRelativeTime = (time) => {
64
+ let relativetime = "";
65
65
  if (dayjs(time).isUTC()) {
66
66
  relativetime = dayjs(time).fromNow();
67
67
  } else {
@@ -77,7 +77,7 @@ export const getRelativeTime = time => {
77
77
  * @param {string} value from which Year needs to be taken out
78
78
  * @returns {number} year for the date passed
79
79
  */
80
- export const getFullYear = value =>
80
+ export const getFullYear = (value) =>
81
81
  value ? new Date(value).getFullYear() : new Date().getFullYear();
82
82
 
83
83
  /**
@@ -127,8 +127,8 @@ export const getMinDate = (previousYears, currentYear, yearFromValue) => {
127
127
  *
128
128
  * @returns {number} clockFormat
129
129
  */
130
- export const parseClockFormat = clockFormat =>
131
- typeof clockFormat === 'string' ? parseInt(clockFormat, 10) : clockFormat;
130
+ export const parseClockFormat = (clockFormat) =>
131
+ typeof clockFormat === "string" ? parseInt(clockFormat, 10) : clockFormat;
132
132
 
133
133
  /**
134
134
  * Return datetime value string off to seconds
@@ -140,9 +140,9 @@ export const parseClockFormat = clockFormat =>
140
140
  */
141
141
  export const correctDateTimeToSeconds = (datetime, withSeconds) => {
142
142
  if (withSeconds) {
143
- return `${datetime.substring(0, datetime.indexOf('Z'))}.000Z`;
143
+ return `${datetime.substring(0, datetime.indexOf("Z"))}.000Z`;
144
144
  }
145
- return `${datetime.substring(0, datetime.lastIndexOf(':'))}:00.000Z`;
145
+ return `${datetime.substring(0, datetime.lastIndexOf(":"))}:00.000Z`;
146
146
  };
147
147
 
148
148
  /**
@@ -155,9 +155,12 @@ export const correctDateTimeToSeconds = (datetime, withSeconds) => {
155
155
  */
156
156
  export const timeCorrectedToSeconds = (datetime, withSeconds) => {
157
157
  if (withSeconds) {
158
- return datetime.substring(datetime.indexOf('T') + 1, datetime.indexOf('.'));
158
+ return datetime.substring(datetime.indexOf("T") + 1, datetime.indexOf("."));
159
159
  }
160
- return `${datetime.substring(datetime.indexOf('T') + 1, datetime.lastIndexOf(':'))}:00`;
160
+ return `${datetime.substring(
161
+ datetime.indexOf("T") + 1,
162
+ datetime.lastIndexOf(":")
163
+ )}:00`;
161
164
  };
162
165
 
163
166
  /**
@@ -180,13 +183,14 @@ export const datetimeFireChangeBlurEvents = (
180
183
  propName,
181
184
  pConn
182
185
  ) => {
186
+
183
187
  // TODO - clean up, we should not rely on timestamp from cosmos to check InComplete validation
184
188
  // above triggerFieldChange should have validated this
185
189
  if (errorState) {
186
190
  pConn.getValidationApi().validate(errorState);
187
191
  }
188
192
  // BUG-640834 In errorState presist old values avoiding store update & re-render.
189
- else {
193
+ else{
190
194
  if (formattedValue !== actualValue) {
191
195
  actions.updateFieldValue(propName, formattedValue);
192
196
  }
@@ -207,27 +211,27 @@ export const getDateFormat = (locale, options) => {
207
211
  .formatToParts()
208
212
  .map(({ type, value }) => {
209
213
  switch (type) {
210
- case 'day':
211
- return 'DD';
212
- case 'month':
213
- return 'MM';
214
- case 'year':
215
- return 'YYYY';
216
- case 'hour':
217
- return 'hh';
218
- case 'minute':
219
- return 'mm';
220
- case 'second':
221
- return 'ss';
222
- case 'dayPeriod':
223
- return 'A';
224
- case 'literal':
214
+ case "day":
215
+ return "DD";
216
+ case "month":
217
+ return "MM";
218
+ case "year":
219
+ return "YYYY";
220
+ case "hour":
221
+ return "hh";
222
+ case "minute":
223
+ return "mm";
224
+ case "second":
225
+ return "ss";
226
+ case "dayPeriod":
227
+ return "A";
228
+ case "literal":
225
229
  return value;
226
230
  default:
227
- return '';
231
+ return "";
228
232
  }
229
233
  })
230
- .join('');
234
+ .join("");
231
235
  };
232
236
 
233
237
  /**
@@ -237,13 +241,15 @@ export const getDateFormat = (locale, options) => {
237
241
  * @returns {boolean} True or False for the locale
238
242
  * Example : getDateFormat("pl-PL") returns false
239
243
  */
240
- export const is12HClockFormat = locale => {
244
+ export const is12HClockFormat = (locale) => {
241
245
  const meridiem = new Intl.DateTimeFormat(locale, {
242
- hour: 'numeric'
246
+ hour: "numeric"
243
247
  })
244
248
  .formatToParts()
245
- .find(({ type }) => type === 'dayPeriod');
246
- return !!(meridiem === null || meridiem === undefined ? undefined : meridiem.value);
249
+ .find(({ type }) => type === "dayPeriod");
250
+ return !!(meridiem === null || meridiem === undefined
251
+ ? undefined
252
+ : meridiem.value);
247
253
  };
248
254
 
249
255
  /**
@@ -256,9 +262,9 @@ export const is12HClockFormat = locale => {
256
262
  */
257
263
  export const getTimeOptions = (withSeconds, is12h = false) => {
258
264
  return {
259
- hour: 'numeric',
260
- minute: 'numeric',
261
- ...(withSeconds && { second: 'numeric' }),
265
+ hour: "numeric",
266
+ minute: "numeric",
267
+ ...(withSeconds && { second: "numeric" }),
262
268
  hour12: is12h
263
269
  };
264
270
  };
@@ -273,9 +279,9 @@ export const getTimeOptions = (withSeconds, is12h = false) => {
273
279
  */
274
280
  export const getDateTimeOptions = (withSeconds, is12h = false) => {
275
281
  return {
276
- year: 'numeric',
277
- month: 'numeric',
278
- day: 'numeric',
282
+ year: "numeric",
283
+ month: "numeric",
284
+ day: "numeric",
279
285
  ...getTimeOptions(withSeconds, is12h)
280
286
  };
281
287
  };
@@ -9,26 +9,26 @@ dayjs.extend(localizedFormat);
9
9
  dayjs.extend(utc);
10
10
  dayjs.extend(timezone);
11
11
 
12
- export const datetimedisplayformatter = formatter => {
12
+ export const datetimedisplayformatter = (formatter) => {
13
13
  const objectvalues = {};
14
14
  switch (formatter) {
15
- case 'DateTime-Long': {
16
- objectvalues.variantVal = 'datetime';
17
- objectvalues.formatVal = 'long';
15
+ case "DateTime-Long": {
16
+ objectvalues.variantVal = "datetime";
17
+ objectvalues.formatVal = "long";
18
18
  break;
19
19
  }
20
- case 'DateTime-Short': {
21
- objectvalues.variantVal = 'date';
22
- objectvalues.formatVal = 'short';
20
+ case "DateTime-Short": {
21
+ objectvalues.variantVal = "date";
22
+ objectvalues.formatVal = "short";
23
23
  break;
24
24
  }
25
- case 'DateTime-Since': {
26
- objectvalues.variantVal = 'relative';
25
+ case "DateTime-Since": {
26
+ objectvalues.variantVal = "relative";
27
27
  break;
28
28
  }
29
- case 'Time-Only': {
30
- objectvalues.variantVal = 'time';
31
- objectvalues.formatVal = 'short';
29
+ case "Time-Only": {
30
+ objectvalues.variantVal = "time";
31
+ objectvalues.formatVal = "short";
32
32
  break;
33
33
  }
34
34
  // no default
@@ -36,8 +36,13 @@ export const datetimedisplayformatter = formatter => {
36
36
  return objectvalues;
37
37
  };
38
38
 
39
- export const formatExists = formatterVal => {
40
- const formatterValues = ['DateTime-Long', 'DateTime-Short', 'DateTime-Since', 'Time-Only'];
39
+ export const formatExists = (formatterVal) => {
40
+ const formatterValues = [
41
+ "DateTime-Long",
42
+ "DateTime-Short",
43
+ "DateTime-Since",
44
+ "Time-Only"
45
+ ];
41
46
  let isformatter = false;
42
47
  if (formatterValues.includes(formatterVal)) {
43
48
  isformatter = true;
@@ -45,6 +50,8 @@ export const formatExists = formatterVal => {
45
50
  return isformatter;
46
51
  };
47
52
 
53
+
54
+
48
55
  /**
49
56
  * Return relative time in fromNow for the given datetime
50
57
  * @description Convert and return the given datetime in dayJSObject
@@ -52,11 +59,11 @@ export const formatExists = formatterVal => {
52
59
  * @param {string} text datetime
53
60
  * @returns {object} datetime as a dayjs object
54
61
  */
55
- export const getDayJSObject = text => {
62
+ export const getDayJSObject = (text) => {
56
63
  const momObj = dayjs(text);
57
64
  if (momObj.isValid()) return momObj;
58
65
  const timeStamp = text;
59
- const isDateTime = timeStamp.indexOf('GMT') !== -1;
66
+ const isDateTime = timeStamp.indexOf("GMT") !== -1;
60
67
  const year = parseInt(timeStamp.substr(0, 4), 10);
61
68
  const month = parseInt(timeStamp.substr(4, 2), 10) - 1;
62
69
  const day = parseInt(timeStamp.substr(6, 2), 10);
@@ -82,7 +89,7 @@ export const getDayJSObject = text => {
82
89
  }
83
90
 
84
91
  mom = dayjs(
85
- mom.toLocaleString('en-US', {
92
+ mom.toLocaleString("en-US", {
86
93
  timeZone: CurrentTz
87
94
  })
88
95
  );
@@ -96,8 +103,8 @@ export const getDayJSObject = text => {
96
103
  * @param {string} time datetime
97
104
  * @returns {object} relative time from now
98
105
  */
99
- export const getRelativeTime = time => {
100
- let relativetime = '';
106
+ export const getRelativeTime = (time) => {
107
+ let relativetime = "";
101
108
  if (dayjs(time).isUTC()) {
102
109
  relativetime = dayjs(time).fromNow();
103
110
  } else {
@@ -113,7 +120,7 @@ export const getRelativeTime = time => {
113
120
  * @param {string} value from which Year needs to be taken out
114
121
  * @returns {number} year for the date passed
115
122
  */
116
- export const getFullYear = value =>
123
+ export const getFullYear = (value) =>
117
124
  value ? new Date(value).getFullYear() : new Date().getFullYear();
118
125
 
119
126
  /**
@@ -163,8 +170,8 @@ export const getMinDate = (previousYears, currentYear, yearFromValue) => {
163
170
  *
164
171
  * @returns {number} clockFormat
165
172
  */
166
- export const parseClockFormat = clockFormat =>
167
- typeof clockFormat === 'string' ? parseInt(clockFormat, 10) : clockFormat;
173
+ export const parseClockFormat = (clockFormat) =>
174
+ typeof clockFormat === "string" ? parseInt(clockFormat, 10) : clockFormat;
168
175
 
169
176
  /**
170
177
  * Return datetime value string off to seconds
@@ -176,9 +183,9 @@ export const parseClockFormat = clockFormat =>
176
183
  */
177
184
  export const correctDateTimeToSeconds = (datetime, withSeconds) => {
178
185
  if (withSeconds) {
179
- return `${datetime.substring(0, datetime.indexOf('Z'))}.000Z`;
186
+ return `${datetime.substring(0, datetime.indexOf("Z"))}.000Z`;
180
187
  }
181
- return `${datetime.substring(0, datetime.lastIndexOf(':'))}:00.000Z`;
188
+ return `${datetime.substring(0, datetime.lastIndexOf(":"))}:00.000Z`;
182
189
  };
183
190
 
184
191
  /**
@@ -191,9 +198,12 @@ export const correctDateTimeToSeconds = (datetime, withSeconds) => {
191
198
  */
192
199
  export const timeCorrectedToSeconds = (datetime, withSeconds) => {
193
200
  if (withSeconds) {
194
- return datetime.substring(datetime.indexOf('T') + 1, datetime.indexOf('.'));
201
+ return datetime.substring(datetime.indexOf("T") + 1, datetime.indexOf("."));
195
202
  }
196
- return `${datetime.substring(datetime.indexOf('T') + 1, datetime.lastIndexOf(':'))}:00`;
203
+ return `${datetime.substring(
204
+ datetime.indexOf("T") + 1,
205
+ datetime.lastIndexOf(":")
206
+ )}:00`;
197
207
  };
198
208
 
199
209
  /**
@@ -216,13 +226,14 @@ export const datetimeFireChangeBlurEvents = (
216
226
  propName,
217
227
  pConn
218
228
  ) => {
229
+
219
230
  // TODO - clean up, we should not rely on timestamp from cosmos to check InComplete validation
220
231
  // above triggerFieldChange should have validated this
221
232
  if (errorState) {
222
233
  pConn.getValidationApi().validate(errorState);
223
234
  }
224
235
  // BUG-640834 In errorState presist old values avoiding store update & re-render.
225
- else {
236
+ else{
226
237
  if (formattedValue !== actualValue) {
227
238
  actions.updateFieldValue(propName, formattedValue);
228
239
  }
@@ -243,27 +254,27 @@ export const getDateFormat = (locale, options) => {
243
254
  .formatToParts()
244
255
  .map(({ type, value }) => {
245
256
  switch (type) {
246
- case 'day':
247
- return 'DD';
248
- case 'month':
249
- return 'MM';
250
- case 'year':
251
- return 'YYYY';
252
- case 'hour':
253
- return 'hh';
254
- case 'minute':
255
- return 'mm';
256
- case 'second':
257
- return 'ss';
258
- case 'dayPeriod':
259
- return 'A';
260
- case 'literal':
257
+ case "day":
258
+ return "DD";
259
+ case "month":
260
+ return "MM";
261
+ case "year":
262
+ return "YYYY";
263
+ case "hour":
264
+ return "hh";
265
+ case "minute":
266
+ return "mm";
267
+ case "second":
268
+ return "ss";
269
+ case "dayPeriod":
270
+ return "A";
271
+ case "literal":
261
272
  return value;
262
273
  default:
263
- return '';
274
+ return "";
264
275
  }
265
276
  })
266
- .join('');
277
+ .join("");
267
278
  };
268
279
 
269
280
  /**
@@ -273,13 +284,15 @@ export const getDateFormat = (locale, options) => {
273
284
  * @returns {boolean} True or False for the locale
274
285
  * Example : getDateFormat("pl-PL") returns false
275
286
  */
276
- export const is12HClockFormat = locale => {
287
+ export const is12HClockFormat = (locale) => {
277
288
  const meridiem = new Intl.DateTimeFormat(locale, {
278
- hour: 'numeric'
289
+ hour: "numeric"
279
290
  })
280
291
  .formatToParts()
281
- .find(({ type }) => type === 'dayPeriod');
282
- return !!(meridiem === null || meridiem === undefined ? undefined : meridiem.value);
292
+ .find(({ type }) => type === "dayPeriod");
293
+ return !!(meridiem === null || meridiem === undefined
294
+ ? undefined
295
+ : meridiem.value);
283
296
  };
284
297
 
285
298
  /**
@@ -292,9 +305,9 @@ export const is12HClockFormat = locale => {
292
305
  */
293
306
  export const getTimeOptions = (withSeconds, is12h = false) => {
294
307
  return {
295
- hour: 'numeric',
296
- minute: 'numeric',
297
- ...(withSeconds && { second: 'numeric' }),
308
+ hour: "numeric",
309
+ minute: "numeric",
310
+ ...(withSeconds && { second: "numeric" }),
298
311
  hour12: is12h
299
312
  };
300
313
  };
@@ -309,9 +322,9 @@ export const getTimeOptions = (withSeconds, is12h = false) => {
309
322
  */
310
323
  export const getDateTimeOptions = (withSeconds, is12h = false) => {
311
324
  return {
312
- year: 'numeric',
313
- month: 'numeric',
314
- day: 'numeric',
325
+ year: "numeric",
326
+ month: "numeric",
327
+ day: "numeric",
315
328
  ...getTimeOptions(withSeconds, is12h)
316
329
  };
317
330
  };
@@ -17,15 +17,15 @@ export function getAllFields(pConnect) {
17
17
 
18
18
  let allFields = [];
19
19
 
20
- const makeField = f => ({
20
+ const makeField = (f) => ({
21
21
  ...pConnect().resolveConfigProps(f.config),
22
22
  type: f.type
23
23
  });
24
24
 
25
25
  const hasRegions = !!metadata.children[0]?.children;
26
26
  if (hasRegions) {
27
- allFields = metadata.children.map(region =>
28
- region.children.map(field => {
27
+ allFields = metadata.children.map((region) =>
28
+ region.children.map((field) => {
29
29
  // Do not resolve the config props if is status work, instead create component here as status badge and mark as status display
30
30
  if (field.config?.value === '@P .pyStatusWork') {
31
31
  field.type = 'TextInput';
@@ -110,9 +110,7 @@ export function prepareComponentInCaseSummary(configObject, getPConnect, display
110
110
  // createdComponent.props.getPConnect().setInheritedProp("hideLabel", true);
111
111
  caseSummaryComponentObject.value = createdComponent;
112
112
  if (type === 'reference') {
113
- caseSummaryComponentObject.name = createdComponent.props
114
- .getPConnect()
115
- .getInheritedProps().label;
113
+ caseSummaryComponentObject.name = createdComponent.props.getPConnect().getInheritedProps().label;
116
114
  }
117
115
 
118
116
  return caseSummaryComponentObject;
@@ -131,12 +129,12 @@ export function getFilteredFields(getPConnect) {
131
129
  }
132
130
 
133
131
  // Filter out fields that are not visible and unsupported types for primary fields (for CaseSummary)
134
- primaryFieldsRaw = primaryFieldsRaw.filter(item => {
132
+ primaryFieldsRaw = primaryFieldsRaw.filter((item) => {
135
133
  const resolvedItem = getPConnect().resolveConfigProps(item.config);
136
134
  return resolvedItem.visibility !== false && item.type !== 'TextContent';
137
135
  });
138
136
 
139
- secondaryFieldsRaw = secondaryFieldsRaw.filter(item => {
137
+ secondaryFieldsRaw = secondaryFieldsRaw.filter((item) => {
140
138
  const resolvedItem = getPConnect().resolveConfigProps(item.config);
141
139
  return resolvedItem.visibility !== false && item.type !== 'TextContent';
142
140
  });
@@ -163,9 +161,7 @@ export function getLayoutDataFromRegion(regionData) {
163
161
  const itemPConnect = item?.getPConnect();
164
162
 
165
163
  return {
166
- id: itemPConnect?.getComponentName()
167
- ? `${itemPConnect.getComponentName()}--${index}`
168
- : `item--${index}`,
164
+ id: itemPConnect?.getComponentName() ? `${itemPConnect.getComponentName()}--${index}` : `item--${index}`,
169
165
  content: itemPConnect?.getComponent(),
170
166
  layoutConfig: {
171
167
  ...defaultLayoutConfig,
@@ -216,8 +212,9 @@ export function getInstructions(pConnect, instructions = 'casestep') {
216
212
 
217
213
  // If the annotation wasn't processed correctly, don't return any instruction text
218
214
  if (instructions?.startsWith('@PARAGRAPH')) {
215
+ /* eslint-disable no-console */
219
216
  console.error('@PARAGRAPH annotation was not processed. Hiding custom instructions.');
220
-
217
+ /* eslint-enable no-console */
221
218
  return undefined;
222
219
  }
223
220