@arrai-innovations/reactive-helpers 11.4.2 → 13.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/.husky/pre-commit +0 -1
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.prettierignore +1 -0
- package/README.md +11 -10
- package/config/listCrud.js +32 -1
- package/config/objectCrud.js +47 -1
- package/docs/README.md +43 -0
- package/docs/config/listCrud.md +97 -0
- package/docs/config/objectCrud.md +123 -0
- package/docs/use/cancellableIntent.md +163 -0
- package/docs/use/combineClasses.md +52 -0
- package/docs/use/list.md +285 -0
- package/docs/use/listCalculated.md +773 -0
- package/docs/use/listFilter.md +877 -0
- package/docs/use/listInstance.md +483 -0
- package/docs/use/listKeys.md +91 -0
- package/docs/use/listRelated.md +685 -0
- package/docs/use/listSearch.md +889 -0
- package/docs/use/listSort.md +1144 -0
- package/docs/use/listSubscription.md +379 -0
- package/docs/use/loadingError.md +21 -0
- package/docs/use/object.md +437 -0
- package/docs/use/objectCalculated.md +606 -0
- package/docs/use/objectInstance.md +486 -0
- package/docs/use/objectRelated.md +588 -0
- package/docs/use/objectSubscription.md +459 -0
- package/docs/use/paginatedListInstance.md +147 -0
- package/docs/use/search.md +311 -0
- package/docs/use/watchesRunning.md +80 -0
- package/docs/utils/assignReactiveObject.md +351 -0
- package/docs/utils/classes.md +100 -0
- package/docs/utils/compact.md +57 -0
- package/docs/utils/deleteKey.md +53 -0
- package/docs/utils/flattenPaths.md +45 -0
- package/docs/utils/getFakeId.md +34 -0
- package/docs/utils/keyDiff.md +101 -0
- package/docs/utils/loadingCombine.md +28 -0
- package/docs/utils/proxyRunning.md +33 -0
- package/docs/utils/relatedCalculatedHelpers.md +75 -0
- package/docs/utils/set.md +139 -0
- package/docs/utils/transformWalk.md +33 -0
- package/docs/utils/watches.md +441 -0
- package/eslint.config.js +125 -0
- package/index.js +34 -3
- package/lint-staged.config.js +5 -1
- package/makeTypeDoc.sh +25 -0
- package/package.json +27 -19
- package/tests/unit/config/listCrud.spec.js +5 -0
- package/tests/unit/config/objectCrud.spec.js +5 -0
- package/tests/unit/crudPromise.js +22 -3
- package/tests/unit/mockOnUnmounted.js +1 -1
- package/tests/unit/use/cancellableIntent.spec.js +2 -0
- package/tests/unit/use/listCalculated.spec.js +4 -3
- package/tests/unit/use/listFilter.spec.js +11 -7
- package/tests/unit/use/listInstance.spec.js +32 -14
- package/tests/unit/use/listRelated.spec.js +3 -2
- package/tests/unit/use/listSearch.spec.js +9 -7
- package/tests/unit/use/listSort.spec.js +29 -22
- package/tests/unit/use/listSubscription.spec.js +11 -5
- package/tests/unit/use/objectInstance.spec.js +15 -2
- package/tests/unit/use/objectSubscription.spec.js +31 -16
- package/tests/unit/use/search.spec.js +2 -2
- package/tests/unit/utils/assignReactiveObject.spec.js +21 -13
- package/tests/unit/utils/classes.spec.js +7 -6
- package/tests/unit/utils/watches.spec.js +4 -4
- package/tsconfig.json +19 -0
- package/typedoc-local-plugins/customize-output.js +13 -0
- package/typedoc.json +12 -0
- package/use/cancellableIntent.js +73 -2
- package/use/combineClasses.js +41 -31
- package/use/list.js +139 -5
- package/use/listCalculated.js +175 -10
- package/use/listFilter.js +175 -21
- package/use/listInstance.js +215 -94
- package/use/listRelated.js +260 -72
- package/use/listSearch.js +178 -57
- package/use/listSort.js +188 -21
- package/use/listSubscription.js +211 -63
- package/use/loadingError.js +43 -0
- package/use/object.js +187 -23
- package/use/objectCalculated.js +168 -16
- package/use/objectInstance.js +183 -102
- package/use/objectRelated.js +276 -84
- package/use/objectSubscription.js +169 -17
- package/use/paginatedListInstance.js +30 -1
- package/use/search.js +39 -23
- package/use/watchesRunning.js +41 -6
- package/utils/assignReactiveObject.js +139 -88
- package/utils/classes.js +57 -48
- package/utils/compact.js +28 -2
- package/utils/deleteKey.js +14 -1
- package/utils/flattenPaths.js +19 -9
- package/utils/getFakeId.js +11 -1
- package/utils/keyDiff.js +26 -35
- package/utils/loadingCombine.js +7 -4
- package/utils/proxyRunning.js +16 -8
- package/utils/relatedCalculatedHelpers.js +17 -0
- package/utils/set.js +66 -0
- package/utils/transformWalk.js +7 -6
- package/utils/watches.js +205 -71
- package/.eslintignore +0 -2
- package/.eslintrc.cjs +0 -25
- package/.jsdoc2md.json +0 -4
- package/config/index.js +0 -2
- package/docs.md +0 -1002
- package/jsdoc-to-markdown.sh +0 -16
- package/tests/unit/.eslintrc.cjs +0 -11
- package/tests/unit/config/index.spec.js +0 -18
- package/tests/unit/use/index.spec.js +0 -18
- package/tests/unit/utils/index.spec.js +0 -18
- package/use/index.js +0 -19
- package/utils/debugMessage.js +0 -209
- package/utils/debugWatch.js +0 -29
- package/utils/index.js +0 -16
- package/utils/lifecycleDebug.js +0 -126
|
@@ -0,0 +1,877 @@
|
|
|
1
|
+
[**@arrai-innovations/reactive-helpers**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@arrai-innovations/reactive-helpers](../README.md) / use/listFilter
|
|
6
|
+
|
|
7
|
+
# use/listFilter
|
|
8
|
+
|
|
9
|
+
## Interfaces
|
|
10
|
+
|
|
11
|
+
### ListFilterOptions
|
|
12
|
+
|
|
13
|
+
#### Properties
|
|
14
|
+
|
|
15
|
+
##### allowedFilter
|
|
16
|
+
|
|
17
|
+
> **allowedFilter**: `Function` \| `Ref`\<`Function`\>
|
|
18
|
+
|
|
19
|
+
A function that returns true if an item should be included, which can be reactive.
|
|
20
|
+
|
|
21
|
+
##### excludedFilter
|
|
22
|
+
|
|
23
|
+
> **excludedFilter**: `Function` \| `Ref`\<`Function`\>
|
|
24
|
+
|
|
25
|
+
A function that returns true if an item should be excluded, which can be reactive.
|
|
26
|
+
|
|
27
|
+
##### parentState
|
|
28
|
+
|
|
29
|
+
> **parentState**: `object`
|
|
30
|
+
|
|
31
|
+
The parent state.
|
|
32
|
+
|
|
33
|
+
###### calculatedObjects
|
|
34
|
+
|
|
35
|
+
> **calculatedObjects**: `object`
|
|
36
|
+
|
|
37
|
+
The calculated objects.
|
|
38
|
+
|
|
39
|
+
###### Index Signature
|
|
40
|
+
|
|
41
|
+
\[`id`: `string`\]: `object`
|
|
42
|
+
|
|
43
|
+
###### calculatedObjectsParentStateObjectsWatchRunning
|
|
44
|
+
|
|
45
|
+
> **calculatedObjectsParentStateObjectsWatchRunning**: `boolean`
|
|
46
|
+
|
|
47
|
+
Whether the parent state objects watch is running.
|
|
48
|
+
|
|
49
|
+
###### calculatedObjectsRules
|
|
50
|
+
|
|
51
|
+
> **calculatedObjectsRules**: `object`
|
|
52
|
+
|
|
53
|
+
The rules for the calculated objects.
|
|
54
|
+
|
|
55
|
+
###### Index Signature
|
|
56
|
+
|
|
57
|
+
\[`rule`: `string`\]: (`object`, `relatedObject`, `calculatedObjects`) => `any`
|
|
58
|
+
|
|
59
|
+
###### calculatedObjectsWatchRunning
|
|
60
|
+
|
|
61
|
+
> **calculatedObjectsWatchRunning**: `boolean`
|
|
62
|
+
|
|
63
|
+
Whether the calculated objects watch is running.
|
|
64
|
+
|
|
65
|
+
###### calculatedRunning
|
|
66
|
+
|
|
67
|
+
> **calculatedRunning**: `boolean`
|
|
68
|
+
|
|
69
|
+
Whether the calculated properties are running.
|
|
70
|
+
|
|
71
|
+
###### crud
|
|
72
|
+
|
|
73
|
+
> **crud**: `object`
|
|
74
|
+
|
|
75
|
+
CRUD functions and their configurations for the list.
|
|
76
|
+
|
|
77
|
+
###### crud.args
|
|
78
|
+
|
|
79
|
+
> **args**: `any`
|
|
80
|
+
|
|
81
|
+
Arguments for the CRUD functions.
|
|
82
|
+
|
|
83
|
+
###### crud.list
|
|
84
|
+
|
|
85
|
+
> **list**: `Function`
|
|
86
|
+
|
|
87
|
+
Function to list objects.
|
|
88
|
+
|
|
89
|
+
###### error
|
|
90
|
+
|
|
91
|
+
> **error**: `Error`
|
|
92
|
+
|
|
93
|
+
The last error encountered.
|
|
94
|
+
|
|
95
|
+
###### errored
|
|
96
|
+
|
|
97
|
+
> **errored**: `boolean`
|
|
98
|
+
|
|
99
|
+
Indicates if an error occurred during the last operation.
|
|
100
|
+
|
|
101
|
+
###### fkForIdAndRule
|
|
102
|
+
|
|
103
|
+
> **fkForIdAndRule**: `object`
|
|
104
|
+
|
|
105
|
+
Maintains computed references to the foreign keys for each object ID and rule, crucial for navigating complex data relationships.
|
|
106
|
+
|
|
107
|
+
###### Index Signature
|
|
108
|
+
|
|
109
|
+
\[`id`: `string`\]: `object`
|
|
110
|
+
|
|
111
|
+
###### intendToList
|
|
112
|
+
|
|
113
|
+
> **intendToList**: `boolean`
|
|
114
|
+
|
|
115
|
+
If this is true, the list should be fetched, or re-fetched if arguments change.
|
|
116
|
+
|
|
117
|
+
###### intendToSubscribe
|
|
118
|
+
|
|
119
|
+
> **intendToSubscribe**: `boolean`
|
|
120
|
+
|
|
121
|
+
If this is true, the subscription should start or restart if arguments change.
|
|
122
|
+
|
|
123
|
+
###### listArgs
|
|
124
|
+
|
|
125
|
+
> **listArgs**: `any`
|
|
126
|
+
|
|
127
|
+
Arguments passed to the server for listing operations.
|
|
128
|
+
|
|
129
|
+
###### loading
|
|
130
|
+
|
|
131
|
+
> **loading**: `boolean`
|
|
132
|
+
|
|
133
|
+
Indicates if the list is currently loading.
|
|
134
|
+
|
|
135
|
+
###### objAndKeyForIdAndRule
|
|
136
|
+
|
|
137
|
+
> **objAndKeyForIdAndRule**: `object`
|
|
138
|
+
|
|
139
|
+
Maps each object ID and rule to a tuple consisting of the related object and its respective key, facilitating direct data manipulation.
|
|
140
|
+
|
|
141
|
+
###### Index Signature
|
|
142
|
+
|
|
143
|
+
\[`id`: `string`\]: `object`
|
|
144
|
+
|
|
145
|
+
###### objects
|
|
146
|
+
|
|
147
|
+
> **objects**: [`ObjectsById`](listInstance.md#objectsbyid)
|
|
148
|
+
|
|
149
|
+
The list objects stored by their IDs.
|
|
150
|
+
|
|
151
|
+
###### objectsInOrder
|
|
152
|
+
|
|
153
|
+
> **objectsInOrder**: [`ListObject`](listInstance.md#listobject)[]
|
|
154
|
+
|
|
155
|
+
The objects in the order specified by the list.
|
|
156
|
+
|
|
157
|
+
###### order
|
|
158
|
+
|
|
159
|
+
> **order**: `string`[]
|
|
160
|
+
|
|
161
|
+
The order of objects in the list.
|
|
162
|
+
|
|
163
|
+
###### relatedObjects
|
|
164
|
+
|
|
165
|
+
> **relatedObjects**: `object`
|
|
166
|
+
|
|
167
|
+
Stores computed references to related objects, allowing for dynamic access based on object ID and specific rules.
|
|
168
|
+
|
|
169
|
+
###### Index Signature
|
|
170
|
+
|
|
171
|
+
\[`id`: `string`\]: `object`
|
|
172
|
+
|
|
173
|
+
###### relatedObjectsParentStateObjectsWatchRunning
|
|
174
|
+
|
|
175
|
+
> **relatedObjectsParentStateObjectsWatchRunning**: `boolean`
|
|
176
|
+
|
|
177
|
+
Flags whether the watch on parent state objects is currently active, ensuring updates trigger as needed.
|
|
178
|
+
|
|
179
|
+
###### relatedObjectsRules
|
|
180
|
+
|
|
181
|
+
> **relatedObjectsRules**: `object`
|
|
182
|
+
|
|
183
|
+
Defines the rules for establishing relationships, such as foreign key links and sorting orders.
|
|
184
|
+
|
|
185
|
+
###### Index Signature
|
|
186
|
+
|
|
187
|
+
\[`rule`: `string`\]: [`ListRelatedRule`](listRelated.md#listrelatedrule)
|
|
188
|
+
|
|
189
|
+
###### relatedObjectsWatchRunning
|
|
190
|
+
|
|
191
|
+
> **relatedObjectsWatchRunning**: `boolean`
|
|
192
|
+
|
|
193
|
+
Indicates if watches on the related objects themselves are active, managing updates efficiently.
|
|
194
|
+
|
|
195
|
+
###### relatedRunning
|
|
196
|
+
|
|
197
|
+
> **relatedRunning**: `boolean`
|
|
198
|
+
|
|
199
|
+
Signals whether any computations related to object relationships are currently in progress.
|
|
200
|
+
|
|
201
|
+
###### retrieveArgs
|
|
202
|
+
|
|
203
|
+
> **retrieveArgs**: `any`
|
|
204
|
+
|
|
205
|
+
Arguments passed to the server for retrieval operations.
|
|
206
|
+
|
|
207
|
+
###### running
|
|
208
|
+
|
|
209
|
+
> **running**: `boolean`
|
|
210
|
+
|
|
211
|
+
Indicates if there are ongoing reactive updates.
|
|
212
|
+
|
|
213
|
+
###### subscribed
|
|
214
|
+
|
|
215
|
+
> **subscribed**: `boolean`
|
|
216
|
+
|
|
217
|
+
Whether the subscription is active.
|
|
218
|
+
|
|
219
|
+
###### subscriptionError
|
|
220
|
+
|
|
221
|
+
> **subscriptionError**: `Error`
|
|
222
|
+
|
|
223
|
+
The error that occurred.
|
|
224
|
+
|
|
225
|
+
###### subscriptionErrored
|
|
226
|
+
|
|
227
|
+
> **subscriptionErrored**: `boolean`
|
|
228
|
+
|
|
229
|
+
Whether the subscription has errored.
|
|
230
|
+
|
|
231
|
+
###### subscriptionLoading
|
|
232
|
+
|
|
233
|
+
> **subscriptionLoading**: `boolean`
|
|
234
|
+
|
|
235
|
+
Whether the subscription is loading.
|
|
236
|
+
|
|
237
|
+
***
|
|
238
|
+
|
|
239
|
+
### ListFilterProperties
|
|
240
|
+
|
|
241
|
+
#### Properties
|
|
242
|
+
|
|
243
|
+
##### effectScope
|
|
244
|
+
|
|
245
|
+
> **effectScope**: `EffectScope`
|
|
246
|
+
|
|
247
|
+
Scoped reactivity for this filter instance.
|
|
248
|
+
|
|
249
|
+
##### parentState
|
|
250
|
+
|
|
251
|
+
> **parentState**: `object`
|
|
252
|
+
|
|
253
|
+
The state of the list being filtered.
|
|
254
|
+
|
|
255
|
+
###### calculatedObjects
|
|
256
|
+
|
|
257
|
+
> **calculatedObjects**: `object`
|
|
258
|
+
|
|
259
|
+
The calculated objects.
|
|
260
|
+
|
|
261
|
+
###### Index Signature
|
|
262
|
+
|
|
263
|
+
\[`id`: `string`\]: `object`
|
|
264
|
+
|
|
265
|
+
###### calculatedObjectsParentStateObjectsWatchRunning
|
|
266
|
+
|
|
267
|
+
> **calculatedObjectsParentStateObjectsWatchRunning**: `boolean`
|
|
268
|
+
|
|
269
|
+
Whether the parent state objects watch is running.
|
|
270
|
+
|
|
271
|
+
###### calculatedObjectsRules
|
|
272
|
+
|
|
273
|
+
> **calculatedObjectsRules**: `object`
|
|
274
|
+
|
|
275
|
+
The rules for the calculated objects.
|
|
276
|
+
|
|
277
|
+
###### Index Signature
|
|
278
|
+
|
|
279
|
+
\[`rule`: `string`\]: (`object`, `relatedObject`, `calculatedObjects`) => `any`
|
|
280
|
+
|
|
281
|
+
###### calculatedObjectsWatchRunning
|
|
282
|
+
|
|
283
|
+
> **calculatedObjectsWatchRunning**: `boolean`
|
|
284
|
+
|
|
285
|
+
Whether the calculated objects watch is running.
|
|
286
|
+
|
|
287
|
+
###### calculatedRunning
|
|
288
|
+
|
|
289
|
+
> **calculatedRunning**: `boolean`
|
|
290
|
+
|
|
291
|
+
Whether the calculated properties are running.
|
|
292
|
+
|
|
293
|
+
###### crud
|
|
294
|
+
|
|
295
|
+
> **crud**: `object`
|
|
296
|
+
|
|
297
|
+
CRUD functions and their configurations for the list.
|
|
298
|
+
|
|
299
|
+
###### crud.args
|
|
300
|
+
|
|
301
|
+
> **args**: `any`
|
|
302
|
+
|
|
303
|
+
Arguments for the CRUD functions.
|
|
304
|
+
|
|
305
|
+
###### crud.list
|
|
306
|
+
|
|
307
|
+
> **list**: `Function`
|
|
308
|
+
|
|
309
|
+
Function to list objects.
|
|
310
|
+
|
|
311
|
+
###### error
|
|
312
|
+
|
|
313
|
+
> **error**: `Error`
|
|
314
|
+
|
|
315
|
+
The last error encountered.
|
|
316
|
+
|
|
317
|
+
###### errored
|
|
318
|
+
|
|
319
|
+
> **errored**: `boolean`
|
|
320
|
+
|
|
321
|
+
Indicates if an error occurred during the last operation.
|
|
322
|
+
|
|
323
|
+
###### fkForIdAndRule
|
|
324
|
+
|
|
325
|
+
> **fkForIdAndRule**: `object`
|
|
326
|
+
|
|
327
|
+
Maintains computed references to the foreign keys for each object ID and rule, crucial for navigating complex data relationships.
|
|
328
|
+
|
|
329
|
+
###### Index Signature
|
|
330
|
+
|
|
331
|
+
\[`id`: `string`\]: `object`
|
|
332
|
+
|
|
333
|
+
###### intendToList
|
|
334
|
+
|
|
335
|
+
> **intendToList**: `boolean`
|
|
336
|
+
|
|
337
|
+
If this is true, the list should be fetched, or re-fetched if arguments change.
|
|
338
|
+
|
|
339
|
+
###### intendToSubscribe
|
|
340
|
+
|
|
341
|
+
> **intendToSubscribe**: `boolean`
|
|
342
|
+
|
|
343
|
+
If this is true, the subscription should start or restart if arguments change.
|
|
344
|
+
|
|
345
|
+
###### listArgs
|
|
346
|
+
|
|
347
|
+
> **listArgs**: `any`
|
|
348
|
+
|
|
349
|
+
Arguments passed to the server for listing operations.
|
|
350
|
+
|
|
351
|
+
###### loading
|
|
352
|
+
|
|
353
|
+
> **loading**: `boolean`
|
|
354
|
+
|
|
355
|
+
Indicates if the list is currently loading.
|
|
356
|
+
|
|
357
|
+
###### objAndKeyForIdAndRule
|
|
358
|
+
|
|
359
|
+
> **objAndKeyForIdAndRule**: `object`
|
|
360
|
+
|
|
361
|
+
Maps each object ID and rule to a tuple consisting of the related object and its respective key, facilitating direct data manipulation.
|
|
362
|
+
|
|
363
|
+
###### Index Signature
|
|
364
|
+
|
|
365
|
+
\[`id`: `string`\]: `object`
|
|
366
|
+
|
|
367
|
+
###### objects
|
|
368
|
+
|
|
369
|
+
> **objects**: [`ObjectsById`](listInstance.md#objectsbyid)
|
|
370
|
+
|
|
371
|
+
The list objects stored by their IDs.
|
|
372
|
+
|
|
373
|
+
###### objectsInOrder
|
|
374
|
+
|
|
375
|
+
> **objectsInOrder**: [`ListObject`](listInstance.md#listobject)[]
|
|
376
|
+
|
|
377
|
+
The objects in the order specified by the list.
|
|
378
|
+
|
|
379
|
+
###### order
|
|
380
|
+
|
|
381
|
+
> **order**: `string`[]
|
|
382
|
+
|
|
383
|
+
The order of objects in the list.
|
|
384
|
+
|
|
385
|
+
###### relatedObjects
|
|
386
|
+
|
|
387
|
+
> **relatedObjects**: `object`
|
|
388
|
+
|
|
389
|
+
Stores computed references to related objects, allowing for dynamic access based on object ID and specific rules.
|
|
390
|
+
|
|
391
|
+
###### Index Signature
|
|
392
|
+
|
|
393
|
+
\[`id`: `string`\]: `object`
|
|
394
|
+
|
|
395
|
+
###### relatedObjectsParentStateObjectsWatchRunning
|
|
396
|
+
|
|
397
|
+
> **relatedObjectsParentStateObjectsWatchRunning**: `boolean`
|
|
398
|
+
|
|
399
|
+
Flags whether the watch on parent state objects is currently active, ensuring updates trigger as needed.
|
|
400
|
+
|
|
401
|
+
###### relatedObjectsRules
|
|
402
|
+
|
|
403
|
+
> **relatedObjectsRules**: `object`
|
|
404
|
+
|
|
405
|
+
Defines the rules for establishing relationships, such as foreign key links and sorting orders.
|
|
406
|
+
|
|
407
|
+
###### Index Signature
|
|
408
|
+
|
|
409
|
+
\[`rule`: `string`\]: [`ListRelatedRule`](listRelated.md#listrelatedrule)
|
|
410
|
+
|
|
411
|
+
###### relatedObjectsWatchRunning
|
|
412
|
+
|
|
413
|
+
> **relatedObjectsWatchRunning**: `boolean`
|
|
414
|
+
|
|
415
|
+
Indicates if watches on the related objects themselves are active, managing updates efficiently.
|
|
416
|
+
|
|
417
|
+
###### relatedRunning
|
|
418
|
+
|
|
419
|
+
> **relatedRunning**: `boolean`
|
|
420
|
+
|
|
421
|
+
Signals whether any computations related to object relationships are currently in progress.
|
|
422
|
+
|
|
423
|
+
###### retrieveArgs
|
|
424
|
+
|
|
425
|
+
> **retrieveArgs**: `any`
|
|
426
|
+
|
|
427
|
+
Arguments passed to the server for retrieval operations.
|
|
428
|
+
|
|
429
|
+
###### running
|
|
430
|
+
|
|
431
|
+
> **running**: `boolean`
|
|
432
|
+
|
|
433
|
+
Indicates if there are ongoing reactive updates.
|
|
434
|
+
|
|
435
|
+
###### subscribed
|
|
436
|
+
|
|
437
|
+
> **subscribed**: `boolean`
|
|
438
|
+
|
|
439
|
+
Whether the subscription is active.
|
|
440
|
+
|
|
441
|
+
###### subscriptionError
|
|
442
|
+
|
|
443
|
+
> **subscriptionError**: `Error`
|
|
444
|
+
|
|
445
|
+
The error that occurred.
|
|
446
|
+
|
|
447
|
+
###### subscriptionErrored
|
|
448
|
+
|
|
449
|
+
> **subscriptionErrored**: `boolean`
|
|
450
|
+
|
|
451
|
+
Whether the subscription has errored.
|
|
452
|
+
|
|
453
|
+
###### subscriptionLoading
|
|
454
|
+
|
|
455
|
+
> **subscriptionLoading**: `boolean`
|
|
456
|
+
|
|
457
|
+
Whether the subscription is loading.
|
|
458
|
+
|
|
459
|
+
##### state
|
|
460
|
+
|
|
461
|
+
> **state**: `object`
|
|
462
|
+
|
|
463
|
+
The reactive state managing the filter logic and results.
|
|
464
|
+
|
|
465
|
+
###### allowedFilter
|
|
466
|
+
|
|
467
|
+
> **allowedFilter**: `Function`
|
|
468
|
+
|
|
469
|
+
Function to determine if an item should be included based on custom logic.
|
|
470
|
+
|
|
471
|
+
###### calculatedObjects
|
|
472
|
+
|
|
473
|
+
> **calculatedObjects**: `object`
|
|
474
|
+
|
|
475
|
+
The calculated objects.
|
|
476
|
+
|
|
477
|
+
###### Index Signature
|
|
478
|
+
|
|
479
|
+
\[`id`: `string`\]: `object`
|
|
480
|
+
|
|
481
|
+
###### calculatedObjectsParentStateObjectsWatchRunning
|
|
482
|
+
|
|
483
|
+
> **calculatedObjectsParentStateObjectsWatchRunning**: `boolean`
|
|
484
|
+
|
|
485
|
+
Whether the parent state objects watch is running.
|
|
486
|
+
|
|
487
|
+
###### calculatedObjectsRules
|
|
488
|
+
|
|
489
|
+
> **calculatedObjectsRules**: `object`
|
|
490
|
+
|
|
491
|
+
The rules for the calculated objects.
|
|
492
|
+
|
|
493
|
+
###### Index Signature
|
|
494
|
+
|
|
495
|
+
\[`rule`: `string`\]: (`object`, `relatedObject`, `calculatedObjects`) => `any`
|
|
496
|
+
|
|
497
|
+
###### calculatedObjectsWatchRunning
|
|
498
|
+
|
|
499
|
+
> **calculatedObjectsWatchRunning**: `boolean`
|
|
500
|
+
|
|
501
|
+
Whether the calculated objects watch is running.
|
|
502
|
+
|
|
503
|
+
###### calculatedRunning
|
|
504
|
+
|
|
505
|
+
> **calculatedRunning**: `boolean`
|
|
506
|
+
|
|
507
|
+
Whether the calculated properties are running.
|
|
508
|
+
|
|
509
|
+
###### crud
|
|
510
|
+
|
|
511
|
+
> **crud**: `object`
|
|
512
|
+
|
|
513
|
+
CRUD functions and their configurations for the list.
|
|
514
|
+
|
|
515
|
+
###### crud.args
|
|
516
|
+
|
|
517
|
+
> **args**: `any`
|
|
518
|
+
|
|
519
|
+
Arguments for the CRUD functions.
|
|
520
|
+
|
|
521
|
+
###### crud.list
|
|
522
|
+
|
|
523
|
+
> **list**: `Function`
|
|
524
|
+
|
|
525
|
+
Function to list objects.
|
|
526
|
+
|
|
527
|
+
###### error
|
|
528
|
+
|
|
529
|
+
> **error**: `Error`
|
|
530
|
+
|
|
531
|
+
The last error encountered.
|
|
532
|
+
|
|
533
|
+
###### errored
|
|
534
|
+
|
|
535
|
+
> **errored**: `boolean`
|
|
536
|
+
|
|
537
|
+
Indicates if an error occurred during the last operation.
|
|
538
|
+
|
|
539
|
+
###### excludedFilter
|
|
540
|
+
|
|
541
|
+
> **excludedFilter**: `Function`
|
|
542
|
+
|
|
543
|
+
Function to determine if an item should be excluded based on custom logic.
|
|
544
|
+
|
|
545
|
+
###### fkForIdAndRule
|
|
546
|
+
|
|
547
|
+
> **fkForIdAndRule**: `object`
|
|
548
|
+
|
|
549
|
+
Maintains computed references to the foreign keys for each object ID and rule, crucial for navigating complex data relationships.
|
|
550
|
+
|
|
551
|
+
###### Index Signature
|
|
552
|
+
|
|
553
|
+
\[`id`: `string`\]: `object`
|
|
554
|
+
|
|
555
|
+
###### inResults
|
|
556
|
+
|
|
557
|
+
> **inResults**: `any`
|
|
558
|
+
|
|
559
|
+
A map of items to boolean values indicating filter results.
|
|
560
|
+
|
|
561
|
+
###### intendToList
|
|
562
|
+
|
|
563
|
+
> **intendToList**: `boolean`
|
|
564
|
+
|
|
565
|
+
If this is true, the list should be fetched, or re-fetched if arguments change.
|
|
566
|
+
|
|
567
|
+
###### intendToSubscribe
|
|
568
|
+
|
|
569
|
+
> **intendToSubscribe**: `boolean`
|
|
570
|
+
|
|
571
|
+
If this is true, the subscription should start or restart if arguments change.
|
|
572
|
+
|
|
573
|
+
###### listArgs
|
|
574
|
+
|
|
575
|
+
> **listArgs**: `any`
|
|
576
|
+
|
|
577
|
+
Arguments passed to the server for listing operations.
|
|
578
|
+
|
|
579
|
+
###### loading
|
|
580
|
+
|
|
581
|
+
> **loading**: `boolean`
|
|
582
|
+
|
|
583
|
+
Indicates if the list is currently loading.
|
|
584
|
+
|
|
585
|
+
###### objAndKeyForIdAndRule
|
|
586
|
+
|
|
587
|
+
> **objAndKeyForIdAndRule**: `object`
|
|
588
|
+
|
|
589
|
+
Maps each object ID and rule to a tuple consisting of the related object and its respective key, facilitating direct data manipulation.
|
|
590
|
+
|
|
591
|
+
###### Index Signature
|
|
592
|
+
|
|
593
|
+
\[`id`: `string`\]: `object`
|
|
594
|
+
|
|
595
|
+
###### objects
|
|
596
|
+
|
|
597
|
+
> **objects**: [`ObjectsById`](listInstance.md#objectsbyid)
|
|
598
|
+
|
|
599
|
+
The list objects stored by their IDs.
|
|
600
|
+
|
|
601
|
+
###### objectsInOrder
|
|
602
|
+
|
|
603
|
+
> **objectsInOrder**: [`ListObject`](listInstance.md#listobject)[]
|
|
604
|
+
|
|
605
|
+
The objects in the order specified by the list.
|
|
606
|
+
|
|
607
|
+
###### objectsWatchRunning
|
|
608
|
+
|
|
609
|
+
> **objectsWatchRunning**: `boolean`
|
|
610
|
+
|
|
611
|
+
Flag indicating if the object watch is active.
|
|
612
|
+
|
|
613
|
+
###### order
|
|
614
|
+
|
|
615
|
+
> **order**: `string`[]
|
|
616
|
+
|
|
617
|
+
The order of objects in the list.
|
|
618
|
+
|
|
619
|
+
###### orderWatchRunning
|
|
620
|
+
|
|
621
|
+
> **orderWatchRunning**: `boolean`
|
|
622
|
+
|
|
623
|
+
Flag indicating if the order watch is active.
|
|
624
|
+
|
|
625
|
+
###### relatedObjects
|
|
626
|
+
|
|
627
|
+
> **relatedObjects**: `object`
|
|
628
|
+
|
|
629
|
+
Stores computed references to related objects, allowing for dynamic access based on object ID and specific rules.
|
|
630
|
+
|
|
631
|
+
###### Index Signature
|
|
632
|
+
|
|
633
|
+
\[`id`: `string`\]: `object`
|
|
634
|
+
|
|
635
|
+
###### relatedObjectsParentStateObjectsWatchRunning
|
|
636
|
+
|
|
637
|
+
> **relatedObjectsParentStateObjectsWatchRunning**: `boolean`
|
|
638
|
+
|
|
639
|
+
Flags whether the watch on parent state objects is currently active, ensuring updates trigger as needed.
|
|
640
|
+
|
|
641
|
+
###### relatedObjectsRules
|
|
642
|
+
|
|
643
|
+
> **relatedObjectsRules**: `object`
|
|
644
|
+
|
|
645
|
+
Defines the rules for establishing relationships, such as foreign key links and sorting orders.
|
|
646
|
+
|
|
647
|
+
###### Index Signature
|
|
648
|
+
|
|
649
|
+
\[`rule`: `string`\]: [`ListRelatedRule`](listRelated.md#listrelatedrule)
|
|
650
|
+
|
|
651
|
+
###### relatedObjectsWatchRunning
|
|
652
|
+
|
|
653
|
+
> **relatedObjectsWatchRunning**: `boolean`
|
|
654
|
+
|
|
655
|
+
Indicates if watches on the related objects themselves are active, managing updates efficiently.
|
|
656
|
+
|
|
657
|
+
###### relatedRunning
|
|
658
|
+
|
|
659
|
+
> **relatedRunning**: `boolean`
|
|
660
|
+
|
|
661
|
+
Signals whether any computations related to object relationships are currently in progress.
|
|
662
|
+
|
|
663
|
+
###### resultsWatchRunning
|
|
664
|
+
|
|
665
|
+
> **resultsWatchRunning**: `boolean`
|
|
666
|
+
|
|
667
|
+
Flag indicating if the results watch is active.
|
|
668
|
+
|
|
669
|
+
###### retrieveArgs
|
|
670
|
+
|
|
671
|
+
> **retrieveArgs**: `any`
|
|
672
|
+
|
|
673
|
+
Arguments passed to the server for retrieval operations.
|
|
674
|
+
|
|
675
|
+
###### running
|
|
676
|
+
|
|
677
|
+
> **running**: `boolean`
|
|
678
|
+
|
|
679
|
+
Indicates if there are ongoing reactive updates.
|
|
680
|
+
|
|
681
|
+
###### subscribed
|
|
682
|
+
|
|
683
|
+
> **subscribed**: `boolean`
|
|
684
|
+
|
|
685
|
+
Whether the subscription is active.
|
|
686
|
+
|
|
687
|
+
###### subscriptionError
|
|
688
|
+
|
|
689
|
+
> **subscriptionError**: `Error`
|
|
690
|
+
|
|
691
|
+
The error that occurred.
|
|
692
|
+
|
|
693
|
+
###### subscriptionErrored
|
|
694
|
+
|
|
695
|
+
> **subscriptionErrored**: `boolean`
|
|
696
|
+
|
|
697
|
+
Whether the subscription has errored.
|
|
698
|
+
|
|
699
|
+
###### subscriptionLoading
|
|
700
|
+
|
|
701
|
+
> **subscriptionLoading**: `boolean`
|
|
702
|
+
|
|
703
|
+
Whether the subscription is loading.
|
|
704
|
+
|
|
705
|
+
***
|
|
706
|
+
|
|
707
|
+
### ListFilterRawState
|
|
708
|
+
|
|
709
|
+
#### Properties
|
|
710
|
+
|
|
711
|
+
##### allowedFilter
|
|
712
|
+
|
|
713
|
+
> **allowedFilter**: `Function`
|
|
714
|
+
|
|
715
|
+
Function to determine if an item should be included based on custom logic.
|
|
716
|
+
|
|
717
|
+
##### excludedFilter
|
|
718
|
+
|
|
719
|
+
> **excludedFilter**: `Function`
|
|
720
|
+
|
|
721
|
+
Function to determine if an item should be excluded based on custom logic.
|
|
722
|
+
|
|
723
|
+
##### inResults
|
|
724
|
+
|
|
725
|
+
> **inResults**: `any`
|
|
726
|
+
|
|
727
|
+
A map of items to boolean values indicating filter results.
|
|
728
|
+
|
|
729
|
+
##### objectsWatchRunning
|
|
730
|
+
|
|
731
|
+
> **objectsWatchRunning**: `boolean`
|
|
732
|
+
|
|
733
|
+
Flag indicating if the object watch is active.
|
|
734
|
+
|
|
735
|
+
##### orderWatchRunning
|
|
736
|
+
|
|
737
|
+
> **orderWatchRunning**: `boolean`
|
|
738
|
+
|
|
739
|
+
Flag indicating if the order watch is active.
|
|
740
|
+
|
|
741
|
+
##### resultsWatchRunning
|
|
742
|
+
|
|
743
|
+
> **resultsWatchRunning**: `boolean`
|
|
744
|
+
|
|
745
|
+
Flag indicating if the results watch is active.
|
|
746
|
+
|
|
747
|
+
##### running
|
|
748
|
+
|
|
749
|
+
> **running**: `boolean`
|
|
750
|
+
|
|
751
|
+
Flag indicating if any part of the filter logic is currently processing.
|
|
752
|
+
|
|
753
|
+
## Type Aliases
|
|
754
|
+
|
|
755
|
+
### ListFilter
|
|
756
|
+
|
|
757
|
+
> **ListFilter**\<\>: [`ListFilterProperties`](listFilter.md#listfilterproperties)
|
|
758
|
+
|
|
759
|
+
#### Type Parameters
|
|
760
|
+
|
|
761
|
+
***
|
|
762
|
+
|
|
763
|
+
### ListFilterAllowedFilter
|
|
764
|
+
|
|
765
|
+
> **ListFilterAllowedFilter**\<\>: `Function`
|
|
766
|
+
|
|
767
|
+
A function that returns true if an item should be included.
|
|
768
|
+
|
|
769
|
+
#### Type Parameters
|
|
770
|
+
|
|
771
|
+
***
|
|
772
|
+
|
|
773
|
+
### ListFilterExcludedFilter
|
|
774
|
+
|
|
775
|
+
> **ListFilterExcludedFilter**\<\>: `Function`
|
|
776
|
+
|
|
777
|
+
A function that returns true if an item should be excluded.
|
|
778
|
+
|
|
779
|
+
#### Type Parameters
|
|
780
|
+
|
|
781
|
+
***
|
|
782
|
+
|
|
783
|
+
### ListFilterParentRawState
|
|
784
|
+
|
|
785
|
+
> **ListFilterParentRawState**\<\>: [`use/listInstance`](listInstance.md) & `Partial`\<[`use/listSubscription`](listSubscription.md)\> & `Partial`\<[`use/listRelated`](listRelated.md)\> & `Partial`\<[`use/listCalculated`](listCalculated.md)\>
|
|
786
|
+
|
|
787
|
+
#### Type Parameters
|
|
788
|
+
|
|
789
|
+
***
|
|
790
|
+
|
|
791
|
+
### ListFilterParentState
|
|
792
|
+
|
|
793
|
+
> **ListFilterParentState**\<\>: `UnwrapNestedRefs`
|
|
794
|
+
|
|
795
|
+
#### Type Parameters
|
|
796
|
+
|
|
797
|
+
***
|
|
798
|
+
|
|
799
|
+
### ListFilterState
|
|
800
|
+
|
|
801
|
+
> **ListFilterState**\<\>: `UnwrapNestedRefs`
|
|
802
|
+
|
|
803
|
+
#### Type Parameters
|
|
804
|
+
|
|
805
|
+
***
|
|
806
|
+
|
|
807
|
+
### ObjectsInOrderRefs
|
|
808
|
+
|
|
809
|
+
> **ObjectsInOrderRefs**\<\>: `Ref`[]
|
|
810
|
+
|
|
811
|
+
#### Type Parameters
|
|
812
|
+
|
|
813
|
+
## Functions
|
|
814
|
+
|
|
815
|
+
### useListFilter()
|
|
816
|
+
|
|
817
|
+
> **useListFilter**(`options`): [`ListFilterProperties`](listFilter.md#listfilterproperties)
|
|
818
|
+
|
|
819
|
+
Initializes and manages a list filter instance, setting up reactive states and dependencies
|
|
820
|
+
to dynamically adjust the visible items based on the provided filter functions.
|
|
821
|
+
|
|
822
|
+
#### Parameters
|
|
823
|
+
|
|
824
|
+
• **options**: [`ListFilterOptions`](listFilter.md#listfilteroptions)
|
|
825
|
+
|
|
826
|
+
The options for the list filter including filters and parent state.
|
|
827
|
+
|
|
828
|
+
#### Returns
|
|
829
|
+
|
|
830
|
+
[`ListFilterProperties`](listFilter.md#listfilterproperties)
|
|
831
|
+
|
|
832
|
+
A fully configured list filter instance, providing reactive filtered results.
|
|
833
|
+
|
|
834
|
+
#### Example
|
|
835
|
+
|
|
836
|
+
```vue
|
|
837
|
+
<script setup>
|
|
838
|
+
import { defineProps, reactive, toRef, computed } from 'vue';
|
|
839
|
+
import { useListInstance, useListFilter } from '@arrai-innovations/reactive-helpers';
|
|
840
|
+
|
|
841
|
+
const props = defineProps({
|
|
842
|
+
someListFilter: String
|
|
843
|
+
});
|
|
844
|
+
|
|
845
|
+
const listInstance = useListInstance({ props });
|
|
846
|
+
const filterConditions = reactive({
|
|
847
|
+
allowedFilter: (item) => item.isActive,
|
|
848
|
+
excludedFilter: (item) => !item.isValid
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
const listFilter = useListFilter({
|
|
852
|
+
parentState: listInstance.state,
|
|
853
|
+
...filterConditions
|
|
854
|
+
});
|
|
855
|
+
// listFilter.state.objectsInOrder now contains the reactive filtered items from listInstance.state.objectsInOrder
|
|
856
|
+
</script>
|
|
857
|
+
```
|
|
858
|
+
|
|
859
|
+
***
|
|
860
|
+
|
|
861
|
+
### useListFilters()
|
|
862
|
+
|
|
863
|
+
> **useListFilters**(`listFilterArgs`): `object`
|
|
864
|
+
|
|
865
|
+
Helper function to create multiple instances of list filters based on provided configurations.
|
|
866
|
+
|
|
867
|
+
#### Parameters
|
|
868
|
+
|
|
869
|
+
• **listFilterArgs**
|
|
870
|
+
|
|
871
|
+
Configuration for each filter instance.
|
|
872
|
+
|
|
873
|
+
#### Returns
|
|
874
|
+
|
|
875
|
+
`object`
|
|
876
|
+
|
|
877
|
+
An object containing instances of list filters.
|