/** * Contains core SlickGrid classes. * @module Core * @namespace Slick */ import { type CSSStyleDeclarationWritable } from '@slickgrid-universal/utils'; import type { MergeTypes } from '../enums/index.js'; import type { DragRange, EditController } from '../interfaces/index.js'; import type { SlickGrid } from './slickGrid.js'; export type Handler = (e: SlickEventData, args: ArgType) => void; export interface BasePubSub { publish(_eventName: string | any, _data?: ArgType, delay?: number, assignEventCallback?: any): any; subscribe(_eventName: string | string[] | Function, _callback: (data: ArgType) => void): any; unsubscribeAll(): 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.

* @class EventData * @constructor */ export declare class SlickEventData { protected event?: Event | null | undefined; protected args?: ArgType | undefined; protected _arguments?: ArgType; protected _isPropagationStopped: boolean; protected _isImmediatePropagationStopped: boolean; protected _isDefaultPrevented: boolean; protected returnValue: any; protected _eventTarget?: EventTarget | null; nativeEvent?: Event | null; readonly altKey?: boolean; readonly ctrlKey?: boolean; readonly metaKey?: boolean; readonly shiftKey?: boolean; readonly key?: string; readonly keyCode?: number; readonly clientX?: number; readonly clientY?: number; readonly offsetX?: number; readonly offsetY?: number; readonly pageX?: number; readonly pageY?: number; readonly bubbles?: boolean; readonly target?: HTMLElement; readonly type?: string; readonly which?: number; readonly x?: number; readonly y?: number; get defaultPrevented(): boolean; constructor(event?: Event | null | undefined, args?: ArgType | undefined); /** * Stops event from propagating up the DOM tree. * @method stopPropagation */ stopPropagation(): void; /** * Returns whether stopPropagation was called on this event object. * @method isPropagationStopped * @return {Boolean} */ isPropagationStopped(): boolean; /** * Prevents the rest of the handlers from being executed. * @method stopImmediatePropagation */ stopImmediatePropagation(): void; /** * Returns whether stopImmediatePropagation was called on this event object.\ * @method isImmediatePropagationStopped * @return {Boolean} */ isImmediatePropagationStopped(): boolean; getNativeEvent(): E; preventDefault(): void; isDefaultPrevented(): boolean; addReturnValue(value: any): void; getReturnValue(): any; getArguments(): ArgType | undefined; resetReturnValue(): void; } /** * A simple publisher-subscriber implementation. * @class Event * @constructor */ export declare class SlickEvent { protected readonly eventName?: string | undefined; protected readonly pubSub?: BasePubSub | undefined; protected _handlers: Handler[]; protected _pubSubService?: BasePubSub; get subscriberCount(): number; /** * Constructor * @param {String} [eventName] - event name that could be used for dispatching CustomEvent (when enabled) * @param {BasePubSub} [pubSubService] - event name that could be used for dispatching CustomEvent (when enabled) */ constructor(eventName?: string | undefined, pubSub?: BasePubSub | undefined); /** * 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.

* @method subscribe * @param {Function} fn - Event handler. */ subscribe(fn: Handler): void; /** * Removes an event handler added with subscribe(fn). * @method unsubscribe * @param {Function} [fn] - Event handler to be removed. */ unsubscribe(fn?: Handler): void; /** * Fires an event notifying all subscribers. * @method notify * @param {Object} args Additional data object to be passed to all handlers. * @param {EventData} [event] - An EventData object to be passed to all handlers. * For DOM events, an existing W3C event object can be passed in. * @param {Object} [scope] - The scope ("this") within which the handler will be executed. * If not specified, the scope will be set to the Event instance. */ notify(args: ArgType, evt?: SlickEventData | Event | MergeTypes | null, scope?: any, ignorePrevEventDataValue?: boolean): SlickEventData; setPubSubService(pubSub: BasePubSub): void; } export declare class SlickEventHandler { protected handlers: Array<{ event: SlickEvent; handler: Handler; }>; get subscriberCount(): number; subscribe(event: SlickEvent, handler: Handler): SlickEventHandler; unsubscribe(event: SlickEvent, handler: Handler): SlickEventHandler | void; unsubscribeAll(): SlickEventHandler; } /** * A structure containing a range of cells. * @class Range * @constructor * @param fromRow {Integer} Starting row. * @param fromCell {Integer} Starting cell. * @param toRow {Integer} Optional. Ending row. Defaults to fromRow. * @param toCell {Integer} Optional. Ending cell. Defaults to fromCell. */ export declare class SlickRange { fromRow: number; fromCell: number; toCell: number; toRow: number; constructor(fromRow: number, fromCell: number, toRow?: number, toCell?: number); /** * Returns whether a range represents a single cell. * @method isSingleCell * @return {Boolean} */ isSingleCell(): boolean; /** * Returns whether a range represents a single row. * @method isSingleRow * @return {Boolean} */ isSingleRow(): boolean; /** * Returns whether a range contains a given cell. * @method contains * @param row {Integer} * @param cell {Integer} * @return {Boolean} */ contains(row: number, cell: number): boolean; /** * Row Count. * @method rowCount * @return {Number} */ rowCount(): number; /** * Cell Count. * @method cellCount * @return {Number} */ cellCount(): number; /** * Returns a readable representation of a range. * @method toString * @return {String} */ toString(): string; } /** * A structure containing a range of cells to copy to. * @class SlickCopyRange * @constructor * @param {Integer} fromRow Starting row. * @param {Integer} fromCell Starting cell. * @param {Integer} rowCount Row Count. * @param {Integer} cellCount Cell Count. */ export declare class SlickCopyRange { fromRow: number; fromCell: number; rowCount: number; cellCount: number; constructor(fromRow: number, fromCell: number, rowCount: number, cellCount: number); } /** * Create a handle element for Excel style drag-replace * @class DragExtendHandle * @constructor * @param gridUid {String} string UID of parent grid */ export declare class SlickDragExtendHandle { id: string; cssClass: string; constructor(gridUid: string); removeEl(): void; createEl(activeCellNode: HTMLDivElement | null): void; } /** * A base class that all special / non-data rows (like Group and GroupTotals) derive from. * @class NonDataItem * @constructor */ export declare class SlickNonDataItem { __nonDataRow: boolean; } /** * Information about a group of rows. * @class Group * @extends SlickNonDataItem * @constructor */ export declare class SlickGroup extends SlickNonDataItem { __group: boolean; /** * Grouping level, starting with 0. * @property level * @type {Number} */ level: number; /** * Number of rows in the group. * @property count * @type {Integer} */ count: number; /** * Grouping value. * @property value * @type {Object} */ value: any; /** * Formatted display value of the group. * @property title * @type {String} */ title: string | null; /** * Whether a group is collapsed. * @property collapsed * @type {Boolean} */ collapsed: boolean | number; /** * Whether a group selection checkbox is checked. * @property selectChecked * @type {Boolean} */ selectChecked: boolean; /** * GroupTotals, if any. * @property totals * @type {GroupTotals} */ totals: SlickGroupTotals; /** * Rows that are part of the group. * @property rows * @type {Array} */ rows: any[]; /** * Sub-groups that are part of the group. * @property groups * @type {Array} */ groups: SlickGroup[]; /** * A unique key used to identify the group. * This key can be used in calls to DataView `collapseGroup()` or `expandGroup()`. * @property groupingKey * @type {String} */ groupingKey: string; constructor(); /** * Compares two Group instances. * @method equals * @return {Boolean} * @param group {Group} Group instance to compare to. */ equals(group: SlickGroup): boolean; } /** * 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 SlickNonDataItem * @constructor */ export declare class SlickGroupTotals extends SlickNonDataItem { __groupTotals: boolean; /** * Parent Group. * @param group * @type {Group} */ group: SlickGroup | null; /** * Whether the totals have been fully initialized / calculated. * Will be set to false for lazy-calculated group totals. * @param initialized * @type {Boolean} */ initialized: boolean; constructor(); } /** * 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 SlickGrid) can query if an active edit is in progress * and attempt a commit or cancel before proceeding. * @class EditorLock * @constructor */ export declare class SlickEditorLock { activeEditController: EditController | null; /** * 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. * @method isActive * @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 throw new Error(. * @method activate * @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 throw new Error(. * @method deactivate * @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. * @method commitCurrentEdit * @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. * @method cancelCurrentEdit * @return {Boolean} */ cancelCurrentEdit(): boolean; } export declare class Utils { static storage: { _storage: WeakMap; put: (element: any, key: string, obj: any) => void; get: (element: any, key: string) => any; remove: (element: any, key: string) => any; }; static height(el: HTMLElement, value?: number | string): number | void; static width(el: HTMLElement, value?: number | string): number | void; static setStyleSize

(el: HTMLElement, style: keyof P, val?: number | string | Function): void; static isHidden(el: HTMLElement): boolean; static parents(el: HTMLElement | ParentNode, selector?: string): Array; static toFloat(value: string | number): number; static show(el: HTMLElement | HTMLElement[], type?: string): void; static hide(el: HTMLElement | HTMLElement[]): void; static applyDefaults(targetObj: any, srcObj: any): void; /** * User could optionally add PubSub Service to SlickEvent * When it is defined then a SlickEvent `notify()` call will also dispatch it by using the PubSub publish() method * @param {BasePubSub} [pubSubService] * @param {*} scope */ static addSlickEventPubSubWhenDefined(pubSub: BasePubSub, scope: T): void; } export declare class SlickSelectionUtils { static normaliseDragRange(rawRange: DragRange): DragRange; static copyRangeIsLarger(baseRange: SlickRange, copyToRange: SlickRange): boolean; static normalRangeOppositeCellFromCopy(normalisedDragRange: DragRange, targetCell: { row: number; cell: number; }): { row: number; cell: number; }; /** copy to range above or below - includes corner space target range */ static verticalTargetRange(baseRange: SlickRange, copyToRange: SlickRange): SlickRange | null; /** copy to range left or right - excludes corner space target range */ static horizontalTargetRange(baseRange: SlickRange, copyToRange: SlickRange): SlickRange | null; /** copy to corner space target range */ static cornerTargetRange(baseRange: SlickRange, copyToRange: SlickRange): SlickRange | null; static copyCellsToTargetRange(baseRange: SlickRange, targetRange: SlickRange, grid: SlickGrid): void; } export declare const SlickGlobalEditorLock: SlickEditorLock; export declare const preClickClassName = "slick-edit-preclick"; //# sourceMappingURL=slickCore.d.ts.map