vxe-table 4.1.20 → 4.2.0-beta.2

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 (324) hide show
  1. package/README.en.md +2 -4
  2. package/README.md +2 -3
  3. package/README.zh-TW.md +2 -4
  4. package/es/button/index.js +1 -1
  5. package/es/checkbox/index.js +1 -1
  6. package/es/checkbox-group/index.js +1 -1
  7. package/es/colgroup/index.js +3 -2
  8. package/es/column/index.js +3 -2
  9. package/es/edit/src/hook.js +2 -1
  10. package/es/export/index.js +2 -2
  11. package/es/export/src/hook.js +2 -1
  12. package/es/export/src/util.js +3 -5
  13. package/es/filter/index.js +1 -1
  14. package/es/filter/src/hook.js +17 -10
  15. package/es/footer/index.js +1 -1
  16. package/es/footer/src/footer.js +3 -2
  17. package/es/form/index.js +1 -1
  18. package/es/form/src/form-gather.js +3 -3
  19. package/es/form/src/form-item.js +4 -4
  20. package/es/form/src/form.js +36 -43
  21. package/es/form/src/render.js +15 -10
  22. package/es/form/src/util.js +6 -0
  23. package/es/form-gather/index.js +1 -1
  24. package/es/form-item/index.js +1 -1
  25. package/es/grid/index.js +1 -1
  26. package/es/grid/src/grid.js +2 -1
  27. package/es/header/index.js +1 -1
  28. package/es/header/src/header.js +1 -1
  29. package/es/input/index.js +1 -1
  30. package/es/input/src/date.js +41 -0
  31. package/es/input/src/input.js +4 -51
  32. package/es/input/src/number.js +10 -0
  33. package/es/list/index.js +1 -1
  34. package/es/menu/index.js +1 -1
  35. package/es/modal/index.js +1 -1
  36. package/es/modal/src/modal.js +2 -1
  37. package/es/optgroup/index.js +1 -1
  38. package/es/option/index.js +1 -1
  39. package/es/pager/index.js +1 -1
  40. package/es/pager/src/pager.js +13 -2
  41. package/es/pulldown/index.js +1 -1
  42. package/es/radio/index.js +1 -1
  43. package/es/radio-button/index.js +1 -1
  44. package/es/radio-group/index.js +1 -1
  45. package/es/select/index.js +1 -1
  46. package/es/select/style.css +1 -1
  47. package/es/style.css +1 -1
  48. package/es/style.min.css +1 -1
  49. package/es/switch/index.js +1 -1
  50. package/es/table/index.js +1 -1
  51. package/es/table/src/body.js +32 -11
  52. package/es/table/src/cell.js +3 -3
  53. package/es/table/src/column.js +3 -1
  54. package/es/table/src/columnInfo.js +5 -4
  55. package/es/table/src/emits.js +5 -1
  56. package/es/table/src/props.js +5 -2
  57. package/es/table/src/table.js +120 -86
  58. package/es/table/src/util.js +5 -3
  59. package/es/textarea/index.js +1 -1
  60. package/es/toolbar/index.js +1 -1
  61. package/es/toolbar/src/toolbar.js +2 -1
  62. package/es/tools/dom.js +9 -0
  63. package/es/tools/log.js +13 -0
  64. package/es/tools/utils.js +0 -12
  65. package/es/tooltip/index.js +1 -1
  66. package/es/tooltip/src/tooltip.js +85 -45
  67. package/es/tooltip/style.css +1 -1
  68. package/es/v-x-e-table/index.js +1 -0
  69. package/es/v-x-e-table/src/conf.js +12 -7
  70. package/es/v-x-e-table/src/interceptor.js +1 -1
  71. package/es/v-x-e-table/src/renderer.js +2 -1
  72. package/es/v-x-e-table/src/store.js +1 -1
  73. package/helper/vetur/attributes.json +31 -11
  74. package/helper/vetur/tags.json +8 -3
  75. package/lib/button/index.js +3 -2
  76. package/lib/button/index.min.js +1 -1
  77. package/lib/checkbox/index.js +3 -2
  78. package/lib/checkbox/index.min.js +1 -1
  79. package/lib/checkbox-group/index.js +3 -2
  80. package/lib/checkbox-group/index.min.js +1 -1
  81. package/lib/colgroup/index.js +6 -4
  82. package/lib/colgroup/index.min.js +1 -1
  83. package/lib/column/index.js +6 -4
  84. package/lib/column/index.min.js +1 -1
  85. package/lib/edit/src/hook.js +7 -5
  86. package/lib/edit/src/hook.min.js +1 -1
  87. package/lib/export/index.js +5 -4
  88. package/lib/export/index.min.js +1 -1
  89. package/lib/export/src/hook.js +14 -12
  90. package/lib/export/src/hook.min.js +1 -1
  91. package/lib/export/src/util.js +7 -9
  92. package/lib/export/src/util.min.js +1 -1
  93. package/lib/filter/index.js +3 -2
  94. package/lib/filter/index.min.js +1 -1
  95. package/lib/filter/src/hook.js +24 -13
  96. package/lib/filter/src/hook.min.js +1 -1
  97. package/lib/footer/index.js +3 -2
  98. package/lib/footer/index.min.js +1 -1
  99. package/lib/footer/src/footer.js +7 -3
  100. package/lib/footer/src/footer.min.js +1 -1
  101. package/lib/form/index.js +3 -2
  102. package/lib/form/index.min.js +1 -1
  103. package/lib/form/src/form-gather.js +3 -3
  104. package/lib/form/src/form-gather.min.js +1 -1
  105. package/lib/form/src/form-item.js +3 -3
  106. package/lib/form/src/form-item.min.js +1 -1
  107. package/lib/form/src/form.js +45 -58
  108. package/lib/form/src/form.min.js +1 -1
  109. package/lib/form/src/render.js +24 -10
  110. package/lib/form/src/render.min.js +1 -1
  111. package/lib/form/src/util.js +11 -0
  112. package/lib/form/src/util.min.js +1 -1
  113. package/lib/form-gather/index.js +3 -2
  114. package/lib/form-gather/index.min.js +1 -1
  115. package/lib/form-item/index.js +3 -2
  116. package/lib/form-item/index.min.js +1 -1
  117. package/lib/grid/index.js +3 -2
  118. package/lib/grid/index.min.js +1 -1
  119. package/lib/grid/src/grid.js +16 -14
  120. package/lib/grid/src/grid.min.js +1 -1
  121. package/lib/header/index.js +3 -2
  122. package/lib/header/index.min.js +1 -1
  123. package/lib/header/src/header.js +1 -1
  124. package/lib/header/src/header.min.js +1 -1
  125. package/lib/index.umd.js +584 -415
  126. package/lib/index.umd.min.js +1 -2
  127. package/lib/input/index.js +3 -2
  128. package/lib/input/index.min.js +1 -1
  129. package/lib/input/src/date.js +56 -0
  130. package/lib/input/src/date.min.js +1 -0
  131. package/lib/input/src/input.js +13 -67
  132. package/lib/input/src/input.min.js +1 -1
  133. package/lib/input/src/number.js +23 -0
  134. package/lib/input/src/number.min.js +1 -0
  135. package/lib/list/index.js +3 -2
  136. package/lib/list/index.min.js +1 -1
  137. package/lib/menu/index.js +3 -2
  138. package/lib/menu/index.min.js +1 -1
  139. package/lib/modal/index.js +3 -2
  140. package/lib/modal/index.min.js +1 -1
  141. package/lib/modal/src/modal.js +3 -1
  142. package/lib/modal/src/modal.min.js +1 -1
  143. package/lib/optgroup/index.js +3 -2
  144. package/lib/optgroup/index.min.js +1 -1
  145. package/lib/option/index.js +3 -2
  146. package/lib/option/index.min.js +1 -1
  147. package/lib/pager/index.js +3 -2
  148. package/lib/pager/index.min.js +1 -1
  149. package/lib/pager/src/pager.js +15 -1
  150. package/lib/pager/src/pager.min.js +1 -1
  151. package/lib/pulldown/index.js +3 -2
  152. package/lib/pulldown/index.min.js +1 -1
  153. package/lib/radio/index.js +3 -2
  154. package/lib/radio/index.min.js +1 -1
  155. package/lib/radio-button/index.js +3 -2
  156. package/lib/radio-button/index.min.js +1 -1
  157. package/lib/radio-group/index.js +3 -2
  158. package/lib/radio-group/index.min.js +1 -1
  159. package/lib/select/index.js +3 -2
  160. package/lib/select/index.min.js +1 -1
  161. package/lib/select/style/style.css +1 -1
  162. package/lib/select/style/style.min.css +1 -1
  163. package/lib/style.css +1 -1
  164. package/lib/style.min.css +1 -1
  165. package/lib/switch/index.js +3 -2
  166. package/lib/switch/index.min.js +1 -1
  167. package/lib/table/index.js +3 -2
  168. package/lib/table/index.min.js +1 -1
  169. package/lib/table/src/body.js +32 -11
  170. package/lib/table/src/body.min.js +1 -1
  171. package/lib/table/src/cell.js +3 -3
  172. package/lib/table/src/cell.min.js +1 -1
  173. package/lib/table/src/column.js +3 -1
  174. package/lib/table/src/column.min.js +1 -1
  175. package/lib/table/src/columnInfo.js +13 -9
  176. package/lib/table/src/columnInfo.min.js +1 -1
  177. package/lib/table/src/emits.js +1 -1
  178. package/lib/table/src/emits.min.js +1 -1
  179. package/lib/table/src/props.js +5 -2
  180. package/lib/table/src/table.js +187 -148
  181. package/lib/table/src/table.min.js +1 -1
  182. package/lib/table/src/util.js +5 -3
  183. package/lib/table/src/util.min.js +1 -1
  184. package/lib/textarea/index.js +3 -2
  185. package/lib/textarea/index.min.js +1 -1
  186. package/lib/toolbar/index.js +3 -2
  187. package/lib/toolbar/index.min.js +1 -1
  188. package/lib/toolbar/src/toolbar.js +4 -2
  189. package/lib/toolbar/src/toolbar.min.js +1 -1
  190. package/lib/tools/dom.js +12 -1
  191. package/lib/tools/dom.min.js +1 -1
  192. package/lib/tools/log.js +29 -0
  193. package/lib/tools/log.min.js +1 -0
  194. package/lib/tools/utils.js +0 -20
  195. package/lib/tools/utils.min.js +1 -1
  196. package/lib/tooltip/index.js +3 -3
  197. package/lib/tooltip/index.min.js +1 -1
  198. package/lib/tooltip/src/tooltip.js +114 -60
  199. package/lib/tooltip/src/tooltip.min.js +1 -1
  200. package/lib/tooltip/style/style.css +1 -1
  201. package/lib/tooltip/style/style.min.css +1 -1
  202. package/lib/v-x-e-table/index.js +1 -0
  203. package/lib/v-x-e-table/index.min.js +1 -1
  204. package/lib/v-x-e-table/src/conf.js +12 -7
  205. package/lib/v-x-e-table/src/conf.min.js +1 -1
  206. package/lib/v-x-e-table/src/interceptor.js +3 -3
  207. package/lib/v-x-e-table/src/interceptor.min.js +1 -1
  208. package/lib/v-x-e-table/src/renderer.js +3 -1
  209. package/lib/v-x-e-table/src/renderer.min.js +1 -1
  210. package/lib/v-x-e-table/src/store.js +2 -2
  211. package/lib/v-x-e-table/src/store.min.js +1 -1
  212. package/package.json +4 -4
  213. package/packages/button/index.ts +2 -1
  214. package/packages/checkbox/index.ts +2 -1
  215. package/packages/checkbox-group/index.ts +2 -1
  216. package/packages/colgroup/index.ts +4 -2
  217. package/packages/column/index.ts +4 -2
  218. package/packages/edit/src/hook.ts +2 -1
  219. package/packages/export/index.ts +3 -2
  220. package/packages/export/src/hook.ts +2 -1
  221. package/packages/export/src/util.ts +4 -6
  222. package/packages/filter/index.ts +2 -1
  223. package/packages/filter/src/hook.ts +17 -10
  224. package/packages/footer/index.ts +2 -1
  225. package/packages/footer/src/footer.ts +3 -2
  226. package/packages/form/index.ts +2 -1
  227. package/packages/form/src/form-gather.ts +3 -3
  228. package/packages/form/src/form-item.ts +4 -4
  229. package/packages/form/src/form.ts +38 -46
  230. package/packages/form/src/render.ts +8 -6
  231. package/packages/form/src/util.ts +8 -1
  232. package/packages/form-gather/index.ts +2 -1
  233. package/packages/form-item/index.ts +2 -1
  234. package/packages/grid/index.ts +2 -1
  235. package/packages/grid/src/grid.ts +2 -1
  236. package/packages/header/index.ts +2 -1
  237. package/packages/header/src/header.ts +1 -1
  238. package/packages/input/index.ts +2 -1
  239. package/packages/input/src/date.ts +42 -0
  240. package/packages/input/src/input.ts +3 -51
  241. package/packages/input/src/number.ts +12 -0
  242. package/packages/list/index.ts +2 -1
  243. package/packages/menu/index.ts +2 -1
  244. package/packages/modal/index.ts +2 -1
  245. package/packages/modal/src/modal.ts +2 -1
  246. package/packages/optgroup/index.ts +2 -1
  247. package/packages/option/index.ts +2 -1
  248. package/packages/pager/index.ts +2 -1
  249. package/packages/pager/src/pager.ts +17 -3
  250. package/packages/pulldown/index.ts +2 -1
  251. package/packages/radio/index.ts +2 -1
  252. package/packages/radio-button/index.ts +2 -1
  253. package/packages/radio-group/index.ts +2 -1
  254. package/packages/select/index.ts +2 -1
  255. package/packages/switch/index.ts +2 -1
  256. package/packages/table/index.ts +2 -1
  257. package/packages/table/src/body.ts +33 -12
  258. package/packages/table/src/cell.ts +3 -3
  259. package/packages/table/src/column.ts +3 -1
  260. package/packages/table/src/columnInfo.ts +5 -3
  261. package/packages/table/src/emits.ts +5 -1
  262. package/packages/table/src/props.ts +5 -2
  263. package/packages/table/src/table.ts +120 -84
  264. package/packages/table/src/util.ts +5 -3
  265. package/packages/textarea/index.ts +2 -1
  266. package/packages/toolbar/index.ts +2 -1
  267. package/packages/toolbar/src/toolbar.ts +2 -1
  268. package/packages/tools/dom.ts +11 -0
  269. package/packages/tools/log.ts +16 -0
  270. package/packages/tools/utils.ts +0 -15
  271. package/packages/tooltip/index.ts +2 -1
  272. package/packages/tooltip/src/tooltip.ts +87 -46
  273. package/packages/v-x-e-table/index.ts +1 -0
  274. package/packages/v-x-e-table/src/conf.ts +12 -7
  275. package/packages/v-x-e-table/src/interceptor.ts +1 -1
  276. package/packages/v-x-e-table/src/renderer.ts +2 -1
  277. package/packages/v-x-e-table/src/store.ts +1 -1
  278. package/styles/select.scss +1 -1
  279. package/styles/tooltip.scss +1 -1
  280. package/types/all.d.ts +2 -2
  281. package/types/button.d.ts +54 -54
  282. package/types/checkbox-group.d.ts +21 -21
  283. package/types/checkbox.d.ts +30 -30
  284. package/types/colgroup.d.ts +16 -16
  285. package/types/column.d.ts +172 -161
  286. package/types/component.d.ts +9 -9
  287. package/types/edit.d.ts +35 -35
  288. package/types/export.d.ts +101 -101
  289. package/types/filter.d.ts +19 -19
  290. package/types/footer.d.ts +1 -1
  291. package/types/form-gather.d.ts +3 -3
  292. package/types/form-item.d.ts +68 -66
  293. package/types/form.d.ts +136 -131
  294. package/types/grid.d.ts +257 -257
  295. package/types/header.d.ts +1 -1
  296. package/types/icon.d.ts +1 -1
  297. package/types/input.d.ts +162 -162
  298. package/types/keyboard.d.ts +6 -6
  299. package/types/list.d.ts +54 -54
  300. package/types/menu.d.ts +33 -33
  301. package/types/modal.d.ts +160 -160
  302. package/types/optgroup.d.ts +5 -5
  303. package/types/option.d.ts +19 -19
  304. package/types/pager.d.ts +65 -61
  305. package/types/plugins/pro.d.ts +245 -215
  306. package/types/pulldown.d.ts +36 -36
  307. package/types/radio-button.d.ts +25 -25
  308. package/types/radio-group.d.ts +20 -20
  309. package/types/radio.d.ts +27 -27
  310. package/types/select.d.ts +82 -82
  311. package/types/switch.d.ts +40 -40
  312. package/types/table.d.ts +1422 -1336
  313. package/types/textarea.d.ts +71 -71
  314. package/types/toolbar.d.ts +65 -65
  315. package/types/tooltip.d.ts +50 -44
  316. package/types/v-x-e-table/commands.d.ts +12 -12
  317. package/types/v-x-e-table/formats.d.ts +10 -10
  318. package/types/v-x-e-table/hooks.d.ts +9 -9
  319. package/types/v-x-e-table/index.d.ts +51 -43
  320. package/types/v-x-e-table/interceptor.d.ts +26 -26
  321. package/types/v-x-e-table/menus.d.ts +13 -13
  322. package/types/v-x-e-table/renderer.d.ts +128 -128
  323. package/types/v-x-e-table/setup.d.ts +55 -55
  324. package/types/validator.d.ts +28 -28
