@arrai-innovations/reactive-helpers 20.1.2 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/README.md +22 -893
  2. package/config/listCrud.js +30 -27
  3. package/config/objectCrud.js +20 -13
  4. package/index.js +5 -3
  5. package/package.json +5 -3
  6. package/types/config/commonCrud.d.ts +0 -1
  7. package/types/config/listCrud.d.ts +28 -41
  8. package/types/config/objectCrud.d.ts +14 -29
  9. package/types/index.d.ts +5 -4
  10. package/types/tests/unit/config/listCrud.spec.d.ts +0 -1
  11. package/types/tests/unit/config/objectCrud.spec.d.ts +0 -1
  12. package/types/tests/unit/crudPromise.d.ts +42 -15
  13. package/types/tests/unit/mockOnUnmounted.d.ts +0 -1
  14. package/types/tests/unit/poll.d.ts +0 -1
  15. package/types/tests/unit/scopedIt.d.ts +15 -0
  16. package/types/tests/unit/setup.d.ts +2 -0
  17. package/types/tests/unit/use/cancellableIntent.spec.d.ts +0 -1
  18. package/types/tests/unit/use/combineClasses.spec.d.ts +1 -0
  19. package/types/tests/unit/use/list.spec.d.ts +1 -0
  20. package/types/tests/unit/use/listCalculated.spec.d.ts +0 -1
  21. package/types/tests/unit/use/listFilter.spec.d.ts +0 -1
  22. package/types/tests/unit/use/listInstance.spec.d.ts +0 -1
  23. package/types/tests/unit/use/listRelated.spec.d.ts +0 -1
  24. package/types/tests/unit/use/listSearch.spec.d.ts +0 -1
  25. package/types/tests/unit/use/listSort.spec.d.ts +0 -1
  26. package/types/tests/unit/use/listSubscription.spec.d.ts +0 -1
  27. package/types/tests/unit/use/loadingError.spec.d.ts +0 -1
  28. package/types/tests/unit/use/object.spec.d.ts +1 -0
  29. package/types/tests/unit/use/objectCalculated.spec.d.ts +1 -0
  30. package/types/tests/unit/use/objectInstance.spec.d.ts +0 -1
  31. package/types/tests/unit/use/objectRelated.spec.d.ts +1 -0
  32. package/types/tests/unit/use/objectSubscription.spec.d.ts +0 -1
  33. package/types/tests/unit/use/proxyLoadingError.spec.d.ts +0 -1
  34. package/types/tests/unit/use/search.error.spec.d.ts +1 -0
  35. package/types/tests/unit/use/search.spec.d.ts +0 -1
  36. package/types/tests/unit/utils/assignReactiveObject.extra.spec.d.ts +1 -0
  37. package/types/tests/unit/utils/assignReactiveObject.refs.spec.d.ts +1 -0
  38. package/types/tests/unit/utils/assignReactiveObject.spec.d.ts +0 -1
  39. package/types/tests/unit/utils/cancellableFetch.spec.d.ts +1 -0
  40. package/types/tests/unit/utils/classes.spec.d.ts +0 -1
  41. package/types/tests/unit/utils/compact.spec.d.ts +1 -0
  42. package/types/tests/unit/utils/deepUnref.spec.d.ts +1 -0
  43. package/types/tests/unit/utils/deleteKey.spec.d.ts +0 -1
  44. package/types/tests/unit/utils/flattenPaths.spec.d.ts +0 -1
  45. package/types/tests/unit/utils/flattenPathsWithValues.spec.d.ts +1 -0
  46. package/types/tests/unit/utils/getFakePk.spec.d.ts +1 -0
  47. package/types/tests/unit/utils/keepAliveTry.spec.d.ts +1 -0
  48. package/types/tests/unit/utils/keyDiff.spec.d.ts +0 -1
  49. package/types/tests/unit/utils/set.spec.d.ts +0 -1
  50. package/types/tests/unit/utils/transformWalk.spec.d.ts +1 -0
  51. package/types/tests/unit/utils/unwrapNested.spec.d.ts +1 -0
  52. package/types/tests/unit/utils/watches.spec.d.ts +0 -1
  53. package/types/use/cancellableIntent.d.ts +121 -48
  54. package/types/use/combineClasses.d.ts +0 -1
  55. package/types/use/error.d.ts +48 -0
  56. package/types/use/list.d.ts +9 -32
  57. package/types/use/listCalculated.d.ts +107 -49
  58. package/types/use/listFilter.d.ts +13 -31
  59. package/types/use/listInstance.d.ts +137 -71
  60. package/types/use/listRelated.d.ts +106 -43
  61. package/types/use/listSearch.d.ts +24 -12
  62. package/types/use/listSort.d.ts +3 -34
  63. package/types/use/listSubscription.d.ts +40 -57
  64. package/types/use/loading.d.ts +37 -0
  65. package/types/use/loadingError.d.ts +5 -100
  66. package/types/use/object.d.ts +3 -12
  67. package/types/use/objectCalculated.d.ts +3 -9
  68. package/types/use/objectInstance.d.ts +59 -47
  69. package/types/use/objectRelated.d.ts +3 -9
  70. package/types/use/objectSubscription.d.ts +33 -51
  71. package/types/use/proxyError.d.ts +27 -0
  72. package/types/use/proxyLoading.d.ts +15 -0
  73. package/types/use/proxyLoadingError.d.ts +8 -16
  74. package/types/use/search.d.ts +2 -3
  75. package/types/utils/assignReactiveObject.d.ts +0 -1
  76. package/types/utils/cancellableFetch.d.ts +0 -1
  77. package/types/utils/cancellablePromise.d.ts +0 -1
  78. package/types/utils/classes.d.ts +2 -8
  79. package/types/utils/compact.d.ts +0 -1
  80. package/types/utils/deepUnref.d.ts +2 -23
  81. package/types/utils/deleteKey.d.ts +6 -6
  82. package/types/utils/flattenPaths.d.ts +0 -1
  83. package/types/utils/flattenPathsWithValues.d.ts +29 -0
  84. package/types/utils/getFakePk.d.ts +0 -1
  85. package/types/utils/keepAliveTry.d.ts +0 -1
  86. package/types/utils/keyDiff.d.ts +9 -10
  87. package/types/utils/loadingCombine.d.ts +0 -1
  88. package/types/utils/proxyRunning.d.ts +2 -3
  89. package/types/utils/refIfReactive.d.ts +0 -1
  90. package/types/utils/relatedCalculatedHelpers.d.ts +0 -1
  91. package/types/utils/set.d.ts +0 -1
  92. package/types/utils/transformWalk.d.ts +0 -1
  93. package/types/utils/unwrapNested.d.ts +0 -1
  94. package/types/utils/watches.d.ts +0 -1
  95. package/use/cancellableIntent.js +185 -100
  96. package/use/error.js +44 -0
  97. package/use/list.js +51 -111
  98. package/use/listCalculated.js +75 -98
  99. package/use/listFilter.js +91 -186
  100. package/use/listInstance.js +357 -282
  101. package/use/listRelated.js +52 -72
  102. package/use/listSearch.js +49 -86
  103. package/use/listSort.js +121 -237
  104. package/use/listSubscription.js +181 -274
  105. package/use/loading.js +35 -0
  106. package/use/loadingError.js +7 -81
  107. package/use/object.js +47 -67
  108. package/use/objectCalculated.js +103 -65
  109. package/use/objectInstance.js +253 -241
  110. package/use/objectRelated.js +48 -30
  111. package/use/objectSubscription.js +110 -175
  112. package/use/proxyError.js +48 -0
  113. package/use/proxyLoading.js +22 -0
  114. package/use/proxyLoadingError.js +9 -35
  115. package/use/search.js +4 -2
  116. package/utils/assignReactiveObject.js +8 -8
  117. package/utils/classes.js +7 -28
  118. package/utils/deepUnref.js +15 -2
  119. package/utils/deleteKey.js +13 -5
  120. package/utils/flattenPathsWithValues.js +65 -0
  121. package/utils/keyDiff.js +5 -5
  122. package/utils/proxyRunning.js +16 -10
  123. package/types/config/commonCrud.d.ts.map +0 -1
  124. package/types/config/listCrud.d.ts.map +0 -1
  125. package/types/config/objectCrud.d.ts.map +0 -1
  126. package/types/index.d.ts.map +0 -1
  127. package/types/tests/unit/config/listCrud.spec.d.ts.map +0 -1
  128. package/types/tests/unit/config/objectCrud.spec.d.ts.map +0 -1
  129. package/types/tests/unit/crudPromise.d.ts.map +0 -1
  130. package/types/tests/unit/expectHelpers.d.ts +0 -2
  131. package/types/tests/unit/expectHelpers.d.ts.map +0 -1
  132. package/types/tests/unit/mockOnUnmounted.d.ts.map +0 -1
  133. package/types/tests/unit/poll.d.ts.map +0 -1
  134. package/types/tests/unit/use/cancellableIntent.spec.d.ts.map +0 -1
  135. package/types/tests/unit/use/listCalculated.spec.d.ts.map +0 -1
  136. package/types/tests/unit/use/listFilter.spec.d.ts.map +0 -1
  137. package/types/tests/unit/use/listInstance.spec.d.ts.map +0 -1
  138. package/types/tests/unit/use/listRelated.spec.d.ts.map +0 -1
  139. package/types/tests/unit/use/listSearch.spec.d.ts.map +0 -1
  140. package/types/tests/unit/use/listSort.spec.d.ts.map +0 -1
  141. package/types/tests/unit/use/listSubscription.spec.d.ts.map +0 -1
  142. package/types/tests/unit/use/loadingError.spec.d.ts.map +0 -1
  143. package/types/tests/unit/use/objectInstance.spec.d.ts.map +0 -1
  144. package/types/tests/unit/use/objectSubscription.spec.d.ts.map +0 -1
  145. package/types/tests/unit/use/proxyLoadingError.spec.d.ts.map +0 -1
  146. package/types/tests/unit/use/search.spec.d.ts.map +0 -1
  147. package/types/tests/unit/utils/assignReactiveObject.spec.d.ts.map +0 -1
  148. package/types/tests/unit/utils/classes.spec.d.ts.map +0 -1
  149. package/types/tests/unit/utils/deleteKey.spec.d.ts.map +0 -1
  150. package/types/tests/unit/utils/flattenPaths.spec.d.ts.map +0 -1
  151. package/types/tests/unit/utils/keyDiff.spec.d.ts.map +0 -1
  152. package/types/tests/unit/utils/set.spec.d.ts.map +0 -1
  153. package/types/tests/unit/utils/watches.spec.d.ts.map +0 -1
  154. package/types/use/cancellableIntent.d.ts.map +0 -1
  155. package/types/use/combineClasses.d.ts.map +0 -1
  156. package/types/use/list.d.ts.map +0 -1
  157. package/types/use/listCalculated.d.ts.map +0 -1
  158. package/types/use/listFilter.d.ts.map +0 -1
  159. package/types/use/listInstance.d.ts.map +0 -1
  160. package/types/use/listKeys.d.ts +0 -15
  161. package/types/use/listKeys.d.ts.map +0 -1
  162. package/types/use/listRelated.d.ts.map +0 -1
  163. package/types/use/listSearch.d.ts.map +0 -1
  164. package/types/use/listSort.d.ts.map +0 -1
  165. package/types/use/listSubscription.d.ts.map +0 -1
  166. package/types/use/loadingError.d.ts.map +0 -1
  167. package/types/use/object.d.ts.map +0 -1
  168. package/types/use/objectCalculated.d.ts.map +0 -1
  169. package/types/use/objectInstance.d.ts.map +0 -1
  170. package/types/use/objectRelated.d.ts.map +0 -1
  171. package/types/use/objectSubscription.d.ts.map +0 -1
  172. package/types/use/paginatedListInstance.d.ts +0 -60
  173. package/types/use/paginatedListInstance.d.ts.map +0 -1
  174. package/types/use/proxyLoadingError.d.ts.map +0 -1
  175. package/types/use/search.d.ts.map +0 -1
  176. package/types/use/watchesRunning.d.ts +0 -63
  177. package/types/use/watchesRunning.d.ts.map +0 -1
  178. package/types/utils/assignReactiveObject.d.ts.map +0 -1
  179. package/types/utils/cancellableFetch.d.ts.map +0 -1
  180. package/types/utils/cancellablePromise.d.ts.map +0 -1
  181. package/types/utils/classes.d.ts.map +0 -1
  182. package/types/utils/compact.d.ts.map +0 -1
  183. package/types/utils/deepUnref.d.ts.map +0 -1
  184. package/types/utils/deleteKey.d.ts.map +0 -1
  185. package/types/utils/flattenPaths.d.ts.map +0 -1
  186. package/types/utils/getFakePk.d.ts.map +0 -1
  187. package/types/utils/keepAliveTry.d.ts.map +0 -1
  188. package/types/utils/keyDiff.d.ts.map +0 -1
  189. package/types/utils/loadingCombine.d.ts.map +0 -1
  190. package/types/utils/proxyRunning.d.ts.map +0 -1
  191. package/types/utils/refIfReactive.d.ts.map +0 -1
  192. package/types/utils/relatedCalculatedHelpers.d.ts.map +0 -1
  193. package/types/utils/set.d.ts.map +0 -1
  194. package/types/utils/transformWalk.d.ts.map +0 -1
  195. package/types/utils/unwrapNested.d.ts.map +0 -1
  196. package/types/utils/watches.d.ts.map +0 -1
  197. package/use/listKeys.js +0 -105
  198. package/use/paginatedListInstance.js +0 -126
  199. package/use/watchesRunning.js +0 -69
