@arrai-innovations/reactive-helpers 21.1.2 → 22.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +28 -0
- package/README.md +109 -21
- package/config/commonCrud.js +4 -6
- package/config/listCrud.js +20 -22
- package/config/objectCrud.js +30 -37
- package/package.json +93 -89
- package/types/config/listCrud.d.ts +83 -26
- package/types/config/objectCrud.d.ts +123 -44
- package/types/use/cancellableIntent.d.ts +27 -31
- package/types/use/combineClasses.d.ts +4 -1
- package/types/use/error.d.ts +39 -19
- package/types/use/list.d.ts +27 -26
- package/types/use/listCalculated.d.ts +21 -39
- package/types/use/listFilter.d.ts +25 -33
- package/types/use/listInstance.d.ts +88 -80
- package/types/use/listRelated.d.ts +26 -46
- package/types/use/listSearch.d.ts +54 -52
- package/types/use/listSort.d.ts +25 -39
- package/types/use/listSubscription.d.ts +28 -35
- 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 +30 -27
- package/types/use/objectInstance.d.ts +67 -73
- package/types/use/objectRelated.d.ts +41 -33
- package/types/use/objectSubscription.d.ts +32 -43
- 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/cancellablePromise.d.ts +5 -5
- package/types/utils/classes.d.ts +7 -1
- package/types/utils/deepUnref.d.ts +1 -1
- 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 +27 -7
- package/use/combineClasses.js +1 -1
- package/use/error.js +10 -14
- package/use/list.js +6 -18
- package/use/listCalculated.js +7 -22
- package/use/listFilter.js +8 -21
- package/use/listInstance.js +25 -44
- package/use/listRelated.js +9 -28
- package/use/listSearch.js +8 -17
- package/use/listSort.js +27 -41
- package/use/listSubscription.js +10 -25
- package/use/loading.js +5 -7
- package/use/loadingError.js +3 -3
- package/use/object.js +7 -19
- package/use/objectCalculated.js +9 -15
- package/use/objectInstance.js +46 -47
- package/use/objectRelated.js +13 -20
- package/use/objectSubscription.js +11 -25
- package/use/proxyError.js +10 -10
- package/use/proxyLoading.js +5 -5
- package/use/proxyLoadingError.js +10 -8
- package/use/search.js +5 -11
- package/utils/assignReactiveObject.js +3 -3
- package/utils/cancellablePromise.js +4 -4
- package/utils/classes.js +2 -2
- package/utils/deepUnref.js +1 -5
- package/utils/isReactiveTyped.js +2 -0
- package/utils/keyDiff.js +1 -3
- package/utils/relatedCalculatedHelpers.js +2 -0
package/types/use/list.d.ts
CHANGED
|
@@ -30,81 +30,84 @@ export function useList({ props, handlers, searchThrottle, sortThrottleWait, sea
|
|
|
30
30
|
*/
|
|
31
31
|
export type ListRawProps = {
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* The arguments to pass to the registered list crud handlers, related to the list itself.
|
|
34
34
|
*/
|
|
35
35
|
params: object;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* The primary key for the list items.
|
|
38
38
|
*/
|
|
39
39
|
pkKey: string;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* General arguments to pass to the registered list crud handlers, often related to endpoints.
|
|
42
42
|
*/
|
|
43
43
|
target: object;
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Indicates whether the list should be fetched immediately.
|
|
46
46
|
*/
|
|
47
47
|
intendToList: boolean;
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* Indicates whether changes to the list should be subscribed to.
|
|
50
50
|
*/
|
|
51
51
|
intendToSubscribe: boolean;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* Defines rules for associating related objects with list items.
|
|
54
54
|
*/
|
|
55
55
|
relatedObjectsRules: import("./listRelated.js").ListRelatedRules;
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* Defines rules for dynamically calculating properties of list items.
|
|
58
58
|
*/
|
|
59
59
|
calculatedObjectsRules: import("./listCalculated.js").ListCalculatedRules;
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* Function or rule to determine if an item should be included based on inclusion criteria.
|
|
62
62
|
*/
|
|
63
63
|
allowedFilter: import("./listFilter.js").ListFilterAllowedFilter;
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* Function or rule to determine if an item should be excluded based on exclusion criteria.
|
|
66
66
|
*/
|
|
67
67
|
excludedFilter: import("./listFilter.js").ListFilterExcludedFilter;
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
69
|
+
* Defines the properties and conditions used to filter the list via text search.
|
|
70
70
|
*/
|
|
71
71
|
textSearchRules: import("./listSearch.js").TextSearchRules;
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
73
|
+
* Current text query used for filtering the list.
|
|
74
74
|
*/
|
|
75
75
|
textSearchValue: string;
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* FlexSearch document configuration options for advanced searching capabilities.
|
|
78
78
|
*/
|
|
79
79
|
customDocumentOptions: object;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* Additional search options for FlexSearch.
|
|
82
82
|
*/
|
|
83
83
|
customSearchOptions: object;
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
85
|
+
* Sorting rules that define the order of list items.
|
|
86
86
|
*/
|
|
87
87
|
orderByRules: import("./listSort.js").OrderByRule[];
|
|
88
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* The configuration options used to create a fully managed list via useList.
|
|
91
|
+
*/
|
|
89
92
|
export type ListOptions = {
|
|
90
93
|
/**
|
|
91
|
-
*
|
|
94
|
+
* The properties for configuring the list.
|
|
92
95
|
*/
|
|
93
96
|
props: ListRawProps;
|
|
94
97
|
/**
|
|
95
|
-
*
|
|
98
|
+
* Additional handlers to be included in the list manager.
|
|
96
99
|
*/
|
|
97
100
|
handlers?: import("../config/listCrud.js").ListCrudHandlers;
|
|
98
101
|
/**
|
|
99
|
-
*
|
|
102
|
+
* The throttle time for text search.
|
|
100
103
|
*/
|
|
101
104
|
searchThrottle?: number;
|
|
102
105
|
/**
|
|
103
|
-
*
|
|
106
|
+
* The throttle time for sorting.
|
|
104
107
|
*/
|
|
105
108
|
sortThrottleWait?: number;
|
|
106
109
|
/**
|
|
107
|
-
*
|
|
110
|
+
* Indicates whether all items should be shown when the search query is empty.
|
|
108
111
|
*/
|
|
109
112
|
searchShowAllWhenEmpty?: boolean;
|
|
110
113
|
};
|
|
@@ -125,25 +128,23 @@ export type ListManaged = {
|
|
|
125
128
|
*/
|
|
126
129
|
export type ListFunctions = (import("./listInstance.js").ListInstanceFunctions & import("./listSubscription.js").ListSubscriptionFunctions);
|
|
127
130
|
/**
|
|
128
|
-
* Encapsulates properties relevant to the overall management of list-related hooks, including state, direct access to hooks,
|
|
129
|
-
* and scoped effects.
|
|
131
|
+
* Encapsulates properties relevant to the overall management of list-related hooks, including state, direct access to hooks, and scoped effects.
|
|
130
132
|
*/
|
|
131
133
|
export type ListManagerProperties = {
|
|
132
134
|
/**
|
|
133
|
-
*
|
|
135
|
+
* A readonly reference to the managed list hooks.
|
|
134
136
|
*/
|
|
135
137
|
managed: ListManaged;
|
|
136
138
|
/**
|
|
137
|
-
*
|
|
139
|
+
* Represents the final reactive state in the list processing chain.
|
|
138
140
|
*/
|
|
139
141
|
state: import("./listSort.js").ListSortState;
|
|
140
142
|
/**
|
|
141
|
-
*
|
|
143
|
+
* A function to stop the effect scope and clean up resources.
|
|
142
144
|
*/
|
|
143
145
|
stop: () => void;
|
|
144
146
|
};
|
|
145
147
|
/**
|
|
146
|
-
* Combines functionality and properties to represent a fully managed list instance,
|
|
147
|
-
* orchestrating various functionalities such as sorting, searching, filtering, and state management.
|
|
148
|
+
* Combines functionality and properties to represent a fully managed list instance, orchestrating various functionalities such as sorting, searching, filtering, and state management.
|
|
148
149
|
*/
|
|
149
150
|
export type ListManager = ListFunctions & ListManagerProperties;
|
|
@@ -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,
|
|
@@ -21,7 +17,7 @@
|
|
|
21
17
|
* [rule: string]: import('vue').ComputedRef<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.
|
|
25
21
|
*/
|
|
26
22
|
/**
|
|
27
23
|
* The raw state for a list calculated.
|
|
@@ -36,31 +32,24 @@
|
|
|
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.
|
|
@@ -72,17 +61,13 @@
|
|
|
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.
|
|
@@ -154,9 +139,7 @@ export function useListCalculateds(listCalculatedArgs: {
|
|
|
154
139
|
*/
|
|
155
140
|
export function useListCalculated({ parentState, calculatedObjectsRules }: ListCalculatedOptions): ListCalculated;
|
|
156
141
|
/**
|
|
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.
|
|
142
|
+
* 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.
|
|
160
143
|
*/
|
|
161
144
|
export type ListCalculatedRules = {
|
|
162
145
|
[rule: string]: (object: import("../use/objectInstance.js").ExistingCrudObject, relatedObject: {
|
|
@@ -166,11 +149,11 @@ export type ListCalculatedRules = {
|
|
|
166
149
|
}) => any;
|
|
167
150
|
};
|
|
168
151
|
/**
|
|
169
|
-
*
|
|
152
|
+
* The raw state for a list calculated property.
|
|
170
153
|
*/
|
|
171
154
|
export type ListCalculatedRawState = {
|
|
172
155
|
/**
|
|
173
|
-
*
|
|
156
|
+
* The calculated objects.
|
|
174
157
|
*/
|
|
175
158
|
calculatedObjects: {
|
|
176
159
|
[pk: import("../config/commonCrud.js").Pk]: {
|
|
@@ -178,23 +161,23 @@ export type ListCalculatedRawState = {
|
|
|
178
161
|
};
|
|
179
162
|
};
|
|
180
163
|
/**
|
|
181
|
-
*
|
|
164
|
+
* The rules for the calculated objects.
|
|
182
165
|
*/
|
|
183
166
|
calculatedObjectsRules: ListCalculatedRules;
|
|
184
167
|
/**
|
|
185
|
-
*
|
|
168
|
+
* Whether the parent state objects watch is running.
|
|
186
169
|
*/
|
|
187
170
|
calculatedObjectsParentStateObjectsWatchRunning: boolean;
|
|
188
171
|
/**
|
|
189
|
-
*
|
|
172
|
+
* Whether the calculated objects watch is running.
|
|
190
173
|
*/
|
|
191
174
|
calculatedObjectsWatchRunning: boolean;
|
|
192
175
|
/**
|
|
193
|
-
*
|
|
176
|
+
* Whether the calculated properties are running.
|
|
194
177
|
*/
|
|
195
178
|
calculatedRunning: import("vue").ComputedRef<boolean>;
|
|
196
179
|
/**
|
|
197
|
-
*
|
|
180
|
+
* Whether the list is running.
|
|
198
181
|
*/
|
|
199
182
|
running: import("vue").ComputedRef<boolean>;
|
|
200
183
|
};
|
|
@@ -207,20 +190,19 @@ export type ListCalculatedParentRawState = (import("./listInstance.js").ListInst
|
|
|
207
190
|
*/
|
|
208
191
|
export type ListCalculatedState = import("vue").UnwrapNestedRefs<ListCalculatedParentRawState & ListCalculatedRawState>;
|
|
209
192
|
/**
|
|
210
|
-
* Represents a combined reactive state that includes properties from list related,
|
|
211
|
-
* subscription, and instance modules.
|
|
193
|
+
* Represents a combined reactive state that includes properties from list related, subscription, and instance modules.
|
|
212
194
|
*/
|
|
213
195
|
export type ListCalculatedParentState = import("vue").UnwrapNestedRefs<(import("./listInstance.js").ListInstanceRawState & Partial<import("./listSubscription.js").ListSubscriptionRawState> & Partial<import("./listRelated.js").ListRelatedRawState>)>;
|
|
214
196
|
/**
|
|
215
|
-
*
|
|
197
|
+
* Options to configure the behavior of the list calculated properties.
|
|
216
198
|
*/
|
|
217
199
|
export type ListCalculatedOptions = {
|
|
218
200
|
/**
|
|
219
|
-
*
|
|
201
|
+
* The parent state that interacts with the calculated objects.
|
|
220
202
|
*/
|
|
221
203
|
parentState: ListCalculatedParentState;
|
|
222
204
|
/**
|
|
223
|
-
*
|
|
205
|
+
* A reactive reference to rules used for dynamic calculations
|
|
224
206
|
* within list objects. Proper setup of this reference ensures that updates are managed reactively, including deep
|
|
225
207
|
* property changes.
|
|
226
208
|
*/
|
|
@@ -231,15 +213,15 @@ export type ListCalculatedOptions = {
|
|
|
231
213
|
*/
|
|
232
214
|
export type ListCalculatedProperties = {
|
|
233
215
|
/**
|
|
234
|
-
*
|
|
216
|
+
* The state for the list calculated property.
|
|
235
217
|
*/
|
|
236
218
|
state: ListCalculatedState;
|
|
237
219
|
/**
|
|
238
|
-
*
|
|
220
|
+
* The parent state object.
|
|
239
221
|
*/
|
|
240
222
|
parentState: ListCalculatedParentState;
|
|
241
223
|
/**
|
|
242
|
-
*
|
|
224
|
+
* Stops composition's effects and cleans up resources.
|
|
243
225
|
*/
|
|
244
226
|
stop: () => void;
|
|
245
227
|
};
|
|
@@ -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
|
};
|