@@ -1,60 +1,61 @@
1
1
  import { VNode } from 'vue'
2
2
  import { VXEComponent } from './component'
3
3
  import { VxeFormConstructor, VxeFormDefines, VxeFormPropTypes } from './form'
4
+ import { VxeTooltipPropTypes } from './tooltip'
4
5
  import { VxeGlobalRendererHandles } from './v-x-e-table'
5
6
 
6
7
  /**
7
8
  * 组件 - 表单项
8
9
  * @example import { FormItem as VxeFormItem } from 'vxe-table'
9
10
  */
10
- export const FormItem: VXEComponent<VxeFormItemProps>;
11
+ export const FormItem: VXEComponent<VxeFormItemProps>
11
12
 
12
13
  export interface VxeFormItemProps {
13
14
  /**
14
15
  * 标题
15
16
  */
16
- title?: VxeFormItemPropTypes.Title;
17
+ title?: VxeFormItemPropTypes.Title
17
18
  /**
18
19
  * 字段名
19
20
  */
20
- field?: VxeFormItemPropTypes.Field;
21
+ field?: VxeFormItemPropTypes.Field
21
22
  /**
22
23
  * 栅格占据的列数(共 24 分栏)
23
24
  */
24
- span?: VxeFormItemPropTypes.Span;
25
+ span?: VxeFormItemPropTypes.Span
25
26
  /**
26
27
  * 内容对齐方式
27
28
  */
28
- align?: VxeFormItemPropTypes.Align;
29
+ align?: VxeFormItemPropTypes.Align
29
30
  /**
30
31
  * 标题对齐方式
31
32
  */
32
- titleAlign?: VxeFormItemPropTypes.TitleAlign;
33
+ titleAlign?: VxeFormItemPropTypes.TitleAlign
33
34
  /**
34
35
  * 标题宽度
35
36
  */
36
- titleWidth?: VxeFormItemPropTypes.TitleWidth;
37
+ titleWidth?: VxeFormItemPropTypes.TitleWidth
37
38
  /**
38
39
  * 给表单项附加 className
39
40
  */
40
- className?: VxeFormItemPropTypes.ClassName;
41
+ className?: VxeFormItemPropTypes.ClassName
41
42
  /**
42
43
  * 前缀配置项
43
44
  */
44
- titlePrefix?: VxeFormItemPropTypes.TitlePrefix;
45
+ titlePrefix?: VxeFormItemPropTypes.TitlePrefix
45
46
  /**
46
47
  * 后缀配置项
47
48
  */
48
- titleSuffix?: VxeFormItemPropTypes.TitleSuffix;
49
- titleOverflow?: VxeFormItemPropTypes.TitleOverflow;
49
+ titleSuffix?: VxeFormItemPropTypes.TitleSuffix
50
+ titleOverflow?: VxeFormItemPropTypes.TitleOverflow
50
51
  /**
51
52
  * 重置时的默认值
52
53
  */
53
- resetValue?: VxeFormItemPropTypes.ResetValue;
54
+ resetValue?: VxeFormItemPropTypes.ResetValue
54
55
  /**
55
56
  * 是否显示
56
57
  */
57
- visible?: VxeFormItemPropTypes.Visible;
58
+ visible?: VxeFormItemPropTypes.Visible
58
59
  /**
59
60
  * 该方法的返回值用来决定该项是否显示
60
61
  */
@@ -62,58 +63,59 @@ export interface VxeFormItemProps {
62
63
  /**
63
64
  * 默认收起
64
65
  */
65
- folding?: VxeFormItemPropTypes.Folding;
66
+ folding?: VxeFormItemPropTypes.Folding
66
67
  /**
67
68
  * 折叠节点
68
69
  */
69
- collapseNode?: VxeFormItemPropTypes.CollapseNode;
70
+ collapseNode?: VxeFormItemPropTypes.CollapseNode
70
71
  /**
71
72
  * 项渲染配置项
72
73
  */
73
- itemRender?: FormItemRenderOptions;
74
- slots?: VxeFormItemPropTypes.Slots;
75
- children?: VxeFormItemProps[];
74
+ itemRender?: FormItemRenderOptions
75
+ slots?: VxeFormItemPropTypes.Slots
76
+ children?: VxeFormItemProps[]
76
77
  }
77
78
 
78
79
  export namespace VxeFormItemPropTypes {
79
- export type Title = string;
80
- export type Field = string;
81
- export type Span = VxeFormPropTypes.Span;
82
- export type Align = VxeFormPropTypes.Align;
83
- export type TitleAlign = VxeFormPropTypes.TitleAlign;
84
- export type TitleWidth = VxeFormPropTypes.TitleWidth;
80
+ export type Title = string
81
+ export type Field = string
82
+ export type Span = VxeFormPropTypes.Span
83
+ export type Align = VxeFormPropTypes.Align
84
+ export type TitleAlign = VxeFormPropTypes.TitleAlign
85
+ export type TitleWidth = VxeFormPropTypes.TitleWidth
85
86
 
86
87
  interface ClassNameParams {
87
- $form: VxeFormConstructor;
88
- data: any;
89
- item: VxeFormDefines.ItemInfo;
90
- property: string;
88
+ $form: VxeFormConstructor
89
+ data: any
90
+ item: VxeFormDefines.ItemInfo
91
+ property: string
91
92
  }
92
- export type ClassName = string | ((params: ClassNameParams) => string);
93
+ export type ClassName = string | ((params: ClassNameParams) => string)
93
94
 
94
95
  interface PrefixOption {
95
- content?: string;
96
- enterable?: boolean;
97
- theme?: string;
98
- icon?: string;
96
+ useHTML?: VxeTooltipPropTypes.UseHTML
97
+ content?: VxeTooltipPropTypes.Content
98
+ enterable?: VxeTooltipPropTypes.Enterable
99
+ theme?: VxeTooltipPropTypes.Theme
100
+ icon?: string
99
101
  /**
100
102
  * @deprecated 已废弃,请使用 content
101
103
  */
102
- message?: string;
104
+ message?: string
103
105
  }
104
106
  export type TitlePrefix = PrefixOption
105
107
  export type TitleSuffix = PrefixOption
106
108
  export type TitleOverflow = VxeFormPropTypes.TitleOverflow
107
109
 
108
- export type ResetValue = any;
109
- export type Visible = boolean;
110
- export type VisibleMethod = (params: FormItemVisibleParams) => boolean;
111
- export type Folding = boolean;
112
- export type CollapseNode = boolean;
113
- export type ItemRender = FormItemRenderOptions;
110
+ export type ResetValue = any
111
+ export type Visible = boolean
112
+ export type VisibleMethod = (params: FormItemVisibleParams) => boolean
113
+ export type Folding = boolean
114
+ export type CollapseNode = boolean
115
+ export type ItemRender = FormItemRenderOptions
114
116
  export type Slots = {
115
- title?: string | ((params: FormItemTitleRenderParams) => JSX.Element[] | VNode[] | string[]) | null;
116
- default?: string | ((params: FormItemContentRenderParams) => JSX.Element[] | VNode[] | string[]) | null;
117
+ title?: string | ((params: FormItemTitleRenderParams) => JSX.Element[] | VNode[] | string[]) | null
118
+ default?: string | ((params: FormItemContentRenderParams) => JSX.Element[] | VNode[] | string[]) | null
117
119
  }
118
120
  }
119
121
 
@@ -124,68 +126,68 @@ export interface FormItemRenderOptions extends VxeGlobalRendererHandles.RenderOp
124
126
  /**
125
127
  * 下拉选项列表(需要渲染器支持)
126
128
  */
127
- options?: any[];
129
+ options?: any[]
128
130
  /**
129
131
  * 下拉选项属性参数配置(需要渲染器支持)
130
132
  */
131
- optionProps?: VxeGlobalRendererHandles.RenderOptionProps;
133
+ optionProps?: VxeGlobalRendererHandles.RenderOptionProps
132
134
  /**
133
135
  * 下拉分组选项列表(需要渲染器支持)
134
136
  */
135
- optionGroups?: any[];
137
+ optionGroups?: any[]
136
138
  /**
137
139
  * 下拉分组选项属性参数配置(需要渲染器支持)
138
140
  */
139
- optionGroupProps?: VxeGlobalRendererHandles.RenderOptionGroupProps;
141
+ optionGroupProps?: VxeGlobalRendererHandles.RenderOptionGroupProps
140
142
  /**
141
143
  * 渲染组件的内容(需要渲染器支持)
142
144
  */
143
- content?: string;
144
- autofocus?: boolean;
145
- defaultValue?: ((params: { item: VxeFormItemProps }) => any) | null | undefined | string | number | RegExp | object | any[] | Date;
145
+ content?: string
146
+ autofocus?: boolean
147
+ defaultValue?: ((params: { item: VxeFormItemProps }) => any) | null | undefined | string | number | RegExp | object | any[] | Date
146
148
  }
147
149
 
148
150
  /**
149
151
  * 项标题渲染参数
150
152
  */
151
153
  export interface FormItemTitleRenderParams {
152
- $form: VxeFormConstructor;
153
- data: any;
154
- item: VxeFormDefines.ItemInfo;
155
- property: string;
154
+ $form: VxeFormConstructor
155
+ data: any
156
+ item: VxeFormDefines.ItemInfo
157
+ property: string
156
158
  }
157
159
 
158
160
  /**
159
161
  * 项内容渲染参数
160
162
  */
161
163
  export interface FormItemContentRenderParams {
162
- $form: VxeFormConstructor;
163
- data: any;
164
- item: VxeFormDefines.ItemInfo;
165
- property: string;
164
+ $form: VxeFormConstructor
165
+ data: any
166
+ item: VxeFormDefines.ItemInfo
167
+ property: string
166
168
  }
167
169
 
168
170
  /**
169
171
  * 项可视方法参数
170
172
  */
171
173
  export interface FormItemVisibleParams {
172
- $form: VxeFormConstructor;
173
- data: any;
174
- item: VxeFormDefines.ItemInfo;
175
- property: string;
174
+ $form: VxeFormConstructor
175
+ data: any
176
+ item: VxeFormDefines.ItemInfo
177
+ property: string
176
178
  }