@@ -1,9 +1,73 @@
1
+ /**
2
+ * This module provides a Vue Composition API composable function for dynamically calculating properties in lists
3
+ * based on complex business logic. It integrates with list management systems to apply user-defined rules
4
+ * that calculate new properties based on changes in list items or related data. This is particularly useful for
5
+ * applications that need to display derived data without altering the original source objects in the list.
6
+ *
7
+ * @module use/listCalculated.js
8
+ */
9
+ /**
10
+ * Defines rules for dynamically calculating new properties for objects in a list. Each rule is a function that takes an
11
+ * object from the list, optionally its related objects, and previously calculated properties to compute a new
12
+ * property. These functions are reactive and re-evaluate when underlying dependencies change.
13
+ *
14
+ * @typedef {{
15
+ * [rule: string]: (
16
+ * object: import('../use/objectInstance.js').ExistingCrudObject,
17
+ * relatedObject: {
18
+ * [rule: string]: any,
19
+ * },
20
+ * calculatedObjects: {
21
+ * [rule: string]: import('vue').ComputedRef<any>,
22
+ * }
23
+ * ) => any,
24
+ * }} ListCalculatedRules
25
+ */
26
+ /**
27
+ * The raw state for a list calculated.
28
+ *
29
+ * @typedef {object} ListCalculatedRawState - The raw state for a list calculated property.
30
+ * @property {{[pk: string]: {[rule: string]: import('vue').ComputedRef<any>}}} calculatedObjects - The calculated objects.
31
+ * @property {ListCalculatedRules} calculatedObjectsRules - The rules for the calculated objects.
32
+ * @property {boolean} calculatedObjectsParentStateObjectsWatchRunning - Whether the parent state objects watch is running.
33
+ * @property {boolean} calculatedObjectsWatchRunning - Whether the calculated objects watch is running.
34
+ * @property {import('vue').ComputedRef<boolean>} calculatedRunning - Whether the calculated properties are running.
35
+ * @property {import('vue').ComputedRef<boolean>} running - Whether the list is running.
36
+ * @private
37
+ */
38
+ /**
39
+ * The raw parent state for a list calculated.
40
+ *
41
+ * @typedef {(
42
+ * import('./listInstance.js').ListInstanceRawState &
43
+ * Partial<import('./listSubscription.js').ListSubscriptionRawState> &
44
+ * Partial<import('./listRelated.js').ListRelatedRawState>
45
+ * )} ListCalculatedParentRawState
46
+ */
47
+ /**
48
+ * The state for a list calculated property.
49
+ *
50
+ * @typedef {import('vue').UnwrapNestedRefs<
51
+ * ListCalculatedParentRawState &
52
+ * ListCalculatedRawState
53
+ * >} ListCalculatedState
54
+ */
55
+ /**
56
+ * Represents a combined reactive state that includes properties from list related,
57
+ * subscription, and instance modules.
58
+ *
59
+ * @typedef {import('vue').UnwrapNestedRefs<(
60
+ * import('./listInstance.js').ListInstanceRawState &
61
+ * Partial<import('./listSubscription.js').ListSubscriptionRawState> &
62
+ * Partial<import('./listRelated.js').ListRelatedRawState>
63
+ * )>} ListCalculatedParentState
64
+ */
1
65
  /**
2
66
  * The options to create a list calculated composition function.
3
67
  *
4
68
  * @typedef {object} ListCalculatedOptions - Options to configure the behavior of the list calculated properties.
5
69
  * @property {ListCalculatedParentState} parentState - The parent state that interacts with the calculated objects.
6
- * @property {ListCalculatedRules} calculatedObjectsRules - A reactive reference to rules used for dynamic calculations
70
+ * @property {import('vue').Ref<ListCalculatedRules>} calculatedObjectsRules - A reactive reference to rules used for dynamic calculations
7
71
  * within list objects. Proper setup of this reference ensures that updates are managed reactively, including deep
8
72
  * property changes.
9
73
  */
