@ftjs/antd 0.0.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.
@@ -0,0 +1,139 @@
1
+ import { TfTableColumn, TfTablePropsMap, ValueOf } from '@ftjs/core';
2
+ import { VxeGridProps, VxeGridSlots, VxeGridInstance, VxeGridPropTypes } from 'vxe-table';
3
+ import { FormColumn, FormExposed } from '../form/register';
4
+ import { EditMap } from '../antd-table/column-edit';
5
+ declare module "@ftjs/core" {
6
+ interface TableTypeMap<TableData extends Record<string, any>, SearchData extends Record<string, any> = TableData> {
7
+ "vxe-table": {
8
+ tableSlots: VxeTableSlots<TableData> & {
9
+ buttons: () => any;
10
+ tools: () => any;
11
+ };
12
+ tableColumn: VxeTableColumn<TableData>;
13
+ formColumn: FormColumn<SearchData>;
14
+ extendedProps: VxeExtendedProps<TableData, SearchData>;
15
+ internalTableProps: InternalVxeTableProps<TableData>;
16
+ internalFormProps: {};
17
+ };
18
+ }
19
+ }
20
+ /**
21
+ * 表格暴露的方法
22
+ */
23
+ interface VxeTableExposed<TableData extends Record<string, any>, SearchData extends Record<string, any> = TableData> {
24
+ /**
25
+ * 刷新表格
26
+ */
27
+ refresh: () => Promise<void>;
28
+ /**
29
+ * 表单暴露的方法
30
+ */
31
+ formExposed: FormExposed<SearchData>;
32
+ /**
33
+ * 表格暴露的方法
34
+ */
35
+ tableExposed: VxeGridInstance<TableData>;
36
+ }
37
+ /**
38
+ * 列定义
39
+ */
40
+ type VxeTableColumn<TableData extends Record<string, any>> = TfTableColumn<TableData> & Omit<VxeGridPropTypes.Column<TableData>, "title" | "editRender"> & {
41
+ /**
42
+ * 行内编辑
43
+ */
44
+ edit?: keyof EditMap<TableData> | ValueOf<EditMap<TableData>>;
45
+ };
46
+ /**
47
+ * 内部表格 props
48
+ */
49
+ interface InternalVxeTableProps<TableData extends Record<string, any>> extends Omit<VxeGridProps<TableData>, "columns" | "minHeight" | "treeConfig" | "rowConfig" | "customConfig" | "toolbarConfig" | "columnConfig"> {
50
+ }
51
+ /**
52
+ * 表格插槽
53
+ */
54
+ interface VxeTableSlots<TableData extends Record<string, any>> extends VxeGridSlots<TableData> {
55
+ }
56
+ interface VxeExtendedProps<TableData extends Record<string, any>, SearchData extends Record<string, any> = TableData> {
57
+ /**
58
+ * 是否初始化搜索
59
+ *
60
+ * @default true
61
+ */
62
+ initSearch?: boolean;
63
+ /**
64
+ * 是否自适应父元素(flex布局)剩余高度
65
+ *
66
+ * 如果为true,则table会占据父元素的剩余高度,此时可以通过 {@link minHeight} 控制最小高度,避免高度不够展示内容
67
+ * @default true
68
+ */
69
+ fitFlexHeight?: boolean;
70
+ /**
71
+ * 最小高度
72
+ * @default 310
73
+ */
74
+ minHeight?: number;
75
+ /**
76
+ * vxe-table 树形配置
77
+ */
78
+ treeConfig?: VxeGridProps<TableData>["treeConfig"];
79
+ /**
80
+ * vxe-table 行配置
81
+ */
82
+ rowConfig?: VxeGridProps<TableData>["rowConfig"];
83
+ /**
84
+ * vxe-table 自定义配置
85
+ */
86
+ customConfig?: VxeGridProps<TableData>["customConfig"];
87
+ /**
88
+ * vxe-table 工具栏配置
89
+ */
90
+ toolbarConfig?: VxeGridProps<TableData>["toolbarConfig"];
91
+ /**
92
+ * vxe-table 列配置
93
+ */
94
+ columnConfig?: VxeGridProps<TableData>["columnConfig"];
95
+ /**
96
+ * 是否隐藏搜索
97
+ * @default false
98
+ */
99
+ hideSearch?: boolean;
100
+ /**
101
+ * 是否隐藏分页
102
+ * @default false
103
+ */
104
+ hidePagination?: boolean;
105
+ exposed?: VxeTableExposed<TableData, SearchData>;
106
+ "onUpdate:exposed"?: (exposed: VxeTableExposed<TableData, SearchData>) => void;
107
+ onSearch: (searchData: SearchData, info: {
108
+ pagination?: VxePagination;
109
+ }) => Promise<void> | void;
110
+ }
111
+ interface VxePagination {
112
+ page: number;
113
+ pageSize: number;
114
+ }
115
+ export declare const TfVxeTable: new <TableData extends Record<string, any>, SearchData extends Record<string, any> = TableData>(props: ((import('@ftjs/core').TfTableIntrinsicProps<TableData, SearchData, "vxe-table"> & (VxeExtendedProps<TableData, SearchData> & ({
116
+ [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
117
+ } | {
118
+ [x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
119
+ }))) & import('vue').VNodeProps) & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps) => import('vue').CreateComponentPublicInstanceWithMixins<import('@ftjs/core').TfTableIntrinsicProps<TableData, SearchData, "vxe-table"> & (VxeExtendedProps<TableData, SearchData> & ({
120
+ [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
121
+ } | {
122
+ [x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
123
+ })), {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, import('vue').EmitsOptions, import('vue').PublicProps, {}, false, {}, import('vue').SlotsType<VxeTableSlots<TableData> & {
124
+ buttons: () => any;
125
+ tools: () => any;
126
+ }>, {}, {}, string, {}, any, import('vue').ComponentProvideOptions, {
127
+ P: {};
128
+ B: {};
129
+ D: {};
130
+ C: {};
131
+ M: {};
132
+ Defaults: {};
133
+ }, (import('@ftjs/core').TfTableIntrinsicProps<TableData, SearchData, "vxe-table"> & VxeExtendedProps<TableData, SearchData> & {
134
+ [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
135
+ }) | (import('@ftjs/core').TfTableIntrinsicProps<TableData, SearchData, "vxe-table"> & VxeExtendedProps<TableData, SearchData> & {
136
+ [x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
137
+ }), {}, {}, {}, {}, {}>;
138
+ export type TfVxeTableProps<TableData extends Record<string, any>, SearchData extends Record<string, any> = TableData> = TfTablePropsMap<TableData, SearchData, "vxe-table">;
139
+ export {};
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@ftjs/antd",
3
+ "version": "0.0.2",
4
+ "keywords": [],
5
+ "author": "",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "dependencies": {},
20
+ "devDependencies": {
21
+ "@ant-design/icons-vue": "^7.0.1",
22
+ "ant-design-vue": "^4.2.6",
23
+ "dayjs": "^1.11.13",
24
+ "vue": "^3.5.13",
25
+ "vue-component-type-helpers": "^2.2.0",
26
+ "vxe-table": "4.11.10",
27
+ "@vitejs/plugin-vue": "^5.2.1",
28
+ "@vitejs/plugin-vue-jsx": "^4.1.1",
29
+ "typescript": "^5.7.3",
30
+ "vite": "^6.1.0",
31
+ "vite-plugin-dts": "^4.5.0",
32
+ "vue-tsc": "2.2.0",
33
+ "@ftjs/core": "0.0.2"
34
+ },
35
+ "peerDependencies": {
36
+ "@ant-design/icons-vue": ">=7.0.0",
37
+ "vue": ">=3.3.0",
38
+ "@ftjs/core": ">=1.0.0",
39
+ "ant-design-vue": ">=4.0.0",
40
+ "dayjs": ">=1.0.0",
41
+ "vxe-table": ">=4.0.0"
42
+ },
43
+ "scripts": {
44
+ "build": "vite build",
45
+ "minify": "pnpm dlx esbuild ./dist/index.js --minify --outfile=./dist/index.min.js",
46
+ "pub": "tsx ../../scripts/publish.ts"
47
+ }
48
+ }