@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.
Files changed (115) hide show
  1. package/.husky/pre-commit +0 -1
  2. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  3. package/.prettierignore +1 -0
  4. package/README.md +11 -10
  5. package/config/listCrud.js +32 -1
  6. package/config/objectCrud.js +47 -1
  7. package/docs/README.md +43 -0
  8. package/docs/config/listCrud.md +97 -0
  9. package/docs/config/objectCrud.md +123 -0
  10. package/docs/use/cancellableIntent.md +163 -0
  11. package/docs/use/combineClasses.md +52 -0
  12. package/docs/use/list.md +285 -0
  13. package/docs/use/listCalculated.md +773 -0
  14. package/docs/use/listFilter.md +877 -0
  15. package/docs/use/listInstance.md +483 -0
  16. package/docs/use/listKeys.md +91 -0
  17. package/docs/use/listRelated.md +685 -0
  18. package/docs/use/listSearch.md +889 -0
  19. package/docs/use/listSort.md +1144 -0
  20. package/docs/use/listSubscription.md +379 -0
  21. package/docs/use/loadingError.md +21 -0
  22. package/docs/use/object.md +437 -0
  23. package/docs/use/objectCalculated.md +606 -0
  24. package/docs/use/objectInstance.md +486 -0
  25. package/docs/use/objectRelated.md +588 -0
  26. package/docs/use/objectSubscription.md +459 -0
  27. package/docs/use/paginatedListInstance.md +147 -0
  28. package/docs/use/search.md +311 -0
  29. package/docs/use/watchesRunning.md +80 -0
  30. package/docs/utils/assignReactiveObject.md +351 -0
  31. package/docs/utils/classes.md +100 -0
  32. package/docs/utils/compact.md +57 -0
  33. package/docs/utils/deleteKey.md +53 -0
  34. package/docs/utils/flattenPaths.md +45 -0
  35. package/docs/utils/getFakeId.md +34 -0
  36. package/docs/utils/keyDiff.md +101 -0
  37. package/docs/utils/loadingCombine.md +28 -0
  38. package/docs/utils/proxyRunning.md +33 -0
  39. package/docs/utils/relatedCalculatedHelpers.md +75 -0
  40. package/docs/utils/set.md +139 -0
  41. package/docs/utils/transformWalk.md +33 -0
  42. package/docs/utils/watches.md +441 -0
  43. package/eslint.config.js +125 -0
  44. package/index.js +34 -3
  45. package/lint-staged.config.js +5 -1
  46. package/makeTypeDoc.sh +25 -0
  47. package/package.json +27 -19
  48. package/tests/unit/config/listCrud.spec.js +5 -0
  49. package/tests/unit/config/objectCrud.spec.js +5 -0
  50. package/tests/unit/crudPromise.js +22 -3
  51. package/tests/unit/mockOnUnmounted.js +1 -1
  52. package/tests/unit/use/cancellableIntent.spec.js +2 -0
  53. package/tests/unit/use/listCalculated.spec.js +4 -3
  54. package/tests/unit/use/listFilter.spec.js +11 -7
  55. package/tests/unit/use/listInstance.spec.js +32 -14
  56. package/tests/unit/use/listRelated.spec.js +3 -2
  57. package/tests/unit/use/listSearch.spec.js +9 -7
  58. package/tests/unit/use/listSort.spec.js +29 -22
  59. package/tests/unit/use/listSubscription.spec.js +11 -5
  60. package/tests/unit/use/objectInstance.spec.js +15 -2
  61. package/tests/unit/use/objectSubscription.spec.js +31 -16
  62. package/tests/unit/use/search.spec.js +2 -2
  63. package/tests/unit/utils/assignReactiveObject.spec.js +21 -13
  64. package/tests/unit/utils/classes.spec.js +7 -6
  65. package/tests/unit/utils/watches.spec.js +4 -4
  66. package/tsconfig.json +19 -0
  67. package/typedoc-local-plugins/customize-output.js +13 -0
  68. package/typedoc.json +12 -0
  69. package/use/cancellableIntent.js +73 -2
  70. package/use/combineClasses.js +41 -31
  71. package/use/list.js +139 -5
  72. package/use/listCalculated.js +175 -10
  73. package/use/listFilter.js +175 -21
  74. package/use/listInstance.js +215 -94
  75. package/use/listRelated.js +260 -72
  76. package/use/listSearch.js +178 -57
  77. package/use/listSort.js +188 -21
  78. package/use/listSubscription.js +211 -63
  79. package/use/loadingError.js +43 -0
  80. package/use/object.js +187 -23
  81. package/use/objectCalculated.js +168 -16
  82. package/use/objectInstance.js +183 -102
  83. package/use/objectRelated.js +276 -84
  84. package/use/objectSubscription.js +169 -17
  85. package/use/paginatedListInstance.js +30 -1
  86. package/use/search.js +39 -23
  87. package/use/watchesRunning.js +41 -6
  88. package/utils/assignReactiveObject.js +139 -88
  89. package/utils/classes.js +57 -48
  90. package/utils/compact.js +28 -2
  91. package/utils/deleteKey.js +14 -1
  92. package/utils/flattenPaths.js +19 -9
  93. package/utils/getFakeId.js +11 -1
  94. package/utils/keyDiff.js +26 -35
  95. package/utils/loadingCombine.js +7 -4
  96. package/utils/proxyRunning.js +16 -8
  97. package/utils/relatedCalculatedHelpers.js +17 -0
  98. package/utils/set.js +66 -0
  99. package/utils/transformWalk.js +7 -6
  100. package/utils/watches.js +205 -71
  101. package/.eslintignore +0 -2
  102. package/.eslintrc.cjs +0 -25
  103. package/.jsdoc2md.json +0 -4
  104. package/config/index.js +0 -2
  105. package/docs.md +0 -1002
  106. package/jsdoc-to-markdown.sh +0 -16
  107. package/tests/unit/.eslintrc.cjs +0 -11
  108. package/tests/unit/config/index.spec.js +0 -18
  109. package/tests/unit/use/index.spec.js +0 -18
  110. package/tests/unit/utils/index.spec.js +0 -18
  111. package/use/index.js +0 -19
  112. package/utils/debugMessage.js +0 -209
  113. package/utils/debugWatch.js +0 -29
  114. package/utils/index.js +0 -16
  115. package/utils/lifecycleDebug.js +0 -126
