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,373 @@
1
+ import { defineVxeComponent } from '../../ui/src/comp';
2
+ import XEUtils from 'xe-utils';
3
+ import { getConfig, globalEvents, globalResize, createEvent, globalMixins } from '../../ui';
4
+ import { browse } from '../../ui/src/dom';
5
+ import VxeLoadingComponent from '../../loading/src/loading';
6
+ export default defineVxeComponent({
7
+ name: 'VxeList',
8
+ mixins: [
9
+ globalMixins.sizeMixin
10
+ ],
11
+ props: {
12
+ data: Array,
13
+ height: [Number, String],
14
+ maxHeight: [Number, String],
15
+ loading: Boolean,
16
+ className: [String, Function],
17
+ size: { type: String, default: () => getConfig().list.size || getConfig().size },
18
+ autoResize: { type: Boolean, default: () => getConfig().list.autoResize },
19
+ syncResize: [Boolean, String, Number],
20
+ scrollY: Object
21
+ },
22
+ data() {
23
+ const xID = XEUtils.uniqueId();
24
+ const reactData = {
25
+ scrollYLoad: false,
26
+ bodyHeight: 0,
27
+ rowHeight: 0,
28
+ topSpaceHeight: 0,
29
+ items: []
30
+ };
31
+ const internalData = {
32
+ resizeObserver: undefined,
33
+ fullData: [],
34
+ lastScrollLeft: 0,
35
+ lastScrollTop: 0,
36
+ scrollYStore: {
37
+ startIndex: 0,
38
+ endIndex: 0,
39
+ visibleSize: 0,
40
+ offsetSize: 0,
41
+ rowHeight: 0
42
+ }
43
+ };
44
+ return {
45
+ xID,
46
+ reactData,
47
+ internalData
48
+ };
49
+ },
50
+ computed: Object.assign(Object.assign({}, {}), { computeSYOpts() {
51
+ const $xeList = this;
52
+ const props = $xeList;
53
+ return Object.assign({}, getConfig().list.scrollY, props.scrollY);
54
+ },
55
+ computeStyles() {
56
+ const $xeList = this;
57
+ const props = $xeList;
58
+ const { height, maxHeight } = props;
59
+ const style = {};
60
+ if (height) {
61
+ style.height = `${isNaN(height) ? height : `${height}px`}`;
62
+ }
63
+ else if (maxHeight) {
64
+ style.height = 'auto';
65
+ style.maxHeight = `${isNaN(maxHeight) ? maxHeight : `${maxHeight}px`}`;
66
+ }
67
+ return style;
68
+ } }),
69
+ methods: {
70
+ //
71
+ // Method
72
+ //
73
+ dispatchEvent(type, params, evnt) {
74
+ const $xeList = this;
75
+ $xeList.$emit(type, createEvent(evnt, { $list: $xeList }, params));
76
+ },
77
+ /**
78
+ * 加载数据
79
+ * @param {Array} datas 数据
80
+ */
81
+ loadData(datas) {
82
+ const $xeList = this;
83
+ const reactData = $xeList.reactData;
84
+ const internalData = $xeList.internalData;
85
+ const { scrollYStore } = internalData;
86
+ const sYOpts = $xeList.computeSYOpts;
87
+ const fullData = datas || [];
88
+ Object.assign(scrollYStore, {
89
+ startIndex: 0,
90
+ endIndex: 1,
91
+ visibleSize: 0
92
+ });
93
+ internalData.fullData = fullData;
94
+ // 如果gt为0,则总是启用
95
+ reactData.scrollYLoad = !!sYOpts.enabled && sYOpts.gt > -1 && (sYOpts.gt === 0 || sYOpts.gt <= fullData.length);
96
+ $xeList.handleData();
97
+ return $xeList.computeScrollLoad().then(() => {
98
+ $xeList.refreshScroll();
99
+ });
100
+ },
101
+ /**
102
+ * 重新加载数据
103
+ * @param {Array} datas 数据
104
+ */
105
+ reloadData(datas) {
106
+ const $xeList = this;
107
+ $xeList.clearScroll();
108
+ return $xeList.loadData(datas);
109
+ },
110
+ updateYSpace() {
111
+ const $xeList = this;
112
+ const reactData = $xeList.reactData;
113
+ const internalData = $xeList.internalData;
114
+ const { scrollYLoad } = reactData;
115
+ const { scrollYStore, fullData } = internalData;
116
+ reactData.bodyHeight = scrollYLoad ? fullData.length * scrollYStore.rowHeight : 0;
117
+ reactData.topSpaceHeight = scrollYLoad ? Math.max(scrollYStore.startIndex * scrollYStore.rowHeight, 0) : 0;
118
+ },
119
+ handleData() {
120
+ const $xeList = this;
121
+ const reactData = $xeList.reactData;
122
+ const internalData = $xeList.internalData;
123
+ const { scrollYLoad } = reactData;
124
+ const { fullData, scrollYStore } = internalData;
125
+ reactData.items = scrollYLoad ? fullData.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullData.slice(0);
126
+ return $xeList.$nextTick();
127
+ },
128
+ updateYData() {
129
+ const $xeList = this;
130
+ $xeList.handleData();
131
+ $xeList.updateYSpace();
132
+ },
133
+ computeScrollLoad() {
134
+ const $xeList = this;
135
+ const reactData = $xeList.reactData;
136
+ const internalData = $xeList.internalData;
137
+ return $xeList.$nextTick().then(() => {
138
+ const { scrollYLoad } = reactData;
139
+ const { scrollYStore } = internalData;
140
+ const virtualBodyElem = $xeList.$refs.refVirtualBody;
141
+ const sYOpts = $xeList.computeSYOpts;
142
+ let rowHeight = 0;
143
+ let firstItemElem;
144
+ if (virtualBodyElem) {
145
+ if (sYOpts.sItem) {
146
+ firstItemElem = virtualBodyElem.querySelector(sYOpts.sItem);
147
+ }
148
+ if (!firstItemElem) {
149
+ firstItemElem = virtualBodyElem.children[0];
150
+ }
151
+ }
152
+ if (firstItemElem) {
153
+ rowHeight = firstItemElem.offsetHeight;
154
+ }
155
+ rowHeight = Math.max(20, rowHeight);
156
+ scrollYStore.rowHeight = rowHeight;
157
+ // 计算 Y 逻辑
158
+ if (scrollYLoad) {
159
+ const scrollBodyElem = $xeList.$refs.refVirtualWrapper;
160
+ const visibleYSize = Math.max(8, Math.ceil(scrollBodyElem.clientHeight / rowHeight));
161
+ const offsetYSize = sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : (browse.edge ? 10 : 0);
162
+ scrollYStore.offsetSize = offsetYSize;
163
+ scrollYStore.visibleSize = visibleYSize;
164
+ scrollYStore.endIndex = Math.max(scrollYStore.startIndex, visibleYSize + offsetYSize, scrollYStore.endIndex);
165
+ $xeList.updateYData();
166
+ }
167
+ else {
168
+ $xeList.updateYSpace();
169
+ }
170
+ reactData.rowHeight = rowHeight;
171
+ });
172
+ },
173
+ /**
174
+ * 清除滚动条
175
+ */
176
+ clearScroll() {
177
+ const $xeList = this;
178
+ const scrollBodyElem = $xeList.$refs.refVirtualWrapper;
179
+ if (scrollBodyElem) {
180
+ scrollBodyElem.scrollTop = 0;
181
+ }
182
+ return $xeList.$nextTick();
183
+ },
184
+ /**
185
+ * 如果有滚动条,则滚动到对应的位置
186
+ * @param {Number} scrollLeft 左距离
187
+ * @param {Number} scrollTop 上距离
188
+ */
189
+ scrollTo(scrollLeft, scrollTop) {
190
+ const $xeList = this;
191
+ const reactData = $xeList.reactData;
192
+ const scrollBodyElem = $xeList.$refs.refVirtualWrapper;
193
+ if (XEUtils.isNumber(scrollLeft)) {
194
+ scrollBodyElem.scrollLeft = scrollLeft;
195
+ }
196
+ if (XEUtils.isNumber(scrollTop)) {
197
+ scrollBodyElem.scrollTop = scrollTop;
198
+ }
199
+ if (reactData.scrollYLoad) {
200
+ return new Promise(resolve => {
201
+ setTimeout(() => {
202
+ $xeList.$nextTick(() => {
203
+ resolve();
204
+ });
205
+ }, 50);
206
+ });
207
+ }
208
+ return $xeList.$nextTick();
209
+ },
210
+ /**
211
+ * 刷新滚动条
212
+ */
213
+ refreshScroll() {
214
+ const $xeList = this;
215
+ const internalData = $xeList.internalData;
216
+ const { lastScrollLeft, lastScrollTop } = internalData;
217
+ return $xeList.clearScroll().then(() => {
218
+ if (lastScrollLeft || lastScrollTop) {
219
+ internalData.lastScrollLeft = 0;
220
+ internalData.lastScrollTop = 0;
221
+ return scrollTo(lastScrollLeft, lastScrollTop);
222
+ }
223
+ });
224
+ },
225
+ /**
226
+ * 重新计算列表
227
+ */
228
+ recalculate() {
229
+ const $xeList = this;
230
+ const el = $xeList.$refs.refElem;
231
+ if (el.clientWidth && el.clientHeight) {
232
+ return $xeList.computeScrollLoad();
233
+ }
234
+ return Promise.resolve();
235
+ },
236
+ loadYData(evnt) {
237
+ const $xeList = this;
238
+ const internalData = $xeList.internalData;
239
+ const { scrollYStore } = internalData;
240
+ const { startIndex, endIndex, visibleSize, offsetSize, rowHeight } = scrollYStore;
241
+ const scrollBodyElem = evnt.target;
242
+ const scrollTop = scrollBodyElem.scrollTop;
243
+ const toVisibleIndex = Math.floor(scrollTop / rowHeight);
244
+ const offsetStartIndex = Math.max(0, toVisibleIndex - 1 - offsetSize);
245
+ const offsetEndIndex = toVisibleIndex + visibleSize + offsetSize;
246
+ if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
247
+ if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
248
+ scrollYStore.startIndex = offsetStartIndex;
249
+ scrollYStore.endIndex = offsetEndIndex;
250
+ $xeList.updateYData();
251
+ }
252
+ }
253
+ },
254
+ scrollEvent(evnt) {
255
+ const $xeList = this;
256
+ const reactData = $xeList.reactData;
257
+ const internalData = $xeList.internalData;
258
+ const scrollBodyElem = evnt.target;
259
+ const scrollTop = scrollBodyElem.scrollTop;
260
+ const scrollLeft = scrollBodyElem.scrollLeft;
261
+ const isX = scrollLeft !== internalData.lastScrollLeft;
262
+ const isY = scrollTop !== internalData.lastScrollTop;
263
+ internalData.lastScrollTop = scrollTop;
264
+ internalData.lastScrollLeft = scrollLeft;
265
+ if (reactData.scrollYLoad) {
266
+ $xeList.loadYData(evnt);
267
+ }
268
+ $xeList.dispatchEvent('scroll', { scrollLeft, scrollTop, isX, isY }, evnt);
269
+ },
270
+ //
271
+ // Render
272
+ //
273
+ renderVN(h) {
274
+ const $xeList = this;
275
+ const props = $xeList;
276
+ const reactData = $xeList.reactData;
277
+ const slots = $xeList.$scopedSlots;
278
+ const { className, loading } = props;
279
+ const { bodyHeight, topSpaceHeight, items } = reactData;
280
+ const defaultSlot = slots.default;
281
+ const vSize = $xeList.computeSize;
282
+ const styles = $xeList.computeStyles;
283
+ return h('div', {
284
+ ref: 'refElem',
285
+ class: ['vxe-list', className ? (XEUtils.isFunction(className) ? className({ $list: $xeList }) : className) : '', {
286
+ [`size--${vSize}`]: vSize,
287
+ 'is--loading': loading
288
+ }]
289
+ }, [
290
+ h('div', {
291
+ ref: 'refVirtualWrapper',
292
+ class: 'vxe-list--virtual-wrapper',
293
+ style: styles,
294
+ on: {
295
+ scroll: $xeList.scrollEvent
296
+ }
297
+ }, [
298
+ h('div', {
299
+ class: 'vxe-list--y-space',
300
+ style: {
301
+ height: bodyHeight ? `${bodyHeight}px` : ''
302
+ }
303
+ }),
304
+ h('div', {
305
+ ref: 'refVirtualBody',
306
+ class: 'vxe-list--body',
307
+ style: {
308
+ marginTop: topSpaceHeight ? `${topSpaceHeight}px` : ''
309
+ }
310
+ }, defaultSlot ? defaultSlot({ items, $list: $xeList }) : [])
311
+ ]),
312
+ /**
313
+ * 加载中
314
+ */
315
+ h(VxeLoadingComponent, {
316
+ class: 'vxe-list--loading',
317
+ props: {
318
+ value: loading
319
+ }
320
+ })
321
+ ]);
322
+ }
323
+ },
324
+ watch: {
325
+ data() {
326
+ const $xeList = this;
327
+ const props = $xeList;
328
+ $xeList.loadData(props.data || []);
329
+ },
330
+ syncResize(val) {
331
+ const $xeList = this;
332
+ if (val) {
333
+ $xeList.recalculate();
334
+ $xeList.$nextTick(() => setTimeout(() => $xeList.recalculate()));
335
+ }
336
+ }
337
+ },
338
+ created() {
339
+ const $xeList = this;
340
+ const props = $xeList;
341
+ globalEvents.on($xeList, 'resize', () => {
342
+ $xeList.recalculate();
343
+ });
344
+ $xeList.loadData(props.data || []);
345
+ },
346
+ mounted() {
347
+ const $xeList = this;
348
+ const props = $xeList;
349
+ const internalData = $xeList.internalData;
350
+ if (props.autoResize) {
351
+ const el = $xeList.$refs.refElem;
352
+ const resizeObserver = globalResize.create(() => $xeList.recalculate());
353
+ resizeObserver.observe(el);
354
+ internalData.resizeObserver = resizeObserver;
355
+ }
356
+ },
357
+ activated() {
358
+ const $xeList = this;
359
+ $xeList.recalculate().then(() => $xeList.refreshScroll());
360
+ },
361
+ beforeDestroy() {
362
+ const $xeList = this;
363
+ const internalData = $xeList.internalData;
364
+ const { resizeObserver } = internalData;
365
+ if (resizeObserver) {
366
+ resizeObserver.disconnect();
367
+ }
368
+ globalEvents.off($xeList, 'resize');
369
+ },
370
+ render(h) {
371
+ return this.renderVN(h);
372
+ }
373
+ });
@@ -0,0 +1,28 @@
1
+ .vxe-list {
2
+ position: relative;
3
+ display: block;
4
+ padding: 0;
5
+ color: var(--vxe-ui-font-color);
6
+ font-family: var(--vxe-ui-font-family);
7
+ direction: ltr;
8
+ }
9
+ .vxe-list .vxe-list--virtual-wrapper {
10
+ position: relative;
11
+ overflow: auto;
12
+ outline: 0;
13
+ }
14
+ .vxe-list .vxe-list--y-space {
15
+ width: 0;
16
+ float: left;
17
+ }
18
+ .vxe-list .vxe-list--virtual-wrapper,
19
+ .vxe-list .vxe-list--body {
20
+ padding: 0;
21
+ margin: 0;
22
+ border: 0;
23
+ outline: 0;
24
+ }
25
+
26
+ .vxe-list--virtual-wrapper {
27
+ height: 100px;
28
+ }
@@ -0,0 +1 @@
1
+ .vxe-list{position:relative;display:block;padding:0;color:var(--vxe-ui-font-color);font-family:var(--vxe-ui-font-family);direction:ltr}.vxe-list .vxe-list--virtual-wrapper{position:relative;overflow:auto;outline:0}.vxe-list .vxe-list--y-space{width:0;float:left}.vxe-list .vxe-list--body,.vxe-list .vxe-list--virtual-wrapper{padding:0;margin:0;border:0;outline:0}.vxe-list--virtual-wrapper{height:100px}
@@ -65,6 +65,11 @@ export default defineVxeComponent({
65
65
  const $xeLoading = this;
66
66
  $xeLoading.$emit(type, createEvent(evnt, { $loading: $xeLoading }, params));
67
67
  },
68
+ emitModel(value) {
69
+ const $xeLoading = this;
70
+ $xeLoading.$emit('input', value);
71
+ $xeLoading.$emit('modelValue', value);
72
+ },
68
73
  handleInit() {
69
74
  const $xeLoading = this;
70
75
  const reactData = $xeLoading.reactData;
@@ -77,6 +77,11 @@ export default defineVxeComponent({
77
77
  const $xeMenu = this;
78
78
  $xeMenu.$emit(type, createEvent(evnt, { $menu: $xeMenu }, params));
79
79
  },
80
+ emitModel(value) {
81
+ const $xeMenu = this;
82
+ $xeMenu.$emit('input', value);
83
+ $xeMenu.$emit('modelValue', value);
84
+ },
80
85
  getMenuTitle(item) {
81
86
  return `${item.title || item.name}`;
82
87
  },
@@ -159,8 +164,7 @@ export default defineVxeComponent({
159
164
  if (routerLink) {
160
165
  const value = item.itemKey;
161
166
  reactData.activeName = value;
162
- $xeMenu.$emit('input', value);
163
- $xeMenu.$emit('modelValue', value);
167
+ $xeMenu.emitModel(value);
164
168
  }
165
169
  else {
166
170
  if (hasChild) {
@@ -244,6 +244,11 @@ export default defineVxeComponent({
244
244
  const $xeModal = this;
245
245
  $xeModal.$emit(type, createEvent(evnt, { $modal: $xeModal }, params));
246
246
  },
247
+ emitModel(value) {
248
+ const $xeModal = this;
249
+ $xeModal.$emit('input', value);
250
+ $xeModal.$emit('modelValue', value);
251
+ },
247
252
  open() {
248
253
  const $xeModal = this;
249
254
  return $xeModal.openModal();
@@ -421,8 +426,7 @@ export default defineVxeComponent({
421
426
  $xeModal.dispatchEvent('before-hide', params, null);
422
427
  setTimeout(() => {
423
428
  reactData.visible = false;
424
- $xeModal.$emit('input', false);
425
- $xeModal.$emit('modelValue', false);
429
+ $xeModal.emitModel(false);
426
430
  $xeModal.dispatchEvent('hide', params, null);
427
431
  }, 200);
428
432
  $xeModal.removeBodyLockScroll();
@@ -734,8 +738,7 @@ export default defineVxeComponent({
734
738
  }
735
739
  const type = '';
736
740
  const params = { type };
737
- $xeModal.$emit('input', true);
738
- $xeModal.$emit('modelValue', true);
741
+ $xeModal.emitModel(true);
739
742
  $xeModal.dispatchEvent('show', params, null);
740
743
  });
741
744
  }, 10);
@@ -237,6 +237,10 @@ export default defineVxeComponent({
237
237
  const $xeNumberInput = this;
238
238
  $xeNumberInput.$emit(type, createEvent(evnt, { $numberInput: $xeNumberInput }, params));
239
239
  },
240
+ emitModel(value) {
241
+ const $xeModal = this;
242
+ $xeModal.$emit('modelValue', value);
243
+ },
240
244
  focus() {
241
245
  const $xeNumberInput = this;
242
246
  const reactData = $xeNumberInput.reactData;
@@ -279,7 +283,7 @@ export default defineVxeComponent({
279
283
  const { inputValue } = reactData;
280
284
  $xeNumberInput.dispatchEvent(evnt.type, { value: inputValue }, evnt);
281
285
  },
282
- emitModel(val, inputValue, evnt) {
286
+ handleChange(val, inputValue, evnt) {
283
287
  const $xeNumberInput = this;
284
288
  const props = $xeNumberInput;
285
289
  const reactData = $xeNumberInput.reactData;
@@ -289,7 +293,7 @@ export default defineVxeComponent({
289
293
  const isChange = value !== props.value;
290
294
  if (isChange) {
291
295
  reactData.inputValue = inputValue || '';
292
- $xeNumberInput.$emit('modelValue', value);
296
+ $xeNumberInput.emitModel(value);
293
297
  }
294
298
  $xeNumberInput.dispatchEvent('input', { value }, evnt);
295
299
  if (isChange) {
@@ -307,7 +311,7 @@ export default defineVxeComponent({
307
311
  const value = inputValue ? XEUtils.toNumber(inputValue) : null;
308
312
  reactData.inputValue = inputValue;
309
313
  if (inpImmediate) {
310
- $xeNumberInput.emitModel(value, inputValue, evnt);
314
+ $xeNumberInput.handleChange(value, inputValue, evnt);
311
315
  }
312
316
  else {
313
317
  $xeNumberInput.dispatchEvent('input', { value }, evnt);
@@ -344,7 +348,7 @@ export default defineVxeComponent({
344
348
  clearValueEvent(evnt, value) {
345
349
  const $xeNumberInput = this;
346
350
  $xeNumberInput.focus();
347
- $xeNumberInput.emitModel(null, '', evnt);
351
+ $xeNumberInput.handleChange(null, '', evnt);
348
352
  $xeNumberInput.dispatchEvent('clear', { value }, evnt);
349
353
  },
350
354
  clickSuffixEvent(evnt) {
@@ -375,7 +379,7 @@ export default defineVxeComponent({
375
379
  validValue = Number(textValue);
376
380
  }
377
381
  if (inputValue !== validValue) {
378
- $xeNumberInput.emitModel(validValue, textValue, { type: 'init' });
382
+ $xeNumberInput.handleChange(validValue, textValue, { type: 'init' });
379
383
  }
380
384
  }
381
385
  }
@@ -413,7 +417,7 @@ export default defineVxeComponent({
413
417
  }
414
418
  }
415
419
  const inpValue = $xeNumberInput.getNumberValue(inpNumVal);
416
- $xeNumberInput.emitModel(inpValue === null ? null : Number(inpValue), inpValue, { type: 'check' });
420
+ $xeNumberInput.handleChange(inpValue === null ? null : Number(inpValue), inpValue, { type: 'check' });
417
421
  }
418
422
  }
419
423
  },
@@ -424,7 +428,7 @@ export default defineVxeComponent({
424
428
  const inpImmediate = $xeNumberInput.computeInpImmediate;
425
429
  const value = inputValue ? Number(inputValue) : null;
426
430
  if (!inpImmediate) {
427
- $xeNumberInput.emitModel(value, `${inputValue || ''}`, evnt);
431
+ $xeNumberInput.handleChange(value, `${inputValue || ''}`, evnt);
428
432
  }
429
433
  $xeNumberInput.afterCheckValue();
430
434
  reactData.isActivated = false;