@visns-studio/visns-components 4.3.8 → 4.3.9
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.
|
@@ -124,15 +124,27 @@ function GenericFormBuilder({ setting, urlParam, userProfile }) {
|
|
|
124
124
|
const handleAddRowOption = (e) => {
|
|
125
125
|
e.preventDefault();
|
|
126
126
|
|
|
127
|
+
console.info(dataField);
|
|
128
|
+
|
|
129
|
+
// Initialize rows if it doesn't exist
|
|
130
|
+
if (!dataField.rows) {
|
|
131
|
+
setDataField((items) => ({
|
|
132
|
+
...items,
|
|
133
|
+
rows: [],
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
|
|
127
137
|
if (rowOption.label !== '') {
|
|
128
|
-
const isLabelUnique =
|
|
129
|
-
|
|
130
|
-
|
|
138
|
+
const isLabelUnique = dataField.rows
|
|
139
|
+
? !dataField.rows.some(
|
|
140
|
+
(option) => option.label === rowOption.label
|
|
141
|
+
)
|
|
142
|
+
: true;
|
|
131
143
|
|
|
132
144
|
if (isLabelUnique) {
|
|
133
145
|
setDataField((items) => ({
|
|
134
146
|
...items,
|
|
135
|
-
rows: [...items.rows, rowOption],
|
|
147
|
+
rows: [...(items.rows || []), rowOption],
|
|
136
148
|
}));
|
|
137
149
|
|
|
138
150
|
setRowOption(() => ({
|
|
@@ -179,6 +191,7 @@ function GenericFormBuilder({ setting, urlParam, userProfile }) {
|
|
|
179
191
|
label: '',
|
|
180
192
|
type: '',
|
|
181
193
|
options: [],
|
|
194
|
+
// rows: [],
|
|
182
195
|
size: 'half',
|
|
183
196
|
required: 'no',
|
|
184
197
|
}));
|
package/package.json
CHANGED