@@ -0,0 +1,1144 @@
1
+ [**@arrai-innovations/reactive-helpers**](../README.md) • **Docs**
2
+
3
+ ***
4
+
5
+ [@arrai-innovations/reactive-helpers](../README.md) / use/listSort
6
+
7
+ # use/listSort
8
+
9
+ ## Interfaces
10
+
11
+ ### ListSortOptions
12
+
13
+ #### Properties
14
+
15
+ ##### orderByRules
16
+
17
+ > **orderByRules**: [`OrderByRule`](listSort.md#orderbyrule)[] \| `Ref`\<[`OrderByRule`](listSort.md#orderbyrule)[]\>
18
+
19
+ Rules defining how the list should be sorted, including key and direction.
20
+
21
+ ##### parentState
22
+
23
+ > **parentState**: `object`
24
+
25
+ The parent state containing the list data and any associated state needed for sorting.
26
+
27
+ ###### allowedFilter
28
+
29
+ > **allowedFilter**: `Function`
30
+
31
+ Function to determine if an item should be included based on custom logic.
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
+ ###### customDocumentOptions
90
+
91
+ > **customDocumentOptions**: `any`
92
+
93
+ Configuration options for the search document, used by FlexSearch.
94
+
95
+ ###### customSearchOptions
96
+
97
+ > **customSearchOptions**: `any`
98
+
99
+ Additional search options for FlexSearch.
100
+
101
+ ###### error
102
+
103
+ > **error**: `Error`
104
+
105
+ The last error encountered.
106
+
107
+ ###### errored
108
+
109
+ > **errored**: `boolean`
110
+
111
+ Indicates if an error occurred during the last operation.
112
+
113
+ ###### excludedFilter
114
+
115
+ > **excludedFilter**: `Function`
116
+
117
+ Function to determine if an item should be excluded based on custom logic.
118
+
119
+ ###### fkForIdAndRule
120
+
121
+ > **fkForIdAndRule**: `object`
122
+
123
+ Maintains computed references to the foreign keys for each object ID and rule, crucial for navigating complex data relationships.
124
+
125
+ ###### Index Signature
126
+
127
+ \[`id`: `string`\]: `object`
128
+
129
+ ###### inResults
130
+
131
+ > **inResults**: `any`
132
+
133
+ A map of items to boolean values indicating filter results.
134
+
135
+ ###### intendToList
136
+
137
+ > **intendToList**: `boolean`
138
+
139
+ If this is true, the list should be fetched, or re-fetched if arguments change.
140
+
141
+ ###### intendToSubscribe
142
+
143
+ > **intendToSubscribe**: `boolean`
144
+
145
+ If this is true, the subscription should start or restart if arguments change.
146
+
147
+ ###### listArgs
148
+
149
+ > **listArgs**: `any`
150
+
151
+ Arguments passed to the server for listing operations.
152
+
153
+ ###### loading
154
+
155
+ > **loading**: `boolean`
156
+
157
+ Indicates if the list is currently loading.
158
+
159
+ ###### objAndKeyForIdAndRule
160
+
161
+ > **objAndKeyForIdAndRule**: `object`
162
+
163
+ Maps each object ID and rule to a tuple consisting of the related object and its respective key, facilitating direct data manipulation.
164
+
165
+ ###### Index Signature
166
+
167
+ \[`id`: `string`\]: `object`
168
+
169
+ ###### objectIndexes
170
+
171
+ > **objectIndexes**: `any`
172
+
173
+ Indexes built for quick search across objects based on rules.
174
+
175
+ ###### objects
176
+
177
+ > **objects**: [`ObjectsById`](listInstance.md#objectsbyid)
178
+
179
+ The list objects stored by their IDs.
180
+
181
+ ###### objectsInOrder
182
+
183
+ > **objectsInOrder**: [`ListObject`](listInstance.md#listobject)[]
184
+
185
+ The objects in the order specified by the list.
186
+
187
+ ###### objectsWatchRunning
188
+
189
+ > **objectsWatchRunning**: `boolean`
190
+
191
+ Flag indicating if the object watch is active.
192
+
193
+ ###### order
194
+
195
+ > **order**: `string`[]
196
+
197
+ The order of objects in the list.
198
+
199
+ ###### orderWatchRunning
200
+
201
+ > **orderWatchRunning**: `boolean`
202
+
203
+ Flag indicating if the order watch is active.
204
+
205
+ ###### relatedObjects
206
+
207
+ > **relatedObjects**: `object`
208
+
209
+ Stores computed references to related objects, allowing for dynamic access based on object ID and specific rules.
210
+
211
+ ###### Index Signature
212
+
213
+ \[`id`: `string`\]: `object`
214
+
215
+ ###### relatedObjectsParentStateObjectsWatchRunning
216
+
217
+ > **relatedObjectsParentStateObjectsWatchRunning**: `boolean`
218
+
219
+ Flags whether the watch on parent state objects is currently active, ensuring updates trigger as needed.
220
+
221
+ ###### relatedObjectsRules
222
+
223
+ > **relatedObjectsRules**: `object`
224
+
225
+ Defines the rules for establishing relationships, such as foreign key links and sorting orders.
226
+
227
+ ###### Index Signature
228
+
229
+ \[`rule`: `string`\]: [`ListRelatedRule`](listRelated.md#listrelatedrule)
230
+
231
+ ###### relatedObjectsWatchRunning
232
+
233
+ > **relatedObjectsWatchRunning**: `boolean`
234
+
235
+ Indicates if watches on the related objects themselves are active, managing updates efficiently.
236
+
237
+ ###### relatedRunning
238
+
239
+ > **relatedRunning**: `boolean`
240
+
241
+ Signals whether any computations related to object relationships are currently in progress.
242
+
243
+ ###### resultsWatchRunning
244
+
245
+ > **resultsWatchRunning**: `boolean`
246
+
247
+ Flag indicating if the results watch is active.
248
+
249
+ ###### retrieveArgs
250
+
251
+ > **retrieveArgs**: `any`
252
+
253
+ Arguments passed to the server for retrieval operations.
254
+
255
+ ###### running
256
+
257
+ > **running**: `boolean`
258
+
259
+ Indicates if there are ongoing reactive updates.
260
+
261
+ ###### searched
262
+
263
+ > **searched**: `boolean`
264
+
265
+ Flag indicating if a search has been performed.
266
+
267
+ ###### subscribed
268
+
269
+ > **subscribed**: `boolean`
270
+
271
+ Whether the subscription is active.
272
+
273
+ ###### subscriptionError
274
+
275
+ > **subscriptionError**: `Error`
276
+
277
+ The error that occurred.
278
+
279
+ ###### subscriptionErrored
280
+
281
+ > **subscriptionErrored**: `boolean`
282
+
283
+ Whether the subscription has errored.
284
+
285
+ ###### subscriptionLoading
286
+
287
+ > **subscriptionLoading**: `boolean`
288
+
289
+ Whether the subscription is loading.
290
+
291
+ ###### textSearchRules
292
+
293
+ > **textSearchRules**: `any`
294
+
295
+ Rules defining how text search should be applied on list items. Each rule
296
+ specifies a key and a function to extract the searchable text.
297
+
298
+ ###### textSearchValue
299
+
300
+ > **textSearchValue**: `string`
301
+
302
+ The current value used for searching.
303
+
304
+ ##### sortThrottleWait
305
+
306
+ > **sortThrottleWait**: `number` \| `symbol`
307
+
308
+ Optional throttle wait time to limit the frequency of sort operations, enhancing performance.
309
+
310
+ ***
311
+
312
+ ### ListSortProperties
313
+
314
+ #### Properties
315
+
316
+ ##### effectScope
317
+
318
+ > **effectScope**: `EffectScope`
319
+
320
+ The effect scope for the list sort.
321
+
322
+ ##### parentState
323
+
324
+ > **parentState**: `object`
325
+
326
+ The parent state.
327
+
328
+ ###### allowedFilter
329
+
330
+ > **allowedFilter**: `Function`
331
+
332
+ Function to determine if an item should be included based on custom logic.
333
+
334
+ ###### calculatedObjects
335
+
336
+ > **calculatedObjects**: `object`
337
+
338
+ The calculated objects.
339
+
340
+ ###### Index Signature
341
+
342
+ \[`id`: `string`\]: `object`
343
+
344
+ ###### calculatedObjectsParentStateObjectsWatchRunning
345
+
346
+ > **calculatedObjectsParentStateObjectsWatchRunning**: `boolean`
347
+
348
+ Whether the parent state objects watch is running.
349
+
350
+ ###### calculatedObjectsRules
351
+
352
+ > **calculatedObjectsRules**: `object`
353
+
354
+ The rules for the calculated objects.
355
+
356
+ ###### Index Signature
357
+
358
+ \[`rule`: `string`\]: (`object`, `relatedObject`, `calculatedObjects`) => `any`
359
+
360
+ ###### calculatedObjectsWatchRunning
361
+
362
+ > **calculatedObjectsWatchRunning**: `boolean`
363
+
364
+ Whether the calculated objects watch is running.
365
+
366
+ ###### calculatedRunning
367
+
368
+ > **calculatedRunning**: `boolean`
369
+
370
+ Whether the calculated properties are running.
371
+
372
+ ###### crud
373
+
374
+ > **crud**: `object`
375
+
376
+ CRUD functions and their configurations for the list.
377
+
378
+ ###### crud.args
379
+
380
+ > **args**: `any`
381
+
382
+ Arguments for the CRUD functions.
383
+
384
+ ###### crud.list
385
+
386
+ > **list**: `Function`
387
+
388
+ Function to list objects.
389
+
390
+ ###### customDocumentOptions
391
+
392
+ > **customDocumentOptions**: `any`
393
+
394
+ Configuration options for the search document, used by FlexSearch.
395
+
396
+ ###### customSearchOptions
397
+
398
+ > **customSearchOptions**: `any`
399
+
400
+ Additional search options for FlexSearch.
401
+
402
+ ###### error
403
+
404
+ > **error**: `Error`
405
+
406
+ The last error encountered.
407
+
408
+ ###### errored
409
+
410
+ > **errored**: `boolean`
411
+
412
+ Indicates if an error occurred during the last operation.
413
+
414
+ ###### excludedFilter
415
+
416
+ > **excludedFilter**: `Function`
417
+
418
+ Function to determine if an item should be excluded based on custom logic.
419
+
420
+ ###### fkForIdAndRule
421
+
422
+ > **fkForIdAndRule**: `object`
423
+
424
+ Maintains computed references to the foreign keys for each object ID and rule, crucial for navigating complex data relationships.
425
+
426
+ ###### Index Signature
427
+
428
+ \[`id`: `string`\]: `object`
429
+
430
+ ###### inResults
431
+
432
+ > **inResults**: `any`
433
+
434
+ A map of items to boolean values indicating filter results.
435
+
436
+ ###### intendToList
437
+
438
+ > **intendToList**: `boolean`
439
+
440
+ If this is true, the list should be fetched, or re-fetched if arguments change.
441
+
442
+ ###### intendToSubscribe
443
+
444
+ > **intendToSubscribe**: `boolean`
445
+
446
+ If this is true, the subscription should start or restart if arguments change.
447
+
448
+ ###### listArgs
449
+
450
+ > **listArgs**: `any`
451
+
452
+ Arguments passed to the server for listing operations.
453
+
454
+ ###### loading
455
+
456
+ > **loading**: `boolean`
457
+
458
+ Indicates if the list is currently loading.
459
+
460
+ ###### objAndKeyForIdAndRule
461
+
462
+ > **objAndKeyForIdAndRule**: `object`
463
+
464
+ Maps each object ID and rule to a tuple consisting of the related object and its respective key, facilitating direct data manipulation.
465
+
466
+ ###### Index Signature
467
+
468
+ \[`id`: `string`\]: `object`
469
+
470
+ ###### objectIndexes
471
+
472
+ > **objectIndexes**: `any`
473
+
474
+ Indexes built for quick search across objects based on rules.
475
+
476
+ ###### objects
477
+
478
+ > **objects**: [`ObjectsById`](listInstance.md#objectsbyid)
479
+
480
+ The list objects stored by their IDs.
481
+
482
+ ###### objectsInOrder
483
+
484
+ > **objectsInOrder**: [`ListObject`](listInstance.md#listobject)[]
485
+
486
+ The objects in the order specified by the list.
487
+
488
+ ###### objectsWatchRunning
489
+
490
+ > **objectsWatchRunning**: `boolean`
491
+
492
+ Flag indicating if the object watch is active.
493
+
494
+ ###### order
495
+
496
+ > **order**: `string`[]
497
+
498
+ The order of objects in the list.
499
+
500
+ ###### orderWatchRunning
501
+
502
+ > **orderWatchRunning**: `boolean`
503
+
504
+ Flag indicating if the order watch is active.
505
+
506
+ ###### relatedObjects
507
+
508
+ > **relatedObjects**: `object`
509
+
510
+ Stores computed references to related objects, allowing for dynamic access based on object ID and specific rules.
511
+
512
+ ###### Index Signature
513
+
514
+ \[`id`: `string`\]: `object`
515
+
516
+ ###### relatedObjectsParentStateObjectsWatchRunning
517
+
518
+ > **relatedObjectsParentStateObjectsWatchRunning**: `boolean`
519
+
520
+ Flags whether the watch on parent state objects is currently active, ensuring updates trigger as needed.
521
+
522
+ ###### relatedObjectsRules
523
+
524
+ > **relatedObjectsRules**: `object`
525
+
526
+ Defines the rules for establishing relationships, such as foreign key links and sorting orders.
527
+
528
+ ###### Index Signature
529
+
530
+ \[`rule`: `string`\]: [`ListRelatedRule`](listRelated.md#listrelatedrule)
531
+
532
+ ###### relatedObjectsWatchRunning
533
+
534
+ > **relatedObjectsWatchRunning**: `boolean`
535
+
536
+ Indicates if watches on the related objects themselves are active, managing updates efficiently.
537
+
538
+ ###### relatedRunning
539
+
540
+ > **relatedRunning**: `boolean`
541
+
542
+ Signals whether any computations related to object relationships are currently in progress.
543
+
544
+ ###### resultsWatchRunning
545
+
546
+ > **resultsWatchRunning**: `boolean`
547
+
548
+ Flag indicating if the results watch is active.
549
+
550
+ ###### retrieveArgs
551
+
552
+ > **retrieveArgs**: `any`
553
+
554
+ Arguments passed to the server for retrieval operations.
555
+
556
+ ###### running
557
+
558
+ > **running**: `boolean`
559
+
560
+ Indicates if there are ongoing reactive updates.
561
+
562
+ ###### searched
563
+
564
+ > **searched**: `boolean`
565
+
566
+ Flag indicating if a search has been performed.
567
+
568
+ ###### subscribed
569
+
570
+ > **subscribed**: `boolean`
571
+
572
+ Whether the subscription is active.
573
+
574
+ ###### subscriptionError
575
+
576
+ > **subscriptionError**: `Error`
577
+
578
+ The error that occurred.
579
+
580
+ ###### subscriptionErrored
581
+
582
+ > **subscriptionErrored**: `boolean`
583
+
584
+ Whether the subscription has errored.
585
+
586
+ ###### subscriptionLoading
587
+
588
+ > **subscriptionLoading**: `boolean`
589
+
590
+ Whether the subscription is loading.
591
+
592
+ ###### textSearchRules
593
+
594
+ > **textSearchRules**: `any`
595
+
596
+ Rules defining how text search should be applied on list items. Each rule
597
+ specifies a key and a function to extract the searchable text.
598
+
599
+ ###### textSearchValue
600
+
601
+ > **textSearchValue**: `string`
602
+
603
+ The current value used for searching.
604
+
605
+ ##### state
606
+
607
+ > **state**: `object`
608
+
609
+ The reactive state for the list sort.
610
+
611
+ ###### allowedFilter
612
+
613
+ > **allowedFilter**: `Function`
614
+
615
+ Function to determine if an item should be included based on custom logic.
616
+
617
+ ###### calculatedObjects
618
+
619
+ > **calculatedObjects**: `object`
620
+
621
+ The calculated objects.
622
+
623
+ ###### Index Signature
624
+
625
+ \[`id`: `string`\]: `object`
626
+
627
+ ###### calculatedObjectsParentStateObjectsWatchRunning
628
+
629
+ > **calculatedObjectsParentStateObjectsWatchRunning**: `boolean`
630
+
631
+ Whether the parent state objects watch is running.
632
+
633
+ ###### calculatedObjectsRules
634
+
635
+ > **calculatedObjectsRules**: `object`
636
+
637
+ The rules for the calculated objects.
638
+
639
+ ###### Index Signature
640
+
641
+ \[`rule`: `string`\]: (`object`, `relatedObject`, `calculatedObjects`) => `any`
642
+
643
+ ###### calculatedObjectsWatchRunning
644
+
645
+ > **calculatedObjectsWatchRunning**: `boolean`
646
+
647
+ Whether the calculated objects watch is running.
648
+
649
+ ###### calculatedRunning
650
+
651
+ > **calculatedRunning**: `boolean`
652
+
653
+ Whether the calculated properties are running.
654
+
655
+ ###### crud
656
+
657
+ > **crud**: `object`
658
+
659
+ CRUD functions and their configurations for the list.
660
+
661
+ ###### crud.args
662
+
663
+ > **args**: `any`
664
+
665
+ Arguments for the CRUD functions.
666
+
667
+ ###### crud.list
668
+
669
+ > **list**: `Function`
670
+
671
+ Function to list objects.
672
+
673
+ ###### customDocumentOptions
674
+
675
+ > **customDocumentOptions**: `any`
676
+
677
+ Configuration options for the search document, used by FlexSearch.
678
+
679
+ ###### customSearchOptions
680
+
681
+ > **customSearchOptions**: `any`
682
+
683
+ Additional search options for FlexSearch.
684
+
685
+ ###### error
686
+
687
+ > **error**: `Error`
688
+
689
+ The last error encountered.
690
+
691
+ ###### errored
692
+
693
+ > **errored**: `boolean`
694
+
695
+ Indicates if an error occurred during the last operation.
696
+
697
+ ###### excludedFilter
698
+
699
+ > **excludedFilter**: `Function`
700
+
701
+ Function to determine if an item should be excluded based on custom logic.
702
+
703
+ ###### fkForIdAndRule
704
+
705
+ > **fkForIdAndRule**: `object`
706
+
707
+ Maintains computed references to the foreign keys for each object ID and rule, crucial for navigating complex data relationships.
708
+
709
+ ###### Index Signature
710
+
711
+ \[`id`: `string`\]: `object`
712
+
713
+ ###### inResults
714
+
715
+ > **inResults**: `any`
716
+
717
+ A map of items to boolean values indicating filter results.
718
+
719
+ ###### intendToList
720
+
721
+ > **intendToList**: `boolean`
722
+
723
+ If this is true, the list should be fetched, or re-fetched if arguments change.
724
+
725
+ ###### intendToSubscribe
726
+
727
+ > **intendToSubscribe**: `boolean`
728
+
729
+ If this is true, the subscription should start or restart if arguments change.
730
+
731
+ ###### listArgs
732
+
733
+ > **listArgs**: `any`
734
+
735
+ Arguments passed to the server for listing operations.
736
+
737
+ ###### loading
738
+
739
+ > **loading**: `boolean`
740
+
741
+ Indicates if the list is currently loading.
742
+
743
+ ###### objAndKeyForIdAndRule
744
+
745
+ > **objAndKeyForIdAndRule**: `object`
746
+
747
+ Maps each object ID and rule to a tuple consisting of the related object and its respective key, facilitating direct data manipulation.
748
+
749
+ ###### Index Signature
750
+
751
+ \[`id`: `string`\]: `object`
752
+
753
+ ###### objectIndexes
754
+
755
+ > **objectIndexes**: `any`
756
+
757
+ Indexes built for quick search across objects based on rules.
758
+
759
+ ###### objects
760
+
761
+ > **objects**: [`ObjectsById`](listInstance.md#objectsbyid)
762
+
763
+ The list objects stored by their IDs.
764
+
765
+ ###### objectsInOrder
766
+
767
+ > **objectsInOrder**: [`ListObject`](listInstance.md#listobject)[]
768
+
769
+ The objects in the order specified by the list.
770
+
771
+ ###### objectsWatchRunning
772
+
773
+ > **objectsWatchRunning**: `boolean`
774
+
775
+ Flag indicating if the object watch is active.
776
+
777
+ ###### order
778
+
779
+ > **order**: `string`[]
780
+
781
+ The order of objects in the list.
782
+
783
+ ###### orderByDesc
784
+
785
+ > **orderByDesc**: `boolean`[]
786
+
787
+ Flags indicating whether each sort criterion is in descending order.
788
+
789
+ ###### orderByRules
790
+
791
+ > **orderByRules**: `object`[]
792
+
793
+ Current sorting rules applied to the list.
794
+
795
+ ###### orderWatchRunning
796
+
797
+ > **orderWatchRunning**: `boolean`
798
+
799
+ Flag indicating if the order watch is active.
800
+
801
+ ###### outstandingEffects
802
+
803
+ > **outstandingEffects**: `boolean`
804
+
805
+ Flag to indicate if there are pending reactive effects needing resolution.
806
+
807
+ ###### relatedObjects
808
+
809
+ > **relatedObjects**: `object`
810
+
811
+ Stores computed references to related objects, allowing for dynamic access based on object ID and specific rules.
812
+
813
+ ###### Index Signature
814
+
815
+ \[`id`: `string`\]: `object`
816
+
817
+ ###### relatedObjectsParentStateObjectsWatchRunning
818
+
819
+ > **relatedObjectsParentStateObjectsWatchRunning**: `boolean`
820
+
821
+ Flags whether the watch on parent state objects is currently active, ensuring updates trigger as needed.
822
+
823
+ ###### relatedObjectsRules
824
+
825
+ > **relatedObjectsRules**: `object`
826
+
827
+ Defines the rules for establishing relationships, such as foreign key links and sorting orders.
828
+
829
+ ###### Index Signature
830
+
831
+ \[`rule`: `string`\]: [`ListRelatedRule`](listRelated.md#listrelatedrule)
832
+
833
+ ###### relatedObjectsWatchRunning
834
+
835
+ > **relatedObjectsWatchRunning**: `boolean`
836
+
837
+ Indicates if watches on the related objects themselves are active, managing updates efficiently.
838
+
839
+ ###### relatedRunning
840
+
841
+ > **relatedRunning**: `boolean`
842
+
843
+ Signals whether any computations related to object relationships are currently in progress.
844
+
845
+ ###### resultsWatchRunning
846
+
847
+ > **resultsWatchRunning**: `boolean`
848
+
849
+ Flag indicating if the results watch is active.
850
+
851
+ ###### retrieveArgs
852
+
853
+ > **retrieveArgs**: `any`
854
+
855
+ Arguments passed to the server for retrieval operations.
856
+
857
+ ###### running
858
+
859
+ > **running**: `boolean`
860
+
861
+ Indicates if there are ongoing reactive updates.
862
+
863
+ ###### searched
864
+
865
+ > **searched**: `boolean`
866
+
867
+ Flag indicating if a search has been performed.
868
+
869
+ ###### sortCriteria
870
+
871
+ > **sortCriteria**: `any`
872
+
873
+ Computed sort criteria used for dynamically sorting the list.
874
+
875
+ ###### sortCriteriaWatchRunning
876
+
877
+ > **sortCriteriaWatchRunning**: `boolean`
878
+
879
+ Flag to indicate if sorting criteria computations are actively updating.
880
+
881
+ ###### sortWatchRunning
882
+
883
+ > **sortWatchRunning**: `boolean`
884
+
885
+ Flag to indicate if the sort operation is actively processing.
886
+
887
+ ###### subscribed
888
+
889
+ > **subscribed**: `boolean`
890
+
891
+ Whether the subscription is active.
892
+
893
+ ###### subscriptionError
894
+
895
+ > **subscriptionError**: `Error`
896
+
897
+ The error that occurred.
898
+
899
+ ###### subscriptionErrored
900
+
901
+ > **subscriptionErrored**: `boolean`
902
+
903
+ Whether the subscription has errored.
904
+
905
+ ###### subscriptionLoading
906
+
907
+ > **subscriptionLoading**: `boolean`
908
+
909
+ Whether the subscription is loading.
910
+
911
+ ###### textSearchRules
912
+
913
+ > **textSearchRules**: `any`
914
+
915
+ Rules defining how text search should be applied on list items. Each rule
916
+ specifies a key and a function to extract the searchable text.
917
+
918
+ ###### textSearchValue
919
+
920
+ > **textSearchValue**: `string`
921
+
922
+ The current value used for searching.
923
+
924
+ ##### watchesRunning
925
+
926
+ > **watchesRunning**: [`WatchesRunning`](watchesRunning.md#watchesrunning)
927
+
928
+ The watches running instance.
929
+
930
+ ***
931
+
932
+ ### ListSortRawState
933
+
934
+ #### Properties
935
+
936
+ ##### order
937
+
938
+ > **order**: `string`[]
939
+
940
+ Array of IDs representing the current sort order of the list.
941
+
942
+ ##### orderByDesc
943
+
944
+ > **orderByDesc**: `boolean`[]
945
+
946
+ Flags indicating whether each sort criterion is in descending order.
947
+
948
+ ##### orderByRules
949
+
950
+ > **orderByRules**: [`OrderByRule`](listSort.md#orderbyrule)[]
951
+
952
+ Current sorting rules applied to the list.
953
+
954
+ ##### outstandingEffects
955
+
956
+ > **outstandingEffects**: `boolean`
957
+
958
+ Flag to indicate if there are pending reactive effects needing resolution.
959
+
960
+ ##### sortCriteria
961
+
962
+ > **sortCriteria**: `any`
963
+
964
+ Computed sort criteria used for dynamically sorting the list.
965
+
966
+ ##### sortCriteriaWatchRunning
967
+
968
+ > **sortCriteriaWatchRunning**: `boolean`
969
+
970
+ Flag to indicate if sorting criteria computations are actively updating.
971
+
972
+ ##### sortWatchRunning
973
+
974
+ > **sortWatchRunning**: `boolean`
975
+
976
+ Flag to indicate if the sort operation is actively processing.
977
+
978
+ ## Type Aliases
979
+
980
+ ### ListSort
981
+
982
+ > **ListSort**\<\>: [`ListSortProperties`](listSort.md#listsortproperties)
983
+
984
+ #### Type Parameters
985
+
986
+ ***
987
+
988
+ ### ListSortParentRawState
989
+
990
+ > **ListSortParentRawState**\<\>: [`use/listInstance`](listInstance.md) & `Partial`\<[`use/listSubscription`](listSubscription.md)\> & `Partial`\<[`use/listRelated`](listRelated.md)\> & `Partial`\<[`use/listCalculated`](listCalculated.md)\> & `Partial`\<[`use/listFilter`](listFilter.md)\> & `Partial`\<[`use/listSearch`](listSearch.md)\>
991
+
992
+ #### Type Parameters
993
+
994
+ ***
995
+
996
+ ### ListSortParentState
997
+
998
+ > **ListSortParentState**\<\>: `UnwrapNestedRefs`
999
+
1000
+ #### Type Parameters
1001
+
1002
+ ***
1003
+
1004
+ ### ListSortState
1005
+
1006
+ > **ListSortState**\<\>: `UnwrapNestedRefs`
1007
+
1008
+ #### Type Parameters
1009
+
1010
+ ***
1011
+
1012
+ ### OrderByRule
1013
+
1014
+ > **OrderByRule**\<\>: `object`
1015
+
1016
+ #### Type Parameters
1017
+
1018
+ #### Type declaration
1019
+
1020
+ ##### desc?
1021
+
1022
+ > `optional` **desc**: `boolean`
1023
+
1024
+ ##### key
1025
+
1026
+ > **key**: `string`
1027
+
1028
+ ##### keyFn()?
1029
+
1030
+ > `optional` **keyFn**: (`object`, `state`) => `any`
1031
+
1032
+ ###### Parameters
1033
+
1034
+ • **object**: `any`
1035
+
1036
+ • **state**: [`ListSortState`](listSort.md#listsortstate)
1037
+
1038
+ ###### Returns
1039
+
1040
+ `any`
1041
+
1042
+ ##### localeCompare?
1043
+
1044
+ > `optional` **localeCompare**: `boolean`
1045
+
1046
+ ## Functions
1047
+
1048
+ ### setListSortDefaultOptions()
1049
+
1050
+ > **setListSortDefaultOptions**(`options`): `void`
1051
+
1052
+ Sets default configuration options for all list sorting operations within the application. This function allows
1053
+ global settings to be specified that affect the behavior of sorting operations unless overridden by specific
1054
+ instance configurations.
1055
+
1056
+ #### Parameters
1057
+
1058
+ • **options**
1059
+
1060
+ Configuration options to set as defaults for list sorting.
1061
+
1062
+ • **options.sortThrottleWait**: `number`
1063
+
1064
+ Default throttle wait time, in milliseconds, to control the rate at
1065
+ which sorting operations are processed, enhancing performance on large lists.
1066
+
1067
+ #### Returns
1068
+
1069
+ `void`
1070
+
1071
+ ***
1072
+
1073
+ ### useListSort()
1074
+
1075
+ > **useListSort**(`options`): [`ListSortProperties`](listSort.md#listsortproperties)
1076
+
1077
+ Initializes and manages sorting for a list of objects. This function sets up a reactive sorting mechanism
1078
+ that automatically updates the sort order of the list based on specified criteria. It supports multiple sorting
1079
+ rules, including direct property comparison and custom comparator functions, providing flexibility in handling
1080
+ various data types and structures.
1081
+
1082
+ #### Parameters
1083
+
1084
+ • **options**: [`ListSortOptions`](listSort.md#listsortoptions)
1085
+
1086
+ The configuration options for initializing the list sort instance.
1087
+
1088
+ #### Returns
1089
+
1090
+ [`ListSortProperties`](listSort.md#listsortproperties)
1091
+
1092
+ The initialized list sort instance, including reactive state and utilities to manage list sorting.
1093
+
1094
+ #### Example
1095
+
1096
+ ```vue
1097
+ <script setup>
1098
+ import { reactive, computed } from 'vue';
1099
+ import { useListSort, useListInstance } from '@arrai-innovations/reactive-helpers';
1100
+ const listInstanceProps = reactive({
1101
+ crudArgs: {},
1102
+ listArgs: {},
1103
+ retrieveArgs: {},
1104
+ intendToList: true,
1105
+ });
1106
+ const listInstance = useListInstance(listInstanceProps);
1107
+ const listSortProps = reactive({
1108
+ parentState: listInstance.state, // Providing the list instance state as the parent state
1109
+ orderByRules: [
1110
+ { key: 'name', desc: false }, // Sort by name in ascending order
1111
+ { key: 'age', desc: true }, // Sort by age in descending order
1112
+ { key: 'relatedItem.name', desc: false }, // Sort by a related item's name
1113
+ { key: 'calculatedItem.value', desc: true }, // Sort by a calculated value in descending order
1114
+ ],
1115
+ });
1116
+ const listSort = useListSort(listSortProps);
1117
+ </script>
1118
+ <template>
1119
+ <!-- reactive list of items sorted client-side -->
1120
+ <div v-for="item in listSort.state.objectsInOrder" :key="item.id">
1121
+ {{ item.name }}
1122
+ </div>
1123
+ </template>
1124
+ ```
1125
+
1126
+ ***
1127
+
1128
+ ### useListSorts()
1129
+
1130
+ > **useListSorts**(`listSortArgs`): `object`
1131
+
1132
+ Creates multiple list sort instances.
1133
+
1134
+ #### Parameters
1135
+
1136
+ • **listSortArgs**
1137
+
1138
+ The options for the list sort.
1139
+
1140
+ #### Returns
1141
+
1142
+ `object`
1143
+
1144
+ The list sort instance.