vxe-pc-ui 3.0.1 → 3.0.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 (367) hide show
  1. package/README.md +23 -25
  2. package/es/calendar/index.js +12 -0
  3. package/es/calendar/src/calendar.js +1227 -0
  4. package/es/calendar/style.css +247 -0
  5. package/es/calendar/style.min.css +1 -0
  6. package/es/checkbox/src/checkbox.js +6 -1
  7. package/es/checkbox/src/group.js +6 -1
  8. package/es/collapse/index.js +12 -0
  9. package/es/collapse/src/collapse-pane.js +39 -0
  10. package/es/collapse/src/collapse.js +39 -0
  11. package/es/collapse/style.css +0 -0
  12. package/es/collapse/style.min.css +0 -0
  13. package/es/collapse-pane/index.js +12 -0
  14. package/es/collapse-pane/style.css +0 -0
  15. package/es/collapse-pane/style.min.css +0 -0
  16. package/es/components.js +27 -27
  17. package/es/date-picker/src/date-picker.js +17 -13
  18. package/es/drawer/src/drawer.js +17 -12
  19. package/es/form/index.js +13 -0
  20. package/es/form/render/index.js +461 -0
  21. package/es/form/src/form-config-item.js +201 -0
  22. package/es/form/src/form-gather.js +87 -0
  23. package/es/form/src/form-item.js +291 -0
  24. package/es/form/src/form.js +762 -0
  25. package/es/form/src/itemInfo.js +43 -0
  26. package/es/form/src/render.js +78 -0
  27. package/es/form/src/util.js +66 -0
  28. package/es/form/style.css +470 -0
  29. package/es/form/style.min.css +1 -0
  30. package/es/form-gather/index.js +12 -0
  31. package/es/form-gather/style.css +0 -0
  32. package/es/form-gather/style.min.css +0 -0
  33. package/es/form-item/index.js +12 -0
  34. package/es/form-item/style.css +0 -0
  35. package/es/form-item/style.min.css +0 -0
  36. package/es/icon/style.css +1 -1
  37. package/es/icon-picker/src/icon-picker.js +5 -1
  38. package/es/image/src/preview.js +1 -2
  39. package/es/input/src/input.js +19 -15
  40. package/es/list/index.js +12 -0
  41. package/es/list/src/list.js +373 -0
  42. package/es/list/style.css +28 -0
  43. package/es/list/style.min.css +1 -0
  44. package/es/loading/src/loading.js +5 -0
  45. package/es/menu/src/menu.js +6 -2
  46. package/es/modal/src/modal.js +7 -4
  47. package/es/number-input/src/number-input.js +11 -7
  48. package/es/pager/style.css +303 -0
  49. package/es/pager/style.min.css +1 -0
  50. package/es/password-input/src/password-input.js +7 -3
  51. package/es/pulldown/src/pulldown.js +6 -2
  52. package/es/radio/src/button.js +6 -2
  53. package/es/radio/src/group.js +6 -2
  54. package/es/radio/src/radio.js +6 -2
  55. package/es/select/src/select.js +16 -1
  56. package/es/select/src/util.js +2 -1
  57. package/es/style.css +1 -1
  58. package/es/style.min.css +1 -1
  59. package/es/switch/src/switch.js +6 -2
  60. package/es/tabs/src/tabs.js +8 -3
  61. package/es/textarea/src/textarea.js +9 -5
  62. package/es/tooltip/src/tooltip.js +6 -1
  63. package/es/tree/index.js +12 -0
  64. package/es/tree/src/tree.js +1216 -0
  65. package/es/tree/style.css +219 -0
  66. package/es/tree/style.min.css +1 -0
  67. package/es/tree-select/index.js +12 -0
  68. package/es/tree-select/src/tree-select.js +685 -0
  69. package/es/tree-select/style.css +129 -0
  70. package/es/tree-select/style.min.css +1 -0
  71. package/es/ui/index.js +1 -1
  72. package/es/ui/src/log.js +1 -1
  73. package/es/ui/src/vn.js +1 -1
  74. package/es/upload/src/upload.js +9 -5
  75. package/es/vxe-calendar/index.js +3 -0
  76. package/es/vxe-calendar/style.css +247 -0
  77. package/es/vxe-calendar/style.min.css +1 -0
  78. package/es/vxe-collapse/index.js +3 -0
  79. package/es/vxe-collapse/style.css +0 -0
  80. package/es/vxe-collapse/style.min.css +0 -0
  81. package/es/vxe-collapse-pane/index.js +3 -0
  82. package/es/vxe-collapse-pane/style.css +0 -0
  83. package/es/vxe-collapse-pane/style.min.css +0 -0
  84. package/es/vxe-form/index.js +3 -0
  85. package/es/vxe-form/style.css +470 -0
  86. package/es/vxe-form/style.min.css +1 -0
  87. package/es/vxe-form-gather/index.js +3 -0
  88. package/es/vxe-form-gather/style.css +0 -0
  89. package/es/vxe-form-gather/style.min.css +0 -0
  90. package/es/vxe-form-item/index.js +3 -0
  91. package/es/vxe-form-item/style.css +0 -0
  92. package/es/vxe-form-item/style.min.css +0 -0
  93. package/es/vxe-list/index.js +3 -0
  94. package/es/vxe-list/style.css +28 -0
  95. package/es/vxe-list/style.min.css +1 -0
  96. package/es/vxe-pager/index.js +3 -0
  97. package/es/vxe-pager/style.css +303 -0
  98. package/es/vxe-pager/style.min.css +1 -0
  99. package/es/vxe-tree/index.js +3 -0
  100. package/es/vxe-tree/style.css +219 -0
  101. package/es/vxe-tree/style.min.css +1 -0
  102. package/es/vxe-tree-select/index.js +3 -0
  103. package/es/vxe-tree-select/style.css +129 -0
  104. package/es/vxe-tree-select/style.min.css +1 -0
  105. package/lib/calendar/index.js +19 -0
  106. package/lib/calendar/index.min.js +1 -0
  107. package/lib/calendar/src/calendar.js +1286 -0
  108. package/lib/calendar/src/calendar.min.js +1 -0
  109. package/lib/calendar/style/index.js +1 -0
  110. package/lib/calendar/style/style.css +247 -0
  111. package/lib/calendar/style/style.min.css +1 -0
  112. package/lib/checkbox/src/checkbox.js +6 -1
  113. package/lib/checkbox/src/checkbox.min.js +1 -1
  114. package/lib/checkbox/src/group.js +6 -1
  115. package/lib/checkbox/src/group.min.js +1 -1
  116. package/lib/collapse/index.js +19 -0
  117. package/lib/collapse/index.min.js +1 -0
  118. package/lib/collapse/src/collapse-pane.js +48 -0
  119. package/lib/collapse/src/collapse-pane.min.js +1 -0
  120. package/lib/collapse/src/collapse.js +48 -0
  121. package/lib/collapse/src/collapse.min.js +1 -0
  122. package/lib/collapse/style/index.js +1 -0
  123. package/lib/collapse/style/style.css +0 -0
  124. package/lib/collapse/style/style.min.css +0 -0
  125. package/lib/collapse-pane/index.js +19 -0
  126. package/lib/collapse-pane/index.min.js +1 -0
  127. package/lib/collapse-pane/style/index.js +1 -0
  128. package/lib/collapse-pane/style/style.css +0 -0
  129. package/lib/collapse-pane/style/style.min.css +0 -0
  130. package/lib/components.js +114 -39
  131. package/lib/components.min.js +1 -1
  132. package/lib/date-picker/src/date-picker.js +17 -13
  133. package/lib/date-picker/src/date-picker.min.js +1 -1
  134. package/lib/drawer/src/drawer.js +17 -12
  135. package/lib/drawer/src/drawer.min.js +1 -1
  136. package/lib/form/index.js +20 -0
  137. package/lib/form/index.min.js +1 -0
  138. package/lib/form/render/index.js +509 -0
  139. package/lib/form/render/index.min.js +1 -0
  140. package/lib/form/src/form-config-item.js +210 -0
  141. package/lib/form/src/form-config-item.min.js +1 -0
  142. package/lib/form/src/form-gather.js +99 -0
  143. package/lib/form/src/form-gather.min.js +1 -0
  144. package/lib/form/src/form-item.js +299 -0
  145. package/lib/form/src/form-item.min.js +1 -0
  146. package/lib/form/src/form.js +856 -0
  147. package/lib/form/src/form.min.js +1 -0
  148. package/lib/form/src/itemInfo.js +60 -0
  149. package/lib/form/src/itemInfo.min.js +1 -0
  150. package/lib/form/src/render.js +94 -0
  151. package/lib/form/src/render.min.js +1 -0
  152. package/lib/form/src/util.js +93 -0
  153. package/lib/form/src/util.min.js +1 -0
  154. package/lib/form/style/index.js +1 -0
  155. package/lib/form/style/style.css +470 -0
  156. package/lib/form/style/style.min.css +1 -0
  157. package/lib/form-gather/index.js +19 -0
  158. package/lib/form-gather/index.min.js +1 -0
  159. package/lib/form-gather/style/index.js +1 -0
  160. package/lib/form-gather/style/style.css +0 -0
  161. package/lib/form-gather/style/style.min.css +0 -0
  162. package/lib/form-item/index.js +19 -0
  163. package/lib/form-item/index.min.js +1 -0
  164. package/lib/form-item/style/index.js +1 -0
  165. package/lib/form-item/style/style.css +0 -0
  166. package/lib/form-item/style/style.min.css +0 -0
  167. package/lib/icon/style/style.css +1 -1
  168. package/lib/icon/style/style.min.css +1 -1
  169. package/lib/icon-picker/src/icon-picker.js +5 -1
  170. package/lib/icon-picker/src/icon-picker.min.js +1 -1
  171. package/lib/image/src/preview.js +1 -2
  172. package/lib/image/src/preview.min.js +1 -1
  173. package/lib/index.umd.js +11284 -5009
  174. package/lib/index.umd.min.js +1 -1
  175. package/lib/input/src/input.js +19 -15
  176. package/lib/input/src/input.min.js +1 -1
  177. package/lib/list/index.js +19 -0
  178. package/lib/list/index.min.js +1 -0
  179. package/lib/list/src/list.js +415 -0
  180. package/lib/list/src/list.min.js +1 -0
  181. package/lib/list/style/index.js +1 -0
  182. package/lib/list/style/style.css +28 -0
  183. package/lib/list/style/style.min.css +1 -0
  184. package/lib/loading/src/loading.js +5 -0
  185. package/lib/loading/src/loading.min.js +1 -1
  186. package/lib/menu/src/menu.js +6 -2
  187. package/lib/menu/src/menu.min.js +1 -1
  188. package/lib/modal/src/modal.js +7 -4
  189. package/lib/modal/src/modal.min.js +1 -1
  190. package/lib/number-input/src/number-input.js +11 -7
  191. package/lib/number-input/src/number-input.min.js +1 -1
  192. package/lib/pager/style/index.js +1 -0
  193. package/lib/pager/style/style.css +303 -0
  194. package/lib/pager/style/style.min.css +1 -0
  195. package/lib/password-input/src/password-input.js +7 -3
  196. package/lib/password-input/src/password-input.min.js +1 -1
  197. package/lib/pulldown/src/pulldown.js +6 -2
  198. package/lib/pulldown/src/pulldown.min.js +1 -1
  199. package/lib/radio/src/button.js +6 -2
  200. package/lib/radio/src/button.min.js +1 -1
  201. package/lib/radio/src/group.js +6 -2
  202. package/lib/radio/src/group.min.js +1 -1
  203. package/lib/radio/src/radio.js +6 -2
  204. package/lib/radio/src/radio.min.js +1 -1
  205. package/lib/select/src/select.js +16 -1
  206. package/lib/select/src/select.min.js +1 -1
  207. package/lib/select/src/util.js +2 -1
  208. package/lib/style.css +1 -1
  209. package/lib/style.min.css +1 -1
  210. package/lib/switch/src/switch.js +6 -2
  211. package/lib/switch/src/switch.min.js +1 -1
  212. package/lib/tabs/src/tabs.js +8 -3
  213. package/lib/tabs/src/tabs.min.js +1 -1
  214. package/lib/textarea/src/textarea.js +9 -5
  215. package/lib/textarea/src/textarea.min.js +1 -1
  216. package/lib/tooltip/src/tooltip.js +6 -1
  217. package/lib/tooltip/src/tooltip.min.js +1 -1
  218. package/lib/tree/index.js +19 -0
  219. package/lib/tree/index.min.js +1 -0
  220. package/lib/tree/src/tree.js +1324 -0
  221. package/lib/tree/src/tree.min.js +1 -0
  222. package/lib/tree/style/index.js +1 -0
  223. package/lib/tree/style/style.css +219 -0
  224. package/lib/tree/style/style.min.css +1 -0
  225. package/lib/tree-select/index.js +19 -0
  226. package/lib/tree-select/index.min.js +1 -0
  227. package/lib/tree-select/src/tree-select.js +695 -0
  228. package/lib/tree-select/src/tree-select.min.js +1 -0
  229. package/lib/tree-select/style/index.js +1 -0
  230. package/lib/tree-select/style/style.css +129 -0
  231. package/lib/tree-select/style/style.min.css +1 -0
  232. package/lib/ui/index.js +1 -1
  233. package/lib/ui/index.min.js +1 -1
  234. package/lib/ui/src/log.js +1 -1
  235. package/lib/ui/src/log.min.js +1 -1
  236. package/lib/ui/src/vn.js +1 -1
  237. package/lib/ui/src/vn.min.js +1 -1
  238. package/lib/upload/src/upload.js +9 -5
  239. package/lib/upload/src/upload.min.js +1 -1
  240. package/lib/vxe-calendar/index.js +23 -0
  241. package/lib/vxe-calendar/index.min.js +1 -0
  242. package/lib/vxe-calendar/style/index.js +1 -0
  243. package/lib/vxe-calendar/style/style.css +247 -0
  244. package/lib/vxe-calendar/style/style.min.css +1 -0
  245. package/lib/vxe-collapse/index.js +23 -0
  246. package/lib/vxe-collapse/index.min.js +1 -0
  247. package/lib/vxe-collapse/style/index.js +1 -0
  248. package/lib/vxe-collapse/style/style.css +0 -0
  249. package/lib/vxe-collapse/style/style.min.css +0 -0
  250. package/lib/vxe-collapse-pane/index.js +23 -0
  251. package/lib/vxe-collapse-pane/index.min.js +1 -0
  252. package/lib/vxe-collapse-pane/style/index.js +1 -0
  253. package/lib/vxe-collapse-pane/style/style.css +0 -0
  254. package/lib/vxe-collapse-pane/style/style.min.css +0 -0
  255. package/lib/vxe-form/index.js +23 -0
  256. package/lib/vxe-form/index.min.js +1 -0
  257. package/lib/vxe-form/style/index.js +1 -0
  258. package/lib/vxe-form/style/style.css +470 -0
  259. package/lib/vxe-form/style/style.min.css +1 -0
  260. package/lib/vxe-form-gather/index.js +23 -0
  261. package/lib/vxe-form-gather/index.min.js +1 -0
  262. package/lib/vxe-form-gather/style/index.js +1 -0
  263. package/lib/vxe-form-gather/style/style.css +0 -0
  264. package/lib/vxe-form-gather/style/style.min.css +0 -0
  265. package/lib/vxe-form-item/index.js +23 -0
  266. package/lib/vxe-form-item/index.min.js +1 -0
  267. package/lib/vxe-form-item/style/index.js +1 -0
  268. package/lib/vxe-form-item/style/style.css +0 -0
  269. package/lib/vxe-form-item/style/style.min.css +0 -0
  270. package/lib/vxe-list/index.js +23 -0
  271. package/lib/vxe-list/index.min.js +1 -0
  272. package/lib/vxe-list/style/index.js +1 -0
  273. package/lib/vxe-list/style/style.css +28 -0
  274. package/lib/vxe-list/style/style.min.css +1 -0
  275. package/lib/vxe-pager/index.js +23 -0
  276. package/lib/vxe-pager/index.min.js +1 -0
  277. package/lib/vxe-pager/style/index.js +1 -0
  278. package/lib/vxe-pager/style/style.css +303 -0
  279. package/lib/vxe-pager/style/style.min.css +1 -0
  280. package/lib/vxe-tree/index.js +23 -0
  281. package/lib/vxe-tree/index.min.js +1 -0
  282. package/lib/vxe-tree/style/index.js +1 -0
  283. package/lib/vxe-tree/style/style.css +219 -0
  284. package/lib/vxe-tree/style/style.min.css +1 -0
  285. package/lib/vxe-tree-select/index.js +23 -0
  286. package/lib/vxe-tree-select/index.min.js +1 -0
  287. package/lib/vxe-tree-select/style/index.js +1 -0
  288. package/lib/vxe-tree-select/style/style.css +129 -0
  289. package/lib/vxe-tree-select/style/style.min.css +1 -0
  290. package/package.json +1 -1
  291. package/packages/calendar/index.ts +16 -0
  292. package/packages/calendar/src/calendar.ts +1281 -0
  293. package/packages/checkbox/src/checkbox.ts +7 -1
  294. package/packages/checkbox/src/group.ts +8 -2
  295. package/packages/collapse/index.ts +16 -0
  296. package/packages/collapse/src/collapse-pane.ts +47 -0
  297. package/packages/collapse/src/collapse.ts +47 -0
  298. package/packages/collapse-pane/index.ts +16 -0
  299. package/packages/components.ts +27 -27
  300. package/packages/date-picker/src/date-picker.ts +18 -13
  301. package/packages/drawer/src/drawer.ts +18 -12
  302. package/packages/form/index.ts +17 -0
  303. package/packages/form/render/index.ts +499 -0
  304. package/packages/form/src/form-config-item.ts +219 -0
  305. package/packages/form/src/form-gather.ts +104 -0
  306. package/packages/form/src/form-item.ts +322 -0
  307. package/packages/form/src/form.ts +809 -0
  308. package/packages/form/src/itemInfo.ts +47 -0
  309. package/packages/form/src/render.ts +98 -0
  310. package/packages/form/src/util.ts +80 -0
  311. package/packages/form-gather/index.ts +16 -0
  312. package/packages/form-item/index.ts +16 -0
  313. package/packages/icon-picker/src/icon-picker.ts +6 -1
  314. package/packages/image/src/preview.ts +1 -2
  315. package/packages/input/src/input.ts +20 -15
  316. package/packages/layout-footer/src/layout-footer.ts +1 -0
  317. package/packages/list/index.ts +16 -0
  318. package/packages/list/src/list.ts +403 -0
  319. package/packages/loading/src/loading.ts +6 -0
  320. package/packages/menu/src/menu.ts +7 -2
  321. package/packages/modal/src/modal.ts +8 -4
  322. package/packages/number-input/src/number-input.ts +12 -7
  323. package/packages/password-input/src/password-input.ts +8 -3
  324. package/packages/pulldown/src/pulldown.ts +7 -2
  325. package/packages/radio/src/button.ts +7 -2
  326. package/packages/radio/src/group.ts +7 -2
  327. package/packages/radio/src/radio.ts +7 -2
  328. package/packages/select/src/select.ts +17 -1
  329. package/packages/select/src/util.ts +4 -3
  330. package/packages/switch/src/switch.ts +7 -2
  331. package/packages/tabs/src/tabs.ts +9 -3
  332. package/packages/textarea/src/textarea.ts +10 -5
  333. package/packages/tooltip/src/tooltip.ts +7 -1
  334. package/packages/tree/index.ts +16 -0
  335. package/packages/tree/src/tree.ts +1292 -0
  336. package/packages/tree-select/index.ts +16 -0
  337. package/packages/tree-select/src/tree-select.ts +743 -0
  338. package/packages/ui/src/vn.ts +1 -1
  339. package/packages/upload/src/upload.ts +10 -5
  340. package/types/components/calendar.d.ts +6 -0
  341. package/types/components/colgroup.d.ts +1 -0
  342. package/types/components/column.d.ts +1 -0
  343. package/types/components/drawer.d.ts +11 -10
  344. package/types/components/form-item.d.ts +1 -1
  345. package/types/components/form.d.ts +8 -1
  346. package/types/components/list.d.ts +1 -0
  347. package/types/components/table.d.ts +43 -4
  348. package/types/components/toolbar.d.ts +5 -0
  349. package/types/components/tree-select.d.ts +4 -0
  350. package/types/ui/index.d.ts +0 -5
  351. package/types/ui/renderer.d.ts +37 -36
  352. package/types/handles/form-design.d.ts +0 -4
  353. package/types/handles/index.d.ts +0 -3
  354. package/types/handles/list-design.d.ts +0 -4
  355. package/types/handles/table.d.ts +0 -4
  356. /package/es/icon/style/{iconfont.1725723159302.ttf → iconfont.1725869586078.ttf} +0 -0
  357. /package/es/icon/style/{iconfont.1725723159302.woff → iconfont.1725869586078.woff} +0 -0
  358. /package/es/icon/style/{iconfont.1725723159302.woff2 → iconfont.1725869586078.woff2} +0 -0
  359. /package/es/{iconfont.1725723159302.ttf → iconfont.1725869586078.ttf} +0 -0
  360. /package/es/{iconfont.1725723159302.woff → iconfont.1725869586078.woff} +0 -0
  361. /package/es/{iconfont.1725723159302.woff2 → iconfont.1725869586078.woff2} +0 -0
  362. /package/lib/icon/style/{iconfont.1725723159302.ttf → iconfont.1725869586078.ttf} +0 -0
  363. /package/lib/icon/style/{iconfont.1725723159302.woff → iconfont.1725869586078.woff} +0 -0
  364. /package/lib/icon/style/{iconfont.1725723159302.woff2 → iconfont.1725869586078.woff2} +0 -0
  365. /package/lib/{iconfont.1725723159302.ttf → iconfont.1725869586078.ttf} +0 -0
  366. /package/lib/{iconfont.1725723159302.woff → iconfont.1725869586078.woff} +0 -0
  367. /package/lib/{iconfont.1725723159302.woff2 → iconfont.1725869586078.woff2} +0 -0