177
179
 
178
180
  /**
179
181
  * 项重置方法参数
180
182
  */
181
183
  export interface FormItemResetParams {
182
- $form: VxeFormConstructor;
183
- data: any;
184
- item: VxeFormDefines.ItemInfo;
185
- field: string;
184
+ $form: VxeFormConstructor
185
+ data: any
186
+ item: VxeFormDefines.ItemInfo
187
+ field: string
186
188
  /**
187
189
  * 已废弃,该属性被 field 替换
188
190
  * @deprecated
189
191
  */
190
- property: string;
192
+ property: string
191
193
  }
package/types/form.d.ts CHANGED
@@ -6,44 +6,43 @@ import { VxeFormItemProps, VxeFormItemPropTypes } from './form-item'
6
6
  * 组件 - 表单
7
7
  * @example import { Form as VxeForm } from 'vxe-table'
8
8
  */
9
- export const Form: VXEComponent<VxeFormProps, VxeFormEventProps>;
9
+ export const Form: VXEComponent<VxeFormProps, VxeFormEventProps>
10
10
 
11
- export type VxeFormInstance = ComponentPublicInstance<VxeFormProps, VxeFormConstructor>;
11
+ export type VxeFormInstance = ComponentPublicInstance<VxeFormProps, VxeFormConstructor>
12
12
 
