@linzjs/step-ag-grid 28.5.1 → 29.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.
Files changed (42) hide show
  1. package/dist/index.css +11 -7
  2. package/dist/src/components/Grid.d.ts +5 -1
  3. package/dist/src/contexts/GridContext.d.ts +3 -4
  4. package/dist/src/contexts/GridPopoverContext.d.ts +1 -0
  5. package/dist/src/contexts/GridUpdatingContext.d.ts +1 -0
  6. package/dist/src/lui/reactUtils.d.ts +4 -0
  7. package/dist/step-ag-grid.cjs +263 -246
  8. package/dist/step-ag-grid.cjs.map +1 -1
  9. package/dist/step-ag-grid.esm.js +264 -247
  10. package/dist/step-ag-grid.esm.js.map +1 -1
  11. package/package.json +21 -22
  12. package/src/components/Grid.tsx +114 -112
  13. package/src/components/GridPopoverHook.tsx +25 -20
  14. package/src/components/gridFilter/useGridFilter.ts +3 -3
  15. package/src/components/gridHook/useGridContextMenu.tsx +3 -3
  16. package/src/contexts/GridContext.tsx +11 -14
  17. package/src/contexts/GridContextProvider.tsx +164 -137
  18. package/src/contexts/GridPopoverContext.tsx +2 -0
  19. package/src/contexts/GridPopoverContextProvider.tsx +9 -5
  20. package/src/contexts/GridUpdatingContext.tsx +5 -0
  21. package/src/contexts/GridUpdatingContextProvider.tsx +35 -28
  22. package/src/lui/reactUtils.tsx +24 -0
  23. package/src/react-menu3/components/MenuList.tsx +3 -0
  24. package/src/stories/grid/GridFilterButtons.stories.tsx +1 -1
  25. package/src/stories/grid/GridNonEditableRow.stories.tsx +1 -1
  26. package/src/stories/grid/GridPinnedRow.stories.tsx +1 -1
  27. package/src/stories/grid/GridPopoutContextMenu.stories.tsx +3 -3
  28. package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +2 -2
  29. package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +8 -4
  30. package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +1 -0
  31. package/src/stories/grid/GridReadOnly.stories.tsx +1 -1
  32. package/src/stories/grid/GridViewList.stories.tsx +1 -1
  33. package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +5 -3
  34. package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +3 -2
  35. package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +3 -2
  36. package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +3 -2
  37. package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +3 -2
  38. package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +3 -2
  39. package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +3 -2
  40. package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +3 -2
  41. package/src/stories/grid/gridFormStatic/GridFormDropDown.stories.tsx +2 -2
  42. package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +2 -2
@@ -63,7 +63,7 @@ const ContextMenu = ({ clickedRow, colDef, close }: GridContextMenuComponentProp
63
63
  );
64
64
  };
65
65
 
