@qin-ui/antd-vue-pro 2.4.4 → 2.5.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 +26 -2
- package/README.md +44 -37
- package/api.json +24 -9
- package/es/antd-vue-pro.css +15 -15
- package/es/components/component-provider/components/index.vue.d.ts +3 -3
- package/es/components/component-provider/components/index.vue.d.ts.map +1 -1
- package/es/components/component-provider/constants/index.d.ts +20 -4
- package/es/components/component-provider/constants/index.d.ts.map +1 -1
- package/es/components/component-provider/types/index.d.ts +8 -4
- package/es/components/component-provider/types/index.d.ts.map +1 -1
- package/es/components/form/components/BaseField/index.vue.d.ts +7 -1
- package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -1
- package/es/components/form/components/BaseField/utils/index.d.ts +18 -0
- package/es/components/form/components/BaseField/utils/index.d.ts.map +1 -1
- package/es/components/form/components/BaseFormItem/index.vue.d.ts +3 -0
- package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -1
- package/es/components/form/components/ContainerFragment/index.vue.d.ts +1 -0
- package/es/components/form/components/ContainerFragment/index.vue.d.ts.map +1 -1
- package/es/components/form/components/ProForm/index.vue.d.ts.map +1 -1
- package/es/components/form/components/SlotComponent/index.vue.d.ts +1 -0
- package/es/components/form/components/SlotComponent/index.vue.d.ts.map +1 -1
- package/es/components/form/components/index.d.ts +4 -0
- package/es/components/form/components/index.d.ts.map +1 -1
- package/es/components/form/constants/index.d.ts.map +1 -1
- package/es/components/form/hooks/useFields.d.ts +2 -0
- package/es/components/form/hooks/useFields.d.ts.map +1 -1
- package/es/components/form/hooks/useGroupFieldAttrs.d.ts +10 -0
- package/es/components/form/hooks/useGroupFieldAttrs.d.ts.map +1 -1
- package/es/components/form/index.d.ts +2 -2
- package/es/components/form/index.d.ts.map +1 -1
- package/es/components/form/types/index.d.ts +75 -44
- package/es/components/form/types/index.d.ts.map +1 -1
- package/es/components/form/utils/fieldKey.d.ts +13 -0
- package/es/components/form/utils/fieldKey.d.ts.map +1 -0
- package/es/components/table/components/ColumnControl.vue.d.ts +3 -0
- package/es/components/table/components/ColumnControl.vue.d.ts.map +1 -1
- package/es/components/table/components/DefaultSearchFormContainer.vue.d.ts.map +1 -1
- package/es/components/table/components/DefaultTableContainer.vue.d.ts.map +1 -1
- package/es/components/table/components/ProTable.vue.d.ts +8 -1
- package/es/components/table/components/ProTable.vue.d.ts.map +1 -1
- package/es/components/table/components/SearchForm.vue.d.ts +10 -2
- package/es/components/table/components/SearchForm.vue.d.ts.map +1 -1
- package/es/components/table/components/SizeControl.vue.d.ts +7 -2
- package/es/components/table/components/SizeControl.vue.d.ts.map +1 -1
- package/es/components/table/hooks/useTable.d.ts.map +1 -1
- package/es/components/table/index.d.ts +4 -1
- package/es/components/table/index.d.ts.map +1 -1
- package/es/components/table/types/index.d.ts +14 -6
- package/es/components/table/types/index.d.ts.map +1 -1
- package/es/index.d.ts +8 -4
- package/es/index.d.ts.map +1 -1
- package/es/index.js +528 -343
- package/es/index.js.map +1 -1
- package/es/locale/index.d.ts +2 -0
- package/es/locale/index.d.ts.map +1 -1
- package/es/shared/core/index.d.ts +1 -1
- package/es/shared/core/index.d.ts.map +1 -1
- package/es/shared/ui/index.d.ts +15 -3
- package/es/shared/ui/index.d.ts.map +1 -1
- package/package.json +7 -4
- package/src/components/component-provider/components/index.vue +26 -12
- package/src/components/component-provider/constants/index.ts +33 -6
- package/src/components/component-provider/types/index.ts +17 -9
- package/src/components/form/components/BaseField/index.vue +48 -16
- package/src/components/form/components/BaseField/utils/index.ts +19 -1
- package/src/components/form/components/BaseFormItem/index.vue +65 -17
- package/src/components/form/components/ContainerFragment/index.vue +3 -1
- package/src/components/form/components/ProForm/index.vue +30 -18
- package/src/components/form/components/SlotComponent/index.vue +14 -4
- package/src/components/form/components/index.ts +8 -1
- package/src/components/form/constants/index.ts +3 -4
- package/src/components/form/hooks/useFields.ts +3 -1
- package/src/components/form/hooks/useGroupFieldAttrs.ts +34 -27
- package/src/components/form/index.ts +1 -3
- package/src/components/form/types/index.ts +79 -46
- package/src/components/form/utils/fieldKey.ts +27 -0
- package/src/components/table/components/ColumnControl.vue +21 -5
- package/src/components/table/components/DefaultSearchFormContainer.vue +5 -0
- package/src/components/table/components/DefaultTableContainer.vue +5 -0
- package/src/components/table/components/ProTable.vue +239 -66
- package/src/components/table/components/SearchForm.vue +58 -21
- package/src/components/table/components/SizeControl.vue +21 -1
- package/src/components/table/hooks/useTable.ts +1 -1
- package/src/components/table/index.ts +8 -3
- package/src/components/table/types/index.ts +15 -7
- package/src/index.ts +12 -5
- package/src/locale/index.ts +2 -0
- package/src/shared/core/index.ts +11 -0
- package/src/shared/ui/index.ts +22 -4
- package/tsconfig.json +22 -0
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
ComponentExposed,
|
|
3
|
+
ComponentProps,
|
|
4
|
+
} from 'vue-component-type-helpers';
|
|
2
5
|
import ProTable from './components/ProTable.vue';
|
|
3
6
|
|
|
4
|
-
|
|
7
|
+
/** ProTable 的组件属性类型 */
|
|
5
8
|
export type ProTableProps = ComponentProps<typeof ProTable>;
|
|
9
|
+
/** ProTable 的组件实例类型,用于 `ref` 标注与 `defineExpose` 访问 */
|
|
6
10
|
export type ProTableInstance = ComponentExposed<typeof ProTable>;
|
|
7
11
|
|
|
8
12
|
// 仅导出核心列配置类型
|
|
9
|
-
export { type Column, type Columns } from './types';
|
|
13
|
+
export { type Column, type ColumnControlConfig, type Columns } from './types';
|
|
10
14
|
|
|
11
15
|
// 仅导出核心表格 Hook 与类型
|
|
12
16
|
export { useTable, type Table } from './hooks';
|
|
17
|
+
export { type PageParam } from '../../shared/core';
|
|
13
18
|
|
|
14
19
|
export default ProTable;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { ColumnType } from '../../../shared/ui';
|
|
2
|
-
import { Data, KeyExpandString, Paths, Path } from '../../../shared/core';
|
|
2
|
+
import type { Data, KeyExpandString, Paths, Path } from '../../../shared/core';
|
|
3
|
+
import type { ComputedRef, MaybeRef } from 'vue';
|
|
4
|
+
|
|
5
|
+
type MaybeRefOrComputedRef<T = any> = MaybeRef<T> | ComputedRef<T>;
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
|
-
*
|
|
8
|
+
* 表格列配置类型
|
|
6
9
|
*
|
|
7
10
|
* @description 继承 Ant Design Vue 的 ColumnType 列类型,并添加:
|
|
8
11
|
* - 类型安全的 dataIndex(基于泛型 D 推导路径),优先使用
|
|
@@ -37,7 +40,7 @@ export type Column<D extends Data = Data> = Omit<
|
|
|
37
40
|
'dataIndex' | 'key'
|
|
38
41
|
> & {
|
|
39
42
|
/**
|
|
40
|
-
*
|
|
43
|
+
* 列数据路径(主要字段)
|
|
41
44
|
* 关联数据源中对应字段的路径,支持点号分隔的深层路径和数组路径。
|
|
42
45
|
* 优先使用 dataIndex 进行字段匹配。
|
|
43
46
|
*
|
|
@@ -45,20 +48,25 @@ export type Column<D extends Data = Data> = Omit<
|
|
|
45
48
|
*/
|
|
46
49
|
dataIndex?: KeyExpandString<Extract<keyof D, string>> | Paths<D>;
|
|
47
50
|
/**
|
|
48
|
-
*
|
|
51
|
+
* 列字段标识(辅助字段)
|
|
49
52
|
* 仅当 dataIndex 无法满足需求时使用,例如需要在自定义渲染中标识列时。
|
|
50
53
|
* 在字段匹配时的优先级低于 dataIndex。
|
|
51
54
|
*/
|
|
52
55
|
key?: Path<D>;
|
|
53
56
|
/**
|
|
54
|
-
*
|
|
57
|
+
* 列是否隐藏;支持布尔、Ref 与 ComputedRef 形式,渲染期按 `toValue` 取值。
|
|
58
|
+
* 分组列的子列同样参与过滤(递归生效)。
|
|
55
59
|
* @default false
|
|
56
60
|
*/
|
|
57
|
-
hidden?: boolean
|
|
61
|
+
hidden?: MaybeRefOrComputedRef<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* 分组子列;提供时该列作为分组表头渲染,子列沿用同一配置类型
|
|
64
|
+
*/
|
|
65
|
+
children?: Column<D>[];
|
|
58
66
|
};
|
|
59
67
|
|
|
60
68
|
/**
|
|
61
|
-
*
|
|
69
|
+
* 表格列配置数组类型
|
|
62
70
|
*
|
|
63
71
|
* @template D - 表格行数据类型
|
|
64
72
|
* @public
|
package/src/index.ts
CHANGED
|
@@ -26,7 +26,9 @@ export * from './locale';
|
|
|
26
26
|
* <ProForm :form="form" />
|
|
27
27
|
* </template>
|
|
28
28
|
* ```
|
|
29
|
-
|
|
29
|
+
*/
|
|
30
|
+
export { ProForm };
|
|
31
|
+
/**
|
|
30
32
|
* Schema 驱动的表格组件,基于 antd-vue Table 封装
|
|
31
33
|
*
|
|
32
34
|
* @description 通过声明式列配置即可生成功能完整的表格,
|
|
@@ -42,7 +44,9 @@ export * from './locale';
|
|
|
42
44
|
* <ProTable :table="table" />
|
|
43
45
|
* </template>
|
|
44
46
|
* ```
|
|
45
|
-
|
|
47
|
+
*/
|
|
48
|
+
export { ProTable };
|
|
49
|
+
/**
|
|
46
50
|
* 组件提供者,用于全局配置 ProForm 和 ProTable 的默认行为
|
|
47
51
|
*
|
|
48
52
|
* @description 通过 `ProComponentProvider` 包裹应用根组件,
|
|
@@ -57,10 +61,10 @@ export * from './locale';
|
|
|
57
61
|
* </template>
|
|
58
62
|
* ```
|
|
59
63
|
*/
|
|
60
|
-
export {
|
|
64
|
+
export { ProComponentProvider };
|
|
61
65
|
export default {
|
|
62
66
|
/**
|
|
63
|
-
*
|
|
67
|
+
* 安装方法
|
|
64
68
|
* @description 全局注册所有组件(ProForm、ProTable、ProComponentProvider)
|
|
65
69
|
*
|
|
66
70
|
* @param {App} app - Vue 应用实例
|
|
@@ -76,6 +80,9 @@ export default {
|
|
|
76
80
|
install(app: App) {
|
|
77
81
|
app.component(ProForm.name, ProForm);
|
|
78
82
|
app.component(ProTable.name, ProTable);
|
|
79
|
-
app.component(
|
|
83
|
+
app.component(
|
|
84
|
+
ProComponentProvider.name ?? 'ProComponentProvider',
|
|
85
|
+
ProComponentProvider
|
|
86
|
+
);
|
|
80
87
|
},
|
|
81
88
|
};
|
package/src/locale/index.ts
CHANGED
|
@@ -23,8 +23,10 @@ import {
|
|
|
23
23
|
} from '../shared/core';
|
|
24
24
|
import { useConfigContextInject } from '../shared/ui';
|
|
25
25
|
|
|
26
|
+
/** 内置语言包:简体中文 / 繁体中文 / 英文 */
|
|
26
27
|
export { zhCN, zhTW, enUS };
|
|
27
28
|
|
|
29
|
+
/** 文案表类型:键为内置文案 key,值为任意字符串 */
|
|
28
30
|
export type { ProLocale };
|
|
29
31
|
|
|
30
32
|
/** ProComponentProvider 通过该 key 注入局部覆盖文案 */
|
package/src/shared/core/index.ts
CHANGED
|
@@ -2,19 +2,28 @@
|
|
|
2
2
|
* 统一 re-export @qin-ui/pro-components-core,包内所有文件通过此文件引入 core 内容。
|
|
3
3
|
*/
|
|
4
4
|
export {
|
|
5
|
+
// types
|
|
6
|
+
type AdditionalMethods,
|
|
7
|
+
localePacks,
|
|
8
|
+
normalizeColumn,
|
|
9
|
+
normalizeColumns,
|
|
5
10
|
// hooks
|
|
6
11
|
useForm,
|
|
7
12
|
createFormProxy,
|
|
8
13
|
useTable,
|
|
9
14
|
useSearchFormExpand,
|
|
10
15
|
useFields,
|
|
16
|
+
resolveFieldIdentity,
|
|
17
|
+
DEFAULT_FIELD_IDENTITY_KEYS,
|
|
11
18
|
useFormData,
|
|
12
19
|
useFormRef,
|
|
20
|
+
useReactiveAttrs,
|
|
13
21
|
// injection keys
|
|
14
22
|
InjectionFormKey,
|
|
15
23
|
InjectionFormSlotsKey,
|
|
16
24
|
// utils
|
|
17
25
|
getObject,
|
|
26
|
+
omitBy,
|
|
18
27
|
get,
|
|
19
28
|
set,
|
|
20
29
|
normalizePathKey,
|
|
@@ -22,7 +31,9 @@ export {
|
|
|
22
31
|
camelizeProperties,
|
|
23
32
|
cloneDeep,
|
|
24
33
|
pick,
|
|
34
|
+
omit,
|
|
25
35
|
isPlainObject,
|
|
36
|
+
isObjectItem,
|
|
26
37
|
isPromise,
|
|
27
38
|
// locale
|
|
28
39
|
zhCN,
|
package/src/shared/ui/index.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
FormProps as _FormProps,
|
|
3
|
+
Table,
|
|
4
|
+
TableProps as _TableProps,
|
|
5
|
+
} from 'ant-design-vue';
|
|
6
|
+
import type { ComponentProps } from 'vue-component-type-helpers';
|
|
2
7
|
import type { Options } from 'scroll-into-view-if-needed';
|
|
3
8
|
|
|
4
9
|
export {
|
|
@@ -36,7 +41,6 @@ export {
|
|
|
36
41
|
type RowProps as GridProps,
|
|
37
42
|
type ColProps as GridItemProps,
|
|
38
43
|
type FormItemProps,
|
|
39
|
-
type TableProps,
|
|
40
44
|
type PaginationProps,
|
|
41
45
|
} from 'ant-design-vue';
|
|
42
46
|
|
|
@@ -48,13 +52,27 @@ export {
|
|
|
48
52
|
useProviderDisabled,
|
|
49
53
|
} from 'ant-design-vue/es/config-provider/DisabledContext';
|
|
50
54
|
export { colProps as gridItemProps } from 'ant-design-vue/es/grid/Col';
|
|
55
|
+
export { formItemProps } from 'ant-design-vue/es/form';
|
|
51
56
|
export {
|
|
52
|
-
formItemProps,
|
|
53
57
|
useInjectFormItemContext,
|
|
54
|
-
|
|
58
|
+
useProvideFormItemContext,
|
|
59
|
+
} from 'ant-design-vue/es/form/FormItemContext';
|
|
55
60
|
export { type NamePath } from 'ant-design-vue/es/form/interface';
|
|
56
61
|
export { type MenuItemType } from 'ant-design-vue/es/menu/src/interface';
|
|
57
62
|
|
|
63
|
+
/** 宿主 Form 属性面;`scrollToFirstError` 放宽为布尔或滚动配置对象 */
|
|
58
64
|
export type FormProps = Omit<_FormProps, 'scrollToFirstError'> & {
|
|
59
65
|
scrollToFirstError?: boolean | Options<any>;
|
|
60
66
|
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 表格完整属性面
|
|
70
|
+
*
|
|
71
|
+
* @description 由宿主 `TableProps` 与其未声明的 emit 型属性键组成;
|
|
72
|
+
* ant-design-vue 的 Table 未暴露 `scroll` 事件面,故不提供 `@scroll` 入口。
|
|
73
|
+
*/
|
|
74
|
+
export interface TableProps extends _TableProps {
|
|
75
|
+
'onUpdate:expandedRowKeys'?: ComponentProps<
|
|
76
|
+
typeof Table
|
|
77
|
+
>['onUpdate:expandedRowKeys'];
|
|
78
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"jsx": "preserve",
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"lib": ["ESNext", "ES2022", "DOM"],
|
|
13
|
+
"baseUrl": ".",
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"declarationMap": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"forceConsistentCasingInFileNames": true,
|
|
18
|
+
"noEmit": true
|
|
19
|
+
},
|
|
20
|
+
"include": ["src", "__tests__"],
|
|
21
|
+
"exclude": ["node_modules", "es"]
|
|
22
|
+
}
|