import { Computed, Signal } from '@serenity-is/domwise'; /*** * A base class that all special / non-data rows (like Group and GroupTotals) derive from. */ export declare class NonDataRow { __nonDataRow: boolean; } export declare const preClickClassName = "slick-edit-preclick"; export type CellNavigationDirection = "up" | "down" | "left" | "right" | "next" | "prev" | "home" | "end"; export interface CellNavigation { navigateBottom(): void; navigateDown(): boolean; navigateLeft(): boolean; navigateNext(): boolean; navigatePageDown(): void; navigatePageUp(): void; navigatePrev(): boolean; navigateRight(): boolean; navigateRowEnd(): boolean; navigateRowStart(): boolean; navigateTop(): void; navigateToRow(row: number): boolean; navigateUp(): boolean; /** * Navigate the active cell in the specified direction. * @param dir Navigation direction. * @return Whether navigation resulted in a change of active cell. */ navigate(dir: CellNavigationDirection): boolean; } export declare class CellRange { fromRow: number; fromCell: number; toRow: number; toCell: number; constructor(fromRow: number, fromCell: number, toRow?: number, toCell?: number); /*** * Returns whether a range represents a single row. */ isSingleRow(): boolean; /*** * Returns whether a range represents a single cell. */ isSingleCell(): boolean; /*** * Returns whether a range contains a given cell. */ contains(row: number, cell: number): boolean; /*** * Returns a readable representation of a range. */ toString(): string; } export interface IEventData { args: TArgs; defaultPrevented: boolean; preventDefault(): void; stopPropagation(): void; stopImmediatePropagation(): void; isDefaultPrevented(): boolean; isImmediatePropagationStopped(): boolean; isPropagationStopped(): boolean; getReturnValue(): any; getReturnValues(): any[]; nativeEvent: TEvent | null | undefined; } export type MergeArgKeys = "grid" | "column" | "node" | "row" | "cell" | "item"; export type EventData = IEventData & TEvent & { [key in keyof TArgs & (MergeArgKeys)]: TArgs[key]; }; export type EventCallback = (e: EventData, args?: TArgs) => void; /*** * An event object for passing data to event handlers and letting them control propagation. *

This is pretty much identical to how W3C and jQuery implement events.

*/ export declare class EventDataWrapper implements IEventData { private _args; private _isPropagationStopped; private _isImmediatePropagationStopped; private _isDefaultPrevented; private _nativeEvent; private _returnValue; private _returnValues; constructor(event?: TEvent | null, args?: TArgs); get defaultPrevented(): boolean; preventDefault(): void; isDefaultPrevented(): any; /*** * Stops event from propagating up the DOM tree. */ stopPropagation(): void; /*** * Returns whether stopPropagation was called on this event object. */ isPropagationStopped(): boolean; /*** * Prevents the rest of the handlers from being executed. */ stopImmediatePropagation(): void; /*** * Returns whether stopImmediatePropagation was called on this event object.\ */ isImmediatePropagationStopped(): boolean; get args(): TArgs; addReturnValue(value: any): void; getReturnValues(): any[]; getReturnValue(): any; get nativeEvent(): TEvent | null | undefined; } /*** * A simple publisher-subscriber implementation. */ export declare class EventEmitter { private _handlers; /*** * Adds an event handler to be called when the event is fired. *

Event handler will receive two arguments - an EventData and the data * object the event was fired with.

* @param fn {Function} Event handler. */ subscribe(fn: EventCallback): void; /*** * Removes an event handler added with subscribe(fn). * @param fn {Function} Event handler to be removed. */ unsubscribe(fn: EventCallback): void; /*** * Fires an event notifying all subscribers. * @param args {Object} Additional data object to be passed to all handlers. * @param e {EventDataWrapper} * Optional. * An EventData object to be passed to all handlers. * For DOM events, an existing W3C/jQuery event object can be passed in. * @param scope {Object} * Optional. * The scope ("this") within which the handler will be executed. * If not specified, the scope will be set to the Event instance. */ notify(args?: TArgs, e?: TEvent, scope?: object): EventData; clear(): void; } export declare class EventSubscriber { private _handlers; subscribe(event: EventEmitter, handler: EventCallback): this; unsubscribe(event: EventEmitter, handler: EventCallback): this; unsubscribeAll(): EventSubscriber; } /** @deprecated */ export declare const keyCode: { BACKSPACE: number; DELETE: number; DOWN: number; END: number; ENTER: number; ESCAPE: number; HOME: number; INSERT: number; LEFT: number; PAGEDOWN: number; PAGEUP: number; RIGHT: number; TAB: number; UP: number; }; export interface Position { bottom?: number; height?: number; left?: number; right?: number; top?: number; visible?: boolean; width?: number; } export interface ValidationResult { valid: boolean; msg?: string; } export interface RowCell { row: number; cell: number; } export interface EditorHost { getActiveCell(): RowCell; navigateNext(): boolean; navigatePrev(): boolean; onCompositeEditorChange: EventEmitter; getEditorFactory(): EditorFactory; } export interface CompositeEditorOptions { formValues: any; } export interface EditorOptions { grid: EditorHost; gridPosition?: Position; position?: Position; editorCellNavOnLRKeys?: boolean; column?: Column; columnMetaData?: ColumnMetadata; compositeEditorOptions?: CompositeEditorOptions; container?: HTMLElement; item?: any; event?: EventData; commitChanges?: () => void; cancelChanges?: () => void; } export interface EditorFactory { getEditor(column: Column, row?: number): EditorClass; } export interface EditCommand { row: number; cell: number; editor: Editor; serializedValue: any; prevSerializedValue: any; execute: () => void; undo: () => void; } export interface EditorClass { new (options: EditorOptions): Editor; suppressClearOnEdit?: boolean; } export interface Editor { destroy(): void; applyValue(item: any, value: any): void; focus(): void; isValueChanged(args: { commitEdit?: boolean; }): boolean; keyCaptureList?: number[]; loadValue(value: any): void; serializeValue(): any; position?(pos: Position): void; preClick?(): void; hide?(): void; show?(): void; validate?(): ValidationResult; } export interface EditController { commitCurrentEdit(): boolean; cancelCurrentEdit(): boolean; } /*** * A locking helper to track the active edit controller and ensure that only a single controller * can be active at a time. This prevents a whole class of state and validation synchronization * issues. An edit controller (such as SleekGrid) can query if an active edit is in progress * and attempt a commit or cancel before proceeding. * @class EditorLock */ export declare class EditorLock { private activeEditController; /*** * Returns true if a specified edit controller is active (has the edit lock). * If the parameter is not specified, returns true if any edit controller is active. * @param editController {EditController} * @return {Boolean} */ isActive(editController?: EditController): boolean; /*** * Sets the specified edit controller as the active edit controller (acquire edit lock). * If another edit controller is already active, and exception will be thrown. * @param editController {EditController} edit controller acquiring the lock */ activate(editController: EditController): void; /*** * Unsets the specified edit controller as the active edit controller (release edit lock). * If the specified edit controller is not the active one, an exception will be thrown. * @param editController {EditController} edit controller releasing the lock */ deactivate(editController: EditController): void; /*** * Attempts to commit the current edit by calling "commitCurrentEdit" method on the active edit * controller and returns whether the commit attempt was successful (commit may fail due to validation * errors, etc.). Edit controller's "commitCurrentEdit" must return true if the commit has succeeded * and false otherwise. If no edit controller is active, returns true. * @return {Boolean} */ commitCurrentEdit(): boolean; /*** * Attempts to cancel the current edit by calling "cancelCurrentEdit" method on the active edit * controller and returns whether the edit was successfully cancelled. If no edit controller is * active, returns true. * @return {Boolean} */ cancelCurrentEdit(): boolean; } /*** * A global singleton editor lock. */ export declare const GlobalEditorLock: EditorLock; export interface ArgsGrid { grid: ISleekGrid; } export interface ArgsColumn extends ArgsGrid { column: Column; } export interface ArgsDrag extends ArgsGrid { mode: string; row: number; cell: number; item: any; helper: HTMLElement; } export interface ArgsColumnNode extends ArgsColumn { node: HTMLElement; } export type ArgsSortCol = { sortCol: Column; sortAsc: boolean; }; export interface ArgsSort extends ArgsGrid { multiColumnSort: boolean; sortAsc: boolean; sortCol: Column; sortCols: ArgsSortCol[]; } export interface ArgsSelectedRowsChange extends ArgsGrid { rows: number[]; changedSelectedRows: number[]; changedUnselectedRows: number[]; previousSelectedRows: number[]; caller: any; } export interface ArgsScroll extends ArgsGrid { scrollLeft: number; scrollTop: number; } export interface ArgsCssStyle extends ArgsGrid { key: string; hash: CellStylesHash; } export interface ArgsCell extends ArgsGrid { row: number; cell: number; } export interface ArgsCellChange extends ArgsCell { item: any; } export interface ArgsCellEdit extends ArgsCellChange { column: Column; } export interface ArgsAddNewRow extends ArgsColumn { item: any; } export interface ArgsEditorDestroy extends ArgsGrid { editor: Editor; } export interface ArgsValidationError extends ArgsCell { editor: Editor; column: Column; cellNode: HTMLElement; validationResults: ValidationResult; } export type CellEvent = EventData; export type CellKeyboardEvent = EventData; export type CellMouseEvent = EventData; export type HeaderColumnEvent = EventData; export type HeaderMouseEvent = EventData; export type HeaderRenderEvent = EventData; export type FooterColumnEvent = HeaderColumnEvent; export type FooterMouseEvent = HeaderMouseEvent; export type FooterRenderEvent = HeaderRenderEvent; export type GridEvent = EventData; export type GridDragEvent = EventData; export type GridMouseEvent = EventData; export type GridSortEvent = EventData; export interface GridPlugin { init(grid: ISleekGrid): void; pluginName?: string; destroy?: () => void; } /** @deprecated Use GridPlugin instead */ export interface IPlugin extends GridPlugin { } export interface GridPluginHost { getPluginByName(name: string): GridPlugin; registerPlugin(plugin: GridPlugin): void; unregisterPlugin(plugin: GridPlugin): void; } export interface GridSignals { readonly showColumnHeader: Signal; readonly hideColumnHeader: Computed; readonly showTopPanel: Signal; readonly hideTopPanel: Computed; readonly showHeaderRow: Signal; readonly hideHeaderRow: Computed; readonly showFooterRow: Signal; readonly hideFooterRow: Computed; readonly pinnedStartCols: Signal; readonly pinnedEndCols: Signal; readonly frozenTopRows: Signal; readonly frozenBottomRows: Signal; } export interface ViewportInfo { height: number; width: number; hasVScroll: boolean; hasHScroll: boolean; headerHeight: number; groupingPanelHeight: number; virtualHeight: number; realScrollHeight: number; topPanelHeight: number; headerRowHeight: number; footerRowHeight: number; numVisibleRows: number; } export type BandKey = "start" | "main" | "end"; export type PaneKey = "top" | "body" | "bottom"; export interface GridBandRefs { key: BandKey; headerCols?: HTMLElement; headerRowCols?: HTMLElement; canvas: { top?: HTMLElement; body: HTMLElement; bottom?: HTMLElement; }; footerRowCols?: HTMLElement; readonly cellOffset: number; canvasWidth: number; } export type GridLayoutRefs = { readonly start: GridBandRefs; readonly main: GridBandRefs; readonly end: GridBandRefs; topPanel?: HTMLElement; readonly pinnedStartCols: number; readonly pinnedStartLast: number; readonly pinnedEndCols: number; readonly pinnedEndFirst: number; readonly frozenTopRows: number; readonly frozenTopLast: number; readonly frozenBottomRows: number; readonly frozenBottomFirst: number; config: { pinnedStartCols?: number; pinnedEndCols?: number; pinnedLimit?: number | null; colCount?: number; frozenTopRows?: number; frozenBottomRows?: number; frozenLimit?: number | null; dataLength?: number; }; }; export interface LayoutHost extends Pick, GridPluginHost { getSignals(): GridSignals; getViewportInfo(): ViewportInfo; removeNode(node: HTMLElement): void; readonly refs: GridLayoutRefs; } export interface LayoutEngine { layoutName: string; init(host: LayoutHost): void; destroy(): void; adjustFrozenRowsOption?(): void; afterSetOptions(args: GridOptions): void; /** this might be called before init, chicken egg situation */ reorderViewColumns?(viewCols: Column[], refs: GridLayoutRefs): Column[]; supportPinnedCols?: boolean; supportPinnedEnd?: boolean; supportFrozenRows?: boolean; supportFrozenBottom?: boolean; } /*** * Information about a group of rows. */ export declare class Group extends NonDataRow { readonly __group = true; /** * Grouping level, starting with 0. * @property level * @type {Number} */ level: number; /*** * Number of rows in the group. * @property count * @type {Number} */ count: number; /*** * Grouping value. * @property value * @type {Object} */ value: any; /*** * Whether a group is collapsed. * @property collapsed * @type {Boolean} */ collapsed: boolean; /*** * GroupTotals, if any. * @property totals * @type {GroupTotals} */ totals: GroupTotals; /** * Rows that are part of the group. * @property rows * @type {Array} */ rows: TEntity[]; /** * Sub-groups that are part of the group. * @property groups * @type {Array} */ groups: Group[]; /** * A unique key used to identify the group. This key can be used in calls to DataView * collapseGroup() or expandGroup(). * @property groupingKey * @type {Object} */ groupingKey: string; /** Returns a text representation of the group value. */ formatValue: (ctx: FormatterContext>) => FormatterResult; /*** * Compares two Group instances. * @return {Boolean} * @param group {Group} Group instance to compare to. */ equals(group: Group): boolean; } export interface IGroupTotals { __nonDataRow?: boolean; __groupTotals?: boolean; group?: Group; initialized?: boolean; sum?: Record; avg?: Record; min?: Record; max?: Record; } /*** * Information about group totals. * An instance of GroupTotals will be created for each totals row and passed to the aggregators * so that they can store arbitrary data in it. That data can later be accessed by group totals * formatters during the display. * @class GroupTotals * @extends NonDataRow */ export declare class GroupTotals extends NonDataRow implements IGroupTotals { readonly __groupTotals = true; /*** * Parent Group. * @param group * @type {Group} */ group: Group; /*** * Whether the totals have been fully initialized / calculated. * Will be set to false for lazy-calculated group totals. * @param initialized * @type {Boolean} */ initialized: boolean; /** * Contains sum */ sum?: Record; /** * Contains avg */ avg?: Record; /** * Contains min */ min?: Record; /** * Contains max */ max?: Record; } /** * Configuration options for the SleekGrid component. * * @template TItem - The type of items in the grid. */ export interface GridOptions { /** * CSS class applied to newly added rows for custom styling. Default is `"new-row"`. */ addNewRowCssClass?: string; /** * Defaults to `false`. If `true`, a horizontal scrollbar is always visible regardless of content width. */ alwaysAllowHorizontalScroll?: boolean; /** * Defaults to `false`. If `true`, a vertical scrollbar is always visible, useful for fixed-height grids or menus. */ alwaysShowVerticalScroll?: boolean; /** * Defaults to `100`. Delay in milliseconds before asynchronous loading of editors. */ asyncEditorLoadDelay?: number; /** * Defaults to `false`. If `true`, editors are loaded asynchronously, reducing initial rendering load. */ asyncEditorLoading?: boolean; /** * Defaults to `40`. Delay in milliseconds before cleaning up post-rendered elements. */ asyncPostCleanupDelay?: number; /** * Defaults to `-1` which means immediate execution. Delay in milliseconds before starting asynchronous post-rendering. */ asyncPostRenderDelay?: number; /** * Defaults to `true`. If `true`, automatically opens the cell editor when a cell gains focus. */ autoEdit?: boolean; /** * Defaults to `false`. If `true`, automatically adjusts the grid's height to fit the entire content without scrolling. */ autoHeight?: boolean; /** * CSS class applied to cells with a flashing effect. Default is `"flashing"`. */ cellFlashingCssClass?: string; /** * Function to handle clearing a DOM node, used for custom cleanup logic. Default is `null`. */ emptyNode?: (node: Element) => void; /** * Array of column definitions for the grid. */ columns?: Column[]; /** * @deprecated Use showGroupingPanel option instead. */ createPreHeaderPanel?: boolean; /** * Function to extract column values from data items, used for custom copy buffer operations. Default is `null`. */ dataItemColumnValueExtractor?: (item: TItem, column: Column) => void; /** * Defaults to `80`. Default width of columns in pixels. */ defaultColumnWidth?: number; /** * Default formatting options for columns. Default is `defaultColumnFormat`. */ defaultFormat?: ColumnFormat; /** * Default formatter function for cells. */ defaultFormatter?: CompatFormatter; /** * Defaults to `false`. If `true`, cells can be edited inline. */ editable?: boolean; /** * Function to handle edit commands, useful for implementing custom undo support. Default is `null`. */ editCommandHandler?: (item: TItem, column: Column, command: EditCommand) => void; /** * Defaults to `false`. If `true`, enables navigation between cells using left and right arrow keys within the editor. */ editorCellNavOnLRKeys?: boolean; /** * Factory function for creating custom editors. Default is `null`. */ editorFactory?: EditorFactory; /** * Global editor lock instance, used for managing concurrent editor access. Default is `GlobalEditorLock`. */ editorLock?: EditorLock; /** * Defaults to `false`. If `true`, enables the ability to add new rows to the grid. */ enableAddRow?: boolean; /** * Defaults to `false`. If `true`, enables asynchronous post-rendering. */ enableAsyncPostRender?: boolean; /** * Defaults to `false`. If `true`, enables cleanup after asynchronous post-rendering. */ enableAsyncPostRenderCleanup?: boolean; /** * Defaults to `true`. If `true`, enables cell navigation with arrow keys. */ enableCellNavigation?: boolean; /** * Defaults to `false`. If `true`, allows selection of cell ranges. */ enableCellRangeSelection?: boolean; /** * Defaults to `true`. If `true`, enables column reordering. */ enableColumnReorder?: boolean; /** * Allow returning raw HTML strings from formatters and use `innerHTML` to render them. Defaults to `false` for tighter security. * It is recommended to leave this as `false` for better security and to avoid XSS vulnerabilities. In that case, formatters should return plain text or DOM elements. */ enableHtmlRendering?: boolean; /** * Defaults to `false`. If `true`, enables row reordering. */ enableRowReordering?: boolean; /** * Defaults to `true`. If `true`, enables navigation between cells using the Tab key. */ enableTabKeyNavigation?: boolean; /** * Defaults to `false`. If `true`, enables text selection within cells. */ enableTextSelectionOnCells?: boolean; /** * Defaults to `false`. If `true`, requires explicit initialization of the grid. */ explicitInitialization?: boolean; /** * Defaults to null which means the footer row height is calculated based on CSS rules. */ footerRowHeight?: number; /** * Defaults to `false`. If `true`, forces columns to fit the grid width. */ forceFitColumns?: boolean; /** * Defaults to `false`. If `true`, synchronizes scrolling between the grid and its container. */ forceSyncScrolling?: boolean; /** * Defaults to `250`. Interval in milliseconds for synchronizing scrolling when `forceSyncScrolling` is enabled. */ forceSyncScrollInterval?: number; /** * Factory function for creating custom formatters. Default is `null`. */ formatterFactory?: FormatterFactory; /** * Defaults to `false`. If `true`, places frozen rows at the bottom edge of the grid. */ frozenBottom?: boolean | number; /** * Defaults to `undefined`. If specified, freezes the given number of columns on the left edge of the grid. * Prefer setting column.frozen = 'true' for individual columns as this is only for compatibility. */ frozenColumns?: number; /** * Defaults to `undefined`. If specified, freezes the given number of rows at the top or bottom * edge (if frozenBottom === true). */ frozenRows?: number; /** * Defaults to `false`. If `true`, makes rows take the full width of the grid. */ fullWidthRows?: boolean; /** * Defaults to `false`. If `true`, shows the grouping panel for grouping columns. */ groupingPanel?: boolean; /** * Defaults to null, e.g. calculated based on CSS. Height of the grouping panel in pixels. */ groupingPanelHeight?: number; /** * Function to format group totals for display in the grouping panel. */ groupTotalsFormat?: (ctx: FormatterContext>) => FormatterResult; /** * Function to format group totals for display in the grouping panel. * @deprecated Use `groupTotalsFormat` with `FormatterContext` signature instead. */ groupTotalsFormatter?: (totals?: IGroupTotals, column?: Column, grid?: ISleekGrid) => string; /** * Defaults to null, e.g. calculated based on CSS. Height of the header row in pixels. */ headerRowHeight?: number; /** * jQuery object for compatibility or custom integration purposes. Default is `undefined` unless jQuery is available in the global object (e.g. window). */ jQuery?: { ready: any; fn: any; }; /** * Defaults to `false`. If `true`, leaves space for new rows in the DOM visible buffer. */ leaveSpaceForNewRows?: boolean; /** * Layout engine for custom grid layouts. Default is `BasicLayout`. Use FrozenLayout to enable frozen columns / rows. */ layoutEngine?: LayoutEngine | (() => LayoutEngine); /** * Defaults to `3`. Minimum number of rows to keep in the buffer. */ minBuffer?: number; /** * Defaults to `false`. If `true`, allows sorting by multiple columns simultaneously. */ multiColumnSort?: boolean; /** * Defaults to `true`. If `true`, enables multiple cell selection. */ multiSelect?: boolean; /** * @deprecated Use groupingPanelHeight option instead. */ preHeaderPanelHeight?: number; /** * Defaults to `false`. If `true`, renders all cells (row columns) in the viewport, at the cost of higher memory usage and reduced performance. */ renderAllCells?: boolean; /** * Defaults to `false`. If `true`, renders all rows in the viewport, at the cost of higher memory usage and reduced performance. * When both renderAllCells and renderAllRows are true, all cells in the grid are rendered (e.g. virtualization is disabled), * which can be very slow for large datasets, but may be desired to keep all rows and cells in the DOM for accessibility purposes, * proper tabbing and screen reader support. */ renderAllRows?: boolean; /** * Function to handle removing a DOM node, used for custom cleanup logic. Default is `null` or jQuery.remove if available. */ removeNode?: (node: Element) => void; /** * Defaults to `30`. Height of rows in pixels. */ rowHeight?: number; /** * Default is based on document element's (``) `dir` property.. If `true`, enables right-to-left text direction. */ rtl?: boolean; /** * Optional function for sanitizing HTML strings to avoid XSS attacks. * Default is `DOMPurify.sanitize` if available globally, otherwise falls back to `basicDOMSanitizer`. */ sanitizer?: (dirtyHtml: string) => string; /** * CSS class applied to selected cells. Default is `"selected"`. */ selectedCellCssClass?: string; /** * Defaults to `true`. If `true`, shows cell selection indicators. */ showCellSelection?: boolean; /** * Defaults to `true`. If `true`, displays the column header. */ showColumnHeader?: boolean; /** * Defaults to `false`. If `true`, displays the footer row. */ showFooterRow?: boolean; /** * Defaults to `false`. If `true`, displays the grouping panel. */ showGroupingPanel?: boolean; /** * Defaults to `false`. If `true`, displays the header row. */ showHeaderRow?: boolean; /** * @deprecated Use showGroupingPanel option instead. */ showPreHeaderPanel?: boolean; /** * Defaults to `false`. If `true`, displays the post-header panel for additional controls or information. */ showTopPanel?: boolean; /** * Defaults to `false`. If `true`, suppresses the activation of cells when they contain an editor and are clicked. */ suppressActiveCellChangeOnEdit?: boolean; /** * Nonce value for CSP (Content Security Policy) when `useCssVars` is `false`. Applied to the dynamically * created `