@@ -0,0 +1,856 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _comp = require("../../ui/src/comp");
8
+ var _xeUtils = _interopRequireDefault(require("xe-utils"));
9
+ var _ui = require("../../ui");
10
+ var _utils = require("../../ui/src/utils");
11
+ var _dom = require("../../ui/src/dom");
12
+ var _util = require("./util");
13
+ var _tooltip = _interopRequireDefault(require("../../tooltip/src/tooltip"));
14
+ var _formConfigItem = _interopRequireDefault(require("./form-config-item"));
15
+ var _loading = _interopRequireDefault(require("../../loading/src/loading"));
16
+ var _vn = require("../../ui/src/vn");
17
+ var _log = require("../../ui/src/log");
18
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
20
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
21
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
22
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
23
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
24
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
25
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
26
+ var Rule = /*#__PURE__*/function () {
27
+ function Rule(rule) {
28
+ _classCallCheck(this, Rule);
29
+ Object.assign(this, {
30
+ $options: rule,
31
+ required: rule.required,
32
+ min: rule.min,
33
+ max: rule.min,
34
+ type: rule.type,
35
+ pattern: rule.pattern,
36
+ validator: rule.validator,
37
+ trigger: rule.trigger,
38
+ maxWidth: rule.maxWidth
39
+ });
40
+ }
41
+ return _createClass(Rule, [{
42
+ key: "content",
43
+ get: function get() {
44
+ return (0, _utils.getFuncText)(this.$options.content || this.$options.message);
45
+ }
46
+ }, {
47
+ key: "message",
48
+ get: function get() {
49
+ return this.content;
50
+ }
51
+ }]);
52
+ }();
53
+ var validErrorRuleValue = function validErrorRuleValue(rule, val) {
54
+ var type = rule.type,
55
+ min = rule.min,
56
+ max = rule.max,
57
+ pattern = rule.pattern;
58
+ var isNumType = type === 'number';
59
+ var numVal = isNumType ? _xeUtils.default.toNumber(val) : _xeUtils.default.getSize(val);
60
+ // 判断数值
61
+ if (isNumType && isNaN(val)) {
62
+ return true;
63
+ }
64
+ // 如果存在 min,判断最小值
65
+ if (!_xeUtils.default.eqNull(min) && numVal < _xeUtils.default.toNumber(min)) {
66
+ return true;
67
+ }
68
+ // 如果存在 max,判断最大值
69
+ if (!_xeUtils.default.eqNull(max) && numVal > _xeUtils.default.toNumber(max)) {
70
+ return true;
71
+ }
72
+ // 如果存在 pattern,正则校验
73
+ if (pattern && !(_xeUtils.default.isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)) {
74
+ return true;
75
+ }
76
+ return false;
77
+ };
78
+ function getResetValue(value, resetValue) {
79
+ if (_xeUtils.default.isArray(value)) {
80
+ resetValue = [];
81
+ }
82
+ return resetValue;
83
+ }
84
+ var _default2 = exports.default = (0, _comp.defineVxeComponent)({
85
+ name: 'VxeForm',
86
+ mixins: [_ui.globalMixins.sizeMixin],
87
+ props: {
88
+ collapseStatus: {
89
+ type: Boolean,
90
+ default: true
91
+ },
92
+ loading: Boolean,
93
+ data: Object,
94
+ size: {
95
+ type: String,
96
+ default: function _default() {
97
+ return (0, _ui.getConfig)().form.size || (0, _ui.getConfig)().size;
98
+ }
99
+ },
100
+ span: {
101
+ type: [String, Number],
102
+ default: function _default() {
103
+ return (0, _ui.getConfig)().form.span;
104
+ }
105
+ },
106
+ align: {
107
+ type: String,
108
+ default: function _default() {
109
+ return (0, _ui.getConfig)().form.align;
110
+ }
111
+ },
112
+ titleBold: {
113
+ type: Boolean,
114
+ default: function _default() {
115
+ return (0, _ui.getConfig)().form.titleBold;
116
+ }
117
+ },
118
+ titleAlign: {
119
+ type: String,
120
+ default: function _default() {
121
+ return (0, _ui.getConfig)().form.titleAlign;
122
+ }
123
+ },
124
+ titleWidth: {
125
+ type: [String, Number],
126
+ default: function _default() {
127
+ return (0, _ui.getConfig)().form.titleWidth;
128
+ }
129
+ },
130
+ titleColon: {
131
+ type: Boolean,
132
+ default: function _default() {
133
+ return (0, _ui.getConfig)().form.titleColon;
134
+ }
135
+ },
136
+ titleAsterisk: {
137
+ type: Boolean,
138
+ default: function _default() {
139
+ return (0, _ui.getConfig)().form.titleAsterisk;
140
+ }
141
+ },
142
+ titleOverflow: {
143
+ type: [Boolean, String],
144
+ default: function _default() {
145
+ return (0, _ui.getConfig)().form.titleOverflow;
146
+ }
147
+ },
148
+ vertical: {
149
+ type: Boolean,
150
+ default: function _default() {
151
+ return (0, _ui.getConfig)().form.vertical;
152
+ }
153
+ },
154
+ padding: {
155
+ type: Boolean,
156
+ default: function _default() {
157
+ return (0, _ui.getConfig)().form.padding;
158
+ }
159
+ },
160
+ className: [String, Function],
161
+ readonly: Boolean,
162
+ disabled: Boolean,
163
+ items: Array,
164
+ rules: Object,
165
+ preventSubmit: {
166
+ type: Boolean,
167
+ default: function _default() {
168
+ return (0, _ui.getConfig)().form.preventSubmit;
169
+ }
170
+ },
171
+ validConfig: Object,
172
+ tooltipConfig: Object,
173
+ customLayout: {
174
+ type: Boolean,
175
+ default: function _default() {
176
+ return (0, _ui.getConfig)().form.customLayout;
177
+ }
178
+ }
179
+ },
180
+ inject: {
181
+ $xeGrid: {
182
+ default: null
183
+ }
184
+ },
185
+ provide: function provide() {
186
+ var $xeForm = this;
187
+ return {
188
+ $xeForm: $xeForm,
189
+ xeFormItemInfo: null,
190
+ $xeFormGather: null,
191
+ $xeFormItem: null
192
+ };
193
+ },
194
+ data: function data() {
195
+ var xID = _xeUtils.default.uniqueId();
196
+ var reactData = {
197
+ collapseAll: false,
198
+ staticItems: [],
199
+ formItems: []
200
+ };
201
+ var internalData = {
202
+ meTimeout: undefined,
203
+ stTimeout: undefined,
204
+ tooltipStore: {
205
+ item: null,
206
+ visible: false
207
+ }
208
+ };
209
+ return {
210
+ xID: xID,
211
+ reactData: reactData,
212
+ internalData: internalData
213
+ };
214
+ },
215
+ computed: Object.assign(Object.assign({}, {}), {
216
+ computeValidOpts: function computeValidOpts() {
217
+ var $xeForm = this;
218
+ var props = $xeForm;
219
+ return Object.assign({}, (0, _ui.getConfig)().form.validConfig, props.validConfig);
220
+ },
221
+ computeTooltipOpts: function computeTooltipOpts() {
222
+ var $xeForm = this;
223
+ var props = $xeForm;
224
+ return Object.assign({}, (0, _ui.getConfig)().tooltip, (0, _ui.getConfig)().form.tooltipConfig, props.tooltipConfig);
225
+ }
226
+ }),
227
+ methods: {
228
+ //
229
+ // Method
230
+ //
231
+ dispatchEvent: function dispatchEvent(type, params, evnt) {
232
+ var $xeForm = this;
233
+ $xeForm.$emit(type, (0, _ui.createEvent)(evnt, {
234
+ $form: $xeForm
235
+ }, params));
236
+ },
237
+ callSlot: function callSlot(slotFunc, params) {
238
+ var $xeForm = this;
239
+ var slots = $xeForm.$scopedSlots;
240
+ if (slotFunc) {
241
+ if (_xeUtils.default.isString(slotFunc)) {
242
+ slotFunc = slots[slotFunc] || null;
243
+ }
244
+ if (_xeUtils.default.isFunction(slotFunc)) {
245
+ return (0, _vn.getSlotVNs)(slotFunc(params));
246
+ }
247
+ }
248
+ return [];
249
+ },
250
+ loadItem: function loadItem(list) {
251
+ var $xeForm = this;
252
+ var slots = $xeForm.$scopedSlots;
253
+ var reactData = $xeForm.reactData;
254
+ if (list.length) {
255
+ if (process.env.NODE_ENV === 'development') {
256
+ list.forEach(function (item) {
257
+ if (item.slots) {
258
+ _xeUtils.default.each(item.slots, function (func) {
259
+ if (!_xeUtils.default.isFunction(func)) {
260
+ if (!slots[func]) {
261
+ (0, _log.errLog)('vxe.error.notSlot', [func]);
262
+ }
263
+ }
264
+ });
265
+ }
266
+ });
267
+ }
268
+ }
269
+ reactData.staticItems = _xeUtils.default.mapTree(list, function (item) {
270
+ return (0, _util.createItem)($xeForm, item);
271
+ }, {
272
+ children: 'children'
273
+ });
274
+ return $xeForm.$nextTick();
275
+ },
276
+ getItems: function getItems() {
277
+ var $xeForm = this;
278
+ var reactData = $xeForm.reactData;
279
+ var itemList = [];
280
+ _xeUtils.default.eachTree(reactData.formItems, function (item) {
281
+ itemList.push(item);
282
+ }, {
283
+ children: 'children'
284
+ });
285
+ return itemList;
286
+ },
287
+ getItemByField: function getItemByField(field) {
288
+ var $xeForm = this;
289
+ var reactData = $xeForm.reactData;
290
+ var rest = _xeUtils.default.findTree(reactData.formItems, function (item) {
291
+ return item.field === field;
292
+ }, {
293
+ children: 'children'
294
+ });
295
+ return rest ? rest.item : null;
296
+ },
297
+ getCollapseStatus: function getCollapseStatus() {
298
+ var $xeForm = this;
299
+ var reactData = $xeForm.reactData;
300
+ return reactData.collapseAll;
301
+ },
302
+ toggleCollapse: function toggleCollapse() {
303
+ var $xeForm = this;
304
+ var reactData = $xeForm.reactData;
305
+ var status = !$xeForm.getCollapseStatus();
306
+ reactData.collapseAll = status;
307
+ $xeForm.$emit('update:collapseStatus', status);
308
+ return $xeForm.$nextTick();
309
+ },
310
+ toggleCollapseEvent: function toggleCollapseEvent(evnt) {
311
+ var $xeForm = this;
312
+ var props = $xeForm;
313
+ $xeForm.toggleCollapse();
314
+ var status = $xeForm.getCollapseStatus();
315
+ $xeForm.dispatchEvent('toggle-collapse', {
316
+ status: status,
317
+ collapse: status,
318
+ data: props.data
319
+ }, evnt);
320
+ $xeForm.dispatchEvent('collapse', {
321
+ status: status,
322
+ collapse: status,
323
+ data: props.data
324
+ }, evnt);
325
+ },
326
+ clearValidate: function clearValidate(fieldOrItem) {
327
+ var $xeForm = this;
328
+ if (fieldOrItem) {
329
+ var fields = fieldOrItem;
330
+ if (!_xeUtils.default.isArray(fieldOrItem)) {
331
+ fields = [fieldOrItem];
332
+ }
333
+ fields.forEach(function (field) {
334
+ if (field) {
335
+ var item = (0, _util.handleFieldOrItem)($xeForm, field);
336
+ if (item) {
337
+ item.showError = false;
338
+ }
339
+ }
340
+ });
341
+ } else {
342
+ $xeForm.getItems().forEach(function (item) {
343
+ item.showError = false;
344
+ });
345
+ }
346
+ return $xeForm.$nextTick();
347
+ },
348
+ reset: function reset() {
349
+ var $xeForm = this;
350
+ var props = $xeForm;
351
+ var data = props.data;
352
+ var itemList = $xeForm.getItems();
353
+ if (data) {
354
+ itemList.forEach(function (item) {
355
+ var field = item.field,
356
+ resetValue = item.resetValue,
357
+ itemRender = item.itemRender;
358
+ if ((0, _utils.isEnableConf)(itemRender)) {
359
+ var compConf = _ui.renderer.get(itemRender.name);
360
+ var fiResetMethod = compConf ? compConf.formItemResetMethod || compConf.itemResetMethod : null;
361
+ if (compConf && fiResetMethod) {
362
+ fiResetMethod({
363
+ data: data,
364
+ field: field,
365
+ property: field,
366
+ item: item,
367
+ $form: $xeForm,
368
+ $grid: $xeForm.xegrid
369
+ });
370
+ } else if (field) {
371
+ _xeUtils.default.set(data, field, resetValue === null ? getResetValue(_xeUtils.default.get(data, field), undefined) : _xeUtils.default.clone(resetValue, true));
372
+ }
373
+ }
374
+ });
375
+ }
376
+ return $xeForm.clearValidate();
377
+ },
378
+ resetEvent: function resetEvent(evnt) {
379
+ var $xeForm = this;
380
+ var props = $xeForm;
381
+ evnt.preventDefault();
382
+ $xeForm.reset();
383
+ $xeForm.dispatchEvent('reset', {
384
+ data: props.data
385
+ }, evnt);
386
+ },
387
+ handleFocus: function handleFocus(fields) {
388
+ var $xeForm = this;
389
+ var props = $xeForm;
390
+ var $xeGrid = $xeForm.$xeGrid;
391
+ var el = $xeForm.$refs.refElem;
392
+ if (el) {
393
+ for (var i = 0; i < fields.length; i++) {
394
+ var field = fields[i];
395
+ var item = $xeForm.getItemByField(field);
396
+ if (item && (0, _utils.isEnableConf)(item.itemRender)) {
397
+ var itemRender = item.itemRender;
398
+ var compConf = _ui.renderer.get(itemRender.name);
399
+ // 定位到第一个
400
+ if (!i) {
401
+ (0, _dom.scrollToView)(el.querySelector(".".concat(item.id)));
402
+ }
403
+ var inputElem = null;
404
+ var autoFocus = itemRender.autoFocus || itemRender.autofocus || (compConf ? compConf.formItemAutoFocus : null);
405
+ // 如果指定了聚焦 class
406
+ if (_xeUtils.default.isFunction(autoFocus)) {
407
+ inputElem = autoFocus({
408
+ $form: $xeForm,
409
+ $grid: $xeGrid,
410
+ item: item,
411
+ data: props.data,
412
+ field: field
413
+ });
414
+ } else if (autoFocus) {
415
+ inputElem = el.querySelector(".".concat(item.id, " ").concat(autoFocus));
416
+ }
417
+ if (inputElem) {
418
+ inputElem.focus();
419
+ break;
420
+ }
421
+ }
422
+ }
423
+ }
424
+ },
425
+ /**
426
+ * 校验数据
427
+ * 按表格行、列顺序依次校验(同步或异步)
428
+ * 校验规则根据索引顺序依次校验,如果是异步则会等待校验完成才会继续校验下一列
429
+ * 如果校验失败则,触发回调或者 Promise<(ErrMap 校验不通过列的信息)>
430
+ * 如果是传回调方式这返回一个 (ErrMap 校验不通过列的信息)
431
+ *
432
+ * rule 配置:
433
+ * required=Boolean 是否必填
434
+ * min=Number 最小长度
435
+ * max=Number 最大长度
436
+ * validator=Function({ itemValue, rule, rules, data, property }) 自定义校验,接收一个 Promise
437
+ * trigger=change 触发方式
438
+ */
439
+ validItemRules: function validItemRules(validType, fields, val) {
440
+ var $xeForm = this;
441
+ var props = $xeForm;
442
+ var data = props.data,
443
+ formRules = props.rules;
444
+ var errorMaps = {};
445
+ if (!_xeUtils.default.isArray(fields)) {
446
+ fields = [fields];
447
+ }
448
+ return Promise.all(fields.map(function (property) {
449
+ var errorRules = [];
450
+ var syncVailds = [];
451
+ if (property && formRules) {
452
+ var rules = _xeUtils.default.get(formRules, property);
453
+ if (rules) {
454
+ var itemValue = _xeUtils.default.isUndefined(val) ? _xeUtils.default.get(data, property) : val;
455
+ rules.forEach(function (rule) {
456
+ var type = rule.type,
457
+ trigger = rule.trigger,
458
+ required = rule.required,
459
+ validator = rule.validator;
460
+ if (validType === 'all' || !trigger || validType === trigger) {
461
+ if (validator) {
462
+ var validParams = {
463
+ itemValue: itemValue,
464
+ rule: rule,
465
+ rules: rules,
466
+ data: data,
467
+ field: property,
468
+ property: property,
469
+ $form: $xeForm
470
+ };
471
+ var customValid;
472
+ if (_xeUtils.default.isString(validator)) {
473
+ var gvItem = _ui.validators.get(validator);
474
+ if (gvItem) {
475
+ var validatorMethod = gvItem.formItemValidatorMethod || gvItem.itemValidatorMethod;
476
+ if (validatorMethod) {
477
+ customValid = validatorMethod(validParams);
478
+ } else {
479
+ if (process.env.NODE_ENV === 'development') {
480
+ (0, _log.warnLog)('vxe.error.notValidators', [validator]);
481
+ }
482
+ }
483
+ } else {
484
+ if (process.env.NODE_ENV === 'development') {
485
+ (0, _log.errLog)('vxe.error.notValidators', [validator]);
486
+ }
487
+ }
488
+ } else {
489
+ customValid = validator(validParams);
490
+ }
491
+ if (customValid) {
492
+ if (_xeUtils.default.isError(customValid)) {
493
+ errorRules.push(new Rule({
494
+ type: 'custom',
495
+ trigger: trigger,
496
+ content: customValid.message,
497
+ rule: new Rule(rule)
498
+ }));
499
+ } else if (customValid.catch) {
500
+ // 如果为异步校验(注:异步校验是并发无序的)
501
+ syncVailds.push(customValid.catch(function (e) {
502
+ errorRules.push(new Rule({
503
+ type: 'custom',
504
+ trigger: trigger,
505
+ content: e ? e.message : rule.content || rule.message,
506
+ rule: new Rule(rule)
507
+ }));
508
+ }));
509
+ }
510
+ }
511
+ } else {
512
+ var isArrType = type === 'array';
513
+ var isArrVal = _xeUtils.default.isArray(itemValue);
514
+ var hasEmpty = true;
515
+ if (isArrType || isArrVal) {
516
+ hasEmpty = !isArrVal || !itemValue.length;
517
+ } else if (_xeUtils.default.isString(itemValue)) {
518
+ hasEmpty = (0, _utils.eqEmptyValue)(itemValue.trim());
519
+ } else {
520
+ hasEmpty = (0, _utils.eqEmptyValue)(itemValue);
521
+ }
522
+ if (required ? hasEmpty || validErrorRuleValue(rule, itemValue) : !hasEmpty && validErrorRuleValue(rule, itemValue)) {
523
+ errorRules.push(new Rule(rule));
524
+ }
525
+ }
526
+ }
527
+ });
528
+ }
529
+ }
530
+ return Promise.all(syncVailds).then(function () {
531
+ if (errorRules.length) {
532
+ errorMaps[property] = errorRules.map(function (rule) {
533
+ return {
534
+ $form: $xeForm,
535
+ rule: rule,
536
+ data: data,
537
+ field: property,
538
+ property: property
539
+ };
540
+ });
541
+ }
542
+ });
543
+ })).then(function () {
544
+ if (!_xeUtils.default.isEmpty(errorMaps)) {
545
+ return Promise.reject(errorMaps);
546
+ }
547
+ });
548
+ },
549
+ beginValidate: function beginValidate(itemList, type, callback) {
550
+ var $xeForm = this;
551
+ var props = $xeForm;
552
+ var internalData = $xeForm.internalData;
553
+ var data = props.data,
554
+ formRules = props.rules;
555
+ var validOpts = $xeForm.computeValidOpts;
556
+ var validRest = {};
557
+ var validFields = [];
558
+ var itemValids = [];
559
+ clearTimeout(internalData.meTimeout);
560
+ if (data && formRules) {
561
+ itemList.forEach(function (item) {
562
+ var field = item.field;
563
+ if (field && !(0, _util.isHiddenItem)($xeForm, item) && (0, _util.isActiveItem)($xeForm, item)) {
564
+ itemValids.push($xeForm.validItemRules(type || 'all', field).then(function () {
565
+ item.errRule = null;
566
+ }).catch(function (errorMaps) {
567
+ var rest = errorMaps[field];
568
+ if (!validRest[field]) {
569
+ validRest[field] = [];
570
+ }
571
+ validRest[field].push(rest);
572
+ validFields.push(field);
573
+ item.errRule = rest[0].rule;
574
+ return Promise.reject(rest);
575
+ }));
576
+ }
577
+ });
578
+ return Promise.all(itemValids).then(function () {
579
+ if (callback) {
580
+ callback();
581
+ }
582
+ }).catch(function () {
583
+ return new Promise(function (resolve) {
584
+ internalData.meTimeout = window.setTimeout(function () {
585
+ itemList.forEach(function (item) {
586
+ if (item.errRule) {
587
+ item.showError = true;
588
+ }
589
+ });
590
+ }, 20);
591
+ if (validOpts.autoPos !== false) {
592
+ $xeForm.$nextTick(function () {
593
+ $xeForm.handleFocus(validFields);
594
+ });
595
+ }
596
+ if (callback) {
597
+ callback(validRest);
598
+ resolve();
599
+ } else {
600
+ resolve(validRest);
601
+ }
602
+ });
603
+ });
604
+ }
605
+ if (callback) {
606
+ callback();
607
+ }
608
+ return Promise.resolve();
609
+ },
610
+ validate: function validate(callback) {
611
+ var $xeForm = this;
612
+ var props = $xeForm;
613
+ var readonly = props.readonly;
614
+ $xeForm.clearValidate();
615
+ if (readonly) {
616
+ return $xeForm.$nextTick();
617
+ }
618
+ return $xeForm.beginValidate($xeForm.getItems(), '', callback);
619
+ },
620
+ validateField: function validateField(fieldOrItem, callback) {
621
+ var $xeForm = this;
622
+ var props = $xeForm;
623
+ var readonly = props.readonly;
624
+ if (readonly) {
625
+ return $xeForm.$nextTick();
626
+ }
627
+ var fields = [];
628
+ if (fieldOrItem) {
629
+ if (_xeUtils.default.isArray(fieldOrItem)) {
630
+ fields = fieldOrItem;
631
+ } else {
632
+ fields = [fieldOrItem];
633
+ }
634
+ }
635
+ return $xeForm.beginValidate(fields.map(function (field) {
636
+ return (0, _util.handleFieldOrItem)($xeForm, field);
637
+ }), '', callback);
638
+ },
639
+ submitEvent: function submitEvent(evnt) {
640
+ var $xeForm = this;
641
+ var props = $xeForm;
642
+ var readonly = props.readonly;
643
+ evnt.preventDefault();
644
+ if (!props.preventSubmit) {
645
+ $xeForm.clearValidate();
646
+ if (readonly) {
647
+ $xeForm.dispatchEvent('submit', {
648
+ data: props.data
649
+ }, evnt);
650
+ return;
651
+ }
652
+ $xeForm.beginValidate($xeForm.getItems()).then(function (errMap) {
653
+ if (errMap) {
654
+ $xeForm.dispatchEvent('submit-invalid', {
655
+ data: props.data,
656
+ errMap: errMap
657
+ }, evnt);
658
+ } else {
659
+ $xeForm.dispatchEvent('submit', {
660
+ data: props.data
661
+ }, evnt);
662
+ }
663
+ });
664
+ }
665
+ },
666
+ closeTooltip: function closeTooltip() {
667
+ var $xeForm = this;
668
+ var internalData = $xeForm.internalData;
669
+ var tooltipStore = internalData.tooltipStore;
670
+ var $tooltip = $xeForm.$refs.refTooltip;
671
+ if (tooltipStore.visible) {
672
+ Object.assign(tooltipStore, {
673
+ item: null,
674
+ visible: false
675
+ });
676
+ if ($tooltip) {
677
+ $tooltip.close();
678
+ }
679
+ }
680
+ return $xeForm.$nextTick();
681
+ },
682
+ triggerTitleTipEvent: function triggerTitleTipEvent(evnt, params) {
683
+ var $xeForm = this;
684
+ var internalData = $xeForm.internalData;
685
+ var item = params.item;
686
+ var tooltipStore = internalData.tooltipStore;
687
+ var $tooltip = $xeForm.$refs.refTooltip;
688
+ var overflowElem = evnt.currentTarget.children[0];
689
+ var content = (overflowElem.textContent || '').trim();
690
+ var isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth;
691
+ clearTimeout(internalData.stTimeout);
692
+ if (tooltipStore.item !== item) {
693
+ $xeForm.closeTooltip();
694
+ }
695
+ if (content && isCellOverflow) {
696
+ Object.assign(tooltipStore, {
697
+ item: item,
698
+ visible: true
699
+ });
700
+ if ($tooltip) {
701
+ $tooltip.open(overflowElem, content);
702
+ }
703
+ }
704
+ },
705
+ handleTitleTipLeaveEvent: function handleTitleTipLeaveEvent() {
706
+ var $xeForm = this;
707
+ var internalData = $xeForm.internalData;
708
+ var tooltipOpts = $xeForm.computeTooltipOpts;
709
+ var $tooltip = $xeForm.$refs.refTooltip;
710
+ if ($tooltip) {
711
+ $tooltip.setActived(false);
712
+ }
713
+ if (tooltipOpts.enterable) {
714
+ internalData.stTimeout = setTimeout(function () {
715
+ $tooltip = $xeForm.$refs.refTooltip;
716
+ if ($tooltip && !$tooltip.isActived()) {
717
+ $xeForm.closeTooltip();
718
+ }
719
+ }, tooltipOpts.leaveDelay);
720
+ } else {
721
+ $xeForm.closeTooltip();
722
+ }
723
+ },
724
+ triggerItemEvent: function triggerItemEvent(evnt, field, itemValue) {
725
+ var $xeForm = this;
726
+ if (field) {
727
+ return $xeForm.validItemRules(evnt ? ['blur'].includes(evnt.type) ? 'blur' : 'change' : 'all', field, itemValue).then(function () {
728
+ $xeForm.clearValidate(field);
729
+ }).catch(function (errorMaps) {
730
+ var rest = errorMaps[field];
731
+ var item = $xeForm.getItemByField(field);
732
+ if (rest && item) {
733
+ item.showError = true;
734
+ item.errRule = rest[0].rule;
735
+ }
736
+ });
737
+ }
738
+ return $xeForm.$nextTick();
739
+ },
740
+ /**
741
+ * 更新项状态
742
+ * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一项编辑状态
743
+ * 如果单元格配置了校验规则,则会进行校验
744
+ */
745
+ updateStatus: function updateStatus(scope, itemValue) {
746
+ var $xeForm = this;
747
+ var field = scope.field;
748
+ return $xeForm.triggerItemEvent(new Event('change'), field, itemValue);
749
+ },
750
+ //
751
+ // Render
752
+ //
753
+ renderVN: function renderVN(h) {
754
+ var $xeForm = this;
755
+ var props = $xeForm;
756
+ var slots = $xeForm.$scopedSlots;
757
+ var reactData = $xeForm.reactData;
758
+ var loading = props.loading,
759
+ className = props.className,
760
+ data = props.data,
761
+ customLayout = props.customLayout;
762
+ var formItems = reactData.formItems;
763
+ // const formItems: any[] = []
764
+ var vSize = $xeForm.computeSize;
765
+ var tooltipOpts = $xeForm.computeTooltipOpts;
766
+ var defaultSlot = slots.default;
767
+ return h('form', {
768
+ ref: 'refElem',
769
+ class: ['vxe-form', className ? _xeUtils.default.isFunction(className) ? className({
770
+ items: formItems,
771
+ data: data,
772
+ $form: $xeForm
773
+ }) : className : '', _defineProperty(_defineProperty(_defineProperty({}, "size--".concat(vSize), vSize), 'custom--layout', customLayout), 'is--loading', loading)],
774
+ on: {
775
+ submit: $xeForm.submitEvent,
776
+ reset: $xeForm.resetEvent
777
+ }
778
+ }, [h('div', {
779
+ class: 'vxe-form--wrapper vxe-form--item-row'
780
+ }, customLayout ? defaultSlot ? defaultSlot({}) : [] : formItems.map(function (item, index) {
781
+ return h(_formConfigItem.default, {
782
+ key: index,
783
+ props: {
784
+ itemConfig: item
785
+ }
786
+ });
787
+ })), h('div', {
788
+ class: 'vxe-form-slots',
789
+ ref: 'hideItem'
790
+ }, customLayout ? [] : defaultSlot ? defaultSlot({}) : []),
791
+ /**
792
+ * 加载中
793
+ */
794
+ h(_loading.default, {
795
+ class: 'vxe-form--loading',
796
+ props: {
797
+ value: loading
798
+ }
799
+ }),
800
+ /**
801
+ * 工具提示
802
+ */
803
+ h(_tooltip.default, Object.assign({
804
+ ref: 'refTooltip'
805
+ }, tooltipOpts))]);
806
+ }
807
+ },
808
+ watch: {
809
+ 'reactData.staticItems': function reactDataStaticItems() {
810
+ var $xeForm = this;
811
+ var reactData = $xeForm.reactData;
812
+ reactData.formItems = reactData.staticItems;
813
+ },
814
+ items: function items() {
815
+ var $xeForm = this;
816
+ var props = $xeForm;
817
+ $xeForm.loadItem(props.items || []);
818
+ },
819
+ collapseStatus: function collapseStatus(val) {
820
+ var $xeForm = this;
821
+ var reactData = $xeForm.reactData;
822
+ reactData.collapseAll = !!val;
823
+ },
824
+ readonly: function readonly() {
825
+ var $xeForm = this;
826
+ $xeForm.clearValidate();
827
+ },
828
+ disabled: function disabled() {
829
+ var $xeForm = this;
830
+ $xeForm.clearValidate();
831
+ }
832
+ },
833
+ created: function created() {
834
+ var $xeForm = this;
835
+ var props = $xeForm;
836
+ var reactData = $xeForm.reactData;
837
+ reactData.collapseAll = !!props.collapseStatus;
838
+ if (props.items) {
839
+ $xeForm.loadItem(props.items);
840
+ }
841
+ },
842
+ mounted: function mounted() {
843
+ var $xeForm = this;
844
+ var props = $xeForm;
845
+ $xeForm.$nextTick(function () {
846
+ if (process.env.NODE_ENV === 'development') {
847
+ if (props.customLayout && props.items) {
848
+ (0, _log.errLog)('vxe.error.errConflicts', ['custom-layout', 'items']);
849
+ }
850
+ }
851
+ });
852
+ },
853
+ render: function render(h) {
854
+ return this.renderVN(h);
855
+ }
856
+ });