@iswangh/element-plus-kit-form 0.3.0 → 0.3.1

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.
@@ -1,5 +1,5 @@
1
- import { ElAutocomplete, ElCascader, ElCheckboxGroup, ElColorPicker, ElColorPickerPanel, ElDatePicker, ElDatePickerPanel, ElInput, ElInputNumber, ElInputTag, ElMention, ElRadioGroup, ElRate, ElSelect, ElSelectV2, ElSlider, ElSwitch, ElTimePicker, ElTimeSelect, ElTransfer, ElTreeSelect } from 'element-plus';
2
- import { EXPAND_COMP_MAP } from '../config';
1
+ import { WCheckTag } from '@iswangh/element-plus-kit-tag';
2
+ import { ElAutocomplete, ElCascader, ElCheckbox, ElCheckboxGroup, ElColorPicker, ElColorPickerPanel, ElDatePicker, ElDatePickerPanel, ElInput, ElInputNumber, ElInputTag, ElMention, ElRadioGroup, ElRate, ElSelect, ElSelectV2, ElSlider, ElSwitch, ElTimePicker, ElTimeSelect, ElTransfer, ElTreeSelect } from 'element-plus';
3
3
  /**
4
4
  * Element Plus 组件映射类型
5
5
  *
@@ -9,7 +9,8 @@ import { EXPAND_COMP_MAP } from '../config';
9
9
  interface ElCompMap {
10
10
  readonly 'autocomplete': typeof ElAutocomplete
11
11
  readonly 'cascader': typeof ElCascader
12
- readonly 'checkbox': typeof ElCheckboxGroup
12
+ readonly 'checkbox': typeof ElCheckbox
13
+ readonly 'checkbox-group': typeof ElCheckboxGroup
13
14
  readonly 'color-picker-panel': typeof ElColorPickerPanel
14
15
  readonly 'color-picker': typeof ElColorPicker
15
16
  readonly 'date-picker-panel': typeof ElDatePickerPanel
@@ -18,7 +19,7 @@ interface ElCompMap {
18
19
  readonly 'input-number': typeof ElInputNumber
19
20
  readonly 'input-tag': typeof ElInputTag
20
21
  readonly 'mention': typeof ElMention
21
- readonly 'radio': typeof ElRadioGroup
22
+ readonly 'radio-group': typeof ElRadioGroup
22
23
  readonly 'rate': typeof ElRate
23
24
  readonly 'select': typeof ElSelect
24
25
  readonly 'select-v2': typeof ElSelectV2
@@ -30,17 +31,28 @@ interface ElCompMap {
30
31
  readonly 'tree-select': typeof ElTreeSelect
31
32
  }
32
33
 
34
+ /**
35
+ * 扩展组件映射类型
36
+ *
37
+ * 手动定义扩展组件的类型映射,确保类型提示正常工作
38
+ * 与 comp.ts 中的 EXPAND_COMP_MAP 保持同步
39
+ */
40
+ interface ExpandCompMap {
41
+ readonly 'custom': typeof HTMLDivElement
42
+ readonly 'w-check-tag': typeof WCheckTag
43
+ }
44
+
33
45
  /**
34
46
  * 表单组件配置映射类型
35
47
  *
36
48
  * 合并 Element Plus 组件映射和扩展组件映射的类型
37
49
  * - ElCompMap: 手动定义,避免类型推断超出限制
38
- * - typeof EXPAND_COMP_MAP: 从运行时值提取类型(简单映射,不会超出限制)
50
+ * - ExpandCompMap: 手动定义扩展组件类型,确保类型提示正常工作
39
51
  *
40
52
  * 注意:不使用 typeof FORM_ITEM_COMP_MAP,因为 FORM_ITEM_COMP_MAP 使用了
41
53
  * Record<string, any> 避免类型推断超出编译器序列化限制
42
54
  */
43
- export type FormCompConfig = ElCompMap & typeof EXPAND_COMP_MAP
55
+ export type FormCompConfig = ElCompMap & ExpandCompMap
44
56
 
45
57
  /**
46
58
  * 支持的表单组件枚举
@@ -49,30 +61,31 @@ export type FormCompConfig = ElCompMap & typeof EXPAND_COMP_MAP
49
61
  * 注意:由于 FORM_ITEM_COMP_MAP 使用了 Record<string, any> 避免类型推断超出限制,
50
62
  * 我们需要显式定义键名类型,而不是从 typeof FORM_ITEM_COMP_MAP 中提取
51
63
  */
