tinybase 9.1.0-beta.0 → 9.1.0-beta.2
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/common/index.d.ts +17 -2
- package/@types/common/with-schemas/index.d.ts +18 -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 +133 -25
- package/@types/store/with-schemas/index.d.ts +145 -51
- package/@types/ui-react/index.d.ts +48 -2
- package/@types/ui-react/with-schemas/index.d.ts +108 -34
- package/@types/ui-solid/index.d.ts +51 -2
- package/@types/ui-solid/with-schemas/index.d.ts +111 -34
- package/@types/ui-svelte/index.d.ts +84 -2
- package/@types/ui-svelte/with-schemas/index.d.ts +122 -25
- package/index.js +155 -38
- package/indexes/index.js +39 -0
- package/indexes/with-schemas/index.js +39 -0
- package/mergeable-store/index.js +116 -38
- package/mergeable-store/with-schemas/index.js +116 -38
- 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-dom/index.js +1 -1
- package/min/ui-react-dom/index.js.gz +0 -0
- package/min/ui-react-dom/with-schemas/index.js +1 -1
- package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom-charts/index.js +1 -1
- package/min/ui-react-dom-charts/index.js.gz +0 -0
- package/min/ui-react-dom-charts/with-schemas/index.js +1 -1
- package/min/ui-react-dom-charts/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-dom/index.js +1 -1
- package/min/ui-solid-dom/index.js.gz +0 -0
- package/min/ui-solid-dom/with-schemas/index.js +1 -1
- package/min/ui-solid-dom/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-dom/index.js +1 -1
- package/min/ui-svelte-dom/index.js.gz +0 -0
- package/min/ui-svelte-dom/with-schemas/index.js +1 -1
- package/min/ui-svelte-dom/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 +155 -38
- package/omni/with-schemas/index.js +155 -38
- package/package.json +3 -3
- package/readme.md +14 -14
- package/releases.md +101 -60
- package/store/index.js +116 -38
- package/store/with-schemas/index.js +116 -38
- package/ui-react/index.js +52 -6
- package/ui-react/with-schemas/index.js +52 -6
- package/ui-react-dom/index.js +24 -4
- package/ui-react-dom/with-schemas/index.js +24 -4
- package/ui-react-dom-charts/index.js +24 -4
- package/ui-react-dom-charts/with-schemas/index.js +24 -4
- package/ui-react-inspector/index.js +140 -42
- package/ui-react-inspector/with-schemas/index.js +140 -42
- package/ui-solid/index.js +48 -2
- package/ui-solid/with-schemas/index.js +48 -2
- package/ui-solid-dom/index.js +17 -1
- package/ui-solid-dom/with-schemas/index.js +17 -1
- package/ui-solid-inspector/index.js +133 -39
- package/ui-solid-inspector/with-schemas/index.js +133 -39
- package/ui-svelte/index.js +91 -31
- package/ui-svelte/with-schemas/index.js +91 -31
- package/ui-svelte-dom/index.js +35 -14
- package/ui-svelte-dom/with-schemas/index.js +35 -14
- package/ui-svelte-inspector/index.js +151 -52
- package/ui-svelte-inspector/with-schemas/index.js +151 -52
- package/with-schemas/index.js +155 -38
|
@@ -36,6 +36,7 @@ import type {
|
|
|
36
36
|
IdOrNull,
|
|
37
37
|
Ids,
|
|
38
38
|
ParameterizedCallback,
|
|
39
|
+
Sorter,
|
|
39
40
|
} from '../common/index.d.ts';
|
|
40
41
|
import type {
|
|
41
42
|
Indexes,
|
|
@@ -1797,6 +1798,7 @@ export function useSortedRowIds(
|
|
|
1797
1798
|
descending?: boolean,
|
|
1798
1799
|
offset?: number,
|
|
1799
1800
|
limit?: number,
|
|
1801
|
+
sorterOrStoreOrStoreId?: Sorter | StoreOrStoreId,
|
|
1800
1802
|
storeOrStoreId?: StoreOrStoreId,
|
|
1801
1803
|
): Ids;
|
|
1802
1804
|
|
|
@@ -1804,7 +1806,8 @@ export function useSortedRowIds(
|
|
|
1804
1806
|
* When called with an object as the first argument, the useSortedRowIds method
|
|
1805
1807
|
* destructures it to make it easier to skip optional parameters.
|
|
1806
1808
|
* @param args A SortedRowIdsArgs object containing the Id of the Table in the
|
|
1807
|
-
* Store, and optional `cellId`, `descending`, `offset`, and `
|
|
1809
|
+
* Store, and optional `cellId`, `descending`, `offset`, `limit`, and `sorter`
|
|
1810
|
+
* parameters.
|
|
1808
1811
|
* @param storeOrStoreId The Store to be accessed: omit for the default context
|
|
1809
1812
|
* Store, provide an Id for a named context Store, or provide an explicit
|
|
1810
1813
|
* reference.
|
|
@@ -5178,7 +5181,8 @@ export function useSortedRowIdsListener(
|
|
|
5178
5181
|
* When called with an object as the first argument, the useSortedRowIds method
|
|
5179
5182
|
* destructures it to make it easier to skip optional parameters.
|
|
5180
5183
|
* @param args A SortedRowIdsArgs object containing the Id of the Table in the
|
|
5181
|
-
* Store, and optional `cellId`, `descending`, `offset`, and `
|
|
5184
|
+
* Store, and optional `cellId`, `descending`, `offset`, `limit`, and `sorter`
|
|
5185
|
+
* parameters.
|
|
5182
5186
|
* @param listener The function that will be called whenever the sorted Row Ids
|
|
5183
5187
|
* in the Table change.
|
|
5184
5188
|
* @param listenerDeps An optional array of dependencies for the `listener`
|
|
@@ -7251,6 +7255,26 @@ export function useProvideIndexes(indexesId: Id, indexes: Indexes): void;
|
|
|
7251
7255
|
*/
|
|
7252
7256
|
export function useIndexIds(indexesOrIndexesId?: IndexesOrIndexesId): Ids;
|
|
7253
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
|
+
|
|
7254
7278
|
/**
|
|
7255
7279
|
* The useSliceIds hook gets the list of Slice Ids in an Index, and registers a
|
|
7256
7280
|
* listener so that any changes to that result will cause a re-render.
|
|
@@ -7371,6 +7395,28 @@ export function useSliceIds(
|
|
|
7371
7395
|
indexesOrIndexesId?: IndexesOrIndexesId,
|
|
7372
7396
|
): Ids;
|
|
7373
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
|
+
|
|
7374
7420
|
/**
|
|
7375
7421
|
* The useSliceRowIds hook gets the list of Row Ids in a given Slice, and
|
|
7376
7422
|
* registers a listener so that any changes to that result will cause a
|
|
@@ -82,6 +82,7 @@ import type {
|
|
|
82
82
|
IdOrNull,
|
|
83
83
|
Ids,
|
|
84
84
|
ParameterizedCallback,
|
|
85
|
+
Sorter,
|
|
85
86
|
} from '../../common/with-schemas/index.d.ts';
|
|
86
87
|
import type {
|
|
87
88
|
Indexes,
|
|
@@ -140,6 +141,8 @@ import type {
|
|
|
140
141
|
MapCell,
|
|
141
142
|
MapValue,
|
|
142
143
|
OptionalSchemas,
|
|
144
|
+
PartialRow,
|
|
145
|
+
PartialValues,
|
|
143
146
|
Row,
|
|
144
147
|
RowCountListener,
|
|
145
148
|
RowIdsListener,
|
|
@@ -1901,6 +1904,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
1901
1904
|
* descending?: boolean,
|
|
1902
1905
|
* offset?: number,
|
|
1903
1906
|
* limit?: number,
|
|
1907
|
+
* sorterOrStoreOrStoreId?: Sorter | StoreOrStoreId,
|
|
1904
1908
|
* storeOrStoreId?: StoreOrStoreId,
|
|
1905
1909
|
* ): Ids;
|
|
1906
1910
|
* ```
|
|
@@ -2032,6 +2036,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
2032
2036
|
descending?: boolean,
|
|
2033
2037
|
offset?: number,
|
|
2034
2038
|
limit?: number,
|
|
2039
|
+
sorterOrStoreOrStoreId?: Sorter | StoreOrStoreId<Schemas>,
|
|
2035
2040
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
2036
2041
|
): Ids;
|
|
2037
2042
|
|
|
@@ -2039,7 +2044,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
2039
2044
|
* When called with an object as the first argument, the useSortedRowIds method
|
|
2040
2045
|
* destructures it to make it easier to skip optional parameters.
|
|
2041
2046
|
* @param args A SortedRowIdsArgs object containing the Id of the Table in the
|
|
2042
|
-
* Store, and optional `cellId`, `descending`, `offset`, and `
|
|
2047
|
+
* Store, and optional `cellId`, `descending`, `offset`, `limit`, and `sorter`
|
|
2048
|
+
* parameters.
|
|
2043
2049
|
* @param storeOrStoreId The Store to be accessed: omit for the default context
|
|
2044
2050
|
* Store, provide an Id for a named context Store, or provide an explicit
|
|
2045
2051
|
* reference.
|
|
@@ -3573,14 +3579,14 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
3573
3579
|
* @category Store hooks
|
|
3574
3580
|
* @since v1.0.0
|
|
3575
3581
|
*/
|
|
3576
|
-
useSetTablesCallback: <Parameter
|
|
3582
|
+
useSetTablesCallback: <Parameter>(
|
|
3577
3583
|
getTables: (
|
|
3578
3584
|
parameter: Parameter,
|
|
3579
3585
|
store: Store<Schemas>,
|
|
3580
|
-
) =>
|
|
3586
|
+
) => Tables<Schemas[0], true>,
|
|
3581
3587
|
getTablesDeps?: React.DependencyList,
|
|
3582
3588
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
3583
|
-
then?: (store: Store<Schemas>, tables:
|
|
3589
|
+
then?: (store: Store<Schemas>, tables: Tables<Schemas[0], true>) => void,
|
|
3584
3590
|
thenDeps?: React.DependencyList,
|
|
3585
3591
|
) => ParameterizedCallback<Parameter>;
|
|
3586
3592
|
|
|
@@ -3684,16 +3690,18 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
3684
3690
|
useSetTableCallback: <
|
|
3685
3691
|
Parameter,
|
|
3686
3692
|
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
3687
|
-
SetTable = Table<Schemas[0], TableId, true>,
|
|
3688
3693
|
>(
|
|
3689
3694
|
tableId: TableId | GetId<Schemas, Parameter, TableId>,
|
|
3690
3695
|
getTable: (
|
|
3691
3696
|
parameter: Parameter,
|
|
3692
3697
|
store: Store<Schemas>,
|
|
3693
|
-
) =>
|
|
3698
|
+
) => Table<Schemas[0], TableId, true>,
|
|
3694
3699
|
getTableDeps?: React.DependencyList,
|
|
3695
3700
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
3696
|
-
then?: (
|
|
3701
|
+
then?: (
|
|
3702
|
+
store: Store<Schemas>,
|
|
3703
|
+
table: Table<Schemas[0], TableId, true>,
|
|
3704
|
+
) => void,
|
|
3697
3705
|
thenDeps?: React.DependencyList,
|
|
3698
3706
|
) => ParameterizedCallback<Parameter>;
|
|
3699
3707
|
|
|
@@ -3799,17 +3807,16 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
3799
3807
|
* @category Store hooks
|
|
3800
3808
|
* @since v1.0.0
|
|
3801
3809
|
*/
|
|
3802
|
-
useSetRowCallback: <
|
|
3803
|
-
Parameter,
|
|
3804
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
3805
|
-
SetRow = Row<Schemas[0], TableId, true>,
|
|
3806
|
-
>(
|
|
3810
|
+
useSetRowCallback: <Parameter, TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
3807
3811
|
tableId: TableId | GetId<Schemas, Parameter, TableId>,
|
|
3808
3812
|
rowId: Id | GetId<Schemas, Parameter, Id>,
|
|
3809
|
-
getRow: (
|
|
3813
|
+
getRow: (
|
|
3814
|
+
parameter: Parameter,
|
|
3815
|
+
store: Store<Schemas>,
|
|
3816
|
+
) => Row<Schemas[0], TableId, true>,
|
|
3810
3817
|
getRowDeps?: React.DependencyList,
|
|
3811
3818
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
3812
|
-
then?: (store: Store<Schemas>, row:
|
|
3819
|
+
then?: (store: Store<Schemas>, row: Row<Schemas[0], TableId, true>) => void,
|
|
3813
3820
|
thenDeps?: React.DependencyList,
|
|
3814
3821
|
) => ParameterizedCallback<Parameter>;
|
|
3815
3822
|
|
|
@@ -3920,16 +3927,19 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
3920
3927
|
* @category Store hooks
|
|
3921
3928
|
* @since v1.0.0
|
|
3922
3929
|
*/
|
|
3923
|
-
useAddRowCallback: <
|
|
3924
|
-
Parameter,
|
|
3925
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
3926
|
-
AddRow = Row<Schemas[0], TableId, true>,
|
|
3927
|
-
>(
|
|
3930
|
+
useAddRowCallback: <Parameter, TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
3928
3931
|
tableId: TableId | GetId<Schemas, Parameter, TableId>,
|
|
3929
|
-
getRow: (
|
|
3932
|
+
getRow: (
|
|
3933
|
+
parameter: Parameter,
|
|
3934
|
+
store: Store<Schemas>,
|
|
3935
|
+
) => Row<Schemas[0], TableId, true>,
|
|
3930
3936
|
getRowDeps?: React.DependencyList,
|
|
3931
3937
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
3932
|
-
then?: (
|
|
3938
|
+
then?: (
|
|
3939
|
+
rowId: Id | undefined,
|
|
3940
|
+
store: Store<Schemas>,
|
|
3941
|
+
row: Row<Schemas[0], TableId, true>,
|
|
3942
|
+
) => void,
|
|
3933
3943
|
thenDeps?: React.DependencyList,
|
|
3934
3944
|
reuseRowIds?: boolean,
|
|
3935
3945
|
) => ParameterizedCallback<Parameter>;
|
|
@@ -4041,17 +4051,19 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
4041
4051
|
useSetPartialRowCallback: <
|
|
4042
4052
|
Parameter,
|
|
4043
4053
|
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
4044
|
-
SetPartialRow = Row<Schemas[0], TableId, true>,
|
|
4045
4054
|
>(
|
|
4046
4055
|
tableId: TableId | GetId<Schemas, Parameter, TableId>,
|
|
4047
4056
|
rowId: Id | GetId<Schemas, Parameter, Id>,
|
|
4048
4057
|
getPartialRow: (
|
|
4049
4058
|
parameter: Parameter,
|
|
4050
4059
|
store: Store<Schemas>,
|
|
4051
|
-
) =>
|
|
4060
|
+
) => PartialRow<Schemas[0], TableId>,
|
|
4052
4061
|
getPartialRowDeps?: React.DependencyList,
|
|
4053
4062
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
4054
|
-
then?: (
|
|
4063
|
+
then?: (
|
|
4064
|
+
store: Store<Schemas>,
|
|
4065
|
+
partialRow: PartialRow<Schemas[0], TableId>,
|
|
4066
|
+
) => void,
|
|
4055
4067
|
thenDeps?: React.DependencyList,
|
|
4056
4068
|
) => ParameterizedCallback<Parameter>;
|
|
4057
4069
|
|
|
@@ -4315,14 +4327,14 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
4315
4327
|
* @category Store hooks
|
|
4316
4328
|
* @since v3.0.0
|
|
4317
4329
|
*/
|
|
4318
|
-
useSetValuesCallback: <Parameter
|
|
4330
|
+
useSetValuesCallback: <Parameter>(
|
|
4319
4331
|
getValues: (
|
|
4320
4332
|
parameter: Parameter,
|
|
4321
4333
|
store: Store<Schemas>,
|
|
4322
|
-
) =>
|
|
4334
|
+
) => Values<Schemas[1], true>,
|
|
4323
4335
|
getValuesDeps?: React.DependencyList,
|
|
4324
4336
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
4325
|
-
then?: (store: Store<Schemas>, values:
|
|
4337
|
+
then?: (store: Store<Schemas>, values: Values<Schemas[1], true>) => void,
|
|
4326
4338
|
thenDeps?: React.DependencyList,
|
|
4327
4339
|
) => ParameterizedCallback<Parameter>;
|
|
4328
4340
|
|
|
@@ -4420,17 +4432,17 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
4420
4432
|
* @category Store hooks
|
|
4421
4433
|
* @since v3.0.0
|
|
4422
4434
|
*/
|
|
4423
|
-
useSetPartialValuesCallback: <
|
|
4424
|
-
Parameter,
|
|
4425
|
-
SetPartialValues = Values<Schemas[1], true>,
|
|
4426
|
-
>(
|
|
4435
|
+
useSetPartialValuesCallback: <Parameter>(
|
|
4427
4436
|
getPartialValues: (
|
|
4428
4437
|
parameter: Parameter,
|
|
4429
4438
|
store: Store<Schemas>,
|
|
4430
|
-
) =>
|
|
4439
|
+
) => PartialValues<Schemas[1]>,
|
|
4431
4440
|
getPartialValuesDeps?: React.DependencyList,
|
|
4432
4441
|
storeOrStoreId?: StoreOrStoreId<Schemas>,
|
|
4433
|
-
then?: (
|
|
4442
|
+
then?: (
|
|
4443
|
+
store: Store<Schemas>,
|
|
4444
|
+
partialValues: PartialValues<Schemas[1]>,
|
|
4445
|
+
) => void,
|
|
4434
4446
|
thenDeps?: React.DependencyList,
|
|
4435
4447
|
) => ParameterizedCallback<Parameter>;
|
|
4436
4448
|
|
|
@@ -5957,7 +5969,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
5957
5969
|
* When called with an object as the first argument, the useSortedRowIds method
|
|
5958
5970
|
* destructures it to make it easier to skip optional parameters.
|
|
5959
5971
|
* @param args A SortedRowIdsArgs object containing the Id of the Table in the
|
|
5960
|
-
* Store, and optional `cellId`, `descending`, `offset`, and `
|
|
5972
|
+
* Store, and optional `cellId`, `descending`, `offset`, `limit`, and `sorter`
|
|
5973
|
+
* parameters.
|
|
5961
5974
|
* @param listener The function that will be called whenever the sorted Row Ids
|
|
5962
5975
|
* in the Table change.
|
|
5963
5976
|
* @param listenerDeps An optional array of dependencies for the `listener`
|
|
@@ -8174,6 +8187,35 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
8174
8187
|
*/
|
|
8175
8188
|
useIndexIds(indexesOrIndexesId?: IndexesOrIndexesId<Schemas>): Ids;
|
|
8176
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
|
+
|
|
8177
8219
|
/**
|
|
8178
8220
|
* The useSliceIds hook gets the list of Slice Ids in an Index, and registers a
|
|
8179
8221
|
* listener so that any changes to that result will cause a re-render.
|
|
@@ -8303,6 +8345,38 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
8303
8345
|
indexesOrIndexesId?: IndexesOrIndexesId<Schemas>,
|
|
8304
8346
|
) => Ids;
|
|
8305
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
|
+
|
|
8306
8380
|
/**
|
|
8307
8381
|
* The useSliceRowIds hook gets the list of Row Ids in a given Slice, and
|
|
8308
8382
|
* registers a listener so that any changes to that result will cause a
|
|
@@ -38,6 +38,7 @@ import type {
|
|
|
38
38
|
IdOrNull,
|
|
39
39
|
Ids,
|
|
40
40
|
ParameterizedCallback,
|
|
41
|
+
Sorter,
|
|
41
42
|
} from '../common/index.d.ts';
|
|
42
43
|
import type {
|
|
43
44
|
Indexes,
|
|
@@ -1418,6 +1419,8 @@ export function useRowIds(
|
|
|
1418
1419
|
* @param descending Whether the sorting should be in descending order.
|
|
1419
1420
|
* @param offset The number of Row Ids to skip for pagination purposes, if any.
|
|
1420
1421
|
* @param limit The maximum number of Row Ids to return, or `undefined` for all.
|
|
1422
|
+
* @param sorter A custom function for comparing the sorting values, or
|
|
1423
|
+
* `undefined` to use the default alphanumeric sorting.
|
|
1421
1424
|
* @param storeOrStoreId The Store to be accessed: omit for the default context
|
|
1422
1425
|
* Store, provide an Id for a named context Store, or provide an explicit
|
|
1423
1426
|
* reference.
|
|
@@ -1441,6 +1444,7 @@ export function useRowIds(
|
|
|
1441
1444
|
* false,
|
|
1442
1445
|
* 0,
|
|
1443
1446
|
* undefined,
|
|
1447
|
+
* undefined,
|
|
1444
1448
|
* store,
|
|
1445
1449
|
* );
|
|
1446
1450
|
* console.log(JSON.stringify(rowIds()));
|
|
@@ -1457,6 +1461,7 @@ export function useSortedRowIds(
|
|
|
1457
1461
|
descending?: MaybeAccessor<boolean | undefined>,
|
|
1458
1462
|
offset?: MaybeAccessor<number | undefined>,
|
|
1459
1463
|
limit?: MaybeAccessor<number | undefined>,
|
|
1464
|
+
sorter?: Sorter,
|
|
1460
1465
|
storeOrStoreId?: MaybeAccessor<StoreOrStoreId | undefined>,
|
|
1461
1466
|
): Accessor<Ids>;
|
|
1462
1467
|
|
|
@@ -1464,7 +1469,8 @@ export function useSortedRowIds(
|
|
|
1464
1469
|
* When called with an object as the first argument, the useSortedRowIds method
|
|
1465
1470
|
* destructures it to make it easier to skip optional parameters.
|
|
1466
1471
|
* @param args A SortedRowIdsArgs object containing the Id of the Table in the
|
|
1467
|
-
* Store, and optional `cellId`, `descending`, `offset`, and `
|
|
1472
|
+
* Store, and optional `cellId`, `descending`, `offset`, `limit`, and `sorter`
|
|
1473
|
+
* parameters.
|
|
1468
1474
|
* @param storeOrStoreId The Store to be accessed: omit for the default context
|
|
1469
1475
|
* Store, provide an Id for a named context Store, or provide an explicit
|
|
1470
1476
|
* reference.
|
|
@@ -4517,7 +4523,8 @@ export function useSortedRowIdsListener(
|
|
|
4517
4523
|
* When called with an object as the first argument, the useSortedRowIds method
|
|
4518
4524
|
* destructures it to make it easier to skip optional parameters.
|
|
4519
4525
|
* @param args A SortedRowIdsArgs object containing the Id of the Table in the
|
|
4520
|
-
* Store, and optional `cellId`, `descending`, `offset`, and `
|
|
4526
|
+
* Store, and optional `cellId`, `descending`, `offset`, `limit`, and `sorter`
|
|
4527
|
+
* parameters.
|
|
4521
4528
|
* @param listener The function that will be called whenever the sorted Row Ids
|
|
4522
4529
|
* in the Table change.
|
|
4523
4530
|
* @param mutator An optional boolean that indicates that the listener mutates
|
|
@@ -6864,6 +6871,26 @@ export function useIndexIds(
|
|
|
6864
6871
|
indexesOrIndexesId?: MaybeAccessor<IndexesOrIndexesId | undefined>,
|
|
6865
6872
|
): Accessor<Ids>;
|
|
6866
6873
|
|
|
6874
|
+
/**
|
|
6875
|
+
* The useHasIndex primitive returns a boolean indicating whether a given Index
|
|
6876
|
+
* exists in the Indexes object, and registers a listener so that any changes to
|
|
6877
|
+
* that result will cause an update.
|
|
6878
|
+
*
|
|
6879
|
+
* This primitive follows the same Indexes object resolution rules as the
|
|
6880
|
+
* useIndexIds primitive.
|
|
6881
|
+
* @param indexId The Id of a possible Index in the Indexes object.
|
|
6882
|
+
* @param indexesOrIndexesId The Indexes object to be accessed: omit for the
|
|
6883
|
+
* default context Indexes object, provide an Id for a named context Indexes
|
|
6884
|
+
* object, or provide an explicit reference.
|
|
6885
|
+
* @returns Whether an Index with that Id exists.
|
|
6886
|
+
* @category Indexes primitives
|
|
6887
|
+
* @since v9.1.0
|
|
6888
|
+
*/
|
|
6889
|
+
export function useHasIndex(
|
|
6890
|
+
indexId: MaybeAccessor<Id>,
|
|
6891
|
+
indexesOrIndexesId?: MaybeAccessor<IndexesOrIndexesId | undefined>,
|
|
6892
|
+
): Accessor<boolean>;
|
|
6893
|
+
|
|
6867
6894
|
/**
|
|
6868
6895
|
* The useSliceIds primitive gets the list of Slice Ids in an Index, and
|
|
6869
6896
|
* registers a listener so that any changes to that result will cause an update.
|
|
@@ -6951,6 +6978,28 @@ export function useSliceIds(
|
|
|
6951
6978
|
indexesOrIndexesId?: MaybeAccessor<IndexesOrIndexesId | undefined>,
|
|
6952
6979
|
): Accessor<Ids>;
|
|
6953
6980
|
|
|
6981
|
+
/**
|
|
6982
|
+
* The useHasSlice primitive returns a boolean indicating whether a given Slice
|
|
6983
|
+
* exists in an Index, and registers a listener so that any changes to that
|
|
6984
|
+
* result will cause an update.
|
|
6985
|
+
*
|
|
6986
|
+
* This primitive follows the same Indexes object resolution rules as the
|
|
6987
|
+
* useSliceIds primitive.
|
|
6988
|
+
* @param indexId The Id of a possible Index in the Indexes object.
|
|
6989
|
+
* @param sliceId The Id of a possible Slice in the Index.
|
|
6990
|
+
* @param indexesOrIndexesId The Indexes object to be accessed: omit for the
|
|
6991
|
+
* default context Indexes object, provide an Id for a named context Indexes
|
|
6992
|
+
* object, or provide an explicit reference.
|
|
6993
|
+
* @returns Whether a Slice with that Id exists.
|
|
6994
|
+
* @category Indexes primitives
|
|
6995
|
+
* @since v9.1.0
|
|
6996
|
+
*/
|
|
6997
|
+
export function useHasSlice(
|
|
6998
|
+
indexId: MaybeAccessor<Id>,
|
|
6999
|
+
sliceId: MaybeAccessor<Id>,
|
|
7000
|
+
indexesOrIndexesId?: MaybeAccessor<IndexesOrIndexesId | undefined>,
|
|
7001
|
+
): Accessor<boolean>;
|
|
7002
|
+
|
|
6954
7003
|
/**
|
|
6955
7004
|
* The useSliceRowIds primitive gets the list of Row Ids in a given Slice, and
|
|
6956
7005
|
* registers a listener so that any changes to that result will cause an update.
|