@axinom/mosaic-ui 0.34.0 → 0.34.1

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.34.0",
3
+ "version": "0.34.1",
4
4
  "description": "UI components for building Axinom Mosaic applications",
5
5
  "author": "Axinom",
6
6
  "license": "PROPRIETARY",
@@ -102,5 +102,5 @@
102
102
  "publishConfig": {
103
103
  "access": "public"
104
104
  },
105
- "gitHead": "7c6702d386aee28156332c050cf7c97f3df2b1db"
105
+ "gitHead": "26de70cf028138cec5bf4a5cccc73c61ce105e47"
106
106
  }
@@ -160,7 +160,7 @@ export const List = <T extends Data>({
160
160
  isError = false,
161
161
  errorMsg = 'There was an error.',
162
162
  handleRetry = true,
163
- minimumWidth = 'fit-content',
163
+ minimumWidth = '500px',
164
164
  columnGap = '5px',
165
165
  rowGap = '0px',
166
166
  headerRowHeight = '44px',
@@ -249,58 +249,64 @@ export const ListRow = <T extends Data>({
249
249
  {generateCells}
250
250
  </div>
251
251
  )}
252
- <div className={classes.actions}>
253
- {inlineMenuActions &&
254
- inlineActionMenuData &&
255
- inlineActionMenuData.length > 0 && (
256
- <InlineMenu
257
- actions={inlineActionMenuData}
258
- showArrow={false}
259
- placement="bottom-end"
260
- />
252
+ {(inlineMenuActions ||
253
+ showActionButton ||
254
+ showCheckMark ||
255
+ showItemCheckbox) && (
256
+ <div className={classes.actions}>
257
+ {inlineMenuActions &&
258
+ inlineActionMenuData &&
259
+ inlineActionMenuData.length > 0 && (
260
+ <InlineMenu
261
+ actions={inlineActionMenuData}
262
+ showArrow={false}
263
+ placement="bottom-end"
264
+ />
265
+ )}
266
+ {showActionButton && selectionMode === ListSelectMode.None && (
267
+ <>
268
+ {showActionButton &&
269
+ (typeof onItemClicked !== 'function' ? (
270
+ <Button
271
+ icon={IconName.ChevronRight}
272
+ height={actionSize}
273
+ width={actionSize}
274
+ path={onItemClicked}
275
+ dataTestId="list-entry-action"
276
+ />
277
+ ) : (
278
+ <Button
279
+ icon={IconName.ChevronRight}
280
+ height={actionSize}
281
+ width={actionSize}
282
+ onButtonClicked={() => onItemClickedHandler(data)}
283
+ dataTestId="list-entry-action"
284
+ />
285
+ ))}
286
+ </>
261
287
  )}
262
- {showActionButton && selectionMode === ListSelectMode.None && (
263
- <>
264
- {showActionButton &&
265
- (typeof onItemClicked !== 'function' ? (
266
- <Button
267
- icon={IconName.ChevronRight}
268
- height={actionSize}
269
- width={actionSize}
270
- path={onItemClicked}
271
- dataTestId="list-entry-action"
272
- />
273
- ) : (
274
- <Button
275
- icon={IconName.ChevronRight}
276
- height={actionSize}
277
- width={actionSize}
278
- dataTestId="list-entry-action"
279
- />
280
- ))}
281
- </>
282
- )}
283
288
 
284
- {showCheckMark && (
285
- <Button
286
- icon={IconName.Checkmark}
287
- height={actionSize}
288
- width={actionSize}
289
- dataTestId="list-entry-select-button"
290
- className={classes.selectionCheckMark}
291
- onButtonClicked={() => onItemClickedHandler(data)}
292
- />
293
- )}
294
- {showItemCheckbox && (
295
- <ListCheckBox
296
- height={actionSize}
297
- width={actionSize}
298
- onCheckBoxToggled={() => onItemClickedHandler(data)}
299
- isChecked={itemSelected}
300
- isDisabled={isRowDisabled}
301
- />
302
- )}
303
- </div>
289
+ {showCheckMark && (
290
+ <Button
291
+ icon={IconName.Checkmark}
292
+ height={actionSize}
293
+ width={actionSize}
294
+ dataTestId="list-entry-select-button"
295
+ className={classes.selectionCheckMark}
296
+ onButtonClicked={() => onItemClickedHandler(data)}
297
+ />
298
+ )}
299
+ {showItemCheckbox && (
300
+ <ListCheckBox
301
+ height={actionSize}
302
+ width={actionSize}
303
+ onCheckBoxToggled={() => onItemClickedHandler(data)}
304
+ isChecked={itemSelected}
305
+ isDisabled={isRowDisabled}
306
+ />
307
+ )}
308
+ </div>
309
+ )}
304
310
  </div>
305
311
  );
306
312
 
@@ -1,4 +1,4 @@
1
- import { useEffect, useState } from 'react';
1
+ import { SetStateAction, useEffect, useState } from 'react';
2
2
  import { Data } from '../../types';
3
3
  import { Column, ListSelectMode } from './List.model';
4
4
 
@@ -73,6 +73,8 @@ export const useColumnsSize = <T extends Data>(
73
73
  setColumnSizes: React.Dispatch<React.SetStateAction<string>>;
74
74
  hasActionColumn: boolean;
75
75
  } => {
76
+ const [isResized, setIsResized] = useState<boolean>(false);
77
+
76
78
  const [orgColumnSizes, setOrgColumnSizes] = useState<string>(
77
79
  getColumnsSizeDefinition(
78
80
  columns,
@@ -81,6 +83,7 @@ export const useColumnsSize = <T extends Data>(
81
83
  showInlineMenu,
82
84
  ),
83
85
  );
86
+
84
87
  const [columnSizes, setColumnSizes] = useState<string>(orgColumnSizes);
85
88
 
86
89
  useEffect(() => {
@@ -92,16 +95,30 @@ export const useColumnsSize = <T extends Data>(
92
95
  showInlineMenu,
93
96
  ),
94
97
  );
95
- }, [columns, selectMode, showActionButton, showInlineMenu]);
98
+ if (!isResized) {
99
+ setColumnSizes(orgColumnSizes);
100
+ }
101
+ }, [
102
+ columns,
103
+ isResized,
104
+ orgColumnSizes,
105
+ selectMode,
106
+ showActionButton,
107
+ showInlineMenu,
108
+ ]);
96
109
 
97
110
  const resetColumnSizes = (): void => {
98
111
  setColumnSizes(orgColumnSizes);
112
+ setIsResized(false);
99
113
  };
100
114
 
101
115
  return {
102
116
  columnSizes,
103
117
  resetColumnSizes,
104
- setColumnSizes,
118
+ setColumnSizes: (newColumnSizes: SetStateAction<string>) => {
119
+ setIsResized(true);
120
+ setColumnSizes(newColumnSizes);
121
+ },
105
122
  hasActionColumn: hasActionColumn(
106
123
  selectMode,
107
124
  showActionButton,