Skip to content

use/list

Classes

ListError

Custom error class for use list errors.

Extends

  • Error

Constructors

Constructor

new ListError(message, code): ListError

Creates a new ListError.

Parameters
message

string

The error message.

code

string

The error code.

Returns

ListError

Overrides

Error.constructor

Properties

code

code: string

name

name: string

Inherited from

Error.name

Interfaces

ListManagerProperties

Encapsulates properties relevant to the overall management of list-related hooks, including state, direct access to hooks, and scoped effects.

Properties

managed

managed: ListManaged

A readonly reference to the managed list hooks.

state

state: object

Represents the final reactive state in the list processing chain.

allowedFilter?

optional allowedFilter?: Function

Function to determine if an item should be included based on custom logic.

calculatedObjects?

optional calculatedObjects?: 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?

optional calculatedObjectsParentStateObjectsWatchRunning?: boolean

Whether the parent state objects watch is running.

calculatedObjectsRules?

optional calculatedObjectsRules?: ListCalculatedRules

The rules for the calculated objects.

calculatedObjectsWatchRunning?

optional calculatedObjectsWatchRunning?: boolean

Whether the calculated objects watch is running.

calculatedRunning?

optional calculatedRunning?: 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.

customDocumentOptions?

optional customDocumentOptions?: any

Configuration options for the search document, used by FlexSearch.

customSearchOptions?

optional customSearchOptions?: any

Additional search options for FlexSearch.

error

error: Error

The error that occurred.

errored

errored: boolean

Whether an error has occurred.

excludedFilter?

optional excludedFilter?: Function

Function to determine if an item should be excluded based on custom logic.

fkForPkAndRule?

optional fkForPkAndRule?: 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?

optional intendToList?: boolean

If this is true, the list should be fetched, or re-fetched if arguments change.

intendToSubscribe?

optional intendToSubscribe?: boolean

If this is true, the subscription should start or restart if arguments change.

loading

loading: boolean

Whether the component is loading.

objAndKeyForPkAndRule?

optional objAndKeyForPkAndRule?: 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

objectIndexes?

optional objectIndexes?: any

Indexes built for quick search across objects based on rules.

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, keyof Map<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.

orderByDesc

orderByDesc: boolean[]

Flags indicating whether each sort criterion is in descending order.

orderByRules

orderByRules: object[]

Current sorting rules applied to 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?

optional relatedObjects?: 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?

optional relatedObjectsParentStateObjectsWatchRunning?: boolean

Flags whether the watch on parent state objects is currently active, ensuring updates trigger as needed.

relatedObjectsRules?

optional relatedObjectsRules?: ListRelatedRules

Defines the rules for establishing relationships, such as foreign key links and sorting orders.

relatedObjectsWatchRunning?

optional relatedObjectsWatchRunning?: boolean

Indicates if watches on the related objects themselves are active, managing updates efficiently.

relatedRunning?

optional relatedRunning?: boolean

Signals whether any computations related to object relationships are currently in progress.

running

running: boolean

General flag that indicates if the list-related logic is processing, used to manage UI feedback or prevent concurrent operations.

searched?

optional searched?: boolean

Flag indicating if a search has been performed.

subscribed?

optional subscribed?: boolean

Whether the subscription is active.

textSearchRules?

optional textSearchRules?: any

Rules defining how text search should be applied on list items. Each rule specifies a key and a function to extract the searchable text.

textSearchValue?

optional textSearchValue?: string

The current value used for searching.

stop

stop: () => void

A function to stop the effect scope and clean up resources.

Returns

void


ListOptions

The configuration options used to create a fully managed list via useList.

Properties

handlers?

optional handlers?: ListCrudHandlers

Additional handlers to be included in the list manager.

props

props: ListRawProps

The properties for configuring the list.

searchShowAllWhenEmpty?

optional searchShowAllWhenEmpty?: boolean

Indicates whether all items should be shown when the search query is empty.

searchThrottle?

optional searchThrottle?: number

The throttle time for text search.

sortThrottleWait?

optional sortThrottleWait?: number

The throttle time for sorting.


ListRawProps

Defines properties for configuring the list management system.

Properties

allowedFilter

allowedFilter: Function

Function or rule to determine if an item should be included based on inclusion criteria.

calculatedObjectsRules

calculatedObjectsRules: ListCalculatedRules

Defines rules for dynamically calculating properties of list items.

customDocumentOptions

customDocumentOptions: any

FlexSearch document configuration options for advanced searching capabilities.

customSearchOptions

customSearchOptions: any

Additional search options for FlexSearch.

excludedFilter

excludedFilter: Function

Function or rule to determine if an item should be excluded based on exclusion criteria.

intendToList

intendToList: boolean

Indicates whether the list should be fetched immediately.

intendToSubscribe

intendToSubscribe: boolean

Indicates whether changes to the list should be subscribed to.

orderByRules

orderByRules: OrderByRule[]

Sorting rules that define the order of list items.

params

params: any

The arguments to pass to the registered list crud handlers, related to the list itself.

pkKey

pkKey: string

The primary key for the list items.

relatedObjectsRules

relatedObjectsRules: ListRelatedRules

Defines rules for associating related objects with list items.

target

target: any

General arguments to pass to the registered list crud handlers, often related to endpoints.

textSearchRules

textSearchRules: TextSearchRules

Defines the properties and conditions used to filter the list via text search.

textSearchValue

textSearchValue: string

Current text query used for filtering the list.

Type Aliases

ListFunctions

ListFunctions = ListInstanceFunctions & ListSubscriptionFunctions

Aggregates all functions provided by various list-related composables, allowing for a unified approach to calling these methods.

Type Parameters


ListManaged

ListManaged = object

Holds references to instances of all list-related composables, facilitating direct access and management.

Type Parameters

Type Declaration

listCalculated

listCalculated: ListCalculated

listFilter

listFilter: ListFilter

listInstance

listInstance: ListInstance

listRelated

listRelated: ListRelated

listSearch

listSearch: ListSearch

listSort

listSort: ListSort

listSubscription

listSubscription: ListSubscription


ListManager

ListManager = ListFunctions & ListManagerProperties

Combines functionality and properties to represent a fully managed list instance, orchestrating various functionalities such as sorting, searching, filtering, and state management.

Type Parameters

Functions

useList()

useList(options): ListManager

Creates and manages an enhanced list instance by orchestrating various list-related composables. It ensures seamless integration of all list functionalities such as sorting, searching, filtering, and advanced state management.

Parameters

options

ListOptions

The options for the list./.

Returns

ListManager

  • The managed stack of list-related composable functions.

Example

vue

Throws

  • If required options are not provided.

useLists()

useLists(listOptions): object

Initializes multiple list management instances with provided configurations.

Parameters

listOptions

The options for initializing multiple list instances.

Returns

object

  • The managed list instances.