@dazhicheng/ui 1.6.2 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -34,12 +34,12 @@ export type TtUseTableRenderReturnType<Row = any> = [
|
|
|
34
34
|
*
|
|
35
35
|
* 返回 [FormTable 组件, TableFormApi API]。
|
|
36
36
|
*
|
|
37
|
-
* `options`
|
|
38
|
-
* `
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
37
|
+
* `options` 用 `NoInfer` 包裹,`Row` 不再从传入的配置反向推断。业务常见写法是在
|
|
38
|
+
* `form.schemas` 的回调里引用解构出来的 api:
|
|
39
|
+
* `const [FormTable, api] = useTableFormRender({ form: { schemas: [{ onChange: () => f(api) }] } })`,
|
|
40
|
+
* 若 `Row` 从 `options` 推断,则 api 的类型依赖 options、options 又引用 api,TS 判定为循环,
|
|
41
|
+
* 整个变量退化成隐式 any 并报 TS7022/TS7023。代价是需要显式写
|
|
42
|
+
* `useTableFormRender<Row>({ ... })` 才能拿到行类型推断,不写则为 `any`。
|
|
43
43
|
*
|
|
44
44
|
* @param options 表格渲染配置项
|
|
45
45
|
* @returns [FormTable组件, TableFormApi API]
|
|
@@ -61,16 +61,16 @@ export type TtUseTableRenderReturnType<Row = any> = [
|
|
|
61
61
|
* // 在模板中使用
|
|
62
62
|
* <FormTable />
|
|
63
63
|
*/
|
|
64
|
-
export declare function useTableFormRender<Row = any>(options: TtTableFormProps<
|
|
64
|
+
export declare function useTableFormRender<Row = any>(options: NoInfer<TtTableFormProps<Row>>): TtUseTableFormRenderReturnType<Row>;
|
|
65
65
|
/**
|
|
66
66
|
* 用于渲染表格的 hooks,返回 [TableRender 组件, 表格API]。
|
|
67
67
|
*
|
|
68
68
|
* options 只接受表格配置;单向数据使用 data,双向数据绑定到返回的 TableRender 组件。
|
|
69
69
|
*
|
|
70
|
-
* `options`
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
70
|
+
* `options` 用 `NoInfer` 包裹,`Row` 不从配置反向推断。业务常见写法是初始化时给 `data: []`,
|
|
71
|
+
* 若 `Row` 从空数组推断会退化成 `never`,组件的 `data` prop 类型变成 `MaybeRef<never[]>`,
|
|
72
|
+
* 之后传入任何具体行类型都会报 TS2322。代价是需要显式写 `useTableRender<Row>({ ... })`
|
|
73
|
+
* 才能拿到行类型推断,不写则为 `any`。
|
|
74
74
|
*
|
|
75
75
|
* @param options 表格渲染配置项
|
|
76
76
|
* @returns [TableRender组件, 表格API]
|
|
@@ -91,5 +91,5 @@ export declare function useTableFormRender<Row = any>(options: TtTableFormProps<
|
|
|
91
91
|
* // 在模板中使用
|
|
92
92
|
* <TableRender />
|
|
93
93
|
*/
|
|
94
|
-
export declare function useTableRender<Row = any>(options: TtTableProps<
|
|
94
|
+
export declare function useTableRender<Row = any>(options: NoInfer<TtTableProps<Row>>): TtUseTableRenderReturnType<Row>;
|
|
95
95
|
export {};
|