@qin-ui/element-plus-pro 1.3.4 → 1.4.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.
Files changed (93) hide show
  1. package/AI-CONTEXT.md +26 -2
  2. package/README.md +41 -30
  3. package/api.json +69 -38
  4. package/es/components/component-provider/components/index.vue.d.ts +10 -3
  5. package/es/components/component-provider/components/index.vue.d.ts.map +1 -1
  6. package/es/components/component-provider/constants/index.d.ts +22 -4
  7. package/es/components/component-provider/constants/index.d.ts.map +1 -1
  8. package/es/components/component-provider/types/index.d.ts +17 -3
  9. package/es/components/component-provider/types/index.d.ts.map +1 -1
  10. package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -1
  11. package/es/components/form/components/BaseField/utils/index.d.ts +15 -0
  12. package/es/components/form/components/BaseField/utils/index.d.ts.map +1 -1
  13. package/es/components/form/components/BaseFormItem/index.vue.d.ts +3 -1
  14. package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -1
  15. package/es/components/form/components/ContainerFragment/index.vue.d.ts.map +1 -1
  16. package/es/components/form/components/ProForm/index.vue.d.ts.map +1 -1
  17. package/es/components/form/components/SlotComponent/index.vue.d.ts.map +1 -1
  18. package/es/components/form/components/index.d.ts +4 -0
  19. package/es/components/form/components/index.d.ts.map +1 -1
  20. package/es/components/form/constants/index.d.ts +8 -2
  21. package/es/components/form/constants/index.d.ts.map +1 -1
  22. package/es/components/form/hooks/useFields.d.ts.map +1 -1
  23. package/es/components/form/hooks/useForm.d.ts.map +1 -1
  24. package/es/components/form/hooks/useGroupFieldAttrs.d.ts +9 -0
  25. package/es/components/form/hooks/useGroupFieldAttrs.d.ts.map +1 -1
  26. package/es/components/form/index.d.ts +2 -2
  27. package/es/components/form/index.d.ts.map +1 -1
  28. package/es/components/form/types/index.d.ts +65 -50
  29. package/es/components/form/types/index.d.ts.map +1 -1
  30. package/es/components/form/utils/fieldKey.d.ts +13 -0
  31. package/es/components/form/utils/fieldKey.d.ts.map +1 -0
  32. package/es/components/table/components/ColumnControl.vue.d.ts +1 -1
  33. package/es/components/table/components/ColumnControl.vue.d.ts.map +1 -1
  34. package/es/components/table/components/ProTable.vue.d.ts +15 -1
  35. package/es/components/table/components/ProTable.vue.d.ts.map +1 -1
  36. package/es/components/table/components/SearchForm.vue.d.ts +14 -2
  37. package/es/components/table/components/SearchForm.vue.d.ts.map +1 -1
  38. package/es/components/table/components/SizeControl.vue.d.ts +7 -2
  39. package/es/components/table/components/SizeControl.vue.d.ts.map +1 -1
  40. package/es/components/table/components/TableColumnRenderer.vue.d.ts +14 -14
  41. package/es/components/table/components/TableColumnRenderer.vue.d.ts.map +1 -1
  42. package/es/components/table/hooks/index.d.ts +2 -0
  43. package/es/components/table/hooks/index.d.ts.map +1 -0
  44. package/es/components/table/{useTable.d.ts → hooks/useTable.d.ts} +3 -3
  45. package/es/components/table/hooks/useTable.d.ts.map +1 -0
  46. package/es/components/table/index.d.ts +6 -2
  47. package/es/components/table/index.d.ts.map +1 -1
  48. package/es/components/table/types/index.d.ts +16 -12
  49. package/es/components/table/types/index.d.ts.map +1 -1
  50. package/es/element-plus-pro.css +14 -14
  51. package/es/index.d.ts +9 -6
  52. package/es/index.d.ts.map +1 -1
  53. package/es/index.js +577 -432
  54. package/es/index.js.map +1 -1
  55. package/es/locale/index.d.ts +2 -1
  56. package/es/locale/index.d.ts.map +1 -1
  57. package/es/shared/core/index.d.ts +1 -1
  58. package/es/shared/core/index.d.ts.map +1 -1
  59. package/es/shared/ui/index.d.ts +20 -2
  60. package/es/shared/ui/index.d.ts.map +1 -1
  61. package/package.json +8 -5
  62. package/src/components/component-provider/components/index.vue +48 -21
  63. package/src/components/component-provider/constants/index.ts +34 -6
  64. package/src/components/component-provider/types/index.ts +21 -7
  65. package/src/components/form/components/BaseField/index.vue +32 -15
  66. package/src/components/form/components/BaseField/utils/index.ts +16 -1
  67. package/src/components/form/components/BaseFormItem/index.vue +61 -15
  68. package/src/components/form/components/ContainerFragment/index.vue +3 -1
  69. package/src/components/form/components/ProForm/index.vue +54 -27
  70. package/src/components/form/components/SlotComponent/index.vue +4 -2
  71. package/src/components/form/components/index.ts +8 -1
  72. package/src/components/form/constants/index.ts +9 -2
  73. package/src/components/form/hooks/useFields.ts +5 -2
  74. package/src/components/form/hooks/useForm.ts +8 -1
  75. package/src/components/form/hooks/useGroupFieldAttrs.ts +29 -30
  76. package/src/components/form/index.ts +1 -3
  77. package/src/components/form/types/index.ts +71 -52
  78. package/src/components/form/utils/fieldKey.ts +27 -0
  79. package/src/components/table/components/ColumnControl.vue +20 -8
  80. package/src/components/table/components/ProTable.vue +194 -96
  81. package/src/components/table/components/SearchForm.vue +62 -23
  82. package/src/components/table/components/SizeControl.vue +23 -1
  83. package/src/components/table/components/TableColumnRenderer.vue +93 -61
  84. package/src/components/table/hooks/index.ts +1 -0
  85. package/src/components/table/{useTable.ts → hooks/useTable.ts} +6 -4
  86. package/src/components/table/index.ts +11 -2
  87. package/src/components/table/types/index.ts +17 -13
  88. package/src/index.ts +13 -7
  89. package/src/locale/index.ts +4 -2
  90. package/src/shared/core/index.ts +11 -0
  91. package/src/shared/ui/index.ts +29 -5
  92. package/tsconfig.json +22 -0
  93. package/es/components/table/useTable.d.ts.map +0 -1
