tinybase 6.1.0-beta.1 → 6.1.0-beta.3

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.
Files changed (108) hide show
  1. package/@types/common/index.d.ts +4 -4
  2. package/@types/common/with-schemas/index.d.ts +4 -4
  3. package/@types/mergeable-store/index.d.ts +45 -20
  4. package/@types/mergeable-store/with-schemas/index.d.ts +49 -21
  5. package/@types/persisters/index.d.ts +1 -1
  6. package/@types/persisters/with-schemas/index.d.ts +1 -1
  7. package/index.js +19 -11
  8. package/indexes/index.js +15 -3
  9. package/indexes/with-schemas/index.js +15 -3
  10. package/mergeable-store/index.js +4 -8
  11. package/mergeable-store/with-schemas/index.js +4 -8
  12. package/min/index.js +1 -1
  13. package/min/index.js.gz +0 -0
  14. package/min/indexes/index.js +1 -1
  15. package/min/indexes/index.js.gz +0 -0
  16. package/min/indexes/with-schemas/index.js +1 -1
  17. package/min/indexes/with-schemas/index.js.gz +0 -0
  18. package/min/mergeable-store/index.js +1 -1
  19. package/min/mergeable-store/index.js.gz +0 -0
  20. package/min/mergeable-store/with-schemas/index.js +1 -1
  21. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  22. package/min/with-schemas/index.js +1 -1
  23. package/min/with-schemas/index.js.gz +0 -0
  24. package/package.json +9 -9
  25. package/readme.md +2 -2
  26. package/with-schemas/index.js +19 -11
  27. package/@types/_internal/queries/index.d.cts +0 -0
  28. package/@types/_internal/queries/with-schemas/index.d.cts +0 -22
  29. package/@types/_internal/store/index.d.cts +0 -3
  30. package/@types/_internal/store/with-schemas/index.d.cts +0 -106
  31. package/@types/_internal/ui-react/index.d.cts +0 -0
  32. package/@types/_internal/ui-react/with-schemas/index.d.cts +0 -1130
  33. package/@types/checkpoints/index.d.cts +0 -1059
  34. package/@types/checkpoints/with-schemas/index.d.cts +0 -1151
  35. package/@types/common/index.d.cts +0 -158
  36. package/@types/common/with-schemas/index.d.cts +0 -158
  37. package/@types/index.d.cts +0 -17
  38. package/@types/indexes/index.d.cts +0 -1064
  39. package/@types/indexes/with-schemas/index.d.cts +0 -1210
  40. package/@types/mergeable-store/index.d.cts +0 -1139
  41. package/@types/mergeable-store/with-schemas/index.d.cts +0 -1628
  42. package/@types/metrics/index.d.cts +0 -917
  43. package/@types/metrics/with-schemas/index.d.cts +0 -1004
  44. package/@types/persisters/index.d.cts +0 -1877
  45. package/@types/persisters/persister-automerge/index.d.cts +0 -165
  46. package/@types/persisters/persister-automerge/with-schemas/index.d.cts +0 -180
  47. package/@types/persisters/persister-browser/index.d.cts +0 -185
  48. package/@types/persisters/persister-browser/with-schemas/index.d.cts +0 -208
  49. package/@types/persisters/persister-cr-sqlite-wasm/index.d.cts +0 -159
  50. package/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.cts +0 -178
  51. package/@types/persisters/persister-durable-object-storage/index.d.cts +0 -122
  52. package/@types/persisters/persister-durable-object-storage/with-schemas/index.d.cts +0 -136
  53. package/@types/persisters/persister-electric-sql/index.d.cts +0 -185
  54. package/@types/persisters/persister-electric-sql/with-schemas/index.d.cts +0 -204
  55. package/@types/persisters/persister-expo-sqlite/index.d.cts +0 -186
  56. package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.cts +0 -205
  57. package/@types/persisters/persister-file/index.d.cts +0 -94
  58. package/@types/persisters/persister-file/with-schemas/index.d.cts +0 -107
  59. package/@types/persisters/persister-indexed-db/index.d.cts +0 -120
  60. package/@types/persisters/persister-indexed-db/with-schemas/index.d.cts +0 -135
  61. package/@types/persisters/persister-libsql/index.d.cts +0 -158
  62. package/@types/persisters/persister-libsql/with-schemas/index.d.cts +0 -177
  63. package/@types/persisters/persister-partykit-client/index.d.cts +0 -195
  64. package/@types/persisters/persister-partykit-client/with-schemas/index.d.cts +0 -210
  65. package/@types/persisters/persister-partykit-server/index.d.cts +0 -650
  66. package/@types/persisters/persister-partykit-server/with-schemas/index.d.cts +0 -695
  67. package/@types/persisters/persister-pglite/index.d.cts +0 -177
  68. package/@types/persisters/persister-pglite/with-schemas/index.d.cts +0 -196
  69. package/@types/persisters/persister-postgres/index.d.cts +0 -166
  70. package/@types/persisters/persister-postgres/with-schemas/index.d.cts +0 -185
  71. package/@types/persisters/persister-powersync/index.d.cts +0 -174
  72. package/@types/persisters/persister-powersync/with-schemas/index.d.cts +0 -193
  73. package/@types/persisters/persister-remote/index.d.cts +0 -117
  74. package/@types/persisters/persister-remote/with-schemas/index.d.cts +0 -133
  75. package/@types/persisters/persister-sqlite-wasm/index.d.cts +0 -175
  76. package/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.cts +0 -195
  77. package/@types/persisters/persister-sqlite3/index.d.cts +0 -176
  78. package/@types/persisters/persister-sqlite3/with-schemas/index.d.cts +0 -195
  79. package/@types/persisters/persister-yjs/index.d.cts +0 -161
  80. package/@types/persisters/persister-yjs/with-schemas/index.d.cts +0 -176
  81. package/@types/persisters/with-schemas/index.d.cts +0 -2054
  82. package/@types/queries/index.d.cts +0 -3695
  83. package/@types/queries/with-schemas/index.d.cts +0 -4016
  84. package/@types/relationships/index.d.cts +0 -1320
  85. package/@types/relationships/with-schemas/index.d.cts +0 -1474
  86. package/@types/store/index.d.cts +0 -7598
  87. package/@types/store/with-schemas/index.d.cts +0 -9278
  88. package/@types/synchronizers/index.d.cts +0 -485
  89. package/@types/synchronizers/synchronizer-broadcast-channel/index.d.cts +0 -121
  90. package/@types/synchronizers/synchronizer-broadcast-channel/with-schemas/index.d.cts +0 -137
  91. package/@types/synchronizers/synchronizer-local/index.d.cts +0 -95
  92. package/@types/synchronizers/synchronizer-local/with-schemas/index.d.cts +0 -114
  93. package/@types/synchronizers/synchronizer-ws-client/index.d.cts +0 -160
  94. package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.cts +0 -179
  95. package/@types/synchronizers/synchronizer-ws-server/index.d.cts +0 -736
  96. package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +0 -765
  97. package/@types/synchronizers/synchronizer-ws-server-durable-object/index.d.cts +0 -311
  98. package/@types/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.d.cts +0 -349
  99. package/@types/synchronizers/synchronizer-ws-server-simple/index.d.cts +0 -144
  100. package/@types/synchronizers/synchronizer-ws-server-simple/with-schemas/index.d.cts +0 -144
  101. package/@types/synchronizers/with-schemas/index.d.cts +0 -503
  102. package/@types/ui-react/index.d.cts +0 -16640
  103. package/@types/ui-react/with-schemas/index.d.cts +0 -17281
  104. package/@types/ui-react-dom/index.d.cts +0 -1862
  105. package/@types/ui-react-dom/with-schemas/index.d.cts +0 -1994
  106. package/@types/ui-react-inspector/index.d.cts +0 -79
  107. package/@types/ui-react-inspector/with-schemas/index.d.cts +0 -1985
  108. package/@types/with-schemas/index.d.cts +0 -17
