0.3.3 • Published 1 year ago

vanguard-client v0.3.3

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

Vanguard

vanguard-client, or simply Vanguard, is the Vue 3 client library for the Vanguard Laravel project using InertiaJS. It provides a set of composables to interface with the Vanguard API.

Table of Contents

Installation

To install using NPM:

npm i vanguard-client

It requires any version of Vue 3+, and uses the stable release of InertiaJS 1.0.0. The queryString is a fluent way to interface with search params, and ensures consistency from the server to client.

Composables

useTable

useTable provides the direct interface to the Vanguard Table class, the core functionality of the package. A Table class should be passed to the Inertia rendered page as a property. The composable will then transform it into a reactive object that can be used in the template.

import { useTable } from 'vanguard-client'

defineProps({
    users: Object
})

const usersTable = useTable('users')

The composable requires a first argument, being the name of the property passed from the server. The optional second argument is the properties to search for the key in - this is used to extend the search if the props are nested in an object. The third argument is an optional options parameter to modify the behaviour of the querying composables.

import { useTable } from 'vanguard-client'

const props = defineProps({
    users: Object
})

const usersTable = useTable('users', props, { watch: false })

This will prevent the table from refreshing automatically if a filter or sort is modified, enforcing manual control. The table has the followed properties and methods available:

AttributeTypeDescription
recordKeystringThe key to use as the record identifier
colsArrayThe non-hidden columns to be used as table headings
rowsArrayThe rows to be displayed in the table
metaObjectThe meta data for the rows, dependent on the selected pagination type
actionsObjectThe actions associated with this table
paramsObjectThe search query parameters for the table
sortsArrayThe sorts for the table
filtersArrayThe filters for the table
updateFunctionPerform a manual update of the table using search parameters
getFilterFunctionGet the filter value by name
getSortFunctionGet the sort value by name
resetFunctionReset the query params
currentSortsFunctionGet an array of currently active sorts
currentFiltersFunctionGet an array of currently active filters

useRefinements

useBulk

useActions

useQuery

useQuery provides a

0.3.3

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.1.6

1 year ago

0.1.2

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.5

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago