x-next 1.13.0 → 1.15.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 (187) hide show
  1. package/AI_CODING.md +6 -5
  2. package/AI_USAGE/catalog.md +108 -105
  3. package/AI_USAGE/components/alert-api.md +48 -0
  4. package/AI_USAGE/components/alert.md +222 -3
  5. package/AI_USAGE/components/bar-chart-api.md +177 -0
  6. package/AI_USAGE/components/bar-chart.md +297 -3
  7. package/AI_USAGE/components/boxicons.md +147 -0
  8. package/AI_USAGE/components/button-api.md +144 -0
  9. package/AI_USAGE/components/button.md +447 -3
  10. package/AI_USAGE/components/charts.md +81 -0
  11. package/AI_USAGE/components/checkbox-api.md +145 -0
  12. package/AI_USAGE/components/checkbox.md +365 -3
  13. package/AI_USAGE/components/color-picker-api.md +52 -0
  14. package/AI_USAGE/components/color-picker.md +211 -3
  15. package/AI_USAGE/components/config-provider-api.md +38 -0
  16. package/AI_USAGE/components/config-provider.md +250 -3
  17. package/AI_USAGE/components/date-picker-api.md +1114 -0
  18. package/AI_USAGE/components/date-picker.md +378 -3
  19. package/AI_USAGE/components/dialog-api.md +142 -0
  20. package/AI_USAGE/components/dialog.md +284 -3
  21. package/AI_USAGE/components/draggable-api.md +146 -0
  22. package/AI_USAGE/components/draggable.md +259 -0
  23. package/AI_USAGE/components/drawer-api.md +78 -0
  24. package/AI_USAGE/components/drawer.md +256 -0
  25. package/AI_USAGE/components/dropdown-api.md +529 -0
  26. package/AI_USAGE/components/dropdown.md +392 -3
  27. package/AI_USAGE/components/empty-api.md +36 -0
  28. package/AI_USAGE/components/empty.md +227 -3
  29. package/AI_USAGE/components/finicon.md +88 -0
  30. package/AI_USAGE/components/form-api.md +524 -0
  31. package/AI_USAGE/components/form.md +454 -0
  32. package/AI_USAGE/components/grid-api.md +527 -0
  33. package/AI_USAGE/components/grid.md +224 -0
  34. package/AI_USAGE/components/heatmap-api.md +122 -0
  35. package/AI_USAGE/components/heatmap.md +220 -0
  36. package/AI_USAGE/components/icon-api.md +4707 -0
  37. package/AI_USAGE/components/icon.md +257 -0
  38. package/AI_USAGE/components/image-api.md +440 -0
  39. package/AI_USAGE/components/image.md +465 -0
  40. package/AI_USAGE/components/input-api.md +184 -0
  41. package/AI_USAGE/components/input-number-api.md +66 -0
  42. package/AI_USAGE/components/input-number.md +294 -0
  43. package/AI_USAGE/components/input-tag-api.md +114 -0
  44. package/AI_USAGE/components/input-tag.md +482 -0
  45. package/AI_USAGE/components/input.md +293 -3
  46. package/AI_USAGE/components/layout-api.md +147 -0
  47. package/AI_USAGE/components/layout.md +230 -0
  48. package/AI_USAGE/components/line-chart-api.md +197 -0
  49. package/AI_USAGE/components/line-chart.md +306 -3
  50. package/AI_USAGE/components/link-api.md +42 -0
  51. package/AI_USAGE/components/link.md +197 -0
  52. package/AI_USAGE/components/menu-api.md +516 -0
  53. package/AI_USAGE/components/menu.md +268 -0
  54. package/AI_USAGE/components/message-api.md +215 -0
  55. package/AI_USAGE/components/message-box-api.md +108 -0
  56. package/AI_USAGE/components/message-box.md +268 -3
  57. package/AI_USAGE/components/message.md +231 -3
  58. package/AI_USAGE/components/network-api.md +91 -0
  59. package/AI_USAGE/components/network.md +378 -0
  60. package/AI_USAGE/components/notification-api.md +236 -0
  61. package/AI_USAGE/components/notification.md +275 -3
  62. package/AI_USAGE/components/pagination-api.md +62 -0
  63. package/AI_USAGE/components/pagination.md +380 -3
  64. package/AI_USAGE/components/pie-chart-api.md +109 -0
  65. package/AI_USAGE/components/pie-chart.md +245 -3
  66. package/AI_USAGE/components/popconfirm-api.md +75 -0
  67. package/AI_USAGE/components/popconfirm.md +231 -3
  68. package/AI_USAGE/components/popover-api.md +75 -0
  69. package/AI_USAGE/components/popover.md +208 -3
  70. package/AI_USAGE/components/popup-api.md +75 -0
  71. package/AI_USAGE/components/popup.md +52 -0
  72. package/AI_USAGE/components/progress-api.md +44 -0
  73. package/AI_USAGE/components/progress.md +248 -3
  74. package/AI_USAGE/components/radio-api.md +165 -0
  75. package/AI_USAGE/components/radio.md +259 -3
  76. package/AI_USAGE/components/rate-api.md +54 -0
  77. package/AI_USAGE/components/rate.md +233 -3
  78. package/AI_USAGE/components/resize-box-api.md +56 -0
  79. package/AI_USAGE/components/resize-box.md +231 -0
  80. package/AI_USAGE/components/scrollbar-api.md +77 -0
  81. package/AI_USAGE/components/scrollbar.md +218 -0
  82. package/AI_USAGE/components/select-api.md +758 -0
  83. package/AI_USAGE/components/select.md +640 -3
  84. package/AI_USAGE/components/skeleton-api.md +85 -0
  85. package/AI_USAGE/components/skeleton.md +150 -0
  86. package/AI_USAGE/components/slider-api.md +51 -0
  87. package/AI_USAGE/components/slider.md +233 -3
  88. package/AI_USAGE/components/space-api.md +38 -0
  89. package/AI_USAGE/components/space.md +145 -0
  90. package/AI_USAGE/components/spin-api.md +43 -0
  91. package/AI_USAGE/components/spin.md +205 -0
  92. package/AI_USAGE/components/steps-api.md +111 -0
  93. package/AI_USAGE/components/steps.md +201 -3
  94. package/AI_USAGE/components/switch-api.md +58 -0
  95. package/AI_USAGE/components/switch.md +290 -3
  96. package/AI_USAGE/components/table-api.md +2919 -0
  97. package/AI_USAGE/components/table.md +1457 -0
  98. package/AI_USAGE/components/tabs-api.md +135 -0
  99. package/AI_USAGE/components/tabs.md +308 -3
  100. package/AI_USAGE/components/tag-api.md +124 -0
  101. package/AI_USAGE/components/tag.md +292 -0
  102. package/AI_USAGE/components/textarea-api.md +55 -0
  103. package/AI_USAGE/components/textarea.md +326 -3
  104. package/AI_USAGE/components/time-picker-api.md +137 -0
  105. package/AI_USAGE/components/time-picker.md +271 -3
  106. package/AI_USAGE/components/time-range-selector-api.md +44 -0
  107. package/AI_USAGE/components/time-range-selector.md +355 -0
  108. package/AI_USAGE/components/timeline-api.md +93 -0
  109. package/AI_USAGE/components/timeline.md +312 -0
  110. package/AI_USAGE/components/tooltip-api.md +77 -0
  111. package/AI_USAGE/components/tooltip.md +182 -0
  112. package/AI_USAGE/components/tree-select-api.md +498 -0
  113. package/AI_USAGE/components/tree-select.md +744 -0
  114. package/AI_USAGE/components/trend-chart-api.md +119 -0
  115. package/AI_USAGE/components/trend-chart.md +335 -0
  116. package/AI_USAGE/components/trigger-api.md +124 -0
  117. package/AI_USAGE/components/trigger.md +185 -0
  118. package/AI_USAGE/components/upload-api.md +200 -0
  119. package/AI_USAGE/components/upload.md +711 -3
  120. package/AI_USAGE/components/watermark-api.md +87 -0
  121. package/AI_USAGE/components/watermark.md +200 -0
  122. package/AI_USAGE/core.md +1 -1
  123. package/AI_USAGE/index.md +36 -7
  124. package/AI_USAGE/recipes/form-on-demand.md +1 -1
  125. package/AI_USAGE.md +34972 -5
  126. package/CHANGELOG.md +39 -0
  127. package/dist/_props/css.d.ts +2 -1
  128. package/dist/_utils/inherit-component-type.d.ts +11 -0
  129. package/dist/components/bar-chart/BarChart.d.ts +1 -1
  130. package/dist/components/bar-chart/index.d.ts +3 -3
  131. package/dist/components/date-picker/index.d.ts +420 -5
  132. package/dist/components/form-input/index.d.ts +617 -2
  133. package/dist/components/index.d.ts +1 -0
  134. package/dist/components/layout/index.d.ts +689 -1
  135. package/dist/components/line-chart/LineChart.d.ts +1 -1
  136. package/dist/components/line-chart/index.d.ts +3 -3
  137. package/dist/components/line-chart/interface.d.ts +2 -2
  138. package/dist/components/menu/index.d.ts +786 -1
  139. package/dist/components/tree-select/TreeNode.vue.d.ts +478 -0
  140. package/dist/components/tree-select/TreeSelect.d.ts +1549 -0
  141. package/dist/components/tree-select/TreeSelectDropdown.vue.d.ts +569 -0
  142. package/dist/components/tree-select/hooks/use-tree-select.d.ts +92 -0
  143. package/dist/components/tree-select/index.d.ts +3321 -0
  144. package/dist/components/tree-select/interface.d.ts +203 -0
  145. package/dist/components/tree-select/utils.d.ts +64 -0
  146. package/dist/es/_styles/palette-aliases.js +3 -0
  147. package/dist/es/_utils/inherit-component-type.js +6 -0
  148. package/dist/es/components/_components/feedback-icon/index.vue2.js +10 -10
  149. package/dist/es/components/button/Button.js +9 -9
  150. package/dist/es/components/date-picker/index.js +18 -17
  151. package/dist/es/components/drawer/src/Drawer.vue.js +6 -6
  152. package/dist/es/components/form-input/index.js +12 -11
  153. package/dist/es/components/form-switch/Switch.vue2.js +18 -18
  154. package/dist/es/components/image/Image.vue2.js +13 -13
  155. package/dist/es/components/image/ImagePreview.vue2.js +33 -33
  156. package/dist/es/components/index.js +55 -52
  157. package/dist/es/components/layout/index.js +10 -9
  158. package/dist/es/components/link/Link.vue2.js +12 -12
  159. package/dist/es/components/menu/hooks/use-level.js +5 -5
  160. package/dist/es/components/menu/index.js +13 -10
  161. package/dist/es/components/message/message.vue2.js +13 -13
  162. package/dist/es/components/spin/Spin.js +28 -28
  163. package/dist/es/components/tag/Tag.vue2.js +22 -22
  164. package/dist/es/components/timeline/src/Timeline.js +7 -7
  165. package/dist/es/components/tree-select/TreeNode.vue.js +91 -0
  166. package/dist/es/components/tree-select/TreeNode.vue2.js +162 -0
  167. package/dist/es/components/tree-select/TreeSelect.js +865 -0
  168. package/dist/es/components/tree-select/TreeSelectDropdown.vue.js +57 -0
  169. package/dist/es/components/tree-select/TreeSelectDropdown.vue2.js +79 -0
  170. package/dist/es/components/tree-select/hooks/use-tree-select.js +376 -0
  171. package/dist/es/components/tree-select/index.js +13 -0
  172. package/dist/es/components/tree-select/utils.js +181 -0
  173. package/dist/es/icons/animation/animation-loading.js +2 -2
  174. package/dist/es/index.js +71 -68
  175. package/dist/es/style.css +1 -1
  176. package/dist/index.cjs +3 -3
  177. package/dist/index.umd.js +3 -3
  178. package/dist/style/base.css +1 -1
  179. package/dist/style/dependencies.json +10 -0
  180. package/dist/style/drawer.css +1 -1
  181. package/dist/style/table.css +1 -1
  182. package/dist/style/tree-select.css +1 -0
  183. package/dist/style/tree-select.js +8 -0
  184. package/dist/style.css +1 -1
  185. package/dist/types.d.ts +2 -0
  186. package/package.json +11 -5
  187. package/volar.d.ts +2 -0
