@adaptabletools/adaptable-cjs
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
148 lines (147 loc) • 6.94 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlashingCellReducer = exports.FlashingCellReady = exports.FlashingCellDefinitionUnSuspendAll = exports.FlashingCellDefinitionSuspendAll = exports.FlashingCellDefinitionUnSuspend = exports.FlashingCellDefinitionSuspend = exports.FlashingCellDefinitionDelete = exports.FlashingCellDefinitionEdit = exports.FlashingCellDefinitionSet = exports.FlashingCellDefinitionAdd = exports.FLASHING_CELL_DEFINITION_SET = exports.FLASHING_CELL_READY = exports.FLASHING_CELL_DEFINITION_UNSUSPEND_ALL = exports.FLASHING_CELL_DEFINITION_SUSPEND_ALL = exports.FLASHING_CELL_DEFINITION_UNSUSPEND = exports.FLASHING_CELL_DEFINITION_SUSPEND = exports.FLASHING_CELL_DEFINITION_DELETE = exports.FLASHING_CELL_DEFINITION_EDIT = exports.FLASHING_CELL_DEFINITION_ADD = void 0;
const tslib_1 = require("tslib");
const AdaptableHelper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/AdaptableHelper"));
const utils_1 = require("./utils");
/**
* @ReduxAction A Flashing Cell Definition has been added
*/
exports.FLASHING_CELL_DEFINITION_ADD = 'FLASHING_CELL_DEFINITION_ADD';
/**
* @ReduxAction A Flashing Cell Definition has been edited
*/
exports.FLASHING_CELL_DEFINITION_EDIT = 'FLASHING_CELL_DEFINITION_EDIT';
/**
* @ReduxAction A Flashing Cell Definition has been deleted
*/
exports.FLASHING_CELL_DEFINITION_DELETE = 'FLASHING_CELL_DEFINITION_DELETE';
/**
* @ReduxAction Flashing Cell Definition Style is suspended
*/
exports.FLASHING_CELL_DEFINITION_SUSPEND = 'FLASHING_CELL_DEFINITION_SUSPEND';
/**
* @ReduxAction Flashing Cell Definition is unsuspended, or activated
*/
exports.FLASHING_CELL_DEFINITION_UNSUSPEND = 'FLASHING_CELL_DEFINITION_UNSUSPEND';
/**
* @ReduxAction All Flashing Cell Definitions are suspended
*/
exports.FLASHING_CELL_DEFINITION_SUSPEND_ALL = 'FLASHING_CELL_DEFINITION_SUSPEND_ALL';
/**
* @ReduxAction All Flashing Cell Definitions are unsuspended, or activated
*/
exports.FLASHING_CELL_DEFINITION_UNSUSPEND_ALL = 'FLASHING_CELL_DEFINITION_UNSUSPEND_ALL';
/**
* @ReduxAction Flashing Cell Module is ready
*/
exports.FLASHING_CELL_READY = 'FLASHING_CELL_READY';
exports.FLASHING_CELL_DEFINITION_SET = 'FLASHING_CELL_DEFINITION_SET';
const FlashingCellDefinitionAdd = (flashingCellDefinition) => ({
type: exports.FLASHING_CELL_DEFINITION_ADD,
flashingCellDefinition,
});
exports.FlashingCellDefinitionAdd = FlashingCellDefinitionAdd;
const FlashingCellDefinitionSet = (flashingCellDefinitions) => ({
type: exports.FLASHING_CELL_DEFINITION_SET,
flashingCellDefinitions,
});
exports.FlashingCellDefinitionSet = FlashingCellDefinitionSet;
const FlashingCellDefinitionEdit = (flashingCellDefinition) => ({
type: exports.FLASHING_CELL_DEFINITION_EDIT,
flashingCellDefinition,
});
exports.FlashingCellDefinitionEdit = FlashingCellDefinitionEdit;
const FlashingCellDefinitionDelete = (flashingCellDefinition) => ({
type: exports.FLASHING_CELL_DEFINITION_DELETE,
flashingCellDefinition,
});
exports.FlashingCellDefinitionDelete = FlashingCellDefinitionDelete;
const FlashingCellDefinitionSuspend = (flashingCellDefinition) => ({
type: exports.FLASHING_CELL_DEFINITION_SUSPEND,
flashingCellDefinition,
});
exports.FlashingCellDefinitionSuspend = FlashingCellDefinitionSuspend;
const FlashingCellDefinitionUnSuspend = (flashingCellDefinition) => ({
type: exports.FLASHING_CELL_DEFINITION_UNSUSPEND,
flashingCellDefinition,
});
exports.FlashingCellDefinitionUnSuspend = FlashingCellDefinitionUnSuspend;
const FlashingCellDefinitionSuspendAll = () => ({
type: exports.FLASHING_CELL_DEFINITION_SUSPEND_ALL,
});
exports.FlashingCellDefinitionSuspendAll = FlashingCellDefinitionSuspendAll;
const FlashingCellDefinitionUnSuspendAll = () => ({
type: exports.FLASHING_CELL_DEFINITION_UNSUSPEND_ALL,
});
exports.FlashingCellDefinitionUnSuspendAll = FlashingCellDefinitionUnSuspendAll;
const FlashingCellReady = (alertState) => ({
type: exports.FLASHING_CELL_READY,
alertState,
});
exports.FlashingCellReady = FlashingCellReady;
const initialState = {
FlashingCellDefinitions: [],
};
const FlashingCellReducer = (state = initialState, action) => {
let flashingCellDefinitions;
switch (action.type) {
case exports.FLASHING_CELL_DEFINITION_SET: {
const actionFlashingCellDefinition = action.flashingCellDefinitions;
return {
...state,
FlashingCellDefinitions: actionFlashingCellDefinition,
};
}
case exports.FLASHING_CELL_DEFINITION_ADD: {
const actionFlashingCellDefinition = action.flashingCellDefinition;
AdaptableHelper_1.default.addAdaptableObjectPrimitives(actionFlashingCellDefinition);
flashingCellDefinitions = [].concat(state.FlashingCellDefinitions);
flashingCellDefinitions.push(actionFlashingCellDefinition);
return { ...state, FlashingCellDefinitions: flashingCellDefinitions };
}
case exports.FLASHING_CELL_DEFINITION_EDIT: {
const actionFlashingCellDefinition = action.flashingCellDefinition;
return {
...state,
FlashingCellDefinitions: state.FlashingCellDefinitions.map((abObject) => abObject.Uuid === actionFlashingCellDefinition.Uuid
? actionFlashingCellDefinition
: abObject),
};
}
case exports.FLASHING_CELL_DEFINITION_DELETE: {
const actionFlashingCellDefinition = action.flashingCellDefinition;
return {
...state,
FlashingCellDefinitions: state.FlashingCellDefinitions.filter((abObject) => abObject.Uuid !== actionFlashingCellDefinition.Uuid),
};
}
case exports.FLASHING_CELL_DEFINITION_SUSPEND: {
return {
...state,
FlashingCellDefinitions: (0, utils_1.changeIsSuspendInList)(action.flashingCellDefinition, state.FlashingCellDefinitions, true),
};
}
case exports.FLASHING_CELL_DEFINITION_UNSUSPEND: {
return {
...state,
FlashingCellDefinitions: (0, utils_1.changeIsSuspendInList)(action.flashingCellDefinition, state.FlashingCellDefinitions, false),
};
}
case exports.FLASHING_CELL_DEFINITION_SUSPEND_ALL: {
return {
...state,
FlashingCellDefinitions: (0, utils_1.suspendAllInList)(state.FlashingCellDefinitions),
};
}
case exports.FLASHING_CELL_DEFINITION_UNSUSPEND_ALL: {
return {
...state,
FlashingCellDefinitions: (0, utils_1.unsuspendAllInList)(state.FlashingCellDefinitions),
};
}
default:
return state;
}
};
exports.FlashingCellReducer = FlashingCellReducer;