@tmagic/table 1.3.16 → 1.4.0-beta.2

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.
@@ -553,4 +553,4 @@ const index = {
553
553
  }
554
554
  };
555
555
 
556
- export { _sfc_main as MagicTable, index as default };
556
+ export { _sfc_main as MagicTable, index as default, formatter };
@@ -555,6 +555,7 @@
555
555
 
556
556
  exports.MagicTable = _sfc_main;
557
557
  exports.default = index;
558
+ exports.formatter = formatter;
558
559
 
559
560
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
560
561
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.16",
2
+ "version": "1.4.0-beta.2",
3
3
  "name": "@tmagic/table",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -29,32 +29,33 @@
29
29
  "url": "https://github.com/Tencent/tmagic-editor.git"
30
30
  },
31
31
  "dependencies": {
32
- "@tmagic/design": "1.3.16",
33
- "@tmagic/form": "1.3.16",
34
- "@tmagic/utils": "1.3.16",
32
+ "@tmagic/design": "1.4.0-beta.2",
33
+ "@tmagic/form": "1.4.0-beta.2",
34
+ "@tmagic/utils": "1.4.0-beta.2",
35
35
  "lodash-es": "^4.17.21",
36
- "vue": "^3.3.8"
36
+ "vue": "^3.4.21"
37
37
  },
38
38
  "peerDependencies": {
39
- "@tmagic/form": "1.3.16",
40
- "vue": "^3.3.8"
39
+ "@tmagic/form": "1.4.0-beta.2",
40
+ "vue": "^3.4.21"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/color": "^3.0.1",
44
44
  "@types/lodash-es": "^4.17.4",
45
45
  "@types/node": "^18.19.0",
46
46
  "@vitejs/plugin-vue": "^4.5.2",
47
- "@vue/compiler-sfc": "^3.3.8",
48
- "@vue/test-utils": "^2.3.2",
47
+ "@vue/compiler-sfc": "^3.4.21",
48
+ "@vue/test-utils": "^2.4.4",
49
49
  "rimraf": "^3.0.2",
50
50
  "sass": "^1.35.1",
51
- "typescript": "^5.0.4",
52
- "vite": "^5.0.7",
53
- "vue-tsc": "^1.8.25"
51
+ "typescript": "^5.4.2",
52
+ "vite": "^5.1.6",
53
+ "vue-tsc": "^2.0.6"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "npm run build:type && vite build",
57
57
  "build:type": "npm run clear:type && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.build.json",
58
- "clear:type": "rimraf ./types"
58
+ "clear:type": "rimraf ./types",
59
+ "type:check": "vue-tsc --noEmit"
59
60
  }
60
61
  }
package/src/Table.vue CHANGED
@@ -72,6 +72,7 @@ import ActionsColumn from './ActionsColumn.vue';
72
72
  import ComponentColumn from './ComponentColumn.vue';
73
73
  import ExpandColumn from './ExpandColumn.vue';
74
74
  import PopoverColumn from './PopoverColumn.vue';
75
+ import type { ColumnConfig } from './schema';
75
76
  import TextColumn from './TextColumn.vue';
76
77
 
