@gridkitjs/core 0.0.0-dev-20261109133348 → 0.0.0-dev-20261109134250
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +16 -9
- package/dist/index.js +66 -71
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3295,16 +3295,17 @@ declare function buildKeyShortcuts(capabilities: KeyShortcutCapabilities): strin
|
|
|
3295
3295
|
declare function accessDotted(obj: unknown, path: string): unknown;
|
|
3296
3296
|
|
|
3297
3297
|
/**
|
|
3298
|
-
* The
|
|
3299
|
-
*
|
|
3300
|
-
* of its own, and every other move is plain arithmetic.
|
|
3298
|
+
* The cell the grid's single tab stop sits on: a header cell, or a cell of
|
|
3299
|
+
* body row `rowIndex`. A body focus's `rowIndex` counts from `0`.
|
|
3301
3300
|
*/
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3301
|
+
type GridFocus = {
|
|
3302
|
+
readonly area: "header";
|
|
3303
|
+
readonly columnIndex: number;
|
|
3304
|
+
} | {
|
|
3305
|
+
readonly area: "body";
|
|
3305
3306
|
readonly rowIndex: number;
|
|
3306
3307
|
readonly columnIndex: number;
|
|
3307
|
-
}
|
|
3308
|
+
};
|
|
3308
3309
|
/** The modifier keys held with a navigation key press. */
|
|
3309
3310
|
interface NavigationModifiers {
|
|
3310
3311
|
readonly ctrlKey: boolean;
|
|
@@ -3312,10 +3313,16 @@ interface NavigationModifiers {
|
|
|
3312
3313
|
readonly altKey: boolean;
|
|
3313
3314
|
readonly shiftKey: boolean;
|
|
3314
3315
|
}
|
|
3316
|
+
/** The header's cell at `columnIndex`. */
|
|
3317
|
+
declare function headerFocus(columnIndex: number): GridFocus;
|
|
3318
|
+
/** Body row `rowIndex`'s cell at `columnIndex`. */
|
|
3319
|
+
declare function bodyFocus(rowIndex: number, columnIndex: number): GridFocus;
|
|
3315
3320
|
/**
|
|
3316
3321
|
* Holds a coordinate inside the grid, so that a focus surviving a column
|
|
3317
3322
|
* removal or a shorter page never leaves the grid with no tab stop at all —
|
|
3318
|
-
* which is a grid a keyboard cannot reach.
|
|
3323
|
+
* which is a grid a keyboard cannot reach. A body focus below the last row
|
|
3324
|
+
* moves up to it; one above the first row, or in a grid with no rows, moves
|
|
3325
|
+
* to the header.
|
|
3319
3326
|
*/
|
|
3320
3327
|
declare function clampFocus(focus: GridFocus, rowCount: number, columnCount: number): GridFocus;
|
|
3321
3328
|
/**
|
|
@@ -4416,4 +4423,4 @@ declare const excelFilter: {
|
|
|
4416
4423
|
};
|
|
4417
4424
|
};
|
|
4418
4425
|
|
|
4419
|
-
export { ALL_COLLAPSED, ALL_EXPANDED, type AggregateFn, type AggregateResults, type AggregateSpec, type AggregateState, type Borders, type BuiltInAggregate, type BuiltInCommandIcon, type BuiltInCommandId, type CellSelectEvent, type CellSelectionChangeEvent, type CellSelectionMode, type CellSelectionState, type CellTemplateContext, type ColumnAlignment, type ColumnChooserEntry, type ColumnChooserInput, type ColumnChooserModel, type ColumnChooserToggle, type ColumnConstraints, type ColumnDefinition, type ColumnFilterMenuOptions, type ColumnFilterShape, type ColumnOrderEvent, type ColumnOrderState, type ColumnResizeEvent, type ColumnResizeSession, type ColumnResolveOptions, type ColumnSelectEvent, type ColumnSelectionChangeEvent, type ColumnSizeDefaults, type ColumnSizingState, type ColumnSortEntry, type ColumnSortEvent, type ColumnSortState, type ColumnType, type ColumnValueCacheQuery, type ColumnValueOption, type ColumnValueOptions, type ColumnValueOptionsCache, type ColumnValueQuery, type ColumnVisibilityEvent, type ColumnVisibilityState, type ColumnWrapConfig, type ColumnsSelectEvent, type ConditionRowDraft, type ConditionsDraft, type ContextMenuOpenChangeEvent, type CopyContent, type CopyRequest, type CopySource, type CsvOptions, DEFAULT_COLUMN_SIZES, DEFAULT_FILTER_VALUE_LIMIT, type DataColumn, type DisplayRow, type DropSide, type ExportCell, type ExportColumn, type ExportDataRow, type ExportFile, type ExportFileSource, type ExportGroupRow, type ExportGroupSummaryRow, type ExportOptions, type ExportRow, type ExportScalar, type ExportSource, type ExportTable, type ExportTotalRow, type ExportWriteContext, type ExportWriter, type FieldPath, type FilterChangeEvent, type FilterChecklist, type FilterChecklistItem, type FilterChecklistOptions, type FilterEditorAction, type FilterEditorDraft, type FilterEditorDraftBase, type FilterEntry, type FilterMenuUi, type FilterOperator, type FilterOperatorFamily, type FilterPredicate, type FilterScalar, type FilterState, type FooterTemplateContext, type FormatLocale, type GridCommand, type GridCommandActions, type GridCommandContext, type GridCommandContextInput, type GridCommandEvent, type GridCommandHost, type GridCommandSource, type GridCommandTarget, type GridContextMenuArea, type GridContextMenuEntries, type GridContextMenuOptions, type GridContextMenuRequest, type GridContextMenuTarget, type GridController, type GridControllerOptions, type GridExportOptions, type GridFilterMenuOptions, type GridFocus, type GridMessages, type GridOptions, type GridPanelKind, type GridState, type GridToolbarOptions, type GridToolbarTarget, type GridView, type GridViewInput, type GridViewOptions, type GridViewState, type GroupAggregateDisplay, type GroupByBarVisibility, type GroupByEntry, type GroupByEvent, type GroupByState, type GroupExpansionEvent, type GroupExpansionState, type GroupFilterEntry,
|
|
4426
|
+
export { ALL_COLLAPSED, ALL_EXPANDED, type AggregateFn, type AggregateResults, type AggregateSpec, type AggregateState, type Borders, type BuiltInAggregate, type BuiltInCommandIcon, type BuiltInCommandId, type CellSelectEvent, type CellSelectionChangeEvent, type CellSelectionMode, type CellSelectionState, type CellTemplateContext, type ColumnAlignment, type ColumnChooserEntry, type ColumnChooserInput, type ColumnChooserModel, type ColumnChooserToggle, type ColumnConstraints, type ColumnDefinition, type ColumnFilterMenuOptions, type ColumnFilterShape, type ColumnOrderEvent, type ColumnOrderState, type ColumnResizeEvent, type ColumnResizeSession, type ColumnResolveOptions, type ColumnSelectEvent, type ColumnSelectionChangeEvent, type ColumnSizeDefaults, type ColumnSizingState, type ColumnSortEntry, type ColumnSortEvent, type ColumnSortState, type ColumnType, type ColumnValueCacheQuery, type ColumnValueOption, type ColumnValueOptions, type ColumnValueOptionsCache, type ColumnValueQuery, type ColumnVisibilityEvent, type ColumnVisibilityState, type ColumnWrapConfig, type ColumnsSelectEvent, type ConditionRowDraft, type ConditionsDraft, type ContextMenuOpenChangeEvent, type CopyContent, type CopyRequest, type CopySource, type CsvOptions, DEFAULT_COLUMN_SIZES, DEFAULT_FILTER_VALUE_LIMIT, type DataColumn, type DisplayRow, type DropSide, type ExportCell, type ExportColumn, type ExportDataRow, type ExportFile, type ExportFileSource, type ExportGroupRow, type ExportGroupSummaryRow, type ExportOptions, type ExportRow, type ExportScalar, type ExportSource, type ExportTable, type ExportTotalRow, type ExportWriteContext, type ExportWriter, type FieldPath, type FilterChangeEvent, type FilterChecklist, type FilterChecklistItem, type FilterChecklistOptions, type FilterEditorAction, type FilterEditorDraft, type FilterEditorDraftBase, type FilterEntry, type FilterMenuUi, type FilterOperator, type FilterOperatorFamily, type FilterPredicate, type FilterScalar, type FilterState, type FooterTemplateContext, type FormatLocale, type GridCommand, type GridCommandActions, type GridCommandContext, type GridCommandContextInput, type GridCommandEvent, type GridCommandHost, type GridCommandSource, type GridCommandTarget, type GridContextMenuArea, type GridContextMenuEntries, type GridContextMenuOptions, type GridContextMenuRequest, type GridContextMenuTarget, type GridController, type GridControllerOptions, type GridExportOptions, type GridFilterMenuOptions, type GridFocus, type GridMessages, type GridOptions, type GridPanelKind, type GridState, type GridToolbarOptions, type GridToolbarTarget, type GridView, type GridViewInput, type GridViewOptions, type GridViewState, type GroupAggregateDisplay, type GroupByBarVisibility, type GroupByEntry, type GroupByEvent, type GroupByState, type GroupExpansionEvent, type GroupExpansionState, type GroupFilterEntry, type HoverableConfig, type HtmlTableOptions, type JsonOptions, KEYBOARD_STEP, type KeyShortcutCapabilities, type MenuEntry, type MenuItemEntry, type MenuMove, type MenuResolveOptions, type MenuSubmenuEntry, type NavigationModifiers, type OperatorFilterEntry, type PaginateRowsOptions, type PaginatedRows, type PaginationChangeEvent, type PaginationState, type PaginationUnit, type PaginationWindowEntry, type ParsedConditionRows, type PredicateFilterEntry, type PrintDocument, type PrintOptions, type PrintOrientation, type PrintPage, type PrintSource, type ResizeMode, type ResolvedColumn, type ResolvedColumnFilterMenu, type ResolvedGroupRow, type ResolvedGroupSummaryRow, type ResolvedMenuEntry, type ResolvedMenuItem, type ResolvedMenuSeparator, type ResolvedMenuSubmenu, type ResolvedRow, type ResolvedToolbarButton, type ResolvedToolbarCustom, type ResolvedToolbarItem, type ResolvedToolbarMenu, type ResolvedToolbarSearch, type ResolvedToolbarSpacer, type RowHeights, type RowPointerEvent, type RowProps, type RowSelectEvent, type RowSelectionChangeEvent, type RowsSelectEvent, type SelectAllState, type SelectIntent, type SelectableConfig, type SelectedCell, type SelectedCellRef, type SelectedColumn, type SelectionCallbacks, type SelectionDiff, type SelectionDiffEvent, type SelectionMode, type SelectionState, type SerializedFilterEntry, type SerializedFilterScalar, type SerializedFilterState, type SerializedGridState, type SerializedGroupFilterEntry, type SerializedOperatorFilterEntry, type SerializedValueFilterEntry, type SortDirection, type TextFilterEntry, type ToolbarCustomEntry, type ToolbarEntry, type ToolbarFitInput, type ToolbarItemAttributes, type ToolbarResolveOptions, type ToolbarSplit, type TsvOptions, type ValueFilterEntry, type ValuesDraft, type VisibleRange, accessDotted, alignmentForType, applyColumnOrder, applyColumnResize, applyColumnVisibility, applySelectionIntent, beginColumnResize, bodyFocus, buildExportTable, buildKeyShortcuts, buildPrintDocument, builtInCommands, clampColumnWidth, clampFocus, clearAllFilters, clearSelection, collapseAllGroups, columnValueOptions, compareValues, computeAggregates, conditionRowsFrom, conditionsFromRows, contextMenuEntries, copyContent, createColumnValueOptionsCache, createCommandContext, createDefaultMessages, createGridController, createGridViewResolver, csvWriter, defaultContextMenu, defaultFilterOperators, defaultMessages, defaultToolbar, defineColumnsFromRows, describeColumnFilter, diffSelection, draftToFilter, excelFilter, expandAllGroups, exportFile, exportPrintDocument, filterChecklist, filterDraftChanged, filterEditorReducer, filterOperandArity, filterOperatorFamily, filterQueryFor, filterRows, fitColumnsToWidth, fitToolbarItems, formatAggregateValue, formatCellValue, formatFilterOperand, formatGroupValue, getColumnId, groupRowId, groupRows, hasContextMenu, headerFocus, initialFilterEditorDraft, intentOf, isColumnFiltered, isColumnVisible, isGroupExpanded, isPinnedToolbarItem, isSameCell, jsonWriter, matchesQuery, moveColumnBefore, moveGroupByBefore, movesColumn, movesGroupBy, nextFocusForKey, nextMenuIndex, paginateRows, paginationWindow, parseFilterOperand, resolveCell, resolveColumnChooser, resolveColumnConstraints, resolveColumnFilterMenu, resolveColumnHeaderText, resolveColumnLabel, resolveColumnWidths, resolveColumns, resolveCommands, resolveDataColumns, resolveDropBefore, resolveExportWriters, resolveGridView, resolveKeyboardDropTarget, resolveMenu, resolveMessages, resolveRowId, resolveRows, resolveShownRows, resolveToolbar, revertColumnSize, runCommand, searchTextOf, selectAll, selectAllState, selectCell, selectOnly, selectRange, serializeGridState, setColumnFilter, setColumnVisibility, setSearchText, sizeColumnToContent, sortDirectionFor, sortPriorityFor, sortRows, splitToolbarItems, toConditionsDraft, toCsv, toHtmlTable, toJson, toTsv, toValuesDraft, toggleCellSelection, toggleColumnSort, toggleGroupExpansion, toggleSelection, toolbarEntries, totalColumnWidth, typeaheadIndex, visibleFilterOptions, visibleRange, withGroupAggregates };
|
package/dist/index.js
CHANGED
|
@@ -4532,101 +4532,95 @@ function setSearchText(filter, text) {
|
|
|
4532
4532
|
}
|
|
4533
4533
|
|
|
4534
4534
|
// src/util/navigation.ts
|
|
4535
|
-
|
|
4535
|
+
function headerFocus(columnIndex) {
|
|
4536
|
+
return { area: "header", columnIndex };
|
|
4537
|
+
}
|
|
4538
|
+
function bodyFocus(rowIndex, columnIndex) {
|
|
4539
|
+
return { area: "body", rowIndex, columnIndex };
|
|
4540
|
+
}
|
|
4536
4541
|
function clampFocus(focus, rowCount, columnCount2) {
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4542
|
+
const columnIndex = Math.min(
|
|
4543
|
+
Math.max(focus.columnIndex, 0),
|
|
4544
|
+
Math.max(columnCount2 - 1, 0)
|
|
4545
|
+
);
|
|
4546
|
+
switch (focus.area) {
|
|
4547
|
+
case "header":
|
|
4548
|
+
return headerFocus(columnIndex);
|
|
4549
|
+
case "body": {
|
|
4550
|
+
const rowIndex = Math.min(focus.rowIndex, rowCount - 1);
|
|
4551
|
+
return rowIndex < 0 ? headerFocus(columnIndex) : bodyFocus(rowIndex, columnIndex);
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4544
4554
|
}
|
|
4545
4555
|
function noRowsSkippable() {
|
|
4546
4556
|
return false;
|
|
4547
4557
|
}
|
|
4548
|
-
function
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4558
|
+
function linePosition(focus) {
|
|
4559
|
+
return focus.area === "header" ? -1 : focus.rowIndex;
|
|
4560
|
+
}
|
|
4561
|
+
function focusAtLine(line2, columnIndex) {
|
|
4562
|
+
return line2 < 0 ? headerFocus(columnIndex) : bodyFocus(line2, columnIndex);
|
|
4563
|
+
}
|
|
4564
|
+
function skipSkippableRows(target, direction, rowCount, isSkippableRow, fallback) {
|
|
4565
|
+
if (target.area === "header") {
|
|
4566
|
+
return target;
|
|
4567
|
+
}
|
|
4568
|
+
let rowIndex = target.rowIndex;
|
|
4569
|
+
while (rowIndex < rowCount && isSkippableRow(rowIndex)) {
|
|
4570
|
+
const stepped = rowIndex + direction;
|
|
4571
|
+
if (stepped >= rowCount) {
|
|
4553
4572
|
return fallback;
|
|
4554
4573
|
}
|
|
4555
|
-
|
|
4574
|
+
if (stepped < 0) {
|
|
4575
|
+
return headerFocus(target.columnIndex);
|
|
4576
|
+
}
|
|
4577
|
+
rowIndex = stepped;
|
|
4556
4578
|
}
|
|
4557
|
-
return
|
|
4579
|
+
return bodyFocus(rowIndex, target.columnIndex);
|
|
4558
4580
|
}
|
|
4559
4581
|
function nextFocusForKey(key, modifiers, focus, rowCount, columnCount2, pageSize, isSkippableRow = noRowsSkippable) {
|
|
4560
4582
|
if (modifiers.altKey) {
|
|
4561
4583
|
return null;
|
|
4562
4584
|
}
|
|
4563
|
-
const {
|
|
4585
|
+
const { columnIndex } = focus;
|
|
4586
|
+
function moveRows(rows) {
|
|
4587
|
+
return skipSkippableRows(
|
|
4588
|
+
focusAtLine(linePosition(focus) + rows, columnIndex),
|
|
4589
|
+
rows < 0 ? -1 : 1,
|
|
4590
|
+
rowCount,
|
|
4591
|
+
isSkippableRow,
|
|
4592
|
+
focus
|
|
4593
|
+
);
|
|
4594
|
+
}
|
|
4564
4595
|
switch (key) {
|
|
4565
4596
|
case "ArrowLeft":
|
|
4566
4597
|
if (modifiers.ctrlKey) return null;
|
|
4567
|
-
return {
|
|
4598
|
+
return { ...focus, columnIndex: columnIndex - 1 };
|
|
4568
4599
|
case "ArrowRight":
|
|
4569
4600
|
if (modifiers.ctrlKey) return null;
|
|
4570
|
-
return {
|
|
4601
|
+
return { ...focus, columnIndex: columnIndex + 1 };
|
|
4571
4602
|
case "ArrowUp":
|
|
4572
|
-
return
|
|
4573
|
-
rowIndex: skipSkippableRows(
|
|
4574
|
-
rowIndex - 1,
|
|
4575
|
-
-1,
|
|
4576
|
-
rowCount,
|
|
4577
|
-
isSkippableRow,
|
|
4578
|
-
rowIndex
|
|
4579
|
-
),
|
|
4580
|
-
columnIndex
|
|
4581
|
-
};
|
|
4603
|
+
return moveRows(-1);
|
|
4582
4604
|
case "ArrowDown":
|
|
4583
|
-
return
|
|
4584
|
-
rowIndex: skipSkippableRows(
|
|
4585
|
-
rowIndex + 1,
|
|
4586
|
-
1,
|
|
4587
|
-
rowCount,
|
|
4588
|
-
isSkippableRow,
|
|
4589
|
-
rowIndex
|
|
4590
|
-
),
|
|
4591
|
-
columnIndex
|
|
4592
|
-
};
|
|
4605
|
+
return moveRows(1);
|
|
4593
4606
|
// Ctrl takes Home and End to the grid's ends rather than the row's, which
|
|
4594
4607
|
// is the one place Ctrl is navigation rather than reorder.
|
|
4595
4608
|
case "Home":
|
|
4596
|
-
return modifiers.ctrlKey ?
|
|
4597
|
-
case "End":
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
} : { rowIndex, columnIndex: columnCount2 - 1 };
|
|
4609
|
+
return modifiers.ctrlKey ? headerFocus(0) : { ...focus, columnIndex: 0 };
|
|
4610
|
+
case "End": {
|
|
4611
|
+
const rowEnd = { ...focus, columnIndex: columnCount2 - 1 };
|
|
4612
|
+
return modifiers.ctrlKey ? skipSkippableRows(
|
|
4613
|
+
focusAtLine(rowCount - 1, columnCount2 - 1),
|
|
4614
|
+
-1,
|
|
4615
|
+
rowCount,
|
|
4616
|
+
isSkippableRow,
|
|
4617
|
+
rowEnd
|
|
4618
|
+
) : rowEnd;
|
|
4619
|
+
}
|
|
4608
4620
|
case "PageUp":
|
|
4609
|
-
return
|
|
4610
|
-
rowIndex: skipSkippableRows(
|
|
4611
|
-
rowIndex - pageSize,
|
|
4612
|
-
-1,
|
|
4613
|
-
rowCount,
|
|
4614
|
-
isSkippableRow,
|
|
4615
|
-
rowIndex
|
|
4616
|
-
),
|
|
4617
|
-
columnIndex
|
|
4618
|
-
};
|
|
4621
|
+
return moveRows(-pageSize);
|
|
4619
4622
|
case "PageDown":
|
|
4620
|
-
return
|
|
4621
|
-
rowIndex: skipSkippableRows(
|
|
4622
|
-
rowIndex + pageSize,
|
|
4623
|
-
1,
|
|
4624
|
-
rowCount,
|
|
4625
|
-
isSkippableRow,
|
|
4626
|
-
rowIndex
|
|
4627
|
-
),
|
|
4628
|
-
columnIndex
|
|
4629
|
-
};
|
|
4623
|
+
return moveRows(pageSize);
|
|
4630
4624
|
default:
|
|
4631
4625
|
return null;
|
|
4632
4626
|
}
|
|
@@ -4896,7 +4890,6 @@ export {
|
|
|
4896
4890
|
ALL_EXPANDED,
|
|
4897
4891
|
DEFAULT_COLUMN_SIZES,
|
|
4898
4892
|
DEFAULT_FILTER_VALUE_LIMIT,
|
|
4899
|
-
HEADER_ROW,
|
|
4900
4893
|
KEYBOARD_STEP,
|
|
4901
4894
|
accessDotted,
|
|
4902
4895
|
alignmentForType,
|
|
@@ -4905,6 +4898,7 @@ export {
|
|
|
4905
4898
|
applyColumnVisibility,
|
|
4906
4899
|
applySelectionIntent,
|
|
4907
4900
|
beginColumnResize,
|
|
4901
|
+
bodyFocus,
|
|
4908
4902
|
buildExportTable,
|
|
4909
4903
|
buildKeyShortcuts,
|
|
4910
4904
|
buildPrintDocument,
|
|
@@ -4956,6 +4950,7 @@ export {
|
|
|
4956
4950
|
groupRowId,
|
|
4957
4951
|
groupRows,
|
|
4958
4952
|
hasContextMenu,
|
|
4953
|
+
headerFocus,
|
|
4959
4954
|
initialFilterEditorDraft,
|
|
4960
4955
|
intentOf,
|
|
4961
4956
|
isColumnFiltered,
|