@linzjs/step-ag-grid 25.0.1 → 26.0.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.
package/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  - Custom form
19
19
  - Context menu
20
20
 
21
- _Please note this requires React >=17, ag-grid-community >=28, and SASS._
21
+ _Please note this requires React>=18, ag-grid-community >=32.3.3, and SASS._
22
22
 
23
23
  ## Install
24
24
 
@@ -58,6 +58,29 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
58
58
  )
59
59
  );
60
60
 
61
+ // Don't hide the drag handle
62
+ .ag-theme-step-default.theme-specific .ag-drag-handle.ag-row-drag, .ag-theme-step-compact.theme-specific div.ag-drag-handle.ag-row-drag {
63
+ opacity: 1 !important;
64
+ }
65
+
66
+ .ag-header-hide-default-select .ag-labeled {
67
+ display: none;
68
+ }
69
+
70
+ .ag-header-hide-default-select .ag-wrapper.ag-checkbox-input-wrapper {
71
+ margin-right: 9px;
72
+ }
73
+
74
+ div.ag-header-cell.ag-header-select-draggable[col-id='ag-Grid-SelectionColumn'] {
75
+ padding-left: 40px;
76
+ }
77
+
78
+ .ag-drag-handle.ag-row-drag {
79
+ .ag-icon.ag-icon-grip {
80
+ margin: auto;
81
+ }
82
+ }
83
+
61
84
  .ag-theme-step-default.theme-specific,
62
85
  .ag-theme-step-compact.theme-specific {
63
86
  div.ag-center-cols-viewport {
@@ -70,61 +93,29 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
70
93
  justify-content: center;
71
94
  }
72
95
 
73
- .ag-header-select-draggable .ag-header-cell-comp-wrapper {
74
- justify-content: end;
75
- }
76
-
77
96
  .ag-header-cell {
78
97
  font-size: 14px;
79
98
  font-weight: 600;
80
99
 
81
- // fix: Display descender line
82
- padding: 0 11px;
83
-
84
100
  .LuiIcon {
85
101
  fill: lui.$surfie;
86
102
  }
87
103
  }
88
-
89
- .ag-header .ag-header-cell[aria-colindex="1"] {
90
- padding-left: 17px;
91
- padding-right: 15px;
92
- }
93
-
94
104
  .ag-text-area-input:focus {
95
105
  border-color: lui.$sea;
96
106
  }
97
107
 
98
- .ag-cell[col-id="selection"] {
99
- display: flex; // Fix that when you click below checkbox it doesn't process a click
100
- }
101
-
102
- // Fix that when you click below checkbox it doesn't process a click
103
- .ag-cell-wrapper > *:not(.ag-cell-value, .ag-group-value) {
104
- height: auto;
105
- }
106
-
107
108
  .ag-row:last-of-type {
108
109
  border-bottom: 1px solid lui.$dew;
109
110
  }
110
111
 
111
112
  .ag-cell-label-container {
112
- padding: 8px 0;
113
-
114
113
  // Help ag-grid to calculate column height in react portal
115
114
  height: fit-content;
116
115
  }
117
116
 
118
-
119
- .ag-cell[aria-colindex="1"] {
120
- padding-left: lui.$unit-rg;
121
- }
122
-
123
- .ag-cell {
124
- padding-left: 11px;
125
- padding-right: 11px;
126
- display: flex;
127
- align-items: center;
117
+ .ag-cell .ag-cell-wrapper {
118
+ width: 100%;
128
119
  }
129
120
 
130
121
  .ag-cell-wrap-text {
@@ -167,7 +158,10 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
167
158
  }
168
159
  }
169
160
 
161
+
170
162
  .ag-cell {
163
+ display: flex;
164
+ align-items: center;
171
165
  font-weight: 400;
172
166
  }
173
167
 
@@ -217,25 +211,16 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
217
211
  visibility: inherit;
218
212
  }
219
213
 
220
- .ag-cell-wrapper {
221
- width: 100%;
222
- }
223
-
224
214
  .ag-row-highlight-above::after, .ag-row-highlight-below::after {
225
215
  content: '';
226
- height: 2px;
216
+ height: 3px;
227
217
  background-color: transparent;
228
218
  }
229
219
 