66
- const GridPopoutContextMenuTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
66
+ const GridPopoutContextMenuTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props: GridProps<IFormTestRow>) => {
67
67
  const { selectRowsWithFlashDiff } = useContext(GridContext);
68
68
  const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
69
69
  const [rowData, setRowData] = useState([
@@ -125,9 +125,9 @@ const GridPopoutContextMenuTemplate: StoryFn<typeof Grid> = (props: GridProps) =
125
125
  domLayout={'autoHeight'}
126
126
  defaultColDef={{ minWidth: 70 }}
127
127
  sizeColumns={'auto'}
128
- onCellEditingComplete={() => {
128
+ onBulkEditingComplete={() => {
129
129
  /* eslint-disable-next-line no-console */
130
- console.log('Cell editing complete');
130
+ console.log('onBulkEditingComplete');
131
131
  }}
132
132
  contextMenu={ContextMenu}
133
133
  />
@@ -48,7 +48,7 @@ export default {
48
48
  ],
49
49
  } as Meta<typeof Grid>;
50
50
 
51
- const GridPopoutEditGenericTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
51
+ const GridPopoutEditGenericTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props: GridProps<IFormTestRow>) => {
52
52
  const { selectRowsWithFlashDiff } = useContext(GridContext);
53
53
  const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
54
54
  const [rowData, setRowData] = useState([
@@ -217,7 +217,7 @@ const GridPopoutEditGenericTemplate: StoryFn<typeof Grid> = (props: GridProps) =
217
217
  domLayout={'autoHeight'}
218
218
  defaultColDef={{ minWidth: 70 }}
219
219
  sizeColumns={'auto'}
220
- onCellEditingComplete={() => {
220
+ onBulkEditingComplete={() => {
221
221
  /* eslint-disable-next-line no-console */
222
222
  console.log('Cell editing complete');
223
223
  }}
@@ -39,7 +39,7 @@ export default {
39
39
  },
40
40
  decorators: [
41
41
  (Story) => (
42
- <div style={{ width: 1024, height: 400 }}>
42
+ <div style={{ width: 1224, height: 400 }}>
43
43
  <GridUpdatingContextProvider>
44
44
  <GridContextProvider>
45
45
  <Story />
@@ -65,7 +65,7 @@ interface ICode {
65
65
  desc: string;
66
66
  }
67
67
 
68
- const GridEditDropDownTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
68
+ const GridEditDropDownTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<ITestRow>) => {
69
69
  const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
70
70
 
71
71
  const optionsFn = useCallback(async (selectedRows: ITestRow[], filter?: string) => {
@@ -317,9 +317,13 @@ const GridEditDropDownTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
317
317
  columnDefs={columnDefs}
318
318
  rowData={rowData}
319
319
  domLayout={'autoHeight'}
320
- onCellEditingComplete={() => {
320
+ onBulkEditingComplete={() => {
321
321
  /* eslint-disable-next-line no-console */
322
- console.log('Cell editing complete');
322
+ console.log('onBulkEditingComplete()');
323
+ }}
324
+ onCellFocused={({ colDef, data }) => {
325
+ /* eslint-disable-next-line no-console */
326
+ console.log('on cell focused called', { colDef, data });
323
327
  }}
324
328
  />
325
329
  </GridWrapper>
@@ -116,6 +116,7 @@ const GridEditMultiSelectTemplate: StoryFn<typeof Grid> = (props: GridProps) =>
116
116
  ),
117
117
  GridPopoutEditMultiSelect<ITestRow, ITestRow['position']>(
118
118
  {
119
+ colId: 'position2',
119
120
  field: 'position',
120
121
  headerName: 'Parcel picker',
121
122
  valueFormatter: ({ value }) => {
@@ -70,7 +70,7 @@ interface ITestRow {
70
70
  dd: string;
71
71
  }
72
72
 
73
- const GridReadOnlyTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
73
+ const GridReadOnlyTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<ITestRow>) => {
74
74
  const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
75
75
  const columnDefs: ColDefT<ITestRow>[] = useMemo(
76
76
  () => [
@@ -49,7 +49,7 @@ interface ITestRow {
49
49
  dd: string;
50
50
  }
51
51
 
52
- const GridReadOnlyTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
52
+ const GridReadOnlyTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<ITestRow>) => {
53
53
  const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
54
54
  const columnDefs: ColDefT<ITestRow>[] = useMemo(
55
55
  () => [
@@ -11,6 +11,7 @@ import { expect, fn, userEvent, within } from 'storybook/test';
11
11
  import {
12
12
  GridBaseRow,
13
13
  GridContext,
14
+ GridContextType,
14
15
  GridFormDropDown,
15
16
  GridFormDropDownProps,
16
17
  GridFormSubComponentTextInput,
@@ -53,9 +54,9 @@ const Template: StoryFn<typeof GridFormDropDown<GridBaseRow, number>> = (
53
54
  <GridContext.Provider
54
55
  value={
55
56
  {
56
- stopEditing: () => {},
57
- cancelEdit: () => {},
58
- } as any
57
+ onBulkEditingComplete: () => {},
58
+ resetFocusedCellAfterCellEditing: () => {},
59
+ } as unknown as GridContextType<GridBaseRow>
59
60
  }
60
61
  >
61
62
  <h6 ref={anchorRef}>Interaction test</h6>
@@ -71,6 +72,7 @@ const Template: StoryFn<typeof GridFormDropDown<GridBaseRow, number>> = (
71
72
  formatValue: () => '',
72
73
  saving: false,
73
74
  setSaving: () => {},
75
+ stopEditing: () => {},
74
76
  }}
75
77
  >
76
78
  <GridFormDropDown {...props} {...config} />
@@ -31,8 +31,8 @@ const Template: StoryFn<typeof GridFormEditBearing> = (props: GridFormEditBearin
31
31
  <GridContext.Provider
32
32
  value={
33
33
  {
34
- stopEditing: () => {},
35
- cancelEdit: () => {},
34
+ onBulkEditingComplete: () => {},
35
+ resetFocusedCellAfterCellEditing: () => {},
36
36
  } as any
37
37
  }
38
38
  >
@@ -49,6 +49,7 @@ const Template: StoryFn<typeof GridFormEditBearing> = (props: GridFormEditBearin
49
49
  selectedRows: [],
50
50
  data: { value: '' },
51
51
  field: 'value',
52
+ stopEditing: () => {},
52
53
  }}
53
54
  >
54
55
  <GridFormEditBearing {...props} {...GridPopoverEditBearingCorrectionEditorParams} />
@@ -31,8 +31,8 @@ const Template: StoryFn<typeof GridFormEditBearing> = (props: GridFormEditBearin
31
31
  <GridContext.Provider
32
32
  value={
33
33
  {
34
- stopEditing: () => {},
35
- cancelEdit: () => {},
34
+ onBulkEditingComplete: () => {},
35
+ resetFocusedCellAfterCellEditing: () => {},
36
36
  } as any
37
37
  }
38
38
  >
@@ -49,6 +49,7 @@ const Template: StoryFn<typeof GridFormEditBearing> = (props: GridFormEditBearin
49
49
  selectedRows: [],
50
50
  data: { value: '' },
51
51
  field: 'value',
52
+ stopEditing: () => {},
52
53
  }}
53
54
  >
54
55
  <GridFormEditBearing {...props} {...GridPopoverEditBearingEditorParams} />
@@ -45,8 +45,8 @@ const Template: StoryFn<typeof GridFormMultiSelectGrid> = (props: GridFormMultiS
45
45
  <GridContext.Provider
46
46
  value={
47
47
  {
48
- stopEditing: () => {},
49
- cancelEdit: () => {},
48
+ onBulkEditingComplete: () => {},
49
+ resetFocusedCellAfterCellEditing: () => {},
50
50
  } as any
51
51
  }
52
52
  >
@@ -63,6 +63,7 @@ const Template: StoryFn<typeof GridFormMultiSelectGrid> = (props: GridFormMultiS
63
63
  saving: false,
64
64
  data: { value: '' },
65
65
  field: 'value',
66
+ stopEditing: () => {},
66
67
  }}
67
68
  >
68
69
  <GridFormMultiSelectGrid {...props} {...config} />
@@ -56,8 +56,8 @@ const Template: StoryFn<typeof GridFormMultiSelect> = (props: GridFormMultiSelec
56
56
  <GridContext.Provider
57
57
  value={
58
58
  {
59
- stopEditing: () => {},
60
- cancelEdit: () => {},
59
+ onBulkEditingComplete: () => {},
60
+ resetFocusedCellAfterCellEditing: () => {},
61
61
  } as any
62
62
  }
63
63
  >
@@ -74,6 +74,7 @@ const Template: StoryFn<typeof GridFormMultiSelect> = (props: GridFormMultiSelec
74
74
  saving: false,
75
75
  setSaving: () => {},
76
76
  formatValue: (value) => value,
77
+ stopEditing: () => {},
77
78
  }}
78
79
  >
79
80
  <GridFormMultiSelect {...props} {...config} />
@@ -40,8 +40,8 @@ const Template: StoryFn<typeof GridFormPopoverMenu> = (props: GridFormPopoverMen
40
40
  <GridContext.Provider
41
41
  value={
42
42
  {
43
- stopEditing: () => {},
44
- cancelEdit: () => {},
43
+ onBulkEditingComplete: () => {},
44
+ resetFocusedCellAfterCellEditing: () => {},
45
45
  } as any
46
46
  }
47
47
  >
@@ -58,6 +58,7 @@ const Template: StoryFn<typeof GridFormPopoverMenu> = (props: GridFormPopoverMen
58
58
  saving: false,
59
59
  setSaving: () => {},
60
60
  formatValue: (value) => value,
61
+ stopEditing: () => {},
61
62
  }}
62
63
  >
63
64
  <GridFormPopoverMenu
@@ -26,8 +26,8 @@ const Template: StoryFn<typeof GridFormTextArea> = (props: GridFormTextAreaProps
26
26
  <GridContext.Provider
27
27
  value={
28
28
  {
29
- stopEditing: () => {},
30
- cancelEdit: () => {},
29
+ onBulkEditingComplete: () => {},
30
+ resetFocusedCellAfterCellEditing: () => {},
31
31
  } as any
32
32
  }
33
33
  >
@@ -44,6 +44,7 @@ const Template: StoryFn<typeof GridFormTextArea> = (props: GridFormTextAreaProps
44
44
  saving: false,
45
45
  setSaving: () => {},
46
46
  formatValue: (value) => value,
47
+ stopEditing: () => {},
47
48
  }}
48
49
  >
49
50
  <GridFormTextArea {...props} required={true} />
@@ -26,8 +26,8 @@ const Template: StoryFn<typeof GridFormTextInput> = (props: GridFormTextInputPro
26
26
  <GridContext.Provider
27
27
  value={
28
28
  {
29
- stopEditing: () => {},
30
- cancelEdit: () => {},
29
+ onBulkEditingComplete: () => {},
30
+ resetFocusedCellAfterCellEditing: () => {},
31
31
  } as any
32
32
  }
33
33
  >
@@ -44,6 +44,7 @@ const Template: StoryFn<typeof GridFormTextInput> = (props: GridFormTextInputPro
44
44
  saving: false,
45
45
  setSaving: () => {},
46
46
  formatValue: (value) => value,
47
+ stopEditing: () => {},
47
48
  }}
48
49
  >
49
50
  <GridFormTextInput {...props} required={true} />
@@ -15,8 +15,8 @@ export default {
15
15
  args: {},
16
16
  } as Meta<typeof GridFormDropDown>;
17
17
 
18
- const Template: StoryFn<typeof GridFormDropDown> = (props: GridFormDropDownProps<GridBaseRow>) => {
19
- const configs: [string, GridFormDropDownProps<GridBaseRow>, string?][] = [
18
+ const Template: StoryFn<typeof GridFormDropDown> = (props: GridFormDropDownProps<GridBaseRow, unknown>) => {
19
+ const configs: [string, GridFormDropDownProps<GridBaseRow, unknown>, string?][] = [
20
20
  ['No options', { options: [] }],
21
21
  ['Custom no options', { options: [], noOptionsMessage: 'Custom no options' }],
22
22
  [
@@ -75,7 +75,7 @@ const eAction = fn(() => {
75
75
  return true;
76
76
  });
77
77
 
78
- const GridKeyboardInteractionsTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
78
+ const GridKeyboardInteractionsTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<ITestRow>) => {
79
79
  const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
80
80
  const columnDefs: ColDefT<ITestRow>[] = useMemo(
81
81
  () => [
@@ -223,7 +223,7 @@ const GridKeyboardInteractionsTemplate: StoryFn<typeof Grid> = (props: GridProps
223
223
  );
224
224
  };
225
225
 
226
- export const GridKeyboardInteractions: StoryFn<typeof Grid> = GridKeyboardInteractionsTemplate.bind({});
226
+ export const GridKeyboardInteractions: StoryFn<typeof Grid<ITestRow>> = GridKeyboardInteractionsTemplate.bind({});
227
227
  GridKeyboardInteractions.play = async ({ canvasElement }) => {
228
228
  multiEditAction.mockClear();
229
229
  eAction.mockClear();