import { RuleItem } from 'async-validator'; import { GroupPin } from '@/lib/types/group'; import { VNode } from 'vue'; import { Watcher } from '@/lib/types/feature'; export enum CellType { editor = 'editor', viewer = 'view', calculator = 'calculator', nodeCollector = 'nodeCollector', } /** * 表单校验相关属性 */ export interface ValidateConfig { required: boolean; maxLength: number; minLength: number; minimum: number; maximum: number; pattern: { message: string; pattern: string; }; validator: RuleItem['validator']; } /** * 可编辑单元配置 */ export type CellEditor = (data: { value: CellValue; rowData: Record; handler: { input: (value: CellValue) => void; }; }) => VNode | VNode[]; /** * 单元格索引源 */ export interface CellPositionInfo { top: number; left: number; width: number; height: number; } /** * 单元格索引源 */ export interface CellIndexInfo { id: string; columnId: string; rowId: string; field: string; } /** * 编辑状态收集 */ export interface EditingData { // 值类型 (用于锚定数据类型,做计算) type: CellType; // 值内容 value: CellValue; // 错误提示 error: string; // 预留的 tip tip: string; } /** * 单元格索位置 */ export interface CellLocation { pin: GroupPin; columnId: string; rowId: string; } export type CellValue = string | boolean | number; export type CellCalculator = Watcher>; export enum SpecialObserved { RowSubNodes = '$rowSubNodes', } export interface SpecialObservedData { treeCellValues: CellValue[]; } export interface SyncWatchMass { value: T; unused: boolean; }