slickgrid
Advanced tools
Comparing version 5.14.3 to 5.15.0
@@ -88,11 +88,13 @@ "use strict"; | ||
isKeyAllowed(key) { | ||
return ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "PageDown", "PageUp", "Home", "End"].some((k) => k === key); | ||
return ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "PageDown", "PageUp", "Home", "End", "a", "A"].some((k) => k === key); | ||
} | ||
handleKeyDown(e) { | ||
var _a; | ||
var _a, _b; | ||
let ranges, last, colLn = this._grid.getColumns().length, active = this._grid.getActiveCell(), dataLn = 0; | ||
if (this._dataView && "getPagingInfo" in this._dataView ? dataLn = ((_a = this._dataView) == null ? void 0 : _a.getPagingInfo().pageSize) || this._dataView.getLength() : dataLn = this._grid.getDataLength(), active && (e.shiftKey || e.ctrlKey) && !e.altKey && this.isKeyAllowed(e.key)) { | ||
ranges = this.getSelectedRanges().slice(), ranges.length || ranges.push(new SlickRange(active.row, active.cell)), last = ranges.pop(), last.contains(active.row, active.cell) || (last = new SlickRange(active.row, active.cell)); | ||
let dRow = last.toRow - last.fromRow, dCell = last.toCell - last.fromCell, dirRow = active.row === last.fromRow ? 1 : -1, dirCell = active.cell === last.fromCell ? 1 : -1, isSingleKeyMove = e.key.startsWith("Arrow"), toCell, toRow = 0; | ||
isSingleKeyMove && !e.ctrlKey ? (e.key === "ArrowLeft" ? dCell -= dirCell : e.key === "ArrowRight" ? dCell += dirCell : e.key === "ArrowUp" ? dRow -= dirRow : e.key === "ArrowDown" && (dRow += dirRow), toRow = active.row + dirRow * dRow) : (this._cachedPageRowCount < 1 && (this._cachedPageRowCount = this._grid.getViewportRowCount()), this._prevSelectedRow === void 0 && (this._prevSelectedRow = active.row), e.shiftKey && !e.ctrlKey && e.key === "Home" ? (toCell = 0, toRow = active.row) : e.shiftKey && !e.ctrlKey && e.key === "End" ? (toCell = colLn - 1, toRow = active.row) : e.ctrlKey && e.shiftKey && e.key === "Home" ? (toCell = 0, toRow = 0) : e.ctrlKey && e.shiftKey && e.key === "End" ? (toCell = colLn - 1, toRow = dataLn - 1) : e.key === "PageUp" ? (this._prevSelectedRow >= 0 && (toRow = this._prevSelectedRow - this._cachedPageRowCount), toRow < 0 && (toRow = 0)) : e.key === "PageDown" && (this._prevSelectedRow <= dataLn - 1 && (toRow = this._prevSelectedRow + this._cachedPageRowCount), toRow > dataLn - 1 && (toRow = dataLn - 1)), this._prevSelectedRow = toRow), toCell != null || (toCell = active.cell + dirCell * dCell); | ||
let dRow = last.toRow - last.fromRow, dCell = last.toCell - last.fromCell, toCell, toRow = 0; | ||
e.ctrlKey && ((_b = e.key) == null ? void 0 : _b.toLowerCase()) === "a" && (this._grid.setActiveCell(0, 0, !1, !1, !0), active.row = 0, active.cell = 0, toCell = colLn - 1, toRow = dataLn - 1); | ||
let dirRow = active.row === last.fromRow ? 1 : -1, dirCell = active.cell === last.fromCell ? 1 : -1, isSingleKeyMove = e.key.startsWith("Arrow"); | ||
isSingleKeyMove && !e.ctrlKey ? (e.key === "ArrowLeft" ? dCell -= dirCell : e.key === "ArrowRight" ? dCell += dirCell : e.key === "ArrowUp" ? dRow -= dirRow : e.key === "ArrowDown" && (dRow += dirRow), toRow = active.row + dirRow * dRow) : (this._cachedPageRowCount < 1 && (this._cachedPageRowCount = this._grid.getViewportRowCount()), this._prevSelectedRow === void 0 && (this._prevSelectedRow = active.row), !e.ctrlKey && e.shiftKey && e.key === "Home" || e.ctrlKey && e.shiftKey && e.key === "ArrowLeft" ? (toCell = 0, toRow = active.row) : !e.ctrlKey && e.shiftKey && e.key === "End" || e.ctrlKey && e.shiftKey && e.key === "ArrowRight" ? (toCell = colLn - 1, toRow = active.row) : e.ctrlKey && e.shiftKey && e.key === "ArrowUp" ? toRow = 0 : e.ctrlKey && e.shiftKey && e.key === "ArrowDown" ? toRow = dataLn - 1 : e.ctrlKey && e.shiftKey && e.key === "Home" ? (toCell = 0, toRow = 0) : e.ctrlKey && e.shiftKey && e.key === "End" ? (toCell = colLn - 1, toRow = dataLn - 1) : e.key === "PageUp" ? (this._prevSelectedRow >= 0 && (toRow = this._prevSelectedRow - this._cachedPageRowCount), toRow < 0 && (toRow = 0)) : e.key === "PageDown" && (this._prevSelectedRow <= dataLn - 1 && (toRow = this._prevSelectedRow + this._cachedPageRowCount), toRow > dataLn - 1 && (toRow = dataLn - 1)), this._prevSelectedRow = toRow), toCell != null || (toCell = active.cell + dirCell * dCell); | ||
let new_last = new SlickRange(active.row, active.cell, toRow, toCell); | ||
@@ -99,0 +101,0 @@ if (this.removeInvalidRanges([new_last]).length) { |
@@ -12,2 +12,3 @@ "use strict"; | ||
__publicField(this, "defaults", { | ||
globalItemMetadataProvider: null, | ||
groupItemMetadataProvider: null, | ||
@@ -456,5 +457,6 @@ inlineFilters: !1, | ||
} | ||
getItemMetadata(i) { | ||
let item = this.rows[i]; | ||
return item === void 0 ? null : item.__group ? this._options.groupItemMetadataProvider.getGroupRowMetadata(item) : item.__groupTotals ? this._options.groupItemMetadataProvider.getTotalsRowMetadata(item) : null; | ||
getItemMetadata(row) { | ||
var _a2, _b2, _c; | ||
let item = this.rows[row]; | ||
return item === void 0 ? null : (_a2 = this._options.globalItemMetadataProvider) != null && _a2.getRowMetadata ? this._options.globalItemMetadataProvider.getRowMetadata(item, row) : item.__group && ((_b2 = this._options.groupItemMetadataProvider) != null && _b2.getGroupRowMetadata) ? this._options.groupItemMetadataProvider.getGroupRowMetadata(item, row) : item.__groupTotals && ((_c = this._options.groupItemMetadataProvider) != null && _c.getTotalsRowMetadata) ? this._options.groupItemMetadataProvider.getTotalsRowMetadata(item, row) : null; | ||
} | ||
@@ -461,0 +463,0 @@ expandCollapseAllGroups(level, collapse) { |
@@ -91,3 +91,3 @@ "use strict"; | ||
} | ||
getGroupRowMetadata(item) { | ||
getGroupRowMetadata(item, _row, _cell) { | ||
let groupLevel = item == null ? void 0 : item.level; | ||
@@ -108,3 +108,3 @@ return { | ||
} | ||
getTotalsRowMetadata(item) { | ||
getTotalsRowMetadata(item, _row, _cell) { | ||
var _a; | ||
@@ -111,0 +111,0 @@ let groupLevel = (_a = item == null ? void 0 : item.group) == null ? void 0 : _a.level; |
@@ -108,2 +108,4 @@ import type { AutoSize, CellMenuOption, CustomTooltipOption, Editor, EditorConstructor, EditorValidator, Formatter, FormatterResultWithHtml, FormatterResultWithText, GroupTotalsFormatter, Grouping, HeaderButtonsOrMenu } from './index.js'; | ||
resizable?: boolean; | ||
/** Row span in cell count or use `*` to span across the entire row */ | ||
rowspan?: number; | ||
/** Is the column selectable? Goes with grid option "enableCellNavigation: true". */ | ||
@@ -110,0 +112,0 @@ selectable?: boolean; |
@@ -10,5 +10,5 @@ import type { Column as BaseColumn, CellMenuOption, ColumnPickerOption, ColumnReorderFunction, ContextMenuOption, CustomTooltipOption, EditCommand, EditorConstructor, ExcelCopyBufferOption, Formatter, GridMenuOption, ItemMetadata } from './index.js'; | ||
export interface CustomDataView<T = any> { | ||
getItem: (index: number) => T; | ||
getItemMetadata(row: number, cell?: boolean | number): ItemMetadata | null; | ||
getLength: () => number; | ||
getItem: (index: number) => T; | ||
getItemMetadata(index: number): ItemMetadata | null; | ||
} | ||
@@ -119,2 +119,8 @@ export interface CssStyleHash { | ||
/** | ||
* Do we want to enable cell rowspan? | ||
* Note: this is an opt-in option because of the multiple row/column/cells looping that it has to do | ||
* (which is at least an O^n3 but only for visible range) | ||
*/ | ||
enableCellRowSpan?: boolean; | ||
/** | ||
* Defaults to true, this option can be a boolean or a Column Reorder function. | ||
@@ -183,2 +189,7 @@ * When provided as a boolean, it will permits the user to move an entire column from a position to another. | ||
logSanitizedHtml?: boolean; | ||
/** | ||
* Defaults to 5000, max number of rows that we'll consider doing a partial rowspan remapping. | ||
* Anything else will be considered to require a full rowspan remap when necessary | ||
*/ | ||
maxPartialRowSpanRemap?: number; | ||
/** Max supported CSS height */ | ||
@@ -188,2 +199,4 @@ maxSupportedCssHeight?: number; | ||
minRowBuffer?: number; | ||
/** What is the maximum row buffer to use? */ | ||
maxRowBuffer?: number; | ||
/** Use a mixin function when applying defaults to passed in option and columns objects, rather than creating a new object, so as not to break references */ | ||
@@ -190,0 +203,0 @@ mixinDefaults?: boolean; |
import type { Formatter } from './index.js'; | ||
export interface ItemMetadataProvider { | ||
getRowMetadata(item: any, row?: number): any; | ||
} | ||
export interface GroupItemMetadataProviderOption { | ||
@@ -3,0 +6,0 @@ /** Whether or not we want to use group select checkbox. */ |
@@ -27,3 +27,2 @@ export type * from './aggregator.interface.js'; | ||
export type * from './editorValidator.interface.js'; | ||
export type * from './elementPosition.interface.js'; | ||
export type * from './excelCopyBufferOption.interface.js'; | ||
@@ -52,3 +51,2 @@ export type * from './externalCopyClipCommand.interface.js'; | ||
export type * from './headerMenuOption.interface.js'; | ||
export type * from './htmlElementPosition.interface.js'; | ||
export type * from './infer.type.js'; | ||
@@ -67,2 +65,3 @@ export type * from './interactions.interface.js'; | ||
export type * from './pagingInfo.interface.js'; | ||
export type * from './position.interface.js'; | ||
export type * from './positionMethod.type.js'; | ||
@@ -69,0 +68,0 @@ export type * from './resizerOption.interface.js'; |
import type { Column, Editor, Formatter, GroupTotalsFormatter } from './index.js'; | ||
export type ColumnMetadata = Pick<Column, 'colspan' | 'rowspan' | 'cssClass' | 'editor' | 'focusable' | 'formatter' | 'selectable'>; | ||
/** | ||
@@ -20,5 +21,5 @@ * Provides a powerful way of specifying additional information about a data item that let the grid customize the appearance | ||
columns?: { | ||
[colIdOrIdx in string | number]: Pick<Column, 'colspan' | 'editor' | 'focusable' | 'formatter' | 'selectable'>; | ||
[colIdOrIdx in string | number]: ColumnMetadata; | ||
}; | ||
} | ||
//# sourceMappingURL=itemMetadata.interface.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import type { ElementPosition } from './elementPosition.interface.js'; | ||
import type { ElementPosition } from './position.interface.js'; | ||
export type PositionMethod = () => ElementPosition; | ||
//# sourceMappingURL=positionMethod.type.d.ts.map |
@@ -1,5 +0,7 @@ | ||
import type { Aggregator, CustomDataView, DataViewHints, Grouping, ItemMetadata, OnGroupCollapsedEventArgs, OnGroupExpandedEventArgs, OnRowCountChangedEventArgs, OnRowsChangedEventArgs, OnRowsOrCountChangedEventArgs, OnSelectedRowIdsChangedEventArgs, OnSetItemsCalledEventArgs, PagingInfo, SlickGridModel } from './models/index.js'; | ||
import type { Aggregator, CustomDataView, DataViewHints, Grouping, ItemMetadata, ItemMetadataProvider, OnGroupCollapsedEventArgs, OnGroupExpandedEventArgs, OnRowCountChangedEventArgs, OnRowsChangedEventArgs, OnRowsOrCountChangedEventArgs, OnSelectedRowIdsChangedEventArgs, OnSetItemsCalledEventArgs, PagingInfo, SlickGridModel } from './models/index.js'; | ||
import { type BasePubSub, SlickEvent as SlickEvent_, SlickGroup as SlickGroup_, SlickGroupTotals as SlickGroupTotals_, type SlickNonDataItem } from './slick.core.js'; | ||
import { SlickGroupItemMetadataProvider as SlickGroupItemMetadataProvider_ } from './slick.groupitemmetadataprovider.js'; | ||
export interface DataViewOption { | ||
/** global override for all rows */ | ||
globalItemMetadataProvider: ItemMetadataProvider | null; | ||
/** Optionally provide a GroupItemMetadataProvider in order to use Grouping/DraggableGrouping features */ | ||
@@ -226,3 +228,3 @@ groupItemMetadataProvider: SlickGroupItemMetadataProvider_ | null; | ||
getItem<T extends TData>(i: number): T; | ||
getItemMetadata(i: number): ItemMetadata | null; | ||
getItemMetadata(row: number): ItemMetadata | null; | ||
protected expandCollapseAllGroups(level?: number, collapse?: boolean): void; | ||
@@ -229,0 +231,0 @@ /** |
import type SortableInstance from 'sortablejs'; | ||
import type { AutoSize, CellViewportRange, Column, ColumnSort, CssStyleHash, CustomDataView, DOMEvent, DragPosition, DragRowMove, Editor, EditorConstructor, EditController, Formatter, FormatterResultWithHtml, FormatterResultWithText, GridOption as BaseGridOption, InteractionBase, MenuCommandItemCallbackArgs, MultiColumnSort, OnActivateChangedOptionsEventArgs, OnActiveCellChangedEventArgs, OnAddNewRowEventArgs, OnAutosizeColumnsEventArgs, OnBeforeUpdateColumnsEventArgs, OnBeforeAppendCellEventArgs, OnBeforeCellEditorDestroyEventArgs, OnBeforeColumnsResizeEventArgs, OnBeforeEditCellEventArgs, OnBeforeHeaderCellDestroyEventArgs, OnBeforeHeaderRowCellDestroyEventArgs, OnBeforeFooterRowCellDestroyEventArgs, OnBeforeSetColumnsEventArgs, OnCellChangeEventArgs, OnCellCssStylesChangedEventArgs, OnClickEventArgs, OnColumnsDragEventArgs, OnColumnsReorderedEventArgs, OnColumnsResizedEventArgs, OnColumnsResizeDblClickEventArgs, OnCompositeEditorChangeEventArgs, OnDblClickEventArgs, OnFooterContextMenuEventArgs, OnFooterRowCellRenderedEventArgs, OnHeaderCellRenderedEventArgs, OnFooterClickEventArgs, OnHeaderClickEventArgs, OnHeaderContextMenuEventArgs, OnHeaderMouseEventArgs, OnHeaderRowCellRenderedEventArgs, OnKeyDownEventArgs, OnPreHeaderContextMenuEventArgs, OnPreHeaderClickEventArgs, OnRenderedEventArgs, OnSelectedRowsChangedEventArgs, OnSetOptionsEventArgs, OnScrollEventArgs, OnValidationErrorEventArgs, PagingInfo, RowInfo, SelectionModel, SingleColumnSort, SlickPlugin } from './models/index.js'; | ||
import type { AutoSize, CellPosition, CellViewportRange, Column, ColumnMetadata, ColumnSort, CssStyleHash, CustomDataView, DOMEvent, DragPosition, DragRowMove, Editor, EditorConstructor, EditController, Formatter, FormatterResultWithHtml, FormatterResultWithText, GridOption as BaseGridOption, InteractionBase, ItemMetadata, MenuCommandItemCallbackArgs, MultiColumnSort, OnActivateChangedOptionsEventArgs, OnActiveCellChangedEventArgs, OnAddNewRowEventArgs, OnAutosizeColumnsEventArgs, OnBeforeUpdateColumnsEventArgs, OnBeforeAppendCellEventArgs, OnBeforeCellEditorDestroyEventArgs, OnBeforeColumnsResizeEventArgs, OnBeforeEditCellEventArgs, OnBeforeHeaderCellDestroyEventArgs, OnBeforeHeaderRowCellDestroyEventArgs, OnBeforeFooterRowCellDestroyEventArgs, OnBeforeSetColumnsEventArgs, OnCellChangeEventArgs, OnCellCssStylesChangedEventArgs, OnClickEventArgs, OnColumnsDragEventArgs, OnColumnsReorderedEventArgs, OnColumnsResizedEventArgs, OnColumnsResizeDblClickEventArgs, OnCompositeEditorChangeEventArgs, OnDblClickEventArgs, OnFooterContextMenuEventArgs, OnFooterRowCellRenderedEventArgs, OnHeaderCellRenderedEventArgs, OnFooterClickEventArgs, OnHeaderClickEventArgs, OnHeaderContextMenuEventArgs, OnHeaderMouseEventArgs, OnHeaderRowCellRenderedEventArgs, OnKeyDownEventArgs, OnPreHeaderContextMenuEventArgs, OnPreHeaderClickEventArgs, OnRenderedEventArgs, OnSelectedRowsChangedEventArgs, OnSetOptionsEventArgs, OnScrollEventArgs, OnValidationErrorEventArgs, PagingInfo, RowInfo, SelectionModel, SingleColumnSort, SlickPlugin } from './models/index.js'; | ||
import { type BasePubSub, BindingEventService as BindingEventService_, type SlickEditorLock, SlickEvent as SlickEvent_, SlickEventData as SlickEventData_, SlickRange as SlickRange_ } from './slick.core.js'; | ||
@@ -13,3 +13,3 @@ /** | ||
* | ||
* SlickGrid v5.14.3 | ||
* SlickGrid v5.15.0 | ||
* | ||
@@ -193,2 +193,3 @@ * NOTES: | ||
protected activePosX: number; | ||
protected activePosY: number; | ||
protected activeRow: number; | ||
@@ -200,3 +201,9 @@ protected activeCell: number; | ||
protected editController?: EditController; | ||
protected rowsCache: Array<RowCaching>; | ||
protected _prevDataLength: number; | ||
protected _prevInvalidatedRowsCount: number; | ||
protected _rowSpanIsCached: boolean; | ||
protected _colsWithRowSpanCache: { | ||
[colIdx: number]: Set<string>; | ||
}; | ||
protected rowsCache: Record<number, RowCaching>; | ||
protected renderedRows: number; | ||
@@ -226,3 +233,2 @@ protected numVisibleRows: number; | ||
protected h_editorLoader?: number; | ||
protected h_render: null; | ||
protected h_postrender?: number; | ||
@@ -440,2 +446,4 @@ protected h_postrenderCleanup?: number; | ||
protected setFrozenOptions(): void; | ||
/** add/remove frozen class to left headers/footer when defined */ | ||
protected setPaneFrozenClasses(): void; | ||
protected setPaneVisibility(): void; | ||
@@ -571,2 +579,8 @@ protected setOverflow(): void; | ||
getDataItem(i: number): TData; | ||
/** | ||
* Returns item metadata by a row index when it exists | ||
* @param {Number} row | ||
* @returns {ItemMetadata | null} | ||
*/ | ||
getItemMetadaWhenExists(row: number): ItemMetadata | null; | ||
/** Get Top Panel DOM element */ | ||
@@ -616,3 +630,5 @@ getTopPanel(): HTMLDivElement; | ||
getContainerNode(): HTMLElement; | ||
protected getRowHeight(): number; | ||
protected getRowTop(row: number): number; | ||
protected getRowBottom(row: number): number; | ||
protected getRowFromPosition(y: number): number; | ||
@@ -629,3 +645,3 @@ /** | ||
protected appendRowHtml(divArrayL: HTMLElement[], divArrayR: HTMLElement[], row: number, range: CellViewportRange, dataLength: number): void; | ||
protected appendCellHtml(divRow: HTMLElement, row: number, cell: number, colspan: number, item: TData): void; | ||
protected appendCellHtml(divRow: HTMLElement, row: number, cell: number, colspan: number, rowspan: number, columnMetadata: ColumnMetadata | null, item: TData): void; | ||
protected cleanupRows(rangeToKeep: { | ||
@@ -635,3 +651,37 @@ bottom: number; | ||
}): void; | ||
/** Invalidate all grid rows and re-render the grid rows */ | ||
/** | ||
* from a row number, return any column indexes that intersected with the grid row including the cell | ||
* @param {Number} row - grid row index | ||
*/ | ||
getRowSpanColumnIntersects(row: number): number[]; | ||
/** | ||
* from a row number, verify if the rowspan is intersecting and return it when found, | ||
* otherwise return `null` when nothing is found or when the rowspan feature is disabled. | ||
* @param {Number} row - grid row index | ||
*/ | ||
getRowSpanIntersect(row: number): number | null; | ||
protected getRowSpanIntersection<R>(row: number, outputType?: 'columns' | 'start'): R; | ||
/** | ||
* Returns the parent rowspan details when child cell are spanned from a rowspan or `null` when it's not spanned. | ||
* By default it will exclude the parent cell that holds the rowspan, and return `null`, that initiated the rowspan unless the 3rd argument is disabled. | ||
* The exclusion is helpful to find out when we're dealing with a child cell of a rowspan | ||
* @param {Number} row - grid row index | ||
* @param {Number} cell - grid cell/column index | ||
* @param {Boolean} [excludeParentRow] - should we exclude the parent who initiated the rowspan in the search (defaults to true)? | ||
*/ | ||
getParentRowSpanByCell(row: number, cell: number, excludeParentRow?: boolean): { | ||
start: number; | ||
end: number; | ||
range: string; | ||
} | null; | ||
/** | ||
* Remap all the rowspan metadata by looping through all dataset rows and keep a cache of rowspan by column indexes | ||
* For example: | ||
* 1- if 2nd row of the 1st column has a metadata.rowspan of 3 then the cache will be: `{ 0: '1:4' }` | ||
* 2- if 2nd row if the 1st column has a metadata.rowspan of 3 AND a colspan of 2 then the cache will be: `{ 0: '1:4', 1: '1:4' }` | ||
*/ | ||
protected remapAllColumnsRowSpan(): void; | ||
protected remapRowSpanMetadataByRow(row: number): void; | ||
protected remapRowSpanMetadata(row: number, cell: number, colspan: number, rowspan: number): void; | ||
/** Invalidate all grid rows and re-render the visible grid rows */ | ||
invalidate(): void; | ||
@@ -666,2 +716,3 @@ /** Invalidate all grid rows */ | ||
updateRow(row: number): void; | ||
getCellHeight(row: number, rowspan: number): number; | ||
/** | ||
@@ -708,2 +759,3 @@ * Get the number of rows displayed in the viewport | ||
protected cleanUpAndRenderCells(range: CellViewportRange): void; | ||
protected createEmptyCachingRow(): RowCaching; | ||
protected renderRows(range: { | ||
@@ -715,2 +767,4 @@ top: number; | ||
}): void; | ||
/** polyfill if the new Set.difference() added in ES2024 */ | ||
protected setDifference(a: Set<number>, b: Set<number>): Set<number>; | ||
protected startPostProcessing(): void; | ||
@@ -870,4 +924,6 @@ protected startPostProcessingCleanup(): void; | ||
} | null; | ||
/** Resets active cell. */ | ||
/** Resets active cell by making cell normal and other internal reset. */ | ||
resetActiveCell(): void; | ||
/** Clear active cell by making cell normal & removing "active" CSS class. */ | ||
unsetActiveCell(): void; | ||
/** @alias `setFocus` */ | ||
@@ -961,45 +1017,70 @@ focus(): void; | ||
navigateBottom(): void; | ||
protected navigateToRow(row: number): boolean; | ||
navigateToRow(row: number): boolean; | ||
protected getColspan(row: number, cell: number): number; | ||
protected findFirstFocusableCell(row: number): number | null; | ||
protected findLastFocusableCell(row: number): number | null; | ||
protected gotoRight(row: number, cell: number, _posX?: number): { | ||
protected getRowspan(row: number, cell: number): number; | ||
protected findFocusableRow(row: number, cell: number, dir: 'up' | 'down'): number; | ||
protected findFirstFocusableCell(row: number): { | ||
cell: number; | ||
row: number; | ||
}; | ||
protected findLastFocusableCell(row: number): { | ||
cell: number; | ||
row: number; | ||
}; | ||
/** | ||
* From any row/cell indexes that might have colspan/rowspan, find its starting indexes | ||
* For example, if we start at 0,0 and we have colspan/rowspan of 4 for both and our indexes is row:2,cell:3 | ||
* then our starting row/cell is 0,0. If a cell has no spanning at all then row/cell output is same as input | ||
*/ | ||
findSpanStartingCell(row: number, cell: number): { | ||
cell: number; | ||
row: number; | ||
}; | ||
protected gotoRight(_row: number, cell: number, posY: number, _posX?: number): { | ||
row: number; | ||
cell: number; | ||
posX: number; | ||
posY: number; | ||
} | null; | ||
protected gotoLeft(row: number, cell: number, _posX?: number): { | ||
protected gotoLeft(row: number, cell: number, posY: number, _posX?: number): { | ||
row: number; | ||
cell: number; | ||
posX: number; | ||
posY: number; | ||
} | null; | ||
protected gotoDown(row: number, cell: number, posX: number): { | ||
protected gotoDown(row: number, cell: number, _posY: number, posX: number): { | ||
row: number; | ||
cell: number; | ||
posX: number; | ||
posY: number; | ||
} | null; | ||
protected gotoUp(row: number, cell: number, posX: number): { | ||
protected gotoUp(row: number, cell: number, _posY: number, posX: number): { | ||
row: number; | ||
cell: number; | ||
posX: number; | ||
posY: number; | ||
} | null; | ||
protected gotoNext(row: number, cell: number, posX?: number): { | ||
protected gotoNext(row: number, cell: number, posY: number, posX: number): { | ||
row: number; | ||
cell: number; | ||
posX: number; | ||
posY: number; | ||
} | null; | ||
protected gotoPrev(row: number, cell: number, posX?: number): { | ||
protected gotoPrev(row: number, cell: number, posY: number, posX: number): { | ||
row: number; | ||
cell: number; | ||
posX: number; | ||
posY: number; | ||
} | null; | ||
protected gotoRowStart(row: number, _cell: number, _posX?: number): { | ||
protected gotoRowStart(row: number, _cell: number, _posY: number, _posX: number): { | ||
row: number; | ||
cell: number; | ||
posX: number; | ||
posY: number; | ||
} | null; | ||
protected gotoRowEnd(row: number, _cell: number, _posX?: number): { | ||
protected gotoRowEnd(row: number, _cell: number, _posY: number, _posX: number): { | ||
row: number; | ||
cell: number; | ||
posX: number; | ||
posY: number; | ||
} | null; | ||
@@ -1022,2 +1103,6 @@ /** Switches the active cell one cell right skipping unselectable cells. Unline navigateNext, navigateRight stops at the last cell of the row. Returns a boolean saying whether it was able to complete or not. */ | ||
navigateRowEnd(): boolean | undefined; | ||
/** Navigate to coordinate 0,0 (top left home) */ | ||
navigateTopStart(): boolean | undefined; | ||
/** Navigate to bottom row end (bottom right end) */ | ||
navigateBottomEnd(): boolean | undefined; | ||
/** | ||
@@ -1028,2 +1113,3 @@ * @param {string} dir Navigation direction. | ||
protected navigate(dir: 'up' | 'down' | 'left' | 'right' | 'prev' | 'next' | 'home' | 'end'): boolean | undefined; | ||
protected navigateToPos(pos: CellPosition | null): boolean | undefined; | ||
/** | ||
@@ -1030,0 +1116,0 @@ * Returns a DOM element containing a cell at a given row and cell. |
@@ -39,7 +39,7 @@ import { type SlickEventData } from './slick.core.js'; | ||
protected handleDataViewExpandOrCollapse(item: any): void; | ||
getGroupRowMetadata(item: GroupingFormatterItem): ItemMetadata; | ||
getGroupRowMetadata(item: GroupingFormatterItem, _row?: number, _cell?: number): ItemMetadata; | ||
getTotalsRowMetadata(item: { | ||
group: GroupingFormatterItem; | ||
}): ItemMetadata | null; | ||
}, _row?: number, _cell?: number): ItemMetadata | null; | ||
} | ||
//# sourceMappingURL=slick.groupitemmetadataprovider.d.ts.map |
{ | ||
"name": "slickgrid", | ||
"version": "5.14.3", | ||
"version": "5.15.0", | ||
"description": "A lightning fast JavaScript grid/spreadsheet", | ||
@@ -42,3 +42,3 @@ "main": "./dist/cjs/index.js", | ||
"dependencies": { | ||
"sortablejs": "^1.15.5" | ||
"sortablejs": "^1.15.6" | ||
}, | ||
@@ -45,0 +45,0 @@ "workspaces": [ |
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/) | ||
[![NPM downloads](https://img.shields.io/npm/dm/slickgrid.svg)](https://npmjs.org/package/slickgrid) | ||
[![npm bundle size](https://img.shields.io/bundlephobia/minzip/slickgrid?color=5dade2&label=gzip)](https://bundlephobia.com/result?p=slickgrid) | ||
[![jsdelivr hits/month](https://data.jsdelivr.com/v1/package/npm/slickgrid/badge)](https://www.jsdelivr.com/package/npm/slickgrid) | ||
@@ -46,3 +47,3 @@ | ||
![Realtime Trading Demo](https://github.com/user-attachments/assets/db5303f9-bddf-4418-9906-fa0b11d237bd) | ||
![Realtime Trading Demo](https://github.com/user-attachments/assets/a098b242-88e5-418d-a40b-3a8e44e93ca4) | ||
@@ -49,0 +50,0 @@ ### Installation |
@@ -170,2 +170,5 @@ import type { | ||
/** Row span in cell count or use `*` to span across the entire row */ | ||
rowspan?: number; | ||
/** Is the column selectable? Goes with grid option "enableCellNavigation: true". */ | ||
@@ -172,0 +175,0 @@ selectable?: boolean; |
@@ -25,5 +25,5 @@ import type { | ||
export interface CustomDataView<T = any> { | ||
getItem: (index: number) => T; | ||
getItemMetadata(row: number, cell?: boolean | number): ItemMetadata | null; | ||
getLength: () => number; | ||
getItem: (index: number) => T; | ||
getItemMetadata(index: number): ItemMetadata | null; | ||
} | ||
@@ -171,2 +171,9 @@ | ||
/** | ||
* Do we want to enable cell rowspan? | ||
* Note: this is an opt-in option because of the multiple row/column/cells looping that it has to do | ||
* (which is at least an O^n3 but only for visible range) | ||
*/ | ||
enableCellRowSpan?: boolean; | ||
/** | ||
* Defaults to true, this option can be a boolean or a Column Reorder function. | ||
@@ -254,2 +261,8 @@ * When provided as a boolean, it will permits the user to move an entire column from a position to another. | ||
/** | ||
* Defaults to 5000, max number of rows that we'll consider doing a partial rowspan remapping. | ||
* Anything else will be considered to require a full rowspan remap when necessary | ||
*/ | ||
maxPartialRowSpanRemap?: number; | ||
/** Max supported CSS height */ | ||
@@ -261,2 +274,5 @@ maxSupportedCssHeight?: number; | ||
/** What is the maximum row buffer to use? */ | ||
maxRowBuffer?: number; | ||
/** Use a mixin function when applying defaults to passed in option and columns objects, rather than creating a new object, so as not to break references */ | ||
@@ -263,0 +279,0 @@ mixinDefaults?: boolean; |
import type { Formatter } from './index.js'; | ||
export interface ItemMetadataProvider { | ||
getRowMetadata(item: any, row?: number): any; | ||
} | ||
export interface GroupItemMetadataProviderOption { | ||
@@ -4,0 +8,0 @@ /** Whether or not we want to use group select checkbox. */ |
@@ -27,3 +27,2 @@ export type * from './aggregator.interface.js'; | ||
export type * from './editorValidator.interface.js'; | ||
export type * from './elementPosition.interface.js'; | ||
export type * from './excelCopyBufferOption.interface.js'; | ||
@@ -52,3 +51,2 @@ export type * from './externalCopyClipCommand.interface.js'; | ||
export type * from './headerMenuOption.interface.js'; | ||
export type * from './htmlElementPosition.interface.js'; | ||
export type * from './infer.type.js'; | ||
@@ -67,2 +65,3 @@ export type * from './interactions.interface.js'; | ||
export type * from './pagingInfo.interface.js'; | ||
export type * from './position.interface.js'; | ||
export type * from './positionMethod.type.js'; | ||
@@ -69,0 +68,0 @@ export type * from './resizerOption.interface.js'; |
import type { Column, Editor, Formatter, GroupTotalsFormatter } from './index.js'; | ||
export type ColumnMetadata = Pick<Column, 'colspan' | 'rowspan' | 'cssClass' | 'editor' | 'focusable' | 'formatter' | 'selectable'>; | ||
/** | ||
@@ -29,4 +31,4 @@ * Provides a powerful way of specifying additional information about a data item that let the grid customize the appearance | ||
// properties describing metadata related to individual columns | ||
[colIdOrIdx in string | number]: Pick<Column, 'colspan' | 'editor' | 'focusable' | 'formatter' | 'selectable'>; | ||
[colIdOrIdx in string | number]: ColumnMetadata; | ||
} | ||
} |
@@ -1,3 +0,3 @@ | ||
import type { ElementPosition } from './elementPosition.interface.js'; | ||
import type { ElementPosition } from './position.interface.js'; | ||
export type PositionMethod = () => ElementPosition; |
@@ -155,3 +155,3 @@ import { SlickEvent as SlickEvent_, SlickEventData as SlickEventData_, SlickRange as SlickRange_, Utils as Utils_ } from '../slick.core.js'; | ||
protected isKeyAllowed(key: string) { | ||
return ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'PageDown', 'PageUp', 'Home', 'End'].some(k => k === key); | ||
return ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'PageDown', 'PageUp', 'Home', 'End', 'a', 'A'].some(k => k === key); | ||
} | ||
@@ -185,3 +185,14 @@ | ||
let dCell = last.toCell - last.fromCell; | ||
let toCell: undefined | number; | ||
let toRow = 0; | ||
// when using Ctrl+{a, A} we will change our position to cell 0,0 and select all grid cells | ||
if (e.ctrlKey && e.key?.toLowerCase() === 'a') { | ||
this._grid.setActiveCell(0, 0, false, false, true); | ||
active.row = 0; | ||
active.cell = 0; | ||
toCell = colLn - 1; | ||
toRow = dataLn - 1; | ||
} | ||
// walking direction | ||
@@ -191,4 +202,2 @@ const dirRow = active.row === last.fromRow ? 1 : -1; | ||
const isSingleKeyMove = e.key!.startsWith('Arrow'); | ||
let toCell: undefined | number = undefined; | ||
let toRow = 0; | ||
@@ -216,8 +225,12 @@ if (isSingleKeyMove && !e.ctrlKey) { | ||
if (e.shiftKey && !e.ctrlKey && e.key === 'Home') { | ||
if ((!e.ctrlKey && e.shiftKey && e.key === 'Home') || (e.ctrlKey && e.shiftKey && e.key === 'ArrowLeft')) { | ||
toCell = 0; | ||
toRow = active.row; | ||
} else if (e.shiftKey && !e.ctrlKey && e.key === 'End') { | ||
} else if ((!e.ctrlKey && e.shiftKey && e.key === 'End') || (e.ctrlKey && e.shiftKey && e.key === 'ArrowRight')) { | ||
toCell = colLn - 1; | ||
toRow = active.row; | ||
} else if (e.ctrlKey && e.shiftKey && e.key === 'ArrowUp') { | ||
toRow = 0; | ||
} else if (e.ctrlKey && e.shiftKey && e.key === 'ArrowDown') { | ||
toRow = dataLn - 1; | ||
} else if (e.ctrlKey && e.shiftKey && e.key === 'Home') { | ||
@@ -282,2 +295,2 @@ toCell = 0; | ||
}); | ||
} | ||
} |
@@ -214,8 +214,8 @@ import type { Column, CompositeEditorOption, Editor, EditorArguments, HtmlElementPosition } from './models/index.js'; | ||
}; | ||
} else { | ||
return { | ||
valid: true, | ||
msg: '' | ||
}; | ||
} | ||
return { | ||
valid: true, | ||
msg: '' | ||
}; | ||
}; | ||
@@ -222,0 +222,0 @@ |
@@ -167,3 +167,3 @@ import { type SlickEventData, SlickGroup as SlickGroup_, keyCode as keyCode_, Utils as Utils_ } from './slick.core.js'; | ||
getGroupRowMetadata(item: GroupingFormatterItem): ItemMetadata { | ||
getGroupRowMetadata(item: GroupingFormatterItem, _row?: number, _cell?: number): ItemMetadata { | ||
const groupLevel = item?.level; | ||
@@ -185,3 +185,3 @@ return { | ||
getTotalsRowMetadata(item: { group: GroupingFormatterItem }): ItemMetadata | null { | ||
getTotalsRowMetadata(item: { group: GroupingFormatterItem }, _row?: number, _cell?: number): ItemMetadata | null { | ||
const groupLevel = item?.group?.level; | ||
@@ -188,0 +188,0 @@ return { |
@@ -13,3 +13,3 @@ { | ||
"flatpickr": "^4.6.13", | ||
"slickgrid": "^5.14.2", | ||
"slickgrid": "^5.14.3", | ||
"sortablejs": "^1.15.5" | ||
@@ -16,0 +16,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
9484869
72547
106
482
Updatedsortablejs@^1.15.6