import { ActionType , InsertRowPosition } from './enums' ; import { Focused } from './Models/Focused' ; import { PopupPosition } from './Models/PopupPosition' ; import { IMoveFocusedSettings } from './Utils/NavigationUtils' ; export const updateHeaderFilterValues = ( columnKey , item , checked ) => ( { columnKey , checked , item , type : ActionType . UpdateHeaderFilterValues } ) ; export const updatePopupPosition = ( popupPosition ) => ( { popupPosition , type : ActionType . UpdatePopupPosition } ) ; export const updateHeaderFilterPopupState = ( columnKey , isHeaderFilterPopupShown ? ) => ( { columnKey , isHeaderFilterPopupShown , type : ActionType . UpdateHeaderFilterPopupState } ) ; export const updateFilterRowValue = ( columnKey , filterRowValue ) => ( { columnKey , filterRowValue , type : ActionType . UpdateFilterRowValue , } ) ; export const updateFilterRowOperator = ( columnKey , filterRowOperator ) => ( { columnKey , filterRowOperator , type : ActionType . UpdateFilterRowOperator , } ) ; export const updateEditorValue = ( rowKeyValue , columnKey , value ) => ( { columnKey , rowKeyValue , type : ActionType . UpdateEditorValue , value , } ) ; export const updateCellValue = ( rowKeyValue , columnKey , value ) => ( { columnKey , rowKeyValue , type : ActionType . UpdateCellValue , value , } ) ; export const updateSortDirection = ( columnKey ) => ( { columnKey , type : ActionType . UpdateSortDirection , } ) ; export const closeEditor = ( rowKeyValue , columnKey ) => ( { columnKey , rowKeyValue , type : ActionType . CloseEditor , } ) ; export const deleteRow = ( rowKeyValue ) => ( { rowKeyValue , type : ActionType . DeleteRow , } ) ; export const deselectAllRows = ( ) => ( { type : ActionType . DeselectAllRows , } ) ; export const deselectAllFilteredRows = ( ) => ( { type : ActionType . DeselectAllFilteredRows , } ) ; export const deselectAllVisibleRows = ( ) => ( { type : ActionType . DeselectAllVisibleRows , } ) ; export const deselectRow = ( rowKeyValue ) => ( { rowKeyValue , type : ActionType . DeselectRow , } ) ; export const openEditor = ( rowKeyValue , columnKey ) => ( { columnKey , rowKeyValue , type : ActionType . OpenEditor , } ) ; export const search = ( searchText ) => ( { searchText , type : ActionType . Search , } ) ; export const selectAllRows = ( ) => ( { type : ActionType . SelectAllRows , } ) ; export const selectAllFilteredRows = ( ) => ( { type : ActionType . SelectAllFilteredRows , } ) ; export const selectAllVisibleRows = ( ) => ( { type : ActionType . SelectAllVisibleRows , } ) ; export const selectSingleRow = ( rowKeyValue ) => ( { rowKeyValue , type : ActionType . SelectSingleRow , } ) ; export const selectRow = ( rowKeyValue ) => ( { rowKeyValue , type : ActionType . SelectRow , } ) ; export const selectRowsRange = ( rowKeyValueFrom , rowKeyValueTo ) => ( { rowKeyValueFrom , rowKeyValueTo , type : ActionType . SelectRowsRange , } ) ; export const updateGroupsExpanded = ( groupKey ) => ( { groupKey , type : ActionType . UpdateGroupsExpanded , } ) ; export const updateData = ( data ) => ( { data , type : ActionType . UpdateData , } ) ; export const showLoading = ( text ? ) => ( { text , type : ActionType . ShowLoading , } ) ; export const hideLoading = ( ) => ( { type : ActionType . HideLoading , } ) ; export const showNewRow = ( ) => ( { type : ActionType . ShowNewRow , } ) ; export const hideNewRow = ( ) => ( { type : ActionType . HideNewRow , } ) ; export const showDetailsRow = ( rowKeyValue ) => ( { rowKeyValue , type : ActionType . ShowDetailsRow , } ) ; export const hideDetailsRow = ( rowKeyValue ) => ( { rowKeyValue , type : ActionType . HideDetailsRow , } ) ; export const saveNewRow = ( rowKeyValue , settings ? ) => ( { rowKeyValue , validate : settings && settings . validate , type : ActionType . SaveNewRow , } ) ; export const openRowEditors = ( rowKeyValue ) => ( { rowKeyValue , type : ActionType . OpenRowEditors , } ) ; export const closeRowEditors = ( rowKeyValue ) => ( { rowKeyValue , type : ActionType . CloseRowEditors , } ) ; export const saveRowEditors = ( rowKeyValue , settings ? ) => ( { rowKeyValue , validate : settings && settings . validate , type : ActionType . SaveRowEditors , } ) ; export const updateRow = ( rowData ) => { return { type : ActionType . UpdateRow , rowData , } ; } ; export const updatePageIndex = ( pageIndex ) => ( { pageIndex , type : ActionType . UpdatePageIndex , } ) ; export const updatePageSize = ( pageSize ) => ( { pageSize , type : ActionType . UpdatePageSize , } ) ; export const updatePagesCount = ( pagesCount ) => ( { pagesCount , type : ActionType . UpdatePagesCount , } ) ; export const resizeColumn = ( columnKey , width ) => ( { type : ActionType . ResizeColumn , columnKey , width , } ) ; export const reorderRows = ( rowKeyValue , targetRowKeyValue ) => ( { type : ActionType . ReorderRows , rowKeyValue , targetRowKeyValue , } ) ; export const reorderColumns = ( columnKey , targetColumnKey ) => ( { type : ActionType . ReorderColumns , columnKey , targetColumnKey , } ) ; export const showColumn = ( columnKey ) => ( { columnKey , type : ActionType . ShowColumn , } ) ; export const hideColumn = ( columnKey ) => ( { columnKey , type : ActionType . HideColumn , } ) ; export const loadData = ( ) => ( { type : ActionType . LoadData } ) ; export const clearSingleAction = ( ) => ( { type : ActionType . ClearSingleAction } ) ; export const setSingleAction = ( singleAction ) => ( { singleAction , type : ActionType . SetSingleAction } ) ; export const clearFocused = ( ) => ( { type : ActionType . ClearFocused } ) ; export const setFocused = ( focused ) => ( { focused , type : ActionType . SetFocused } ) ; export const moveFocusedRight = ( settings ) => ( { settings , type : ActionType . MoveFocusedRight } ) ; export const moveFocusedLeft = ( settings ? ) => ( { settings , type : ActionType . MoveFocusedLeft } ) ; export const moveFocusedUp = ( settings ? ) => ( { settings , type : ActionType . MoveFocusedUp } ) ; export const moveFocusedDown = ( settings ? ) => ( { settings , type : ActionType . MoveFocusedDown } ) ; export const updateTreeGroupsExpanded = ( rowKeyValue ) => ( { rowKeyValue , type : ActionType . UpdateTreeGroupsExpanded , } ) ; export const validate = ( ) => ( { type : ActionType . Validate , } ) ; export const openAllEditors = ( ) => ( { type : ActionType . OpenAllEditors , } ) ; export const saveAllEditors = ( ) => ( { type : ActionType . SaveAllEditors } ) ; export const insertRow = ( rowData , options ? ) => ( { rowData , options , type : ActionType . InsertRow } ) ;