@orkestrel/table 0.0.3 → 0.0.5
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/README.md +13 -15
- package/dist/src/core/index.cjs +286 -199
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +364 -429
- package/dist/src/core/index.d.ts +364 -429
- package/dist/src/core/index.js +284 -194
- package/dist/src/core/index.js.map +1 -1
- package/package.json +17 -14
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { JSONRecord } from '@orkestrel/contract';
|
|
1
|
+
import type { EmitterErrorHandler } from '@orkestrel/emitter';
|
|
2
|
+
import type { EmitterHooks } from '@orkestrel/emitter';
|
|
3
|
+
import type { EmitterInterface } from '@orkestrel/emitter';
|
|
4
|
+
import type { JSONRecord } from '@orkestrel/contract';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
|
-
*
|
|
7
|
+
* Checks whether one column admits a filter and every operand it carries — the gate `filter.set`
|
|
8
|
+
* and {@link matchesFilter} share.
|
|
9
9
|
*
|
|
10
10
|
* @param column - The column that fixes the accepted operators and cell shapes.
|
|
11
11
|
* @param filter - The filter to inspect.
|
|
12
|
-
* @returns
|
|
12
|
+
* @returns True if the filter belongs to the column and the column can apply it; false otherwise.
|
|
13
13
|
*/
|
|
14
14
|
export declare function admitsFilter(column: TableColumn, filter: TableFilter): boolean;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Audits a structurally valid schema for domain faults and budget breaches, returning human
|
|
18
|
+
* diagnostics.
|
|
18
19
|
*
|
|
19
20
|
* @param schema - The table schema to audit.
|
|
20
21
|
* @returns Frozen human-readable diagnostics, or an empty list when the schema is sound.
|
|
@@ -22,11 +23,12 @@ export declare function admitsFilter(column: TableColumn, filter: TableFilter):
|
|
|
22
23
|
export declare function auditTable(schema: TableSchema): readonly string[];
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
+
* Keeps the rows whose cell falls between `minimum` and `maximum`, both included, compared the
|
|
27
|
+
* way the column compares.
|
|
26
28
|
*
|
|
27
29
|
* @remarks
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
+
* A `text` column holding ISO strings therefore takes a pair of ISO strings and reads as a date
|
|
31
|
+
* range.
|
|
30
32
|
*/
|
|
31
33
|
export declare interface BetweenFilter {
|
|
32
34
|
readonly column: string;
|
|
@@ -36,13 +38,13 @@ export declare interface BetweenFilter {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
|
-
*
|
|
41
|
+
* Compares two cells of one column, replacing what its `cell` fixes. Always describes ascending
|
|
42
|
+
* order; direction is applied afterwards.
|
|
40
43
|
*
|
|
41
44
|
* @remarks
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* always describes ascending order.
|
|
45
|
+
* The replacement covers that column alone, and it receives `undefined` for a row carrying no
|
|
46
|
+
* cell there. Sorting reads the result the way `Array.prototype.sort` does and applies
|
|
47
|
+
* {@link TableDirection} to it.
|
|
46
48
|
*
|
|
47
49
|
* @param left - The first row's cell, or `undefined` when it carries none.
|
|
48
50
|
* @param right - The second row's cell, or `undefined` when it carries none.
|
|
@@ -56,15 +58,16 @@ export declare interface BetweenFilter {
|
|
|
56
58
|
export declare type CellComparator = (left: TableCell | undefined, right: TableCell | undefined) => number;
|
|
57
59
|
|
|
58
60
|
/**
|
|
59
|
-
*
|
|
61
|
+
* Tests one column's cell against a filter, replacing what its `cell` fixes. Receives every
|
|
62
|
+
* filter the table holds against that column.
|
|
60
63
|
*
|
|
61
64
|
* @remarks
|
|
62
|
-
*
|
|
63
|
-
*
|
|
65
|
+
* The replacement covers that column alone, and it receives `undefined` for a row carrying no
|
|
66
|
+
* cell there.
|
|
64
67
|
*
|
|
65
68
|
* @param cell - The row's cell, or `undefined` when it carries none.
|
|
66
69
|
* @param filter - The filter the table is applying.
|
|
67
|
-
* @returns
|
|
70
|
+
* @returns True if the filter accepts the cell; false otherwise.
|
|
68
71
|
* @example
|
|
69
72
|
* ```ts
|
|
70
73
|
* const loose: CellMatcher = (cell, filter) =>
|
|
@@ -73,11 +76,12 @@ export declare type CellComparator = (left: TableCell | undefined, right: TableC
|
|
|
73
76
|
*/
|
|
74
77
|
export declare type CellMatcher = (cell: TableCell | undefined, filter: TableFilter) => boolean;
|
|
75
78
|
|
|
76
|
-
/**
|
|
79
|
+
/** Names the maximum number of choices one `choice` column may offer: 1024. */
|
|
77
80
|
export declare const CHOICE_LIMIT = 1024;
|
|
78
81
|
|
|
79
82
|
/**
|
|
80
|
-
*
|
|
83
|
+
* Represents a column drawn from a declared list, compared by the order that list declares. It
|
|
84
|
+
* requires `choices`.
|
|
81
85
|
*
|
|
82
86
|
* @remarks
|
|
83
87
|
* A cell holding a value the list does not offer is refused at admission.
|
|
@@ -88,7 +92,7 @@ export declare interface ChoiceColumn extends ColumnBase {
|
|
|
88
92
|
}
|
|
89
93
|
|
|
90
94
|
/**
|
|
91
|
-
*
|
|
95
|
+
* Clones one row into an owned frozen snapshot.
|
|
92
96
|
*
|
|
93
97
|
* @param row - The row to own.
|
|
94
98
|
* @returns A frozen copy of the row's cells.
|
|
@@ -96,21 +100,23 @@ export declare interface ChoiceColumn extends ColumnBase {
|
|
|
96
100
|
export declare function cloneRow(row: TableRow): TableRow;
|
|
97
101
|
|
|
98
102
|
/**
|
|
99
|
-
*
|
|
103
|
+
* Clones a whole schema into an owned frozen snapshot, freezing every nested column, choice list,
|
|
104
|
+
* choice, and `meta`; raises `SCHEMA` for a `meta` it cannot own.
|
|
100
105
|
*
|
|
101
106
|
* @param schema - The schema to own.
|
|
102
107
|
* @returns A frozen schema with every nested column, choice, list, and metadata record owned.
|
|
103
108
|
*/
|
|
104
109
|
export declare function cloneSchema(schema: TableSchema): TableSchema;
|
|
105
110
|
|
|
106
|
-
/**
|
|
111
|
+
/** Lists every column cell, in the order declared by the public contract. */
|
|
107
112
|
export declare const COLUMN_CELLS: readonly ColumnCell[];
|
|
108
113
|
|
|
109
|
-
/**
|
|
114
|
+
/** Names the maximum number of columns one schema may declare: 256. */
|
|
110
115
|
export declare const COLUMN_LIMIT = 256;
|
|
111
116
|
|
|
112
117
|
/**
|
|
113
|
-
*
|
|
118
|
+
* Describes what every column carries, whatever its cells hold — the name a row's cell uses, the
|
|
119
|
+
* text a reader sees, whether a host draws the column, and the metadata a host attaches to it.
|
|
114
120
|
*
|
|
115
121
|
* @remarks
|
|
116
122
|
* `key` names the column, and it is the name a row uses for that column's cell. `label` is the
|
|
@@ -135,11 +141,12 @@ export declare interface ColumnBase {
|
|
|
135
141
|
}
|
|
136
142
|
|
|
137
143
|
/**
|
|
138
|
-
*
|
|
144
|
+
* Names what a column's cells hold — the discriminant that fixes the column's options, its
|
|
145
|
+
* comparison, and the filters that apply to it.
|
|
139
146
|
*
|
|
140
147
|
* @remarks
|
|
141
|
-
*
|
|
142
|
-
*
|
|
148
|
+
* Every {@link TableColumn} variant is discriminated by it, so narrowing on the member reaches
|
|
149
|
+
* that variant's own options.
|
|
143
150
|
*
|
|
144
151
|
* A date, a time, and a timestamp are `text` holding a canonically spelled ISO string. Lexical
|
|
145
152
|
* order is chronological only when a column uses one offset, one precision, and normalized
|
|
@@ -153,10 +160,10 @@ export declare interface ColumnBase {
|
|
|
153
160
|
export declare type ColumnCell = 'text' | 'number' | 'flag' | 'choice';
|
|
154
161
|
|
|
155
162
|
/**
|
|
156
|
-
*
|
|
163
|
+
* Represents one value a `choice` column offers — `value` is stored, `label` is read, and `help`
|
|
164
|
+
* explains.
|
|
157
165
|
*
|
|
158
166
|
* @remarks
|
|
159
|
-
* `value` is what the cell holds and `label` is what a reader sees. `help` explains the choice.
|
|
160
167
|
* The order a column declares its choices in is the order that column sorts by, which is what
|
|
161
168
|
* lets a status column sort draft before live before archived rather than alphabetically.
|
|
162
169
|
*/
|
|
@@ -167,7 +174,7 @@ export declare interface ColumnChoice {
|
|
|
167
174
|
}
|
|
168
175
|
|
|
169
176
|
/**
|
|
170
|
-
*
|
|
177
|
+
* Compares two of one column's cells the way its `cell` fixes, describing ascending order.
|
|
171
178
|
*
|
|
172
179
|
* @param column - The column that fixes the comparison.
|
|
173
180
|
* @param left - The first cell, or absence.
|
|
@@ -177,7 +184,8 @@ export declare interface ColumnChoice {
|
|
|
177
184
|
export declare function compareCells(column: TableColumn, left: TableCell | undefined, right: TableCell | undefined): number;
|
|
178
185
|
|
|
179
186
|
/**
|
|
180
|
-
*
|
|
187
|
+
* Computes one atomic 0/1/N membership change over the keys a caller may address — the engine
|
|
188
|
+
* selection and expansion share.
|
|
181
189
|
*
|
|
182
190
|
* @param known - Every key the caller may change.
|
|
183
191
|
* @param current - The current key set.
|
|
@@ -188,7 +196,7 @@ export declare function compareCells(column: TableColumn, left: TableCell | unde
|
|
|
188
196
|
*/
|
|
189
197
|
export declare function computeKeys(known: readonly TableKey[], current: ReadonlySet<TableKey>, input: TableKey | readonly TableKey[] | undefined, include: (included: boolean) => boolean): ReadonlySet<TableKey> | undefined;
|
|
190
198
|
|
|
191
|
-
/**
|
|
199
|
+
/** Keeps the rows whose cell holds this `text` somewhere inside it. */
|
|
192
200
|
export declare interface ContainsFilter {
|
|
193
201
|
readonly column: string;
|
|
194
202
|
readonly operator: 'contains';
|
|
@@ -196,63 +204,56 @@ export declare interface ContainsFilter {
|
|
|
196
204
|
}
|
|
197
205
|
|
|
198
206
|
/**
|
|
199
|
-
*
|
|
207
|
+
* Opens a table against a schema. The schema is copied, and the copy is what the table declares.
|
|
200
208
|
*
|
|
201
209
|
* @param schema - The table declaration to own.
|
|
202
210
|
* @param options - Initial rows, lens overrides, pagination, and emitter wiring.
|
|
203
211
|
* @returns A live table interface.
|
|
204
212
|
* @throws A {@link TableError} coded `SCHEMA` when the schema is unusable, `KEY` when a seeded
|
|
205
213
|
* identity is unusable or repeated, and `CELL` when a seeded cell is invalid.
|
|
206
|
-
* @example
|
|
214
|
+
* @example Open a table
|
|
207
215
|
* ```ts
|
|
208
|
-
*
|
|
209
|
-
*
|
|
216
|
+
* import { createTable } from '@orkestrel/table'
|
|
217
|
+
*
|
|
218
|
+
* const table = createTable(
|
|
219
|
+
* {
|
|
220
|
+
* label: 'People',
|
|
221
|
+
* key: 'id',
|
|
222
|
+
* columns: [
|
|
223
|
+
* { cell: 'text', key: 'id', label: 'Reference' },
|
|
224
|
+
* { cell: 'text', key: 'name', label: 'Name' },
|
|
225
|
+
* { cell: 'number', key: 'age', label: 'Age' },
|
|
226
|
+
* ],
|
|
227
|
+
* },
|
|
228
|
+
* {
|
|
229
|
+
* rows: [
|
|
230
|
+
* { id: '1', name: 'Ada', age: 36 },
|
|
231
|
+
* { id: '2', name: 'Grace', age: 45 },
|
|
232
|
+
* { id: '3', name: 'Alan', age: 41 },
|
|
233
|
+
* ],
|
|
234
|
+
* limit: 2,
|
|
235
|
+
* },
|
|
236
|
+
* )
|
|
237
|
+
*
|
|
238
|
+
* table.filter.set({ column: 'name', operator: 'contains', text: 'a' })
|
|
239
|
+
* table.sort.set({ column: 'age', direction: 'descending' })
|
|
240
|
+
*
|
|
241
|
+
* table.count // 3 — every name holds a lowercase 'a'
|
|
242
|
+
* table.pagination.count // 2 — two pages of two
|
|
243
|
+
* table.view.map((row) => row.name) // ['Grace', 'Alan'] — page one, oldest first
|
|
210
244
|
* ```
|
|
211
245
|
*/
|
|
212
246
|
export declare function createTable(schema: TableSchema, options?: TableOptions): TableInterface;
|
|
213
247
|
|
|
214
|
-
/**
|
|
248
|
+
/** Keeps the rows whose cell holds exactly this `value`. */
|
|
215
249
|
export declare interface EqualsFilter {
|
|
216
250
|
readonly column: string;
|
|
217
251
|
readonly operator: 'equals';
|
|
218
252
|
readonly value: TableCell;
|
|
219
253
|
}
|
|
220
254
|
|
|
221
|
-
/** The keys of the rows somebody has opened. */
|
|
222
|
-
export declare class ExpansionManager implements ExpansionManagerInterface {
|
|
223
|
-
#private;
|
|
224
|
-
/**
|
|
225
|
-
* Create an expansion manager over one table's private stores.
|
|
226
|
-
*
|
|
227
|
-
* @param emitter - The table's event emitter.
|
|
228
|
-
* @param gate - The table lifecycle gate.
|
|
229
|
-
* @param rows - A read of every row key.
|
|
230
|
-
* @param read - A read of the expanded keys.
|
|
231
|
-
* @param write - The expanded-key commit boundary.
|
|
232
|
-
*/
|
|
233
|
-
constructor(emitter: Emitter<TableEventMap>, gate: () => void, rows: () => readonly TableKey[], read: () => ReadonlySet<TableKey>, write: (keys: ReadonlySet<TableKey>) => void);
|
|
234
|
-
/** The keys of the rows opened right now. */
|
|
235
|
-
get keys(): ReadonlySet<TableKey>;
|
|
236
|
-
/** Open every row the table holds. */
|
|
237
|
-
expand(): void;
|
|
238
|
-
/** Open one row. */
|
|
239
|
-
expand(key: TableKey): boolean;
|
|
240
|
-
/** Open several rows. */
|
|
241
|
-
expand(keys: readonly TableKey[]): boolean;
|
|
242
|
-
/** Close every row. */
|
|
243
|
-
clear(): void;
|
|
244
|
-
/** Close one row. */
|
|
245
|
-
clear(key: TableKey): boolean;
|
|
246
|
-
/** Close several rows. */
|
|
247
|
-
clear(keys: readonly TableKey[]): boolean;
|
|
248
|
-
/** Open one row or close it when already open. */
|
|
249
|
-
toggle(key: TableKey): boolean;
|
|
250
|
-
/** Turn several rows around independently. */
|
|
251
|
-
toggle(keys: readonly TableKey[]): boolean;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
255
|
/**
|
|
255
|
-
*
|
|
256
|
+
* Manages the rows somebody has opened up.
|
|
256
257
|
*
|
|
257
258
|
* @remarks
|
|
258
259
|
* Expansion holds keys exactly as selection does, and what an opened row shows beside it is the
|
|
@@ -265,61 +266,65 @@ export declare class ExpansionManager implements ExpansionManagerInterface {
|
|
|
265
266
|
* ```
|
|
266
267
|
*/
|
|
267
268
|
export declare interface ExpansionManagerInterface {
|
|
268
|
-
/**
|
|
269
|
+
/** Holds the keys of the rows opened right now. */
|
|
269
270
|
readonly keys: ReadonlySet<TableKey>;
|
|
270
|
-
/**
|
|
271
|
+
/** Opens every row the table holds, one row, or several. */
|
|
271
272
|
expand(): void;
|
|
272
273
|
/**
|
|
273
|
-
*
|
|
274
|
+
* Opens one row.
|
|
274
275
|
*
|
|
275
276
|
* @param key - The row's key.
|
|
276
|
-
* @returns
|
|
277
|
+
* @returns True if the key named a row the table holds; false otherwise.
|
|
277
278
|
*/
|
|
278
279
|
expand(key: TableKey): boolean;
|
|
279
280
|
/**
|
|
280
|
-
*
|
|
281
|
+
* Opens several rows.
|
|
281
282
|
*
|
|
282
283
|
* @param keys - The rows' keys.
|
|
283
|
-
* @returns
|
|
284
|
-
* row opens.
|
|
284
|
+
* @returns True if every key named a row the table holds; false otherwise. Every key is
|
|
285
|
+
* checked before any row opens.
|
|
285
286
|
*/
|
|
286
287
|
expand(keys: readonly TableKey[]): boolean;
|
|
287
|
-
/**
|
|
288
|
+
/**
|
|
289
|
+
* Closes every row, one row, or several. A known key that was not open still answers `true`.
|
|
290
|
+
*/
|
|
288
291
|
clear(): void;
|
|
289
292
|
/**
|
|
290
|
-
*
|
|
293
|
+
* Closes one row.
|
|
291
294
|
*
|
|
292
295
|
* @param key - The row's key.
|
|
293
|
-
* @returns
|
|
296
|
+
* @returns True if the key named a row the table holds, whether or not it was
|
|
297
|
+
* open; false otherwise.
|
|
294
298
|
*/
|
|
295
299
|
clear(key: TableKey): boolean;
|
|
296
300
|
/**
|
|
297
|
-
*
|
|
301
|
+
* Closes several rows.
|
|
298
302
|
*
|
|
299
303
|
* @param keys - The rows' keys.
|
|
300
|
-
* @returns
|
|
301
|
-
* row closes.
|
|
304
|
+
* @returns True if every key named a row the table holds; false otherwise. Every key is
|
|
305
|
+
* checked before any row closes.
|
|
302
306
|
*/
|
|
303
307
|
clear(keys: readonly TableKey[]): boolean;
|
|
304
308
|
/**
|
|
305
|
-
*
|
|
309
|
+
* Opens one row, or closes it when it is already open; over a list, turns each row around on
|
|
310
|
+
* its own.
|
|
306
311
|
*
|
|
307
312
|
* @param key - The row's key.
|
|
308
|
-
* @returns
|
|
313
|
+
* @returns True if the key named a row the table holds; false otherwise.
|
|
309
314
|
*/
|
|
310
315
|
toggle(key: TableKey): boolean;
|
|
311
316
|
/**
|
|
312
|
-
*
|
|
317
|
+
* Turns several rows around, each on its own.
|
|
313
318
|
*
|
|
314
319
|
* @param keys - The rows' keys.
|
|
315
|
-
* @returns
|
|
316
|
-
* row turns.
|
|
320
|
+
* @returns True if every key named a row the table holds; false otherwise. Every key is
|
|
321
|
+
* checked before any row turns.
|
|
317
322
|
*/
|
|
318
323
|
toggle(keys: readonly TableKey[]): boolean;
|
|
319
324
|
}
|
|
320
325
|
|
|
321
326
|
/**
|
|
322
|
-
*
|
|
327
|
+
* Finds one column by key; `undefined` when the schema declares no such column.
|
|
323
328
|
*
|
|
324
329
|
* @param schema - The schema whose columns to search.
|
|
325
330
|
* @param key - The column key to find.
|
|
@@ -328,7 +333,8 @@ export declare interface ExpansionManagerInterface {
|
|
|
328
333
|
export declare function extractColumn(schema: TableSchema, key: string): TableColumn | undefined;
|
|
329
334
|
|
|
330
335
|
/**
|
|
331
|
-
*
|
|
336
|
+
* Reads one row's declared identity; `undefined` when its key cell is missing, empty, or not a
|
|
337
|
+
* string.
|
|
332
338
|
*
|
|
333
339
|
* @param schema - The schema that names the identity column.
|
|
334
340
|
* @param row - The row whose identity to read.
|
|
@@ -336,38 +342,8 @@ export declare function extractColumn(schema: TableSchema, key: string): TableCo
|
|
|
336
342
|
*/
|
|
337
343
|
export declare function extractKey(schema: TableSchema, row: TableRow): TableKey | undefined;
|
|
338
344
|
|
|
339
|
-
/** The filters one table applies with and-only composition. */
|
|
340
|
-
export declare class FilterManager implements FilterManagerInterface {
|
|
341
|
-
#private;
|
|
342
|
-
/**
|
|
343
|
-
* Create a filter manager over one table's private filter store.
|
|
344
|
-
*
|
|
345
|
-
* @param schema - The table schema.
|
|
346
|
-
* @param emitter - The table's event emitter.
|
|
347
|
-
* @param gate - The table lifecycle gate.
|
|
348
|
-
* @param read - A read of the current filters.
|
|
349
|
-
* @param write - The filter commit boundary.
|
|
350
|
-
* @param clamp - The pagination clamp commit after a filter commit.
|
|
351
|
-
*/
|
|
352
|
-
constructor(schema: TableSchema, emitter: Emitter<TableEventMap>, gate: () => void, read: () => readonly TableFilter[], write: (filters: readonly TableFilter[]) => void, clamp: () => number | undefined);
|
|
353
|
-
/** Find one column's filter. */
|
|
354
|
-
filter(column: string): TableFilter | undefined;
|
|
355
|
-
/** Read every filter as an owned frozen snapshot. */
|
|
356
|
-
filters(): readonly TableFilter[];
|
|
357
|
-
/** Filter several columns. */
|
|
358
|
-
set(filters: readonly TableFilter[]): void;
|
|
359
|
-
/** Filter one column. */
|
|
360
|
-
set(filter: TableFilter): void;
|
|
361
|
-
/** Stop filtering by every column. */
|
|
362
|
-
remove(): void;
|
|
363
|
-
/** Stop filtering by one column. */
|
|
364
|
-
remove(column: string): boolean;
|
|
365
|
-
/** Stop filtering by several columns. */
|
|
366
|
-
remove(columns: readonly string[]): boolean;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
345
|
/**
|
|
370
|
-
*
|
|
346
|
+
* Manages which rows a table keeps.
|
|
371
347
|
*
|
|
372
348
|
* @remarks
|
|
373
349
|
* The table holds at most one filter per column and keeps the rows every filter accepts.
|
|
@@ -380,20 +356,22 @@ export declare class FilterManager implements FilterManagerInterface {
|
|
|
380
356
|
*/
|
|
381
357
|
export declare interface FilterManagerInterface {
|
|
382
358
|
/**
|
|
383
|
-
*
|
|
359
|
+
* Finds one column's filter; `undefined` when nothing filters that column.
|
|
384
360
|
*
|
|
385
361
|
* @param column - The column's key.
|
|
386
362
|
* @returns The filter, or `undefined` when nothing filters that column.
|
|
387
363
|
*/
|
|
388
364
|
filter(column: string): TableFilter | undefined;
|
|
389
365
|
/**
|
|
390
|
-
*
|
|
366
|
+
* Reads every filter the table keeps rows by, in the order they were set.
|
|
391
367
|
*
|
|
392
|
-
* @returns The filters
|
|
368
|
+
* @returns The filters the table keeps rows by.
|
|
393
369
|
*/
|
|
394
370
|
filters(): readonly TableFilter[];
|
|
395
371
|
/**
|
|
396
|
-
*
|
|
372
|
+
* Filters one column or several. A filter for a column already filtered replaces it; every
|
|
373
|
+
* other one joins the end. An undeclared column raises `COLUMN`, and a filter the column does
|
|
374
|
+
* not admit raises `CELL`.
|
|
397
375
|
*
|
|
398
376
|
* @param filters - The filters to set. A filter for a column already filtered replaces that
|
|
399
377
|
* column's filter; every other one joins the end of the list.
|
|
@@ -403,34 +381,37 @@ export declare interface FilterManagerInterface {
|
|
|
403
381
|
*/
|
|
404
382
|
set(filters: readonly TableFilter[]): void;
|
|
405
383
|
/**
|
|
406
|
-
*
|
|
384
|
+
* Filters one column.
|
|
407
385
|
*
|
|
408
386
|
* @param filter - The filter to set.
|
|
409
387
|
* @throws A {@link TableError} coded `COLUMN` when the filter names a column the schema does
|
|
410
388
|
* not declare, and `CELL` when an operand is one the column cannot hold.
|
|
411
389
|
*/
|
|
412
390
|
set(filter: TableFilter): void;
|
|
413
|
-
/**
|
|
391
|
+
/**
|
|
392
|
+
* Stops filtering everything, one column, or several. An undeclared column returns `false` and
|
|
393
|
+
* stops nothing.
|
|
394
|
+
*/
|
|
414
395
|
remove(): void;
|
|
415
396
|
/**
|
|
416
|
-
*
|
|
397
|
+
* Stops filtering one column.
|
|
417
398
|
*
|
|
418
399
|
* @param column - The column's key.
|
|
419
|
-
* @returns
|
|
400
|
+
* @returns True if the schema declares that column; false otherwise.
|
|
420
401
|
*/
|
|
421
402
|
remove(column: string): boolean;
|
|
422
403
|
/**
|
|
423
|
-
*
|
|
404
|
+
* Stops filtering several columns.
|
|
424
405
|
*
|
|
425
406
|
* @param columns - The columns' keys.
|
|
426
|
-
* @returns
|
|
427
|
-
* filter goes.
|
|
407
|
+
* @returns True if the schema declares every one of them; false otherwise. Every key is
|
|
408
|
+
* checked before any filter goes.
|
|
428
409
|
*/
|
|
429
410
|
remove(columns: readonly string[]): boolean;
|
|
430
411
|
}
|
|
431
412
|
|
|
432
413
|
/**
|
|
433
|
-
*
|
|
414
|
+
* Names how a filter tests a cell — the operator each filter carries.
|
|
434
415
|
*
|
|
435
416
|
* @remarks
|
|
436
417
|
* `contains` looks for text inside a `text` or `choice` cell. `between` accepts a cell inside a
|
|
@@ -443,7 +424,8 @@ export declare interface FilterManagerInterface {
|
|
|
443
424
|
export declare type FilterOperator = 'contains' | 'between' | 'equals';
|
|
444
425
|
|
|
445
426
|
/**
|
|
446
|
-
*
|
|
427
|
+
* Keeps the rows every filter accepts, in the order given; a supplied {@link CellMatcher}
|
|
428
|
+
* replaces the default per column.
|
|
447
429
|
*
|
|
448
430
|
* @param schema - The schema that declares the filtered columns.
|
|
449
431
|
* @param rows - The rows to filter.
|
|
@@ -453,136 +435,139 @@ export declare type FilterOperator = 'contains' | 'between' | 'equals';
|
|
|
453
435
|
*/
|
|
454
436
|
export declare function filterRows(schema: TableSchema, rows: readonly TableRow[], filters: readonly TableFilter[], matchers?: Readonly<Record<string, CellMatcher>>): readonly TableRow[];
|
|
455
437
|
|
|
456
|
-
/**
|
|
438
|
+
/** Represents a column of yes-or-no answers, compared false before true. */
|
|
457
439
|
export declare interface FlagColumn extends ColumnBase {
|
|
458
440
|
readonly cell: 'flag';
|
|
459
441
|
}
|
|
460
442
|
|
|
461
443
|
/**
|
|
462
|
-
*
|
|
444
|
+
* Determines whether an unknown value is a declared column cell.
|
|
463
445
|
*
|
|
464
446
|
* @param input - The value to inspect.
|
|
465
|
-
* @returns
|
|
447
|
+
* @returns True if the value is a declared column cell; false otherwise.
|
|
466
448
|
*/
|
|
467
449
|
export declare function isColumnCell(input: unknown): input is ColumnCell;
|
|
468
450
|
|
|
469
451
|
/**
|
|
470
|
-
*
|
|
452
|
+
* Determines whether an unknown value is one exact {@link ColumnChoice} record; an unknown member
|
|
453
|
+
* refuses it.
|
|
471
454
|
*
|
|
472
455
|
* @param input - The value to inspect.
|
|
473
|
-
* @returns
|
|
456
|
+
* @returns True if the value is a column choice; false otherwise.
|
|
474
457
|
*/
|
|
475
458
|
export declare function isColumnChoice(input: unknown): input is ColumnChoice;
|
|
476
459
|
|
|
477
460
|
/**
|
|
478
|
-
*
|
|
461
|
+
* Determines whether an unknown value has the exact shape of a {@link TableSchema} — the shape
|
|
462
|
+
* alone, with no domain check.
|
|
479
463
|
*
|
|
480
464
|
* @param input - The value to inspect.
|
|
481
|
-
* @returns
|
|
465
|
+
* @returns True if the value has the exact structure of a table schema; false otherwise.
|
|
482
466
|
*/
|
|
483
467
|
export declare function isStructuralTableSchema(input: unknown): input is TableSchema;
|
|
484
468
|
|
|
485
469
|
/**
|
|
486
|
-
*
|
|
470
|
+
* Determines whether an unknown value has a table cell shape — a string, a finite number, or a
|
|
471
|
+
* boolean.
|
|
487
472
|
*
|
|
488
473
|
* @param input - The value to inspect.
|
|
489
|
-
* @returns
|
|
474
|
+
* @returns True if the value is a string, finite number, or boolean; false otherwise.
|
|
490
475
|
*/
|
|
491
476
|
export declare function isTableCell(input: unknown): input is TableCell;
|
|
492
477
|
|
|
493
478
|
/**
|
|
494
|
-
*
|
|
479
|
+
* Determines whether an unknown value is one exact discriminated {@link TableColumn}, checked
|
|
480
|
+
* against its cell's own options.
|
|
495
481
|
*
|
|
496
482
|
* @param input - The value to inspect.
|
|
497
|
-
* @returns
|
|
483
|
+
* @returns True if the value is a structurally valid table column; false otherwise.
|
|
498
484
|
*/
|
|
499
485
|
export declare function isTableColumn(input: unknown): input is TableColumn;
|
|
500
486
|
|
|
501
487
|
/**
|
|
502
|
-
*
|
|
488
|
+
* Determines whether a caught value is a table error, so a `catch` branches on `code` without an
|
|
489
|
+
* assertion.
|
|
503
490
|
*
|
|
504
491
|
* @param input - The value to inspect.
|
|
505
|
-
* @returns
|
|
492
|
+
* @returns True if the value is a {@link TableError} instance; false otherwise.
|
|
506
493
|
*/
|
|
507
494
|
export declare function isTableError(input: unknown): input is TableError;
|
|
508
495
|
|
|
509
496
|
/**
|
|
510
|
-
*
|
|
497
|
+
* Determines whether an unknown value is a record whose every own key is a string and every value
|
|
498
|
+
* a {@link TableCell}.
|
|
511
499
|
*
|
|
512
500
|
* @param input - The value to inspect.
|
|
513
|
-
* @returns
|
|
501
|
+
* @returns True if every own key is a string and every value is a table cell; false otherwise.
|
|
514
502
|
*/
|
|
515
503
|
export declare function isTableRow(input: unknown): input is TableRow;
|
|
516
504
|
|
|
517
505
|
/**
|
|
518
|
-
*
|
|
506
|
+
* Determines whether an unknown value is a {@link TableSchema} a table can be opened against —
|
|
507
|
+
* the exact shape, and an audit that finds nothing.
|
|
519
508
|
*
|
|
520
509
|
* @param input - The value to inspect.
|
|
521
|
-
* @returns
|
|
510
|
+
* @returns True if the value has valid structure, domain relationships, and
|
|
511
|
+
* budgets; false otherwise.
|
|
522
512
|
*/
|
|
523
513
|
export declare function isTableSchema(input: unknown): input is TableSchema;
|
|
524
514
|
|
|
525
515
|
/**
|
|
526
|
-
*
|
|
516
|
+
* Checks whether one column can hold a value — the shape gate every write and every seed passes
|
|
517
|
+
* through.
|
|
527
518
|
*
|
|
528
519
|
* @param column - The column that owns the cell.
|
|
529
520
|
* @param value - The unknown value to inspect.
|
|
530
|
-
* @returns
|
|
521
|
+
* @returns True if the column can hold the value; false otherwise.
|
|
531
522
|
*/
|
|
532
523
|
export declare function matchesCell(column: TableColumn, value: unknown): value is TableCell;
|
|
533
524
|
|
|
534
525
|
/**
|
|
535
|
-
*
|
|
526
|
+
* Tests one of a column's cells against one filter the way its `cell` fixes.
|
|
536
527
|
*
|
|
537
528
|
* @param column - The column that fixes the accepted operators.
|
|
538
529
|
* @param cell - The cell to test, or absence.
|
|
539
530
|
* @param filter - The filter to apply.
|
|
540
|
-
* @returns
|
|
531
|
+
* @returns True if the filter accepts the cell; false otherwise.
|
|
541
532
|
*/
|
|
542
533
|
export declare function matchesFilter(column: TableColumn, cell: TableCell | undefined, filter: TableFilter): boolean;
|
|
543
534
|
|
|
544
|
-
/**
|
|
535
|
+
/**
|
|
536
|
+
* Checks whether two lens lists hold the same terms in the same order, with the supplied test
|
|
537
|
+
* deciding the operands.
|
|
538
|
+
*
|
|
539
|
+
* @param left - The first list.
|
|
540
|
+
* @param right - The second list.
|
|
541
|
+
* @param equal - Decide whether two terms naming one column carry the same operands.
|
|
542
|
+
* @returns True if the lists are the same length and every position names the same column and
|
|
543
|
+
* carries the same operands; false otherwise.
|
|
544
|
+
*/
|
|
545
|
+
export declare function matchesTerms<Term extends TableTerm>(left: readonly Term[], right: readonly Term[], equal: (left: Term, right: Term) => boolean): boolean;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Merges lens terms into a column-keyed list, replacing the entry that names the same column —
|
|
549
|
+
* the `set` write.
|
|
550
|
+
*
|
|
551
|
+
* @param current - The list as it stands.
|
|
552
|
+
* @param requested - The terms to write, in the order they are written.
|
|
553
|
+
* @returns A frozen list holding one owned entry per column, in the order the columns first
|
|
554
|
+
* appeared.
|
|
555
|
+
*/
|
|
556
|
+
export declare function mergeTerms<Term extends TableTerm>(current: readonly Term[], requested: readonly Term[]): readonly Term[];
|
|
557
|
+
|
|
558
|
+
/** Names the maximum length of a schema name or column key: 128 UTF-16 code units. */
|
|
545
559
|
export declare const NAME_LIMIT = 128;
|
|
546
560
|
|
|
547
|
-
/**
|
|
561
|
+
/** Names the maximum total number of records, arrays, and leaves one schema retains: 16384. */
|
|
548
562
|
export declare const NODE_LIMIT = 16384;
|
|
549
563
|
|
|
550
|
-
/**
|
|
564
|
+
/** Represents a column of numbers, compared by magnitude. */
|
|
551
565
|
export declare interface NumberColumn extends ColumnBase {
|
|
552
566
|
readonly cell: 'number';
|
|
553
567
|
}
|
|
554
568
|
|
|
555
|
-
/** The page arithmetic over one table's filtered rows. */
|
|
556
|
-
export declare class PaginationManager implements PaginationManagerInterface {
|
|
557
|
-
#private;
|
|
558
|
-
/**
|
|
559
|
-
* Create a pagination manager over one table's private stores.
|
|
560
|
-
*
|
|
561
|
-
* @param emitter - The table's event emitter.
|
|
562
|
-
* @param gate - The table lifecycle gate.
|
|
563
|
-
* @param rows - A read of the filtered row count.
|
|
564
|
-
* @param readPage - A read of the current page.
|
|
565
|
-
* @param writePage - The page commit boundary.
|
|
566
|
-
* @param readLimit - A read of the current page size.
|
|
567
|
-
* @param writeLimit - The page-size commit boundary.
|
|
568
|
-
*/
|
|
569
|
-
constructor(emitter: Emitter<TableEventMap>, gate: () => void, rows: () => number, readPage: () => number, writePage: (page: number) => void, readLimit: () => number | undefined, writeLimit: (limit: number | undefined) => void);
|
|
570
|
-
/** The page shown, counted from one. */
|
|
571
|
-
get page(): number;
|
|
572
|
-
/** The number of rows one page holds. */
|
|
573
|
-
get limit(): number | undefined;
|
|
574
|
-
/** The number of filtered rows skipped before this page. */
|
|
575
|
-
get offset(): number;
|
|
576
|
-
/** The number of pages filled by the filtered rows. */
|
|
577
|
-
get count(): number;
|
|
578
|
-
/** Show another page, clamped to the pages that exist. */
|
|
579
|
-
move(page: number): void;
|
|
580
|
-
/** Change the page size while keeping the first row previously shown. */
|
|
581
|
-
resize(limit?: number): void;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
569
|
/**
|
|
585
|
-
*
|
|
570
|
+
* Manages which stretch of the filtered rows the view shows.
|
|
586
571
|
*
|
|
587
572
|
* @remarks
|
|
588
573
|
* `page` is the state, counted from one. `offset` and `count` are worked out from it and from the
|
|
@@ -599,26 +584,27 @@ export declare class PaginationManager implements PaginationManagerInterface {
|
|
|
599
584
|
* ```
|
|
600
585
|
*/
|
|
601
586
|
export declare interface PaginationManagerInterface {
|
|
602
|
-
/**
|
|
587
|
+
/** Holds the page the view shows, counted from one, and `1` when the table is not paged. */
|
|
603
588
|
readonly page: number;
|
|
604
|
-
/**
|
|
589
|
+
/** Holds the number of rows one page shows, or `undefined` when the table is not paged. */
|
|
605
590
|
readonly limit: number | undefined;
|
|
606
|
-
/**
|
|
591
|
+
/** Holds the number of rows the view skips before the page it shows, counted from zero. */
|
|
607
592
|
readonly offset: number;
|
|
608
|
-
/**
|
|
593
|
+
/** Counts the pages the rows admitted by the filter fill, and `1` when the table is not paged. */
|
|
609
594
|
readonly count: number;
|
|
610
595
|
/**
|
|
611
|
-
*
|
|
596
|
+
* Shows another page, counted from one and clamped to the pages that exist.
|
|
612
597
|
*
|
|
613
|
-
* @param page - The page to show, counted from one and clamped to the pages that exist.
|
|
598
|
+
* @param page - The page to show, counted from one and clamped to the pages that exist. `NaN`
|
|
599
|
+
* shows the first page.
|
|
614
600
|
*/
|
|
615
601
|
move(page: number): void;
|
|
616
602
|
/**
|
|
617
|
-
*
|
|
603
|
+
* Sets how many rows a page holds, keeping the first row the view was showing. Leave the
|
|
604
|
+
* argument out to stop paging.
|
|
618
605
|
*
|
|
619
606
|
* @remarks
|
|
620
|
-
* The
|
|
621
|
-
* that row now falls.
|
|
607
|
+
* The page moves to wherever that first row now falls.
|
|
622
608
|
*
|
|
623
609
|
* @param limit - How many rows a page holds. Leave it out to stop paging, and the view shows
|
|
624
610
|
* every row the filter admits.
|
|
@@ -627,7 +613,8 @@ export declare interface PaginationManagerInterface {
|
|
|
627
613
|
}
|
|
628
614
|
|
|
629
615
|
/**
|
|
630
|
-
*
|
|
616
|
+
* Parses unknown wire data into owned rows against one table schema, coercing a numeric string
|
|
617
|
+
* and `'true'` / `'false'`.
|
|
631
618
|
*
|
|
632
619
|
* @param schema - The schema that declares the accepted keys and cell shapes.
|
|
633
620
|
* @param input - The unknown row-list value to parse.
|
|
@@ -636,52 +623,25 @@ export declare interface PaginationManagerInterface {
|
|
|
636
623
|
export declare function parseRows(schema: TableSchema, input: unknown): readonly TableRow[] | undefined;
|
|
637
624
|
|
|
638
625
|
/**
|
|
639
|
-
*
|
|
626
|
+
* Parses unknown wire data into an owned, structurally valid, semantically sound table schema.
|
|
640
627
|
*
|
|
641
628
|
* @param input - The unknown schema value to parse.
|
|
642
629
|
* @returns An owned table schema, or `undefined` on refusal.
|
|
643
630
|
*/
|
|
644
631
|
export declare function parseTable(input: unknown): TableSchema | undefined;
|
|
645
632
|
|
|
646
|
-
/**
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
* @param read - A read of the current rows.
|
|
656
|
-
* @param write - The row commit boundary.
|
|
657
|
-
* @param settle - Commit dependent state, then order row and dependent announcements.
|
|
658
|
-
* @param rows - Rows to seed without announcements.
|
|
659
|
-
*/
|
|
660
|
-
constructor(schema: TableSchema, emitter: Emitter<TableEventMap>, gate: () => void, read: () => readonly TableRow[], write: (rows: readonly TableRow[]) => void, settle: (removed: readonly TableKey[], announce: () => void) => void, rows?: readonly TableRow[]);
|
|
661
|
-
/** Find one row by key as an owned frozen snapshot. */
|
|
662
|
-
row(key: TableKey): TableRow | undefined;
|
|
663
|
-
/** Read every row as owned frozen snapshots in table order. */
|
|
664
|
-
rows(): readonly TableRow[];
|
|
665
|
-
/** Append several rows. */
|
|
666
|
-
add(rows: readonly TableRow[]): void;
|
|
667
|
-
/** Append one row. */
|
|
668
|
-
add(row: TableRow): void;
|
|
669
|
-
/** Merge several rows into the rows their keys name. */
|
|
670
|
-
update(rows: readonly TableRow[]): boolean;
|
|
671
|
-
/** Merge one row into the row its key names. */
|
|
672
|
-
update(row: TableRow): boolean;
|
|
673
|
-
/** Move one row to a clamped index in table order. */
|
|
674
|
-
move(key: TableKey, index: number): boolean;
|
|
675
|
-
/** Remove every row. */
|
|
676
|
-
remove(): void;
|
|
677
|
-
/** Remove one row. */
|
|
678
|
-
remove(key: TableKey): boolean;
|
|
679
|
-
/** Remove several rows. */
|
|
680
|
-
remove(keys: readonly TableKey[]): boolean;
|
|
681
|
-
}
|
|
633
|
+
/**
|
|
634
|
+
* Removes every lens term naming one of the given columns — the drop `sort.remove` and
|
|
635
|
+
* `filter.remove` share.
|
|
636
|
+
*
|
|
637
|
+
* @param current - The list as it stands.
|
|
638
|
+
* @param columns - The column keys to drop.
|
|
639
|
+
* @returns A frozen list holding the entries no named column matched, in their original order.
|
|
640
|
+
*/
|
|
641
|
+
export declare function removeTerms<Term extends TableTerm>(current: readonly Term[], columns: readonly string[]): readonly Term[];
|
|
682
642
|
|
|
683
643
|
/**
|
|
684
|
-
*
|
|
644
|
+
* Manages the rows a table holds, in the order it holds them.
|
|
685
645
|
*
|
|
686
646
|
* @remarks
|
|
687
647
|
* This order is the table's own, and it is what the view shows when no sort term separates two
|
|
@@ -695,20 +655,21 @@ export declare class RowManager implements RowManagerInterface {
|
|
|
695
655
|
*/
|
|
696
656
|
export declare interface RowManagerInterface {
|
|
697
657
|
/**
|
|
698
|
-
*
|
|
658
|
+
* Finds one row by key; `undefined` when the table holds no such key.
|
|
699
659
|
*
|
|
700
660
|
* @param key - The row's key.
|
|
701
661
|
* @returns The row, or `undefined` when the table holds no such key.
|
|
702
662
|
*/
|
|
703
663
|
row(key: TableKey): TableRow | undefined;
|
|
704
664
|
/**
|
|
705
|
-
*
|
|
665
|
+
* Reads every row the table holds, in its own order — unfiltered, unsorted, and unpaged.
|
|
706
666
|
*
|
|
707
|
-
* @returns The rows,
|
|
667
|
+
* @returns The rows, in the order the table holds them.
|
|
708
668
|
*/
|
|
709
669
|
rows(): readonly TableRow[];
|
|
710
670
|
/**
|
|
711
|
-
*
|
|
671
|
+
* Takes in one row or several, appending them in the order given. Every row is checked before
|
|
672
|
+
* any is admitted.
|
|
712
673
|
*
|
|
713
674
|
* @param rows - The rows to admit.
|
|
714
675
|
* @throws A {@link TableError} coded `KEY` when a row's key is missing, unusable, already
|
|
@@ -717,7 +678,7 @@ export declare interface RowManagerInterface {
|
|
|
717
678
|
*/
|
|
718
679
|
add(rows: readonly TableRow[]): void;
|
|
719
680
|
/**
|
|
720
|
-
*
|
|
681
|
+
* Takes in one row, appending it.
|
|
721
682
|
*
|
|
722
683
|
* @param row - The row to admit.
|
|
723
684
|
* @throws A {@link TableError} coded `KEY` when the row's key is missing, unusable, or already
|
|
@@ -725,93 +686,61 @@ export declare interface RowManagerInterface {
|
|
|
725
686
|
*/
|
|
726
687
|
add(row: TableRow): void;
|
|
727
688
|
/**
|
|
728
|
-
*
|
|
689
|
+
* Writes over one row or several, each found by the key it carries. The cells given replace;
|
|
690
|
+
* the cells left out stay.
|
|
729
691
|
*
|
|
730
692
|
* @param rows - The rows to write, each carrying the key of the row it writes over.
|
|
731
|
-
* @returns
|
|
693
|
+
* @returns True if every key named a row the table holds; false otherwise.
|
|
732
694
|
* @throws A {@link TableError} coded `CELL` when a cell is one its column cannot hold. Every
|
|
733
695
|
* row is checked before any is written, so one refusal writes none of them.
|
|
734
696
|
*/
|
|
735
697
|
update(rows: readonly TableRow[]): boolean;
|
|
736
698
|
/**
|
|
737
|
-
*
|
|
699
|
+
* Writes over one row, found by the key it carries.
|
|
738
700
|
*
|
|
739
701
|
* @remarks
|
|
740
702
|
* The cells given replace the cells held; the cells left out stay as they are. A row's key
|
|
741
703
|
* therefore cannot move, because a different key names a different row.
|
|
742
704
|
*
|
|
743
705
|
* @param row - The cells to write, carrying the key of the row they belong to.
|
|
744
|
-
* @returns
|
|
706
|
+
* @returns True if the key named a row the table holds; false otherwise.
|
|
745
707
|
* @throws A {@link TableError} coded `CELL` when a cell is one its column cannot hold.
|
|
746
708
|
*/
|
|
747
709
|
update(row: TableRow): boolean;
|
|
748
710
|
/**
|
|
749
|
-
*
|
|
711
|
+
* Moves one row to another place in the table's own order, counted from zero and clamped to the
|
|
712
|
+
* rows that exist.
|
|
750
713
|
*
|
|
751
714
|
* @param key - The row's key.
|
|
752
|
-
* @param index - Where to put it, counted from zero and clamped to the rows that exist.
|
|
753
|
-
*
|
|
715
|
+
* @param index - Where to put it, counted from zero and clamped to the rows that exist. `NaN`
|
|
716
|
+
* puts the row first.
|
|
717
|
+
* @returns True if the key named a row the table holds; false otherwise.
|
|
754
718
|
*/
|
|
755
719
|
move(key: TableKey, index: number): boolean;
|
|
756
720
|
/**
|
|
757
|
-
*
|
|
758
|
-
*
|
|
759
|
-
* @remarks
|
|
760
|
-
* Selection and expansion drop the keys they held, because those rows are gone.
|
|
721
|
+
* Takes out every row, one row, or several. Selection and expansion drop the keys of the rows
|
|
722
|
+
* that went.
|
|
761
723
|
*/
|
|
762
724
|
remove(): void;
|
|
763
725
|
/**
|
|
764
|
-
*
|
|
726
|
+
* Takes out one row.
|
|
765
727
|
*
|
|
766
728
|
* @param key - The row's key.
|
|
767
|
-
* @returns
|
|
729
|
+
* @returns True if the key named a row the table holds; false otherwise.
|
|
768
730
|
*/
|
|
769
731
|
remove(key: TableKey): boolean;
|
|
770
732
|
/**
|
|
771
|
-
*
|
|
733
|
+
* Takes out several rows.
|
|
772
734
|
*
|
|
773
735
|
* @param keys - The rows' keys.
|
|
774
|
-
* @returns
|
|
775
|
-
* row goes, so one unknown key leaves the whole call undone.
|
|
736
|
+
* @returns True if every key named a row the table holds; false otherwise. Every key is
|
|
737
|
+
* checked before any row goes, so one unknown key leaves the whole call undone.
|
|
776
738
|
*/
|
|
777
739
|
remove(keys: readonly TableKey[]): boolean;
|
|
778
740
|
}
|
|
779
741
|
|
|
780
|
-
/** The keys of the rows somebody has picked. */
|
|
781
|
-
export declare class SelectionManager implements SelectionManagerInterface {
|
|
782
|
-
#private;
|
|
783
|
-
/**
|
|
784
|
-
* Create a selection manager over one table's private stores.
|
|
785
|
-
*
|
|
786
|
-
* @param emitter - The table's event emitter.
|
|
787
|
-
* @param gate - The table lifecycle gate.
|
|
788
|
-
* @param rows - A read of every row key.
|
|
789
|
-
* @param read - A read of the selected keys.
|
|
790
|
-
* @param write - The selected-key commit boundary.
|
|
791
|
-
*/
|
|
792
|
-
constructor(emitter: Emitter<TableEventMap>, gate: () => void, rows: () => readonly TableKey[], read: () => ReadonlySet<TableKey>, write: (keys: ReadonlySet<TableKey>) => void);
|
|
793
|
-
/** The keys of the rows picked right now. */
|
|
794
|
-
get keys(): ReadonlySet<TableKey>;
|
|
795
|
-
/** Pick every row the table holds. */
|
|
796
|
-
select(): void;
|
|
797
|
-
/** Pick one row. */
|
|
798
|
-
select(key: TableKey): boolean;
|
|
799
|
-
/** Pick several rows. */
|
|
800
|
-
select(keys: readonly TableKey[]): boolean;
|
|
801
|
-
/** Drop every pick. */
|
|
802
|
-
clear(): void;
|
|
803
|
-
/** Drop one pick. */
|
|
804
|
-
clear(key: TableKey): boolean;
|
|
805
|
-
/** Drop several picks. */
|
|
806
|
-
clear(keys: readonly TableKey[]): boolean;
|
|
807
|
-
/** Pick one row or drop it when already picked. */
|
|
808
|
-
toggle(key: TableKey): boolean;
|
|
809
|
-
/** Turn several rows around independently. */
|
|
810
|
-
toggle(keys: readonly TableKey[]): boolean;
|
|
811
|
-
}
|
|
812
|
-
|
|
813
742
|
/**
|
|
814
|
-
*
|
|
743
|
+
* Manages the rows somebody has picked.
|
|
815
744
|
*
|
|
816
745
|
* @remarks
|
|
817
746
|
* Selection holds keys, never rows or positions, so a pick survives a sort, a filter, and a page
|
|
@@ -824,67 +753,71 @@ export declare class SelectionManager implements SelectionManagerInterface {
|
|
|
824
753
|
* ```
|
|
825
754
|
*/
|
|
826
755
|
export declare interface SelectionManagerInterface {
|
|
827
|
-
/**
|
|
756
|
+
/** Holds the keys of the rows picked right now. */
|
|
828
757
|
readonly keys: ReadonlySet<TableKey>;
|
|
829
758
|
/**
|
|
830
|
-
*
|
|
759
|
+
* Picks every row the table holds, one row, or several. Every row, not every visible one.
|
|
831
760
|
*
|
|
832
761
|
* @remarks
|
|
833
|
-
*
|
|
834
|
-
* instead.
|
|
762
|
+
* A host picking one page hands that page's keys over instead.
|
|
835
763
|
*/
|
|
836
764
|
select(): void;
|
|
837
765
|
/**
|
|
838
|
-
*
|
|
766
|
+
* Picks one row.
|
|
839
767
|
*
|
|
840
768
|
* @param key - The row's key.
|
|
841
|
-
* @returns
|
|
769
|
+
* @returns True if the key named a row the table holds; false otherwise.
|
|
842
770
|
*/
|
|
843
771
|
select(key: TableKey): boolean;
|
|
844
772
|
/**
|
|
845
|
-
*
|
|
773
|
+
* Picks several rows.
|
|
846
774
|
*
|
|
847
775
|
* @param keys - The rows' keys.
|
|
848
|
-
* @returns
|
|
849
|
-
* row is picked.
|
|
776
|
+
* @returns True if every key named a row the table holds; false otherwise. Every key is
|
|
777
|
+
* checked before any row is picked.
|
|
850
778
|
*/
|
|
851
779
|
select(keys: readonly TableKey[]): boolean;
|
|
852
|
-
/**
|
|
780
|
+
/**
|
|
781
|
+
* Drops every pick, one pick, or several. A known key that was not picked still answers `true`.
|
|
782
|
+
*/
|
|
853
783
|
clear(): void;
|
|
854
784
|
/**
|
|
855
|
-
*
|
|
785
|
+
* Drops one pick.
|
|
856
786
|
*
|
|
857
787
|
* @param key - The row's key.
|
|
858
|
-
* @returns
|
|
788
|
+
* @returns True if the key named a row the table holds, whether or not it was
|
|
789
|
+
* picked; false otherwise.
|
|
859
790
|
*/
|
|
860
791
|
clear(key: TableKey): boolean;
|
|
861
792
|
/**
|
|
862
|
-
*
|
|
793
|
+
* Drops several picks.
|
|
863
794
|
*
|
|
864
795
|
* @param keys - The rows' keys.
|
|
865
|
-
* @returns
|
|
866
|
-
* pick is dropped.
|
|
796
|
+
* @returns True if every key named a row the table holds; false otherwise. Every key is
|
|
797
|
+
* checked before any pick is dropped.
|
|
867
798
|
*/
|
|
868
799
|
clear(keys: readonly TableKey[]): boolean;
|
|
869
800
|
/**
|
|
870
|
-
*
|
|
801
|
+
* Picks one row, or drops it when it is already picked; over a list, turns each row around on
|
|
802
|
+
* its own.
|
|
871
803
|
*
|
|
872
804
|
* @param key - The row's key.
|
|
873
|
-
* @returns
|
|
805
|
+
* @returns True if the key named a row the table holds; false otherwise.
|
|
874
806
|
*/
|
|
875
807
|
toggle(key: TableKey): boolean;
|
|
876
808
|
/**
|
|
877
|
-
*
|
|
809
|
+
* Turns several rows around, each on its own.
|
|
878
810
|
*
|
|
879
811
|
* @param keys - The rows' keys.
|
|
880
|
-
* @returns
|
|
881
|
-
* row turns.
|
|
812
|
+
* @returns True if every key named a row the table holds; false otherwise. Every key is
|
|
813
|
+
* checked before any row turns.
|
|
882
814
|
*/
|
|
883
815
|
toggle(keys: readonly TableKey[]): boolean;
|
|
884
816
|
}
|
|
885
817
|
|
|
886
818
|
/**
|
|
887
|
-
*
|
|
819
|
+
* Projects rows into JSON with each row's cells in the schema's column order, dropping every
|
|
820
|
+
* absent cell.
|
|
888
821
|
*
|
|
889
822
|
* @param schema - The schema that fixes cell order.
|
|
890
823
|
* @param rows - The rows to project.
|
|
@@ -893,7 +826,8 @@ export declare interface SelectionManagerInterface {
|
|
|
893
826
|
export declare function serializeRows(schema: TableSchema, rows: readonly TableRow[]): readonly JSONRecord[];
|
|
894
827
|
|
|
895
828
|
/**
|
|
896
|
-
*
|
|
829
|
+
* Projects a schema into JSON in declaration order, dropping every absent member; raises `SCHEMA`
|
|
830
|
+
* for a `meta` it cannot own.
|
|
897
831
|
*
|
|
898
832
|
* @param schema - The schema to project.
|
|
899
833
|
* @returns A deeply owned JSON record with absent members omitted.
|
|
@@ -901,37 +835,8 @@ export declare function serializeRows(schema: TableSchema, rows: readonly TableR
|
|
|
901
835
|
*/
|
|
902
836
|
export declare function serializeTable(schema: TableSchema): JSONRecord;
|
|
903
837
|
|
|
904
|
-
/** The ordered sort terms of one table. */
|
|
905
|
-
export declare class SortManager implements SortManagerInterface {
|
|
906
|
-
#private;
|
|
907
|
-
/**
|
|
908
|
-
* Create a sort manager over one table's private term store.
|
|
909
|
-
*
|
|
910
|
-
* @param schema - The table schema.
|
|
911
|
-
* @param emitter - The table's event emitter.
|
|
912
|
-
* @param gate - The table lifecycle gate.
|
|
913
|
-
* @param read - A read of the current terms.
|
|
914
|
-
* @param write - The term commit boundary.
|
|
915
|
-
*/
|
|
916
|
-
constructor(schema: TableSchema, emitter: Emitter<TableEventMap>, gate: () => void, read: () => readonly TableOrder[], write: (orders: readonly TableOrder[]) => void);
|
|
917
|
-
/** Find one column's sort term. */
|
|
918
|
-
order(column: string): TableOrder | undefined;
|
|
919
|
-
/** Read every sort term as an owned frozen snapshot. */
|
|
920
|
-
orders(): readonly TableOrder[];
|
|
921
|
-
/** Sort by several columns. */
|
|
922
|
-
set(orders: readonly TableOrder[]): void;
|
|
923
|
-
/** Sort by one column. */
|
|
924
|
-
set(order: TableOrder): void;
|
|
925
|
-
/** Stop sorting by every column. */
|
|
926
|
-
remove(): void;
|
|
927
|
-
/** Stop sorting by one column. */
|
|
928
|
-
remove(column: string): boolean;
|
|
929
|
-
/** Stop sorting by several columns. */
|
|
930
|
-
remove(columns: readonly string[]): boolean;
|
|
931
|
-
}
|
|
932
|
-
|
|
933
838
|
/**
|
|
934
|
-
*
|
|
839
|
+
* Manages the order a table reads its rows in.
|
|
935
840
|
*
|
|
936
841
|
* @remarks
|
|
937
842
|
* The table holds one term per column and applies them in the order they were set. Which
|
|
@@ -946,20 +851,21 @@ export declare class SortManager implements SortManagerInterface {
|
|
|
946
851
|
*/
|
|
947
852
|
export declare interface SortManagerInterface {
|
|
948
853
|
/**
|
|
949
|
-
*
|
|
854
|
+
* Finds one column's term; `undefined` when nothing sorts that column.
|
|
950
855
|
*
|
|
951
856
|
* @param column - The column's key.
|
|
952
857
|
* @returns The term, or `undefined` when nothing sorts that column.
|
|
953
858
|
*/
|
|
954
859
|
order(column: string): TableOrder | undefined;
|
|
955
860
|
/**
|
|
956
|
-
*
|
|
861
|
+
* Reads every term the table sorts by, first to last, in the order they decide.
|
|
957
862
|
*
|
|
958
|
-
* @returns The terms
|
|
863
|
+
* @returns The terms the table sorts by.
|
|
959
864
|
*/
|
|
960
865
|
orders(): readonly TableOrder[];
|
|
961
866
|
/**
|
|
962
|
-
*
|
|
867
|
+
* Sorts by one column or several. A term for a column already sorted replaces its direction in
|
|
868
|
+
* place; every other term joins the end. An undeclared column raises `COLUMN`.
|
|
963
869
|
*
|
|
964
870
|
* @param orders - The terms to set. A term for a column already sorted replaces that column's
|
|
965
871
|
* direction in place; every other term joins the end of the list.
|
|
@@ -968,34 +874,38 @@ export declare interface SortManagerInterface {
|
|
|
968
874
|
*/
|
|
969
875
|
set(orders: readonly TableOrder[]): void;
|
|
970
876
|
/**
|
|
971
|
-
*
|
|
877
|
+
* Sorts by one column.
|
|
972
878
|
*
|
|
973
879
|
* @param order - The term to set.
|
|
974
880
|
* @throws A {@link TableError} coded `COLUMN` when the term names a column the schema does not
|
|
975
881
|
* declare.
|
|
976
882
|
*/
|
|
977
883
|
set(order: TableOrder): void;
|
|
978
|
-
/**
|
|
884
|
+
/**
|
|
885
|
+
* Stops sorting by everything, by one column, or by several. An undeclared column returns
|
|
886
|
+
* `false` and stops nothing.
|
|
887
|
+
*/
|
|
979
888
|
remove(): void;
|
|
980
889
|
/**
|
|
981
|
-
*
|
|
890
|
+
* Stops sorting by one column.
|
|
982
891
|
*
|
|
983
892
|
* @param column - The column's key.
|
|
984
|
-
* @returns
|
|
893
|
+
* @returns True if the schema declares that column; false otherwise.
|
|
985
894
|
*/
|
|
986
895
|
remove(column: string): boolean;
|
|
987
896
|
/**
|
|
988
|
-
*
|
|
897
|
+
* Stops sorting by several columns.
|
|
989
898
|
*
|
|
990
899
|
* @param columns - The columns' keys.
|
|
991
|
-
* @returns
|
|
992
|
-
* term goes.
|
|
900
|
+
* @returns True if the schema declares every one of them; false otherwise. Every key is
|
|
901
|
+
* checked before any term goes.
|
|
993
902
|
*/
|
|
994
903
|
remove(columns: readonly string[]): boolean;
|
|
995
904
|
}
|
|
996
905
|
|
|
997
906
|
/**
|
|
998
|
-
*
|
|
907
|
+
* Orders rows by the terms given, stably; a supplied {@link CellComparator} replaces the default
|
|
908
|
+
* per column.
|
|
999
909
|
*
|
|
1000
910
|
* @param schema - The schema that declares the sorted columns.
|
|
1001
911
|
* @param rows - The rows to order.
|
|
@@ -1005,14 +915,17 @@ export declare interface SortManagerInterface {
|
|
|
1005
915
|
*/
|
|
1006
916
|
export declare function sortRows(schema: TableSchema, rows: readonly TableRow[], orders: readonly TableOrder[], comparators?: Readonly<Record<string, CellComparator>>): readonly TableRow[];
|
|
1007
917
|
|
|
1008
|
-
/**
|
|
918
|
+
/** Names the maximum length of any single retained string: 65536 UTF-16 code units. */
|
|
1009
919
|
export declare const STRING_LIMIT = 65536;
|
|
1010
920
|
|
|
1011
|
-
/**
|
|
921
|
+
/**
|
|
922
|
+
* Holds a schema, its rows, and the lens through which they are read, implementing
|
|
923
|
+
* {@link TableInterface} exactly.
|
|
924
|
+
*/
|
|
1012
925
|
export declare class Table implements TableInterface {
|
|
1013
926
|
#private;
|
|
1014
927
|
/**
|
|
1015
|
-
*
|
|
928
|
+
* Opens a table against a schema.
|
|
1016
929
|
*
|
|
1017
930
|
* @param schema - The table declaration to own.
|
|
1018
931
|
* @param options - Initial rows, lens overrides, pagination, and emitter wiring.
|
|
@@ -1020,36 +933,36 @@ export declare class Table implements TableInterface {
|
|
|
1020
933
|
* identity is unusable or repeated, and `CELL` when a seeded cell is invalid.
|
|
1021
934
|
*/
|
|
1022
935
|
constructor(schema: TableSchema, options?: TableOptions);
|
|
1023
|
-
/**
|
|
936
|
+
/** Holds the table's event emitter. */
|
|
1024
937
|
get emitter(): EmitterInterface<TableEventMap>;
|
|
1025
|
-
/**
|
|
938
|
+
/** Holds the owned frozen schema. */
|
|
1026
939
|
get schema(): TableSchema;
|
|
1027
|
-
/**
|
|
940
|
+
/** Manages the rows the table holds. */
|
|
1028
941
|
get rows(): RowManagerInterface;
|
|
1029
|
-
/**
|
|
942
|
+
/** Manages the ordered sort terms. */
|
|
1030
943
|
get sort(): SortManagerInterface;
|
|
1031
|
-
/**
|
|
944
|
+
/** Manages the filters applied with and-only composition. */
|
|
1032
945
|
get filter(): FilterManagerInterface;
|
|
1033
|
-
/**
|
|
946
|
+
/** Manages the selected row keys. */
|
|
1034
947
|
get selection(): SelectionManagerInterface;
|
|
1035
|
-
/**
|
|
948
|
+
/** Manages the expanded row keys. */
|
|
1036
949
|
get expansion(): ExpansionManagerInterface;
|
|
1037
|
-
/**
|
|
950
|
+
/** Manages the page arithmetic. */
|
|
1038
951
|
get pagination(): PaginationManagerInterface;
|
|
1039
|
-
/**
|
|
952
|
+
/** Returns the filtered, sorted, and paged rows as owned frozen snapshots. */
|
|
1040
953
|
get view(): readonly TableRow[];
|
|
1041
|
-
/**
|
|
954
|
+
/** Returns the number of rows admitted by the filters. */
|
|
1042
955
|
get count(): number;
|
|
1043
|
-
/**
|
|
956
|
+
/** Reports whether the table has been torn down. */
|
|
1044
957
|
get destroyed(): boolean;
|
|
1045
|
-
/**
|
|
958
|
+
/** Resets every moving axis to its opening state. */
|
|
1046
959
|
clear(): void;
|
|
1047
|
-
/**
|
|
960
|
+
/** Tears the table down while leaving every getter readable. */
|
|
1048
961
|
destroy(): void;
|
|
1049
962
|
}
|
|
1050
963
|
|
|
1051
964
|
/**
|
|
1052
|
-
*
|
|
965
|
+
* Represents every value a cell can hold — a `string`, a `number`, or a `boolean`.
|
|
1053
966
|
*
|
|
1054
967
|
* @remarks
|
|
1055
968
|
* The variant follows the column: `text` and `choice` hold a `string`, `number` holds a `number`,
|
|
@@ -1059,11 +972,10 @@ export declare class Table implements TableInterface {
|
|
|
1059
972
|
export declare type TableCell = string | number | boolean;
|
|
1060
973
|
|
|
1061
974
|
/**
|
|
1062
|
-
*
|
|
975
|
+
* Represents any column a schema can declare — the union discriminated on `cell`.
|
|
1063
976
|
*
|
|
1064
977
|
* @remarks
|
|
1065
|
-
*
|
|
1066
|
-
* members.
|
|
978
|
+
* Narrowing on `cell` reaches each variant's own members.
|
|
1067
979
|
*
|
|
1068
980
|
* @example
|
|
1069
981
|
* ```ts
|
|
@@ -1075,22 +987,24 @@ export declare type TableCell = string | number | boolean;
|
|
|
1075
987
|
export declare type TableColumn = TextColumn | NumberColumn | FlagColumn | ChoiceColumn;
|
|
1076
988
|
|
|
1077
989
|
/**
|
|
1078
|
-
*
|
|
990
|
+
* Names which way a column sorts. A column nobody has sorted carries no term at all.
|
|
1079
991
|
*
|
|
1080
992
|
* @remarks
|
|
1081
|
-
*
|
|
1082
|
-
* standing for unsorted.
|
|
993
|
+
* No member of this union stands for unsorted; that state is the missing {@link TableOrder}.
|
|
1083
994
|
*/
|
|
1084
995
|
export declare type TableDirection = 'ascending' | 'descending';
|
|
1085
996
|
|
|
1086
|
-
/**
|
|
997
|
+
/**
|
|
998
|
+
* Represents an error raised by the table domain — a machine-readable `code` and optional
|
|
999
|
+
* structured `context`.
|
|
1000
|
+
*/
|
|
1087
1001
|
export declare class TableError extends Error {
|
|
1088
|
-
/**
|
|
1002
|
+
/** Holds the machine-readable reason for this failure. */
|
|
1089
1003
|
readonly code: TableErrorCode;
|
|
1090
|
-
/**
|
|
1004
|
+
/** Holds structured values that locate or explain this failure. */
|
|
1091
1005
|
readonly context?: JSONRecord;
|
|
1092
1006
|
/**
|
|
1093
|
-
*
|
|
1007
|
+
* Creates a table error.
|
|
1094
1008
|
*
|
|
1095
1009
|
* @param code - The machine-readable reason.
|
|
1096
1010
|
* @param message - The human-readable failure text.
|
|
@@ -1100,7 +1014,7 @@ export declare class TableError extends Error {
|
|
|
1100
1014
|
}
|
|
1101
1015
|
|
|
1102
1016
|
/**
|
|
1103
|
-
*
|
|
1017
|
+
* Names the reason a {@link TableError} carries — the machine-readable code a `catch` branches on.
|
|
1104
1018
|
*
|
|
1105
1019
|
* @remarks
|
|
1106
1020
|
* `SCHEMA` rejects a malformed schema, including a `key` naming no declared column. `COLUMN`
|
|
@@ -1111,7 +1025,7 @@ export declare class TableError extends Error {
|
|
|
1111
1025
|
export declare type TableErrorCode = 'SCHEMA' | 'COLUMN' | 'KEY' | 'CELL' | 'DESTROYED';
|
|
1112
1026
|
|
|
1113
1027
|
/**
|
|
1114
|
-
*
|
|
1028
|
+
* Lists everything a table announces, mapping each event to the payload its listeners receive.
|
|
1115
1029
|
*
|
|
1116
1030
|
* @remarks
|
|
1117
1031
|
* Every event fires after the state it reports is committed, and only when something actually
|
|
@@ -1141,11 +1055,11 @@ export declare type TableEventMap = {
|
|
|
1141
1055
|
};
|
|
1142
1056
|
|
|
1143
1057
|
/**
|
|
1144
|
-
*
|
|
1058
|
+
* Represents any filter a table can hold — the union discriminated on `operator`.
|
|
1145
1059
|
*
|
|
1146
1060
|
* @remarks
|
|
1147
|
-
*
|
|
1148
|
-
*
|
|
1061
|
+
* Each operator carries only the operands it uses, so a `between` missing a bound cannot be
|
|
1062
|
+
* written down.
|
|
1149
1063
|
*
|
|
1150
1064
|
* A table holds at most one filter per column and keeps every row all of them accept. There is no
|
|
1151
1065
|
* either-or composition in this version.
|
|
@@ -1158,15 +1072,15 @@ export declare type TableEventMap = {
|
|
|
1158
1072
|
export declare type TableFilter = ContainsFilter | BetweenFilter | EqualsFilter;
|
|
1159
1073
|
|
|
1160
1074
|
/**
|
|
1161
|
-
*
|
|
1075
|
+
* Represents a table: what it declares, the rows it holds, and the lens it reads them through.
|
|
1162
1076
|
*
|
|
1163
1077
|
* @remarks
|
|
1164
1078
|
* The table owns values, not pixels. It renders nothing, reads no document, and names no host
|
|
1165
1079
|
* type, so one table serves a browser, a terminal, a report, and an export equally.
|
|
1166
1080
|
*
|
|
1167
|
-
*
|
|
1168
|
-
* `
|
|
1169
|
-
*
|
|
1081
|
+
* One manager holds each axis that moves: `rows`, `sort`, `filter`, `selection`, `expansion`, and
|
|
1082
|
+
* `pagination`. Nothing else is stored. `view` and `count` are worked out when they are read, so no
|
|
1083
|
+
* second copy of the answer can go stale.
|
|
1170
1084
|
*
|
|
1171
1085
|
* A write validates all of itself before any of it lands, and announces itself once it has.
|
|
1172
1086
|
*
|
|
@@ -1178,59 +1092,60 @@ export declare type TableFilter = ContainsFilter | BetweenFilter | EqualsFilter;
|
|
|
1178
1092
|
* ```
|
|
1179
1093
|
*/
|
|
1180
1094
|
export declare interface TableInterface {
|
|
1181
|
-
/**
|
|
1095
|
+
/** Holds the table's event emitter. */
|
|
1182
1096
|
readonly emitter: EmitterInterface<TableEventMap>;
|
|
1183
|
-
/**
|
|
1097
|
+
/** Holds what this table declares. */
|
|
1184
1098
|
readonly schema: TableSchema;
|
|
1185
|
-
/**
|
|
1099
|
+
/** Manages the rows the table holds. */
|
|
1186
1100
|
readonly rows: RowManagerInterface;
|
|
1187
|
-
/**
|
|
1101
|
+
/** Manages the order the table reads them in. */
|
|
1188
1102
|
readonly sort: SortManagerInterface;
|
|
1189
|
-
/**
|
|
1103
|
+
/** Manages which of them the table keeps. */
|
|
1190
1104
|
readonly filter: FilterManagerInterface;
|
|
1191
|
-
/**
|
|
1105
|
+
/** Manages the ones somebody has picked. */
|
|
1192
1106
|
readonly selection: SelectionManagerInterface;
|
|
1193
|
-
/**
|
|
1107
|
+
/** Manages the ones somebody has opened up. */
|
|
1194
1108
|
readonly expansion: ExpansionManagerInterface;
|
|
1195
|
-
/**
|
|
1109
|
+
/** Manages which stretch of them the view shows. */
|
|
1196
1110
|
readonly pagination: PaginationManagerInterface;
|
|
1197
1111
|
/**
|
|
1198
|
-
*
|
|
1112
|
+
* Returns the rows to draw right now: filtered, then sorted, then paged.
|
|
1199
1113
|
*
|
|
1200
1114
|
* @remarks
|
|
1201
1115
|
* It is worked out on every read and never stored, so it is right the instant anything moves.
|
|
1202
1116
|
*/
|
|
1203
1117
|
readonly view: readonly TableRow[];
|
|
1204
|
-
/**
|
|
1118
|
+
/** Counts the rows the filter admits, before the page narrows them. */
|
|
1205
1119
|
readonly count: number;
|
|
1206
|
-
/**
|
|
1120
|
+
/** Reports whether the table has been torn down. */
|
|
1207
1121
|
readonly destroyed: boolean;
|
|
1208
1122
|
/**
|
|
1209
|
-
*
|
|
1123
|
+
* Puts the table back the way it opened, holding nothing. Rows, sort, filter, selection,
|
|
1124
|
+
* expansion, and the page all reset.
|
|
1210
1125
|
*
|
|
1211
1126
|
* @remarks
|
|
1212
|
-
*
|
|
1213
|
-
*
|
|
1127
|
+
* The table emits `clear` and nothing else, so a reset of ten thousand rows is one
|
|
1128
|
+
* announcement.
|
|
1214
1129
|
*/
|
|
1215
1130
|
clear(): void;
|
|
1216
1131
|
/**
|
|
1217
|
-
*
|
|
1132
|
+
* Tears the table down. Idempotent; afterwards every write raises `DESTROYED` and every getter
|
|
1133
|
+
* still answers.
|
|
1218
1134
|
*
|
|
1219
1135
|
* @remarks
|
|
1220
|
-
*
|
|
1221
|
-
*
|
|
1222
|
-
* held, so a host can read its way out of teardown without catching anything.
|
|
1136
|
+
* The write throws a {@link TableError} carrying that code, and what a getter answers is what
|
|
1137
|
+
* the table last held, so a host can read its way out of teardown without catching anything.
|
|
1223
1138
|
*/
|
|
1224
1139
|
destroy(): void;
|
|
1225
1140
|
}
|
|
1226
1141
|
|
|
1227
1142
|
/**
|
|
1228
|
-
*
|
|
1143
|
+
* Represents a row's identity — a `string`, carried in the cell the schema's `key` names.
|
|
1229
1144
|
*
|
|
1230
1145
|
* @remarks
|
|
1231
|
-
*
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1146
|
+
* The identity must be non-empty. A column's own identifier is a plain `string`; this names a row.
|
|
1147
|
+
* Selection and expansion hold these keys and nothing else, so a row keeps its selection through a
|
|
1148
|
+
* re-sort.
|
|
1234
1149
|
*
|
|
1235
1150
|
* @example
|
|
1236
1151
|
* ```ts
|
|
@@ -1240,9 +1155,10 @@ export declare interface TableInterface {
|
|
|
1240
1155
|
export declare type TableKey = string;
|
|
1241
1156
|
|
|
1242
1157
|
/**
|
|
1243
|
-
*
|
|
1158
|
+
* Describes how to open a table — the listeners wired at construction and where a throw from one
|
|
1159
|
+
* goes, the rows seeded into it, the per-column comparison and test replacements, and the page
|
|
1160
|
+
* size.
|
|
1244
1161
|
*
|
|
1245
|
-
* @param options - The table's settings.
|
|
1246
1162
|
* @remarks
|
|
1247
1163
|
* `on` wires listeners at construction and `error` receives any throw from one of them.
|
|
1248
1164
|
*
|
|
@@ -1275,11 +1191,12 @@ export declare interface TableOptions {
|
|
|
1275
1191
|
}
|
|
1276
1192
|
|
|
1277
1193
|
/**
|
|
1278
|
-
*
|
|
1194
|
+
* Represents one column's place in the sort — the `column` and its `direction`. The list is read
|
|
1195
|
+
* left to right.
|
|
1279
1196
|
*
|
|
1280
1197
|
* @remarks
|
|
1281
|
-
* The
|
|
1282
|
-
*
|
|
1198
|
+
* The first term decides, and each later term breaks the tie the terms before it left. Rows no
|
|
1199
|
+
* term separates keep the order the table holds them in.
|
|
1283
1200
|
*
|
|
1284
1201
|
* @example
|
|
1285
1202
|
* ```ts
|
|
@@ -1292,12 +1209,11 @@ export declare interface TableOrder {
|
|
|
1292
1209
|
}
|
|
1293
1210
|
|
|
1294
1211
|
/**
|
|
1295
|
-
*
|
|
1212
|
+
* Represents one row, keyed by column. A column nobody has filled has no key here.
|
|
1296
1213
|
*
|
|
1297
1214
|
* @remarks
|
|
1298
|
-
* A row
|
|
1299
|
-
*
|
|
1300
|
-
* holds afterwards can move a stored row.
|
|
1215
|
+
* A row carries no key the schema does not declare, and the table clones and freezes it at
|
|
1216
|
+
* admission, so nothing a caller holds afterwards can move a stored row.
|
|
1301
1217
|
*
|
|
1302
1218
|
* @example
|
|
1303
1219
|
* ```ts
|
|
@@ -1307,7 +1223,8 @@ export declare interface TableOrder {
|
|
|
1307
1223
|
export declare type TableRow = Readonly<Record<string, TableCell>>;
|
|
1308
1224
|
|
|
1309
1225
|
/**
|
|
1310
|
-
*
|
|
1226
|
+
* Holds everything a table declares about itself — how the table is described, which column
|
|
1227
|
+
* carries row identity, and the columns it declares, in the order it declares them.
|
|
1311
1228
|
*
|
|
1312
1229
|
* @remarks
|
|
1313
1230
|
* The schema is data. It carries no function, so all of it crosses a wire and nothing is dropped
|
|
@@ -1342,10 +1259,28 @@ export declare interface TableSchema {
|
|
|
1342
1259
|
readonly columns: readonly TableColumn[];
|
|
1343
1260
|
}
|
|
1344
1261
|
|
|
1345
|
-
/**
|
|
1262
|
+
/**
|
|
1263
|
+
* Represents one entry of a lens list — the `column` it names. A sort term and a filter each hold
|
|
1264
|
+
* one, which is why the two share a list engine.
|
|
1265
|
+
*
|
|
1266
|
+
* @remarks
|
|
1267
|
+
* A table holds at most one sort term and at most one filter per column, so `column` is what
|
|
1268
|
+
* places an entry in either list. {@link mergeTerms}, {@link removeTerms}, and
|
|
1269
|
+
* {@link matchesTerms} work over this shape alone, so each list keeps its own operands.
|
|
1270
|
+
*/
|
|
1271
|
+
export declare interface TableTerm {
|
|
1272
|
+
readonly column: string;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* Names the maximum total length of every string one schema retains: 1048576 UTF-16 code units.
|
|
1277
|
+
*/
|
|
1346
1278
|
export declare const TEXT_LIMIT = 1048576;
|
|
1347
1279
|
|
|
1348
|
-
/**
|
|
1280
|
+
/**
|
|
1281
|
+
* Represents a column of text, compared lexically. Carries a date, a time, and a timestamp as ISO
|
|
1282
|
+
* strings.
|
|
1283
|
+
*/
|
|
1349
1284
|
export declare interface TextColumn extends ColumnBase {
|
|
1350
1285
|
readonly cell: 'text';
|
|
1351
1286
|
}
|