52
- export type FormItemComp = 'custom'
53
- | 'autocomplete'
54
- | 'cascader'
55
- | 'checkbox'
56
- | 'color-picker'
57
- | 'color-picker-panel'
58
- | 'date-picker'
59
- | 'date-picker-panel'
60
- | 'input'
61
- | 'input-number'
62
- | 'input-tag'
63
- | 'mention'
64
- | 'radio'
65
- | 'rate'
66
- | 'select'
67
- | 'select-v2'
68
- | 'slider'
69
- | 'switch'
70
- | 'time-picker'
71
- | 'time-select'
72
- | 'transfer'
73
- | 'tree-select'
74
- | 'custom'
75
-
64
+ export type FormItemComp
65
+ = 'autocomplete'
66
+ | 'cascader'
67
+ | 'checkbox'
68
+ | 'checkbox-group'
69
+ | 'color-picker'
70
+ | 'color-picker-panel'
71
+ | 'date-picker'
72
+ | 'date-picker-panel'
73
+ | 'input'
74
+ | 'input-number'
75
+ | 'input-tag'
76
+ | 'mention'
77
+ | 'radio-group'
78
+ | 'rate'
79
+ | 'select'
80
+ | 'select-v2'
81
+ | 'slider'
82
+ | 'switch'
83
+ | 'time-picker'
84
+ | 'time-select'
85
+ | 'transfer'
86
+ | 'tree-select'
87
+ | 'custom'
88
+ | 'w-check-tag'
76
89
  /**
77
90
  * 根据组件类型获取组件实例类型
78
91
  * @template T 组件类型
@@ -1,30 +1,16 @@
1
1
  import { ElCol, ElRow, FormItemInstance, FormRules } from 'element-plus';
2
- /**
3
- * Element Plus Form Props
4
- *
5
- * 由于 `FormInstance['$slots']` 类型定义存在问题,
6
- * 暂时无法直接使用 `FormInstance['$props']`,
7
- * 因此手动定义了部分常用属性以确保类型安全。
8
- *
9
- * @see {@link https://element-plus.org/zh-CN/component/form.html#form-attributes Element Plus Form Attributes}
10
- */
2
+ /** Element Plus Form Props */
11
3
  export interface ElFormProps {
12
- // 数据相关
13
4
  model?: Record<string, any>
14
5
  rules?: FormRules
15
-
16
- // 布局相关
17
6
  inline?: boolean
18
7
  labelPosition?: 'left' | 'right' | 'top'
19
8
  labelWidth?: string | number
20
9
  labelSuffix?: string
21
-
22
- // 样式相关
23
10
  size?: 'large' | 'default' | 'small'
24
11
  disabled?: boolean
25
12
  hideRequiredAsterisk?: boolean
26
-
27
- // 验证相关
13
+ requireAsteriskPosition?: 'left' | 'right'
28
14
  showMessage?: boolean
29
15
  inlineMessage?: boolean
30
16
  statusIcon?: boolean
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iswangh/element-plus-kit-form",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.3.1",
5
5
  "description": "Element Plus Kit 表单组件包",
6
6
  "license": "Apache-2.0",
7
7
  "sideEffects": [
@@ -31,20 +31,21 @@
31
31
  "vue": "^3.5.23"
32
32
  },
33
33
  "dependencies": {
34
- "lodash-es": "^4.17.21",
35
- "@iswangh/element-plus-kit-core": "0.2.1"
34
+ "lodash-es": "^4.17.22",
35
+ "@iswangh/element-plus-kit-tag": "0.0.2",
36
+ "@iswangh/element-plus-kit-core": "0.2.2"
36
37
  },
37
38
  "devDependencies": {
38
39
  "@element-plus/icons-vue": "^2.3.2",
39
40
  "@types/lodash-es": "^4.17.12",
40
- "@vitejs/plugin-vue": "^6.0.1",
41
- "element-plus": "^2.11.8",
42
- "sass": "^1.94.0",
41
+ "@vitejs/plugin-vue": "^6.0.3",
42
+ "element-plus": "^2.13.0",
43
+ "sass": "^1.97.1",
43
44
  "typescript": "^5.9.3",
44
- "vite": "^7.2.2",
45
+ "vite": "^7.3.0",
45
46
  "vite-plugin-dts": "^4.5.4",
46
- "vue": "^3.5.24",
47
- "vue-tsc": "^3.1.3"
47
+ "vue": "^3.5.26",
48
+ "vue-tsc": "^3.2.1"
48
49
  },
49
50
  "publishConfig": {
50
51
  "access": "public",