@@ -4,7 +4,8 @@ import { default as zhCN } from './zh-CN';
4
4
  import { default as zhTW } from './zh-TW';
5
5
  import { default as enUS } from './en-US';
6
6
  export { zhCN, zhTW, enUS };
7
- export type ProLocale = typeof zhCN;
7
+ /** 内置文案类型:键集合与 zh-CN 对齐,取值允许任意文案覆盖 */
8
+ export type ProLocale = Record<keyof typeof zhCN, string>;
8
9
  /** ProComponentProvider 通过该 key 注入局部覆盖文案 */
9
10
  export declare const LOCALE_INJECT_KEY: InjectionKey<MaybeRef<Partial<ProLocale> | undefined>>;
10
11
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/locale/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAC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,CAAC,CAClB,CAAC;AAEzB;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,SAAS;aAcJ,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAG,MAAM;;CAQ1E,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * 统一 re-export @qin-ui/pro-components-core,包内所有文件通过此文件引入 core 内容。
3
3
  */
4
- export { useForm, createFormProxy, useTable, useSearchFormExpand, useFields, useFormData, useFormRef, InjectionFormKey, InjectionFormSlotsKey, getObject, get, set, normalizePathKey, toPath, camelizeProperties, cloneDeep, pick, isPlainObject, isPromise, zhCN, zhTW, enUS, format, resolveLocaleName, type ProLocale, type ProLocaleName, type ProLocaleKey, type Data, type Path, type Paths, type KeyExpandString, type ExtendWithAny, type DeepPartial, type PageParam, type Fields, type Form, type Table, type UseFieldsReturn, type UseFormDataReturn, type UseFormRefReturn, } from '@qin-ui/pro-components-core';
4
+ export { type AdditionalMethods, localePacks, normalizeColumn, normalizeColumns, useForm, createFormProxy, useTable, useSearchFormExpand, useFields, resolveFieldIdentity, DEFAULT_FIELD_IDENTITY_KEYS, useFormData, useFormRef, useReactiveAttrs, InjectionFormKey, InjectionFormSlotsKey, getObject, omitBy, get, set, normalizePathKey, toPath, camelizeProperties, cloneDeep, pick, omit, isPlainObject, isObjectItem, isPromise, zhCN, zhTW, enUS, format, resolveLocaleName, type ProLocale, type ProLocaleName, type ProLocaleKey, type Data, type Path, type Paths, type KeyExpandString, type ExtendWithAny, type DeepPartial, type PageParam, type Fields, type Form, type Table, type UseFieldsReturn, type UseFormDataReturn, type UseFormRefReturn, } from '@qin-ui/pro-components-core';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/core/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAEL,OAAO,EACP,eAAe,EACf,QAAQ,EACR,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,UAAU,EAEV,gBAAgB,EAChB,qBAAqB,EAErB,SAAS,EACT,GAAG,EACH,GAAG,EACH,gBAAgB,EAChB,MAAM,EACN,kBAAkB,EAClB,SAAS,EACT,IAAI,EACJ,aAAa,EACb,SAAS,EAET,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EAEjB,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,IAAI,EACT,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/core/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAEL,KAAK,iBAAiB,EACtB,WAAW,EACX,eAAe,EACf,gBAAgB,EAEhB,OAAO,EACP,eAAe,EACf,QAAQ,EACR,mBAAmB,EACnB,SAAS,EACT,oBAAoB,EACpB,2BAA2B,EAC3B,WAAW,EACX,UAAU,EACV,gBAAgB,EAEhB,gBAAgB,EAChB,qBAAqB,EAErB,SAAS,EACT,MAAM,EACN,GAAG,EACH,GAAG,EACH,gBAAgB,EAChB,MAAM,EACN,kBAAkB,EAClB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,YAAY,EACZ,SAAS,EAET,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EAEjB,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,IAAI,EACT,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,6BAA6B,CAAC"}
@@ -1,14 +1,32 @@
1
- import { ElForm as Form, ElFormItem as FormItem, ElRow as Grid, ElCol as GridItem, ElTable as Table, ElTableColumn as TableColumn, ElSpace as Space, ElDropdown as Dropdown, ElDropdownMenu as DropdownMenu, ElDropdownItem as DropdownItem, ElCheckbox as Checkbox, ElCheckboxGroup as CheckboxGroup, ElButton as Button, ElAutocomplete as AutoComplete, ElCascader as Cascader, ElDatePicker as DatePicker, ElInput as Input, ElInputNumber as InputNumber, ElSelect as Select, ElSlider as Slider, ElSwitch as Switch, ElTransfer as Transfer, ElTreeSelect as TreeSelect, ElRadioGroup as RadioGroup, ElTimePicker as TimePicker, ElTimeSelect as TimeSelect, ElPagination as Pagination, FormItemInstance, FormInstance, FormProps, FormItemProps, TableProps as _TableProps, TableEmits, TableColumnCtx as ColumnType, PaginationProps, RowProps as GridProps, ColProps as GridItemProps } from 'element-plus';
1
+ import { ElForm as Form, ElFormItem as FormItem, ElRow as Grid, ElCol as GridItem, ElTable as Table, ElTableColumn as TableColumn, ElSpace as Space, ElDropdown as Dropdown, ElDropdownMenu as DropdownMenu, ElDropdownItem as DropdownItem, ElCheckbox as Checkbox, ElCheckboxGroup as CheckboxGroup, ElButton as Button, ElAutocomplete as AutoComplete, ElCascader as Cascader, ElDatePicker as DatePicker, ElInput as Input, ElInputNumber as InputNumber, ElSelect as Select, ElSlider as Slider, ElSwitch as Switch, ElTransfer as Transfer, ElTreeSelect as TreeSelect, ElRadioGroup as RadioGroup, ElTimePicker as TimePicker, ElTimeSelect as TimeSelect, ElPagination as Pagination, useSize, FormItemInstance, FormInstance, FormProps, FormItemProps, TableProps as _TableProps, TableEmits, TableColumnCtx as ColumnType, PaginationProps, RowProps as GridProps, ColProps as GridItemProps } from 'element-plus';
2
2
  import { MaybeRefOrGetter } from 'vue';
