lpf-form-model
v1.0.3
Published
lpf-form-model is a model for vue.js and quasar.js
Downloads
2
Readme
lpf-form-model for vue.js and quasar
lpf-form-model is a model for vue.js and quasar.js.
Installation
yarn add lpf-form-model
Usage
import FormModel from 'lpf-form-model'
Existing methods
/**
* Return form field where field[propertyName]
* Exemple can be used in preloadFormData to get field with property preload
*/
Model.getFormField (propertyName)
/**
* Return all form fields
*/
Model.getAllFormFields ()
/**
* get form schema:
* getFormSchema(Object: schema)
* @params {String}
* @return {Object}
*/
Model.getFormSchema (schema)
/**
* Return all categories created inside the model
*/
Model.getFormCategories ()
/**
* get the form by category:
* getFormByCategory(String: category)
* @params {String}
* @return {Object}
*/
Model.getFormByCategory (category)
/**
* set api prefix in model:
* setApiPrefix(String: prefix)
* @params {String}
* @return {void}
*/
Model.setApiPrefix (prefix)
/**
* set the table columns in model for the qtable quasar component:
* setTableColumns(Object: columns)
* @params {Object}
* @return {void}
*/
Model.setTableColumns (columns)
/**
* separates form data into several categories ex:
* setFormCategories('Global', ['name', 'mode'])
* separates the form data into several categories ex:
* @params {String}
* @params {Array}
* @return {Object} Returns the formatted schema with the entries.
*/
Model.setFormCategory (category, fields = [])
/**
* Allows you to create a custom form model by passing an array of props.
* @param {Array} props List of desired fields for the custom model.
* @return {Object} Returns the formatted schema.
// TODO: should throw an error when prop not found
*/
Model.renderFormFields (props)
/**
* Allows you to format an object containing only the values of the inputs.
* @return {Object} Returns the form values.
// TODO: should throw an error when prop not found
*/
Model.extractPayloadValues ()