@@ -13,8 +77,7 @@
13
77
  * @typedef {object} ListCalculatedProperties
14
78
  * @property {ListCalculatedState} state - The state for the list calculated property.
15
79
  * @property {ListCalculatedParentState} parentState - The parent state object.
16
- * @property {import('./watchesRunning.js').WatchesRunning} watchesRunning - The watches running.
17
- * @property {import('vue').EffectScope} effectScope - The effect scope for the list calculated property.
80
+ * @property {() => void} stop - Stops composition's effects and cleans up resources.
18
81
  */
19
82
  /**
20
83
  * The instance of `useListCalculated`.
@@ -90,58 +153,18 @@ export function useListCalculateds(listCalculatedArgs: {
90
153
  * list, facilitating real-time updates and complex dependency management across multiple components.
91
154
  */
92
155
  export function useListCalculated({ parentState, calculatedObjectsRules }: ListCalculatedOptions): ListCalculated;
93
- /**
94
- * - Options to configure the behavior of the list calculated properties.
95
- */
96
- export type ListCalculatedOptions = {
97
- /**
98
- * - The parent state that interacts with the calculated objects.
99
- */
100
- parentState: ListCalculatedParentState;
101
- /**
102
- * - A reactive reference to rules used for dynamic calculations
103
- * within list objects. Proper setup of this reference ensures that updates are managed reactively, including deep
104
- * property changes.
105
- */
106
- calculatedObjectsRules: ListCalculatedRules;
107
- };
108
- /**
109
- * The properties for the list computed composition function.
110
- */
111
- export type ListCalculatedProperties = {
112
- /**
113
- * - The state for the list calculated property.
114
- */
115
- state: ListCalculatedState;
116
- /**
117
- * - The parent state object.
118
- */
119
- parentState: ListCalculatedParentState;
120
- /**
121
- * - The watches running.
122
- */
123
- watchesRunning: import("./watchesRunning.js").WatchesRunning;
124
- /**
125
- * - The effect scope for the list calculated property.
126
- */
127
- effectScope: import("vue").EffectScope;
128
- };
129
- /**
130
- * The instance of `useListCalculated`.
131
- */
132
- export type ListCalculated = ListCalculatedProperties;
133
156
  /**
134
157
  * Defines rules for dynamically calculating new properties for objects in a list. Each rule is a function that takes an
135
158
  * object from the list, optionally its related objects, and previously calculated properties to compute a new
136
159
  * property. These functions are reactive and re-evaluate when underlying dependencies change.
137
160
  */