13
13
  export interface VxeFormConstructor extends VxeComponentBase, VxeFormMethods {
14
- props: VxeFormProps;
15
- context: SetupContext<VxeFormEmits>;
16
- reactData: FormReactData;
17
- internalData: FormInternalData;
18
- getRefMaps(): FormPrivateRef;
19
- getComputeMaps(): FormPrivateComputed;
20
- renderVN: RenderFunction;
14
+ props: VxeFormProps
15
+ context: SetupContext<VxeFormEmits>
16
+ reactData: FormReactData
17
+ internalData: FormInternalData
18
+ getRefMaps(): FormPrivateRef
19
+ getComputeMaps(): FormPrivateComputed
20
+ renderVN: RenderFunction
21
21
  }
22
22
 
23
23
  export interface FormPrivateRef {
24
- refElem: Ref<HTMLFormElement>;
24
+ refElem: Ref<HTMLFormElement>
25
25
  }
26
26
  export interface VxeFormPrivateRef extends FormPrivateRef { }
27
27
 
28
28
  export interface FormPrivateComputed {
29
- computeSize: ComputedRef<VxeFormPropTypes.Size>;
30
- computeValidOpts: ComputedRef<VxeFormPropTypes.ValidOpts>;
31
- computeTooltipOpts: ComputedRef<VxeFormPropTypes.TooltipOpts>;
29
+ computeSize: ComputedRef<VxeFormPropTypes.Size>
30
+ computeValidOpts: ComputedRef<VxeFormPropTypes.ValidOpts>
31
+ computeTooltipOpts: ComputedRef<VxeFormPropTypes.TooltipOpts>
32
32
  }
