use/listFilter
Interfaces
ListFilterOptions
Configuration options for initializing a list filter. Includes references to the parent state and filter functions.
Properties
allowedFilter?
optionalallowedFilter?:Function|Ref<Function,Function>
A function that returns true if an item should be included, which can be reactive.
excludedFilter?
optionalexcludedFilter?:Function|Ref<Function,Function>
A function that returns true if an item should be excluded, which can be reactive.
parentState
parentState:
object
The parent state.
calculatedObjects?
optionalcalculatedObjects?:object
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.
Index Signature
[pk: string]: object
calculatedObjectsParentStateObjectsWatchRunning?
optionalcalculatedObjectsParentStateObjectsWatchRunning?:boolean
Whether the parent state objects watch is running.
calculatedObjectsRules?
optionalcalculatedObjectsRules?:ListCalculatedRules
The rules for the calculated objects.
calculatedObjectsWatchRunning?
optionalcalculatedObjectsWatchRunning?:boolean
Whether the calculated objects watch is running.
calculatedRunning?
optionalcalculatedRunning?:boolean
Whether the calculated properties are running.
columnTotals
columnTotals:
ShallowReactive<ColumnTotals>
Column totals for the list.
crud
crud:
object
CRUD handlers and their configurations for the list.
crud.args
args:
Reactive<{ } |TargetArgs>
The arguments to be passed to the crud handlers.
crud.bulkDelete
bulkDelete:
CrudBulkDeleteFn
The bulk delete function.
crud.executeAction
executeAction:
CrudExecuteActionFn
The execute action function.
crud.list
list:
CrudListFn
The list function.
crud.subscribe
subscribe:
CrudListSubscribeFn
The subscribe function.
error
error:
Error
The error that occurred.
errored
errored:
boolean
Whether an error has occurred.
fkForPkAndRule?
optionalfkForPkAndRule?:object
The foreign key for each object pk and rule, crucial for navigating complex data relationships. Each entry is backed by a computed that the reactive proxy unwraps on read.
Index Signature
[pk: string]: object
intendToList?
optionalintendToList?:boolean
If this is true, the list should be fetched, or re-fetched if arguments change.
intendToSubscribe?
optionalintendToSubscribe?:boolean
If this is true, the subscription should start or restart if arguments change.
loading
loading:
boolean
Whether the component is loading.
objAndKeyForPkAndRule?
optionalobjAndKeyForPkAndRule?:object
Maps each object pk and rule to a tuple consisting of the related object and its respective key, facilitating direct data manipulation. Reads through the reactive state unwrap the computed to the tuple itself, so .value is not used.
Index Signature
[pk: string]: object
objects
objects:
ObjectsByPk
The list objects stored by their pks.
objectsInOrder
objectsInOrder:
ExistingCrudObject[]
The objects in the order specified by the list.
objectsMap
objectsMap:
Map<string,ExistingCrudObject> &Omit<ObjectsMap, keyofMap<any,any>>
The map of objects stored by their pks.
objectsVersion
objectsVersion:
number
Increments when the set of object keys changes.
order
order:
string[]
The order of objects in the list.
paginateInfo
paginateInfo:
ShallowReactive<PaginateInfo>
Pagination information for the list.
params
params:
any
Arguments passed to the server for listing operations.
pkKey
pkKey:
string
The primary key field for the list objects.
relatedObjects?
optionalrelatedObjects?:object
The related 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 related object (or array of related objects) and never carry a .value.
Index Signature
[pk: string]: object
relatedObjectsParentStateObjectsWatchRunning?
optionalrelatedObjectsParentStateObjectsWatchRunning?:boolean
Flags whether the watch on parent state objects is currently active, ensuring updates trigger as needed.
relatedObjectsRules?
optionalrelatedObjectsRules?:ListRelatedRules
Defines the rules for establishing relationships, such as foreign key links and sorting orders.
relatedObjectsWatchRunning?
optionalrelatedObjectsWatchRunning?:boolean
Indicates if watches on the related objects themselves are active, managing updates efficiently.
relatedRunning?
optionalrelatedRunning?:boolean
Signals whether any computations related to object relationships are currently in progress.
running?
optionalrunning?:boolean
General flag that indicates if the list-related logic is processing, used to manage UI feedback or prevent concurrent operations.
subscribed?
optionalsubscribed?:boolean
Whether the subscription is active.
ListFilterProperties
The properties of a list filter, including its state and associated Vue composition API utilities.
Properties
parentState
parentState:
object
The state of the list being filtered.
calculatedObjects?
optionalcalculatedObjects?:object
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.
Index Signature
[pk: string]: object
calculatedObjectsParentStateObjectsWatchRunning?
optionalcalculatedObjectsParentStateObjectsWatchRunning?:boolean
Whether the parent state objects watch is running.
calculatedObjectsRules?
optionalcalculatedObjectsRules?:ListCalculatedRules
The rules for the calculated objects.
calculatedObjectsWatchRunning?
optionalcalculatedObjectsWatchRunning?:boolean
Whether the calculated objects watch is running.
calculatedRunning?
optionalcalculatedRunning?:boolean
Whether the calculated properties are running.
columnTotals
columnTotals:
ShallowReactive<ColumnTotals>
Column totals for the list.
crud
crud:
object
CRUD handlers and their configurations for the list.
crud.args
args:
Reactive<{ } |TargetArgs>
The arguments to be passed to the crud handlers.
crud.bulkDelete
bulkDelete:
CrudBulkDeleteFn
The bulk delete function.
crud.executeAction
executeAction:
CrudExecuteActionFn
The execute action function.
crud.list
list:
CrudListFn
The list function.
crud.subscribe
subscribe:
CrudListSubscribeFn
The subscribe function.
error
error:
Error
The error that occurred.
errored
errored:
boolean
Whether an error has occurred.
fkForPkAndRule?
optionalfkForPkAndRule?:object
The foreign key for each object pk and rule, crucial for navigating complex data relationships. Each entry is backed by a computed that the reactive proxy unwraps on read.
Index Signature
[pk: string]: object
intendToList?
optionalintendToList?:boolean
If this is true, the list should be fetched, or re-fetched if arguments change.
intendToSubscribe?
optionalintendToSubscribe?:boolean
If this is true, the subscription should start or restart if arguments change.
loading
loading:
boolean
Whether the component is loading.
objAndKeyForPkAndRule?
optionalobjAndKeyForPkAndRule?:object
Maps each object pk and rule to a tuple consisting of the related object and its respective key, facilitating direct data manipulation. Reads through the reactive state unwrap the computed to the tuple itself, so .value is not used.
Index Signature
[pk: string]: object
objects
objects:
ObjectsByPk
The list objects stored by their pks.
objectsInOrder
objectsInOrder:
ExistingCrudObject[]
The objects in the order specified by the list.
objectsMap
objectsMap:
Map<string,ExistingCrudObject> &Omit<ObjectsMap, keyofMap<any,any>>
The map of objects stored by their pks.
objectsVersion
objectsVersion:
number
Increments when the set of object keys changes.
order
order:
string[]
The order of objects in the list.
paginateInfo
paginateInfo:
ShallowReactive<PaginateInfo>
Pagination information for the list.
params
params:
any
Arguments passed to the server for listing operations.
pkKey
pkKey:
string
The primary key field for the list objects.
relatedObjects?
optionalrelatedObjects?:object
The related 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 related object (or array of related objects) and never carry a .value.
Index Signature
[pk: string]: object
relatedObjectsParentStateObjectsWatchRunning?
optionalrelatedObjectsParentStateObjectsWatchRunning?:boolean
Flags whether the watch on parent state objects is currently active, ensuring updates trigger as needed.
relatedObjectsRules?
optionalrelatedObjectsRules?:ListRelatedRules
Defines the rules for establishing relationships, such as foreign key links and sorting orders.
relatedObjectsWatchRunning?
optionalrelatedObjectsWatchRunning?:boolean
Indicates if watches on the related objects themselves are active, managing updates efficiently.
relatedRunning?
optionalrelatedRunning?:boolean
Signals whether any computations related to object relationships are currently in progress.
running?
optionalrunning?:boolean
General flag that indicates if the list-related logic is processing, used to manage UI feedback or prevent concurrent operations.
subscribed?
optionalsubscribed?:boolean
Whether the subscription is active.
state
state:
object
The reactive state managing the filter logic and results.
allowedFilter?
optionalallowedFilter?:Function
Function to determine if an item should be included based on custom logic.
calculatedObjects?
optionalcalculatedObjects?:object
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.
Index Signature
[pk: string]: object
calculatedObjectsParentStateObjectsWatchRunning?
optionalcalculatedObjectsParentStateObjectsWatchRunning?:boolean
Whether the parent state objects watch is running.
calculatedObjectsRules?
optionalcalculatedObjectsRules?:ListCalculatedRules
The rules for the calculated objects.
calculatedObjectsWatchRunning?
optionalcalculatedObjectsWatchRunning?:boolean
Whether the calculated objects watch is running.
calculatedRunning?
optionalcalculatedRunning?:boolean
Whether the calculated properties are running.
columnTotals
columnTotals:
ShallowReactive<ColumnTotals>
Column totals for the list.
crud
crud:
object
CRUD handlers and their configurations for the list.
crud.args
args:
Reactive<{ } |TargetArgs>
The arguments to be passed to the crud handlers.
crud.bulkDelete
bulkDelete:
CrudBulkDeleteFn
The bulk delete function.
crud.executeAction
executeAction:
CrudExecuteActionFn
The execute action function.
crud.list
list:
CrudListFn
The list function.
crud.subscribe
subscribe:
CrudListSubscribeFn
The subscribe function.
error
error:
Error
The error that occurred.
errored
errored:
boolean
Whether an error has occurred.
excludedFilter?
optionalexcludedFilter?:Function
Function to determine if an item should be excluded based on custom logic.
fkForPkAndRule?
optionalfkForPkAndRule?:object
The foreign key for each object pk and rule, crucial for navigating complex data relationships. Each entry is backed by a computed that the reactive proxy unwraps on read.
Index Signature
[pk: string]: object
intendToList?
optionalintendToList?:boolean
If this is true, the list should be fetched, or re-fetched if arguments change.
intendToSubscribe?
optionalintendToSubscribe?:boolean
If this is true, the subscription should start or restart if arguments change.
loading
loading:
boolean
Whether the component is loading.
objAndKeyForPkAndRule?
optionalobjAndKeyForPkAndRule?:object
Maps each object pk and rule to a tuple consisting of the related object and its respective key, facilitating direct data manipulation. Reads through the reactive state unwrap the computed to the tuple itself, so .value is not used.
Index Signature
[pk: string]: object
objects
objects:
ObjectsByPk
The list objects stored by their pks.
objectsInOrder
objectsInOrder:
ExistingCrudObject[]
The objects in the order specified by the list.
objectsMap
objectsMap:
Map<string,ExistingCrudObject> &Omit<ObjectsMap, keyofMap<any,any>>
The map of objects stored by their pks.
objectsVersion
objectsVersion:
number
Increments when the set of object keys changes.
order
order:
string[]
The order of objects in the list.
paginateInfo
paginateInfo:
ShallowReactive<PaginateInfo>
Pagination information for the list.
params
params:
any
Arguments passed to the server for listing operations.
pkKey
pkKey:
string
The primary key field for the list objects.
relatedObjects?
optionalrelatedObjects?:object
The related 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 related object (or array of related objects) and never carry a .value.
Index Signature
[pk: string]: object
relatedObjectsParentStateObjectsWatchRunning?
optionalrelatedObjectsParentStateObjectsWatchRunning?:boolean
Flags whether the watch on parent state objects is currently active, ensuring updates trigger as needed.
relatedObjectsRules?
optionalrelatedObjectsRules?:ListRelatedRules
Defines the rules for establishing relationships, such as foreign key links and sorting orders.
relatedObjectsWatchRunning?
optionalrelatedObjectsWatchRunning?:boolean
Indicates if watches on the related objects themselves are active, managing updates efficiently.
relatedRunning?
optionalrelatedRunning?:boolean
Signals whether any computations related to object relationships are currently in progress.
running?
optionalrunning?:boolean
General flag that indicates if the list-related logic is processing, used to manage UI feedback or prevent concurrent operations.
subscribed?
optionalsubscribed?:boolean
Whether the subscription is active.
stop
stop: () =>
void
A function to stop the effect scope and clean up resources.
Returns
void
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.
Properties
allowedFilter?
optionalallowedFilter?:Function
Function to determine if an item should be included based on custom logic.
excludedFilter?
optionalexcludedFilter?:Function
Function to determine if an item should be excluded based on custom logic.
Type Aliases
ListFilter
ListFilter =
ListFilterProperties
Represents an instance of a list filter, including its state and associated Vue composition API utilities.
Type Parameters
ListFilterAllowedFilter
ListFilterAllowedFilter =
Function
A function that returns true if an item should be included.
Type Parameters
ListFilterExcludedFilter
ListFilterExcludedFilter =
Function
A function that returns true if an item should be excluded.
Type Parameters
ListFilterParentRawState
ListFilterParentRawState =
ListInstanceRawState&Partial<ListSubscriptionRawState> &Partial<ListRelatedRawState> &Partial<ListCalculatedRawState>
The raw, pre-unwrapped parent state consumed by the list filter mixin, aggregating the upstream list composable states.
Type Parameters
ListFilterParentState
ListFilterParentState =
UnwrapNestedRefs
The parent state for a list filter.
Type Parameters
ListFilterState
ListFilterState =
UnwrapNestedRefs
Describes the combined state from various list-related composables that might interact with the list filter.
Type Parameters
ObjectsInOrderRefs
ObjectsInOrderRefs =
Ref[]
An array of Vue refs to the list's existing objects in their current order.
Type Parameters
Functions
useListFilter()
useListFilter(
options):ListFilterProperties
Initializes and manages a list filter instance, setting up reactive states and dependencies to dynamically adjust the visible items based on the provided filter functions.
Parameters
options
The options for the list filter including filters and parent state.
Returns
A fully configured list filter instance, providing reactive filtered results.
Example
<script setup>
import { defineProps, reactive, toRef, computed } from 'vue';
import { useListInstance, useListFilter } from '@arrai-innovations/reactive-helpers';
const props = defineProps({
someListFilter: String
});
const listInstance = useListInstance({ props });
const filterConditions = reactive({
allowedFilter: (item) => item.isActive,
excludedFilter: (item) => !item.isValid
});
const listFilter = useListFilter({
parentState: listInstance.state,
...filterConditions
});
// listFilter.state.objectsInOrder now contains the reactive filtered items from listInstance.state.objectsInOrder
</script>useListFilters()
useListFilters(
listFilterArgs):object
Helper function to create multiple instances of list filters based on provided configurations.
Parameters
listFilterArgs
Configuration for each filter instance.
Returns
object
An object containing instances of list filters.