Files
FunJiaUI_Vue_Package/UmTable/core/diagnose.d.ts
T
funjia f26bd3f377 feat: 更新为 1.2.0 构建产物(内核重构版)
- 产物替换为 funjiaui.es.js / funjiaui.cjs.js / funjiaui.umd.js
- style.css 更新,新增 index.d.ts 与各组件类型声明目录
- 移除旧产物 um_table.es.js(1.0.0 的 ES 包,历史与 v1.0.0 标签仍可回溯)
- package.json 补齐 module / types / unpkg / jsdelivr / files 字段,
  并将 vue、element-plus、@element-plus/icons-vue 声明为 peerDependencies
- 新增 README 说明产物清单与用法
2026-09-19 01:04:09 +08:00

46 lines
2.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 配置体检。
*
* 装饰器驱动这套写法的最大代价是"错误是静默的":字符串写错、装饰器挂错位置、
* 少写一个阶段,编译不报错、运行也不抛异常,只是功能没生效。使用方看到的现象
* 永远是"点了没反应",然后去找组件的 bug —— 而问题在他的配置类里。
*
* 这个模块把常见的配置失误在组件挂载时一次性报出来,让静默的失败变成一条
* 指得出位置的警告。它只读元数据、不改行为,报错也不阻断渲染。
*/
export type TDiagnosticLevel = "error" | "warn";
export interface IDiagnostic {
level: TDiagnosticLevel;
/** 规则名,便于单测断言与按需忽略 */
code: string;
/** 出问题的成员(属性名 / 方法名 / 按钮类型),用于定位 */
member?: string;
/** 一句话结论 */
message: string;
/** 具体怎么改 */
hint?: string;
}
export interface IDiagnoseOptions {
/**
* 需要"弹窗确认后才提交"的按钮类型,缺省用 `DEFAULT_DEFER_TYPES`。
* 传了就以传入的为准(组件会把自己的 `defer-after-types` 传进来)。
*/
deferAfterTypes?: string[];
/** 是否要求存在 `getList``UmByClassEnhance` 场景传 true */
requireGetList?: boolean;
}
/**
* 检查一个配置类,返回全部发现的问题(按 error -> warn、再按成员名排序)。
* 只读,不产生任何副作用。
*/
export declare const diagnoseTarget: (target: any, options?: IDiagnoseOptions) => IDiagnostic[];
export declare const setDiagnosticsEnabled: (enabled: boolean) => void;
export declare const isDiagnosticsEnabled: () => boolean;
export interface IReportOptions extends IDiagnoseOptions {
/** 本次是否上报(组件会把 `:diagnose="false"` 传进来) */
enabled?: boolean;
}
/** 把诊断结果打到控制台,并原样返回,便于使用方自行处理 */
export declare const reportDiagnostics: (target: any, options?: IReportOptions) => IDiagnostic[];
export declare const reportDiagnosticsOnce: (target: any, options?: IReportOptions) => IDiagnostic[];