@linzjs/step-ag-grid 15.1.3 → 16.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/dist/src/components/GridCell.d.ts +1 -1
- package/dist/src/components/GridIcon.d.ts +2 -2
- package/dist/src/components/GridLoadableCell.d.ts +1 -2
- package/dist/src/components/GridNoRowsOverlay.d.ts +3 -3
- package/dist/src/components/GridPopoverHook.d.ts +1 -1
- package/dist/src/components/GridWrapper.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterDownloadCsvButton.d.ts +1 -2
- package/dist/src/components/gridFilter/GridFilterQuick.d.ts +1 -2
- package/dist/src/components/gridFilter/GridFilters.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormEditBearing.d.ts +1 -2
- package/dist/src/components/gridForm/GridFormMessage.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +1 -2
- package/dist/src/components/gridHeader/GridHeaderSelect.d.ts +1 -2
- package/dist/src/components/gridHook/useGridContextMenu.d.ts +1 -1
- package/dist/src/components/gridRender/GridRenderPopoutMenuCell.d.ts +1 -2
- package/dist/src/contexts/GridContext.d.ts +1 -1
- package/dist/src/contexts/GridPopoverContextProvider.d.ts +1 -1
- package/dist/src/contexts/GridUpdatingContextProvider.d.ts +1 -1
- package/dist/src/lui/ActionButton.d.ts +1 -1
- package/dist/src/lui/FormError.d.ts +1 -1
- package/dist/src/lui/TextAreaInput.d.ts +1 -1
- package/dist/src/lui/TextInputFormatted.d.ts +1 -1
- package/dist/src/react-menu3/components/ControlledMenu.d.ts +3 -3
- package/dist/src/react-menu3/components/FocusableItem.d.ts +2 -2
- package/dist/src/react-menu3/components/Menu.d.ts +2 -2
- package/dist/src/react-menu3/components/MenuButton.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuDivider.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuGroup.d.ts +2 -2
- package/dist/src/react-menu3/components/MenuHeader.d.ts +2 -2
- package/dist/src/react-menu3/components/MenuItem.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuList.d.ts +1 -2
- package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +2 -2
- package/dist/src/react-menu3/components/SubMenu.d.ts +2 -2
- package/dist/src/react-menu3/utils/utils.d.ts +1 -1
- package/dist/step-ag-grid.cjs.js +807 -3725
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +808 -3726
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +27 -23
- package/src/components/Grid.tsx +14 -18
- package/src/components/GridIcon.tsx +2 -1
- package/src/components/GridNoRowsOverlay.tsx +7 -10
- package/src/contexts/GridContext.tsx +1 -1
- package/src/contexts/GridContextProvider.tsx +32 -13
- package/src/lui/ActionButton.tsx +2 -1
- package/src/lui/TextInputFormatted.tsx +2 -1
- package/src/lui/reactUtils.test.tsx +4 -3
- package/src/stories/components/ActionButton.stories.tsx +2 -1
- package/src/stories/grid/FormTest.tsx +2 -1
- package/src/stories/grid/GridFilterButtons.stories.tsx +5 -15
- package/src/stories/grid/GridNoRowsOverlay.stories.tsx +6 -3
- package/src/stories/grid/GridNonEditableRow.stories.tsx +4 -3
- package/src/stories/grid/GridPopoutContextMenu.stories.tsx +4 -3
- package/src/stories/grid/GridPopoutEditGeneric.stories.tsx +4 -3
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +5 -4
- package/src/stories/grid/GridPopoverEditBearing.stories.tsx +4 -3
- package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +4 -3
- package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +4 -3
- package/src/stories/grid/GridPopoverEditMultiSelectGrid.stories.tsx +4 -3
- package/src/stories/grid/GridReadOnly.stories.tsx +12 -3
- package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +13 -10
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +13 -10
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +13 -10
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +12 -9
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +17 -14
- package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +17 -14
- package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +10 -7
- package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +12 -9
- package/src/stories/grid/gridFormStatic/GridFormDropDown.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormEditBearing.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormEditBearingCorrection.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormMessage.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormMultiSelect.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormPopoverMenu.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormTextArea.stories.tsx +4 -1
- package/src/stories/grid/gridFormStatic/GridFormTextInput.stories.tsx +4 -1
- package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +21 -12
- package/src/stories/react-menu/ReactMenu.stories.tsx +6 -4
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": "
|
|
5
|
+
"version": "16.0.0",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"aggrid",
|
|
8
8
|
"ag-grid",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"test": "jest",
|
|
57
57
|
"eject": "react-scripts eject",
|
|
58
58
|
"lint": "eslint ./src --ext .js,.ts,.tsx --fix --cache --ignore-path .gitignore",
|
|
59
|
-
"storybook": "
|
|
60
|
-
"build-storybook": "build
|
|
59
|
+
"storybook": "storybook dev -p 6006",
|
|
60
|
+
"build-storybook": "storybook build",
|
|
61
61
|
"deploy-storybook": "npx --yes -p @storybook/storybook-deployer storybook-to-ghpages",
|
|
62
62
|
"chromatic": "chromatic --exit-zero-on-changes",
|
|
63
63
|
"semantic-release": "semantic-release"
|
|
@@ -86,32 +86,33 @@
|
|
|
86
86
|
"@rollup/plugin-node-resolve": "^15.1.0",
|
|
87
87
|
"@semantic-release/changelog": "^6.0.3",
|
|
88
88
|
"@semantic-release/git": "^10.0.1",
|
|
89
|
-
"@storybook/addon-essentials": "^
|
|
90
|
-
"@storybook/addon-interactions": "^
|
|
91
|
-
"@storybook/
|
|
92
|
-
"@storybook/jest": "^0.0
|
|
93
|
-
"@storybook/
|
|
94
|
-
"@storybook/
|
|
95
|
-
"@storybook/react": "^
|
|
96
|
-
"@storybook/test-runner": "^0.
|
|
97
|
-
"@storybook/testing-library": "^0.0
|
|
98
|
-
"@testing-library/dom": "^9.3.
|
|
99
|
-
"@testing-library/jest-dom": "^5.
|
|
100
|
-
"@testing-library/react": "^
|
|
89
|
+
"@storybook/addon-essentials": "^7.2.2",
|
|
90
|
+
"@storybook/addon-interactions": "^7.2.2",
|
|
91
|
+
"@storybook/addon-postcss": "^2.0.0",
|
|
92
|
+
"@storybook/jest": "^0.1.0",
|
|
93
|
+
"@storybook/preset-create-react-app": "^7.2.2",
|
|
94
|
+
"@storybook/react": "^7.2.2",
|
|
95
|
+
"@storybook/react-webpack5": "^7.2.2",
|
|
96
|
+
"@storybook/test-runner": "^0.13.0",
|
|
97
|
+
"@storybook/testing-library": "^0.2.0",
|
|
98
|
+
"@testing-library/dom": "^9.3.1",
|
|
99
|
+
"@testing-library/jest-dom": "^5.17.0",
|
|
100
|
+
"@testing-library/react": "^14.0.0",
|
|
101
101
|
"@testing-library/user-event": "^14.4.3",
|
|
102
102
|
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
|
|
103
103
|
"@types/debounce-promise": "^3.1.6",
|
|
104
104
|
"@types/jest": "^29.5.2",
|
|
105
|
-
"@types/lodash-es": "^4.17.
|
|
106
|
-
"@types/node": "^20.
|
|
107
|
-
"@types/react": "^
|
|
108
|
-
"@types/react-dom": "^
|
|
109
|
-
"@types/uuid": "^9.0.
|
|
105
|
+
"@types/lodash-es": "^4.17.8",
|
|
106
|
+
"@types/node": "^20.4.9",
|
|
107
|
+
"@types/react": "^18.2.20",
|
|
108
|
+
"@types/react-dom": "^18.2.7",
|
|
109
|
+
"@types/uuid": "^9.0.2",
|
|
110
110
|
"@typescript-eslint/parser": "^5.60.0",
|
|
111
111
|
"babel-jest": "^29.5.0",
|
|
112
112
|
"babel-preset-react-app": "^10.0.1",
|
|
113
|
-
"chromatic": "^6.
|
|
113
|
+
"chromatic": "^6.21.0",
|
|
114
114
|
"conventional-changelog-conventionalcommits": "^5.0.0",
|
|
115
|
+
"css-loader": "^6.8.1",
|
|
115
116
|
"eslint": "^8.41.0",
|
|
116
117
|
"eslint-config-prettier": "^8.8.0",
|
|
117
118
|
"eslint-config-react-app": "^7.0.1",
|
|
@@ -122,8 +123,9 @@
|
|
|
122
123
|
"eslint-plugin-prettier": "^4.2.1",
|
|
123
124
|
"eslint-plugin-react": "^7.32.2",
|
|
124
125
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
125
|
-
"eslint-plugin-
|
|
126
|
-
"
|
|
126
|
+
"eslint-plugin-storybook": "^0.6.13",
|
|
127
|
+
"eslint-plugin-testing-library": "^5.11.1",
|
|
128
|
+
"jest": "^29.6.2",
|
|
127
129
|
"jest-canvas-mock": "^2.5.1",
|
|
128
130
|
"jest-environment-jsdom": "^29.5.0",
|
|
129
131
|
"jest-expect-message": "^1.1.3",
|
|
@@ -143,6 +145,8 @@
|
|
|
143
145
|
"sass": "^1.62.1",
|
|
144
146
|
"sass-loader": "^13.3.1",
|
|
145
147
|
"semantic-release": "^19.0.5",
|
|
148
|
+
"storybook": "^7.2.2",
|
|
149
|
+
"storybook-css-modules-preset": "^1.1.1",
|
|
146
150
|
"style-loader": "^3.3.3",
|
|
147
151
|
"stylelint": "^14.16.1",
|
|
148
152
|
"stylelint-config-prettier": "^9.0.5",
|
package/src/components/Grid.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CellClickedEvent, ColDef, ColGroupDef, ColumnResizedEvent, ModelUpdatedEvent } from "ag-grid-community";
|
|
2
2
|
import { CellClassParams, EditableCallback, EditableCallbackParams } from "ag-grid-community/dist/lib/entities/colDef";
|
|
3
3
|
import { GridOptions } from "ag-grid-community/dist/lib/entities/gridOptions";
|
|
4
|
-
import { CellEvent, GridReadyEvent, SelectionChangedEvent } from "ag-grid-community/dist/lib/events";
|
|
4
|
+
import { AgGridEvent, CellEvent, GridReadyEvent, SelectionChangedEvent } from "ag-grid-community/dist/lib/events";
|
|
5
5
|
import { AgGridReact } from "ag-grid-react";
|
|
6
6
|
import clsx from "clsx";
|
|
7
7
|
import { defer, difference, isEmpty, last, omit, xorBy } from "lodash-es";
|
|
@@ -208,7 +208,7 @@ export const Grid = ({
|
|
|
208
208
|
if (params.autoSelectFirstRow) {
|
|
209
209
|
selectRowsById([firstRowId]);
|
|
210
210
|
} else {
|
|
211
|
-
focusByRowById(firstRowId);
|
|
211
|
+
focusByRowById(firstRowId, true);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
}, [
|
|
@@ -357,6 +357,7 @@ export const Grid = ({
|
|
|
357
357
|
const onGridReady = useCallback(
|
|
358
358
|
(event: GridReadyEvent) => {
|
|
359
359
|
setApis(event.api, event.columnApi, dataTestId);
|
|
360
|
+
event.api.showNoRowsOverlay();
|
|
360
361
|
synchroniseExternallySelectedItemsToGrid();
|
|
361
362
|
},
|
|
362
363
|
[dataTestId, setApis, synchroniseExternallySelectedItemsToGrid],
|
|
@@ -389,19 +390,8 @@ export const Grid = ({
|
|
|
389
390
|
/**
|
|
390
391
|
* Show/hide no rows overlay when model changes.
|
|
391
392
|
*/
|
|
392
|
-
const isShowingNoRowsOverlay = useRef(false);
|
|
393
393
|
const onModelUpdated = useCallback((event: ModelUpdatedEvent) => {
|
|
394
|
-
|
|
395
|
-
if (!isShowingNoRowsOverlay.current) {
|
|
396
|
-
event.api.showNoRowsOverlay();
|
|
397
|
-
isShowingNoRowsOverlay.current = true;
|
|
398
|
-
}
|
|
399
|
-
} else {
|
|
400
|
-
if (isShowingNoRowsOverlay.current) {
|
|
401
|
-
event.api.hideOverlay();
|
|
402
|
-
isShowingNoRowsOverlay.current = false;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
394
|
+
event.api.showNoRowsOverlay();
|
|
405
395
|
}, []);
|
|
406
396
|
|
|
407
397
|
/**
|
|
@@ -622,10 +612,16 @@ export const Grid = ({
|
|
|
622
612
|
defaultColDef={{ minWidth: 48, ...omit(params.defaultColDef, ["editable"]) }}
|
|
623
613
|
columnDefs={columnDefsAdjusted}
|
|
624
614
|
rowData={params.rowData}
|
|
625
|
-
noRowsOverlayComponent={
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
615
|
+
noRowsOverlayComponent={(event: AgGridEvent) => {
|
|
616
|
+
let rowCount = 0;
|
|
617
|
+
event.api.forEachNode(() => rowCount++);
|
|
618
|
+
return (
|
|
619
|
+
<GridNoRowsOverlay
|
|
620
|
+
rowCount={rowCount}
|
|
621
|
+
filteredRowCount={event.api.getDisplayedRowCount()}
|
|
622
|
+
noRowsOverlayText={params.noRowsOverlayText}
|
|
623
|
+
/>
|
|
624
|
+
);
|
|
629
625
|
}}
|
|
630
626
|
onModelUpdated={onModelUpdated}
|
|
631
627
|
onGridReady={onGridReady}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
|
+
import { ReactElement } from "react";
|
|
2
3
|
|
|
3
4
|
import { LuiIcon } from "@linzjs/lui";
|
|
4
5
|
import { IconName, IconSize } from "@linzjs/lui/dist/components/LuiIcon/LuiIcon";
|
|
@@ -9,7 +10,7 @@ export const GridIcon = (props: {
|
|
|
9
10
|
size?: IconSize;
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
className?: string;
|
|
12
|
-
}):
|
|
13
|
+
}): ReactElement => (
|
|
13
14
|
<LuiIcon
|
|
14
15
|
name={props.icon}
|
|
15
16
|
title={props.title}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { isEmpty } from "lodash-es";
|
|
2
|
-
|
|
3
1
|
export const GridNoRowsOverlay = (params: {
|
|
4
|
-
|
|
2
|
+
rowCount: number | undefined | null;
|
|
3
|
+
filteredRowCount: number;
|
|
5
4
|
noRowsOverlayText: string | undefined;
|
|
6
|
-
}) =>
|
|
7
|
-
<span>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
</span>
|
|
12
|
-
);
|
|
5
|
+
}) => {
|
|
6
|
+
if (params.rowCount === 0) return <span>{params.noRowsOverlayText ?? "There are currently no rows"}</span>;
|
|
7
|
+
if (params.filteredRowCount === 0) return <span>All rows have been filtered</span>;
|
|
8
|
+
return <span />;
|
|
9
|
+
};
|
|
@@ -36,7 +36,7 @@ export interface GridContextType<RowType extends GridBaseRow> {
|
|
|
36
36
|
selectRowsByIdWithFlash: (rowIds?: number[]) => void;
|
|
37
37
|
flashRows: (rowIds?: number[]) => void;
|
|
38
38
|
flashRowsDiff: (updateFn: () => Promise<any>) => Promise<void>;
|
|
39
|
-
focusByRowById: (rowId: number) => void;
|
|
39
|
+
focusByRowById: (rowId: number, ifNoCellFocused?: boolean) => void;
|
|
40
40
|
ensureRowVisible: (id: number | string) => boolean;
|
|
41
41
|
ensureSelectedRowIsVisible: () => void;
|
|
42
42
|
getFirstRowId: () => number;
|
|
@@ -218,10 +218,19 @@ export const GridContextProvider = <RowType extends GridBaseRow>(props: GridCont
|
|
|
218
218
|
*/
|
|
219
219
|
const _selectRowsWithOptionalFlash = useCallback(
|
|
220
220
|
(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
221
|
+
{
|
|
222
|
+
rowIds,
|
|
223
|
+
select,
|
|
224
|
+
flash,
|
|
225
|
+
ifNoCellFocused = false,
|
|
226
|
+
retryCount = 15,
|
|
227
|
+
}: {
|
|
228
|
+
rowIds: number[] | undefined;
|
|
229
|
+
select: boolean;
|
|
230
|
+
flash: boolean;
|
|
231
|
+
ifNoCellFocused?: boolean;
|
|
232
|
+
retryCount?: number;
|
|
233
|
+
}, // We retry for approximately 5x200ms=1s
|
|
225
234
|
) => {
|
|
226
235
|
return gridApiOp((gridApi) => {
|
|
227
236
|
const rowNodes = rowIds ? _rowIdsToNodes(rowIds) : _getNewNodes();
|
|
@@ -230,7 +239,10 @@ export const GridContextProvider = <RowType extends GridBaseRow>(props: GridCont
|
|
|
230
239
|
const gridHasNotUpdated = gridRowIdsNotUpdatedYet || gridRowIdsNotChangedYet;
|
|
231
240
|
// After retry count expires we give-up and deselect all rows, then select any subset of rows that have updated
|
|
232
241
|
if (gridHasNotUpdated && retryCount > 0) {
|
|
233
|
-
delay(
|
|
242
|
+
delay(
|
|
243
|
+
() => _selectRowsWithOptionalFlash({ rowIds, select, flash, ifNoCellFocused, retryCount: retryCount - 1 }),
|
|
244
|
+
250,
|
|
245
|
+
);
|
|
234
246
|
return;
|
|
235
247
|
}
|
|
236
248
|
|
|
@@ -249,7 +261,13 @@ export const GridContextProvider = <RowType extends GridBaseRow>(props: GridCont
|
|
|
249
261
|
const colId = col.colId;
|
|
250
262
|
// We need to make sure we aren't currently editing a cell otherwise tests will fail
|
|
251
263
|
// as they will start to edit the cell before this stuff has a chance to run
|
|
252
|
-
colId &&
|
|
264
|
+
colId &&
|
|
265
|
+
delay(() => {
|
|
266
|
+
if (isEmpty(gridApi.getEditingCells()) && (!ifNoCellFocused || gridApi.getFocusedCell() == null)) {
|
|
267
|
+
// ifNoCellFocused
|
|
268
|
+
gridApi.setFocusedCell(rowIndex, colId);
|
|
269
|
+
}
|
|
270
|
+
}, 100);
|
|
253
271
|
}
|
|
254
272
|
}
|
|
255
273
|
}
|
|
@@ -278,17 +296,17 @@ export const GridContextProvider = <RowType extends GridBaseRow>(props: GridCont
|
|
|
278
296
|
);
|
|
279
297
|
|
|
280
298
|
const selectRowsById = useCallback(
|
|
281
|
-
(rowIds?: number[]) => _selectRowsWithOptionalFlash(rowIds, true, false),
|
|
299
|
+
(rowIds?: number[]) => _selectRowsWithOptionalFlash({ rowIds, select: true, flash: false }),
|
|
282
300
|
[_selectRowsWithOptionalFlash],
|
|
283
301
|
);
|
|
284
302
|
|
|
285
303
|
const selectRowsByIdWithFlash = useCallback(
|
|
286
|
-
(rowIds?: number[]) => _selectRowsWithOptionalFlash(rowIds, true, true),
|
|
304
|
+
(rowIds?: number[]) => _selectRowsWithOptionalFlash({ rowIds, select: true, flash: true }),
|
|
287
305
|
[_selectRowsWithOptionalFlash],
|
|
288
306
|
);
|
|
289
307
|
|
|
290
308
|
const flashRows = useCallback(
|
|
291
|
-
(rowIds?: number[]) => _selectRowsWithOptionalFlash(rowIds, false, true),
|
|
309
|
+
(rowIds?: number[]) => _selectRowsWithOptionalFlash({ rowIds, select: false, flash: true }),
|
|
292
310
|
[_selectRowsWithOptionalFlash],
|
|
293
311
|
);
|
|
294
312
|
|
|
@@ -296,7 +314,7 @@ export const GridContextProvider = <RowType extends GridBaseRow>(props: GridCont
|
|
|
296
314
|
async (fn: () => Promise<any>) => {
|
|
297
315
|
beforeUpdate();
|
|
298
316
|
await fn();
|
|
299
|
-
_selectRowsWithOptionalFlash(undefined, true, false);
|
|
317
|
+
_selectRowsWithOptionalFlash({ rowIds: undefined, select: true, flash: false });
|
|
300
318
|
},
|
|
301
319
|
[_selectRowsWithOptionalFlash, beforeUpdate],
|
|
302
320
|
);
|
|
@@ -305,7 +323,7 @@ export const GridContextProvider = <RowType extends GridBaseRow>(props: GridCont
|
|
|
305
323
|
async (fn: () => Promise<any>) => {
|
|
306
324
|
beforeUpdate();
|
|
307
325
|
await fn();
|
|
308
|
-
_selectRowsWithOptionalFlash(undefined, true, true);
|
|
326
|
+
_selectRowsWithOptionalFlash({ rowIds: undefined, select: true, flash: true });
|
|
309
327
|
},
|
|
310
328
|
[_selectRowsWithOptionalFlash, beforeUpdate],
|
|
311
329
|
);
|
|
@@ -314,13 +332,14 @@ export const GridContextProvider = <RowType extends GridBaseRow>(props: GridCont
|
|
|
314
332
|
async (fn: () => Promise<any>) => {
|
|
315
333
|
beforeUpdate();
|
|
316
334
|
await fn();
|
|
317
|
-
_selectRowsWithOptionalFlash(undefined, false, true);
|
|
335
|
+
_selectRowsWithOptionalFlash({ rowIds: undefined, select: false, flash: true });
|
|
318
336
|
},
|
|
319
337
|
[_selectRowsWithOptionalFlash, beforeUpdate],
|
|
320
338
|
);
|
|
321
339
|
|
|
322
340
|
const focusByRowById = useCallback(
|
|
323
|
-
(rowId: number
|
|
341
|
+
(rowId: number, ifNoCellFocused?: boolean) =>
|
|
342
|
+
_selectRowsWithOptionalFlash({ rowIds: [rowId], select: false, flash: false, ifNoCellFocused }),
|
|
324
343
|
[_selectRowsWithOptionalFlash],
|
|
325
344
|
);
|
|
326
345
|
|
package/src/lui/ActionButton.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "./ActionButton.scss";
|
|
2
|
+
|
|
1
3
|
import clsx from "clsx";
|
|
2
4
|
import { CSSProperties, useEffect, useState } from "react";
|
|
3
5
|
|
|
@@ -5,7 +7,6 @@ import { LuiButton, LuiIcon, LuiMiniSpinner } from "@linzjs/lui";
|
|
|
5
7
|
import { LuiButtonProps } from "@linzjs/lui/dist/components/LuiButton/LuiButton";
|
|
6
8
|
import { IconName } from "@linzjs/lui/dist/components/LuiIcon/LuiIcon";
|
|
7
9
|
|
|
8
|
-
import "./ActionButton.scss";
|
|
9
10
|
import { usePrevious } from "./reactUtils";
|
|
10
11
|
import { useStateDeferred } from "./stateDeferredHook";
|
|
11
12
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import "./TextInputFormatted.scss";
|
|
2
|
+
|
|
1
3
|
import clsx from "clsx";
|
|
2
4
|
import { omit } from "lodash-es";
|
|
3
5
|
import { DetailedHTMLProps, InputHTMLAttributes } from "react";
|
|
4
6
|
|
|
5
7
|
import { FormError } from "./FormError";
|
|
6
|
-
import "./TextInputFormatted.scss";
|
|
7
8
|
|
|
8
9
|
export interface LuiTextInputProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
9
10
|
// overrides value in base class to be string type only
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { screen } from "@testing-library/dom";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import userEvent from "@testing-library/user-event";
|
|
3
4
|
import { useEffect, useState } from "react";
|
|
4
5
|
|
|
5
6
|
import { usePrevious } from "./reactUtils";
|
|
@@ -39,10 +40,10 @@ describe("usePrevious", () => {
|
|
|
39
40
|
|
|
40
41
|
expect(extPrevious).toBeUndefined();
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
await userEvent.click(button);
|
|
43
44
|
expect(extPrevious).toBe(false);
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
await userEvent.click(button);
|
|
46
47
|
expect(extPrevious).toBe(true);
|
|
47
48
|
});
|
|
48
49
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
|
+
|
|
1
3
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
4
|
import { useCallback } from "react";
|
|
3
5
|
|
|
4
6
|
import "@linzjs/lui/dist/fonts";
|
|
5
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
6
7
|
|
|
7
8
|
import { ActionButton } from "../../lui/ActionButton";
|
|
8
9
|
import { wait } from "../../utils/util";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import "./FormTest.scss";
|
|
2
|
+
|
|
1
3
|
import { useCallback, useState } from "react";
|
|
2
4
|
|
|
3
5
|
import { LuiAlertModal, LuiAlertModalButtons, LuiButton, LuiTextInput } from "@linzjs/lui";
|
|
4
6
|
|
|
5
7
|
import { CellEditorCommon, FormError, useGridPopoverContext, useGridPopoverHook, wait } from "../..";
|
|
6
|
-
import "./FormTest.scss";
|
|
7
8
|
|
|
8
9
|
export interface IFormTestRow {
|
|
9
10
|
id: number;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import "../../styles/GridTheme.scss";
|
|
2
|
+
import "../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
6
|
import { useMemo, useState } from "react";
|
|
3
7
|
|
|
4
8
|
import "@linzjs/lui/dist/fonts";
|
|
5
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
6
9
|
|
|
7
10
|
import {
|
|
8
11
|
ColDefT,
|
|
@@ -16,26 +19,13 @@ import {
|
|
|
16
19
|
GridUpdatingContextProvider,
|
|
17
20
|
GridWrapper,
|
|
18
21
|
} from "../..";
|
|
19
|
-
import "../../styles/GridTheme.scss";
|
|
20
|
-
import "../../styles/index.scss";
|
|
21
22
|
|
|
22
23
|
export default {
|
|
23
24
|
title: "Components / Grids",
|
|
24
25
|
component: Grid,
|
|
25
26
|
decorators: [
|
|
26
27
|
(Story) => (
|
|
27
|
-
<div
|
|
28
|
-
style={{
|
|
29
|
-
border: "1px solid #eee",
|
|
30
|
-
display: "flex",
|
|
31
|
-
flexDirection: "column",
|
|
32
|
-
height: "100%",
|
|
33
|
-
maxHeight: 500,
|
|
34
|
-
maxWidth: "100%",
|
|
35
|
-
minWidth: "480px",
|
|
36
|
-
padding: "1em",
|
|
37
|
-
}}
|
|
38
|
-
>
|
|
28
|
+
<div style={{ width: 1024, height: 400, display: "flex" }}>
|
|
39
29
|
<GridUpdatingContextProvider>
|
|
40
30
|
<GridContextProvider>
|
|
41
31
|
<Story />
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
|
+
|
|
1
3
|
import { expect } from "@storybook/jest";
|
|
2
4
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
3
5
|
import { within } from "@storybook/testing-library";
|
|
4
6
|
|
|
5
7
|
import "@linzjs/lui/dist/fonts";
|
|
6
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
7
8
|
|
|
8
9
|
import { GridNoRowsOverlay } from "../../components";
|
|
9
10
|
|
|
@@ -19,7 +20,8 @@ const GridNoRowsOverlayTemplate: ComponentStory<typeof GridNoRowsOverlay> = (par
|
|
|
19
20
|
|
|
20
21
|
export const GridNoRowsEmpty = GridNoRowsOverlayTemplate.bind({});
|
|
21
22
|
GridNoRowsEmpty.args = {
|
|
22
|
-
|
|
23
|
+
rowCount: 0,
|
|
24
|
+
filteredRowCount: 0,
|
|
23
25
|
};
|
|
24
26
|
GridNoRowsEmpty.play = async ({ canvasElement }) => {
|
|
25
27
|
const canvas = within(canvasElement);
|
|
@@ -28,7 +30,8 @@ GridNoRowsEmpty.play = async ({ canvasElement }) => {
|
|
|
28
30
|
|
|
29
31
|
export const GridNoRowsFiltered = GridNoRowsOverlayTemplate.bind({});
|
|
30
32
|
GridNoRowsFiltered.args = {
|
|
31
|
-
|
|
33
|
+
rowCount: 1,
|
|
34
|
+
filteredRowCount: 0,
|
|
32
35
|
};
|
|
33
36
|
GridNoRowsFiltered.play = async ({ canvasElement }) => {
|
|
34
37
|
const canvas = within(canvasElement);
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "../../styles/GridTheme.scss";
|
|
2
|
+
import "../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
6
|
import { ColDef } from "ag-grid-community";
|
|
3
7
|
import { GridPopoverEditDropDown } from "components/gridPopoverEdit/GridPopoverEditDropDown";
|
|
@@ -5,7 +9,6 @@ import { GridPopoverTextArea } from "components/gridPopoverEdit/GridPopoverTextA
|
|
|
5
9
|
import { useMemo, useState } from "react";
|
|
6
10
|
|
|
7
11
|
import "@linzjs/lui/dist/fonts";
|
|
8
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
9
12
|
|
|
10
13
|
import {
|
|
11
14
|
ColDefT,
|
|
@@ -20,8 +23,6 @@ import {
|
|
|
20
23
|
MenuOption,
|
|
21
24
|
wait,
|
|
22
25
|
} from "../..";
|
|
23
|
-
import "../../styles/GridTheme.scss";
|
|
24
|
-
import "../../styles/index.scss";
|
|
25
26
|
|
|
26
27
|
export default {
|
|
27
28
|
title: "Components / Grids",
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import "../../styles/GridTheme.scss";
|
|
2
|
+
import "../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
6
|
import { ReactElement, useCallback, useContext, useMemo, useState } from "react";
|
|
3
7
|
|
|
4
8
|
import "@linzjs/lui/dist/fonts";
|
|
5
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
6
9
|
|
|
7
10
|
import {
|
|
8
11
|
ActionButton,
|
|
@@ -17,8 +20,6 @@ import {
|
|
|
17
20
|
MenuItem,
|
|
18
21
|
wait,
|
|
19
22
|
} from "../..";
|
|
20
|
-
import "../../styles/GridTheme.scss";
|
|
21
|
-
import "../../styles/index.scss";
|
|
22
23
|
import { IFormTestRow } from "./FormTest";
|
|
23
24
|
|
|
24
25
|
export default {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import "../../styles/GridTheme.scss";
|
|
2
|
+
import "../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
6
|
import { useMemo, useState } from "react";
|
|
3
7
|
|
|
4
8
|
import "@linzjs/lui/dist/fonts";
|
|
5
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
6
9
|
|
|
7
10
|
import { ColDefT, Grid, GridCell, GridContextProvider, GridProps, GridUpdatingContextProvider } from "../..";
|
|
8
|
-
import "../../styles/GridTheme.scss";
|
|
9
|
-
import "../../styles/index.scss";
|
|
10
11
|
import { FormTest, IFormTestRow } from "./FormTest";
|
|
11
12
|
|
|
12
13
|
export default {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import "../../styles/GridTheme.scss";
|
|
2
|
+
import "../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
6
|
import { useCallback, useContext, useMemo, useState } from "react";
|
|
3
7
|
|
|
4
8
|
import "@linzjs/lui/dist/fonts";
|
|
5
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
6
9
|
|
|
7
10
|
import {
|
|
8
11
|
ActionButton,
|
|
@@ -23,8 +26,6 @@ import {
|
|
|
23
26
|
isFloat,
|
|
24
27
|
wait,
|
|
25
28
|
} from "../..";
|
|
26
|
-
import "../../styles/GridTheme.scss";
|
|
27
|
-
import "../../styles/index.scss";
|
|
28
29
|
import { IFormTestRow } from "./FormTest";
|
|
29
30
|
|
|
30
31
|
export default {
|
|
@@ -172,7 +173,7 @@ const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridP
|
|
|
172
173
|
{
|
|
173
174
|
label: "Delete",
|
|
174
175
|
action: async ({ selectedRows }) => {
|
|
175
|
-
await wait(
|
|
176
|
+
await wait(1000);
|
|
176
177
|
setRowData(rowData.filter((data) => !selectedRows.some((row) => row.id == data.id)));
|
|
177
178
|
},
|
|
178
179
|
},
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import "../../styles/GridTheme.scss";
|
|
2
|
+
import "../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
6
|
import { useMemo, useState } from "react";
|
|
3
7
|
|
|
4
8
|
import "@linzjs/lui/dist/fonts";
|
|
5
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
6
9
|
|
|
7
10
|
import {
|
|
8
11
|
ColDefT,
|
|
@@ -20,8 +23,6 @@ import {
|
|
|
20
23
|
GridWrapper,
|
|
21
24
|
wait,
|
|
22
25
|
} from "../..";
|
|
23
|
-
import "../../styles/GridTheme.scss";
|
|
24
|
-
import "../../styles/index.scss";
|
|
25
26
|
|
|
26
27
|
export default {
|
|
27
28
|
title: "Components / Grids",
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import "../../styles/GridTheme.scss";
|
|
2
|
+
import "../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
6
|
import { useCallback, useMemo, useState } from "react";
|
|
3
7
|
|
|
4
8
|
import "@linzjs/lui/dist/fonts";
|
|
5
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
6
9
|
|
|
7
10
|
import {
|
|
8
11
|
ColDefT,
|
|
@@ -25,8 +28,6 @@ import {
|
|
|
25
28
|
MenuSeparatorString,
|
|
26
29
|
wait,
|
|
27
30
|
} from "../..";
|
|
28
|
-
import "../../styles/GridTheme.scss";
|
|
29
|
-
import "../../styles/index.scss";
|
|
30
31
|
|
|
31
32
|
export default {
|
|
32
33
|
title: "Components / Grids",
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import "../../styles/GridTheme.scss";
|
|
2
|
+
import "../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
6
|
import { isEmpty, partition } from "lodash-es";
|
|
3
7
|
import { useMemo, useState } from "react";
|
|
4
8
|
|
|
5
9
|
import "@linzjs/lui/dist/fonts";
|
|
6
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
7
10
|
|
|
8
11
|
import {
|
|
9
12
|
ColDefT,
|
|
@@ -18,8 +21,6 @@ import {
|
|
|
18
21
|
MultiSelectOption,
|
|
19
22
|
wait,
|
|
20
23
|
} from "../..";
|
|
21
|
-
import "../../styles/GridTheme.scss";
|
|
22
|
-
import "../../styles/index.scss";
|
|
23
24
|
|
|
24
25
|
export default {
|
|
25
26
|
title: "Components / Grids",
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import "../../styles/GridTheme.scss";
|
|
2
|
+
import "../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
1
5
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
2
6
|
import { countBy, mergeWith, pull, range, union } from "lodash-es";
|
|
3
7
|
import { useMemo, useState } from "react";
|
|
4
8
|
|
|
5
9
|
import "@linzjs/lui/dist/fonts";
|
|
6
|
-
import "@linzjs/lui/dist/scss/base.scss";
|
|
7
10
|
|
|
8
11
|
import { ColDefT, Grid, GridCell, GridContextProvider, GridProps, GridUpdatingContextProvider } from "../..";
|
|
9
12
|
import { MultiSelectGridOption } from "../../components/gridForm/GridFormMultiSelectGrid";
|
|
10
13
|
import { GridPopoutEditMultiSelectGrid } from "../../components/gridPopoverEdit/GridPopoutEditMultiSelectGrid";
|
|
11
|
-
import "../../styles/GridTheme.scss";
|
|
12
|
-
import "../../styles/index.scss";
|
|
13
14
|
|
|
14
15
|
export default {
|
|
15
16
|
title: "Components / Grids",
|