33
33
  export interface VxeFormPrivateComputed extends FormPrivateComputed { }
34
34
 
35
35
  export interface FormReactData {
36
- collapseAll: boolean;
37
- staticItems: any[];
38
- formItems: VxeFormDefines.ItemInfo[];
36
+ collapseAll: boolean
37
+ staticItems: any[]
38
+ formItems: VxeFormDefines.ItemInfo[]
39
39
  }
40
40
 
41
41
  export interface FormInternalData {
42
- tooltipTimeout: any;
43
- tooltipActive: boolean;
42
+ tooltipTimeout: any
44
43
  tooltipStore: {
45
- item: VxeFormDefines.ItemInfo | null;
46
- visible: boolean;
44
+ item: VxeFormDefines.ItemInfo | null
45
+ visible: boolean
47
46
  }
48
47
  }
49
48
 
@@ -57,216 +56,222 @@ export type VxeFormEmits = [
57
56
  ]
58
57
 
59
58
  export namespace VxeFormPropTypes {
60
- export type Size = SizeType;
61
- export type CollapseStatus = boolean;
62
- export type Loading = boolean;
63
- export type Data = any;
64
- export type Span = string | number;
65
- export type Align = 'left' | 'center' | 'right' | null;
66
- export type TitleAlign = Align;
67
- export type TitleWidth = string | number;
68
- export type TitleColon = boolean;
69
- export type TitleAsterisk = boolean;
70
- export type TitleOverflow = boolean | 'ellipsis' | 'title' | 'tooltip' | null;
59
+ export type Size = SizeType
60
+ export type CollapseStatus = boolean
61
+ export type Loading = boolean
62
+ export type Data = any
63
+ export type Span = string | number
64
+ export type Align = 'left' | 'center' | 'right' | null
65
+ export type TitleAlign = Align
66
+ export type TitleWidth = string | number
67
+ export type TitleColon = boolean
68
+ export type TitleAsterisk = boolean
69
+ export type TitleOverflow = boolean | 'ellipsis' | 'title' | 'tooltip' | null
71
70
 
72
71
  interface ClassNameParams {
73
- $form: VxeFormConstructor;
74
- data: any;
75
- items: VxeFormDefines.ItemInfo[];
72
+ $form: VxeFormConstructor
73
+ data: any
74
+ items: VxeFormDefines.ItemInfo[]
76
75
  }
77
- export type ClassName = string | ((params: ClassNameParams) => string);
76
+ export type ClassName = string | ((params: ClassNameParams) => string)
78
77
 
79
- export type Items = VxeFormItemProps[];
78
+ export type Items = VxeFormItemProps[]
80
79
 
81
80
  /**
82
81
  * 校验规则配置项
83
82
  */
84
83
  export interface Rules {
85
- [field: string]: VxeFormDefines.FormRule[];
84
+ [field: string]: VxeFormDefines.FormRule[]
86
85
  }
87
86
 
88
- export type PreventSubmit = boolean;
87
+ export type PreventSubmit = boolean
89
88
  export type ValidConfig = {
90
- autoPos?: boolean;
91
- showMessage?: boolean;
92
- };
89
+ autoPos?: boolean
90
+ showMessage?: boolean
91
+ }
93
92
  export interface ValidOpts extends ValidConfig { }
94
93
 
95
94
  /**
96
95
  * 提示信息配置项
97
96
  */
98
97
  export interface TooltipConfig {
99
- theme?: 'dark' | 'light';
100
- enterable?: boolean;
101
- leaveDelay?: number;
102
- leaveMethod?: (params: { $event: Event }) => boolean;
98
+ theme?: 'dark' | 'light'
99
+ enterable?: boolean
100
+ leaveDelay?: number
101
+ leaveMethod?: (params: { $event: Event }) => boolean
103
102
  }
104
103
  export interface TooltipOpts extends TooltipConfig { }
105
104
 
106
- export type CustomLayout = boolean;
105
+ export type CustomLayout = boolean
107
106
  }
108
107
 
109
108
  export type VxeFormProps<D = any> = {
110
- size?: VxeFormPropTypes.Size;
111
- collapseStatus?: VxeFormPropTypes.CollapseStatus;
112
- loading?: VxeFormPropTypes.Loading;
113
- data?: D;
114
- span?: VxeFormPropTypes.Span;
115
- align?: VxeFormPropTypes.Align;
116
- titleAlign?: VxeFormPropTypes.TitleAlign;
117
- titleWidth?: VxeFormPropTypes.TitleWidth;
118
- titleColon?: VxeFormPropTypes.TitleColon;
119
- titleAsterisk?: VxeFormPropTypes.TitleAsterisk;
120
- titleOverflow?: VxeFormPropTypes.TitleOverflow;
121
- className?: VxeFormPropTypes.ClassName;
122
- items?: VxeFormPropTypes.Items;
123
- rules?: VxeFormPropTypes.Rules;
124
- preventSubmit?: VxeFormPropTypes.PreventSubmit;
125
- validConfig?: VxeFormPropTypes.ValidConfig;
126
- tooltipConfig?: VxeFormPropTypes.TooltipConfig;
127
- customLayout?: VxeFormPropTypes.CustomLayout;
109
+ size?: VxeFormPropTypes.Size
110
+ collapseStatus?: VxeFormPropTypes.CollapseStatus
111
+ loading?: VxeFormPropTypes.Loading
112
+ data?: D
113
+ span?: VxeFormPropTypes.Span
114
+ align?: VxeFormPropTypes.Align
115
+ titleAlign?: VxeFormPropTypes.TitleAlign
116
+ titleWidth?: VxeFormPropTypes.TitleWidth
117
+ titleColon?: VxeFormPropTypes.TitleColon
118
+ titleAsterisk?: VxeFormPropTypes.TitleAsterisk
119
+ titleOverflow?: VxeFormPropTypes.TitleOverflow
120
+ className?: VxeFormPropTypes.ClassName
121
+ items?: VxeFormPropTypes.Items
122
+ rules?: VxeFormPropTypes.Rules
123
+ preventSubmit?: VxeFormPropTypes.PreventSubmit
124
+ validConfig?: VxeFormPropTypes.ValidConfig
125
+ tooltipConfig?: VxeFormPropTypes.TooltipConfig
126
+ customLayout?: VxeFormPropTypes.CustomLayout
128
127
  }