138
- export type ListCalculatedRules = import("vue").Ref<{
139
- [rule: string]: (object: import("./listInstance.js").ListObject, relatedObject: {
161
+ export type ListCalculatedRules = {
162
+ [rule: string]: (object: import("../use/objectInstance.js").ExistingCrudObject, relatedObject: {
140
163
  [rule: string]: any;
141
164
  }, calculatedObjects: {
142
165
  [rule: string]: import("vue").ComputedRef<any>;
143
166
  }) => any;
144
- }>;
167
+ };
145
168
  /**
146
169
  * - The raw state for a list calculated property.
147
170
  */
@@ -169,11 +192,11 @@ export type ListCalculatedRawState = {
169
192
  /**
170
193
  * - Whether the calculated properties are running.
171
194
  */
172
- calculatedRunning: boolean;
195
+ calculatedRunning: import("vue").ComputedRef<boolean>;
173
196
  /**
174
197
  * - Whether the list is running.
175
198
  */
176
- running: import("vue").Ref<boolean>;
199
+ running: import("vue").ComputedRef<boolean>;
177
200
  };
178
201
  /**
179
202
  * The raw parent state for a list calculated.
@@ -188,4 +211,39 @@ export type ListCalculatedState = import("vue").UnwrapNestedRefs<ListCalculatedP
188
211
  * subscription, and instance modules.
189
212
  */
190
213
  export type ListCalculatedParentState = import("vue").UnwrapNestedRefs<(import("./listInstance.js").ListInstanceRawState & Partial<import("./listSubscription.js").ListSubscriptionRawState> & Partial<import("./listRelated.js").ListRelatedRawState>)>;
191
- //# sourceMappingURL=listCalculated.d.ts.map
214
+ /**
215
+ * - Options to configure the behavior of the list calculated properties.
216
+ */
217
+ export type ListCalculatedOptions = {
218
+ /**
219
+ * - The parent state that interacts with the calculated objects.
220
+ */
221
+ parentState: ListCalculatedParentState;
222
+ /**
223
+ * - A reactive reference to rules used for dynamic calculations
224
+ * within list objects. Proper setup of this reference ensures that updates are managed reactively, including deep
225
+ * property changes.
226
+ */
227
+ calculatedObjectsRules: import("vue").Ref<ListCalculatedRules>;
228
+ };
229
+ /**
230
+ * The properties for the list computed composition function.
231
+ */
232
+ export type ListCalculatedProperties = {
233
+ /**
234
+ * - The state for the list calculated property.
235
+ */
236
+ state: ListCalculatedState;
237
+ /**
238
+ * - The parent state object.
239
+ */
240
+ parentState: ListCalculatedParentState;
241
+ /**
242
+ * - Stops composition's effects and cleans up resources.
243
+ */
244
+ stop: () => void;
245
+ };
246
+ /**
247
+ * The instance of `useListCalculated`.
248
+ */
249
+ export type ListCalculated = ListCalculatedProperties;
@@ -1,5 +1,13 @@
1
1
  /**
2
- * @typedef {import('vue').Ref<import('./listInstance.js').ListObject>[]} ObjectsInOrderRefs
2
+ * Provides reactive filtering functionality for lists within a Vue application. This composable
3
+ * supports defining dynamic inclusion and exclusion criteria to control the visibility of list items
4
+ * based on user-defined rules. It's particularly useful in scenarios where list contents need to be
5
+ * dynamically adjusted without modifying the source data.
6
+ *
7
+ * @module use/listFilter.js
8
+ */
9
+ /**
10
+ * @typedef {import('vue').Ref<import('../use/objectInstance.js').ExistingCrudObject>[]} ObjectsInOrderRefs
3
11
  */
4
12
  /**
5
13
  * @typedef {Function} ListFilterAllowedFilter - A function that returns true if an item should be included.
@@ -14,11 +22,6 @@
14
22
  * @typedef {object} ListFilterRawState
15
23
  * @property {ListFilterAllowedFilter} [allowedFilter] - Function to determine if an item should be included based on custom logic.
16
24
  * @property {ListFilterExcludedFilter} [excludedFilter] - Function to determine if an item should be excluded based on custom logic.
17
- * @property {object} inResults - A map of items to boolean values indicating filter results.
18
- * @property {boolean} objectsWatchRunning - Flag indicating if the object watch is active.
19
- * @property {boolean} resultsWatchRunning - Flag indicating if the results watch is active.
20
- * @property {boolean} running - Flag indicating if any part of the filter logic is currently processing.
21
- * @property {boolean} orderWatchRunning - Flag indicating if the order watch is active.
22
25
  */
23
26
  /**
24
27
  *
@@ -59,7 +62,7 @@
59
62
  * @typedef {object} ListFilterProperties
60
63
  * @property {ListFilterState} state - The reactive state managing the filter logic and results.
61
64
  * @property {ListFilterParentState} parentState - The state of the list being filtered.
62
- * @property {import('vue').EffectScope} effectScope - Scoped reactivity for this filter instance.
65
+ * @property {() => void} stop - A function to stop the effect scope and clean up resources.
63
66
  */
64
67
  /**
65
68
  * Represents an instance of a list filter, including its state and associated Vue composition API utilities.
@@ -110,7 +113,7 @@ export function useListFilters(listFilterArgs: {
110
113
  * @returns {ListFilter} A fully configured list filter instance, providing reactive filtered results.
111
114
  */
112
115
  export function useListFilter({ parentState, allowedFilter, excludedFilter }: ListFilterOptions): ListFilter;
113
- export type ObjectsInOrderRefs = import("vue").Ref<import("./listInstance.js").ListObject>[];
116
+ export type ObjectsInOrderRefs = import("vue").Ref<import("../use/objectInstance.js").ExistingCrudObject>[];
114
117
  /**
115
118
  * - A function that returns true if an item should be included.
116
119
  */
@@ -132,26 +135,6 @@ export type ListFilterRawState = {
132
135
  * - Function to determine if an item should be excluded based on custom logic.
133
136
  */
134
137
  excludedFilter?: ListFilterExcludedFilter;
135
- /**
136
- * - A map of items to boolean values indicating filter results.
137
- */
138
- inResults: object;
139
- /**
140
- * - Flag indicating if the object watch is active.
141
- */
142
- objectsWatchRunning: boolean;
143
- /**
144
- * - Flag indicating if the results watch is active.
145
- */
146
- resultsWatchRunning: boolean;
147
- /**
148
- * - Flag indicating if any part of the filter logic is currently processing.
149
- */
150
- running: boolean;
151
- /**
152
- * - Flag indicating if the order watch is active.
153
- */
154
- orderWatchRunning: boolean;
155
138
  };
156
139
  export type ListFilterParentRawState = (import("./listInstance.js").ListInstanceRawState & Partial<import("./listSubscription.js").ListSubscriptionRawState> & Partial<import("./listRelated.js").ListRelatedRawState> & Partial<import("./listCalculated.js").ListCalculatedRawState>);
157
140
  /**
@@ -192,12 +175,11 @@ export type ListFilterProperties = {
192
175
  */
193
176
  parentState: ListFilterParentState;
194
177
  /**
195
- * - Scoped reactivity for this filter instance.
178
+ * - A function to stop the effect scope and clean up resources.
196
179
  */
197
- effectScope: import("vue").EffectScope;
180
+ stop: () => void;
198
181
  };
199
182
  /**
200
183
  * Represents an instance of a list filter, including its state and associated Vue composition API utilities.
201
184
  */
202
185
  export type ListFilter = ListFilterProperties;
203
- //# sourceMappingURL=listFilter.d.ts.map
@@ -20,59 +20,95 @@
20
20
  * function.
21
21
  * @property {import('../config/listCrud.js').CrudListSubscribeFn} [handlers.subscribe] - Provide the implementation for the
22
22
  * subscribe function.
23
- * @property {import('vue').Ref<boolean>|boolean} keepOldPages - If true, pages will not be cleared when defaultPageCallback is called.
24
23
  */
25
24
  /**
26
25
  * The objects by pk.
27
26
  *
28
- * @typedef {{[pk: string]: ListObject}} ObjectsByPk
27
+ * @typedef {{[pk: string]: import('../use/objectInstance.js').ExistingCrudObject}} ObjectsByPk
29
28
  */
30
29
  /**
31
30
  * The objects in order, based on .order & .objects.
32
31
  *
33
- * @typedef {import('vue').ComputedRef<ListObject[]>} ObjectsInOrder
32
+ * @typedef {import('vue').ComputedRef<import('../use/objectInstance.js').ExistingCrudObject[]>} ObjectsInOrder
34
33
  */
35
34
  /**
36
35
  * The order of the objects in the list.
37
36
  *
38
37
  * @typedef {import('vue').ComputedRef<string[]>} ListOrder
39
38
  */
39
+ /**
40
+ * @typedef {object} ListInstanceRawStateCrud
41
+ * @property {import('vue').Reactive<import('../config/objectCrud.js').TargetArgs|{}>} args - The arguments to be passed to the crud handlers.
42
+ * @property {import('../config/listCrud.js').CrudListFn} list - The list function.
43
+ * @property {import('../config/listCrud.js').CrudListSubscribeFn} subscribe - The subscribe function.
44
+ * @property {import('../config/listCrud.js').CrudBulkDeleteFn} bulkDelete - The bulk delete function.
45
+ * @property {import('../config/listCrud.js').CrudExecuteActionFn} executeAction - The execute action function.
46
+ */
47
+ /**
48
+ * @typedef {Map<string, import('vue').Reactive<import('../use/objectInstance.js').ExistingCrudObject>>} ObjectsMap
49
+ */
50
+ /**
51
+ * @typedef {object} PaginateInfo
52
+ * @property {number} [totalRecords] - The total records.
53
+ * @property {number} [totalPages] - The total pages.
54
+ * @property {number} [perPage] - The per page.
55
+ * @property {number} [page] - The page you are giving us results for.
56
+ */
57
+ /**
58
+ * @typedef {{ [key: string]: number | string }} ColumnTotals
59
+ */
40
60
  /**
41
61
  * The raw state object for the list instance, defining the reactive properties and their types.
42
62
  *
43
- * @typedef {object} ListInstanceRawState
44
- * @property {object} crud - CRUD handlers and their configurations for the list.
45
- * @property {object} crud.args - Arguments for the CRUD handlers.
46
- * @property {Function} [crud.list] - Function to list objects.
63
+ * @typedef {object} ListInstanceRawMyState
64
+ * @property {import('vue').Reactive<ListInstanceRawStateCrud>} crud - CRUD handlers and their configurations for the list.
47
65
  * @property {string} pkKey - The primary key field for the list objects.
48
66
  * @property {object} params - Arguments passed to the server for listing operations.
67
+ * @property {ObjectsMap} objectsMap - The map of objects stored by their pks.
49
68
  * @property {ObjectsByPk} objects - The list objects stored by their pks.
50
- * @property {boolean} running - Indicates if there are ongoing reactive updates.
51
- * @property {Readonly<import('vue').Ref<boolean>>} [loading] - Indicates if the list is currently loading.
52
- * @property {Readonly<import('vue').Ref<boolean>>} errored - Indicates if an error occurred during the last operation.
53
- * @property {Readonly<import('vue').Ref<Error|null>>} error - The last error encountered.
54
69
  * @property {ListOrder} order - The order of objects in the list.
55
70
  * @property {ObjectsInOrder} objectsInOrder - The objects in the order specified by the list.
71
+ * @property {import('vue').ShallowReactive<PaginateInfo>} paginateInfo - Pagination information for the list.
72
+ * @property {import('vue').ShallowReactive<ColumnTotals>} columnTotals - Column totals for the list.
73
+ */
74
+ /**
75
+ * @typedef {ListInstanceRawMyState & Pick<import('./loadingError.js').LoadingErrorStatus, "loading" | "error" | "errored">} ListInstanceRawState
56
76
  */
57
77
  /**
58
78
  * Defines the reactive state used by the list instance.
59
79
  *
60
80
  * @typedef {import('vue').UnwrapNestedRefs<ListInstanceRawState>} ListInstanceState
61
81
  */
82
+ /**
83
+ * @typedef {(newObjects: import('../use/objectInstance.js').ExistingCrudObject[]) => void} PushObjectsFn
84
+ */
85
+ /**
86
+ * @typedef {() => void} ClearListFn
87
+ */
88
+ /**
89
+ * @typedef {(info: PaginateInfo) => void} SetPaginateInfoFn
90
+ */
91
+ /**
92
+ * @typedef {(total: ColumnTotals) => void} SetColumnTotalsFn
93
+ */
62
94
  /**
63
95
  * Defines the methods provided by the list instance for managing objects in the list.
64
96
  *
65
- * @typedef {object} ListInstanceFunctions
66
- * @property {(newObjects: ListObject[]) => void} defaultPageCallback - Handles new or updated objects, respecting the keepOldPages setting.
67
- * @property {(newObjects: ListObject[]) => void} pageCallback - Customizable callback for handling new objects per page.
68
- * @property {(object: ListObject) => void} addListObject - Adds an object to the list.
69
- * @property {(object: ListObject) => void} updateListObject - Updates an object in the list.
97
+ * @typedef {object} ListInstanceMyFunctions
98
+ * @property {PushObjectsFn} pushObjects - Customizable callback for handling new objects per page.
99
+ * @property {(object: import('../use/objectInstance.js').ExistingCrudObject) => void} addListObject - Adds an object to the list.
100
+ * @property {(object: import('../use/objectInstance.js').ExistingCrudObject) => void} updateListObject - Updates an object in the list.
70
101
  * @property {(objectId: string) => void} deleteListObject - Deletes an object from the list by pk.
71
102
  * @property {() => void} clearList - Clears all objects and errors from the list.
72
103
  * @property {() => string} getFakePk - Generates a unique fake pk for use within the list.
73
104
  * @property {() => import('../utils/cancellablePromise.js').MaybeCancellablePromise<boolean|never>} list - Initiates a fetch to retrieve objects according to the CRUD configuration, returning a promise to a boolean indicating success.
74
- * @property {() => Promise<boolean>} bulkDelete - Initiates a bulk delete operation on all objects in the list, returning a promise to a boolean indicating success.
105
+ * @property {(args: {pks?: string[]}) => Promise<boolean>} bulkDelete - Deletes objects from the list by pk, returning a promise to a boolean indicating success.
75
106
  * @property {() => Promise<object|string|false>} executeAction - Initiates an action on all objects in the list, returning the response, or false if the action failed.
107
+ * @property {(info: PaginateInfo) => void} setPaginateInfo - The method to update pagination information.
108
+ * @property {(total: ColumnTotals) => void} setColumnTotals - The method to update column totals.
109
+ */
110
+ /**
111
+ * @typedef {ListInstanceMyFunctions & Pick<import('./loadingError.js').LoadingErrorStatus, "clearError">} ListInstanceFunctions
76
112
  */
77
113
  /**
78
114
  * Helper type to facilitate the combination of state and functions into a single type.
@@ -145,20 +181,14 @@ export function useListInstances(listInstanceArgs: {
145
181
  * @param {ListInstanceOptions} options - Specifies the configuration options for creating a list instance, including
146
182
  * properties for CRUD operations and UI behaviors like page persistence.
147
183
  * @returns {ListInstance} The list instance.
148
- * @throws {ListInstanceError} If the props or keepOldPages are missing.
184
+ * @throws {ListInstanceError} If the props are missing.
149
185
  */
150
- export function useListInstance({ props, handlers, keepOldPages }: ListInstanceOptions): ListInstance;
186
+ export function useListInstance({ props, handlers }: ListInstanceOptions): ListInstance;
151
187
  /**
152
188
  * A composable function for managing a list of objects.
153
189
  *
154
190
  * @module use/listInstance.js
155
191
  */
156
- /**
157
- * Defines the structure for the objects stored within the list, each identified by a unique pk and capable of
158
- * holding various key-value pairs.
159
- *
160
- * @typedef {{pk: string, [key: string]: any}} ListObject
161
- */
162
192
  /**
163
193
  * Defines a custom error class specific to list instance operations, encapsulating details about errors that occur
164
194
  * during list manipulation and processing.
@@ -207,36 +237,73 @@ export type ListInstanceOptions = {
207
237
  executeAction?: import("../config/listCrud.js").CrudExecuteActionFn;
208
238
  subscribe?: import("../config/listCrud.js").CrudListSubscribeFn;
209
239
  };
210
- /**
211
- * - If true, pages will not be cleared when defaultPageCallback is called.
212
- */
213
- keepOldPages: import("vue").Ref<boolean> | boolean;
214
240
  };