3
- export { Form, FormItem, Grid, GridItem, Table, TableColumn, Space, Dropdown, DropdownMenu, DropdownItem, Checkbox, CheckboxGroup, Button, AutoComplete, Cascader, DatePicker, Input, InputNumber, Select, Slider, Switch, Transfer, TreeSelect, RadioGroup, TimePicker, TimeSelect, Pagination, type FormItemInstance, type FormInstance, type FormProps, type FormItemProps, type PaginationProps, type GridProps, type GridItemProps, type ColumnType, type TableEmits, };
3
+ export { Form, FormItem, Grid, GridItem, Table, TableColumn, Space, Dropdown, DropdownMenu, DropdownItem, Checkbox, CheckboxGroup, Button, AutoComplete, Cascader, DatePicker, Input, InputNumber, Select, Slider, Switch, Transfer, TreeSelect, RadioGroup, TimePicker, TimeSelect, Pagination, useSize, type FormItemInstance, type FormInstance, type FormProps, type FormItemProps, type PaginationProps, type GridProps, type GridItemProps, type ColumnType, type TableEmits, };
4
+ /** 宿主 Table 属性面(放宽泛型以兼容任意行数据) */
4
5
  export type TableProps = _TableProps<any>;
6
+ /** 宿主 Table 的静态 props 快照(透传键名白名单用) */
5
7
  export declare const tableProps: () => any;
8
+ /** 宿主 Pagination 的静态 props 快照(分页配置键名白名单用) */
6
9
  export declare const paginationProps: () => any;
10
+ /** 宿主 Row/Col 的静态 props 快照 */
7
11
  export declare const gridItemProps: () => any;
12
+ /** 宿主 FormItem 的静态 props 快照 */
8
13
  export declare const formItemProps: () => any;
14
+ /** 禁用上下文取值
15
+ *
16
+ * @description 字段级禁用优先,未声明时回退宿主 `el-form` 的禁用状态
17
+ * @returns {ComputedRef<boolean>} 当前生效的禁用状态
18
+ */
9
19
  export declare const useDisabledContext: () => import('vue').ComputedRef<boolean>;
20
+ /** 禁用上下文提供者
21
+ *
22
+ * @description 与父级禁用上下文合并:未声明时保持继承,声明时(含 false)覆盖
23
+ * @param {MaybeRefOrGetter<boolean | undefined>} disabled - 本层声明的禁用状态
24
+ */
10
25
  export declare const useDisabledContextProvider: (disabled: MaybeRefOrGetter<boolean | undefined>) => void;
26
+ /** {@link useDisabledContext} 的别名 */
11
27
  export declare const useInjectDisabled: () => import('vue').ComputedRef<boolean>;
28
+ /** {@link useDisabledContextProvider} 的别名 */
12
29
  export declare const useProviderDisabled: (disabled: MaybeRefOrGetter<boolean | undefined>) => void;
30
+ /** 字段路径:字符串、数字或分段数组 */
13
31
  export type NamePath = string | number | (string | number)[];
