@axinom/mosaic-ui 0.64.0-rc.3 → 0.64.0-rc.5
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/dist/components/Explorer/BulkEdit/FormFieldsConfigConverter.d.ts.map +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/DynamicDataList/DynamicListRow/DynamicListRow.tsx +1 -1
- package/src/components/Explorer/BulkEdit/FormFieldsConfigConverter.tsx +29 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axinom/mosaic-ui",
|
|
3
|
-
"version": "0.64.0-rc.
|
|
3
|
+
"version": "0.64.0-rc.5",
|
|
4
4
|
"description": "UI components for building Axinom Mosaic applications",
|
|
5
5
|
"author": "Axinom",
|
|
6
6
|
"license": "PROPRIETARY",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"publishConfig": {
|
|
113
113
|
"access": "public"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "ba8b2e57a1286b215fa3cbf48e65cd9a4ff254d3"
|
|
116
116
|
}
|
|
@@ -139,7 +139,7 @@ export const DynamicListRow = <T extends Data>({
|
|
|
139
139
|
onClick={() => allowEditing && onRowClicked(data)}
|
|
140
140
|
>
|
|
141
141
|
{showPositionColumn && (
|
|
142
|
-
<div className={classes.position}>
|
|
142
|
+
<div className={classes.position} onClick={(e) => e.stopPropagation()}>
|
|
143
143
|
{allowDragging && (
|
|
144
144
|
<div className={classes.draggable} {...provided?.dragHandleProps}>
|
|
145
145
|
<Icons icon={IconName.Drag} className={classes.dragIcon} />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Field, useFormikContext } from 'formik';
|
|
2
|
-
import React, { useMemo } from 'react';
|
|
2
|
+
import React, { useEffect, useMemo } from 'react';
|
|
3
3
|
import { Data } from '../../../types';
|
|
4
4
|
import { FieldSelection } from '../../FieldSelection';
|
|
5
5
|
import {
|
|
@@ -23,8 +23,28 @@ export const BulkEditFormFieldsConfigConverter = (
|
|
|
23
23
|
const keys = Object.keys(config);
|
|
24
24
|
|
|
25
25
|
const FormFields: React.FC = () => {
|
|
26
|
-
const {
|
|
27
|
-
|
|
26
|
+
const {
|
|
27
|
+
setFieldValue,
|
|
28
|
+
setFieldTouched,
|
|
29
|
+
setErrors,
|
|
30
|
+
errors,
|
|
31
|
+
validateForm,
|
|
32
|
+
values,
|
|
33
|
+
} = useFormikContext<Data>();
|
|
34
|
+
|
|
35
|
+
// Effect to clear empty fields
|
|
36
|
+
// This will set fields with empty strings or empty arrays to undefined
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
values &&
|
|
39
|
+
Object.keys(values).forEach((key) => {
|
|
40
|
+
if (
|
|
41
|
+
values[key] === '' ||
|
|
42
|
+
(Array.isArray(values[key]) && values[key].length === 0)
|
|
43
|
+
) {
|
|
44
|
+
setFieldValue(key, undefined);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}, [setFieldValue, values]);
|
|
28
48
|
|
|
29
49
|
const onFieldRemoved = (field: string): void => {
|
|
30
50
|
setFieldValue(field, undefined, false); // Clear the field value when removed
|
|
@@ -73,7 +93,12 @@ export const BulkEditFormFieldsConfigConverter = (
|
|
|
73
93
|
key={key}
|
|
74
94
|
label={fieldConfig.label}
|
|
75
95
|
validate={(value: unknown) => {
|
|
76
|
-
if (
|
|
96
|
+
if (
|
|
97
|
+
value === null ||
|
|
98
|
+
value === undefined ||
|
|
99
|
+
value === '' ||
|
|
100
|
+
(Array.isArray(value) && value.length === 0)
|
|
101
|
+
) {
|
|
77
102
|
return 'Please provide a value';
|
|
78
103
|
}
|
|
79
104
|
}}
|