UNPKG

@adaptabletools/adaptable

Version:

Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

67 lines (66 loc) 2.81 kB
import { QUICK_SEARCH_DEFAULT_CELL_BACK_COLOR, QUICK_SEARCH_DEFAULT_CURRENT_BACK_COLOR, QUICK_SEARCH_DEFAULT_FORE_COLOR, QUICK_SEARCH_DEFAULT_TEXT_BACK_COLOR, } from '../../Utilities/Constants/ReduxConstants'; import { EMPTY_STRING } from '../../Utilities/Constants/GeneralConstants'; export const QUICK_SEARCH_DEFAULT_CELL_MATCH_STYLE = { BackColor: QUICK_SEARCH_DEFAULT_CELL_BACK_COLOR, ForeColor: QUICK_SEARCH_DEFAULT_FORE_COLOR, }; export const QUICK_SEARCH_DEFAULT_TEXT_MATCH_STYLE = { BackColor: QUICK_SEARCH_DEFAULT_TEXT_BACK_COLOR, ForeColor: QUICK_SEARCH_DEFAULT_FORE_COLOR, }; export const QUICK_SEARCH_DEFAULT_CURRENT_TEXT_MATCH_STYLE = { BackColor: QUICK_SEARCH_DEFAULT_CURRENT_BACK_COLOR, ForeColor: QUICK_SEARCH_DEFAULT_FORE_COLOR, FontWeight: 'Bold', }; export const QUICK_SEARCH_RUN = 'QUICK_SEARCH_RUN'; export const QUICK_SEARCH_SET_CELL_MATCHING_STYLE = 'QUICK_SEARCH_SET_CELL_MATCHING_STYLE'; export const QUICK_SEARCH_SET_TEXT_MATCHING_STYLE = 'QUICK_SEARCH_SET_TEXT_MATCHING_STYLE'; export const QUICK_SEARCH_SET_CURRENT_TEXT_MATCHING_STYLE = 'QUICK_SEARCH_SET_CURRENT_TEXT_MATCHING_STYLE'; export const QUICK_SEARCH_READY = 'QUICK_SEARCH_READY'; export const QuickSearchRun = (quickSearchText) => ({ type: QUICK_SEARCH_RUN, quickSearchText, }); export const QuickSearchSetCellMatchingStyle = (matchingCellStyle) => ({ type: QUICK_SEARCH_SET_CELL_MATCHING_STYLE, matchingCellStyle: matchingCellStyle, }); export const QuickSearchSetTextMatchingStyle = (textMatchStyle) => ({ type: QUICK_SEARCH_SET_TEXT_MATCHING_STYLE, textMatchStyle, }); export const QuickSearchSetCurrentTextMatchingStyle = (currentTextMatchStyle) => ({ type: QUICK_SEARCH_SET_CURRENT_TEXT_MATCHING_STYLE, currentTextMatchStyle, }); export const QuickSearchReady = (quickSearchState) => ({ type: QUICK_SEARCH_READY, quickSearchState, }); const initialState = { QuickSearchText: EMPTY_STRING, }; export const QuickSearchReducer = (state = initialState, action) => { switch (action.type) { case QUICK_SEARCH_RUN: return Object.assign({}, state, { QuickSearchText: action.quickSearchText, }); case QUICK_SEARCH_SET_CELL_MATCHING_STYLE: return Object.assign({}, state, { CellMatchStyle: action.matchingCellStyle, }); case QUICK_SEARCH_SET_TEXT_MATCHING_STYLE: return Object.assign({}, state, { TextMatchStyle: action.textMatchStyle, }); case QUICK_SEARCH_SET_CURRENT_TEXT_MATCHING_STYLE: return Object.assign({}, state, { CurrentTextMatchStyle: action .currentTextMatchStyle, }); default: return state; } };