@axinom/mosaic-ui 0.64.0-rc.1 → 0.64.0-rc.11

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.64.0-rc.1",
3
+ "version": "0.64.0-rc.11",
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": "7687500b82d8ba095097fac0e55bb1b317748237"
115
+ "gitHead": "309b232320896ccf706d8adb4bd6b38be6499e94"
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} />
@@ -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();
@@ -32,6 +32,20 @@ export const BulkEditFormFieldsConfigConverter = (
32
32
  values,
33
33
  } = useFormikContext<Data>();
34
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]);
48
+
35
49
  const onFieldRemoved = (field: string): void => {
36
50
  setFieldValue(field, undefined, false); // Clear the field value when removed
37
51
  setFieldTouched(field, false, false); // Mark the field as not touched
@@ -47,17 +61,6 @@ export const BulkEditFormFieldsConfigConverter = (
47
61
  }
48
62
  };
49
63
 
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
64
  const onFieldAdded = (field: string): void => {
62
65
  setFieldTouched(field, true); // Mark the field as touched when added
63
66
  };
@@ -78,7 +81,9 @@ export const BulkEditFormFieldsConfigConverter = (
78
81
 
79
82
  if (!Component) {
80
83
  // eslint-disable-next-line no-console
81
- console.warn(`No component found for field type: ${fieldType}`);
84
+ console.warn(
85
+ `Bulk Edit: No component found for field type: ${fieldType}`,
86
+ );
82
87
  return null; // Filter out null entries later
83
88
  }
84
89
 
@@ -88,12 +93,13 @@ export const BulkEditFormFieldsConfigConverter = (
88
93
  key={key}
89
94
  label={fieldConfig.label}
90
95
  validate={(value: unknown) => {
91
- if (fieldType === 'Array') {
92
- // Array can be empty, so no validation needed
93
- return;
94
- }
95
- if (value === null || value === undefined || value === '') {
96
- return 'This field is required';
96
+ if (
97
+ value === null ||
98
+ value === undefined ||
99
+ value === '' ||
100
+ (Array.isArray(value) && value.length === 0)
101
+ ) {
102
+ return 'Please provide a value';
97
103
  }
98
104
  }}
99
105
  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
@@ -142,6 +142,7 @@ export const useQuickEdit = <T extends Data>({
142
142
  : PageHeaderActionType.Context,
143
143
  onClick: async () => {
144
144
  await saveCallbackRef.current?.();
145
+ setSelectedItem({ ...selectedItem });
145
146
  setCurrentRegistration(registration);
146
147
  updateDetailsLink(selectedItem, registration);
147
148
  },