@qin-ui/antdv-next-pro 1.1.15 → 1.2.0
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.
- package/AI-CONTEXT.md +35 -24
- package/LICENSE +9 -0
- package/README.md +61 -61
- package/api.json +42 -28
- package/es/antdv-next-pro.css +9 -9
- package/es/component-provider/{index-Daiw7IxY.js → index-Tesc9NuK.js} +2 -1
- package/es/component-provider/index-Tesc9NuK.js.map +1 -0
- package/es/component-provider/index.js +2 -1
- package/es/component-provider/index.js.map +1 -0
- package/es/components/component-provider/components/index.vue.d.ts +27 -0
- package/es/components/component-provider/components/index.vue.d.ts.map +1 -0
- package/es/components/component-provider/constants/index.d.ts +16 -0
- package/es/components/component-provider/constants/index.d.ts.map +1 -0
- package/es/components/component-provider/index.d.ts +4 -0
- package/es/components/component-provider/index.d.ts.map +1 -0
- package/es/components/component-provider/types/index.d.ts +26 -0
- package/es/components/component-provider/types/index.d.ts.map +1 -0
- package/es/components/form/components/BaseField/index.vue.d.ts +13 -0
- package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -0
- package/es/components/form/components/BaseField/utils/index.d.ts +3 -0
- package/es/components/form/components/BaseField/utils/index.d.ts.map +1 -0
- package/es/components/form/components/BaseFormItem/index.vue.d.ts +9 -0
- package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -0
- package/es/components/form/components/ContainerFragment/index.vue.d.ts +23 -0
- package/es/components/form/components/ContainerFragment/index.vue.d.ts.map +1 -0
- package/es/components/form/components/GroupedFieldAttrs/index.vue.d.ts +31 -0
- package/es/components/form/components/GroupedFieldAttrs/index.vue.d.ts.map +1 -0
- package/es/components/form/components/PathProvider/index.vue.d.ts +24 -0
- package/es/components/form/components/PathProvider/index.vue.d.ts.map +1 -0
- package/es/components/form/components/ProForm/index.vue.d.ts +36 -0
- package/es/components/form/components/ProForm/index.vue.d.ts.map +1 -0
- package/es/components/form/components/SlotComponent/index.vue.d.ts +7 -0
- package/es/components/form/components/SlotComponent/index.vue.d.ts.map +1 -0
- package/es/components/form/components/index.d.ts +12 -0
- package/es/components/form/components/index.d.ts.map +1 -0
- package/es/components/form/constants/index.d.ts +81 -0
- package/es/components/form/constants/index.d.ts.map +1 -0
- package/es/components/form/hooks/index.d.ts +5 -0
- package/es/components/form/hooks/index.d.ts.map +1 -0
- package/es/components/form/hooks/useFields.d.ts +57 -0
- package/es/components/form/hooks/useFields.d.ts.map +1 -0
- package/es/components/form/hooks/useForm.d.ts +93 -0
- package/es/components/form/hooks/useForm.d.ts.map +1 -0
- package/es/components/form/hooks/useFormRef.d.ts +30 -0
- package/es/components/form/hooks/useFormRef.d.ts.map +1 -0
- package/es/components/form/index.d.ts +7 -0
- package/es/components/form/index.d.ts.map +1 -0
- package/es/components/form/types/index.d.ts +251 -0
- package/es/components/form/types/index.d.ts.map +1 -0
- package/es/components/table/components/ColumnControl.vue.d.ts +9 -0
- package/es/components/table/components/ColumnControl.vue.d.ts.map +1 -0
- package/es/components/table/components/DefaultSearchFormContainer.vue.d.ts +18 -0
- package/es/components/table/components/DefaultSearchFormContainer.vue.d.ts.map +1 -0
- package/es/components/table/components/DefaultTableContainer.vue.d.ts +18 -0
- package/es/components/table/components/DefaultTableContainer.vue.d.ts.map +1 -0
- package/es/components/table/components/ProTable.vue.d.ts +118 -0
- package/es/components/table/components/ProTable.vue.d.ts.map +1 -0
- package/es/components/table/components/SearchForm.vue.d.ts +48 -0
- package/es/components/table/components/SearchForm.vue.d.ts.map +1 -0
- package/es/components/table/components/SizeControl.vue.d.ts +12 -0
- package/es/components/table/components/SizeControl.vue.d.ts.map +1 -0
- package/es/components/table/components/icons/ColumnHeightOutlined.vue.d.ts +3 -0
- package/es/components/table/components/icons/ColumnHeightOutlined.vue.d.ts.map +1 -0
- package/es/components/table/components/icons/DownOutlined.vue.d.ts +3 -0
- package/es/components/table/components/icons/DownOutlined.vue.d.ts.map +1 -0
- package/es/components/table/components/icons/FilterOutlined.vue.d.ts +3 -0
- package/es/components/table/components/icons/FilterOutlined.vue.d.ts.map +1 -0
- package/es/components/table/components/index.d.ts +5 -0
- package/es/components/table/components/index.d.ts.map +1 -0
- package/es/components/table/index.d.ts +8 -0
- package/es/components/table/index.d.ts.map +1 -0
- package/es/components/table/types/index.d.ts +48 -0
- package/es/components/table/types/index.d.ts.map +1 -0
- package/es/components/table/useTable.d.ts +111 -0
- package/es/components/table/useTable.d.ts.map +1 -0
- package/es/form/{index-7clzY8ZD.js → index-CcP5OaUd.js} +12 -6
- package/es/form/index-CcP5OaUd.js.map +1 -0
- package/es/form/index.js +4 -3
- package/es/form/index.js.map +1 -0
- package/es/index.d.ts +76 -1543
- package/es/index.d.ts.map +1 -0
- package/es/index.js +14 -23
- package/es/index.js.map +1 -0
- package/es/shared/core/index.d.ts +6 -0
- package/es/shared/core/index.d.ts.map +1 -0
- package/es/shared/ui/index.d.ts +9 -0
- package/es/shared/ui/index.d.ts.map +1 -0
- package/es/table/index.js +11 -9
- package/es/table/index.js.map +1 -0
- package/package.json +10 -11
- package/src/components/component-provider/components/index.vue +67 -0
- package/src/components/component-provider/constants/index.ts +177 -0
- package/src/components/component-provider/index.ts +6 -0
- package/src/components/component-provider/types/index.ts +59 -0
- package/src/components/form/components/BaseField/index.vue +181 -0
- package/src/components/form/components/BaseField/utils/index.ts +16 -0
- package/src/components/form/components/BaseFormItem/index.vue +158 -0
- package/src/components/form/components/ContainerFragment/index.vue +24 -0
- package/src/components/form/components/GroupedFieldAttrs/index.vue +119 -0
- package/src/components/form/components/PathProvider/index.vue +19 -0
- package/src/components/form/components/ProForm/index.vue +104 -0
- package/src/components/form/components/SlotComponent/index.vue +26 -0
- package/src/components/form/components/index.ts +15 -0
- package/src/components/form/constants/index.ts +140 -0
- package/src/components/form/hooks/index.ts +5 -0
- package/src/components/form/hooks/useFields.ts +67 -0
- package/src/components/form/hooks/useForm.ts +110 -0
- package/src/components/form/hooks/useFormRef.ts +35 -0
- package/src/components/form/index.ts +29 -0
- package/src/components/form/types/index.ts +317 -0
- package/src/components/table/components/ColumnControl.vue +142 -0
- package/src/components/table/components/DefaultSearchFormContainer.vue +22 -0
- package/src/components/table/components/DefaultTableContainer.vue +19 -0
- package/src/components/table/components/ProTable.vue +372 -0
- package/src/components/table/components/SearchForm.vue +296 -0
- package/src/components/table/components/SizeControl.vue +54 -0
- package/src/components/table/components/icons/ColumnHeightOutlined.vue +4 -0
- package/src/components/table/components/icons/DownOutlined.vue +4 -0
- package/src/components/table/components/icons/FilterOutlined.vue +4 -0
- package/src/components/table/components/index.ts +4 -0
- package/src/components/table/index.ts +14 -0
- package/src/components/table/types/index.ts +52 -0
- package/src/components/table/useTable.ts +129 -0
- package/src/index.ts +81 -0
- package/src/shared/core/index.ts +37 -0
- package/src/shared/ui/index.ts +55 -0
- package/es/core/index-ghYuQ3Sy.js +0 -360
- package/es/vendor/utils/lodash-es-p6jau26B.js +0 -1120
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- prettier-ignore -->
|
|
3
|
+
<svg focusable="false" data-icon="column-height" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896"><path d="M840 836H184c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h656c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm0-724H184c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h656c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM610.8 378c6 0 9.4-7 5.7-11.7L515.7 238.7a7.14 7.14 0 00-11.3 0L403.6 366.3a7.23 7.23 0 005.7 11.7H476v268h-62.8c-6 0-9.4 7-5.7 11.7l100.8 127.5c2.9 3.7 8.5 3.7 11.3 0l100.8-127.5c3.7-4.7.4-11.7-5.7-11.7H548V378h62.8z"></path></svg>
|
|
4
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- prettier-ignore -->
|
|
3
|
+
<svg focusable="false" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896"><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg>
|
|
4
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- prettier-ignore -->
|
|
3
|
+
<svg focusable="false" data-icon="filter" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896"><path d="M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z"></path></svg>
|
|
4
|
+
</template>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as DefaultSearchFormContainer } from './DefaultSearchFormContainer.vue';
|
|
2
|
+
export { default as DefaultTableContainer } from './DefaultTableContainer.vue';
|
|
3
|
+
export { default as SizeControl } from './SizeControl.vue';
|
|
4
|
+
export { default as ColumnControl } from './ColumnControl.vue';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentExposed, ComponentProps } from 'vue-component-type-helpers';
|
|
2
|
+
import ProTable from './components/ProTable.vue';
|
|
3
|
+
|
|
4
|
+
// 仅保留组件 Props 与实例类型
|
|
5
|
+
export type ProTableProps = ComponentProps<typeof ProTable>;
|
|
6
|
+
export type ProTableInstance = ComponentExposed<typeof ProTable>;
|
|
7
|
+
|
|
8
|
+
// 仅导出核心列配置类型
|
|
9
|
+
export { type Column, type Columns } from './types';
|
|
10
|
+
|
|
11
|
+
// 仅导出核心表格 Hook 与类型
|
|
12
|
+
export { useTable, type Table } from './useTable';
|
|
13
|
+
|
|
14
|
+
export default ProTable;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ColumnType } from '../../../shared/ui';
|
|
2
|
+
import { Data, KeyExpandString, Paths, Path } from '../../../shared/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @qin-ui/antdv-next-pro 表格列配置类型
|
|
6
|
+
*
|
|
7
|
+
* @description 继承 antdv-next 的 ColumnType 列类型,并添加:
|
|
8
|
+
* - 类型安全的 dataIndex(基于泛型 D 推导路径),优先使用
|
|
9
|
+
* - key 作为辅助标识
|
|
10
|
+
* - hidden 属性用于控制列显隐
|
|
11
|
+
*
|
|
12
|
+
* @template D - 表格行数据类型
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* interface User { name: string; age: number }
|
|
17
|
+
*
|
|
18
|
+
* const columns: Columns<User> = [
|
|
19
|
+
* { dataIndex: 'name', title: '姓名', width: 120 },
|
|
20
|
+
* { dataIndex: 'age', title: '年龄', width: 80 },
|
|
21
|
+
* ]
|
|
22
|
+
* ```
|
|
23
|
+
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export type Column<D extends Data = Data> = Omit<
|
|
27
|
+
ColumnType,
|
|
28
|
+
'dataIndex' | 'key'
|
|
29
|
+
> & {
|
|
30
|
+
/**
|
|
31
|
+
* @description 列数据路径(主要字段),优先使用 dataIndex 进行字段匹配
|
|
32
|
+
* @example 'name' | 'address.city' | ['address', 'city']
|
|
33
|
+
*/
|
|
34
|
+
dataIndex?: KeyExpandString<Extract<keyof D, string>> | Paths<D>;
|
|
35
|
+
/**
|
|
36
|
+
* @description 列字段标识(辅助字段),当 dataIndex 不满足需求时使用
|
|
37
|
+
*/
|
|
38
|
+
key?: Path<D>;
|
|
39
|
+
/**
|
|
40
|
+
* @description 是否隐藏该列
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
hidden?: boolean;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @qin-ui/antdv-next-pro 表格列配置数组类型
|
|
48
|
+
* @template D - 表格行数据类型
|
|
49
|
+
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export type Columns<D extends Data = Data> = Array<Column<D>>;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useTable as coreUseTable,
|
|
3
|
+
type Table as _Table,
|
|
4
|
+
} from '../../shared/core';
|
|
5
|
+
import type {
|
|
6
|
+
Data,
|
|
7
|
+
ExtendWithAny,
|
|
8
|
+
DeepPartial,
|
|
9
|
+
PageParam,
|
|
10
|
+
} from '../../shared/core';
|
|
11
|
+
import { Fields } from '../form/types';
|
|
12
|
+
import type { Column, Columns } from './types';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 表格实例类型
|
|
16
|
+
*
|
|
17
|
+
* @description 在 core Table 类型的基础上,将列类型 C 绑定为本地 Column\<T\>,
|
|
18
|
+
* 使 columns 操作获得 antdv-next 表格列的完整属性类型提示。
|
|
19
|
+
*
|
|
20
|
+
* @template D - 搜索表单数据类型
|
|
21
|
+
* @template T - 表格行数据类型(一行数据的类型)
|
|
22
|
+
*
|
|
23
|
+
* @property columns - 列配置数组(响应式 Ref),用于渲染表格列
|
|
24
|
+
* @property dataSource - 表格数据源(响应式 Ref),绑定到 Table 的 data-source
|
|
25
|
+
* @property pageParam - 分页参数(响应式 reactive),包含 current、pageSize、total
|
|
26
|
+
* @property searchForm - 搜索表单实例(Form 类型),用于管理搜索区域的字段和数据
|
|
27
|
+
* @property setColumn - 更新列配置,支持合并/覆盖两种模式,用法同 setField
|
|
28
|
+
* @property deleteColumn - 删除列,支持路径或查找函数
|
|
29
|
+
* @property appendColumn - 在指定列后追加新列,传 undefined 在末尾追加
|
|
30
|
+
* @property prependColumn - 在指定列前插入新列,传 undefined 在开头插入
|
|
31
|
+
* @property setPageParam - 设置分页参数,支持部分更新和函数式更新
|
|
32
|
+
* @property resetQueryParams - 重置分页到第一页并恢复搜索条件到初始值
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* interface User { name: string; age: number; email: string }
|
|
37
|
+
*
|
|
38
|
+
* const table: Table<{}, User> = useTable({
|
|
39
|
+
* columns: [{ dataIndex: 'name', title: '姓名' }],
|
|
40
|
+
* })
|
|
41
|
+
*
|
|
42
|
+
* table.columns.value // 访问列配置
|
|
43
|
+
* table.setColumn('name', { width: 150 }) // 更新列
|
|
44
|
+
* table.setPageParam({ current: 2 }) // 切换页码
|
|
45
|
+
* table.searchForm.setFormData('keyword', '搜索词') // 操作搜索表单
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export type Table<
|
|
51
|
+
D extends Data = Data,
|
|
52
|
+
T extends Data = ExtendWithAny<D>,
|
|
53
|
+
> = _Table<D, T, Column<T>>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 创建表格实例的 Hook
|
|
57
|
+
*
|
|
58
|
+
* @description 基于 `@qin-ui/pro-components-core` 的 `useTable`,将列类型绑定为本地 `Column<T>`。
|
|
59
|
+
* 是 ProTable 组件的核心 Hook,提供了:
|
|
60
|
+
* - 列配置管理(增删改查)
|
|
61
|
+
* - 数据源管理
|
|
62
|
+
* - 分页管理
|
|
63
|
+
* - 搜索表单集成(内部使用 useForm)
|
|
64
|
+
* - 查询参数重置
|
|
65
|
+
*
|
|
66
|
+
* @template D - 搜索表单数据类型
|
|
67
|
+
* @template T - 表格行数据类型
|
|
68
|
+
*
|
|
69
|
+
* @param {object} params - 表格配置参数
|
|
70
|
+
* @param {Columns<T>} [params.columns] - 初始列配置数组
|
|
71
|
+
* @param {T[]} [params.dataSource] - 初始数据源
|
|
72
|
+
* @param {PageParam} [params.pageParam] - 初始分页参数,默认 `{ current: 1, pageSize: 10, total: 0 }`
|
|
73
|
+
* @param {ExtendWithAny<DeepPartial<D>>} [params.searchParam] - 初始搜索参数
|
|
74
|
+
* @param {Fields<D>} [params.searchFields] - 搜索表单字段配置
|
|
75
|
+
*
|
|
76
|
+
* @returns {Table<D, T>} 表格实例
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* interface SearchParams { keyword: string; status: string }
|
|
81
|
+
* interface User { name: string; age: number; email: string }
|
|
82
|
+
*
|
|
83
|
+
* const table = useTable<SearchParams, User>({
|
|
84
|
+
* columns: [
|
|
85
|
+
* { dataIndex: 'name', title: '姓名', width: 120 },
|
|
86
|
+
* { dataIndex: 'age', title: '年龄', width: 80 },
|
|
87
|
+
* ],
|
|
88
|
+
* dataSource: [],
|
|
89
|
+
* pageParam: { current: 1, pageSize: 20, total: 0 },
|
|
90
|
+
* searchParam: { keyword: '', status: '' },
|
|
91
|
+
* searchFields: [
|
|
92
|
+
* { path: 'keyword', label: '关键词', component: 'input' },
|
|
93
|
+
* { path: 'status', label: '状态', component: 'select' },
|
|
94
|
+
* ],
|
|
95
|
+
* })
|
|
96
|
+
*
|
|
97
|
+
* // 查询
|
|
98
|
+
* const handleSearch = async () => {
|
|
99
|
+
* const res = await fetchUserList({
|
|
100
|
+
* ...table.searchForm.formData,
|
|
101
|
+
* ...table.pageParam,
|
|
102
|
+
* })
|
|
103
|
+
* table.dataSource.value = res.data
|
|
104
|
+
* table.setPageParam({ total: res.total })
|
|
105
|
+
* }
|
|
106
|
+
*
|
|
107
|
+
* // 重置
|
|
108
|
+
* const handleReset = () => {
|
|
109
|
+
* table.resetQueryParams()
|
|
110
|
+
* handleSearch()
|
|
111
|
+
* }
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @see {@link coreUseTable} 底层核心实现(来自 @qin-ui/pro-components-core)
|
|
115
|
+
*
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
118
|
+
export function useTable<
|
|
119
|
+
D extends Data = Data,
|
|
120
|
+
T extends Data = ExtendWithAny<D>,
|
|
121
|
+
>(params: {
|
|
122
|
+
columns?: Columns<T>;
|
|
123
|
+
dataSource?: T[];
|
|
124
|
+
pageParam?: PageParam;
|
|
125
|
+
searchParam?: ExtendWithAny<DeepPartial<D>>;
|
|
126
|
+
searchFields?: Fields<D>;
|
|
127
|
+
}): Table<D, T> {
|
|
128
|
+
return coreUseTable(params) as any;
|
|
129
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import ProForm from './components/form';
|
|
3
|
+
import ProTable from './components/table';
|
|
4
|
+
import ProComponentProvider from './components/component-provider';
|
|
5
|
+
|
|
6
|
+
export * from './components/form';
|
|
7
|
+
export * from './components/table';
|
|
8
|
+
export * from './components/component-provider';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Schema 驱动的表单组件,基于 antdv-next Form 封装
|
|
12
|
+
*
|
|
13
|
+
* @description 通过声明式 JSON Schema 配置即可快速生成表单,
|
|
14
|
+
* 提供极致的 TypeScript 类型推导与组件库插槽扩展能力。
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```vue
|
|
18
|
+
* <script setup lang="ts">
|
|
19
|
+
* import { ProForm, useForm } from '@qin-ui/antdv-next-pro'
|
|
20
|
+
* const form = useForm<User>({ name: '' }, [
|
|
21
|
+
* { path: 'name', label: '姓名', component: 'input' }
|
|
22
|
+
* ])
|
|
23
|
+
* </script>
|
|
24
|
+
* <template>
|
|
25
|
+
* <ProForm :form="form" />
|
|
26
|
+
* </template>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* Schema 驱动的表格组件,基于 antdv-next Table 封装
|
|
30
|
+
*
|
|
31
|
+
* @description 通过声明式列配置即可生成功能完整的表格,
|
|
32
|
+
* 支持列动态控制、搜索表单集成、分页管理等企业级能力。
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```vue
|
|
36
|
+
* <script setup lang="ts">
|
|
37
|
+
* import { ProTable, useTable } from '@qin-ui/antdv-next-pro'
|
|
38
|
+
* const table = useTable<User>({ columns: [{ key: 'name', title: '姓名' }] })
|
|
39
|
+
* </script>
|
|
40
|
+
* <template>
|
|
41
|
+
* <ProTable :table="table" />
|
|
42
|
+
* </template>
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* 组件提供者,用于全局配置 ProForm 和 ProTable 的默认行为
|
|
46
|
+
*
|
|
47
|
+
* @description 通过 `ProComponentProvider` 包裹应用根组件,
|
|
48
|
+
* 可以全局覆盖组件的默认属性(如表单布局、表格尺寸等)。
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```vue
|
|
52
|
+
* <template>
|
|
53
|
+
* <ProComponentProvider :component-props="customProps">
|
|
54
|
+
* <App />
|
|
55
|
+
* </ProComponentProvider>
|
|
56
|
+
* </template>
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export { ProForm, ProTable, ProComponentProvider };
|
|
60
|
+
|
|
61
|
+
export default {
|
|
62
|
+
/**
|
|
63
|
+
* @qin-ui/antdv-next-pro 安装方法
|
|
64
|
+
* @description 全局注册所有组件(ProForm、ProTable、ProComponentProvider)
|
|
65
|
+
*
|
|
66
|
+
* @param {App} app - Vue 应用实例
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* import { createApp } from 'vue'
|
|
71
|
+
* import ProComponents from '@qin-ui/antdv-next-pro'
|
|
72
|
+
* const app = createApp(App)
|
|
73
|
+
* app.use(ProComponents)
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
install(app: App) {
|
|
77
|
+
app.component(ProForm.name, ProForm);
|
|
78
|
+
app.component(ProTable.name, ProTable);
|
|
79
|
+
app.component(ProComponentProvider.name!, ProComponentProvider);
|
|
80
|
+
},
|
|
81
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 统一 re-export @qin-ui/pro-components-core,包内所有文件通过此文件引入 core 内容,
|
|
3
|
+
* 避免直接散列依赖 @qin-ui/pro-components-core,便于将来统一维护。
|
|
4
|
+
*/
|
|
5
|
+
export {
|
|
6
|
+
// hooks
|
|
7
|
+
useForm,
|
|
8
|
+
useTable,
|
|
9
|
+
useFields,
|
|
10
|
+
useFormData,
|
|
11
|
+
useFormRef,
|
|
12
|
+
// injection keys
|
|
13
|
+
InjectionFormKey,
|
|
14
|
+
InjectionPathKey,
|
|
15
|
+
// utils
|
|
16
|
+
getObject,
|
|
17
|
+
toPath,
|
|
18
|
+
camelizeProperties,
|
|
19
|
+
cloneDeep,
|
|
20
|
+
omit,
|
|
21
|
+
pick,
|
|
22
|
+
isPlainObject,
|
|
23
|
+
// types
|
|
24
|
+
type Data,
|
|
25
|
+
type Path,
|
|
26
|
+
type Paths,
|
|
27
|
+
type KeyExpandString,
|
|
28
|
+
type ExtendWithAny,
|
|
29
|
+
type DeepPartial,
|
|
30
|
+
type PageParam,
|
|
31
|
+
type Fields,
|
|
32
|
+
type Form,
|
|
33
|
+
type Table,
|
|
34
|
+
type UseFieldsReturn,
|
|
35
|
+
type UseFormDataReturn,
|
|
36
|
+
type UseFormRefReturn,
|
|
37
|
+
} from '@qin-ui/pro-components-core';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Col, Table, FormItem } from 'antdv-next';
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
theme,
|
|
5
|
+
useConfig,
|
|
6
|
+
Form,
|
|
7
|
+
FormItem,
|
|
8
|
+
Row as Grid,
|
|
9
|
+
Col as GridItem,
|
|
10
|
+
Table,
|
|
11
|
+
Space,
|
|
12
|
+
Dropdown,
|
|
13
|
+
Menu,
|
|
14
|
+
RadioGroup,
|
|
15
|
+
Checkbox,
|
|
16
|
+
CheckboxGroup,
|
|
17
|
+
Button,
|
|
18
|
+
AutoComplete,
|
|
19
|
+
Cascader,
|
|
20
|
+
DatePicker,
|
|
21
|
+
DateRangePicker as RangePicker,
|
|
22
|
+
Input,
|
|
23
|
+
InputOTP,
|
|
24
|
+
TextArea,
|
|
25
|
+
InputPassword,
|
|
26
|
+
InputNumber,
|
|
27
|
+
InputSearch,
|
|
28
|
+
Select,
|
|
29
|
+
Slider,
|
|
30
|
+
Switch,
|
|
31
|
+
TimePicker,
|
|
32
|
+
TimeRangePicker,
|
|
33
|
+
Transfer,
|
|
34
|
+
TreeSelect,
|
|
35
|
+
type FormProps,
|
|
36
|
+
type FormItemProps,
|
|
37
|
+
type FormInstance,
|
|
38
|
+
type TableProps,
|
|
39
|
+
type PaginationProps,
|
|
40
|
+
type RowProps as GridProps,
|
|
41
|
+
type ColProps as GridItemProps,
|
|
42
|
+
type TableColumnType as ColumnType,
|
|
43
|
+
} from 'antdv-next';
|
|
44
|
+
|
|
45
|
+
export type FormItemInstance = InstanceType<typeof FormItem>;
|
|
46
|
+
export const tableProps = () => (Table as any).props || {};
|
|
47
|
+
export const gridItemProps = () => (Col as any).props || {};
|
|
48
|
+
export const formItemProps = () => (FormItem as any).props || {};
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
useDisabledContext,
|
|
52
|
+
useDisabledContextProvider,
|
|
53
|
+
} from 'antdv-next/dist/config-provider/DisabledContext';
|
|
54
|
+
|
|
55
|
+
export type NamePath = string | number | (string | number)[];
|