import { AndOr, CellLocation, ColumnFilter, ColumnGroupRecord, ColumnLocation, DragDirection, IndexColumn, IndexRow, RowData, RowSelectionStatus, } from '@/lib/types'; import { GroupSelection } from '@/lib/types/group'; import { RowIndex, RowSelection, TotalBar, TreeData } from '@/lib/types/feature'; export interface StoreState { // 索引层数据 index: { /** * 生成:初始化 * 修改:列宽度变化、列排序, 动态锁定列 * 引用者:Index */ columnRecord: Record; /** * 生成:初始化 * 修改:列宽度变化、列排序 * 引用者:Header */ columnGroupRecord: ColumnGroupRecord; /** * 生成:初始化 * 修改:列排序 */ columnId2Index: Record; /** * 生成:初始化 * 修改: */ columnId2Field: Record; /** * 生成:初始化 * 使用:仅仅在每次筛选时根据原始数据筛选 */ rowIndex2Id: string[]; /** * 作用:作为全量数据记录每一行高度 * 生成:初始化 * 引用者:仅仅每次筛选时根据原始数据筛选 */ rowRecord: Record; /** * 生成:初始化 * 修改:单元格编辑(填写、校验、自动计算) * 销毁: * 第一层为 row 信息 第二层为 column信息 */ data2D: Record; /** * 生成:初始化 * 修改:行选中 * */ rowSelection: Record; }; // 视图层数据(逻辑热区数据) view: { /** * 与 index 的区别在于 此处为 筛选 + 排序后的数据,非全量数据 * 生成:初始化,行排序,行筛选 * 修改:行拖拽 * 引用者:Body */ rowIndex2Id: string[]; /** * 生成:初始化,行排序,行筛选 * 修改:resize row、行拖拽 * 引用者:Body */ rowRecord: Record; }; featureConfig: { treeData: Partial; rowSelection: Partial; rowIndex: Partial; totalBar: Partial; }; columnTotal: Record; config: { // 是否高度自适应 autoHeight: boolean; // 表格宽 width: number; // 表格高 height: number; // 表格行高 rowHeight: number; // 表格表体内容高 bodyHeight: number; // 表格表体可视区域高 bodyViewHeight: number; // 表格头高 headerHeight: number; // 表格头层级 headerGroupLevel: number; // 表格表体滚动区域高 scrollViewLeft: number; idKey: string; }; virtualScroll: { y: { startIndex: number; endIndex: number; }; xStartLeft: number; xEndLeft: number; }; activeStatus: { clickedBodyCell: CellLocation; dbClickedBodyCell: CellLocation; }; selectionStatus: { active: boolean; changing: boolean; startRowIndex: number; endRowIndex: number; startColumn: ColumnLocation; endColumn: ColumnLocation; leftArea: GroupSelection; rightArea: GroupSelection; scrollArea: GroupSelection; }; dragCalculateStatus: { active: boolean; changing: boolean; direction: DragDirection; startRowIndex: number; endRowIndex: number; startColumn: ColumnLocation; endColumn: ColumnLocation; leftArea: GroupSelection; rightArea: GroupSelection; scrollArea: GroupSelection; }; rightMenu: { active: boolean; top: number; left: number; }; /** * 筛选状态,不需要做响应式,每次筛选后主动触发 */ filter: { filters: Record; andOr: AndOr; }; }