14
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,IAAI,IAAI,EACd,UAAU,IAAI,QAAQ,EACtB,KAAK,IAAI,IAAI,EACb,KAAK,IAAI,QAAQ,EACjB,OAAO,IAAI,KAAK,EAChB,aAAa,IAAI,WAAW,EAC5B,OAAO,IAAI,KAAK,EAChB,UAAU,IAAI,QAAQ,EACtB,cAAc,IAAI,YAAY,EAC9B,cAAc,IAAI,YAAY,EAC9B,UAAU,IAAI,QAAQ,EACtB,eAAe,IAAI,aAAa,EAChC,QAAQ,IAAI,MAAM,EAClB,cAAc,IAAI,YAAY,EAC9B,UAAU,IAAI,QAAQ,EACtB,YAAY,IAAI,UAAU,EAC1B,OAAO,IAAI,KAAK,EAChB,aAAa,IAAI,WAAW,EAC5B,QAAQ,IAAI,MAAM,EAClB,QAAQ,IAAI,MAAM,EAClB,QAAQ,IAAI,MAAM,EAClB,UAAU,IAAI,QAAQ,EACtB,YAAY,IAAI,UAAU,EAC1B,YAAY,IAAI,UAAU,EAC1B,YAAY,IAAI,UAAU,EAC1B,YAAY,IAAI,UAAU,EAC1B,YAAY,IAAI,UAAU,EAE1B,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,UAAU,IAAI,WAAW,EAC9B,KAAK,UAAU,EACf,KAAK,cAAc,IAAI,UAAU,EACjC,KAAK,eAAe,EACpB,KAAK,QAAQ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R,UAAU,EACV,KAAK,EACL,WAAW,EACX,MAAM,EACN,MAAM,EACN,MAAM,EACN,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,OAAO,EACP,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,CAAC;AAEF,iCAAiC;AACjC,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;AAO1C,sCAAsC;AACtC,eAAO,MAAM,UAAU,WAAoB,CAAC;AAC5C,6CAA6C;AAC7C,eAAO,MAAM,eAAe,WAAyB,CAAC;AACtD,8BAA8B;AAC9B,eAAO,MAAM,aAAa,WAAuB,CAAC;AAClD,+BAA+B;AAC/B,eAAO,MAAM,aAAa,WAAuB,CAAC;AAIlD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,0CAW9B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GACrC,UAAU,gBAAgB,CAAC,OAAO,GAAG,SAAS,CAAC,SAQhD,CAAC;AAEF,qCAAqC;AACrC,eAAO,MAAM,iBAAiB,0CAAqB,CAAC;AACpD,6CAA6C;AAC7C,eAAO,MAAM,mBAAmB,aAbpB,gBAAgB,CAAC,OAAO,GAAG,SAAS,CAAC,SAaY,CAAC;AAE9D,uBAAuB;AACvB,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qin-ui/element-plus-pro",
3
- "version": "1.3.4",
3
+ "version": "1.4.0",
4
4
  "description": "基于 element-plus 的二次封装组件",
5
5
  "bin": {
6
6
  "element-plus-pro": "./bin/init-ai.mjs"
@@ -14,7 +14,8 @@
14
14
  "types": "./es/index.d.ts",
15
15
  "import": "./es/index.js"
16
16
  },
17
- "./element-plus-pro.css": "./es/element-plus-pro.css"
17
+ "./element-plus-pro.css": "./es/element-plus-pro.css",
18
+ "./package.json": "./package.json"
18
19
  },
19
20
  "files": [
20
21
  "es",
@@ -23,7 +24,8 @@
23
24
  "README.md",
24
25
  "LICENSE",
25
26
  "api.json",
26
- "AI-CONTEXT.md"
27
+ "AI-CONTEXT.md",
28
+ "tsconfig.json"
27
29
  ],
28
30
  "homepage": "https://dufan3715.github.io/pro-components/",
