@gridkitjs/core 0.0.0-dev-20261112200523 → 0.0.0-dev-20261118081957
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/{chunk-AHDALZCY.js → chunk-DHSWUNSZ.js} +128 -111
- package/dist/chunk-DHSWUNSZ.js.map +1 -0
- package/dist/{filterEditor-9hncygVf.d.ts → filterEditor-C2nZkvgC.d.ts} +61 -16
- package/dist/index.d.ts +2 -2
- package/dist/index.js +73 -22
- package/dist/index.js.map +1 -1
- package/dist/renderer.d.ts +2 -2
- package/dist/renderer.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AHDALZCY.js.map +0 -1
|
@@ -184,7 +184,7 @@ interface GridController<Row, Node = string> {
|
|
|
184
184
|
readonly setColumnSelection: (selection: SelectionState) => void;
|
|
185
185
|
/** `selectRow`, for a column among the columns as rendered. */
|
|
186
186
|
readonly selectColumn: (columnId: string, intent: SelectIntent) => void;
|
|
187
|
-
/** Replaces the
|
|
187
|
+
/** Replaces the cell selection as given, `{ kind: "none" }` for none. */
|
|
188
188
|
readonly setCellSelection: (selection: CellSelectionState) => void;
|
|
189
189
|
/**
|
|
190
190
|
* Applies one click or key press to a cell: `"toggle"` lets go of it when
|
|
@@ -702,7 +702,8 @@ interface ExportGroupSummaryRow {
|
|
|
702
702
|
}
|
|
703
703
|
/**
|
|
704
704
|
* A body row of an export, in the order the grid shows them. Discriminate on
|
|
705
|
-
* `kind
|
|
705
|
+
* `kind`; a minor release may add a kind, so a writer's `switch` over it
|
|
706
|
+
* needs a `default`.
|
|
706
707
|
*/
|
|
707
708
|
type ExportRow = ExportDataRow | ExportGroupRow | ExportGroupSummaryRow;
|
|
708
709
|
/**
|
|
@@ -1243,11 +1244,15 @@ interface GridCommand<Row> {
|
|
|
1243
1244
|
readonly execute: ((context: GridCommandContext<Row>) => void) | ((context: GridCommandContext<Row>) => boolean);
|
|
1244
1245
|
}
|
|
1245
1246
|
|
|
1246
|
-
/**
|
|
1247
|
+
/**
|
|
1248
|
+
* The id of every command `builtInCommands` returns. A minor release may
|
|
1249
|
+
* add a command, so a `switch` over it needs a `default`.
|
|
1250
|
+
*/
|
|
1247
1251
|
type BuiltInCommandId = "sort.ascending" | "sort.descending" | "sort.clear" | "sort.clearAll" | "group.add" | "group.remove" | "group.clearAll" | "group.expandAll" | "group.collapseAll" | "column.hide" | "column.autoFit" | "column.autoFitAll" | "column.choose" | "filter.open" | "filter.clear" | "selection.selectAllRows" | "selection.clear" | "filter.clearAll" | "export.csv" | "export.json" | "export.xlsx" | "export.pdf" | "exportSelection.csv" | "exportSelection.json" | "exportSelection.xlsx" | "copy.cell" | "copy.row" | "copy.selection" | "print";
|
|
1248
1252
|
/**
|
|
1249
1253
|
* The icon keys the built-ins carry, which a renderer draws as icons of its
|
|
1250
|
-
* own. An app command may use them too, to look like the built-ins.
|
|
1254
|
+
* own. An app command may use them too, to look like the built-ins. A minor
|
|
1255
|
+
* release may add a key, so a renderer's map of them needs a fallback.
|
|
1251
1256
|
*/
|
|
1252
1257
|
type BuiltInCommandIcon = "sortAscending" | "sortDescending" | "group" | "hide" | "autoFit" | "copy" | "print";
|
|
1253
1258
|
/**
|
|
@@ -1334,7 +1339,10 @@ interface ResolvedMenuSeparator {
|
|
|
1334
1339
|
/** One entry of a menu as `resolveMenu` hands it to a renderer to draw. */
|
|
1335
1340
|
type ResolvedMenuEntry = ResolvedMenuItem | ResolvedMenuSubmenu | ResolvedMenuSeparator;
|
|
1336
1341
|
|
|
1337
|
-
/**
|
|
1342
|
+
/**
|
|
1343
|
+
* The parts of a grid that open a context menu of their own. A minor
|
|
1344
|
+
* release may add an area, so a `switch` over it needs a `default`.
|
|
1345
|
+
*/
|
|
1338
1346
|
type GridContextMenuArea = "header" | "cell" | "group" | "body";
|
|
1339
1347
|
/**
|
|
1340
1348
|
* Where a context menu opens: a command target in one of the context menu
|
|
@@ -1644,9 +1652,9 @@ interface GridOptions<Row> {
|
|
|
1644
1652
|
/** The cell selected to start with. Uncontrolled. */
|
|
1645
1653
|
defaultCellSelection?: CellSelectionState | undefined;
|
|
1646
1654
|
/**
|
|
1647
|
-
* The selected cell, controlled — `
|
|
1648
|
-
* the cell selection callbacks. Leave it `undefined` for the
|
|
1649
|
-
* it.
|
|
1655
|
+
* The selected cell, controlled — `{ kind: "none" }` for none, changed
|
|
1656
|
+
* only through the cell selection callbacks. Leave it `undefined` for the
|
|
1657
|
+
* grid to keep it.
|
|
1650
1658
|
*/
|
|
1651
1659
|
cellSelection?: CellSelectionState | undefined;
|
|
1652
1660
|
/** Whether columns can be dragged wider, unless a column says otherwise. */
|
|
@@ -2547,6 +2555,10 @@ interface ResolvedGroupRow {
|
|
|
2547
2555
|
readonly expanded: boolean;
|
|
2548
2556
|
/** Leaf row count under this group, regardless of collapse state. */
|
|
2549
2557
|
readonly count: number;
|
|
2558
|
+
/** 1-based place among the groups sharing its parent, for `aria-posinset`: the same on every page. */
|
|
2559
|
+
readonly position: number;
|
|
2560
|
+
/** How many groups share its parent, itself included, for `aria-setsize`: the same on every page. */
|
|
2561
|
+
readonly setSize: number;
|
|
2550
2562
|
/** Position among the display rows as rendered — same invariant ResolvedRow.rowIndex keeps. */
|
|
2551
2563
|
readonly rowIndex: number;
|
|
2552
2564
|
/** This header's absolute position in the whole filtered/sorted/grouped dataset, matching ResolvedRow.datasetIndex. */
|
|
@@ -2819,8 +2831,18 @@ interface SelectedCellRef {
|
|
|
2819
2831
|
readonly rowId: string;
|
|
2820
2832
|
readonly columnId: string;
|
|
2821
2833
|
}
|
|
2822
|
-
/**
|
|
2823
|
-
|
|
2834
|
+
/**
|
|
2835
|
+
* Which cells are selected: none, or one cell by its address. A minor
|
|
2836
|
+
* release may add a member, such as a range of cells, so a `switch` over
|
|
2837
|
+
* `kind` needs a `default`.
|
|
2838
|
+
*/
|
|
2839
|
+
type CellSelectionState = {
|
|
2840
|
+
readonly kind: "none";
|
|
2841
|
+
} | {
|
|
2842
|
+
readonly kind: "cell";
|
|
2843
|
+
readonly rowId: string;
|
|
2844
|
+
readonly columnId: string;
|
|
2845
|
+
};
|
|
2824
2846
|
/**
|
|
2825
2847
|
* What changed between two selections. Ids rather than resolved members, so
|
|
2826
2848
|
* that the transform producing it stays free of the data it selects from.
|
|
@@ -2845,6 +2867,20 @@ interface ResolvedRow<Row> {
|
|
|
2845
2867
|
readonly rowIndex: number;
|
|
2846
2868
|
/** This row's absolute position in the whole filtered/sorted/grouped dataset, matching `CellTemplateContext`. */
|
|
2847
2869
|
readonly datasetIndex: number;
|
|
2870
|
+
/** Where the row sits in its group. Set by `groupRows`; absent from an ungrouped result. */
|
|
2871
|
+
readonly groupPosition?: RowGroupPosition;
|
|
2872
|
+
}
|
|
2873
|
+
/**
|
|
2874
|
+
* A data row's place inside its group: what a renderer draws as the row's
|
|
2875
|
+
* `aria-level`, `aria-posinset` and `aria-setsize` in a treegrid.
|
|
2876
|
+
*/
|
|
2877
|
+
interface RowGroupPosition {
|
|
2878
|
+
/** Nesting depth on `ResolvedGroupRow.level`'s scale: one deeper than the group holding the row, so `1` under a top-level group. */
|
|
2879
|
+
readonly level: number;
|
|
2880
|
+
/** 1-based place among the data rows of its group. */
|
|
2881
|
+
readonly position: number;
|
|
2882
|
+
/** How many data rows its group holds, its `count`: the same on every page the group spans. */
|
|
2883
|
+
readonly setSize: number;
|
|
2848
2884
|
}
|
|
2849
2885
|
/**
|
|
2850
2886
|
* A selected column. Carries the resolved column rather than the bare
|
|
@@ -2934,9 +2970,9 @@ interface CellSelectEvent<Row, Node = string> {
|
|
|
2934
2970
|
readonly selection: CellSelectionState;
|
|
2935
2971
|
}
|
|
2936
2972
|
/**
|
|
2937
|
-
* Reports a cell selection change whole.
|
|
2938
|
-
* interaction can fill both — moving between cells
|
|
2939
|
-
* once.
|
|
2973
|
+
* Reports a cell selection change whole. `selected` and `deselected` are
|
|
2974
|
+
* nullable and one interaction can fill both — moving between cells
|
|
2975
|
+
* deselects and selects at once.
|
|
2940
2976
|
*/
|
|
2941
2977
|
interface CellSelectionChangeEvent<Row, Node = string> {
|
|
2942
2978
|
readonly selected: SelectedCell<Row, Node> | null;
|
|
@@ -3011,7 +3047,14 @@ interface GridViewInput<Row, Node = string> {
|
|
|
3011
3047
|
readonly rows: readonly Row[];
|
|
3012
3048
|
readonly getRowId?: ((row: Row, index: number) => string) | undefined;
|
|
3013
3049
|
readonly columns: readonly ColumnDefinition<Row, Node>[];
|
|
3014
|
-
|
|
3050
|
+
/**
|
|
3051
|
+
* The slices to show, any of them: one left out reads as the grid's
|
|
3052
|
+
* starting default — no sizes, order, hidden columns, sort, filter or
|
|
3053
|
+
* grouping, every group expanded, and the first page of 25.
|
|
3054
|
+
*/
|
|
3055
|
+
readonly state: {
|
|
3056
|
+
readonly [K in keyof GridViewState<Row>]?: GridViewState<Row>[K] | undefined;
|
|
3057
|
+
};
|
|
3015
3058
|
readonly options: GridViewOptions<Row>;
|
|
3016
3059
|
}
|
|
3017
3060
|
/**
|
|
@@ -3259,6 +3302,7 @@ declare function clearSelection(selection: SelectionState): SelectionState;
|
|
|
3259
3302
|
* same interaction cannot disagree about which it was.
|
|
3260
3303
|
*/
|
|
3261
3304
|
declare function diffSelection(previous: SelectionState, next: SelectionState): SelectionDiff;
|
|
3305
|
+
/** Whether two cell selections hold the same cells. */
|
|
3262
3306
|
declare function isSameCell(a: CellSelectionState, b: CellSelectionState): boolean;
|
|
3263
3307
|
/**
|
|
3264
3308
|
* The cell selection moved to `cell` — a plain click. Idempotent: clicking the
|
|
@@ -3376,7 +3420,8 @@ declare function groupRowId(path: readonly unknown[]): string;
|
|
|
3376
3420
|
* own `direction`, followed depth-first by its nested groups and/or data
|
|
3377
3421
|
* rows. A group `expansion` collapses contributes only its own header,
|
|
3378
3422
|
* nothing beneath it — but its `count` still reports the group's full
|
|
3379
|
-
* leaf-row count either way.
|
|
3423
|
+
* leaf-row count either way. Each data row carries its `groupPosition`:
|
|
3424
|
+
* its depth, and its place among and the count of its group's rows.
|
|
3380
3425
|
*
|
|
3381
3426
|
* Filter and sort are expected to have already run (see `resolveShownRows`):
|
|
3382
3427
|
* this only reshapes their output, and never changes which rows appear or
|
|
@@ -3674,4 +3719,4 @@ declare function draftToFilter<Row>(draft: FilterEditorDraft<Row>, columnId: str
|
|
|
3674
3719
|
*/
|
|
3675
3720
|
declare function filterDraftChanged<Row>(opened: FilterEditorDraft<Row>, draft: FilterEditorDraft<Row>): boolean;
|
|
3676
3721
|
|
|
3677
|
-
export { type CellSelectionState as $, type AggregateState as A, type SerializedGridState as B, type ColumnType as C, type DataColumn as D, type ExportTable as E, type FilterState as F, type GridControllerOptions as G, type ExportSource as H, type ExportWriter as I, type GridExportOptions as J, type ExportFile as K, ALL_COLLAPSED as L, type MenuEntry as M, ALL_EXPANDED as N, type AggregateFn as O, type PaginationUnit as P, type AggregateSpec as Q, type ResolvedMenuEntry as R, type SortDirection as S, type ToolbarItemAttributes as T, type Borders as U, type BuiltInAggregate as V, type BuiltInCommandIcon as W, type BuiltInCommandId as X, type CellSelectEvent as Y, type CellSelectionChangeEvent as Z, type CellSelectionMode as _, type GridController as a, type JsonOptions as a$, type CellTemplateContext as a0, type ColumnAlignment as a1, type ColumnConstraints as a2, type ColumnFilterMenuOptions as a3, type ColumnOrderEvent as a4, type ColumnOrderState as a5, type ColumnResizeEvent as a6, type ColumnResolveOptions as a7, type ColumnSelectEvent as a8, type ColumnSelectionChangeEvent as a9, type FilterOperatorFamily as aA, type FilterPredicate as aB, type FilterScalar as aC, type FooterTemplateContext as aD, type FormatLocale as aE, type GridCommandActions as aF, type GridCommandEvent as aG, type GridCommandSource as aH, type GridContextMenuArea as aI, type GridContextMenuEntries as aJ, type GridContextMenuOptions as aK, type GridContextMenuRequest as aL, type GridContextMenuTarget as aM, type GridFilterMenuOptions as aN, type GridFocus as aO, type GridOptions as aP, type GridPanelKind as aQ, type GridToolbarOptions as aR, type GridViewOptions as aS, type GridViewState as aT, type GroupByBarVisibility as aU, type GroupByEntry as aV, type GroupByEvent as aW, type GroupExpansionEvent as aX, type GroupExpansionState as aY, type GroupFilterEntry as aZ, type HoverableConfig as a_, type ColumnSizeDefaults as aa, type ColumnSizingState as ab, type ColumnSortEntry as ac, type ColumnSortEvent as ad, type ColumnVisibilityEvent as ae, type ColumnWrapConfig as af, type ColumnsSelectEvent as ag, type ContextMenuOpenChangeEvent as ah, type CopyContent as ai, type CsvOptions as aj, DEFAULT_COLUMN_SIZES as ak, DEFAULT_FILTER_VALUE_LIMIT as al, type ExportCell as am, type ExportColumn as an, type ExportDataRow as ao, type ExportGroupRow as ap, type ExportGroupSummaryRow as aq, type ExportOptions as ar, type ExportRow as as, type ExportScalar as at, type ExportTotalRow as au, type ExportWriteContext as av, type FilterChangeEvent as aw, type FilterEntry as ax, type FilterMenuUi as ay, type FilterOperator as az, type GridCommandTarget as b,
|
|
3722
|
+
export { type CellSelectionState as $, type AggregateState as A, type SerializedGridState as B, type ColumnType as C, type DataColumn as D, type ExportTable as E, type FilterState as F, type GridControllerOptions as G, type ExportSource as H, type ExportWriter as I, type GridExportOptions as J, type ExportFile as K, ALL_COLLAPSED as L, type MenuEntry as M, ALL_EXPANDED as N, type AggregateFn as O, type PaginationUnit as P, type AggregateSpec as Q, type ResolvedMenuEntry as R, type SortDirection as S, type ToolbarItemAttributes as T, type Borders as U, type BuiltInAggregate as V, type BuiltInCommandIcon as W, type BuiltInCommandId as X, type CellSelectEvent as Y, type CellSelectionChangeEvent as Z, type CellSelectionMode as _, type GridController as a, type JsonOptions as a$, type CellTemplateContext as a0, type ColumnAlignment as a1, type ColumnConstraints as a2, type ColumnFilterMenuOptions as a3, type ColumnOrderEvent as a4, type ColumnOrderState as a5, type ColumnResizeEvent as a6, type ColumnResolveOptions as a7, type ColumnSelectEvent as a8, type ColumnSelectionChangeEvent as a9, type FilterOperatorFamily as aA, type FilterPredicate as aB, type FilterScalar as aC, type FooterTemplateContext as aD, type FormatLocale as aE, type GridCommandActions as aF, type GridCommandEvent as aG, type GridCommandSource as aH, type GridContextMenuArea as aI, type GridContextMenuEntries as aJ, type GridContextMenuOptions as aK, type GridContextMenuRequest as aL, type GridContextMenuTarget as aM, type GridFilterMenuOptions as aN, type GridFocus as aO, type GridOptions as aP, type GridPanelKind as aQ, type GridToolbarOptions as aR, type GridViewOptions as aS, type GridViewState as aT, type GroupByBarVisibility as aU, type GroupByEntry as aV, type GroupByEvent as aW, type GroupExpansionEvent as aX, type GroupExpansionState as aY, type GroupFilterEntry as aZ, type HoverableConfig as a_, type ColumnSizeDefaults as aa, type ColumnSizingState as ab, type ColumnSortEntry as ac, type ColumnSortEvent as ad, type ColumnVisibilityEvent as ae, type ColumnWrapConfig as af, type ColumnsSelectEvent as ag, type ContextMenuOpenChangeEvent as ah, type CopyContent as ai, type CsvOptions as aj, DEFAULT_COLUMN_SIZES as ak, DEFAULT_FILTER_VALUE_LIMIT as al, type ExportCell as am, type ExportColumn as an, type ExportDataRow as ao, type ExportGroupRow as ap, type ExportGroupSummaryRow as aq, type ExportOptions as ar, type ExportRow as as, type ExportScalar as at, type ExportTotalRow as au, type ExportWriteContext as av, type FilterChangeEvent as aw, type FilterEntry as ax, type FilterMenuUi as ay, type FilterOperator as az, type GridCommandTarget as b, formatCellValue as b$, type MenuItemEntry as b0, type MenuSubmenuEntry as b1, type OperatorFilterEntry as b2, type PaginationChangeEvent as b3, type PredicateFilterEntry as b4, type PrintDocument as b5, type PrintOptions as b6, type PrintOrientation as b7, type PrintPage as b8, type PrintSource as b9, type SerializedFilterState as bA, type SerializedGroupFilterEntry as bB, type SerializedOperatorFilterEntry as bC, type SerializedValueFilterEntry as bD, type TextFilterEntry as bE, type ToolbarCustomEntry as bF, type ValueFilterEntry as bG, accessDotted as bH, alignmentForType as bI, applyColumnOrder as bJ, applySelectionIntent as bK, bodyFocus as bL, buildExportTable as bM, builtInCommands as bN, clearSelection as bO, collapseAllGroups as bP, contextMenuEntries as bQ, createDefaultMessages as bR, csvWriter as bS, defaultContextMenu as bT, defaultFilterOperators as bU, defaultMessages as bV, defaultToolbar as bW, defineColumnsFromRows as bX, expandAllGroups as bY, exportPrintDocument as bZ, formatAggregateValue as b_, type ResizeMode as ba, type ResolvedGroupRow as bb, type ResolvedGroupSummaryRow as bc, type ResolvedMenuItem as bd, type ResolvedMenuSeparator as be, type ResolvedMenuSubmenu as bf, type ResolvedToolbarButton as bg, type ResolvedToolbarCustom as bh, type ResolvedToolbarMenu as bi, type ResolvedToolbarSearch as bj, type ResolvedToolbarSpacer as bk, type RowGroupPosition as bl, type RowPointerEvent as bm, type RowProps as bn, type RowSelectEvent as bo, type RowSelectionChangeEvent as bp, type RowsSelectEvent as bq, type SelectIntent as br, type SelectableConfig as bs, type SelectionCallbacks as bt, type SelectionDiff as bu, type SelectionDiffEvent as bv, type SelectionMode as bw, type SelectionState as bx, type SerializedFilterEntry as by, type SerializedFilterScalar as bz, type GridMessages as c, hasContextMenu as c$, formatGroupValue as c0, getColumnId as c1, groupRowId as c2, groupRows as c3, headerFocus as c4, isColumnFiltered as c5, isGroupExpanded as c6, isSameCell as c7, jsonWriter as c8, moveColumnBefore as c9, type CopyRequest as cA, type CopySource as cB, type DropSide as cC, type FilterEditorAction as cD, type FilterEditorDraft as cE, type FilterEditorDraftBase as cF, KEYBOARD_STEP as cG, type KeyShortcutCapabilities as cH, type NavigationModifiers as cI, type ResolvedColumnFilterMenu as cJ, applyColumnResize as cK, beginColumnResize as cL, buildKeyShortcuts as cM, buildPrintDocument as cN, clampColumnWidth as cO, clampFocus as cP, columnValueOptions as cQ, copyContent as cR, describeColumnFilter as cS, diffSelection as cT, draftToFilter as cU, filterDraftChanged as cV, filterEditorReducer as cW, filterOperandArity as cX, filterOperatorFamily as cY, fitColumnsToWidth as cZ, formatFilterOperand as c_, moveGroupByBefore as ca, resolveColumnHeaderText as cb, resolveColumnLabel as cc, resolveColumnWidths as cd, resolveDataColumns as ce, resolveExportWriters as cf, resolveMessages as cg, resolveRowId as ch, selectAll as ci, selectCell as cj, selectOnly as ck, selectRange as cl, toCsv as cm, toJson as cn, toggleCellSelection as co, toggleGroupExpansion as cp, toggleSelection as cq, toolbarEntries as cr, type SelectAllState as cs, type ColumnFilterShape as ct, type ColumnValueQuery as cu, type ColumnValueOptions as cv, type ValuesDraft as cw, type ColumnResizeSession as cx, type ColumnValueOption as cy, type ConditionsDraft as cz, type GridCommandHost as d, initialFilterEditorDraft as d0, intentOf as d1, movesColumn as d2, movesGroupBy as d3, nextFocusForKey as d4, parseFilterOperand as d5, resolveColumnConstraints as d6, resolveColumnFilterMenu as d7, resolveDropBefore as d8, resolveKeyboardDropTarget as d9, revertColumnSize as da, selectAllState as db, sizeColumnToContent as dc, toConditionsDraft as dd, toValuesDraft as de, totalColumnWidth as df, visibleFilterOptions as dg, type GridCommandContext as e, type GridCommand as f, type GridToolbarTarget as g, type ToolbarEntry as h, type ResolvedToolbarItem as i, type ColumnSortState as j, type ResolvedRow as k, type FieldPath as l, type ResolvedColumn as m, type SelectedCellRef as n, type SelectedCell as o, type SelectedColumn as p, type DisplayRow as q, type PaginationState as r, type AggregateResults as s, type GroupByState as t, type GroupAggregateDisplay as u, type ColumnVisibilityState as v, type ColumnDefinition as w, type GridViewInput as x, type GridView as y, type GridState as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GridControllerOptions, a as GridController, b as GridCommandTarget, c as GridMessages, d as GridCommandHost, e as GridCommandContext, f as GridCommand, M as MenuEntry, R as ResolvedMenuEntry, g as GridToolbarTarget, T as ToolbarItemAttributes, h as ToolbarEntry, i as ResolvedToolbarItem, C as ColumnType, j as ColumnSortState, S as SortDirection, k as ResolvedRow, D as DataColumn, F as FilterState, l as FieldPath, m as ResolvedColumn, n as SelectedCellRef, o as SelectedCell, p as SelectedColumn, P as PaginationUnit, q as DisplayRow, r as PaginationState, A as AggregateState, s as AggregateResults, t as GroupByState, u as GroupAggregateDisplay, v as ColumnVisibilityState, w as ColumnDefinition, x as GridViewInput, y as GridView, z as GridState, B as SerializedGridState, E as ExportTable, H as ExportSource, I as ExportWriter, J as GridExportOptions, K as ExportFile } from './filterEditor-
|
|
2
|
-
export { L as ALL_COLLAPSED, N as ALL_EXPANDED, O as AggregateFn, Q as AggregateSpec, U as Borders, V as BuiltInAggregate, W as BuiltInCommandIcon, X as BuiltInCommandId, Y as CellSelectEvent, Z as CellSelectionChangeEvent, _ as CellSelectionMode, $ as CellSelectionState, a0 as CellTemplateContext, a1 as ColumnAlignment, a2 as ColumnConstraints, a3 as ColumnFilterMenuOptions, a4 as ColumnOrderEvent, a5 as ColumnOrderState, a6 as ColumnResizeEvent, a7 as ColumnResolveOptions, a8 as ColumnSelectEvent, a9 as ColumnSelectionChangeEvent, aa as ColumnSizeDefaults, ab as ColumnSizingState, ac as ColumnSortEntry, ad as ColumnSortEvent, ae as ColumnVisibilityEvent, af as ColumnWrapConfig, ag as ColumnsSelectEvent, ah as ContextMenuOpenChangeEvent, ai as CopyContent, aj as CsvOptions, ak as DEFAULT_COLUMN_SIZES, al as DEFAULT_FILTER_VALUE_LIMIT, am as ExportCell, an as ExportColumn, ao as ExportDataRow, ap as ExportGroupRow, aq as ExportGroupSummaryRow, ar as ExportOptions, as as ExportRow, at as ExportScalar, au as ExportTotalRow, av as ExportWriteContext, aw as FilterChangeEvent, ax as FilterEntry, ay as FilterMenuUi, az as FilterOperator, aA as FilterOperatorFamily, aB as FilterPredicate, aC as FilterScalar, aD as FooterTemplateContext, aE as FormatLocale, aF as GridCommandActions, aG as GridCommandEvent, aH as GridCommandSource, aI as GridContextMenuArea, aJ as GridContextMenuEntries, aK as GridContextMenuOptions, aL as GridContextMenuRequest, aM as GridContextMenuTarget, aN as GridFilterMenuOptions, aO as GridFocus, aP as GridOptions, aQ as GridPanelKind, aR as GridToolbarOptions, aS as GridViewOptions, aT as GridViewState, aU as GroupByBarVisibility, aV as GroupByEntry, aW as GroupByEvent, aX as GroupExpansionEvent, aY as GroupExpansionState, aZ as GroupFilterEntry, a_ as HoverableConfig, a$ as JsonOptions, b0 as MenuItemEntry, b1 as MenuSubmenuEntry, b2 as OperatorFilterEntry, b3 as PaginationChangeEvent, b4 as PredicateFilterEntry, b5 as PrintDocument, b6 as PrintOptions, b7 as PrintOrientation, b8 as PrintPage, b9 as PrintSource, ba as ResizeMode, bb as ResolvedGroupRow, bc as ResolvedGroupSummaryRow, bd as ResolvedMenuItem, be as ResolvedMenuSeparator, bf as ResolvedMenuSubmenu, bg as ResolvedToolbarButton, bh as ResolvedToolbarCustom, bi as ResolvedToolbarMenu, bj as ResolvedToolbarSearch, bk as ResolvedToolbarSpacer, bl as
|
|
1
|
+
import { G as GridControllerOptions, a as GridController, b as GridCommandTarget, c as GridMessages, d as GridCommandHost, e as GridCommandContext, f as GridCommand, M as MenuEntry, R as ResolvedMenuEntry, g as GridToolbarTarget, T as ToolbarItemAttributes, h as ToolbarEntry, i as ResolvedToolbarItem, C as ColumnType, j as ColumnSortState, S as SortDirection, k as ResolvedRow, D as DataColumn, F as FilterState, l as FieldPath, m as ResolvedColumn, n as SelectedCellRef, o as SelectedCell, p as SelectedColumn, P as PaginationUnit, q as DisplayRow, r as PaginationState, A as AggregateState, s as AggregateResults, t as GroupByState, u as GroupAggregateDisplay, v as ColumnVisibilityState, w as ColumnDefinition, x as GridViewInput, y as GridView, z as GridState, B as SerializedGridState, E as ExportTable, H as ExportSource, I as ExportWriter, J as GridExportOptions, K as ExportFile } from './filterEditor-C2nZkvgC.js';
|
|
2
|
+
export { L as ALL_COLLAPSED, N as ALL_EXPANDED, O as AggregateFn, Q as AggregateSpec, U as Borders, V as BuiltInAggregate, W as BuiltInCommandIcon, X as BuiltInCommandId, Y as CellSelectEvent, Z as CellSelectionChangeEvent, _ as CellSelectionMode, $ as CellSelectionState, a0 as CellTemplateContext, a1 as ColumnAlignment, a2 as ColumnConstraints, a3 as ColumnFilterMenuOptions, a4 as ColumnOrderEvent, a5 as ColumnOrderState, a6 as ColumnResizeEvent, a7 as ColumnResolveOptions, a8 as ColumnSelectEvent, a9 as ColumnSelectionChangeEvent, aa as ColumnSizeDefaults, ab as ColumnSizingState, ac as ColumnSortEntry, ad as ColumnSortEvent, ae as ColumnVisibilityEvent, af as ColumnWrapConfig, ag as ColumnsSelectEvent, ah as ContextMenuOpenChangeEvent, ai as CopyContent, aj as CsvOptions, ak as DEFAULT_COLUMN_SIZES, al as DEFAULT_FILTER_VALUE_LIMIT, am as ExportCell, an as ExportColumn, ao as ExportDataRow, ap as ExportGroupRow, aq as ExportGroupSummaryRow, ar as ExportOptions, as as ExportRow, at as ExportScalar, au as ExportTotalRow, av as ExportWriteContext, aw as FilterChangeEvent, ax as FilterEntry, ay as FilterMenuUi, az as FilterOperator, aA as FilterOperatorFamily, aB as FilterPredicate, aC as FilterScalar, aD as FooterTemplateContext, aE as FormatLocale, aF as GridCommandActions, aG as GridCommandEvent, aH as GridCommandSource, aI as GridContextMenuArea, aJ as GridContextMenuEntries, aK as GridContextMenuOptions, aL as GridContextMenuRequest, aM as GridContextMenuTarget, aN as GridFilterMenuOptions, aO as GridFocus, aP as GridOptions, aQ as GridPanelKind, aR as GridToolbarOptions, aS as GridViewOptions, aT as GridViewState, aU as GroupByBarVisibility, aV as GroupByEntry, aW as GroupByEvent, aX as GroupExpansionEvent, aY as GroupExpansionState, aZ as GroupFilterEntry, a_ as HoverableConfig, a$ as JsonOptions, b0 as MenuItemEntry, b1 as MenuSubmenuEntry, b2 as OperatorFilterEntry, b3 as PaginationChangeEvent, b4 as PredicateFilterEntry, b5 as PrintDocument, b6 as PrintOptions, b7 as PrintOrientation, b8 as PrintPage, b9 as PrintSource, ba as ResizeMode, bb as ResolvedGroupRow, bc as ResolvedGroupSummaryRow, bd as ResolvedMenuItem, be as ResolvedMenuSeparator, bf as ResolvedMenuSubmenu, bg as ResolvedToolbarButton, bh as ResolvedToolbarCustom, bi as ResolvedToolbarMenu, bj as ResolvedToolbarSearch, bk as ResolvedToolbarSpacer, bl as RowGroupPosition, bm as RowPointerEvent, bn as RowProps, bo as RowSelectEvent, bp as RowSelectionChangeEvent, bq as RowsSelectEvent, br as SelectIntent, bs as SelectableConfig, bt as SelectionCallbacks, bu as SelectionDiff, bv as SelectionDiffEvent, bw as SelectionMode, bx as SelectionState, by as SerializedFilterEntry, bz as SerializedFilterScalar, bA as SerializedFilterState, bB as SerializedGroupFilterEntry, bC as SerializedOperatorFilterEntry, bD as SerializedValueFilterEntry, bE as TextFilterEntry, bF as ToolbarCustomEntry, bG as ValueFilterEntry, bH as accessDotted, bI as alignmentForType, bJ as applyColumnOrder, bK as applySelectionIntent, bL as bodyFocus, bM as buildExportTable, bN as builtInCommands, bO as clearSelection, bP as collapseAllGroups, bQ as contextMenuEntries, bR as createDefaultMessages, bS as csvWriter, bT as defaultContextMenu, bU as defaultFilterOperators, bV as defaultMessages, bW as defaultToolbar, bX as defineColumnsFromRows, bY as expandAllGroups, bZ as exportPrintDocument, b_ as formatAggregateValue, b$ as formatCellValue, c0 as formatGroupValue, c1 as getColumnId, c2 as groupRowId, c3 as groupRows, c4 as headerFocus, c5 as isColumnFiltered, c6 as isGroupExpanded, c7 as isSameCell, c8 as jsonWriter, c9 as moveColumnBefore, ca as moveGroupByBefore, cb as resolveColumnHeaderText, cc as resolveColumnLabel, cd as resolveColumnWidths, ce as resolveDataColumns, cf as resolveExportWriters, cg as resolveMessages, ch as resolveRowId, ci as selectAll, cj as selectCell, ck as selectOnly, cl as selectRange, cm as toCsv, cn as toJson, co as toggleCellSelection, cp as toggleGroupExpansion, cq as toggleSelection, cr as toolbarEntries } from './filterEditor-C2nZkvgC.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates the state container for one grid — see `GridController`. Hold one
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ALL_EXPANDED,
|
|
4
4
|
DEFAULT_COLUMN_SIZES,
|
|
5
5
|
DEFAULT_FILTER_VALUE_LIMIT,
|
|
6
|
+
NO_CELL_SELECTED,
|
|
6
7
|
accessDotted,
|
|
7
8
|
alignmentForType,
|
|
8
9
|
applyColumnOrder,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
buildExportTable,
|
|
13
14
|
builtInCommands,
|
|
14
15
|
clearAllFilters,
|
|
16
|
+
clearCellSelection,
|
|
15
17
|
clearSelection,
|
|
16
18
|
collapseAllGroups,
|
|
17
19
|
collapseSeparators,
|
|
@@ -86,7 +88,7 @@ import {
|
|
|
86
88
|
unknownDisplayRow,
|
|
87
89
|
unknownFilterEntry,
|
|
88
90
|
withGroupAggregates
|
|
89
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-DHSWUNSZ.js";
|
|
90
92
|
|
|
91
93
|
// src/util/memoize.ts
|
|
92
94
|
function memoizeLast(compute) {
|
|
@@ -230,13 +232,33 @@ function serializeGridState(state) {
|
|
|
230
232
|
filter: serializeFilter(state.filter)
|
|
231
233
|
};
|
|
232
234
|
}
|
|
235
|
+
function untaggedCellSelection(saved) {
|
|
236
|
+
if (saved === null) {
|
|
237
|
+
return { kind: "none" };
|
|
238
|
+
}
|
|
239
|
+
if (typeof saved === "object" && !("kind" in saved) && "rowId" in saved && typeof saved.rowId === "string" && "columnId" in saved && typeof saved.columnId === "string") {
|
|
240
|
+
return { kind: "cell", rowId: saved.rowId, columnId: saved.columnId };
|
|
241
|
+
}
|
|
242
|
+
return void 0;
|
|
243
|
+
}
|
|
244
|
+
function migrateUnversioned(state) {
|
|
245
|
+
let migrated = state;
|
|
246
|
+
if (isStringList(state.groupExpansion)) {
|
|
247
|
+
migrated = {
|
|
248
|
+
...migrated,
|
|
249
|
+
groupExpansion: { mode: "allExpanded", except: state.groupExpansion }
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
const cellSelection = untaggedCellSelection(state.cellSelection);
|
|
253
|
+
if (cellSelection !== void 0) {
|
|
254
|
+
migrated = { ...migrated, cellSelection };
|
|
255
|
+
}
|
|
256
|
+
return migrated;
|
|
257
|
+
}
|
|
233
258
|
function migrateSavedState(saved) {
|
|
234
259
|
const { version, ...state } = saved;
|
|
235
260
|
if (version === void 0) {
|
|
236
|
-
return
|
|
237
|
-
...state,
|
|
238
|
-
groupExpansion: { mode: "allExpanded", except: state.groupExpansion }
|
|
239
|
-
} : state;
|
|
261
|
+
return migrateUnversioned(state);
|
|
240
262
|
}
|
|
241
263
|
if (version === SAVED_STATE_VERSION) {
|
|
242
264
|
return state;
|
|
@@ -325,6 +347,29 @@ function reviveGroupExpansion(saved) {
|
|
|
325
347
|
|
|
326
348
|
// src/util/view.ts
|
|
327
349
|
var NO_AGGREGATES = [];
|
|
350
|
+
var DEFAULT_PAGE_SIZE = 25;
|
|
351
|
+
var STARTING_VIEW_STATE = {
|
|
352
|
+
columnSizing: {},
|
|
353
|
+
columnOrder: [],
|
|
354
|
+
columnVisibility: {},
|
|
355
|
+
columnSort: [],
|
|
356
|
+
filter: [],
|
|
357
|
+
groupBy: [],
|
|
358
|
+
groupExpansion: ALL_EXPANDED,
|
|
359
|
+
pagination: { pageIndex: 0, pageSize: DEFAULT_PAGE_SIZE }
|
|
360
|
+
};
|
|
361
|
+
function fillViewState(state) {
|
|
362
|
+
return {
|
|
363
|
+
columnSizing: state.columnSizing ?? STARTING_VIEW_STATE.columnSizing,
|
|
364
|
+
columnOrder: state.columnOrder ?? STARTING_VIEW_STATE.columnOrder,
|
|
365
|
+
columnVisibility: state.columnVisibility ?? STARTING_VIEW_STATE.columnVisibility,
|
|
366
|
+
columnSort: state.columnSort ?? STARTING_VIEW_STATE.columnSort,
|
|
367
|
+
filter: state.filter ?? STARTING_VIEW_STATE.filter,
|
|
368
|
+
groupBy: state.groupBy ?? STARTING_VIEW_STATE.groupBy,
|
|
369
|
+
groupExpansion: state.groupExpansion ?? STARTING_VIEW_STATE.groupExpansion,
|
|
370
|
+
pagination: state.pagination ?? STARTING_VIEW_STATE.pagination
|
|
371
|
+
};
|
|
372
|
+
}
|
|
328
373
|
function identifyRows(rows, getRowId) {
|
|
329
374
|
return rows.map((row, rowIndex) => ({
|
|
330
375
|
kind: "data",
|
|
@@ -381,7 +426,14 @@ function createGridViewResolver() {
|
|
|
381
426
|
grandTotal
|
|
382
427
|
})
|
|
383
428
|
);
|
|
384
|
-
return ({
|
|
429
|
+
return ({
|
|
430
|
+
rows: data,
|
|
431
|
+
getRowId,
|
|
432
|
+
columns: definitions,
|
|
433
|
+
state: given,
|
|
434
|
+
options
|
|
435
|
+
}) => {
|
|
436
|
+
const state = fillViewState(given);
|
|
385
437
|
const paginated = options.paginated ?? false;
|
|
386
438
|
const aggregates = options.aggregates ?? NO_AGGREGATES;
|
|
387
439
|
const dataColumns = orderColumns(definitions, state.columnOrder);
|
|
@@ -551,9 +603,12 @@ function reportColumnSelection(previous, next, columns, callbacks) {
|
|
|
551
603
|
});
|
|
552
604
|
return diff;
|
|
553
605
|
}
|
|
606
|
+
function selectedCellOf(selection) {
|
|
607
|
+
return selection.kind === "cell" ? selection : null;
|
|
608
|
+
}
|
|
554
609
|
function reportCellSelection(previous, next, rowsById, columns, callbacks) {
|
|
555
|
-
const selected = resolveCell(rowsById, columns, next);
|
|
556
|
-
const deselected = resolveCell(rowsById, columns, previous);
|
|
610
|
+
const selected = resolveCell(rowsById, columns, selectedCellOf(next));
|
|
611
|
+
const deselected = resolveCell(rowsById, columns, selectedCellOf(previous));
|
|
557
612
|
if (deselected !== null) {
|
|
558
613
|
callbacks.onCellDeselect?.({ cell: deselected, selection: next });
|
|
559
614
|
}
|
|
@@ -695,7 +750,7 @@ function createSelectionActions(grid) {
|
|
|
695
750
|
grid.transaction(() => {
|
|
696
751
|
commitRows(clearSelection(grid.getState().rowSelection));
|
|
697
752
|
commitColumns(clearSelection(grid.getState().columnSelection));
|
|
698
|
-
commitCell(
|
|
753
|
+
commitCell(clearCellSelection(grid.getState().cellSelection));
|
|
699
754
|
});
|
|
700
755
|
},
|
|
701
756
|
setColumnSelection(selection) {
|
|
@@ -732,7 +787,6 @@ function createSelectionActions(grid) {
|
|
|
732
787
|
}
|
|
733
788
|
|
|
734
789
|
// src/controller/createGridController.ts
|
|
735
|
-
var DEFAULT_PAGE_SIZE = 25;
|
|
736
790
|
var NO_ROWS = [];
|
|
737
791
|
var NO_COLUMNS = [];
|
|
738
792
|
var SLICE_KEYS = [
|
|
@@ -763,20 +817,17 @@ var DEFAULT_OPTION = {
|
|
|
763
817
|
};
|
|
764
818
|
function startingState(options) {
|
|
765
819
|
return {
|
|
766
|
-
columnSizing: options.defaultColumnSizing ??
|
|
767
|
-
columnOrder: options.defaultColumnOrder ??
|
|
768
|
-
columnVisibility: options.defaultColumnVisibility ??
|
|
769
|
-
columnSort: options.defaultColumnSort ??
|
|
770
|
-
filter: options.defaultFilter ??
|
|
771
|
-
groupBy: options.defaultGroupBy ??
|
|
772
|
-
groupExpansion: options.defaultGroupExpansion ??
|
|
773
|
-
pagination: options.defaultPagination ??
|
|
774
|
-
pageIndex: 0,
|
|
775
|
-
pageSize: DEFAULT_PAGE_SIZE
|
|
776
|
-
},
|
|
820
|
+
columnSizing: options.defaultColumnSizing ?? STARTING_VIEW_STATE.columnSizing,
|
|
821
|
+
columnOrder: options.defaultColumnOrder ?? STARTING_VIEW_STATE.columnOrder,
|
|
822
|
+
columnVisibility: options.defaultColumnVisibility ?? STARTING_VIEW_STATE.columnVisibility,
|
|
823
|
+
columnSort: options.defaultColumnSort ?? STARTING_VIEW_STATE.columnSort,
|
|
824
|
+
filter: options.defaultFilter ?? STARTING_VIEW_STATE.filter,
|
|
825
|
+
groupBy: options.defaultGroupBy ?? STARTING_VIEW_STATE.groupBy,
|
|
826
|
+
groupExpansion: options.defaultGroupExpansion ?? STARTING_VIEW_STATE.groupExpansion,
|
|
827
|
+
pagination: options.defaultPagination ?? STARTING_VIEW_STATE.pagination,
|
|
777
828
|
rowSelection: options.defaultRowSelection ?? [],
|
|
778
829
|
columnSelection: options.defaultColumnSelection ?? [],
|
|
779
|
-
cellSelection: options.defaultCellSelection ??
|
|
830
|
+
cellSelection: options.defaultCellSelection ?? NO_CELL_SELECTED
|
|
780
831
|
};
|
|
781
832
|
}
|
|
782
833
|
function definedColumns(columns, rows) {
|