@gridkitjs/react 0.13.0 → 0.15.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/index.d.ts +1 -1
- package/dist/index.js +33 -10
- 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, ColumnSortState, FilterState, GroupByState, GroupExpansionState, AggregateResults, SelectionState, CellSelectionState, GridState, SerializedGridState, GridContextMenuTarget, GridCommandTarget, SelectedCell as SelectedCell$1, SelectedColumn as SelectedColumn$1 } from '@gridkitjs/core';
|
|
4
|
-
export { Borders, CellSelectionMode, CellSelectionState, CellTemplateContext, ColumnResizeEvent, ColumnSizeDefaults, ColumnSizingState, ColumnVisibilityEvent, ColumnVisibilityState, ContextMenuOpenChangeEvent, ExportFile, ExportOptions, ExportWriter, FilterChangeEvent, FilterEntry, FilterState, GridCommand, GridCommandEvent, GridCommandTarget, GridContextMenuOptions, GridContextMenuRequest, GridContextMenuTarget, GridExportOptions, GridMessages, GridOptions, GridState, GridToolbarOptions, GroupByBarVisibility, HoverableConfig, MenuEntry, PrintOptions, ResizeMode, ResolvedRow, RowPointerEvent, RowProps, RowSelectEvent, RowSelectionChangeEvent, RowsSelectEvent, SelectableConfig, SelectedCellRef, SelectionMode, SelectionState, SerializedGridState, ToolbarEntry, excelFilter, serializeGridState } from '@gridkitjs/core';
|
|
4
|
+
export { Borders, CellSelectionMode, CellSelectionState, CellTemplateContext, ColumnResizeEvent, ColumnSizeDefaults, ColumnSizingState, ColumnVisibilityEvent, ColumnVisibilityState, ContextMenuOpenChangeEvent, ExportFile, ExportOptions, ExportWriter, FilterChangeEvent, FilterEntry, FilterState, GridCommand, GridCommandEvent, GridCommandTarget, GridContextMenuOptions, GridContextMenuRequest, GridContextMenuTarget, GridExportOptions, GridMessages, GridOptions, GridState, GridToolbarOptions, GroupByBarVisibility, HoverableConfig, MenuEntry, PaginationUnit, PrintOptions, ResizeMode, ResolvedRow, RowPointerEvent, RowProps, RowSelectEvent, RowSelectionChangeEvent, RowsSelectEvent, SelectableConfig, SelectedCellRef, SelectionMode, SelectionState, SerializedGridState, 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
|
@@ -1110,9 +1110,10 @@ function GridFooter({
|
|
|
1110
1110
|
aggregates,
|
|
1111
1111
|
results,
|
|
1112
1112
|
rows,
|
|
1113
|
-
locale
|
|
1113
|
+
locale,
|
|
1114
|
+
ariaRowIndex
|
|
1114
1115
|
}) {
|
|
1115
|
-
return /* @__PURE__ */ jsx8("tfoot", { role: "rowgroup", children: /* @__PURE__ */ jsx8("tr", { className: "grid-footer", role: "row", children: columns.map((entry) => {
|
|
1116
|
+
return /* @__PURE__ */ jsx8("tfoot", { role: "rowgroup", children: /* @__PURE__ */ jsx8("tr", { className: "grid-footer", role: "row", "aria-rowindex": ariaRowIndex, children: columns.map((entry) => {
|
|
1116
1117
|
const specs = aggregates.filter(
|
|
1117
1118
|
(candidate) => candidate.columnId === entry.id
|
|
1118
1119
|
);
|
|
@@ -1157,8 +1158,10 @@ function PagerNavButton({
|
|
|
1157
1158
|
className: `grid-pager-button grid-pager-nav ${className}`,
|
|
1158
1159
|
"aria-label": label,
|
|
1159
1160
|
title: label,
|
|
1160
|
-
disabled,
|
|
1161
|
-
onClick
|
|
1161
|
+
...ariaAttr(disabled, "aria-disabled", true),
|
|
1162
|
+
onClick: () => {
|
|
1163
|
+
if (!disabled) onClick();
|
|
1164
|
+
},
|
|
1162
1165
|
children
|
|
1163
1166
|
}
|
|
1164
1167
|
);
|
|
@@ -3568,6 +3571,7 @@ import { useLayoutEffect as useLayoutEffect11, useRef as useRef15, useState as u
|
|
|
3568
3571
|
import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3569
3572
|
function ToolbarMenuButton({
|
|
3570
3573
|
itemKey,
|
|
3574
|
+
attributes,
|
|
3571
3575
|
label,
|
|
3572
3576
|
icon,
|
|
3573
3577
|
entries,
|
|
@@ -3596,6 +3600,7 @@ function ToolbarMenuButton({
|
|
|
3596
3600
|
/* @__PURE__ */ jsxs17(
|
|
3597
3601
|
"button",
|
|
3598
3602
|
{
|
|
3603
|
+
...attributes,
|
|
3599
3604
|
type: "button",
|
|
3600
3605
|
className: classNames("toolbar-button", more && "toolbar-more"),
|
|
3601
3606
|
"data-gridkit-toolbar-item": itemKey,
|
|
@@ -3660,6 +3665,7 @@ import { jsx as jsx24 } from "react/jsx-runtime";
|
|
|
3660
3665
|
var SEARCH_DELAY_MS = 250;
|
|
3661
3666
|
function ToolbarSearch({
|
|
3662
3667
|
itemKey,
|
|
3668
|
+
attributes,
|
|
3663
3669
|
controller,
|
|
3664
3670
|
messages,
|
|
3665
3671
|
announce
|
|
@@ -3697,6 +3703,7 @@ function ToolbarSearch({
|
|
|
3697
3703
|
return /* @__PURE__ */ jsx24(
|
|
3698
3704
|
"input",
|
|
3699
3705
|
{
|
|
3706
|
+
...attributes,
|
|
3700
3707
|
type: "search",
|
|
3701
3708
|
className: "toolbar-search",
|
|
3702
3709
|
"data-gridkit-toolbar-item": itemKey,
|
|
@@ -3814,12 +3821,21 @@ function GridToolbar(props) {
|
|
|
3814
3821
|
if (entries.length === 0) {
|
|
3815
3822
|
return null;
|
|
3816
3823
|
}
|
|
3817
|
-
const
|
|
3818
|
-
return /* @__PURE__ */ jsx25(
|
|
3824
|
+
const options = typeof props.toolbar === "object" ? props.toolbar : void 0;
|
|
3825
|
+
return /* @__PURE__ */ jsx25(
|
|
3826
|
+
Toolbar,
|
|
3827
|
+
{
|
|
3828
|
+
...props,
|
|
3829
|
+
entries,
|
|
3830
|
+
label: options?.label ?? props.messages.toolbarLabel,
|
|
3831
|
+
itemAttributes: options?.itemAttributes
|
|
3832
|
+
}
|
|
3833
|
+
);
|
|
3819
3834
|
}
|
|
3820
3835
|
function Toolbar({
|
|
3821
3836
|
entries,
|
|
3822
3837
|
label,
|
|
3838
|
+
itemAttributes,
|
|
3823
3839
|
renderItem,
|
|
3824
3840
|
gridId,
|
|
3825
3841
|
controller,
|
|
@@ -3831,7 +3847,8 @@ function Toolbar({
|
|
|
3831
3847
|
const menuClosed = useRef18(false);
|
|
3832
3848
|
const items = resolveToolbar(entries, {
|
|
3833
3849
|
commands: commands.commands,
|
|
3834
|
-
contextFor: commands.contextFor
|
|
3850
|
+
contextFor: commands.contextFor,
|
|
3851
|
+
itemAttributes
|
|
3835
3852
|
}).map(
|
|
3836
3853
|
(item) => reportingItem(item, (commandId, itemId) => {
|
|
3837
3854
|
commands.report(commandId, { area: "toolbar", itemId }, "toolbar");
|
|
@@ -3862,6 +3879,7 @@ function Toolbar({
|
|
|
3862
3879
|
return /* @__PURE__ */ jsxs18(
|
|
3863
3880
|
"button",
|
|
3864
3881
|
{
|
|
3882
|
+
...item.attributes,
|
|
3865
3883
|
type: "button",
|
|
3866
3884
|
className: "toolbar-button",
|
|
3867
3885
|
"data-gridkit-toolbar-item": item.key,
|
|
@@ -3891,6 +3909,7 @@ function Toolbar({
|
|
|
3891
3909
|
ToolbarMenuButton,
|
|
3892
3910
|
{
|
|
3893
3911
|
itemKey: item.key,
|
|
3912
|
+
attributes: item.attributes,
|
|
3894
3913
|
label: item.label,
|
|
3895
3914
|
icon: item.icon,
|
|
3896
3915
|
entries: item.items,
|
|
@@ -3903,6 +3922,7 @@ function Toolbar({
|
|
|
3903
3922
|
ToolbarSearch,
|
|
3904
3923
|
{
|
|
3905
3924
|
itemKey: item.key,
|
|
3925
|
+
attributes: item.attributes,
|
|
3906
3926
|
controller,
|
|
3907
3927
|
messages,
|
|
3908
3928
|
announce
|
|
@@ -3933,6 +3953,7 @@ function Toolbar({
|
|
|
3933
3953
|
return /* @__PURE__ */ jsx25(
|
|
3934
3954
|
"div",
|
|
3935
3955
|
{
|
|
3956
|
+
...item.attributes,
|
|
3936
3957
|
className: "toolbar-custom",
|
|
3937
3958
|
"data-gridkit-toolbar-item": item.key,
|
|
3938
3959
|
children: renderItem?.(item.id)
|
|
@@ -4586,6 +4607,7 @@ function DataGrid(props) {
|
|
|
4586
4607
|
selection.columnMode === false ? "" : "selectable-columns",
|
|
4587
4608
|
selection.cellMode === false ? "" : "selectable-cells"
|
|
4588
4609
|
);
|
|
4610
|
+
const hasFooter = aggregates.length > 0;
|
|
4589
4611
|
return /* @__PURE__ */ jsxs19("div", { className: "gridkit-data-grid-viewport", ref: viewportRef, children: [
|
|
4590
4612
|
/* @__PURE__ */ jsx26(
|
|
4591
4613
|
GridToolbar,
|
|
@@ -4619,7 +4641,7 @@ function DataGrid(props) {
|
|
|
4619
4641
|
id: gridId,
|
|
4620
4642
|
className: "gridkit-data-grid-tables",
|
|
4621
4643
|
role: state.groupBy.length > 0 ? "treegrid" : "grid",
|
|
4622
|
-
"aria-rowcount": view.displayRows.length + 1,
|
|
4644
|
+
"aria-rowcount": view.displayRows.length + (hasFooter ? 2 : 1),
|
|
4623
4645
|
"aria-colcount": view.columns.length,
|
|
4624
4646
|
...ariaAttr(multiselectable, "aria-multiselectable", true),
|
|
4625
4647
|
...ariaAttr(labelledBy !== void 0, "aria-labelledby", labelledBy),
|
|
@@ -4720,7 +4742,7 @@ function DataGrid(props) {
|
|
|
4720
4742
|
)
|
|
4721
4743
|
}
|
|
4722
4744
|
),
|
|
4723
|
-
|
|
4745
|
+
hasFooter && /* @__PURE__ */ jsxs19(
|
|
4724
4746
|
"table",
|
|
4725
4747
|
{
|
|
4726
4748
|
role: "presentation",
|
|
@@ -4738,7 +4760,8 @@ function DataGrid(props) {
|
|
|
4738
4760
|
aggregates,
|
|
4739
4761
|
results: view.grandTotal,
|
|
4740
4762
|
rows: view.rows.map((entry) => entry.row),
|
|
4741
|
-
locale
|
|
4763
|
+
locale,
|
|
4764
|
+
ariaRowIndex: view.displayRows.length + 2
|
|
4742
4765
|
}
|
|
4743
4766
|
)
|
|
4744
4767
|
]
|