@arrai-innovations/reactive-helpers 20.1.2 → 21.0.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/README.md +22 -893
- package/config/listCrud.js +30 -27
- package/config/objectCrud.js +20 -13
- package/index.js +5 -3
- package/package.json +5 -3
- package/types/config/commonCrud.d.ts +0 -1
- package/types/config/listCrud.d.ts +28 -41
- package/types/config/objectCrud.d.ts +14 -29
- package/types/index.d.ts +5 -4
- package/types/tests/unit/config/listCrud.spec.d.ts +0 -1
- package/types/tests/unit/config/objectCrud.spec.d.ts +0 -1
- package/types/tests/unit/crudPromise.d.ts +42 -15
- package/types/tests/unit/mockOnUnmounted.d.ts +0 -1
- package/types/tests/unit/poll.d.ts +0 -1
- package/types/tests/unit/scopedIt.d.ts +15 -0
- package/types/tests/unit/setup.d.ts +2 -0
- package/types/tests/unit/use/cancellableIntent.spec.d.ts +0 -1
- package/types/tests/unit/use/combineClasses.spec.d.ts +1 -0
- package/types/tests/unit/use/list.spec.d.ts +1 -0
- package/types/tests/unit/use/listCalculated.spec.d.ts +0 -1
- package/types/tests/unit/use/listFilter.spec.d.ts +0 -1
- package/types/tests/unit/use/listInstance.spec.d.ts +0 -1
- package/types/tests/unit/use/listRelated.spec.d.ts +0 -1
- package/types/tests/unit/use/listSearch.spec.d.ts +0 -1
- package/types/tests/unit/use/listSort.spec.d.ts +0 -1
- package/types/tests/unit/use/listSubscription.spec.d.ts +0 -1
- package/types/tests/unit/use/loadingError.spec.d.ts +0 -1
- package/types/tests/unit/use/object.spec.d.ts +1 -0
- package/types/tests/unit/use/objectCalculated.spec.d.ts +1 -0
- package/types/tests/unit/use/objectInstance.spec.d.ts +0 -1
- package/types/tests/unit/use/objectRelated.spec.d.ts +1 -0
- package/types/tests/unit/use/objectSubscription.spec.d.ts +0 -1
- package/types/tests/unit/use/proxyLoadingError.spec.d.ts +0 -1
- package/types/tests/unit/use/search.error.spec.d.ts +1 -0
- package/types/tests/unit/use/search.spec.d.ts +0 -1
- package/types/tests/unit/utils/assignReactiveObject.extra.spec.d.ts +1 -0
- package/types/tests/unit/utils/assignReactiveObject.refs.spec.d.ts +1 -0
- package/types/tests/unit/utils/assignReactiveObject.spec.d.ts +0 -1
- package/types/tests/unit/utils/cancellableFetch.spec.d.ts +1 -0
- package/types/tests/unit/utils/classes.spec.d.ts +0 -1
- package/types/tests/unit/utils/compact.spec.d.ts +1 -0
- package/types/tests/unit/utils/deepUnref.spec.d.ts +1 -0
- package/types/tests/unit/utils/deleteKey.spec.d.ts +0 -1
- package/types/tests/unit/utils/flattenPaths.spec.d.ts +0 -1
- package/types/tests/unit/utils/flattenPathsWithValues.spec.d.ts +1 -0
- package/types/tests/unit/utils/getFakePk.spec.d.ts +1 -0
- package/types/tests/unit/utils/keepAliveTry.spec.d.ts +1 -0
- package/types/tests/unit/utils/keyDiff.spec.d.ts +0 -1
- package/types/tests/unit/utils/set.spec.d.ts +0 -1
- package/types/tests/unit/utils/transformWalk.spec.d.ts +1 -0
- package/types/tests/unit/utils/unwrapNested.spec.d.ts +1 -0
- package/types/tests/unit/utils/watches.spec.d.ts +0 -1
- package/types/use/cancellableIntent.d.ts +121 -48
- package/types/use/combineClasses.d.ts +0 -1
- package/types/use/error.d.ts +48 -0
- package/types/use/list.d.ts +9 -32
- package/types/use/listCalculated.d.ts +107 -49
- package/types/use/listFilter.d.ts +13 -31
- package/types/use/listInstance.d.ts +137 -71
- package/types/use/listRelated.d.ts +106 -43
- package/types/use/listSearch.d.ts +24 -12
- package/types/use/listSort.d.ts +3 -34
- package/types/use/listSubscription.d.ts +40 -57
- package/types/use/loading.d.ts +37 -0
- package/types/use/loadingError.d.ts +5 -100
- package/types/use/object.d.ts +3 -12
- package/types/use/objectCalculated.d.ts +3 -9
- package/types/use/objectInstance.d.ts +59 -47
- package/types/use/objectRelated.d.ts +3 -9
- package/types/use/objectSubscription.d.ts +33 -51
- package/types/use/proxyError.d.ts +27 -0
- package/types/use/proxyLoading.d.ts +15 -0
- package/types/use/proxyLoadingError.d.ts +8 -16
- package/types/use/search.d.ts +2 -3
- package/types/utils/assignReactiveObject.d.ts +0 -1
- package/types/utils/cancellableFetch.d.ts +0 -1
- package/types/utils/cancellablePromise.d.ts +0 -1
- package/types/utils/classes.d.ts +2 -8
- package/types/utils/compact.d.ts +0 -1
- package/types/utils/deepUnref.d.ts +2 -23
- package/types/utils/deleteKey.d.ts +6 -6
- package/types/utils/flattenPaths.d.ts +0 -1
- package/types/utils/flattenPathsWithValues.d.ts +29 -0
- package/types/utils/getFakePk.d.ts +0 -1
- package/types/utils/keepAliveTry.d.ts +0 -1
- package/types/utils/keyDiff.d.ts +9 -10
- package/types/utils/loadingCombine.d.ts +0 -1
- package/types/utils/proxyRunning.d.ts +2 -3
- package/types/utils/refIfReactive.d.ts +0 -1
- package/types/utils/relatedCalculatedHelpers.d.ts +0 -1
- package/types/utils/set.d.ts +0 -1
- package/types/utils/transformWalk.d.ts +0 -1
- package/types/utils/unwrapNested.d.ts +0 -1
- package/types/utils/watches.d.ts +0 -1
- package/use/cancellableIntent.js +185 -100
- package/use/error.js +44 -0
- package/use/list.js +51 -111
- package/use/listCalculated.js +75 -98
- package/use/listFilter.js +91 -186
- package/use/listInstance.js +357 -282
- package/use/listRelated.js +52 -72
- package/use/listSearch.js +49 -86
- package/use/listSort.js +121 -237
- package/use/listSubscription.js +181 -274
- package/use/loading.js +35 -0
- package/use/loadingError.js +7 -81
- package/use/object.js +47 -67
- package/use/objectCalculated.js +103 -65
- package/use/objectInstance.js +253 -241
- package/use/objectRelated.js +48 -30
- package/use/objectSubscription.js +110 -175
- package/use/proxyError.js +48 -0
- package/use/proxyLoading.js +22 -0
- package/use/proxyLoadingError.js +9 -35
- package/use/search.js +4 -2
- package/utils/assignReactiveObject.js +8 -8
- package/utils/classes.js +7 -28
- package/utils/deepUnref.js +15 -2
- package/utils/deleteKey.js +13 -5
- package/utils/flattenPathsWithValues.js +65 -0
- package/utils/keyDiff.js +5 -5
- package/utils/proxyRunning.js +16 -10
- package/types/config/commonCrud.d.ts.map +0 -1
- package/types/config/listCrud.d.ts.map +0 -1
- package/types/config/objectCrud.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/tests/unit/config/listCrud.spec.d.ts.map +0 -1
- package/types/tests/unit/config/objectCrud.spec.d.ts.map +0 -1
- package/types/tests/unit/crudPromise.d.ts.map +0 -1
- package/types/tests/unit/expectHelpers.d.ts +0 -2
- package/types/tests/unit/expectHelpers.d.ts.map +0 -1
- package/types/tests/unit/mockOnUnmounted.d.ts.map +0 -1
- package/types/tests/unit/poll.d.ts.map +0 -1
- package/types/tests/unit/use/cancellableIntent.spec.d.ts.map +0 -1
- package/types/tests/unit/use/listCalculated.spec.d.ts.map +0 -1
- package/types/tests/unit/use/listFilter.spec.d.ts.map +0 -1
- package/types/tests/unit/use/listInstance.spec.d.ts.map +0 -1
- package/types/tests/unit/use/listRelated.spec.d.ts.map +0 -1
- package/types/tests/unit/use/listSearch.spec.d.ts.map +0 -1
- package/types/tests/unit/use/listSort.spec.d.ts.map +0 -1
- package/types/tests/unit/use/listSubscription.spec.d.ts.map +0 -1
- package/types/tests/unit/use/loadingError.spec.d.ts.map +0 -1
- package/types/tests/unit/use/objectInstance.spec.d.ts.map +0 -1
- package/types/tests/unit/use/objectSubscription.spec.d.ts.map +0 -1
- package/types/tests/unit/use/proxyLoadingError.spec.d.ts.map +0 -1
- package/types/tests/unit/use/search.spec.d.ts.map +0 -1
- package/types/tests/unit/utils/assignReactiveObject.spec.d.ts.map +0 -1
- package/types/tests/unit/utils/classes.spec.d.ts.map +0 -1
- package/types/tests/unit/utils/deleteKey.spec.d.ts.map +0 -1
- package/types/tests/unit/utils/flattenPaths.spec.d.ts.map +0 -1
- package/types/tests/unit/utils/keyDiff.spec.d.ts.map +0 -1
- package/types/tests/unit/utils/set.spec.d.ts.map +0 -1
- package/types/tests/unit/utils/watches.spec.d.ts.map +0 -1
- package/types/use/cancellableIntent.d.ts.map +0 -1
- package/types/use/combineClasses.d.ts.map +0 -1
- package/types/use/list.d.ts.map +0 -1
- package/types/use/listCalculated.d.ts.map +0 -1
- package/types/use/listFilter.d.ts.map +0 -1
- package/types/use/listInstance.d.ts.map +0 -1
- package/types/use/listKeys.d.ts +0 -15
- package/types/use/listKeys.d.ts.map +0 -1
- package/types/use/listRelated.d.ts.map +0 -1
- package/types/use/listSearch.d.ts.map +0 -1
- package/types/use/listSort.d.ts.map +0 -1
- package/types/use/listSubscription.d.ts.map +0 -1
- package/types/use/loadingError.d.ts.map +0 -1
- package/types/use/object.d.ts.map +0 -1
- package/types/use/objectCalculated.d.ts.map +0 -1
- package/types/use/objectInstance.d.ts.map +0 -1
- package/types/use/objectRelated.d.ts.map +0 -1
- package/types/use/objectSubscription.d.ts.map +0 -1
- package/types/use/paginatedListInstance.d.ts +0 -60
- package/types/use/paginatedListInstance.d.ts.map +0 -1
- package/types/use/proxyLoadingError.d.ts.map +0 -1
- package/types/use/search.d.ts.map +0 -1
- package/types/use/watchesRunning.d.ts +0 -63
- package/types/use/watchesRunning.d.ts.map +0 -1
- package/types/utils/assignReactiveObject.d.ts.map +0 -1
- package/types/utils/cancellableFetch.d.ts.map +0 -1
- package/types/utils/cancellablePromise.d.ts.map +0 -1
- package/types/utils/classes.d.ts.map +0 -1
- package/types/utils/compact.d.ts.map +0 -1
- package/types/utils/deepUnref.d.ts.map +0 -1
- package/types/utils/deleteKey.d.ts.map +0 -1
- package/types/utils/flattenPaths.d.ts.map +0 -1
- package/types/utils/getFakePk.d.ts.map +0 -1
- package/types/utils/keepAliveTry.d.ts.map +0 -1
- package/types/utils/keyDiff.d.ts.map +0 -1
- package/types/utils/loadingCombine.d.ts.map +0 -1
- package/types/utils/proxyRunning.d.ts.map +0 -1
- package/types/utils/refIfReactive.d.ts.map +0 -1
- package/types/utils/relatedCalculatedHelpers.d.ts.map +0 -1
- package/types/utils/set.d.ts.map +0 -1
- package/types/utils/transformWalk.d.ts.map +0 -1
- package/types/utils/unwrapNested.d.ts.map +0 -1
- package/types/utils/watches.d.ts.map +0 -1
- package/use/listKeys.js +0 -105
- package/use/paginatedListInstance.js +0 -126
- package/use/watchesRunning.js +0 -69
|
@@ -1,3 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue Composition API composable function for managing relationships among objects in a list.
|
|
3
|
+
* It enables linking objects based on predefined rules and dynamically adjusts as the underlying data changes.
|
|
4
|
+
*
|
|
5
|
+
* @module use/listRelated.js
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* The rule for defining relationships for objects in a list.
|
|
9
|
+
*
|
|
10
|
+
* @typedef {object} ListRelatedRule
|
|
11
|
+
* @property {string} pkKey - Specifies the foreign key used to link objects across lists. Planned to be renamed to
|
|
12
|
+
* 'fkKey' to better reflect its usage.
|
|
13
|
+
* @property {string[]} [order] - Specifies the order in which related objects should be sorted, if applicable.
|
|
14
|
+
* @property {import('./listInstance.js').ObjectsByPk} objects - The objects that can be related based on the foreign key.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The rules for defining relationships among objects in a list.
|
|
18
|
+
*
|
|
19
|
+
* @typedef {{
|
|
20
|
+
* [rule: string]: ListRelatedRule,
|
|
21
|
+
* }} ListRelatedRules
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Represents the internal state used by the list related composition function. It manages and computes the relationships
|
|
25
|
+
* between objects based on specified rules, providing real-time updates to related objects as the parent state changes.
|
|
26
|
+
*
|
|
27
|
+
* @typedef {object} ListRelatedRawState
|
|
28
|
+
* @property {{
|
|
29
|
+
* [pk: string]: {
|
|
30
|
+
* [rule: string]: import('vue').ComputedRef<any>,
|
|
31
|
+
* },
|
|
32
|
+
* }} relatedObjects - Stores computed references to related objects, allowing for dynamic access based on object pk and specific rules.
|
|
33
|
+
* @property {ListRelatedRules} relatedObjectsRules - Defines the rules for establishing relationships, such as foreign key links and sorting orders.
|
|
34
|
+
* @property {{
|
|
35
|
+
* [pk: string]: {
|
|
36
|
+
* [rule: string]: import('vue').ComputedRef<[object, string]>,
|
|
37
|
+
* },
|
|
38
|
+
* }} objAndKeyForPkAndRule - Maps each object pk and rule to a tuple consisting of the related object and its respective key, facilitating direct data manipulation.
|
|
39
|
+
* @property {{
|
|
40
|
+
* [pk: string]: {
|
|
41
|
+
* [rule: string]: import('vue').ComputedRef<any>,
|
|
42
|
+
* },
|
|
43
|
+
* }} fkForPkAndRule - Maintains computed references to the foreign keys for each object pk and rule, crucial for navigating complex data relationships.
|
|
44
|
+
* @property {boolean} relatedObjectsParentStateObjectsWatchRunning - Flags whether the watch on parent state objects is currently active, ensuring updates trigger as needed.
|
|
45
|
+
* @property {boolean} relatedObjectsWatchRunning - Indicates if watches on the related objects themselves are active, managing updates efficiently.
|
|
46
|
+
* @property {boolean} relatedRunning - Signals whether any computations related to object relationships are currently in progress.
|
|
47
|
+
* @property {import('vue').Ref<boolean>} running - General flag that indicates if the list-related logic is processing, used to manage UI feedback or prevent concurrent operations.
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* The raw state properties for a parent of a list related property.
|
|
51
|
+
*
|
|
52
|
+
* @typedef {(
|
|
53
|
+
* import('./listInstance.js').ListInstanceRawState &
|
|
54
|
+
* Partial<import('./listSubscription.js').ListSubscriptionRawState>
|
|
55
|
+
* )} ListRelatedParentRawState
|
|
56
|
+
*/
|
|
57
|
+
/**
|
|
58
|
+
* The type for a parentState object.
|
|
59
|
+
*
|
|
60
|
+
* @typedef {import('vue').UnwrapNestedRefs<ListRelatedParentRawState>} ListRelatedParentState
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* The state for a list related property.
|
|
64
|
+
*
|
|
65
|
+
* @typedef {import('vue').UnwrapNestedRefs<
|
|
66
|
+
* ListRelatedParentRawState &
|
|
67
|
+
* ListRelatedRawState
|
|
68
|
+
* >} ListRelatedState
|
|
69
|
+
*/
|
|
1
70
|
/**
|
|
2
71
|
* The options for the list related composition function.
|
|
3
72
|
*
|
|
@@ -11,8 +80,7 @@
|
|
|
11
80
|
* @typedef {object} ListRelatedProperties
|
|
12
81
|
* @property {ListRelatedState} state - The state for the list related property.
|
|
13
82
|
* @property {ListRelatedParentState} parentState - The parent state object.
|
|
14
|
-
* @property {
|
|
15
|
-
* @property {import('vue').EffectScope} effectScope - The effect scope for the list related property.
|
|
83
|
+
* @property {() => void} stop - Stops all effects of the list related property.
|
|
16
84
|
*/
|
|
17
85
|
/**
|
|
18
86
|
* An instance of `useListRelated`.
|
|
@@ -109,44 +177,6 @@ export function useListRelateds(listRelatedArgs: {
|
|
|
109
177
|
* maintaining the integrity of object relationships as per the specified rules.
|
|
110
178
|
*/
|
|
111
179
|
export function useListRelated({ parentState, relatedObjectsRules }: ListRelatedOptions): ListRelated;
|
|
112
|
-
/**
|
|
113
|
-
* The options for the list related composition function.
|
|
114
|
-
*/
|
|
115
|
-
export type ListRelatedOptions = {
|
|
116
|
-
/**
|
|
117
|
-
* - The parent state object.
|
|
118
|
-
*/
|
|
119
|
-
parentState: ListRelatedParentState;
|
|
120
|
-
/**
|
|
121
|
-
* - The rules for the related objects.
|
|
122
|
-
*/
|
|
123
|
-
relatedObjectsRules: import("vue").Ref<ListRelatedRules>;
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* The properties for the list related composition function.
|
|
127
|
-
*/
|
|
128
|
-
export type ListRelatedProperties = {
|
|
129
|
-
/**
|
|
130
|
-
* - The state for the list related property.
|
|
131
|
-
*/
|
|
132
|
-
state: ListRelatedState;
|
|
133
|
-
/**
|
|
134
|
-
* - The parent state object.
|
|
135
|
-
*/
|
|
136
|
-
parentState: ListRelatedParentState;
|
|
137
|
-
/**
|
|
138
|
-
* - The watches running instance.
|
|
139
|
-
*/
|
|
140
|
-
watchesRunning: import("./watchesRunning.js").WatchesRunning;
|
|
141
|
-
/**
|
|
142
|
-
* - The effect scope for the list related property.
|
|
143
|
-
*/
|
|
144
|
-
effectScope: import("vue").EffectScope;
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* An instance of `useListRelated`.
|
|
148
|
-
*/
|
|
149
|
-
export type ListRelated = ListRelatedProperties;
|
|
150
180
|
/**
|
|
151
181
|
* The rule for defining relationships for objects in a list.
|
|
152
182
|
*/
|
|
@@ -168,9 +198,9 @@ export type ListRelatedRule = {
|
|
|
168
198
|
/**
|
|
169
199
|
* The rules for defining relationships among objects in a list.
|
|
170
200
|
*/
|
|
171
|
-
export type ListRelatedRules =
|
|
201
|
+
export type ListRelatedRules = {
|
|
172
202
|
[rule: string]: ListRelatedRule;
|
|
173
|
-
}
|
|
203
|
+
};
|
|
174
204
|
/**
|
|
175
205
|
* Represents the internal state used by the list related composition function. It manages and computes the relationships
|
|
176
206
|
* between objects based on specified rules, providing real-time updates to related objects as the parent state changes.
|
|
@@ -233,4 +263,37 @@ export type ListRelatedParentState = import("vue").UnwrapNestedRefs<ListRelatedP
|
|
|
233
263
|
* The state for a list related property.
|
|
234
264
|
*/
|
|
235
265
|
export type ListRelatedState = import("vue").UnwrapNestedRefs<ListRelatedParentRawState & ListRelatedRawState>;
|
|
236
|
-
|
|
266
|
+
/**
|
|
267
|
+
* The options for the list related composition function.
|
|
268
|
+
*/
|
|
269
|
+
export type ListRelatedOptions = {
|
|
270
|
+
/**
|
|
271
|
+
* - The parent state object.
|
|
272
|
+
*/
|
|
273
|
+
parentState: ListRelatedParentState;
|
|
274
|
+
/**
|
|
275
|
+
* - The rules for the related objects.
|
|
276
|
+
*/
|
|
277
|
+
relatedObjectsRules: import("vue").Ref<ListRelatedRules>;
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* The properties for the list related composition function.
|
|
281
|
+
*/
|
|
282
|
+
export type ListRelatedProperties = {
|
|
283
|
+
/**
|
|
284
|
+
* - The state for the list related property.
|
|
285
|
+
*/
|
|
286
|
+
state: ListRelatedState;
|
|
287
|
+
/**
|
|
288
|
+
* - The parent state object.
|
|
289
|
+
*/
|
|
290
|
+
parentState: ListRelatedParentState;
|
|
291
|
+
/**
|
|
292
|
+
* - Stops all effects of the list related property.
|
|
293
|
+
*/
|
|
294
|
+
stop: () => void;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* An instance of `useListRelated`.
|
|
298
|
+
*/
|
|
299
|
+
export type ListRelated = ListRelatedProperties;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides a Vue 3 composable for adding text search functionality to lists. It allows for
|
|
3
|
+
* configuring dynamic search rules that reactively filter lists based on user input and other
|
|
4
|
+
* criteria. The search functionality is optimized for integration with other list management
|
|
5
|
+
* composables like listInstance and listFilter, enabling complex search scenarios across
|
|
6
|
+
* multiple data points.
|
|
7
|
+
*
|
|
8
|
+
* @module use/listSearch.js
|
|
9
|
+
*/
|
|
1
10
|
/**
|
|
2
11
|
* Represents the raw reactive state used by the list search functionality.
|
|
3
12
|
*
|
|
@@ -11,8 +20,8 @@
|
|
|
11
20
|
* @property {object} objectIndexes - Indexes built for quick search across objects based on rules.
|
|
12
21
|
* @property {object} customDocumentOptions - Configuration options for the search document, used by FlexSearch.
|
|
13
22
|
* @property {object} customSearchOptions - Additional search options for FlexSearch.
|
|
14
|
-
* @property {boolean} searched - Flag indicating if a search has been performed.
|
|
15
|
-
* @property {boolean} running - Indicates if the search process is actively running.
|
|
23
|
+
* @property {Readonly<import('vue').Ref<boolean>>} searched - Flag indicating if a search has been performed.
|
|
24
|
+
* @property {import('vue').ComputedRef<boolean>} running - Indicates if the search process is actively running.
|
|
16
25
|
*/
|
|
17
26
|
/**
|
|
18
27
|
*
|
|
@@ -28,6 +37,9 @@
|
|
|
28
37
|
/**
|
|
29
38
|
* @typedef {import('vue').UnwrapNestedRefs<ListSearchParentRawState>} ListSearchParentState - The parent state for a list search.
|
|
30
39
|
*/
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {import('vue').ToRefs<ListSearchParentState>} ListSearchParentStateToRefs
|
|
42
|
+
*/
|
|
31
43
|
/**
|
|
32
44
|
* @typedef {import('vue').UnwrapNestedRefs<
|
|
33
45
|
* ListSearchRawState &
|
|
@@ -58,8 +70,8 @@
|
|
|
58
70
|
*
|
|
59
71
|
* @typedef {object} ListSearchProperties
|
|
60
72
|
* @property {ListSearchState} state - The state.
|
|
61
|
-
* @property {import('vue').EffectScope} effectScope - The effect scope.
|
|
62
73
|
* @property {import('./search.js').SearchInstance} textSearchIndex - The text search index.
|
|
74
|
+
* @property {() => void} stop - Stops the effect scope and cleans up resources.
|
|
63
75
|
*/
|
|
64
76
|
/**
|
|
65
77
|
* The provided list search instance, containing properties and functions.
|
|
@@ -99,7 +111,7 @@ export function useListSearches(listSearchArgs: {
|
|
|
99
111
|
/**
|
|
100
112
|
* @typedef {object} ListSearchInstanceOptions
|
|
101
113
|
* @property {object} parentState - The list being filtered.
|
|
102
|
-
* @property {ListSearchProps} props - Reactive properties.
|
|
114
|
+
* @property {ListSearchProps} [props] - Reactive properties.
|
|
103
115
|
* @property {number} [throttle=500] - Throttle wait time.
|
|
104
116
|
* @property {boolean} [showAllWhenEmpty=true] - Whether to show all items when the search is empty.
|
|
105
117
|
*/
|
|
@@ -172,17 +184,18 @@ export type ListSearchRawState = {
|
|
|
172
184
|
/**
|
|
173
185
|
* - Flag indicating if a search has been performed.
|
|
174
186
|
*/
|
|
175
|
-
searched: boolean
|
|
187
|
+
searched: Readonly<import("vue").Ref<boolean>>;
|
|
176
188
|
/**
|
|
177
189
|
* - Indicates if the search process is actively running.
|
|
178
190
|
*/
|
|
179
|
-
running: boolean
|
|
191
|
+
running: import("vue").ComputedRef<boolean>;
|
|
180
192
|
};
|
|
181
193
|
export type ListSearchParentRawState = (import("./listInstance.js").ListInstanceRawState & Partial<import("./listSubscription.js").ListSubscriptionRawState> & Partial<import("./listRelated.js").ListRelatedRawState> & Partial<import("./listCalculated.js").ListCalculatedRawState> & Partial<import("./listFilter.js").ListFilterRawState>);
|
|
182
194
|
/**
|
|
183
195
|
* - The parent state for a list search.
|
|
184
196
|
*/
|
|
185
197
|
export type ListSearchParentState = import("vue").UnwrapNestedRefs<ListSearchParentRawState>;
|
|
198
|
+
export type ListSearchParentStateToRefs = import("vue").ToRefs<ListSearchParentState>;
|
|
186
199
|
/**
|
|
187
200
|
* - The state for a list search.
|
|
188
201
|
*/
|
|
@@ -239,14 +252,14 @@ export type ListSearchProperties = {
|
|
|
239
252
|
* - The state.
|
|
240
253
|
*/
|
|
241
254
|
state: ListSearchState;
|
|
242
|
-
/**
|
|
243
|
-
* - The effect scope.
|
|
244
|
-
*/
|
|
245
|
-
effectScope: import("vue").EffectScope;
|
|
246
255
|
/**
|
|
247
256
|
* - The text search index.
|
|
248
257
|
*/
|
|
249
258
|
textSearchIndex: import("./search.js").SearchInstance;
|
|
259
|
+
/**
|
|
260
|
+
* - Stops the effect scope and cleans up resources.
|
|
261
|
+
*/
|
|
262
|
+
stop: () => void;
|
|
250
263
|
};
|
|
251
264
|
/**
|
|
252
265
|
* The provided list search instance, containing properties and functions.
|
|
@@ -285,7 +298,7 @@ export type ListSearchInstanceOptions = {
|
|
|
285
298
|
/**
|
|
286
299
|
* - Reactive properties.
|
|
287
300
|
*/
|
|
288
|
-
props
|
|
301
|
+
props?: ListSearchProps;
|
|
289
302
|
/**
|
|
290
303
|
* - Throttle wait time.
|
|
291
304
|
*/
|
|
@@ -295,4 +308,3 @@ export type ListSearchInstanceOptions = {
|
|
|
295
308
|
*/
|
|
296
309
|
showAllWhenEmpty?: boolean;
|
|
297
310
|
};
|
|
298
|
-
//# sourceMappingURL=listSearch.d.ts.map
|
package/types/use/listSort.d.ts
CHANGED
|
@@ -28,12 +28,7 @@ export function setListSortDefaultOptions({ sortThrottleWait }: {
|
|
|
28
28
|
*
|
|
29
29
|
* @typedef {object} ListSortRawState
|
|
30
30
|
* @property {OrderByRule[]} orderByRules - Current sorting rules applied to the list.
|
|
31
|
-
* @property {string[]} order - Array of IDs representing the current sort order of the list.
|
|
32
|
-
* @property {object} sortCriteria - Computed sort criteria used for dynamically sorting the list.
|
|
33
31
|
* @property {boolean[]} orderByDesc - Flags indicating whether each sort criterion is in descending order.
|
|
34
|
-
* @property {boolean} sortCriteriaWatchRunning - Flag to indicate if sorting criteria computations are actively updating.
|
|
35
|
-
* @property {boolean} sortWatchRunning - Flag to indicate if the sort operation is actively processing.
|
|
36
|
-
* @property {boolean} outstandingEffects - Flag to indicate if there are pending reactive effects needing resolution.
|
|
37
32
|
*/
|
|
38
33
|
/**
|
|
39
34
|
*
|
|
@@ -73,8 +68,7 @@ export function setListSortDefaultOptions({ sortThrottleWait }: {
|
|
|
73
68
|
* @typedef {object} ListSortProperties
|
|
74
69
|
* @property {ListSortState} state - The reactive state for the list sort.
|
|
75
70
|
* @property {ListSortParentState} parentState - The parent state.
|
|
76
|
-
* @property {
|
|
77
|
-
* @property {import('./watchesRunning.js').WatchesRunning} watchesRunning - The watches running instance.
|
|
71
|
+
* @property {() => void} stop - A function to stop the effect scope and clean up resources.
|
|
78
72
|
*/
|
|
79
73
|
/**
|
|
80
74
|
* The list sort instance, including reactive state and utilities to manage list sorting operations.
|
|
@@ -157,30 +151,10 @@ export type ListSortRawState = {
|
|
|
157
151
|
* - Current sorting rules applied to the list.
|
|
158
152
|
*/
|
|
159
153
|
orderByRules: OrderByRule[];
|
|
160
|
-
/**
|
|
161
|
-
* - Array of IDs representing the current sort order of the list.
|
|
162
|
-
*/
|
|
163
|
-
order: string[];
|
|
164
|
-
/**
|
|
165
|
-
* - Computed sort criteria used for dynamically sorting the list.
|
|
166
|
-
*/
|
|
167
|
-
sortCriteria: object;
|
|
168
154
|
/**
|
|
169
155
|
* - Flags indicating whether each sort criterion is in descending order.
|
|
170
156
|
*/
|
|
171
157
|
orderByDesc: boolean[];
|
|
172
|
-
/**
|
|
173
|
-
* - Flag to indicate if sorting criteria computations are actively updating.
|
|
174
|
-
*/
|
|
175
|
-
sortCriteriaWatchRunning: boolean;
|
|
176
|
-
/**
|
|
177
|
-
* - Flag to indicate if the sort operation is actively processing.
|
|
178
|
-
*/
|
|
179
|
-
sortWatchRunning: boolean;
|
|
180
|
-
/**
|
|
181
|
-
* - Flag to indicate if there are pending reactive effects needing resolution.
|
|
182
|
-
*/
|
|
183
|
-
outstandingEffects: boolean;
|
|
184
158
|
};
|
|
185
159
|
export type ListSortParentRawState = (import("./listInstance.js").ListInstanceRawState & Partial<import("./listSubscription.js").ListSubscriptionRawState> & Partial<import("./listRelated.js").ListRelatedRawState> & Partial<import("./listCalculated.js").ListCalculatedRawState> & Partial<import("./listFilter.js").ListFilterRawState> & Partial<import("./listSearch.js").ListSearchRawState>);
|
|
186
160
|
export type ListSortParentState = import("vue").UnwrapNestedRefs<ListSortParentRawState>;
|
|
@@ -219,16 +193,11 @@ export type ListSortProperties = {
|
|
|
219
193
|
*/
|
|
220
194
|
parentState: ListSortParentState;
|
|
221
195
|
/**
|
|
222
|
-
* -
|
|
223
|
-
*/
|
|
224
|
-
effectScope: import("vue").EffectScope;
|
|
225
|
-
/**
|
|
226
|
-
* - The watches running instance.
|
|
196
|
+
* - A function to stop the effect scope and clean up resources.
|
|
227
197
|
*/
|
|
228
|
-
|
|
198
|
+
stop: () => void;
|
|
229
199
|
};
|
|
230
200
|
/**
|
|
231
201
|
* The list sort instance, including reactive state and utilities to manage list sorting operations.
|
|
232
202
|
*/
|
|
233
203
|
export type ListSort = ListSortProperties;
|
|
234
|
-
//# sourceMappingURL=listSort.d.ts.map
|
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The raw state of a list subscription.
|
|
3
3
|
*
|
|
4
|
-
* @typedef {object}
|
|
5
|
-
* @property {
|
|
6
|
-
* @property {
|
|
7
|
-
* @property {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @
|
|
4
|
+
* @typedef {object} ListSubscriptionMyState
|
|
5
|
+
* @property {import('vue').Ref<boolean>|boolean} intendToList - If this is true, the list should be fetched, or re-fetched if arguments change.
|
|
6
|
+
* @property {import('vue').Ref<boolean>|boolean} intendToSubscribe - If this is true, the subscription should start or restart if arguments change.
|
|
7
|
+
* @property {import('vue').Ref<boolean>} subscribed - Whether the subscription is active.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {import('vue').ToRefs<import('./listInstance.js').ListInstanceState>} ListInstanceStateRefs
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The raw state of a list subscription, including the state from the list instance.
|
|
14
|
+
*
|
|
15
|
+
* @typedef {ListSubscriptionMyState & (
|
|
16
|
+
* Pick<import('./loadingError.js').LoadingErrorStatus, "loading" | "error" | "errored">
|
|
17
|
+
* ) & ListInstanceStateRefs} ListSubscriptionRawState
|
|
11
18
|
*/
|
|
12
19
|
/**
|
|
13
20
|
* A reactive object that manages a list of objects, as returned by `useListInstance`.
|
|
14
21
|
*
|
|
15
|
-
* @typedef {import('vue').
|
|
16
|
-
* ListSubscriptionRawState &
|
|
17
|
-
* import('./listInstance.js').ListInstanceRawState
|
|
18
|
-
* >} ListSubscriptionState
|
|
22
|
+
* @typedef {import('vue').Reactive<ListSubscriptionRawState>} ListSubscriptionState
|
|
19
23
|
*/
|
|
20
24
|
/**
|
|
21
25
|
* The methods available on a list subscription.
|
|
22
26
|
*
|
|
23
|
-
* @typedef {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* @
|
|
27
|
+
* @typedef {Pick<import('./loadingError.js').LoadingErrorStatus, "clearError">} ListSubscriptionFunctions
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {{
|
|
31
|
+
* state: ListSubscriptionState,
|
|
32
|
+
* listInstance: import('./listInstance.js').ListInstance,
|
|
33
|
+
* loadingError: import('./loadingError.js').LoadingErrorStatus,
|
|
34
|
+
* }} ListSubscriptionContext
|
|
27
35
|
*/
|
|
28
36
|
/**
|
|
29
37
|
* The properties of a list subscription.
|
|
@@ -33,7 +41,6 @@
|
|
|
33
41
|
* @property {import('./listInstance.js').ListInstance} listInstance - The list instance used by the subscription.
|
|
34
42
|
* @property {import('./cancellableIntent.js').CancellableIntent} listIntent - The `CancellableIntent` instance managing if the list should be (re)fetched.
|
|
35
43
|
* @property {import('./cancellableIntent.js').CancellableIntent} subscribeIntent - The `CancellableIntent` instance managing if the subscription should be (un)subscribed.
|
|
36
|
-
* @property {import('vue').EffectScope} effectScope - The effect scope of the list subscription.
|
|
37
44
|
*/
|
|
38
45
|
/**
|
|
39
46
|
* An instance of a list subscription, returned by `useListSubscription`.
|
|
@@ -46,8 +53,6 @@
|
|
|
46
53
|
*
|
|
47
54
|
* @typedef {object & import("./listInstance.js").ListInstanceOptions} ListSubscriptionOptions
|
|
48
55
|
* @property {import("./listInstance.js").ListInstance} listInstance - A list instance to use instead of creating one.
|
|
49
|
-
* @property {boolean} clearListOnListIntentTriggered - If true, the list will be cleared when the list intent is triggered. Default is false.
|
|
50
|
-
* @property {import('vue').Ref<boolean>|boolean} keepOldPages - If true, pages will not be cleared when defaultPageCallback is called.
|
|
51
56
|
*/
|
|
52
57
|
/**
|
|
53
58
|
* A Vue composition function that creates multiple list subscriptions, and returns them as an object.
|
|
@@ -105,11 +110,9 @@ export function useListSubscriptions(listSubscriptionArgs: {
|
|
|
105
110
|
* @param {ListSubscriptionOptions} options - The options for the list subscription.
|
|
106
111
|
* @returns {ListSubscription} - Returns a robust list subscription object that manages a list instance with
|
|
107
112
|
* capabilities to subscribe and unsubscribe to data sources, alongside handling real-time data updates.
|
|
108
|
-
* @throws {ListSubscriptionError} - If
|
|
109
|
-
* passed. Also thrown if clearListOnListIntentTriggered is not passed or if neither listInstance
|
|
110
|
-
* nor keepOldPages are passed.
|
|
113
|
+
* @throws {ListSubscriptionError} - If the list instance is not set and no props are passed.
|
|
111
114
|
*/
|
|
112
|
-
export function useListSubscription({ listInstance, props, handlers
|
|
115
|
+
export function useListSubscription({ listInstance, props, handlers }: ListSubscriptionOptions): ListSubscription;
|
|
113
116
|
/**
|
|
114
117
|
* A composable function for managing a list subscription.
|
|
115
118
|
*
|
|
@@ -131,52 +134,37 @@ export class ListSubscriptionError extends Error {
|
|
|
131
134
|
/**
|
|
132
135
|
* The raw state of a list subscription.
|
|
133
136
|
*/
|
|
134
|
-
export type
|
|
135
|
-
/**
|
|
136
|
-
* - Whether the subscription is loading.
|
|
137
|
-
*/
|
|
138
|
-
subscriptionLoading: Readonly<import("vue").Ref<boolean>>;
|
|
139
|
-
/**
|
|
140
|
-
* - Whether the subscription has errored.
|
|
141
|
-
*/
|
|
142
|
-
subscriptionErrored: Readonly<import("vue").Ref<boolean>>;
|
|
143
|
-
/**
|
|
144
|
-
* - The error that occurred.
|
|
145
|
-
*/
|
|
146
|
-
subscriptionError: Readonly<import("vue").Ref<Error>>;
|
|
137
|
+
export type ListSubscriptionMyState = {
|
|
147
138
|
/**
|
|
148
139
|
* - If this is true, the list should be fetched, or re-fetched if arguments change.
|
|
149
140
|
*/
|
|
150
|
-
intendToList: boolean;
|
|
141
|
+
intendToList: import("vue").Ref<boolean> | boolean;
|
|
151
142
|
/**
|
|
152
143
|
* - If this is true, the subscription should start or restart if arguments change.
|
|
153
144
|
*/
|
|
154
|
-
intendToSubscribe: boolean;
|
|
145
|
+
intendToSubscribe: import("vue").Ref<boolean> | boolean;
|
|
155
146
|
/**
|
|
156
147
|
* - Whether the subscription is active.
|
|
157
148
|
*/
|
|
158
|
-
subscribed: boolean
|
|
149
|
+
subscribed: import("vue").Ref<boolean>;
|
|
159
150
|
};
|
|
151
|
+
export type ListInstanceStateRefs = import("vue").ToRefs<import("./listInstance.js").ListInstanceState>;
|
|
152
|
+
/**
|
|
153
|
+
* The raw state of a list subscription, including the state from the list instance.
|
|
154
|
+
*/
|
|
155
|
+
export type ListSubscriptionRawState = ListSubscriptionMyState & (Pick<import("./loadingError.js").LoadingErrorStatus, "loading" | "error" | "errored">) & ListInstanceStateRefs;
|
|
160
156
|
/**
|
|
161
157
|
* A reactive object that manages a list of objects, as returned by `useListInstance`.
|
|
162
158
|
*/
|
|
163
|
-
export type ListSubscriptionState = import("vue").
|
|
159
|
+
export type ListSubscriptionState = import("vue").Reactive<ListSubscriptionRawState>;
|
|
164
160
|
/**
|
|
165
161
|
* The methods available on a list subscription.
|
|
166
162
|
*/
|
|
167
|
-
export type ListSubscriptionFunctions =
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* - Unsubscribe from the list.
|
|
174
|
-
*/
|
|
175
|
-
unsubscribe: Function;
|
|
176
|
-
/**
|
|
177
|
-
* - Clear the subscription error and the underlying list instance error.
|
|
178
|
-
*/
|
|
179
|
-
clearError: Function;
|
|
163
|
+
export type ListSubscriptionFunctions = Pick<import("./loadingError.js").LoadingErrorStatus, "clearError">;
|
|
164
|
+
export type ListSubscriptionContext = {
|
|
165
|
+
state: ListSubscriptionState;
|
|
166
|
+
listInstance: import("./listInstance.js").ListInstance;
|
|
167
|
+
loadingError: import("./loadingError.js").LoadingErrorStatus;
|
|
180
168
|
};
|
|
181
169
|
/**
|
|
182
170
|
* The properties of a list subscription.
|
|
@@ -198,10 +186,6 @@ export type ListSubscriptionProperties = {
|
|
|
198
186
|
* - The `CancellableIntent` instance managing if the subscription should be (un)subscribed.
|
|
199
187
|
*/
|
|
200
188
|
subscribeIntent: import("./cancellableIntent.js").CancellableIntent;
|
|
201
|
-
/**
|
|
202
|
-
* - The effect scope of the list subscription.
|
|
203
|
-
*/
|
|
204
|
-
effectScope: import("vue").EffectScope;
|
|
205
189
|
};
|
|
206
190
|
/**
|
|
207
191
|
* An instance of a list subscription, returned by `useListSubscription`.
|
|
@@ -212,4 +196,3 @@ export type ListSubscription = ListSubscriptionFunctions & ListSubscriptionPrope
|
|
|
212
196
|
* and subscriptions based on the given properties.
|
|
213
197
|
*/
|
|
214
198
|
export type ListSubscriptionOptions = object & import("./listInstance.js").ListInstanceOptions;
|
|
215
|
-
//# sourceMappingURL=listSubscription.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("vue").Ref<boolean|undefined>} LoadingRef
|
|
3
|
+
* @typedef {Readonly<LoadingRef>} LoadingReadonlyRef
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The loading state API.
|
|
7
|
+
*
|
|
8
|
+
* @typedef {object} LoadingStatus
|
|
9
|
+
* @property {LoadingReadonlyRef} loading - Whether the component is loading.
|
|
10
|
+
* @property {() => void} setLoading - Set the loading state to true.
|
|
11
|
+
* @property {() => void} clearLoading - Set the loading state to false.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* A composable function for managing loading state.
|
|
15
|
+
*
|
|
16
|
+
* @returns {LoadingStatus} - An object containing reactive fields and actions for loading state.
|
|
17
|
+
*/
|
|
18
|
+
export function useLoading(): LoadingStatus;
|
|
19
|
+
export type LoadingRef = import("vue").Ref<boolean | undefined>;
|
|
20
|
+
export type LoadingReadonlyRef = Readonly<LoadingRef>;
|
|
21
|
+
/**
|
|
22
|
+
* The loading state API.
|
|
23
|
+
*/
|
|
24
|
+
export type LoadingStatus = {
|
|
25
|
+
/**
|
|
26
|
+
* - Whether the component is loading.
|
|
27
|
+
*/
|
|
28
|
+
loading: LoadingReadonlyRef;
|
|
29
|
+
/**
|
|
30
|
+
* - Set the loading state to true.
|
|
31
|
+
*/
|
|
32
|
+
setLoading: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* - Set the loading state to false.
|
|
35
|
+
*/
|
|
36
|
+
clearLoading: () => void;
|
|
37
|
+
};
|
|
@@ -1,105 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
2
|
+
* @typedef {import('./loading.js').LoadingStatus & import('./error.js').ErrorStatus} LoadingErrorStatus
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* @typedef {import("vue").Ref<boolean|undefined>} LoadingRef
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* @typedef {import("vue").Ref<Error|null>} ErrorRef
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* @typedef {import("vue").Ref<boolean>} ErroredRef
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* @typedef {Readonly<LoadingRef>} LoadingReadonlyRef
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* @typedef {Readonly<ErrorRef>} ErrorReadonlyRef
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* @typedef {Readonly<ErroredRef>} ErroredReadonlyRef
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* The common API for loading and error states.
|
|
5
|
+
* A composable function combining loading and error state management.
|
|
27
6
|
*
|
|
28
|
-
* @
|
|
29
|
-
* @property {LoadingReadonlyRef} loading - Whether the component is loading.
|
|
30
|
-
* @property {ErrorReadonlyRef} error - The error that occurred.
|
|
31
|
-
* @property {ErroredReadonlyRef} errored - Whether an error has occurred.
|
|
32
|
-
* @property {ClearErrorFn} clearError - Clear the error state.
|
|
33
|
-
*/
|
|
34
|
-
/**
|
|
35
|
-
* The writable API for loading and error states.
|
|
36
|
-
*
|
|
37
|
-
* @typedef {object} LoadingErrorMutations
|
|
38
|
-
* @property {() => void} setLoading - Set the loading state.
|
|
39
|
-
* @property {() => void} clearLoading - Clear the loading state.
|
|
40
|
-
* @property {(error: Error) => void} setError - Set the error state.
|
|
41
|
-
*/
|
|
42
|
-
/**
|
|
43
|
-
* The instance of useLoadingError.
|
|
44
|
-
*
|
|
45
|
-
* @typedef {LoadingErrorStatus & LoadingErrorMutations} LoadingError
|
|
46
|
-
*/
|
|
47
|
-
/**
|
|
48
|
-
* A composable function for managing loading and error states.
|
|
49
|
-
*
|
|
50
|
-
* @returns {LoadingError} - An object containing reactive fields and actions for loading and error states.
|
|
51
|
-
*/
|
|
52
|
-
export function useLoadingError(): LoadingError;
|
|
53
|
-
/**
|
|
54
|
-
* - Clear the error state.
|
|
55
|
-
*/
|
|
56
|
-
export type ClearErrorFn = () => void;
|
|
57
|
-
export type LoadingRef = import("vue").Ref<boolean | undefined>;
|
|
58
|
-
export type ErrorRef = import("vue").Ref<Error | null>;
|
|
59
|
-
export type ErroredRef = import("vue").Ref<boolean>;
|
|
60
|
-
export type LoadingReadonlyRef = Readonly<LoadingRef>;
|
|
61
|
-
export type ErrorReadonlyRef = Readonly<ErrorRef>;
|
|
62
|
-
export type ErroredReadonlyRef = Readonly<ErroredRef>;
|
|
63
|
-
/**
|
|
64
|
-
* The common API for loading and error states.
|
|
65
|
-
*/
|
|
66
|
-
export type LoadingErrorStatus = {
|
|
67
|
-
/**
|
|
68
|
-
* - Whether the component is loading.
|
|
69
|
-
*/
|
|
70
|
-
loading: LoadingReadonlyRef;
|
|
71
|
-
/**
|
|
72
|
-
* - The error that occurred.
|
|
73
|
-
*/
|
|
74
|
-
error: ErrorReadonlyRef;
|
|
75
|
-
/**
|
|
76
|
-
* - Whether an error has occurred.
|
|
77
|
-
*/
|
|
78
|
-
errored: ErroredReadonlyRef;
|
|
79
|
-
/**
|
|
80
|
-
* - Clear the error state.
|
|
81
|
-
*/
|
|
82
|
-
clearError: ClearErrorFn;
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* The writable API for loading and error states.
|
|
86
|
-
*/
|
|
87
|
-
export type LoadingErrorMutations = {
|
|
88
|
-
/**
|
|
89
|
-
* - Set the loading state.
|
|
90
|
-
*/
|
|
91
|
-
setLoading: () => void;
|
|
92
|
-
/**
|
|
93
|
-
* - Clear the loading state.
|
|
94
|
-
*/
|
|
95
|
-
clearLoading: () => void;
|
|
96
|
-
/**
|
|
97
|
-
* - Set the error state.
|
|
98
|
-
*/
|
|
99
|
-
setError: (error: Error) => void;
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* The instance of useLoadingError.
|
|
7
|
+
* @returns {LoadingErrorStatus} - An object containing reactive fields and actions for both loading and error state.
|
|
103
8
|
*/
|
|
104
|
-
export
|
|
105
|
-
|
|
9
|
+
export function useLoadingError(): LoadingErrorStatus;
|
|
10
|
+
export type LoadingErrorStatus = import("./loading.js").LoadingStatus & import("./error.js").ErrorStatus;
|