230
220
  .ag-row-highlight-above::after {
231
- top:-3px; // moves the top highlight to the position of the bottom highlight
232
221
  border-top: 2px dashed lui.$andrea;
233
222
  }
234
223
 
235
- .ag-row-highlight-above:first-of-type::after {
236
- top:0; // the first row highlight needs to in the normal position otherwise it is cut off by the top of the table
237
- }
238
-
239
224
  .ag-row-highlight-below::after {
240
225
  border-bottom: 2px dashed lui.$andrea;
241
226
  }
@@ -266,19 +251,10 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
266
251
  font-size: 14px;
267
252
  font-weight: 600;
268
253
 
269
- // fix: Display descender line
270
- padding: 0 12px;
271
-
272
254
  .LuiIcon {
273
255
  fill: lui.$surfie;
274
256
  }
275
257
  }
276
-
277
- .ag-header .ag-header-cell[aria-colindex="1"] {
278
- padding-left: 32px;
279
- padding-right: 12px;
280
- }
281
-
282
258
  .ag-header-group-cell {
283
259
  font-weight: normal;
284
260
  font-size: 22px;
@@ -287,12 +263,4 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
287
263
  .ag-header-cell {
288
264
  font-size: 14px;
289
265
  }
290
-
291
- .ag-row .ag-cell:first-of-type {
292
- padding-left: 32px;
293
- }
294
-
295
- .ag-row .ag-cell:last-of-type {
296
- padding-right: 32px;
297
- }
298
266
  }
@@ -4,7 +4,12 @@ import { GridContextMenuComponent } from './gridHook';
4
4
  export interface GridBaseRow {
5
5
  id: string | number;
6
6
  }