129
128
 
130
129
  export interface FormMethods {
131
- dispatchEvent(type: ValueOf<VxeFormEmits>, params: any, evnt: Event): void;
130
+ dispatchEvent(type: ValueOf<VxeFormEmits>, params: any, evnt: Event): void
132
131
  /**
133
132
  * 重置表单
134
133
  */
135
- reset(): Promise<any>;
134
+ reset(): Promise<any>
136
135
  /**
137
136
  * 对表单进行校验,参数为一个回调函数。该回调函数会在校验结束后被调用 callback(errMap)。若不传入回调函数,则会返回一个 promise
138
137
  * @param callback 回调函数
139
138
  */
140
- validate(callback?: (errMap?: VxeFormDefines.ValidateErrorMapParams) => void): Promise<any>;
139
+ validate(callback?: (errMap?: VxeFormDefines.ValidateErrorMapParams) => void): Promise<any>
141
140
  /**
142
141
  * 对表单指定项进行校验,参数为一个回调函数。该回调函数会在校验结束后被调用 callback(errMap)。若不传入回调函数,则会返回一个 promise
143
142
  * @param callback 回调函数
144
143
  */
145
- validateField(field: VxeFormItemPropTypes.Field, callback?: (errMap?: VxeFormDefines.ValidateErrorMapParams) => void): Promise<any>;
144
+ validateField(field: VxeFormItemPropTypes.Field | VxeFormDefines.ItemInfo, callback?: (errMap?: VxeFormDefines.ValidateErrorMapParams) => void): Promise<any>
146
145
  /**
147
146
  * 手动清除校验状态,如果指定 field 则清除指定的项,否则清除整个表单
148
147
  * @param field 字段名
149
148
  */
150
- clearValidate(field?: string): Promise<any>;
149
+ clearValidate(field?: VxeFormItemPropTypes.Field | VxeFormDefines.ItemInfo): Promise<any>
151
150
  /**
152
151
  * 更新项状态
153
152
  * 当使用自定义渲染时可能会用到
154
153
  * @param scope 插槽对象
155
154
  */
156
- updateStatus(scope: any, itemValue?: any): void;
155
+ updateStatus(scope: any, itemValue?: any): void
157
156
  /**
158
157
  * 获取表单项列表
159
158
  */
160
- getItems(): VxeFormDefines.ItemInfo[];
159
+ getItems(): VxeFormDefines.ItemInfo[]
160
+ /**
161
+ * 根据列的字段名获取表单项
162
+ * @param field 字段名
163
+ *
164
+ */
165
+ getItemByField(field: VxeFormItemPropTypes.Field): VxeFormDefines.ItemInfo | null
161
166
  /**
162
167
  * 关闭 tooltip 提示
163
168
  */
164
- closeTooltip(): Promise<any>;
169
+ closeTooltip(): Promise<any>
165
170
  /**
166
171
  * 手动切换折叠状态
167
172
  */
168
- toggleCollapse(): Promise<any>;
173
+ toggleCollapse(): Promise<any>
169
174
  }
170
175
  export interface VxeFormMethods extends FormMethods { }
171
176
 
172
177
  export interface FormPrivateMethods {
173
- callSlot<T>(slotFunc: ((params: T) => any[]) | string | null, params: T): VNode[];
174
- toggleCollapseEvent(evnt: Event): void;
175
- triggerHeaderHelpEvent(evnt: MouseEvent, params: {
176
- item: VxeFormDefines.ItemInfo;
177
- }): void;
178
- handleTargetLeaveEvent(): void;
178
+ callSlot<T>(slotFunc: ((params: T) => any[]) | string | null, params: T): VNode[]
179
+ toggleCollapseEvent(evnt: Event): void
180
+ triggerTitleTipEvent(evnt: MouseEvent, params: {
181
+ item: VxeFormDefines.ItemInfo
182
+ }): void
183
+ handleTitleTipLeaveEvent(): void
179
184
  }
180
185
  export interface VxeFormPrivateMethods extends FormPrivateMethods { }
181
186
 
