@linzjs/step-ag-grid 17.3.0 → 17.4.0

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
  /**
@@ -2527,20 +2527,24 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2527
2527
  },
2528
2528
  };
2529
2529
  });
2530
- return params.selectable
2530
+ return params.selectable || params.onRowDragEnd
2531
2531
  ? [
2532
2532
  {
2533
2533
  colId: "selection",
2534
2534
  editable: false,
2535
- minWidth: 48,
2536
- maxWidth: 48,
2535
+ rowDrag: !!params.onRowDragEnd,
2536
+ minWidth: params.selectable && params.onRowDragEnd ? 76 : 48,
2537
+ maxWidth: params.selectable && params.onRowDragEnd ? 76 : 48,
2537
2538
  pinned: selectColumnPinned,
2538
2539
  headerComponentParams: {
2539
2540
  exportable: false,
2540
2541
  },
2541
- checkboxSelection: true,
2542
+ checkboxSelection: params.selectable,
2542
2543
  headerComponent: rowSelection === "multiple" ? GridHeaderSelect : null,
2544
+ //headerCheckboxSelection:true,
2543
2545
  suppressHeaderKeyboardEvent: (e) => {
2546
+ if (!params.selectable)
2547
+ return false;
2544
2548
  if ((e.event.key === "Enter" || e.event.key === " ") && !e.event.repeat) {
2545
2549
  if (lodashEs.isEmpty(e.api.getSelectedRows())) {
2546
2550
  e.api.selectAllFiltered();
@@ -2560,6 +2564,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2560
2564
  }, [
2561
2565
  params.columnDefs,
2562
2566
  params.selectable,
2567
+ params.onRowDragEnd,
2563
2568
  params.readOnly,
2564
2569
  params.defaultColDef?.editable,
2565
2570
  selectColumnPinned,
@@ -2752,6 +2757,14 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2752
2757
  }
2753
2758
  }, []);
2754
2759
  const gridContextMenu = useGridContextMenu({ contextMenu: params.contextMenu, contextMenuSelectRow });
2760
+ const onRowDragEnd = React.useCallback((event) => {
2761
+ const moved = event.node.data;
2762
+ const target = event.overNode?.data;
2763
+ moved.id != target.id &&
2764
+ event.node.rowIndex != null &&
2765
+ params.onRowDragEnd &&
2766
+ params.onRowDragEnd(moved, target, event.node.rowIndex);
2767
+ }, [params]);
2755
2768
  // This is setting a ref in the GridContext so won't be triggering an update loop
2756
2769
  setOnCellEditingComplete(params.onCellEditingComplete);
2757
2770
  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 +2773,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2760
2773
  let rowCount = 0;
2761
2774
  event.api.forEachNode(() => rowCount++);
2762
2775
  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 }) })] }));
2776
+ }, 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
2777
  };
2765
2778
 
2766
2779
  const GridPopoverContext = React.createContext({