0.1.0 • Published 5 years ago

@cmds/view-field-settings v0.1.0

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

ViewFieldSettings

npm package

Used for ordering, showing, hiding fields in a view.

Getting started

npm install @cmds/view-field-settings --save

Prop Types

PropertyTypeRequired?Description
fieldsField!!Unique id for the instance of this foreign record selector
onSortFunctionTriggers when the user sorts the fields: ({oldIndex: number, newIndex: number})
onShowOrHideFunctionTriggers when the user hide or shows a field: ({id: string, visibility: boolean})
onShowOrHideAllFunctionTriggers when the user hide or shows all fields: ({visibility: boolean})

Field

PropertyTypeRequired?Description
idIDField ID
nameStringName of the field
visibilityBooleanWhether or not it is visible

Example

<FieldSettings 
    fields={[{
        id: '1',
        name: 'Field 1',
        visibility: true
    }, {
        id: '2',
        name: 'Field 2',
        visibility: true
    }, {
        id: '3',
        name: 'Field 3',
        visibility: false
    }]}
    onSort={({oldIndex, newIndex}) => {
        // do something
    }}
    onShowOrHide={({id, visibility}) => {
        // do something
    }}
    onShowOrHideAll={({visibility}) => {
        // do something
    }}
/>

More information

This component is designed and developed as part of Cosmos Design System.