import { AnyObject, ArrayAble, AnyFn, MaybeString, LowCodeTypes, TupleToUnion } from '../../../../shared/types'; import { VxeTableProps, VxeTableDefines, VxeTableInstance, VxeColumnPropTypes, VxeTablePropTypes, VxeTableConstructor, VxeTableMethods } from 'vxe-table'; import { VxePagerEventProps } from 'vxe-table/types/pager'; import { VxeTableEventProps, VxeTableListeners, VxeTablePrivateMethods } from 'vxe-table/types/table'; import { AnnotationItem } from '../../../../components/annotation-edit/src/type'; import { DragScrollConfig } from '../../../../components/drag-scroll'; import { IHO_TABLE_STRING_STATUS, IhoTableEventNameTuple, IhoTableRowGroupSequence } from '../../../../components/iho-table/src/constants'; import Sortable from 'sortablejs'; export * from './pluginType'; export type $VxeTable = VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods; export interface IhoTableRowGroupItem { groupName?: string; title: string; list: string[]; } export type IhoTableConfig = VxeTableProps & Partial<{ uuid: string; isTree: MaybeString<0 | 1 | 2 | 3>; isBatchSelect: MaybeString<0 | 1>; isSingleSelect: MaybeString<0 | 1>; dragScroll: boolean; dragScrollConfig: DragScrollConfig; selectType: Exclude; rowDraggable: boolean; showSeq: boolean; forceClearable: boolean; hideSettingBtn: MaybeString<0 | 1>; rowGroupSetting: Partial, IhoTableRowGroupItem[]>>; anchorList: Array<{ name?: string; field: string; } | string>; columnConfig: Partial<{ seqSlotFn: VxeColumnPropTypes.Slots['default']; seqConfig: Partial; }>; sortableConfig: Partial<{ enable: boolean; usePreset: boolean; [K: string]: any; }>; operationalForm: LowCodeTypes.operationalConfig[]; operationForm: LowCodeTypes.operationalConfig[]; dateOperationalForm: LowCodeTypes.dateOperationalConfig[]; /** * @desc 在checkboxConfig作拓展 * @property slots - 用于配置checkbox列插槽 { default,edit,header,filter... } * @property maxCheckSize - 多选时的最大选择数量 * @property disableHeader - 是否禁用表头的全选功能 * @property useNCheckbox - 是否使用n-checkbox组件 * @property indeterminateField - 用于配置checkbox列的半选状态字段 */ checkboxConfig: Partial; /** * @desc 在rowConfig作拓展 * @property clickToCancel - 是否允许点击行后取消其高亮状态 */ rowConfig: Partial; /** * @desc 在keyboardConfig作拓展 * @property forceArrowKey - 是否强制使用上下左右键进行导航(即使已经处于编辑状态) */ keyboardConfig: Partial; /** * @desc 在radioConfig作拓展 * @property slots - 用于配置radio列插槽 { default,edit,header,filter... } */ radioConfig: Partial; /** * @desc 竖向表格相关配置 * @property enable - 是否开启竖向表格 * @property headerWidth - 表头宽度 * @property bodyWidth - 表体宽度 * @property bodyMinWidth - 表体最小宽度 */ verticalConfig: Partial<{ enable: boolean; headerWidth: number | 'auto' | ((level: number) => number); bodyWidth: number | ((index: number) => number); bodyMinWidth: number | ((index: number) => number); }>; /** * @desc 滚动翻页加载 * @property enable - 是否开启 * @property capacity - 分页容量 * @property loading - 是否开启加载动画 */ pagerScroll: Partial<{ enable: boolean; capacity: number; loading: boolean; }>; /** * @desc sticky左右固定列模式 * @property enable - 是否开启 */ stickyFixedConfig: Partial<{ enable: boolean; }>; tableRowHeight: 'table-simple' | 'table-classic' | number | string; tableHeaderRowHeight: 'table-simple' | 'table-classic' | number | string; crossColumnSetting: Partial<{ columnWidth: number; rowHeight: number; fixedColumnList: Array<{ setting: Partial<{ alias: string; name: string; option: { text: string; value?: string; }[]; }>; columnWidth?: number; }>; }>; [K: string]: unknown; }> & /** * 允许在配置中使用on开头属性监听vxe-table中的所有事件(含iho-table中的拓展事件),如 onKeydown(){ ... }、onFormChange(){ ... } 等等 * 不推荐使用,请在表格外层设置监听器 */ Partial<{ [K in EventNameToEventListener]: (...payload: IhoTableEmitPayload>) => void; }>; export type IhoTableFieldItem = { [K in keyof VxeTableDefines.ColumnInfo]?: K extends 'children' ? IhoTableFieldItem[] : K extends keyof VxeTableDefines.ColumnInfo ? VxeTableDefines.ColumnInfo[K] : never; } & Partial<{ annotation: boolean; depth: number; parent: IhoTableFieldItem; [key: string]: any; }>; export declare namespace IhoTableLowCodeField { type FieldSetting = Partial<{ mergedFeildExpression: string; notParticipatingSearch: IHO_TABLE_STRING_STATUS; mapping: Partial<{ type: string; mappingFiled: Array<{ value: Array>>; key?: string; }>; }>; }>; type FilterSetting = Partial<{ daterange: Partial<{ datePickerProps: AnyObject; }>; type: 'daterange' | 'text' | 'remote'; pagination: boolean; text: Partial<{ inputProps: AnyObject; }>; urlConfig: LowCodeTypes.UrlConfig; }>; type ColorAndIconItem = Partial<{ condition: { con: LowCodeTypes.VALUE_RELATION; value: unknown; field_key?: string; }[]; sqlExpression: string; colorType: 'background' | 'color'; color: string; icon: string; }>; type SettingObj = Partial<{ attr: string; isHide: MaybeString<0 | 1>; colorAndIcon: ColorAndIconItem[]; fieldDescribe: string; fieldDescDev: string; showSetting: Partial<{ filter: Partial<{ con: string; conName: string; field_key: string; keyword: string; i18n: string; key: string; value: string; }>[]; change_text: string; field_key: string; sqlExpression: string; }>[]; [K: string]: unknown; }>; type QueryOptions = (payload: { keyword?: string; row?: AnyObject; column: VxeTableDefines.ColumnInfo; rowIndex?: number; isFullData?: boolean; connectColumn?: VxeTableDefines.ColumnInfo; }) => Promise; } export type LowCodeTableFieldItem = { columnName: string; [K: string]: any; } & Partial<{ id: number | string; alias: string; isFixed: 0 | 1 | 2; colWidth: VxeTableDefines.ColumnInfo['width']; settingObj: IhoTableLowCodeField.SettingObj; treeNode: boolean; connectField: string; isShow: MaybeString<0 | 1>; isSort: MaybeString<0 | 1>; isOrder: MaybeString<0> | VxeTablePropTypes.SortOrder; formType: string; fieldSetting: string | IhoTableLowCodeField.FieldSetting; filterCapacity: number; onFilterShow: any; notParticipatingSearch: 0 | 1; componentProps: AnyObject; options: { label?: string; key?: string; value: string; disabled?: boolean; keyword?: string; [K: string]: any; }[]; queryOptions: IhoTableLowCodeField.QueryOptions; annotation: boolean; slotFn: NonNullable['default']; headerSlotFn: NonNullable['header']; editSlotFn: NonNullable['edit']; footerSlotFn: NonNullable['footer']; separateSlot: AnyObject | AnyFn; separateFormatter: (row: AnyObject) => any; separateDeep: boolean; separateBinder: ArrayAble; separateRowEdit: boolean; separatePlacement: 'bottom'; separateIndent: number; separateWidth: ((payload: { column: VxeTableDefines.ColumnInfo; row: AnyObject; rowIndex: number; $table: VxeTableInstance; }) => number) | number; /** * 即将被废弃,请使用表格外层的beforeEditMethod属性 * @deprecated */ checkEditStatus: (payload: VxeTableDefines.CellRenderBodyParams) => boolean | void; colorAndIcon: IhoTableLowCodeField.ColorAndIconItem[]; variableHeight: boolean | '0' | '1'; filterSetting: IhoTableLowCodeField.FilterSetting; bindEventSetting: LowCodeTypes.BindEventSettingItem[]; allowSlash: boolean | string; whiteList: string[]; defaultValue: any; autograph: string; wordbook: LowCodeTypes.wordbook; requestCache: boolean; open: LowCodeTypes.switchProperty; close: LowCodeTypes.switchProperty; show_mode: LowCodeTypes.showModeType; lazyRequest: boolean; labelToValue: boolean; filterLabelRender: (payload: VxeColumnPropTypes.FilterSlotParams & { option: VxeTableDefines.FilterOption; }) => any; showFilterFullNums: boolean; verticalConfig: { rowHeight: number; }; widgetConfig: { input: { eventMode: 'input' | 'change'; }; }; nameAbbr: string; optionInfo: { dynamicOptionInfo?: Partial<{ filterKeys: string[]; showKeys: string[]; valueKey: string; dataSourceId: string; dataSourceType: string; dataSourceName: string; treeInfo: { enable: boolean; }; autograph: string; }>; list?: Array<{ name: string; value: string; extraValue: string; }>; }; }> & Partial; export type IhoTableFormChangePayload = { column: IhoTableFieldItem; row: AnyObject; value: unknown; index: number; type?: string; oldValue?: unknown; option?: null | AnyObject; $table: VxeTableConstructor & VxeTablePrivateMethods; }; export type IhoTableEmits = (event: T, ...args: IhoTableEmitPayload) => void; export type EventListenerToEventName = T extends `on${infer R}` ? R extends `${infer F}${infer L}` ? `${Lowercase}${L}` : never : never; export type EventNameToEventListener = T extends `${infer L}${infer R}` ? `on${Uppercase}${R}` : never; export type IhoTableHandler = Record<'updateConfigRef' | 'updateFieldListRef' | 'updateTableDataRef', () => void>; export type IhoTableEventNameUnion = TupleToUnion; export type IHoTableKeyboardPayload = IhoTableFormChangePayload & { key: string; }; export type IhoTableEmitPayload = T extends 'formChange' | 'formClick' ? [IhoTableFormChangePayload] : T extends 'keyboard' ? [IHoTableKeyboardPayload] : T extends 'settingClick' ? [] : T extends 'rowDrag' ? [Sortable.SortableEvent] : T extends keyof VxeTableListeners ? Parameters> : []; export type IhoTableAnchorItem = { field: string; title: string; left: number; }; export type IhoTableEventTypes = VxeTableEventProps & VxePagerEventProps; export type IhoTableExpose = { $table: VxeTableInstance; loadData(data: AnyObject[]): void; setSort(field: string, value: 'asc' | 'desc' | null): void; setFilter(field: string, value: ArrayAble): void; reload(): Promise; verticalTable: { update: () => void; }; tableDataResolved(): Promise; }; export type IhoTableSeparateInfo = { index: number; isOriginRow: boolean; isLastRow: boolean; separateData: AnyObject; originalData: AnyObject; separateIndex: number; separateLength: number; ihoTableHandler?: IhoTableHandler; }; export type IhoTableProps = Partial<{ tableConfig: IhoTableConfig; fieldList: IhoTableFieldItem[]; tableData: AnyObject[]; annotation: Record; developMode: boolean; }>;