29
31
  "repository": {
@@ -34,14 +36,15 @@
34
36
  "license": "MIT",
35
37
  "private": false,
36
38
  "peerDependencies": {
37
- "element-plus": "^2.13.6",
39
+ "element-plus": "^2.14.5",
38
40
  "vue": "^3.5.0"
39
41
  },
40
42
  "dependencies": {
41
43
  "vue-component-type-helpers": "^3.2.5",
42
- "@qin-ui/pro-components-core": "^2.0.3"
44
+ "@qin-ui/pro-components-core": "^2.1.0"
43
45
  },
44
46
  "devDependencies": {
47
+ "@types/node": "^24",
45
48
  "@vue/test-utils": "^2.4.11",
46
49
  "element-plus": "^2.14.5",
47
50
  "happy-dom": "^20.11.6",
@@ -1,36 +1,44 @@
1
1
  <script lang="ts" setup>
2
2
  /**
3
+ * 全局配置提供者组件
4
+ *
3
5
  * @component ProComponentProvider
4
- * @description @qin-ui/element-plus-pro 全局配置提供者组件
6
+ * @public
5
7
  *
6
8
  * 用于在组件树的顶层配置所有子组件的全局默认属性。
9
+ * 支持配置 ProForm、ProTable、ProFormItem 以及所有内置组件的默认属性。
7
10
  *
8
11
  * @param {ComponentVars} [componentVars] - 组件全局配置变量
9
- * @param {Record<ComponentName, any>} [componentMap] - 自定义组件映射
12
+ * @param {Record<ComponentName, any>} [componentMap] - 自定义组件映射,用于替换或扩展内置组件
10
13
  * @param {Partial<ProLocale>} [locale] - 内置文案覆盖,可覆盖任意 locale 文案(如查询/重置/序号/占位符等)
11
14
  *
12
- * @slot default - 子组件内容
15
+ * @slot default - 需要应用全局配置的子组件内容
13
16
  *
14
17
  * @example
15
18
  * ```vue
16
- * <ProComponentProvider
17
- * :componentVars="{ 'input': { placeholder: '请输入' } }"
18
- * >
19
- * <ProForm :form="form" />
20
- * </ProComponentProvider>
19
+ * <template>
20
+ * <ProComponentProvider
21
+ * :componentVars="{
22
+ * 'pro-form': { grid: { gutter: 24 } },
23
+ * 'input': { placeholder: '请输入', maxlength: 200 },
24
+ * 'select': { placeholder: '请选择' },
25
+ * }"
26
+ * >
27
+ * <ProForm :form="form" />
28
+ * </ProComponentProvider>
29
+ * </template>
21
30
  * ```
22
-
23
- * @public
24
31
  */
25
- import { ComponentVars } from '../types';
26
32
  import {
33
+ INJECT_COMPONENT_VARS,
27
34
  INJECT_COMPONENTS,
28
35
  INJECT_CONFIG,
29
36
  ensureInjectConfig,
30
37
  } from '../constants';
38
+ import type { ComponentVars } from '../types';
31
39
  import { computed, provide } from 'vue';
32
- import { getObject } from '../../../shared/core';
33
- import { ComponentName } from '../../form/constants';
40
+ import { getObject, omit } from '../../../shared/core';
41
+ import type { ComponentName } from '../../form/constants';
34
42
  import { LOCALE_INJECT_KEY, type ProLocale } from '../../../locale';
35
43
 
36
44
  type ComponentMap = Partial<Record<ComponentName, any>>;
@@ -41,13 +49,20 @@ defineOptions({
41
49
  });
42
50
 
43
51
  type Props = {
44
- /** 组件全局配置,可配置所有内置组件的默认属性 */
52
+ /**
53
+ * 组件全局配置,可配置所有内置组件和 Pro 组件的默认属性
54
+ * @example { 'input': { placeholder: '请输入' }, 'pro-form': { grid: { gutter: 24 } } }
55
+ */
45
56
  componentVars?: ComponentVars;
46
- /** 自定义组件映射,用于替换或扩展内置组件 */
57
+ /**
58
+ * 自定义组件映射:用于替换或扩展内置组件,传入的组件会覆盖默认的同名组件
59
+ * @example { 'input': MyCustomInput, 'select': MyCustomSelect }
60
+ */
47
61
  componentMap?: ComponentMap;
48
62
  /**
49
- * 内置文案覆盖,可覆盖任意 locale 文案(如查询/重置/序号/占位符等),
63
+ * 内置文案覆盖:可覆盖任意 locale 文案(如查询/重置/序号/占位符等),
50
64
  * 未覆盖的文案默认跟随宿主组件库语言自动切换
65
+ * @example { 'table.query': '搜索' }
51
66
  */
52
67
  locale?: Partial<ProLocale>;
53
68
  };
@@ -60,18 +75,24 @@ const props = withDefaults(defineProps<Props>(), {
60
75
 
61
76
  /*
62
77
  * 遍历 componentVars 的每个 key,获取或创建对应的 inject 配置
63
- * 将用户提供的值合并到默认值上,通过 provide 响应式注入到子组件树
78
+ * 将用户提供的值合并到默认值上,剔除该注入项的不可注入键后通过 provide 响应式注入到子组件树
64
79
  * 子组件通过 inject(config.injectionKey) 获取合并后的计算属性配置
65
80
  */
66
81
  (Object.keys(INJECT_CONFIG) as Array<keyof typeof INJECT_CONFIG>).forEach(
67
82
  key => {
68
83
  const config = INJECT_CONFIG[key];
84
+ const ignored = config.ignoreProps;
69
85
  provide(
70
86
  config.injectionKey as any,
71
- computed(() => ({
72
- ...config.default,
73
- ...getObject(props.componentVars?.[key as keyof ComponentVars]),
74
- }))
87
+ computed(() =>
88
+ omit(
89
+ {
90
+ ...config.default,
91
+ ...getObject(props.componentVars?.[key as keyof ComponentVars]),
92
+ },
93
+ ignored ?? []
94
+ )
95
+ )
75
96
  );
76
97
  }
77
98
  );
@@ -92,6 +113,12 @@ if (props.componentVars) {
92
113
  });
93
114
  }
94
115
 
116
+ // 全量 componentVars:自定义组件键在运行期新增后同样可被子组件读取
117
+ provide(
118
+ INJECT_COMPONENT_VARS,
119
+ computed(() => (props.componentVars as Record<string, any>) ?? {})
120
+ );
121
+
95
122
  // 注入自定义组件映射,BaseField 在解析组件时会优先使用此映射
96
123
  provide(
97
124
  INJECT_COMPONENTS,
@@ -1,19 +1,32 @@
1
- import { RequiredComponentVars } from '../types';
2
- import { InjectionKey, Component, type ComputedRef } from 'vue';
1
+ import type { RequiredComponentVars } from '../types';
2
+ import type { InjectionKey, Component } from 'vue';
3
+ import { type ComputedRef } from 'vue';
3
4
 
5
+ /** 全量 componentVars 注入通道:运行期新增的自定义组件键由此读取(按组件名取配置) */
6
+ export const INJECT_COMPONENT_VARS: InjectionKey<
7
+ ComputedRef<Record<string, any> | undefined> | Record<string, any>
8
+ > = Symbol('COMPONENT_VARS');
9
+
10
+ /** 注入项配置:注入 key、内置默认值与不可注入键清单 */
4
11
  export type InjectConfigEntry<T = any> = {
5
12
  injectionKey: InjectionKey<T>;
6
13
  default: T;
14
+ /** 不接受 Provider 注入的键,注入层静默剔除 */
15
+ ignoreProps?: readonly string[];
7
16
  };
8
17
 
18
+ /**
19
+ * 注入项配置表:键为内置组件名与 `pro-*` 组件名,值为注入 key、内置默认值与不可注入键清单
20
+ */
9
21
  export const INJECT_CONFIG: {
10
- [key in keyof RequiredComponentVars]: {
11
- injectionKey: InjectionKey<RequiredComponentVars[key]>;
12
- default: RequiredComponentVars[key];
13
- };
22
+ [key in keyof RequiredComponentVars]: InjectConfigEntry<
23
+ RequiredComponentVars[key]
24
+ >;
14
25
  } = {
15
26
  'pro-table': {
16
27
  injectionKey: Symbol(''),
28
+ // 数据取自 `:table` 实例或显式 `:data`;列与加载态非类型面成员,同样在注入层忽略
29
+ ignoreProps: ['loading', 'columns', 'data'],
17
30
  default: {
18
31
  pagination: {
19
32
  layout: 'total, sizes, prev, pager, next, jumper',
@@ -30,6 +43,8 @@ export const INJECT_CONFIG: {
30
43
  },
31
44
  'pro-form': {
32
45
  injectionKey: Symbol(''),
46
+ // 表单实例由 `:form` 显式传入
47
+ ignoreProps: ['form'],
33
48
  default: { grid: { gutter: 24 } },
34
49
  },
35
50
  'pro-form-item': {
@@ -176,6 +191,7 @@ export const INJECT_CONFIG: {
176
191
  },
177
192
  };
178
193
 
194
+ /** componentMap 注入 key:BaseField 解析组件时优先取用 */
179
195
  export const INJECT_COMPONENTS: InjectionKey<
180
196
  | ComputedRef<Partial<Record<string, Component>> | undefined>
181
197
  | Partial<Record<string, Component>>
@@ -184,6 +200,12 @@ export const INJECT_COMPONENTS: InjectionKey<
184
200
  const DYNAMIC_INJECT_CONFIG: Record<string, InjectConfigEntry> =
185
201
  Object.create(null);
186
202
 
203
+ /**
204
+ * 读取注入项配置
205
+ *
206
+ * @param {string} key - 组件名或自定义注入键
207
+ * @returns {InjectConfigEntry | undefined} 内置或动态注入项配置,未注册时返回 undefined
208
+ */
187
209
  export const getInjectConfig = (key: string): InjectConfigEntry | undefined => {
188
210
  return (
189
211
  (INJECT_CONFIG as Record<string, InjectConfigEntry>)[key] ||
@@ -191,6 +213,12 @@ export const getInjectConfig = (key: string): InjectConfigEntry | undefined => {
191
213
  );
192
214
  };
193
215
 
216
+ /**
217
+ * 读取注入项配置,未注册时按组件名补建动态注入项
218
+ *
219
+ * @param {string} key - 组件名或自定义注入键
220
+ * @returns {InjectConfigEntry} 已存在或新建的注入项配置
221
+ */
194
222
  export const ensureInjectConfig = (key: string): InjectConfigEntry => {
195
223
  const existing = getInjectConfig(key);
196
224
  if (existing) return existing;
@@ -1,17 +1,17 @@
1
- import {
1
+ import type {
2
2
  GridItemProps,
3
3
  FormItemProps,
4
4
  TableProps,
5
5
  PaginationProps,
6
6
  DatePicker,
7
7
  } from '../../../shared/ui';
8
- import { ComponentName, GetComponentType } from '../../form/constants';
9
- import { Base, Grid, ContainerComponent } from '../../form/types';
10
- import { ProFormProps } from '../../form';
8
+ import type { ComponentName, GetComponentType } from '../../form/constants';
9
+ import type { Base, Grid, ContainerComponent } from '../../form/types';
10
+ import type { ProFormProps } from '../../form/components';
11
11
  import type { SearchFormProps } from '../../table/components/SearchForm.vue';
12
- import { AllowedComponentProps } from 'vue';
12
+ import type { AllowedComponentProps } from 'vue';
13
13
  import type { ComponentProps } from 'vue-component-type-helpers';
14
- import { ColumnControlConfig } from 'src/components/table/types';
14
+ import type { ColumnControlConfig } from '../../table/types';
15
15
 
16
16
  type PP<T extends Record<string, any>> = Partial<T & AllowedComponentProps>;
17
17
 
@@ -30,9 +30,17 @@ type FP<T extends Record<string, any>> = Partial<
30
30
 
31
31
  type DatePickerType = NonNullable<ComponentProps<typeof DatePicker>['type']>;
32
32
 
33
+ /**
34
+ * 全局配置的完整键集合(ComponentVars 的必填形态):键为内置组件名与 `pro-*` 组件名
35
+ */
33
36
  export type RequiredComponentVars = {
37
+ /**
38
+ * ProTable 全局默认属性
39
+ *
40
+ * @description `data` 不参与全局注入:由 `:table` 实例(`useTable`)或显式 `:data` 驱动;`columns` / `loading` 非本注入项的类型面成员,传入时在注入层忽略。
41
+ */
34
42
  'pro-table': PP<
35
- TableProps & {
43
+ Omit<TableProps, 'data'> & {
36
44
  pagination?: false | Partial<PaginationProps>;
37
45
  control?:
38
46
  | boolean
@@ -49,6 +57,7 @@ export type RequiredComponentVars = {
49
57
  tableContainer?: ContainerComponent | false;
50
58
  }
51
59
  >;
60
+ /** ProForm 全局默认属性,grid 必须为 GridProps 对象而非 boolean */
52
61
  'pro-form': PP<
53
62
  Omit<ProFormProps, 'form' | 'grid'> & {
54
63
  grid?: Exclude<Grid, undefined | boolean>;
@@ -71,4 +80,9 @@ export type RequiredComponentVars = {
71
80
  >;
72
81
  };
73
82
 
83
+ /**
84
+ * 组件全局配置
85
+ * @description RequiredComponentVars 的 Partial 版本,用于 ProComponentProvider 的 props
86
+ * @public
87
+ */
74
88
  export type ComponentVars = Partial<RequiredComponentVars>;
@@ -1,7 +1,9 @@
1
1
  <script lang="ts" setup>
2
2
  /**
3
+ * 字段级渲染组件
4
+ *
3
5
  * @component BaseField
4
- * @description 字段级渲染组件,负责将 field 配置渲染为实际的输入组件
6
+ * @description 负责将 field 配置渲染为实际的输入组件
5
7
  *
6
8
  * ## 核心职责
7
9
  *
@@ -34,14 +36,19 @@ import {
34
36
  mergeProps,
35
37
  ref,
36
38
  toValue,
37
- useAttrs,
38
39
  } from 'vue';
39
- import { cloneDeep } from '../../../../shared/core';
40
+ import {
41
+ cloneDeep,
42
+ getObject,
43
+ useReactiveAttrs,
44
+ } from '../../../../shared/core';
40
45
  import { useDisabledContext } from '../../../../shared/ui';
41
46
  import type { Field } from '../../types';
42
- import { ContainerFragment, SlotComponent } from '..';
47
+ import ContainerFragment from '../ContainerFragment/index.vue';
48
+ import SlotComponent from '../SlotComponent/index.vue';
43
49
  import { componentMap, InjectionFormSlotsKey } from '../../constants';
44
50
  import {
51
+ INJECT_COMPONENT_VARS,
45
52
  INJECT_COMPONENTS,
46
53
  getInjectConfig,
47
54
  } from '../../../component-provider/constants';
@@ -49,6 +56,10 @@ import { useForm } from '../../hooks/useForm';
49
56
  import { getInitProps, warnUnknownComponent } from './utils';
50
57
  import { useLocale } from '../../../../locale';
51
58
 
59
+ const cloneDeepIfObject = (val: unknown) =>
60
+ // 原始值直接传递,引用值克隆快照
61
+ typeof val === 'object' && val !== null ? cloneDeep(val) : val;
62
+
52
63
  defineOptions({ name: 'BaseField', inheritAttrs: false });
53
64
 
54
65
  type Props = {
@@ -66,7 +77,7 @@ const form = useForm(false);
66
77
 
67
78
  const componentRef = ref<any>();
68
79
 
69
- const attrs: any = useAttrs();
80
+ const attrs: any = useReactiveAttrs();
70
81
 
71
82
  /**
72
83
  * 全局默认配置注入:key = 组件名 + type 修饰段,inject 须在 setup 同步期调用。
@@ -84,6 +95,8 @@ const componentInjectConfig = injectConfigKey
84
95
  const rawInjectComponentProps = componentInjectConfig
85
96
  ? inject(componentInjectConfig.injectionKey, componentInjectConfig.default)
86
97
  : undefined;
98
+ // 全量 componentVars:运行期新增的自定义组件键由此兜底读取
99
+ const componentVars = inject(INJECT_COMPONENT_VARS, undefined);
87
100
 
88
101
  // setter: 向 formData 写入值,支持 valueFormatter / valueFormatter.set 转换
89
102
  const value = computed({
@@ -113,7 +126,7 @@ const value = computed({
113
126
  // 仅当 set 转换函数需要旧值参数时,才获取旧值上下文
114
127
  const oldVal =
115
128
  setFormatter.length > 1
116
- ? cloneDeep(form.getFormData?.(props.path))
129
+ ? cloneDeepIfObject(form.getFormData?.(props.path))
117
130
  : undefined;
118
131
  newVal = setFormatter(val, oldVal);
119
132
  }
@@ -135,7 +148,10 @@ const parentDisabled = useDisabledContext();
135
148
  * 属性分为三类:绑定属性(v-model)、组件属性(传递给组件)、插槽(动态渲染)
136
149
  */
137
150
  const groupedAttrs = computed(() => {
138
- const currentInjectProps = toValue(rawInjectComponentProps) || {};
151
+ const currentInjectProps = {
152
+ ...(toValue(rawInjectComponentProps) || {}),
153
+ ...getObject(toValue(componentVars)?.[injectConfigKey]),
154
+ };
139
155
  const initProps = getInitProps(
140
156
  {
141
157
  component: props.component,
@@ -145,10 +161,14 @@ const groupedAttrs = computed(() => {
145
161
  t
146
162
  );
147
163
  const modelPropName = attrs.modelProp ?? initProps.modelProp ?? 'modelValue';
164
+ // 字段级优先;null / undefined 回退父级与 Provider,'' / 'disabled' 按宿主 Boolean 形态为 true
165
+ const normalizeDisabled = (value: unknown) =>
166
+ value === '' || value === 'disabled' ? true : Boolean(value);
148
167
  const effectiveDisabled =
149
- attrs.disabled !== undefined
150
- ? Boolean(attrs.disabled)
151
- : Boolean(parentDisabled.value || initProps.disabled);
168
+ attrs.disabled !== undefined && attrs.disabled !== null
169
+ ? normalizeDisabled(attrs.disabled)
170
+ : normalizeDisabled(parentDisabled.value) ||
171
+ normalizeDisabled(initProps.disabled);
152
172
  const mergedProps = mergeProps(
153
173
  initProps,
154
174
  attrs,
@@ -158,7 +178,6 @@ const groupedAttrs = computed(() => {
158
178
  ) as Required<Field>;
159
179
 
160
180
  // prettier-ignore
161
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
162
181
  const { valueFormatter, modelProp, slots, componentClass, componentStyle, componentContainer, [modelPropName]: _modelVal, [`onUpdate:${modelPropName}`]: onUpdateValue, ...bindAttrs } = mergedProps as any;
163
182
 
164
183
  return {
@@ -172,9 +191,7 @@ const groupedAttrs = computed(() => {
172
191
  });
173
192
 
174
193
  // 从 ProForm 插槽注入的 slots 集合(优先级最高)
175
- const formSlots = inject(InjectionFormSlotsKey, undefined) as
176
- | Record<string, any>
177
- | undefined;
194
+ const injectedFormSlots = inject(InjectionFormSlotsKey, undefined);
178
195
 
179
196
  // 从 ProComponentProvider 注入的自定义组件映射
180
197
  const customComponents = inject(INJECT_COMPONENTS, {});
@@ -184,7 +201,7 @@ const customComponents = inject(INJECT_COMPONENTS, {});
184
201
  * ProForm 插槽 → 自定义组件映射 → 内置组件映射 → 原始 component 值
185
202
  */
186
203
  const is = computed(() => {
187
- const teleportSlot = props.path && formSlots?.[props.path];
204
+ const teleportSlot = props.path && injectedFormSlots?.value?.[props.path];
188
205
  if (teleportSlot) return teleportSlot;
189
206
  if (typeof props.component === 'string') {
190
207
  const resolved =
@@ -1,4 +1,4 @@
1
- import { Field } from '../../../types';
1
+ import type { Field } from '../../../types';
2
2
 
3
3
  type LocaleT = (
4
4
  key: string,
@@ -59,6 +59,15 @@ const getPlaceholderProps = (
59
59
  return { placeholder: t(placeholderKey) };
60
60
  };
61
61
 
62
+ /**
63
+ * 组件初始属性:以内置默认值为底,按下发组件名补默认占位符文案
64
+ *
65
+ * @description 组件名由 `component` 与 `type` 拼接(如 `input.password`);`component` 非字符串时返回空记录。
66
+ * @param {Field} field - 字段配置
67
+ * @param {Record<string, any>} injectProps - Provider 下发的组件默认属性
68
+ * @param {LocaleT} t - 取文案的翻译函数
69
+ * @returns {Record<string, any>} 组件初始属性(键值均来自注入配置与默认文案)
70
+ */
62
71
  export const getInitProps = (
63
72
  field: Field,
64
73
  injectProps: Record<string, any> = {},
@@ -75,6 +84,12 @@ export const getInitProps = (
75
84
  /** 已告警过的未知组件名(模块级去重集合) */
76
85
  const warnedUnknownComponents = new Set<string>();
77
86
 
87
+ /**
88
+ * 未识别组件名的降级告警
89
+ *
90
+ * @description 同一组件名仅告警一次,提示注册 componentMap 或 ProComponentProvider。
91
+ * @param {string} name - 未识别的组件类型名
92
+ */
78
93
  export function warnUnknownComponent(name: string) {
79
94
  if (warnedUnknownComponents.has(name)) return;
80
95
  warnedUnknownComponents.add(name);