foldkit-data-grid 0.1.3 → 0.2.0
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/crud.d.mts +23 -10
- package/dist/crud.d.mts.map +1 -1
- package/dist/index.d.mts +447 -1192
- package/dist/index.d.mts.map +1 -1
- package/dist/{rows-BfrGLtaa.d.mts → rows-TYJdJ7tK.d.mts} +5 -5
- package/dist/rows-TYJdJ7tK.d.mts.map +1 -0
- package/package.json +13 -13
- package/dist/rows-BfrGLtaa.d.mts.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CellEditor, c as ColumnId, d as EditValue, f as EditableId, i as addressableRows, l as ColumnSpec, n as RowModel, o as Column, r as RowStatus, s as ColumnEdit, t as RowCount, u as Columns } from "./rows-
|
|
1
|
+
import { a as CellEditor, c as ColumnId, d as EditValue, f as EditableId, i as addressableRows, l as ColumnSpec, n as RowModel, o as Column, r as RowStatus, s as ColumnEdit, t as RowCount, u as Columns } from "./rows-TYJdJ7tK.mjs";
|
|
2
2
|
import { Option, Schema } from "effect";
|
|
3
3
|
import { Bundle } from "foldkit-bundle";
|
|
4
4
|
import * as Mount from "foldkit/mount";
|
|
@@ -119,14 +119,36 @@ interface CellText<Id extends string> {
|
|
|
119
119
|
interface PastedCell<Id extends string> extends CellText<Id> {
|
|
120
120
|
readonly from: string;
|
|
121
121
|
}
|
|
122
|
+
/** Rows of cells as tab-separated text, the form spreadsheets copy and paste. */
|
|
123
|
+
declare const toTsv: (rows: ReadonlyArray<ReadonlyArray<string>>) => string;
|
|
124
|
+
/**
|
|
125
|
+
* Tab-separated text as rows of cells. Quoted cells may hold tabs, line
|
|
126
|
+
* breaks and doubled quotes; `\r\n` and `\r` end a row as `\n` does; the line
|
|
127
|
+
* break a spreadsheet adds after the last row makes no empty row.
|
|
128
|
+
*/
|
|
129
|
+
declare const parseTsv: (text: string) => ReadonlyArray<ReadonlyArray<string>>;
|
|
130
|
+
/**
|
|
131
|
+
* The text of the cells a box covers, row by row in the projection's order
|
|
132
|
+
* and column by column in display order. A row counted but not loaded copies
|
|
133
|
+
* as empty cells, so the shape is the box's.
|
|
134
|
+
*/
|
|
135
|
+
declare const copy: <Row, Id extends string>(projection: GridProjection<Row, Id>, box: CellBox<Id>, textOf: (address: CellAddress<Id>) => string) => string;
|
|
136
|
+
/**
|
|
137
|
+
* Where pasted cells land: the matrix laid from `anchor` across rows in the
|
|
138
|
+
* projection's order and columns in display order. Cells past the grid's
|
|
139
|
+
* edges are dropped, as are those landing on a column that does not edit or
|
|
140
|
+
* a row not loaded; the rest keep their place, each with `from`, the text
|
|
141
|
+
* the cell showed (the text an edit of it would begin from).
|
|
142
|
+
*/
|
|
143
|
+
declare const pasteAt: <Row, Id extends string>(projection: GridProjection<Row, Id>, anchor: CellAddress<Id>, matrix: ReadonlyArray<ReadonlyArray<string>>, cells: {
|
|
144
|
+
readonly editable: (column: Id) => boolean;
|
|
145
|
+
readonly from: (address: CellAddress<Id>) => string;
|
|
146
|
+
}) => ReadonlyArray<PastedCell<Id>>;
|
|
122
147
|
export declare const Clipboard: {
|
|
123
|
-
toTsv:
|
|
124
|
-
parseTsv:
|
|
125
|
-
copy:
|
|
126
|
-
pasteAt:
|
|
127
|
-
readonly editable: (column: Id) => boolean;
|
|
128
|
-
readonly from: (address: CellAddress<Id>) => string;
|
|
129
|
-
}) => ReadonlyArray<PastedCell<Id>>;
|
|
148
|
+
toTsv: typeof toTsv;
|
|
149
|
+
parseTsv: typeof parseTsv;
|
|
150
|
+
copy: typeof copy;
|
|
151
|
+
pasteAt: typeof pasteAt;
|
|
130
152
|
};
|
|
131
153
|
//#endregion
|
|
132
154
|
//#region src/fill.d.ts
|
|
@@ -149,13 +171,30 @@ interface FillPlan<Id extends string> {
|
|
|
149
171
|
/** Rows (`down`/`up`) or columns (`right`/`left`), away from the source. */
|
|
150
172
|
readonly toward: 'down' | 'up' | 'right' | 'left';
|
|
151
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* The texts that carry `source` on for `count` cells, the first of them next
|
|
176
|
+
* to it. Two or more numbers a constant step apart continue their step, with
|
|
177
|
+
* as many decimals as the most precise of them; anything else repeats, in
|
|
178
|
+
* order. `backward` carries the source on before its first text, as filling
|
|
179
|
+
* up or left does.
|
|
180
|
+
*/
|
|
181
|
+
declare const series: (source: ReadonlyArray<string>, count: number, backward: boolean) => ReadonlyArray<string>;
|
|
182
|
+
/** The source's box and the box beyond it toward `to`; none when `to` is inside it. */
|
|
183
|
+
declare const plan: <Row, Id extends string>(projection: GridProjection<Row, Id>, request: FillRequest<Id>) => Option.Option<FillPlan<Id>>;
|
|
184
|
+
/**
|
|
185
|
+
* The cells a fill writes: each lane of the source (a column for a fill down
|
|
186
|
+
* or up, a row for one right or left) carried on through the target by
|
|
187
|
+
* `series`. Cells on a column that does not edit, or on a row not loaded, are
|
|
188
|
+
* dropped; each kept cell has `from`, the text it showed.
|
|
189
|
+
*/
|
|
190
|
+
declare const cells: <Row, Id extends string>(projection: GridProjection<Row, Id>, fill: FillPlan<Id>, options: {
|
|
191
|
+
readonly editable: (column: Id) => boolean;
|
|
192
|
+
readonly from: (address: CellAddress<Id>) => string;
|
|
193
|
+
}) => ReadonlyArray<PastedCell<Id>>;
|
|
152
194
|
export declare const Fill: {
|
|
153
|
-
series:
|
|
154
|
-
plan:
|
|
155
|
-
cells:
|
|
156
|
-
readonly editable: (column: Id) => boolean;
|
|
157
|
-
readonly from: (address: CellAddress<Id>) => string;
|
|
158
|
-
}) => ReadonlyArray<PastedCell<Id>>;
|
|
195
|
+
series: typeof series;
|
|
196
|
+
plan: typeof plan;
|
|
197
|
+
cells: typeof cells;
|
|
159
198
|
};
|
|
160
199
|
//#endregion
|
|
161
200
|
//#region src/columnState.d.ts
|
|
@@ -177,28 +216,35 @@ interface Restored<Id extends string> {
|
|
|
177
216
|
/** Ids the saved state named that these columns do not define, or named twice. */
|
|
178
217
|
readonly dropped: ReadonlyArray<string>;
|
|
179
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Column state for one grid's columns: its Schema, which decodes only these
|
|
221
|
+
* columns' ids, and the operations a grid's Messages run. Every operation
|
|
222
|
+
* returns the state it was given when it changes nothing, so a no-op draws
|
|
223
|
+
* nothing.
|
|
224
|
+
*/
|
|
225
|
+
declare const make$2: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>>(columns: Columns<Row, Specs>) => {
|
|
226
|
+
Model: Schema.Struct<{
|
|
227
|
+
readonly start: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
228
|
+
readonly center: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
229
|
+
readonly end: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
230
|
+
readonly hidden: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
231
|
+
readonly widths: Schema.$Array<Schema.Struct<{
|
|
232
|
+
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
233
|
+
readonly width: Schema.Number;
|
|
234
|
+
}>>;
|
|
235
|
+
}>;
|
|
236
|
+
initial: () => ColumnState<keyof Specs & string>;
|
|
237
|
+
widthOf: (state: ColumnState<keyof Specs & string>) => ((id: keyof Specs & string) => number);
|
|
238
|
+
regionOf: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => Region;
|
|
239
|
+
resize: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, width: number) => ColumnState<keyof Specs & string>;
|
|
240
|
+
hide: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => ColumnState<keyof Specs & string>;
|
|
241
|
+
show: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => ColumnState<keyof Specs & string>;
|
|
242
|
+
move: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, region: Region, index: number) => ColumnState<keyof Specs & string>;
|
|
243
|
+
dropAt: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, delta: number) => number;
|
|
244
|
+
restore: (saved: unknown) => Restored<keyof Specs & string>;
|
|
245
|
+
};
|
|
180
246
|
export declare const ColumnState: {
|
|
181
|
-
make:
|
|
182
|
-
Model: Schema.Struct<{
|
|
183
|
-
readonly start: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
184
|
-
readonly center: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
185
|
-
readonly end: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
186
|
-
readonly hidden: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
187
|
-
readonly widths: Schema.$Array<Schema.Struct<{
|
|
188
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
189
|
-
readonly width: Schema.Number;
|
|
190
|
-
}>>;
|
|
191
|
-
}>;
|
|
192
|
-
initial: () => ColumnState<keyof Specs & string>;
|
|
193
|
-
widthOf: (state: ColumnState<keyof Specs & string>) => ((id: keyof Specs & string) => number);
|
|
194
|
-
regionOf: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => Region;
|
|
195
|
-
resize: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, width: number) => ColumnState<keyof Specs & string>;
|
|
196
|
-
hide: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => ColumnState<keyof Specs & string>;
|
|
197
|
-
show: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => ColumnState<keyof Specs & string>;
|
|
198
|
-
move: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, region: Region, index: number) => ColumnState<keyof Specs & string>;
|
|
199
|
-
dropAt: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, delta: number) => number;
|
|
200
|
-
restore: (saved: unknown) => Restored<keyof Specs & string>;
|
|
201
|
-
};
|
|
247
|
+
make: typeof make$2;
|
|
202
248
|
};
|
|
203
249
|
//#endregion
|
|
204
250
|
//#region src/virtual.d.ts
|
|
@@ -246,16 +292,30 @@ interface WindowOptions<Row, Id extends string> extends Geometry<Row, Id> {
|
|
|
246
292
|
readonly columns?: number;
|
|
247
293
|
};
|
|
248
294
|
}
|
|
295
|
+
/**
|
|
296
|
+
* What to render for a viewport: the rows and center columns it shows, plus
|
|
297
|
+
* overscan, and the space the rest take. Rows are one fixed height, so the
|
|
298
|
+
* row window is arithmetic on the scroll offset and never walks the rows; the
|
|
299
|
+
* column window is a binary search over the center columns' widths. The
|
|
300
|
+
* pinned columns are always rendered, outside the horizontal window.
|
|
301
|
+
*/
|
|
302
|
+
declare const window: <Row, Id extends string>(options: WindowOptions<Row, Id>) => GridWindow<Id>;
|
|
249
303
|
interface RevealOptions<Row, Id extends string> extends Geometry<Row, Id> {
|
|
250
304
|
readonly viewport: Viewport;
|
|
251
305
|
readonly position: CellPosition;
|
|
252
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* The scroll offsets that bring a cell fully into view, moving each axis the
|
|
309
|
+
* least it can, or none when it is already in view. A pinned column never
|
|
310
|
+
* scrolls, so only its row is brought in.
|
|
311
|
+
*/
|
|
312
|
+
declare const reveal: <Row, Id extends string>(options: RevealOptions<Row, Id>) => Option.Option<{
|
|
313
|
+
readonly top: number;
|
|
314
|
+
readonly left: number;
|
|
315
|
+
}>;
|
|
253
316
|
export declare const VirtualGrid: {
|
|
254
|
-
window:
|
|
255
|
-
reveal:
|
|
256
|
-
readonly top: number;
|
|
257
|
-
readonly left: number;
|
|
258
|
-
}>;
|
|
317
|
+
window: typeof window;
|
|
318
|
+
reveal: typeof reveal;
|
|
259
319
|
};
|
|
260
320
|
//#endregion
|
|
261
321
|
//#region src/grid.d.ts
|
|
@@ -270,10 +330,10 @@ export declare const VirtualGrid: {
|
|
|
270
330
|
* `cellSelection` lets a rectangle of cells be selected; without them their
|
|
271
331
|
* Messages change nothing.
|
|
272
332
|
*/
|
|
273
|
-
declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>>(options: {
|
|
333
|
+
declare const make$1: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>>(options: {
|
|
274
334
|
readonly id: string;
|
|
275
335
|
readonly columns: Columns<Row, Specs>;
|
|
276
|
-
readonly rowSelection?:
|
|
336
|
+
readonly rowSelection?: 'single' | 'multiple';
|
|
277
337
|
readonly cellSelection?: boolean;
|
|
278
338
|
}) => {
|
|
279
339
|
id: string;
|
|
@@ -288,11 +348,11 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
288
348
|
editorFor: (column: keyof Specs & string) => Option.Option<CellEditor>;
|
|
289
349
|
MenuItem: import("foldkit/schema").TaggedUnion<{
|
|
290
350
|
readonly Pin: {
|
|
291
|
-
|
|
351
|
+
region: Schema.Literals<readonly ["start", "center", "end"]>;
|
|
292
352
|
};
|
|
293
353
|
readonly Hide: {};
|
|
294
354
|
readonly Show: {
|
|
295
|
-
|
|
355
|
+
column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
296
356
|
};
|
|
297
357
|
}>;
|
|
298
358
|
menuItems: (state: {
|
|
@@ -305,16 +365,16 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
305
365
|
readonly width: number;
|
|
306
366
|
}[];
|
|
307
367
|
}, column: keyof Specs & string) => ReadonlyArray<{
|
|
308
|
-
readonly _tag: "Pin";
|
|
309
|
-
readonly region: "start" | "center" | "end";
|
|
310
|
-
} | {
|
|
311
368
|
readonly _tag: "Hide";
|
|
369
|
+
} | {
|
|
370
|
+
readonly _tag: "Pin";
|
|
371
|
+
readonly region: "center" | "end" | "start";
|
|
312
372
|
} | {
|
|
313
373
|
readonly _tag: "Show";
|
|
314
374
|
readonly column: keyof Specs & string;
|
|
315
375
|
}>;
|
|
316
376
|
columns: Columns<Row, Specs>;
|
|
317
|
-
rowSelection: "
|
|
377
|
+
rowSelection: "multiple" | "single" | undefined;
|
|
318
378
|
cellSelection: boolean;
|
|
319
379
|
focus: {
|
|
320
380
|
Address: Schema.Struct<{
|
|
@@ -345,6 +405,12 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
345
405
|
readonly column: keyof Specs & string;
|
|
346
406
|
}>;
|
|
347
407
|
readonly header: Option.Option<keyof Specs & string>;
|
|
408
|
+
} | {
|
|
409
|
+
readonly current: Option.Option<{
|
|
410
|
+
readonly row: string;
|
|
411
|
+
readonly column: keyof Specs & string;
|
|
412
|
+
}>;
|
|
413
|
+
readonly header: Option.Option<keyof Specs & string>;
|
|
348
414
|
}, {
|
|
349
415
|
readonly _tag: "Focused";
|
|
350
416
|
readonly address: {
|
|
@@ -455,22 +521,22 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
455
521
|
}) => string;
|
|
456
522
|
Out: import("foldkit/schema").TaggedUnion<{
|
|
457
523
|
readonly Edited: {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
524
|
+
row: Schema.String;
|
|
525
|
+
column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
526
|
+
text: Schema.String;
|
|
461
527
|
};
|
|
462
528
|
/** The cells their columns accepted, and those they refused, with why. */
|
|
463
529
|
readonly Pasted: {
|
|
464
|
-
|
|
530
|
+
accepted: Schema.$Array<Schema.Struct<{
|
|
465
531
|
readonly row: Schema.String;
|
|
466
532
|
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
467
533
|
readonly text: Schema.String;
|
|
468
534
|
}>>;
|
|
469
|
-
|
|
470
|
-
readonly error: Schema.String;
|
|
535
|
+
refused: Schema.$Array<Schema.Struct<{
|
|
471
536
|
readonly row: Schema.String;
|
|
472
537
|
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
473
538
|
readonly text: Schema.String;
|
|
539
|
+
readonly error: Schema.String;
|
|
474
540
|
}>>;
|
|
475
541
|
};
|
|
476
542
|
readonly UndoRequested: {};
|
|
@@ -561,10 +627,10 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
561
627
|
readonly selection: Schema.Struct<{
|
|
562
628
|
readonly rows: import("foldkit/schema").TaggedUnion<{
|
|
563
629
|
readonly Keys: {
|
|
564
|
-
|
|
630
|
+
keys: Schema.$Array<Schema.String>;
|
|
565
631
|
};
|
|
566
632
|
readonly AllExcept: {
|
|
567
|
-
|
|
633
|
+
except: Schema.$Array<Schema.String>;
|
|
568
634
|
};
|
|
569
635
|
}>;
|
|
570
636
|
/** Where the last plain row selection happened; a Shift range extends from it. */
|
|
@@ -598,7 +664,7 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
598
664
|
Message: import("foldkit/message").MessageUnion<{
|
|
599
665
|
/** The pointer or the browser focused a cell. */
|
|
600
666
|
readonly Focused: {
|
|
601
|
-
|
|
667
|
+
address: Schema.Struct<{
|
|
602
668
|
readonly row: Schema.String;
|
|
603
669
|
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
604
670
|
}>;
|
|
@@ -609,29 +675,29 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
609
675
|
* the cell is shown.
|
|
610
676
|
*/
|
|
611
677
|
readonly Moved: {
|
|
612
|
-
|
|
678
|
+
address: Schema.Struct<{
|
|
613
679
|
readonly row: Schema.String;
|
|
614
680
|
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
615
681
|
}>;
|
|
616
|
-
|
|
682
|
+
reveal: Schema.OptionFromNullOr<Schema.Struct<{
|
|
617
683
|
readonly top: Schema.Number;
|
|
618
684
|
readonly left: Schema.Number;
|
|
619
685
|
}>>;
|
|
620
686
|
};
|
|
621
687
|
/** A key moved focus up to a column's header, revealing it when scrolled away. */
|
|
622
688
|
readonly HeaderFocused: {
|
|
623
|
-
|
|
624
|
-
|
|
689
|
+
column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
690
|
+
reveal: Schema.OptionFromNullOr<Schema.Struct<{
|
|
625
691
|
readonly top: Schema.Number;
|
|
626
692
|
readonly left: Schema.Number;
|
|
627
693
|
}>>;
|
|
628
694
|
};
|
|
629
695
|
/** The scroll container moved or changed size: `GridViewport.Measure` reports it. */
|
|
630
696
|
readonly Measured: {
|
|
631
|
-
readonly width: Schema.Number;
|
|
632
|
-
readonly height: Schema.Number;
|
|
633
697
|
readonly top: Schema.Number;
|
|
634
698
|
readonly left: Schema.Number;
|
|
699
|
+
readonly width: Schema.Number;
|
|
700
|
+
readonly height: Schema.Number;
|
|
635
701
|
};
|
|
636
702
|
/** The reveal a `Moved` asked for has scrolled the container. */
|
|
637
703
|
readonly Revealed: {
|
|
@@ -640,35 +706,35 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
640
706
|
};
|
|
641
707
|
/** A column was resized; the width is clamped to its limits. */
|
|
642
708
|
readonly ColumnResized: {
|
|
643
|
-
|
|
644
|
-
|
|
709
|
+
column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
710
|
+
width: Schema.Number;
|
|
645
711
|
};
|
|
646
712
|
readonly ColumnHidden: {
|
|
647
|
-
|
|
713
|
+
column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
648
714
|
};
|
|
649
715
|
readonly ColumnShown: {
|
|
650
|
-
|
|
716
|
+
column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
651
717
|
};
|
|
652
718
|
/** A column moved to `index` in `region`: a reorder, a pin or an unpin. */
|
|
653
719
|
readonly ColumnMoved: {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
720
|
+
column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
721
|
+
region: Schema.Literals<readonly ["start", "center", "end"]>;
|
|
722
|
+
index: Schema.Number;
|
|
657
723
|
};
|
|
658
724
|
/** The pointer went down on a column's resize handle. */
|
|
659
725
|
readonly ResizeStarted: {
|
|
660
|
-
|
|
726
|
+
column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
661
727
|
};
|
|
662
728
|
/**
|
|
663
729
|
* The pointer moved `delta` pixels toward the column's end edge since the
|
|
664
730
|
* resize began: positive widens it, in either direction of text.
|
|
665
731
|
*/
|
|
666
732
|
readonly ResizeMoved: {
|
|
667
|
-
|
|
733
|
+
delta: Schema.Number;
|
|
668
734
|
};
|
|
669
735
|
/** The pointer let go, or the drag was cancelled and the width goes back. */
|
|
670
736
|
readonly ResizeEnded: {
|
|
671
|
-
|
|
737
|
+
completed: Schema.Boolean;
|
|
672
738
|
};
|
|
673
739
|
/**
|
|
674
740
|
* The pointer began dragging the column header whose DOM id is `header`
|
|
@@ -676,46 +742,46 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
676
742
|
* a shown column of this grid changes nothing.
|
|
677
743
|
*/
|
|
678
744
|
readonly ColumnDragStarted: {
|
|
679
|
-
|
|
745
|
+
header: Schema.String;
|
|
680
746
|
};
|
|
681
747
|
/** The pointer is `delta` pixels toward the region's end from where the drag began. */
|
|
682
748
|
readonly ColumnDragged: {
|
|
683
|
-
|
|
749
|
+
delta: Schema.Number;
|
|
684
750
|
};
|
|
685
751
|
/**
|
|
686
752
|
* The pointer let go and the column moves where it was dropped
|
|
687
753
|
* (`ColumnState.dropAt`), or the drag was cancelled and nothing moves.
|
|
688
754
|
*/
|
|
689
755
|
readonly ColumnDragEnded: {
|
|
690
|
-
|
|
756
|
+
completed: Schema.Boolean;
|
|
691
757
|
};
|
|
692
758
|
/**
|
|
693
759
|
* A column's menu opened, from its button or a key on its header; focus
|
|
694
760
|
* goes to the header, so closing the menu returns there.
|
|
695
761
|
*/
|
|
696
762
|
readonly MenuOpened: {
|
|
697
|
-
|
|
763
|
+
column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
698
764
|
};
|
|
699
765
|
/** The keyboard moved to item `active` of the open menu. */
|
|
700
766
|
readonly MenuMoved: {
|
|
701
|
-
|
|
767
|
+
active: Schema.Number;
|
|
702
768
|
};
|
|
703
769
|
/**
|
|
704
770
|
* Item `index` of the open menu was chosen. It is read from the menu as
|
|
705
771
|
* it stands now, and the menu closes.
|
|
706
772
|
*/
|
|
707
773
|
readonly MenuChosen: {
|
|
708
|
-
|
|
774
|
+
index: Schema.Number;
|
|
709
775
|
};
|
|
710
776
|
readonly MenuClosed: {};
|
|
711
777
|
/** A row was chosen: in single mode it is the selection, in multiple it toggles. */
|
|
712
778
|
readonly RowSelected: {
|
|
713
|
-
|
|
779
|
+
row: Schema.String;
|
|
714
780
|
};
|
|
715
781
|
/** A Shift range of rows, worked out by the view from the projection it drew. */
|
|
716
782
|
readonly RowsExtended: {
|
|
717
|
-
|
|
718
|
-
|
|
783
|
+
rows: Schema.$Array<Schema.String>;
|
|
784
|
+
to: Schema.String;
|
|
719
785
|
};
|
|
720
786
|
readonly AllRowsSelected: {};
|
|
721
787
|
readonly RowsCleared: {};
|
|
@@ -724,15 +790,15 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
724
790
|
* corner into view, as `Moved`'s does for a focused cell.
|
|
725
791
|
*/
|
|
726
792
|
readonly CellsSelected: {
|
|
727
|
-
|
|
793
|
+
anchor: Schema.Struct<{
|
|
728
794
|
readonly row: Schema.String;
|
|
729
795
|
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
730
796
|
}>;
|
|
731
|
-
|
|
797
|
+
focus: Schema.Struct<{
|
|
732
798
|
readonly row: Schema.String;
|
|
733
799
|
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
734
800
|
}>;
|
|
735
|
-
|
|
801
|
+
reveal: Schema.OptionFromNullOr<Schema.Struct<{
|
|
736
802
|
readonly top: Schema.Number;
|
|
737
803
|
readonly left: Schema.Number;
|
|
738
804
|
}>>;
|
|
@@ -744,18 +810,18 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
744
810
|
* from the page, so one that is not this grid's cell changes nothing.
|
|
745
811
|
*/
|
|
746
812
|
readonly CellPressed: {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
813
|
+
cell: Schema.String;
|
|
814
|
+
shiftKey: Schema.Boolean;
|
|
815
|
+
toggleKey: Schema.Boolean;
|
|
750
816
|
};
|
|
751
817
|
readonly CellsCleared: {};
|
|
752
818
|
/** An edit began on an editable cell, with the text it starts from. */
|
|
753
819
|
readonly EditStarted: {
|
|
754
|
-
|
|
820
|
+
address: Schema.Struct<{
|
|
755
821
|
readonly row: Schema.String;
|
|
756
822
|
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
757
823
|
}>;
|
|
758
|
-
|
|
824
|
+
draft: Schema.String;
|
|
759
825
|
};
|
|
760
826
|
/**
|
|
761
827
|
* A key typed on the grid itself, over an editable cell: it starts an
|
|
@@ -766,15 +832,15 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
766
832
|
* showed, which a new edit began from.
|
|
767
833
|
*/
|
|
768
834
|
readonly EditTyped: {
|
|
769
|
-
|
|
835
|
+
address: Schema.Struct<{
|
|
770
836
|
readonly row: Schema.String;
|
|
771
837
|
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
772
838
|
}>;
|
|
773
|
-
|
|
774
|
-
|
|
839
|
+
text: Schema.String;
|
|
840
|
+
from: Schema.String;
|
|
775
841
|
};
|
|
776
842
|
readonly EditChanged: {
|
|
777
|
-
|
|
843
|
+
draft: Schema.String;
|
|
778
844
|
};
|
|
779
845
|
/**
|
|
780
846
|
* A choice's draft moved through its column's options: the next or
|
|
@@ -783,11 +849,11 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
783
849
|
* the draft as it is. On a column that is no choice it changes nothing.
|
|
784
850
|
*/
|
|
785
851
|
readonly EditStepped: {
|
|
786
|
-
|
|
852
|
+
by: Schema.Literals<readonly ["next", "previous", "first", "last", "pageNext", "pagePrevious"]>;
|
|
787
853
|
};
|
|
788
854
|
/** A pointer chose one of a choice's options: it is the draft, committed in place. */
|
|
789
855
|
readonly EditChosen: {
|
|
790
|
-
|
|
856
|
+
draft: Schema.String;
|
|
791
857
|
};
|
|
792
858
|
/**
|
|
793
859
|
* The draft is to be kept. When the column accepts it the edit ends, focus
|
|
@@ -797,11 +863,11 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
797
863
|
* stays with the error.
|
|
798
864
|
*/
|
|
799
865
|
readonly EditCommitted: {
|
|
800
|
-
|
|
866
|
+
next: Schema.OptionFromNullOr<Schema.Struct<{
|
|
801
867
|
readonly row: Schema.String;
|
|
802
868
|
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
803
869
|
}>>;
|
|
804
|
-
|
|
870
|
+
reveal: Schema.OptionFromNullOr<Schema.Struct<{
|
|
805
871
|
readonly top: Schema.Number;
|
|
806
872
|
readonly left: Schema.Number;
|
|
807
873
|
}>>;
|
|
@@ -814,11 +880,11 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
814
880
|
* their columns and reported as one `Pasted`, or nothing when none is left.
|
|
815
881
|
*/
|
|
816
882
|
readonly Pasted: {
|
|
817
|
-
|
|
818
|
-
readonly from: Schema.String;
|
|
883
|
+
cells: Schema.$Array<Schema.Struct<{
|
|
819
884
|
readonly row: Schema.String;
|
|
820
885
|
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
821
886
|
readonly text: Schema.String;
|
|
887
|
+
readonly from: Schema.String;
|
|
822
888
|
}>>;
|
|
823
889
|
};
|
|
824
890
|
/**
|
|
@@ -848,11 +914,11 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
848
914
|
readonly FillStarted: {};
|
|
849
915
|
/** The pointer, filling, is over the cell whose DOM id is `cell`. */
|
|
850
916
|
readonly FillDragged: {
|
|
851
|
-
|
|
917
|
+
cell: Schema.String;
|
|
852
918
|
};
|
|
853
919
|
/** The fill handle was let go, or the drag cancelled (`completed` false). */
|
|
854
920
|
readonly FillEnded: {
|
|
855
|
-
|
|
921
|
+
completed: Schema.Boolean;
|
|
856
922
|
};
|
|
857
923
|
}>;
|
|
858
924
|
bundle: Bundle.Bundle<"DataGrid", void, {
|
|
@@ -909,11 +975,11 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
909
975
|
}>;
|
|
910
976
|
readonly selection: {
|
|
911
977
|
readonly rows: {
|
|
912
|
-
readonly _tag: "Keys";
|
|
913
|
-
readonly keys: readonly string[];
|
|
914
|
-
} | {
|
|
915
978
|
readonly _tag: "AllExcept";
|
|
916
979
|
readonly except: readonly string[];
|
|
980
|
+
} | {
|
|
981
|
+
readonly _tag: "Keys";
|
|
982
|
+
readonly keys: readonly string[];
|
|
917
983
|
};
|
|
918
984
|
readonly anchor: Option.Option<string>;
|
|
919
985
|
readonly cells: Option.Option<{
|
|
@@ -937,43 +1003,21 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
937
1003
|
readonly error: Option.Option<string>;
|
|
938
1004
|
}>;
|
|
939
1005
|
}, {
|
|
940
|
-
readonly _tag: "
|
|
941
|
-
readonly address: {
|
|
942
|
-
readonly row: string;
|
|
943
|
-
readonly column: keyof Specs & string;
|
|
944
|
-
};
|
|
945
|
-
} | {
|
|
946
|
-
readonly _tag: "HeaderFocused";
|
|
947
|
-
readonly column: keyof Specs & string;
|
|
948
|
-
readonly reveal: Option.Option<{
|
|
949
|
-
readonly top: number;
|
|
950
|
-
readonly left: number;
|
|
951
|
-
}>;
|
|
1006
|
+
readonly _tag: "AllRowsSelected";
|
|
952
1007
|
} | {
|
|
953
|
-
readonly _tag: "
|
|
954
|
-
readonly
|
|
955
|
-
readonly
|
|
956
|
-
readonly
|
|
957
|
-
readonly left: number;
|
|
1008
|
+
readonly _tag: "CellPressed";
|
|
1009
|
+
readonly cell: string;
|
|
1010
|
+
readonly shiftKey: boolean;
|
|
1011
|
+
readonly toggleKey: boolean;
|
|
958
1012
|
} | {
|
|
959
|
-
readonly _tag: "
|
|
960
|
-
readonly top: number;
|
|
961
|
-
readonly left: number;
|
|
1013
|
+
readonly _tag: "CellsCleared";
|
|
962
1014
|
} | {
|
|
963
|
-
readonly _tag: "
|
|
964
|
-
readonly
|
|
965
|
-
readonly from: string;
|
|
1015
|
+
readonly _tag: "CellsSelected";
|
|
1016
|
+
readonly anchor: {
|
|
966
1017
|
readonly row: string;
|
|
967
1018
|
readonly column: keyof Specs & string;
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
} | {
|
|
971
|
-
readonly _tag: "UndoRequested";
|
|
972
|
-
} | {
|
|
973
|
-
readonly _tag: "RedoRequested";
|
|
974
|
-
} | {
|
|
975
|
-
readonly _tag: "Moved";
|
|
976
|
-
readonly address: {
|
|
1019
|
+
};
|
|
1020
|
+
readonly focus: {
|
|
977
1021
|
readonly row: string;
|
|
978
1022
|
readonly column: keyof Specs & string;
|
|
979
1023
|
};
|
|
@@ -982,28 +1026,7 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
982
1026
|
readonly left: number;
|
|
983
1027
|
}>;
|
|
984
1028
|
} | {
|
|
985
|
-
readonly _tag: "
|
|
986
|
-
readonly column: keyof Specs & string;
|
|
987
|
-
readonly width: number;
|
|
988
|
-
} | {
|
|
989
|
-
readonly _tag: "ColumnHidden";
|
|
990
|
-
readonly column: keyof Specs & string;
|
|
991
|
-
} | {
|
|
992
|
-
readonly _tag: "ColumnShown";
|
|
993
|
-
readonly column: keyof Specs & string;
|
|
994
|
-
} | {
|
|
995
|
-
readonly _tag: "ColumnMoved";
|
|
996
|
-
readonly column: keyof Specs & string;
|
|
997
|
-
readonly region: "start" | "center" | "end";
|
|
998
|
-
readonly index: number;
|
|
999
|
-
} | {
|
|
1000
|
-
readonly _tag: "ResizeStarted";
|
|
1001
|
-
readonly column: keyof Specs & string;
|
|
1002
|
-
} | {
|
|
1003
|
-
readonly _tag: "ResizeMoved";
|
|
1004
|
-
readonly delta: number;
|
|
1005
|
-
} | {
|
|
1006
|
-
readonly _tag: "ResizeEnded";
|
|
1029
|
+
readonly _tag: "ColumnDragEnded";
|
|
1007
1030
|
readonly completed: boolean;
|
|
1008
1031
|
} | {
|
|
1009
1032
|
readonly _tag: "ColumnDragStarted";
|
|
@@ -1012,51 +1035,38 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
1012
1035
|
readonly _tag: "ColumnDragged";
|
|
1013
1036
|
readonly delta: number;
|
|
1014
1037
|
} | {
|
|
1015
|
-
readonly _tag: "
|
|
1016
|
-
readonly completed: boolean;
|
|
1017
|
-
} | {
|
|
1018
|
-
readonly _tag: "MenuOpened";
|
|
1038
|
+
readonly _tag: "ColumnHidden";
|
|
1019
1039
|
readonly column: keyof Specs & string;
|
|
1020
1040
|
} | {
|
|
1021
|
-
readonly _tag: "
|
|
1022
|
-
readonly
|
|
1023
|
-
|
|
1024
|
-
readonly _tag: "MenuChosen";
|
|
1041
|
+
readonly _tag: "ColumnMoved";
|
|
1042
|
+
readonly column: keyof Specs & string;
|
|
1043
|
+
readonly region: "center" | "end" | "start";
|
|
1025
1044
|
readonly index: number;
|
|
1026
1045
|
} | {
|
|
1027
|
-
readonly _tag: "
|
|
1046
|
+
readonly _tag: "ColumnResized";
|
|
1047
|
+
readonly column: keyof Specs & string;
|
|
1048
|
+
readonly width: number;
|
|
1028
1049
|
} | {
|
|
1029
|
-
readonly _tag: "
|
|
1030
|
-
readonly
|
|
1050
|
+
readonly _tag: "ColumnShown";
|
|
1051
|
+
readonly column: keyof Specs & string;
|
|
1031
1052
|
} | {
|
|
1032
|
-
readonly _tag: "
|
|
1033
|
-
readonly rows: readonly string[];
|
|
1034
|
-
readonly to: string;
|
|
1053
|
+
readonly _tag: "EditCancelled";
|
|
1035
1054
|
} | {
|
|
1036
|
-
readonly _tag: "
|
|
1055
|
+
readonly _tag: "EditChanged";
|
|
1056
|
+
readonly draft: string;
|
|
1037
1057
|
} | {
|
|
1038
|
-
readonly _tag: "
|
|
1058
|
+
readonly _tag: "EditChosen";
|
|
1059
|
+
readonly draft: string;
|
|
1039
1060
|
} | {
|
|
1040
|
-
readonly _tag: "
|
|
1041
|
-
readonly
|
|
1042
|
-
readonly row: string;
|
|
1043
|
-
readonly column: keyof Specs & string;
|
|
1044
|
-
};
|
|
1045
|
-
readonly focus: {
|
|
1061
|
+
readonly _tag: "EditCommitted";
|
|
1062
|
+
readonly next: Option.Option<{
|
|
1046
1063
|
readonly row: string;
|
|
1047
1064
|
readonly column: keyof Specs & string;
|
|
1048
|
-
}
|
|
1065
|
+
}>;
|
|
1049
1066
|
readonly reveal: Option.Option<{
|
|
1050
1067
|
readonly top: number;
|
|
1051
1068
|
readonly left: number;
|
|
1052
1069
|
}>;
|
|
1053
|
-
} | {
|
|
1054
|
-
readonly _tag: "CellPressed";
|
|
1055
|
-
readonly cell: string;
|
|
1056
|
-
readonly shiftKey: boolean;
|
|
1057
|
-
readonly toggleKey: boolean;
|
|
1058
|
-
} | {
|
|
1059
|
-
readonly _tag: "CellsCleared";
|
|
1060
1070
|
} | {
|
|
1061
1071
|
readonly _tag: "EditStarted";
|
|
1062
1072
|
readonly address: {
|
|
@@ -1064,6 +1074,9 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
1064
1074
|
readonly column: keyof Specs & string;
|
|
1065
1075
|
};
|
|
1066
1076
|
readonly draft: string;
|
|
1077
|
+
} | {
|
|
1078
|
+
readonly _tag: "EditStepped";
|
|
1079
|
+
readonly by: "first" | "last" | "next" | "pageNext" | "pagePrevious" | "previous";
|
|
1067
1080
|
} | {
|
|
1068
1081
|
readonly _tag: "EditTyped";
|
|
1069
1082
|
readonly address: {
|
|
@@ -1072,29 +1085,6 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
1072
1085
|
};
|
|
1073
1086
|
readonly text: string;
|
|
1074
1087
|
readonly from: string;
|
|
1075
|
-
} | {
|
|
1076
|
-
readonly _tag: "EditChanged";
|
|
1077
|
-
readonly draft: string;
|
|
1078
|
-
} | {
|
|
1079
|
-
readonly _tag: "EditStepped";
|
|
1080
|
-
readonly by: "next" | "previous" | "first" | "last" | "pageNext" | "pagePrevious";
|
|
1081
|
-
} | {
|
|
1082
|
-
readonly _tag: "EditChosen";
|
|
1083
|
-
readonly draft: string;
|
|
1084
|
-
} | {
|
|
1085
|
-
readonly _tag: "EditCommitted";
|
|
1086
|
-
readonly next: Option.Option<{
|
|
1087
|
-
readonly row: string;
|
|
1088
|
-
readonly column: keyof Specs & string;
|
|
1089
|
-
}>;
|
|
1090
|
-
readonly reveal: Option.Option<{
|
|
1091
|
-
readonly top: number;
|
|
1092
|
-
readonly left: number;
|
|
1093
|
-
}>;
|
|
1094
|
-
} | {
|
|
1095
|
-
readonly _tag: "EditCancelled";
|
|
1096
|
-
} | {
|
|
1097
|
-
readonly _tag: "FillStarted";
|
|
1098
1088
|
} | {
|
|
1099
1089
|
readonly _tag: "FillDragged";
|
|
1100
1090
|
readonly cell: string;
|
|
@@ -1117,815 +1107,94 @@ declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>
|
|
|
1117
1107
|
readonly row: string;
|
|
1118
1108
|
readonly column: keyof Specs & string;
|
|
1119
1109
|
};
|
|
1120
|
-
}, {
|
|
1121
|
-
readonly _tag: "UndoRequested";
|
|
1122
|
-
} | {
|
|
1123
|
-
readonly _tag: "RedoRequested";
|
|
1124
1110
|
} | {
|
|
1125
|
-
readonly _tag: "
|
|
1126
|
-
readonly row: string;
|
|
1127
|
-
readonly column: keyof Specs & string;
|
|
1128
|
-
readonly text: string;
|
|
1111
|
+
readonly _tag: "FillStarted";
|
|
1129
1112
|
} | {
|
|
1130
|
-
readonly _tag: "
|
|
1131
|
-
readonly
|
|
1132
|
-
readonly row: string;
|
|
1133
|
-
readonly column: keyof Specs & string;
|
|
1134
|
-
readonly text: string;
|
|
1135
|
-
}[];
|
|
1136
|
-
readonly refused: readonly {
|
|
1137
|
-
readonly error: string;
|
|
1113
|
+
readonly _tag: "Focused";
|
|
1114
|
+
readonly address: {
|
|
1138
1115
|
readonly row: string;
|
|
1139
1116
|
readonly column: keyof Specs & string;
|
|
1140
|
-
|
|
1141
|
-
}[];
|
|
1117
|
+
};
|
|
1142
1118
|
} | {
|
|
1143
|
-
readonly _tag: "
|
|
1144
|
-
readonly
|
|
1145
|
-
|
|
1146
|
-
readonly row: string;
|
|
1147
|
-
readonly column: keyof Specs & string;
|
|
1148
|
-
};
|
|
1149
|
-
readonly focus: {
|
|
1150
|
-
readonly row: string;
|
|
1151
|
-
readonly column: keyof Specs & string;
|
|
1152
|
-
};
|
|
1153
|
-
};
|
|
1154
|
-
readonly to: {
|
|
1155
|
-
readonly row: string;
|
|
1156
|
-
readonly column: keyof Specs & string;
|
|
1157
|
-
};
|
|
1158
|
-
}, never, never, void, {}, {}>;
|
|
1159
|
-
};
|
|
1160
|
-
export declare const DataGrid: {
|
|
1161
|
-
make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>>(options: {
|
|
1162
|
-
readonly id: string;
|
|
1163
|
-
readonly columns: Columns<Row, Specs>;
|
|
1164
|
-
readonly rowSelection?: "single" | "multiple";
|
|
1165
|
-
readonly cellSelection?: boolean;
|
|
1166
|
-
}) => {
|
|
1167
|
-
id: string;
|
|
1168
|
-
matchEdit: <const Handlers extends { readonly [K in EditableId<Specs>]: (edited: {
|
|
1169
|
-
readonly row: string;
|
|
1170
|
-
readonly value: EditValue<Specs[K]>;
|
|
1171
|
-
}) => unknown; }>(cell: {
|
|
1172
|
-
readonly row: string;
|
|
1173
|
-
readonly column: keyof Specs & string;
|
|
1174
|
-
readonly text: string;
|
|
1175
|
-
}, handlers: Handlers & { readonly [K in Exclude<keyof Handlers, EditableId<Specs>>]: never; }) => ReturnType<Handlers[EditableId<Specs>]>;
|
|
1176
|
-
editorFor: (column: keyof Specs & string) => Option.Option<CellEditor>;
|
|
1177
|
-
MenuItem: import("foldkit/schema").TaggedUnion<{
|
|
1178
|
-
readonly Pin: {
|
|
1179
|
-
readonly region: Schema.Literals<readonly ["start", "center", "end"]>;
|
|
1180
|
-
};
|
|
1181
|
-
readonly Hide: {};
|
|
1182
|
-
readonly Show: {
|
|
1183
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1184
|
-
};
|
|
1185
|
-
}>;
|
|
1186
|
-
menuItems: (state: {
|
|
1187
|
-
readonly start: readonly (keyof Specs & string)[];
|
|
1188
|
-
readonly center: readonly (keyof Specs & string)[];
|
|
1189
|
-
readonly end: readonly (keyof Specs & string)[];
|
|
1190
|
-
readonly hidden: readonly (keyof Specs & string)[];
|
|
1191
|
-
readonly widths: readonly {
|
|
1192
|
-
readonly column: keyof Specs & string;
|
|
1193
|
-
readonly width: number;
|
|
1194
|
-
}[];
|
|
1195
|
-
}, column: keyof Specs & string) => ReadonlyArray<{
|
|
1196
|
-
readonly _tag: "Pin";
|
|
1197
|
-
readonly region: "start" | "center" | "end";
|
|
1198
|
-
} | {
|
|
1199
|
-
readonly _tag: "Hide";
|
|
1200
|
-
} | {
|
|
1201
|
-
readonly _tag: "Show";
|
|
1202
|
-
readonly column: keyof Specs & string;
|
|
1203
|
-
}>;
|
|
1204
|
-
columns: Columns<Row, Specs>;
|
|
1205
|
-
rowSelection: "single" | "multiple" | undefined;
|
|
1206
|
-
cellSelection: boolean;
|
|
1207
|
-
focus: {
|
|
1208
|
-
Address: Schema.Struct<{
|
|
1209
|
-
readonly row: Schema.String;
|
|
1210
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1211
|
-
}>;
|
|
1212
|
-
Model: Schema.Struct<{
|
|
1213
|
-
readonly current: Schema.OptionFromNullOr<Schema.Struct<{
|
|
1214
|
-
readonly row: Schema.String;
|
|
1215
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1216
|
-
}>>;
|
|
1217
|
-
readonly header: Schema.OptionFromNullOr<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
1218
|
-
}>;
|
|
1219
|
-
Message: import("foldkit/message").MessageUnion<{
|
|
1220
|
-
readonly Focused: {
|
|
1221
|
-
readonly address: Schema.Struct<{
|
|
1222
|
-
readonly row: Schema.String;
|
|
1223
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1224
|
-
}>;
|
|
1225
|
-
};
|
|
1226
|
-
readonly HeaderFocused: {
|
|
1227
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1228
|
-
};
|
|
1229
|
-
}>;
|
|
1230
|
-
bundle: Bundle.Bundle<"GridFocus", void, {
|
|
1231
|
-
readonly current: Option.Option<{
|
|
1232
|
-
readonly row: string;
|
|
1233
|
-
readonly column: keyof Specs & string;
|
|
1234
|
-
}>;
|
|
1235
|
-
readonly header: Option.Option<keyof Specs & string>;
|
|
1236
|
-
}, {
|
|
1237
|
-
readonly _tag: "Focused";
|
|
1238
|
-
readonly address: {
|
|
1239
|
-
readonly row: string;
|
|
1240
|
-
readonly column: keyof Specs & string;
|
|
1241
|
-
};
|
|
1242
|
-
} | {
|
|
1243
|
-
readonly _tag: "HeaderFocused";
|
|
1244
|
-
readonly column: keyof Specs & string;
|
|
1245
|
-
}, never, never, never, void, {}, {}>;
|
|
1246
|
-
};
|
|
1247
|
-
columnState: {
|
|
1248
|
-
Model: Schema.Struct<{
|
|
1249
|
-
readonly start: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
1250
|
-
readonly center: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
1251
|
-
readonly end: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
1252
|
-
readonly hidden: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
1253
|
-
readonly widths: Schema.$Array<Schema.Struct<{
|
|
1254
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1255
|
-
readonly width: Schema.Number;
|
|
1256
|
-
}>>;
|
|
1257
|
-
}>;
|
|
1258
|
-
initial: () => ColumnState<keyof Specs & string>;
|
|
1259
|
-
widthOf: (state: ColumnState<keyof Specs & string>) => (id: keyof Specs & string) => number;
|
|
1260
|
-
regionOf: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => Region;
|
|
1261
|
-
resize: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, width: number) => ColumnState<keyof Specs & string>;
|
|
1262
|
-
hide: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => ColumnState<keyof Specs & string>;
|
|
1263
|
-
show: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string) => ColumnState<keyof Specs & string>;
|
|
1264
|
-
move: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, region: Region, index: number) => ColumnState<keyof Specs & string>;
|
|
1265
|
-
dropAt: (state: ColumnState<keyof Specs & string>, id: keyof Specs & string, delta: number) => number;
|
|
1266
|
-
restore: (saved: unknown) => Restored<keyof Specs & string>;
|
|
1267
|
-
};
|
|
1268
|
-
project: (rows: RowModel<Row>, state: {
|
|
1269
|
-
readonly start: readonly (keyof Specs & string)[];
|
|
1270
|
-
readonly center: readonly (keyof Specs & string)[];
|
|
1271
|
-
readonly end: readonly (keyof Specs & string)[];
|
|
1272
|
-
readonly hidden: readonly (keyof Specs & string)[];
|
|
1273
|
-
readonly widths: readonly {
|
|
1274
|
-
readonly column: keyof Specs & string;
|
|
1275
|
-
readonly width: number;
|
|
1276
|
-
}[];
|
|
1277
|
-
}) => GridProjection<Row, keyof Specs & string>;
|
|
1278
|
-
window: (input: {
|
|
1279
|
-
readonly rows: RowModel<Row>;
|
|
1280
|
-
readonly state: {
|
|
1281
|
-
readonly viewport: Viewport;
|
|
1282
|
-
readonly columns: {
|
|
1283
|
-
readonly start: readonly (keyof Specs & string)[];
|
|
1284
|
-
readonly center: readonly (keyof Specs & string)[];
|
|
1285
|
-
readonly end: readonly (keyof Specs & string)[];
|
|
1286
|
-
readonly hidden: readonly (keyof Specs & string)[];
|
|
1287
|
-
readonly widths: readonly {
|
|
1288
|
-
readonly column: keyof Specs & string;
|
|
1289
|
-
readonly width: number;
|
|
1290
|
-
}[];
|
|
1291
|
-
};
|
|
1292
|
-
};
|
|
1293
|
-
readonly rowHeight: number;
|
|
1294
|
-
readonly headerHeight: number;
|
|
1295
|
-
readonly overscan?: {
|
|
1296
|
-
readonly rows?: number;
|
|
1297
|
-
readonly columns?: number;
|
|
1298
|
-
};
|
|
1299
|
-
}) => GridWindow<keyof Specs & string>;
|
|
1300
|
-
fill: (rows: RowModel<Row>, state: {
|
|
1301
|
-
readonly columns: {
|
|
1302
|
-
readonly start: readonly (keyof Specs & string)[];
|
|
1303
|
-
readonly center: readonly (keyof Specs & string)[];
|
|
1304
|
-
readonly end: readonly (keyof Specs & string)[];
|
|
1305
|
-
readonly hidden: readonly (keyof Specs & string)[];
|
|
1306
|
-
readonly widths: readonly {
|
|
1307
|
-
readonly column: keyof Specs & string;
|
|
1308
|
-
readonly width: number;
|
|
1309
|
-
}[];
|
|
1310
|
-
};
|
|
1311
|
-
}, request: {
|
|
1312
|
-
readonly source: {
|
|
1313
|
-
readonly anchor: {
|
|
1314
|
-
readonly row: string;
|
|
1315
|
-
readonly column: keyof Specs & string;
|
|
1316
|
-
};
|
|
1317
|
-
readonly focus: {
|
|
1318
|
-
readonly row: string;
|
|
1319
|
-
readonly column: keyof Specs & string;
|
|
1320
|
-
};
|
|
1321
|
-
};
|
|
1322
|
-
readonly to: {
|
|
1323
|
-
readonly row: string;
|
|
1324
|
-
readonly column: keyof Specs & string;
|
|
1325
|
-
};
|
|
1326
|
-
}) => {
|
|
1327
|
-
accepted: {
|
|
1328
|
-
readonly row: string;
|
|
1329
|
-
readonly column: keyof Specs & string;
|
|
1330
|
-
readonly text: string;
|
|
1331
|
-
}[];
|
|
1332
|
-
refused: ({
|
|
1333
|
-
readonly row: string;
|
|
1334
|
-
readonly column: keyof Specs & string;
|
|
1335
|
-
readonly text: string;
|
|
1336
|
-
} & {
|
|
1337
|
-
readonly error: string;
|
|
1338
|
-
})[];
|
|
1339
|
-
};
|
|
1340
|
-
draftOf: (projection: GridProjection<Row, keyof Specs & string>, address: {
|
|
1341
|
-
readonly row: string;
|
|
1342
|
-
readonly column: keyof Specs & string;
|
|
1343
|
-
}) => string;
|
|
1344
|
-
Out: import("foldkit/schema").TaggedUnion<{
|
|
1345
|
-
readonly Edited: {
|
|
1346
|
-
readonly row: Schema.String;
|
|
1347
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1348
|
-
readonly text: Schema.String;
|
|
1349
|
-
};
|
|
1350
|
-
/** The cells their columns accepted, and those they refused, with why. */
|
|
1351
|
-
readonly Pasted: {
|
|
1352
|
-
readonly accepted: Schema.$Array<Schema.Struct<{
|
|
1353
|
-
readonly row: Schema.String;
|
|
1354
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1355
|
-
readonly text: Schema.String;
|
|
1356
|
-
}>>;
|
|
1357
|
-
readonly refused: Schema.$Array<Schema.Struct<{
|
|
1358
|
-
readonly error: Schema.String;
|
|
1359
|
-
readonly row: Schema.String;
|
|
1360
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1361
|
-
readonly text: Schema.String;
|
|
1362
|
-
}>>;
|
|
1363
|
-
};
|
|
1364
|
-
readonly UndoRequested: {};
|
|
1365
|
-
readonly RedoRequested: {};
|
|
1366
|
-
/**
|
|
1367
|
-
* A fill: carry `source` on to `to`. What it writes is worked out from the
|
|
1368
|
-
* rows by `fill`, which the application holds.
|
|
1369
|
-
*/
|
|
1370
|
-
readonly Filled: {
|
|
1371
|
-
readonly source: Schema.Struct<{
|
|
1372
|
-
readonly anchor: Schema.Struct<{
|
|
1373
|
-
readonly row: Schema.String;
|
|
1374
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1375
|
-
}>;
|
|
1376
|
-
readonly focus: Schema.Struct<{
|
|
1377
|
-
readonly row: Schema.String;
|
|
1378
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1379
|
-
}>;
|
|
1380
|
-
}>;
|
|
1381
|
-
readonly to: Schema.Struct<{
|
|
1382
|
-
readonly row: Schema.String;
|
|
1383
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1384
|
-
}>;
|
|
1385
|
-
};
|
|
1386
|
-
}>;
|
|
1387
|
-
Model: Schema.Struct<{
|
|
1388
|
-
readonly focus: Schema.Struct<{
|
|
1389
|
-
readonly current: Schema.OptionFromNullOr<Schema.Struct<{
|
|
1390
|
-
readonly row: Schema.String;
|
|
1391
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1392
|
-
}>>;
|
|
1393
|
-
readonly header: Schema.OptionFromNullOr<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
1394
|
-
}>;
|
|
1395
|
-
readonly viewport: Schema.Struct<{
|
|
1396
|
-
readonly top: Schema.Number;
|
|
1397
|
-
readonly left: Schema.Number;
|
|
1398
|
-
readonly width: Schema.Number;
|
|
1399
|
-
readonly height: Schema.Number;
|
|
1400
|
-
}>;
|
|
1401
|
-
readonly columns: Schema.Struct<{
|
|
1402
|
-
readonly start: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
1403
|
-
readonly center: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
1404
|
-
readonly end: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
1405
|
-
readonly hidden: Schema.$Array<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
1406
|
-
readonly widths: Schema.$Array<Schema.Struct<{
|
|
1407
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1408
|
-
readonly width: Schema.Number;
|
|
1409
|
-
}>>;
|
|
1410
|
-
}>;
|
|
1411
|
-
/** A column being resized by the pointer, and its width when the drag began. */
|
|
1412
|
-
readonly resizing: Schema.OptionFromNullOr<Schema.Struct<{
|
|
1413
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1414
|
-
readonly from: Schema.Number;
|
|
1415
|
-
}>>;
|
|
1416
|
-
/**
|
|
1417
|
-
* A column header being dragged by the pointer, and how far toward its
|
|
1418
|
-
* region's end. Where it lands is worked out when it is let go.
|
|
1419
|
-
*/
|
|
1420
|
-
readonly dragging: Schema.OptionFromNullOr<Schema.Struct<{
|
|
1421
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1422
|
-
readonly delta: Schema.Number;
|
|
1423
|
-
}>>;
|
|
1424
|
-
/** The column whose menu is open, and the item the keyboard is on (`menuItems`). */
|
|
1425
|
-
readonly menu: Schema.OptionFromNullOr<Schema.Struct<{
|
|
1426
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1427
|
-
readonly active: Schema.Number;
|
|
1428
|
-
}>>;
|
|
1429
|
-
/**
|
|
1430
|
-
* A fill being dragged from the range's handle: the range, and the cell
|
|
1431
|
-
* the pointer is over. What it writes is worked out when it is let go.
|
|
1432
|
-
*/
|
|
1433
|
-
readonly filling: Schema.OptionFromNullOr<Schema.Struct<{
|
|
1434
|
-
readonly source: Schema.Struct<{
|
|
1435
|
-
readonly anchor: Schema.Struct<{
|
|
1436
|
-
readonly row: Schema.String;
|
|
1437
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1438
|
-
}>;
|
|
1439
|
-
readonly focus: Schema.Struct<{
|
|
1440
|
-
readonly row: Schema.String;
|
|
1441
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1442
|
-
}>;
|
|
1443
|
-
}>;
|
|
1444
|
-
readonly to: Schema.Struct<{
|
|
1445
|
-
readonly row: Schema.String;
|
|
1446
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1447
|
-
}>;
|
|
1448
|
-
}>>;
|
|
1449
|
-
readonly selection: Schema.Struct<{
|
|
1450
|
-
readonly rows: import("foldkit/schema").TaggedUnion<{
|
|
1451
|
-
readonly Keys: {
|
|
1452
|
-
readonly keys: Schema.$Array<Schema.String>;
|
|
1453
|
-
};
|
|
1454
|
-
readonly AllExcept: {
|
|
1455
|
-
readonly except: Schema.$Array<Schema.String>;
|
|
1456
|
-
};
|
|
1457
|
-
}>;
|
|
1458
|
-
/** Where the last plain row selection happened; a Shift range extends from it. */
|
|
1459
|
-
readonly anchor: Schema.OptionFromNullOr<Schema.String>;
|
|
1460
|
-
/** A rectangle of cells, by its corners; a single focused cell is none. */
|
|
1461
|
-
readonly cells: Schema.OptionFromNullOr<Schema.Struct<{
|
|
1462
|
-
readonly anchor: Schema.Struct<{
|
|
1463
|
-
readonly row: Schema.String;
|
|
1464
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1465
|
-
}>;
|
|
1466
|
-
readonly focus: Schema.Struct<{
|
|
1467
|
-
readonly row: Schema.String;
|
|
1468
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1469
|
-
}>;
|
|
1470
|
-
}>>;
|
|
1471
|
-
}>;
|
|
1472
|
-
/**
|
|
1473
|
-
* The cell being edited, the text it began from, its draft, and the error
|
|
1474
|
-
* that refused it, if one did.
|
|
1475
|
-
*/
|
|
1476
|
-
readonly editing: Schema.OptionFromNullOr<Schema.Struct<{
|
|
1477
|
-
readonly address: Schema.Struct<{
|
|
1478
|
-
readonly row: Schema.String;
|
|
1479
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1480
|
-
}>;
|
|
1481
|
-
readonly from: Schema.String;
|
|
1482
|
-
readonly draft: Schema.String;
|
|
1483
|
-
readonly error: Schema.OptionFromNullOr<Schema.String>;
|
|
1484
|
-
}>>;
|
|
1485
|
-
}>;
|
|
1486
|
-
Message: import("foldkit/message").MessageUnion<{
|
|
1487
|
-
/** The pointer or the browser focused a cell. */
|
|
1488
|
-
readonly Focused: {
|
|
1489
|
-
readonly address: Schema.Struct<{
|
|
1490
|
-
readonly row: Schema.String;
|
|
1491
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1492
|
-
}>;
|
|
1493
|
-
};
|
|
1494
|
-
/**
|
|
1495
|
-
* A key moved focus. `reveal` is the scroll that brings the cell into
|
|
1496
|
-
* view, worked out by the view from the viewport it drew, or none when
|
|
1497
|
-
* the cell is shown.
|
|
1498
|
-
*/
|
|
1499
|
-
readonly Moved: {
|
|
1500
|
-
readonly address: Schema.Struct<{
|
|
1501
|
-
readonly row: Schema.String;
|
|
1502
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1503
|
-
}>;
|
|
1504
|
-
readonly reveal: Schema.OptionFromNullOr<Schema.Struct<{
|
|
1505
|
-
readonly top: Schema.Number;
|
|
1506
|
-
readonly left: Schema.Number;
|
|
1507
|
-
}>>;
|
|
1508
|
-
};
|
|
1509
|
-
/** A key moved focus up to a column's header, revealing it when scrolled away. */
|
|
1510
|
-
readonly HeaderFocused: {
|
|
1511
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1512
|
-
readonly reveal: Schema.OptionFromNullOr<Schema.Struct<{
|
|
1513
|
-
readonly top: Schema.Number;
|
|
1514
|
-
readonly left: Schema.Number;
|
|
1515
|
-
}>>;
|
|
1516
|
-
};
|
|
1517
|
-
/** The scroll container moved or changed size: `GridViewport.Measure` reports it. */
|
|
1518
|
-
readonly Measured: {
|
|
1519
|
-
readonly width: Schema.Number;
|
|
1520
|
-
readonly height: Schema.Number;
|
|
1521
|
-
readonly top: Schema.Number;
|
|
1522
|
-
readonly left: Schema.Number;
|
|
1523
|
-
};
|
|
1524
|
-
/** The reveal a `Moved` asked for has scrolled the container. */
|
|
1525
|
-
readonly Revealed: {
|
|
1526
|
-
readonly top: Schema.Number;
|
|
1527
|
-
readonly left: Schema.Number;
|
|
1528
|
-
};
|
|
1529
|
-
/** A column was resized; the width is clamped to its limits. */
|
|
1530
|
-
readonly ColumnResized: {
|
|
1531
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1532
|
-
readonly width: Schema.Number;
|
|
1533
|
-
};
|
|
1534
|
-
readonly ColumnHidden: {
|
|
1535
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1536
|
-
};
|
|
1537
|
-
readonly ColumnShown: {
|
|
1538
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1539
|
-
};
|
|
1540
|
-
/** A column moved to `index` in `region`: a reorder, a pin or an unpin. */
|
|
1541
|
-
readonly ColumnMoved: {
|
|
1542
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1543
|
-
readonly region: Schema.Literals<readonly ["start", "center", "end"]>;
|
|
1544
|
-
readonly index: Schema.Number;
|
|
1545
|
-
};
|
|
1546
|
-
/** The pointer went down on a column's resize handle. */
|
|
1547
|
-
readonly ResizeStarted: {
|
|
1548
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1549
|
-
};
|
|
1550
|
-
/**
|
|
1551
|
-
* The pointer moved `delta` pixels toward the column's end edge since the
|
|
1552
|
-
* resize began: positive widens it, in either direction of text.
|
|
1553
|
-
*/
|
|
1554
|
-
readonly ResizeMoved: {
|
|
1555
|
-
readonly delta: Schema.Number;
|
|
1556
|
-
};
|
|
1557
|
-
/** The pointer let go, or the drag was cancelled and the width goes back. */
|
|
1558
|
-
readonly ResizeEnded: {
|
|
1559
|
-
readonly completed: Schema.Boolean;
|
|
1560
|
-
};
|
|
1561
|
-
/**
|
|
1562
|
-
* The pointer began dragging the column header whose DOM id is `header`
|
|
1563
|
-
* (`GridFocus.headerId`). The id comes from the page, so one that is not
|
|
1564
|
-
* a shown column of this grid changes nothing.
|
|
1565
|
-
*/
|
|
1566
|
-
readonly ColumnDragStarted: {
|
|
1567
|
-
readonly header: Schema.String;
|
|
1568
|
-
};
|
|
1569
|
-
/** The pointer is `delta` pixels toward the region's end from where the drag began. */
|
|
1570
|
-
readonly ColumnDragged: {
|
|
1571
|
-
readonly delta: Schema.Number;
|
|
1572
|
-
};
|
|
1573
|
-
/**
|
|
1574
|
-
* The pointer let go and the column moves where it was dropped
|
|
1575
|
-
* (`ColumnState.dropAt`), or the drag was cancelled and nothing moves.
|
|
1576
|
-
*/
|
|
1577
|
-
readonly ColumnDragEnded: {
|
|
1578
|
-
readonly completed: Schema.Boolean;
|
|
1579
|
-
};
|
|
1580
|
-
/**
|
|
1581
|
-
* A column's menu opened, from its button or a key on its header; focus
|
|
1582
|
-
* goes to the header, so closing the menu returns there.
|
|
1583
|
-
*/
|
|
1584
|
-
readonly MenuOpened: {
|
|
1585
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1586
|
-
};
|
|
1587
|
-
/** The keyboard moved to item `active` of the open menu. */
|
|
1588
|
-
readonly MenuMoved: {
|
|
1589
|
-
readonly active: Schema.Number;
|
|
1590
|
-
};
|
|
1591
|
-
/**
|
|
1592
|
-
* Item `index` of the open menu was chosen. It is read from the menu as
|
|
1593
|
-
* it stands now, and the menu closes.
|
|
1594
|
-
*/
|
|
1595
|
-
readonly MenuChosen: {
|
|
1596
|
-
readonly index: Schema.Number;
|
|
1597
|
-
};
|
|
1598
|
-
readonly MenuClosed: {};
|
|
1599
|
-
/** A row was chosen: in single mode it is the selection, in multiple it toggles. */
|
|
1600
|
-
readonly RowSelected: {
|
|
1601
|
-
readonly row: Schema.String;
|
|
1602
|
-
};
|
|
1603
|
-
/** A Shift range of rows, worked out by the view from the projection it drew. */
|
|
1604
|
-
readonly RowsExtended: {
|
|
1605
|
-
readonly rows: Schema.$Array<Schema.String>;
|
|
1606
|
-
readonly to: Schema.String;
|
|
1607
|
-
};
|
|
1608
|
-
readonly AllRowsSelected: {};
|
|
1609
|
-
readonly RowsCleared: {};
|
|
1610
|
-
/**
|
|
1611
|
-
* A rectangle of cells, from Shift with a key. `reveal` scrolls its far
|
|
1612
|
-
* corner into view, as `Moved`'s does for a focused cell.
|
|
1613
|
-
*/
|
|
1614
|
-
readonly CellsSelected: {
|
|
1615
|
-
readonly anchor: Schema.Struct<{
|
|
1616
|
-
readonly row: Schema.String;
|
|
1617
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1618
|
-
}>;
|
|
1619
|
-
readonly focus: Schema.Struct<{
|
|
1620
|
-
readonly row: Schema.String;
|
|
1621
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1622
|
-
}>;
|
|
1623
|
-
readonly reveal: Schema.OptionFromNullOr<Schema.Struct<{
|
|
1624
|
-
readonly top: Schema.Number;
|
|
1625
|
-
readonly left: Schema.Number;
|
|
1626
|
-
}>>;
|
|
1627
|
-
};
|
|
1628
|
-
/**
|
|
1629
|
-
* The pointer pressed the cell whose DOM id is `cell` (`GridFocus.cellId`).
|
|
1630
|
-
* With Shift it spans a range from the focused cell, with Ctrl or Meta it
|
|
1631
|
-
* toggles the cell's row, and plainly it focuses the cell. The id comes
|
|
1632
|
-
* from the page, so one that is not this grid's cell changes nothing.
|
|
1633
|
-
*/
|
|
1634
|
-
readonly CellPressed: {
|
|
1635
|
-
readonly cell: Schema.String;
|
|
1636
|
-
readonly shiftKey: Schema.Boolean;
|
|
1637
|
-
readonly toggleKey: Schema.Boolean;
|
|
1638
|
-
};
|
|
1639
|
-
readonly CellsCleared: {};
|
|
1640
|
-
/** An edit began on an editable cell, with the text it starts from. */
|
|
1641
|
-
readonly EditStarted: {
|
|
1642
|
-
readonly address: Schema.Struct<{
|
|
1643
|
-
readonly row: Schema.String;
|
|
1644
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1645
|
-
}>;
|
|
1646
|
-
readonly draft: Schema.String;
|
|
1647
|
-
};
|
|
1648
|
-
/**
|
|
1649
|
-
* A key typed on the grid itself, over an editable cell: it starts an
|
|
1650
|
-
* edit with the text, or, when that cell's edit is already open (the
|
|
1651
|
-
* keys came faster than the editor took focus), adds to its draft.
|
|
1652
|
-
* On a choice it picks the next option starting with the key instead,
|
|
1653
|
-
* after the draft's, as a select finds one. `from` is the text the cell
|
|
1654
|
-
* showed, which a new edit began from.
|
|
1655
|
-
*/
|
|
1656
|
-
readonly EditTyped: {
|
|
1657
|
-
readonly address: Schema.Struct<{
|
|
1658
|
-
readonly row: Schema.String;
|
|
1659
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1660
|
-
}>;
|
|
1661
|
-
readonly text: Schema.String;
|
|
1662
|
-
readonly from: Schema.String;
|
|
1663
|
-
};
|
|
1664
|
-
readonly EditChanged: {
|
|
1665
|
-
readonly draft: Schema.String;
|
|
1666
|
-
};
|
|
1667
|
-
/**
|
|
1668
|
-
* A choice's draft moved through its column's options: the next or
|
|
1669
|
-
* previous, the first or last, or a page of ten either way, stopping at
|
|
1670
|
-
* the ends. The view sends the step; `update` works out the option from
|
|
1671
|
-
* the draft as it is. On a column that is no choice it changes nothing.
|
|
1672
|
-
*/
|
|
1673
|
-
readonly EditStepped: {
|
|
1674
|
-
readonly by: Schema.Literals<readonly ["next", "previous", "first", "last", "pageNext", "pagePrevious"]>;
|
|
1675
|
-
};
|
|
1676
|
-
/** A pointer chose one of a choice's options: it is the draft, committed in place. */
|
|
1677
|
-
readonly EditChosen: {
|
|
1678
|
-
readonly draft: Schema.String;
|
|
1679
|
-
};
|
|
1680
|
-
/**
|
|
1681
|
-
* The draft is to be kept. When the column accepts it the edit ends, focus
|
|
1682
|
-
* goes to `next` (the cell below, or beside, worked out by the view), and
|
|
1683
|
-
* the grid reports `Out.Edited`, unless the draft is the text the edit
|
|
1684
|
-
* began from or decodes to the same value; when it refuses it, the edit
|
|
1685
|
-
* stays with the error.
|
|
1686
|
-
*/
|
|
1687
|
-
readonly EditCommitted: {
|
|
1688
|
-
readonly next: Schema.OptionFromNullOr<Schema.Struct<{
|
|
1689
|
-
readonly row: Schema.String;
|
|
1690
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1691
|
-
}>>;
|
|
1692
|
-
readonly reveal: Schema.OptionFromNullOr<Schema.Struct<{
|
|
1693
|
-
readonly top: Schema.Number;
|
|
1694
|
-
readonly left: Schema.Number;
|
|
1695
|
-
}>>;
|
|
1696
|
-
};
|
|
1697
|
-
readonly EditCancelled: {};
|
|
1698
|
-
/**
|
|
1699
|
-
* Text pasted, or a cut's cleared cells, laid onto editable cells by the
|
|
1700
|
-
* view (`Clipboard.pasteAt`). A cell its text leaves unchanged (as an
|
|
1701
|
-
* edit judges it, against `from`) is dropped; the rest are checked against
|
|
1702
|
-
* their columns and reported as one `Pasted`, or nothing when none is left.
|
|
1703
|
-
*/
|
|
1704
|
-
readonly Pasted: {
|
|
1705
|
-
readonly cells: Schema.$Array<Schema.Struct<{
|
|
1706
|
-
readonly from: Schema.String;
|
|
1707
|
-
readonly row: Schema.String;
|
|
1708
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1709
|
-
readonly text: Schema.String;
|
|
1710
|
-
}>>;
|
|
1711
|
-
};
|
|
1712
|
-
/**
|
|
1713
|
-
* Ctrl or Meta with Z on the grid, or with Shift (or Ctrl+Y) for redo.
|
|
1714
|
-
* An open edit keeps them, since the editor's own undo is the field's.
|
|
1715
|
-
*/
|
|
1716
|
-
readonly UndoRequested: {};
|
|
1717
|
-
readonly RedoRequested: {};
|
|
1718
|
-
/** Ctrl+D or Ctrl+R over a range, worked out by the view: carry `source` on to `to`. */
|
|
1719
|
-
readonly FillRequested: {
|
|
1720
|
-
readonly source: Schema.Struct<{
|
|
1721
|
-
readonly anchor: Schema.Struct<{
|
|
1722
|
-
readonly row: Schema.String;
|
|
1723
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1724
|
-
}>;
|
|
1725
|
-
readonly focus: Schema.Struct<{
|
|
1726
|
-
readonly row: Schema.String;
|
|
1727
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1728
|
-
}>;
|
|
1729
|
-
}>;
|
|
1730
|
-
readonly to: Schema.Struct<{
|
|
1731
|
-
readonly row: Schema.String;
|
|
1732
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1733
|
-
}>;
|
|
1734
|
-
};
|
|
1735
|
-
/** The range's fill handle was pressed and moved: a fill begins from the range. */
|
|
1736
|
-
readonly FillStarted: {};
|
|
1737
|
-
/** The pointer, filling, is over the cell whose DOM id is `cell`. */
|
|
1738
|
-
readonly FillDragged: {
|
|
1739
|
-
readonly cell: Schema.String;
|
|
1740
|
-
};
|
|
1741
|
-
/** The fill handle was let go, or the drag cancelled (`completed` false). */
|
|
1742
|
-
readonly FillEnded: {
|
|
1743
|
-
readonly completed: Schema.Boolean;
|
|
1744
|
-
};
|
|
1745
|
-
}>;
|
|
1746
|
-
bundle: Bundle.Bundle<"DataGrid", void, {
|
|
1747
|
-
readonly focus: {
|
|
1748
|
-
readonly current: Option.Option<{
|
|
1749
|
-
readonly row: string;
|
|
1750
|
-
readonly column: keyof Specs & string;
|
|
1751
|
-
}>;
|
|
1752
|
-
readonly header: Option.Option<keyof Specs & string>;
|
|
1753
|
-
};
|
|
1754
|
-
readonly viewport: {
|
|
1755
|
-
readonly top: number;
|
|
1756
|
-
readonly left: number;
|
|
1757
|
-
readonly width: number;
|
|
1758
|
-
readonly height: number;
|
|
1759
|
-
};
|
|
1760
|
-
readonly columns: {
|
|
1761
|
-
readonly start: readonly (keyof Specs & string)[];
|
|
1762
|
-
readonly center: readonly (keyof Specs & string)[];
|
|
1763
|
-
readonly end: readonly (keyof Specs & string)[];
|
|
1764
|
-
readonly hidden: readonly (keyof Specs & string)[];
|
|
1765
|
-
readonly widths: readonly {
|
|
1766
|
-
readonly column: keyof Specs & string;
|
|
1767
|
-
readonly width: number;
|
|
1768
|
-
}[];
|
|
1769
|
-
};
|
|
1770
|
-
readonly resizing: Option.Option<{
|
|
1771
|
-
readonly column: keyof Specs & string;
|
|
1772
|
-
readonly from: number;
|
|
1773
|
-
}>;
|
|
1774
|
-
readonly dragging: Option.Option<{
|
|
1775
|
-
readonly column: keyof Specs & string;
|
|
1776
|
-
readonly delta: number;
|
|
1777
|
-
}>;
|
|
1778
|
-
readonly menu: Option.Option<{
|
|
1779
|
-
readonly column: keyof Specs & string;
|
|
1780
|
-
readonly active: number;
|
|
1781
|
-
}>;
|
|
1782
|
-
readonly filling: Option.Option<{
|
|
1783
|
-
readonly source: {
|
|
1784
|
-
readonly anchor: {
|
|
1785
|
-
readonly row: string;
|
|
1786
|
-
readonly column: keyof Specs & string;
|
|
1787
|
-
};
|
|
1788
|
-
readonly focus: {
|
|
1789
|
-
readonly row: string;
|
|
1790
|
-
readonly column: keyof Specs & string;
|
|
1791
|
-
};
|
|
1792
|
-
};
|
|
1793
|
-
readonly to: {
|
|
1794
|
-
readonly row: string;
|
|
1795
|
-
readonly column: keyof Specs & string;
|
|
1796
|
-
};
|
|
1797
|
-
}>;
|
|
1798
|
-
readonly selection: {
|
|
1799
|
-
readonly rows: {
|
|
1800
|
-
readonly _tag: "Keys";
|
|
1801
|
-
readonly keys: readonly string[];
|
|
1802
|
-
} | {
|
|
1803
|
-
readonly _tag: "AllExcept";
|
|
1804
|
-
readonly except: readonly string[];
|
|
1805
|
-
};
|
|
1806
|
-
readonly anchor: Option.Option<string>;
|
|
1807
|
-
readonly cells: Option.Option<{
|
|
1808
|
-
readonly anchor: {
|
|
1809
|
-
readonly row: string;
|
|
1810
|
-
readonly column: keyof Specs & string;
|
|
1811
|
-
};
|
|
1812
|
-
readonly focus: {
|
|
1813
|
-
readonly row: string;
|
|
1814
|
-
readonly column: keyof Specs & string;
|
|
1815
|
-
};
|
|
1816
|
-
}>;
|
|
1817
|
-
};
|
|
1818
|
-
readonly editing: Option.Option<{
|
|
1819
|
-
readonly address: {
|
|
1820
|
-
readonly row: string;
|
|
1821
|
-
readonly column: keyof Specs & string;
|
|
1822
|
-
};
|
|
1823
|
-
readonly from: string;
|
|
1824
|
-
readonly draft: string;
|
|
1825
|
-
readonly error: Option.Option<string>;
|
|
1826
|
-
}>;
|
|
1827
|
-
}, {
|
|
1828
|
-
readonly _tag: "Focused";
|
|
1829
|
-
readonly address: {
|
|
1830
|
-
readonly row: string;
|
|
1831
|
-
readonly column: keyof Specs & string;
|
|
1832
|
-
};
|
|
1833
|
-
} | {
|
|
1834
|
-
readonly _tag: "HeaderFocused";
|
|
1835
|
-
readonly column: keyof Specs & string;
|
|
1836
|
-
readonly reveal: Option.Option<{
|
|
1837
|
-
readonly top: number;
|
|
1838
|
-
readonly left: number;
|
|
1839
|
-
}>;
|
|
1840
|
-
} | {
|
|
1841
|
-
readonly _tag: "Measured";
|
|
1842
|
-
readonly width: number;
|
|
1843
|
-
readonly height: number;
|
|
1844
|
-
readonly top: number;
|
|
1845
|
-
readonly left: number;
|
|
1846
|
-
} | {
|
|
1847
|
-
readonly _tag: "Revealed";
|
|
1119
|
+
readonly _tag: "HeaderFocused";
|
|
1120
|
+
readonly column: keyof Specs & string;
|
|
1121
|
+
readonly reveal: Option.Option<{
|
|
1848
1122
|
readonly top: number;
|
|
1849
1123
|
readonly left: number;
|
|
1850
|
-
}
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
} | {
|
|
1873
|
-
readonly _tag: "ColumnResized";
|
|
1874
|
-
readonly column: keyof Specs & string;
|
|
1875
|
-
readonly width: number;
|
|
1876
|
-
} | {
|
|
1877
|
-
readonly _tag: "ColumnHidden";
|
|
1878
|
-
readonly column: keyof Specs & string;
|
|
1879
|
-
} | {
|
|
1880
|
-
readonly _tag: "ColumnShown";
|
|
1881
|
-
readonly column: keyof Specs & string;
|
|
1882
|
-
} | {
|
|
1883
|
-
readonly _tag: "ColumnMoved";
|
|
1884
|
-
readonly column: keyof Specs & string;
|
|
1885
|
-
readonly region: "start" | "center" | "end";
|
|
1886
|
-
readonly index: number;
|
|
1887
|
-
} | {
|
|
1888
|
-
readonly _tag: "ResizeStarted";
|
|
1889
|
-
readonly column: keyof Specs & string;
|
|
1890
|
-
} | {
|
|
1891
|
-
readonly _tag: "ResizeMoved";
|
|
1892
|
-
readonly delta: number;
|
|
1893
|
-
} | {
|
|
1894
|
-
readonly _tag: "ResizeEnded";
|
|
1895
|
-
readonly completed: boolean;
|
|
1896
|
-
} | {
|
|
1897
|
-
readonly _tag: "ColumnDragStarted";
|
|
1898
|
-
readonly header: string;
|
|
1899
|
-
} | {
|
|
1900
|
-
readonly _tag: "ColumnDragged";
|
|
1901
|
-
readonly delta: number;
|
|
1902
|
-
} | {
|
|
1903
|
-
readonly _tag: "ColumnDragEnded";
|
|
1904
|
-
readonly completed: boolean;
|
|
1905
|
-
} | {
|
|
1906
|
-
readonly _tag: "MenuOpened";
|
|
1124
|
+
}>;
|
|
1125
|
+
} | {
|
|
1126
|
+
readonly _tag: "Measured";
|
|
1127
|
+
readonly top: number;
|
|
1128
|
+
readonly left: number;
|
|
1129
|
+
readonly width: number;
|
|
1130
|
+
readonly height: number;
|
|
1131
|
+
} | {
|
|
1132
|
+
readonly _tag: "MenuChosen";
|
|
1133
|
+
readonly index: number;
|
|
1134
|
+
} | {
|
|
1135
|
+
readonly _tag: "MenuClosed";
|
|
1136
|
+
} | {
|
|
1137
|
+
readonly _tag: "MenuMoved";
|
|
1138
|
+
readonly active: number;
|
|
1139
|
+
} | {
|
|
1140
|
+
readonly _tag: "MenuOpened";
|
|
1141
|
+
readonly column: keyof Specs & string;
|
|
1142
|
+
} | {
|
|
1143
|
+
readonly _tag: "Moved";
|
|
1144
|
+
readonly address: {
|
|
1145
|
+
readonly row: string;
|
|
1907
1146
|
readonly column: keyof Specs & string;
|
|
1908
|
-
}
|
|
1909
|
-
|
|
1910
|
-
readonly
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
} | {
|
|
1917
|
-
readonly _tag: "RowSelected";
|
|
1147
|
+
};
|
|
1148
|
+
readonly reveal: Option.Option<{
|
|
1149
|
+
readonly top: number;
|
|
1150
|
+
readonly left: number;
|
|
1151
|
+
}>;
|
|
1152
|
+
} | {
|
|
1153
|
+
readonly _tag: "Pasted";
|
|
1154
|
+
readonly cells: readonly {
|
|
1918
1155
|
readonly row: string;
|
|
1919
|
-
|
|
1920
|
-
readonly
|
|
1921
|
-
readonly
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1156
|
+
readonly column: keyof Specs & string;
|
|
1157
|
+
readonly text: string;
|
|
1158
|
+
readonly from: string;
|
|
1159
|
+
}[];
|
|
1160
|
+
} | {
|
|
1161
|
+
readonly _tag: "RedoRequested";
|
|
1162
|
+
} | {
|
|
1163
|
+
readonly _tag: "ResizeEnded";
|
|
1164
|
+
readonly completed: boolean;
|
|
1165
|
+
} | {
|
|
1166
|
+
readonly _tag: "ResizeMoved";
|
|
1167
|
+
readonly delta: number;
|
|
1168
|
+
} | {
|
|
1169
|
+
readonly _tag: "ResizeStarted";
|
|
1170
|
+
readonly column: keyof Specs & string;
|
|
1171
|
+
} | {
|
|
1172
|
+
readonly _tag: "Revealed";
|
|
1173
|
+
readonly top: number;
|
|
1174
|
+
readonly left: number;
|
|
1175
|
+
} | {
|
|
1176
|
+
readonly _tag: "RowSelected";
|
|
1177
|
+
readonly row: string;
|
|
1178
|
+
} | {
|
|
1179
|
+
readonly _tag: "RowsCleared";
|
|
1180
|
+
} | {
|
|
1181
|
+
readonly _tag: "RowsExtended";
|
|
1182
|
+
readonly rows: readonly string[];
|
|
1183
|
+
readonly to: string;
|
|
1184
|
+
} | {
|
|
1185
|
+
readonly _tag: "UndoRequested";
|
|
1186
|
+
}, {
|
|
1187
|
+
readonly _tag: "RedoRequested";
|
|
1188
|
+
} | {
|
|
1189
|
+
readonly _tag: "UndoRequested";
|
|
1190
|
+
} | {
|
|
1191
|
+
readonly _tag: "Edited";
|
|
1192
|
+
readonly row: string;
|
|
1193
|
+
readonly column: keyof Specs & string;
|
|
1194
|
+
readonly text: string;
|
|
1195
|
+
} | {
|
|
1196
|
+
readonly _tag: "Filled";
|
|
1197
|
+
readonly source: {
|
|
1929
1198
|
readonly anchor: {
|
|
1930
1199
|
readonly row: string;
|
|
1931
1200
|
readonly column: keyof Specs & string;
|
|
@@ -1934,120 +1203,31 @@ export declare const DataGrid: {
|
|
|
1934
1203
|
readonly row: string;
|
|
1935
1204
|
readonly column: keyof Specs & string;
|
|
1936
1205
|
};
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
}
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
readonly
|
|
1946
|
-
|
|
1947
|
-
readonly _tag: "CellsCleared";
|
|
1948
|
-
} | {
|
|
1949
|
-
readonly _tag: "EditStarted";
|
|
1950
|
-
readonly address: {
|
|
1951
|
-
readonly row: string;
|
|
1952
|
-
readonly column: keyof Specs & string;
|
|
1953
|
-
};
|
|
1954
|
-
readonly draft: string;
|
|
1955
|
-
} | {
|
|
1956
|
-
readonly _tag: "EditTyped";
|
|
1957
|
-
readonly address: {
|
|
1958
|
-
readonly row: string;
|
|
1959
|
-
readonly column: keyof Specs & string;
|
|
1960
|
-
};
|
|
1206
|
+
};
|
|
1207
|
+
readonly to: {
|
|
1208
|
+
readonly row: string;
|
|
1209
|
+
readonly column: keyof Specs & string;
|
|
1210
|
+
};
|
|
1211
|
+
} | {
|
|
1212
|
+
readonly _tag: "Pasted";
|
|
1213
|
+
readonly accepted: readonly {
|
|
1214
|
+
readonly row: string;
|
|
1215
|
+
readonly column: keyof Specs & string;
|
|
1961
1216
|
readonly text: string;
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
readonly _tag: "EditChanged";
|
|
1965
|
-
readonly draft: string;
|
|
1966
|
-
} | {
|
|
1967
|
-
readonly _tag: "EditStepped";
|
|
1968
|
-
readonly by: "next" | "previous" | "first" | "last" | "pageNext" | "pagePrevious";
|
|
1969
|
-
} | {
|
|
1970
|
-
readonly _tag: "EditChosen";
|
|
1971
|
-
readonly draft: string;
|
|
1972
|
-
} | {
|
|
1973
|
-
readonly _tag: "EditCommitted";
|
|
1974
|
-
readonly next: Option.Option<{
|
|
1975
|
-
readonly row: string;
|
|
1976
|
-
readonly column: keyof Specs & string;
|
|
1977
|
-
}>;
|
|
1978
|
-
readonly reveal: Option.Option<{
|
|
1979
|
-
readonly top: number;
|
|
1980
|
-
readonly left: number;
|
|
1981
|
-
}>;
|
|
1982
|
-
} | {
|
|
1983
|
-
readonly _tag: "EditCancelled";
|
|
1984
|
-
} | {
|
|
1985
|
-
readonly _tag: "FillStarted";
|
|
1986
|
-
} | {
|
|
1987
|
-
readonly _tag: "FillDragged";
|
|
1988
|
-
readonly cell: string;
|
|
1989
|
-
} | {
|
|
1990
|
-
readonly _tag: "FillEnded";
|
|
1991
|
-
readonly completed: boolean;
|
|
1992
|
-
} | {
|
|
1993
|
-
readonly _tag: "FillRequested";
|
|
1994
|
-
readonly source: {
|
|
1995
|
-
readonly anchor: {
|
|
1996
|
-
readonly row: string;
|
|
1997
|
-
readonly column: keyof Specs & string;
|
|
1998
|
-
};
|
|
1999
|
-
readonly focus: {
|
|
2000
|
-
readonly row: string;
|
|
2001
|
-
readonly column: keyof Specs & string;
|
|
2002
|
-
};
|
|
2003
|
-
};
|
|
2004
|
-
readonly to: {
|
|
2005
|
-
readonly row: string;
|
|
2006
|
-
readonly column: keyof Specs & string;
|
|
2007
|
-
};
|
|
2008
|
-
}, {
|
|
2009
|
-
readonly _tag: "UndoRequested";
|
|
2010
|
-
} | {
|
|
2011
|
-
readonly _tag: "RedoRequested";
|
|
2012
|
-
} | {
|
|
2013
|
-
readonly _tag: "Edited";
|
|
1217
|
+
}[];
|
|
1218
|
+
readonly refused: readonly {
|
|
2014
1219
|
readonly row: string;
|
|
2015
1220
|
readonly column: keyof Specs & string;
|
|
2016
1221
|
readonly text: string;
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
}[];
|
|
2024
|
-
readonly refused: readonly {
|
|
2025
|
-
readonly error: string;
|
|
2026
|
-
readonly row: string;
|
|
2027
|
-
readonly column: keyof Specs & string;
|
|
2028
|
-
readonly text: string;
|
|
2029
|
-
}[];
|
|
2030
|
-
} | {
|
|
2031
|
-
readonly _tag: "Filled";
|
|
2032
|
-
readonly source: {
|
|
2033
|
-
readonly anchor: {
|
|
2034
|
-
readonly row: string;
|
|
2035
|
-
readonly column: keyof Specs & string;
|
|
2036
|
-
};
|
|
2037
|
-
readonly focus: {
|
|
2038
|
-
readonly row: string;
|
|
2039
|
-
readonly column: keyof Specs & string;
|
|
2040
|
-
};
|
|
2041
|
-
};
|
|
2042
|
-
readonly to: {
|
|
2043
|
-
readonly row: string;
|
|
2044
|
-
readonly column: keyof Specs & string;
|
|
2045
|
-
};
|
|
2046
|
-
}, never, never, void, {}, {}>;
|
|
2047
|
-
};
|
|
1222
|
+
readonly error: string;
|
|
1223
|
+
}[];
|
|
1224
|
+
}, never, never, void, {}, {}>;
|
|
1225
|
+
};
|
|
1226
|
+
export declare const DataGrid: {
|
|
1227
|
+
make: typeof make$1;
|
|
2048
1228
|
};
|
|
2049
1229
|
/** What `DataGrid.make` returns for these columns: the grid a view draws. */
|
|
2050
|
-
type DataGridOf<Row, Specs extends Record<string, ColumnSpec<Row, unknown>>> = ReturnType<typeof make<Row, Specs>>;
|
|
1230
|
+
type DataGridOf<Row, Specs extends Record<string, ColumnSpec<Row, unknown>>> = ReturnType<typeof make$1<Row, Specs>>;
|
|
2051
1231
|
//#endregion
|
|
2052
1232
|
//#region src/focus.d.ts
|
|
2053
1233
|
type Direction = 'ltr' | 'rtl';
|
|
@@ -2060,63 +1240,113 @@ interface KeyOptions<Id extends string> {
|
|
|
2060
1240
|
/** How many rows PageUp and PageDown move: the rows a viewport shows. */
|
|
2061
1241
|
readonly pageRows: number;
|
|
2062
1242
|
}
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
1243
|
+
/**
|
|
1244
|
+
* The cell that holds the grid's one tab stop: the focused cell while it is
|
|
1245
|
+
* shown, and otherwise the first cell. A focused cell whose column was hidden
|
|
1246
|
+
* or whose row went away stays in the Model, so focus returns to it if it
|
|
1247
|
+
* comes back, but the tab stop moves on until then.
|
|
1248
|
+
*/
|
|
1249
|
+
declare const tabStop: <Row, Id extends string>(projection: GridProjection<Row, Id>, current: Option.Option<CellAddress<Id>>) => Option.Option<CellAddress<Id>>;
|
|
1250
|
+
/**
|
|
1251
|
+
* The cell a key moves focus to, or none when the key is not the grid's to
|
|
1252
|
+
* handle, so the caller leaves it to the page. Arrows step one cell, Home and
|
|
1253
|
+
* End go to the row's edges and, with Ctrl, to the grid's corners; PageUp and
|
|
1254
|
+
* PageDown move `pageRows`. A key the grid handles always lands somewhere: at
|
|
1255
|
+
* an edge, or onto a row that is counted but not loaded, focus stays where it
|
|
1256
|
+
* is. Shift, Alt and Meta combinations are left alone: Shift extends a
|
|
1257
|
+
* selection, which is not focus's to decide.
|
|
1258
|
+
*/
|
|
1259
|
+
declare const target: <Row, Id extends string>(projection: GridProjection<Row, Id>, options: KeyOptions<Id>) => Option.Option<CellAddress<Id>>;
|
|
1260
|
+
/**
|
|
1261
|
+
* A cell's DOM id: the grid's id, the row key and the column id, each
|
|
1262
|
+
* URI-encoded and joined by `:`, which encoding never leaves in a part, so no
|
|
1263
|
+
* two cells share an id. The container points at it with
|
|
1264
|
+
* `aria-activedescendant`.
|
|
1265
|
+
*/
|
|
1266
|
+
declare const cellId: <Id extends string>(grid: string, address: CellAddress<Id>) => string;
|
|
1267
|
+
/**
|
|
1268
|
+
* The address a `cellId` names, if it is one of this grid's: its row key and
|
|
1269
|
+
* its column id as written, for the grid's columns to check. An id from
|
|
1270
|
+
* another grid, or with a malformed escape, is none.
|
|
1271
|
+
*/
|
|
1272
|
+
declare const cellOf: (grid: string, id: string) => Option.Option<{
|
|
1273
|
+
readonly row: string;
|
|
1274
|
+
readonly column: string;
|
|
1275
|
+
}>;
|
|
1276
|
+
/**
|
|
1277
|
+
* A column header's DOM id: the grid's id and the column id, URI-encoded and
|
|
1278
|
+
* joined by `:`. It has two parts where a cell's has three, so the two never
|
|
1279
|
+
* meet.
|
|
1280
|
+
*/
|
|
1281
|
+
declare const headerId: (grid: string, column: string) => string;
|
|
1282
|
+
/** The column a `headerId` names, if it is one of this grid's, as written. */
|
|
1283
|
+
declare const headerOf: (grid: string, id: string) => Option.Option<string>;
|
|
1284
|
+
/**
|
|
1285
|
+
* Focus for one grid: which cell is current, by identity. Make it once per
|
|
1286
|
+
* grid from its columns, so a focus saved in the Model decodes only against
|
|
1287
|
+
* columns that exist.
|
|
1288
|
+
*/
|
|
1289
|
+
declare const make: <Row, Specs extends Record<string, ColumnSpec<Row, unknown>>>(columns: Columns<Row, Specs>) => {
|
|
1290
|
+
Address: Schema.Struct<{
|
|
1291
|
+
readonly row: Schema.String;
|
|
1292
|
+
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1293
|
+
}>;
|
|
1294
|
+
Model: Schema.Struct<{
|
|
1295
|
+
/** The focused cell; stored as `null` when none is. */
|
|
1296
|
+
readonly current: Schema.OptionFromNullOr<Schema.Struct<{
|
|
2066
1297
|
readonly row: Schema.String;
|
|
2067
1298
|
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
2068
|
-
}
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
1299
|
+
}>>;
|
|
1300
|
+
/**
|
|
1301
|
+
* The column header focus is on, when it is on the header row. The cell
|
|
1302
|
+
* focused before stays in `current`, so going back down returns to it.
|
|
1303
|
+
*/
|
|
1304
|
+
readonly header: Schema.OptionFromNullOr<Schema.Literals<readonly (keyof Specs & string)[]>>;
|
|
1305
|
+
}>;
|
|
1306
|
+
Message: import("foldkit/message").MessageUnion<{
|
|
1307
|
+
/** A cell became current: the user focused it, or a key moved there. */
|
|
1308
|
+
readonly Focused: {
|
|
1309
|
+
address: Schema.Struct<{
|
|
2072
1310
|
readonly row: Schema.String;
|
|
2073
1311
|
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
2074
|
-
}
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
1312
|
+
}>;
|
|
1313
|
+
};
|
|
1314
|
+
/** Focus went up to a column's header. */
|
|
1315
|
+
readonly HeaderFocused: {
|
|
1316
|
+
column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
1317
|
+
};
|
|
1318
|
+
}>;
|
|
1319
|
+
bundle: Bundle.Bundle<"GridFocus", void, {
|
|
1320
|
+
readonly current: Option.Option<{
|
|
1321
|
+
readonly row: string;
|
|
1322
|
+
readonly column: keyof Specs & string;
|
|
2080
1323
|
}>;
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
2087
|
-
}>;
|
|
2088
|
-
};
|
|
2089
|
-
/** Focus went up to a column's header. */
|
|
2090
|
-
readonly HeaderFocused: {
|
|
2091
|
-
readonly column: Schema.Literals<readonly (keyof Specs & string)[]>;
|
|
2092
|
-
};
|
|
1324
|
+
readonly header: Option.Option<keyof Specs & string>;
|
|
1325
|
+
} | {
|
|
1326
|
+
readonly current: Option.Option<{
|
|
1327
|
+
readonly row: string;
|
|
1328
|
+
readonly column: keyof Specs & string;
|
|
2093
1329
|
}>;
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
readonly header: Option.Option<keyof Specs & string>;
|
|
2100
|
-
}, {
|
|
2101
|
-
readonly _tag: "Focused";
|
|
2102
|
-
readonly address: {
|
|
2103
|
-
readonly row: string;
|
|
2104
|
-
readonly column: keyof Specs & string;
|
|
2105
|
-
};
|
|
2106
|
-
} | {
|
|
2107
|
-
readonly _tag: "HeaderFocused";
|
|
1330
|
+
readonly header: Option.Option<keyof Specs & string>;
|
|
1331
|
+
}, {
|
|
1332
|
+
readonly _tag: "Focused";
|
|
1333
|
+
readonly address: {
|
|
1334
|
+
readonly row: string;
|
|
2108
1335
|
readonly column: keyof Specs & string;
|
|
2109
|
-
}
|
|
2110
|
-
}
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
1336
|
+
};
|
|
1337
|
+
} | {
|
|
1338
|
+
readonly _tag: "HeaderFocused";
|
|
1339
|
+
readonly column: keyof Specs & string;
|
|
1340
|
+
}, never, never, never, void, {}, {}>;
|
|
1341
|
+
};
|
|
1342
|
+
export declare const GridFocus: {
|
|
1343
|
+
make: typeof make;
|
|
1344
|
+
target: typeof target;
|
|
1345
|
+
tabStop: typeof tabStop;
|
|
1346
|
+
cellId: typeof cellId;
|
|
1347
|
+
cellOf: typeof cellOf;
|
|
1348
|
+
headerId: typeof headerId;
|
|
1349
|
+
headerOf: typeof headerOf;
|
|
2120
1350
|
};
|
|
2121
1351
|
//#endregion
|
|
2122
1352
|
//#region src/selection.d.ts
|
|
@@ -2127,18 +1357,28 @@ export declare const GridFocus: {
|
|
|
2127
1357
|
*/
|
|
2128
1358
|
export declare const RowSelection: import("foldkit/schema").TaggedUnion<{
|
|
2129
1359
|
readonly Keys: {
|
|
2130
|
-
|
|
1360
|
+
keys: Schema.$Array<Schema.String>;
|
|
2131
1361
|
};
|
|
2132
1362
|
readonly AllExcept: {
|
|
2133
|
-
|
|
1363
|
+
except: Schema.$Array<Schema.String>;
|
|
2134
1364
|
};
|
|
2135
1365
|
}>;
|
|
2136
1366
|
export type RowSelection = typeof RowSelection.Type;
|
|
1367
|
+
/** Whether a row is selected. Call it once per selection: it indexes the keys. */
|
|
1368
|
+
declare const isSelected: (selection: RowSelection) => ((key: string) => boolean);
|
|
1369
|
+
/** Selects a row, or deselects it if it is selected. */
|
|
1370
|
+
declare const toggle: (selection: RowSelection, key: string) => RowSelection;
|
|
1371
|
+
/** Selects every row in `keys`, keeping what was selected. */
|
|
1372
|
+
declare const add: (selection: RowSelection, keys: ReadonlyArray<string>) => RowSelection;
|
|
1373
|
+
/** The keys of the rows from `from` to `to`, in the projection's order, both included. */
|
|
1374
|
+
declare const rowsBetween: <Row, Id extends string>(projection: GridProjection<Row, Id>, from: string, to: string) => ReadonlyArray<string>;
|
|
2137
1375
|
/** A rectangle of cells, named by its corners, so it survives a re-sort as two cells. */
|
|
2138
1376
|
interface CellRange<Id extends string> {
|
|
2139
1377
|
readonly anchor: CellAddress<Id>;
|
|
2140
1378
|
readonly focus: CellAddress<Id>;
|
|
2141
1379
|
}
|
|
1380
|
+
/** The cells a range covers now, or none when a corner is hidden or gone. */
|
|
1381
|
+
declare const boxOf: <Row, Id extends string>(projection: GridProjection<Row, Id>, range: CellRange<Id>) => Option.Option<CellBox<Id>>;
|
|
2142
1382
|
interface ExtendOptions<Id extends string> {
|
|
2143
1383
|
readonly range: Option.Option<CellRange<Id>>;
|
|
2144
1384
|
/** The focused cell: a range grows from it when there is none. */
|
|
@@ -2148,35 +1388,50 @@ interface ExtendOptions<Id extends string> {
|
|
|
2148
1388
|
readonly pageRows: number;
|
|
2149
1389
|
readonly direction?: Direction;
|
|
2150
1390
|
}
|
|
1391
|
+
/**
|
|
1392
|
+
* The range a Shift key makes, or none when the key is not one: Shift with an
|
|
1393
|
+
* arrow moves the range's far corner a cell, with PageUp or PageDown a page,
|
|
1394
|
+
* with Home or End to the row's edge. The near corner stays where the range
|
|
1395
|
+
* began, the focused cell when there was none. As with focus, a key the grid
|
|
1396
|
+
* handles always lands: at an edge, or before a row not loaded, the range
|
|
1397
|
+
* stays as it is.
|
|
1398
|
+
*/
|
|
1399
|
+
declare const extend: <Row, Id extends string>(projection: GridProjection<Row, Id>, options: ExtendOptions<Id>) => Option.Option<CellRange<Id>>;
|
|
2151
1400
|
export declare const GridSelection: {
|
|
2152
1401
|
none: {
|
|
2153
1402
|
readonly _tag: "Keys";
|
|
2154
1403
|
readonly keys: readonly string[];
|
|
2155
1404
|
};
|
|
2156
|
-
isSelected:
|
|
2157
|
-
toggle:
|
|
2158
|
-
add:
|
|
2159
|
-
rowsBetween:
|
|
2160
|
-
boxOf:
|
|
2161
|
-
extend:
|
|
1405
|
+
isSelected: typeof isSelected;
|
|
1406
|
+
toggle: typeof toggle;
|
|
1407
|
+
add: typeof add;
|
|
1408
|
+
rowsBetween: typeof rowsBetween;
|
|
1409
|
+
boxOf: typeof boxOf;
|
|
1410
|
+
extend: typeof extend;
|
|
2162
1411
|
};
|
|
2163
1412
|
//#endregion
|
|
2164
1413
|
//#region src/viewport.d.ts
|
|
2165
1414
|
declare const Message: import("foldkit/message").MessageUnion<{
|
|
2166
1415
|
/** The scroll container moved or changed size; the Mount reports it. */
|
|
2167
1416
|
readonly Measured: {
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
1417
|
+
top: Schema.Number;
|
|
1418
|
+
left: Schema.Number;
|
|
1419
|
+
width: Schema.Number;
|
|
1420
|
+
height: Schema.Number;
|
|
2172
1421
|
};
|
|
2173
1422
|
/** A reveal set the scroll offsets; the container's own scroll event confirms it later. */
|
|
2174
1423
|
readonly Revealed: {
|
|
2175
|
-
|
|
2176
|
-
|
|
1424
|
+
top: Schema.Number;
|
|
1425
|
+
left: Schema.Number;
|
|
2177
1426
|
};
|
|
2178
1427
|
}>;
|
|
2179
1428
|
type Message = typeof Message.Type;
|
|
1429
|
+
/**
|
|
1430
|
+
* Scrolls the container with this DOM id to `offsets` (from
|
|
1431
|
+
* `VirtualGrid.reveal`) and reports `Revealed`, so the next window is drawn
|
|
1432
|
+
* from the new offsets at once rather than after the scroll event.
|
|
1433
|
+
*/
|
|
1434
|
+
declare const scrollTo: (viewportId: string, offsets: Pick<Viewport, 'top' | 'left'>) => Command<Message>;
|
|
2180
1435
|
export declare const GridViewport: {
|
|
2181
1436
|
Model: Schema.Struct<{
|
|
2182
1437
|
readonly top: Schema.Number;
|
|
@@ -2187,15 +1442,15 @@ export declare const GridViewport: {
|
|
|
2187
1442
|
Message: import("foldkit/message").MessageUnion<{
|
|
2188
1443
|
/** The scroll container moved or changed size; the Mount reports it. */
|
|
2189
1444
|
readonly Measured: {
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
1445
|
+
top: Schema.Number;
|
|
1446
|
+
left: Schema.Number;
|
|
1447
|
+
width: Schema.Number;
|
|
1448
|
+
height: Schema.Number;
|
|
2194
1449
|
};
|
|
2195
1450
|
/** A reveal set the scroll offsets; the container's own scroll event confirms it later. */
|
|
2196
1451
|
readonly Revealed: {
|
|
2197
|
-
|
|
2198
|
-
|
|
1452
|
+
top: Schema.Number;
|
|
1453
|
+
left: Schema.Number;
|
|
2199
1454
|
};
|
|
2200
1455
|
}>;
|
|
2201
1456
|
bundle: Bundle.Bundle<"GridViewport", void, {
|
|
@@ -2221,8 +1476,8 @@ export declare const GridViewport: {
|
|
|
2221
1476
|
readonly width: number;
|
|
2222
1477
|
readonly height: number;
|
|
2223
1478
|
}>;
|
|
2224
|
-
scrollTo:
|
|
1479
|
+
scrollTo: typeof scrollTo;
|
|
2225
1480
|
};
|
|
2226
1481
|
//#endregion
|
|
2227
|
-
export { type AxisWindow, type CellBox, CellEditor, type CellOffset, type CellPosition, type CellRange, type CellText, type Column, type ColumnEdit, type ColumnId, type ColumnSpec, Columns, type DataGridOf, type Direction, type ExtendOptions, type FillPlan, type FillRequest, type Geometry, type GridWindow, type KeyOptions, type PastedCell, type ProjectionOptions, type Region, type Restored, type RevealOptions, RowCount, RowModel, RowStatus, type Viewport, type WindowOptions, addressableRows };
|
|
1482
|
+
export { type AxisWindow, type CellBox, CellEditor, type CellOffset, type CellPosition, type CellRange, type CellText, type Column, type ColumnEdit, type ColumnId, type ColumnSpec, Columns, type DataGridOf, type Direction, type EditableId, type ExtendOptions, type FillPlan, type FillRequest, type Geometry, type GridWindow, type KeyOptions, type PastedCell, type ProjectionOptions, type Region, type Restored, type RevealOptions, RowCount, RowModel, RowStatus, type Viewport, type WindowOptions, addressableRows };
|
|
2228
1483
|
//# sourceMappingURL=index.d.mts.map
|