1.1.0 • Published 3 years ago

vue-wp-resource-library v1.1.0

Weekly downloads
5
License
ISC
Repository
github
Last release
3 years ago

yarn run v1.22.10 $ jsdoc2md resource-library.js

ResourceLibrary

Vue.js Resource Library for Taco WordPress

ResourceLibrary~ResourceLibrary : object

Kind: inner namespace of ResourceLibrary
Properties

NameTypeDescription
propsObjectThe initial properties
props.vernumberUpdate to invalidate cache
props.post_typestringThe type of posts to query
props.per_pagenumberNumber of results per page
props.meta_fieldsstringMeta fields to include
props.initial_pagestringThe initial page of results to load
props.initial_searchstringThe initial search terms
props.initial_orderstringThe initial order direction
props.initial_orderbystringThe initial field to order on
props.initial_taxonomiesObjectThe initial taxonomies available to filter on. You must pass an empty array or inital data for each taxonomy to enable it on the instance
props.initial_meta_queryObjectThe initial meta query

ResourceLibrary~ResourceLibrary : object

Kind: inner namespace of ResourceLibrary
Properties

NameTypeDescription
resourcesArray.<Object>Resources processes the raw REST response and delivers it in a useful way to the front end. This matches the properties that are available in WordPress from getPost() with a few extra convenience properties
resources.getFeaturedImage(size)functionGet the featured image at the requested size name (e.g. full, medium). This must be defined in WordPress
resources.termsArray.<Array.<Object>>Convenience access for taxonomy terms. The outer array is indexed by taxonomy, and the inner array contains the terms on this

ResourceLibrary~ResourceLibrary : object

Kind: inner namespace of ResourceLibrary
Properties

NameTypeDescription
pagesArray.<string>An array of pagination data, including ellipses. Always show 9 pages and insert ellipses in the correct spot.

ResourceLibrary~afterCreated()

Override in order to call method after component is created

Kind: inner method of ResourceLibrary

ResourceLibrary~onInitialLoad()

Override in order to call method on initial load

Kind: inner method of ResourceLibrary

ResourceLibrary~onParamsChange()

Override in order to call method after params change but not on initial load

Kind: inner method of ResourceLibrary

ResourceLibrary~selectPage(page, callback)

Select which page of results to display

Kind: inner method of ResourceLibrary

ParamTypeDescription
pagenumberThe page number
callbackfunction

ResourceLibrary~setSearchTerms(search, callback)

Set search terms

Kind: inner method of ResourceLibrary

ParamTypeDescription
searchstringSearch terms
callbackfunction

ResourceLibrary~resetTerms(taxonomy, callback)

Reset taxonomy terms

Kind: inner method of ResourceLibrary

ParamTypeDescription
taxonomystringThe taxonomy to use
callbackfunction

ResourceLibrary~addTerms(taxonomy, terms, callback)

Add taxonomy terms

Kind: inner method of ResourceLibrary

ParamTypeDescription
taxonomystringThe taxonomy to use
termsinteger | Array.<number>The ID of the taxonomy to add
callbackfunction

ResourceLibrary~removeTerms(taxonomy, terms, callback)

Remove taxonomy terms

Kind: inner method of ResourceLibrary

ParamTypeDescription
taxonomystringThe taxonomy to use
termsnumber | Array.<number>The ID of the taxonomy to remove
callbackfunction

ResourceLibrary~setTerms(taxonomy, terms, callback)

Set taxonomy terms. This overwrites any current taxonomy temms.

Kind: inner method of ResourceLibrary

ParamTypeDescription
taxonomystringThe taxonomy to use
termsnumber | Array.<number>The ID of the taxonomy to remove
callbackfunction

ResourceLibrary~joinTerms(item, taxonomy, separator)

Helper function to join taxonomy terms into a string to display on the front end

Kind: inner method of ResourceLibrary

ParamTypeDescription
itemObjectThe item to join terms from
taxonomystringThe taxonomy to use
separatorstringThe separator to use

ResourceLibrary~setOrder(order, callback)

Set whether to order results in ascending or descending order

Kind: inner method of ResourceLibrary

ParamTypeDescription
orderstringOrder direction. One of "asc" or "desc"
callbackfunction

ResourceLibrary~setOrderBy(orderby, callback)

Set the field to order results by

Kind: inner method of ResourceLibrary

ParamTypeDescription
orderbystringThe field to order by
callbackfunction

ResourceLibrary~selectOrderBy(orderby, default_order, callback)

Convenience method to select an orderby and set the appropriate order, or toggle the order if already selected.

Kind: inner method of ResourceLibrary

ParamTypeDescription
orderbystringThe field to order by
default_orderstringOrder direction. One of "asc" or "desc". This will be used to sort results if the order has not been explicitly set.
callbackfunction

ResourceLibrary~isOrderedBy(orderby, order) ⇒ boolean

Convenience method to see what we're ordered by in order to deal with postmeta

Kind: inner method of ResourceLibrary
Returns: boolean - Whether or not results are currently ordered by orderby, and sorted in the order direction

ParamTypeDescription
orderbystringThe field to order by
orderstringThe direction to order in

ResourceLibrary~toggleOrder()

Toggle the order direction from asc to desc or from desc to asc

Kind: inner method of ResourceLibrary

ResourceLibrary~setMetaFilter(field, value)

Set a filter on a meta-value. Currently only supports one field value per meta value.

Kind: inner method of ResourceLibrary

ParamTypeDescription
fieldstringThe meta field to set the filter on
valuestringThe value to filter on

ResourceLibrary~removeMetaFilter(field)

Remove filters on a meta field

Kind: inner method of ResourceLibrary

ParamTypeDescription
fieldstringThe meta field to delete the filter on

ResourceLibrary~clearMetaFilters()

Clear all meta filters

Kind: inner method of ResourceLibrary

ResourceLibrary~initialParams() ⇒ Object

Get the params that the resource library was initialized with

Kind: inner method of ResourceLibrary
Returns: Object - Object of initial values

ResourceLibrary~reset()

Reset params to their initial values

Kind: inner method of ResourceLibrary

ResourceLibrary~triggerRootEvent(event, args)

In case you need to communicate with something outside of Vue, call this to trigger an event on the Vue root element. Attach a function to the Vue root element to then interact with the function. The args will be passed to the "detail" arg in the function

Kind: inner method of ResourceLibrary

ParamTypeDescription
eventstringThe event type to trigger
argsstringThe args to pass to the triggered function

ResourceLibrary~serializeParams(params) ⇒ string

Serialize URL params

Kind: inner method of ResourceLibrary
Returns: string - A URL param string (e.g. param1=value1m2=value2)

ParamTypeDescription
paramsObjectAn object of key:value pairs corresponding to the URL params

ResourceLibrary~unserializeParams(param_string) ⇒ Object

Unserialize URL params to an object

Kind: inner method of ResourceLibrary
Returns: Object - An object with key:value pairs corresponding to the URL params

ParamTypeDescription
param_stringstringA URL param string (e.g. param1=value1m2=value2)