/** * 图表注释配置中 `x`/`y` 字段名 → 表头列 `dataIndex` 的模糊匹配工具。 * * 背景: * - 用户在 HTML 注释里写 ``, * 但表格表头常带括号单位说明,如 `| 时段 | 客单价(元) |`。 * - 直接用 `row["客单价"]` 取值会取不到 `客单价(元)` 列,导致图表无数据。 * * 这里提供与 `MarkdownEditor/editor/parser/parse/parseTable.ts` 中 * `columnKeyMatchesConfiguredField` / `resolveChartAxisFieldToColumnKey` 行为完全一致 * 的实现,供 MarkdownRenderer 链路(remarkChartFromComment 插件)复用, * 避免编辑器与渲染器在「同一份 markdown」上呈现不同行为。 */ /** * 判断表头列名 `columnKey` 是否对应注释里配置的轴字段 `configuredField`。 * * 命中规则(按顺序): * 1. 双方 `trim()` 后完全相等 * 2. `columnKey` 以 `configuredField` 开头,且剩余部分完全匹配 * `TRAILING_UNIT_SUFFIX_PATTERN`(即只多出中英文括号包裹的单位/补充说明) * * 大小写敏感、不忽略字符串内部空格。 */ export declare const columnKeyMatchesConfiguredField: (columnKey: string, configuredField: string) => boolean; /** * 把注释里写的 `x`/`y` 字段名解析为表格列实际的 `dataIndex`。 * * - 字段为 `undefined` / `null` 时原样返回 * - 字段 `trim()` 后为空字符串时原样返回(保留调用方语义) * - 列名集合中存在精确匹配时直接返回该精确字段 * - 否则走 {@link columnKeyMatchesConfiguredField} 找第一个命中的列名 * - 全部不命中时返回原 `configuredField`(让下游决定如何处理"找不到列") */ export declare const resolveChartAxisFieldToColumnKey: (configuredField: string | undefined, columnKeys: string[]) => string | undefined; /** * 对单个 chart 配置对象的 `x`/`y` 字段做归一化,返回新对象。 * * 不修改入参,未声明 `x`/`y` 的配置原样保留其它字段。 */ export declare const normalizeChartConfigAxisFields: (cfg: T, columnKeys: string[]) => T;