vxe-pc-ui 4.20.34 → 4.20.35

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/dist/all.esm.js +45718 -45038
  2. package/dist/all.esm.min.js +3 -3
  3. package/dist/style.css +307 -1
  4. package/dist/style.mini.css +1 -1
  5. package/es/alert/src/alert.js +117 -114
  6. package/es/anchor/src/anchor-link.js +110 -107
  7. package/es/anchor/src/anchor.js +212 -209
  8. package/es/avatar/src/avatar.js +132 -129
  9. package/es/backtop/src/backtop.js +267 -264
  10. package/es/badge/src/badge.js +102 -99
  11. package/es/breadcrumb/src/breadcrumb-item.js +104 -101
  12. package/es/breadcrumb/src/breadcrumb.js +70 -67
  13. package/es/button/src/button-group.js +88 -85
  14. package/es/calendar/src/calendar.js +1371 -1368
  15. package/es/card/src/card.js +235 -232
  16. package/es/carousel/src/carousel-item.js +78 -75
  17. package/es/carousel/src/carousel.js +392 -389
  18. package/es/cascader/src/cascader.js +1667 -1664
  19. package/es/checkbox/src/button.js +198 -195
  20. package/es/checkbox/src/checkbox.js +181 -178
  21. package/es/checkbox/src/group.js +210 -207
  22. package/es/collapse/src/collapse-pane.js +98 -95
  23. package/es/collapse/src/collapse.js +340 -337
  24. package/es/color-picker/src/color-picker.js +1116 -1113
  25. package/es/components.d.ts +1 -0
  26. package/es/components.js +3 -0
  27. package/es/context-menu/src/context-menu.js +601 -598
  28. package/es/countdown/src/countdown.js +224 -221
  29. package/es/date-panel/src/date-panel.js +1905 -1902
  30. package/es/date-picker/src/date-picker.js +1537 -1534
  31. package/es/date-range-picker/src/date-range-picker.js +1412 -1409
  32. package/es/divider/src/divider.js +80 -77
  33. package/es/drawer/src/drawer.js +778 -775
  34. package/es/empty/src/empty.js +100 -97
  35. package/es/form/src/form-group.js +74 -71
  36. package/es/form/src/form-item.js +76 -73
  37. package/es/form/src/form.js +789 -786
  38. package/es/icon/src/icon.js +59 -56
  39. package/es/icon/style.css +1 -1
  40. package/es/icon/style.mini.css +1 -1
  41. package/es/icon-picker/src/icon-picker.js +719 -716
  42. package/es/image/src/group.js +130 -127
  43. package/es/image/src/image.js +243 -240
  44. package/es/image/src/preview.js +627 -624
  45. package/es/index.esm.js +2 -0
  46. package/es/index.js +2 -0
  47. package/es/input/src/input.js +2700 -2697
  48. package/es/layout-aside/src/layout-aside.js +138 -135
  49. package/es/layout-body/src/layout-body.js +145 -142
  50. package/es/layout-container/src/layout-container.js +71 -68
  51. package/es/layout-footer/src/layout-footer.js +60 -57
  52. package/es/layout-header/src/layout-header.js +58 -55
  53. package/es/link/src/link.js +131 -128
  54. package/es/list/src/list.js +2174 -2171
  55. package/es/loading/src/loading.js +141 -138
  56. package/es/mention/src/mention.js +49 -46
  57. package/es/menu/src/menu.js +799 -796
  58. package/es/modal/src/modal.js +1519 -1527
  59. package/es/notice-bar/src/notice-bar.js +168 -165
  60. package/es/number-input/src/number-input.js +1094 -1091
  61. package/es/pager/src/pager.js +767 -764
  62. package/es/password-input/src/password-input.js +431 -428
  63. package/es/print/src/page-break.js +63 -60
  64. package/es/print/src/print.js +303 -300
  65. package/es/pulldown/src/pulldown.js +403 -400
  66. package/es/radio/src/button.js +214 -211
  67. package/es/radio/src/group.js +195 -192
  68. package/es/radio/src/radio.js +194 -191
  69. package/es/rate/src/rate.js +164 -161
  70. package/es/result/src/result.js +116 -113
  71. package/es/row/src/col.js +133 -130
  72. package/es/row/src/row.js +111 -108
  73. package/es/scrollbar/src/scrollbar.js +518 -515
  74. package/es/segmented/src/segmented.js +240 -237
  75. package/es/select/src/optgroup.js +44 -41
  76. package/es/select/src/option.js +39 -36
  77. package/es/select/src/select.js +1914 -1896
  78. package/es/slider/src/slider.js +419 -416
  79. package/es/space/src/space.js +190 -187
  80. package/es/splitter/src/splitter-panel.js +146 -143
  81. package/es/splitter/src/splitter.js +917 -914
  82. package/es/step-item/index.d.ts +76 -0
  83. package/es/step-item/index.js +17 -0
  84. package/es/steps/index.d.ts +288 -34
  85. package/es/steps/src/step-info.d.ts +6 -0
  86. package/es/steps/src/step-info.js +20 -0
  87. package/es/steps/src/step-item.d.ts +14 -0
  88. package/es/steps/src/step-item.js +39 -0
  89. package/es/steps/src/steps.d.ts +68 -8
  90. package/es/steps/src/steps.js +299 -47
  91. package/es/steps/src/util.d.ts +7 -0
  92. package/es/steps/src/util.js +44 -0
  93. package/es/steps/style.css +297 -0
  94. package/es/steps/style.mini.css +1 -0
  95. package/es/style.css +307 -1
  96. package/es/style.mini.css +1 -1
  97. package/es/switch/src/switch.js +228 -225
  98. package/es/table-select/src/table-select.js +865 -862
  99. package/es/table-transfer/src/table-transfer.js +61 -58
  100. package/es/tabs/src/tab-pane.js +102 -99
  101. package/es/tabs/src/tabs.js +936 -933
  102. package/es/tag/src/tag.js +163 -160
  103. package/es/text/src/text.js +232 -229
  104. package/es/text-ellipsis/src/text-ellipsis.js +252 -249
  105. package/es/textarea/src/textarea.js +434 -431
  106. package/es/timeline/src/timeline.js +74 -36
  107. package/es/timeline/src/util.js +7 -4
  108. package/es/tip/src/tip.js +117 -114
  109. package/es/tooltip/src/tooltip.js +552 -549
  110. package/es/tour/src/tour.js +49 -46
  111. package/es/transfer/src/transfer.js +95 -92
  112. package/es/tree/src/tree.js +3379 -3376
  113. package/es/tree-select/src/tree-select.js +969 -966
  114. package/es/ui/index.js +8 -2
  115. package/es/ui/src/log.js +1 -1
  116. package/es/upload/src/upload.js +1791 -1788
  117. package/es/vxe-icon/style.css +1 -1
  118. package/es/vxe-icon/style.mini.css +1 -1
  119. package/es/vxe-steps/style.css +297 -0
  120. package/es/vxe-steps/style.mini.css +1 -0
  121. package/es/watermark/src/watermark.js +158 -155
  122. package/lib/alert/src/alert.js +117 -114
  123. package/lib/anchor/src/anchor-link.js +110 -107
  124. package/lib/anchor/src/anchor.js +212 -209
  125. package/lib/avatar/src/avatar.js +132 -129
  126. package/lib/backtop/src/backtop.js +267 -264
  127. package/lib/badge/src/badge.js +102 -99
  128. package/lib/breadcrumb/src/breadcrumb-item.js +104 -101
  129. package/lib/breadcrumb/src/breadcrumb.js +70 -67
  130. package/lib/button/src/button-group.js +88 -85
  131. package/lib/calendar/src/calendar.js +1371 -1368
  132. package/lib/card/src/card.js +235 -232
  133. package/lib/carousel/src/carousel-item.js +78 -75
  134. package/lib/carousel/src/carousel.js +392 -389
  135. package/lib/cascader/src/cascader.js +1665 -1662
  136. package/lib/checkbox/src/button.js +198 -195
  137. package/lib/checkbox/src/checkbox.js +181 -178
  138. package/lib/checkbox/src/group.js +210 -207
  139. package/lib/collapse/src/collapse-pane.js +98 -95
  140. package/lib/collapse/src/collapse.js +340 -337
  141. package/lib/color-picker/src/color-picker.js +1116 -1113
  142. package/lib/components.js +3 -0
  143. package/lib/context-menu/src/context-menu.js +601 -598
  144. package/lib/countdown/src/countdown.js +224 -221
  145. package/lib/date-panel/src/date-panel.js +1905 -1902
  146. package/lib/date-picker/src/date-picker.js +1537 -1534
  147. package/lib/date-range-picker/src/date-range-picker.js +1412 -1409
  148. package/lib/divider/src/divider.js +80 -77
  149. package/lib/drawer/src/drawer.js +778 -775
  150. package/lib/empty/src/empty.js +100 -97
  151. package/lib/form/src/form-group.js +74 -71
  152. package/lib/form/src/form-item.js +76 -73
  153. package/lib/form/src/form.js +789 -786
  154. package/lib/icon/src/icon.js +59 -56
  155. package/lib/icon/style/style.css +1 -1
  156. package/lib/icon/style/style.mini.css +1 -1
  157. package/lib/icon-picker/src/icon-picker.js +719 -716
  158. package/lib/image/src/group.js +130 -127
  159. package/lib/image/src/image.js +243 -240
  160. package/lib/image/src/preview.js +627 -624
  161. package/lib/index.common.js +2 -0
  162. package/lib/index.js +2 -0
  163. package/lib/index.umd.js +47411 -46732
  164. package/lib/index.umd.min.js +3 -3
  165. package/lib/input/src/input.js +2700 -2697
  166. package/lib/layout-aside/src/layout-aside.js +138 -135
  167. package/lib/layout-body/src/layout-body.js +145 -142
  168. package/lib/layout-container/src/layout-container.js +71 -68
  169. package/lib/layout-footer/src/layout-footer.js +60 -57
  170. package/lib/layout-header/src/layout-header.js +58 -55
  171. package/lib/link/src/link.js +131 -128
  172. package/lib/list/src/list.js +2173 -2170
  173. package/lib/loading/src/loading.js +141 -138
  174. package/lib/mention/src/mention.js +49 -46
  175. package/lib/menu/src/menu.js +799 -796
  176. package/lib/modal/src/modal.js +1519 -1527
  177. package/lib/notice-bar/src/notice-bar.js +168 -165
  178. package/lib/number-input/src/number-input.js +1094 -1091
  179. package/lib/pager/src/pager.js +767 -764
  180. package/lib/password-input/src/password-input.js +431 -428
  181. package/lib/print/src/page-break.js +63 -60
  182. package/lib/print/src/print.js +303 -300
  183. package/lib/pulldown/src/pulldown.js +403 -400
  184. package/lib/radio/src/button.js +214 -211
  185. package/lib/radio/src/group.js +195 -192
  186. package/lib/radio/src/radio.js +194 -191
  187. package/lib/rate/src/rate.js +164 -161
  188. package/lib/result/src/result.js +116 -113
  189. package/lib/row/src/col.js +133 -130
  190. package/lib/row/src/row.js +111 -108
  191. package/lib/scrollbar/src/scrollbar.js +518 -515
  192. package/lib/segmented/src/segmented.js +240 -237
  193. package/lib/select/src/optgroup.js +44 -41
  194. package/lib/select/src/option.js +39 -36
  195. package/lib/select/src/select.js +1915 -1897
  196. package/lib/slider/src/slider.js +419 -416
  197. package/lib/space/src/space.js +190 -187
  198. package/lib/splitter/src/splitter-panel.js +146 -143
  199. package/lib/splitter/src/splitter.js +917 -914
  200. package/lib/step-item/index.js +47 -0
  201. package/lib/steps/src/step-info.js +49 -0
  202. package/lib/steps/src/step-item.js +59 -0
  203. package/lib/steps/src/steps.js +298 -46
  204. package/lib/steps/src/util.js +74 -0
  205. package/lib/steps/style/style.css +297 -0
  206. package/lib/steps/style/style.mini.css +1 -0
  207. package/lib/style.css +307 -1
  208. package/lib/style.mini.css +1 -1
  209. package/lib/switch/src/switch.js +228 -225
  210. package/lib/table-select/src/table-select.js +865 -862
  211. package/lib/table-transfer/src/table-transfer.js +61 -58
  212. package/lib/tabs/src/tab-pane.js +102 -99
  213. package/lib/tabs/src/tabs.js +936 -933
  214. package/lib/tag/src/tag.js +163 -160
  215. package/lib/text/src/text.js +232 -229
  216. package/lib/text-ellipsis/src/text-ellipsis.js +252 -249
  217. package/lib/textarea/src/textarea.js +434 -431
  218. package/lib/timeline/src/timeline.js +74 -36
  219. package/lib/timeline/src/util.js +7 -4
  220. package/lib/tip/src/tip.js +117 -114
  221. package/lib/tooltip/src/tooltip.js +552 -549
  222. package/lib/tour/src/tour.js +49 -46
  223. package/lib/transfer/src/transfer.js +95 -92
  224. package/lib/tree/src/tree.js +3379 -3376
  225. package/lib/tree-select/src/tree-select.js +969 -966
  226. package/lib/ui/index.js +8 -2
  227. package/lib/ui/src/log.js +1 -1
  228. package/lib/upload/src/upload.js +1788 -1785
  229. package/lib/vxe-icon/style/style.css +1 -1
  230. package/lib/vxe-icon/style/style.mini.css +1 -1
  231. package/lib/vxe-steps/style/style.css +297 -0
  232. package/lib/vxe-steps/style/style.mini.css +1 -0
  233. package/lib/watermark/src/watermark.js +158 -155
  234. package/package.json +1 -1
  235. package/packages/alert/src/alert.ts +2 -2
  236. package/packages/anchor/src/anchor-link.ts +2 -2
  237. package/packages/anchor/src/anchor.ts +2 -2
  238. package/packages/avatar/src/avatar.ts +2 -2
  239. package/packages/backtop/src/backtop.ts +2 -2
  240. package/packages/badge/src/badge.ts +2 -2
  241. package/packages/breadcrumb/src/breadcrumb-item.ts +2 -2
  242. package/packages/breadcrumb/src/breadcrumb.ts +2 -2
  243. package/packages/button/src/button-group.ts +2 -2
  244. package/packages/calendar/src/calendar.ts +2 -2
  245. package/packages/card/src/card.ts +2 -2
  246. package/packages/carousel/src/carousel-item.ts +2 -2
  247. package/packages/carousel/src/carousel.ts +2 -2
  248. package/packages/cascader/src/cascader.ts +2 -2
  249. package/packages/checkbox/src/button.ts +3 -15
  250. package/packages/checkbox/src/checkbox.ts +2 -2
  251. package/packages/checkbox/src/group.ts +2 -2
  252. package/packages/collapse/src/collapse-pane.ts +2 -2
  253. package/packages/collapse/src/collapse.ts +2 -2
  254. package/packages/color-picker/src/color-picker.ts +2 -2
  255. package/packages/components.ts +3 -0
  256. package/packages/context-menu/src/context-menu.ts +3 -16
  257. package/packages/countdown/src/countdown.ts +2 -2
  258. package/packages/date-panel/src/date-panel.ts +2 -2
  259. package/packages/date-picker/src/date-picker.ts +2 -2
  260. package/packages/date-range-picker/src/date-range-picker.ts +2 -2
  261. package/packages/divider/src/divider.ts +2 -2
  262. package/packages/drawer/src/drawer.ts +2 -2
  263. package/packages/empty/src/empty.ts +2 -2
  264. package/packages/form/src/form-group.ts +2 -2
  265. package/packages/form/src/form-item.ts +2 -2
  266. package/packages/form/src/form.ts +2 -2
  267. package/packages/icon/src/icon.ts +2 -2
  268. package/packages/icon-picker/src/icon-picker.ts +2 -2
  269. package/packages/image/src/group.ts +2 -2
  270. package/packages/image/src/image.ts +2 -2
  271. package/packages/image/src/preview.ts +3 -16
  272. package/packages/index.ts +2 -2
  273. package/packages/input/src/input.ts +2 -2
  274. package/packages/layout-aside/src/layout-aside.ts +2 -2
  275. package/packages/layout-body/src/layout-body.ts +2 -2
  276. package/packages/layout-container/src/layout-container.ts +3 -14
  277. package/packages/layout-footer/src/layout-footer.ts +2 -2
  278. package/packages/layout-header/src/layout-header.ts +2 -2
  279. package/packages/link/src/link.ts +2 -2
  280. package/packages/list/src/list.ts +2 -2
  281. package/packages/loading/src/loading.ts +2 -2
  282. package/packages/mention/src/mention.ts +2 -2
  283. package/packages/menu/src/menu.ts +2 -2
  284. package/packages/modal/src/modal.ts +5 -20
  285. package/packages/notice-bar/src/notice-bar.ts +2 -2
  286. package/packages/number-input/src/number-input.ts +3 -17
  287. package/packages/pager/src/pager.ts +2 -2
  288. package/packages/password-input/src/password-input.ts +2 -2
  289. package/packages/print/src/page-break.ts +2 -2
  290. package/packages/print/src/print.ts +2 -2
  291. package/packages/pulldown/src/pulldown.ts +2 -2
  292. package/packages/radio/src/button.ts +3 -16
  293. package/packages/radio/src/group.ts +3 -17
  294. package/packages/radio/src/radio.ts +2 -2
  295. package/packages/rate/src/rate.ts +2 -2
  296. package/packages/result/src/result.ts +2 -2
  297. package/packages/row/src/col.ts +2 -2
  298. package/packages/row/src/row.ts +2 -2
  299. package/packages/scrollbar/src/scrollbar.ts +3 -4
  300. package/packages/segmented/src/segmented.ts +2 -2
  301. package/packages/select/src/optgroup.ts +2 -2
  302. package/packages/select/src/option.ts +2 -2
  303. package/packages/select/src/select.ts +33 -19
  304. package/packages/slider/src/slider.ts +2 -2
  305. package/packages/space/src/space.ts +2 -2
  306. package/packages/splitter/src/splitter-panel.ts +2 -2
  307. package/packages/splitter/src/splitter.ts +2 -2
  308. package/packages/step-item/index.ts +16 -0
  309. package/packages/steps/src/step-info.ts +18 -0
  310. package/packages/steps/src/step-item.ts +41 -0
  311. package/packages/steps/src/steps.ts +273 -13
  312. package/packages/steps/src/util.ts +44 -0
  313. package/packages/switch/src/switch.ts +2 -2
  314. package/packages/table-select/src/table-select.ts +2 -2
  315. package/packages/table-transfer/src/table-transfer.ts +3 -15
  316. package/packages/tabs/src/tab-pane.ts +2 -2
  317. package/packages/tabs/src/tabs.ts +2 -2
  318. package/packages/tag/src/tag.ts +2 -2
  319. package/packages/text/src/text.ts +2 -2
  320. package/packages/text-ellipsis/src/text-ellipsis.ts +2 -2
  321. package/packages/textarea/src/textarea.ts +2 -2
  322. package/packages/timeline/src/timeline-info.ts +17 -17
  323. package/packages/timeline/src/timeline.ts +93 -49
  324. package/packages/timeline/src/util.ts +44 -41
  325. package/packages/tip/src/tip.ts +2 -2
  326. package/packages/tooltip/src/tooltip.ts +2 -2
  327. package/packages/tour/src/tour.ts +2 -2
  328. package/packages/transfer/src/transfer.ts +2 -2
  329. package/packages/tree/src/tree.ts +2 -2
  330. package/packages/tree-select/src/tree-select.ts +2 -2
  331. package/packages/ui/index.ts +8 -1
  332. package/packages/upload/src/upload.ts +2 -2
  333. package/packages/watermark/src/watermark.ts +2 -2
  334. package/styles/all.scss +1 -0
  335. package/styles/components/step-item.scss +0 -0
  336. package/styles/components/steps.scss +354 -0
  337. package/styles/theme/base.scss +9 -0
  338. package/types/all.d.ts +3 -0
  339. package/types/components/gantt.d.ts +1 -3
  340. package/types/components/select.d.ts +1 -13
  341. package/types/components/step-item.d.ts +72 -0
  342. package/types/components/steps.d.ts +67 -8
  343. package/types/components/table.d.ts +7 -66
  344. package/types/handles/form-design.d.ts +1 -4
  345. package/types/ui/global-config.d.ts +2 -0
  346. package/types/ui/global-icon.d.ts +7 -0
  347. /package/dist/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  348. /package/dist/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  349. /package/dist/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  350. /package/es/icon/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  351. /package/es/icon/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  352. /package/es/icon/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  353. /package/es/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  354. /package/es/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  355. /package/es/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  356. /package/es/vxe-icon/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  357. /package/es/vxe-icon/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  358. /package/es/vxe-icon/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  359. /package/lib/icon/style/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  360. /package/lib/icon/style/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  361. /package/lib/icon/style/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  362. /package/lib/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  363. /package/lib/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  364. /package/lib/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
  365. /package/lib/vxe-icon/style/{iconfont.1793330162657.ttf → iconfont.1793359478136.ttf} +0 -0
  366. /package/lib/vxe-icon/style/{iconfont.1793330162657.woff → iconfont.1793359478136.woff} +0 -0
  367. /package/lib/vxe-icon/style/{iconfont.1793330162657.woff2 → iconfont.1793359478136.woff2} +0 -0
