@linzjs/step-ag-grid 21.1.0 → 21.1.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/dist/src/components/GridNoRowsOverlay.d.ts +3 -1
- package/dist/step-ag-grid.cjs.js +24 -11
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +25 -13
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +9 -2
- package/src/components/GridNoRowsOverlay.tsx +21 -7
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import { LuiMiniSpinner, LuiStatusSpinner, LuiIcon, LuiButton, LuiCheckboxInput,
|
|
|
3
3
|
import { RowHighlightPosition } from 'ag-grid-community';
|
|
4
4
|
import { AgGridReact } from 'ag-grid-react';
|
|
5
5
|
import { negate, isEmpty, findIndex, defer as defer$1, debounce as debounce$1, xorBy, last, difference, omit, sortBy, delay, partition, pick, groupBy, fromPairs, toPairs, isEqual, compact, filter, sumBy, pull, remove, castArray, flatten } from 'lodash-es';
|
|
6
|
-
import React, { useRef, useEffect, useLayoutEffect, createContext, useContext, useCallback, useState, useMemo, memo,
|
|
6
|
+
import React, { useRef, useEffect, useLayoutEffect, createContext, useContext, forwardRef, useCallback, useState, useMemo, memo, useReducer, cloneElement, useImperativeHandle, Fragment } from 'react';
|
|
7
7
|
import { unstable_batchedUpdates, flushSync, createPortal } from 'react-dom';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -262,7 +262,7 @@ const sanitiseFileName = (filename) => {
|
|
|
262
262
|
return valid.slice(0, -fileExt.length - 1).slice(0, 64) + "." + fileExt;
|
|
263
263
|
};
|
|
264
264
|
|
|
265
|
-
const
|
|
265
|
+
const GridLoadingOverlayComponentFr = (props, externalRef) => (jsx("div", { ref: externalRef, style: {
|
|
266
266
|
left: 0,
|
|
267
267
|
top: 0,
|
|
268
268
|
bottom: 0,
|
|
@@ -270,15 +270,20 @@ const GridLoadingOverlayComponent = (props) => (jsx("div", { style: {
|
|
|
270
270
|
position: "absolute",
|
|
271
271
|
backgroundColor: "rgba(255,255,255,0.5)",
|
|
272
272
|
}, children: jsx("div", { style: { height: "100%", position: "relative" }, children: jsx("div", { style: { position: "absolute", left: 0, top: props.headerRowHeight, right: 0, bottom: 0 }, children: jsx(LuiStatusSpinner, {}) }) }) }));
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (props.
|
|
279
|
-
return jsx("div", { children: props.
|
|
280
|
-
|
|
273
|
+
const GridLoadingOverlayComponent = forwardRef(GridLoadingOverlayComponentFr);
|
|
274
|
+
const GridNoRowsOverlayFr = (props, externalRef) => {
|
|
275
|
+
if (props.loading) {
|
|
276
|
+
return jsx(GridLoadingOverlayComponent, { ref: externalRef, headerRowHeight: props.headerRowHeight });
|
|
277
|
+
}
|
|
278
|
+
if (props.rowCount === 0) {
|
|
279
|
+
return jsx("div", { ref: externalRef, children: props.noRowsOverlayText ?? "There are currently no rows" });
|
|
280
|
+
}
|
|
281
|
+
if (props.filteredRowCount === 0) {
|
|
282
|
+
return jsx("div", { ref: externalRef, children: props.noRowsMatchingOverlayText ?? "All rows have been filtered" });
|
|
283
|
+
}
|
|
284
|
+
return jsx("div", { ref: externalRef });
|
|
281
285
|
};
|
|
286
|
+
const GridNoRowsOverlay = forwardRef(GridNoRowsOverlayFr);
|
|
282
287
|
|
|
283
288
|
/**
|
|
284
289
|
* Retains last sort order from via <AgGrid postRowSort>.
|
|
@@ -2347,6 +2352,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
|
|
|
2347
2352
|
const hasSetContentSize = useRef(false);
|
|
2348
2353
|
const hasSetContentSizeEmpty = useRef(false);
|
|
2349
2354
|
const needsAutoSize = useRef(true);
|
|
2355
|
+
const lastFullResize = useRef();
|
|
2350
2356
|
const setInitialContentSize = useCallback(() => {
|
|
2351
2357
|
if (!gridDivRef.current?.clientWidth || rowData == null) {
|
|
2352
2358
|
// Don't resize grids if they are offscreen as it doesn't work.
|
|
@@ -2374,8 +2380,14 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
|
|
|
2374
2380
|
}
|
|
2375
2381
|
else if (gridRendered === "rows-visible") {
|
|
2376
2382
|
if (!hasSetContentSize.current) {
|
|
2377
|
-
|
|
2378
|
-
|
|
2383
|
+
if (lastFullResize.current === result.width) {
|
|
2384
|
+
hasSetContentSize.current = true;
|
|
2385
|
+
params.onContentSize?.(result);
|
|
2386
|
+
}
|
|
2387
|
+
else {
|
|
2388
|
+
needsAutoSize.current = true;
|
|
2389
|
+
}
|
|
2390
|
+
lastFullResize.current = result.width;
|
|
2379
2391
|
}
|
|
2380
2392
|
}
|
|
2381
2393
|
else {
|
|
@@ -5280,5 +5292,5 @@ const useDeferredPromise = () => {
|
|
|
5280
5292
|
};
|
|
5281
5293
|
};
|
|
5282
5294
|
|
|
5283
|
-
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellFiller, GridCellFillerColId, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFilterButtons, GridFilterColumnsToggle, GridFilterDownloadCsvButton, GridFilterHeaderIconButton, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormMultiSelectGrid, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridNoRowsOverlay, GridPopoutEditMultiSelect, GridPopoutEditMultiSelectGrid, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, convertDDToDMS, downloadCsvUseValueFormattersProcessCellCallback, findParentWithClass, fnOrVar, generateFilterGetter, hasParentClass, isFloat, isGridCellFiller, isNotEmpty, sanitiseFileName, stringByteLengthIsInvalid, suppressCellKeyboardEvents, useDeferredPromise, useGenerateOrDefaultId, useGridContext, useGridContextMenu, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
|
|
5295
|
+
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellFiller, GridCellFillerColId, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFilterButtons, GridFilterColumnsToggle, GridFilterDownloadCsvButton, GridFilterHeaderIconButton, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormMultiSelectGrid, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridNoRowsOverlay, GridNoRowsOverlayFr, GridPopoutEditMultiSelect, GridPopoutEditMultiSelectGrid, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, convertDDToDMS, downloadCsvUseValueFormattersProcessCellCallback, findParentWithClass, fnOrVar, generateFilterGetter, hasParentClass, isFloat, isGridCellFiller, isNotEmpty, sanitiseFileName, stringByteLengthIsInvalid, suppressCellKeyboardEvents, useDeferredPromise, useGenerateOrDefaultId, useGridContext, useGridContextMenu, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait };
|
|
5284
5296
|
//# sourceMappingURL=step-ag-grid.esm.js.map
|