@arrai-innovations/reactive-helpers 21.1.2 → 22.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +28 -0
- package/README.md +109 -21
- package/config/commonCrud.js +7 -10
- package/config/listCrud.js +33 -33
- package/config/objectCrud.js +64 -59
- package/package.json +103 -89
- package/types/config/listCrud.d.ts +83 -28
- package/types/config/objectCrud.d.ts +139 -49
- package/types/tests/benchmarks/fixtures.d.ts +60 -0
- package/types/tests/benchmarks/listLayers.bench.d.ts +1 -0
- package/types/tests/benchmarks/listPush.bench.d.ts +1 -0
- package/types/tests/benchmarks/listStream.bench.d.ts +1 -0
- package/types/tests/unit/use/lifecycleCleanup.spec.d.ts +1 -0
- package/types/tests/unit/use/listPerformance.spec.d.ts +1 -0
- package/types/tests/unit/utils/cancellablePromise.spec.d.ts +1 -0
- package/types/use/cancellableIntent.d.ts +36 -33
- package/types/use/combineClasses.d.ts +5 -2
- package/types/use/error.d.ts +39 -19
- package/types/use/list.d.ts +27 -26
- package/types/use/listCalculated.d.ts +38 -55
- package/types/use/listFilter.d.ts +25 -33
- package/types/use/listInstance.d.ts +94 -81
- package/types/use/listRelated.d.ts +37 -57
- package/types/use/listSearch.d.ts +54 -52
- package/types/use/listSort.d.ts +31 -40
- package/types/use/listSubscription.d.ts +33 -36
- package/types/use/loading.d.ts +20 -10
- package/types/use/loadingError.d.ts +12 -3
- package/types/use/object.d.ts +8 -5
- package/types/use/objectCalculated.d.ts +46 -39
- package/types/use/objectInstance.d.ts +70 -74
- package/types/use/objectRelated.d.ts +51 -41
- package/types/use/objectSubscription.d.ts +38 -48
- package/types/use/proxyError.d.ts +15 -6
- package/types/use/proxyLoading.d.ts +11 -5
- package/types/use/proxyLoadingError.d.ts +19 -7
- package/types/use/search.d.ts +33 -29
- package/types/utils/assignReactiveObject.d.ts +3 -0
- package/types/utils/cancellableFetch.d.ts +2 -3
- package/types/utils/cancellablePromise.d.ts +42 -8
- package/types/utils/classes.d.ts +7 -1
- package/types/utils/deepUnref.d.ts +1 -1
- package/types/utils/getFakePk.d.ts +2 -2
- package/types/utils/isReactiveTyped.d.ts +2 -0
- package/types/utils/keyDiff.d.ts +4 -6
- package/types/utils/relatedCalculatedHelpers.d.ts +2 -0
- package/types/utils/watches.d.ts +1 -1
- package/use/cancellableIntent.js +36 -9
- package/use/combineClasses.js +2 -2
- package/use/error.js +10 -14
- package/use/list.js +6 -18
- package/use/listCalculated.js +28 -38
- package/use/listFilter.js +12 -24
- package/use/listInstance.js +101 -60
- package/use/listRelated.js +18 -37
- package/use/listSearch.js +9 -18
- package/use/listSort.js +95 -64
- package/use/listSubscription.js +19 -25
- package/use/loading.js +5 -7
- package/use/loadingError.js +3 -3
- package/use/object.js +14 -27
- package/use/objectCalculated.js +21 -25
- package/use/objectInstance.js +55 -50
- package/use/objectRelated.js +19 -25
- package/use/objectSubscription.js +18 -30
- package/use/proxyError.js +10 -10
- package/use/proxyLoading.js +5 -5
- package/use/proxyLoadingError.js +13 -8
- package/use/search.js +5 -11
- package/utils/assignReactiveObject.js +3 -3
- package/utils/cancellableFetch.js +3 -3
- package/utils/cancellablePromise.js +25 -8
- package/utils/classes.js +2 -2
- package/utils/deepUnref.js +1 -5
- package/utils/getFakePk.js +2 -2
- package/utils/isReactiveTyped.js +2 -0
- package/utils/keyDiff.js +1 -3
- package/utils/relatedCalculatedHelpers.js +2 -0
|
@@ -7,10 +7,6 @@
|
|
|
7
7
|
* @module use/listCalculated.js
|
|
8
8
|
*/
|
|
9
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
10
|
* @typedef {{
|
|
15
11
|
* [rule: string]: (
|
|
16
12
|
* object: import('../use/objectInstance.js').ExistingCrudObject,
|
|
@@ -18,16 +14,16 @@
|
|
|
18
14
|
* [rule: string]: any,
|
|
19
15
|
* },
|
|
20
16
|
* calculatedObjects: {
|
|
21
|
-
* [rule: string]:
|
|
17
|
+
* [rule: string]: any,
|
|
22
18
|
* }
|
|
23
19
|
* ) => any,
|
|
24
|
-
* }} ListCalculatedRules
|
|
20
|
+
* }} ListCalculatedRules - Defines rules for dynamically calculating new properties for objects in a list. Each rule is a function that takes an object from the list, optionally its related objects, and previously calculated properties to compute a new property. These functions are reactive and re-evaluate when underlying dependencies change. Each entry of the third argument is backed by a computed, but it is read through a reactive proxy that unwraps it, so a rule reads `calculatedObjects.otherRule` directly and never `.value`.
|
|
25
21
|
*/
|
|
26
22
|
/**
|
|
27
23
|
* The raw state for a list calculated.
|
|
28
24
|
*
|
|
29
25
|
* @typedef {object} ListCalculatedRawState - The raw state for a list calculated property.
|
|
30
|
-
* @property {{[pk: import('../config/commonCrud.js').Pk]: {[rule: string]:
|
|
26
|
+
* @property {{[pk: import('../config/commonCrud.js').Pk]: {[rule: string]: any}}} calculatedObjects - The calculated objects, by object pk and then rule name. Each entry is backed by a computed, but it is read through a reactive proxy that unwraps it, so reads yield the calculated value and never carry a `.value`.
|
|
31
27
|
* @property {ListCalculatedRules} calculatedObjectsRules - The rules for the calculated objects.
|
|
32
28
|
* @property {boolean} calculatedObjectsParentStateObjectsWatchRunning - Whether the parent state objects watch is running.
|
|
33
29
|
* @property {boolean} calculatedObjectsWatchRunning - Whether the calculated objects watch is running.
|
|
@@ -36,53 +32,42 @@
|
|
|
36
32
|
* @private
|
|
37
33
|
*/
|
|
38
34
|
/**
|
|
39
|
-
* The raw parent state for a list calculated.
|
|
40
|
-
*
|
|
41
35
|
* @typedef {(
|
|
42
36
|
* import('./listInstance.js').ListInstanceRawState &
|
|
43
37
|
* Partial<import('./listSubscription.js').ListSubscriptionRawState> &
|
|
44
38
|
* Partial<import('./listRelated.js').ListRelatedRawState>
|
|
45
|
-
* )} ListCalculatedParentRawState
|
|
39
|
+
* )} ListCalculatedParentRawState - The raw parent state for a list calculated.
|
|
46
40
|
*/
|
|
47
41
|
/**
|
|
48
|
-
* The state for a list calculated property.
|
|
49
|
-
*
|
|
50
42
|
* @typedef {import('vue').UnwrapNestedRefs<
|
|
51
43
|
* ListCalculatedParentRawState &
|
|
52
44
|
* ListCalculatedRawState
|
|
53
|
-
* >} ListCalculatedState
|
|
45
|
+
* >} ListCalculatedState - The state for a list calculated property.
|
|
54
46
|
*/
|
|
55
47
|
/**
|
|
56
|
-
* Represents a combined reactive state that includes properties from list related,
|
|
57
|
-
* subscription, and instance modules.
|
|
58
|
-
*
|
|
59
48
|
* @typedef {import('vue').UnwrapNestedRefs<(
|
|
60
49
|
* import('./listInstance.js').ListInstanceRawState &
|
|
61
50
|
* Partial<import('./listSubscription.js').ListSubscriptionRawState> &
|
|
62
51
|
* Partial<import('./listRelated.js').ListRelatedRawState>
|
|
63
|
-
* )>} ListCalculatedParentState
|
|
52
|
+
* )>} ListCalculatedParentState - Represents a combined reactive state that includes properties from list related, subscription, and instance modules.
|
|
64
53
|
*/
|
|
65
54
|
/**
|
|
66
55
|
* The options to create a list calculated composition function.
|
|
67
56
|
*
|
|
68
|
-
* @typedef {object} ListCalculatedOptions - Options to configure the
|
|
57
|
+
* @typedef {object} ListCalculatedOptions - Options to configure the behaviour of the list calculated properties.
|
|
69
58
|
* @property {ListCalculatedParentState} parentState - The parent state that interacts with the calculated objects.
|
|
70
59
|
* @property {import('vue').Ref<ListCalculatedRules>} calculatedObjectsRules - A reactive reference to rules used for dynamic calculations
|
|
71
60
|
* within list objects. Proper setup of this reference ensures that updates are managed reactively, including deep
|
|
72
61
|
* property changes.
|
|
73
62
|
*/
|
|
74
63
|
/**
|
|
75
|
-
* The properties for the list computed composition function.
|
|
76
|
-
*
|
|
77
|
-
* @typedef {object} ListCalculatedProperties
|
|
64
|
+
* @typedef {object} ListCalculatedProperties - The properties for the list computed composition function.
|
|
78
65
|
* @property {ListCalculatedState} state - The state for the list calculated property.
|
|
79
66
|
* @property {ListCalculatedParentState} parentState - The parent state object.
|
|
80
67
|
* @property {() => void} stop - Stops composition's effects and cleans up resources.
|
|
81
68
|
*/
|
|
82
69
|
/**
|
|
83
|
-
* The instance of `useListCalculated`.
|
|
84
|
-
*
|
|
85
|
-
* @typedef {ListCalculatedProperties} ListCalculated
|
|
70
|
+
* @typedef {ListCalculatedProperties} ListCalculated - The instance of `useListCalculated`.
|
|
86
71
|
*/
|
|
87
72
|
/**
|
|
88
73
|
* A composable function to create multiple list calculated objects.
|
|
@@ -108,7 +93,7 @@ export function useListCalculateds(listCalculatedArgs: {
|
|
|
108
93
|
* ```vue
|
|
109
94
|
* <script setup>
|
|
110
95
|
* import { useListSubscription, useListCalculated } from "@arrai-innovations/reactive-helpers";
|
|
111
|
-
* import { reactive
|
|
96
|
+
* import { reactive } from "vue";
|
|
112
97
|
*
|
|
113
98
|
* const listSubscriptionProps = reactive({
|
|
114
99
|
* // whatever props you need to get the list to work with your crud implementation
|
|
@@ -117,14 +102,15 @@ export function useListCalculateds(listCalculatedArgs: {
|
|
|
117
102
|
* pkKey: "pk",
|
|
118
103
|
* intendToList: true,
|
|
119
104
|
* });
|
|
120
|
-
* const listSubscription = useListSubscription(listSubscriptionProps);
|
|
105
|
+
* const listSubscription = useListSubscription({ props: listSubscriptionProps });
|
|
121
106
|
* const listCalculatedProps = reactive({
|
|
122
107
|
* parentState: listSubscription.state,
|
|
123
|
-
*
|
|
124
|
-
* someRule: (object,
|
|
125
|
-
* // some complex calculation
|
|
126
|
-
* //
|
|
127
|
-
* //
|
|
108
|
+
* calculatedObjectsRules: {
|
|
109
|
+
* someRule: (object, relatedObject, calculatedObjects) => {
|
|
110
|
+
* // some complex calculation. relatedObject holds this object's related objects, and is only
|
|
111
|
+
* // populated when a useListRelated sits between the list and this composable.
|
|
112
|
+
* // calculatedObjects holds the other calculated values for this same object,
|
|
113
|
+
* // including this rule, so try not to create circular dependencies.
|
|
128
114
|
* // this is used as a computed body.
|
|
129
115
|
* return object.someProperty + object.someOtherProperty;
|
|
130
116
|
* }
|
|
@@ -134,12 +120,12 @@ export function useListCalculateds(listCalculatedArgs: {
|
|
|
134
120
|
* </script>
|
|
135
121
|
* <template>
|
|
136
122
|
* <ul>
|
|
137
|
-
* <!-- reactive list of objects,
|
|
138
|
-
* <li v-for="obj in
|
|
123
|
+
* <!-- reactive list of objects, kept current by the configured subscription function. -->
|
|
124
|
+
* <li v-for="obj in listSubscription.state.objectsInOrder">
|
|
139
125
|
* {{ obj }}
|
|
140
126
|
* <div>
|
|
141
|
-
* <!-- the
|
|
142
|
-
* {{ listCalculated.state.
|
|
127
|
+
* <!-- the calculated value for this object, based on the rule -->
|
|
128
|
+
* {{ listCalculated.state.calculatedObjects[obj.pk].someRule }}
|
|
143
129
|
* </div>
|
|
144
130
|
* </li>
|
|
145
131
|
* </ul>
|
|
@@ -154,47 +140,45 @@ export function useListCalculateds(listCalculatedArgs: {
|
|
|
154
140
|
*/
|
|
155
141
|
export function useListCalculated({ parentState, calculatedObjectsRules }: ListCalculatedOptions): ListCalculated;
|
|
156
142
|
/**
|
|
157
|
-
* Defines rules for dynamically calculating new properties for objects in a list. Each rule is a function that takes an
|
|
158
|
-
* object from the list, optionally its related objects, and previously calculated properties to compute a new
|
|
159
|
-
* property. These functions are reactive and re-evaluate when underlying dependencies change.
|
|
143
|
+
* Defines rules for dynamically calculating new properties for objects in a list. Each rule is a function that takes an object from the list, optionally its related objects, and previously calculated properties to compute a new property. These functions are reactive and re-evaluate when underlying dependencies change. Each entry of the third argument is backed by a computed, but it is read through a reactive proxy that unwraps it, so a rule reads `calculatedObjects.otherRule` directly and never `.value`.
|
|
160
144
|
*/
|
|
161
145
|
export type ListCalculatedRules = {
|
|
162
146
|
[rule: string]: (object: import("../use/objectInstance.js").ExistingCrudObject, relatedObject: {
|
|
163
147
|
[rule: string]: any;
|
|
164
148
|
}, calculatedObjects: {
|
|
165
|
-
[rule: string]:
|
|
149
|
+
[rule: string]: any;
|
|
166
150
|
}) => any;
|
|
167
151
|
};
|
|
168
152
|
/**
|
|
169
|
-
*
|
|
153
|
+
* The raw state for a list calculated property.
|
|
170
154
|
*/
|
|
171
155
|
export type ListCalculatedRawState = {
|
|
172
156
|
/**
|
|
173
|
-
*
|
|
157
|
+
* The calculated objects, by object pk and then rule name. Each entry is backed by a computed, but it is read through a reactive proxy that unwraps it, so reads yield the calculated value and never carry a `.value`.
|
|
174
158
|
*/
|
|
175
159
|
calculatedObjects: {
|
|
176
160
|
[pk: import("../config/commonCrud.js").Pk]: {
|
|
177
|
-
[rule: string]:
|
|
161
|
+
[rule: string]: any;
|
|
178
162
|
};
|
|
179
163
|
};
|
|
180
164
|
/**
|
|
181
|
-
*
|
|
165
|
+
* The rules for the calculated objects.
|
|
182
166
|
*/
|
|
183
167
|
calculatedObjectsRules: ListCalculatedRules;
|
|
184
168
|
/**
|
|
185
|
-
*
|
|
169
|
+
* Whether the parent state objects watch is running.
|
|
186
170
|
*/
|
|
187
171
|
calculatedObjectsParentStateObjectsWatchRunning: boolean;
|
|
188
172
|
/**
|
|
189
|
-
*
|
|
173
|
+
* Whether the calculated objects watch is running.
|
|
190
174
|
*/
|
|
191
175
|
calculatedObjectsWatchRunning: boolean;
|
|
192
176
|
/**
|
|
193
|
-
*
|
|
177
|
+
* Whether the calculated properties are running.
|
|
194
178
|
*/
|
|
195
179
|
calculatedRunning: import("vue").ComputedRef<boolean>;
|
|
196
180
|
/**
|
|
197
|
-
*
|
|
181
|
+
* Whether the list is running.
|
|
198
182
|
*/
|
|
199
183
|
running: import("vue").ComputedRef<boolean>;
|
|
200
184
|
};
|
|
@@ -207,20 +191,19 @@ export type ListCalculatedParentRawState = (import("./listInstance.js").ListInst
|
|
|
207
191
|
*/
|
|
208
192
|
export type ListCalculatedState = import("vue").UnwrapNestedRefs<ListCalculatedParentRawState & ListCalculatedRawState>;
|
|
209
193
|
/**
|
|
210
|
-
* Represents a combined reactive state that includes properties from list related,
|
|
211
|
-
* subscription, and instance modules.
|
|
194
|
+
* Represents a combined reactive state that includes properties from list related, subscription, and instance modules.
|
|
212
195
|
*/
|
|
213
196
|
export type ListCalculatedParentState = import("vue").UnwrapNestedRefs<(import("./listInstance.js").ListInstanceRawState & Partial<import("./listSubscription.js").ListSubscriptionRawState> & Partial<import("./listRelated.js").ListRelatedRawState>)>;
|
|
214
197
|
/**
|
|
215
|
-
*
|
|
198
|
+
* Options to configure the behaviour of the list calculated properties.
|
|
216
199
|
*/
|
|
217
200
|
export type ListCalculatedOptions = {
|
|
218
201
|
/**
|
|
219
|
-
*
|
|
202
|
+
* The parent state that interacts with the calculated objects.
|
|
220
203
|
*/
|
|
221
204
|
parentState: ListCalculatedParentState;
|
|
222
205
|
/**
|
|
223
|
-
*
|
|
206
|
+
* A reactive reference to rules used for dynamic calculations
|
|
224
207
|
* within list objects. Proper setup of this reference ensures that updates are managed reactively, including deep
|
|
225
208
|
* property changes.
|
|
226
209
|
*/
|
|
@@ -231,15 +214,15 @@ export type ListCalculatedOptions = {
|
|
|
231
214
|
*/
|
|
232
215
|
export type ListCalculatedProperties = {
|
|
233
216
|
/**
|
|
234
|
-
*
|
|
217
|
+
* The state for the list calculated property.
|
|
235
218
|
*/
|
|
236
219
|
state: ListCalculatedState;
|
|
237
220
|
/**
|
|
238
|
-
*
|
|
221
|
+
* The parent state object.
|
|
239
222
|
*/
|
|
240
223
|
parentState: ListCalculatedParentState;
|
|
241
224
|
/**
|
|
242
|
-
*
|
|
225
|
+
* Stops composition's effects and cleans up resources.
|
|
243
226
|
*/
|
|
244
227
|
stop: () => void;
|
|
245
228
|
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module use/listFilter.js
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
|
-
* @typedef {import('vue').Ref<import('../use/objectInstance.js').ExistingCrudObject>[]} ObjectsInOrderRefs
|
|
10
|
+
* @typedef {import('vue').Ref<import('../use/objectInstance.js').ExistingCrudObject>[]} ObjectsInOrderRefs - An array of Vue refs to the list's existing objects in their current order.
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
13
|
* @typedef {Function} ListFilterAllowedFilter - A function that returns true if an item should be included.
|
|
@@ -16,10 +16,7 @@
|
|
|
16
16
|
* @typedef {Function} ListFilterExcludedFilter - A function that returns true if an item should be excluded.
|
|
17
17
|
*/
|
|
18
18
|
/**
|
|
19
|
-
* Defines the structure of the reactive state used by the list filter. This state includes both filters and
|
|
20
|
-
* the results of applying these filters to a list.
|
|
21
|
-
*
|
|
22
|
-
* @typedef {object} ListFilterRawState
|
|
19
|
+
* @typedef {object} ListFilterRawState - Defines the structure of the reactive state used by the list filter. This state includes both filters and the results of applying these filters to a list.
|
|
23
20
|
* @property {ListFilterAllowedFilter} [allowedFilter] - Function to determine if an item should be included based on custom logic.
|
|
24
21
|
* @property {ListFilterExcludedFilter} [excludedFilter] - Function to determine if an item should be excluded based on custom logic.
|
|
25
22
|
*/
|
|
@@ -31,43 +28,33 @@
|
|
|
31
28
|
* Partial<import('./listSubscription.js').ListSubscriptionRawState> &
|
|
32
29
|
* Partial<import('./listRelated.js').ListRelatedRawState> &
|
|
33
30
|
* Partial<import('./listCalculated.js').ListCalculatedRawState>
|
|
34
|
-
* )} ListFilterParentRawState
|
|
31
|
+
* )} ListFilterParentRawState - The raw, pre-unwrapped parent state consumed by the list filter mixin, aggregating the upstream list composable states.
|
|
35
32
|
*/
|
|
36
33
|
/**
|
|
37
|
-
* The parent state for a list filter.
|
|
38
|
-
*
|
|
39
34
|
* @typedef {import('vue').UnwrapNestedRefs<(
|
|
40
35
|
* ListFilterParentRawState
|
|
41
|
-
* )>} ListFilterParentState
|
|
36
|
+
* )>} ListFilterParentState - The parent state for a list filter.
|
|
42
37
|
*/
|
|
43
38
|
/**
|
|
44
|
-
* Describes the combined state from various list-related composables that might interact with the list filter.
|
|
45
|
-
*
|
|
46
39
|
* @typedef {import('vue').UnwrapNestedRefs<
|
|
47
40
|
* ListFilterParentRawState &
|
|
48
41
|
* ListFilterRawState
|
|
49
|
-
* >} ListFilterState
|
|
42
|
+
* >} ListFilterState - Describes the combined state from various list-related composables that might interact with the list filter.
|
|
50
43
|
*/
|
|
51
44
|
/**
|
|
52
|
-
* Configuration options for initializing a list filter. Includes references to the parent state and filter functions.
|
|
53
|
-
*
|
|
54
|
-
* @typedef {object} ListFilterOptions
|
|
45
|
+
* @typedef {object} ListFilterOptions - Configuration options for initializing a list filter. Includes references to the parent state and filter functions.
|
|
55
46
|
* @property {ListFilterParentState} parentState - The parent state.
|
|
56
47
|
* @property {import('vue').Ref<Function>|Function} [allowedFilter] - A function that returns true if an item should be included, which can be reactive.
|
|
57
48
|
* @property {import('vue').Ref<Function>|Function} [excludedFilter] - A function that returns true if an item should be excluded, which can be reactive.
|
|
58
49
|
*/
|
|
59
50
|
/**
|
|
60
|
-
* The properties of a list filter, including its state and associated Vue composition API utilities.
|
|
61
|
-
*
|
|
62
|
-
* @typedef {object} ListFilterProperties
|
|
51
|
+
* @typedef {object} ListFilterProperties - The properties of a list filter, including its state and associated Vue composition API utilities.
|
|
63
52
|
* @property {ListFilterState} state - The reactive state managing the filter logic and results.
|
|
64
53
|
* @property {ListFilterParentState} parentState - The state of the list being filtered.
|
|
65
54
|
* @property {() => void} stop - A function to stop the effect scope and clean up resources.
|
|
66
55
|
*/
|
|
67
56
|
/**
|
|
68
|
-
* Represents an instance of a list filter, including its state and associated Vue composition API utilities.
|
|
69
|
-
*
|
|
70
|
-
* @typedef {ListFilterProperties} ListFilter
|
|
57
|
+
* @typedef {ListFilterProperties} ListFilter - Represents an instance of a list filter, including its state and associated Vue composition API utilities.
|
|
71
58
|
*
|
|
72
59
|
*/
|
|
73
60
|
/**
|
|
@@ -113,29 +100,34 @@ export function useListFilters(listFilterArgs: {
|
|
|
113
100
|
* @returns {ListFilter} A fully configured list filter instance, providing reactive filtered results.
|
|
114
101
|
*/
|
|
115
102
|
export function useListFilter({ parentState, allowedFilter, excludedFilter }: ListFilterOptions): ListFilter;
|
|
103
|
+
/**
|
|
104
|
+
* An array of Vue refs to the list's existing objects in their current order.
|
|
105
|
+
*/
|
|
116
106
|
export type ObjectsInOrderRefs = import("vue").Ref<import("../use/objectInstance.js").ExistingCrudObject>[];
|
|
117
107
|
/**
|
|
118
|
-
*
|
|
108
|
+
* A function that returns true if an item should be included.
|
|
119
109
|
*/
|
|
120
110
|
export type ListFilterAllowedFilter = Function;
|
|
121
111
|
/**
|
|
122
|
-
*
|
|
112
|
+
* A function that returns true if an item should be excluded.
|
|
123
113
|
*/
|
|
124
114
|
export type ListFilterExcludedFilter = Function;
|
|
125
115
|
/**
|
|
126
|
-
* Defines the structure of the reactive state used by the list filter. This state includes both filters and
|
|
127
|
-
* the results of applying these filters to a list.
|
|
116
|
+
* Defines the structure of the reactive state used by the list filter. This state includes both filters and the results of applying these filters to a list.
|
|
128
117
|
*/
|
|
129
118
|
export type ListFilterRawState = {
|
|
130
119
|
/**
|
|
131
|
-
*
|
|
120
|
+
* Function to determine if an item should be included based on custom logic.
|
|
132
121
|
*/
|
|
133
122
|
allowedFilter?: ListFilterAllowedFilter;
|
|
134
123
|
/**
|
|
135
|
-
*
|
|
124
|
+
* Function to determine if an item should be excluded based on custom logic.
|
|
136
125
|
*/
|
|
137
126
|
excludedFilter?: ListFilterExcludedFilter;
|
|
138
127
|
};
|
|
128
|
+
/**
|
|
129
|
+
* The raw, pre-unwrapped parent state consumed by the list filter mixin, aggregating the upstream list composable states.
|
|
130
|
+
*/
|
|
139
131
|
export type ListFilterParentRawState = (import("./listInstance.js").ListInstanceRawState & Partial<import("./listSubscription.js").ListSubscriptionRawState> & Partial<import("./listRelated.js").ListRelatedRawState> & Partial<import("./listCalculated.js").ListCalculatedRawState>);
|
|
140
132
|
/**
|
|
141
133
|
* The parent state for a list filter.
|
|
@@ -150,15 +142,15 @@ export type ListFilterState = import("vue").UnwrapNestedRefs<ListFilterParentRaw
|
|
|
150
142
|
*/
|
|
151
143
|
export type ListFilterOptions = {
|
|
152
144
|
/**
|
|
153
|
-
*
|
|
145
|
+
* The parent state.
|
|
154
146
|
*/
|
|
155
147
|
parentState: ListFilterParentState;
|
|
156
148
|
/**
|
|
157
|
-
*
|
|
149
|
+
* A function that returns true if an item should be included, which can be reactive.
|
|
158
150
|
*/
|
|
159
151
|
allowedFilter?: import("vue").Ref<Function> | Function;
|
|
160
152
|
/**
|
|
161
|
-
*
|
|
153
|
+
* A function that returns true if an item should be excluded, which can be reactive.
|
|
162
154
|
*/
|
|
163
155
|
excludedFilter?: import("vue").Ref<Function> | Function;
|
|
164
156
|
};
|
|
@@ -167,15 +159,15 @@ export type ListFilterOptions = {
|
|
|
167
159
|
*/
|
|
168
160
|
export type ListFilterProperties = {
|
|
169
161
|
/**
|
|
170
|
-
*
|
|
162
|
+
* The reactive state managing the filter logic and results.
|
|
171
163
|
*/
|
|
172
164
|
state: ListFilterState;
|
|
173
165
|
/**
|
|
174
|
-
*
|
|
166
|
+
* The state of the list being filtered.
|
|
175
167
|
*/
|
|
176
168
|
parentState: ListFilterParentState;
|
|
177
169
|
/**
|
|
178
|
-
*
|
|
170
|
+
* A function to stop the effect scope and clean up resources.
|
|
179
171
|
*/
|
|
180
172
|
stop: () => void;
|
|
181
173
|
};
|