form0-core 0.1.14 → 0.1.15
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
|
@@ -75,18 +75,44 @@ const toRepeatableLabel = (field) =>
|
|
|
75
75
|
toTrimmedString(field?.key) ??
|
|
76
76
|
'Repeatable section';
|
|
77
77
|
|
|
78
|
+
const normalizeCalculatedDisplayStyle = (value) => {
|
|
79
|
+
const normalized = toTrimmedString(value);
|
|
80
|
+
if (!normalized) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
switch (normalized.toLowerCase()) {
|
|
85
|
+
case 'number':
|
|
86
|
+
return 'numeric';
|
|
87
|
+
case 'datetime':
|
|
88
|
+
return 'date';
|
|
89
|
+
default:
|
|
90
|
+
return normalized.toLowerCase();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
78
94
|
const getCalculatedDisplayStyle = (field) => {
|
|
79
95
|
if (!isRecord(field)) {
|
|
80
96
|
return null;
|
|
81
97
|
}
|
|
82
98
|
|
|
99
|
+
const directStyle =
|
|
100
|
+
normalizeCalculatedDisplayStyle(field.display_mode) ??
|
|
101
|
+
normalizeCalculatedDisplayStyle(field.display_style);
|
|
102
|
+
if (directStyle) {
|
|
103
|
+
return directStyle;
|
|
104
|
+
}
|
|
105
|
+
|
|
83
106
|
const display = field.display;
|
|
84
107
|
if (typeof display === 'string') {
|
|
85
|
-
return
|
|
108
|
+
return normalizeCalculatedDisplayStyle(display);
|
|
86
109
|
}
|
|
87
110
|
|
|
88
111
|
if (isRecord(display)) {
|
|
89
|
-
return
|
|
112
|
+
return (
|
|
113
|
+
normalizeCalculatedDisplayStyle(display.style) ??
|
|
114
|
+
normalizeCalculatedDisplayStyle(display.type)
|
|
115
|
+
);
|
|
90
116
|
}
|
|
91
117
|
|
|
92
118
|
return null;
|