@linzjs/step-ag-grid 17.3.0 → 17.4.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.
@@ -47,9 +47,19 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
47
47
  )
48
48
  );
49
49
 
50
- // Fix that when you click below checkbox it doesn't process a click
50
+
51
51
  .ag-cell[col-id="selection"] {
52
- display: flex;
52
+ display: flex;// Fix that when you click below checkbox it doesn't process a click
53
+ justify-content: end; // fix alignment of cell content when grabber is present
54
+
55
+ .ag-selection-checkbox {
56
+ margin-right:0;
57
+ }
58
+ }
59
+
60
+ // fix alignment of cell content when grabber is present
61
+ .ag-header-cell-comp-wrapper {
62
+ justify-content: end;
53
63
  }
54
64
 
55
65
  // Fix that when you click below checkbox it doesn't process a click
package/dist/index.css CHANGED
@@ -397,6 +397,22 @@
397
397
  visibility: visible;
398
398
  }
399
399
 
400
+ .ag-drag-handle.ag-row-drag {
401
+ opacity: 0;
402
+ }
403
+ .ag-drag-handle.ag-row-drag .ag-icon-grip {
404
+ background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='%239999B3' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2Zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2Zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2Zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2Zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2Zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2Z' /%3E%3C/svg%3E");
405
+ background-repeat: no-repeat no-repeat;
406
+ background-position: center center;
407
+ background-size: cover;
408
+ color: transparent;
409
+ }
410
+
411
+ .ag-row:hover .ag-drag-handle.ag-row-drag {
412
+ opacity: 1;
413
+ transition: opacity 0.2s ease-in-out;
414
+ }
415
+
400
416
  .GridFormMessage-container {
401
417
  padding: 4px 8px;
402
418
  max-width: 400px;
@@ -21,13 +21,14 @@ export interface GridProps {
21
21
  */
22
22
  selectColumnPinned?: ColDef["pinned"];
23
23
  noRowsOverlayText?: string;
24
- postSortRows?: GridOptions["postSortRows"];
25
24
  animateRows?: boolean;
26
25
  rowHeight?: number;
27
26
  rowClassRules?: GridOptions["rowClassRules"];
28
27
  rowSelection?: "single" | "multiple";
29
28
  autoSelectFirstRow?: boolean;
30
29
  onColumnMoved?: GridOptions["onColumnMoved"];
30
+ rowDragText?: GridOptions["rowDragText"];
31
+ onRowDragEnd?: (movedRow: any, targetRow: any, targetIndex: number) => void;
31
32
  alwaysShowVerticalScroll?: boolean;
32
33
  suppressColumnVirtualization?: GridOptions["suppressColumnVirtualisation"];
33
34
  /**
@@ -1736,7 +1736,10 @@ const ControlledMenuFr = ({ "aria-label": ariaLabel, className, containerProps,
1736
1736
  reposition,
1737
1737
  viewScroll,
1738
1738
  ]);
1739
- const isWithinMenu = React.useCallback((target) => hasParentClass("szh-menu--state-open", target), []);
1739
+ const isWithinMenu = React.useCallback((target) => hasParentClass("szh-menu--state-open", target) ||
1740
+ // This is temporary, it will be removed when the overlay click is fixed
1741
+ hasParentClass("LuiModalPrefab", target) ||
1742
+ hasParentClass("prefab-modal", target), []);
1740
1743
  const handleScreenEventForSave = React.useCallback((ev) => {
1741
1744
  if (!isWithinMenu(ev.target)) {
1742
1745
  ev.preventDefault();
@@ -2527,20 +2530,24 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2527
2530
  },
2528
2531
  };
2529
2532
  });
2530
- return params.selectable
2533
+ return params.selectable || params.onRowDragEnd
2531
2534
  ? [
2532
2535
  {
2533
2536
  colId: "selection",
2534
2537
  editable: false,
2535
- minWidth: 48,
2536
- maxWidth: 48,
2538
+ rowDrag: !!params.onRowDragEnd,
2539
+ minWidth: params.selectable && params.onRowDragEnd ? 76 : 48,
2540
+ maxWidth: params.selectable && params.onRowDragEnd ? 76 : 48,
2537
2541
  pinned: selectColumnPinned,
2538
2542
  headerComponentParams: {
2539
2543
  exportable: false,
2540
2544
  },
2541
- checkboxSelection: true,
2545
+ checkboxSelection: params.selectable,
2542
2546
  headerComponent: rowSelection === "multiple" ? GridHeaderSelect : null,
2547
+ //headerCheckboxSelection:true,
2543
2548
  suppressHeaderKeyboardEvent: (e) => {
2549
+ if (!params.selectable)
2550
+ return false;
2544
2551
  if ((e.event.key === "Enter" || e.event.key === " ") && !e.event.repeat) {
2545
2552
  if (lodashEs.isEmpty(e.api.getSelectedRows())) {
2546
2553
  e.api.selectAllFiltered();
@@ -2560,6 +2567,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2560
2567
  }, [
2561
2568
  params.columnDefs,
2562
2569
  params.selectable,
2570
+ params.onRowDragEnd,
2563
2571
  params.readOnly,
2564
2572
  params.defaultColDef?.editable,
2565
2573
  selectColumnPinned,
@@ -2752,6 +2760,14 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2752
2760
  }
2753
2761
  }, []);
2754
2762
  const gridContextMenu = useGridContextMenu({ contextMenu: params.contextMenu, contextMenuSelectRow });
2763
+ const onRowDragEnd = React.useCallback((event) => {
2764
+ const moved = event.node.data;
2765
+ const target = event.overNode?.data;
2766
+ moved.id != target.id &&
2767
+ event.node.rowIndex != null &&
2768
+ params.onRowDragEnd &&
2769
+ params.onRowDragEnd(moved, target, event.node.rowIndex);
2770
+ }, [params]);
2755
2771
  // This is setting a ref in the GridContext so won't be triggering an update loop
2756
2772
  setOnCellEditingComplete(params.onCellEditingComplete);
2757
2773
  return (jsxRuntime.jsxs("div", { "data-testid": dataTestId, className: clsx("Grid-container", theme, staleGrid && "Grid-sortIsStale", gridReady && params.rowData && autoSized && "Grid-ready"), children: [gridContextMenu.component, jsxRuntime.jsx("div", { style: { flex: 1 }, ref: gridDivRef, children: jsxRuntime.jsx(agGridReact.AgGridReact, { rowHeight: rowHeight, animateRows: params.animateRows, rowClassRules: params.rowClassRules, getRowId: (params) => `${params.data.id}`, suppressRowClickSelection: true, rowSelection: rowSelection, suppressBrowserResizeObserver: true, onGridSizeChanged: onGridSizeChanged, suppressColumnVirtualisation: suppressColumnVirtualization, suppressClickEdit: true, onColumnVisible: () => {
@@ -2760,7 +2776,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2760
2776
  let rowCount = 0;
2761
2777
  event.api.forEachNode(() => rowCount++);
2762
2778
  return (jsxRuntime.jsx(GridNoRowsOverlay, { rowCount: rowCount, filteredRowCount: event.api.getDisplayedRowCount(), noRowsOverlayText: params.noRowsOverlayText }));
2763
- }, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: params.postSortRows ?? postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass, maintainColumnOrder: true, preventDefaultOnContextMenu: true, onCellContextMenu: gridContextMenu.cellContextMenu }) })] }));
2779
+ }, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: params.onRowDragEnd ? undefined : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass, maintainColumnOrder: true, preventDefaultOnContextMenu: true, onCellContextMenu: gridContextMenu.cellContextMenu, rowDragText: params.rowDragText, rowDragManaged: !!params.onRowDragEnd, suppressMoveWhenRowDragging: true, onRowDragEnd: onRowDragEnd }) })] }));
2764
2780
  };
2765
2781
 
2766
2782
  const GridPopoverContext = React.createContext({