@axinom/mosaic-ui 0.63.0 → 0.63.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axinom/mosaic-ui",
3
- "version": "0.63.0",
3
+ "version": "0.63.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": "dbd1826dcce67b30117a399e4428db62caa949e2"
115
+ "gitHead": "d46924b900b1e93fe125e22418d2e9db4bf86fcc"
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, { useEffect, useMemo } from '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
- setFieldValue,
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(`No component found for field type: ${fieldType}`);
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 'This field is required';
77
+ return 'Please provide a value';
97
78
  }
98
79
  }}
99
80
  autoFocus={true}
@@ -73,7 +73,7 @@ export const useBulkEdit = <T extends Data>({
73
73
  () =>
74
74
  bulkEditRegistration
75
75
  ? {
76
- label: bulkEditRegistration.label ?? 'Bulk Edit',
76
+ label: bulkEditRegistration.label ?? 'Edit',
77
77
  icon: bulkEditRegistration.icon ?? IconName.BulkEdit,
78
78
  tag: 'BETA',
79
79
  onClick: () => setIsBulkEditMode((prev) => !prev),
@@ -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
@@ -67,6 +67,7 @@ export const FormStationHeader: React.FC<
67
67
  actionItems.push({
68
68
  label: saveHeaderActionConfig.label,
69
69
  icon: saveHeaderActionConfig.icon,
70
+ confirmationMode: bulkEditContext ? 'Simple' : 'None',
70
71
  kind: 'action',
71
72
  actionType: PageHeaderActionType.Context,
72
73
  onClick: async () => {