@gridkitjs/core 0.0.0-dev-20261118134132 → 0.0.0-dev-20261118190822

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/renderer.js CHANGED
@@ -26,10 +26,12 @@ import {
26
26
  isColumnVisible,
27
27
  isScalarList,
28
28
  keyOf,
29
+ moveColumnInPinGroup,
29
30
  movesColumn,
30
31
  movesGroupBy,
31
32
  nextFocusForKey,
32
33
  parseFilterOperand,
34
+ pinnedWidths,
33
35
  resolveColumnConstraints,
34
36
  resolveColumnFilterMenu,
35
37
  resolveColumnHeaderText,
@@ -45,7 +47,7 @@ import {
45
47
  totalColumnWidth,
46
48
  touchesColumn,
47
49
  visibleFilterOptions
48
- } from "./chunk-PUD53NFG.js";
50
+ } from "./chunk-ZFWEGZX3.js";
49
51
 
50
52
  // src/menu/navigation.ts
51
53
  function startIndex(count, from, move) {
@@ -450,12 +452,14 @@ export {
450
452
  inlineStep,
451
453
  intentOf,
452
454
  isPinnedToolbarItem,
455
+ moveColumnInPinGroup,
453
456
  movesColumn,
454
457
  movesGroupBy,
455
458
  nextFocusForKey,
456
459
  nextMenuIndex,
457
460
  paginationWindow,
458
461
  parseFilterOperand,
462
+ pinnedWidths,
459
463
  resolveColumnChooser,
460
464
  resolveColumnConstraints,
461
465
  resolveColumnFilterMenu,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/menu/navigation.ts","../src/toolbar/overflow.ts","../src/toolbar/search.ts","../src/util/paginationWindow.ts","../src/util/columnChooser.ts","../src/filterMenu/conditions.ts","../src/filterMenu/valueCache.ts","../src/filterMenu/checklist.ts","../src/util/virtualization.ts"],"sourcesContent":["import type { ResolvedMenuEntry } from \"./types\";\n\n/** Where an arrow, Home or End key moves a menu's focus. */\nexport type MenuMove = \"next\" | \"previous\" | \"first\" | \"last\";\n\n/** Where the search for the next item begins, before skipping separators. */\nfunction startIndex(count: number, from: number, move: MenuMove): number {\n const focused = from >= 0 && from < count;\n switch (move) {\n case \"first\":\n return 0;\n case \"last\":\n return count - 1;\n case \"next\":\n return focused ? from + 1 : 0;\n case \"previous\":\n return focused ? from - 1 : count - 1;\n }\n}\n\n/**\n * The index of the item focus moves to from `from` — `-1` when nothing is\n * focused yet, so `\"next\"` lands on the first item and `\"previous\"` on the\n * last. Separators are skipped and `\"next\"`/`\"previous\"` wrap round the\n * ends; disabled items count, since they stay focusable for a screen reader\n * to find. `-1` when there is no item at all.\n *\n * Takes anything with a `type`, so a behaviour that reads its items off the\n * page can pass `{ type: \"item\" }` for each.\n */\nexport function nextMenuIndex(\n entries: readonly Pick<ResolvedMenuEntry, \"type\">[],\n from: number,\n move: MenuMove,\n): number {\n const count = entries.length;\n const step = move === \"next\" || move === \"first\" ? 1 : -1;\n const start = startIndex(count, from, move);\n for (let offset = 0; offset < count; offset++) {\n const index = (((start + step * offset) % count) + count) % count;\n if (entries[index]?.type !== \"separator\") {\n return index;\n }\n }\n return -1;\n}\n\n/**\n * The index of the item `query` — what was typed, buffered for a moment —\n * picks, matched case-insensitively against the start of each label and\n * wrapping round the end; `-1` when none matches.\n *\n * `from` is the item focused now. A single letter, or the same letter\n * typed again and again, searches from the item after it, so repeating a\n * letter steps through every item it starts. A longer query searches from\n * `from` itself, so the item already found stays put while what is typed\n * still matches it.\n */\nexport function typeaheadIndex(\n labels: readonly string[],\n from: number,\n query: string,\n): number {\n const typed = query.toLowerCase();\n const firstCodePoint = typed.codePointAt(0);\n if (firstCodePoint === undefined) {\n return -1;\n }\n const first = String.fromCodePoint(firstCodePoint);\n const repeated = typed.replaceAll(first, \"\") === \"\";\n const prefix = repeated ? first : typed;\n const start = repeated ? from + 1 : Math.max(from, 0);\n for (let offset = 0; offset < labels.length; offset++) {\n const index = (start + offset) % labels.length;\n if (labels[index]?.toLowerCase().startsWith(prefix) === true) {\n return index;\n }\n }\n return -1;\n}\n","import { collapseSeparators } from \"../menu/resolveMenu\";\nimport type { ResolvedMenuEntry } from \"../menu/types\";\nimport type { ResolvedToolbarItem } from \"./types\";\n\n/** What `fitToolbarItems` fits: a toolbar's entries, by width, into its space. */\nexport interface ToolbarFitInput {\n /** Each entry's width, in order — `0` for a spacer, whose width is only the space left over. */\n readonly widths: readonly number[];\n /** The width the entries share. */\n readonly available: number;\n /** The width of the \"More\" button the entries that do not fit go into. */\n readonly moreWidth: number;\n /** Whether each entry, in order, stays however little room there is. */\n readonly pinned: readonly boolean[];\n}\n\n/**\n * How many of a toolbar's entries fit, from the start: the first `count`\n * stay in the toolbar, with every pinned entry after them, and the rest go\n * into a \"More\" menu.\n *\n * Pinned entries take their room first, wherever they are. Room for \"More\"\n * is kept only when something does not fit — when everything does, the\n * result is every entry and no \"More\" is drawn. Entries are taken in order\n * and the first that does not fit ends the count, so the toolbar keeps its\n * order rather than filling gaps with later, narrower entries; one with no\n * width, a spacer, fits wherever the entries before it did.\n */\nexport function fitToolbarItems({\n widths,\n available,\n moreWidth,\n pinned,\n}: ToolbarFitInput): number {\n const total = widths.reduce((sum, width) => sum + width, 0);\n if (total <= available) {\n return widths.length;\n }\n let used =\n moreWidth +\n widths.reduce((sum, width, index) => sum + (pinned[index] ? width : 0), 0);\n for (const [index, width] of widths.entries()) {\n if (!pinned[index]) {\n used += width;\n if (used > available) {\n return index;\n }\n }\n }\n return widths.length;\n}\n\n/**\n * Whether a toolbar entry stays in the toolbar however narrow it gets: the\n * search box and custom entries, which have no menu item to become.\n */\nexport function isPinnedToolbarItem(\n item: Pick<ResolvedToolbarItem, \"type\">,\n): boolean {\n return item.type === \"search\" || item.type === \"custom\";\n}\n\n/** A toolbar split at the count `fitToolbarItems` gave — see `splitToolbarItems`. */\nexport interface ToolbarSplit {\n /** What stays in the toolbar. */\n readonly shown: readonly ResolvedToolbarItem[];\n /** The \"More\" menu's entries, empty when everything fits. */\n readonly overflow: readonly ResolvedMenuEntry[];\n}\n\n/** An entry that did not fit, as the \"More\" menu lists it; `null` for a spacer. */\nfunction asMenuEntry(item: ResolvedToolbarItem): ResolvedMenuEntry | null {\n switch (item.type) {\n case \"button\":\n return {\n type: \"item\",\n id: item.id,\n label: item.label,\n icon: item.icon,\n shortcut: item.shortcut,\n disabled: item.disabled,\n checked: item.pressed,\n run: item.run,\n };\n case \"menu\":\n return {\n type: \"submenu\",\n id: item.id,\n label: item.label,\n icon: item.icon,\n items: item.items,\n };\n case \"separator\":\n return item;\n default:\n return null;\n }\n}\n\n/**\n * `items` split at the first `fit`: those before it, and every pinned item,\n * stay in the toolbar; the rest become the \"More\" menu's entries — a button\n * an item, checked where it was pressed, and a dropdown a submenu. Neither\n * side keeps a separator at its ends, doubled, or beside a spacer.\n */\nexport function splitToolbarItems(\n items: readonly ResolvedToolbarItem[],\n fit: number,\n): ToolbarSplit {\n const fits = (item: ResolvedToolbarItem, index: number) =>\n index < fit || isPinnedToolbarItem(item);\n return {\n shown: collapseSeparators(\n items.filter(fits),\n (item) => item.type === \"spacer\",\n ),\n overflow: collapseSeparators(\n items\n .filter((item, index) => !fits(item, index))\n .map(asMenuEntry)\n .filter((entry) => entry !== null),\n ),\n };\n}\n","import type { FilterState } from \"../types\";\nimport { filterQueryFor, setColumnFilter } from \"../util/filtering\";\n\n/**\n * What a search box shows for `filter`: the global text entry's query — the\n * one naming no column — without the `%` anchors that make it a \"contains\"\n * match, or `\"\"` when there is none. A `%` the user typed inside the text\n * stays: only the first and last characters are anchors.\n */\nexport function searchTextOf<Row>(filter: FilterState<Row>): string {\n const query = filterQueryFor(filter) ?? \"\";\n const start = query.startsWith(\"%\") ? 1 : 0;\n const end = query.endsWith(\"%\") ? -1 : undefined;\n return query.slice(start, end);\n}\n\n/**\n * `filter` with its global text entry set to search for `text` anywhere in\n * any column — the query `%text%` — or removed for an empty `text`. Every\n * entry naming a column stays as it was. `filter` itself, unchanged, when\n * it already searches for `text`.\n *\n * `text` is written as typed, spaces and all: a search box reads its text\n * back from the filter, and trimming here would take a space away from\n * under the caret as the user types it.\n */\nexport function setSearchText<Row>(\n filter: FilterState<Row>,\n text: string,\n): FilterState<Row> {\n return setColumnFilter(filter, undefined, text === \"\" ? \"\" : `%${text}%`);\n}\n","export type PaginationWindowEntry = number | \"ellipsis\";\n\n/**\n * Which page numbers a numbered pager should show for `currentPage` of\n * `pageCount` — the boundary + sibling windowing MUI's `usePagination` uses.\n * Always includes the first/last `boundaryCount` pages and a run of\n * `2 * siblingCount + 1` pages around `currentPage`, slid inwards rather than\n * cut short near either end, with one slot between each boundary and that\n * run holding either the single page it skips or an `\"ellipsis\"`.\n *\n * So once `pageCount` exceeds `2 * boundaryCount + 2 * siblingCount + 3`,\n * every window is exactly that many entries long, wherever `currentPage`\n * sits: a pager drawing one fixed-width slot per entry keeps its trailing\n * controls in place as the user pages through. Below that, every page shows.\n */\nexport function paginationWindow(\n currentPage: number,\n pageCount: number,\n options?: {\n boundaryCount?: number | undefined;\n siblingCount?: number | undefined;\n },\n): readonly PaginationWindowEntry[] {\n if (pageCount <= 0) {\n return [];\n }\n\n const boundaryCount = Math.max(0, Math.floor(options?.boundaryCount ?? 1));\n const siblingCount = Math.max(0, Math.floor(options?.siblingCount ?? 1));\n const slotCount = 2 * boundaryCount + 2 * siblingCount + 3;\n\n if (pageCount <= slotCount) {\n return Array.from({ length: pageCount }, (_, index) => index + 1);\n }\n\n const current = Math.min(Math.max(currentPage, 1), pageCount);\n // The sibling run, slid to stay clear of the slot beside each boundary.\n const runStart = Math.min(\n Math.max(current - siblingCount, boundaryCount + 2),\n pageCount - boundaryCount - 1 - 2 * siblingCount,\n );\n const runEnd = runStart + 2 * siblingCount;\n\n const entries: PaginationWindowEntry[] = [];\n for (let page = 1; page <= boundaryCount; page++) {\n entries.push(page);\n }\n entries.push(runStart === boundaryCount + 2 ? boundaryCount + 1 : \"ellipsis\");\n for (let page = runStart; page <= runEnd; page++) {\n entries.push(page);\n }\n entries.push(\n runEnd === pageCount - boundaryCount - 1\n ? pageCount - boundaryCount\n : \"ellipsis\",\n );\n for (let page = pageCount - boundaryCount + 1; page <= pageCount; page++) {\n entries.push(page);\n }\n\n return entries;\n}\n","import type { ColumnVisibilityState, DataColumn } from \"../types\";\nimport type { SelectAllState } from \"./filterEditor\";\nimport { resolveColumnHeaderText } from \"./grid\";\nimport { isColumnVisible } from \"./visibility\";\n\n/** What a column chooser is drawn from: every column, the visibility, and the search typed. */\nexport interface ColumnChooserInput<Row> {\n /** Every column in its current order, hidden ones included — a view's `dataColumns`. */\n readonly columns: readonly DataColumn<Row, unknown>[];\n readonly visibility: ColumnVisibilityState;\n /** Narrows the list to the columns whose header text contains it, ignoring case. */\n readonly search?: string | undefined;\n}\n\n/** One column's checkbox in a column chooser. */\nexport interface ColumnChooserEntry {\n readonly columnId: string;\n /** The column's header text — what the search matches, and the checkbox's label. */\n readonly label: string;\n /** Whether the column is shown — whether its checkbox is checked. */\n readonly visible: boolean;\n /**\n * Whether the checkbox cannot be unchecked: the column is shown and is\n * either not `hideable` or the last column shown. A hidden column can\n * always be shown, `hideable` or not.\n */\n readonly disabled: boolean;\n}\n\n/** What toggling a chooser's \"Show all\" checkbox does: shows these columns, or hides them. */\nexport interface ColumnChooserToggle {\n readonly visible: boolean;\n readonly columnIds: readonly string[];\n}\n\nexport interface ColumnChooserModel {\n /** The columns the search matches, in column order. */\n readonly entries: readonly ColumnChooserEntry[];\n /**\n * The \"Show all\" checkbox's state over the entries whose columns are\n * `hideable` — the ones it acts on. A column the user cannot hide is\n * always on, so counting it would leave \"Show all\" stuck at mixed.\n */\n readonly selectAll: SelectAllState;\n /** What toggling \"Show all\" does, or `null` when it can do nothing — a disabled checkbox. */\n readonly toggleAll: ColumnChooserToggle | null;\n}\n\n/** A column as the chooser reads it. */\ninterface ChooserColumn<Row> {\n readonly column: DataColumn<Row, unknown>;\n readonly label: string;\n readonly visible: boolean;\n}\n\nfunction isHideable<Row>(column: DataColumn<Row, unknown>): boolean {\n return column.column.hideable !== false;\n}\n\nfunction matchesSearch(label: string, search: string): boolean {\n return label.toLowerCase().includes(search.toLowerCase());\n}\n\nfunction selectAllStateOf(states: readonly boolean[]): SelectAllState {\n if (states.length > 0 && states.every(Boolean)) {\n return \"checked\";\n }\n return states.some(Boolean) ? \"mixed\" : \"unchecked\";\n}\n\n/**\n * A column chooser's list for a search, and what its \"Show all\" checkbox\n * says and does — the same tri-state over what the search shows that a\n * filter editor's select-all is (`selectAllState`).\n *\n * \"Show all\" shows every hidden column the search shows once any is hidden,\n * and hides those it shows once none is. It never touches a column that is\n * not `hideable`, and never hides the last column shown: when that is all\n * that would be left, the first of them in column order stays, since a grid\n * with no column shown has no header to bring one back from.\n */\nexport function resolveColumnChooser<Row>({\n columns,\n visibility,\n search = \"\",\n}: ColumnChooserInput<Row>): ColumnChooserModel {\n const all = columns.map((column): ChooserColumn<Row> => ({\n column,\n label: resolveColumnHeaderText(column.column),\n visible: isColumnVisible(column.column, visibility),\n }));\n const shownCount = all.filter(({ visible }) => visible).length;\n const matched = all.filter(({ label }) => matchesSearch(label, search));\n\n const entries = matched.map(\n ({ column, label, visible }): ColumnChooserEntry => ({\n columnId: column.id,\n label,\n visible,\n disabled: visible && (!isHideable(column) || shownCount === 1),\n }),\n );\n\n const covered = matched.filter(({ column }) => isHideable(column));\n const selectAll = selectAllStateOf(covered.map(({ visible }) => visible));\n return {\n entries,\n selectAll,\n toggleAll: toggleAllOf(covered, selectAll, shownCount),\n };\n}\n\nfunction toggleAllOf<Row>(\n covered: readonly ChooserColumn<Row>[],\n selectAll: SelectAllState,\n shownCount: number,\n): ColumnChooserToggle | null {\n const show = selectAll !== \"checked\";\n const changing = covered\n .filter(({ visible }) => visible !== show)\n .map(({ column }) => column.id);\n // Hiding every column shown would leave none: the first of them stays.\n const columnIds =\n !show && changing.length === shownCount ? changing.slice(1) : changing;\n return columnIds.length === 0 ? null : { visible: show, columnIds };\n}\n","import type { ColumnType, FilterOperator, OperatorFilterEntry } from \"../types\";\nimport type { ColumnFilterShape } from \"../util/filterEditor\";\nimport { isScalarList } from \"../util/filterOperators\";\nimport {\n filterOperandArity,\n formatFilterOperand,\n parseFilterOperand,\n} from \"./operators\";\n\n/**\n * One condition row of a simple filter editor as the user types it: text,\n * not yet a value, so a half-typed number or date stays in its input until\n * the editor is applied and `conditionsFromRows` reads it.\n */\nexport interface ConditionRowDraft {\n readonly operator: FilterOperator;\n /** The operand as typed — `between`'s lower end. */\n readonly text: string;\n /**\n * `between`'s upper end, as typed. Kept under any other operator, unread,\n * so switching back to `between` finds it still there.\n */\n readonly textTo: string;\n}\n\n/** What `conditionsFromRows` reads off an editor's rows. */\nexport interface ParsedConditionRows<Row> {\n /** A condition for each row that reads as one, in row order. */\n readonly conditions: readonly OperatorFilterEntry<Row>[];\n /**\n * The indexes of the rows that don't, for the editor to mark. Apply the\n * conditions only once this is empty.\n */\n readonly invalid: readonly number[];\n}\n\n/** A simple editor's rows: one condition, and an optional second joined to it. */\nconst ROW_COUNT = 2;\n\nfunction rowOf<Row>(\n condition: OperatorFilterEntry<Row>,\n type: ColumnType | undefined,\n): ConditionRowDraft {\n const { operator, value } = condition;\n if (isScalarList(value)) {\n const [low, high] = value;\n return {\n operator,\n text: formatFilterOperand(low, type),\n textTo: formatFilterOperand(high, type),\n };\n }\n return { operator, text: formatFilterOperand(value, type), textTo: \"\" };\n}\n\n/**\n * The rows a simple editor opens with over a column's filter `shape`, its\n * operands written as the column's `type` reads them: two, holding the\n * column's conditions when its filter is conditions, and each row they\n * don't fill starting at the first of `operators`, empty. With no operator\n * to start one at, only the rows the filter fills.\n */\nexport function conditionRowsFrom<Row>(\n shape: ColumnFilterShape<Row>,\n operators: readonly FilterOperator[],\n type: ColumnType | undefined,\n): readonly ConditionRowDraft[] {\n const filled =\n shape.kind === \"conditions\"\n ? shape.conditions.map((condition) => rowOf(condition, type))\n : [];\n const [first] = operators;\n if (first === undefined) {\n return filled;\n }\n const blank: ConditionRowDraft = { operator: first, text: \"\", textTo: \"\" };\n return Array.from(\n { length: ROW_COUNT },\n (_, index) => filled[index] ?? blank,\n );\n}\n\n/** Whether a row was left empty: none of the operands its operator takes is typed. */\nfunction isEmptyRow(row: ConditionRowDraft): boolean {\n switch (filterOperandArity(row.operator)) {\n case 0:\n return false;\n case 1:\n return row.text === \"\";\n case 2:\n return row.text === \"\" && row.textTo === \"\";\n }\n}\n\n/** `row` as a condition on `columnId`, or `undefined` when an operand it needs doesn't read. */\nfunction conditionOf<Row>(\n row: ConditionRowDraft,\n columnId: string,\n type: ColumnType | undefined,\n): OperatorFilterEntry<Row> | undefined {\n const { operator } = row;\n switch (filterOperandArity(operator)) {\n case 0:\n return { kind: \"operator\", columnId, operator };\n case 1: {\n const value = parseFilterOperand(row.text, type);\n return value === undefined\n ? undefined\n : { kind: \"operator\", columnId, operator, value };\n }\n case 2: {\n const low = parseFilterOperand(row.text, type);\n const high = parseFilterOperand(row.textTo, type);\n return low === undefined || high === undefined\n ? undefined\n : { kind: \"operator\", columnId, operator, value: [low, high] };\n }\n }\n}\n\n/**\n * The conditions a simple editor's rows stand for on `columnId`, each\n * operand read as the column's `type` filters (`parseFilterOperand`) — for\n * `filterEditorReducer`'s `setConditions`, with the combinator the editor\n * shows.\n *\n * A row needs every operand its operator takes, or it is `invalid`; the\n * blanks operators take none. A row after the first left empty is dropped\n * rather than invalid, since the second condition is optional; an empty\n * first row is invalid — clearing the filter is the editor's clear action,\n * not an apply with nothing typed.\n */\nexport function conditionsFromRows<Row>(\n rows: readonly ConditionRowDraft[],\n columnId: string,\n type: ColumnType | undefined,\n): ParsedConditionRows<Row> {\n const conditions: OperatorFilterEntry<Row>[] = [];\n const invalid: number[] = [];\n for (const [index, row] of rows.entries()) {\n if (index > 0 && isEmptyRow(row)) {\n continue;\n }\n const condition = conditionOf<Row>(row, columnId, type);\n if (condition === undefined) {\n invalid.push(index);\n } else {\n conditions.push(condition);\n }\n }\n return { conditions, invalid };\n}\n","import type { GridMessages } from \"../messages\";\nimport type { DataColumn, FilterEntry, FilterState } from \"../types\";\nimport type {\n ColumnValueOptions,\n ColumnValueQuery,\n} from \"../util/filterEditor\";\nimport { columnValueOptions, touchesColumn } from \"../util/filterEditor\";\nimport type { FormatLocale } from \"../util/format\";\n\n/**\n * What a cached list is labelled by: `columnValueOptions`' query without\n * `search` and `limit`, which a draft applies over the whole list.\n */\nexport type ColumnValueCacheQuery = Pick<\n ColumnValueQuery,\n \"locale\" | \"messages\"\n>;\n\n/** `columnValueOptions`, remembered per column. */\nexport interface ColumnValueOptionsCache<Row> {\n /**\n * `columnId`'s whole value list — `columnValueOptions` with no `search`\n * or `limit` — or the very list it returned last time, when nothing the\n * list is counted from or labelled by has changed since.\n */\n readonly get: (\n rows: readonly Row[],\n dataColumns: readonly DataColumn<Row, unknown>[],\n filter: FilterState<Row>,\n columnId: string,\n query?: ColumnValueCacheQuery,\n ) => ColumnValueOptions;\n}\n\n/** What every list in a cache is counted from and labelled by. */\ninterface CacheSource<Row> {\n readonly rows: readonly Row[];\n readonly dataColumns: readonly DataColumn<Row, unknown>[];\n readonly locale: FormatLocale;\n readonly messages: Partial<GridMessages> | undefined;\n}\n\ninterface CachedList<Row> {\n /** The entries it was counted under: every one not about its column. */\n readonly others: FilterState<Row>;\n readonly values: ColumnValueOptions;\n}\n\nfunction sameSource<Row>(a: CacheSource<Row>, b: CacheSource<Row>): boolean {\n return (\n a.rows === b.rows &&\n a.dataColumns === b.dataColumns &&\n a.locale === b.locale &&\n a.messages === b.messages\n );\n}\n\nfunction sameEntries<Row>(\n a: readonly FilterEntry<Row>[],\n b: readonly FilterEntry<Row>[],\n): boolean {\n return a.length === b.length && a.every((entry, index) => entry === b[index]);\n}\n\n/**\n * A memo of each column's checklist values, for a renderer to hold one of\n * per grid: reopening a column's checklist hands back the list it was given\n * last time — the same object — rather than counting `rows` again, until\n * something the list depends on changes.\n *\n * That is the `rows` and `dataColumns`, the `locale` and `messages` it is\n * labelled in, and the filter's entries not about the column — all compared\n * by identity, the entries one by one. Identity holds across an apply:\n * `draftToFilter` keeps every entry it doesn't replace as it was, so\n * filtering one column leaves the lists of the others to recount and its\n * own cached, since a column's list never depends on its own entries.\n *\n * Each column keeps its latest list. New rows, columns, locale or messages\n * drop every list, so the cache never holds on to rows the grid has let go\n * of — pass the grid's own, which keep their identity between renders.\n */\nexport function createColumnValueOptionsCache<\n Row,\n>(): ColumnValueOptionsCache<Row> {\n let source: CacheSource<Row> | undefined;\n const lists = new Map<string, CachedList<Row>>();\n return {\n get: (rows, dataColumns, filter, columnId, query = {}) => {\n const { locale, messages } = query;\n const current: CacheSource<Row> = { rows, dataColumns, locale, messages };\n if (source === undefined || !sameSource(source, current)) {\n lists.clear();\n source = current;\n }\n const others = filter.filter((entry) => !touchesColumn(entry, columnId));\n const cached = lists.get(columnId);\n if (cached !== undefined && sameEntries(cached.others, others)) {\n return cached.values;\n }\n const values = columnValueOptions(\n rows,\n dataColumns,\n filter,\n columnId,\n messages === undefined ? { locale } : { locale, messages },\n );\n lists.set(columnId, { others, values });\n return values;\n },\n };\n}\n","import type { FilterScalar } from \"../types\";\nimport type { ValuesDraft } from \"../util/filterEditor\";\nimport {\n keyOf,\n selectAllCoversBlanks,\n visibleFilterOptions,\n} from \"../util/filterEditor\";\n\n/** One row of a checklist: a value the column holds, or its blank cells. */\nexport type FilterChecklistItem = {\n /**\n * Tells the item apart from every other in the list: a value's key is the\n * one `draft.checked` holds it under, and the blanks have their own.\n */\n readonly key: string;\n /** The value as its cells print it, or the blanks' label. */\n readonly label: string;\n /** How many rows hold it, among those the other columns' filters keep. */\n readonly count: number;\n readonly checked: boolean;\n} & (\n | {\n /** Toggled with `filterEditorReducer`'s `toggleValue`. */\n readonly kind: \"value\";\n readonly value: Exclude<FilterScalar, null>;\n }\n | {\n /** Toggled with `filterEditorReducer`'s `setIncludeBlanks`. */\n readonly kind: \"blanks\";\n }\n);\n\nexport interface FilterChecklistOptions {\n /** How many values the list shows at most: the column's resolved `valueLimit`. */\n readonly valueLimit: number;\n /** The blanks item's label: the grid's `filterBlanks` message. */\n readonly blanksLabel: string;\n}\n\n/** What a checklist editor draws below its search box and select-all. */\nexport interface FilterChecklist {\n /**\n * The rows to draw, in order: the values the search shows, cut to\n * `valueLimit`, then the blanks while nothing is searched and some cells\n * are blank. Empty while `needsSearch`.\n */\n readonly items: readonly FilterChecklistItem[];\n /**\n * Whether the list waits for a search: the column holds more values than\n * `valueLimit` and nothing is searched yet — `filterSearchFirst(total)`.\n */\n readonly needsSearch: boolean;\n /**\n * How many of the values the search matches `valueLimit` left out of\n * `items` — `filterMoreValues(hiddenCount)`. `0` while `needsSearch`, so\n * the two notes never show together.\n */\n readonly hiddenCount: number;\n /** How many values the search matches — every value while nothing is searched. Blanks aside. */\n readonly total: number;\n}\n\n/**\n * The list a checklist editor draws for `draft`: the window of values its\n * search shows, as items carrying what each row says and whether it is\n * checked. A draft on its conditions draws through `toValuesDraft`.\n *\n * A column can hold far more values than a list is worth scrolling, so the\n * list shows at most `valueLimit` of them. Past that, it shows nothing until\n * something is searched (`needsSearch`) — every value is still in the draft,\n * and select-all still covers them all — and a search matching more shows\n * the first `valueLimit` of its matches in sort order, with the rest counted\n * in `hiddenCount`.\n *\n * The blanks item comes last, as in Excel's, and only while nothing is\n * searched: exactly when select-all counts the blanks, so the checkbox acts\n * on what the list shows.\n */\nexport function filterChecklist<Row>(\n draft: ValuesDraft<Row>,\n { valueLimit, blanksLabel }: FilterChecklistOptions,\n): FilterChecklist {\n const visible = visibleFilterOptions(draft);\n const total = visible.length;\n if (draft.search === \"\" && total > valueLimit) {\n return { items: [], needsSearch: true, hiddenCount: 0, total };\n }\n const items = visible\n .slice(0, valueLimit)\n .map(({ value, label, count }): FilterChecklistItem => {\n const key = keyOf(draft, value);\n const checked = draft.checked.has(key);\n return { kind: \"value\", key, value, label, count, checked };\n });\n const hiddenCount = total - items.length;\n if (selectAllCoversBlanks(draft)) {\n items.push({\n kind: \"blanks\",\n // Blank cells' own key, which no offered value has.\n key: keyOf(draft, null),\n label: blanksLabel,\n count: draft.blanks,\n checked: draft.includeBlanks,\n });\n }\n return { items, needsSearch: false, hiddenCount, total };\n}\n","/**\n * One entry per row: its measured height once known, `undefined` until then.\n * A row never yet rendered (or rendered but not yet observed) falls back to\n * `visibleRange`'s own `estimatedHeight` argument.\n */\nexport type RowHeights = readonly (number | undefined)[];\n\nexport interface VisibleRange {\n readonly startIndex: number;\n readonly endIndex: number; // inclusive\n /** Total height of every row before `startIndex` — the leading spacer's height. */\n readonly offsetBefore: number;\n /** Total height of every row after `endIndex` — the trailing spacer's height. */\n readonly offsetAfter: number;\n}\n\n/**\n * Which rows of a dynamic-height, virtualized list fall within\n * `[scrollTop, scrollTop + viewportHeight)`, padded by `overscan` rows on\n * each side and clamped to the array's own bounds.\n *\n * Walks a cumulative-offset prefix sum built from `heights` (measured height\n * where known, `estimatedHeight` otherwise) rather than assuming a uniform\n * row height — this codebase's rows are not uniform (`.is-wrapped` cells,\n * group header/summary rows), so a fixed-height virtualizer would either\n * break wrapping or force it out of scope.\n *\n * `O(n)` in `heights.length`. Deliberately not a Fenwick tree or a\n * binary-searchable prefix-sum structure — that optimization belongs in the\n * mutable height cache that already owns mutability (`createRowVirtualizer`\n * in `@gridkitjs/dom`), not in this pure function's contract, and is not\n * worth taking on until a profiled scenario actually shows it matters at\n * realistic row counts.\n */\nexport function visibleRange(\n heights: RowHeights,\n estimatedHeight: number,\n scrollTop: number,\n viewportHeight: number,\n overscan: number,\n): VisibleRange {\n const rowCount = heights.length;\n if (rowCount === 0) {\n return { startIndex: 0, endIndex: -1, offsetBefore: 0, offsetAfter: 0 };\n }\n\n function heightAt(index: number): number {\n return heights[index] ?? estimatedHeight;\n }\n\n const viewportBottom = scrollTop + viewportHeight;\n\n // The first row whose bottom edge crosses `scrollTop` — everything before\n // it is fully scrolled past. `top` tracks that row's own top edge (the\n // cumulative height of every row before it) as the walk advances. Stops at\n // the last row rather than walking off the end when `scrollTop` reaches or\n // exceeds the total height.\n let start = 0;\n let top = 0;\n while (start < rowCount - 1 && top + heightAt(start) <= scrollTop) {\n top += heightAt(start);\n start += 1;\n }\n const startTop = top;\n\n // From `start`, the last row whose top edge is still above `viewportBottom`\n // — the first row no longer even partially visible ends the walk one row\n // earlier than it, or the array itself runs out first. `bottom` tracks the\n // current row's own bottom edge.\n let end = start;\n let bottom = startTop + heightAt(start);\n while (end < rowCount - 1 && bottom < viewportBottom) {\n end += 1;\n bottom += heightAt(end);\n }\n\n const overscanStart = Math.max(0, start - overscan);\n const overscanEnd = Math.min(rowCount - 1, end + overscan);\n\n let offsetBefore = 0;\n for (let index = 0; index < overscanStart; index++) {\n offsetBefore += heightAt(index);\n }\n let offsetAfter = 0;\n for (let index = overscanEnd + 1; index < rowCount; index++) {\n offsetAfter += heightAt(index);\n }\n\n return {\n startIndex: overscanStart,\n endIndex: overscanEnd,\n offsetBefore,\n offsetAfter,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,WAAW,OAAe,MAAc,MAAwB;AACvE,QAAM,UAAU,QAAQ,KAAK,OAAO;AACpC,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO,QAAQ;AAAA,IACjB,KAAK;AACH,aAAO,UAAU,OAAO,IAAI;AAAA,IAC9B,KAAK;AACH,aAAO,UAAU,OAAO,IAAI,QAAQ;AAAA,EACxC;AACF;AAYO,SAAS,cACd,SACA,MACA,MACQ;AACR,QAAM,QAAQ,QAAQ;AACtB,QAAM,OAAO,SAAS,UAAU,SAAS,UAAU,IAAI;AACvD,QAAM,QAAQ,WAAW,OAAO,MAAM,IAAI;AAC1C,WAAS,SAAS,GAAG,SAAS,OAAO,UAAU;AAC7C,UAAM,UAAW,QAAQ,OAAO,UAAU,QAAS,SAAS;AAC5D,QAAI,QAAQ,KAAK,GAAG,SAAS,aAAa;AACxC,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAaO,SAAS,eACd,QACA,MACA,OACQ;AACR,QAAM,QAAQ,MAAM,YAAY;AAChC,QAAM,iBAAiB,MAAM,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AM,iBAAiB,YAAY;AAOnC,MAAI,QAAQ;AACZ,MAAI,MAAM;AACV,SAAO,QAAQ,WAAW,KAAK,MAAM,SAAS,KAAK,KAAK,WAAW;AACjE,WAAO,SAAS,KAAK;AACrB,aAAS;AAAA,EACX;AACA,QAAM,WAAW;AAMjB,MAAI,MAAM;AACV,MAAI,SAAS,WAAW,SAAS,KAAK;AACtC,SAAO,MAAM,WAAW,KAAK,SAAS,gBAAgB;AACpD,WAAO;AACP,cAAU,SAAS,GAAG;AAAA,EACxB;AAEA,QAAM,gBAAgB,KAAK,IAAI,GAAG,QAAQ,QAAQ;AAClD,QAAM,cAAc,KAAK,IAAI,WAAW,GAAG,MAAM,QAAQ;AAEzD,MAAI,eAAe;AACnB,WAAS,QAAQ,GAAG,QAAQ,eAAe,SAAS;AAClD,oBAAgB,SAAS,KAAK;AAAA,EAChC;AACA,MAAI,cAAc;AAClB,WAAS,QAAQ,cAAc,GAAG,QAAQ,UAAU,SAAS;AAC3D,mBAAe,SAAS,KAAK;AAAA,EAC/B;AAEA,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,UAAU;AAAA,IACV;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/menu/navigation.ts","../src/toolbar/overflow.ts","../src/toolbar/search.ts","../src/util/paginationWindow.ts","../src/util/columnChooser.ts","../src/filterMenu/conditions.ts","../src/filterMenu/valueCache.ts","../src/filterMenu/checklist.ts","../src/util/virtualization.ts"],"sourcesContent":["import type { ResolvedMenuEntry } from \"./types\";\n\n/** Where an arrow, Home or End key moves a menu's focus. */\nexport type MenuMove = \"next\" | \"previous\" | \"first\" | \"last\";\n\n/** Where the search for the next item begins, before skipping separators. */\nfunction startIndex(count: number, from: number, move: MenuMove): number {\n const focused = from >= 0 && from < count;\n switch (move) {\n case \"first\":\n return 0;\n case \"last\":\n return count - 1;\n case \"next\":\n return focused ? from + 1 : 0;\n case \"previous\":\n return focused ? from - 1 : count - 1;\n }\n}\n\n/**\n * The index of the item focus moves to from `from` — `-1` when nothing is\n * focused yet, so `\"next\"` lands on the first item and `\"previous\"` on the\n * last. Separators are skipped and `\"next\"`/`\"previous\"` wrap round the\n * ends; disabled items count, since they stay focusable for a screen reader\n * to find. `-1` when there is no item at all.\n *\n * Takes anything with a `type`, so a behaviour that reads its items off the\n * page can pass `{ type: \"item\" }` for each.\n */\nexport function nextMenuIndex(\n entries: readonly Pick<ResolvedMenuEntry, \"type\">[],\n from: number,\n move: MenuMove,\n): number {\n const count = entries.length;\n const step = move === \"next\" || move === \"first\" ? 1 : -1;\n const start = startIndex(count, from, move);\n for (let offset = 0; offset < count; offset++) {\n const index = (((start + step * offset) % count) + count) % count;\n if (entries[index]?.type !== \"separator\") {\n return index;\n }\n }\n return -1;\n}\n\n/**\n * The index of the item `query` — what was typed, buffered for a moment —\n * picks, matched case-insensitively against the start of each label and\n * wrapping round the end; `-1` when none matches.\n *\n * `from` is the item focused now. A single letter, or the same letter\n * typed again and again, searches from the item after it, so repeating a\n * letter steps through every item it starts. A longer query searches from\n * `from` itself, so the item already found stays put while what is typed\n * still matches it.\n */\nexport function typeaheadIndex(\n labels: readonly string[],\n from: number,\n query: string,\n): number {\n const typed = query.toLowerCase();\n const firstCodePoint = typed.codePointAt(0);\n if (firstCodePoint === undefined) {\n return -1;\n }\n const first = String.fromCodePoint(firstCodePoint);\n const repeated = typed.replaceAll(first, \"\") === \"\";\n const prefix = repeated ? first : typed;\n const start = repeated ? from + 1 : Math.max(from, 0);\n for (let offset = 0; offset < labels.length; offset++) {\n const index = (start + offset) % labels.length;\n if (labels[index]?.toLowerCase().startsWith(prefix) === true) {\n return index;\n }\n }\n return -1;\n}\n","import { collapseSeparators } from \"../menu/resolveMenu\";\nimport type { ResolvedMenuEntry } from \"../menu/types\";\nimport type { ResolvedToolbarItem } from \"./types\";\n\n/** What `fitToolbarItems` fits: a toolbar's entries, by width, into its space. */\nexport interface ToolbarFitInput {\n /** Each entry's width, in order — `0` for a spacer, whose width is only the space left over. */\n readonly widths: readonly number[];\n /** The width the entries share. */\n readonly available: number;\n /** The width of the \"More\" button the entries that do not fit go into. */\n readonly moreWidth: number;\n /** Whether each entry, in order, stays however little room there is. */\n readonly pinned: readonly boolean[];\n}\n\n/**\n * How many of a toolbar's entries fit, from the start: the first `count`\n * stay in the toolbar, with every pinned entry after them, and the rest go\n * into a \"More\" menu.\n *\n * Pinned entries take their room first, wherever they are. Room for \"More\"\n * is kept only when something does not fit — when everything does, the\n * result is every entry and no \"More\" is drawn. Entries are taken in order\n * and the first that does not fit ends the count, so the toolbar keeps its\n * order rather than filling gaps with later, narrower entries; one with no\n * width, a spacer, fits wherever the entries before it did.\n */\nexport function fitToolbarItems({\n widths,\n available,\n moreWidth,\n pinned,\n}: ToolbarFitInput): number {\n const total = widths.reduce((sum, width) => sum + width, 0);\n if (total <= available) {\n return widths.length;\n }\n let used =\n moreWidth +\n widths.reduce((sum, width, index) => sum + (pinned[index] ? width : 0), 0);\n for (const [index, width] of widths.entries()) {\n if (!pinned[index]) {\n used += width;\n if (used > available) {\n return index;\n }\n }\n }\n return widths.length;\n}\n\n/**\n * Whether a toolbar entry stays in the toolbar however narrow it gets: the\n * search box and custom entries, which have no menu item to become.\n */\nexport function isPinnedToolbarItem(\n item: Pick<ResolvedToolbarItem, \"type\">,\n): boolean {\n return item.type === \"search\" || item.type === \"custom\";\n}\n\n/** A toolbar split at the count `fitToolbarItems` gave — see `splitToolbarItems`. */\nexport interface ToolbarSplit {\n /** What stays in the toolbar. */\n readonly shown: readonly ResolvedToolbarItem[];\n /** The \"More\" menu's entries, empty when everything fits. */\n readonly overflow: readonly ResolvedMenuEntry[];\n}\n\n/** An entry that did not fit, as the \"More\" menu lists it; `null` for a spacer. */\nfunction asMenuEntry(item: ResolvedToolbarItem): ResolvedMenuEntry | null {\n switch (item.type) {\n case \"button\":\n return {\n type: \"item\",\n id: item.id,\n label: item.label,\n icon: item.icon,\n shortcut: item.shortcut,\n disabled: item.disabled,\n checked: item.pressed,\n run: item.run,\n };\n case \"menu\":\n return {\n type: \"submenu\",\n id: item.id,\n label: item.label,\n icon: item.icon,\n items: item.items,\n };\n case \"separator\":\n return item;\n default:\n return null;\n }\n}\n\n/**\n * `items` split at the first `fit`: those before it, and every pinned item,\n * stay in the toolbar; the rest become the \"More\" menu's entries — a button\n * an item, checked where it was pressed, and a dropdown a submenu. Neither\n * side keeps a separator at its ends, doubled, or beside a spacer.\n */\nexport function splitToolbarItems(\n items: readonly ResolvedToolbarItem[],\n fit: number,\n): ToolbarSplit {\n const fits = (item: ResolvedToolbarItem, index: number) =>\n index < fit || isPinnedToolbarItem(item);\n return {\n shown: collapseSeparators(\n items.filter(fits),\n (item) => item.type === \"spacer\",\n ),\n overflow: collapseSeparators(\n items\n .filter((item, index) => !fits(item, index))\n .map(asMenuEntry)\n .filter((entry) => entry !== null),\n ),\n };\n}\n","import type { FilterState } from \"../types\";\nimport { filterQueryFor, setColumnFilter } from \"../util/filtering\";\n\n/**\n * What a search box shows for `filter`: the global text entry's query — the\n * one naming no column — without the `%` anchors that make it a \"contains\"\n * match, or `\"\"` when there is none. A `%` the user typed inside the text\n * stays: only the first and last characters are anchors.\n */\nexport function searchTextOf<Row>(filter: FilterState<Row>): string {\n const query = filterQueryFor(filter) ?? \"\";\n const start = query.startsWith(\"%\") ? 1 : 0;\n const end = query.endsWith(\"%\") ? -1 : undefined;\n return query.slice(start, end);\n}\n\n/**\n * `filter` with its global text entry set to search for `text` anywhere in\n * any column — the query `%text%` — or removed for an empty `text`. Every\n * entry naming a column stays as it was. `filter` itself, unchanged, when\n * it already searches for `text`.\n *\n * `text` is written as typed, spaces and all: a search box reads its text\n * back from the filter, and trimming here would take a space away from\n * under the caret as the user types it.\n */\nexport function setSearchText<Row>(\n filter: FilterState<Row>,\n text: string,\n): FilterState<Row> {\n return setColumnFilter(filter, undefined, text === \"\" ? \"\" : `%${text}%`);\n}\n","export type PaginationWindowEntry = number | \"ellipsis\";\n\n/**\n * Which page numbers a numbered pager should show for `currentPage` of\n * `pageCount` — the boundary + sibling windowing MUI's `usePagination` uses.\n * Always includes the first/last `boundaryCount` pages and a run of\n * `2 * siblingCount + 1` pages around `currentPage`, slid inwards rather than\n * cut short near either end, with one slot between each boundary and that\n * run holding either the single page it skips or an `\"ellipsis\"`.\n *\n * So once `pageCount` exceeds `2 * boundaryCount + 2 * siblingCount + 3`,\n * every window is exactly that many entries long, wherever `currentPage`\n * sits: a pager drawing one fixed-width slot per entry keeps its trailing\n * controls in place as the user pages through. Below that, every page shows.\n */\nexport function paginationWindow(\n currentPage: number,\n pageCount: number,\n options?: {\n boundaryCount?: number | undefined;\n siblingCount?: number | undefined;\n },\n): readonly PaginationWindowEntry[] {\n if (pageCount <= 0) {\n return [];\n }\n\n const boundaryCount = Math.max(0, Math.floor(options?.boundaryCount ?? 1));\n const siblingCount = Math.max(0, Math.floor(options?.siblingCount ?? 1));\n const slotCount = 2 * boundaryCount + 2 * siblingCount + 3;\n\n if (pageCount <= slotCount) {\n return Array.from({ length: pageCount }, (_, index) => index + 1);\n }\n\n const current = Math.min(Math.max(currentPage, 1), pageCount);\n // The sibling run, slid to stay clear of the slot beside each boundary.\n const runStart = Math.min(\n Math.max(current - siblingCount, boundaryCount + 2),\n pageCount - boundaryCount - 1 - 2 * siblingCount,\n );\n const runEnd = runStart + 2 * siblingCount;\n\n const entries: PaginationWindowEntry[] = [];\n for (let page = 1; page <= boundaryCount; page++) {\n entries.push(page);\n }\n entries.push(runStart === boundaryCount + 2 ? boundaryCount + 1 : \"ellipsis\");\n for (let page = runStart; page <= runEnd; page++) {\n entries.push(page);\n }\n entries.push(\n runEnd === pageCount - boundaryCount - 1\n ? pageCount - boundaryCount\n : \"ellipsis\",\n );\n for (let page = pageCount - boundaryCount + 1; page <= pageCount; page++) {\n entries.push(page);\n }\n\n return entries;\n}\n","import type { ColumnVisibilityState, DataColumn } from \"../types\";\nimport type { SelectAllState } from \"./filterEditor\";\nimport { resolveColumnHeaderText } from \"./grid\";\nimport { isColumnVisible } from \"./visibility\";\n\n/** What a column chooser is drawn from: every column, the visibility, and the search typed. */\nexport interface ColumnChooserInput<Row> {\n /** Every column in its current order, hidden ones included — a view's `dataColumns`. */\n readonly columns: readonly DataColumn<Row, unknown>[];\n readonly visibility: ColumnVisibilityState;\n /** Narrows the list to the columns whose header text contains it, ignoring case. */\n readonly search?: string | undefined;\n}\n\n/** One column's checkbox in a column chooser. */\nexport interface ColumnChooserEntry {\n readonly columnId: string;\n /** The column's header text — what the search matches, and the checkbox's label. */\n readonly label: string;\n /** Whether the column is shown — whether its checkbox is checked. */\n readonly visible: boolean;\n /**\n * Whether the checkbox cannot be unchecked: the column is shown and is\n * either not `hideable` or the last column shown. A hidden column can\n * always be shown, `hideable` or not.\n */\n readonly disabled: boolean;\n}\n\n/** What toggling a chooser's \"Show all\" checkbox does: shows these columns, or hides them. */\nexport interface ColumnChooserToggle {\n readonly visible: boolean;\n readonly columnIds: readonly string[];\n}\n\nexport interface ColumnChooserModel {\n /** The columns the search matches, in column order. */\n readonly entries: readonly ColumnChooserEntry[];\n /**\n * The \"Show all\" checkbox's state over the entries whose columns are\n * `hideable` — the ones it acts on. A column the user cannot hide is\n * always on, so counting it would leave \"Show all\" stuck at mixed.\n */\n readonly selectAll: SelectAllState;\n /** What toggling \"Show all\" does, or `null` when it can do nothing — a disabled checkbox. */\n readonly toggleAll: ColumnChooserToggle | null;\n}\n\n/** A column as the chooser reads it. */\ninterface ChooserColumn<Row> {\n readonly column: DataColumn<Row, unknown>;\n readonly label: string;\n readonly visible: boolean;\n}\n\nfunction isHideable<Row>(column: DataColumn<Row, unknown>): boolean {\n return column.column.hideable !== false;\n}\n\nfunction matchesSearch(label: string, search: string): boolean {\n return label.toLowerCase().includes(search.toLowerCase());\n}\n\nfunction selectAllStateOf(states: readonly boolean[]): SelectAllState {\n if (states.length > 0 && states.every(Boolean)) {\n return \"checked\";\n }\n return states.some(Boolean) ? \"mixed\" : \"unchecked\";\n}\n\n/**\n * A column chooser's list for a search, and what its \"Show all\" checkbox\n * says and does — the same tri-state over what the search shows that a\n * filter editor's select-all is (`selectAllState`).\n *\n * \"Show all\" shows every hidden column the search shows once any is hidden,\n * and hides those it shows once none is. It never touches a column that is\n * not `hideable`, and never hides the last column shown: when that is all\n * that would be left, the first of them in column order stays, since a grid\n * with no column shown has no header to bring one back from.\n */\nexport function resolveColumnChooser<Row>({\n columns,\n visibility,\n search = \"\",\n}: ColumnChooserInput<Row>): ColumnChooserModel {\n const all = columns.map((column): ChooserColumn<Row> => ({\n column,\n label: resolveColumnHeaderText(column.column),\n visible: isColumnVisible(column.column, visibility),\n }));\n const shownCount = all.filter(({ visible }) => visible).length;\n const matched = all.filter(({ label }) => matchesSearch(label, search));\n\n const entries = matched.map(\n ({ column, label, visible }): ColumnChooserEntry => ({\n columnId: column.id,\n label,\n visible,\n disabled: visible && (!isHideable(column) || shownCount === 1),\n }),\n );\n\n const covered = matched.filter(({ column }) => isHideable(column));\n const selectAll = selectAllStateOf(covered.map(({ visible }) => visible));\n return {\n entries,\n selectAll,\n toggleAll: toggleAllOf(covered, selectAll, shownCount),\n };\n}\n\nfunction toggleAllOf<Row>(\n covered: readonly ChooserColumn<Row>[],\n selectAll: SelectAllState,\n shownCount: number,\n): ColumnChooserToggle | null {\n const show = selectAll !== \"checked\";\n const changing = covered\n .filter(({ visible }) => visible !== show)\n .map(({ column }) => column.id);\n // Hiding every column shown would leave none: the first of them stays.\n const columnIds =\n !show && changing.length === shownCount ? changing.slice(1) : changing;\n return columnIds.length === 0 ? null : { visible: show, columnIds };\n}\n","import type { ColumnType, FilterOperator, OperatorFilterEntry } from \"../types\";\nimport type { ColumnFilterShape } from \"../util/filterEditor\";\nimport { isScalarList } from \"../util/filterOperators\";\nimport {\n filterOperandArity,\n formatFilterOperand,\n parseFilterOperand,\n} from \"./operators\";\n\n/**\n * One condition row of a simple filter editor as the user types it: text,\n * not yet a value, so a half-typed number or date stays in its input until\n * the editor is applied and `conditionsFromRows` reads it.\n */\nexport interface ConditionRowDraft {\n readonly operator: FilterOperator;\n /** The operand as typed — `between`'s lower end. */\n readonly text: string;\n /**\n * `between`'s upper end, as typed. Kept under any other operator, unread,\n * so switching back to `between` finds it still there.\n */\n readonly textTo: string;\n}\n\n/** What `conditionsFromRows` reads off an editor's rows. */\nexport interface ParsedConditionRows<Row> {\n /** A condition for each row that reads as one, in row order. */\n readonly conditions: readonly OperatorFilterEntry<Row>[];\n /**\n * The indexes of the rows that don't, for the editor to mark. Apply the\n * conditions only once this is empty.\n */\n readonly invalid: readonly number[];\n}\n\n/** A simple editor's rows: one condition, and an optional second joined to it. */\nconst ROW_COUNT = 2;\n\nfunction rowOf<Row>(\n condition: OperatorFilterEntry<Row>,\n type: ColumnType | undefined,\n): ConditionRowDraft {\n const { operator, value } = condition;\n if (isScalarList(value)) {\n const [low, high] = value;\n return {\n operator,\n text: formatFilterOperand(low, type),\n textTo: formatFilterOperand(high, type),\n };\n }\n return { operator, text: formatFilterOperand(value, type), textTo: \"\" };\n}\n\n/**\n * The rows a simple editor opens with over a column's filter `shape`, its\n * operands written as the column's `type` reads them: two, holding the\n * column's conditions when its filter is conditions, and each row they\n * don't fill starting at the first of `operators`, empty. With no operator\n * to start one at, only the rows the filter fills.\n */\nexport function conditionRowsFrom<Row>(\n shape: ColumnFilterShape<Row>,\n operators: readonly FilterOperator[],\n type: ColumnType | undefined,\n): readonly ConditionRowDraft[] {\n const filled =\n shape.kind === \"conditions\"\n ? shape.conditions.map((condition) => rowOf(condition, type))\n : [];\n const [first] = operators;\n if (first === undefined) {\n return filled;\n }\n const blank: ConditionRowDraft = { operator: first, text: \"\", textTo: \"\" };\n return Array.from(\n { length: ROW_COUNT },\n (_, index) => filled[index] ?? blank,\n );\n}\n\n/** Whether a row was left empty: none of the operands its operator takes is typed. */\nfunction isEmptyRow(row: ConditionRowDraft): boolean {\n switch (filterOperandArity(row.operator)) {\n case 0:\n return false;\n case 1:\n return row.text === \"\";\n case 2:\n return row.text === \"\" && row.textTo === \"\";\n }\n}\n\n/** `row` as a condition on `columnId`, or `undefined` when an operand it needs doesn't read. */\nfunction conditionOf<Row>(\n row: ConditionRowDraft,\n columnId: string,\n type: ColumnType | undefined,\n): OperatorFilterEntry<Row> | undefined {\n const { operator } = row;\n switch (filterOperandArity(operator)) {\n case 0:\n return { kind: \"operator\", columnId, operator };\n case 1: {\n const value = parseFilterOperand(row.text, type);\n return value === undefined\n ? undefined\n : { kind: \"operator\", columnId, operator, value };\n }\n case 2: {\n const low = parseFilterOperand(row.text, type);\n const high = parseFilterOperand(row.textTo, type);\n return low === undefined || high === undefined\n ? undefined\n : { kind: \"operator\", columnId, operator, value: [low, high] };\n }\n }\n}\n\n/**\n * The conditions a simple editor's rows stand for on `columnId`, each\n * operand read as the column's `type` filters (`parseFilterOperand`) — for\n * `filterEditorReducer`'s `setConditions`, with the combinator the editor\n * shows.\n *\n * A row needs every operand its operator takes, or it is `invalid`; the\n * blanks operators take none. A row after the first left empty is dropped\n * rather than invalid, since the second condition is optional; an empty\n * first row is invalid — clearing the filter is the editor's clear action,\n * not an apply with nothing typed.\n */\nexport function conditionsFromRows<Row>(\n rows: readonly ConditionRowDraft[],\n columnId: string,\n type: ColumnType | undefined,\n): ParsedConditionRows<Row> {\n const conditions: OperatorFilterEntry<Row>[] = [];\n const invalid: number[] = [];\n for (const [index, row] of rows.entries()) {\n if (index > 0 && isEmptyRow(row)) {\n continue;\n }\n const condition = conditionOf<Row>(row, columnId, type);\n if (condition === undefined) {\n invalid.push(index);\n } else {\n conditions.push(condition);\n }\n }\n return { conditions, invalid };\n}\n","import type { GridMessages } from \"../messages\";\nimport type { DataColumn, FilterEntry, FilterState } from \"../types\";\nimport type {\n ColumnValueOptions,\n ColumnValueQuery,\n} from \"../util/filterEditor\";\nimport { columnValueOptions, touchesColumn } from \"../util/filterEditor\";\nimport type { FormatLocale } from \"../util/format\";\n\n/**\n * What a cached list is labelled by: `columnValueOptions`' query without\n * `search` and `limit`, which a draft applies over the whole list.\n */\nexport type ColumnValueCacheQuery = Pick<\n ColumnValueQuery,\n \"locale\" | \"messages\"\n>;\n\n/** `columnValueOptions`, remembered per column. */\nexport interface ColumnValueOptionsCache<Row> {\n /**\n * `columnId`'s whole value list — `columnValueOptions` with no `search`\n * or `limit` — or the very list it returned last time, when nothing the\n * list is counted from or labelled by has changed since.\n */\n readonly get: (\n rows: readonly Row[],\n dataColumns: readonly DataColumn<Row, unknown>[],\n filter: FilterState<Row>,\n columnId: string,\n query?: ColumnValueCacheQuery,\n ) => ColumnValueOptions;\n}\n\n/** What every list in a cache is counted from and labelled by. */\ninterface CacheSource<Row> {\n readonly rows: readonly Row[];\n readonly dataColumns: readonly DataColumn<Row, unknown>[];\n readonly locale: FormatLocale;\n readonly messages: Partial<GridMessages> | undefined;\n}\n\ninterface CachedList<Row> {\n /** The entries it was counted under: every one not about its column. */\n readonly others: FilterState<Row>;\n readonly values: ColumnValueOptions;\n}\n\nfunction sameSource<Row>(a: CacheSource<Row>, b: CacheSource<Row>): boolean {\n return (\n a.rows === b.rows &&\n a.dataColumns === b.dataColumns &&\n a.locale === b.locale &&\n a.messages === b.messages\n );\n}\n\nfunction sameEntries<Row>(\n a: readonly FilterEntry<Row>[],\n b: readonly FilterEntry<Row>[],\n): boolean {\n return a.length === b.length && a.every((entry, index) => entry === b[index]);\n}\n\n/**\n * A memo of each column's checklist values, for a renderer to hold one of\n * per grid: reopening a column's checklist hands back the list it was given\n * last time — the same object — rather than counting `rows` again, until\n * something the list depends on changes.\n *\n * That is the `rows` and `dataColumns`, the `locale` and `messages` it is\n * labelled in, and the filter's entries not about the column — all compared\n * by identity, the entries one by one. Identity holds across an apply:\n * `draftToFilter` keeps every entry it doesn't replace as it was, so\n * filtering one column leaves the lists of the others to recount and its\n * own cached, since a column's list never depends on its own entries.\n *\n * Each column keeps its latest list. New rows, columns, locale or messages\n * drop every list, so the cache never holds on to rows the grid has let go\n * of — pass the grid's own, which keep their identity between renders.\n */\nexport function createColumnValueOptionsCache<\n Row,\n>(): ColumnValueOptionsCache<Row> {\n let source: CacheSource<Row> | undefined;\n const lists = new Map<string, CachedList<Row>>();\n return {\n get: (rows, dataColumns, filter, columnId, query = {}) => {\n const { locale, messages } = query;\n const current: CacheSource<Row> = { rows, dataColumns, locale, messages };\n if (source === undefined || !sameSource(source, current)) {\n lists.clear();\n source = current;\n }\n const others = filter.filter((entry) => !touchesColumn(entry, columnId));\n const cached = lists.get(columnId);\n if (cached !== undefined && sameEntries(cached.others, others)) {\n return cached.values;\n }\n const values = columnValueOptions(\n rows,\n dataColumns,\n filter,\n columnId,\n messages === undefined ? { locale } : { locale, messages },\n );\n lists.set(columnId, { others, values });\n return values;\n },\n };\n}\n","import type { FilterScalar } from \"../types\";\nimport type { ValuesDraft } from \"../util/filterEditor\";\nimport {\n keyOf,\n selectAllCoversBlanks,\n visibleFilterOptions,\n} from \"../util/filterEditor\";\n\n/** One row of a checklist: a value the column holds, or its blank cells. */\nexport type FilterChecklistItem = {\n /**\n * Tells the item apart from every other in the list: a value's key is the\n * one `draft.checked` holds it under, and the blanks have their own.\n */\n readonly key: string;\n /** The value as its cells print it, or the blanks' label. */\n readonly label: string;\n /** How many rows hold it, among those the other columns' filters keep. */\n readonly count: number;\n readonly checked: boolean;\n} & (\n | {\n /** Toggled with `filterEditorReducer`'s `toggleValue`. */\n readonly kind: \"value\";\n readonly value: Exclude<FilterScalar, null>;\n }\n | {\n /** Toggled with `filterEditorReducer`'s `setIncludeBlanks`. */\n readonly kind: \"blanks\";\n }\n);\n\nexport interface FilterChecklistOptions {\n /** How many values the list shows at most: the column's resolved `valueLimit`. */\n readonly valueLimit: number;\n /** The blanks item's label: the grid's `filterBlanks` message. */\n readonly blanksLabel: string;\n}\n\n/** What a checklist editor draws below its search box and select-all. */\nexport interface FilterChecklist {\n /**\n * The rows to draw, in order: the values the search shows, cut to\n * `valueLimit`, then the blanks while nothing is searched and some cells\n * are blank. Empty while `needsSearch`.\n */\n readonly items: readonly FilterChecklistItem[];\n /**\n * Whether the list waits for a search: the column holds more values than\n * `valueLimit` and nothing is searched yet — `filterSearchFirst(total)`.\n */\n readonly needsSearch: boolean;\n /**\n * How many of the values the search matches `valueLimit` left out of\n * `items` — `filterMoreValues(hiddenCount)`. `0` while `needsSearch`, so\n * the two notes never show together.\n */\n readonly hiddenCount: number;\n /** How many values the search matches — every value while nothing is searched. Blanks aside. */\n readonly total: number;\n}\n\n/**\n * The list a checklist editor draws for `draft`: the window of values its\n * search shows, as items carrying what each row says and whether it is\n * checked. A draft on its conditions draws through `toValuesDraft`.\n *\n * A column can hold far more values than a list is worth scrolling, so the\n * list shows at most `valueLimit` of them. Past that, it shows nothing until\n * something is searched (`needsSearch`) — every value is still in the draft,\n * and select-all still covers them all — and a search matching more shows\n * the first `valueLimit` of its matches in sort order, with the rest counted\n * in `hiddenCount`.\n *\n * The blanks item comes last, as in Excel's, and only while nothing is\n * searched: exactly when select-all counts the blanks, so the checkbox acts\n * on what the list shows.\n */\nexport function filterChecklist<Row>(\n draft: ValuesDraft<Row>,\n { valueLimit, blanksLabel }: FilterChecklistOptions,\n): FilterChecklist {\n const visible = visibleFilterOptions(draft);\n const total = visible.length;\n if (draft.search === \"\" && total > valueLimit) {\n return { items: [], needsSearch: true, hiddenCount: 0, total };\n }\n const items = visible\n .slice(0, valueLimit)\n .map(({ value, label, count }): FilterChecklistItem => {\n const key = keyOf(draft, value);\n const checked = draft.checked.has(key);\n return { kind: \"value\", key, value, label, count, checked };\n });\n const hiddenCount = total - items.length;\n if (selectAllCoversBlanks(draft)) {\n items.push({\n kind: \"blanks\",\n // Blank cells' own key, which no offered value has.\n key: keyOf(draft, null),\n label: blanksLabel,\n count: draft.blanks,\n checked: draft.includeBlanks,\n });\n }\n return { items, needsSearch: false, hiddenCount, total };\n}\n","/**\n * One entry per row: its measured height once known, `undefined` until then.\n * A row never yet rendered (or rendered but not yet observed) falls back to\n * `visibleRange`'s own `estimatedHeight` argument.\n */\nexport type RowHeights = readonly (number | undefined)[];\n\nexport interface VisibleRange {\n readonly startIndex: number;\n readonly endIndex: number; // inclusive\n /** Total height of every row before `startIndex` — the leading spacer's height. */\n readonly offsetBefore: number;\n /** Total height of every row after `endIndex` — the trailing spacer's height. */\n readonly offsetAfter: number;\n}\n\n/**\n * Which rows of a dynamic-height, virtualized list fall within\n * `[scrollTop, scrollTop + viewportHeight)`, padded by `overscan` rows on\n * each side and clamped to the array's own bounds.\n *\n * Walks a cumulative-offset prefix sum built from `heights` (measured height\n * where known, `estimatedHeight` otherwise) rather than assuming a uniform\n * row height — this codebase's rows are not uniform (`.is-wrapped` cells,\n * group header/summary rows), so a fixed-height virtualizer would either\n * break wrapping or force it out of scope.\n *\n * `O(n)` in `heights.length`. Deliberately not a Fenwick tree or a\n * binary-searchable prefix-sum structure — that optimization belongs in the\n * mutable height cache that already owns mutability (`createRowVirtualizer`\n * in `@gridkitjs/dom`), not in this pure function's contract, and is not\n * worth taking on until a profiled scenario actually shows it matters at\n * realistic row counts.\n */\nexport function visibleRange(\n heights: RowHeights,\n estimatedHeight: number,\n scrollTop: number,\n viewportHeight: number,\n overscan: number,\n): VisibleRange {\n const rowCount = heights.length;\n if (rowCount === 0) {\n return { startIndex: 0, endIndex: -1, offsetBefore: 0, offsetAfter: 0 };\n }\n\n function heightAt(index: number): number {\n return heights[index] ?? estimatedHeight;\n }\n\n const viewportBottom = scrollTop + viewportHeight;\n\n // The first row whose bottom edge crosses `scrollTop` — everything before\n // it is fully scrolled past. `top` tracks that row's own top edge (the\n // cumulative height of every row before it) as the walk advances. Stops at\n // the last row rather than walking off the end when `scrollTop` reaches or\n // exceeds the total height.\n let start = 0;\n let top = 0;\n while (start < rowCount - 1 && top + heightAt(start) <= scrollTop) {\n top += heightAt(start);\n start += 1;\n }\n const startTop = top;\n\n // From `start`, the last row whose top edge is still above `viewportBottom`\n // — the first row no longer even partially visible ends the walk one row\n // earlier than it, or the array itself runs out first. `bottom` tracks the\n // current row's own bottom edge.\n let end = start;\n let bottom = startTop + heightAt(start);\n while (end < rowCount - 1 && bottom < viewportBottom) {\n end += 1;\n bottom += heightAt(end);\n }\n\n const overscanStart = Math.max(0, start - overscan);\n const overscanEnd = Math.min(rowCount - 1, end + overscan);\n\n let offsetBefore = 0;\n for (let index = 0; index < overscanStart; index++) {\n offsetBefore += heightAt(index);\n }\n let offsetAfter = 0;\n for (let index = overscanEnd + 1; index < rowCount; index++) {\n offsetAfter += heightAt(index);\n }\n\n return {\n startIndex: overscanStart,\n endIndex: overscanEnd,\n offsetBefore,\n offsetAfter,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,WAAW,OAAe,MAAc,MAAwB;AACvE,QAAM,UAAU,QAAQ,KAAK,OAAO;AACpC,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO,QAAQ;AAAA,IACjB,KAAK;AACH,aAAO,UAAU,OAAO,IAAI;AAAA,IAC9B,KAAK;AACH,aAAO,UAAU,OAAO,IAAI,QAAQ;AAAA,EACxC;AACF;AAYO,SAAS,cACd,SACA,MACA,MACQ;AACR,QAAM,QAAQ,QAAQ;AACtB,QAAM,OAAO,SAAS,UAAU,SAAS,UAAU,IAAI;AACvD,QAAM,QAAQ,WAAW,OAAO,MAAM,IAAI;AAC1C,WAAS,SAAS,GAAG,SAAS,OAAO,UAAU;AAC7C,UAAM,UAAW,QAAQ,OAAO,UAAU,QAAS,SAAS;AAC5D,QAAI,QAAQ,KAAK,GAAG,SAAS,aAAa;AACxC,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAaO,SAAS,eACd,QACA,MACA,OACQ;AACR,QAAM,QAAQ,MAAM,YAAY;AAChC,QAAM,iBAAiB,MAAM,YAAY,CAAC;AAC1C,MAAI,mBAAmB,QAAW;AAChC,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,OAAO,cAAc,cAAc;AACjD,QAAM,WAAW,M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ACjE,WAAO,SAAS,KAAK;AACrB,aAAS;AAAA,EACX;AACA,QAAM,WAAW;AAMjB,MAAI,MAAM;AACV,MAAI,SAAS,WAAW,SAAS,KAAK;AACtC,SAAO,MAAM,WAAW,KAAK,SAAS,gBAAgB;AACpD,WAAO;AACP,cAAU,SAAS,GAAG;AAAA,EACxB;AAEA,QAAM,gBAAgB,KAAK,IAAI,GAAG,QAAQ,QAAQ;AAClD,QAAM,cAAc,KAAK,IAAI,WAAW,GAAG,MAAM,QAAQ;AAEzD,MAAI,eAAe;AACnB,WAAS,QAAQ,GAAG,QAAQ,eAAe,SAAS;AAClD,oBAAgB,SAAS,KAAK;AAAA,EAChC;AACA,MAAI,cAAc;AAClB,WAAS,QAAQ,cAAc,GAAG,QAAQ,UAAU,SAAS;AAC3D,mBAAe,SAAS,KAAK;AAAA,EAC/B;AAEA,SAAO;AAAA,IACL,YAAY;AAAA,IACZ,UAAU;AAAA,IACV;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridkitjs/core",
3
- "version": "0.0.0-dev-20261118134132",
3
+ "version": "0.0.0-dev-20261118190822",
4
4
  "description": "Framework-agnostic data-grid logic: column resolution, alignment and sizing.",
5
5
  "license": "MIT",
6
6
  "author": "Blagoja Blazhevski",