import { AxiosResponse, AxiosInstance, AxiosProgressEvent, AxiosRequestConfig } from 'axios'; interface LocationResult { latitude: number; longitude: number; accuracy: number; timestamp: number; } /** * @description 获取浏览器地理位置 * @param options 地理位置获取配置选项 * @returns Promise 成功时返回位置信息,失败时reject错误信息 */ declare const getLocation: (options?: PositionOptions) => Promise; interface LoadCallback { onerror?: (error: string | Event) => void; onload?: () => void; } /** * @description 动态加载js文件 * @param url js 地址 * @param param1 成功、失败回调函数 * @returns */ declare const loadScript: (url: string, { onerror, onload }?: LoadCallback) => void; /** * @description 动态加载css文件 * @param url css 地址 * @param param1 成功、失败回调函数 * @returns */ declare const loadCSS: (url: string, { onerror, onload }?: LoadCallback) => void; /** * @description 当前环境是否浏览器环境 */ declare const isBrowserEnvironment: () => boolean; /** * @description 是否支持指定的 CSS 属性 * @param property CSS属性名 */ declare const isCSSPropertySupported: (property: string) => boolean; /** * @description 获取当前页面 二级域名 */ declare const parseDomain: () => string; /** * @description 获取 url 路径上的查询参数 * @param url 要解析的URL */ declare const getURLParameters: (url: string) => Record; /** * @description 将对象转换为 URL 参数 * @param obj 需要转换的参数对象 * @returns {string} URL参数字符串 */ declare const toUrlParameters: >(obj: T) => string; interface DoublyLinkedNode { value: T; next: DoublyLinkedNode | null; previous: DoublyLinkedNode | null; } declare class DoublyLinkedList { private _head; private _tail; private _size; constructor(); /** * @description 获取链表所有值的数组 */ get values(): T[]; /** * @readonly * @description 获取链表长度 */ get size(): number; /** * @readonly * @description 获取链表头部节点 */ get head(): DoublyLinkedNode | null; /** * @readonly * @description 获取链表尾部节点 */ get tail(): DoublyLinkedNode | null; /** * @description 在指定位置插入节点 * @param index 需要插入的节点位置 (0-based) * @param value 需要插入的节点值 */ insertAt(index: number, value: T): void; /** * @description 在链表头部添加节点 * @param value 需要插入的节点值 */ insertFirst(value: T): void; /** * @description 在链表尾部添加节点 * @param value 需要插入的节点值 */ insertLast(value: T): void; /** * @description 获取节点 * @param index 需要获取的节点位置 (0-based) */ getAt(index: number): DoublyLinkedNode | null; /** * @description 移除节点 * @param index 需要移除的节点的位置 (0-based) */ removeAt(index: number): DoublyLinkedNode | null; /** * @description 删除头节点 */ removeFirst(): DoublyLinkedNode | null; /** * @description 删除尾节点 */ removeLast(): DoublyLinkedNode | null; /** * @description 查找值在链表中的索引 * @param value 要查找的值 */ indexOf(value: T): number; /** * @description 检查链表是否包含指定值 * @param value 要检查的值 */ contains(value: T): boolean; /** * @description 清空链表 */ clear(): void; /** * @description 反转链表 */ reverse(): void; /** * @description 检查链表是否为空 */ isEmpty(): boolean; /** * @description 将链表转换为数组 */ toArray(): T[]; /** * @description 从尾部开始遍历链表 */ reverseIterator(): IterableIterator>; /** * @description 私有方法:获取指定位置的节点(优化版本,从较近的一端开始) * @param index 节点位置 */ private _getNodeAt; /** * @description 遍历链表 */ [Symbol.iterator](): IterableIterator>; } interface LinkedNode { value: T; next: LinkedNode | null; } declare class LinkedList { private _head; private _tail; private _size; constructor(); /** * @description 获取链表所有值的数组 */ get values(): T[]; /** * @readonly * @description 链表长度 */ get size(): number; /** * @readonly * @description 链表中第一个节点 */ get head(): LinkedNode | null; /** * @readonly * @description 链表中最后一个节点 */ get tail(): LinkedNode | null; /** * @description 在指定位置插入节点 * @param index 插入节点的位置 (0-based) * @param value 插入节点的值 */ insertAt(index: number, value: T): void; /** * @description 在链表头部插入节点 * @param value 插入节点的值 */ insertFirst(value: T): void; /** * @description 在链表尾部插入节点 * @param value 插入节点的值 */ insertLast(value: T): void; /** * @description 获取指定位置的节点 * @param index 节点位置 (0-based) */ getAt(index: number): LinkedNode | null; /** * @description 删除指定位置的节点 * @param index 节点位置 (0-based) */ removeAt(index: number): LinkedNode | null; /** * @description 删除头节点 */ removeFirst(): LinkedNode | null; /** * @description 删除尾节点 */ removeLast(): LinkedNode | null; /** * @description 查找值在链表中的索引 * @param value 要查找的值 */ indexOf(value: T): number; /** * @description 检查链表是否包含指定值 * @param value 要检查的值 */ contains(value: T): boolean; /** * @description 清空链表 */ clear(): void; /** * @description 反转链表 */ reverse(): void; /** * @description 检查链表是否为空 */ isEmpty(): boolean; /** * @description 将链表转换为数组 */ toArray(): T[]; /** * @description 私有方法:获取指定位置的节点 * @param index 节点位置 */ private _getNodeAt; /** * @description 遍历链表 */ [Symbol.iterator](): IterableIterator>; } declare class Queue { private readonly items; constructor(); /** * @readonly * @description 是否是空队列 */ get isEmpty(): boolean; /** * @readonly * @description 队列长度 */ get size(): number; /** * @description 入列 * @param item T */ enqueue(item: T): void; /** * @description 出列 */ dequeue(): T | undefined; /** * @description 最后出列的项 */ peek(): T | undefined; } declare class Stack { private readonly items; constructor(); /** * @readonly * @description 是否空栈 */ get isEmpty(): boolean; /** * @readonly * @description 栈大小 */ get size(): number; /** * @description 入栈 * @param item */ push(item: T): void; /** * @description 出栈 */ pop(): T | undefined; /** * @description 最后出栈的项 */ peek(): T; } /** * 二叉树节点接口 */ interface BinaryTreeNode { value: T; left: BinaryTreeNode | null; right: BinaryTreeNode | null; } /** * 通用树节点类 */ declare class TreeNode { key: T; value: T; parent: TreeNode | null; children: Array>; constructor(key: T, value?: T, parent?: TreeNode | null); get isLeaf(): boolean; get hasChildren(): boolean; } declare class Tree { root: TreeNode; constructor(key: T, value?: T); /** * @description 前序遍历树结构。 * @param node */ preOrderTraversal(node?: TreeNode): Generator>; /** * @description 后序遍历树结构。 * @param node */ postOrderTraversal(node?: TreeNode): Generator>; /** * @description 插入节点 * @param parentNodeKey * @param key * @param value */ insert(parentNodeKey: T, key: T, value?: T): boolean; remove(key: T): boolean; find(key: T): TreeNode | undefined; /** * @description 获取树的高度 */ getHeight(): number; /** * @description 获取树的大小(节点数量) */ get size(): number; /** * @description 广度优先遍历 */ breadthFirstTraversal(): Generator>; /** * @description 获取所有叶子节点 */ getLeaves(): TreeNode[]; /** * @description 清空树(保留根节点) */ clear(): void; private _getNodeHeight; } /** * 二叉树遍历顺序类型 */ type TraversalOrder = 'preorder' | 'inorder' | 'postorder' | 'levelorder'; /** * 二叉搜索树类 */ declare class BinaryTree { private _root; private _size; constructor(rootValue?: T); /** * @description 获取根节点 */ get root(): BinaryTreeNode | null; /** * @description 获取树的大小 */ get size(): number; /** * @description 检查树是否为空 */ isEmpty(): boolean; /** * @description 插入节点(按二叉搜索树规则) * @param value 要插入的值 */ insert(value: T): void; /** * @description 搜索值 * @param value 要搜索的值 */ search(value: T): BinaryTreeNode | null; /** * @description 删除节点 * @param value 要删除的值 */ remove(value: T): boolean; /** * @description 获取树的高度 */ getHeight(): number; /** * @description 遍历树 * @param order 遍历顺序 */ traverse(order?: TraversalOrder): T[]; /** * @description 清空树 */ clear(): void; /** * @description 检查是否为平衡二叉树 */ isBalanced(): boolean; /** * @description 获取最小值 */ getMin(): T | null; /** * @description 获取最大值 */ getMax(): T | null; private _insertNode; private _searchNode; private _removeNode; private _getNodeHeight; private _preorderTraversal; private _inorderTraversal; private _postorderTraversal; private _levelorderTraversal; private _checkBalance; private _getMinNode; private _getMaxNode; } /** * 图的边接口 */ interface GraphEdge { a: T; b: T; weight: number; } /** * 图遍历结果接口 */ interface TraversalResult { path: T[]; visited: Set; } /** * 最短路径结果接口 */ interface ShortestPathResult { distance: number; path: T[]; found: boolean; } declare class Graph { directed: boolean; nodes: Array<{ key: T; value: T; }>; edges: Map; constructor(directed?: boolean); /** * @description 向图中添加节点,key 是节点的唯一标识,value 是节点存储的值,默认情况下 value 等于 key。 * @param key * @param value */ addNode(key: T, value?: T): void; /** * @description 向图中添加一条边,从节点 a 到节点 b,并指定边的权重 weight。如果图是无向的,还会添加一条从 b 到 a 的对称边。 * @param a * @param b * @param weight */ addEdge(a: T, b: T, weight: number): void; /** * @description 删除图中的节点 key,同时删除与该节点相关的所有边。 * @param key */ removeNode(key: T): void; /** * @description 删除从节点 a 到节点 b 的边。如果图是无向的,还会删除从 b 到 a 的对称边。 * @param a * @param b */ removeEdge(a: T, b: T): void; /** * @description 查找图中的节点 key,返回该节点对象(包含 key 和 value),如果节点不存在则返回 undefined。 * @param key */ findNode(key: T): { key: T; value: T; } | undefined; /** * @description 检查图中是否存在从节点 a 到节点 b 的边。 * @param a * @param b */ hasEdge(a: T, b: T): boolean; /** * @description 更新从节点 a 到节点 b 的边的权重为 weight。如果图是无向的,也会更新从 b 到 a 的对称边的权重。 * @param a * @param b * @param weight */ setEdgeWeight(a: T, b: T, weight: number): void; /** * @description 获取从节点 a 到节点 b 的边的权重,如果边不存在,返回 undefined。 * @param a * @param b */ getEdgeWeight(a: T, b: T): number | undefined; /** * @description 返回与节点 key 直接相邻的所有节点,即有从 key 出发的边指向的节点列表。 * @param key */ adjacent(key: T): T[]; /** * @description 计算节点 key 的入度,即有多少条边指向该节点。。 * @param key */ inDegree(key: T): number; /** * @description 计算节点 key 的出度,即从该节点出发的边的数量。 * @param key */ outDegree(key: T): number; /** * @description 获取所有节点的键 */ getNodes(): T[]; /** * @description 获取所有边 */ getEdges(): GraphEdge[]; /** * @description 获取图中节点的数量 */ get nodeCount(): number; /** * @description 获取图中边的数量 */ get edgeCount(): number; /** * @description 检查图是否为空 */ isEmpty(): boolean; /** * @description 深度优先搜索遍历 * @param startKey 起始节点 */ dfs(startKey: T): TraversalResult; /** * @description 广度优先搜索遍历 * @param startKey 起始节点 */ bfs(startKey: T): TraversalResult; /** * @description 查找两个节点之间的路径 * @param startKey 起始节点 * @param endKey 目标节点 */ findPath(startKey: T, endKey: T): T[] | null; /** * @description 使用 Dijkstra 算法找最短路径 * @param startKey 起始节点 * @param endKey 目标节点 */ shortestPath(startKey: T, endKey: T): ShortestPathResult; /** * @description 检查图是否有环 */ hasCycle(): boolean; /** * @description 拓扑排序(仅适用于有向无环图) */ topologicalSort(): T[] | null; /** * @description 获取所有连通分量 */ getConnectedComponents(): T[][]; /** * @description 检查图是否连通 */ isConnected(): boolean; /** * @description 清空图 */ clear(): void; /** * @description 克隆图 */ clone(): Graph; private _dfsHelper; private _findPathHelper; private _hasUndirectedCycle; private _hasUndirectedCycleHelper; private _hasDirectedCycle; private _hasDirectedCycleHelper; private _topologicalSortHelper; } interface ColorComponents { r: number; g: number; b: number; a: number; } /** * @description 将颜色转换为RGB分量 * @param color */ declare const convertColor: (color: string) => ColorComponents; /** * @description 数字数组 * @param start 开始 * @param end 结束值 * @param step 步长 * @returns {number[]} */ declare const rangeArray: (start: number, end: number, step?: number) => number[]; type ValueType = string | number | boolean; type Item = { label: string; value: ValueType; }; declare class BiMap { #private; constructor(items?: Item[]); /** 批量添加 */ addAll(items: Item[]): void; /** 添加单个映射 */ add(item: Item): void; /** 根据 value 删除 */ removeByValue(value: string): boolean; /** 根据 label 删除 */ removeByLabel(label: string): boolean; /** 清空所有映射 */ clear(): void; /** 根据 value 获取 label */ getLabel(value: string): string | undefined; /** 根据 label 获取 value */ getValue(label: string): ValueType | undefined; hasValue(value: string): boolean; hasLabel(label: string): boolean; /** 获取所有 value→label 映射 */ entries(): [ValueType, string][]; /** 转换为数组 */ toArray(): Item[]; } /** * @description 工厂 + 工具类 */ declare class BiMapFactory { #private; /** 基于 array 缓存复用 */ static fromArray(items: Item[]): BiMap; /** 一次性转换成 BiMap(不缓存) */ static toBiMap(items: Item[]): BiMap; /** 转换成 value→label 的 Map */ static toValueMap(items: Item[]): Map; /** 转换成 label→value 的 Map */ static toLabelMap(items: Item[]): Map; } declare const DateFormat: { DATE_FORMAT: string; TIME_FORMAT: string; DATE_TIME_FORMAT: string; MONTH_DAY_FORMAT: string; YEAR_FORMAT: string; }; /** * @description 驼峰转连接符 * @param input 要处理的字符串 * @param delimiter 连接符号 */ declare const humpToLinker: (input: string, delimiter?: string) => string; /** * @description 连接符转驼峰 * @param input 要处理的字符串 * @param delimiter 字符串的连接符号 * @param capitalizeFirst 是否转为大驼峰 */ declare const linkerToHump: (input: string, delimiter?: string, capitalizeFirst?: boolean) => string; /** * @description 首字母转大写 * @param text */ declare const upperFirst: (text: string) => string; /** * @description 首字母转小写 * @param text */ declare const lowerFirst: (text: string) => string; /** * 请求工厂配置选项 */ interface RequestFactoryOptions { baseURL?: string; timeout?: number; getToken?: () => string | null; handleError?: (error: unknown) => void; transformResponse?: (response: AxiosResponse) => any; cancelDuplicate?: boolean; } /** * 创建HTTP请求客户端 * @param options 配置选项 * @returns Axios实例 */ declare function createRequestClient(options?: RequestFactoryOptions): AxiosInstance; /** * HTTP请求配置 */ interface HttpRequestConfig extends AxiosRequestConfig { /** * 是否显示加载状态 */ loading?: boolean; /** * 是否显示错误信息 */ showError?: boolean; /** * 自定义错误处理 */ customErrorHandler?: (error: any) => void; } /** * 文件上传配置 */ interface UploadConfig { /** * 上传进度回调 */ onProgress?: (progressEvent: AxiosProgressEvent) => void; /** * 文件字段名 */ fieldName?: string; /** * 额外的表单数据 */ data?: Record; } /** * 文件下载配置 */ interface DownloadConfig { /** * 下载文件名 */ filename?: string; /** * 下载进度回调 */ onProgress?: (progressEvent: AxiosProgressEvent) => void; } /** * 增强的HTTP客户端 */ declare class HttpClient { private instance; constructor(options?: RequestFactoryOptions); /** * GET请求 */ get(url: string, config?: HttpRequestConfig): Promise; /** * POST请求 */ post(url: string, data?: any, config?: HttpRequestConfig): Promise; /** * PUT请求 */ put(url: string, data?: any, config?: HttpRequestConfig): Promise; /** * DELETE请求 */ delete(url: string, config?: HttpRequestConfig): Promise; /** * PATCH请求 */ patch(url: string, data?: any, config?: HttpRequestConfig): Promise; /** * 文件上传 */ upload(url: string, file: File | File[], config?: UploadConfig): Promise; /** * 文件下载 * @description 通过HTTP请求下载文件,支持进度监控 * @param url 文件下载URL * @param config 下载配置 */ download(url: string, config?: DownloadConfig): Promise; /** * 从URL中提取文件名 * @param url 文件URL * @returns 文件名 */ private getFilenameFromUrl; /** * 通用请求方法 */ request(config: HttpRequestConfig): Promise; /** * 获取原始axios实例 */ getAxiosInstance(): AxiosInstance; } /** * 创建HTTP客户端实例 */ declare function createHttpClient(options?: RequestFactoryOptions): HttpClient; /** * HTTP响应数据结构 */ interface HttpResponse { /** * 响应数据 */ data: T; /** * 响应状态码 */ code: number; /** * 响应消息 */ message: string; /** * 时间戳 */ timestamp?: number; } /** * HTTP错误对象 */ interface HttpError extends Error { /** * 错误码 */ code?: string | number; /** * HTTP状态码 */ status?: number; /** * 请求配置 */ config?: any; /** * 响应对象 */ response?: AxiosResponse; /** * 是否为请求取消 */ isCancel?: boolean; } /** * @description 校验文件是否支持上传 * @param fileType {string} 当前的文件类型 * @param acceptString {string} 支持的文件类型 * @returns boolean */ declare const isFileTypeAccepted: (fileType: string, acceptString: string) => boolean; /** * @description 下载文件 * @param file {File} 文件对象 * @param fileName {string} 文件名 * @returns {Promise} */ declare function saveFile(file: File, fileName?: string): Promise; /** * @description 下载文件 * @param fileOrUrl 文件或者文件 URL * @param fileName 文件名 */ declare function downloadFile(fileOrUrl: File | ArrayBuffer | Blob | string, fileName?: string): Promise; /** * Excel 解析组件类型定义 * * 本模块定义了 Excel 文件解析、数据处理和数据校验相关的所有类型。 * 整体数据流: 文件解析 (ParsedTableData) → 数据处理 (ProcessedDataRow) → 数据校验 (ValidationResult) * Worker 与主线程之间通过事件消息通信,事件类型包括: progress / result / dataChunk / complete / error */ /** Excel 文件解析后的原始表格数据 */ interface ParsedTableData { /** 表头名称列表 */ headers: string[]; /** 数据行数组,每行以表头名称为键的键值对 */ rows: Record[]; } /** 单条数据校验错误信息 */ interface ValidationError { /** 出错行索引(从 0 开始) */ row: number; /** 出错列名(对应表头名称) */ column: string; /** 错误描述信息 */ message: string; /** 出错单元格的原始值 */ value?: string | number | Date; } /** 数据校验结果 */ interface ValidationResult { /** 整体是否通过校验(无任何错误时为 true) */ isValid: boolean; /** 所有校验错误列表 */ errors: ValidationError[]; /** 通过校验的行数 */ validRowCount: number; /** 总行数 */ totalRowCount: number; } /** 解析各阶段的性能计时信息(单位: 毫秒) */ interface ParsePerformanceInfo { /** 文件解析耗时 */ parseTime: number; /** 数据处理耗时(仅在配置了 processor 时存在) */ processTime?: number; /** 数据校验耗时(仅在配置了 validator 时存在) */ validationTime?: number; /** 总耗时(从开始解析到数据就绪) */ totalTime: number; } /** 文件读取进度事件 */ interface ParseProgressEvent { type: 'progress'; /** 进度百分比 (0-100) */ percent: number; } /** 经过处理器处理后的单行数据 */ interface ProcessedDataRow { /** 原始行索引(从 0 开始) */ row?: number; /** 处理后的行数据 */ data: Record; } /** 处理后的数据结果,按校验结果分为有效和无效两组 */ interface ProcessedDataResult { /** 通过校验的有效数据行 */ validData: ProcessedDataRow[]; /** 未通过校验的无效数据行 */ invalidData: ProcessedDataRow[]; } /** * 解析结果事件 * * Worker 完成解析后首先发送此事件,包含表头、元数据和性能信息。 * 实际的行数据通过后续的 dataChunk 事件分块发送,以避免一次性传输大量数据。 */ interface ParseResultEvent { type: 'result'; /** 原始解析数据(rows 为空数组,实际数据通过 dataChunk 事件发送) */ data: ParsedTableData; /** 处理后的数据结果概要(validData/invalidData 为空数组,实际数据通过 dataChunk 事件发送) */ processedData?: ProcessedDataResult; /** 校验结果 */ validationResult?: ValidationResult; /** 性能计时信息 */ performance: ParsePerformanceInfo; /** 数据摘要元信息 */ metadata?: { /** 原始数据总行数 */ totalRows: number; /** 有效数据总行数 */ totalProcessedValidData: number; /** 无效数据总行数 */ totalProcessedInvalidData: number; /** 是否包含原始行数据 */ hasRawData: boolean; }; } /** * 数据块事件 * * 用于分块传输大量数据,避免 postMessage 序列化大数组时造成主线程卡顿。 * 每块最多包含 CHUNK_SIZE (1000) 行数据。 */ interface ParseDataChunkEvent { type: 'dataChunk'; /** 当前块的数据 */ data: Record[] | ProcessedDataRow[]; /** 起始索引(在当前块内的偏移,始终为 0) */ startIndex: number; /** 结束索引(当前块的数据长度) */ endIndex: number; /** 是否为原始解析数据(true: 原始行数据,false: 处理后数据) */ isRawData: boolean; /** 处理后数据的有效性(仅在 isRawData 为 false 时有值) */ isValid?: boolean; } /** 所有数据传输完成事件 */ interface ParseCompleteEvent { type: 'complete'; } /** 解析或处理过程中的错误事件 */ interface ParseErrorEvent { type: 'error'; /** 错误描述信息 */ message: string; /** 错误码,如 PARSE_ERROR / PROCESSOR_ERROR / PROCESSOR_NOT_FOUND / VALIDATOR_NOT_FOUND */ code?: string; /** 原始错误对象 */ details?: unknown; } /** * 数据处理器函数 * * 接收原始解析数据,返回处理后的行数据数组。 * 可用于数据清洗、格式转换、字段映射等场景。 */ type DataProcessor = (data: ParsedTableData) => ProcessedDataRow[]; /** * 数据校验器函数 * * 接收原始数据和处理后的数据(可选),返回校验结果。 */ type DataValidator = (data: ParsedTableData, processedData?: ProcessedDataRow[]) => ValidationResult; /** 处理器函数注册项 */ interface ProcessorFunctionRegistration { /** 处理器唯一标识 */ id: string; /** 处理器函数 */ processor: DataProcessor; } /** 校验器函数注册项 */ interface ValidatorFunctionRegistration { /** 校验器唯一标识 */ id: string; /** 校验器函数 */ validator: DataValidator; } /** Worker 消息格式(主线程发送给 Worker) */ interface WorkerMessage { /** 要解析的 Excel 文件 */ file: File; /** 已注册的数据处理器 ID(可选) */ processorId?: string; /** 已注册的数据校验器 ID(可选) */ validatorId?: string; } /** 解析完成事件的数据结构 */ interface ParseCompleteData { originalData: ParsedTableData['rows']; validData: ProcessedDataRow[]; invalidData: ProcessedDataRow[]; validationResult?: ValidationResult; performance?: ParsePerformanceInfo; } /** * 异步解析 Excel 文件为结构化表格数据 * * 解析流程: * 1. 使用 FileReader 读取文件为 ArrayBuffer * 2. 使用 SheetJS 解析工作簿,取第一个工作表 * 3. 读取第一行作为表头(跳过空列) * 4. 逐行读取数据,以表头为键构建对象数组 * * @param file - 要解析的 Excel 文件对象 * @param onProgress - 可选的文件读取进度回调函数 * @returns 解析后的表格数据,包含表头和行数据 */ declare function parseExcelFile(file: File, onProgress?: (percent: number) => void): Promise; /** * 数据处理和校验函数注册表 * * 提供 DataProcessor(数据处理器)和 DataValidator(数据校验器)的注册、查询和管理功能。 * Worker 线程通过 ID 查找对应的处理/校验函数来执行数据处理流水线。 * * 注意: 该注册表会被主线程和 Worker 线程分别实例化,需确保两侧都注册了相同的函数。 */ declare class FunctionRegistry { private processors; private validators; /** * 注册数据处理器 * * @param id - 处理器唯一标识,Worker 通过此 ID 查找处理器 * @param processor - 处理器函数 */ registerProcessor(id: string, processor: DataProcessor): void; /** * 注册数据校验器 * * @param id - 校验器唯一标识,Worker 通过此 ID 查找校验器 * @param validator - 校验器函数 */ registerValidator(id: string, validator: DataValidator): void; /** 根据ID获取已注册的数据处理器 */ getProcessor(id: string): DataProcessor | undefined; /** 根据ID获取已注册的数据校验器 */ getValidator(id: string): DataValidator | undefined; /** 注销指定数据处理器 */ unregisterProcessor(id: string): boolean; /** 注销指定数据校验器 */ unregisterValidator(id: string): boolean; /** 获取所有已注册的数据处理器 ID 列表 */ listProcessors(): string[]; /** 获取所有已注册的数据校验器 ID 列表 */ listValidators(): string[]; /** 清除所有已注册的处理器和校验器 */ clear(): void; } /** 全局单例注册表实例 */ declare const functionRegistry: FunctionRegistry; /** * 默认数据校验器 * * 内置校验规则: 检查表头中带有星号 (*) 标记的列为必填列,若对应单元格为空则报告校验错误。 * 例如表头 "姓名*" 表示 "姓名" 列为必填。 */ /** 默认校验器在注册表中的唯一标识 */ declare const defaultDataValidatorId = "default-validator"; /** * 默认校验器实现 * * 校验逻辑: * 1. 扫描所有表头,找出名称中包含 '*' 的列作为必填列 * 2. 若无必填列,直接返回校验通过 * 3. 逐行检查必填列的值是否为空(null、undefined 或空白字符串) */ declare const defaultDataValidator: DataValidator; /** * 启动 Excel Worker 消息处理 * * 在 Worker 线程中调用此函数以注册 onmessage 处理器。 * 各框架的 worker 代理文件应在顶层调用此函数。 */ declare function runExcelWorker(): void; /** * Excel 文件格式校验工具 */ /** * 校验文件格式是否为支持的 Excel 类型 * * @param file - 文件对象 * @returns 是否为有效的 Excel 文件格式 */ declare const isValidExcelFile: (file: File) => boolean; /** * Worker 内部辅助函数 * * 提供数据分组、行包装等工具函数,供 Worker 线程在处理解析结果时使用。 */ /** * 从校验结果中提取失败行的索引集合 * * @returns 失败行索引的 Set,若校验结果为空或无错误则返回 undefined */ declare const createFailedRows: (validationResult?: ValidationResult) => Set | undefined; /** * 将处理器输出的行数据按校验结果分为有效和无效两组 * * 遍历已处理行数据,根据校验失败的行索引集合进行分类。 * 预分配数组大小以减少内存重分配。 */ declare const buildProcessedData: (rows: ProcessedDataRow[], failedRows?: Set) => ProcessedDataResult; /** * 将原始解析行数据包装为 ProcessedDataRow 格式,并按校验结果分组 * * 当未配置数据处理器时,使用此函数直接将原始行数据包装后分组。 */ declare const wrapParsedRows: (rows: ParsedTableData["rows"], failedRows?: Set) => ProcessedDataResult; export { BiMapFactory, BinaryTree, DateFormat, DoublyLinkedList, FunctionRegistry, Graph, HttpClient, LinkedList, Queue, Stack, Tree, TreeNode, buildProcessedData, convertColor, createFailedRows, createHttpClient, createRequestClient, defaultDataValidator, defaultDataValidatorId, downloadFile, functionRegistry, getLocation, getURLParameters, humpToLinker, isBrowserEnvironment, isCSSPropertySupported, isFileTypeAccepted, isValidExcelFile, linkerToHump, loadCSS, loadScript, lowerFirst, parseDomain, parseExcelFile, rangeArray, runExcelWorker, saveFile, toUrlParameters, upperFirst, wrapParsedRows }; export type { BinaryTreeNode, DataProcessor, DataValidator, DoublyLinkedNode, DownloadConfig, GraphEdge, HttpError, HttpRequestConfig, HttpResponse, LinkedNode, ParseCompleteData, ParseCompleteEvent, ParseDataChunkEvent, ParseErrorEvent, ParsePerformanceInfo, ParseProgressEvent, ParseResultEvent, ParsedTableData, ProcessedDataResult, ProcessedDataRow, ProcessorFunctionRegistration, RequestFactoryOptions, ShortestPathResult, TraversalOrder, TraversalResult, UploadConfig, ValidationError, ValidationResult, ValidatorFunctionRegistration, WorkerMessage };