@axinom/mosaic-ui 0.64.0-rc.1 → 0.64.0-rc.2
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/Explorer/BulkEdit/FormFieldsConfigConverter.spec.tsx +1 -1
- package/src/components/Explorer/BulkEdit/FormFieldsConfigConverter.tsx +7 -26
- package/src/components/Explorer/Explorer.stories.tsx +0 -1
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.2",
|
|
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": "b268105fb427d813ef333c4ebc476aa47e991a5a"
|
|
116
116
|
}
|
|
@@ -145,7 +145,7 @@ describe('BulkEditFormFieldsConfigConverter', () => {
|
|
|
145
145
|
);
|
|
146
146
|
|
|
147
147
|
expect(consoleWarnSpy).toHaveBeenCalledWith(
|
|
148
|
-
'No component found for field type: UnsupportedType',
|
|
148
|
+
'Bulk Edit: No component found for field type: UnsupportedType',
|
|
149
149
|
);
|
|
150
150
|
expect(getByTestId('FieldSelection')).toBeInTheDocument();
|
|
151
151
|
expect(container.firstChild).toBeEmptyDOMElement();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Field, useFormikContext } from 'formik';
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
3
|
import { Data } from '../../../types';
|
|
4
4
|
import { FieldSelection } from '../../FieldSelection';
|
|
5
5
|
import {
|
|
@@ -23,14 +23,8 @@ export const BulkEditFormFieldsConfigConverter = (
|
|
|
23
23
|
const keys = Object.keys(config);
|
|
24
24
|
|
|
25
25
|
const FormFields: React.FC = () => {
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
setFieldTouched,
|
|
29
|
-
setErrors,
|
|
30
|
-
errors,
|
|
31
|
-
validateForm,
|
|
32
|
-
values,
|
|
33
|
-
} = useFormikContext<Data>();
|
|
26
|
+
const { setFieldValue, setFieldTouched, setErrors, errors, validateForm } =
|
|
27
|
+
useFormikContext<Data>();
|
|
34
28
|
|
|
35
29
|
const onFieldRemoved = (field: string): void => {
|
|
36
30
|
setFieldValue(field, undefined, false); // Clear the field value when removed
|
|
@@ -47,17 +41,6 @@ export const BulkEditFormFieldsConfigConverter = (
|
|
|
47
41
|
}
|
|
48
42
|
};
|
|
49
43
|
|
|
50
|
-
// Effect to clear empty fields
|
|
51
|
-
// This will set fields with empty strings or empty arrays to undefined
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
values &&
|
|
54
|
-
Object.keys(values).forEach((key) => {
|
|
55
|
-
if (values[key] === '' || values[key].length === 0) {
|
|
56
|
-
setFieldValue(key, undefined);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}, [setFieldValue, values]);
|
|
60
|
-
|
|
61
44
|
const onFieldAdded = (field: string): void => {
|
|
62
45
|
setFieldTouched(field, true); // Mark the field as touched when added
|
|
63
46
|
};
|
|
@@ -78,7 +61,9 @@ export const BulkEditFormFieldsConfigConverter = (
|
|
|
78
61
|
|
|
79
62
|
if (!Component) {
|
|
80
63
|
// eslint-disable-next-line no-console
|
|
81
|
-
console.warn(
|
|
64
|
+
console.warn(
|
|
65
|
+
`Bulk Edit: No component found for field type: ${fieldType}`,
|
|
66
|
+
);
|
|
82
67
|
return null; // Filter out null entries later
|
|
83
68
|
}
|
|
84
69
|
|
|
@@ -88,12 +73,8 @@ export const BulkEditFormFieldsConfigConverter = (
|
|
|
88
73
|
key={key}
|
|
89
74
|
label={fieldConfig.label}
|
|
90
75
|
validate={(value: unknown) => {
|
|
91
|
-
if (fieldType === 'Array') {
|
|
92
|
-
// Array can be empty, so no validation needed
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
76
|
if (value === null || value === undefined || value === '') {
|
|
96
|
-
return '
|
|
77
|
+
return 'Please provide a value';
|
|
97
78
|
}
|
|
98
79
|
}}
|
|
99
80
|
autoFocus={true}
|
|
@@ -554,7 +554,6 @@ export const BulkEdit: StoryObj<ExplorerStoryType> = {
|
|
|
554
554
|
...Default.args,
|
|
555
555
|
stationKey: 'StoryBookExplorer_QuickEdit',
|
|
556
556
|
bulkEditRegistration: {
|
|
557
|
-
label: 'Bulk Edit',
|
|
558
557
|
config: BulkEditImagesAsyncFormFieldsConfig,
|
|
559
558
|
saveData: async (data, items) => {
|
|
560
559
|
// eslint-disable-next-line no-console
|