@gridkitjs/react 0.0.0-dev-20261119135354 → 0.0.0-dev-20261120100049
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/index.d.ts +1 -1
- package/dist/index.js +97 -47
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, Ref, RefObject } from 'react';
|
|
3
3
|
import { ExportWriter, GridExportOptions, PrintOptions, CellSelectEvent as CellSelectEvent$1, CellSelectionChangeEvent as CellSelectionChangeEvent$1, ColumnDefinition as ColumnDefinition$1, ColumnSelectEvent as ColumnSelectEvent$1, ColumnSelectionChangeEvent as ColumnSelectionChangeEvent$1, ColumnsSelectEvent as ColumnsSelectEvent$1, DataColumn as DataColumn$1, GridOptions, PaginationState, SelectionCallbacks as SelectionCallbacks$1, ResolvedRow, DisplayRow, ResolvedColumn as ResolvedColumn$1, ColumnSizingState, ColumnOrderState, ColumnVisibilityState, ColumnPinningState, ColumnSortState, FilterState, GroupByState, GroupExpansionState, AggregateResults, SelectionState, CellSelectionState, GridFocus, GridState, SerializedGridState, ColumnPin, GridContextMenuTarget, GridCommandTarget, SelectedCell as SelectedCell$1, SelectedColumn as SelectedColumn$1 } from '@gridkitjs/core';
|
|
4
|
-
export { AggregateFn, AggregateResults, AggregateSpec, AggregateState, Borders, BuiltInAggregate, CellSelectionMode, CellSelectionState, CellTemplateContext, ColumnAlignment, ColumnFilterMenuOptions, ColumnOrderEvent, ColumnOrderState, ColumnPin, ColumnPinningEvent, ColumnPinningState, ColumnResizeEvent, ColumnSizeDefaults, ColumnSizingState, ColumnSortEntry, ColumnSortEvent, ColumnSortState, ColumnType, ColumnVisibilityEvent, ColumnVisibilityState, ColumnWrapConfig, ContextMenuOpenChangeEvent, DisplayRow, ExportFile, ExportOptions, ExportScalar, ExportWriter, FieldPath, FilterChangeEvent, FilterEntry, FilterState, FooterTemplateContext, FormatLocale, GridCommand, GridCommandEvent, GridCommandTarget, GridContextMenuOptions, GridContextMenuRequest, GridContextMenuTarget, GridExportOptions, GridFilterMenuOptions, GridFocus, GridMessages, GridOptions, GridState, GridToolbarOptions, GroupAggregateDisplay, GroupByBarVisibility, GroupByEntry, GroupByEvent, GroupByState, GroupExpansionEvent, GroupExpansionState, HoverableConfig, MenuEntry, PaginationChangeEvent, PaginationState, PaginationUnit, PrintOptions, ResizeMode, ResolvedGroupRow, ResolvedGroupSummaryRow, ResolvedRow, RowGroupPosition, RowPointerEvent, RowProps, RowSelectEvent, RowSelectionChangeEvent, RowsSelectEvent, SelectableConfig, SelectedCellRef, SelectionMode, SelectionState, SerializedGridState, SortDirection, ToolbarEntry, ToolbarItemAttributes, excelFilter, serializeGridState } from '@gridkitjs/core';
|
|
4
|
+
export { AggregateFn, AggregateResults, AggregateSpec, AggregateState, Borders, BuiltInAggregate, CellSelectionMode, CellSelectionState, CellTemplateContext, ColumnAlignment, ColumnFilterMenuOptions, ColumnOrderEvent, ColumnOrderState, ColumnPin, ColumnPinningEvent, ColumnPinningState, ColumnResizeEvent, ColumnSizeDefaults, ColumnSizingState, ColumnSortEntry, ColumnSortEvent, ColumnSortState, ColumnType, ColumnVisibilityEvent, ColumnVisibilityState, ColumnWrapConfig, ContextMenuOpenChangeEvent, DataMode, DisplayRow, ExportFile, ExportOptions, ExportScalar, ExportWriter, FieldPath, FilterChangeEvent, FilterEntry, FilterState, FooterTemplateContext, FormatLocale, GridCommand, GridCommandEvent, GridCommandTarget, GridContextMenuOptions, GridContextMenuRequest, GridContextMenuTarget, GridExportOptions, GridFilterMenuOptions, GridFocus, GridMessages, GridOptions, GridState, GridToolbarOptions, GroupAggregateDisplay, GroupByBarVisibility, GroupByEntry, GroupByEvent, GroupByState, GroupExpansionEvent, GroupExpansionState, HoverableConfig, MenuEntry, PaginationChangeEvent, PaginationState, PaginationUnit, PrintOptions, ResizeMode, ResolvedGroupRow, ResolvedGroupSummaryRow, ResolvedRow, RowGroupPosition, RowPointerEvent, RowProps, RowSelectEvent, RowSelectionChangeEvent, RowsSelectEvent, SelectableConfig, SelectedCellRef, SelectionMode, SelectionState, SerializedGridState, SortDirection, ToolbarEntry, ToolbarItemAttributes, excelFilter, serializeGridState } from '@gridkitjs/core';
|
|
5
5
|
|
|
6
6
|
/** What `DataGridApi` carries for exporting. */
|
|
7
7
|
interface GridExportApi {
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
useId as useId2,
|
|
7
7
|
useImperativeHandle as useImperativeHandle3,
|
|
8
8
|
useMemo as useMemo5,
|
|
9
|
-
useRef as
|
|
9
|
+
useRef as useRef24,
|
|
10
10
|
useState as useState19
|
|
11
11
|
} from "react";
|
|
12
12
|
import {
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
pinnedWidths as pinnedWidths2,
|
|
22
22
|
totalColumnWidth
|
|
23
23
|
} from "@gridkitjs/core/renderer";
|
|
24
|
+
import { keyOrigin as keyOrigin2 } from "@gridkitjs/dom";
|
|
24
25
|
|
|
25
26
|
// src/DataGrid/components/GridColgroup.tsx
|
|
26
27
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -110,6 +111,16 @@ function ChevronsRightIcon() {
|
|
|
110
111
|
] });
|
|
111
112
|
}
|
|
112
113
|
|
|
114
|
+
// src/DataGrid/controlKeys.ts
|
|
115
|
+
import { keyOrigin } from "@gridkitjs/dom";
|
|
116
|
+
function isControlKey(event) {
|
|
117
|
+
const origin = keyOrigin(event.target);
|
|
118
|
+
return origin === "text-entry" || origin === "control" && (event.key === " " || event.key === "Enter");
|
|
119
|
+
}
|
|
120
|
+
function isKeyActivatedControl(event) {
|
|
121
|
+
return event.detail === 0 && keyOrigin(event.target) !== "grid";
|
|
122
|
+
}
|
|
123
|
+
|
|
113
124
|
// src/DataGrid/isOwnEvent.ts
|
|
114
125
|
function isOwnEvent(event) {
|
|
115
126
|
return event.target instanceof Node && event.currentTarget.contains(event.target);
|
|
@@ -247,7 +258,7 @@ function GridHeader({
|
|
|
247
258
|
nav.focusCell(headerFocus(index));
|
|
248
259
|
},
|
|
249
260
|
onClick: (event) => {
|
|
250
|
-
if (drag.justDragged(entry.id)) {
|
|
261
|
+
if (drag.justDragged(entry.id) || isKeyActivatedControl(event)) {
|
|
251
262
|
return;
|
|
252
263
|
}
|
|
253
264
|
if (event.target instanceof Element && (event.target.closest(".gridkit-header-resize-handle") !== null || event.target.closest(".gridkit-header-sort-toggle") !== null || event.target.closest(".gridkit-header-group-toggle") !== null || event.target.closest(".gridkit-header-filter-toggle") !== null)) {
|
|
@@ -256,7 +267,7 @@ function GridHeader({
|
|
|
256
267
|
selection.selectColumn(entry.id, intentOf(event));
|
|
257
268
|
},
|
|
258
269
|
onKeyDown: (event) => {
|
|
259
|
-
if (!isOwnEvent(event)) return;
|
|
270
|
+
if (!isOwnEvent(event) || isControlKey(event)) return;
|
|
260
271
|
const step = inlineStep(
|
|
261
272
|
event.key,
|
|
262
273
|
writingDirection(event.currentTarget)
|
|
@@ -1024,6 +1035,7 @@ function GridBody({
|
|
|
1024
1035
|
);
|
|
1025
1036
|
},
|
|
1026
1037
|
onClick: (event) => {
|
|
1038
|
+
if (isKeyActivatedControl(event)) return;
|
|
1027
1039
|
const group = groupRowFrom(event.target);
|
|
1028
1040
|
if (group !== null) {
|
|
1029
1041
|
controller.toggleGroupExpansion(group.groupId);
|
|
@@ -1039,7 +1051,7 @@ function GridBody({
|
|
|
1039
1051
|
reportRowPointer(event, onRowDoubleClick);
|
|
1040
1052
|
},
|
|
1041
1053
|
onKeyDown: (event) => {
|
|
1042
|
-
if (!isOwnEvent(event)) return;
|
|
1054
|
+
if (!isOwnEvent(event) || isControlKey(event)) return;
|
|
1043
1055
|
const group = groupRowFrom(event.target);
|
|
1044
1056
|
if (group !== null) {
|
|
1045
1057
|
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
|
@@ -2844,7 +2856,7 @@ function useGridOverlay({
|
|
|
2844
2856
|
}
|
|
2845
2857
|
|
|
2846
2858
|
// src/DataGrid/panels/GridPanels.tsx
|
|
2847
|
-
import { useRef as
|
|
2859
|
+
import { useRef as useRef16 } from "react";
|
|
2848
2860
|
|
|
2849
2861
|
// src/DataGrid/columnChooser/ColumnChooser.tsx
|
|
2850
2862
|
import { useLayoutEffect as useLayoutEffect7, useRef as useRef9, useState as useState6 } from "react";
|
|
@@ -3882,25 +3894,47 @@ function FilterMenu({
|
|
|
3882
3894
|
}
|
|
3883
3895
|
|
|
3884
3896
|
// src/DataGrid/useAnnounceWhenDrawn.ts
|
|
3885
|
-
import { useEffect as useEffect5, useState as useState10 } from "react";
|
|
3886
|
-
function useAnnounceWhenDrawn(announce) {
|
|
3897
|
+
import { useEffect as useEffect5, useRef as useRef15, useState as useState10 } from "react";
|
|
3898
|
+
function useAnnounceWhenDrawn(announce, controller) {
|
|
3887
3899
|
const [requested, setRequested] = useState10(null);
|
|
3900
|
+
const settled = useRef15(null);
|
|
3901
|
+
const { dataMode, dataSource, loading = false } = controller.getOptions();
|
|
3888
3902
|
useEffect5(() => {
|
|
3889
|
-
if (requested
|
|
3890
|
-
|
|
3903
|
+
if (requested === null || settled.current === requested) {
|
|
3904
|
+
return;
|
|
3891
3905
|
}
|
|
3892
|
-
|
|
3893
|
-
|
|
3906
|
+
const { announcement, rowsAsked } = requested;
|
|
3907
|
+
const awaitingRows = dataMode === "server" && (loading || dataSource === rowsAsked);
|
|
3908
|
+
const drawn = announcement.drawn();
|
|
3909
|
+
if (drawn && awaitingRows) {
|
|
3910
|
+
return;
|
|
3911
|
+
}
|
|
3912
|
+
settled.current = requested;
|
|
3913
|
+
if (drawn) {
|
|
3914
|
+
announce(announcement.text());
|
|
3915
|
+
}
|
|
3916
|
+
}, [requested, dataMode, dataSource, loading, announce]);
|
|
3917
|
+
return (announcement) => {
|
|
3918
|
+
setRequested({
|
|
3919
|
+
announcement,
|
|
3920
|
+
rowsAsked: controller.getOptions().dataSource
|
|
3921
|
+
});
|
|
3922
|
+
};
|
|
3923
|
+
}
|
|
3924
|
+
function resultCount(controller) {
|
|
3925
|
+
const { dataMode, rowCount } = controller.getOptions();
|
|
3926
|
+
const held = controller.getView().rows.length;
|
|
3927
|
+
return dataMode === "server" ? rowCount ?? held : held;
|
|
3894
3928
|
}
|
|
3895
3929
|
|
|
3896
3930
|
// src/DataGrid/filterMenu/useApplyFilter.ts
|
|
3897
3931
|
function useApplyFilter(controller, messages, announce) {
|
|
3898
|
-
const announceWhenDrawn = useAnnounceWhenDrawn(announce);
|
|
3932
|
+
const announceWhenDrawn = useAnnounceWhenDrawn(announce, controller);
|
|
3899
3933
|
return (filter) => {
|
|
3900
3934
|
announceWhenDrawn({
|
|
3901
3935
|
drawn: () => controller.getState().filter === filter,
|
|
3902
|
-
text: () => messages.filterResults(
|
|
3903
|
-
controller
|
|
3936
|
+
text: () => controller.getOptions().dataMode === "server" ? messages.searchResults(resultCount(controller)) : messages.filterResults(
|
|
3937
|
+
resultCount(controller),
|
|
3904
3938
|
controller.getOptions().dataSource?.length ?? 0
|
|
3905
3939
|
)
|
|
3906
3940
|
});
|
|
@@ -3940,7 +3974,7 @@ function GridPanels({
|
|
|
3940
3974
|
commands,
|
|
3941
3975
|
messages
|
|
3942
3976
|
}) {
|
|
3943
|
-
const initialFocus =
|
|
3977
|
+
const initialFocus = useRef16(null);
|
|
3944
3978
|
const applyFilter = useApplyFilter(
|
|
3945
3979
|
controller,
|
|
3946
3980
|
messages,
|
|
@@ -4009,7 +4043,7 @@ function panelApi(panels, controller) {
|
|
|
4009
4043
|
}
|
|
4010
4044
|
|
|
4011
4045
|
// src/DataGrid/panels/useGridPanels.ts
|
|
4012
|
-
import { useRef as
|
|
4046
|
+
import { useRef as useRef17 } from "react";
|
|
4013
4047
|
import {
|
|
4014
4048
|
writingDirection as writingDirection6
|
|
4015
4049
|
} from "@gridkitjs/dom";
|
|
@@ -4038,7 +4072,7 @@ function useGridPanels({
|
|
|
4038
4072
|
headerTableRef,
|
|
4039
4073
|
overlay
|
|
4040
4074
|
}) {
|
|
4041
|
-
const openings =
|
|
4075
|
+
const openings = useRef17(0);
|
|
4042
4076
|
function placeFor(root, target) {
|
|
4043
4077
|
const element = target.area === "toolbar" ? toolbarItem(root, target.itemId) : target.area === "header" ? headerCell2(headerTableRef.current, target.columnId) : null;
|
|
4044
4078
|
if (element !== null) {
|
|
@@ -4084,7 +4118,7 @@ function useGridPanels({
|
|
|
4084
4118
|
}
|
|
4085
4119
|
|
|
4086
4120
|
// src/DataGrid/toolbar/GridToolbar.tsx
|
|
4087
|
-
import { useLayoutEffect as useLayoutEffect13, useRef as
|
|
4121
|
+
import { useLayoutEffect as useLayoutEffect13, useRef as useRef20 } from "react";
|
|
4088
4122
|
import {
|
|
4089
4123
|
resolveToolbar,
|
|
4090
4124
|
toolbarEntries
|
|
@@ -4156,7 +4190,7 @@ function ToolbarMenuButton({
|
|
|
4156
4190
|
}
|
|
4157
4191
|
|
|
4158
4192
|
// src/DataGrid/toolbar/ToolbarSearch.tsx
|
|
4159
|
-
import { useEffect as useEffect6, useRef as
|
|
4193
|
+
import { useEffect as useEffect6, useRef as useRef18, useState as useState12 } from "react";
|
|
4160
4194
|
import { searchTextOf, setSearchText } from "@gridkitjs/core/renderer";
|
|
4161
4195
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
4162
4196
|
var SEARCH_DELAY_MS = 250;
|
|
@@ -4169,8 +4203,8 @@ function ToolbarSearch({
|
|
|
4169
4203
|
}) {
|
|
4170
4204
|
const applied = searchTextOf(controller.getState().filter);
|
|
4171
4205
|
const [draft, setDraft] = useState12(null);
|
|
4172
|
-
const timer =
|
|
4173
|
-
const announceWhenDrawn = useAnnounceWhenDrawn(announce);
|
|
4206
|
+
const timer = useRef18(void 0);
|
|
4207
|
+
const announceWhenDrawn = useAnnounceWhenDrawn(announce, controller);
|
|
4174
4208
|
const text = draft !== null && draft.over === applied ? draft.text : applied;
|
|
4175
4209
|
function apply(next, over) {
|
|
4176
4210
|
clearTimeout(timer.current);
|
|
@@ -4183,7 +4217,7 @@ function ToolbarSearch({
|
|
|
4183
4217
|
if (searched !== filter) {
|
|
4184
4218
|
announceWhenDrawn({
|
|
4185
4219
|
drawn: () => searchTextOf(controller.getState().filter) === next,
|
|
4186
|
-
text: () => messages.searchResults(controller
|
|
4220
|
+
text: () => messages.searchResults(resultCount(controller))
|
|
4187
4221
|
});
|
|
4188
4222
|
controller.setFilter(searched);
|
|
4189
4223
|
}
|
|
@@ -4225,12 +4259,12 @@ function ToolbarSearch({
|
|
|
4225
4259
|
}
|
|
4226
4260
|
|
|
4227
4261
|
// src/DataGrid/toolbar/useToolbarOverflow.ts
|
|
4228
|
-
import { useLayoutEffect as useLayoutEffect12, useRef as
|
|
4262
|
+
import { useLayoutEffect as useLayoutEffect12, useRef as useRef19, useState as useState13 } from "react";
|
|
4229
4263
|
import { observeToolbarOverflow } from "@gridkitjs/dom";
|
|
4230
4264
|
function useToolbarOverflow(toolbarRef, items) {
|
|
4231
4265
|
const [fit, setFit] = useState13(items.length);
|
|
4232
|
-
const overflow =
|
|
4233
|
-
const measuredLayout =
|
|
4266
|
+
const overflow = useRef19(null);
|
|
4267
|
+
const measuredLayout = useRef19("");
|
|
4234
4268
|
const layout = JSON.stringify(
|
|
4235
4269
|
items.map((item) => [
|
|
4236
4270
|
item.type,
|
|
@@ -4337,7 +4371,7 @@ function Toolbar({
|
|
|
4337
4371
|
messages,
|
|
4338
4372
|
announce
|
|
4339
4373
|
}) {
|
|
4340
|
-
const toolbarRef =
|
|
4374
|
+
const toolbarRef = useRef20(null);
|
|
4341
4375
|
const items = resolveToolbar(entries, {
|
|
4342
4376
|
commands: commands.commands,
|
|
4343
4377
|
contextFor: commands.contextFor,
|
|
@@ -4657,14 +4691,14 @@ function useGridController(options) {
|
|
|
4657
4691
|
}
|
|
4658
4692
|
|
|
4659
4693
|
// src/DataGrid/useInfiniteScroll.ts
|
|
4660
|
-
import { useEffect as useEffect7, useRef as
|
|
4694
|
+
import { useEffect as useEffect7, useRef as useRef21 } from "react";
|
|
4661
4695
|
import { attachInfiniteScroll } from "@gridkitjs/dom";
|
|
4662
4696
|
function useInfiniteScroll({
|
|
4663
4697
|
rootRef,
|
|
4664
4698
|
sentinelRef,
|
|
4665
4699
|
config
|
|
4666
4700
|
}) {
|
|
4667
|
-
const scroll =
|
|
4701
|
+
const scroll = useRef21(null);
|
|
4668
4702
|
useEffect7(() => {
|
|
4669
4703
|
const root = rootRef.current;
|
|
4670
4704
|
if (root === null) {
|
|
@@ -4692,10 +4726,10 @@ function useInfiniteScroll({
|
|
|
4692
4726
|
}
|
|
4693
4727
|
|
|
4694
4728
|
// src/DataGrid/useLiveAnnouncer.ts
|
|
4695
|
-
import { useCallback as useCallback3, useLayoutEffect as useLayoutEffect16, useRef as
|
|
4729
|
+
import { useCallback as useCallback3, useLayoutEffect as useLayoutEffect16, useRef as useRef22 } from "react";
|
|
4696
4730
|
import { createLiveAnnouncer } from "@gridkitjs/dom";
|
|
4697
4731
|
function useLiveAnnouncer(containerRef) {
|
|
4698
|
-
const announcer =
|
|
4732
|
+
const announcer = useRef22(null);
|
|
4699
4733
|
useLayoutEffect16(() => {
|
|
4700
4734
|
const container = containerRef.current;
|
|
4701
4735
|
if (container === null) {
|
|
@@ -4714,7 +4748,7 @@ function useLiveAnnouncer(containerRef) {
|
|
|
4714
4748
|
}
|
|
4715
4749
|
|
|
4716
4750
|
// src/DataGrid/useRowVirtualizer.ts
|
|
4717
|
-
import { useLayoutEffect as useLayoutEffect17, useRef as
|
|
4751
|
+
import { useLayoutEffect as useLayoutEffect17, useRef as useRef23, useState as useState18 } from "react";
|
|
4718
4752
|
import {
|
|
4719
4753
|
bodyRowFrom as bodyRowFrom3,
|
|
4720
4754
|
createRowVirtualizer as createRowVirtualizer2
|
|
@@ -4755,8 +4789,8 @@ function useRowVirtualizer({
|
|
|
4755
4789
|
overscan
|
|
4756
4790
|
}) {
|
|
4757
4791
|
const [virtualizer, setVirtualizer] = useState18(null);
|
|
4758
|
-
const instance =
|
|
4759
|
-
const rowCount =
|
|
4792
|
+
const instance = useRef23(null);
|
|
4793
|
+
const rowCount = useRef23(rows.length);
|
|
4760
4794
|
const [rowWindow, setRowWindow] = useState18(enabled ? NO_ROWS3 : ALL_ROWS);
|
|
4761
4795
|
if (!enabled && rowWindow.kind !== "allRows") {
|
|
4762
4796
|
setRowWindow(ALL_ROWS);
|
|
@@ -4877,15 +4911,15 @@ function DataGrid(props) {
|
|
|
4877
4911
|
const hoverRows = hoverable?.rows ?? true;
|
|
4878
4912
|
const hoverColumns = hoverable?.columns ?? true;
|
|
4879
4913
|
const hoverCells = hoverable?.cells ?? true;
|
|
4880
|
-
const viewportRef =
|
|
4881
|
-
const gridRef =
|
|
4882
|
-
const headerTableRef =
|
|
4883
|
-
const bodyTableRef =
|
|
4884
|
-
const bodyRef =
|
|
4885
|
-
const footerTableRef =
|
|
4886
|
-
const sentinelRef =
|
|
4914
|
+
const viewportRef = useRef24(null);
|
|
4915
|
+
const gridRef = useRef24(null);
|
|
4916
|
+
const headerTableRef = useRef24(null);
|
|
4917
|
+
const bodyTableRef = useRef24(null);
|
|
4918
|
+
const bodyRef = useRef24(null);
|
|
4919
|
+
const footerTableRef = useRef24(null);
|
|
4920
|
+
const sentinelRef = useRef24(null);
|
|
4887
4921
|
const viewportWidth = useElementWidth(gridRef, resizeMode === "fit");
|
|
4888
|
-
const subscribersRef =
|
|
4922
|
+
const subscribersRef = useRef24(/* @__PURE__ */ new Set());
|
|
4889
4923
|
const gridId = useId2();
|
|
4890
4924
|
const announce = useLiveAnnouncer(viewportRef);
|
|
4891
4925
|
const messages = useMemo5(
|
|
@@ -4928,6 +4962,14 @@ function DataGrid(props) {
|
|
|
4928
4962
|
);
|
|
4929
4963
|
}
|
|
4930
4964
|
}, [paginated, hasInfiniteScroll]);
|
|
4965
|
+
const serverPagesUncounted = props.dataMode === "server" && paginated && props.rowCount === void 0;
|
|
4966
|
+
useEffect8(() => {
|
|
4967
|
+
if (serverPagesUncounted) {
|
|
4968
|
+
console.error(
|
|
4969
|
+
'DataGrid: a `paginated` grid under `dataMode: "server"` needs `rowCount` \u2014 without it the pager counts only the rows given, one page. Pass `0` until the first response.'
|
|
4970
|
+
);
|
|
4971
|
+
}
|
|
4972
|
+
}, [serverPagesUncounted]);
|
|
4931
4973
|
useInfiniteScroll({
|
|
4932
4974
|
rootRef: gridRef,
|
|
4933
4975
|
sentinelRef,
|
|
@@ -5256,7 +5298,7 @@ function DataGrid(props) {
|
|
|
5256
5298
|
id: gridId,
|
|
5257
5299
|
className: "gridkit-data-grid-tables",
|
|
5258
5300
|
role: state.groupBy.length > 0 ? "treegrid" : "grid",
|
|
5259
|
-
"aria-rowcount": view.
|
|
5301
|
+
"aria-rowcount": view.rowCount + (hasFooter ? 2 : 1),
|
|
5260
5302
|
"aria-colcount": view.columns.length,
|
|
5261
5303
|
tabIndex: -1,
|
|
5262
5304
|
style: tablesStyle(
|
|
@@ -5275,13 +5317,21 @@ function DataGrid(props) {
|
|
|
5275
5317
|
),
|
|
5276
5318
|
onKeyDown: (event) => {
|
|
5277
5319
|
if (!isOwnEvent(event)) return;
|
|
5278
|
-
handleCopyKey(event);
|
|
5279
5320
|
if (event.key === "Escape") {
|
|
5280
5321
|
if (drag.draggedColumnId !== null || resize.activeColumnId !== null)
|
|
5281
5322
|
return;
|
|
5282
|
-
|
|
5323
|
+
if (keyOrigin2(event.target) === "grid") {
|
|
5324
|
+
selection.clear();
|
|
5325
|
+
return;
|
|
5326
|
+
}
|
|
5327
|
+
const cell = nav.tabStopCell();
|
|
5328
|
+
if (event.target instanceof Node && cell?.contains(event.target)) {
|
|
5329
|
+
cell.focus();
|
|
5330
|
+
}
|
|
5283
5331
|
return;
|
|
5284
5332
|
}
|
|
5333
|
+
if (isControlKey(event)) return;
|
|
5334
|
+
handleCopyKey(event);
|
|
5285
5335
|
if ((event.ctrlKey || event.metaKey) && (event.key === "a" || event.key === "A")) {
|
|
5286
5336
|
if (selection.rowMode !== "multiple") return;
|
|
5287
5337
|
event.preventDefault();
|
|
@@ -5397,7 +5447,7 @@ function DataGrid(props) {
|
|
|
5397
5447
|
results: view.grandTotal,
|
|
5398
5448
|
rows: view.rows.map((entry) => entry.row),
|
|
5399
5449
|
locale,
|
|
5400
|
-
ariaRowIndex: view.
|
|
5450
|
+
ariaRowIndex: view.rowCount + 2
|
|
5401
5451
|
}
|
|
5402
5452
|
)
|
|
5403
5453
|
]
|
|
@@ -5432,7 +5482,7 @@ import { useCallback as useCallback5 } from "react";
|
|
|
5432
5482
|
import {
|
|
5433
5483
|
useCallback as useCallback4,
|
|
5434
5484
|
useEffect as useEffect9,
|
|
5435
|
-
useRef as
|
|
5485
|
+
useRef as useRef25,
|
|
5436
5486
|
useSyncExternalStore as useSyncExternalStore3
|
|
5437
5487
|
} from "react";
|
|
5438
5488
|
function subscribeTo(api, listener) {
|
|
@@ -5449,7 +5499,7 @@ function unsubscribe(subscription) {
|
|
|
5449
5499
|
}
|
|
5450
5500
|
}
|
|
5451
5501
|
function useGridSnapshot(gridRef, getSnapshot, fallback) {
|
|
5452
|
-
const subscription =
|
|
5502
|
+
const subscription = useRef25(null);
|
|
5453
5503
|
const subscribe = useCallback4(
|
|
5454
5504
|
(listener) => {
|
|
5455
5505
|
subscription.current = subscribeTo(gridRef.current, listener);
|