import { AnchorLocation } from '@sheetxl/utils'; import { AxisOrientationFlags } from '@sheetxl/utils'; import { Bounds } from '@sheetxl/utils'; import { CellCoords } from '@sheetxl/utils'; import { CellFinder } from '@sheetxl/utils-react'; import { default as default_2 } from 'react'; import { Direction } from '@sheetxl/utils'; import { HiddenHeadersAt } from '@sheetxl/utils-react'; import { HorizontalAlignment } from '@sheetxl/utils-react'; import { ICellLayout } from '@sheetxl/utils-react'; import { ICommands } from '@sheetxl/utils-react'; import { IScrollPaneElement } from '@sheetxl/utils-react'; import { ItemSizer } from '@sheetxl/utils-react'; import { JSX } from 'react/jsx-runtime'; import { PaintableText } from '@sheetxl/utils'; import { Point } from '@sheetxl/utils'; import { PointerHandlerOptions } from '@sheetxl/utils-react'; import { PointerModifiers } from '@sheetxl/utils-react'; import { RangeCoords } from '@sheetxl/utils'; import { RangeOrientation } from '@sheetxl/utils'; import { Rectangle } from '@sheetxl/utils'; import { ScrollableViewport } from '@sheetxl/utils-react'; import { ScrollPaneProps } from '@sheetxl/utils-react'; import { SelectionCoords } from '@sheetxl/utils'; import { Size } from '@sheetxl/utils'; import { TopLeft } from '@sheetxl/utils'; export declare interface AnimatedStrokeProps { /** * The named of the animation */ name?: string; dashGap: number; speed: number; dashLength: number; } /** * Data grid component for rendering cells onto a virtual panel. * This component coordinates between ICellLayout and CellRenderer. * This component expects a width and height to be passed to it. * * * To support dynamic width/height based on div sizing wrap this is @see * * To support scrolling wrap use @see (which wraps @see ) * * @see GridProps */ export declare const BaseGrid: default_2.NamedExoticComponent>; export declare interface CellEditorProps extends default_2.HTMLAttributes, default_2.Attributes { /** * editState of the cell */ editState?: EditState | null; /** * Styling for the textfield */ defaultTextStyle?: TextStyle; /** * Override defaultText styling with cellStyling? */ useRichStyling?: boolean; /** * Callback when a value has changed. */ onStartEdit?(editState: EditState): void; /** * Callback when a value has changed. */ onChangeEdit?(editState: EditState): void; /** * Callback to submit the value back to data store */ onSubmitEdit?(editState: EditState): void; /** * On Cancel callbacks. Hides the editor */ onCancelEdit?(): void; /** * Called when either the cancel or submit is called. */ onDoneEdit?(): void; /** * Position of editor, x, y, width and height */ containerBounds?: Bounds; disabled?: boolean; setNaturalSize?(size: Size): void; /** * Callback to enable navigation after submit * @param direction */ onNavigate?(direction: Direction): void; zoom?: number; /** * Reference to the underlying element */ ref?: default_2.Ref; } export declare interface CellRendererProps extends React.HTMLAttributes, React.Attributes { /** * A value to render */ value: T; /** * The range bounds relative to the current viewport and zoom */ bounds: Bounds; /** * The Coords that is being rendered. */ coords: CellCoords; /** * The view that is rendering a collection of cells */ view: IGridView; /** * The RangeCoords that is being rendering. * @remarks * For non most cells this is the same as the coords. This will only be different for spanning cells * @defaultValue The sames as the coords */ range?: RangeCoords; /** * If there is a zoom scale. * @defaultValue 1 */ zoom?: number; } export declare interface CoordOffset { index: number; offset: number; } /** * Default cell editor * * @param props */ export declare const DefaultCellEditor: default_2.NamedExoticComponent & default_2.RefAttributes>; /** * Default cell component capable of rendering a value * @param props */ export declare const DefaultCellRenderer: default_2.MemoExoticComponent<(props: CellRendererProps) => JSX.Element>; export declare const DefaultHeaderDivider: default_2.NamedExoticComponent & default_2.RefAttributes>; export declare const defaultSelectionRenderer: (props: SelectionProps) => JSX.Element; export declare interface EditorOverlayResults { /** * Editor component to be injected. */ renderOverlay: (view: IGridView, ref?: default_2.Ref) => default_2.ReactNode; /** * Bind to keyboard event */ onKeyboardEvent: (e: default_2.KeyboardEvent) => void; onKeyboardEventNative: (e: globalThis.KeyboardEvent) => void; /** * Bind to pointer event */ onPointerEvent(e: default_2.PointerEvent): void; onPointerEventNative(e: globalThis.PointerEvent): void; /** * Make a cell editable * * @param event an option StartEditEvent */ startEdit(event?: StartEditEvent): void; /** * Imperatively trigger submit */ submitEdit(): void; /** * Cancels an edit */ cancelEdit(): void; /** * indicates if the editor is active */ isEditing: boolean; /** * OnScroll listener to align the editor */ onScroll?: (scrollPoint: TopLeft) => void; } export declare interface EditState { clean: CT; dirty?: DT | undefined; editMode?: boolean; } /** * Fill handle component */ export declare const FillHandle: default_2.NamedExoticComponent & default_2.RefAttributes>; export declare interface FillHandleAttributes { } export declare interface FillHandleElement extends HTMLDivElement, FillHandleAttributes { } export declare interface FillHandleProps extends default_2.HTMLAttributes { corner?: string; x?: number; y?: number; size?: number; borderWidth?: number; borderStroke?: string; background?: string; /** * Underlying element reference */ ref?: default_2.Ref; } export declare interface FrozenEdge { /** * The boundaries for the edge */ index: number; /** * If specified then the edge has a scrollOffset */ scrollOffset?: number; } export declare const getDefaultStringEditState: (clean?: string) => EditState | undefined; export declare const Grid: default_2.NamedExoticComponent>; export declare interface GridHeaderStyle extends GridSurfaceStyle { strokeFillShadow?: string; edgeStrokeFill?: string; dividerStrokeFill?: string; edgeStrokeWidth?: number; } export declare interface GridProps extends default_2.HTMLAttributes { /** * Width of the grid container */ width?: number; /** * Height of the grid container */ height?: number; /** * Number of columns in the grid */ columnCount: number; /** * Number of rows in the grid */ rowCount: number; /** * Passed through to @see useCellLayoutHook. If cellLayout property is provided this is ignored */ defaultColumnWidth?: number; /** * Passed through to @see useCellLayoutHook. If cellLayout property is provided this is ignored */ defaultRowHeight?: number; /** * Passed through to @see useCellLayoutHook. If cellLayout property is provided this is ignored */ getRowHeight?: ItemSizer; /** * Passed through to @see useCellLayoutHook. If cellLayout property is provided this is ignored */ getColumnWidth?: ItemSizer; /** * The layout for the cells */ layout?: ICellLayout; /** * Called on scroll, subject to debouncing. Used for programmatic changes. Called even on load */ onViewportScroll?: (scrollPoint: Partial) => void; /** * Called immediately on scroll. Used for programmatic changes. Called even on load */ onImmediateScroll?: (scrollPoint: Partial) => void; /** * Fired when the view port changes. * This is in pixel coordinates and is slightly different than viewable cells because off screen location range could change */ onViewportChange?: (viewport: ScrollableViewport) => void; /** * Enable dragging active cell and selections */ enableMouseWheel?: boolean; /** * When wheel mouse is called. If return false then wheelMouse will not be processed */ onWheelScroll?: (event: globalThis.WheelEvent) => boolean | void; /** * The location of the top left scroll corner */ scrollPoint?: Partial; /** * Number of frozen left */ freezeLeft?: number | FrozenEdge; /** * Number of frozen top */ freezeTop?: number | FrozenEdge; /** * Allow for customization of freezeTopDivider */ propsFreezeLeft?: Partial; /** * Allow for customization of freezeTopDivider */ propsFreezeTop?: Partial; /** * Called right before a row is being rendered. * Will be called for frozen cells and merged cells * @remarks Not implement. */ /** * Call only once when the renders for the first time. */ onFirstRender?: (grid: IGridElement) => void; /** * Returns the actual element to render. * * @remarks * There can be many cells so care should be taken * to ensure these are as performant as possible. By default * the pointerEvents are set to none. To enable interaction this should be * overwritten. */ renderCell?: (props: CellRendererProps) => default_2.ReactNode; /** * Allow for cells to be inset. This is a way to account for borders. By default this is 1, 1, 1,x. */ cellInsets?: Rectangle; /** * Render elements for the view. This will be called whenever the viewport changes. */ renderOverlays?: ((view: IGridView) => default_2.ReactNode)[]; /** * Props passed to all overlayRenderers */ propsOverlays?: default_2.HTMLAttributes; /** * Used for rendering overlays. Similar to cell render but covers the entire area. * * @param props */ renderOverlay?: (props: OverlayRendererProps) => default_2.ReactNode; propsOverlay?: default_2.HTMLAttributes; /** * Overlays are generally clipped to fit in the viewport but * this allows for the properties to be overridden. */ allowOverlaysOverflow?: boolean; /** * Allows users to Wrap stage children in Top level Context */ wrapperStage?: (children: default_2.ReactNode) => default_2.ReactNode; /** * Props that can be injected to stage */ propsStage?: default_2.HTMLAttributes; /** * Show grid lines. * Useful for spreadsheets * NOTE - should we just allow gridline renderers to be null? */ showGridLines?: boolean | Partial; /** * Customize grid line color. * @remarks * This is overwritten by gridlinePropsVertical and gridlinePropsHorizontal */ gridLineColor?: string; /** * Gridline props for rows. */ propsGridLineRows?: default_2.SVGProps; /** * Gridline props for columns. */ propsGridLineColumns?: default_2.SVGProps; /** * Will skip rendering for this row and the adjacent rows in the given direction. */ hiddenRowsAt?: (rowIndex: number, forward: boolean) => number; /** * Will skip rendering for this columns and the adjacent columns in the given direction. */ hiddenColumnsAt?: (colIndex: number, forward: boolean) => number; /** * Indicates the cell is hidden and should not be rendered. * * @remarks * * Superseded by hiddenRowsAt and hiddenColumnsAt. * * If getVisibleCells is define this is ignored * This is typically used for cells that have nothing to render. */ hiddenCellAt?: (coords: CellCoords) => boolean; /** * Allows for optimization of rendering. * * @param view * @returns Either a CellCoord that should be rendered or an object with a coord and value. Note - the value is passed to the cell renderer * * @remarks * * Allows for quick skipping of cells that have nothing to render. * * If not specified then all cells within the visible range will be * iterated and if hiddenCellAt does not return false then cellRender will be * called. */ getVisibleCells?: (view: IGridView) => ({ coords: CellCoords; value?: any; range?: RangeCoords; } | CellCoords)[]; /** * Returns the cell as a range. If this cell is merged this will be reflected. * * @remarks * Slightly more sophisticated than rowSpan and colSpan because it allows for queries that are not on the top/left. */ getCellCoordsAsRangeCoords?: (coords: CellCoords) => RangeCoords; /** * Zoom. `1` indicates no zoom. * * @defaultValue 1 or none. */ zoom?: number; /** * Cursor used for grid. */ cursor?: string; /** * Clip overflow of cells unless explicitly provided. */ clipCells?: boolean; } export declare interface GridStyle extends GridSurfaceStyle { body?: GridSurfaceStyle; selection?: SelectionStyle; selectionRemove?: SelectionStyle; selectionInactive?: SelectionStyle; header?: GridHeaderStyle; headerSelect?: GridHeaderStyle; headerSelectAll?: GridHeaderStyle; headerHover?: GridHeaderStyle | ((style: GridHeaderStyle) => GridHeaderStyle); headerSelection?: SelectionStyle; headerSelectionInactive?: SelectionStyle; colorShadow?: string; colorGrey?: string; filterDarkInvert?: string; buttonSurface?: GridHeaderStyle; } export declare interface GridSurfaceStyle extends PaintStyle { text?: TextStyle; /** * Indicates to the renderers that the colors being rendered are for dark mode. * @remarks * Renderers should invert colors if the colors being used are not specifically for dark mode. */ darkMode?: boolean; } /** * A divider placed between headers to provider a visual cue for various actions. * Resize, hide/unhide, etc. */ export declare const HeaderDivider: default_2.NamedExoticComponent & default_2.RefAttributes>; export declare interface HeaderDividerAnchorProps extends HeaderDividerProps { renderDivider?: (props: HeaderDividerRendererProps) => default_2.ReactNode; /** * The number of pixels to mouse before resizing starts. * If this number is less than 1 then it will be 1. */ resizeThreshold?: number; /** * Called when the mouse is pressed down. * @param index the index of the divider. * @param size the size of the header during callback. */ onDividerMouseDown?: (index: number, size: number) => void; /** * Called after the mouse has dragged beyond the threshold * * @param index the index of the divider * @param prevSize the size of the header on DividerResizeStart (not last resize call) */ onDividerResizeStart?: (index: number, prevSize: number) => void; /** * Called during resize. * @param index the index of the divider * @param size the size of the header during callback * @param prevSize the size of the header on resizeStart (not last resize call) */ onDividerResize?: (index: number, size: number, prevSize: number) => void; /** * Called after the mouse has been released but only if the mouse onDividerResizeStart was called. * * @param index The index of the divider * @param size the size of the header during callback * @param prevSize In pixel the previous size of the divider */ onDividerResizeEnd?: (index: number, size: number, prevSize: number) => void; /** * Called when the mouse is released (regardless of resize). * * @param index */ onDividerMouseUp?: (index: number) => void; /** * Called when the mouse autoFit has been initiated (usually a double-click). * * @param index */ onDividerAutoFit?: (index: number) => void; } /** * HeaderDividers follow the header * // TODO - allow negative resizing (before the current) (easy to do I think) */ export declare interface HeaderDividerProps extends default_2.HTMLAttributes { orientation: RangeOrientation; view: IGridView; index: number; /** * This should disable interaction. This should also * provide a visual cue that the divider is disabled. */ disabled?: boolean; /** * If the divider does not allow resize. * @remarks * We create a faux divider on the left of the first header and we mark it as disabledResize. */ disabledResize?: boolean; /** * If the next header is hidden. * This allows the divider to shift location */ isNextHidden?: boolean; /** * If the current header is hidden. * This allows the divider to shift location */ isHidden?: boolean; /** * If the header associated with this divider is selected. */ isSelected?: boolean; /** * If the header associated with this divider is selected. */ isSelectedAll?: boolean; /** * If the divider is the last one in view. Useful for touch divider that only show the last one. */ showTouchDivider?: boolean; headerStyle: GridHeaderStyle; headerStyleSelect: GridHeaderStyle; headerStyleSelectAll: GridHeaderStyle; headerStyleHover?: GridHeaderStyle | ((style: GridHeaderStyle) => GridHeaderStyle); /** * The reference to the element. */ ref?: default_2.Ref; } export declare interface HeaderDividerRendererProps extends HeaderDividerProps { bounds: Bounds; /** * Handle mouse down and all dragging */ onPointerDown: default_2.PointerEventHandler; onAutoFit: () => void; } export declare const HeaderRenderer: default_2.MemoExoticComponent<(props: HeaderRendererCellProps) => JSX.Element>; export declare interface HeaderRendererCellProps extends CellRendererProps { orientation: RangeOrientation; index: number; headerStyle: GridHeaderStyle; headerStyleSelect: GridHeaderStyle; headerStyleSelectAll: GridHeaderStyle; headerStyleHover?: GridHeaderStyle | ((style: GridHeaderStyle) => GridHeaderStyle); verticalPadding?: number; horizontalPadding?: number; headerText?: (index: number) => string; isSelected?: (index: number) => boolean; isSelectedAll?: (index: number) => boolean; /** * This is not the default grid zoom this is just for rendering. * @defaultValue 100 */ zoomScale?: number; } export declare interface HeaderSelectionResults { /** * Handler for pointerdown */ onPointerDown: (e: default_2.PointerEvent) => void; getCellCoordsFromClient: (x: number, y: number) => CellCoords; } export declare type ICellEditorAttributes = { /** * When editor is loaded, this will be called. Note this should not use the autoFocus property. here * If this is set the editor focus will be called as appropriate. */ startEdit?(event: StartEditEvent): void; submitEdit(): boolean; cancelEdit(): void; /** * Called if the StartEditEvent event has autoFocus set. * @param selector A selector string (or empty means 'default' focus) */ autoFocus(selector?: string): void; /** * Returns the default line height. */ getLineHeight: () => number; }; export declare interface ICellEditorElement extends HTMLDivElement, ICellEditorAttributes { } export declare interface IGridAttributes { /** * The stage element for the cells */ readonly stage: HTMLDivElement | null; /** * The rowCount provided by the properties */ readonly rowCount: number; /** * The columnCount provided by the properties */ readonly columnCount: number; /** * Invalidate either a cell or a range of cells. If no arguments are provided then the entire grid is invalidated. * @param coords */ invalidate: (coords?: CellCoords | RangeCoords) => void; handleWheel: (event: globalThis.WheelEvent) => void; getScrollPosition: () => TopLeft; getViewport: () => RangeCoords; getDimensions: () => { containerWidth: number; containerHeight: number; totalWidth: number; totalHeight: number; }; /** * Scroll the cell into view. If the coord does not have an index it will only scroll in a single direction. */ scrollCellCoordsIntoView: (coords: Partial, options?: globalThis.ScrollIntoViewOptions | boolean) => Promise>; /** * The grid coordinates relative to the containing div (includes any padding, margins) */ getRelativePointFromClient: (x: number, y: number) => Point | null; /** * Returns the view for the given point. If point is * over a frozen pane it will return the frozen pane otherwise * it will return the center view. */ getViewFromClient: (x: number, y: number) => IGridView; /** * Returns the view for the given coords. If coord is * over a frozen pane it will return the frozen pane otherwise * it will return the center view. */ getViewFromCellCoords: (coords: CellCoords) => IGridView; /** * Returns null if the view does not exist. */ getViewFromLocation: (anchor: AnchorLocation) => IGridView | null; /** * Called when the view has been changed. * @remarks * This is only called once. */ onViewChangeOnce: (callback: () => void) => void; /** * Reference to the underlying element */ ref?: default_2.Ref; } /** * Type returned via ref property */ export declare interface IGridElement extends HTMLDivElement, IGridAttributes { } /** * Describes the view of a grid. * * @remarks * Useful for overlay rendering. */ export declare interface IGridView { /** * Returns the underlying stage element for the view. * * @remarks * Useful for capturing stage events. */ getStage(): HTMLDivElement | null; /** * The anchor for the view. */ getAnchor(): AnchorLocation; /** * Allow for dimensions to be determined for various cells. * The cellLayout is inclusive of the zoom */ getLayout(): ICellLayout; /** * Useful for internal rendering. * * @remarks * The cell layout will account for zoom factors already. */ getZoom(): number; /** * This captures the total viewable range. * * @remarks * Will have the sames values as {@link getVisibleRows} and {@link getVisibleColumns}. */ getVisibleRangeCoords(): RangeCoords; /** * Useful for scanning. Contains a list of row offsets that are visible. * Guaranteed to be non-null but may be zero length if no rows are visible. */ getVisibleRows(): readonly number[]; /** * Useful for scanning. Contains a list of column offsets that are visible. * Guaranteed to be non-null but may be zero length if no column are visible. */ getVisibleColumns(): readonly number[]; /** * Returns the SizedOffsets for columns. */ getVisibleColumnOffsets(): SizedOffset; /** * Returns the SizedOffsets for rows. */ getVisibleRowOffsets(): SizedOffset; /** * Returns the range coords that captures the entire view. */ getTotalRangeCoords(): RangeCoords; /** * Clip a rectangle against the viewport. * * @remarks * * A negative inset will extend outside of the viewport; * * Useful when elements should visually 'flow' off of the viewport. (i.e. selection with borders) */ toClipBounds(bounds?: Bounds, insets?: number | Bounds): Bounds; /** * Returns the viewport bounds for an absolute bounds. */ toViewBounds(bounds: Bounds): Bounds; /** * Returns the absolute bounds for a viewport bounds. */ toAbsoluteBounds(bounds: Bounds): Bounds; /** * The bounds of the the overlay relative to the total view. */ getBounds(): Bounds; /** * Additional inside padding. */ getInsets(): Rectangle; /** * Returns the cell as a range. If this cell is merged this will be reflected. * Note - This is slightly more sophisticated than rowSpan and colSpan * because it allows for queries that are not on the top/left. */ getCellCoordsAsRangeCoords(coords: CellCoords): RangeCoords; /** * Returns a bounds for a given range. * If not specified then will return for the cellRange. * * @param adjustment This allows you to adjust the rect. Note - This is not like insets * * @remarks * The bounds are relative to the view. */ getRangeCoordsBounds(range?: RangeCoords, adjustment?: Partial): Bounds; /** * Scroll the cell coords into view. * If the coord does not have an index it will only scroll in a single direction. */ scrollCellCoordsIntoView(coords: Partial, options?: globalThis.ScrollIntoViewOptions | boolean): Promise>; /** * Returns the coords at the offset. * @param x - The x offset relative to the view * @param y - The y offset relative to the view * @param actualCell - Don't return the topLeft of a merge. Default value `false`. */ getCellCoordsFromClient(x: number, y: number, actualCell?: boolean): CellCoords | null; /** * Indicate the allowable scroll directions. */ getScrollOrientation(): AxisOrientationFlags; /** * Returns the current scroll top/left for the view. */ getScrollTopLeft(): TopLeft; /** * Returns the number of frozen rows and columns. */ getFreezeTopLeft(): TopLeft; /** * Returns the total size of all rendered values in pixels. */ getTotalSize(): Size; /** * This is the size for all views (but not including the headers) */ getViewportSize(): Size; /** * Allows for access to all current views. */ allViews(): Partial>; /** * Returns a point relative to the view. */ getRelativePointFromClient(x: number, y: number): Point | null; } export declare interface IHeaderDividerAttributes { } export declare interface IHeaderDividerElement extends HTMLDivElement, IHeaderDividerAttributes { } export declare interface LineProps extends default_2.SVGProps { linePoints: number[]; bounds: Bounds; propsPath?: default_2.SVGProps; } export declare type NewHeaderSelectionMode = "clear" | "modify" | "append"; export declare type NewSelectionMode = "clear" | "modify" | "append"; export declare interface OverlayRendererProps extends React.HTMLAttributes, React.Attributes { /** * The view that is rendering a collection of cells */ view: IGridView; onStageKeyDown?: (e: React.KeyboardEvent) => void; onStagePointerDown?: (e: React.PointerEvent) => void; onStageDoubleClick?: (e: React.PointerEvent) => void; ref?: React.Ref; } export declare interface PaintStyle { fill?: string; strokeFill?: string; strokeWidth?: number; } export declare const RESET_SCROLL_EVENTS_DEBOUNCE_INTERVAL = 150; export declare const safeSelectionCoords: (prev?: SelectionCoords) => SelectionCoords; /** * ScrollableGrid. This wraps BaseGrid and manages bounds to create consistent css behavior for consumers */ export declare const ScrollableGrid: default_2.NamedExoticComponent & default_2.RefAttributes>; export declare interface ScrollableGridProps extends GridProps, ScrollPaneProps { /** * Callback for detecting a change in the ScrollPane. * @param scrollPoint */ onScrollViewport?: (scrollPoint: Partial) => void; /** * Ref for the HTMLDivElement */ ref?: default_2.Ref; } declare const Selection_2: default_2.FC; export { Selection_2 as Selection } export declare const SELECTION_CLIP_INSETS = -10; export declare interface SelectionPointerHandlerOptions extends Omit { onSelectionPointerDown: (event: default_2.PointerEvent, modifiers: PointerModifiers, view?: IGridView, coords?: CellCoords, pivotCoords?: CellCoords, extendSelection?: boolean, scrollToAnchor?: boolean, resetCellAnchor?: boolean) => boolean | void; onSelectionPointerMoveOrWait?: (event: default_2.PointerEvent, modifiers: PointerModifiers, originalEvent: default_2.PointerEvent, view?: IGridView, coords?: CellCoords, pivotCoords?: CellCoords, scrollToAnchor?: boolean, resetCellAnchor?: boolean) => void; } export declare type SelectionPolicy = "single" | "range" | "multiple"; export declare interface SelectionProps extends SVGRectProps { /** * @defaultValue false unless props are set */ isAnimatedStroke?: boolean; /** * Customize props for Animated Stroke */ propsAnimatedStroke?: AnimatedStrokeProps; /** * The range that this selection represents. */ range: RangeCoords; /** * An area may or may not contain an anchor cell. */ cell?: CellCoords; } export declare interface SelectionResults { /** * The current selection. */ selection: SelectionCoords; /** * Set the currently active cell. */ setSelectionCell: (coords: CellCoords | null, shouldScroll?: boolean) => void; /** * Use this to update selections without clearing old selection. */ setSelectionRanges: (ranges: RangeCoords[] | ((ranges: RangeCoords[]) => RangeCoords[])) => void; /** * Handler for pointerdown, use to set activeCoords */ onPointerDown: (e: default_2.PointerEvent) => void; /** * Returns a flag indicating if the entire range is selected */ isEntire: boolean; /** * Preferred global cursor if set */ cursor?: string; /** * Array of functions that return components to overlay * // TODO - make this a function that takes props and received onMouse, onKeyboard * (we can then make selection overlays a function that doesn't rerender the table (or sheet on move)) */ renderOverlay: (view: IGridView) => default_2.ReactNode; /** * Navigate left/right/up/down * @param direction The direction to navigate. * @param select A flag indicating if we should select the new cell. * @param contentFul A flag indicating if we should navigate to the next contentful cell. * @param incrementAmount Use instead of contentful. Allows for navigating distances (useful for pageUp/pageDown). */ navigate?: (direction: Direction, select?: boolean, contentFul?: boolean, incrementAmount?: number) => void; /** * Navigate with the selections (unless there is no active selection) */ navigateSelection: (direction: Direction) => void; /** * Use this to invoke a new selection. All old selections will be cleared */ newSelection: (coordsStart: Partial, coordsEnd?: Partial, anchor?: Partial) => void; /** * Modify selection. If the coordsPivot is not provided then the current anchor will be used. */ modifySelection: (coords: CellCoords, coordsPivot?: CellCoords) => void; /** * Add a new selection */ appendSelection: (start: CellCoords, end: CellCoords, anchor?: Partial) => void; /** * Clear all current ranges. Leaves the anchor intact */ clearSelections: () => void; /** * Clears the last selection */ clearLastSelection: () => void; } export declare interface SelectionStyle extends PaintStyle { } export declare type SizedOffset = Record; /** * A set of standard characters that are used for starting a CellEditor. */ export declare const STANDARD_KEY_CHARS: string; export declare interface StartEditEvent { /** * Edit text. If this is null or undefined then this will not replace the text. * * @defaultValue null * * @remarks * * A '' will clear the text. */ text?: string; /** * Is editor starting in edit mode. * * @defaultValue false */ editMode?: boolean; /** * Allows the initial selection position to be overridden. By default it's at the end */ initialSelection?: { start: number; end: number; direction?: "forward" | "backward" | "none"; }; /** * Should editor start editing with focus. If a string is passed this will use a querySelector to a nest element to focus. * * @defaultValue true */ autoFocus?: boolean | string; /** * The cell that should be edited */ cell?: CellCoords; } export declare interface StringCellEditorProps extends CellEditorProps { textProperties?: PaintableText; } export declare const SVGLine: (props: LineProps) => JSX.Element; declare const SVGRect_2: (props: SVGRectProps) => JSX.Element; export { SVGRect_2 as SVGRect } export declare interface SVGRectProps extends default_2.SVGProps { boundsPath?: Bounds; propsPath?: default_2.SVGProps; } export declare interface TextStyle extends PaintStyle { fontFamily?: string; fontSize?: number; fontWeight?: string | number; fontStyle?: string; } /** * TouchSelectHandle component */ export declare const TouchSelectHandle: default_2.NamedExoticComponent & default_2.RefAttributes>; export declare interface TouchSelectHandleAttributes { } export declare interface TouchSelectHandleElement extends HTMLDivElement, TouchSelectHandleAttributes { } export declare interface TouchSelectHandleProps extends default_2.HTMLAttributes { /** * Possible anchors are. If 'l', 't', 'r', or 'b', then it will center along view the view. * * @remarks * Determines not only the position but the event that is fired. */ anchor: 'tl' | 'br' | 'l' | 't' | 'r' | 'b'; range: RangeCoords; view: IGridView; size?: number; borderWidth?: number; borderStroke?: string; background?: string; selectionTouchPointerHandler: SelectionPointerHandlerOptions; onTouchSelectStart?: (anchor: string) => void; onTouchSelectEnd?: (anchor: string) => void; /** * Indicate that a touch handling is being used */ currentTouchAnchor?: string; /** * If provided then touch control will walk the parent hierarchy * to find the absolute scroll position */ scrollableElement?: HTMLElement; /** * Use to add create the portal * @defaultValue document.body */ scrollableRoot?: HTMLElement; /** * Reference to the underling element */ ref?: default_2.Ref; } /** * Hook to manage cell layout */ export declare const useCellLayout: (props: UseCellLayoutProps | null) => ICellLayout; export declare interface UseCellLayoutProps { /** * Number of columns in the grid */ columnCount: number; /** * Number of rows in the grid */ rowCount: number; /** * Performance - Helps in lazy grid width calculation */ defaultColumnWidth?: number; /** * Performance - Helps in lazy grid height calculation */ defaultRowHeight?: number; /** * Should return height of a row at an index */ getRowHeight?: ItemSizer; /** * Should return width of a column at an index */ getColumnWidth?: ItemSizer; } /** * Hook to enable selection in grid */ export declare const useHeaderSelection: ({ gridRef, gridMainRef, orientation, headerCount: propHeaderCount, selectionPolicy, newSelectionMode, alwaysScrollToActiveCoords, onDragStart: propOnDragStart, onDragEnd: propOnDragEnd, pointerDownInterceptor, pointerMoveInterceptor, onPointerUp, newSelection: propNewSelection, modifySelection: propModifySelection, appendSelection: propAppendSelection, clearSelections: propClearSelections, }: UseHeaderSelectionOptions) => HeaderSelectionResults; /** * Hook for managing the header selections. * * TODO - When dragging a selection that already exist it should drag for reorder. (Not supported yet) */ export declare interface UseHeaderSelectionOptions { /** * Access grid functions */ gridMainRef: default_2.RefObject; /** * Access grid functions */ gridRef: default_2.RefObject; /** * The orientation of the header. */ orientation?: RangeOrientation; /** * No of headers in the grid */ headerCount?: number; /** * scroll to active cell when */ alwaysScrollToActiveCoords?: boolean; /** * Pointerdown Interceptor */ pointerDownInterceptor?: (e: default_2.PointerEvent, coords: CellCoords) => boolean | undefined; /** * Pointer Move Interceptor */ pointerMoveInterceptor?: (e: default_2.PointerEvent, coords: CellCoords) => boolean | undefined; /** * Pointer Up Listener */ onPointerUp?: (e: default_2.PointerEvent) => void; /** * Returns true if the coordinate span can overlap merged ranges. * @param start * @param end * @returns A flag indicating if the selection will span over (ignore) merged cells. */ canSelectionSpanMergedCells?: (start: CellCoords, end: CellCoords) => boolean; /** * Selection policy */ selectionPolicy?: SelectionPolicy; /** * New selection mode */ newSelectionMode?: NewHeaderSelectionMode; /** * Callback when drag starts */ onDragStart?: () => void; /** * Callback when drag ends */ onDragEnd?: () => void; /** * Use this to invoke a new selection. All old selections will be cleared */ newSelection: (coordsStart: Partial, coordsEnd?: Partial, anchor?: Partial) => void; /** * Modify selection. If the coordsPivot is not provided then the current anchor will be used. */ modifySelection: (coords: CellCoords, coordsPivot?: CellCoords) => void; /** * Add a new selection */ appendSelection: (start: CellCoords, end: CellCoords, anchor?: Partial) => void; /** * Clear all current ranges. Leaves the anchor intact */ clearSelections: () => void; } /** * Hook to make enable inline 'keyboard editing'. Simple editing like checkboxes can be implemented as renderers * * @param props * * @remarks * For creating a CellOverlay that routes keyboard (and pointer) events. */ export declare const useKeyboardEditorOverlay: (props: useKeyboardEditorOverlayOptions) => EditorOverlayResults; /** * This enables custom editors to be injected in place of a renderer. * Note sometimes is makes more sense to just allow the renderer to edit in place. * Some examples are when a formula is being entered or if the cell is empty * * TODO - should the editor extend the render interface? */ export declare interface useKeyboardEditorOverlayOptions { /** * If provided and it doesn't return null then the editor will be aligned to the range. */ getRangeCoords?: (coord: CellCoords) => RangeCoords; /** * The view that is being used for rendering */ view: IGridView; /** * Active selected cell. This is required to enable * the editor to activate when a key is pressed */ activeCoords: CellCoords | null; /** * Inject custom editors based on a cell. * This should not return null but rather can canEdit. * This is called during placement after scrolling and other bookkeeping has occurred */ getCellEditor: (props: CellEditorProps, coords: CellCoords) => default_2.ReactElement>; /** * Callback fired before editing. Can be used to prevent editing. */ canEdit?(coords: CellCoords): boolean; /** * Callback when a start has been initialed. This is called before the editor is mounted. */ onBeforeStartEdit?: (coords: CellCoords) => void; /** * Callback when user start editing */ onStartEdit?: (coords: CellCoords) => void; /** * Callback when user submits a value. Use this to update state */ onSubmitEdit?: (coords: CellCoords) => void; /** * Callback when user cancels editing */ onCancelEdit?: (coords: CellCoords) => void; /** * Callback when user is done editing, either a submit or a cancel */ onDoneEdit?: (coords: CellCoords) => void; onNavigate?: (direction: Direction) => void; /** * Test if the key event should start the editor */ isEditorStartKeyEvent?: (e: KeyboardEvent, coords: CellCoords) => boolean | StartEditEvent; /** * Test if the mouse event should start the editor. If this returns an event this will be dispatched to the editor. * * @param e - The pointer event * * @returns Either `true` or an `StartEditEvent` */ isEditorStartPointerEvent?: (e: PointerEvent, coords: CellCoords) => boolean | StartEditEvent; propsContainer?: default_2.HTMLAttributes; borderStrokeFill?: string; borderStrokeWidth?: number; /** * The editor alignment. Used for expanding on overflow */ alignment?: HorizontalAlignment; } /** * Hook to enable selection in grid */ export declare const useSelection: ({ gridRef, commands, layout, selection: propSelection, onSelectionChange: propOnSelectionChange, onSelectionDragStart: propOnSelectionDragStart, onSelectionDragEnd: propOnSelectionDragEnd, selectionPolicy, newSelectionMode, allowDeselectSelection, onFillPreview: propOnFillPreview, onFillCancel: propOnFillCancel, onFillDone: propOnFillDone, onFill: propOnFill, disableFillDrag, fillHandleBorderColor, hiddenRowsAt: propHiddenRowsAt, hiddenColumnsAt: propHiddenColumnsAt, isContentfulCell: propsIsContentfulCell, contentfulCellFinder: propContentfulCellFinder, getDataCoords, alwaysScrollToActiveCoords, selectionBounds: propSelectionBounds, pointerDownInterceptor, pointerMoveInterceptor, mergedRanges, canSelectionSpanMergedCells, onMoveDragStart: propOnMoveDragStart, onMoveDragUpdate: propOnMoveDragUpdate, onMoveDragEnd: propOnMoveDragEnd, onMoveDragDone: propOnMoveDragDone, renderSelection: propRenderSelection, disableMoveDrag, getCellCoordsAsRangeCoords, moveDragHitSize, moveDragOutlineSize, selectionBackgroundColor, selectionBorderColor, selectionRemoveBorderColor, selectionRemoveBackgroundColor, disableTouchSelection, propsTouchSelectHandle, }: UseSelectionOptions) => SelectionResults; export declare interface UseSelectionOptions { /** * Access grid functions. */ gridRef: default_2.RefObject; commands?: ICommands.IGroup; /** * This is used for pageUp/pageDown and getHiddenAuto. */ layout?: ICellLayout; /** * selections */ selection?: SelectionCoords; /** * Callback when a value has changed. */ onSelectionChange?: (selection: SelectionCoords) => void; /** * Callback at the start of selection change driven by the pointer. */ onSelectionDragStart?: (selection: SelectionCoords, e: default_2.PointerEvent) => void; /** * Callback at the end of selection change driven by the pointer. */ onSelectionDragEnd?: (selection: SelectionCoords, e: default_2.PointerEvent) => void; /** * Allow deselect a selected area */ allowDeselectSelection?: boolean; /** * Hidden rows */ hiddenRowsAt?: HiddenHeadersAt; /** * Hidden columns */ hiddenColumnsAt?: HiddenHeadersAt; /** * If there is no value. Note - This is slightly different than isEmpty because it may still have logical render (like fill, border, etc) */ isContentfulCell?: (coords: CellCoords) => boolean; /** * Allows for selection to navigate intelligently between cells based on if they have data. * If this is note specified a default implementation will be used that uses hiddenRowsAt/hiddenColumnsAt/hiddenCellAt. * If no intelligently navigation is desired then this can be set explicitly to null. */ contentfulCellFinder?: CellFinder; /** * Performance - important performance consideration. * This allows functions (like copy and scan to not operate on the entire sheet.) * If this is not set or returns `undefined` then a scan of all the rows/columns will * be done when needed to determine. (For example select all in a large sheet and copy to clipboard) */ getDataCoords?: () => RangeCoords; /** * Always scroll to active cell */ alwaysScrollToActiveCoords?: boolean; /** * bound of selection */ selectionBounds?: Rectangle; /** * pointerDownInterceptor */ pointerDownInterceptor?: (e: default_2.PointerEvent, coords: CellCoords, selection: SelectionCoords) => boolean | undefined; pointerMoveInterceptor?: (e: default_2.PointerEvent, coords: CellCoords, selection: SelectionCoords) => boolean | undefined; /** * Is the current selection able to intersect merged cells. */ canSelectionSpanMergedCells?: (range: RangeCoords) => boolean; /** * Selection policy */ selectionPolicy?: SelectionPolicy; /** * New selection mode */ newSelectionMode?: NewSelectionMode; /** * Disable move drag * @defaultValue if the onMoveDragDone is provided */ disableMoveDrag?: boolean; /** * The size of the move hit stroke. * @defaultValue 5 */ moveDragHitSize?: number; /** * The size of the move outline. * @defaultValue 3 */ moveDragOutlineSize?: number; /** * Callback at the start of selection change driven by the pointer. */ onMoveDragStart?: (from: RangeCoords, e: default_2.PointerEvent, modifiers: PointerModifiers) => void; /** * Callback at the start of selection change driven by the pointer. */ onMoveDragUpdate?: (from: RangeCoords, e: default_2.PointerEvent, modifiers: PointerModifiers) => void; /** * Callback at the end of selection change driven by the pointer. */ onMoveDragEnd?: (from: RangeCoords, e: default_2.PointerEvent, modifiers: PointerModifiers) => void; /** * When selection is moved. */ onMoveDragDone?: (from: RangeCoords, to: RangeCoords, event: default_2.PointerEvent, modifiers: PointerModifiers) => Promise; /** * Disable fill drag. * @defaultValue to a value based on if onFill is provided. */ disableFillDrag?: boolean; /** * Called to actually perform the fill. */ onFill?: (template: RangeCoords, destination: RangeCoords, direction: Direction) => void; /** * Called when dragging to fill. */ onFillPreview?: (template: RangeCoords, destination: RangeCoords, direction: Direction) => void; /** * Called when a cancel is started but not completed by dragging to original rect. */ onFillCancel?: () => void; /** * Called when fill gesture is complete; either onFill or onFillCancel' */ onFillDone?: () => void; /** * Border color of fill handle. */ fillHandleBorderColor?: string; /** * Disable touch selection If false then the touch selection handles are not set * @defaultValue true */ disableTouchSelection?: boolean; /** * If touch is enabled. */ propsTouchSelectHandle?: TouchSelectHandleProps; /** * Allow users to customize selected cells design */ renderSelection?: (props: SelectionProps) => default_2.ReactNode; /** * Border color of selected area */ selectionBorderColor?: string; /** * Background of selection */ selectionBackgroundColor?: string; selectionRemoveBorderColor?: string; /** * Background of selection for removal */ selectionRemoveBackgroundColor?: string; /** * Is either an array of merged cells or a RangeCoordsLookup */ mergedRanges?: RangeCoords[] | ((range: RangeCoords) => RangeCoords[]); /** * Returns the cell as a range. If this cell is merged this will be reflected. * @remarks * This is slightly more sophisticated than rowSpan and colSpan * because it allows for queries that are not on the top/left. */ getCellCoordsAsRangeCoords?: (coords: CellCoords) => RangeCoords; } export { }