@performant-software/user-defined-fields
v3.1.11
Published
A package of components used for allowing end users to define fields on models. Use with the "user_defined_fields" gem.
Keywords
Readme
UserDefinedFields
This package is designed to be used with the user_defined_fields Rails gem. The idea is to allow users to define what type of metadata they want to collection about specific models and use these components to add, remove, and modify the configuration of the fields.
Installation
yarn add @performant-software/user-defined-fieldsor
npm install @performant-software/user-defined-fieldsComponents
To load user defined fields directly from the API endpoint, use the UserDefinedFieldsList component.
<UserDefinedFieldsList />To add the user defined fields from nested attributes of a parent record, use the UserDefinedFieldsEmbeddedList component.
<UserDefinedFieldsEmbeddedList
items={props.item.user_defined_fields}
onDelete={props.onDeleteChildAssociation.bind(this, 'user_defined_fields')}
onSave={props.onSaveChildAssociation.bind(this, 'user_defined_fields')}
/>Services
// Fetch the list of user defined fields
UserDefinedFieldsService.fetchAll(params)
// Fetch a single user defined field
UserDefinedFieldsService.fetchOne(id)
// Save a user defined field
UserDefinedFieldsService.save(udf)
// Delete a user defined field
UserDefinedFieldsService.delete(udf)
// Fetch a list of tables to which user defined fields can be added
UserDefinedFieldsService.fetchTables()
// Fetch a list of allowed data types
UserDefinedFieldsService.fetchDataTypes()