@linzjs/step-ag-grid 17.0.1 → 17.0.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": "17.0.1",
5
+ "version": "17.0.2",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -326,8 +326,8 @@ export const Grid = ({
326
326
  {
327
327
  colId: "selection",
328
328
  editable: false,
329
- minWidth: 42,
330
- maxWidth: 42,
329
+ minWidth: 48,
330
+ maxWidth: 48,
331
331
  pinned: selectColumnPinned,
332
332
  headerComponentParams: {
333
333
  exportable: false,
@@ -193,7 +193,7 @@ export const GridContextProvider = <RowType extends GridBaseRow>(props: PropsWit
193
193
  (
194
194
  filterDef: keyof ColDef | ((r: ColDef) => boolean | undefined | null | number | string) = () => true,
195
195
  ): ColDefT<RowType>[] =>
196
- filter(columnApi?.getAllColumns()?.map((col) => col.getColDef()) ?? [], filterDef) as ColDefT<RowType>[],
196
+ filter(columnApi?.getColumns()?.map((col) => col.getColDef()) ?? [], filterDef) as ColDefT<RowType>[],
197
197
  [columnApi],
198
198
  );
199
199
 
@@ -589,15 +589,15 @@ export const GridContextProvider = <RowType extends GridBaseRow>(props: PropsWit
589
589
  [gridApiOp, modifyUpdating, selectNextEditableCell],
590
590
  );
591
591
 
592
- const redrawRows = useCallback(
593
- (rowNodes?: IRowNode[]) => {
594
- // redraw rows can throw exceptions in jest, so we ignore them
595
- try {
596
- gridApi && gridApi.redrawRows(rowNodes ? { rowNodes } : undefined);
597
- } catch (ex) {
598
- console.error(ex);
599
- }
600
- },
592
+ const redrawRows = useMemo(
593
+ () =>
594
+ debounce((rowNodes?: IRowNode[]) => {
595
+ try {
596
+ gridApi && gridApi.redrawRows(rowNodes ? { rowNodes } : undefined);
597
+ } catch (ex) {
598
+ console.error(ex);
599
+ }
600
+ }, 50),
601
601
  [gridApi],
602
602
  );
603
603
 
@@ -2,9 +2,7 @@ import "../../styles/GridTheme.scss";
2
2
  import "../../styles/index.scss";
3
3
  import "@linzjs/lui/dist/scss/base.scss";
4
4
 
5
- import { expect } from "@storybook/jest";
6
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
7
- import { waitFor } from "@storybook/testing-library";
8
6
  import { useMemo, useState } from "react";
9
7
 
10
8
  import "@linzjs/lui/dist/fonts";
@@ -21,6 +19,7 @@ import {
21
19
  GridUpdatingContextProvider,
22
20
  GridWrapper,
23
21
  } from "../..";
22
+ import { waitForGridReady } from "../../utils/storybookTestUtil";
24
23
 
25
24
  export default {
26
25
  title: "Components / Grids",
@@ -106,8 +105,4 @@ const GridFilterButtonsTemplate: ComponentStory<typeof Grid> = (props: GridProps
106
105
  };
107
106
 
108
107
  export const _FilterButtonsExample = GridFilterButtonsTemplate.bind({});
109
- _FilterButtonsExample.play = async ({ canvasElement }) => {
110
- await waitFor(() => {
111
- expect(canvasElement.querySelector(".Grid-ready")).toBeInTheDocument();
112
- });
113
- };
108
+ _FilterButtonsExample.play = waitForGridReady;
@@ -2,9 +2,7 @@ import "../../styles/GridTheme.scss";
2
2
  import "../../styles/index.scss";
3
3
  import "@linzjs/lui/dist/scss/base.scss";
4
4
 
5
- import { expect } from "@storybook/jest";
6
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
7
- import { waitFor } from "@storybook/testing-library";
8
6
  import { ColDef } from "ag-grid-community";
9
7
  import { GridPopoverEditDropDown } from "components/gridPopoverEdit/GridPopoverEditDropDown";
10
8
  import { GridPopoverTextArea } from "components/gridPopoverEdit/GridPopoverTextArea";
@@ -25,16 +23,15 @@ import {
25
23
  MenuOption,
26
24
  wait,
27
25
  } from "../..";
26
+ import { waitForGridReady } from "../../utils/storybookTestUtil";
28
27
 
29
28
  export default {
30
29
  title: "Components / Grids",
31
30
  component: Grid,
32
31
  args: {
33
- quickFilter: true,
34
- quickFilterValue: "",
35
- quickFilterPlaceholder: "Quick filter...",
36
- selectable: false,
32
+ selectable: true,
37
33
  rowSelection: "single",
34
+ autoSelectFirstRow: true,
38
35
  },
39
36
  decorators: [
40
37
  (Story) => (
@@ -179,9 +176,4 @@ const GridNonEditableRowTemplate: ComponentStory<typeof Grid> = (props: GridProp
179
176
  };
180
177
 
181
178
  export const _NonEditableRow = GridNonEditableRowTemplate.bind({});
182
- _NonEditableRow.args = { autoSelectFirstRow: true, selectable: true };
183
- _NonEditableRow.play = async ({ canvasElement }) => {
184
- await waitFor(() => {
185
- expect(canvasElement.querySelector(".Grid-ready")).toBeInTheDocument();
186
- });
187
- };
179
+ _NonEditableRow.play = waitForGridReady;
@@ -2,9 +2,7 @@ import "../../styles/GridTheme.scss";
2
2
  import "../../styles/index.scss";
3
3
  import "@linzjs/lui/dist/scss/base.scss";
4
4
 
5
- import { expect } from "@storybook/jest";
6
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
7
- import { waitFor } from "@storybook/testing-library";
8
6
  import { ReactElement, useCallback, useContext, useMemo, useState } from "react";
9
7
 
10
8
  import "@linzjs/lui/dist/fonts";
@@ -22,6 +20,7 @@ import {
22
20
  MenuItem,
23
21
  wait,
24
22
  } from "../..";
23
+ import { waitForGridReady } from "../../utils/storybookTestUtil";
25
24
  import { IFormTestRow } from "./FormTest";
26
25
 
27
26
  export default {
@@ -137,8 +136,4 @@ const GridPopoutContextMenuTemplate: ComponentStory<typeof Grid> = (props: GridP
137
136
  };
138
137
 
139
138
  export const _EditContextMenu = GridPopoutContextMenuTemplate.bind({});
140
- _EditContextMenu.play = async ({ canvasElement }) => {
141
- await waitFor(() => {
142
- expect(canvasElement.querySelector(".Grid-ready")).toBeInTheDocument();
143
- });
144
- };
139
+ _EditContextMenu.play = waitForGridReady;
@@ -2,14 +2,13 @@ import "../../styles/GridTheme.scss";
2
2
  import "../../styles/index.scss";
3
3
  import "@linzjs/lui/dist/scss/base.scss";
4
4
 
5
- import { expect } from "@storybook/jest";
6
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
7
- import { waitFor } from "@storybook/testing-library";
8
6
  import { useMemo, useState } from "react";
9
7
 
10
8
  import "@linzjs/lui/dist/fonts";
11
9
 
12
10
  import { ColDefT, Grid, GridCell, GridContextProvider, GridProps, GridUpdatingContextProvider } from "../..";
11
+ import { waitForGridReady } from "../../utils/storybookTestUtil";
13
12
  import { FormTest, IFormTestRow } from "./FormTest";
14
13
 
15
14
  export default {
@@ -73,8 +72,4 @@ const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridP
73
72
  };
74
73
 
75
74
  export const _EditGeneric = GridPopoutEditGenericTemplate.bind({});
76
- _EditGeneric.play = async ({ canvasElement }) => {
77
- await waitFor(() => {
78
- expect(canvasElement.querySelector(".Grid-ready")).toBeInTheDocument();
79
- });
80
- };
75
+ _EditGeneric.play = waitForGridReady;
@@ -2,9 +2,7 @@ import "../../styles/GridTheme.scss";
2
2
  import "../../styles/index.scss";
3
3
  import "@linzjs/lui/dist/scss/base.scss";
4
4
 
5
- import { expect } from "@storybook/jest";
6
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
7
- import { waitFor } from "@storybook/testing-library";
8
6
  import { useCallback, useContext, useMemo, useState } from "react";
9
7
 
10
8
  import "@linzjs/lui/dist/fonts";
@@ -28,6 +26,7 @@ import {
28
26
  isFloat,
29
27
  wait,
30
28
  } from "../..";
29
+ import { waitForGridReady } from "../../utils/storybookTestUtil";
31
30
  import { IFormTestRow } from "./FormTest";
32
31
 
33
32
  export default {
@@ -228,8 +227,4 @@ const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridP
228
227
  };
229
228
 
230
229
  export const _EditGenericTextArea = GridPopoutEditGenericTemplate.bind({});
231
- _EditGenericTextArea.play = async ({ canvasElement }) => {
232
- await waitFor(() => {
233
- expect(canvasElement.querySelector(".Grid-ready")).toBeInTheDocument();
234
- });
235
- };
230
+ _EditGenericTextArea.play = waitForGridReady;
@@ -2,9 +2,7 @@ import "../../styles/GridTheme.scss";
2
2
  import "../../styles/index.scss";
3
3
  import "@linzjs/lui/dist/scss/base.scss";
4
4
 
5
- import { expect } from "@storybook/jest";
6
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
7
- import { waitFor } from "@storybook/testing-library";
8
6
  import { useMemo, useState } from "react";
9
7
 
10
8
  import "@linzjs/lui/dist/fonts";
@@ -25,6 +23,7 @@ import {
25
23
  GridWrapper,
26
24
  wait,
27
25
  } from "../..";
26
+ import { waitForGridReady } from "../../utils/storybookTestUtil";
28
27
 
29
28
  export default {
30
29
  title: "Components / Grids",
@@ -124,8 +123,4 @@ const GridPopoverEditBearingTemplate: ComponentStory<typeof Grid> = (props: Grid
124
123
  };
125
124
 
126
125
  export const _GridPopoverEditBearing = GridPopoverEditBearingTemplate.bind({});
127
- _GridPopoverEditBearing.play = async ({ canvasElement }) => {
128
- await waitFor(() => {
129
- expect(canvasElement.querySelector(".Grid-ready")).toBeInTheDocument();
130
- });
131
- };
126
+ _GridPopoverEditBearing.play = waitForGridReady;
@@ -2,9 +2,7 @@ import "../../styles/GridTheme.scss";
2
2
  import "../../styles/index.scss";
3
3
  import "@linzjs/lui/dist/scss/base.scss";
4
4
 
5
- import { expect } from "@storybook/jest";
6
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
7
- import { waitFor } from "@storybook/testing-library";
8
6
  import { useCallback, useMemo, useState } from "react";
9
7
 
10
8
  import "@linzjs/lui/dist/fonts";
@@ -30,6 +28,7 @@ import {
30
28
  MenuSeparatorString,
31
29
  wait,
32
30
  } from "../..";
31
+ import { waitForGridReady } from "../../utils/storybookTestUtil";
33
32
 
34
33
  export default {
35
34
  title: "Components / Grids",
@@ -156,6 +155,7 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
156
155
  ),
157
156
  GridPopoverEditDropDown(
158
157
  {
158
+ colId: "position3filtered",
159
159
  field: "position3",
160
160
  headerName: "Filtered",
161
161
  editable: false,
@@ -316,8 +316,4 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
316
316
  };
317
317
 
318
318
  export const EditDropdown = GridEditDropDownTemplate.bind({});
319
- EditDropdown.play = async ({ canvasElement }) => {
320
- await waitFor(() => {
321
- expect(canvasElement.querySelector(".Grid-ready")).toBeInTheDocument();
322
- });
323
- };
319
+ EditDropdown.play = waitForGridReady;
@@ -2,9 +2,7 @@ import "../../styles/GridTheme.scss";
2
2
  import "../../styles/index.scss";
3
3
  import "@linzjs/lui/dist/scss/base.scss";
4
4
 
5
- import { expect } from "@storybook/jest";
6
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
7
- import { waitFor } from "@storybook/testing-library";
8
6
  import { isEmpty, partition } from "lodash-es";
9
7
  import { useMemo, useState } from "react";
10
8
 
@@ -23,6 +21,7 @@ import {
23
21
  MultiSelectOption,
24
22
  wait,
25
23
  } from "../..";
24
+ import { waitForGridReady } from "../../utils/storybookTestUtil";
26
25
 
27
26
  export default {
28
27
  title: "Components / Grids",
@@ -196,8 +195,4 @@ const GridEditMultiSelectTemplate: ComponentStory<typeof Grid> = (props: GridPro
196
195
  };
197
196
 
198
197
  export const EditMultiSelect = GridEditMultiSelectTemplate.bind({});
199
- EditMultiSelect.play = async ({ canvasElement }) => {
200
- await waitFor(() => {
201
- expect(canvasElement.querySelector(".Grid-ready")).toBeInTheDocument();
202
- });
203
- };
198
+ EditMultiSelect.play = waitForGridReady;
@@ -2,9 +2,7 @@ import "../../styles/GridTheme.scss";
2
2
  import "../../styles/index.scss";
3
3
  import "@linzjs/lui/dist/scss/base.scss";
4
4
 
5
- import { expect } from "@storybook/jest";
6
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
7
- import { waitFor } from "@storybook/testing-library";
8
6
  import { countBy, mergeWith, pull, range, union } from "lodash-es";
9
7
  import { useMemo, useState } from "react";
10
8
 
@@ -13,6 +11,7 @@ import "@linzjs/lui/dist/fonts";
13
11
  import { ColDefT, Grid, GridCell, GridContextProvider, GridProps, GridUpdatingContextProvider } from "../..";
14
12
  import { MultiSelectGridOption } from "../../components/gridForm/GridFormMultiSelectGrid";
15
13
  import { GridPopoutEditMultiSelectGrid } from "../../components/gridPopoverEdit/GridPopoutEditMultiSelectGrid";
14
+ import { waitForGridReady } from "../../utils/storybookTestUtil";
16
15
  import { EditMultiSelect } from "./GridPopoverEditMultiSelect.stories";
17
16
 
18
17
  export default {
@@ -111,8 +110,4 @@ const GridEditMultiSelectGridTemplate: ComponentStory<typeof Grid> = (props: Gri
111
110
  };
112
111
 
113
112
  export const EditMultiSelectGrid = GridEditMultiSelectGridTemplate.bind({});
114
- EditMultiSelect.play = async ({ canvasElement }) => {
115
- await waitFor(() => {
116
- expect(canvasElement.querySelector(".Grid-ready")).toBeInTheDocument();
117
- });
118
- };
113
+ EditMultiSelect.play = waitForGridReady;
@@ -2,9 +2,7 @@ import "../../styles/GridTheme.scss";
2
2
  import "../../styles/index.scss";
3
3
  import "@linzjs/lui/dist/scss/base.scss";
4
4
 
5
- import { expect } from "@storybook/jest";
6
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
7
- import { waitFor } from "@storybook/testing-library";
8
6
  import { ReactElement, useCallback, useMemo, useState } from "react";
9
7
 
10
8
  import "@linzjs/lui/dist/fonts";
@@ -31,6 +29,7 @@ import {
31
29
  import { GridFilterColumnsToggle } from "../../components";
32
30
  import { GridFilterDownloadCsvButton } from "../../components";
33
31
  import { GridCellFiller } from "../../components/GridCellFiller";
32
+ import { waitForGridReady } from "../../utils/storybookTestUtil";
34
33
 
35
34
  export default {
36
35
  title: "Components / Grids",
@@ -280,8 +279,4 @@ const GridFilterLessThan = (props: { field: keyof ITestRow; text: string }): Rea
280
279
  };
281
280
 
282
281
  export const ReadOnlySingleSelection = GridReadOnlyTemplate.bind({});
283
- ReadOnlySingleSelection.play = async ({ canvasElement }) => {
284
- await waitFor(() => {
285
- expect(canvasElement.querySelector(".Grid-ready")).toBeInTheDocument();
286
- });
287
- };
282
+ ReadOnlySingleSelection.play = waitForGridReady;
@@ -24,6 +24,7 @@ import {
24
24
  MenuOption,
25
25
  wait,
26
26
  } from "../../../";
27
+ import { waitForGridReady } from "../../../utils/storybookTestUtil";
27
28
 
28
29
  export default {
29
30
  title: "Components / Grids",
@@ -225,9 +226,7 @@ GridKeyboardInteractions.play = async ({ canvasElement }) => {
225
226
  multiEditAction.mockReset();
226
227
  eAction.mockReset();
227
228
 
228
- await waitFor(() => {
229
- expect(canvasElement.querySelector(".Grid-ready")).toBeInTheDocument();
230
- });
229
+ await waitForGridReady({ canvasElement });
231
230
 
232
231
  // Ensure first row/cell is selected on render
233
232
  await waitFor(async () => {
@@ -81,7 +81,7 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
81
81
  }
82
82
 
83
83
  .ag-header .ag-header-cell[aria-colindex="1"] {
84
- padding-left: lui.$unit-rg;
84
+ padding-left: 17px;
85
85
  }
86
86
 
87
87
  .ag-cell[role="gridcell"] {
@@ -90,7 +90,7 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
90
90
  }
91
91
 
92
92
  .ag-cell[aria-colindex="1"] {
93
- border-left: none;
93
+ border-left: 1px solid transparent;
94
94
  padding-left: lui.$unit-rg;
95
95
  }
96
96
 
@@ -0,0 +1,6 @@
1
+ import { expect } from "@storybook/jest";
2
+ import { waitFor } from "@storybook/testing-library";
3
+
4
+ export const waitForGridReady = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
5
+ await waitFor(() => expect(canvasElement.querySelector(".Grid-ready")).toBeInTheDocument(), { timeout: 5000 });
6
+ };