@adaptabletools/adaptable
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
37 lines (36 loc) • 967 B
JavaScript
export var ActionTypes;
(function (ActionTypes) {
ActionTypes["DRAG_OVER"] = "DRAG_OVER";
ActionTypes["DRAG_OUT"] = "DRAG_OUT";
ActionTypes["SET_INVALID_FILE"] = "SET_INVALID_FILE";
ActionTypes["DROP_SUCCES"] = "DROP_SUCCES";
})(ActionTypes || (ActionTypes = {}));
const reducer = (state, action) => {
if (action.type === ActionTypes.DRAG_OVER) {
return {
...state,
dragOver: true,
};
}
if (action.type === ActionTypes.DRAG_OUT) {
return {
...state,
dragOver: false,
};
}
if (action.type === ActionTypes.SET_INVALID_FILE) {
return {
...state,
message: action.payload.message,
};
}
if (action.type === ActionTypes.DROP_SUCCES) {
return {
...state,
dragOver: false,
message: action.payload.message,
};
}
return state;
};
export default reducer;