@@ -0,0 +1,88 @@
1
+ <!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
2
+ # Finicon AI 用法
3
+
4
+ 适用版本:x-next@1.15.0;来源指纹:`47ea153587c8d0b3bf318977b10bde9f8dd4acff90c5818541ba6513252ad362`。
5
+
6
+ 先读 [通用接入](../core.md)。本地组件文档导入的选型和配套资源用法。
7
+
8
+ ### 用途与选型
9
+
10
+ Finicon 是面向金融科技场景的图标库。x-next 将其接入为 `finicon:*` 命名空间,保持和通用 `<x-icon name="..." />` 一致的调用方式。来源见 [Finicon 官网](https://finicon.app/)。
11
+
12
+
13
+ ### 图标浏览器
14
+
15
+ ```vue
16
+ <script setup lang="ts">
17
+ import 'x-next/style.css';
18
+ import { Icon } from 'x-next';
19
+
20
+ import { registerFiniconIcons } from 'x-next';
21
+ registerFiniconIcons();
22
+ </script>
23
+ <template>
24
+ <Icon name="finicon:stock-chart-square-line-up" />
25
+ <Icon name="finicon:ticker-tsla" color="var(--x-color-primary-6)" />
26
+ <Icon name="finicon:region-cn" />
27
+ </template>
28
+ ```
29
+
30
+ ### 尺寸、颜色和描边
31
+
32
+ ```vue
33
+ <script setup lang="ts">
34
+ import 'x-next/style.css';
35
+ import { Icon } from 'x-next';
36
+
37
+ import { registerFiniconIcons } from 'x-next';
38
+ registerFiniconIcons();
39
+ </script>
40
+ <template>
41
+ <Icon name="finicon:trade-trending-up" :size="18" />
42
+ <Icon
43
+ name="finicon:trade-trending-up"
44
+ :size="26"
45
+ color="var(--x-color-success-6)"
46
+ />
47
+ <Icon
48
+ name="finicon:stock-chart-candlestick"
49
+ :size="32"
50
+ color="var(--x-color-danger-6)"
51
+ :stroke-width="1.5"
52
+ />
53
+ <Icon name="finicon:region-us" :size="32" />
54
+ </template>
55
+ ```
56
+
57
+ ### 业务组合
58
+
59
+ ```vue
60
+ <script setup lang="ts">
61
+ import 'x-next/style.css';
62
+ import { Button, Icon, Tag } from 'x-next';
63
+
64
+ import { registerFiniconIcons } from 'x-next';
65
+ registerFiniconIcons();
66
+ </script>
67
+ <template>
68
+ <Button type="primary">
69
+ <template #icon>
70
+ <Icon name="finicon:trade-buy" :stroke-width="2.6" />
71
+ </template>
72
+ 买入
73
+ </Button>
74
+
75
+ <Tag color="green">
76
+ <Icon name="finicon:fund-piggy-bank" :stroke-width="2.6" />
77
+ 基金
78
+ </Tag>
79
+ </template>
80
+ ```
81
+
82
+ ### 来源与授权
83
+
84
+ Finicon 图标来自 [`finicon@1.0.12`](https://www.npmjs.com/package/finicon),官方站点是 [https://finicon.app/](https://finicon.app/)。x-next 保留 `finicon:` 前缀,便于区分金融图标来源。
85
+
86
+
87
+
88
+ 返回 [AI 索引](../index.md)。
@@ -0,0 +1,524 @@
1
+ <!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
2
+ # Form 完整公开 API
3
+
4
+ 适用版本:x-next@1.15.0;来源指纹:`47ea153587c8d0b3bf318977b10bde9f8dd4acff90c5818541ba6513252ad362`。
5
+
6
+ 从同版本构建的公开声明、运行时 props/emits 和显式 expose 生成。运行时导入始终使用 `x-next`,声明路径仅作定位。插槽类型未细化时,具体槽名与作用域见本地用法示例。
7
+
8
+ ## Form API
9
+
10
+ 公开声明:`dist/components/form/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
11
+
12
+ ### Props
13
+
14
+ | 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
15
+ | --- | --- | --- | --- | --- |
16
+ | model | 表单数据对象 | { [x: string]: any; } | 是 | 未声明 |
17
+ | layout | 表单布局 | undefined &#124; "horizontal" &#124; "vertical" &#124; "inline" | 否 | "horizontal" |
18
+ | size | 表单控件尺寸 | undefined &#124; "mini" &#124; "small" &#124; "medium" &#124; "large" | 否 | 未声明 |
19
+ | labelColProps | 标签栅格配置 | undefined &#124; { [x: string]: any; } | 否 | 工厂函数(每个实例初始化;有效值见行为说明) |
20
+ | wrapperColProps | 控件栅格配置 | undefined &#124; { [x: string]: any; } | 否 | 工厂函数(每个实例初始化;有效值见行为说明) |
21
+ | labelColStyle | 标签列样式 | undefined &#124; { [x: string]: any; } | 否 | 未声明 |
22
+ | wrapperColStyle | 控件列样式 | undefined &#124; { [x: string]: any; } | 否 | 未声明 |
23
+ | labelAlign | 标签对齐方式 | undefined &#124; "right" &#124; "left" | 否 | "right" |
24
+ | disabled | 是否禁用整个表单 | undefined &#124; false &#124; true | 否 | undefined |
25
+ | rules | 表单校验规则 | undefined &#124; { [x: string]: FieldRule<any> &#124; FieldRule<any>[]; } | 否 | 未声明 |
26
+ | autoLabelWidth | 自动计算标签宽度,仅水平布局生效 | undefined &#124; false &#124; true | 否 | false |
27
+ | id | 表单 id 属性和表单控件 id 前缀 | undefined &#124; string | 否 | 未声明 |
28
+ | scrollToFirstError | 校验失败后滚动到第一个错误字段,可传滚动配置 | undefined &#124; false &#124; true &#124; StandardBehaviorOptions &#124; CustomBehaviorOptions<unknown> | 否 | false |
29
+
30
+ ### Events
31
+
32
+ | 事件 | 用途 | 监听器签名(即事件参数) |
33
+ | --- | --- | --- |
34
+ | submit | 表单提交时触发 | undefined &#124; (data: { values: Record<string, any>; errors: Record<string, ValidatedError> &#124; undefined; }, ev: Event) => any |
35
+ | submitSuccess | 校验成功时触发 | undefined &#124; (values: Record<string, any>, ev: Event) => any |
36
+ | submitFailed | 校验失败时触发 | undefined &#124; (data: { values: Record<string, any>; errors: Record<string, ValidatedError>; }, ev: Event) => any |
37
+
38
+ ### Slots
39
+
40
+ 公开类型未逐项声明插槽;本页场景说明列出实际使用的插槽,不将任意插槽视为已支持。
41
+
42
+ ### 实例方法 / 暴露值
43
+
44
+ | 名称 | 公开类型 |
45
+ | --- | --- |
46
+ | validate | (callback?: (errors: undefined &#124; Record<string, ValidatedError>) => void) => Promise<undefined &#124; Record<string, ValidatedError>> |
47
+ | validateField | (field: string &#124; string[], callback?: (errors: undefined &#124; Record<string, ValidatedError>) => void) => Promise<undefined &#124; Record<string, ValidatedError>> |
48
+ | resetFields | (field?: string &#124; string[]) => void |
49
+ | clearValidate | (field?: string &#124; string[]) => void |
50
+ | setFields | (data: Record<string, FieldData>) => void |
51
+ | scrollToField | (field: string, options?: Options<unknown>) => void |
52
+
53
+ ### 关联类型定义
54
+
55
+ 以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
56
+
57
+ ```typescript-reference
58
+ declare const VALIDATE_STATUSES: readonly ["success", "warning", "error", "validating"];
59
+
60
+ type ValidateStatus = (typeof VALIDATE_STATUSES)[number];
61
+
62
+ declare const VALIDATE_TRIGGERS: readonly ["change", "input", "focus", "blur"];
63
+
64
+ type ValidateTrigger = (typeof VALIDATE_TRIGGERS)[number];
65
+
66
+ interface FormInstance {
67
+ validate: (callback?: (errors: undefined | Record<string, ValidatedError>) => void) => Promise<undefined | Record<string, ValidatedError>>;
68
+ validateField: (field: string | string[], callback?: (errors: undefined | Record<string, ValidatedError>) => void) => Promise<undefined | Record<string, ValidatedError>>;
69
+ resetFields: (field?: string | string[]) => void;
70
+ clearValidate: (field?: string | string[]) => void;
71
+ setFields: (data: Record<string, FieldData>) => void;
72
+ scrollToField: (field: string, options?: ScrollIntoViewOptions) => void;
73
+ }
74
+
75
+ interface FieldRule<FieldValue = any> {
76
+ /**
77
+ * @zh 校验的值的类型,默认为 `'string'`
78
+ * @en The type of the value to be checked, the default is `'string'`
79
+ */
80
+ type?: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'email' | 'url' | 'ip';
81
+ /**
82
+ * @zh 是否必填
83
+ * @en Is it required
84
+ */
85
+ required?: boolean;
86
+ /**
87
+ * @zh 校验失败时展示的信息
88
+ * @en Information displayed when verification fails
89
+ */
90
+ message?: string;
91
+ /**
92
+ * @zh 校验长度(string, array)
93
+ * @en Check length (string, array)
94
+ */
95
+ length?: number;
96
+ /**
97
+ * @zh 最大长度(string)
98
+ * @en Maximum length (string)
99
+ */
100
+ maxLength?: number;
101
+ /**
102
+ * @zh 最小长度(string)
103
+ * @en Minimum length (string)
104
+ */
105
+ minLength?: number;
106
+ /**
107
+ * @zh 匹配校验(string)
108
+ * @en Match check (string)
109
+ */
110
+ match?: RegExp;
111
+ /**
112
+ * @zh 大写(string)
113
+ * @en Uppercase (string)
114
+ */
115
+ uppercase?: boolean;
116
+ /**
117
+ * @zh 小写(string)
118
+ * @en Lowercase (string)
119
+ */
120
+ lowercase?: boolean;
121
+ /**
122
+ * @zh 最小值(number)
123
+ * @en Minimum (number)
124
+ */
125
+ min?: number;
126
+ /**
127
+ * @zh 最大值(number)
128
+ * @en Maximum (number)
129
+ */
130
+ max?: number;
131
+ /**
132
+ * @zh 校验数值(number)
133
+ * @en Check value (number)
134
+ */
135
+ equal?: number;
136
+ /**
137
+ * @zh 正数(number)
138
+ * @en Positive number (number)
139
+ */
140
+ positive?: boolean;
141
+ /**
142
+ * @zh 负数(number)
143
+ * @en Negative number (number)
144
+ */
145
+ negative?: boolean;
146
+ /**
147
+ * @zh 是否为 `true`(boolean)
148
+ * @en Whether it is `true` (boolean)
149
+ */
150
+ true?: boolean;
151
+ /**
152
+ * @zh 是否为 `false`(boolean)
153
+ * @en Whether it is `false` (boolean)
154
+ */
155
+ false?: boolean;
156
+ /**
157
+ * @zh 数组中是否包含给定值(array)
158
+ * @en Does the array contain the given value (array)
159
+ */
160
+ includes?: any[];
161
+ /**
162
+ * @zh 数组元素是否相等(array)
163
+ * @en Are array elements equal (array)
164
+ */
165
+ deepEqual?: any;
166
+ /**
167
+ * @zh 是否为空(object)
168
+ * @en Is it empty (object)
169
+ */
170
+ empty?: boolean;
171
+ /**
172
+ * @zh 对象是否包含给定属性(object)
173
+ * @en Does the object contain the given attribute (object)
174
+ */
175
+ hasKeys?: string[];
176
+ /**
177
+ * @zh 自定义校验规则
178
+ * @en Custom verification rules
179
+ * @param value
180
+ * @param callback 通过 callback(message) 添加错误;异步校验返回 Promise 并在完成后 resolve
181
+ */
182
+ validator?: (value: FieldValue | undefined, callback: (error?: string) => void) => void | Promise<void>;
183
+ }
184
+
185
+ interface FieldData {
186
+ /**
187
+ * @zh 字段的值
188
+ * @en Field value
189
+ */
190
+ value?: any;
191
+ /**
192
+ * @zh 字段的状态
193
+ * @en Field status
194
+ */
195
+ status?: ValidateStatus;
196
+ /**
197
+ * @zh 字段的错误信息
198
+ * @en Field error message
199
+ */
200
+ message?: string;
201
+ }
202
+
203
+ interface ValidatedError {
204
+ /**
205
+ * @zh 标签的文本
206
+ * @en Label text
207
+ * @version 2.18.0
208
+ */
209
+ label: string;
210
+ /**
211
+ * @zh 字段名
212
+ * @en Field name
213
+ */
214
+ field: string;
215
+ /**
216
+ * @zh 字段值
217
+ * @en Field value
218
+ */
219
+ value: any;
220
+ /**
221
+ * @zh 字段类型
222
+ * @en Field Type
223
+ */
224
+ type: string;
225
+ /**
226
+ * @zh 是否为 `required` 错误
227
+ * @en Is it a `required` error
228
+ */
229
+ isRequiredError: boolean;
230
+ /**
231
+ * @zh 错误信息
232
+ * @en Error message
233
+ */
234
+ message: string;
235
+ }
236
+
237
+ interface FormItemEventHandler {
238
+ /**
239
+ * @zh onChange
240
+ * @en onChange
241
+ */
242
+ onChange?: (ev?: Event) => void;
243
+ /**
244
+ * @zh onInput
245
+ * @en onInput
246
+ */
247
+ onInput?: (ev?: Event) => void;
248
+ /**
249
+ * @zh onFocus
250
+ * @en onFocus
251
+ */
252
+ onFocus?: (ev?: Event) => void;
253
+ /**
254
+ * @zh onBlur
255
+ * @en onBlur
256
+ */
257
+ onBlur?: (ev?: Event) => void;
258
+ }
259
+ ```
260
+
261
+
262
+ ## FormItem API
263
+
264
+ 公开声明:`dist/components/form/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
265
+
266
+ ### Props
267
+
268
+ | 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
269
+ | --- | --- | --- | --- | --- |
270
+ | field | 字段路径 | undefined &#124; string | 否 | "" |
271
+ | label | 标签文本 | undefined &#124; string | 否 | 未声明 |
272
+ | tooltip | 标签提示 | undefined &#124; string | 否 | 未声明 |
273
+ | showColon | 是否显示冒号 | undefined &#124; false &#124; true | 否 | false |
274
+ | noStyle | 是否去除布局样式 | undefined &#124; false &#124; true | 否 | false |
275
+ | disabled | 是否禁用当前项 | undefined &#124; false &#124; true | 否 | undefined |
276
+ | help | 帮助文案 | undefined &#124; string | 否 | 未声明 |
277
+ | extra | 额外文案 | undefined &#124; string | 否 | 未声明 |
278
+ | required | 是否必填 | undefined &#124; false &#124; true | 否 | false |
279
+ | asteriskPosition | 星号位置 | undefined &#124; string | 否 | "start" |
280
+ | rules | 当前项校验规则 | undefined &#124; FieldRule<any> &#124; FieldRule<any>[] | 否 | 未声明 |
281
+ | validateStatus | 手动指定校验状态 | undefined &#124; "success" &#124; "warning" &#124; "error" &#124; "validating" | 否 | 未声明 |
282
+ | validateTrigger | 触发校验的事件 | undefined &#124; "focus" &#124; "blur" &#124; "input" &#124; "change" &#124; ("focus" &#124; "blur" &#124; "input" &#124; "change")[] | 否 | "change" |
283
+ | labelColProps | 当前项标签列配置 | undefined &#124; { [x: string]: any; } | 否 | 未声明 |
284
+ | wrapperColProps | 当前项控件列配置 | undefined &#124; { [x: string]: any; } | 否 | 未声明 |
285
+ | hideLabel | 是否隐藏标签 | undefined &#124; false &#124; true | 否 | false |
286
+ | hideAsterisk | 是否隐藏星号 | undefined &#124; false &#124; true | 否 | false |
287
+ | labelColStyle | 标签列样式 | undefined &#124; { [x: string]: any; } | 否 | 未声明 |
288
+ | wrapperColStyle | 控件列样式 | undefined &#124; { [x: string]: any; } | 否 | 未声明 |
289
+ | rowProps | 当前项 Row 配置 | undefined &#124; { [x: string]: any; } | 否 | 未声明 |
290
+ | rowClass | 当前项 Row class | undefined &#124; string &#124; { [x: string]: any; } &#124; unknown[] | 否 | 未声明 |
291
+ | contentClass | 控件包裹层 class | undefined &#124; string &#124; { [x: string]: any; } &#124; unknown[] | 否 | 未声明 |
292
+ | contentFlex | 内容层是否启用 flex | undefined &#124; false &#124; true | 否 | true |
293
+ | labelColFlex | 标签列 flex 宽度 | undefined &#124; string &#124; number | 否 | 未声明 |
294
+ | feedback | 是否显示反馈图标 | undefined &#124; false &#124; true | 否 | false |
295
+ | labelComponent | 标签渲染元素 | undefined &#124; string | 否 | "label" |
296
+ | labelAttrs | 标签元素属性 | undefined &#124; { [x: string]: any; } | 否 | 未声明 |
297
+
298
+ ### Events
299
+
300
+ 未声明组件 emits;原生事件与包装透传按本页用法核实。
301
+
302
+ ### Slots
303
+
304
+ | 名称 | 用途 | 公开类型 |
305
+ | --- | --- | --- |
306
+ | default | 表单控件内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
307
+ | label | 自定义标签 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
308
+ | help | 自定义帮助信息 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
309
+ | extra | 自定义额外内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
310
+
311
+ ### 实例方法
312
+
313
+ 没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
314
+
315
+ ### 关联类型定义
316
+
317
+ 以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
318
+
319
+ ```typescript-reference
320
+ declare const VALIDATE_STATUSES: readonly ["success", "warning", "error", "validating"];
321
+
322
+ type ValidateStatus = (typeof VALIDATE_STATUSES)[number];
323
+
324
+ declare const VALIDATE_TRIGGERS: readonly ["change", "input", "focus", "blur"];
325
+
326
+ type ValidateTrigger = (typeof VALIDATE_TRIGGERS)[number];
327
+
328
+ interface FormInstance {
329
+ validate: (callback?: (errors: undefined | Record<string, ValidatedError>) => void) => Promise<undefined | Record<string, ValidatedError>>;
330
+ validateField: (field: string | string[], callback?: (errors: undefined | Record<string, ValidatedError>) => void) => Promise<undefined | Record<string, ValidatedError>>;
331
+ resetFields: (field?: string | string[]) => void;
332
+ clearValidate: (field?: string | string[]) => void;
333
+ setFields: (data: Record<string, FieldData>) => void;
334
+ scrollToField: (field: string, options?: ScrollIntoViewOptions) => void;
335
+ }
336
+
337
+ interface FieldRule<FieldValue = any> {
338
+ /**
339
+ * @zh 校验的值的类型,默认为 `'string'`
340
+ * @en The type of the value to be checked, the default is `'string'`
341
+ */
342
+ type?: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'email' | 'url' | 'ip';
343
+ /**
344
+ * @zh 是否必填
345
+ * @en Is it required
346
+ */
347
+ required?: boolean;
348
+ /**
349
+ * @zh 校验失败时展示的信息
350
+ * @en Information displayed when verification fails
351
+ */
352
+ message?: string;
353
+ /**
354
+ * @zh 校验长度(string, array)
355
+ * @en Check length (string, array)
356
+ */
357
+ length?: number;
358
+ /**
359
+ * @zh 最大长度(string)
360
+ * @en Maximum length (string)
361
+ */
362
+ maxLength?: number;
363
+ /**
364
+ * @zh 最小长度(string)
365
+ * @en Minimum length (string)
366
+ */
367
+ minLength?: number;
368
+ /**
369
+ * @zh 匹配校验(string)
370
+ * @en Match check (string)
371
+ */
372
+ match?: RegExp;
373
+ /**
374
+ * @zh 大写(string)
375
+ * @en Uppercase (string)
376
+ */
377
+ uppercase?: boolean;
378
+ /**
379
+ * @zh 小写(string)
380
+ * @en Lowercase (string)
381
+ */
382
+ lowercase?: boolean;
383
+ /**
384
+ * @zh 最小值(number)
385
+ * @en Minimum (number)
386
+ */
387
+ min?: number;
388
+ /**
389
+ * @zh 最大值(number)
390
+ * @en Maximum (number)
391
+ */
392
+ max?: number;
393
+ /**
394
+ * @zh 校验数值(number)
395
+ * @en Check value (number)
396
+ */
397
+ equal?: number;
398
+ /**
399
+ * @zh 正数(number)
400
+ * @en Positive number (number)
401
+ */
402
+ positive?: boolean;
403
+ /**
404
+ * @zh 负数(number)
405
+ * @en Negative number (number)
406
+ */
407
+ negative?: boolean;
408
+ /**
409
+ * @zh 是否为 `true`(boolean)
410
+ * @en Whether it is `true` (boolean)
411
+ */
412
+ true?: boolean;
413
+ /**
414
+ * @zh 是否为 `false`(boolean)
415
+ * @en Whether it is `false` (boolean)
416
+ */
417
+ false?: boolean;
418
+ /**
419
+ * @zh 数组中是否包含给定值(array)
420
+ * @en Does the array contain the given value (array)
421
+ */
422
+ includes?: any[];
423
+ /**
424
+ * @zh 数组元素是否相等(array)
425
+ * @en Are array elements equal (array)
426
+ */
427
+ deepEqual?: any;
428
+ /**
429
+ * @zh 是否为空(object)
430
+ * @en Is it empty (object)
431
+ */
432
+ empty?: boolean;
433
+ /**
434
+ * @zh 对象是否包含给定属性(object)
435
+ * @en Does the object contain the given attribute (object)
436
+ */
437
+ hasKeys?: string[];
438
+ /**
439
+ * @zh 自定义校验规则
440
+ * @en Custom verification rules
441
+ * @param value
442
+ * @param callback 通过 callback(message) 添加错误;异步校验返回 Promise 并在完成后 resolve
443
+ */
444
+ validator?: (value: FieldValue | undefined, callback: (error?: string) => void) => void | Promise<void>;
445
+ }
446
+
447
+ interface FieldData {
448
+ /**
449
+ * @zh 字段的值
450
+ * @en Field value
451
+ */
452
+ value?: any;
453
+ /**
454
+ * @zh 字段的状态
455
+ * @en Field status
456
+ */
457
+ status?: ValidateStatus;
458
+ /**
459
+ * @zh 字段的错误信息
460
+ * @en Field error message
461
+ */
462
+ message?: string;
463
+ }
464
+
465
+ interface ValidatedError {
466
+ /**
467
+ * @zh 标签的文本
468
+ * @en Label text
469
+ * @version 2.18.0
470
+ */
471
+ label: string;
472
+ /**
473
+ * @zh 字段名
474
+ * @en Field name
475
+ */
476
+ field: string;
477
+ /**
478
+ * @zh 字段值
479
+ * @en Field value
480
+ */
481
+ value: any;
482
+ /**
483
+ * @zh 字段类型
484
+ * @en Field Type
485
+ */
486
+ type: string;
487
+ /**
488
+ * @zh 是否为 `required` 错误
489
+ * @en Is it a `required` error
490
+ */
491
+ isRequiredError: boolean;
492
+ /**
493
+ * @zh 错误信息
494
+ * @en Error message
495
+ */
496
+ message: string;
497
+ }
498
+
499
+ interface FormItemEventHandler {
500
+ /**
501
+ * @zh onChange
502
+ * @en onChange
503
+ */
504
+ onChange?: (ev?: Event) => void;
505
+ /**
506
+ * @zh onInput
507
+ * @en onInput
508
+ */
509
+ onInput?: (ev?: Event) => void;
510
+ /**
511
+ * @zh onFocus
512
+ * @en onFocus
513
+ */
514
+ onFocus?: (ev?: Event) => void;
515
+ /**
516
+ * @zh onBlur
517
+ * @en onBlur
518
+ */
519
+ onBlur?: (ev?: Event) => void;
520
+ }
521
+ ```
522
+
523
+
524
+ 返回 [Form 用法](./form.md)。