215
241
  /**
216
242
  * The objects by pk.
217
243
  */
218
244
  export type ObjectsByPk = {
219
- [pk: string]: ListObject;
245
+ [pk: string]: import("../use/objectInstance.js").ExistingCrudObject;
220
246
  };
221
247
  /**
222
248
  * The objects in order, based on .order & .objects.
223
249
  */
224
- export type ObjectsInOrder = import("vue").ComputedRef<ListObject[]>;
250
+ export type ObjectsInOrder = import("vue").ComputedRef<import("../use/objectInstance.js").ExistingCrudObject[]>;
225
251
  /**
226
252
  * The order of the objects in the list.
227
253
  */
228
254
  export type ListOrder = import("vue").ComputedRef<string[]>;
255
+ export type ListInstanceRawStateCrud = {
256
+ /**
257
+ * - The arguments to be passed to the crud handlers.
258
+ */
259
+ args: import("vue").Reactive<import("../config/objectCrud.js").TargetArgs | {}>;
260
+ /**
261
+ * - The list function.
262
+ */
263
+ list: import("../config/listCrud.js").CrudListFn;
264
+ /**
265
+ * - The subscribe function.
266
+ */
267
+ subscribe: import("../config/listCrud.js").CrudListSubscribeFn;
268
+ /**
269
+ * - The bulk delete function.
270
+ */
271
+ bulkDelete: import("../config/listCrud.js").CrudBulkDeleteFn;
272
+ /**
273
+ * - The execute action function.
274
+ */
275
+ executeAction: import("../config/listCrud.js").CrudExecuteActionFn;
276
+ };
277
+ export type ObjectsMap = Map<string, import("vue").Reactive<import("../use/objectInstance.js").ExistingCrudObject>>;
278
+ export type PaginateInfo = {
279
+ /**
280
+ * - The total records.
281
+ */
282
+ totalRecords?: number;
283
+ /**
284
+ * - The total pages.
285
+ */
286
+ totalPages?: number;
287
+ /**
288
+ * - The per page.
289
+ */
290
+ perPage?: number;
291
+ /**
292
+ * - The page you are giving us results for.
293
+ */
294
+ page?: number;
295
+ };
296
+ export type ColumnTotals = {
297
+ [key: string]: number | string;
298
+ };
229
299
  /**
230
300
  * The raw state object for the list instance, defining the reactive properties and their types.
231
301
  */