182
187
  export namespace VxeFormDefines {
183
188
  export class ItemInfo {
184
- id: string;
185
-
186
- title: VxeFormItemPropTypes.Title;
187
- field: VxeFormItemPropTypes.Field;
188
- span: VxeFormItemPropTypes.Span;
189
- align: VxeFormItemPropTypes.Align;
190
- titleAlign: VxeFormItemPropTypes.TitleAlign;
191
- titleWidth: VxeFormItemPropTypes.TitleWidth;
192
- titlePrefix: VxeFormItemPropTypes.TitlePrefix;
193
- titleSuffix: VxeFormItemPropTypes.TitleSuffix;
194
- titleOverflow: VxeFormItemPropTypes.TitleOverflow;
195
- resetValue: VxeFormItemPropTypes.ResetValue;
196
- visibleMethod: VxeFormItemPropTypes.VisibleMethod;
197
- visible: VxeFormItemPropTypes.Visible;
198
- folding: VxeFormItemPropTypes.Folding;
199
- collapseNode: VxeFormItemPropTypes.CollapseNode;
200
- className: VxeFormItemPropTypes.ClassName;
201
- itemRender: VxeFormItemPropTypes.ItemRender;
189
+ id: string
190
+
191
+ title: VxeFormItemPropTypes.Title
192
+ field: VxeFormItemPropTypes.Field
193
+ span: VxeFormItemPropTypes.Span
194
+ align: VxeFormItemPropTypes.Align
195
+ titleAlign: VxeFormItemPropTypes.TitleAlign
196
+ titleWidth: VxeFormItemPropTypes.TitleWidth
197
+ titlePrefix: VxeFormItemPropTypes.TitlePrefix
198
+ titleSuffix: VxeFormItemPropTypes.TitleSuffix
199
+ titleOverflow: VxeFormItemPropTypes.TitleOverflow
200
+ resetValue: VxeFormItemPropTypes.ResetValue
201
+ visibleMethod: VxeFormItemPropTypes.VisibleMethod
202
+ visible: VxeFormItemPropTypes.Visible
203
+ folding: VxeFormItemPropTypes.Folding
204
+ collapseNode: VxeFormItemPropTypes.CollapseNode
205
+ className: VxeFormItemPropTypes.ClassName
206
+ itemRender: VxeFormItemPropTypes.ItemRender
202
207
  // 渲染属性
203
- showError: boolean;
204
- errRule: any;
205
- slots: VxeFormItemPropTypes.Slots;
206
- children: ItemInfo[];
208
+ showError: boolean
209
+ errRule: any
210
+ slots: VxeFormItemPropTypes.Slots
211
+ children: ItemInfo[]
207
212
  }
208
213
 
209
214
  export interface FormRule {
210
215
  /**
211
216
  * 是否必填
212
217
  */
213
- required?: boolean;
218
+ required?: boolean
214
219
  /**
215
220
  * 最小长度/值
216
221
  */
217
- min?: number;
222
+ min?: number
218
223
  /**
219
224
  * 最大长度/值
220
225
  */
221
- max?: number;
226
+ max?: number
222
227
  /**
223
228
  * 数据类型
224
229
  */
225
- type?: 'number' | 'string' | 'array';
230
+ type?: 'number' | 'string' | 'array'
226
231
  /**
227
232
  * 使用正则表达式校验
228
233
  */
229
- pattern?: string | RegExp;
234
+ pattern?: string | RegExp
230
235
  /**
231
236
  * 使用自定义校验函数,接收一个 Promise
232
237
  * @param params 参数
233
238
  */
234
- validator?(params: ValidateErrorParams): void | Error | Promise<any>;
239
+ validator?(params: ValidateErrorParams): void | Error | Promise<any>
235
240
  /**
236
241
  * 提示消息
237
242
  */
238
- content?: string;
239
- trigger?: 'change';
240
- maxWidth?: number;
243
+ content?: string
244
+ trigger?: 'change'
245
+ maxWidth?: number
241
246
  /**
242
247
  * @deprecated 已废弃,请使用 content
243
248
  */
244
- message?: string;
249
+ message?: string
245
250
  }
246
251
 
247
252
  interface ValidateErrorParams {
248
253
  $form: VxeFormConstructor,
249
254
  itemValue: any,
250
- rule: VxeFormDefines.FormRule;
251
- rules: VxeFormDefines.FormRule[];
252
- data: any;
253
- field: string;
255
+ rule: VxeFormDefines.FormRule
256
+ rules: VxeFormDefines.FormRule[]
257
+ data: any
258
+ field: string
254
259
  /**
255
260
  * 已废弃,该属性被 field 替换
256
261
  */
257
- property: string;
262
+ property: string
258
263
  }
259
264
 
260
265
  export interface ValidateErrorMapParams {
261
- [field: string]: ValidateErrorParams[];
266
+ [field: string]: ValidateErrorParams[]
262
267
  }
263
268
 
264
269
  interface FormEventParams extends VxeEvent {
265
- $form: VxeFormConstructor;
270
+ $form: VxeFormConstructor
266
271
  }
267
272
 
268
273
  interface FormBaseParams {
269
- data: any;
274
+ data: any
270
275
  }
271
276
 
272
277
  export interface CollapseParams extends FormBaseParams { }
@@ -283,22 +288,22 @@ export namespace VxeFormDefines {
283
288
  }
284
289
 
285
290
  export type VxeFormEventProps = {
286
- onCollapse?: VxeFormEvents.Collapse;
287
- onSubmit?: VxeFormEvents.Submit;
288
- onSubmitInvalid?: VxeFormEvents.SubmitInvalid;
289
- onReset?: VxeFormEvents.Reset;
291
+ onCollapse?: VxeFormEvents.Collapse
292
+ onSubmit?: VxeFormEvents.Submit
293
+ onSubmitInvalid?: VxeFormEvents.SubmitInvalid
294
+ onReset?: VxeFormEvents.Reset
290
295
  }
291
296
 
292
297
  export interface VxeFormListeners {
293
- collapse?: VxeFormEvents.Collapse;
294
- submit?: VxeFormEvents.Submit;
295
- submitInvalid?: VxeFormEvents.SubmitInvalid;
296
- reset?: VxeFormEvents.Reset;
298
+ collapse?: VxeFormEvents.Collapse
299
+ submit?: VxeFormEvents.Submit
300
+ submitInvalid?: VxeFormEvents.SubmitInvalid
301
+ reset?: VxeFormEvents.Reset
297
302
  }
298
303
 
299
304
  export namespace VxeFormEvents {
300
- export type Collapse = (params: VxeFormDefines.CollapseEventParams) => void;
301
- export type Submit = (params: VxeFormDefines.SubmitEventParams) => void;
302
- export type SubmitInvalid = (params: VxeFormDefines.SubmitInvalidEventParams) => void;
303
- export type Reset = (params: VxeFormDefines.ResetEventParams) => void;
305
+ export type Collapse = (params: VxeFormDefines.CollapseEventParams) => void
306
+ export type Submit = (params: VxeFormDefines.SubmitEventParams) => void
307
+ export type SubmitInvalid = (params: VxeFormDefines.SubmitInvalidEventParams) => void
308
+ export type Reset = (params: VxeFormDefines.ResetEventParams) => void
304
309
  }