@linzjs/step-ag-grid 7.6.0 → 7.6.2

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
@@ -2,7 +2,7 @@
2
2
  "name": "@linzjs/step-ag-grid",
3
3
  "repository": "github:linz/step-ag-grid.git",
4
4
  "license": "MIT",
5
- "version": "7.6.0",
5
+ "version": "7.6.2",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -68,7 +68,7 @@ export const GridCell = <RowType extends GridBaseRow, Props extends CellEditorCo
68
68
  sortable: !!(props?.field || props?.valueGetter),
69
69
  resizable: true,
70
70
  ...(custom?.editor && {
71
- cellClassRules: GridCellMultiSelectClassRules,
71
+ cellClassRules: custom.multiEdit ? GridCellMultiSelectClassRules : undefined,
72
72
  editable: props.editable ?? true,
73
73
  cellEditor: GenericCellEditorComponentWrapper(custom),
74
74
  }),
@@ -102,9 +102,18 @@ export interface CellEditorCommon {
102
102
 
103
103
  export const GenericCellEditorComponentWrapper = (custom?: { editor?: (props: any) => JSX.Element }) => {
104
104
  return forwardRef(function GenericCellEditorComponentFr(cellEditorParams: ICellEditorParams, _) {
105
+ const valueFormatted = cellEditorParams.formatValue
106
+ ? cellEditorParams.formatValue(cellEditorParams.value)
107
+ : "Missing formatter";
105
108
  return (
106
109
  <GridPopoverContextProvider props={cellEditorParams}>
107
- {<cellEditorParams.colDef.cellRenderer {...cellEditorParams} {...cellEditorParams.colDef.cellRendererParams} />}
110
+ {
111
+ <cellEditorParams.colDef.cellRenderer
112
+ {...cellEditorParams}
113
+ valueFormatted={valueFormatted}
114
+ {...cellEditorParams.colDef.cellRendererParams}
115
+ />
116
+ }
108
117
  {custom?.editor && <custom.editor {...cellEditorParams} />}
109
118
  </GridPopoverContextProvider>
110
119
  );
@@ -251,7 +251,10 @@ export const GridContextProvider = (props: GridContextProps): ReactElement => {
251
251
  async () => {
252
252
  // Need to refresh to get spinners to work on all rows
253
253
  gridApi.refreshCells({ rowNodes: props.selectedRows as RowNode[], force: true });
254
- ok = await fnUpdate(selectedRows);
254
+ ok = await fnUpdate(selectedRows).catch((ex) => {
255
+ console.error("Exception during modifyUpdating", ex);
256
+ return false;
257
+ });
255
258
  },
256
259
  );
257
260
 
@@ -31,9 +31,7 @@ export const GridPopoverContextProvider = ({ props, children }: GridPopoverConte
31
31
  async (saveFn: (selectedRows: any[]) => Promise<boolean>, tabDirection: 1 | 0 | -1): Promise<boolean> => {
32
32
  if (hasSaved.current) return true;
33
33
  hasSaved.current = true;
34
- const r = saving ? false : await updatingCells({ selectedRows, field }, saveFn, setSaving, tabDirection);
35
- //if (r) stopEditing();
36
- return r;
34
+ return saving ? false : await updatingCells({ selectedRows, field }, saveFn, setSaving, tabDirection);
37
35
  },
38
36
  [field, saving, selectedRows, updatingCells],
39
37
  );
@@ -62,9 +62,4 @@
62
62
 
63
63
  .Grid-container.ag-theme-alpine .ag-cell-wrapper {
64
64
  width: 100%;
65
- }
66
-
67
- .Grid-container.ag-theme-alpine .ag-cell-inline-editing {
68
- padding-left: 5px;
69
- padding-right: 2px;
70
65
  }
@@ -24,6 +24,7 @@
24
24
  border-color: lui.$lily,
25
25
  secondary-border-color: lui.$lily,
26
26
  cell-horizontal-border: solid ag-derived(secondary-border-color),
27
+ cell-horizontal-padding: 12,
27
28
  row-hover-color: lui.$lily,
28
29
  font-family: (
29
30
  "Open Sans",
@@ -59,7 +60,7 @@
59
60
 
60
61
  .ag-header-cell {
61
62
  font-weight: 600;
62
- padding: 7px 0 7px 8px;
63
+ padding: 7px 11px;
63
64
 
64
65
  .LuiIcon {
65
66
  fill: lui.$surfie;
@@ -67,25 +68,25 @@
67
68
  }
68
69
 
69
70
  .ag-cell {
70
- padding-left: 7px;
71
- padding-right: 4px;
71
+ padding-left: 11px;
72
+ padding-right: 11px;
72
73
  display: flex;
73
74
  align-items: center;
74
75
  }
75
76
 
76
- .ag-cell-more {
77
- padding: 0;
78
- display: flex;
79
- justify-content: center;
77
+ .ag-cell.ag-cell-inline-editing {
78
+ bottom: 0;
80
79
  }
81
80
 
82
81
  .ag-cell-wrap-text {
83
82
  word-break: break-word;
84
83
  }
85
84
 
86
- .ag-cell-popup-editing,
87
- .ag-selected-for-edit,
85
+ .ag-cell.ag-cell-popup-editing,
86
+ .ag-cell.ag-selected-for-edit,
88
87
  .ag-cell-inline-editing {
88
+ padding-left: 9px;
89
+ padding-right: 9px;
89
90
  background: rgb(72 160 244 / 20%);
90
91
  // These are important, it needs to override ag-grid to work
91
92
  border: 3px solid #48a0f4 !important;
@@ -1,9 +1,16 @@
1
- import { useRef } from "react";
1
+ import { useEffect, useRef } from "react";
2
2
 
3
3
  export const useDeferredPromise = <T>() => {
4
4
  const promiseResolve = useRef<((value: T | PromiseLike<T>) => void) | undefined>();
5
5
  const promiseReject = useRef<() => void>();
6
6
 
7
+ // End promise on unload
8
+ useEffect(() => {
9
+ return () => {
10
+ promiseReject.current && promiseReject.current();
11
+ };
12
+ }, []);
13
+
7
14
  return {
8
15
  invoke: () =>
9
16
  new Promise<T>((resolve, reject) => {