232
- export type ListInstanceRawState = {
302
+ export type ListInstanceRawMyState = {
233
303
  /**
234
304
  * - CRUD handlers and their configurations for the list.
235
305
  */
236
- crud: {
237
- args: object;
238
- list?: Function;
239
- };
306
+ crud: import("vue").Reactive<ListInstanceRawStateCrud>;
240
307
  /**
241
308
  * - The primary key field for the list objects.
242
309
  */
@@ -246,25 +313,13 @@ export type ListInstanceRawState = {
246
313
  */
247
314
  params: object;
248
315
  /**
249
- * - The list objects stored by their pks.
250
- */
251
- objects: ObjectsByPk;
252
- /**
253
- * - Indicates if there are ongoing reactive updates.
254
- */
255
- running: boolean;
256
- /**
257
- * - Indicates if the list is currently loading.
316
+ * - The map of objects stored by their pks.
258
317
  */
259
- loading?: Readonly<import("vue").Ref<boolean>>;
318
+ objectsMap: ObjectsMap;
260
319
  /**
261
- * - Indicates if an error occurred during the last operation.
262
- */
263
- errored: Readonly<import("vue").Ref<boolean>>;
264
- /**
265
- * - The last error encountered.
320
+ * - The list objects stored by their pks.
266
321
  */
267
- error: Readonly<import("vue").Ref<Error | null>>;
322
+ objects: ObjectsByPk;
268
323
  /**
269
324
  * - The order of objects in the list.
270
325
  */
@@ -273,31 +328,40 @@ export type ListInstanceRawState = {
273
328
  * - The objects in the order specified by the list.
274
329
  */
275
330
  objectsInOrder: ObjectsInOrder;
331
+ /**
332
+ * - Pagination information for the list.
333
+ */
334
+ paginateInfo: import("vue").ShallowReactive<PaginateInfo>;
335
+ /**
336
+ * - Column totals for the list.
337
+ */
338
+ columnTotals: import("vue").ShallowReactive<ColumnTotals>;
276
339
  };
340
+ export type ListInstanceRawState = ListInstanceRawMyState & Pick<import("./loadingError.js").LoadingErrorStatus, "loading" | "error" | "errored">;
277
341
  /**
278
342
  * Defines the reactive state used by the list instance.
279
343
  */
280
344
  export type ListInstanceState = import("vue").UnwrapNestedRefs<ListInstanceRawState>;
345
+ export type PushObjectsFn = (newObjects: import("../use/objectInstance.js").ExistingCrudObject[]) => void;
346
+ export type ClearListFn = () => void;
347
+ export type SetPaginateInfoFn = (info: PaginateInfo) => void;
348
+ export type SetColumnTotalsFn = (total: ColumnTotals) => void;
281
349
  /**
282
350
  * Defines the methods provided by the list instance for managing objects in the list.
283
351
  */
284
- export type ListInstanceFunctions = {
285
- /**
286
- * - Handles new or updated objects, respecting the keepOldPages setting.
287
- */
288
- defaultPageCallback: (newObjects: ListObject[]) => void;
352
+ export type ListInstanceMyFunctions = {
289
353
  /**
290
354
  * - Customizable callback for handling new objects per page.
291
355
  */
292
- pageCallback: (newObjects: ListObject[]) => void;
356
+ pushObjects: PushObjectsFn;
293
357
  /**
294
358
  * - Adds an object to the list.
295
359
  */
296
- addListObject: (object: ListObject) => void;
360
+ addListObject: (object: import("../use/objectInstance.js").ExistingCrudObject) => void;
297
361
  /**
298
362
  * - Updates an object in the list.
299
363
  */
300
- updateListObject: (object: ListObject) => void;
364
+ updateListObject: (object: import("../use/objectInstance.js").ExistingCrudObject) => void;
301
365
  /**
302
366
  * - Deletes an object from the list by pk.
303
367
  */
@@ -315,14 +379,25 @@ export type ListInstanceFunctions = {
315
379
  */
316
380
  list: () => import("../utils/cancellablePromise.js").MaybeCancellablePromise<boolean | never>;
317
381
  /**
318
- * - Initiates a bulk delete operation on all objects in the list, returning a promise to a boolean indicating success.
382
+ * - Deletes objects from the list by pk, returning a promise to a boolean indicating success.
319
383
  */
320
- bulkDelete: () => Promise<boolean>;
384
+ bulkDelete: (args: {
385
+ pks?: string[];
386
+ }) => Promise<boolean>;
321
387
  /**
322
388
  * - Initiates an action on all objects in the list, returning the response, or false if the action failed.
323
389
  */
324
390
  executeAction: () => Promise<object | string | false>;
391
+ /**
392
+ * - The method to update pagination information.
393
+ */
394
+ setPaginateInfo: (info: PaginateInfo) => void;
395
+ /**
396
+ * - The method to update column totals.
397
+ */
398
+ setColumnTotals: (total: ColumnTotals) => void;
325
399
  };
400
+ export type ListInstanceFunctions = ListInstanceMyFunctions & Pick<import("./loadingError.js").LoadingErrorStatus, "clearError">;
326
401
  /**
327
402
  * Helper type to facilitate the combination of state and functions into a single type.
328
403
  */
@@ -333,12 +408,3 @@ export type ListInstanceStateMixIn = {
333
408
  * The list instance, combining state management and functional operations for managing a list of objects.
334
409
  */
335
410
  export type ListInstance = ListInstanceStateMixIn & ListInstanceFunctions;
336
- /**
337
- * Defines the structure for the objects stored within the list, each identified by a unique pk and capable of
338
- * holding various key-value pairs.
339
- */
340
- export type ListObject = {
341
- pk: string;
342
- [key: string]: any;
343
- };
344
- //# sourceMappingURL=listInstance.d.ts.map