Skip to content

magsdk/component-check-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Check list component

build status npm version dependencies status devDependencies status Gitter

Check list is a component to build user interface, an instance of Component module. It is based on mag-component-list.

Installation

npm install mag-component-check-list

Usage

Add the constructor to the scope:

var CheckList = require('mag-component-check-list');

Create check list instance:

var checkList = new CheckList({
    focusIndex: 0,
    classIcon: 'theme-icon theme-icon-checkbox',
    classIconActive: 'theme-icon theme-icon-checkbox-active',
    classChecked: 'checked',
    data: [
        {state: false, title: 'Some title 1', value: 'value 1'},
        {state: true, title: 'Some title 2', value: 'value 2'},
        {state: false, title: 'Some title 3', value: 'value 3'}
    ]
});

To change data after creation:

checkList.setData({
    focusIndex: 0,
    data: [
        {state: false, title: 'Some title 1', value: 'value 1'},
        {state: true, title: 'Some title 2', value: 'value 2'},
        {state: false, title: 'Some title 3', value: 'value 3'}
    ]
});

To change item state:

checkList.changeState($domItem);

To reset to init state (data and focusIndex):

checkList.resetData();

To uncheck all items:

checkList.clearChecked(newFocusPosition);

To get all checked items data:

console.log(checkList.checkedData);

Development mode

There is a global var DEVELOP which activates additional consistency checks and protection logic not available in release mode.

Contribution

If you have any problems or suggestions please open an issue according to the contribution rules.

License

mag-component-check-list is released under the MIT License.

About

Base check list implementation.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors