@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/{chunk-PUD53NFG.js → chunk-ZFWEGZX3.js} +141 -5
- package/dist/chunk-ZFWEGZX3.js.map +1 -0
- package/dist/{filterEditor-Dr7kwpCC.d.ts → filterEditor-BAbQCUfe.d.ts} +150 -12
- package/dist/index.d.ts +4 -4
- package/dist/index.js +65 -10
- package/dist/index.js.map +1 -1
- package/dist/renderer.d.ts +2 -2
- package/dist/renderer.js +5 -1
- package/dist/renderer.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-PUD53NFG.js.map +0 -1
|
@@ -130,8 +130,10 @@ interface GridController<Row, Node = string> {
|
|
|
130
130
|
readonly setColumnOrder: (order: ColumnOrderState) => void;
|
|
131
131
|
/**
|
|
132
132
|
* Moves a column in front of `beforeId`, or to the end when that is
|
|
133
|
-
* `null`, among every column — hidden ones keep their place.
|
|
134
|
-
*
|
|
133
|
+
* `null`, among every column — hidden ones keep their place. The column
|
|
134
|
+
* stays among those pinned to the same edge, or the unpinned ones: a
|
|
135
|
+
* `beforeId` in an earlier group moves it to the start of its own, and one
|
|
136
|
+
* in a later group to its end. A move that changes nothing reports nothing.
|
|
135
137
|
*/
|
|
136
138
|
readonly moveColumn: (columnId: string, beforeId: string | null) => void;
|
|
137
139
|
/**
|
|
@@ -144,6 +146,19 @@ interface GridController<Row, Node = string> {
|
|
|
144
146
|
readonly showColumns: (columnIds: readonly string[]) => void;
|
|
145
147
|
/** Hides the given columns. A hidden column still sorts, filters and groups. */
|
|
146
148
|
readonly hideColumns: (columnIds: readonly string[]) => void;
|
|
149
|
+
/**
|
|
150
|
+
* Replaces the column pinning state. Reported through
|
|
151
|
+
* `onColumnPinningChange` with every column whose entry changed; an equal
|
|
152
|
+
* state reports nothing.
|
|
153
|
+
*/
|
|
154
|
+
readonly setColumnPinning: (pinning: ColumnPinningState) => void;
|
|
155
|
+
/**
|
|
156
|
+
* Pins a column to the `"start"` or `"end"` edge, or unpins it with
|
|
157
|
+
* `"none"`, leaving the column order as it is: an unpinned column goes
|
|
158
|
+
* back to its place among the others. A column already there, or an id
|
|
159
|
+
* naming no column, reports nothing.
|
|
160
|
+
*/
|
|
161
|
+
readonly pinColumn: (columnId: string, pin: ColumnPin) => void;
|
|
147
162
|
/**
|
|
148
163
|
* Replaces the filter. Reported through `onFilterChange`; a filter equal to
|
|
149
164
|
* the current one — the same entries in the same order, a `Date` value
|
|
@@ -475,6 +490,12 @@ interface GridMessages {
|
|
|
475
490
|
collapseAllGroups: string;
|
|
476
491
|
/** `column.hide` */
|
|
477
492
|
hideColumn: string;
|
|
493
|
+
/** `column.pinStart`: pins the column to the grid's start edge. */
|
|
494
|
+
pinToStart: string;
|
|
495
|
+
/** `column.pinEnd`: pins the column to the grid's end edge. */
|
|
496
|
+
pinToEnd: string;
|
|
497
|
+
/** `column.unpin` */
|
|
498
|
+
unpinColumn: string;
|
|
478
499
|
/** `column.autoFit`: sizes the column to its content. */
|
|
479
500
|
autoFitColumn: string;
|
|
480
501
|
autoFitAllColumns: string;
|
|
@@ -1248,7 +1269,7 @@ interface GridCommand<Row> {
|
|
|
1248
1269
|
* The id of every command `builtInCommands` returns. A minor release may
|
|
1249
1270
|
* add a command, so a `switch` over it needs a `default`.
|
|
1250
1271
|
*/
|
|
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";
|
|
1272
|
+
type BuiltInCommandId = "sort.ascending" | "sort.descending" | "sort.clear" | "sort.clearAll" | "group.add" | "group.remove" | "group.clearAll" | "group.expandAll" | "group.collapseAll" | "column.hide" | "column.pinStart" | "column.pinEnd" | "column.unpin" | "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";
|
|
1252
1273
|
/**
|
|
1253
1274
|
* The icon keys the built-ins carry, which a renderer draws as icons of its
|
|
1254
1275
|
* own. An app command may use them too, to look like the built-ins. A minor
|
|
@@ -1257,7 +1278,7 @@ type BuiltInCommandId = "sort.ascending" | "sort.descending" | "sort.clear" | "s
|
|
|
1257
1278
|
type BuiltInCommandIcon = "sortAscending" | "sortDescending" | "group" | "hide" | "autoFit" | "copy" | "print";
|
|
1258
1279
|
/**
|
|
1259
1280
|
* The grid's own commands, one per action its menus and toolbar offer —
|
|
1260
|
-
* sorting, grouping, hiding, fitting and choosing columns, selecting,
|
|
1281
|
+
* sorting, grouping, hiding, pinning, fitting and choosing columns, selecting,
|
|
1261
1282
|
* clearing, exporting, copying and printing.
|
|
1262
1283
|
* Labels come from `messages`, so they follow the grid's language.
|
|
1263
1284
|
*
|
|
@@ -1706,6 +1727,23 @@ interface GridOptions<Row> {
|
|
|
1706
1727
|
* change touched. A call that changes nothing does not call it.
|
|
1707
1728
|
*/
|
|
1708
1729
|
onColumnVisibilityChange?: ((event: ColumnVisibilityEvent) => void) | undefined;
|
|
1730
|
+
/**
|
|
1731
|
+
* Columns pinned (`"start"`, `"end"`) or unpinned (`"none"`) to start
|
|
1732
|
+
* with, keyed by column id, over each definition's own `pinned`.
|
|
1733
|
+
* Uncontrolled.
|
|
1734
|
+
*/
|
|
1735
|
+
defaultColumnPinning?: ColumnPinningState | undefined;
|
|
1736
|
+
/**
|
|
1737
|
+
* Which columns are pinned, controlled — applied as given, changed only
|
|
1738
|
+
* through `onColumnPinningChange`. Leave it `undefined` for the grid to
|
|
1739
|
+
* keep it itself, starting from `defaultColumnPinning`.
|
|
1740
|
+
*/
|
|
1741
|
+
columnPinning?: ColumnPinningState | undefined;
|
|
1742
|
+
/**
|
|
1743
|
+
* Called once when columns are pinned or unpinned, with every column that
|
|
1744
|
+
* one change touched. A call that changes nothing does not call it.
|
|
1745
|
+
*/
|
|
1746
|
+
onColumnPinningChange?: ((event: ColumnPinningEvent) => void) | undefined;
|
|
1709
1747
|
/**
|
|
1710
1748
|
* Sizes applied to columns that do not set their own — the width they start
|
|
1711
1749
|
* at and the bounds they may be resized between. Distinct from
|
|
@@ -2293,6 +2331,16 @@ interface ColumnDefinition<Row, Node = string> {
|
|
|
2293
2331
|
* ways to do it and nothing else: `hideColumns` still hides the column.
|
|
2294
2332
|
*/
|
|
2295
2333
|
hideable?: boolean | undefined;
|
|
2334
|
+
/**
|
|
2335
|
+
* Pins this column to the grid's inline start or end edge, where it stays
|
|
2336
|
+
* while the other columns scroll sideways. `"start"` is the left edge in a
|
|
2337
|
+
* left-to-right page and the right edge in a right-to-left one. Pinned
|
|
2338
|
+
* columns are drawn ahead of, or after, every unpinned one, each group in
|
|
2339
|
+
* column order. Pinning or unpinning it later lives in
|
|
2340
|
+
* `ColumnPinningState`, which wins over this for as long as it holds an
|
|
2341
|
+
* entry for the column.
|
|
2342
|
+
*/
|
|
2343
|
+
pinned?: "start" | "end" | undefined;
|
|
2296
2344
|
/**
|
|
2297
2345
|
* Whether this column is written to an export, a clipboard copy or a
|
|
2298
2346
|
* print. Defaults to `true`. `false` keeps it out of every one of them —
|
|
@@ -2363,6 +2411,8 @@ interface ColumnResolveOptions {
|
|
|
2363
2411
|
reorderable?: boolean | undefined;
|
|
2364
2412
|
/** Whether columns may be dragged into the group-by bar, unless a column says otherwise. */
|
|
2365
2413
|
groupByDraggable?: boolean | undefined;
|
|
2414
|
+
/** Columns pinned or unpinned over their definitions' `pinned`. */
|
|
2415
|
+
pinning?: ColumnPinningState | undefined;
|
|
2366
2416
|
}
|
|
2367
2417
|
/**
|
|
2368
2418
|
* How a column's width relates to the grid's.
|
|
@@ -2413,6 +2463,20 @@ interface ResolvedColumn<Row, Node = string> {
|
|
|
2413
2463
|
groupByDraggable: boolean;
|
|
2414
2464
|
/** How this column's cells align, after falling back to its type. */
|
|
2415
2465
|
alignment: ColumnAlignment;
|
|
2466
|
+
/** The edge this column is pinned to, after the pinning state, or `"none"`. */
|
|
2467
|
+
pinned: ColumnPin;
|
|
2468
|
+
/**
|
|
2469
|
+
* How far, in px, a pinned column sits from its edge: the summed widths of
|
|
2470
|
+
* the columns pinned to the same edge between it and that edge. `0` for
|
|
2471
|
+
* the column nearest the edge, and for an unpinned column.
|
|
2472
|
+
*/
|
|
2473
|
+
pinOffset: number;
|
|
2474
|
+
/**
|
|
2475
|
+
* Whether this column is the last pinned to the start edge or the first
|
|
2476
|
+
* pinned to the end edge — the one beside the scrolling columns, where a
|
|
2477
|
+
* divider goes.
|
|
2478
|
+
*/
|
|
2479
|
+
pinEdge: boolean;
|
|
2416
2480
|
}
|
|
2417
2481
|
/**
|
|
2418
2482
|
* A resize in progress. It captures its constraints up front so that applying
|
|
@@ -2450,6 +2514,26 @@ interface ColumnVisibilityEvent {
|
|
|
2450
2514
|
readonly columnIds: readonly string[];
|
|
2451
2515
|
readonly visibility: ColumnVisibilityState;
|
|
2452
2516
|
}
|
|
2517
|
+
/**
|
|
2518
|
+
* The edge a column is pinned to: the grid's inline `"start"` or `"end"`, or
|
|
2519
|
+
* `"none"` for a column that scrolls with the rest.
|
|
2520
|
+
*/
|
|
2521
|
+
type ColumnPin = "start" | "end" | "none";
|
|
2522
|
+
/**
|
|
2523
|
+
* Columns pinned or unpinned since the grid started, keyed by column id.
|
|
2524
|
+
* Holding only what changed, the way `ColumnVisibilityState` does: a column
|
|
2525
|
+
* absent from it follows its definition's `pinned`, and `"none"` unpins a
|
|
2526
|
+
* column its definition pins.
|
|
2527
|
+
*/
|
|
2528
|
+
type ColumnPinningState = Readonly<Record<string, ColumnPin>>;
|
|
2529
|
+
/**
|
|
2530
|
+
* Reports columns pinned or unpinned. `columnIds` lists every column the one
|
|
2531
|
+
* change touched, and `pinning` is the whole state to persist from.
|
|
2532
|
+
*/
|
|
2533
|
+
interface ColumnPinningEvent {
|
|
2534
|
+
readonly columnIds: readonly string[];
|
|
2535
|
+
readonly pinning: ColumnPinningState;
|
|
2536
|
+
}
|
|
2453
2537
|
/**
|
|
2454
2538
|
* Column ids in the order they render. It need not list every column: one
|
|
2455
2539
|
* absent from it keeps its position among the definitions and follows those
|
|
@@ -2988,6 +3072,7 @@ interface GridState<Row> {
|
|
|
2988
3072
|
readonly columnSizing: ColumnSizingState;
|
|
2989
3073
|
readonly columnOrder: ColumnOrderState;
|
|
2990
3074
|
readonly columnVisibility: ColumnVisibilityState;
|
|
3075
|
+
readonly columnPinning: ColumnPinningState;
|
|
2991
3076
|
readonly columnSort: ColumnSortState;
|
|
2992
3077
|
readonly filter: FilterState<Row>;
|
|
2993
3078
|
readonly groupBy: GroupByState;
|
|
@@ -3049,8 +3134,8 @@ interface GridViewInput<Row, Node = string> {
|
|
|
3049
3134
|
readonly columns: readonly ColumnDefinition<Row, Node>[];
|
|
3050
3135
|
/**
|
|
3051
3136
|
* The slices to show, any of them: one left out reads as the grid's
|
|
3052
|
-
* starting default — no sizes, order, hidden columns, sort,
|
|
3053
|
-
* grouping, every group expanded, and the first page of 25.
|
|
3137
|
+
* starting default — no sizes, order, hidden or pinned columns, sort,
|
|
3138
|
+
* filter or grouping, every group expanded, and the first page of 25.
|
|
3054
3139
|
*/
|
|
3055
3140
|
readonly state: {
|
|
3056
3141
|
readonly [K in keyof GridViewState<Row>]?: GridViewState<Row>[K] | undefined;
|
|
@@ -3065,7 +3150,10 @@ interface GridViewInput<Row, Node = string> {
|
|
|
3065
3150
|
interface GridView<Row, Node = string> {
|
|
3066
3151
|
/** Every column, hidden ones included, ordered but not sized — what the data stages read. */
|
|
3067
3152
|
readonly dataColumns: readonly DataColumn<Row, Node>[];
|
|
3068
|
-
/**
|
|
3153
|
+
/**
|
|
3154
|
+
* The columns as rendered: visible, ordered and sized, with the columns
|
|
3155
|
+
* pinned to the start first and those pinned to the end last.
|
|
3156
|
+
*/
|
|
3069
3157
|
readonly columns: readonly ResolvedColumn<Row, Node>[];
|
|
3070
3158
|
/** The rows, filtered then sorted. */
|
|
3071
3159
|
readonly rows: readonly ResolvedRow<Row>[];
|
|
@@ -3252,6 +3340,21 @@ declare function resolveDataColumns<Row, Node>(columns: readonly ColumnDefinitio
|
|
|
3252
3340
|
* treat an unchanged reference as "no move happened".
|
|
3253
3341
|
*/
|
|
3254
3342
|
declare function moveColumnBefore(orderedIds: ColumnOrderState, movedId: string, beforeId: string | null): ColumnOrderState;
|
|
3343
|
+
/**
|
|
3344
|
+
* `moveColumnBefore`, kept inside the moved column's pin group: a column is
|
|
3345
|
+
* pinned or unpinned on purpose, never by being dragged across the boundary.
|
|
3346
|
+
* `pinOf` gives each id's pin. A `beforeId` in an earlier group lands the
|
|
3347
|
+
* column at the start of its own group, and one in a later group, like
|
|
3348
|
+
* `null`, at its end.
|
|
3349
|
+
*
|
|
3350
|
+
* The end of a group is the end of `orderedIds`: the view lists each group
|
|
3351
|
+
* in column order, so a column last in the order is last in its group,
|
|
3352
|
+
* wherever the other groups' columns sit. That is also why a move can change
|
|
3353
|
+
* `orderedIds` and leave every group as it was — a column already last in
|
|
3354
|
+
* its group moved to the end — and such a move hands back `orderedIds`
|
|
3355
|
+
* itself, as a move that changes nothing does.
|
|
3356
|
+
*/
|
|
3357
|
+
declare function moveColumnInPinGroup(orderedIds: ColumnOrderState, pinOf: (columnId: string) => ColumnPin, movedId: string, beforeId: string | null): ColumnOrderState;
|
|
3255
3358
|
/**
|
|
3256
3359
|
* Whether moving `movedId` in front of `beforeId` would rearrange anything, so
|
|
3257
3360
|
* that a drop indicator promises exactly the moves that happen.
|
|
@@ -3372,12 +3475,15 @@ declare function resolveColumnConstraints<Row>(column: ColumnDefinition<Row, unk
|
|
|
3372
3475
|
declare function clampColumnWidth(width: number, constraints: ColumnConstraints): number;
|
|
3373
3476
|
/**
|
|
3374
3477
|
* Pairs each column with everything needed to render it — the width it sits
|
|
3375
|
-
* at, the label its header shows, whether it may be resized
|
|
3376
|
-
* align. Widths take the first of the sizing state,
|
|
3377
|
-
* and the default, then clamp.
|
|
3478
|
+
* at, the label its header shows, whether it may be resized, how its cells
|
|
3479
|
+
* align and where it is pinned. Widths take the first of the sizing state,
|
|
3480
|
+
* the column's own `width`, and the default, then clamp.
|
|
3378
3481
|
*
|
|
3379
3482
|
* The sizing state winning means a user's drag outlives a re-render; a column
|
|
3380
3483
|
* absent from it still tracks a `width` edited in the definition.
|
|
3484
|
+
*
|
|
3485
|
+
* Pin offsets are summed along `columns` as given, so they hold for columns
|
|
3486
|
+
* already in pinned order — see `applyColumnPinning`.
|
|
3381
3487
|
*/
|
|
3382
3488
|
declare function resolveColumnWidths<Row, Node>(columns: readonly ColumnDefinition<Row, Node>[], sizing: ColumnSizingState, options?: ColumnResolveOptions): readonly ResolvedColumn<Row, Node>[];
|
|
3383
3489
|
declare function totalColumnWidth<Row, Node>(resolved: readonly ResolvedColumn<Row, Node>[]): number;
|
|
@@ -3406,7 +3512,8 @@ declare function applyColumnResize(session: ColumnResizeSession, position: numbe
|
|
|
3406
3512
|
* Growing stops at each column's `maxWidth`; shrinking stops at its
|
|
3407
3513
|
* `minWidth`. If shrinking every adjustable column to its floor still does
|
|
3408
3514
|
* not reach `availableWidth`, the columns are returned untouched and the
|
|
3409
|
-
* container scrolls rather than crushing them further.
|
|
3515
|
+
* container scrolls rather than crushing them further. Pin offsets follow
|
|
3516
|
+
* the new widths.
|
|
3410
3517
|
*/
|
|
3411
3518
|
declare function fitColumnsToWidth<Row, Node>(resolved: readonly ResolvedColumn<Row, Node>[], availableWidth: number, defaults?: Partial<ColumnSizeDefaults>): readonly ResolvedColumn<Row, Node>[];
|
|
3412
3519
|
/**
|
|
@@ -3510,6 +3617,37 @@ declare function moveGroupByBefore(groupBy: GroupByState, columnId: string, befo
|
|
|
3510
3617
|
*/
|
|
3511
3618
|
declare function movesGroupBy(groupBy: GroupByState, columnId: string, beforeColumnId: string | null): boolean;
|
|
3512
3619
|
|
|
3620
|
+
/**
|
|
3621
|
+
* The edge `column` is pinned to: what the user last chose for it, if
|
|
3622
|
+
* anything, else what its definition says. The one place that precedence is
|
|
3623
|
+
* decided, so the view and an imperative "is it pinned?" cannot disagree.
|
|
3624
|
+
*/
|
|
3625
|
+
declare function resolveColumnPin<Row>(column: ColumnDefinition<Row, unknown>, pinning: ColumnPinningState): ColumnPin;
|
|
3626
|
+
/**
|
|
3627
|
+
* `columns` with the start-pinned ones first and the end-pinned ones last,
|
|
3628
|
+
* each group in the order given. `columns` itself when that is already their
|
|
3629
|
+
* order — always, with nothing pinned — so a stage memoised on this output
|
|
3630
|
+
* sees nothing change.
|
|
3631
|
+
*/
|
|
3632
|
+
declare function applyColumnPinning<Row, Node>(columns: readonly DataColumn<Row, Node>[], pinning: ColumnPinningState): readonly DataColumn<Row, Node>[];
|
|
3633
|
+
/**
|
|
3634
|
+
* `pinning` with `columnId` pinned to `pin`, `"none"` to unpin it. The entry
|
|
3635
|
+
* is written only when the column's pin actually changes, and an id naming
|
|
3636
|
+
* no column is ignored, so asking for the pin a column already has hands back
|
|
3637
|
+
* `pinning` itself — the same reference, for a caller deciding whether
|
|
3638
|
+
* anything happened.
|
|
3639
|
+
*/
|
|
3640
|
+
declare function setColumnPin<Row>(columns: readonly DataColumn<Row, unknown>[], pinning: ColumnPinningState, columnId: string, pin: ColumnPin): ColumnPinningState;
|
|
3641
|
+
/**
|
|
3642
|
+
* The summed widths of the columns pinned to each edge — how much of the
|
|
3643
|
+
* grid's width each side's pinned columns cover, which a renderer keeps
|
|
3644
|
+
* scrolled content clear of.
|
|
3645
|
+
*/
|
|
3646
|
+
declare function pinnedWidths<Row, Node>(columns: readonly ResolvedColumn<Row, Node>[]): {
|
|
3647
|
+
readonly start: number;
|
|
3648
|
+
readonly end: number;
|
|
3649
|
+
};
|
|
3650
|
+
|
|
3513
3651
|
/**
|
|
3514
3652
|
* What one column's filter looks like to an editor — which of its forms can
|
|
3515
3653
|
* show it, or that none can.
|
|
@@ -3741,4 +3879,4 @@ declare function draftToFilter<Row>(draft: FilterEditorDraft<Row>, columnId: str
|
|
|
3741
3879
|
*/
|
|
3742
3880
|
declare function filterDraftChanged<Row>(opened: FilterEditorDraft<Row>, draft: FilterEditorDraft<Row>): boolean;
|
|
3743
3881
|
|
|
3744
|
-
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
|
|
3882
|
+
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 GroupExpansionState 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 ColumnPin as a6, type ColumnPinningEvent as a7, type ColumnPinningState as a8, type ColumnResizeEvent as a9, type FilterEntry as aA, type FilterMenuUi as aB, type FilterOperator as aC, type FilterOperatorFamily as aD, type FilterPredicate as aE, type FilterScalar as aF, type FooterTemplateContext as aG, type FormatLocale as aH, type GridCommandActions as aI, type GridCommandEvent as aJ, type GridCommandSource as aK, type GridContextMenuArea as aL, type GridContextMenuEntries as aM, type GridContextMenuOptions as aN, type GridContextMenuRequest as aO, type GridContextMenuTarget as aP, type GridFilterMenuOptions as aQ, type GridFocus as aR, type GridOptions as aS, type GridPanelKind as aT, type GridToolbarOptions as aU, type GridViewOptions as aV, type GridViewState as aW, type GroupByBarVisibility as aX, type GroupByEntry as aY, type GroupByEvent as aZ, type GroupExpansionEvent as a_, type ColumnResolveOptions as aa, type ColumnSelectEvent as ab, type ColumnSelectionChangeEvent as ac, type ColumnSizeDefaults as ad, type ColumnSizingState as ae, type ColumnSortEntry as af, type ColumnSortEvent as ag, type ColumnVisibilityEvent as ah, type ColumnWrapConfig as ai, type ColumnsSelectEvent as aj, type ContextMenuOpenChangeEvent as ak, type CopyContent as al, type CsvOptions as am, DEFAULT_COLUMN_SIZES as an, DEFAULT_FILTER_VALUE_LIMIT as ao, type ExportCell as ap, type ExportColumn as aq, type ExportDataRow as ar, type ExportGroupRow as as, type ExportGroupSummaryRow as at, type ExportOptions as au, type ExportRow as av, type ExportScalar as aw, type ExportTotalRow as ax, type ExportWriteContext as ay, type FilterChangeEvent as az, type GridCommandTarget as b, defineColumnsFromRows as b$, type GroupFilterEntry as b0, type HoverableConfig as b1, type JsonOptions as b2, type MenuItemEntry as b3, type MenuSubmenuEntry as b4, type OperatorFilterEntry as b5, type PaginationChangeEvent as b6, type PredicateFilterEntry as b7, type PrintDocument as b8, type PrintOptions as b9, type SelectionState as bA, type SerializedFilterEntry as bB, type SerializedFilterScalar as bC, type SerializedFilterState as bD, type SerializedGroupFilterEntry as bE, type SerializedOperatorFilterEntry as bF, type SerializedValueFilterEntry as bG, type TextFilterEntry as bH, type ToolbarCustomEntry as bI, type ValueFilterEntry as bJ, accessDotted as bK, alignmentForType as bL, applyColumnOrder as bM, applyColumnPinning as bN, applySelectionIntent as bO, bodyFocus as bP, buildExportTable as bQ, builtInCommands as bR, clearSelection as bS, collapseAllGroups as bT, contextMenuEntries as bU, createDefaultMessages as bV, csvWriter as bW, defaultContextMenu as bX, defaultFilterOperators as bY, defaultMessages as bZ, defaultToolbar as b_, type PrintOrientation as ba, type PrintPage as bb, type PrintSource as bc, type ResizeMode as bd, type ResolvedGroupRow as be, type ResolvedGroupSummaryRow as bf, type ResolvedMenuItem as bg, type ResolvedMenuSeparator as bh, type ResolvedMenuSubmenu as bi, type ResolvedToolbarButton as bj, type ResolvedToolbarCustom as bk, type ResolvedToolbarMenu as bl, type ResolvedToolbarSearch as bm, type ResolvedToolbarSpacer as bn, type RowGroupPosition as bo, type RowPointerEvent as bp, type RowProps as bq, type RowSelectEvent as br, type RowSelectionChangeEvent as bs, type RowsSelectEvent as bt, type SelectIntent as bu, type SelectableConfig as bv, type SelectionCallbacks as bw, type SelectionDiff as bx, type SelectionDiffEvent as by, type SelectionMode as bz, type GridMessages as c, draftToFilter as c$, expandAllGroups as c0, exportPrintDocument as c1, formatAggregateValue as c2, formatCellValue as c3, formatGroupValue as c4, getColumnId as c5, groupRowId as c6, groupRows as c7, headerFocus as c8, isColumnFiltered as c9, type ColumnValueQuery as cA, type ColumnValueOptions as cB, type ValuesDraft as cC, type ColumnResizeSession as cD, type ColumnValueOption as cE, type ConditionsDraft as cF, type CopyRequest as cG, type CopySource as cH, type DropSide as cI, type FilterEditorAction as cJ, type FilterEditorDraft as cK, type FilterEditorDraftBase as cL, KEYBOARD_STEP as cM, type KeyShortcutCapabilities as cN, type NavigationModifiers as cO, type ResolvedColumnFilterMenu as cP, type WritingDirection as cQ, applyColumnResize as cR, beginColumnResize as cS, buildKeyShortcuts as cT, buildPrintDocument as cU, clampColumnWidth as cV, clampFocus as cW, columnValueOptions as cX, copyContent as cY, describeColumnFilter as cZ, diffSelection as c_, isGroupExpanded as ca, isSameCell as cb, jsonWriter as cc, moveColumnBefore as cd, moveGroupByBefore as ce, resolveColumnHeaderText as cf, resolveColumnLabel as cg, resolveColumnPin as ch, resolveColumnWidths as ci, resolveDataColumns as cj, resolveExportWriters as ck, resolveMessages as cl, resolveRowId as cm, selectAll as cn, selectCell as co, selectOnly as cp, selectRange as cq, setColumnPin as cr, toCsv as cs, toJson as ct, toggleCellSelection as cu, toggleGroupExpansion as cv, toggleSelection as cw, toolbarEntries as cx, type SelectAllState as cy, type ColumnFilterShape as cz, type GridCommandHost as d, filterDraftChanged as d0, filterEditorReducer as d1, filterOperandArity as d2, filterOperatorFamily as d3, fitColumnsToWidth as d4, formatFilterOperand as d5, hasContextMenu as d6, initialFilterEditorDraft as d7, inlineStep as d8, intentOf as d9, moveColumnInPinGroup as da, movesColumn as db, movesGroupBy as dc, nextFocusForKey as dd, parseFilterOperand as de, pinnedWidths as df, resolveColumnConstraints as dg, resolveColumnFilterMenu as dh, resolveDropBefore as di, resolveKeyboardDropTarget as dj, revertColumnSize as dk, selectAllState as dl, sizeColumnToContent as dm, toConditionsDraft as dn, toValuesDraft as dp, totalColumnWidth as dq, visibleFilterOptions as dr, 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
|
|
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-BAbQCUfe.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 ColumnPin, a7 as ColumnPinningEvent, a8 as ColumnPinningState, a9 as ColumnResizeEvent, aa as ColumnResolveOptions, ab as ColumnSelectEvent, ac as ColumnSelectionChangeEvent, ad as ColumnSizeDefaults, ae as ColumnSizingState, af as ColumnSortEntry, ag as ColumnSortEvent, ah as ColumnVisibilityEvent, ai as ColumnWrapConfig, aj as ColumnsSelectEvent, ak as ContextMenuOpenChangeEvent, al as CopyContent, am as CsvOptions, an as DEFAULT_COLUMN_SIZES, ao as DEFAULT_FILTER_VALUE_LIMIT, ap as ExportCell, aq as ExportColumn, ar as ExportDataRow, as as ExportGroupRow, at as ExportGroupSummaryRow, au as ExportOptions, av as ExportRow, aw as ExportScalar, ax as ExportTotalRow, ay as ExportWriteContext, az as FilterChangeEvent, aA as FilterEntry, aB as FilterMenuUi, aC as FilterOperator, aD as FilterOperatorFamily, aE as FilterPredicate, aF as FilterScalar, aG as FooterTemplateContext, aH as FormatLocale, aI as GridCommandActions, aJ as GridCommandEvent, aK as GridCommandSource, aL as GridContextMenuArea, aM as GridContextMenuEntries, aN as GridContextMenuOptions, aO as GridContextMenuRequest, aP as GridContextMenuTarget, aQ as GridFilterMenuOptions, aR as GridFocus, aS as GridOptions, aT as GridPanelKind, aU as GridToolbarOptions, aV as GridViewOptions, aW as GridViewState, aX as GroupByBarVisibility, aY as GroupByEntry, aZ as GroupByEvent, a_ as GroupExpansionEvent, a$ as GroupExpansionState, b0 as GroupFilterEntry, b1 as HoverableConfig, b2 as JsonOptions, b3 as MenuItemEntry, b4 as MenuSubmenuEntry, b5 as OperatorFilterEntry, b6 as PaginationChangeEvent, b7 as PredicateFilterEntry, b8 as PrintDocument, b9 as PrintOptions, ba as PrintOrientation, bb as PrintPage, bc as PrintSource, bd as ResizeMode, be as ResolvedGroupRow, bf as ResolvedGroupSummaryRow, bg as ResolvedMenuItem, bh as ResolvedMenuSeparator, bi as ResolvedMenuSubmenu, bj as ResolvedToolbarButton, bk as ResolvedToolbarCustom, bl as ResolvedToolbarMenu, bm as ResolvedToolbarSearch, bn as ResolvedToolbarSpacer, bo as RowGroupPosition, bp as RowPointerEvent, bq as RowProps, br as RowSelectEvent, bs as RowSelectionChangeEvent, bt as RowsSelectEvent, bu as SelectIntent, bv as SelectableConfig, bw as SelectionCallbacks, bx as SelectionDiff, by as SelectionDiffEvent, bz as SelectionMode, bA as SelectionState, bB as SerializedFilterEntry, bC as SerializedFilterScalar, bD as SerializedFilterState, bE as SerializedGroupFilterEntry, bF as SerializedOperatorFilterEntry, bG as SerializedValueFilterEntry, bH as TextFilterEntry, bI as ToolbarCustomEntry, bJ as ValueFilterEntry, bK as accessDotted, bL as alignmentForType, bM as applyColumnOrder, bN as applyColumnPinning, bO as applySelectionIntent, bP as bodyFocus, bQ as buildExportTable, bR as builtInCommands, bS as clearSelection, bT as collapseAllGroups, bU as contextMenuEntries, bV as createDefaultMessages, bW as csvWriter, bX as defaultContextMenu, bY as defaultFilterOperators, bZ as defaultMessages, b_ as defaultToolbar, b$ as defineColumnsFromRows, c0 as expandAllGroups, c1 as exportPrintDocument, c2 as formatAggregateValue, c3 as formatCellValue, c4 as formatGroupValue, c5 as getColumnId, c6 as groupRowId, c7 as groupRows, c8 as headerFocus, c9 as isColumnFiltered, ca as isGroupExpanded, cb as isSameCell, cc as jsonWriter, cd as moveColumnBefore, ce as moveGroupByBefore, cf as resolveColumnHeaderText, cg as resolveColumnLabel, ch as resolveColumnPin, ci as resolveColumnWidths, cj as resolveDataColumns, ck as resolveExportWriters, cl as resolveMessages, cm as resolveRowId, cn as selectAll, co as selectCell, cp as selectOnly, cq as selectRange, cr as setColumnPin, cs as toCsv, ct as toJson, cu as toggleCellSelection, cv as toggleGroupExpansion, cw as toggleSelection, cx as toolbarEntries } from './filterEditor-BAbQCUfe.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates the state container for one grid — see `GridController`. Hold one
|
|
@@ -331,8 +331,8 @@ declare function createGridViewResolver<Row, Node = string>(): (input: GridViewI
|
|
|
331
331
|
/**
|
|
332
332
|
* What the user is looking at, derived from the rows, the columns, the
|
|
333
333
|
* grid's state and its options in one call: rows filtered → sorted →
|
|
334
|
-
* grouped → aggregated → paginated, and columns ordered → hidden →
|
|
335
|
-
* The one function a renderer, an export or a toolbar calls instead of
|
|
334
|
+
* grouped → aggregated → paginated, and columns ordered → hidden → pinned →
|
|
335
|
+
* sized. The one function a renderer, an export or a toolbar calls instead of
|
|
336
336
|
* composing the stages itself, so none of them can disagree about what is
|
|
337
337
|
* shown.
|
|
338
338
|
*
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
accessDotted,
|
|
8
8
|
alignmentForType,
|
|
9
9
|
applyColumnOrder,
|
|
10
|
+
applyColumnPinning,
|
|
10
11
|
applyColumnVisibility,
|
|
11
12
|
applySelectionIntent,
|
|
12
13
|
bodyFocus,
|
|
@@ -49,11 +50,13 @@ import {
|
|
|
49
50
|
jsonWriter,
|
|
50
51
|
matchesQuery,
|
|
51
52
|
moveColumnBefore,
|
|
53
|
+
moveColumnInPinGroup,
|
|
52
54
|
moveGroupByBefore,
|
|
53
55
|
reportError,
|
|
54
56
|
resolveCell,
|
|
55
57
|
resolveColumnHeaderText,
|
|
56
58
|
resolveColumnLabel,
|
|
59
|
+
resolveColumnPin,
|
|
57
60
|
resolveColumnWidths,
|
|
58
61
|
resolveColumns,
|
|
59
62
|
resolveCommands,
|
|
@@ -72,6 +75,7 @@ import {
|
|
|
72
75
|
selectOnly,
|
|
73
76
|
selectRange,
|
|
74
77
|
setColumnFilter,
|
|
78
|
+
setColumnPin,
|
|
75
79
|
setColumnVisibility,
|
|
76
80
|
sortDirectionFor,
|
|
77
81
|
sortPriorityFor,
|
|
@@ -88,7 +92,7 @@ import {
|
|
|
88
92
|
unknownDisplayRow,
|
|
89
93
|
unknownFilterEntry,
|
|
90
94
|
withGroupAggregates
|
|
91
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-ZFWEGZX3.js";
|
|
92
96
|
|
|
93
97
|
// src/util/memoize.ts
|
|
94
98
|
function memoizeLast(compute) {
|
|
@@ -352,6 +356,7 @@ var STARTING_VIEW_STATE = {
|
|
|
352
356
|
columnSizing: {},
|
|
353
357
|
columnOrder: [],
|
|
354
358
|
columnVisibility: {},
|
|
359
|
+
columnPinning: {},
|
|
355
360
|
columnSort: [],
|
|
356
361
|
filter: [],
|
|
357
362
|
groupBy: [],
|
|
@@ -363,6 +368,7 @@ function fillViewState(state) {
|
|
|
363
368
|
columnSizing: state.columnSizing ?? STARTING_VIEW_STATE.columnSizing,
|
|
364
369
|
columnOrder: state.columnOrder ?? STARTING_VIEW_STATE.columnOrder,
|
|
365
370
|
columnVisibility: state.columnVisibility ?? STARTING_VIEW_STATE.columnVisibility,
|
|
371
|
+
columnPinning: state.columnPinning ?? STARTING_VIEW_STATE.columnPinning,
|
|
366
372
|
columnSort: state.columnSort ?? STARTING_VIEW_STATE.columnSort,
|
|
367
373
|
filter: state.filter ?? STARTING_VIEW_STATE.filter,
|
|
368
374
|
groupBy: state.groupBy ?? STARTING_VIEW_STATE.groupBy,
|
|
@@ -379,11 +385,11 @@ function identifyRows(rows, getRowId) {
|
|
|
379
385
|
datasetIndex: rowIndex
|
|
380
386
|
}));
|
|
381
387
|
}
|
|
382
|
-
function sizeColumns(visibleColumns, sizing, sizes, resizable, reorderable, groupByDraggable, resizeMode, viewportWidth) {
|
|
388
|
+
function sizeColumns(visibleColumns, sizing, pinning, sizes, resizable, reorderable, groupByDraggable, resizeMode, viewportWidth) {
|
|
383
389
|
const widths = resolveColumnWidths(
|
|
384
390
|
visibleColumns.map((entry) => entry.column),
|
|
385
391
|
sizing,
|
|
386
|
-
{ sizes, resizable, reorderable, groupByDraggable }
|
|
392
|
+
{ sizes, resizable, reorderable, groupByDraggable, pinning }
|
|
387
393
|
);
|
|
388
394
|
return resizeMode === "fit" && viewportWidth !== null ? fitColumnsToWidth(widths, viewportWidth, sizes) : widths;
|
|
389
395
|
}
|
|
@@ -406,6 +412,7 @@ function createGridViewResolver() {
|
|
|
406
412
|
const identify = memoizeLast(identifyRows);
|
|
407
413
|
const orderColumns = memoizeLast(resolveDataColumns);
|
|
408
414
|
const showColumns = memoizeLast(applyColumnVisibility);
|
|
415
|
+
const pinColumns = memoizeLast(applyColumnPinning);
|
|
409
416
|
const size = memoizeLast(sizeColumns);
|
|
410
417
|
const filterAndSort = memoizeLast(resolveShownRows);
|
|
411
418
|
const group = memoizeLast(groupRows);
|
|
@@ -438,8 +445,12 @@ function createGridViewResolver() {
|
|
|
438
445
|
const aggregates = options.aggregates ?? NO_AGGREGATES;
|
|
439
446
|
const dataColumns = orderColumns(definitions, state.columnOrder);
|
|
440
447
|
const columns = size(
|
|
441
|
-
|
|
448
|
+
pinColumns(
|
|
449
|
+
showColumns(dataColumns, state.columnVisibility),
|
|
450
|
+
state.columnPinning
|
|
451
|
+
),
|
|
442
452
|
state.columnSizing,
|
|
453
|
+
state.columnPinning,
|
|
443
454
|
options.columnSizeDefaults,
|
|
444
455
|
options.resizableColumns,
|
|
445
456
|
options.reorderableColumns,
|
|
@@ -793,6 +804,7 @@ var SLICE_KEYS = [
|
|
|
793
804
|
"columnSizing",
|
|
794
805
|
"columnOrder",
|
|
795
806
|
"columnVisibility",
|
|
807
|
+
"columnPinning",
|
|
796
808
|
"columnSort",
|
|
797
809
|
"filter",
|
|
798
810
|
"groupBy",
|
|
@@ -806,6 +818,7 @@ var DEFAULT_OPTION = {
|
|
|
806
818
|
columnSizing: "defaultColumnSizing",
|
|
807
819
|
columnOrder: "defaultColumnOrder",
|
|
808
820
|
columnVisibility: "defaultColumnVisibility",
|
|
821
|
+
columnPinning: "defaultColumnPinning",
|
|
809
822
|
columnSort: "defaultColumnSort",
|
|
810
823
|
filter: "defaultFilter",
|
|
811
824
|
groupBy: "defaultGroupBy",
|
|
@@ -820,6 +833,7 @@ function startingState(options) {
|
|
|
820
833
|
columnSizing: options.defaultColumnSizing ?? STARTING_VIEW_STATE.columnSizing,
|
|
821
834
|
columnOrder: options.defaultColumnOrder ?? STARTING_VIEW_STATE.columnOrder,
|
|
822
835
|
columnVisibility: options.defaultColumnVisibility ?? STARTING_VIEW_STATE.columnVisibility,
|
|
836
|
+
columnPinning: options.defaultColumnPinning ?? STARTING_VIEW_STATE.columnPinning,
|
|
823
837
|
columnSort: options.defaultColumnSort ?? STARTING_VIEW_STATE.columnSort,
|
|
824
838
|
filter: options.defaultFilter ?? STARTING_VIEW_STATE.filter,
|
|
825
839
|
groupBy: options.defaultGroupBy ?? STARTING_VIEW_STATE.groupBy,
|
|
@@ -878,6 +892,7 @@ function createGridController(initial) {
|
|
|
878
892
|
columnSizing: resolveSlice("columnSizing"),
|
|
879
893
|
columnOrder: resolveSlice("columnOrder"),
|
|
880
894
|
columnVisibility: resolveSlice("columnVisibility"),
|
|
895
|
+
columnPinning: resolveSlice("columnPinning"),
|
|
881
896
|
columnSort: resolveSlice("columnSort"),
|
|
882
897
|
filter: resolveSlice("filter"),
|
|
883
898
|
groupBy: resolveSlice("groupBy"),
|
|
@@ -1017,13 +1032,16 @@ function createGridController(initial) {
|
|
|
1017
1032
|
);
|
|
1018
1033
|
return resolved?.width ?? 0;
|
|
1019
1034
|
}
|
|
1035
|
+
function changedColumnIds(previous, next) {
|
|
1036
|
+
const changed = new Set(changedKeys(previous, next));
|
|
1037
|
+
const known = getView().dataColumns.map((entry) => entry.id).filter((id) => changed.delete(id));
|
|
1038
|
+
return [...known, ...changed];
|
|
1039
|
+
}
|
|
1020
1040
|
function commitColumnVisibility(next) {
|
|
1021
1041
|
const previous = state.columnVisibility;
|
|
1022
1042
|
commit("columnVisibility", next, () => {
|
|
1023
|
-
const changed = new Set(changedKeys(previous, next));
|
|
1024
|
-
const shown = getView().dataColumns.map((entry) => entry.id).filter((id) => changed.delete(id));
|
|
1025
1043
|
options.onColumnVisibilityChange?.({
|
|
1026
|
-
columnIds:
|
|
1044
|
+
columnIds: changedColumnIds(previous, next),
|
|
1027
1045
|
visibility: next
|
|
1028
1046
|
});
|
|
1029
1047
|
});
|
|
@@ -1038,6 +1056,15 @@ function createGridController(initial) {
|
|
|
1038
1056
|
)
|
|
1039
1057
|
);
|
|
1040
1058
|
}
|
|
1059
|
+
function commitColumnPinning(next) {
|
|
1060
|
+
const previous = state.columnPinning;
|
|
1061
|
+
commit("columnPinning", next, () => {
|
|
1062
|
+
options.onColumnPinningChange?.({
|
|
1063
|
+
columnIds: changedColumnIds(previous, next),
|
|
1064
|
+
pinning: next
|
|
1065
|
+
});
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1041
1068
|
function commitGroupBy(next, columnId) {
|
|
1042
1069
|
commit("groupBy", next, () => {
|
|
1043
1070
|
options.onGroupByChange?.({ columnId, groupBy: next });
|
|
@@ -1145,13 +1172,25 @@ function createGridController(initial) {
|
|
|
1145
1172
|
});
|
|
1146
1173
|
},
|
|
1147
1174
|
/**
|
|
1148
|
-
* Applied to every id in
|
|
1175
|
+
* Applied to every id in column order rather than to the stored order,
|
|
1149
1176
|
* which starts empty and may name only some columns, so would have
|
|
1150
1177
|
* nothing to rearrange.
|
|
1151
1178
|
*/
|
|
1152
1179
|
moveColumn(columnId, beforeId) {
|
|
1153
|
-
const
|
|
1154
|
-
const
|
|
1180
|
+
const { dataColumns } = getView();
|
|
1181
|
+
const orderedIds = dataColumns.map((entry) => entry.id);
|
|
1182
|
+
const pins = new Map(
|
|
1183
|
+
dataColumns.map((entry) => [
|
|
1184
|
+
entry.id,
|
|
1185
|
+
resolveColumnPin(entry.column, state.columnPinning)
|
|
1186
|
+
])
|
|
1187
|
+
);
|
|
1188
|
+
const next = moveColumnInPinGroup(
|
|
1189
|
+
orderedIds,
|
|
1190
|
+
(id) => pins.get(id) ?? "none",
|
|
1191
|
+
columnId,
|
|
1192
|
+
beforeId
|
|
1193
|
+
);
|
|
1155
1194
|
if (next === orderedIds) {
|
|
1156
1195
|
return;
|
|
1157
1196
|
}
|
|
@@ -1170,6 +1209,16 @@ function createGridController(initial) {
|
|
|
1170
1209
|
hideColumns(columnIds) {
|
|
1171
1210
|
changeColumnVisibility(columnIds, false);
|
|
1172
1211
|
},
|
|
1212
|
+
setColumnPinning(pinning) {
|
|
1213
|
+
if (changedKeys(state.columnPinning, pinning).length > 0) {
|
|
1214
|
+
commitColumnPinning(pinning);
|
|
1215
|
+
}
|
|
1216
|
+
},
|
|
1217
|
+
pinColumn(columnId, pin) {
|
|
1218
|
+
commitColumnPinning(
|
|
1219
|
+
setColumnPin(getView().dataColumns, state.columnPinning, columnId, pin)
|
|
1220
|
+
);
|
|
1221
|
+
},
|
|
1173
1222
|
setFilter(filter) {
|
|
1174
1223
|
if (sameFilter(state.filter, filter)) {
|
|
1175
1224
|
return;
|
|
@@ -1268,6 +1317,9 @@ function createGridController(initial) {
|
|
|
1268
1317
|
if (saved.columnVisibility !== void 0) {
|
|
1269
1318
|
controller.setColumnVisibility(saved.columnVisibility);
|
|
1270
1319
|
}
|
|
1320
|
+
if (saved.columnPinning !== void 0) {
|
|
1321
|
+
controller.setColumnPinning(saved.columnPinning);
|
|
1322
|
+
}
|
|
1271
1323
|
if (saved.columnSort !== void 0) {
|
|
1272
1324
|
controller.setColumnSort(saved.columnSort);
|
|
1273
1325
|
}
|
|
@@ -1415,6 +1467,7 @@ export {
|
|
|
1415
1467
|
accessDotted,
|
|
1416
1468
|
alignmentForType,
|
|
1417
1469
|
applyColumnOrder,
|
|
1470
|
+
applyColumnPinning,
|
|
1418
1471
|
applyColumnVisibility,
|
|
1419
1472
|
applySelectionIntent,
|
|
1420
1473
|
bodyFocus,
|
|
@@ -1461,6 +1514,7 @@ export {
|
|
|
1461
1514
|
resolveCell,
|
|
1462
1515
|
resolveColumnHeaderText,
|
|
1463
1516
|
resolveColumnLabel,
|
|
1517
|
+
resolveColumnPin,
|
|
1464
1518
|
resolveColumnWidths,
|
|
1465
1519
|
resolveColumns,
|
|
1466
1520
|
resolveCommands,
|
|
@@ -1480,6 +1534,7 @@ export {
|
|
|
1480
1534
|
selectRange,
|
|
1481
1535
|
serializeGridState,
|
|
1482
1536
|
setColumnFilter,
|
|
1537
|
+
setColumnPin,
|
|
1483
1538
|
setColumnVisibility,
|
|
1484
1539
|
sortDirectionFor,
|
|
1485
1540
|
sortPriorityFor,
|