@etsoo/react 1.4.62 → 1.4.63

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.
@@ -12,7 +12,7 @@ export interface ViewPageField<T extends {}> extends GridProps {
12
12
  /**
13
13
  * Label field
14
14
  */
15
- label: string | (() => React.ReactNode);
15
+ label?: string | (() => React.ReactNode);
16
16
  /**
17
17
  * Display as single row
18
18
  */
@@ -27,12 +27,12 @@ function getItemField(field, data) {
27
27
  if (typeof fieldData === 'function')
28
28
  itemData = fieldData(data);
29
29
  else
30
- itemData = formatItemData(formatItemData);
30
+ itemData = formatItemData(data[fieldData]);
31
31
  // Field label
32
32
  itemLabel =
33
33
  typeof fieldLabel === 'function'
34
34
  ? fieldLabel()
35
- : (_a = globalApp.get(fieldLabel)) !== null && _a !== void 0 ? _a : fieldLabel;
35
+ : (_a = globalApp.get(fieldLabel !== null && fieldLabel !== void 0 ? fieldLabel : (typeof fieldData === 'string' ? fieldData : 'noData'))) !== null && _a !== void 0 ? _a : fieldLabel;
36
36
  }
37
37
  else {
38
38
  itemData = formatItemData(data[field]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.4.62",
3
+ "version": "1.4.63",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -17,7 +17,7 @@ export interface ViewPageField<T extends {}> extends GridProps {
17
17
  /**
18
18
  * Label field
19
19
  */
20
- label: string | (() => React.ReactNode);
20
+ label?: string | (() => React.ReactNode);
21
21
 
22
22
  /**
23
23
  * Display as single row
@@ -79,13 +79,16 @@ function getItemField<T>(
79
79
 
80
80
  // Field data
81
81
  if (typeof fieldData === 'function') itemData = fieldData(data);
82
- else itemData = formatItemData(formatItemData);
82
+ else itemData = formatItemData(data[fieldData]);
83
83
 
84
84
  // Field label
85
85
  itemLabel =
86
86
  typeof fieldLabel === 'function'
87
87
  ? fieldLabel()
88
- : globalApp.get<string>(fieldLabel) ?? fieldLabel;
88
+ : globalApp.get<string>(
89
+ fieldLabel ??
90
+ (typeof fieldData === 'string' ? fieldData : 'noData')
91
+ ) ?? fieldLabel;
89
92
  } else {
90
93
  itemData = formatItemData(data[field]);
91
94
  itemLabel = globalApp.get<string>(field) ?? field;