Choices/assets/scripts/src/actions/index.js

66 lines
1.1 KiB
JavaScript
Raw Normal View History

export const addItem = (value, label, id, optionId) => {
2016-03-30 16:04:21 +02:00
return {
type: 'ADD_ITEM',
value,
label,
id,
optionId,
2016-03-30 16:04:21 +02:00
}
};
2016-03-30 16:04:21 +02:00
2016-04-14 15:43:36 +02:00
export const removeItem = (id, optionId) => {
2016-03-30 16:04:21 +02:00
return {
type: 'REMOVE_ITEM',
id,
optionId,
2016-03-30 16:04:21 +02:00
}
};
2016-03-30 16:04:21 +02:00
export const selectItem = (id, selected) => {
2016-03-30 16:04:21 +02:00
return {
type: 'SELECT_ITEM',
id,
selected,
2016-03-30 16:04:21 +02:00
}
2016-04-12 15:31:07 +02:00
};
export const addOption = (value, label, id, groupId, disabled) => {
2016-04-12 15:31:07 +02:00
return {
type: 'ADD_OPTION',
value,
label,
id,
groupId,
disabled,
}
};
export const filterOptions = (results) => {
return {
type: 'FILTER_OPTIONS',
results,
}
};
export const activateOptions = (active = true) => {
return {
type: 'ACTIVATE_OPTIONS',
active,
}
};
export const addGroup = (value, id, active, disabled) => {
return {
type: 'ADD_GROUP',
value,
id,
active,
disabled,
}
};
export const clearAll = () => {
return {
type: 'CLEAR_ALL',
}
};