|
@@ -9,7 +9,7 @@ import type { Ref } from 'vue';
|
|
|
|
|
|
import type { ClassType, DeepPartial } from '@vben/types';
|
|
|
|
|
|
-import type { VbenFormProps } from '@vben-core/form-ui';
|
|
|
+import type { BaseFormComponentType, VbenFormProps } from '@vben-core/form-ui';
|
|
|
|
|
|
import type { VxeGridApi } from './api';
|
|
|
|
|
@@ -35,7 +35,11 @@ export interface SeparatorOptions {
|
|
|
show?: boolean;
|
|
|
backgroundColor?: string;
|
|
|
}
|
|
|
-export interface VxeGridProps {
|
|
|
+
|
|
|
+export interface VxeGridProps<
|
|
|
+ T extends Record<string, any> = any,
|
|
|
+ D extends BaseFormComponentType = BaseFormComponentType,
|
|
|
+> {
|
|
|
/**
|
|
|
* 标题
|
|
|
*/
|
|
@@ -55,15 +59,15 @@ export interface VxeGridProps {
|
|
|
/**
|
|
|
* vxe-grid 配置
|
|
|
*/
|
|
|
- gridOptions?: DeepPartial<VxeTableGridOptions>;
|
|
|
+ gridOptions?: DeepPartial<VxeTableGridOptions<T>>;
|
|
|
/**
|
|
|
* vxe-grid 事件
|
|
|
*/
|
|
|
- gridEvents?: DeepPartial<VxeGridListeners>;
|
|
|
+ gridEvents?: DeepPartial<VxeGridListeners<T>>;
|
|
|
/**
|
|
|
* 表单配置
|
|
|
*/
|
|
|
- formOptions?: VbenFormProps;
|
|
|
+ formOptions?: VbenFormProps<D>;
|
|
|
/**
|
|
|
* 显示搜索表单
|
|
|
*/
|
|
@@ -74,9 +78,12 @@ export interface VxeGridProps {
|
|
|
separator?: boolean | SeparatorOptions;
|
|
|
}
|
|
|
|
|
|
-export type ExtendedVxeGridApi = VxeGridApi & {
|
|
|
- useStore: <T = NoInfer<VxeGridProps>>(
|
|
|
- selector?: (state: NoInfer<VxeGridProps>) => T,
|
|
|
+export type ExtendedVxeGridApi<
|
|
|
+ D extends Record<string, any> = any,
|
|
|
+ F extends BaseFormComponentType = BaseFormComponentType,
|
|
|
+> = VxeGridApi<D> & {
|
|
|
+ useStore: <T = NoInfer<VxeGridProps<D, F>>>(
|
|
|
+ selector?: (state: NoInfer<VxeGridProps<any, any>>) => T,
|
|
|
) => Readonly<Ref<T>>;
|
|
|
};
|
|
|
|