UNPKG

@true-directive/base

Version:

The set of base classes for the TrueDirective Grid

135 lines (134 loc) 5.96 kB
import { Column } from '../classes/column.class'; import { UIActionType } from '../classes/ui-action.class'; import { CellPosition } from '../classes/cell-position.class'; import { Selection } from '../classes/selection.class'; import { DataSource } from '../classes/data-source.class'; import { GridSettings } from '../classes/grid-settings.class'; import { ColumnCollection } from '../classes/column-collection.class'; import { GridCheckHandler } from './grid-check.handler'; import { LayoutsHandler } from './layouts.handler'; import { IEvents } from '../events.interface'; export declare class GridUIHandler { layoutsHandler: LayoutsHandler; events: IEvents; settings: GridSettings; selection: Selection; dataSource: DataSource; check: GridCheckHandler; columnCollection: ColumnCollection; private readonly cc; private readonly columns; /** * Focused cell position */ focusedCell: CellPosition; cellPosition(row: any, rowIndex: number, fieldName: string): CellPosition; /** * Previous position of the focused cell */ private _prevFocused; /** * Position of the cell containing an editor */ private _editor; readonly editor: CellPosition; /** * Значение редактора. Storing value here because cell may be not rendered. */ editorValue: any; /** * Cell value before editing */ editorValueChanged: boolean; /** * If the editor has been shown. This flag is necessary for understanding * if the dropdown list has been shown avoid more showing * (during the scrolling the editor may be initialized several times). */ editorWasShown: boolean; /** * Editor's height. We need to remember it because cell containing editor can * affect the height of the row. Without storing this value the row's height will * be lost. */ editorHeight: number; /** * Проверка возможности редактирования заданной ячейки * @param cp Позиция ячейки * @return Можно ли редактировать */ /** * Проверка видимости строки после изменения значения одного из полей * @param r Измененная строка * @param fieldName Наименование поля * @return Необходим ли перезапрос данных */ protected checkDataUpdateNeed(r: any, fieldName: string): boolean; /** * Handling of the pressed key before editor Initialization. * This may happen with quick user typing. */ processKeyBeforeEdit(keyEvent: any): void; /** * Editor Initialization. * @param cp Cell position * @param returnFocus Set this parameter true if it is necessary to return the focus into the grid. * @param keyEvent The key that runs cell into the edit mode. * @param cancelCurrent Set this parameter true to reject the changes of the previous editing. */ setEditor(cp: CellPosition, returnFocus?: boolean, keyEvent?: any, cancelCurrent?: boolean): void; startAction(cp: CellPosition, ctrl?: boolean, byTouch?: boolean, button?: number): UIActionType; /** * Start selecting cells * @param cp Cell position * @param add */ startSelect(cp: CellPosition, add?: boolean): void; proceedToSelect(cp: CellPosition): boolean; /** * The user has finished selecting the cells (MouseUp) * @param cp Cell RowPosition * @param byTouch Selection took place in touch events * @param button Левая или правая кнопка мыши */ endSelect(cp: CellPosition, byTouch?: boolean, button?: number): void; /** * Обработка события mousedown. Возможно, необходимо включить редактор * @param cp Позиция * @return Если true, то событие обработано, дальнейшая обработка не требуется */ mouseDown(cp: CellPosition, touch?: boolean, button?: number): boolean; toggleCheck(row: any, fieldName: string, v?: boolean): void; /** * Пользователь переключает галку в заголовке столбца * @param col Колонка с чекбоксом */ toggleCheckColumn(col: Column): void; /** * Click event handling. Toggle cell checkbox. * @param cp Cell position * @return Has event been handled */ click(cp: CellPosition): boolean; /** * Отработка события DblClick. Включение редкатора по EditorShowMode.ON_DBL_CLICK * @param e Параметры события * @param r Строка, по которой был даблклик */ dblClick(e: any, r: any): void; startEditing(cp: CellPosition, keyEvent?: any): boolean; stopEditing(cp: CellPosition, returnFocus?: boolean, cancelChanges?: boolean): void; /** * Подтверждение нового значения ячейки после редактирования * @param row Строка * @param fieldName Наименвание поля * @param value Новое значение * @return Изменено ли в итоге значение */ commitEditor(row: any, fieldName: string, value: any): boolean; processKey(pageCapacity: { upRowCount: number; downRowCount: number; }, // Емкость предыдущей и следующей страниц keyEvent: any): boolean; }