Choices/src/scripts/actions/choices.js

39 lines
613 B
JavaScript
Raw Normal View History

2017-10-10 16:30:06 +02:00
import { ACTION_TYPES } from './../constants';
2017-10-10 16:26:38 +02:00
export const addChoice = (
value,
label,
id,
groupId,
disabled,
elementId,
customProperties,
placeholder,
keyCode,
) => ({
2017-10-10 16:30:06 +02:00
type: ACTION_TYPES.ADD_CHOICE,
2017-10-10 16:26:38 +02:00
value,
label,
id,
groupId,
disabled,
elementId,
customProperties,
placeholder,
keyCode,
});
export const filterChoices = results => ({
2017-10-10 16:30:06 +02:00
type: ACTION_TYPES.FILTER_CHOICES,
2017-10-10 16:26:38 +02:00
results,
});
export const activateChoices = (active = true) => ({
2017-10-10 16:30:06 +02:00
type: ACTION_TYPES.ACTIVATE_CHOICES,
2017-10-10 16:26:38 +02:00
active,
});
export const clearChoices = () => ({
2017-10-10 16:30:06 +02:00
type: ACTION_TYPES.CLEAR_CHOICES,
2017-10-10 16:26:38 +02:00
});