@kanunilabs/datagrid-react 1.8.2 → 1.8.4
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.cjs +3 -3
- package/dist/index.d.cts +82 -10
- package/dist/index.d.ts +82 -10
- package/dist/index.js +3 -3
- package/dist/styles.css +155 -0
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, RefObject } from 'react';
|
|
3
|
-
import { GridRowData, DataGridController, GridDataType, RowKey, LookupItem, GridDictionary, StateStoringConfig, RowNode, GridColumnDef, DataGridCoreConfig, FilterRenderContextBase, FilterNode, InferColumnsOptions, GridThemeName, GridPaletteName, DescribeFilterOptions, GridDensity, CardViewOptions, EditMode, RowChange, RowStatusSource, ColumnRuntime, ColumnLayout, SortDescriptor, ColumnModel, RowSaveStatus, DataRowNode, ColSpanPlan, SummaryDef, ToolbarIconName, ColumnState, BusyPhase, VirtualWindow, ChartBoxSpec, ChartBoxModel, ChartSpec, ChartModel, ChartXYSpec, ChartXYModel, CellRange, RangeSelectionEngine, ColumnSelectMode, EditingEngine, ValidationRule, CrudHandlers, EditingPermissions, NewRowPosition, RowEditSession, LookupMatchMode } from '@kanunilabs/datagrid-core';
|
|
4
|
-
export { BusyChangedEvent, BusyPhase, ClientRowModel, ColumnLayout, ColumnLookup, ColumnModel, ColumnPin, ColumnRuntime, ColumnState, ColumnStateChangedEvent, ContentReadyEvent, CustomFilterOperator, CustomFilterOperatorId, DEFAULT_ROW_HEIGHT, DENSITY_ROW_HEIGHT, DataGridController, DataGridCoreConfig, DataRowNode, DataSource, FilterChangedEvent, FilterCondition, FilterGroupNode, FilterNode, FilterOperator, FocusedRowChangedEvent, GRID_COLOR_SCHEMES, GRID_PALETTES, GRID_THEMES, GridColorScheme, GridColumnDef, GridDataType, GridDensity, GridEventMap, GridPalette, GridPaletteName, GridRowData, GridStateStore, GridTheme, GridThemeName, GridViewState, GroupRowNode, GroupingConfig, HeaderBandCell, InferColumnsOptions, LoadOptions, LoadResult, LookupItem, NewRowPosition, RowDropPosition, RowKey, RowNode, SUMMARY_TYPE_LABEL, ScrollingConfig, SelectionDescriptor, SortChangedEvent, SortDescriptor, SortDirection, StateStoringConfig, SummaryDef, SummaryType, THEME_ROW_HEIGHT, ViewportChangedEvent, VirtualWindow, VirtualWindowEngine, allowedSummaryTypes, andFilters, attachStateStoring, bandDepth, bandPath, computeColumnLayout, computeHeaderBands, createRestDataSource, describeFilter, downloadBlob, fillText, filterInputFromNode, formatSummaryValue, humanizeField, importCsv, inferColumns, isDataRow, isDataSource, isFilterGroup, isGroupRow, isPackagedTheme, lookupLabel, moveRowInArray, parseCsv, parseFilterInput, sniffDelimiter, summaryKey, summaryLabel, summaryTypeLabels, themeClassName } from '@kanunilabs/datagrid-core';
|
|
3
|
+
import { GridRowData, DataGridController, GridDataType, RowKey, LookupItem, GridDictionary, StateStoringConfig, RowNode, GridColumnDef, DataGridCoreConfig, FilterRenderContextBase, FilterNode, InferColumnsOptions, GridThemeName, GridPaletteName, DescribeFilterOptions, GridDensity, ToolbarOptions, PortalContainer, CardViewOptions, EditMode, RowChange, RowStatusSource, ColumnRuntime, ColumnLayout, SortDescriptor, ColumnModel, RowSaveStatus, DataRowNode, ColSpanPlan, SummaryDef, RemoteDistinctList, PortalKind, ToolbarSearchOptions, ToolbarIconName, ColumnState, BusyPhase, VirtualWindow, ChartBoxSpec, ChartBoxModel, ChartSpec, ChartModel, ChartXYSpec, ChartXYModel, CellRange, RangeSelectionEngine, ColumnSelectMode, EditingEngine, ValidationRule, CrudHandlers, EditingPermissions, NewRowPosition, RowEditSession, LookupMatchMode } from '@kanunilabs/datagrid-core';
|
|
4
|
+
export { BusyChangedEvent, BusyPhase, ClientRowModel, ColumnLayout, ColumnLookup, ColumnModel, ColumnPin, ColumnRuntime, ColumnState, ColumnStateChangedEvent, ContentReadyEvent, CustomFilterOperator, CustomFilterOperatorId, DEFAULT_ROW_HEIGHT, DENSITY_ROW_HEIGHT, DataGridController, DataGridCoreConfig, DataRowNode, DataSource, FilterChangedEvent, FilterCondition, FilterGroupNode, FilterNode, FilterOperator, FocusedRowChangedEvent, GRID_COLOR_SCHEMES, GRID_PALETTES, GRID_THEMES, GridColorScheme, GridColumnDef, GridDataType, GridDensity, GridEventMap, GridPalette, GridPaletteName, GridRowData, GridStateStore, GridTheme, GridThemeName, GridViewState, GroupRowNode, GroupingConfig, HeaderBandCell, InferColumnsOptions, LoadOptions, LoadResult, LookupItem, NewRowPosition, PortalContainer, RowDropPosition, RowKey, RowNode, SUMMARY_TYPE_LABEL, ScrollingConfig, SelectionDescriptor, SortChangedEvent, SortDescriptor, SortDirection, StateStoringConfig, SummaryDef, SummaryType, THEME_ROW_HEIGHT, ToolbarOptions, ToolbarSearchOptions, ViewportChangedEvent, VirtualWindow, VirtualWindowEngine, allowedSummaryTypes, andFilters, attachStateStoring, bandDepth, bandPath, computeColumnLayout, computeHeaderBands, createRestDataSource, describeFilter, downloadBlob, fillText, filterInputFromNode, formatSummaryValue, humanizeField, importCsv, inferColumns, isDataRow, isDataSource, isFilterGroup, isGroupRow, isPackagedTheme, lookupLabel, moveRowInArray, parseCsv, parseFilterInput, sniffDelimiter, summaryKey, summaryLabel, summaryTypeLabels, themeClassName } from '@kanunilabs/datagrid-core';
|
|
5
5
|
|
|
6
6
|
/** Formats an export menu can offer. */
|
|
7
7
|
type ExportKind = 'csv' | 'excel' | 'excel-selected' | 'pdf';
|
|
@@ -649,7 +649,9 @@ interface DataGridProps<TRow = GridRowData> extends Omit<DataGridCoreConfig<TRow
|
|
|
649
649
|
* chevron is not rendered, because a control that opens nothing is worse than
|
|
650
650
|
* no control. `EnterpriseDataGrid` wires this to its own builder.
|
|
651
651
|
*/
|
|
652
|
-
onOpenFilterBuilder?: (
|
|
652
|
+
onOpenFilterBuilder?: (context?: {
|
|
653
|
+
columnId?: string;
|
|
654
|
+
}) => void;
|
|
653
655
|
/** Funnel button per header opening the distinct-value checklist popup. */
|
|
654
656
|
headerFilter?: boolean;
|
|
655
657
|
/**
|
|
@@ -744,8 +746,29 @@ interface DataGridProps<TRow = GridRowData> extends Omit<DataGridCoreConfig<TRow
|
|
|
744
746
|
* supports. `false` makes the footer read-only.
|
|
745
747
|
*/
|
|
746
748
|
footerMenu?: boolean;
|
|
747
|
-
/**
|
|
748
|
-
|
|
749
|
+
/**
|
|
750
|
+
* Toolbar with search, column chooser and export. `true` shows all of it;
|
|
751
|
+
* an object picks the parts and sets the search box up:
|
|
752
|
+
*
|
|
753
|
+
* toolbar={{ export: false, columns: false,
|
|
754
|
+
* search: { maxLength: 100, debounce: 300, validate } }}
|
|
755
|
+
*
|
|
756
|
+
* Your own buttons: `toolbarItemsBefore` (start) and `toolbarItemsAfter`
|
|
757
|
+
* (end), e.g. `<GridToolbarButton>`.
|
|
758
|
+
*/
|
|
759
|
+
toolbar?: boolean | ToolbarOptions;
|
|
760
|
+
/**
|
|
761
|
+
* Where the grid draws its popups (header filter, menus, date and lookup
|
|
762
|
+
* lists, dialogs): an element, or a function returning one. Default
|
|
763
|
+
* `document.body`.
|
|
764
|
+
*
|
|
765
|
+
* Set it when the grid sits in a modal (Radix Dialog and the like): the
|
|
766
|
+
* modal makes the rest of the page ignore the pointer, so a popup on <body>
|
|
767
|
+
* cannot be clicked. Pass the modal's content element (one without
|
|
768
|
+
* `overflow: hidden`). Popups stay in place even when the modal is moved
|
|
769
|
+
* with a CSS transform. Every popup carries `data-kanuni-portal`.
|
|
770
|
+
*/
|
|
771
|
+
portalContainer?: PortalContainer;
|
|
749
772
|
/**
|
|
750
773
|
* The toolbar's Columns button — the popup listing HIDDEN columns. Default
|
|
751
774
|
* true. The Enterprise wrapper turns it off when the side bar's Columns
|
|
@@ -1480,6 +1503,12 @@ interface GridHeaderFilterPopupProps {
|
|
|
1480
1503
|
*/
|
|
1481
1504
|
onApply: (filter: FilterNode | null) => void;
|
|
1482
1505
|
onClose: () => void;
|
|
1506
|
+
/**
|
|
1507
|
+
* Shows a "(Custom…)" entry above the list that opens the filter builder on
|
|
1508
|
+
* this column. Given only where a builder can be opened (the app's
|
|
1509
|
+
* `onOpenFilterBuilder`, or the Enterprise grid's own).
|
|
1510
|
+
*/
|
|
1511
|
+
onCustom?: () => void;
|
|
1483
1512
|
/**
|
|
1484
1513
|
* `entries` is only the first page of a longer list.
|
|
1485
1514
|
*
|
|
@@ -1496,9 +1525,16 @@ interface GridHeaderFilterPopupProps {
|
|
|
1496
1525
|
* matched nothing even though the value exists.
|
|
1497
1526
|
*/
|
|
1498
1527
|
onSearch?: (needle: string) => void;
|
|
1528
|
+
/**
|
|
1529
|
+
* A server-side list, loaded in pieces (see `RemoteDistinctList`). When set,
|
|
1530
|
+
* the popup draws THAT instead of `entries`: the scroll bar is as long as the
|
|
1531
|
+
* server's list, the search box searches on the server, and Select all /
|
|
1532
|
+
* Clear / ticks are the pager's ("everything except these").
|
|
1533
|
+
*/
|
|
1534
|
+
pager?: RemoteDistinctList;
|
|
1499
1535
|
labels?: Partial<Record<'search' | 'selectAll' | 'clear' | 'apply' | 'cancel' | 'blank' | 'noMatch' | 'loading' | 'truncated', string>>;
|
|
1500
1536
|
}
|
|
1501
|
-
declare function GridHeaderFilterPopup({ gridId, columnId, headerLabel, entries, initialSelected, anchor, loading, dark, onApply, onClose, truncated, onSearch, labels, }: GridHeaderFilterPopupProps): react.JSX.Element;
|
|
1537
|
+
declare function GridHeaderFilterPopup({ gridId, columnId, headerLabel, entries, initialSelected, anchor, loading, dark, onApply, onClose, onCustom, truncated, onSearch, pager, labels, }: GridHeaderFilterPopupProps): react.JSX.Element;
|
|
1502
1538
|
|
|
1503
1539
|
interface GridContextMenuProps<TContext> {
|
|
1504
1540
|
x: number;
|
|
@@ -1515,8 +1551,10 @@ declare function GridContextMenu<TContext>({ x, y, items, context, onClose, dark
|
|
|
1515
1551
|
interface GridPortalProps {
|
|
1516
1552
|
children: ReactNode;
|
|
1517
1553
|
dark?: boolean;
|
|
1554
|
+
/** `data-kanuni-portal`'s value: a `popup` (default) the user works in, or a `tooltip`. */
|
|
1555
|
+
kind?: PortalKind;
|
|
1518
1556
|
}
|
|
1519
|
-
declare function GridPortal({ children, dark }: GridPortalProps): react.ReactPortal | null;
|
|
1557
|
+
declare function GridPortal({ children, dark, kind }: GridPortalProps): react.ReactPortal | null;
|
|
1520
1558
|
|
|
1521
1559
|
interface GridGroupPanelProps<TRow = GridRowData> {
|
|
1522
1560
|
/** Columns offered for grouping (groupable and visible). */
|
|
@@ -1630,9 +1668,16 @@ interface GridToolbarProps<TRow = GridRowData> {
|
|
|
1630
1668
|
itemsAfter?: React.ReactNode;
|
|
1631
1669
|
/** Milliseconds to wait after the last keystroke. Default 200. */
|
|
1632
1670
|
searchDebounce?: number;
|
|
1671
|
+
/**
|
|
1672
|
+
* The search box's settings (`toolbar={{ search: {...} }}`): placeholder,
|
|
1673
|
+
* maxLength, debounce (wins over `searchDebounce`), applyOnBlur, validate.
|
|
1674
|
+
*/
|
|
1675
|
+
searchOptions?: ToolbarSearchOptions;
|
|
1676
|
+
/** The export menu. Default true; false leaves it out whatever the formats. */
|
|
1677
|
+
exportMenu?: boolean;
|
|
1633
1678
|
labels?: Partial<Record<'search' | 'csv' | 'excel' | 'excelSelected' | 'pdf' | 'columns' | 'exporting' | 'exportMenu', string>>;
|
|
1634
1679
|
}
|
|
1635
|
-
declare function GridToolbarImpl<TRow = GridRowData>({ controller, search, exportCsv, exportExcel, exportPdf, columnChooser, dark, onOpenColumnChooser, itemsBefore, itemsAfter, searchDebounce, labels, }: GridToolbarProps<TRow>): react.JSX.Element;
|
|
1680
|
+
declare function GridToolbarImpl<TRow = GridRowData>({ controller, search, exportCsv, exportExcel, exportPdf, columnChooser, dark, onOpenColumnChooser, itemsBefore, itemsAfter, searchDebounce, searchOptions, exportMenu, labels, }: GridToolbarProps<TRow>): react.JSX.Element;
|
|
1636
1681
|
declare const GridToolbar: typeof GridToolbarImpl;
|
|
1637
1682
|
|
|
1638
1683
|
/** A command button's icon — the shared paths of `toolbarIcons.ts` (see there for why). */
|
|
@@ -1641,6 +1686,26 @@ declare function ToolbarIcon({ name, size }: {
|
|
|
1641
1686
|
size?: number;
|
|
1642
1687
|
}): react.JSX.Element;
|
|
1643
1688
|
|
|
1689
|
+
interface GridToolbarButtonProps {
|
|
1690
|
+
/** The glyph, e.g. an inline SVG or `<ToolbarIcon name="columns" />`. */
|
|
1691
|
+
icon: ReactNode;
|
|
1692
|
+
/** The button's name: its accessible name and the start of its tooltip. */
|
|
1693
|
+
label: string;
|
|
1694
|
+
/** Keyboard shortcut shown in the tooltip ("Export (Ctrl+E)") and as `aria-keyshortcuts`. */
|
|
1695
|
+
shortcut?: string;
|
|
1696
|
+
/**
|
|
1697
|
+
* Set while the button cannot be used: it reads as unavailable, ignores
|
|
1698
|
+
* clicks, and the tooltip and screen reader give this reason.
|
|
1699
|
+
*/
|
|
1700
|
+
disabledReason?: string;
|
|
1701
|
+
/** Show the label beside the icon. Default false (icon only). */
|
|
1702
|
+
showLabel?: boolean;
|
|
1703
|
+
onClick?: () => void;
|
|
1704
|
+
/** `data-testid` on the button. */
|
|
1705
|
+
testId?: string;
|
|
1706
|
+
}
|
|
1707
|
+
declare function GridToolbarButton({ icon, label, shortcut, disabledReason, showLabel, onClick, testId, }: GridToolbarButtonProps): react.JSX.Element;
|
|
1708
|
+
|
|
1644
1709
|
interface GridColumnChooserProps<TRow = GridRowData> {
|
|
1645
1710
|
controller: DataGridController<TRow>;
|
|
1646
1711
|
/** Passed in so the panel re-renders when visibility changes. */
|
|
@@ -2012,9 +2077,16 @@ interface GridSurfaceProviderProps {
|
|
|
2012
2077
|
theme?: GridThemeName;
|
|
2013
2078
|
density?: GridDensity;
|
|
2014
2079
|
palette?: GridPaletteName;
|
|
2080
|
+
/** Where popups are drawn (the grid's `portalContainer`). Default <body>. */
|
|
2081
|
+
portalContainer?: PortalContainer;
|
|
2015
2082
|
children: ReactNode;
|
|
2016
2083
|
}
|
|
2017
|
-
declare function GridSurfaceProvider({ theme, density, palette, children, }: GridSurfaceProviderProps): react.JSX.Element;
|
|
2084
|
+
declare function GridSurfaceProvider({ theme, density, palette, portalContainer, children, }: GridSurfaceProviderProps): react.JSX.Element;
|
|
2085
|
+
/**
|
|
2086
|
+
* The element a popup is portalled into, read when the popup opens: <body>,
|
|
2087
|
+
* or the host inside the grid's `portalContainer` (core `portalTarget`).
|
|
2088
|
+
*/
|
|
2089
|
+
declare function useGridPortalTarget(): () => HTMLElement;
|
|
2018
2090
|
/**
|
|
2019
2091
|
* The theme + density modifier classes for a surface rendered outside the grid.
|
|
2020
2092
|
* `''` when the grid is unthemed, so appending it is always safe.
|
|
@@ -2446,4 +2518,4 @@ interface GridDialogProps {
|
|
|
2446
2518
|
}
|
|
2447
2519
|
declare function GridDialog({ open, title, message, cancelLabel, confirmLabel, danger, dark, onConfirm, onCancel, }: GridDialogProps): react.ReactPortal | null;
|
|
2448
2520
|
|
|
2449
|
-
export { type AlignedGridsApi, BAND_ROW_HEIGHT, type BatchSaveError, type CellMenuOptions, type CellRenderContext, type CellSlotContext, type CellTooltipOptions, DEFAULT_EDIT_FORM_LABELS, DEFAULT_HEADER_MENU_LABELS, DataGrid, type DataGridProps, type DistinctEntry, type EditFormField, type EditFormLabels, type EditModes, type EditorRenderContext, type ExportOutcome, type FilterRenderContext, GridCellEditor, type GridCellEditorProps, GridColumnChooser, type GridColumnChooserProps, GridContextMenu, type GridContextMenuProps, GridDateEditor, type GridDateEditorProps, GridDialog, type GridDialogProps, GridEditForm, type GridEditFormProps, GridFilterPanel, type GridFilterPanelProps, GridFilterRow, type GridFilterRowProps, GridFooterRow, type GridFooterRowProps, GridGroupPanel, type GridGroupPanelProps, GridHeader, GridHeaderBands, type GridHeaderBandsProps, GridHeaderFilterPopup, type GridHeaderFilterPopupProps, type GridHeaderProps, GridLoadingOverlay, type GridLoadingOverlayProps, GridLookupEditor, type GridLookupEditorProps, type GridMenuItem, GridNoteEditor, type GridNotesConfig, GridPager, type GridPagerProps, GridPinnedRows, type GridPinnedRowsProps, GridPopupPanel, type GridPopupPanelProps, GridPortal, type GridPortalProps, GridRow, GridRowEditor, type GridRowEditorProps, type GridRowProps, GridSummaryBar, type GridSummaryBarProps, GridSurfaceProvider, type GridSurfaceProviderProps, GridTextProvider, type GridTextProviderProps, GridToolbar, type GridToolbarProps, GridTooltip, type GridTooltipConfig, type GridTooltipProps, type HeaderMenuContext, type HeaderMenuDeps, type HeaderMenuLabels, type HeaderRenderContext, type NoteCellContext, PRINT_MAX_ROWS, type PendingDelete, type PrintLayoutOptions, type PrintLayoutState, ROW_DRAG_MIME, type RangeApi, type ReactColumnRuntime, type ReactGridColumnDef, type RowDragConfig, type RowDragHandlers, type RowDragPayload, type RowDropEvent, type RowLookupMap, type RowMenuContext, type RowReorderEvent, type RowTemplateContext, SHORTCUT_COPY, SHORTCUT_CUT, SHORTCUT_PASTE, type SelectionStats, ToolbarIcon, type TooltipState, type UseDataGridOptions, type UseDataGridResult, type UseEditModesOptions, type UseGridEditingOptions, type UseGridEditingResult, buildCellMenuItems, buildHeaderMenu, copyToClipboard, editFormColumnIds, editFormLabels, headerMenuLabels, matchOptions, measureBestFitWidth, reconcileFilterInputs, runGridExport, useAlignedGrids, useAnchoredPopup, useCellTooltip, useDataGrid, useEditModes, useGridChartBoxData, useGridChartData, useGridChartXYData, useGridEditing, useGridSurfaceClass, useGridText, usePrintLayout, useRowDrag, useStateStoring, writeClipboardText };
|
|
2521
|
+
export { type AlignedGridsApi, BAND_ROW_HEIGHT, type BatchSaveError, type CellMenuOptions, type CellRenderContext, type CellSlotContext, type CellTooltipOptions, DEFAULT_EDIT_FORM_LABELS, DEFAULT_HEADER_MENU_LABELS, DataGrid, type DataGridProps, type DistinctEntry, type EditFormField, type EditFormLabels, type EditModes, type EditorRenderContext, type ExportOutcome, type FilterRenderContext, GridCellEditor, type GridCellEditorProps, GridColumnChooser, type GridColumnChooserProps, GridContextMenu, type GridContextMenuProps, GridDateEditor, type GridDateEditorProps, GridDialog, type GridDialogProps, GridEditForm, type GridEditFormProps, GridFilterPanel, type GridFilterPanelProps, GridFilterRow, type GridFilterRowProps, GridFooterRow, type GridFooterRowProps, GridGroupPanel, type GridGroupPanelProps, GridHeader, GridHeaderBands, type GridHeaderBandsProps, GridHeaderFilterPopup, type GridHeaderFilterPopupProps, type GridHeaderProps, GridLoadingOverlay, type GridLoadingOverlayProps, GridLookupEditor, type GridLookupEditorProps, type GridMenuItem, GridNoteEditor, type GridNotesConfig, GridPager, type GridPagerProps, GridPinnedRows, type GridPinnedRowsProps, GridPopupPanel, type GridPopupPanelProps, GridPortal, type GridPortalProps, GridRow, GridRowEditor, type GridRowEditorProps, type GridRowProps, GridSummaryBar, type GridSummaryBarProps, GridSurfaceProvider, type GridSurfaceProviderProps, GridTextProvider, type GridTextProviderProps, GridToolbar, GridToolbarButton, type GridToolbarButtonProps, type GridToolbarProps, GridTooltip, type GridTooltipConfig, type GridTooltipProps, type HeaderMenuContext, type HeaderMenuDeps, type HeaderMenuLabels, type HeaderRenderContext, type NoteCellContext, PRINT_MAX_ROWS, type PendingDelete, type PrintLayoutOptions, type PrintLayoutState, ROW_DRAG_MIME, type RangeApi, type ReactColumnRuntime, type ReactGridColumnDef, type RowDragConfig, type RowDragHandlers, type RowDragPayload, type RowDropEvent, type RowLookupMap, type RowMenuContext, type RowReorderEvent, type RowTemplateContext, SHORTCUT_COPY, SHORTCUT_CUT, SHORTCUT_PASTE, type SelectionStats, ToolbarIcon, type TooltipState, type UseDataGridOptions, type UseDataGridResult, type UseEditModesOptions, type UseGridEditingOptions, type UseGridEditingResult, buildCellMenuItems, buildHeaderMenu, copyToClipboard, editFormColumnIds, editFormLabels, headerMenuLabels, matchOptions, measureBestFitWidth, reconcileFilterInputs, runGridExport, useAlignedGrids, useAnchoredPopup, useCellTooltip, useDataGrid, useEditModes, useGridChartBoxData, useGridChartData, useGridChartXYData, useGridEditing, useGridPortalTarget, useGridSurfaceClass, useGridText, usePrintLayout, useRowDrag, useStateStoring, writeClipboardText };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, RefObject } from 'react';
|
|
3
|
-
import { GridRowData, DataGridController, GridDataType, RowKey, LookupItem, GridDictionary, StateStoringConfig, RowNode, GridColumnDef, DataGridCoreConfig, FilterRenderContextBase, FilterNode, InferColumnsOptions, GridThemeName, GridPaletteName, DescribeFilterOptions, GridDensity, CardViewOptions, EditMode, RowChange, RowStatusSource, ColumnRuntime, ColumnLayout, SortDescriptor, ColumnModel, RowSaveStatus, DataRowNode, ColSpanPlan, SummaryDef, ToolbarIconName, ColumnState, BusyPhase, VirtualWindow, ChartBoxSpec, ChartBoxModel, ChartSpec, ChartModel, ChartXYSpec, ChartXYModel, CellRange, RangeSelectionEngine, ColumnSelectMode, EditingEngine, ValidationRule, CrudHandlers, EditingPermissions, NewRowPosition, RowEditSession, LookupMatchMode } from '@kanunilabs/datagrid-core';
|
|
4
|
-
export { BusyChangedEvent, BusyPhase, ClientRowModel, ColumnLayout, ColumnLookup, ColumnModel, ColumnPin, ColumnRuntime, ColumnState, ColumnStateChangedEvent, ContentReadyEvent, CustomFilterOperator, CustomFilterOperatorId, DEFAULT_ROW_HEIGHT, DENSITY_ROW_HEIGHT, DataGridController, DataGridCoreConfig, DataRowNode, DataSource, FilterChangedEvent, FilterCondition, FilterGroupNode, FilterNode, FilterOperator, FocusedRowChangedEvent, GRID_COLOR_SCHEMES, GRID_PALETTES, GRID_THEMES, GridColorScheme, GridColumnDef, GridDataType, GridDensity, GridEventMap, GridPalette, GridPaletteName, GridRowData, GridStateStore, GridTheme, GridThemeName, GridViewState, GroupRowNode, GroupingConfig, HeaderBandCell, InferColumnsOptions, LoadOptions, LoadResult, LookupItem, NewRowPosition, RowDropPosition, RowKey, RowNode, SUMMARY_TYPE_LABEL, ScrollingConfig, SelectionDescriptor, SortChangedEvent, SortDescriptor, SortDirection, StateStoringConfig, SummaryDef, SummaryType, THEME_ROW_HEIGHT, ViewportChangedEvent, VirtualWindow, VirtualWindowEngine, allowedSummaryTypes, andFilters, attachStateStoring, bandDepth, bandPath, computeColumnLayout, computeHeaderBands, createRestDataSource, describeFilter, downloadBlob, fillText, filterInputFromNode, formatSummaryValue, humanizeField, importCsv, inferColumns, isDataRow, isDataSource, isFilterGroup, isGroupRow, isPackagedTheme, lookupLabel, moveRowInArray, parseCsv, parseFilterInput, sniffDelimiter, summaryKey, summaryLabel, summaryTypeLabels, themeClassName } from '@kanunilabs/datagrid-core';
|
|
3
|
+
import { GridRowData, DataGridController, GridDataType, RowKey, LookupItem, GridDictionary, StateStoringConfig, RowNode, GridColumnDef, DataGridCoreConfig, FilterRenderContextBase, FilterNode, InferColumnsOptions, GridThemeName, GridPaletteName, DescribeFilterOptions, GridDensity, ToolbarOptions, PortalContainer, CardViewOptions, EditMode, RowChange, RowStatusSource, ColumnRuntime, ColumnLayout, SortDescriptor, ColumnModel, RowSaveStatus, DataRowNode, ColSpanPlan, SummaryDef, RemoteDistinctList, PortalKind, ToolbarSearchOptions, ToolbarIconName, ColumnState, BusyPhase, VirtualWindow, ChartBoxSpec, ChartBoxModel, ChartSpec, ChartModel, ChartXYSpec, ChartXYModel, CellRange, RangeSelectionEngine, ColumnSelectMode, EditingEngine, ValidationRule, CrudHandlers, EditingPermissions, NewRowPosition, RowEditSession, LookupMatchMode } from '@kanunilabs/datagrid-core';
|
|
4
|
+
export { BusyChangedEvent, BusyPhase, ClientRowModel, ColumnLayout, ColumnLookup, ColumnModel, ColumnPin, ColumnRuntime, ColumnState, ColumnStateChangedEvent, ContentReadyEvent, CustomFilterOperator, CustomFilterOperatorId, DEFAULT_ROW_HEIGHT, DENSITY_ROW_HEIGHT, DataGridController, DataGridCoreConfig, DataRowNode, DataSource, FilterChangedEvent, FilterCondition, FilterGroupNode, FilterNode, FilterOperator, FocusedRowChangedEvent, GRID_COLOR_SCHEMES, GRID_PALETTES, GRID_THEMES, GridColorScheme, GridColumnDef, GridDataType, GridDensity, GridEventMap, GridPalette, GridPaletteName, GridRowData, GridStateStore, GridTheme, GridThemeName, GridViewState, GroupRowNode, GroupingConfig, HeaderBandCell, InferColumnsOptions, LoadOptions, LoadResult, LookupItem, NewRowPosition, PortalContainer, RowDropPosition, RowKey, RowNode, SUMMARY_TYPE_LABEL, ScrollingConfig, SelectionDescriptor, SortChangedEvent, SortDescriptor, SortDirection, StateStoringConfig, SummaryDef, SummaryType, THEME_ROW_HEIGHT, ToolbarOptions, ToolbarSearchOptions, ViewportChangedEvent, VirtualWindow, VirtualWindowEngine, allowedSummaryTypes, andFilters, attachStateStoring, bandDepth, bandPath, computeColumnLayout, computeHeaderBands, createRestDataSource, describeFilter, downloadBlob, fillText, filterInputFromNode, formatSummaryValue, humanizeField, importCsv, inferColumns, isDataRow, isDataSource, isFilterGroup, isGroupRow, isPackagedTheme, lookupLabel, moveRowInArray, parseCsv, parseFilterInput, sniffDelimiter, summaryKey, summaryLabel, summaryTypeLabels, themeClassName } from '@kanunilabs/datagrid-core';
|
|
5
5
|
|
|
6
6
|
/** Formats an export menu can offer. */
|
|
7
7
|
type ExportKind = 'csv' | 'excel' | 'excel-selected' | 'pdf';
|
|
@@ -649,7 +649,9 @@ interface DataGridProps<TRow = GridRowData> extends Omit<DataGridCoreConfig<TRow
|
|
|
649
649
|
* chevron is not rendered, because a control that opens nothing is worse than
|
|
650
650
|
* no control. `EnterpriseDataGrid` wires this to its own builder.
|
|
651
651
|
*/
|
|
652
|
-
onOpenFilterBuilder?: (
|
|
652
|
+
onOpenFilterBuilder?: (context?: {
|
|
653
|
+
columnId?: string;
|
|
654
|
+
}) => void;
|
|
653
655
|
/** Funnel button per header opening the distinct-value checklist popup. */
|
|
654
656
|
headerFilter?: boolean;
|
|
655
657
|
/**
|
|
@@ -744,8 +746,29 @@ interface DataGridProps<TRow = GridRowData> extends Omit<DataGridCoreConfig<TRow
|
|
|
744
746
|
* supports. `false` makes the footer read-only.
|
|
745
747
|
*/
|
|
746
748
|
footerMenu?: boolean;
|
|
747
|
-
/**
|
|
748
|
-
|
|
749
|
+
/**
|
|
750
|
+
* Toolbar with search, column chooser and export. `true` shows all of it;
|
|
751
|
+
* an object picks the parts and sets the search box up:
|
|
752
|
+
*
|
|
753
|
+
* toolbar={{ export: false, columns: false,
|
|
754
|
+
* search: { maxLength: 100, debounce: 300, validate } }}
|
|
755
|
+
*
|
|
756
|
+
* Your own buttons: `toolbarItemsBefore` (start) and `toolbarItemsAfter`
|
|
757
|
+
* (end), e.g. `<GridToolbarButton>`.
|
|
758
|
+
*/
|
|
759
|
+
toolbar?: boolean | ToolbarOptions;
|
|
760
|
+
/**
|
|
761
|
+
* Where the grid draws its popups (header filter, menus, date and lookup
|
|
762
|
+
* lists, dialogs): an element, or a function returning one. Default
|
|
763
|
+
* `document.body`.
|
|
764
|
+
*
|
|
765
|
+
* Set it when the grid sits in a modal (Radix Dialog and the like): the
|
|
766
|
+
* modal makes the rest of the page ignore the pointer, so a popup on <body>
|
|
767
|
+
* cannot be clicked. Pass the modal's content element (one without
|
|
768
|
+
* `overflow: hidden`). Popups stay in place even when the modal is moved
|
|
769
|
+
* with a CSS transform. Every popup carries `data-kanuni-portal`.
|
|
770
|
+
*/
|
|
771
|
+
portalContainer?: PortalContainer;
|
|
749
772
|
/**
|
|
750
773
|
* The toolbar's Columns button — the popup listing HIDDEN columns. Default
|
|
751
774
|
* true. The Enterprise wrapper turns it off when the side bar's Columns
|
|
@@ -1480,6 +1503,12 @@ interface GridHeaderFilterPopupProps {
|
|
|
1480
1503
|
*/
|
|
1481
1504
|
onApply: (filter: FilterNode | null) => void;
|
|
1482
1505
|
onClose: () => void;
|
|
1506
|
+
/**
|
|
1507
|
+
* Shows a "(Custom…)" entry above the list that opens the filter builder on
|
|
1508
|
+
* this column. Given only where a builder can be opened (the app's
|
|
1509
|
+
* `onOpenFilterBuilder`, or the Enterprise grid's own).
|
|
1510
|
+
*/
|
|
1511
|
+
onCustom?: () => void;
|
|
1483
1512
|
/**
|
|
1484
1513
|
* `entries` is only the first page of a longer list.
|
|
1485
1514
|
*
|
|
@@ -1496,9 +1525,16 @@ interface GridHeaderFilterPopupProps {
|
|
|
1496
1525
|
* matched nothing even though the value exists.
|
|
1497
1526
|
*/
|
|
1498
1527
|
onSearch?: (needle: string) => void;
|
|
1528
|
+
/**
|
|
1529
|
+
* A server-side list, loaded in pieces (see `RemoteDistinctList`). When set,
|
|
1530
|
+
* the popup draws THAT instead of `entries`: the scroll bar is as long as the
|
|
1531
|
+
* server's list, the search box searches on the server, and Select all /
|
|
1532
|
+
* Clear / ticks are the pager's ("everything except these").
|
|
1533
|
+
*/
|
|
1534
|
+
pager?: RemoteDistinctList;
|
|
1499
1535
|
labels?: Partial<Record<'search' | 'selectAll' | 'clear' | 'apply' | 'cancel' | 'blank' | 'noMatch' | 'loading' | 'truncated', string>>;
|
|
1500
1536
|
}
|
|
1501
|
-
declare function GridHeaderFilterPopup({ gridId, columnId, headerLabel, entries, initialSelected, anchor, loading, dark, onApply, onClose, truncated, onSearch, labels, }: GridHeaderFilterPopupProps): react.JSX.Element;
|
|
1537
|
+
declare function GridHeaderFilterPopup({ gridId, columnId, headerLabel, entries, initialSelected, anchor, loading, dark, onApply, onClose, onCustom, truncated, onSearch, pager, labels, }: GridHeaderFilterPopupProps): react.JSX.Element;
|
|
1502
1538
|
|
|
1503
1539
|
interface GridContextMenuProps<TContext> {
|
|
1504
1540
|
x: number;
|
|
@@ -1515,8 +1551,10 @@ declare function GridContextMenu<TContext>({ x, y, items, context, onClose, dark
|
|
|
1515
1551
|
interface GridPortalProps {
|
|
1516
1552
|
children: ReactNode;
|
|
1517
1553
|
dark?: boolean;
|
|
1554
|
+
/** `data-kanuni-portal`'s value: a `popup` (default) the user works in, or a `tooltip`. */
|
|
1555
|
+
kind?: PortalKind;
|
|
1518
1556
|
}
|
|
1519
|
-
declare function GridPortal({ children, dark }: GridPortalProps): react.ReactPortal | null;
|
|
1557
|
+
declare function GridPortal({ children, dark, kind }: GridPortalProps): react.ReactPortal | null;
|
|
1520
1558
|
|
|
1521
1559
|
interface GridGroupPanelProps<TRow = GridRowData> {
|
|
1522
1560
|
/** Columns offered for grouping (groupable and visible). */
|
|
@@ -1630,9 +1668,16 @@ interface GridToolbarProps<TRow = GridRowData> {
|
|
|
1630
1668
|
itemsAfter?: React.ReactNode;
|
|
1631
1669
|
/** Milliseconds to wait after the last keystroke. Default 200. */
|
|
1632
1670
|
searchDebounce?: number;
|
|
1671
|
+
/**
|
|
1672
|
+
* The search box's settings (`toolbar={{ search: {...} }}`): placeholder,
|
|
1673
|
+
* maxLength, debounce (wins over `searchDebounce`), applyOnBlur, validate.
|
|
1674
|
+
*/
|
|
1675
|
+
searchOptions?: ToolbarSearchOptions;
|
|
1676
|
+
/** The export menu. Default true; false leaves it out whatever the formats. */
|
|
1677
|
+
exportMenu?: boolean;
|
|
1633
1678
|
labels?: Partial<Record<'search' | 'csv' | 'excel' | 'excelSelected' | 'pdf' | 'columns' | 'exporting' | 'exportMenu', string>>;
|
|
1634
1679
|
}
|
|
1635
|
-
declare function GridToolbarImpl<TRow = GridRowData>({ controller, search, exportCsv, exportExcel, exportPdf, columnChooser, dark, onOpenColumnChooser, itemsBefore, itemsAfter, searchDebounce, labels, }: GridToolbarProps<TRow>): react.JSX.Element;
|
|
1680
|
+
declare function GridToolbarImpl<TRow = GridRowData>({ controller, search, exportCsv, exportExcel, exportPdf, columnChooser, dark, onOpenColumnChooser, itemsBefore, itemsAfter, searchDebounce, searchOptions, exportMenu, labels, }: GridToolbarProps<TRow>): react.JSX.Element;
|
|
1636
1681
|
declare const GridToolbar: typeof GridToolbarImpl;
|
|
1637
1682
|
|
|
1638
1683
|
/** A command button's icon — the shared paths of `toolbarIcons.ts` (see there for why). */
|
|
@@ -1641,6 +1686,26 @@ declare function ToolbarIcon({ name, size }: {
|
|
|
1641
1686
|
size?: number;
|
|
1642
1687
|
}): react.JSX.Element;
|
|
1643
1688
|
|
|
1689
|
+
interface GridToolbarButtonProps {
|
|
1690
|
+
/** The glyph, e.g. an inline SVG or `<ToolbarIcon name="columns" />`. */
|
|
1691
|
+
icon: ReactNode;
|
|
1692
|
+
/** The button's name: its accessible name and the start of its tooltip. */
|
|
1693
|
+
label: string;
|
|
1694
|
+
/** Keyboard shortcut shown in the tooltip ("Export (Ctrl+E)") and as `aria-keyshortcuts`. */
|
|
1695
|
+
shortcut?: string;
|
|
1696
|
+
/**
|
|
1697
|
+
* Set while the button cannot be used: it reads as unavailable, ignores
|
|
1698
|
+
* clicks, and the tooltip and screen reader give this reason.
|
|
1699
|
+
*/
|
|
1700
|
+
disabledReason?: string;
|
|
1701
|
+
/** Show the label beside the icon. Default false (icon only). */
|
|
1702
|
+
showLabel?: boolean;
|
|
1703
|
+
onClick?: () => void;
|
|
1704
|
+
/** `data-testid` on the button. */
|
|
1705
|
+
testId?: string;
|
|
1706
|
+
}
|
|
1707
|
+
declare function GridToolbarButton({ icon, label, shortcut, disabledReason, showLabel, onClick, testId, }: GridToolbarButtonProps): react.JSX.Element;
|
|
1708
|
+
|
|
1644
1709
|
interface GridColumnChooserProps<TRow = GridRowData> {
|
|
1645
1710
|
controller: DataGridController<TRow>;
|
|
1646
1711
|
/** Passed in so the panel re-renders when visibility changes. */
|
|
@@ -2012,9 +2077,16 @@ interface GridSurfaceProviderProps {
|
|
|
2012
2077
|
theme?: GridThemeName;
|
|
2013
2078
|
density?: GridDensity;
|
|
2014
2079
|
palette?: GridPaletteName;
|
|
2080
|
+
/** Where popups are drawn (the grid's `portalContainer`). Default <body>. */
|
|
2081
|
+
portalContainer?: PortalContainer;
|
|
2015
2082
|
children: ReactNode;
|
|
2016
2083
|
}
|
|
2017
|
-
declare function GridSurfaceProvider({ theme, density, palette, children, }: GridSurfaceProviderProps): react.JSX.Element;
|
|
2084
|
+
declare function GridSurfaceProvider({ theme, density, palette, portalContainer, children, }: GridSurfaceProviderProps): react.JSX.Element;
|
|
2085
|
+
/**
|
|
2086
|
+
* The element a popup is portalled into, read when the popup opens: <body>,
|
|
2087
|
+
* or the host inside the grid's `portalContainer` (core `portalTarget`).
|
|
2088
|
+
*/
|
|
2089
|
+
declare function useGridPortalTarget(): () => HTMLElement;
|
|
2018
2090
|
/**
|
|
2019
2091
|
* The theme + density modifier classes for a surface rendered outside the grid.
|
|
2020
2092
|
* `''` when the grid is unthemed, so appending it is always safe.
|
|
@@ -2446,4 +2518,4 @@ interface GridDialogProps {
|
|
|
2446
2518
|
}
|
|
2447
2519
|
declare function GridDialog({ open, title, message, cancelLabel, confirmLabel, danger, dark, onConfirm, onCancel, }: GridDialogProps): react.ReactPortal | null;
|
|
2448
2520
|
|
|
2449
|
-
export { type AlignedGridsApi, BAND_ROW_HEIGHT, type BatchSaveError, type CellMenuOptions, type CellRenderContext, type CellSlotContext, type CellTooltipOptions, DEFAULT_EDIT_FORM_LABELS, DEFAULT_HEADER_MENU_LABELS, DataGrid, type DataGridProps, type DistinctEntry, type EditFormField, type EditFormLabels, type EditModes, type EditorRenderContext, type ExportOutcome, type FilterRenderContext, GridCellEditor, type GridCellEditorProps, GridColumnChooser, type GridColumnChooserProps, GridContextMenu, type GridContextMenuProps, GridDateEditor, type GridDateEditorProps, GridDialog, type GridDialogProps, GridEditForm, type GridEditFormProps, GridFilterPanel, type GridFilterPanelProps, GridFilterRow, type GridFilterRowProps, GridFooterRow, type GridFooterRowProps, GridGroupPanel, type GridGroupPanelProps, GridHeader, GridHeaderBands, type GridHeaderBandsProps, GridHeaderFilterPopup, type GridHeaderFilterPopupProps, type GridHeaderProps, GridLoadingOverlay, type GridLoadingOverlayProps, GridLookupEditor, type GridLookupEditorProps, type GridMenuItem, GridNoteEditor, type GridNotesConfig, GridPager, type GridPagerProps, GridPinnedRows, type GridPinnedRowsProps, GridPopupPanel, type GridPopupPanelProps, GridPortal, type GridPortalProps, GridRow, GridRowEditor, type GridRowEditorProps, type GridRowProps, GridSummaryBar, type GridSummaryBarProps, GridSurfaceProvider, type GridSurfaceProviderProps, GridTextProvider, type GridTextProviderProps, GridToolbar, type GridToolbarProps, GridTooltip, type GridTooltipConfig, type GridTooltipProps, type HeaderMenuContext, type HeaderMenuDeps, type HeaderMenuLabels, type HeaderRenderContext, type NoteCellContext, PRINT_MAX_ROWS, type PendingDelete, type PrintLayoutOptions, type PrintLayoutState, ROW_DRAG_MIME, type RangeApi, type ReactColumnRuntime, type ReactGridColumnDef, type RowDragConfig, type RowDragHandlers, type RowDragPayload, type RowDropEvent, type RowLookupMap, type RowMenuContext, type RowReorderEvent, type RowTemplateContext, SHORTCUT_COPY, SHORTCUT_CUT, SHORTCUT_PASTE, type SelectionStats, ToolbarIcon, type TooltipState, type UseDataGridOptions, type UseDataGridResult, type UseEditModesOptions, type UseGridEditingOptions, type UseGridEditingResult, buildCellMenuItems, buildHeaderMenu, copyToClipboard, editFormColumnIds, editFormLabels, headerMenuLabels, matchOptions, measureBestFitWidth, reconcileFilterInputs, runGridExport, useAlignedGrids, useAnchoredPopup, useCellTooltip, useDataGrid, useEditModes, useGridChartBoxData, useGridChartData, useGridChartXYData, useGridEditing, useGridSurfaceClass, useGridText, usePrintLayout, useRowDrag, useStateStoring, writeClipboardText };
|
|
2521
|
+
export { type AlignedGridsApi, BAND_ROW_HEIGHT, type BatchSaveError, type CellMenuOptions, type CellRenderContext, type CellSlotContext, type CellTooltipOptions, DEFAULT_EDIT_FORM_LABELS, DEFAULT_HEADER_MENU_LABELS, DataGrid, type DataGridProps, type DistinctEntry, type EditFormField, type EditFormLabels, type EditModes, type EditorRenderContext, type ExportOutcome, type FilterRenderContext, GridCellEditor, type GridCellEditorProps, GridColumnChooser, type GridColumnChooserProps, GridContextMenu, type GridContextMenuProps, GridDateEditor, type GridDateEditorProps, GridDialog, type GridDialogProps, GridEditForm, type GridEditFormProps, GridFilterPanel, type GridFilterPanelProps, GridFilterRow, type GridFilterRowProps, GridFooterRow, type GridFooterRowProps, GridGroupPanel, type GridGroupPanelProps, GridHeader, GridHeaderBands, type GridHeaderBandsProps, GridHeaderFilterPopup, type GridHeaderFilterPopupProps, type GridHeaderProps, GridLoadingOverlay, type GridLoadingOverlayProps, GridLookupEditor, type GridLookupEditorProps, type GridMenuItem, GridNoteEditor, type GridNotesConfig, GridPager, type GridPagerProps, GridPinnedRows, type GridPinnedRowsProps, GridPopupPanel, type GridPopupPanelProps, GridPortal, type GridPortalProps, GridRow, GridRowEditor, type GridRowEditorProps, type GridRowProps, GridSummaryBar, type GridSummaryBarProps, GridSurfaceProvider, type GridSurfaceProviderProps, GridTextProvider, type GridTextProviderProps, GridToolbar, GridToolbarButton, type GridToolbarButtonProps, type GridToolbarProps, GridTooltip, type GridTooltipConfig, type GridTooltipProps, type HeaderMenuContext, type HeaderMenuDeps, type HeaderMenuLabels, type HeaderRenderContext, type NoteCellContext, PRINT_MAX_ROWS, type PendingDelete, type PrintLayoutOptions, type PrintLayoutState, ROW_DRAG_MIME, type RangeApi, type ReactColumnRuntime, type ReactGridColumnDef, type RowDragConfig, type RowDragHandlers, type RowDragPayload, type RowDropEvent, type RowLookupMap, type RowMenuContext, type RowReorderEvent, type RowTemplateContext, SHORTCUT_COPY, SHORTCUT_CUT, SHORTCUT_PASTE, type SelectionStats, ToolbarIcon, type TooltipState, type UseDataGridOptions, type UseDataGridResult, type UseEditModesOptions, type UseGridEditingOptions, type UseGridEditingResult, buildCellMenuItems, buildHeaderMenu, copyToClipboard, editFormColumnIds, editFormLabels, headerMenuLabels, matchOptions, measureBestFitWidth, reconcileFilterInputs, runGridExport, useAlignedGrids, useAnchoredPopup, useCellTooltip, useDataGrid, useEditModes, useGridChartBoxData, useGridChartData, useGridChartXYData, useGridEditing, useGridPortalTarget, useGridSurfaceClass, useGridText, usePrintLayout, useRowDrag, useStateStoring, writeClipboardText };
|