tinybase 4.1.0-beta.3 → 4.1.0-beta.4
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/lib/checkpoints.js +1 -1
- package/lib/checkpoints.js.gz +0 -0
- package/lib/cjs/checkpoints.cjs +1 -1
- package/lib/cjs/checkpoints.cjs.gz +0 -0
- package/lib/cjs/common.cjs +1 -1
- package/lib/cjs/common.cjs.gz +0 -0
- package/lib/cjs/indexes.cjs +1 -1
- package/lib/cjs/indexes.cjs.gz +0 -0
- package/lib/cjs/metrics.cjs +1 -1
- package/lib/cjs/metrics.cjs.gz +0 -0
- package/lib/cjs/queries.cjs +1 -1
- package/lib/cjs/queries.cjs.gz +0 -0
- package/lib/cjs/relationships.cjs +1 -1
- package/lib/cjs/relationships.cjs.gz +0 -0
- package/lib/cjs/store.cjs +1 -1
- package/lib/cjs/store.cjs.gz +0 -0
- package/lib/cjs/tinybase.cjs +1 -1
- package/lib/cjs/tinybase.cjs.gz +0 -0
- package/lib/cjs/ui-react-dom-debug.cjs +1 -0
- package/lib/cjs/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs/ui-react-dom.cjs +1 -1
- package/lib/cjs/ui-react-dom.cjs.gz +0 -0
- package/lib/cjs/ui-react.cjs +1 -1
- package/lib/cjs/ui-react.cjs.gz +0 -0
- package/lib/cjs-es6/checkpoints.cjs +1 -1
- package/lib/cjs-es6/checkpoints.cjs.gz +0 -0
- package/lib/cjs-es6/common.cjs +1 -1
- package/lib/cjs-es6/common.cjs.gz +0 -0
- package/lib/cjs-es6/indexes.cjs +1 -1
- package/lib/cjs-es6/indexes.cjs.gz +0 -0
- package/lib/cjs-es6/metrics.cjs +1 -1
- package/lib/cjs-es6/metrics.cjs.gz +0 -0
- package/lib/cjs-es6/queries.cjs +1 -1
- package/lib/cjs-es6/queries.cjs.gz +0 -0
- package/lib/cjs-es6/relationships.cjs +1 -1
- package/lib/cjs-es6/relationships.cjs.gz +0 -0
- package/lib/cjs-es6/store.cjs +1 -1
- package/lib/cjs-es6/store.cjs.gz +0 -0
- package/lib/cjs-es6/tinybase.cjs +1 -1
- package/lib/cjs-es6/tinybase.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom-debug.cjs +1 -0
- package/lib/cjs-es6/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom.cjs +1 -1
- package/lib/cjs-es6/ui-react-dom.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react.cjs +1 -1
- package/lib/cjs-es6/ui-react.cjs.gz +0 -0
- package/lib/common.js +1 -1
- package/lib/common.js.gz +0 -0
- package/lib/debug/checkpoints.js +1 -1
- package/lib/debug/common.js +2 -1
- package/lib/debug/indexes.js +3 -2
- package/lib/debug/metrics.js +1 -1
- package/lib/debug/queries.js +3 -1
- package/lib/debug/relationships.js +1 -1
- package/lib/debug/store.js +32 -6
- package/lib/debug/tinybase.js +33 -6
- package/lib/debug/ui-react-dom.js +2143 -79
- package/lib/debug/ui-react.js +85 -25
- package/lib/es6/checkpoints.js +1 -1
- package/lib/es6/checkpoints.js.gz +0 -0
- package/lib/es6/common.js +1 -1
- package/lib/es6/common.js.gz +0 -0
- package/lib/es6/indexes.js +1 -1
- package/lib/es6/indexes.js.gz +0 -0
- package/lib/es6/metrics.js +1 -1
- package/lib/es6/metrics.js.gz +0 -0
- package/lib/es6/queries.js +1 -1
- package/lib/es6/queries.js.gz +0 -0
- package/lib/es6/relationships.js +1 -1
- package/lib/es6/relationships.js.gz +0 -0
- package/lib/es6/store.js +1 -1
- package/lib/es6/store.js.gz +0 -0
- package/lib/es6/tinybase.js +1 -1
- package/lib/es6/tinybase.js.gz +0 -0
- package/lib/es6/ui-react-dom-debug.js +1 -0
- package/lib/es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/es6/ui-react-dom.js +1 -1
- package/lib/es6/ui-react-dom.js.gz +0 -0
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- package/lib/indexes.js +1 -1
- package/lib/indexes.js.gz +0 -0
- package/lib/metrics.js +1 -1
- package/lib/metrics.js.gz +0 -0
- package/lib/queries.js +1 -1
- package/lib/queries.js.gz +0 -0
- package/lib/relationships.js +1 -1
- package/lib/relationships.js.gz +0 -0
- package/lib/store.js +1 -1
- package/lib/store.js.gz +0 -0
- package/lib/tinybase.js +1 -1
- package/lib/tinybase.js.gz +0 -0
- package/lib/types/queries.d.ts +204 -19
- package/lib/types/store.d.ts +155 -0
- package/lib/types/ui-react-dom.d.ts +278 -18
- package/lib/types/ui-react.d.ts +532 -1
- package/lib/types/with-schemas/queries.d.ts +229 -21
- package/lib/types/with-schemas/store.d.ts +188 -0
- package/lib/types/with-schemas/ui-react-dom.d.ts +278 -18
- package/lib/types/with-schemas/ui-react.d.ts +576 -2
- package/lib/ui-react-dom.js +1 -1
- package/lib/ui-react-dom.js.gz +0 -0
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/checkpoints.js +1 -1
- package/lib/umd/checkpoints.js.gz +0 -0
- package/lib/umd/common.js +1 -1
- package/lib/umd/common.js.gz +0 -0
- package/lib/umd/indexes.js +1 -1
- package/lib/umd/indexes.js.gz +0 -0
- package/lib/umd/metrics.js +1 -1
- package/lib/umd/metrics.js.gz +0 -0
- package/lib/umd/queries.js +1 -1
- package/lib/umd/queries.js.gz +0 -0
- package/lib/umd/relationships.js +1 -1
- package/lib/umd/relationships.js.gz +0 -0
- package/lib/umd/store.js +1 -1
- package/lib/umd/store.js.gz +0 -0
- package/lib/umd/tinybase.js +1 -1
- package/lib/umd/tinybase.js.gz +0 -0
- package/lib/umd/ui-react-dom-debug.js +1 -0
- package/lib/umd/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd/ui-react-dom.js +1 -1
- package/lib/umd/ui-react-dom.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/lib/umd-es6/checkpoints.js +1 -1
- package/lib/umd-es6/checkpoints.js.gz +0 -0
- package/lib/umd-es6/common.js +1 -1
- package/lib/umd-es6/common.js.gz +0 -0
- package/lib/umd-es6/indexes.js +1 -1
- package/lib/umd-es6/indexes.js.gz +0 -0
- package/lib/umd-es6/metrics.js +1 -1
- package/lib/umd-es6/metrics.js.gz +0 -0
- package/lib/umd-es6/queries.js +1 -1
- package/lib/umd-es6/queries.js.gz +0 -0
- package/lib/umd-es6/relationships.js +1 -1
- package/lib/umd-es6/relationships.js.gz +0 -0
- package/lib/umd-es6/store.js +1 -1
- package/lib/umd-es6/store.js.gz +0 -0
- package/lib/umd-es6/tinybase.js +1 -1
- package/lib/umd-es6/tinybase.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom-debug.js +1 -0
- package/lib/umd-es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom.js +1 -1
- package/lib/umd-es6/ui-react-dom.js.gz +0 -0
- package/lib/umd-es6/ui-react.js +1 -1
- package/lib/umd-es6/ui-react.js.gz +0 -0
- package/package.json +10 -9
- package/readme.md +3 -3
|
@@ -23,7 +23,12 @@ import {
|
|
|
23
23
|
import {Id, Ids} from './common';
|
|
24
24
|
import {ComponentType} from 'react';
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* The CustomCell object is used to configure custom cell rendering in an HTML
|
|
28
|
+
* table.
|
|
29
|
+
* @category Configuration
|
|
30
|
+
* @since v4.1.0
|
|
31
|
+
*/
|
|
27
32
|
export type CustomCell = {
|
|
28
33
|
/**
|
|
29
34
|
* An optional string that will be used as the label at the top of the table
|
|
@@ -42,7 +47,12 @@ export type CustomCell = {
|
|
|
42
47
|
readonly getComponentProps?: (rowId: Id, cellId: Id) => ExtraProps;
|
|
43
48
|
};
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
/**
|
|
51
|
+
* The CustomResultCell object is used to configure custom cell rendering for
|
|
52
|
+
* query results in an HTML table.
|
|
53
|
+
* @category Configuration
|
|
54
|
+
* @since v4.1.0
|
|
55
|
+
*/
|
|
46
56
|
export type CustomResultCell = {
|
|
47
57
|
/**
|
|
48
58
|
* An optional string that will be used as the label at the top of the table
|
|
@@ -61,7 +71,13 @@ export type CustomResultCell = {
|
|
|
61
71
|
readonly getComponentProps?: (rowId: Id, cellId: Id) => ExtraProps;
|
|
62
72
|
};
|
|
63
73
|
|
|
64
|
-
|
|
74
|
+
/**
|
|
75
|
+
* HtmlTableProps props are used for components that will render in an HTML
|
|
76
|
+
* table, such as the TableInHtmlTable component or SortedTableInHtmlTable
|
|
77
|
+
* component.
|
|
78
|
+
* @category Props
|
|
79
|
+
* @since v4.1.0
|
|
80
|
+
*/
|
|
65
81
|
export type HtmlTableProps = {
|
|
66
82
|
/**
|
|
67
83
|
* A string className to use on the root of the resulting element.
|
|
@@ -79,7 +95,12 @@ export type HtmlTableProps = {
|
|
|
79
95
|
readonly idColumn?: boolean;
|
|
80
96
|
};
|
|
81
97
|
|
|
82
|
-
|
|
98
|
+
/**
|
|
99
|
+
* TableInHtmlTableProps props are used for components that will render a Table
|
|
100
|
+
* in an HTML table, such as the TableInHtmlTable component.
|
|
101
|
+
* @category Props
|
|
102
|
+
* @since v4.1.0
|
|
103
|
+
*/
|
|
83
104
|
export type TableInHtmlTableProps = {
|
|
84
105
|
/**
|
|
85
106
|
* The Id of the Table in the Store to be rendered.
|
|
@@ -106,7 +127,12 @@ export type TableInHtmlTableProps = {
|
|
|
106
127
|
readonly customCells?: Ids | {[cellId: Id]: string | CustomCell};
|
|
107
128
|
};
|
|
108
129
|
|
|
109
|
-
|
|
130
|
+
/**
|
|
131
|
+
* SortedTableInHtmlTableProps props are used for components that will render a
|
|
132
|
+
* sorted Table in an HTML table, such as the SortedTableInHtmlTable component.
|
|
133
|
+
* @category Props
|
|
134
|
+
* @since v4.1.0
|
|
135
|
+
*/
|
|
110
136
|
export type SortedTableInHtmlTableProps = {
|
|
111
137
|
/**
|
|
112
138
|
* The Id of the Table in the Store to be rendered.
|
|
@@ -153,9 +179,31 @@ export type SortedTableInHtmlTableProps = {
|
|
|
153
179
|
* the sorting and/or direction.
|
|
154
180
|
*/
|
|
155
181
|
readonly sortOnClick?: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Either `true` to show the default SortedTablePaginator for the Table, or
|
|
184
|
+
* provide your own paginator component that takes SortedTablePaginatorProps.
|
|
185
|
+
*/
|
|
186
|
+
readonly paginator?: boolean | ComponentType<SortedTablePaginatorProps>;
|
|
187
|
+
/**
|
|
188
|
+
* A function that is called whenever the sorting or pagination of the Table
|
|
189
|
+
* is changed by the user, invoked with the sorted Cell Id, whether descending
|
|
190
|
+
* or not, and the offset of the pagination.
|
|
191
|
+
*/
|
|
192
|
+
readonly onChange?: (
|
|
193
|
+
sortAndOffset: [
|
|
194
|
+
cellId: Id | undefined,
|
|
195
|
+
descending: boolean,
|
|
196
|
+
offset: number,
|
|
197
|
+
],
|
|
198
|
+
) => void;
|
|
156
199
|
};
|
|
157
200
|
|
|
158
|
-
|
|
201
|
+
/**
|
|
202
|
+
* ResultTableInHtmlTableProps props are used for components that will render a
|
|
203
|
+
* ResultTable in an HTML table, such as the ResultTableInHtmlTable component.
|
|
204
|
+
* @category Props
|
|
205
|
+
* @since v4.1.0
|
|
206
|
+
*/
|
|
159
207
|
export type ResultTableInHtmlTableProps = {
|
|
160
208
|
/**
|
|
161
209
|
* The Id of the query in the Queries object for which the ResultTable will be
|
|
@@ -178,7 +226,13 @@ export type ResultTableInHtmlTableProps = {
|
|
|
178
226
|
readonly customCells?: Ids | {[cellId: Id]: string | CustomResultCell};
|
|
179
227
|
};
|
|
180
228
|
|
|
181
|
-
|
|
229
|
+
/**
|
|
230
|
+
* ResultSortedTableInHtmlTableProps props are used for components that will
|
|
231
|
+
* render a sorted Table in an HTML table, such as the SortedTableInHtmlTable
|
|
232
|
+
* component.
|
|
233
|
+
* @category Props
|
|
234
|
+
* @since v4.1.0
|
|
235
|
+
*/
|
|
182
236
|
export type ResultSortedTableInHtmlTableProps = {
|
|
183
237
|
/**
|
|
184
238
|
* The Id of the query in the Queries object for which the ResultTable will be
|
|
@@ -221,9 +275,32 @@ export type ResultSortedTableInHtmlTableProps = {
|
|
|
221
275
|
* the sorting and/or direction.
|
|
222
276
|
*/
|
|
223
277
|
readonly sortOnClick?: boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Either `true` to show the default SortedTablePaginator for the ResultTable,
|
|
280
|
+
* or provide your own paginator component that takes
|
|
281
|
+
* SortedTablePaginatorProps.
|
|
282
|
+
*/
|
|
283
|
+
readonly paginator?: boolean | ComponentType<SortedTablePaginatorProps>;
|
|
284
|
+
/**
|
|
285
|
+
* A function that is called whenever the sorting or pagination of the
|
|
286
|
+
* ResultTable is changed by the user, invoked with the sorted Cell Id,
|
|
287
|
+
* whether descending or not, and the offset of the pagination.
|
|
288
|
+
*/
|
|
289
|
+
readonly onChange?: (
|
|
290
|
+
sortAndOffset: [
|
|
291
|
+
cellId: Id | undefined,
|
|
292
|
+
descending: boolean,
|
|
293
|
+
offset: number,
|
|
294
|
+
],
|
|
295
|
+
) => void;
|
|
224
296
|
};
|
|
225
297
|
|
|
226
|
-
|
|
298
|
+
/**
|
|
299
|
+
* ValuesInHtmlTableProps props are used for components that will render Values
|
|
300
|
+
* in an HTML table, such as the ValuesInHtmlTable component.
|
|
301
|
+
* @category Props
|
|
302
|
+
* @since v4.1.0
|
|
303
|
+
*/
|
|
227
304
|
export type ValuesInHtmlTableProps = {
|
|
228
305
|
/**
|
|
229
306
|
* The Store to be accessed: omit for the default context Store, provide an Id
|
|
@@ -248,6 +325,60 @@ export type ValuesInHtmlTableProps = {
|
|
|
248
325
|
readonly getValueComponentProps?: (valueId: Id) => ExtraProps;
|
|
249
326
|
};
|
|
250
327
|
|
|
328
|
+
/**
|
|
329
|
+
* SortedTablePaginatorProps props are used for components that will be used as
|
|
330
|
+
* a table paginator, such as the SortedTablePaginator component.
|
|
331
|
+
* @category Props
|
|
332
|
+
* @since v4.1.0
|
|
333
|
+
*/
|
|
334
|
+
export type SortedTablePaginatorProps = {
|
|
335
|
+
/**
|
|
336
|
+
* An event that will fire when the offset is updated, called with the new
|
|
337
|
+
* offset.
|
|
338
|
+
*/
|
|
339
|
+
readonly onChange: (offset: number) => void;
|
|
340
|
+
/**
|
|
341
|
+
* The number of Row Ids to skip for pagination.
|
|
342
|
+
*/
|
|
343
|
+
readonly offset?: number;
|
|
344
|
+
/**
|
|
345
|
+
* The maximum number of Row Ids being returned.
|
|
346
|
+
*/
|
|
347
|
+
readonly limit?: number;
|
|
348
|
+
/**
|
|
349
|
+
* The total number of Row Ids in the paginated table.
|
|
350
|
+
*/
|
|
351
|
+
readonly total: number;
|
|
352
|
+
/**
|
|
353
|
+
* A noun to use in the pagination label for a single row, defaulting to
|
|
354
|
+
* 'row'.
|
|
355
|
+
*/
|
|
356
|
+
readonly singular?: string;
|
|
357
|
+
/**
|
|
358
|
+
* A noun to use in the pagination label for multiple rows, defaulting to the
|
|
359
|
+
* value of the singular noun suffixed with the letter 's'.
|
|
360
|
+
*/
|
|
361
|
+
readonly plural?: string;
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* StoreInspectorProps props are used to configure the StoreInspector component.
|
|
366
|
+
* @category Props
|
|
367
|
+
* @since v4.1.0
|
|
368
|
+
*/
|
|
369
|
+
export type StoreInspectorProps = {
|
|
370
|
+
/**
|
|
371
|
+
* An optional string to indicate where you want the inspector to first
|
|
372
|
+
* appear.
|
|
373
|
+
*/
|
|
374
|
+
readonly position?: 'left' | 'top' | 'bottom' | 'right' | 'full';
|
|
375
|
+
/**
|
|
376
|
+
* An optional boolean to indicate whether the inspector should start in the
|
|
377
|
+
* opened state.
|
|
378
|
+
*/
|
|
379
|
+
readonly open?: boolean;
|
|
380
|
+
};
|
|
381
|
+
|
|
251
382
|
/**
|
|
252
383
|
* The TableInHtmlTable component renders the contents of a single Table in a
|
|
253
384
|
* Store as an HTML <table> element, and registers a listener so that any
|
|
@@ -410,6 +541,13 @@ export function TableInHtmlTable(
|
|
|
410
541
|
* user can click on a column heading to sort by that column. The style classes
|
|
411
542
|
* `sorted` and `ascending` (or `descending`) are added so that you can provide
|
|
412
543
|
* hints to the user how the sorting is being applied.
|
|
544
|
+
*
|
|
545
|
+
* Provide a paginator component for the Table with the `paginator` prop. Set to
|
|
546
|
+
* `true` to use the default SortedTablePaginator, or provide your own component
|
|
547
|
+
* that accepts SortedTablePaginatorProps.
|
|
548
|
+
*
|
|
549
|
+
* Finally, the `onChange` prop lets you listen to a user's changes to the
|
|
550
|
+
* Table's sorting or pagination.
|
|
413
551
|
* @param props The props for this component.
|
|
414
552
|
* @returns A rendering of the Table in a <table> element.
|
|
415
553
|
* @example
|
|
@@ -446,7 +584,7 @@ export function TableInHtmlTable(
|
|
|
446
584
|
* <thead>
|
|
447
585
|
* <tr>
|
|
448
586
|
* <th>Id</th>
|
|
449
|
-
* <th class="sorted ascending"
|
|
587
|
+
* <th class="sorted ascending">↑ species</th>
|
|
450
588
|
* </tr>
|
|
451
589
|
* </thead>
|
|
452
590
|
* <tbody>
|
|
@@ -658,9 +796,9 @@ export function ValuesInHtmlTable(
|
|
|
658
796
|
* This component renders a ResultTable by iterating over its Row objects. By
|
|
659
797
|
* default the Cells are in turn rendered with the CellView component, but you
|
|
660
798
|
* can override this behavior by providing a `component` for each Cell in the
|
|
661
|
-
* `customCells` prop. You can pass additional props to that custom
|
|
662
|
-
*
|
|
663
|
-
*
|
|
799
|
+
* `customCells` prop. You can pass additional props to that custom component
|
|
800
|
+
* with the `getComponentProps` callback. See the ResultCustomCell type for more
|
|
801
|
+
* details.
|
|
664
802
|
*
|
|
665
803
|
* This component uses the useRowIds hook under the covers, which means that any
|
|
666
804
|
* changes to the structure of the Table will cause a re-render.
|
|
@@ -799,9 +937,9 @@ export function ResultTableInHtmlTable(
|
|
|
799
937
|
* This component renders a ResultTable by iterating over its Row objects, in
|
|
800
938
|
* the order dictated by the sort parameters. By default the Cells are in turn
|
|
801
939
|
* rendered with the CellView component, but you can override this behavior by
|
|
802
|
-
* providing a `component` for each Cell in the `customCells` prop. You
|
|
803
|
-
*
|
|
804
|
-
*
|
|
940
|
+
* providing a `component` for each Cell in the `customCells` prop. You can pass
|
|
941
|
+
* additional props to that custom component with the `getComponentProps`
|
|
942
|
+
* callback. See the ResultCustomCell type for more details.
|
|
805
943
|
*
|
|
806
944
|
* This component uses the useSortedRowIds hook under the covers, which means
|
|
807
945
|
* that any changes to the structure or sorting of the ResultTable will cause a
|
|
@@ -814,6 +952,13 @@ export function ResultTableInHtmlTable(
|
|
|
814
952
|
* user can click on a column heading to sort by that column. The style classes
|
|
815
953
|
* `sorted` and `ascending` (or `descending`) are added so that you can provide
|
|
816
954
|
* hints to the user how the sorting is being applied.
|
|
955
|
+
*
|
|
956
|
+
* Provide a paginator component for the ResultTable with the `paginator` prop.
|
|
957
|
+
* Set to `true` to use the default SortedTablePaginator, or provide your own
|
|
958
|
+
* component that accepts SortedTablePaginatorProps.
|
|
959
|
+
*
|
|
960
|
+
* Finally, the `onChange` prop lets you listen to a user's changes to the
|
|
961
|
+
* ResultTable's sorting or pagination.
|
|
817
962
|
* @param props The props for this component.
|
|
818
963
|
* @returns A rendering of the ResultTable in a <table> element.
|
|
819
964
|
* @example
|
|
@@ -850,7 +995,7 @@ export function ResultTableInHtmlTable(
|
|
|
850
995
|
* <thead>
|
|
851
996
|
* <tr>
|
|
852
997
|
* <th>Id</th>
|
|
853
|
-
* <th class="sorted ascending"
|
|
998
|
+
* <th class="sorted ascending">↑ color</th>
|
|
854
999
|
* </tr>
|
|
855
1000
|
* </thead>
|
|
856
1001
|
* <tbody>
|
|
@@ -976,7 +1121,7 @@ export function ResultSortedTableInHtmlTable(
|
|
|
976
1121
|
* // ->
|
|
977
1122
|
* `
|
|
978
1123
|
* <div class="editableCell">
|
|
979
|
-
* <button
|
|
1124
|
+
* <button class="string">string</button>
|
|
980
1125
|
* <input value="brown">
|
|
981
1126
|
* </div>
|
|
982
1127
|
* `;
|
|
@@ -1029,7 +1174,7 @@ export function EditableCellView(
|
|
|
1029
1174
|
* // ->
|
|
1030
1175
|
* `
|
|
1031
1176
|
* <div class="editableValue">
|
|
1032
|
-
* <button
|
|
1177
|
+
* <button class="number">number</button>
|
|
1033
1178
|
* <input type="number" value="3">
|
|
1034
1179
|
* </div>
|
|
1035
1180
|
* `;
|
|
@@ -1040,3 +1185,118 @@ export function EditableCellView(
|
|
|
1040
1185
|
export function EditableValueView(
|
|
1041
1186
|
props: ValueProps & {readonly className?: string},
|
|
1042
1187
|
): ComponentReturnType;
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* The SortedTablePaginator component renders a paginator for a sorted table.
|
|
1191
|
+
*
|
|
1192
|
+
* The component displays 'previous' and 'next' buttons for paging through the
|
|
1193
|
+
* Table if there are more Row Ids than fit in each page. The component will
|
|
1194
|
+
* also display a label that shows which Row Ids are being displayed.
|
|
1195
|
+
*
|
|
1196
|
+
* The component's props identify initial pagination settings, and it will fire
|
|
1197
|
+
* an event when the pagination changes.
|
|
1198
|
+
* @param props The props for this component.
|
|
1199
|
+
* @returns The rendering of a paginator control with a label, and next and
|
|
1200
|
+
* previous buttons, where appropriate.
|
|
1201
|
+
* @example
|
|
1202
|
+
* This example creates a Provider context into which a default Store is
|
|
1203
|
+
* provided. The SortedTableInHtmlTable component within it then renders the
|
|
1204
|
+
* Table in a <table> element with a SortedTablePaginator (the default).
|
|
1205
|
+
*
|
|
1206
|
+
* ```jsx
|
|
1207
|
+
* const App = ({store}) => (
|
|
1208
|
+
* <Provider store={store}>
|
|
1209
|
+
* <Pane />
|
|
1210
|
+
* </Provider>
|
|
1211
|
+
* );
|
|
1212
|
+
* const Pane = () => (
|
|
1213
|
+
* <SortedTableInHtmlTable
|
|
1214
|
+
* tableId="pets"
|
|
1215
|
+
* cellId="species"
|
|
1216
|
+
* limit={2}
|
|
1217
|
+
* paginator={true}
|
|
1218
|
+
* />
|
|
1219
|
+
* );
|
|
1220
|
+
*
|
|
1221
|
+
* const store = createStore().setTables({
|
|
1222
|
+
* pets: {
|
|
1223
|
+
* fido: {species: 'dog'},
|
|
1224
|
+
* felix: {species: 'cat'},
|
|
1225
|
+
* cujo: {species: 'wolf'},
|
|
1226
|
+
* lowly: {species: 'worm'},
|
|
1227
|
+
* polly: {species: 'parrot'},
|
|
1228
|
+
* },
|
|
1229
|
+
* });
|
|
1230
|
+
* const app = document.createElement('div');
|
|
1231
|
+
* ReactDOMClient.createRoot(app).render(<App store={store} />); // !act
|
|
1232
|
+
* console.log(app.innerHTML);
|
|
1233
|
+
* // ->
|
|
1234
|
+
* `
|
|
1235
|
+
* <table>
|
|
1236
|
+
* <caption>
|
|
1237
|
+
* <button class="previous" disabled="">←</button>
|
|
1238
|
+
* <button class="next">→</button>
|
|
1239
|
+
* 1 to 2 of 5 rows
|
|
1240
|
+
* </caption>
|
|
1241
|
+
* <thead>
|
|
1242
|
+
* <tr>
|
|
1243
|
+
* <th>Id</th>
|
|
1244
|
+
* <th class="sorted ascending">↑ species</th>
|
|
1245
|
+
* </tr>
|
|
1246
|
+
* </thead>
|
|
1247
|
+
* <tbody>
|
|
1248
|
+
* <tr>
|
|
1249
|
+
* <th>felix</th>
|
|
1250
|
+
* <td>cat</td>
|
|
1251
|
+
* </tr>
|
|
1252
|
+
* <tr>
|
|
1253
|
+
* <th>fido</th>
|
|
1254
|
+
* <td>dog</td>
|
|
1255
|
+
* </tr>
|
|
1256
|
+
* </tbody>
|
|
1257
|
+
* </table>
|
|
1258
|
+
* `;
|
|
1259
|
+
* ```
|
|
1260
|
+
* @category Store components
|
|
1261
|
+
* @since v4.1.0
|
|
1262
|
+
*/
|
|
1263
|
+
export function SortedTablePaginator(
|
|
1264
|
+
props: SortedTablePaginatorProps,
|
|
1265
|
+
): ComponentReturnType;
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* The StoreInspector component renders a tool which allows you to view and edit
|
|
1269
|
+
* the content of a Store in a debug web environment.
|
|
1270
|
+
*
|
|
1271
|
+
* The component displays a nub in the corner of the screen which you may then
|
|
1272
|
+
* click to interact with all the Store objects in the Provider component
|
|
1273
|
+
* context.
|
|
1274
|
+
*
|
|
1275
|
+
* The component's props identify the nub's initial location and panel state,
|
|
1276
|
+
* though subsequent user changes to that will be preserved on each reload.
|
|
1277
|
+
* @param props The props for this component.
|
|
1278
|
+
* @returns The rendering of the inspector tool.
|
|
1279
|
+
* @example
|
|
1280
|
+
* This example creates a Provider context into which a default Store is
|
|
1281
|
+
* provided. The StoreInspector component within it then renders the inspector
|
|
1282
|
+
* tool.
|
|
1283
|
+
*
|
|
1284
|
+
* ```jsx
|
|
1285
|
+
* const App = ({store}) => (
|
|
1286
|
+
* <Provider store={store}>
|
|
1287
|
+
* <Pane />
|
|
1288
|
+
* </Provider>
|
|
1289
|
+
* );
|
|
1290
|
+
* const Pane = () => <StoreInspector />;
|
|
1291
|
+
*
|
|
1292
|
+
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
1293
|
+
* const app = document.createElement('div');
|
|
1294
|
+
* ReactDOMClient.createRoot(app).render(<App store={store} />); // !act
|
|
1295
|
+
* // ... // !act
|
|
1296
|
+
* console.log(app.innerHTML.substring(0, 35));
|
|
1297
|
+
* // -> '<aside id="tinybaseStoreInspector">'
|
|
1298
|
+
* ```
|
|
1299
|
+
* @category Development components
|
|
1300
|
+
* @since v4.1.0
|
|
1301
|
+
*/
|
|
1302
|
+
export function StoreInspector(props: StoreInspectorProps): ComponentReturnType;
|