7
- export interface GridProps {
7
+ export interface GridOnRowDragEndProps<TData extends GridBaseRow> {
8
+ movedRow: TData;
9
+ targetRow: TData;
10
+ direction: -1 | 1;
11
+ }
12
+ export interface GridProps<TData extends GridBaseRow = GridBaseRow> {
8
13
  readOnly?: boolean;
9
14
  defaultPostSort?: boolean;
10
15
  selectable?: boolean;
@@ -14,11 +19,8 @@ export interface GridProps {
14
19
  externalSelectedItems?: any[];
15
20
  setExternalSelectedItems?: (items: any[]) => void;
16
21
  defaultColDef?: GridOptions['defaultColDef'];
17
- columnDefs: ColDef[];
22
+ columnDefs: ColDef<TData>[];
18
23
  rowData: GridOptions['rowData'];
19
- /**
20
- * Whether select column is pinned. Defaults to "left".
21
- */
22
24
  selectColumnPinned?: ColDef['pinned'];
23
25
  noRowsOverlayText?: string;
24
26
  noRowsMatchingOverlayText?: string;
@@ -29,7 +31,7 @@ export interface GridProps {
29
31
  autoSelectFirstRow?: boolean;
30
32
  onColumnMoved?: GridOptions['onColumnMoved'];
31
33
  rowDragText?: GridOptions['rowDragText'];
32
- onRowDragEnd?: (movedRow: any, targetRow: any, targetIndex: number) => Promise<void> | void;
34
+ onRowDragEnd?: (props: GridOnRowDragEndProps<TData>) => Promise<void> | void;
33
35
  alwaysShowVerticalScroll?: boolean;
34
36
  suppressColumnVirtualization?: GridOptions['suppressColumnVirtualisation'];
35
37
  /**
@@ -77,4 +79,4 @@ export interface GridProps {
77
79
  /**
78
80
  * Wrapper for AgGrid to add commonly used functionality.
79
81
  */
80
- export declare const Grid: ({ "data-testid": dataTestId, defaultPostSort, rowSelection, suppressColumnVirtualization, theme, sizeColumns, selectColumnPinned, contextMenuSelectRow, singleClickEdit, rowData, rowHeight, ...params }: GridProps) => ReactElement;
82
+ export declare const Grid: <TData extends GridBaseRow = GridBaseRow>({ "data-testid": dataTestId, defaultPostSort, rowSelection, suppressColumnVirtualization, theme, sizeColumns, selectColumnPinned, contextMenuSelectRow, singleClickEdit, rowData, rowHeight, selectable, ...params }: GridProps<TData>) => ReactElement;
@@ -1,4 +1,4 @@
1
- import { ColDef, ICellEditorParams, ICellRendererParams } from 'ag-grid-community';
1
+ import { ColDef, EditableCallback, ICellEditorParams, ICellRendererParams } from 'ag-grid-community';
2
2
  import { EditableCallbackParams, SuppressKeyboardEventParams, ValueFormatterFunc, ValueFormatterParams, ValueGetterFunc, ValueGetterParams } from 'ag-grid-community';
3
3
  import { ReactElement } from 'react';
4
4
  import { GridBaseRow } from './Grid';
@@ -33,10 +33,9 @@ export interface SAValueFormatterFunc<TData = any, TValue = any> {
33
33
  (params: SAValueFormatterParams<TData, TValue>): string;
34
34
  }
35
35
  export interface ColDefT<TData extends GridBaseRow, ValueType = any> extends ColDef<TData, ValueType> {
36
- _?: TData;
37
- editable?: boolean | SAEditableCallback<TData, ValueType>;
38
- valueGetter?: string | SAValueGetterFunc<TData, ValueType>;
39
- valueFormatter?: string | SAValueFormatterFunc<TData, ValueType>;
36
+ editable?: boolean | EditableCallback<TData, ValueType>;
37
+ valueGetter?: string | ValueGetterFunc<TData, ValueType>;
38
+ valueFormatter?: string | ValueFormatterFunc<TData, ValueType>;
40
39
  cellRenderer?: ((props: SAICellRendererParams<TData, ValueType>) => ReactElement | string | false | null | undefined) | string;
41
40
  cellRendererParams?: {
42
41
  singleClickEdit?: boolean;
@@ -23,7 +23,7 @@ export declare const MenuHeaderItem: (title: string) => {
23
23
  value: string;
24
24
  };
25
25
  export type SelectOption = null | string | FinalSelectOption;
26
- export interface GridFormDropDownProps<TData extends GridBaseRow, TValue> extends CellEditorCommon {
26
+ export interface GridFormDropDownProps<TData extends GridBaseRow, TValue = any> extends CellEditorCommon {
27
27
  className?: 'GridPopoverEditDropDown-containerSmall' | 'GridPopoverEditDropDown-containerMedium' | 'GridPopoverEditDropDown-containerLarge' | 'GridPopoverEditDropDown-containerUnlimited' | 'GridPopoverEditDropDown-containerAutoWidth' | string | undefined;
28
28
  filtered?: 'local' | 'reload';
29
29
  filterDefaultValue?: string;
@@ -6,6 +6,6 @@ export interface GridEditBooleanEditorProps<TData extends GridBaseRow> extends C
6
6
  selectedRows: TData[];
7
7
  selectedRowIds: TData['id'][];
8
8
  checked: boolean;
9
- }) => Promise<boolean>;
9
+ }) => Promise<boolean> | boolean;
10
10
  }
11
11
  export declare const GridEditBoolean: <TData extends GridBaseRow>(colDef: GenericCellColDef<TData, boolean>, editorProps: GridEditBooleanEditorProps<TData>) => ColDefT<TData>;
@@ -1,4 +1,3 @@
1
- export * from './clickInputWhenContainingCellClicked';
2
1
  export * from './ComponentLoadingWrapper';
3
2
  export * from './Grid';
4
3
  export * from './GridCell';
@@ -7,7 +6,6 @@ export * from './GridCellMultiEditor';
7
6
  export * from './GridCellMultiSelectClassRules';
8
7
  export * from './gridFilter';
9
8
  export * from './gridForm';
10
- export * from './gridHeader';
11
9
  export * from './gridHook';
12
10
  export * from './GridIcon';
13
11
  export * from './GridLoadableCell';
@@ -42,7 +42,7 @@ export interface GridContextType<TData extends GridBaseRow> {
42
42
  startCellEditing: ({ rowId, colId }: {
43
43
  rowId: number;
44
44
  colId: string;
45
- }) => void;
45
+ }) => Promise<void>;
46
46
  stopEditing: () => void;
47
47
  updatingCells: (props: {
48
48
  selectedRows: GridBaseRow[];