77
78
  defineOptions({
@@ -81,7 +82,7 @@ defineOptions({
81
82
  const props = withDefaults(
82
83
  defineProps<{
83
84
  data: any[];
84
- columns?: any[];
85
+ columns?: ColumnConfig[];
85
86
  /** 合并行或列的计算方法 */
86
87
  spanMethod?: (data: { row: any; column: any; rowIndex: number; columnIndex: number }) => [number, number];
87
88
  loading?: boolean;
package/src/index.ts CHANGED
@@ -21,6 +21,8 @@ import { App } from 'vue';
21
21
  import Table from './Table.vue';
22
22
 
23
23
  export { default as MagicTable } from './Table.vue';
24
+ export * from './schema';
25
+ export * from './utils';
24
26
 
25
27
  export default {
26
28
  install(app: App) {
package/src/schema.ts CHANGED
@@ -20,10 +20,10 @@ import { FormConfig, FormValue } from '@tmagic/form';
20
20
 
21
21
  export interface ColumnActionConfig {
22
22
  type?: 'delete' | 'copy' | 'edit';
23
- buttonType: string;
23
+ buttonType?: string;
24
24
  display?: (row: any) => boolean;
25
- text: string | ((row: any) => string);
26
- name: string;
25
+ text?: string | ((row: any) => string);
26
+ name?: string;
27
27
  tooltip?: string;
28
28
  tooltipPlacement?: string;
29
29
  icon?: any;
@@ -33,7 +33,7 @@ export interface ColumnActionConfig {
33
33
  action?: (data: { data: any }) => void;
34
34
  }
35
35
 
36
- export type ColumnConfig = {
36
+ export interface ColumnConfig<T = any> {
37
37
  form?: FormConfig;
38
38
  rules?: any;
39
39
  values?: FormValue;
@@ -43,12 +43,12 @@ export type ColumnConfig = {
43
43
  fixed?: 'left' | 'right' | boolean;
44
44
  width?: number | string;
45
45
  actions?: ColumnActionConfig[];
46
- type?: 'popover' | 'expand' | 'component' | string | ((value: any, row: any) => string);
46
+ type?: 'popover' | 'expand' | 'component' | string | ((value: any, row: T) => string);
47
47
  text?: string;
48
48
  prop?: string;
49
49
  showHeader?: boolean;
50
50
  table?: ColumnConfig[];
51
- formatter?: 'datetime' | ((item: any, row: Record<string, any>) => any);
51
+ formatter?: 'datetime' | ((item: any, row: T) => any);
52
52
  popover?: {
53
53
  placement: string;
54
54
  width: string;
@@ -57,9 +57,9 @@ export type ColumnConfig = {
57
57
  };
58
58
  sortable?: boolean | 'custom';
59
59
  action?: 'tip' | 'actionLink' | 'img' | 'link' | 'tag';
60
- handler?: (row: any) => void;
60
+ handler?: (row: T) => void;
61
61
  /** 当type为expand时有效,展开为html */
62
- expandContent?: (row: any, prop?: string) => string;
62
+ expandContent?: (row: T, prop?: string) => string;
63
63
  /** 当type为expand时,展开为vue组件;当type为component时显示的组件 */
64
64
  component?: any;
65
65
  /** 当type为expand时,展开的vue组件props;当type为component时显示的组件的props */
@@ -68,4 +68,4 @@ export type ColumnConfig = {
68
68
  listeners?: any;
69
69
  /** 当type为tip时有效,显示文案 */
70
70
  buttonText?: string;
71
- };
71
+ }
@@ -1,5 +1,5 @@
1
1
  import { ColumnConfig } from './schema';
2
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
3
3
  columns: any[];
4
4
  config: ColumnConfig;
5
5
  rowkeyName?: string | undefined;
@@ -11,7 +11,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
11
11
  editState: () => never[];
12
12
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
13
  "after-action": (...args: any[]) => void;
14
- }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
14
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
15
15
  columns: any[];
16
16
  config: ColumnConfig;
17
17
  rowkeyName?: string | undefined;
@@ -30,15 +30,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
30
30
  editState: any;
31
31
  }, {}>;
32
32
  export default _default;
33
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
34
- type __VLS_TypePropsToRuntimeProps<T> = {
35
- [K in keyof T]-?: {} extends Pick<T, K> ? {
36
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
37
- } : {
38
- type: import('vue').PropType<T[K]>;
39
- required: true;
40
- };
41
- };
42
33
  type __VLS_WithDefaults<P, D> = {
43
34
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
44
35
  default: D[K];
@@ -47,3 +38,12 @@ type __VLS_WithDefaults<P, D> = {
47
38
  type __VLS_Prettify<T> = {
48
39
  [K in keyof T]: T[K];
49
40
  } & {};
41
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
42
+ type __VLS_TypePropsToOption<T> = {
43
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
44
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
45
+ } : {
46
+ type: import('vue').PropType<T[K]>;
47
+ required: true;
48
+ };
49
+ };
@@ -1,9 +1,9 @@
1
1
  import { ColumnConfig } from './schema';
2
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
3
3
  config: ColumnConfig;
4
4
  }>, {
5
5
  config: () => {};
6
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
6
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
7
7
  config: ColumnConfig;
8
8
  }>, {
9
9
  config: () => {};
@@ -11,15 +11,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
11
11
  config: ColumnConfig;
12
12
  }, {}>;
13
13
  export default _default;
14
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
- type __VLS_TypePropsToRuntimeProps<T> = {
16
- [K in keyof T]-?: {} extends Pick<T, K> ? {
17
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
18
- } : {
19
- type: import('vue').PropType<T[K]>;
20
- required: true;
21
- };
22
- };
23
14
  type __VLS_WithDefaults<P, D> = {
24
15
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
25
16
  default: D[K];
@@ -28,3 +19,12 @@ type __VLS_WithDefaults<P, D> = {
28
19
  type __VLS_Prettify<T> = {
29
20
  [K in keyof T]: T[K];
30
21
  } & {};
22
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
23
+ type __VLS_TypePropsToOption<T> = {
24
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
25
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
26
+ } : {
27
+ type: import('vue').PropType<T[K]>;
28
+ required: true;
29
+ };
30
+ };
@@ -1,9 +1,9 @@
1
1
  import { ColumnConfig } from './schema';
2
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
3
3
  config: ColumnConfig;
4
4
  }>, {
5
5
  config: () => {};
6
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
6
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
7
7
  config: ColumnConfig;
8
8
  }>, {
9
9
  config: () => {};
@@ -11,15 +11,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
11
11
  config: ColumnConfig;
12
12
  }, {}>;
13
13
  export default _default;
14
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
- type __VLS_TypePropsToRuntimeProps<T> = {
16
- [K in keyof T]-?: {} extends Pick<T, K> ? {
17
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
18
- } : {
19
- type: import('vue').PropType<T[K]>;
20
- required: true;
21
- };
22
- };
23
14
  type __VLS_WithDefaults<P, D> = {
24
15
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
25
16
  default: D[K];
@@ -28,3 +19,12 @@ type __VLS_WithDefaults<P, D> = {
28
19
  type __VLS_Prettify<T> = {
29
20
  [K in keyof T]: T[K];
30
21
  } & {};
22
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
23
+ type __VLS_TypePropsToOption<T> = {
24
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
25
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
26
+ } : {
27
+ type: import('vue').PropType<T[K]>;
28
+ required: true;
29
+ };
30
+ };
@@ -1,9 +1,9 @@
1
1
  import { ColumnConfig } from './schema';
2
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
3
3
  config: ColumnConfig;
4
4
  }>, {
5
5
  config: () => {};
6
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
6
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
7
7
  config: ColumnConfig;
8
8
  }>, {
9
9
  config: () => {};
@@ -11,15 +11,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
11
11
  config: ColumnConfig;
12
12
  }, {}>;
13
13
  export default _default;
14
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
- type __VLS_TypePropsToRuntimeProps<T> = {
16
- [K in keyof T]-?: {} extends Pick<T, K> ? {
17
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
18
- } : {
19
- type: import('vue').PropType<T[K]>;
20
- required: true;
21
- };
22
- };
23
14
  type __VLS_WithDefaults<P, D> = {
24
15
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
25
16
  default: D[K];
@@ -28,3 +19,12 @@ type __VLS_WithDefaults<P, D> = {
28
19
  type __VLS_Prettify<T> = {
29
20
  [K in keyof T]: T[K];
30
21
  } & {};
22
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
23
+ type __VLS_TypePropsToOption<T> = {
24
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
25
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
26
+ } : {
27
+ type: import('vue').PropType<T[K]>;
28
+ required: true;
29
+ };
30
+ };
@@ -1,6 +1,7 @@
1
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
1
+ import type { ColumnConfig } from './schema';
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
2
3
  data: any[];
3
- columns?: any[] | undefined;
4
+ columns?: ColumnConfig<any>[] | undefined;
4
5
  /** 合并行或列的计算方法 */
5
6
  spanMethod?: ((data: {
6
7
  row: any;
@@ -38,9 +39,9 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
38
39
  "selection-change": (...args: any[]) => void;
39
40
  "expand-change": (...args: any[]) => void;
40
41
  "cell-click": (...args: any[]) => void;
41
- }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
42
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
42
43
  data: any[];
43
- columns?: any[] | undefined;
44
+ columns?: ColumnConfig<any>[] | undefined;
44
45
  /** 合并行或列的计算方法 */
45
46
  spanMethod?: ((data: {
46
47
  row: any;
@@ -75,22 +76,13 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
75
76
  "onExpand-change"?: ((...args: any[]) => any) | undefined;
76
77
  "onCell-click"?: ((...args: any[]) => any) | undefined;
77
78
  }, {
78
- columns: any[];
79
+ columns: ColumnConfig[];
79
80
  loading: boolean;
80
81
  showHeader: boolean;
81
82
  defaultExpandAll: boolean;
82
83
  border: boolean;
83
84
  }, {}>;
84
85
  export default _default;
85
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
86
- type __VLS_TypePropsToRuntimeProps<T> = {
87
- [K in keyof T]-?: {} extends Pick<T, K> ? {
88
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
89
- } : {
90
- type: import('vue').PropType<T[K]>;
91
- required: true;
92
- };
93
- };
94
86
  type __VLS_WithDefaults<P, D> = {
95
87
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
96
88
  default: D[K];
@@ -99,3 +91,12 @@ type __VLS_WithDefaults<P, D> = {
99
91
  type __VLS_Prettify<T> = {
100
92
  [K in keyof T]: T[K];
101
93
  } & {};
94
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
95
+ type __VLS_TypePropsToOption<T> = {
96
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
97
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
98
+ } : {
99
+ type: import('vue').PropType<T[K]>;
100
+ required: true;
101
+ };
102
+ };
@@ -1,11 +1,11 @@
1
1
  import { ColumnConfig } from './schema';
2
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
3
3
  config: ColumnConfig;
4
4
  editState?: any;
5
5
  }>, {
6
6
  config: () => {};
7
7
  editState: () => {};
8
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
8
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
9
9
  config: ColumnConfig;
10
10
  editState?: any;
11
11
  }>, {
@@ -16,15 +16,6 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
16
16
  editState: any;
17
17
  }, {}>;
18
18
  export default _default;
19
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
20
- type __VLS_TypePropsToRuntimeProps<T> = {
21
- [K in keyof T]-?: {} extends Pick<T, K> ? {
22
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
23
- } : {
24
- type: import('vue').PropType<T[K]>;
25
- required: true;
26
- };
27
- };
28
19
  type __VLS_WithDefaults<P, D> = {
29
20
  [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
30
21
  default: D[K];
@@ -33,3 +24,12 @@ type __VLS_WithDefaults<P, D> = {
33
24
  type __VLS_Prettify<T> = {
34
25
  [K in keyof T]: T[K];
35
26
  } & {};
27
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
28
+ type __VLS_TypePropsToOption<T> = {
29
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
30
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
31
+ } : {
32
+ type: import('vue').PropType<T[K]>;
33
+ required: true;
34
+ };
35
+ };
package/types/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { App } from 'vue';
2
2
  export { default as MagicTable } from './Table.vue';
3
+ export * from './schema';
4
+ export * from './utils';
3
5
  declare const _default: {
4
6
  install(app: App): void;
5
7
  };
package/types/schema.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { FormConfig, FormValue } from '@tmagic/form';
2
2
  export interface ColumnActionConfig {
3
3
  type?: 'delete' | 'copy' | 'edit';
4
- buttonType: string;
4
+ buttonType?: string;
5
5
  display?: (row: any) => boolean;
6
- text: string | ((row: any) => string);
7
- name: string;
6
+ text?: string | ((row: any) => string);
7
+ name?: string;
8
8
  tooltip?: string;
9
9
  tooltipPlacement?: string;
10
10
  icon?: any;
@@ -15,7 +15,7 @@ export interface ColumnActionConfig {
15
15
  data: any;
16
16
  }) => void;
17
17
  }
18
- export type ColumnConfig = {
18
+ export interface ColumnConfig<T = any> {
19
19
  form?: FormConfig;
20
20
  rules?: any;
21
21
  values?: FormValue;
@@ -25,12 +25,12 @@ export type ColumnConfig = {
25
25
  fixed?: 'left' | 'right' | boolean;
26
26
  width?: number | string;
27
27
  actions?: ColumnActionConfig[];
28
- type?: 'popover' | 'expand' | 'component' | string | ((value: any, row: any) => string);
28
+ type?: 'popover' | 'expand' | 'component' | string | ((value: any, row: T) => string);
29
29
  text?: string;
30
30
  prop?: string;
31
31
  showHeader?: boolean;
32
32
  table?: ColumnConfig[];
33
- formatter?: 'datetime' | ((item: any, row: Record<string, any>) => any);
33
+ formatter?: 'datetime' | ((item: any, row: T) => any);
34
34
  popover?: {
35
35
  placement: string;
36
36
  width: string;
@@ -39,9 +39,9 @@ export type ColumnConfig = {
39
39
  };
40
40
  sortable?: boolean | 'custom';
41
41
  action?: 'tip' | 'actionLink' | 'img' | 'link' | 'tag';
42
- handler?: (row: any) => void;
42
+ handler?: (row: T) => void;
43
43
  /** 当type为expand时有效,展开为html */
44
- expandContent?: (row: any, prop?: string) => string;
44
+ expandContent?: (row: T, prop?: string) => string;
45
45
  /** 当type为expand时,展开为vue组件;当type为component时显示的组件 */
46
46
  component?: any;
47
47
  /** 当type为expand时,展开的vue组件props;当type为component时显示的组件的props */
@@ -50,4 +50,4 @@ export type ColumnConfig = {
50
50
  listeners?: any;
51
51
  /** 当type为tip时有效,显示文案 */
52
52
  buttonText?: string;
53
- };
53
+ }