Choices/assets/scripts/src/actions/index.js
Jay Kid 0b3cf1a355 feat: implement custom properties for items and choices
+ Added unit tests for both choice and item reducers
+ Had to add some visually unpleasant undefineds, sorry :P
2017-06-28 11:11:02 +02:00

77 lines
1.2 KiB
JavaScript

export const addItem = (value, label, id, choiceId, groupId, customProperties) => {
return {
type: 'ADD_ITEM',
value,
label,
id,
choiceId,
groupId,
customProperties
};
};
export const removeItem = (id, choiceId) => {
return {
type: 'REMOVE_ITEM',
id,
choiceId,
};
};
export const highlightItem = (id, highlighted) => {
return {
type: 'HIGHLIGHT_ITEM',
id,
highlighted,
};
};
export const addChoice = (value, label, id, groupId, disabled, elementId, customProperties) => {
return {
type: 'ADD_CHOICE',
value,
label,
id,
groupId,
disabled,
elementId: elementId,
customProperties
};
};
export const filterChoices = (results) => {
return {
type: 'FILTER_CHOICES',
results,
};
};
export const activateChoices = (active = true) => {
return {
type: 'ACTIVATE_CHOICES',
active,
};
};
export const clearChoices = () => {
return {
type: 'CLEAR_CHOICES',
};
};
export const addGroup = (value, id, active, disabled) => {
return {
type: 'ADD_GROUP',
value,
id,
active,
disabled,
};
};
export const clearAll = () => {
return {
type: 'CLEAR_ALL',
};
};