@@ -1,1862 +0,0 @@
1
- /**
2
- * The ui-react-dom module of the TinyBase project provides components to make
3
- * it easy to create web-based reactive apps with Store objects.
4
- *
5
- * The components in this module use the react-dom module and so are not
6
- * appropriate for environments like React Native (although those in the
7
- * lower-level ui-react module are).
8
- * @see UI Components demos
9
- * @packageDocumentation
10
- * @module ui-react-dom
11
- * @since v4.1.0
12
- */
13
- import type {ComponentType} from 'react';
14
- import type {Id, Ids} from '../common/index.d.cts';
15
- import type {
16
- CellProps,
17
- ComponentReturnType,
18
- ExtraProps,
19
- IndexesOrIndexesId,
20
- QueriesOrQueriesId,
21
- RelationshipsOrRelationshipsId,
22
- ResultCellProps,
23
- StoreOrStoreId,
24
- ValueProps,
25
- } from '../ui-react/index.d.cts';
26
-
27
- /**
28
- * The CustomCell object is used to configure custom cell rendering in an HTML
29
- * table.
30
- * @category Configuration
31
- * @since v4.1.0
32
- */
33
- export type CustomCell = {
34
- /**
35
- * An optional string that will be used as the label at the top of the table
36
- * column for this Cell.
37
- * @category Prop
38
- * @since v4.1.0
39
- */
40
- label?: string;
41
- /**
42
- * An optional custom component for rendering each Cell in the Table (to
43
- * override the default CellView component).
44
- * @category Prop
45
- * @since v4.1.0
46
- */
47
- component?: ComponentType<CellProps>;
48
- /**
49
- * An optional function for generating extra props for each custom Cell
50
- * component based on Row and Cell Id.
51
- * @category Prop
52
- * @since v4.1.0
53
- */
54
- getComponentProps?: (rowId: Id, cellId: Id) => ExtraProps;
55
- };
56
-
57
- /**
58
- * The CustomResultCell object is used to configure custom cell rendering for
59
- * query results in an HTML table.
60
- * @category Configuration
61
- * @since v4.1.0
62
- */
63
- export type CustomResultCell = {
64
- /**
65
- * An optional string that will be used as the label at the top of the table
66
- * column for this Cell.
67
- * @category Prop
68
- * @since v4.1.0
69
- */
70
- label?: string;
71
- /**
72
- * An optional custom component for rendering each Cell in the ResultTable (to
73
- * override the default ResultCellView component).
74
- * @category Prop
75
- * @since v4.1.0
76
- */
77
- component?: ComponentType<ResultCellProps>;
78
- /**
79
- * An optional function for generating extra props for each custom Cell
80
- * component based on Row and Cell Id.
81
- * @category Prop
82
- * @since v4.1.0
83
- */
84
- getComponentProps?: (rowId: Id, cellId: Id) => ExtraProps;
85
- };
86
-
87
- /**
88
- * HtmlTableProps props are used for components that will render in an HTML
89
- * table, such as the TableInHtmlTable component or SortedTableInHtmlTable
90
- * component.
91
- * @category Props
92
- * @since v4.1.0
93
- */
94
- export type HtmlTableProps = {
95
- /**
96
- * A string className to use on the root of the resulting element.
97
- * @category Prop
98
- * @since v4.1.0
99
- */
100
- readonly className?: string;
101
- /**
102
- * Whether a header row should be rendered at the top of the table, defaulting
103
- * to `true`.
104
- * @category Prop
105
- * @since v4.1.0
106
- */
107
- readonly headerRow?: boolean;
108
- /**
109
- * Whether an Id column should be rendered on the left of the table,
110
- * defaulting to `true`.
111
- * @category Prop
112
- * @since v4.1.0
113
- */
114
- readonly idColumn?: boolean;
115
- };
116
-
117
- /**
118
- * TableInHtmlTableProps props are used for components that will render a Table
119
- * in an HTML table, such as the TableInHtmlTable component.
120
- * @category Props
121
- * @since v4.1.0
122
- */
123
- export type TableInHtmlTableProps = {
124
- /**
125
- * The Id of the Table in the Store to be rendered.
126
- * @category Prop
127
- * @since v4.1.0
128
- */
129
- readonly tableId: Id;
130
- /**
131
- * The Store to be accessed: omit for the default context Store, provide an Id
132
- * for a named context Store, or provide an explicit reference.
133
- * @category Prop
134
- * @since v4.1.0
135
- */
136
- readonly store?: StoreOrStoreId;
137
- /**
138
- * Whether the Cells should be editable. This affects the default CellView
139
- * component (to use the EditableCellView component instead) but of course
140
- * will not affect custom Cell components if you have set them.
141
- * @category Prop
142
- * @since v4.1.0
143
- */
144
- readonly editable?: boolean;
145
- /**
146
- * An optional list of Cell Ids to use for rendering a prescribed set of the
147
- * Table's Cells in a given order. This can also be an object with the desired
148
- * Cell Ids as keys, and with a value that can either be a string label to
149
- * show in the column header, or a CustomCell object to further configure the
150
- * column.
151
- * @category Prop
152
- * @since v4.1.0
153
- */
154
- readonly customCells?: Ids | {[cellId: Id]: string | CustomCell};
155
- };
156
-
157
- /**
158
- * SortedTableInHtmlTableProps props are used for components that will render a
159
- * sorted Table in an HTML table, such as the SortedTableInHtmlTable component.
160
- * @category Props
161
- * @since v4.1.0
162
- */
163
- export type SortedTableInHtmlTableProps = {
164
- /**
165
- * The Id of the Table in the Store to be rendered.
166
- * @category Prop
167
- * @since v4.1.0
168
- */
169
- readonly tableId: Id;
170
- /**
171
- * The Id of the Cell whose values are used for the sorting. If omitted, the
172
- * view will sort the Row Id itself.
173
- * @category Prop
174
- * @since v4.1.0
175
- */
176
- readonly cellId?: Id;
177
- /**
178
- * Whether the sorting should be in descending order.
179
- * @category Prop
180
- * @since v4.1.0
181
- */
182
- readonly descending?: boolean;
183
- /**
184
- * The number of Row Ids to skip for pagination purposes.
185
- * @category Prop
186
- * @since v4.1.0
187
- */
188
- readonly offset?: number;
189
- /**
190
- * The maximum number of Row Ids to return.
191
- * @category Prop
192
- * @since v4.1.0
193
- */
194
- readonly limit?: number;
195
- /**
196
- * The Store to be accessed: omit for the default context Store, provide an Id
197
- * for a named context Store, or provide an explicit reference.
198
- * @category Prop
199
- * @since v4.1.0
200
- */
201
- readonly store?: StoreOrStoreId;
202
- /**
203
- * Whether the Cells should be editable. This affects the default CellView
204
- * component (to use the EditableCellView component instead) but of course
205
- * will not affect custom Cell components if you have set them.
206
- * @category Prop
207
- * @since v4.1.0
208
- */
209
- readonly editable?: boolean;
210
- /**
211
- * An optional list of Cell Ids to use for rendering a prescribed set of the
212
- * Table's Cells in a given order. This can also be an object with the desired
213
- * Cell Ids as keys, and with a value that can either be a string label to
214
- * show in the column header, or a CustomCell object to further configure the
215
- * column.
216
- * @category Prop
217
- * @since v4.1.0
218
- */
219
- readonly customCells?: Ids | {[cellId: Id]: string | CustomCell};
220
- /**
221
- * Whether the table should be interactive such that clicking a header changes
222
- * the sorting and/or direction.
223
- * @category Prop
224
- * @since v4.1.0
225
- */
226
- readonly sortOnClick?: boolean;
227
- /**
228
- * Either `true` to show the default SortedTablePaginator for the Table, or
229
- * provide your own paginator component that takes SortedTablePaginatorProps.
230
- * @category Prop
231
- * @since v4.1.0
232
- */
233
- readonly paginator?: boolean | ComponentType<SortedTablePaginatorProps>;
234
- /**
235
- * A function that is called whenever the sorting or pagination of the Table
236
- * is changed by the user, invoked with the sorted Cell Id, whether descending
237
- * or not, and the offset of the pagination.
238
- * @category Prop
239
- * @since v4.1.0
240
- */
241
- readonly onChange?: (
242
- sortAndOffset: [
243
- cellId: Id | undefined,
244
- descending: boolean,
245
- offset: number,
246
- ],
247
- ) => void;
248
- };
249
-
250
- /**
251
- * ValuesInHtmlTableProps props are used for components that will render Values
252
- * in an HTML table, such as the ValuesInHtmlTable component.
253
- * @category Props
254
- * @since v4.1.0
255
- */
256
- export type ValuesInHtmlTableProps = {
257
- /**
258
- * The Store to be accessed: omit for the default context Store, provide an Id
259
- * for a named context Store, or provide an explicit reference.
260
- * @category Prop
261
- * @since v4.1.0
262
- */
263
- readonly store?: StoreOrStoreId;
264
- /**
265
- * Whether the Values should be editable. This affects the default ValueView
266
- * component (to use the EditableValueView component instead) but of course
267
- * will not affect a custom valueComponent if you have set one.
268
- * @category Prop
269
- * @since v4.1.0
270
- */
271
- readonly editable?: boolean;
272
- /**
273
- * A custom component for rendering each Value in the Store (to override the
274
- * default ValueView component).
275
- * @category Prop
276
- * @since v4.1.0
277
- */
278
- readonly valueComponent?: ComponentType<ValueProps>;
279
- /**
280
- * A function for generating extra props for each custom Value component based
281
- * on its Id.
282
- * @category Prop
283
- * @since v4.1.0
284
- */
285
- readonly getValueComponentProps?: (valueId: Id) => ExtraProps;
286
- };
287
-
288
- /**
289
- * SliceInHtmlTableProps props are used for components that will render an Index
290
- * Slice in an HTML table, such as the SliceInHtmlTable component.
291
- * @category Props
292
- * @since v4.1.0
293
- */
294
- export type SliceInHtmlTableProps = {
295
- /**
296
- * The Id of the Index in the Indexes object.
297
- * @category Prop
298
- * @since v4.1.0
299
- */
300
- readonly indexId: Id;
301
- /**
302
- * The Id of the Slice in the Index to be rendered.
303
- * @category Prop
304
- * @since v4.1.0
305
- */
306
- readonly sliceId: Id;
307
- /**
308
- * The Indexes object to be accessed: omit for the default context Indexes
309
- * object, provide an Id for a named context Indexes object, or provide an
310
- * explicit reference.
311
- * @category Prop
312
- * @since v4.1.0
313
- */
314
- readonly indexes?: IndexesOrIndexesId;
315
- /**
316
- * Whether the Cells should be editable. This affects the default CellView
317
- * component (to use the EditableCellView component instead) but of course
318
- * will not affect custom Cell components if you have set them.
319
- * @category Prop
320
- * @since v4.1.0
321
- */
322
- readonly editable?: boolean;
323
- /**
324
- * An optional list of Cell Ids to use for rendering a prescribed set of the
325
- * Slice's Cells in a given order. This can also be an object with the desired
326
- * Cell Ids as keys, and with a value that can either be a string label to
327
- * show in the column header, or a CustomCell object to further configure the
328
- * column.
329
- * @category Prop
330
- * @since v4.1.0
331
- */
332
- readonly customCells?: Ids | {[cellId: Id]: string | CustomCell};
333
- };
334
-
335
- /**
336
- * RelationshipInHtmlTableProps props are used for components that will render
337
- * the contents of the two Tables linked by a Relationship as an HTML table,
338
- * such as the RelationshipInHtmlTable component.
339
- *
340
- * Note the use of dotted 'tableId.cellId' string pairs when specifying custom
341
- * rendering for the cells in this table, since Cells from both the
342
- * relationship's 'local' and 'remote' Table objects can be rendered and need to
343
- * be distinguished.
344
- * @category Props
345
- * @since v4.1.0
346
- */
347
- export type RelationshipInHtmlTableProps = {
348
- /**
349
- * The Id of the relationship in the Relationships object for which the
350
- * relationship Table Rows will be rendered.
351
- * @category Prop
352
- * @since v4.1.0
353
- */
354
- readonly relationshipId: Id;
355
- /**
356
- * The Relationships object to be accessed: omit for the default context
357
- * Relationships object, provide an Id for a named context Relationships
358
- * object, or provide an explicit reference.
359
- * @category Prop
360
- * @since v4.1.0
361
- */
362
- readonly relationships?: RelationshipsOrRelationshipsId;
363
- /**
364
- * Whether the Cells should be editable. This affects the default CellView
365
- * component (to use the EditableCellView component instead) but of course
366
- * will not affect custom Cell components if you have set them.
367
- * @category Prop
368
- * @since v4.1.0
369
- */
370
- readonly editable?: boolean;
371
- /**
372
- * An optional list of dotted 'tableId.cellId' string pairs to use for
373
- * rendering a prescribed set of the relationship Tables' Cells in a given
374
- * order. This can also be an object with the desired 'tableId.cellId' string
375
- * pairs as keys, and with a value that can either be a string label to show
376
- * in the column header, or a CustomCell object to further configure the
377
- * column.
378
- * @category Prop
379
- * @since v4.1.0
380
- */
381
- readonly customCells?: Ids | {[cellId: Id]: string | CustomCell};
382
- };
383
-
384
- /**
385
- * ResultTableInHtmlTableProps props are used for components that will render a
386
- * ResultTable in an HTML table, such as the ResultTableInHtmlTable component.
387
- * @category Props
388
- * @since v4.1.0
389
- */
390
- export type ResultTableInHtmlTableProps = {
391
- /**
392
- * The Id of the query in the Queries object for which the ResultTable will be
393
- * rendered.
394
- * @category Prop
395
- * @since v4.1.0
396
- */
397
- readonly queryId: Id;
398
- /**
399
- * The Queries object to be accessed: omit for the default context Queries
400
- * object, provide an Id for a named context Queries object, or provide an
401
- * explicit reference.
402
- * @category Prop
403
- * @since v4.1.0
404
- */
405
- readonly queries?: QueriesOrQueriesId;
406
- /**
407
- * An optional list of Cell Ids to use for rendering a prescribed set of the
408
- * ResultTable's Cells in a given order. This can also be an object with the
409
- * desired Cell Ids as keys, and with a value that can either be a string
410
- * label to show in the column header, or a ResultCustomCell object to further
411
- * configure the column.
412
- * @category Prop
413
- * @since v4.1.0
414
- */
415
- readonly customCells?: Ids | {[cellId: Id]: string | CustomResultCell};
416
- };
417
-
418
- /**
419
- * ResultSortedTableInHtmlTableProps props are used for components that will
420
- * render a sorted Table in an HTML table, such as the SortedTableInHtmlTable
421
- * component.
422
- * @category Props
423
- * @since v4.1.0
424
- */
425
- export type ResultSortedTableInHtmlTableProps = {
426
- /**
427
- * The Id of the query in the Queries object for which the ResultTable will be
428
- * rendered.
429
- * @category Prop
430
- * @since v4.1.0
431
- */
432
- readonly queryId: Id;
433
- /**
434
- * The Id of the Cell whose values are used for the sorting. If omitted, the
435
- * view will sort the Row Id itself.
436
- * @category Prop
437
- * @since v4.1.0
438
- */
439
- readonly cellId?: Id;
440
- /**
441
- * Whether the sorting should be in descending order.
442
- * @category Prop
443
- * @since v4.1.0
444
- */
445
- readonly descending?: boolean;
446
- /**
447
- * The number of Row Ids to skip for pagination purposes.
448
- * @category Prop
449
- * @since v4.1.0
450
- */
451
- readonly offset?: number;
452
- /**
453
- * The maximum number of Row Ids to return.
454
- * @category Prop
455
- * @since v4.1.0
456
- */
457
- readonly limit?: number;
458
- /**
459
- * The Queries object to be accessed: omit for the default context Queries
460
- * object, provide an Id for a named context Queries object, or provide an
461
- * explicit reference.
462
- * @category Prop
463
- * @since v4.1.0
464
- */
465
- readonly queries?: QueriesOrQueriesId;
466
- /**
467
- * An optional list of Cell Ids to use for rendering a prescribed set of the
468
- * ResultTable's Cells in a given order. This can also be an object with the
469
- * desired Cell Ids as keys, and with a value that can either be a string
470
- * label to show in the column header, or a ResultCustomCell object to further
471
- * configure the column.
472
- * @category Prop
473
- * @since v4.1.0
474
- */
475
- readonly customCells?: Ids | {[cellId: Id]: string | CustomResultCell};
476
- /**
477
- * Whether the table should be interactive such that clicking a header changes
478
- * the sorting and/or direction.
479
- * @category Prop
480
- * @since v4.1.0
481
- */
482
- readonly sortOnClick?: boolean;
483
- /**
484
- * Either `true` to show the default SortedTablePaginator for the ResultTable,
485
- * or provide your own paginator component that takes
486
- * SortedTablePaginatorProps.
487
- * @category Prop
488
- * @since v4.1.0
489
- */
490
- readonly paginator?: boolean | ComponentType<SortedTablePaginatorProps>;
491
- /**
492
- * A function that is called whenever the sorting or pagination of the
493
- * ResultTable is changed by the user, invoked with the sorted Cell Id,
494
- * whether descending or not, and the offset of the pagination.
495
- * @category Prop
496
- * @since v4.1.0
497
- */
498
- readonly onChange?: (
499
- sortAndOffset: [
500
- cellId: Id | undefined,
501
- descending: boolean,
502
- offset: number,
503
- ],
504
- ) => void;
505
- };
506
-
507
- /**
508
- * SortedTablePaginatorProps props are used for components that will be used as
509
- * a table paginator, such as the SortedTablePaginator component.
510
- * @category Props
511
- * @since v4.1.0
512
- */
513
- export type SortedTablePaginatorProps = {
514
- /**
515
- * An event that will fire when the offset is updated, called with the new
516
- * offset.
517
- * @category Prop
518
- * @since v4.1.0
519
- */
520
- readonly onChange: (offset: number) => void;
521
- /**
522
- * The number of Row Ids to skip for pagination.
523
- * @category Prop
524
- * @since v4.1.0
525
- */
526
- readonly offset?: number;
527
- /**
528
- * The maximum number of Row Ids being returned.
529
- * @category Prop
530
- * @since v4.1.0
531
- */
532
- readonly limit?: number;
533
- /**
534
- * The total number of Row Ids in the paginated table.
535
- * @category Prop
536
- * @since v4.1.0
537
- */
538
- readonly total: number;
539
- /**
540
- * A noun to use in the pagination label for a single row, defaulting to
541
- * 'row'.
542
- * @category Prop
543
- * @since v4.1.0
544
- */
545
- readonly singular?: string;
546
- /**
547
- * A noun to use in the pagination label for multiple rows, defaulting to the
548
- * value of the singular noun suffixed with the letter 's'.
549
- * @category Prop
550
- * @since v4.1.0
551
- */
552
- readonly plural?: string;
553
- };
554
-
555
- /**
556
- * The TableInHtmlTable component renders the contents of a single Table in a
557
- * Store as an HTML <table> element, and registers a listener so that any
558
- * changes to that result will cause a re-render.
559
- *
560
- * See the <TableInHtmlTable /> demo for this component in action.
561
- *
562
- * The component's props identify which Table to render based on Table Id, and
563
- * Store (which is either the default context Store, a named context Store, or
564
- * by explicit reference).
565
- *
566
- * This component renders a Table by iterating over its Row objects. By default
567
- * the Cells are in turn rendered with the CellView component, but you can
568
- * override this behavior by providing a `component` for each Cell in the
569
- * `customCells` prop. You can pass additional props to that custom component
570
- * with the `getComponentProps` callback. See the CustomCell type for more
571
- * details.
572
- *
573
- * This component uses the useRowIds hook under the covers, which means that any
574
- * changes to the structure of the Table will cause a re-render.
575
- *
576
- * You can use the `headerRow` and `idColumn` props to control whether the Ids
577
- * appear in a <th> element at the top of the table, and the start of each row.
578
- * @param props The props for this component.
579
- * @returns A rendering of the Table in a <table> element.
580
- * @example
581
- * This example creates a Provider context into which a default Store is
582
- * provided. The TableInHtmlTable component within it then renders the Table in
583
- * a <table> element with a CSS class.
584
- *
585
- * ```jsx
586
- * import React from 'react';
587
- * import {createRoot} from 'react-dom/client';
588
- * import {createStore} from 'tinybase';
589
- * import {Provider} from 'tinybase/ui-react';
590
- * import {TableInHtmlTable} from 'tinybase/ui-react-dom';
591
- *
592
- * const App = ({store}) => (
593
- * <Provider store={store}>
594
- * <Pane />
595
- * </Provider>
596
- * );
597
- * const Pane = () => <TableInHtmlTable tableId="pets" className="table" />;
598
- *
599
- * const store = createStore().setTable('pets', {
600
- * fido: {species: 'dog'},
601
- * felix: {species: 'cat'},
602
- * });
603
- * const app = document.createElement('div');
604
- * createRoot(app).render(<App store={store} />); // !act
605
- * console.log(app.innerHTML);
606
- * // ->
607
- * `
608
- * <table class="table">
609
- * <thead>
610
- * <tr>
611
- * <th>Id</th>
612
- * <th>species</th>
613
- * </tr>
614
- * </thead>
615
- * <tbody>
616
- * <tr>
617
- * <th>fido</th>
618
- * <td>dog</td>
619
- * </tr>
620
- * <tr>
621
- * <th>felix</th>
622
- * <td>cat</td>
623
- * </tr>
624
- * </tbody>
625
- * </table>
626
- * `;
627
- * ```
628
- * @example
629
- * This example creates a Provider context into which a default Store is
630
- * provided. The TableInHtmlTable component within it then renders the Table
631
- * with a custom component and a custom props callback for the `species` Cell.
632
- * The header row at the top of the table and the Id column at the start of each
633
- * row is removed.
634
- *
635
- * ```jsx
636
- * import React from 'react';
637
- * import {createRoot} from 'react-dom/client';
638
- * import {createStore} from 'tinybase';
639
- * import {CellView, Provider} from 'tinybase/ui-react';
640
- * import {TableInHtmlTable} from 'tinybase/ui-react-dom';
641
- *
642
- * const App = ({store}) => (
643
- * <Provider store={store}>
644
- * <Pane />
645
- * </Provider>
646
- * );
647
- * const Pane = () => (
648
- * <TableInHtmlTable
649
- * tableId="pets"
650
- * customCells={customCells}
651
- * headerRow={false}
652
- * idColumn={false}
653
- * />
654
- * );
655
- *
656
- * const FormattedCellView = ({tableId, rowId, cellId, bold}) => (
657
- * <>
658
- * {bold ? <b>{rowId}</b> : rowId}:
659
- * <CellView tableId={tableId} rowId={rowId} cellId={cellId} />
660
- * </>
661
- * );
662
- * const customCells = {
663
- * species: {
664
- * component: FormattedCellView,
665
- * getComponentProps: (rowId) => ({bold: rowId == 'fido'}),
666
- * },
667
- * };
668
- *
669
- * const store = createStore().setTable('pets', {
670
- * fido: {species: 'dog'},
671
- * felix: {species: 'cat'},
672
- * });
673
- * const app = document.createElement('div');
674
- * createRoot(app).render(<App store={store} />); // !act
675
- * console.log(app.innerHTML);
676
- * // ->
677
- * `
678
- * <table>
679
- * <tbody>
680
- * <tr>
681
- * <td><b>fido</b>:dog</td>
682
- * </tr>
683
- * <tr>
684
- * <td>felix:cat</td>
685
- * </tr>
686
- * </tbody>
687
- * </table>
688
- * `;
689
- * ```
690
- * @category Store components
691
- * @since v4.1.0
692
- */
693
- export function TableInHtmlTable(
694
- props: TableInHtmlTableProps & HtmlTableProps,
695
- ): ComponentReturnType;
696
-
697
- /**
698
- * The SortedTableInHtmlTable component renders the contents of a single sorted
699
- * Table in a Store, as an HTML <table> element, and registers a listener so
700
- * that any changes to that result will cause a re-render.
701
- *
702
- * See the <SortedTableInHtmlTable /> demo for this component in action.
703
- *
704
- * The component's props identify which Table to render based on Table Id, and
705
- * Store (which is either the default context Store, a named context Store, or
706
- * by explicit reference). It also takes a Cell Id to sort by and a boolean to
707
- * indicate that the sorting should be in descending order. The `offset` and
708
- * `limit` props are used to paginate results, but default to `0` and
709
- * `undefined` to return all available Row Ids if not specified.
710
- *
711
- * This component renders a ResultTable by iterating over its Row objects, in
712
- * the order dictated by the sort parameters. By default the Cells are in turn
713
- * rendered with the CellView component, but you can override this behavior by
714
- * providing a `component` for each Cell in the `customCells` prop. You can pass
715
- * additional props to that custom component with the `getComponentProps`
716
- * callback. See the CustomCell type for more details.
717
- *
718
- * This component uses the useSortedRowIds hook under the covers, which means
719
- * that any changes to the structure or sorting of the Table will cause a
720
- * re-render.
721
- *
722
- * You can use the `headerRow` and `idColumn` props to control whether the Ids
723
- * appear in a <th> element at the top of the table, and the start of each row.
724
- *
725
- * The `sortOnClick` prop makes the table's sorting interactive such that the
726
- * user can click on a column heading to sort by that column. The style classes
727
- * `sorted` and `ascending` (or `descending`) are added so that you can provide
728
- * hints to the user how the sorting is being applied.
729
- *
730
- * Provide a paginator component for the Table with the `paginator` prop. Set to
731
- * `true` to use the default SortedTablePaginator, or provide your own component
732
- * that accepts SortedTablePaginatorProps.
733
- *
734
- * Finally, the `onChange` prop lets you listen to a user's changes to the
735
- * Table's sorting or pagination.
736
- * @param props The props for this component.
737
- * @returns A rendering of the Table in a <table> element.
738
- * @example
739
- * This example creates a Provider context into which a default Store is
740
- * provided. The SortedTableInHtmlTable component within it then renders the
741
- * Table in a <table> element with a CSS class.
742
- *
743
- * ```jsx
744
- * import React from 'react';
745
- * import {createRoot} from 'react-dom/client';
746
- * import {createStore} from 'tinybase';
747
- * import {Provider} from 'tinybase/ui-react';
748
- * import {SortedTableInHtmlTable} from 'tinybase/ui-react-dom';
749
- *
750
- * const App = ({store}) => (
751
- * <Provider store={store}>
752
- * <Pane />
753
- * </Provider>
754
- * );
755
- * const Pane = () => (
756
- * <SortedTableInHtmlTable
757
- * tableId="pets"
758
- * cellId="species"
759
- * className="table"
760
- * />
761
- * );
762
- *
763
- * const store = createStore().setTables({
764
- * pets: {
765
- * fido: {species: 'dog'},
766
- * felix: {species: 'cat'},
767
- * },
768
- * });
769
- * const app = document.createElement('div');
770
- * createRoot(app).render(<App store={store} />); // !act
771
- * console.log(app.innerHTML);
772
- * // ->
773
- * `
774
- * <table class="table">
775
- * <thead>
776
- * <tr>
777
- * <th>Id</th>
778
- * <th class="sorted ascending">↑ species</th>
779
- * </tr>
780
- * </thead>
781
- * <tbody>
782
- * <tr>
783
- * <th>felix</th>
784
- * <td>cat</td>
785
- * </tr>
786
- * <tr>
787
- * <th>fido</th>
788
- * <td>dog</td>
789
- * </tr>
790
- * </tbody>
791
- * </table>
792
- * `;
793
- * ```
794
- * @example
795
- * This example creates a Provider context into which a default Store is
796
- * provided. The SortedTableInHtmlTable component within it then renders the
797
- * Table with a custom component and a custom props callback for the `species`
798
- * Cell. The header row at the top of the table and the Id column at the start
799
- * of each row is removed.
800
- *
801
- * ```jsx
802
- * import React from 'react';
803
- * import {createRoot} from 'react-dom/client';
804
- * import {createStore} from 'tinybase';
805
- * import {CellView, Provider} from 'tinybase/ui-react';
806
- * import {SortedTableInHtmlTable} from 'tinybase/ui-react-dom';
807
- *
808
- * const App = ({store}) => (
809
- * <Provider store={store}>
810
- * <Pane />
811
- * </Provider>
812
- * );
813
- *
814
- * const Pane = () => (
815
- * <SortedTableInHtmlTable
816
- * tableId="pets"
817
- * cellId="species"
818
- * customCells={customCells}
819
- * headerRow={false}
820
- * idColumn={false}
821
- * />
822
- * );
823
- *
824
- * const FormattedCellView = ({tableId, rowId, cellId, bold}) => (
825
- * <>
826
- * {bold ? <b>{rowId}</b> : rowId}:
827
- * <CellView tableId={tableId} rowId={rowId} cellId={cellId} />
828
- * </>
829
- * );
830
- * const customCells = {
831
- * species: {
832
- * component: FormattedCellView,
833
- * getComponentProps: (rowId) => ({bold: rowId == 'fido'}),
834
- * },
835
- * };
836
- *
837
- * const store = createStore().setTables({
838
- * pets: {
839
- * fido: {species: 'dog'},
840
- * felix: {species: 'cat'},
841
- * },
842
- * });
843
- * const app = document.createElement('div');
844
- * createRoot(app).render(<App store={store} />); // !act
845
- * console.log(app.innerHTML);
846
- * // ->
847
- * `
848
- * <table>
849
- * <tbody>
850
- * <tr>
851
- * <td>felix:cat</td>
852
- * </tr>
853
- * <tr>
854
- * <td><b>fido</b>:dog</td>
855
- * </tr>
856
- * </tbody>
857
- * </table>
858
- * `;
859
- * ```
860
- * @category Store components
861
- * @since v4.1.0
862
- */
863
- export function SortedTableInHtmlTable(
864
- props: SortedTableInHtmlTableProps & HtmlTableProps,
865
- ): ComponentReturnType;
866
-
867
- /**
868
- * The ValuesInHtmlTable component renders the keyed value contents of a Store
869
- * as an HTML <table> element, and registers a listener so that any changes to
870
- * that result will cause a re-render.
871
- *
872
- * See the <ValuesInHtmlTable /> demo for this component in action.
873
- *
874
- * The component's props identify which Row to render based on Table Id, Row Id,
875
- * and Store (which is either the default context Store, a named context Store,
876
- * or an explicit reference).
877
- *
878
- * This component renders a Store by iterating over its Value objects. By
879
- * default the Values are in turn rendered with the ValueView component, but you
880
- * can override this behavior by providing a `valueComponent` prop, a custom
881
- * component of your own that will render a Value based on ValueProps. You can
882
- * also pass additional props to your custom component with the
883
- * `getValueComponentProps` callback prop.
884
- *
885
- * This component uses the useValueIds hook under the covers, which means that
886
- * any changes to the structure of the Values in the Store will cause a
887
- * re-render.
888
- *
889
- * You can use the `headerRow` and `idColumn` props to control whether labels
890
- * and Ids appear in a <th> element at the top of the table, and the start of
891
- * each row.
892
- * @param props The props for this component.
893
- * @returns A rendering of the Values in a <table> element.
894
- * @example
895
- * This example creates a Provider context into which a default Store is
896
- * provided. The ValuesInHtmlTable component within it then renders the Values
897
- * in a <table> element with a CSS class.
898
- *
899
- * ```jsx
900
- * import React from 'react';
901
- * import {createRoot} from 'react-dom/client';
902
- * import {createStore} from 'tinybase';
903
- * import {Provider} from 'tinybase/ui-react';
904
- * import {ValuesInHtmlTable} from 'tinybase/ui-react-dom';
905
- *
906
- * const App = ({store}) => (
907
- * <Provider store={store}>
908
- * <Pane />
909
- * </Provider>
910
- * );
911
- * const Pane = () => <ValuesInHtmlTable className="values" />;
912
- *
913
- * const store = createStore().setValues({open: true, employees: 3});
914
- * const app = document.createElement('div');
915
- * createRoot(app).render(<App store={store} />); // !act
916
- * console.log(app.innerHTML);
917
- * // ->
918
- * `
919
- * <table class="values">
920
- * <thead>
921
- * <tr>
922
- * <th>Id</th>
923
- * <th>Value</th>
924
- * </tr>
925
- * </thead>
926
- * <tbody>
927
- * <tr>
928
- * <th>open</th>
929
- * <td>true</td>
930
- * </tr>
931
- * <tr>
932
- * <th>employees</th>
933
- * <td>3</td>
934
- * </tr>
935
- * </tbody>
936
- * </table>
937
- * `;
938
- * ```
939
- * @example
940
- * This example creates a Provider context into which a default Store is
941
- * provided. The ValuesInHtmlTable component within it then renders the Row
942
- * with a custom Cell component and a custom props callback. The header row at
943
- * the top of the table and the Id column at the start of each row is removed.
944
- *
945
- * ```jsx
946
- * import React from 'react';
947
- * import {createRoot} from 'react-dom/client';
948
- * import {createStore} from 'tinybase';
949
- * import {Provider, ValueView} from 'tinybase/ui-react';
950
- * import {ValuesInHtmlTable} from 'tinybase/ui-react-dom';
951
- *
952
- * const App = ({store}) => (
953
- * <Provider store={store}>
954
- * <Pane />
955
- * </Provider>
956
- * );
957
- * const getBoldProp = (valueId) => ({bold: valueId == 'open'});
958
- * const Pane = () => (
959
- * <ValuesInHtmlTable
960
- * valueComponent={FormattedValueView}
961
- * getValueComponentProps={getBoldProp}
962
- * headerRow={false}
963
- * idColumn={false}
964
- * />
965
- * );
966
- * const FormattedValueView = ({valueId, bold}) => (
967
- * <>
968
- * {bold ? <b>{valueId}</b> : valueId}
969
- * {': '}
970
- * <ValueView valueId={valueId} />
971
- * </>
972
- * );
973
- *
974
- * const store = createStore().setValues({open: true, employees: 3});
975
- * const app = document.createElement('div');
976
- * createRoot(app).render(<App store={store} />); // !act
977
- * console.log(app.innerHTML);
978
- * // ->
979
- * `
980
- * <table>
981
- * <tbody>
982
- * <tr><td><b>open</b>: true</td></tr>
983
- * <tr><td>employees: 3</td></tr>
984
- * </tbody>
985
- * </table>
986
- * `;
987
- * ```
988
- * @category Store components
989
- * @since v4.1.0
990
- */
991
- export function ValuesInHtmlTable(
992
- props: ValuesInHtmlTableProps & HtmlTableProps,
993
- ): ComponentReturnType;
994
-
995
- /**
996
- * The SliceInHtmlTable component renders the contents of a Slice as an HTML
997
- * <table> element, and registers a listener so that any changes to that result
998
- * will cause a re-render.
999
- *
1000
- * See the <SliceInHtmlTable /> demo for this component in action.
1001
- *
1002
- * The component's props identify which Slice to render based on Index Id, Slice
1003
- * Id, and Indexes object (which is either the default context Indexes object, a
1004
- * named context Indexes object, or an explicit reference).
1005
- *
1006
- * This component renders a Slice by iterating over its Row objects. By default
1007
- * the Cells are in turn rendered with the CellView component, but you can
1008
- * override this behavior by providing a `component` for each Cell in the
1009
- * `customCells` prop. You can pass additional props to that custom component
1010
- * with the `getComponentProps` callback. See the CustomCell type for more
1011
- * details.
1012
- *
1013
- * This component uses the useSliceRowIds hook under the covers, which means
1014
- * that any changes to the structure of the Slice will cause a re-render.
1015
- *
1016
- * You can use the `headerRow` and `idColumn` props to control whether labels
1017
- * and Ids appear in a <th> element at the top of the table, and the start of
1018
- * each row.
1019
- * @param props The props for this component.
1020
- * @returns A rendering of the Slice in a <table> element.
1021
- * @example
1022
- * This example creates a Provider context into which a default Indexes object
1023
- * is provided. The SliceInHtmlTable component within it then renders the Slice
1024
- * in a <table> element with a CSS class.
1025
- *
1026
- * ```jsx
1027
- * import React from 'react';
1028
- * import {createRoot} from 'react-dom/client';
1029
- * import {createIndexes, createStore} from 'tinybase';
1030
- * import {Provider} from 'tinybase/ui-react';
1031
- * import {SliceInHtmlTable} from 'tinybase/ui-react-dom';
1032
- *
1033
- * const App = ({indexes}) => (
1034
- * <Provider indexes={indexes}>
1035
- * <Pane />
1036
- * </Provider>
1037
- * );
1038
- * const Pane = () => (
1039
- * <SliceInHtmlTable indexId="bySpecies" sliceId="dog" className="slice" />
1040
- * );
1041
- *
1042
- * const store = createStore().setTable('pets', {
1043
- * fido: {species: 'dog'},
1044
- * felix: {species: 'cat'},
1045
- * cujo: {species: 'dog'},
1046
- * });
1047
- * const indexes = createIndexes(store);
1048
- * indexes.setIndexDefinition('bySpecies', 'pets', 'species');
1049
- *
1050
- * const app = document.createElement('div');
1051
- * createRoot(app).render(<App indexes={indexes} />); // !act
1052
- * console.log(app.innerHTML);
1053
- * // ->
1054
- * `
1055
- * <table class="slice">
1056
- * <thead>
1057
- * <tr>
1058
- * <th>Id</th>
1059
- * <th>species</th>
1060
- * </tr>
1061
- * </thead>
1062
- * <tbody>
1063
- * <tr>
1064
- * <th>fido</th>
1065
- * <td>dog</td>
1066
- * </tr>
1067
- * <tr>
1068
- * <th>cujo</th>
1069
- * <td>dog</td>
1070
- * </tr>
1071
- * </tbody>
1072
- * </table>
1073
- * `;
1074
- * ```
1075
- * @example
1076
- * This example creates a Provider context into which a default Indexes object
1077
- * is provided. The SliceInHtmlTable component within it then renders the Slice
1078
- * with a custom component and a custom props callback for the `species` Cell.
1079
- * The header row at the top of the table and the Id column at the start of each
1080
- * row is removed.
1081
- *
1082
- * ```jsx
1083
- * import React from 'react';
1084
- * import {createRoot} from 'react-dom/client';
1085
- * import {createIndexes, createStore} from 'tinybase';
1086
- * import {CellView, Provider} from 'tinybase/ui-react';
1087
- * import {SliceInHtmlTable} from 'tinybase/ui-react-dom';
1088
- *
1089
- * const App = ({indexes}) => (
1090
- * <Provider indexes={indexes}>
1091
- * <Pane />
1092
- * </Provider>
1093
- * );
1094
- * const Pane = () => (
1095
- * <SliceInHtmlTable
1096
- * indexId="bySpecies"
1097
- * sliceId="dog"
1098
- * customCells={customCells}
1099
- * headerRow={false}
1100
- * idColumn={false}
1101
- * />
1102
- * );
1103
- *
1104
- * const FormattedCellView = ({tableId, rowId, cellId, bold}) => (
1105
- * <>
1106
- * {bold ? <b>{rowId}</b> : rowId}:
1107
- * <CellView tableId={tableId} rowId={rowId} cellId={cellId} />
1108
- * </>
1109
- * );
1110
- * const customCells = {
1111
- * species: {
1112
- * component: FormattedCellView,
1113
- * getComponentProps: (rowId) => ({bold: rowId == 'fido'}),
1114
- * },
1115
- * };
1116
- *
1117
- * const store = createStore().setTable('pets', {
1118
- * fido: {species: 'dog', color: 'brown'},
1119
- * felix: {species: 'cat'},
1120
- * cujo: {species: 'dog'},
1121
- * });
1122
- * const indexes = createIndexes(store);
1123
- * indexes.setIndexDefinition('bySpecies', 'pets', 'species');
1124
- *
1125
- * const app = document.createElement('div');
1126
- * createRoot(app).render(<App indexes={indexes} />); // !act
1127
- * console.log(app.innerHTML);
1128
- * // ->
1129
- * `
1130
- * <table>
1131
- * <tbody>
1132
- * <tr>
1133
- * <td><b>fido</b>:</td>
1134
- * </tr>
1135
- * <tr>
1136
- * <td>cujo:</td>
1137
- * </tr>
1138
- * </tbody>
1139
- * </table>
1140
- * `;
1141
- * ```
1142
- * @category Indexes components
1143
- * @since v4.1.0
1144
- */
1145
- export function SliceInHtmlTable(
1146
- props: SliceInHtmlTableProps & HtmlTableProps,
1147
- ): ComponentReturnType;
1148
-
1149
- /**
1150
- * The RelationshipInHtmlTable component renders the contents of the two Tables
1151
- * linked by a Relationship as an HTML <table> element, and registers a listener
1152
- * so that any changes to that result will cause a re-render.
1153
- *
1154
- * See the <RelationshipInHtmlTable /> demo for this component in action.
1155
- *
1156
- * The component's props identify which Relationship to render based on
1157
- * Relationship Id and Relationships object (which is either the default context
1158
- * Relationships object, a named context Relationships object, or an explicit
1159
- * reference).
1160
- *
1161
- * This component renders the two Table objects by iterating over their related
1162
- * Row objects. By default the Cells are in turn rendered with the CellView
1163
- * component, but you can override this behavior by providing a `component` for
1164
- * each Cell in the `customCells` prop. You can pass additional props to that
1165
- * custom component with the `getComponentProps` callback. See the CustomCell
1166
- * type for more details.
1167
- *
1168
- * Note the use of dotted 'tableId.cellId' string pairs when specifying custom
1169
- * rendering for the cells in this table, since Cells from both the
1170
- * relationship's 'local' and 'remote' Table objects can be rendered and need to
1171
- * be distinguished.
1172
- *
1173
- * This component uses the useRowIds and useRemoteRowId hooks under the covers,
1174
- * which means that any changes to the structure of either Table resulting in a
1175
- * change to the relationship will cause a re-render.
1176
- *
1177
- * You can use the `headerRow` and `idColumn` props to control whether labels
1178
- * and Ids appear in a <th> element at the top of the table, and the start of
1179
- * each row.
1180
- * @param props The props for this component.
1181
- * @returns A rendering of the two Tables linked by a Relationship in a
1182
- * <table> element.
1183
- * @example
1184
- * This example creates a Provider context into which a default Relationships
1185
- * object is provided. The RelationshipInHtmlTable component within it then
1186
- * renders the two Tables linked by a relationship in a <table> element with a
1187
- * CSS class. Note the dotted pairs that are used as column headings.
1188
- *
1189
- * ```jsx
1190
- * import React from 'react';
1191
- * import {createRoot} from 'react-dom/client';
1192
- * import {createRelationships, createStore} from 'tinybase';
1193
- * import {Provider} from 'tinybase/ui-react';
1194
- * import {RelationshipInHtmlTable} from 'tinybase/ui-react-dom';
1195
- *
1196
- * const App = ({relationships}) => (
1197
- * <Provider relationships={relationships}>
1198
- * <Pane />
1199
- * </Provider>
1200
- * );
1201
- * const Pane = () => (
1202
- * <RelationshipInHtmlTable
1203
- * relationshipId="petSpecies"
1204
- * className="relationship"
1205
- * />
1206
- * );
1207
- *
1208
- * const relationships = createRelationships(
1209
- * createStore()
1210
- * .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'dog'}})
1211
- * .setTable('species', {wolf: {price: 10}, dog: {price: 5}}),
1212
- * ).setRelationshipDefinition('petSpecies', 'pets', 'species', 'species');
1213
- *
1214
- * const app = document.createElement('div');
1215
- * const root = createRoot(app);
1216
- * root.render(<App relationships={relationships} />); // !act
1217
- * console.log(app.innerHTML);
1218
- * // ->
1219
- * `
1220
- * <table class="relationship">
1221
- * <thead>
1222
- * <tr>
1223
- * <th>pets.Id</th>
1224
- * <th>species.Id</th>
1225
- * <th>pets.species</th>
1226
- * <th>species.price</th>
1227
- * </tr>
1228
- * </thead>
1229
- * <tbody>
1230
- * <tr>
1231
- * <th>fido</th>
1232
- * <th>dog</th>
1233
- * <td>dog</td>
1234
- * <td>5</td>
1235
- * </tr>
1236
- * <tr>
1237
- * <th>cujo</th>
1238
- * <th>dog</th>
1239
- * <td>dog</td>
1240
- * <td>5</td>
1241
- * </tr>
1242
- * </tbody>
1243
- * </table>
1244
- * `;
1245
- * ```
1246
- * @example
1247
- * This example creates a Provider context into which a default Relationships
1248
- * object is provided. The RelationshipInHtmlTable component within it then
1249
- * renders the two Tables linked by a relationship with a custom component and a
1250
- * custom props callback for the `species` Cell. The header row at the top of
1251
- * the table and the Id column at the start of each row is removed.
1252
- *
1253
- * ```jsx
1254
- * import React from 'react';
1255
- * import {createRoot} from 'react-dom/client';
1256
- * import {createRelationships, createStore} from 'tinybase';
1257
- * import {CellView, Provider} from 'tinybase/ui-react';
1258
- * import {RelationshipInHtmlTable} from 'tinybase/ui-react-dom';
1259
- *
1260
- * const App = ({relationships}) => (
1261
- * <Provider relationships={relationships}>
1262
- * <Pane />
1263
- * </Provider>
1264
- * );
1265
- * const Pane = () => (
1266
- * <RelationshipInHtmlTable
1267
- * relationshipId="petSpecies"
1268
- * customCells={customCells}
1269
- * idColumn={false}
1270
- * headerRow={false}
1271
- * />
1272
- * );
1273
- *
1274
- * const FormattedCellView = ({tableId, rowId, cellId, store, bold}) => (
1275
- * <>
1276
- * {bold ? <b>{rowId}</b> : rowId}:
1277
- * <CellView
1278
- * tableId={tableId}
1279
- * rowId={rowId}
1280
- * cellId={cellId}
1281
- * store={store}
1282
- * />
1283
- * </>
1284
- * );
1285
- * const customCells = {
1286
- * 'species.price': {
1287
- * component: FormattedCellView,
1288
- * getComponentProps: (rowId) => ({bold: rowId == 'dog'}),
1289
- * },
1290
- * };
1291
- *
1292
- * const relationships = createRelationships(
1293
- * createStore()
1294
- * .setTable('pets', {fido: {species: 'dog'}, cujo: {species: 'wolf'}})
1295
- * .setTable('species', {wolf: {price: 10}, dog: {price: 5}}),
1296
- * ).setRelationshipDefinition('petSpecies', 'pets', 'species', 'species');
1297
- *
1298
- * const app = document.createElement('div');
1299
- * const root = createRoot(app);
1300
- * root.render(<App relationships={relationships} />); // !act
1301
- * console.log(app.innerHTML);
1302
- * // ->
1303
- * `
1304
- * <table>
1305
- * <tbody>
1306
- * <tr>
1307
- * <td><b>dog</b>:5</td>
1308
- * </tr>
1309
- * <tr>
1310
- * <td>wolf:10</td>
1311
- * </tr>
1312
- * </tbody>
1313
- * </table>
1314
- * `;
1315
- * ```
1316
- * @category Relationships components
1317
- * @since v4.1.0
1318
- */
1319
- export function RelationshipInHtmlTable(
1320
- props: RelationshipInHtmlTableProps & HtmlTableProps,
1321
- ): ComponentReturnType;
1322
-
1323
- /**
1324
- * The ResultTableInHtmlTable component renders the contents of a single query's
1325
- * ResultTable in a Queries object as an HTML <table> element, and registers a
1326
- * listener so that any changes to that result will cause a re-render.
1327
- *
1328
- * See the <ResultTableInHtmlTable /> demo for this component in action.
1329
- *
1330
- * The component's props identify which ResultTable to render based on query Id,
1331
- * and Queries object (which is either the default context Queries object, a
1332
- * named context Queries object, or by explicit reference).
1333
- *
1334
- * This component renders a ResultTable by iterating over its Row objects. By
1335
- * default the Cells are in turn rendered with the CellView component, but you
1336
- * can override this behavior by providing a `component` for each Cell in the
1337
- * `customCells` prop. You can pass additional props to that custom component
1338
- * with the `getComponentProps` callback. See the ResultCustomCell type for more
1339
- * details.
1340
- *
1341
- * This component uses the useRowIds hook under the covers, which means that any
1342
- * changes to the structure of the Table will cause a re-render.
1343
- *
1344
- * You can use the `headerRow` and `idColumn` props to control whether the Ids
1345
- * appear in a <th> element at the top of the table, and the start of each row.
1346
- * @param props The props for this component.
1347
- * @returns A rendering of the ResultTable in a <table> element.
1348
- * @example
1349
- * This example creates a Provider context into which a default Queries object
1350
- * is provided. The ResultTableInHtmlTable component within it then renders the
1351
- * ResultTable in a <table> element with a CSS class.
1352
- *
1353
- * ```jsx
1354
- * import React from 'react';
1355
- * import {createRoot} from 'react-dom/client';
1356
- * import {createQueries, createStore} from 'tinybase';
1357
- * import {Provider} from 'tinybase/ui-react';
1358
- * import {ResultTableInHtmlTable} from 'tinybase/ui-react-dom';
1359
- *
1360
- * const App = ({queries}) => (
1361
- * <Provider queries={queries}>
1362
- * <Pane />
1363
- * </Provider>
1364
- * );
1365
- * const Pane = () => (
1366
- * <ResultTableInHtmlTable queryId="petColors" className="table" />
1367
- * );
1368
- *
1369
- * const queries = createQueries(
1370
- * createStore().setTable('pets', {
1371
- * fido: {species: 'dog', color: 'brown'},
1372
- * felix: {species: 'cat', color: 'black'},
1373
- * }),
1374
- * ).setQueryDefinition('petColors', 'pets', ({select}) => select('color'));
1375
- * const app = document.createElement('div');
1376
- * createRoot(app).render(<App queries={queries} />); // !act
1377
- * console.log(app.innerHTML);
1378
- * // ->
1379
- * `
1380
- * <table class="table">
1381
- * <thead>
1382
- * <tr>
1383
- * <th>Id</th>
1384
- * <th>color</th>
1385
- * </tr>
1386
- * </thead>
1387
- * <tbody>
1388
- * <tr>
1389
- * <th>fido</th>
1390
- * <td>brown</td>
1391
- * </tr>
1392
- * <tr>
1393
- * <th>felix</th>
1394
- * <td>black</td>
1395
- * </tr>
1396
- * </tbody>
1397
- * </table>
1398
- * `;
1399
- * ```
1400
- * @example
1401
- * This example creates a Provider context into which a default Queries object
1402
- * is provided. The ResultTableInHtmlTable component within it then renders the
1403
- * ResultTable with a custom component and a custom props callback for the
1404
- * `color` Cell. The header row at the top of the table and the Id column at
1405
- * the start of each row is removed.
1406
- *
1407
- * ```jsx
1408
- * import React from 'react';
1409
- * import {createRoot} from 'react-dom/client';
1410
- * import {createQueries, createStore} from 'tinybase';
1411
- * import {Provider, ResultCellView} from 'tinybase/ui-react';
1412
- * import {ResultTableInHtmlTable} from 'tinybase/ui-react-dom';
1413
- *
1414
- * const App = ({queries}) => (
1415
- * <Provider queries={queries}>
1416
- * <Pane />
1417
- * </Provider>
1418
- * );
1419
- * const Pane = () => (
1420
- * <ResultTableInHtmlTable
1421
- * queryId="petColors"
1422
- * customCells={customCells}
1423
- * headerRow={false}
1424
- * idColumn={false}
1425
- * />
1426
- * );
1427
- *
1428
- * const FormattedResultCellView = ({queryId, rowId, cellId, bold}) => (
1429
- * <>
1430
- * {bold ? <b>{rowId}</b> : rowId}:
1431
- * <ResultCellView queryId={queryId} rowId={rowId} cellId={cellId} />
1432
- * </>
1433
- * );
1434
- * const customCells = {
1435
- * color: {
1436
- * component: FormattedResultCellView,
1437
- * getComponentProps: (rowId) => ({bold: rowId == 'fido'}),
1438
- * },
1439
- * };
1440
- *
1441
- * const queries = createQueries(
1442
- * createStore().setTable('pets', {
1443
- * fido: {species: 'dog', color: 'brown'},
1444
- * felix: {species: 'cat', color: 'black'},
1445
- * }),
1446
- * ).setQueryDefinition('petColors', 'pets', ({select}) => select('color'));
1447
- * const app = document.createElement('div');
1448
- * createRoot(app).render(<App queries={queries} />); // !act
1449
- * console.log(app.innerHTML);
1450
- * // ->
1451
- * `
1452
- * <table>
1453
- * <tbody>
1454
- * <tr>
1455
- * <td><b>fido</b>:brown</td>
1456
- * </tr>
1457
- * <tr>
1458
- * <td>felix:black</td>
1459
- * </tr>
1460
- * </tbody>
1461
- * </table>
1462
- * `;
1463
- * ```
1464
- * @category Queries components
1465
- * @since v4.1.0
1466
- */
1467
- export function ResultTableInHtmlTable(
1468
- props: ResultTableInHtmlTableProps & HtmlTableProps,
1469
- ): ComponentReturnType;
1470
-
1471
- /**
1472
- * The SortedTableInHtmlTable component renders the contents of a single query's
1473
- * sorted ResultTable in a Queries object as an HTML <table> element, and
1474
- * registers a listener so that any changes to that result will cause a
1475
- * re-render.
1476
- *
1477
- * See the <ResultSortedTableInHtmlTable /> demo for this component in action.
1478
- *
1479
- * The component's props identify which ResultTable to render based on query Id,
1480
- * and Queries object (which is either the default context Queries object, a
1481
- * named context Queries object, or by explicit reference). It also takes a Cell
1482
- * Id to sort by and a boolean to indicate that the sorting should be in
1483
- * descending order. The `offset` and `limit` props are used to paginate
1484
- * results, but default to `0` and `undefined` to return all available Row Ids
1485
- * if not specified.
1486
- *
1487
- * This component renders a ResultTable by iterating over its Row objects, in
1488
- * the order dictated by the sort parameters. By default the Cells are in turn
1489
- * rendered with the CellView component, but you can override this behavior by
1490
- * providing a `component` for each Cell in the `customCells` prop. You can pass
1491
- * additional props to that custom component with the `getComponentProps`
1492
- * callback. See the ResultCustomCell type for more details.
1493
- *
1494
- * This component uses the useSortedRowIds hook under the covers, which means
1495
- * that any changes to the structure or sorting of the ResultTable will cause a
1496
- * re-render.
1497
- *
1498
- * You can use the `headerRow` and `idColumn` props to control whether the Ids
1499
- * appear in a <th> element at the top of the table, and the start of each row.
1500
- *
1501
- * The `sortOnClick` prop makes the table's sorting interactive such that the
1502
- * user can click on a column heading to sort by that column. The style classes
1503
- * `sorted` and `ascending` (or `descending`) are added so that you can provide
1504
- * hints to the user how the sorting is being applied.
1505
- *
1506
- * Provide a paginator component for the ResultTable with the `paginator` prop.
1507
- * Set to `true` to use the default SortedTablePaginator, or provide your own
1508
- * component that accepts SortedTablePaginatorProps.
1509
- *
1510
- * Finally, the `onChange` prop lets you listen to a user's changes to the
1511
- * ResultTable's sorting or pagination.
1512
- * @param props The props for this component.
1513
- * @returns A rendering of the ResultTable in a <table> element.
1514
- * @example
1515
- * This example creates a Provider context into which a default Queries object
1516
- * is provided. The ResultSortedTableInHtmlTable component within it then
1517
- * renders the ResultTable in a <table> element with a CSS class.
1518
- *
1519
- * ```jsx
1520
- * import React from 'react';
1521
- * import {createRoot} from 'react-dom/client';
1522
- * import {createQueries, createStore} from 'tinybase';
1523
- * import {Provider} from 'tinybase/ui-react';
1524
- * import {ResultSortedTableInHtmlTable} from 'tinybase/ui-react-dom';
1525
- *
1526
- * const App = ({queries}) => (
1527
- * <Provider queries={queries}>
1528
- * <Pane />
1529
- * </Provider>
1530
- * );
1531
- * const Pane = () => (
1532
- * <ResultSortedTableInHtmlTable
1533
- * queryId="petColors"
1534
- * cellId="color"
1535
- * className="table"
1536
- * />
1537
- * );
1538
- *
1539
- * const queries = createQueries(
1540
- * createStore().setTable('pets', {
1541
- * fido: {species: 'dog', color: 'brown'},
1542
- * felix: {species: 'cat', color: 'black'},
1543
- * }),
1544
- * ).setQueryDefinition('petColors', 'pets', ({select}) => select('color'));
1545
- * const app = document.createElement('div');
1546
- * createRoot(app).render(<App queries={queries} />); // !act
1547
- * console.log(app.innerHTML);
1548
- * // ->
1549
- * `
1550
- * <table class="table">
1551
- * <thead>
1552
- * <tr>
1553
- * <th>Id</th>
1554
- * <th class="sorted ascending">↑ color</th>
1555
- * </tr>
1556
- * </thead>
1557
- * <tbody>
1558
- * <tr>
1559
- * <th>felix</th>
1560
- * <td>black</td>
1561
- * </tr>
1562
- * <tr>
1563
- * <th>fido</th>
1564
- * <td>brown</td>
1565
- * </tr>
1566
- * </tbody>
1567
- * </table>
1568
- * `;
1569
- * ```
1570
- * @example
1571
- * This example creates a Provider context into which a default Queries object
1572
- * is provided. The ResultSortedTableInHtmlTable component within it then
1573
- * renders the ResultTable with a custom component and a custom props callback
1574
- * for the `color` Cell. The header row at the top of the table and the Id
1575
- * column at the start of each row is removed.
1576
- *
1577
- * ```jsx
1578
- * import React from 'react';
1579
- * import {createRoot} from 'react-dom/client';
1580
- * import {createQueries, createStore} from 'tinybase';
1581
- * import {Provider, ResultCellView} from 'tinybase/ui-react';
1582
- * import {ResultSortedTableInHtmlTable} from 'tinybase/ui-react-dom';
1583
- *
1584
- * const App = ({queries}) => (
1585
- * <Provider queries={queries}>
1586
- * <Pane />
1587
- * </Provider>
1588
- * );
1589
- *
1590
- * const Pane = () => (
1591
- * <ResultSortedTableInHtmlTable
1592
- * queryId="petColors"
1593
- * cellId="color"
1594
- * customCells={customCells}
1595
- * headerRow={false}
1596
- * idColumn={false}
1597
- * />
1598
- * );
1599
- *
1600
- * const FormattedResultCellView = ({queryId, rowId, cellId, bold}) => (
1601
- * <>
1602
- * {bold ? <b>{rowId}</b> : rowId}:
1603
- * <ResultCellView queryId={queryId} rowId={rowId} cellId={cellId} />
1604
- * </>
1605
- * );
1606
- * const customCells = {
1607
- * color: {
1608
- * component: FormattedResultCellView,
1609
- * getComponentProps: (rowId) => ({bold: rowId == 'fido'}),
1610
- * },
1611
- * };
1612
- *
1613
- * const queries = createQueries(
1614
- * createStore().setTable('pets', {
1615
- * fido: {species: 'dog', color: 'brown'},
1616
- * felix: {species: 'cat', color: 'black'},
1617
- * }),
1618
- * ).setQueryDefinition('petColors', 'pets', ({select}) => select('color'));
1619
- * const app = document.createElement('div');
1620
- * createRoot(app).render(<App queries={queries} />); // !act
1621
- * console.log(app.innerHTML);
1622
- * // ->
1623
- * `
1624
- * <table>
1625
- * <tbody>
1626
- * <tr>
1627
- * <td>felix:black</td>
1628
- * </tr>
1629
- * <tr>
1630
- * <td><b>fido</b>:brown</td>
1631
- * </tr>
1632
- * </tbody>
1633
- * </table>
1634
- * `;
1635
- * ```
1636
- * @category Queries components
1637
- * @since v4.1.0
1638
- */
1639
- export function ResultSortedTableInHtmlTable(
1640
- props: ResultSortedTableInHtmlTableProps & HtmlTableProps,
1641
- ): ComponentReturnType;
1642
-
1643
- /**
1644
- * The EditableCellView component renders the value of a single Cell in a way
1645
- * that can be edited in a web browser, and registers a listener so that any
1646
- * changes to that result will cause a re-render.
1647
- *
1648
- * See the <EditableCellView /> demo for this component in action.
1649
- *
1650
- * The component's props identify which Cell to render based on Table Id, Row
1651
- * Id, Cell Id, and Store (which is either the default context Store, a named
1652
- * context Store, or an explicit reference).
1653
- *
1654
- * A Cell contains a string, number, or boolean, so the value is rendered in an
1655
- * appropriate <input> tag and a button lets the user change type, if possible.
1656
- *
1657
- * Set the `showType` prop to false to remove the ability for the user to see or
1658
- * change the Cell type. They will also not be able to change the type if there
1659
- * is a TablesSchema applied to the Store.
1660
- *
1661
- * This component uses the useCell hook under the covers, which means that any
1662
- * changes to the specified Cell outside of this component will cause a
1663
- * re-render.
1664
- *
1665
- * You can provide a custom className prop which well be used on the root of the
1666
- * resulting element. If omitted the element's class will be `editableCell`. The
1667
- * debugIds prop has no effect on this component.
1668
- * @param props The props for this component.
1669
- * @returns An editable rendering of the Cell.
1670
- * @example
1671
- * This example creates a Provider context into which a default Store is
1672
- * provided. The EditableCellView component within it then renders an editable
1673
- * Cell.
1674
- *
1675
- * ```jsx
1676
- * import React from 'react';
1677
- * import {createRoot} from 'react-dom/client';
1678
- * import {createStore} from 'tinybase';
1679
- * import {Provider} from 'tinybase/ui-react';
1680
- * import {EditableCellView} from 'tinybase/ui-react-dom';
1681
- *
1682
- * const App = ({store}) => (
1683
- * <Provider store={store}>
1684
- * <Pane />
1685
- * </Provider>
1686
- * );
1687
- * const Pane = () => (
1688
- * <EditableCellView tableId="pets" rowId="fido" cellId="color" />
1689
- * );
1690
- *
1691
- * const store = createStore().setCell('pets', 'fido', 'color', 'brown');
1692
- * const app = document.createElement('div');
1693
- * createRoot(app).render(<App store={store} />); // !act
1694
- * console.log(app.innerHTML);
1695
- * // ->
1696
- * `
1697
- * <div class="editableCell">
1698
- * <button class="string">string</button>
1699
- * <input value="brown">
1700
- * </div>
1701
- * `;
1702
- * ```
1703
- * @category Store components
1704
- * @since v4.1.0
1705
- */
1706
- export function EditableCellView(
1707
- props: CellProps & {readonly className?: string; readonly showType?: boolean},
1708
- ): ComponentReturnType;
1709
-
1710
- /**
1711
- * The EditableValueView component renders the value of a single Value in a way
1712
- * that can be edited in a web browser, and registers a listener so that any
1713
- * changes to that result will cause a re-render.
1714
- *
1715
- * See the <EditableValueView /> demo for this component in action.
1716
- *
1717
- * The component's props identify which Value to render based on Table Id, Row
1718
- * Id, Value Id, and Store (which is either the default context Store, a named
1719
- * context Store, or an explicit reference).
1720
- *
1721
- * A Value contains a string, number, or boolean, so the value is rendered in an
1722
- * appropriate <input> tag and a button lets the user change type, if possible.
1723
- *
1724
- * Set the `showType` prop to false to remove the ability for the user to see or
1725
- * change the Value type. They will also not be able to change the type if there
1726
- * is a ValuesSchema applied to the Store.
1727
- *
1728
- * This component uses the useValue hook under the covers, which means that any
1729
- * changes to the specified Value outside of this component will cause a
1730
- * re-render.
1731
- *
1732
- * You can provide a custom className prop which well be used on the root of the
1733
- * resulting element. If omitted the element's class will be `editableValue`.
1734
- * The debugIds prop has no effect on this component.
1735
- * @param props The props for this component.
1736
- * @returns An editable rendering of the Value.
1737
- * @example
1738
- * This example creates a Provider context into which a default Store is
1739
- * provided. The EditableValueView component within it then renders an editable
1740
- * Value.
1741
- *
1742
- * ```jsx
1743
- * import React from 'react';
1744
- * import {createRoot} from 'react-dom/client';
1745
- * import {createStore} from 'tinybase';
1746
- * import {Provider} from 'tinybase/ui-react';
1747
- * import {EditableValueView} from 'tinybase/ui-react-dom';
1748
- *
1749
- * const App = ({store}) => (
1750
- * <Provider store={store}>
1751
- * <Pane />
1752
- * </Provider>
1753
- * );
1754
- * const Pane = () => <EditableValueView valueId="employees" />;
1755
- *
1756
- * const store = createStore().setValue('employees', 3);
1757
- * const app = document.createElement('div');
1758
- * createRoot(app).render(<App store={store} />); // !act
1759
- * console.log(app.innerHTML);
1760
- * // ->
1761
- * `
1762
- * <div class="editableValue">
1763
- * <button class="number">number</button>
1764
- * <input type="number" value="3">
1765
- * </div>
1766
- * `;
1767
- * ```
1768
- * @category Store components
1769
- * @since v4.1.0
1770
- */
1771
- export function EditableValueView(
1772
- props: ValueProps & {
1773
- readonly className?: string;
1774
- readonly showType?: boolean;
1775
- },
1776
- ): ComponentReturnType;
1777
-
1778
- /**
1779
- * The SortedTablePaginator component renders a paginator for a sorted table.
1780
- *
1781
- * See the <SortedTableInHtmlTable /> demo for this component in action.
1782
- *
1783
- * The component displays 'previous' and 'next' buttons for paging through the
1784
- * Table if there are more Row Ids than fit in each page. The component will
1785
- * also display a label that shows which Row Ids are being displayed.
1786
- *
1787
- * The component's props identify initial pagination settings, and it will fire
1788
- * an event when the pagination changes.
1789
- * @param props The props for this component.
1790
- * @returns The rendering of a paginator control with a label, and next and
1791
- * previous buttons, where appropriate.
1792
- * @example
1793
- * This example creates a Provider context into which a default Store is
1794
- * provided. The SortedTableInHtmlTable component within it then renders the
1795
- * Table in a <table> element with a SortedTablePaginator (the default).
1796
- *
1797
- * ```jsx
1798
- * import React from 'react';
1799
- * import {createRoot} from 'react-dom/client';
1800
- * import {createStore} from 'tinybase';
1801
- * import {Provider} from 'tinybase/ui-react';
1802
- * import {SortedTableInHtmlTable} from 'tinybase/ui-react-dom';
1803
- *
1804
- * const App = ({store}) => (
1805
- * <Provider store={store}>
1806
- * <Pane />
1807
- * </Provider>
1808
- * );
1809
- * const Pane = () => (
1810
- * <SortedTableInHtmlTable
1811
- * tableId="pets"
1812
- * cellId="species"
1813
- * limit={2}
1814
- * paginator={true}
1815
- * />
1816
- * );
1817
- *
1818
- * const store = createStore().setTables({
1819
- * pets: {
1820
- * fido: {species: 'dog'},
1821
- * felix: {species: 'cat'},
1822
- * cujo: {species: 'wolf'},
1823
- * lowly: {species: 'worm'},
1824
- * polly: {species: 'parrot'},
1825
- * },
1826
- * });
1827
- * const app = document.createElement('div');
1828
- * createRoot(app).render(<App store={store} />); // !act
1829
- * console.log(app.innerHTML);
1830
- * // ->
1831
- * `
1832
- * <table>
1833
- * <caption>
1834
- * <button class="previous" disabled="">←</button>
1835
- * <button class="next">→</button>
1836
- * 1 to 2 of 5 rows
1837
- * </caption>
1838
- * <thead>
1839
- * <tr>
1840
- * <th>Id</th>
1841
- * <th class="sorted ascending">↑ species</th>
1842
- * </tr>
1843
- * </thead>
1844
- * <tbody>
1845
- * <tr>
1846
- * <th>felix</th>
1847
- * <td>cat</td>
1848
- * </tr>
1849
- * <tr>
1850
- * <th>fido</th>
1851
- * <td>dog</td>
1852
- * </tr>
1853
- * </tbody>
1854
- * </table>
1855
- * `;
1856
- * ```
1857
- * @category Store components
1858
- * @since v4.1.0
1859
- */
1860
- export function SortedTablePaginator(
1861
- props: SortedTablePaginatorProps,
1862
- ): ComponentReturnType;