tinybase 9.1.0-beta.1 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/_internal/store/with-schemas/index.d.ts +133 -2
- package/@types/indexes/index.d.ts +97 -0
- package/@types/indexes/with-schemas/index.d.ts +137 -0
- package/@types/store/index.d.ts +96 -18
- package/@types/store/with-schemas/index.d.ts +107 -44
- package/@types/ui-react/index.d.ts +42 -0
- package/@types/ui-react/with-schemas/index.d.ts +101 -32
- package/@types/ui-react-dom/index.d.ts +10 -10
- package/@types/ui-react-dom/with-schemas/index.d.ts +10 -10
- package/@types/ui-react-dom-charts/index.d.ts +7 -7
- package/@types/ui-react-dom-charts/with-schemas/index.d.ts +7 -7
- package/@types/ui-react-inspector/index.d.ts +1 -1
- package/@types/ui-react-inspector/with-schemas/index.d.ts +1 -1
- package/@types/ui-solid/index.d.ts +42 -0
- package/@types/ui-solid/with-schemas/index.d.ts +101 -32
- package/@types/ui-solid-dom/index.d.ts +10 -10
- package/@types/ui-solid-dom/with-schemas/index.d.ts +10 -10
- package/@types/ui-solid-inspector/index.d.ts +1 -1
- package/@types/ui-solid-inspector/with-schemas/index.d.ts +1 -1
- package/@types/ui-svelte/index.d.ts +34 -0
- package/@types/ui-svelte/with-schemas/index.d.ts +34 -0
- package/@types/ui-svelte-dom/index.d.ts +10 -10
- package/@types/ui-svelte-dom/with-schemas/index.d.ts +10 -10
- package/@types/ui-svelte-inspector/index.d.ts +1 -1
- package/@types/ui-svelte-inspector/with-schemas/index.d.ts +1 -1
- package/index.js +121 -32
- package/indexes/index.js +39 -0
- package/indexes/with-schemas/index.js +39 -0
- package/mergeable-store/index.js +82 -32
- package/mergeable-store/with-schemas/index.js +82 -32
- package/min/index.js +1 -1
- package/min/index.js.gz +0 -0
- package/min/indexes/index.js +1 -1
- package/min/indexes/index.js.gz +0 -0
- package/min/indexes/with-schemas/index.js +1 -1
- package/min/indexes/with-schemas/index.js.gz +0 -0
- package/min/mergeable-store/index.js +1 -1
- package/min/mergeable-store/index.js.gz +0 -0
- package/min/mergeable-store/with-schemas/index.js +1 -1
- package/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/min/omni/index.js +1 -1
- package/min/omni/index.js.gz +0 -0
- package/min/omni/with-schemas/index.js +1 -1
- package/min/omni/with-schemas/index.js.gz +0 -0
- package/min/store/index.js +1 -1
- package/min/store/index.js.gz +0 -0
- package/min/store/with-schemas/index.js +1 -1
- package/min/store/with-schemas/index.js.gz +0 -0
- package/min/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/min/ui-solid/index.js +1 -1
- package/min/ui-solid/index.js.gz +0 -0
- package/min/ui-solid/with-schemas/index.js +1 -1
- package/min/ui-solid/with-schemas/index.js.gz +0 -0
- package/min/ui-solid-inspector/index.js +1 -1
- package/min/ui-solid-inspector/index.js.gz +0 -0
- package/min/ui-solid-inspector/with-schemas/index.js +1 -1
- package/min/ui-solid-inspector/with-schemas/index.js.gz +0 -0
- package/min/ui-svelte/index.js +1 -1
- package/min/ui-svelte/index.js.gz +0 -0
- package/min/ui-svelte/with-schemas/index.js +1 -1
- package/min/ui-svelte/with-schemas/index.js.gz +0 -0
- package/min/ui-svelte-inspector/index.js +1 -1
- package/min/ui-svelte-inspector/index.js.gz +0 -0
- package/min/ui-svelte-inspector/with-schemas/index.js +1 -1
- package/min/ui-svelte-inspector/with-schemas/index.js.gz +0 -0
- package/min/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/omni/index.js +121 -32
- package/omni/with-schemas/index.js +121 -32
- package/package.json +5 -5
- package/readme.md +14 -14
- package/releases.md +101 -60
- package/store/index.js +82 -32
- package/store/with-schemas/index.js +82 -32
- package/ui-react/index.js +16 -0
- package/ui-react/with-schemas/index.js +16 -0
- package/ui-react-inspector/index.js +82 -32
- package/ui-react-inspector/with-schemas/index.js +82 -32
- package/ui-solid/index.js +16 -0
- package/ui-solid/with-schemas/index.js +16 -0
- package/ui-solid-inspector/index.js +82 -32
- package/ui-solid-inspector/with-schemas/index.js +82 -32
- package/ui-svelte/index.js +18 -0
- package/ui-svelte/with-schemas/index.js +18 -0
- package/ui-svelte-inspector/index.js +82 -32
- package/ui-svelte-inspector/with-schemas/index.js +82 -32
- package/with-schemas/index.js +121 -32
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
import type {
|
|
14
14
|
AllCellIdFromSchema,
|
|
15
15
|
CellIdFromSchema,
|
|
16
|
-
DefaultCellIdFromSchema,
|
|
17
|
-
DefaultValueIdFromSchema,
|
|
18
16
|
DefaultedCellFromSchema,
|
|
19
17
|
DefaultedValueFromSchema,
|
|
18
|
+
PresentCellIdFromSchema,
|
|
19
|
+
PresentValueIdFromSchema,
|
|
20
|
+
RequiredNonDefaultCellIdFromSchema,
|
|
21
|
+
RequiredNonDefaultValueIdFromSchema,
|
|
20
22
|
StoreAlias,
|
|
21
23
|
TableIdFromSchema,
|
|
22
24
|
Truncate,
|
|
@@ -72,11 +74,13 @@ export type TablesSchema = {[tableId: Id]: {[cellId: Id]: CellSchema}};
|
|
|
72
74
|
* object or array Cell directly, and get back the same structure.
|
|
73
75
|
*
|
|
74
76
|
* If a default value is provided (and its type is correct), you can be certain
|
|
75
|
-
* that that Cell will always be present in a Row.
|
|
77
|
+
* that that Cell will always be present in a Row. You can also set `required`
|
|
78
|
+
* to `true` to indicate to schema-based typing that the Cell should be present
|
|
79
|
+
* even if it does not have a default.
|
|
76
80
|
*
|
|
77
|
-
* If
|
|
78
|
-
*
|
|
79
|
-
*
|
|
81
|
+
* If neither a default value nor `required: true` is provided, the Cell may be
|
|
82
|
+
* missing from the Row, but when present you can be guaranteed it is of the
|
|
83
|
+
* correct type.
|
|
80
84
|
* @example
|
|
81
85
|
* When applied to a Store, this CellSchema ensures a boolean Cell is always
|
|
82
86
|
* present, and defaults it to `false`.
|
|
@@ -90,6 +94,18 @@ export type TablesSchema = {[tableId: Id]: {[cellId: Id]: CellSchema}};
|
|
|
90
94
|
* };
|
|
91
95
|
* ```
|
|
92
96
|
* @example
|
|
97
|
+
* When applied to a Store, this CellSchema expects a string Cell to be present
|
|
98
|
+
* without providing a default value.
|
|
99
|
+
*
|
|
100
|
+
* ```js
|
|
101
|
+
* import type {CellSchema} from 'tinybase';
|
|
102
|
+
*
|
|
103
|
+
* export const requiredString: CellSchema = {
|
|
104
|
+
* type: 'string',
|
|
105
|
+
* required: true,
|
|
106
|
+
* };
|
|
107
|
+
* ```
|
|
108
|
+
* @example
|
|
93
109
|
* When applied to a Store, this CellSchema allows an object Cell containing
|
|
94
110
|
* arbitrary data, defaulting to an empty object.
|
|
95
111
|
*
|
|
@@ -105,11 +121,11 @@ export type TablesSchema = {[tableId: Id]: {[cellId: Id]: CellSchema}};
|
|
|
105
121
|
* @since v1.0.0
|
|
106
122
|
*/
|
|
107
123
|
export type CellSchema =
|
|
108
|
-
| {type: 'string'; default?: string}
|
|
109
|
-
| {type: 'number'; default?: number}
|
|
110
|
-
| {type: 'boolean'; default?: boolean}
|
|
111
|
-
| {type: 'object'; default?: AnyObject}
|
|
112
|
-
| {type: 'array'; default?: AnyArray};
|
|
124
|
+
| {type: 'string'; default?: string; required?: boolean}
|
|
125
|
+
| {type: 'number'; default?: number; required?: boolean}
|
|
126
|
+
| {type: 'boolean'; default?: boolean; required?: boolean}
|
|
127
|
+
| {type: 'object'; default?: AnyObject; required?: boolean}
|
|
128
|
+
| {type: 'array'; default?: AnyArray; required?: boolean};
|
|
113
129
|
|
|
114
130
|
/**
|
|
115
131
|
* The ValuesSchema type describes the keyed Values that can be set in a Store
|
|
@@ -145,11 +161,13 @@ export type ValuesSchema = {[valueId: Id]: ValueSchema};
|
|
|
145
161
|
* and from JSON when storing and retrieving them.
|
|
146
162
|
*
|
|
147
163
|
* If a default value is provided (and its type is correct), you can be certain
|
|
148
|
-
* that the Value will always be present in a Store.
|
|
164
|
+
* that the Value will always be present in a Store. You can also set `required`
|
|
165
|
+
* to `true` to indicate to schema-based typing that the Value should be
|
|
166
|
+
* present even if it does not have a default.
|
|
149
167
|
*
|
|
150
|
-
* If
|
|
151
|
-
*
|
|
152
|
-
*
|
|
168
|
+
* If neither a default value nor `required: true` is provided, the Value may
|
|
169
|
+
* not be present in the Store, but when present you can be guaranteed it is of
|
|
170
|
+
* the correct type.
|
|
153
171
|
* @example
|
|
154
172
|
* When applied to a Store, this ValueSchema ensures a boolean Value is always
|
|
155
173
|
* present, and defaults it to `false`.
|
|
@@ -163,6 +181,18 @@ export type ValuesSchema = {[valueId: Id]: ValueSchema};
|
|
|
163
181
|
* };
|
|
164
182
|
* ```
|
|
165
183
|
* @example
|
|
184
|
+
* When applied to a Store, this ValueSchema expects a string Value to be
|
|
185
|
+
* present without providing a default value.
|
|
186
|
+
*
|
|
187
|
+
* ```js
|
|
188
|
+
* import type {ValueSchema} from 'tinybase';
|
|
189
|
+
*
|
|
190
|
+
* export const requiredString: ValueSchema = {
|
|
191
|
+
* type: 'string',
|
|
192
|
+
* required: true,
|
|
193
|
+
* };
|
|
194
|
+
* ```
|
|
195
|
+
* @example
|
|
166
196
|
* When applied to a Store, this ValueSchema allows an array Value containing
|
|
167
197
|
* a list of items, defaulting to an empty array.
|
|
168
198
|
*
|
|
@@ -178,11 +208,11 @@ export type ValuesSchema = {[valueId: Id]: ValueSchema};
|
|
|
178
208
|
* @since v3.0.0
|
|
179
209
|
*/
|
|
180
210
|
export type ValueSchema =
|
|
181
|
-
| {type: 'string'; default?: string}
|
|
182
|
-
| {type: 'number'; default?: number}
|
|
183
|
-
| {type: 'boolean'; default?: boolean}
|
|
184
|
-
| {type: 'object'; default?: AnyObject}
|
|
185
|
-
| {type: 'array'; default?: AnyArray};
|
|
211
|
+
| {type: 'string'; default?: string; required?: boolean}
|
|
212
|
+
| {type: 'number'; default?: number; required?: boolean}
|
|
213
|
+
| {type: 'boolean'; default?: boolean; required?: boolean}
|
|
214
|
+
| {type: 'object'; default?: AnyObject; required?: boolean}
|
|
215
|
+
| {type: 'array'; default?: AnyArray; required?: boolean};
|
|
186
216
|
|
|
187
217
|
/**
|
|
188
218
|
* The NoTablesSchema type is a TablesSchema-like type for when one has not been
|
|
@@ -371,22 +401,40 @@ export type Row<
|
|
|
371
401
|
Schema extends OptionalTablesSchema,
|
|
372
402
|
TableId extends TableIdFromSchema<Schema>,
|
|
373
403
|
WhenSet extends boolean = false,
|
|
374
|
-
> =
|
|
375
|
-
?
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
404
|
+
> = WhenSet extends true
|
|
405
|
+
? RequiredNonDefaultCellIdFromSchema<Schema, TableId> extends never
|
|
406
|
+
? PartialRow<Schema, TableId>
|
|
407
|
+
: {
|
|
408
|
+
-readonly [
|
|
409
|
+
CellId in RequiredNonDefaultCellIdFromSchema<Schema, TableId>
|
|
410
|
+
]: Cell<Schema, TableId, CellId>;
|
|
411
|
+
} & PartialRow<Schema, TableId>
|
|
382
412
|
: {
|
|
383
|
-
-readonly [CellId in
|
|
413
|
+
-readonly [CellId in PresentCellIdFromSchema<Schema, TableId>]: Cell<
|
|
384
414
|
Schema,
|
|
385
415
|
TableId,
|
|
386
416
|
CellId
|
|
387
417
|
>;
|
|
388
|
-
}
|
|
389
|
-
|
|
418
|
+
} & {
|
|
419
|
+
-readonly [
|
|
420
|
+
CellId in PresentCellIdFromSchema<Schema, TableId, false>
|
|
421
|
+
]?: Cell<Schema, TableId, CellId>;
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* The PartialRow type is a Row-like type used when setting part of a row.
|
|
426
|
+
*
|
|
427
|
+
* In schema-based typing, a PartialRow allows any known Cell to be omitted,
|
|
428
|
+
* including Cells marked with `required: true`, while still preventing unknown
|
|
429
|
+
* Cell Ids from being used.
|
|
430
|
+
* @category Store
|
|
431
|
+
* @since v9.1.0
|
|
432
|
+
*/
|
|
433
|
+
export type PartialRow<
|
|
434
|
+
Schema extends OptionalTablesSchema,
|
|
435
|
+
TableId extends TableIdFromSchema<Schema>,
|
|
436
|
+
> = {
|
|
437
|
+
-readonly [CellId in CellIdFromSchema<Schema, TableId>]?: Cell<
|
|
390
438
|
Schema,
|
|
391
439
|
TableId,
|
|
392
440
|
CellId
|
|
@@ -480,23 +528,38 @@ export type CellOrUndefined<
|
|
|
480
528
|
export type Values<
|
|
481
529
|
Schema extends OptionalValuesSchema,
|
|
482
530
|
WhenSet extends boolean = false,
|
|
483
|
-
> =
|
|
484
|
-
?
|
|
485
|
-
|
|
531
|
+
> = WhenSet extends true
|
|
532
|
+
? RequiredNonDefaultValueIdFromSchema<Schema> extends never
|
|
533
|
+
? PartialValues<Schema>
|
|
534
|
+
: {
|
|
535
|
+
-readonly [
|
|
536
|
+
ValueId in RequiredNonDefaultValueIdFromSchema<Schema>
|
|
537
|
+
]: Value<Schema, ValueId>;
|
|
538
|
+
} & PartialValues<Schema>
|
|
539
|
+
: {
|
|
540
|
+
-readonly [ValueId in PresentValueIdFromSchema<Schema>]: Value<
|
|
486
541
|
Schema,
|
|
487
542
|
ValueId
|
|
488
543
|
>;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
-readonly [ValueId in DefaultValueIdFromSchema<Schema>]: Value<
|
|
544
|
+
} & {
|
|
545
|
+
-readonly [ValueId in PresentValueIdFromSchema<Schema, false>]?: Value<
|
|
492
546
|
Schema,
|
|
493
547
|
ValueId
|
|
494
548
|
>;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* The PartialValues type is a Values-like type used when setting some keyed
|
|
553
|
+
* values.
|
|
554
|
+
*
|
|
555
|
+
* In schema-based typing, PartialValues allows any known Value to be omitted,
|
|
556
|
+
* including Values marked with `required: true`, while still preventing unknown
|
|
557
|
+
* Value Ids from being used.
|
|
558
|
+
* @category Store
|
|
559
|
+
* @since v9.1.0
|
|
560
|
+
*/
|
|
561
|
+
export type PartialValues<Schema extends OptionalValuesSchema> = {
|
|
562
|
+
-readonly [ValueId in ValueIdFromSchema<Schema>]?: Value<Schema, ValueId>;
|
|
500
563
|
};
|
|
501
564
|
|
|
502
565
|
/**
|
|
@@ -4543,7 +4606,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4543
4606
|
setPartialRow<TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
4544
4607
|
tableId: TableId,
|
|
4545
4608
|
rowId: Id,
|
|
4546
|
-
partialRow:
|
|
4609
|
+
partialRow: PartialRow<Schemas[0], TableId>,
|
|
4547
4610
|
): this;
|
|
4548
4611
|
|
|
4549
4612
|
/**
|
|
@@ -4740,7 +4803,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4740
4803
|
* @category Setter
|
|
4741
4804
|
* @since v3.0.0
|
|
4742
4805
|
*/
|
|
4743
|
-
setPartialValues(partialValues:
|
|
4806
|
+
setPartialValues(partialValues: PartialValues<Schemas[1]>): this;
|
|
4744
4807
|
|
|
4745
4808
|
/**
|
|
4746
4809
|
* The setValue method sets a single keyed Value in the Store.
|
|
@@ -7255,6 +7255,26 @@ export function useProvideIndexes(indexesId: Id, indexes: Indexes): void;
|
|
|
7255
7255
|
*/
|
|
7256
7256
|
export function useIndexIds(indexesOrIndexesId?: IndexesOrIndexesId): Ids;
|
|
7257
7257
|
|
|
7258
|
+
/**
|
|
7259
|
+
* The useHasIndex hook returns a boolean indicating whether a given Index
|
|
7260
|
+
* exists in the Indexes object, and registers a listener so that any changes to
|
|
7261
|
+
* that result will cause a re-render.
|
|
7262
|
+
*
|
|
7263
|
+
* This hook follows the same Indexes object resolution rules as the useIndexIds
|
|
7264
|
+
* hook.
|
|
7265
|
+
* @param indexId The Id of a possible Index in the Indexes object.
|
|
7266
|
+
* @param indexesOrIndexesId The Indexes object to be accessed: omit for the
|
|
7267
|
+
* default context Indexes object, provide an Id for a named context Indexes
|
|
7268
|
+
* object, or provide an explicit reference.
|
|
7269
|
+
* @returns Whether an Index with that Id exists.
|
|
7270
|
+
* @category Indexes hooks
|
|
7271
|
+
* @since v9.1.0
|
|
7272
|
+
*/
|
|
7273
|
+
export function useHasIndex(
|
|
7274
|
+
indexId: Id,
|
|
7275
|
+
indexesOrIndexesId?: IndexesOrIndexesId,
|
|
7276
|
+
): boolean;
|
|
7277
|
+
|
|
7258
7278
|
/**
|
|
7259
7279
|
* The useSliceIds hook gets the list of Slice Ids in an Index, and registers a
|
|
7260
7280
|
* listener so that any changes to that result will cause a re-render.
|
|
@@ -7375,6 +7395,28 @@ export function useSliceIds(
|
|
|
7375
7395
|
indexesOrIndexesId?: IndexesOrIndexesId,
|
|
7376
7396
|
): Ids;
|
|
7377
7397
|
|
|
7398
|
+
/**
|
|
7399
|
+
* The useHasSlice hook returns a boolean indicating whether a given Slice
|
|
7400
|
+
* exists in an Index, and registers a listener so that any changes to that
|
|
7401
|
+
* result will cause a re-render.
|
|
7402
|
+
*
|
|
7403
|
+
* This hook follows the same Indexes object resolution rules as the useSliceIds
|
|
7404
|
+
* hook.
|
|
7405
|
+
* @param indexId The Id of a possible Index in the Indexes object.
|
|
7406
|
+
* @param sliceId The Id of a possible Slice in the Index.
|
|
7407
|
+
* @param indexesOrIndexesId The Indexes object to be accessed: omit for the
|
|
7408
|
+
* default context Indexes object, provide an Id for a named context Indexes
|
|
7409
|
+
* object, or provide an explicit reference.
|
|
7410
|
+
* @returns Whether a Slice with that Id exists.
|
|
7411
|
+
* @category Indexes hooks
|
|
7412
|
+
* @since v9.1.0
|
|
7413
|
+
*/
|
|
7414
|
+
export function useHasSlice(
|
|
7415
|
+
indexId: Id,
|
|
7416
|
+
sliceId: Id,
|
|
7417
|
+
indexesOrIndexesId?: IndexesOrIndexesId,
|
|
7418
|
+
): boolean;
|
|
7419
|
+
|
|
7378
7420
|
/**
|
|
7379
7421
|
* The useSliceRowIds hook gets the list of Row Ids in a given Slice, and
|
|
7380
7422
|
* registers a listener so that any changes to that result will cause a
|
|
@@ -141,6 +141,8 @@ import type {
|
|
|
141
141
|
MapCell,
|
|
142
142
|
MapValue,
|
|
143
143
|
OptionalSchemas,
|
|
144
|
+
PartialRow,
|
|
145
|
+
PartialValues,
|
|
144
146
|
Row,
|
|
145
147
|
RowCountListener,
|
|
146
148
|
RowIdsListener,
|
|
@@ -3577,14 +3579,14 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
3577
3579
|
* @category Store hooks
|
|
3578
3580
|
* @since v1.0.0
|
|
3579
3581
|
*/
|
|
3580
|
-
useSetTablesCallback: <Parameter
|
|
3582
|
+
useSetTablesCallback: <Parameter>(
|
|
3581
3583
|
getTables: (
|
|
3582
3584
|
parameter: Parameter,
|
|
3583
3585
|
store: Store<Schemas>,
|
|
3584
|
-
) =>
|
|
3586
|
+
) => Tables<Schemas[0], true>,
|
|
3585
3587
|
getTablesDeps?: React.DependencyList,
|
|
3586
3588
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
3587
|
-
then?: (store: Store<Schemas>, tables:
|
|
3589
|
+
then?: (store: Store<Schemas>, tables: Tables<Schemas[0], true>) => void,
|
|
3588
3590
|
thenDeps?: React.DependencyList,
|
|
3589
3591
|
) => ParameterizedCallback<Parameter>;
|
|
3590
3592
|
|
|
@@ -3688,16 +3690,18 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
3688
3690
|
useSetTableCallback: <
|
|
3689
3691
|
Parameter,
|
|
3690
3692
|
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
3691
|
-
SetTable = Table<Schemas[0], TableId, true>,
|
|
3692
3693
|
>(
|
|
3693
3694
|
tableId: TableId | GetId<Schemas, Parameter, TableId>,
|
|
3694
3695
|
getTable: (
|
|
3695
3696
|
parameter: Parameter,
|
|
3696
3697
|
store: Store<Schemas>,
|
|
3697
|
-
) =>
|
|
3698
|
+
) => Table<Schemas[0], TableId, true>,
|
|
3698
3699
|
getTableDeps?: React.DependencyList,
|
|
3699
3700
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
3700
|
-
then?: (
|
|
3701
|
+
then?: (
|
|
3702
|
+
store: Store<Schemas>,
|
|
3703
|
+
table: Table<Schemas[0], TableId, true>,
|
|
3704
|
+
) => void,
|
|
3701
3705
|
thenDeps?: React.DependencyList,
|
|
3702
3706
|
) => ParameterizedCallback<Parameter>;
|
|
3703
3707
|
|
|
@@ -3803,17 +3807,16 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
3803
3807
|
* @category Store hooks
|
|
3804
3808
|
* @since v1.0.0
|
|
3805
3809
|
*/
|
|
3806
|
-
useSetRowCallback: <
|
|
3807
|
-
Parameter,
|
|
3808
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
3809
|
-
SetRow = Row<Schemas[0], TableId, true>,
|
|
3810
|
-
>(
|
|
3810
|
+
useSetRowCallback: <Parameter, TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
3811
3811
|
tableId: TableId | GetId<Schemas, Parameter, TableId>,
|
|
3812
3812
|
rowId: Id | GetId<Schemas, Parameter, Id>,
|
|
3813
|
-
getRow: (
|
|
3813
|
+
getRow: (
|
|
3814
|
+
parameter: Parameter,
|
|
3815
|
+
store: Store<Schemas>,
|
|
3816
|
+
) => Row<Schemas[0], TableId, true>,
|
|
3814
3817
|
getRowDeps?: React.DependencyList,
|
|
3815
3818
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
3816
|
-
then?: (store: Store<Schemas>, row:
|
|
3819
|
+
then?: (store: Store<Schemas>, row: Row<Schemas[0], TableId, true>) => void,
|
|
3817
3820
|
thenDeps?: React.DependencyList,
|
|
3818
3821
|
) => ParameterizedCallback<Parameter>;
|
|
3819
3822
|
|
|
@@ -3924,16 +3927,19 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
3924
3927
|
* @category Store hooks
|
|
3925
3928
|
* @since v1.0.0
|
|
3926
3929
|
*/
|
|
3927
|
-
useAddRowCallback: <
|
|
3928
|
-
Parameter,
|
|
3929
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
3930
|
-
AddRow = Row<Schemas[0], TableId, true>,
|
|
3931
|
-
>(
|
|
3930
|
+
useAddRowCallback: <Parameter, TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
3932
3931
|
tableId: TableId | GetId<Schemas, Parameter, TableId>,
|
|
3933
|
-
getRow: (
|
|
3932
|
+
getRow: (
|
|
3933
|
+
parameter: Parameter,
|
|
3934
|
+
store: Store<Schemas>,
|
|
3935
|
+
) => Row<Schemas[0], TableId, true>,
|
|
3934
3936
|
getRowDeps?: React.DependencyList,
|
|
3935
3937
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
3936
|
-
then?: (
|
|
3938
|
+
then?: (
|
|
3939
|
+
rowId: Id | undefined,
|
|
3940
|
+
store: Store<Schemas>,
|
|
3941
|
+
row: Row<Schemas[0], TableId, true>,
|
|
3942
|
+
) => void,
|
|
3937
3943
|
thenDeps?: React.DependencyList,
|
|
3938
3944
|
reuseRowIds?: boolean,
|
|
3939
3945
|
) => ParameterizedCallback<Parameter>;
|
|
@@ -4045,17 +4051,19 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
4045
4051
|
useSetPartialRowCallback: <
|
|
4046
4052
|
Parameter,
|
|
4047
4053
|
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
4048
|
-
SetPartialRow = Row<Schemas[0], TableId, true>,
|
|
4049
4054
|
>(
|
|
4050
4055
|
tableId: TableId | GetId<Schemas, Parameter, TableId>,
|
|
4051
4056
|
rowId: Id | GetId<Schemas, Parameter, Id>,
|
|
4052
4057
|
getPartialRow: (
|
|
4053
4058
|
parameter: Parameter,
|
|
4054
4059
|
store: Store<Schemas>,
|
|
4055
|
-
) =>
|
|
4060
|
+
) => PartialRow<Schemas[0], TableId>,
|
|
4056
4061
|
getPartialRowDeps?: React.DependencyList,
|
|
4057
4062
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
4058
|
-
then?: (
|
|
4063
|
+
then?: (
|
|
4064
|
+
store: Store<Schemas>,
|
|
4065
|
+
partialRow: PartialRow<Schemas[0], TableId>,
|
|
4066
|
+
) => void,
|
|
4059
4067
|
thenDeps?: React.DependencyList,
|
|
4060
4068
|
) => ParameterizedCallback<Parameter>;
|
|
4061
4069
|
|
|
@@ -4319,14 +4327,14 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
4319
4327
|
* @category Store hooks
|
|
4320
4328
|
* @since v3.0.0
|
|
4321
4329
|
*/
|
|
4322
|
-
useSetValuesCallback: <Parameter
|
|
4330
|
+
useSetValuesCallback: <Parameter>(
|
|
4323
4331
|
getValues: (
|
|
4324
4332
|
parameter: Parameter,
|
|
4325
4333
|
store: Store<Schemas>,
|
|
4326
|
-
) =>
|
|
4334
|
+
) => Values<Schemas[1], true>,
|
|
4327
4335
|
getValuesDeps?: React.DependencyList,
|
|
4328
4336
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
4329
|
-
then?: (store: Store<Schemas>, values:
|
|
4337
|
+
then?: (store: Store<Schemas>, values: Values<Schemas[1], true>) => void,
|
|
4330
4338
|
thenDeps?: React.DependencyList,
|
|
4331
4339
|
) => ParameterizedCallback<Parameter>;
|
|
4332
4340
|
|
|
@@ -4424,17 +4432,17 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
4424
4432
|
* @category Store hooks
|
|
4425
4433
|
* @since v3.0.0
|
|
4426
4434
|
*/
|
|
4427
|
-
useSetPartialValuesCallback: <
|
|
4428
|
-
Parameter,
|
|
4429
|
-
SetPartialValues = Values<Schemas[1], true>,
|
|
4430
|
-
>(
|
|
4435
|
+
useSetPartialValuesCallback: <Parameter>(
|
|
4431
4436
|
getPartialValues: (
|
|
4432
4437
|
parameter: Parameter,
|
|
4433
4438
|
store: Store<Schemas>,
|
|
4434
|
-
) =>
|
|
4439
|
+
) => PartialValues<Schemas[1]>,
|
|
4435
4440
|
getPartialValuesDeps?: React.DependencyList,
|
|
4436
4441
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
4437
|
-
then?: (
|
|
4442
|
+
then?: (
|
|
4443
|
+
store: Store<Schemas>,
|
|
4444
|
+
partialValues: PartialValues<Schemas[1]>,
|
|
4445
|
+
) => void,
|
|
4438
4446
|
thenDeps?: React.DependencyList,
|
|
4439
4447
|
) => ParameterizedCallback<Parameter>;
|
|
4440
4448
|
|
|
@@ -8179,6 +8187,35 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
8179
8187
|
*/
|
|
8180
8188
|
useIndexIds(indexesOrIndexesId?: IndexesOrIndexesId<Schemas>): Ids;
|
|
8181
8189
|
|
|
8190
|
+
/**
|
|
8191
|
+
* The useHasIndex hook returns a boolean indicating whether a given Index
|
|
8192
|
+
* exists in the Indexes object, and registers a listener so that any changes to
|
|
8193
|
+
* that result will cause a re-render.
|
|
8194
|
+
*
|
|
8195
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
8196
|
+
*
|
|
8197
|
+
* ```ts override
|
|
8198
|
+
* useHasIndex(
|
|
8199
|
+
* indexId: Id,
|
|
8200
|
+
* indexesOrIndexesId?: IndexesOrIndexesId,
|
|
8201
|
+
* ): boolean;
|
|
8202
|
+
* ```
|
|
8203
|
+
*
|
|
8204
|
+
* This hook follows the same Indexes object resolution rules as the useIndexIds
|
|
8205
|
+
* hook.
|
|
8206
|
+
* @param indexId The Id of a possible Index in the Indexes object.
|
|
8207
|
+
* @param indexesOrIndexesId The Indexes object to be accessed: omit for the
|
|
8208
|
+
* default context Indexes object, provide an Id for a named context Indexes
|
|
8209
|
+
* object, or provide an explicit reference.
|
|
8210
|
+
* @returns Whether an Index with that Id exists.
|
|
8211
|
+
* @category Indexes hooks
|
|
8212
|
+
* @since v9.1.0
|
|
8213
|
+
*/
|
|
8214
|
+
useHasIndex: (
|
|
8215
|
+
indexId: Id,
|
|
8216
|
+
indexesOrIndexesId?: IndexesOrIndexesId<Schemas>,
|
|
8217
|
+
) => boolean;
|
|
8218
|
+
|
|
8182
8219
|
/**
|
|
8183
8220
|
* The useSliceIds hook gets the list of Slice Ids in an Index, and registers a
|
|
8184
8221
|
* listener so that any changes to that result will cause a re-render.
|
|
@@ -8308,6 +8345,38 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
8308
8345
|
indexesOrIndexesId?: IndexesOrIndexesId<Schemas>,
|
|
8309
8346
|
) => Ids;
|
|
8310
8347
|
|
|
8348
|
+
/**
|
|
8349
|
+
* The useHasSlice hook returns a boolean indicating whether a given Slice
|
|
8350
|
+
* exists in an Index, and registers a listener so that any changes to that
|
|
8351
|
+
* result will cause a re-render.
|
|
8352
|
+
*
|
|
8353
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
8354
|
+
*
|
|
8355
|
+
* ```ts override
|
|
8356
|
+
* useHasSlice(
|
|
8357
|
+
* indexId: Id,
|
|
8358
|
+
* sliceId: Id,
|
|
8359
|
+
* indexesOrIndexesId?: IndexesOrIndexesId,
|
|
8360
|
+
* ): boolean;
|
|
8361
|
+
* ```
|
|
8362
|
+
*
|
|
8363
|
+
* This hook follows the same Indexes object resolution rules as the useSliceIds
|
|
8364
|
+
* hook.
|
|
8365
|
+
* @param indexId The Id of a possible Index in the Indexes object.
|
|
8366
|
+
* @param sliceId The Id of a possible Slice in the Index.
|
|
8367
|
+
* @param indexesOrIndexesId The Indexes object to be accessed: omit for the
|
|
8368
|
+
* default context Indexes object, provide an Id for a named context Indexes
|
|
8369
|
+
* object, or provide an explicit reference.
|
|
8370
|
+
* @returns Whether a Slice with that Id exists.
|
|
8371
|
+
* @category Indexes hooks
|
|
8372
|
+
* @since v9.1.0
|
|
8373
|
+
*/
|
|
8374
|
+
useHasSlice: (
|
|
8375
|
+
indexId: Id,
|
|
8376
|
+
sliceId: Id,
|
|
8377
|
+
indexesOrIndexesId?: IndexesOrIndexesId<Schemas>,
|
|
8378
|
+
) => boolean;
|
|
8379
|
+
|
|
8311
8380
|
/**
|
|
8312
8381
|
* The useSliceRowIds hook gets the list of Row Ids in a given Slice, and
|
|
8313
8382
|
* registers a listener so that any changes to that result will cause a
|
|
@@ -692,7 +692,7 @@ export type SortedTablePaginatorProps = {
|
|
|
692
692
|
*
|
|
693
693
|
* See the <TableInHtmlTable /> (React) demo for this component in action:
|
|
694
694
|
*
|
|
695
|
-
* 
|
|
697
697
|
*
|
|
698
698
|
* The component's props identify which Table to render based on Table Id, and
|
|
@@ -838,7 +838,7 @@ export function TableInHtmlTable(
|
|
|
838
838
|
* See the <SortedTableInHtmlTable /> (React) demo for this component in
|
|
839
839
|
* action:
|
|
840
840
|
*
|
|
841
|
-
* 
|
|
843
843
|
*
|
|
844
844
|
* The component's props identify which Table to render based on Table Id, and
|
|
@@ -1011,7 +1011,7 @@ export function SortedTableInHtmlTable(
|
|
|
1011
1011
|
*
|
|
1012
1012
|
* See the <ValuesInHtmlTable /> (React) demo for this component in action:
|
|
1013
1013
|
*
|
|
1014
|
-
* 
|
|
1016
1016
|
*
|
|
1017
1017
|
* The component's props identify which Row to render based on Table Id, Row Id,
|
|
@@ -1142,7 +1142,7 @@ export function ValuesInHtmlTable(
|
|
|
1142
1142
|
*
|
|
1143
1143
|
* See the <SliceInHtmlTable /> (React) demo for this component in action:
|
|
1144
1144
|
*
|
|
1145
|
-
* 
|
|
1147
1147
|
*
|
|
1148
1148
|
* The component's props identify which Slice to render based on Index Id, Slice
|
|
@@ -1300,7 +1300,7 @@ export function SliceInHtmlTable(
|
|
|
1300
1300
|
* See the <RelationshipInHtmlTable /> (React) demo for this component in
|
|
1301
1301
|
* action:
|
|
1302
1302
|
*
|
|
1303
|
-
* 
|
|
1305
1305
|
*
|
|
1306
1306
|
* The component's props identify which Relationship to render based on
|
|
@@ -1478,7 +1478,7 @@ export function RelationshipInHtmlTable(
|
|
|
1478
1478
|
* See the <ResultTableInHtmlTable /> (React) demo for this component in
|
|
1479
1479
|
* action:
|
|
1480
1480
|
*
|
|
1481
|
-
* 
|
|
1483
1483
|
*
|
|
1484
1484
|
* The component's props identify which ResultTable to render based on query Id,
|
|
@@ -1631,7 +1631,7 @@ export function ResultTableInHtmlTable(
|
|
|
1631
1631
|
* See the <ResultSortedTableInHtmlTable /> (React) demo for this component in
|
|
1632
1632
|
* action:
|
|
1633
1633
|
*
|
|
1634
|
-
* 
|
|
1636
1636
|
*
|
|
1637
1637
|
* The component's props identify which ResultTable to render based on query Id,
|
|
@@ -1805,7 +1805,7 @@ export function ResultSortedTableInHtmlTable(
|
|
|
1805
1805
|
*
|
|
1806
1806
|
* See the <EditableCellView /> (React) demo for this component in action:
|
|
1807
1807
|
*
|
|
1808
|
-
* 
|
|
1810
1810
|
*
|
|
1811
1811
|
* The component's props identify which Cell to render based on Table Id, Row
|
|
@@ -1876,7 +1876,7 @@ export function EditableCellView(
|
|
|
1876
1876
|
*
|
|
1877
1877
|
* See the <EditableValueView /> (React) demo for this component in action:
|
|
1878
1878
|
*
|
|
1879
|
-
* 
|
|
1881
1881
|
*
|
|
1882
1882
|
* The component's props identify which Value to render based on Table Id, Row
|
|
@@ -1947,7 +1947,7 @@ export function EditableValueView(
|
|
|
1947
1947
|
* See the <SortedTableInHtmlTable /> (React) demo for this component in
|
|
1948
1948
|
* action:
|
|
1949
1949
|
*
|
|
1950
|
-
* 
|
|
1952
1952
|
*
|
|
1953
1953
|
* The component displays 'previous' and 'next' buttons for paging through the
|