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