@@ -37,189 +37,192 @@ var import_core = require("@vxe-ui/core");
37
37
  var import_xe_utils = __toESM(require("xe-utils"));
38
38
  var import_dom = require("../../ui/src/dom");
39
39
  const { getConfig, createEvent, getIcon, globalEvents, GLOBAL_EVENT_KEYS, getI18n, renderEmptyElement } = import_core.VxeUI;
40
- var preview_default = (0, import_comp.defineVxeComponent)({
41
- name: "VxeImagePreview",
42
- props: {
43
- modelValue: Number,
44
- urlList: Array,
45
- urlField: {
46
- type: String,
47
- default: () => getConfig().imagePreview.urlField
40
+ var preview_default = (
41
+ /* define-vxe-component start */
42
+ (0, import_comp.defineVxeComponent)({
43
+ name: "VxeImagePreview",
44
+ props: {
45
+ modelValue: Number,
46
+ urlList: Array,
47
+ urlField: {
48
+ type: String,
49
+ default: () => getConfig().imagePreview.urlField
50
+ },
51
+ maskClosable: {
52
+ type: Boolean,
53
+ default: () => getConfig().imagePreview.maskClosable
54
+ },
55
+ marginSize: {
56
+ type: String,
57
+ default: () => getConfig().imagePreview.marginSize
58
+ },
59
+ showPrintButton: {
60
+ type: Boolean,
61
+ default: () => getConfig().imagePreview.showPrintButton
62
+ },
63
+ showDownloadButton: {
64
+ type: Boolean,
65
+ default: () => getConfig().imagePreview.showDownloadButton
66
+ },
67
+ zIndex: Number,
68
+ toolbarConfig: Object,
69
+ beforeDownloadMethod: Function,
70
+ downloadMethod: Function
48
71
  },
49
- maskClosable: {
50
- type: Boolean,
51
- default: () => getConfig().imagePreview.maskClosable
52
- },
53
- marginSize: {
54
- type: String,
55
- default: () => getConfig().imagePreview.marginSize
56
- },
57
- showPrintButton: {
58
- type: Boolean,
59
- default: () => getConfig().imagePreview.showPrintButton
60
- },
61
- showDownloadButton: {
62
- type: Boolean,
63
- default: () => getConfig().imagePreview.showDownloadButton
64
- },
65
- zIndex: Number,
66
- toolbarConfig: Object,
67
- beforeDownloadMethod: Function,
68
- downloadMethod: Function
69
- },
70
- emits: ["update:modelValue", "change", "download", "download-fail", "rotate", "close"],
71
- setup(props, context) {
72
- const { emit } = context;
73
- const xID = import_xe_utils.default.uniqueId();
74
- const refElem = (0, import_vue.ref)();
75
- const refMaps = {
76
- refElem
77
- };
78
- const reactData = (0, import_vue.reactive)({
79
- activeIndex: props.modelValue || 0,
80
- offsetPct11: false,
81
- offsetScale: 0,
82
- offsetRotate: 0,
83
- offsetLeft: 0,
84
- offsetTop: 0
85
- });
86
- const computeUrlProp = (0, import_vue.computed)(() => {
87
- return props.urlField || "url";
88
- });
89
- const computeMarginSize = (0, import_vue.computed)(() => {
90
- return import_xe_utils.default.toNumber(props.marginSize || 0) || 16;
91
- });
92
- const computeToolbarOpts = (0, import_vue.computed)(() => {
93
- return Object.assign({}, getConfig().imagePreview.toolbarConfig, props.toolbarConfig);
94
- });
95
- const computeRotateText = (0, import_vue.computed)(() => {
96
- const { offsetRotate } = reactData;
97
- if (offsetRotate) {
98
- return `${offsetRotate}°`;
99
- }
100
- return "0°";
101
- });
102
- const computeScaleText = (0, import_vue.computed)(() => {
103
- const { offsetScale } = reactData;
104
- if (offsetScale) {
105
- return `${import_xe_utils.default.ceil((1 + offsetScale) * 100)}%`;
106
- }
107
- return "100%";
108
- });
109
- const computeImgList = (0, import_vue.computed)(() => {
110
- const { urlList } = props;
111
- const urlProp = computeUrlProp.value;
112
- if (urlList && urlList.length) {
113
- return urlList.map((item) => {
114
- if (import_xe_utils.default.isString(item)) {
115
- return item;
116
- }
117
- if (item[urlProp]) {
118
- return item[urlProp];
119
- }
120
- return "";
121
- });
122
- }
123
- return [];
124
- });
125
- const computeImgTransform = (0, import_vue.computed)(() => {
126
- let { offsetScale, offsetRotate, offsetLeft, offsetTop } = reactData;
127
- const stys = [];
128
- let targetScale = 1;
129
- if (offsetScale) {
130
- targetScale = 1 + offsetScale;
131
- stys.push(`scale(${targetScale})`);
132
- }
133
- if (offsetRotate) {
134
- stys.push(`rotate(${offsetRotate}deg)`);
135
- }
136
- if (offsetLeft || offsetTop) {
137
- offsetLeft /= targetScale;
138
- offsetTop /= targetScale;
139
- let targetOffsetLeft = offsetLeft;
140
- let targetOffsetTop = offsetTop;
141
- if (offsetRotate) {
142
- switch (offsetRotate % 360) {
143
- case 90:
144
- case -270:
145
- targetOffsetLeft = offsetTop;
146
- targetOffsetTop = -offsetLeft;
147
- break;
148
- case 180:
149
- case -180:
150
- targetOffsetLeft = -offsetLeft;
151
- targetOffsetTop = -offsetTop;
152
- break;
153
- case 270:
154
- case -90:
155
- targetOffsetLeft = -offsetTop;
156
- targetOffsetTop = offsetLeft;
157
- break;
158
- }
159
- }
160
- stys.push(`translate(${targetOffsetLeft}px, ${targetOffsetTop}px)`);
161
- }
162
- return stys.length ? stys.join(" ") : "";
163
- });
164
- const computeMaps = {
165
- computeImgList
166
- };
167
- const $xeImagePreview = {
168
- xID,
169
- props,
170
- context,
171
- reactData,
172
- getRefMaps: () => refMaps,
173
- getComputeMaps: () => computeMaps
174
- };
175
- const dispatchEvent = (type, params, evnt) => {
176
- emit(type, createEvent(evnt, { $imagePreview: $xeImagePreview }, params));
177
- };
178
- const imagePreviewMethods = {
179
- dispatchEvent
180
- };
181
- const emitModel = (value) => {
182
- reactData.activeIndex = value;
183
- emit("update:modelValue", value);
184
- };
185
- const handleCloseEvent = (evnt) => {
186
- dispatchEvent("close", {}, evnt);
187
- };
188
- const imagePreviewPrivateMethods = {};
189
- const resetStyle = () => {
190
- const elem = refElem.value;
191
- (0, import_dom.removeClass)(elem, "is--move");
192
- Object.assign(reactData, {
72
+ emits: ["update:modelValue", "change", "download", "download-fail", "rotate", "close"],
73
+ setup(props, context) {
74
+ const { emit } = context;
75
+ const xID = import_xe_utils.default.uniqueId();
76
+ const refElem = (0, import_vue.ref)();
77
+ const refMaps = {
78
+ refElem
79
+ };
80
+ const reactData = (0, import_vue.reactive)({
81
+ activeIndex: props.modelValue || 0,
193
82
  offsetPct11: false,
194
83
  offsetScale: 0,
195
84
  offsetRotate: 0,
196
85
  offsetLeft: 0,
197
86
  offsetTop: 0
198
87
  });
199
- };
200
- const getOffsetZoomStep = () => {
201
- const { offsetScale } = reactData;
202
- let stepNum = 0.02;
203
- if (offsetScale >= -0.6) {
204
- stepNum = 0.04;
205
- if (offsetScale >= -0.4) {
206
- stepNum = 0.07;
207
- if (offsetScale >= 0) {
208
- stepNum = 0.1;
209
- if (offsetScale >= 3) {
210
- stepNum = 0.25;
211
- if (offsetScale >= 8) {
212
- stepNum = 0.4;
213
- if (offsetScale >= 16) {
214
- stepNum = 0.6;
215
- if (offsetScale >= 24) {
216
- stepNum = 0.9;
217
- if (offsetScale >= 32) {
218
- stepNum = 1.3;
219
- if (offsetScale >= 39) {
220
- stepNum = 1.9;
221
- if (offsetScale >= 45) {
222
- stepNum = 2.5;
88
+ const computeUrlProp = (0, import_vue.computed)(() => {
89
+ return props.urlField || "url";
90
+ });
91
+ const computeMarginSize = (0, import_vue.computed)(() => {
92
+ return import_xe_utils.default.toNumber(props.marginSize || 0) || 16;
93
+ });
94
+ const computeToolbarOpts = (0, import_vue.computed)(() => {
95
+ return Object.assign({}, getConfig().imagePreview.toolbarConfig, props.toolbarConfig);
96
+ });
97
+ const computeRotateText = (0, import_vue.computed)(() => {
98
+ const { offsetRotate } = reactData;
99
+ if (offsetRotate) {
100
+ return `${offsetRotate}°`;
101
+ }
102
+ return "0°";
103
+ });
104
+ const computeScaleText = (0, import_vue.computed)(() => {
105
+ const { offsetScale } = reactData;
106
+ if (offsetScale) {
107
+ return `${import_xe_utils.default.ceil((1 + offsetScale) * 100)}%`;
108
+ }
109
+ return "100%";
110
+ });
111
+ const computeImgList = (0, import_vue.computed)(() => {
112
+ const { urlList } = props;
113
+ const urlProp = computeUrlProp.value;
114
+ if (urlList && urlList.length) {
115
+ return urlList.map((item) => {
116
+ if (import_xe_utils.default.isString(item)) {
117
+ return item;
118
+ }
119
+ if (item[urlProp]) {
120
+ return item[urlProp];
121
+ }
122
+ return "";
123
+ });
124
+ }
125
+ return [];
126
+ });
127
+ const computeImgTransform = (0, import_vue.computed)(() => {
128
+ let { offsetScale, offsetRotate, offsetLeft, offsetTop } = reactData;
129
+ const stys = [];
130
+ let targetScale = 1;
131
+ if (offsetScale) {
132
+ targetScale = 1 + offsetScale;
133
+ stys.push(`scale(${targetScale})`);
134
+ }
135
+ if (offsetRotate) {
136
+ stys.push(`rotate(${offsetRotate}deg)`);
137
+ }
138
+ if (offsetLeft || offsetTop) {
139
+ offsetLeft /= targetScale;
140
+ offsetTop /= targetScale;
141
+ let targetOffsetLeft = offsetLeft;
142
+ let targetOffsetTop = offsetTop;
143
+ if (offsetRotate) {
144
+ switch (offsetRotate % 360) {
145
+ case 90:
146
+ case -270:
147
+ targetOffsetLeft = offsetTop;
148
+ targetOffsetTop = -offsetLeft;
149
+ break;
150
+ case 180:
151
+ case -180:
152
+ targetOffsetLeft = -offsetLeft;
153
+ targetOffsetTop = -offsetTop;
154
+ break;
155
+ case 270:
156
+ case -90:
157
+ targetOffsetLeft = -offsetTop;
158
+ targetOffsetTop = offsetLeft;
159
+ break;
160
+ }
161
+ }
162
+ stys.push(`translate(${targetOffsetLeft}px, ${targetOffsetTop}px)`);
163
+ }
164
+ return stys.length ? stys.join(" ") : "";
165
+ });
166
+ const computeMaps = {
167
+ computeImgList
168
+ };
169
+ const $xeImagePreview = {
170
+ xID,
171
+ props,
172
+ context,
173
+ reactData,
174
+ getRefMaps: () => refMaps,
175
+ getComputeMaps: () => computeMaps
176
+ };
177
+ const dispatchEvent = (type, params, evnt) => {
178
+ emit(type, createEvent(evnt, { $imagePreview: $xeImagePreview }, params));
179
+ };
180
+ const imagePreviewMethods = {
181
+ dispatchEvent
182
+ };
183
+ const emitModel = (value) => {
184
+ reactData.activeIndex = value;
185
+ emit("update:modelValue", value);
186
+ };
187
+ const handleCloseEvent = (evnt) => {
188
+ dispatchEvent("close", {}, evnt);
189
+ };
190
+ const imagePreviewPrivateMethods = {};
191
+ const resetStyle = () => {
192
+ const elem = refElem.value;
193
+ (0, import_dom.removeClass)(elem, "is--move");
194
+ Object.assign(reactData, {
195
+ offsetPct11: false,
196
+ offsetScale: 0,
197
+ offsetRotate: 0,
198
+ offsetLeft: 0,
199
+ offsetTop: 0
200
+ });
201
+ };
202
+ const getOffsetZoomStep = () => {
203
+ const { offsetScale } = reactData;
204
+ let stepNum = 0.02;
205
+ if (offsetScale >= -0.6) {
206
+ stepNum = 0.04;
207
+ if (offsetScale >= -0.4) {
208
+ stepNum = 0.07;
209
+ if (offsetScale >= 0) {
210
+ stepNum = 0.1;
211
+ if (offsetScale >= 3) {
212
+ stepNum = 0.25;
213
+ if (offsetScale >= 8) {
214
+ stepNum = 0.4;
215
+ if (offsetScale >= 16) {
216
+ stepNum = 0.6;
217
+ if (offsetScale >= 24) {
218
+ stepNum = 0.9;
219
+ if (offsetScale >= 32) {
220
+ stepNum = 1.3;
221
+ if (offsetScale >= 39) {
222
+ stepNum = 1.9;
223
+ if (offsetScale >= 45) {
224
+ stepNum = 2.5;
225
+ }
223
226
  }
224
227
  }
225
228
  }
@@ -229,473 +232,473 @@ var preview_default = (0, import_comp.defineVxeComponent)({
229
232
  }
230
233
  }
231
234
  }
232
- }
233
- return stepNum;
234
- };
235
- const handleZoom = (isAdd) => {
236
- const { offsetScale } = reactData;
237
- const stepNum = getOffsetZoomStep();
238
- if (isAdd) {
239
- reactData.offsetScale = Number(Math.min(49, offsetScale + stepNum).toFixed(2));
240
- } else {
241
- reactData.offsetScale = Number(Math.max(-0.9, offsetScale - stepNum).toFixed(2));
242
- }
243
- };
244
- const handleChangeEvent = (evnt, isNext) => {
245
- let activeIndex = reactData.activeIndex || 0;
246
- const imgList = computeImgList.value;
247
- if (isNext) {
248
- if (activeIndex >= imgList.length - 1) {
249
- activeIndex = 0;
235
+ return stepNum;
236
+ };
237
+ const handleZoom = (isAdd) => {
238
+ const { offsetScale } = reactData;
239
+ const stepNum = getOffsetZoomStep();
240
+ if (isAdd) {
241
+ reactData.offsetScale = Number(Math.min(49, offsetScale + stepNum).toFixed(2));
250
242
  } else {
251
- activeIndex++;
243
+ reactData.offsetScale = Number(Math.max(-0.9, offsetScale - stepNum).toFixed(2));
252
244
  }
253
- } else {
254
- if (activeIndex <= 0) {
255
- activeIndex = imgList.length - 1;
245
+ };
246
+ const handleChangeEvent = (evnt, isNext) => {
247
+ let activeIndex = reactData.activeIndex || 0;
248
+ const imgList = computeImgList.value;
249
+ if (isNext) {
250
+ if (activeIndex >= imgList.length - 1) {
251
+ activeIndex = 0;
252
+ } else {
253
+ activeIndex++;
254
+ }
256
255
  } else {
257
- activeIndex--;
256
+ if (activeIndex <= 0) {
257
+ activeIndex = imgList.length - 1;
258
+ } else {
259
+ activeIndex--;
260
+ }
258
261
  }
259
- }
260
- const imgUrl = imgList[activeIndex || 0];
261
- reactData.activeIndex = activeIndex;
262
- resetStyle();
263
- emitModel(activeIndex);
264
- dispatchEvent("change", { url: imgUrl, activeIndex }, evnt);
265
- };
266
- const handleRotateImgEvent = (evnt, isRight) => {
267
- const imgList = computeImgList.value;
268
- const { activeIndex } = reactData;
269
- const imgUrl = imgList[activeIndex || 0];
270
- let offsetRotate = reactData.offsetRotate;
271
- if (isRight) {
272
- offsetRotate += 90;
273
- } else {
274
- offsetRotate -= 90;
275
- }
276
- reactData.offsetRotate = offsetRotate;
277
- dispatchEvent("rotate", { url: imgUrl, rotateValue: offsetRotate }, evnt);
278
- };
279
- const handlePct11 = () => {
280
- resetStyle();
281
- reactData.offsetPct11 = true;
282
- };
283
- const handlePrintImg = () => {
284
- const { activeIndex } = reactData;
285
- const imgList = computeImgList.value;
286
- const imgUrl = imgList[activeIndex || 0];
287
- if (import_core.VxeUI.print) {
288
- import_core.VxeUI.print({
289
- align: "center",
290
- pageBreaks: [
291
- {
292
- bodyHtml: `<img src="${imgUrl}" style="max-width:100%;max-height:100%;">`
293
- }
294
- ]
295
- });
296
- }
297
- };
298
- const handleDownloadEvent = (evnt, imgUrl) => {
299
- dispatchEvent("download", { url: imgUrl }, evnt);
300
- };
301
- const handleDefaultDownload = (evnt, imgUrl) => {
302
- if (import_core.VxeUI.saveFile) {
303
- fetch(imgUrl).then((res) => {
304
- return res.blob().then((blob) => {
305
- import_core.VxeUI.saveFile({
306
- filename: imgUrl,
307
- content: blob
308
- });
309
- handleDownloadEvent(evnt, imgUrl);
262
+ const imgUrl = imgList[activeIndex || 0];
263
+ reactData.activeIndex = activeIndex;
264
+ resetStyle();
265
+ emitModel(activeIndex);
266
+ dispatchEvent("change", { url: imgUrl, activeIndex }, evnt);
267
+ };
268
+ const handleRotateImgEvent = (evnt, isRight) => {
269
+ const imgList = computeImgList.value;
270
+ const { activeIndex } = reactData;
271
+ const imgUrl = imgList[activeIndex || 0];
272
+ let offsetRotate = reactData.offsetRotate;
273
+ if (isRight) {
274
+ offsetRotate += 90;
275
+ } else {
276
+ offsetRotate -= 90;
277
+ }
278
+ reactData.offsetRotate = offsetRotate;
279
+ dispatchEvent("rotate", { url: imgUrl, rotateValue: offsetRotate }, evnt);
280
+ };
281
+ const handlePct11 = () => {
282
+ resetStyle();
283
+ reactData.offsetPct11 = true;
284
+ };
285
+ const handlePrintImg = () => {
286
+ const { activeIndex } = reactData;
287
+ const imgList = computeImgList.value;
288
+ const imgUrl = imgList[activeIndex || 0];
289
+ if (import_core.VxeUI.print) {
290
+ import_core.VxeUI.print({
291
+ align: "center",
292
+ pageBreaks: [
293
+ {
294
+ bodyHtml: `<img src="${imgUrl}" style="max-width:100%;max-height:100%;">`
295
+ }
296
+ ]
310
297
  });
311
- }).catch(() => {
312
- if (import_core.VxeUI.modal) {
313
- import_core.VxeUI.modal.message({
314
- content: getI18n("vxe.error.downErr"),
315
- status: "error"
298
+ }
299
+ };
300
+ const handleDownloadEvent = (evnt, imgUrl) => {
301
+ dispatchEvent("download", { url: imgUrl }, evnt);
302
+ };
303
+ const handleDefaultDownload = (evnt, imgUrl) => {
304
+ if (import_core.VxeUI.saveFile) {
305
+ fetch(imgUrl).then((res) => {
306
+ return res.blob().then((blob) => {
307
+ import_core.VxeUI.saveFile({
308
+ filename: imgUrl,
309
+ content: blob
310
+ });
311
+ handleDownloadEvent(evnt, imgUrl);
316
312
  });
313
+ }).catch(() => {
314
+ if (import_core.VxeUI.modal) {
315
+ import_core.VxeUI.modal.message({
316
+ content: getI18n("vxe.error.downErr"),
317
+ status: "error"
318
+ });
319
+ }
320
+ });
321
+ }
322
+ };
323
+ const handleDownloadImg = (evnt) => {
324
+ const { activeIndex } = reactData;
325
+ const toolbarOpts = computeToolbarOpts.value;
326
+ const btnConf = toolbarOpts.download;
327
+ const btnOpts = import_xe_utils.default.isBoolean(btnConf) ? {} : btnConf ? Object.assign({}, btnConf) : {};
328
+ const imgList = computeImgList.value;
329
+ const imgUrl = imgList[activeIndex || 0];
330
+ const beforeDownloadFn = props.beforeDownloadMethod || btnOpts.beforeDownloadMethod || getConfig().imagePreview.beforeDownloadMethod;
331
+ const downloadFn = props.downloadMethod || btnOpts.downloadMethod || getConfig().imagePreview.downloadMethod;
332
+ Promise.resolve(
333
+ beforeDownloadFn ? beforeDownloadFn({
334
+ $imagePreview: $xeImagePreview,
335
+ url: imgUrl,
336
+ index: activeIndex || 0
337
+ }) : true
338
+ ).then((status) => {
339
+ if (status) {
340
+ if (downloadFn) {
341
+ Promise.resolve(
342
+ downloadFn({
343
+ $imagePreview: $xeImagePreview,
344
+ url: imgUrl,
345
+ index: activeIndex || 0
346
+ })
347
+ ).then(() => {
348
+ handleDownloadEvent(evnt, imgUrl);
349
+ }).catch((e) => e);
350
+ } else {
351
+ handleDefaultDownload(evnt, imgUrl);
352
+ }
317
353
  }
318
354
  });
319
- }
320
- };
321
- const handleDownloadImg = (evnt) => {
322
- const { activeIndex } = reactData;
323
- const toolbarOpts = computeToolbarOpts.value;
324
- const btnConf = toolbarOpts.download;
325
- const btnOpts = import_xe_utils.default.isBoolean(btnConf) ? {} : btnConf ? Object.assign({}, btnConf) : {};
326
- const imgList = computeImgList.value;
327
- const imgUrl = imgList[activeIndex || 0];
328
- const beforeDownloadFn = props.beforeDownloadMethod || btnOpts.beforeDownloadMethod || getConfig().imagePreview.beforeDownloadMethod;
329
- const downloadFn = props.downloadMethod || btnOpts.downloadMethod || getConfig().imagePreview.downloadMethod;
330
- Promise.resolve(
331
- beforeDownloadFn ? beforeDownloadFn({
332
- $imagePreview: $xeImagePreview,
333
- url: imgUrl,
334
- index: activeIndex || 0
335
- }) : true
336
- ).then((status) => {
337
- if (status) {
338
- if (downloadFn) {
339
- Promise.resolve(
340
- downloadFn({
341
- $imagePreview: $xeImagePreview,
342
- url: imgUrl,
343
- index: activeIndex || 0
344
- })
345
- ).then(() => {
346
- handleDownloadEvent(evnt, imgUrl);
347
- }).catch((e) => e);
348
- } else {
349
- handleDefaultDownload(evnt, imgUrl);
355
+ };
356
+ const handleOperationBtn = (evnt, code) => {
357
+ const { activeIndex } = reactData;
358
+ const imgList = computeImgList.value;
359
+ const imgUrl = imgList[activeIndex || 0];
360
+ if (imgUrl) {
361
+ switch (code) {
362
+ case "zoomOut":
363
+ handleZoom(false);
364
+ break;
365
+ case "zoomIn":
366
+ handleZoom(true);
367
+ break;
368
+ case "pctFull":
369
+ resetStyle();
370
+ break;
371
+ case "pct11":
372
+ handlePct11();
373
+ break;
374
+ case "rotateLeft":
375
+ handleRotateImgEvent(evnt, false);
376
+ break;
377
+ case "rotateRight":
378
+ handleRotateImgEvent(evnt, true);
379
+ break;
380
+ case "print":
381
+ handlePrintImg();
382
+ break;
383
+ case "download":
384
+ handleDownloadImg(evnt);
385
+ break;
350
386
  }
351
387
  }
352
- });
353
- };
354
- const handleOperationBtn = (evnt, code) => {
355
- const { activeIndex } = reactData;
356
- const imgList = computeImgList.value;
357
- const imgUrl = imgList[activeIndex || 0];
358
- if (imgUrl) {
359
- switch (code) {
360
- case "zoomOut":
361
- handleZoom(false);
362
- break;
363
- case "zoomIn":
388
+ };
389
+ const wheelEvent = (evnt) => {
390
+ const delta = evnt.deltaY;
391
+ if (delta > 0) {
392
+ evnt.preventDefault();
393
+ handleZoom(false);
394
+ } else if (delta < 0) {
395
+ evnt.preventDefault();
396
+ handleZoom(true);
397
+ }
398
+ };
399
+ const moveEvent = (evnt) => {
400
+ const { offsetTop, offsetLeft } = reactData;
401
+ const elem = refElem.value;
402
+ evnt.preventDefault();
403
+ const domMousemove = document.onmousemove;
404
+ const domMouseup = document.onmouseup;
405
+ const startX = evnt.pageX;
406
+ const startY = evnt.pageY;
407
+ const marginSize = computeMarginSize.value;
408
+ document.onmousemove = (et) => {
409
+ const { pageX, pageY } = et;
410
+ const { visibleHeight, visibleWidth } = (0, import_dom.getDomNode)();
411
+ et.preventDefault();
412
+ (0, import_dom.addClass)(elem, "is--move");
413
+ if (pageX > marginSize && pageY > marginSize && pageX < visibleWidth - marginSize && pageY < visibleHeight - marginSize) {
414
+ reactData.offsetLeft = offsetLeft + pageX - startX;
415
+ reactData.offsetTop = offsetTop + pageY - startY;
416
+ }
417
+ };
418
+ document.onmouseup = () => {
419
+ document.onmousemove = domMousemove;
420
+ document.onmouseup = domMouseup;
421
+ (0, import_dom.removeClass)(elem, "is--move");
422
+ };
423
+ };
424
+ const handleGlobalKeydownEvent = (evnt) => {
425
+ const isControlKey = (0, import_dom.hasControlKey)(evnt);
426
+ const hasShiftKey = evnt.shiftKey;
427
+ const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP);
428
+ const isDownArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN);
429
+ const isLeftArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_LEFT);
430
+ const isRightArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_RIGHT);
431
+ const isR = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.R);
432
+ const isP = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.P);
433
+ if (isUpArrow) {
434
+ evnt.preventDefault();
435
+ if (hasShiftKey) {
436
+ reactData.offsetTop -= 1;
437
+ } else {
364
438
  handleZoom(true);
365
- break;
366
- case "pctFull":
367
- resetStyle();
368
- break;
369
- case "pct11":
370
- handlePct11();
371
- break;
372
- case "rotateLeft":
439
+ }
440
+ } else if (isDownArrow) {
441
+ evnt.preventDefault();
442
+ if (hasShiftKey) {
443
+ reactData.offsetTop += 1;
444
+ } else {
445
+ handleZoom(false);
446
+ }
447
+ } else if (isLeftArrow) {
448
+ evnt.preventDefault();
449
+ if (hasShiftKey) {
450
+ reactData.offsetLeft -= 1;
451
+ } else {
452
+ handleChangeEvent(evnt, false);
453
+ }
454
+ } else if (isRightArrow) {
455
+ evnt.preventDefault();
456
+ if (hasShiftKey) {
457
+ reactData.offsetLeft += 1;
458
+ } else {
459
+ handleChangeEvent(evnt, true);
460
+ }
461
+ } else if (isR && isControlKey) {
462
+ evnt.preventDefault();
463
+ if (hasShiftKey) {
373
464
  handleRotateImgEvent(evnt, false);
374
- break;
375
- case "rotateRight":
465
+ } else {
376
466
  handleRotateImgEvent(evnt, true);
377
- break;
378
- case "print":
379
- handlePrintImg();
380
- break;
381
- case "download":
382
- handleDownloadImg(evnt);
383
- break;
467
+ }
468
+ } else if (isP && isControlKey) {
469
+ evnt.preventDefault();
470
+ handlePrintImg();
384
471
  }
385
- }
386
- };
387
- const wheelEvent = (evnt) => {
388
- const delta = evnt.deltaY;
389
- if (delta > 0) {
390
- evnt.preventDefault();
391
- handleZoom(false);
392
- } else if (delta < 0) {
393
- evnt.preventDefault();
394
- handleZoom(true);
395
- }
396
- };
397
- const moveEvent = (evnt) => {
398
- const { offsetTop, offsetLeft } = reactData;
399
- const elem = refElem.value;
400
- evnt.preventDefault();
401
- const domMousemove = document.onmousemove;
402
- const domMouseup = document.onmouseup;
403
- const startX = evnt.pageX;
404
- const startY = evnt.pageY;
405
- const marginSize = computeMarginSize.value;
406
- document.onmousemove = (et) => {
407
- const { pageX, pageY } = et;
408
- const { visibleHeight, visibleWidth } = (0, import_dom.getDomNode)();
409
- et.preventDefault();
410
- (0, import_dom.addClass)(elem, "is--move");
411
- if (pageX > marginSize && pageY > marginSize && pageX < visibleWidth - marginSize && pageY < visibleHeight - marginSize) {
412
- reactData.offsetLeft = offsetLeft + pageX - startX;
413
- reactData.offsetTop = offsetTop + pageY - startY;
472
+ };
473
+ const handleClickMaskEvent = (evnt) => {
474
+ if (props.maskClosable) {
475
+ if (evnt.target === evnt.currentTarget) {
476
+ dispatchEvent("close", {}, evnt);
477
+ }
414
478
  }
415
479
  };
416
- document.onmouseup = () => {
417
- document.onmousemove = domMousemove;
418
- document.onmouseup = domMouseup;
419
- (0, import_dom.removeClass)(elem, "is--move");
480
+ Object.assign($xeImagePreview, imagePreviewMethods, imagePreviewPrivateMethods);
481
+ const renderImgWrapper = () => {
482
+ const { activeIndex } = reactData;
483
+ const imgList = computeImgList.value;
484
+ const imgTransform = computeImgTransform.value;
485
+ return (0, import_vue.h)(
486
+ "div",
487
+ {
488
+ class: "vxe-image-preview--img-list",
489
+ onClick: handleClickMaskEvent
490
+ },
491
+ imgList.map((url, index) => {
492
+ const isActive = activeIndex === index;
493
+ return (0, import_vue.h)("img", {
494
+ class: [
495
+ "vxe-image-preview--img-item",
496
+ {
497
+ "is--active": isActive
498
+ }
499
+ ],
500
+ src: url,
501
+ style: isActive ? {
502
+ transform: imgTransform
503
+ } : null,
504
+ onMousedown(evnt) {
505
+ moveEvent(evnt);
506
+ }
507
+ });
508
+ })
509
+ );
420
510
  };
421
- };
422
- const handleGlobalKeydownEvent = (evnt) => {
423
- const isControlKey = (0, import_dom.hasControlKey)(evnt);
424
- const hasShiftKey = evnt.shiftKey;
425
- const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP);
426
- const isDownArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN);
427
- const isLeftArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_LEFT);
428
- const isRightArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_RIGHT);
429
- const isR = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.R);
430
- const isP = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.P);
431
- if (isUpArrow) {
432
- evnt.preventDefault();
433
- if (hasShiftKey) {
434
- reactData.offsetTop -= 1;
435
- } else {
436
- handleZoom(true);
437
- }
438
- } else if (isDownArrow) {
439
- evnt.preventDefault();
440
- if (hasShiftKey) {
441
- reactData.offsetTop += 1;
442
- } else {
443
- handleZoom(false);
444
- }
445
- } else if (isLeftArrow) {
446
- evnt.preventDefault();
447
- if (hasShiftKey) {
448
- reactData.offsetLeft -= 1;
449
- } else {
450
- handleChangeEvent(evnt, false);
451
- }
452
- } else if (isRightArrow) {
453
- evnt.preventDefault();
454
- if (hasShiftKey) {
455
- reactData.offsetLeft += 1;
456
- } else {
457
- handleChangeEvent(evnt, true);
458
- }
459
- } else if (isR && isControlKey) {
460
- evnt.preventDefault();
461
- if (hasShiftKey) {
462
- handleRotateImgEvent(evnt, false);
463
- } else {
464
- handleRotateImgEvent(evnt, true);
465
- }
466
- } else if (isP && isControlKey) {
467
- evnt.preventDefault();
468
- handlePrintImg();
469
- }
470
- };
471
- const handleClickMaskEvent = (evnt) => {
472
- if (props.maskClosable) {
473
- if (evnt.target === evnt.currentTarget) {
474
- dispatchEvent("close", {}, evnt);
475
- }
476
- }
477
- };
478
- Object.assign($xeImagePreview, imagePreviewMethods, imagePreviewPrivateMethods);
479
- const renderImgWrapper = () => {
480
- const { activeIndex } = reactData;
481
- const imgList = computeImgList.value;
482
- const imgTransform = computeImgTransform.value;
483
- return (0, import_vue.h)(
484
- "div",
485
- {
486
- class: "vxe-image-preview--img-list",
487
- onClick: handleClickMaskEvent
488
- },
489
- imgList.map((url, index) => {
490
- const isActive = activeIndex === index;
491
- return (0, import_vue.h)("img", {
511
+ const renderOperationBtn = (code, icon) => {
512
+ const toolbarOpts = computeToolbarOpts.value;
513
+ const btnConf = toolbarOpts[code];
514
+ const btnOpts = import_xe_utils.default.isBoolean(btnConf) ? {} : btnConf ? Object.assign({}, btnConf) : {};
515
+ const showBtn = btnConf !== false;
516
+ return showBtn ? (0, import_vue.h)(
517
+ "div",
518
+ {
519
+ class: "vxe-image-preview--operation-btn",
520
+ title: getI18n(`vxe.imagePreview.operBtn.${code}`),
521
+ onClick(evnt) {
522
+ handleOperationBtn(evnt, code);
523
+ }
524
+ },
525
+ [
526
+ (0, import_vue.h)("i", {
527
+ class: btnOpts.icon || getIcon()[icon]
528
+ })
529
+ ]
530
+ ) : renderEmptyElement($xeImagePreview);
531
+ };
532
+ const renderBtnWrapper = () => {
533
+ const { showPrintButton, showDownloadButton } = props;
534
+ const { activeIndex } = reactData;
535
+ const imgList = computeImgList.value;
536
+ const rotateText = computeRotateText.value;
537
+ const scaleText = computeScaleText.value;
538
+ const toolbarOpts = computeToolbarOpts.value;
539
+ return (0, import_vue.h)(
540
+ "div",
541
+ {
542
+ class: "vxe-image-preview--btn-wrapper"
543
+ },
544
+ [
545
+ (0, import_vue.h)(
546
+ "div",
547
+ {
548
+ class: "vxe-image-preview--close-wrapper"
549
+ },
550
+ [
551
+ (0, import_vue.h)(
552
+ "div",
553
+ {
554
+ class: "vxe-image-preview--close-btn",
555
+ onClick: handleCloseEvent
556
+ },
557
+ [
558
+ (0, import_vue.h)("i", {
559
+ class: getIcon().IMAGE_PREVIEW_CLOSE
560
+ })
561
+ ]
562
+ ),
563
+ (0, import_vue.h)("div", {
564
+ class: "vxe-image-preview--close-bg"
565
+ })
566
+ ]
567
+ ),
568
+ imgList.length > 1 ? (0, import_vue.h)(
569
+ "div",
570
+ {
571
+ class: "vxe-image-preview--previous-btn",
572
+ onClick(evnt) {
573
+ handleChangeEvent(evnt, false);
574
+ }
575
+ },
576
+ [
577
+ (0, import_vue.h)("i", {
578
+ class: getIcon().IMAGE_PREVIEW_PREVIOUS
579
+ })
580
+ ]
581
+ ) : renderEmptyElement($xeImagePreview),
582
+ imgList.length > 1 ? (0, import_vue.h)(
583
+ "div",
584
+ {
585
+ class: "vxe-image-preview--next-btn",
586
+ onClick(evnt) {
587
+ handleChangeEvent(evnt, true);
588
+ }
589
+ },
590
+ [
591
+ (0, import_vue.h)("i", {
592
+ class: getIcon().IMAGE_PREVIEW_NEXT
593
+ })
594
+ ]
595
+ ) : renderEmptyElement($xeImagePreview),
596
+ (0, import_vue.h)(
597
+ "div",
598
+ {
599
+ class: "vxe-image-preview--operation-info"
600
+ },
601
+ [
602
+ (0, import_vue.h)(
603
+ "div",
604
+ {
605
+ class: "vxe-image-preview--operation-deg"
606
+ },
607
+ rotateText
608
+ ),
609
+ (0, import_vue.h)(
610
+ "div",
611
+ {
612
+ class: "vxe-image-preview--operation-pct"
613
+ },
614
+ scaleText
615
+ )
616
+ ]
617
+ ),
618
+ (0, import_vue.h)(
619
+ "div",
620
+ {
621
+ class: "vxe-image-preview--operation-wrapper"
622
+ },
623
+ [
624
+ (0, import_vue.h)(
625
+ "div",
626
+ {
627
+ class: "vxe-image-preview--operation-active-count"
628
+ },
629
+ [
630
+ (0, import_vue.h)(
631
+ "span",
632
+ {
633
+ class: "vxe-image-preview--operation-active-current"
634
+ },
635
+ `${(activeIndex || 0) + 1}`
636
+ ),
637
+ (0, import_vue.h)(
638
+ "span",
639
+ {
640
+ class: "vxe-image-preview--operation-active-total"
641
+ },
642
+ `/${imgList.length}`
643
+ )
644
+ ]
645
+ ),
646
+ renderOperationBtn("zoomOut", "IMAGE_PREVIEW_ZOOM_OUT"),
647
+ renderOperationBtn("zoomIn", "IMAGE_PREVIEW_ZOOM_IN"),
648
+ renderOperationBtn("pctFull", "IMAGE_PREVIEW_PCT_FULL"),
649
+ renderOperationBtn("pct11", "IMAGE_PREVIEW_PCT_1_1"),
650
+ renderOperationBtn("rotateLeft", "IMAGE_PREVIEW_ROTATE_LEFT"),
651
+ renderOperationBtn("rotateRight", "IMAGE_PREVIEW_ROTATE_RIGHT"),
652
+ showPrintButton || toolbarOpts.print ? renderOperationBtn("print", "IMAGE_PREVIEW_PRINT") : renderEmptyElement($xeImagePreview),
653
+ showDownloadButton || toolbarOpts.download ? renderOperationBtn("download", "IMAGE_PREVIEW_DOWNLOAD") : renderEmptyElement($xeImagePreview)
654
+ ]
655
+ )
656
+ ]
657
+ );
658
+ };
659
+ const renderVN = () => {
660
+ const { offsetPct11 } = reactData;
661
+ return (0, import_vue.h)(
662
+ "div",
663
+ {
664
+ ref: refElem,
492
665
  class: [
493
- "vxe-image-preview--img-item",
666
+ "vxe-image-preview",
494
667
  {
495
- "is--active": isActive
496
- }
497
- ],
498
- src: url,
499
- style: isActive ? {
500
- transform: imgTransform
501
- } : null,
502
- onMousedown(evnt) {
503
- moveEvent(evnt);
504
- }
505
- });
506
- })
507
- );
508
- };
509
- const renderOperationBtn = (code, icon) => {
510
- const toolbarOpts = computeToolbarOpts.value;
511
- const btnConf = toolbarOpts[code];
512
- const btnOpts = import_xe_utils.default.isBoolean(btnConf) ? {} : btnConf ? Object.assign({}, btnConf) : {};
513
- const showBtn = btnConf !== false;
514
- return showBtn ? (0, import_vue.h)(
515
- "div",
516
- {
517
- class: "vxe-image-preview--operation-btn",
518
- title: getI18n(`vxe.imagePreview.operBtn.${code}`),
519
- onClick(evnt) {
520
- handleOperationBtn(evnt, code);
521
- }
522
- },
523
- [
524
- (0, import_vue.h)("i", {
525
- class: btnOpts.icon || getIcon()[icon]
526
- })
527
- ]
528
- ) : renderEmptyElement($xeImagePreview);
529
- };
530
- const renderBtnWrapper = () => {
531
- const { showPrintButton, showDownloadButton } = props;
532
- const { activeIndex } = reactData;
533
- const imgList = computeImgList.value;
534
- const rotateText = computeRotateText.value;
535
- const scaleText = computeScaleText.value;
536
- const toolbarOpts = computeToolbarOpts.value;
537
- return (0, import_vue.h)(
538
- "div",
539
- {
540
- class: "vxe-image-preview--btn-wrapper"
541
- },
542
- [
543
- (0, import_vue.h)(
544
- "div",
545
- {
546
- class: "vxe-image-preview--close-wrapper"
547
- },
548
- [
549
- (0, import_vue.h)(
550
- "div",
551
- {
552
- class: "vxe-image-preview--close-btn",
553
- onClick: handleCloseEvent
554
- },
555
- [
556
- (0, import_vue.h)("i", {
557
- class: getIcon().IMAGE_PREVIEW_CLOSE
558
- })
559
- ]
560
- ),
561
- (0, import_vue.h)("div", {
562
- class: "vxe-image-preview--close-bg"
563
- })
564
- ]
565
- ),
566
- imgList.length > 1 ? (0, import_vue.h)(
567
- "div",
568
- {
569
- class: "vxe-image-preview--previous-btn",
570
- onClick(evnt) {
571
- handleChangeEvent(evnt, false);
668
+ "is--pct11": offsetPct11
572
669
  }
573
- },
574
- [
575
- (0, import_vue.h)("i", {
576
- class: getIcon().IMAGE_PREVIEW_PREVIOUS
577
- })
578
670
  ]
579
- ) : renderEmptyElement($xeImagePreview),
580
- imgList.length > 1 ? (0, import_vue.h)(
581
- "div",
582
- {
583
- class: "vxe-image-preview--next-btn",
584
- onClick(evnt) {
585
- handleChangeEvent(evnt, true);
586
- }
587
- },
588
- [
589
- (0, import_vue.h)("i", {
590
- class: getIcon().IMAGE_PREVIEW_NEXT
591
- })
592
- ]
593
- ) : renderEmptyElement($xeImagePreview),
594
- (0, import_vue.h)(
595
- "div",
596
- {
597
- class: "vxe-image-preview--operation-info"
598
- },
599
- [
600
- (0, import_vue.h)(
601
- "div",
602
- {
603
- class: "vxe-image-preview--operation-deg"
604
- },
605
- rotateText
606
- ),
607
- (0, import_vue.h)(
608
- "div",
609
- {
610
- class: "vxe-image-preview--operation-pct"
611
- },
612
- scaleText
613
- )
614
- ]
615
- ),
616
- (0, import_vue.h)(
617
- "div",
618
- {
619
- class: "vxe-image-preview--operation-wrapper"
620
- },
621
- [
622
- (0, import_vue.h)(
623
- "div",
624
- {
625
- class: "vxe-image-preview--operation-active-count"
626
- },
627
- [
628
- (0, import_vue.h)(
629
- "span",
630
- {
631
- class: "vxe-image-preview--operation-active-current"
632
- },
633
- `${(activeIndex || 0) + 1}`
634
- ),
635
- (0, import_vue.h)(
636
- "span",
637
- {
638
- class: "vxe-image-preview--operation-active-total"
639
- },
640
- `/${imgList.length}`
641
- )
642
- ]
643
- ),
644
- renderOperationBtn("zoomOut", "IMAGE_PREVIEW_ZOOM_OUT"),
645
- renderOperationBtn("zoomIn", "IMAGE_PREVIEW_ZOOM_IN"),
646
- renderOperationBtn("pctFull", "IMAGE_PREVIEW_PCT_FULL"),
647
- renderOperationBtn("pct11", "IMAGE_PREVIEW_PCT_1_1"),
648
- renderOperationBtn("rotateLeft", "IMAGE_PREVIEW_ROTATE_LEFT"),
649
- renderOperationBtn("rotateRight", "IMAGE_PREVIEW_ROTATE_RIGHT"),
650
- showPrintButton || toolbarOpts.print ? renderOperationBtn("print", "IMAGE_PREVIEW_PRINT") : renderEmptyElement($xeImagePreview),
651
- showDownloadButton || toolbarOpts.download ? renderOperationBtn("download", "IMAGE_PREVIEW_DOWNLOAD") : renderEmptyElement($xeImagePreview)
652
- ]
653
- )
654
- ]
655
- );
656
- };
657
- const renderVN = () => {
658
- const { offsetPct11 } = reactData;
659
- return (0, import_vue.h)(
660
- "div",
661
- {
662
- ref: refElem,
663
- class: [
664
- "vxe-image-preview",
665
- {
666
- "is--pct11": offsetPct11
667
- }
668
- ]
669
- },
670
- [renderImgWrapper(), renderBtnWrapper()]
671
+ },
672
+ [renderImgWrapper(), renderBtnWrapper()]
673
+ );
674
+ };
675
+ (0, import_vue.watch)(
676
+ () => props.modelValue,
677
+ (val) => {
678
+ reactData.activeIndex = val;
679
+ resetStyle();
680
+ }
671
681
  );
672
- };
673
- (0, import_vue.watch)(
674
- () => props.modelValue,
675
- (val) => {
676
- reactData.activeIndex = val;
677
- resetStyle();
678
- }
679
- );
680
- (0, import_vue.onMounted)(() => {
681
- const elem = refElem.value;
682
- if (elem) {
683
- elem.addEventListener("wheel", wheelEvent, { passive: false });
684
- }
685
- globalEvents.on($xeImagePreview, "keydown", handleGlobalKeydownEvent);
686
- });
687
- (0, import_vue.onBeforeUnmount)(() => {
688
- const elem = refElem.value;
689
- if (elem) {
690
- elem.removeEventListener("wheel", wheelEvent);
691
- (0, import_dom.removeClass)(elem, "is--move");
692
- }
693
- });
694
- (0, import_vue.onUnmounted)(() => {
695
- globalEvents.off($xeImagePreview, "keydown");
696
- });
697
- (0, import_vue.provide)("$xeImagePreview", $xeImagePreview);
698
- $xeImagePreview.renderVN = renderVN;
699
- return renderVN;
700
- }
701
- });
682
+ (0, import_vue.onMounted)(() => {
683
+ const elem = refElem.value;
684
+ if (elem) {
685
+ elem.addEventListener("wheel", wheelEvent, { passive: false });
686
+ }
687
+ globalEvents.on($xeImagePreview, "keydown", handleGlobalKeydownEvent);
688
+ });
689
+ (0, import_vue.onBeforeUnmount)(() => {
690
+ const elem = refElem.value;
691
+ if (elem) {
692
+ elem.removeEventListener("wheel", wheelEvent);
693
+ (0, import_dom.removeClass)(elem, "is--move");
694
+ }
695
+ });
696
+ (0, import_vue.onUnmounted)(() => {
697
+ globalEvents.off($xeImagePreview, "keydown");
698
+ });
699
+ (0, import_vue.provide)("$xeImagePreview", $xeImagePreview);
700
+ $xeImagePreview.renderVN = renderVN;
701
+ return renderVN;
702
+ }
703
+ })
704
+ );