vxe-pc-ui 3.0.0 → 3.0.1

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 (331) hide show
  1. package/es/button/src/button.js +3 -0
  2. package/es/carousel/index.js +12 -0
  3. package/es/carousel/src/carousel-item.js +100 -0
  4. package/es/carousel/src/carousel.js +418 -0
  5. package/es/carousel/src/util.js +17 -0
  6. package/es/carousel/style.css +185 -0
  7. package/es/carousel/style.min.css +1 -0
  8. package/es/carousel-item/index.js +12 -0
  9. package/es/carousel-item/style.css +0 -0
  10. package/es/carousel-item/style.min.css +0 -0
  11. package/es/checkbox/index.js +12 -0
  12. package/es/checkbox/src/checkbox.js +159 -0
  13. package/es/checkbox/src/group.js +154 -0
  14. package/es/checkbox/style.css +117 -0
  15. package/es/checkbox/style.min.css +1 -0
  16. package/es/checkbox-group/index.js +12 -0
  17. package/es/checkbox-group/style.css +0 -0
  18. package/es/checkbox-group/style.min.css +0 -0
  19. package/es/components.js +39 -39
  20. package/es/date-picker/src/date-picker.js +3 -0
  21. package/es/icon/style.css +1 -1
  22. package/es/icon-picker/index.js +12 -0
  23. package/es/icon-picker/src/icon-picker.js +668 -0
  24. package/es/icon-picker/style.css +207 -0
  25. package/es/icon-picker/style.min.css +1 -0
  26. package/es/input/index.js +12 -0
  27. package/es/input/src/input.js +2892 -0
  28. package/es/input/style.css +941 -0
  29. package/es/input/style.min.css +1 -0
  30. package/es/layout-footer/src/layout-footer.js +2 -1
  31. package/es/layout-header/src/layout-header.js +2 -1
  32. package/es/optgroup/index.js +12 -0
  33. package/es/optgroup/style.css +0 -0
  34. package/es/optgroup/style.min.css +0 -0
  35. package/es/option/index.js +12 -0
  36. package/es/option/style.css +0 -0
  37. package/es/option/style.min.css +0 -0
  38. package/es/pager/index.js +12 -0
  39. package/es/pager/src/pager.js +687 -0
  40. package/es/password-input/index.js +12 -0
  41. package/es/password-input/src/password-input.js +388 -0
  42. package/es/password-input/style.css +604 -0
  43. package/es/password-input/style.min.css +1 -0
  44. package/es/pulldown/src/pulldown.js +5 -1
  45. package/es/select/index.js +12 -0
  46. package/es/select/src/optgroup.js +90 -0
  47. package/es/select/src/option-info.js +16 -0
  48. package/es/select/src/option.js +86 -0
  49. package/es/select/src/select.js +1269 -0
  50. package/es/select/src/util.js +35 -0
  51. package/es/select/style.css +207 -0
  52. package/es/select/style.min.css +1 -0
  53. package/es/style.css +1 -1
  54. package/es/style.min.css +1 -1
  55. package/es/tab-pane/index.js +12 -0
  56. package/es/tab-pane/style.css +0 -0
  57. package/es/tab-pane/style.min.css +0 -0
  58. package/es/tabs/index.js +12 -0
  59. package/es/tabs/src/tab-pane.js +119 -0
  60. package/es/tabs/src/tabs.js +593 -0
  61. package/es/tabs/src/util.js +17 -0
  62. package/es/tabs/style.css +342 -0
  63. package/es/tabs/style.min.css +1 -0
  64. package/es/ui/index.js +1 -1
  65. package/es/ui/src/log.js +1 -1
  66. package/es/vxe-carousel/index.js +3 -0
  67. package/es/vxe-carousel/style.css +185 -0
  68. package/es/vxe-carousel/style.min.css +1 -0
  69. package/es/vxe-carousel-item/index.js +3 -0
  70. package/es/vxe-carousel-item/style.css +0 -0
  71. package/es/vxe-carousel-item/style.min.css +0 -0
  72. package/es/vxe-checkbox/index.js +3 -0
  73. package/es/vxe-checkbox/style.css +117 -0
  74. package/es/vxe-checkbox/style.min.css +1 -0
  75. package/es/vxe-checkbox-group/index.js +3 -0
  76. package/es/vxe-checkbox-group/style.css +0 -0
  77. package/es/vxe-checkbox-group/style.min.css +0 -0
  78. package/es/vxe-icon-picker/index.js +3 -0
  79. package/es/vxe-icon-picker/style.css +207 -0
  80. package/es/vxe-icon-picker/style.min.css +1 -0
  81. package/es/vxe-input/index.js +3 -0
  82. package/es/vxe-input/style.css +941 -0
  83. package/es/vxe-input/style.min.css +1 -0
  84. package/es/vxe-optgroup/index.js +3 -0
  85. package/es/vxe-optgroup/style.css +0 -0
  86. package/es/vxe-optgroup/style.min.css +0 -0
  87. package/es/vxe-option/index.js +3 -0
  88. package/es/vxe-option/style.css +0 -0
  89. package/es/vxe-option/style.min.css +0 -0
  90. package/es/vxe-password-input/index.js +3 -0
  91. package/es/vxe-password-input/style.css +604 -0
  92. package/es/vxe-password-input/style.min.css +1 -0
  93. package/es/vxe-select/index.js +3 -0
  94. package/es/vxe-select/style.css +207 -0
  95. package/es/vxe-select/style.min.css +1 -0
  96. package/es/vxe-tab-pane/index.js +3 -0
  97. package/es/vxe-tab-pane/style.css +0 -0
  98. package/es/vxe-tab-pane/style.min.css +0 -0
  99. package/es/vxe-tabs/index.js +3 -0
  100. package/es/vxe-tabs/style.css +342 -0
  101. package/es/vxe-tabs/style.min.css +1 -0
  102. package/lib/button/src/button.js +3 -0
  103. package/lib/button/src/button.min.js +1 -1
  104. package/lib/carousel/index.js +19 -0
  105. package/lib/carousel/index.min.js +1 -0
  106. package/lib/carousel/src/carousel-item.js +107 -0
  107. package/lib/carousel/src/carousel-item.min.js +1 -0
  108. package/lib/carousel/src/carousel.js +437 -0
  109. package/lib/carousel/src/carousel.min.js +1 -0
  110. package/lib/carousel/src/util.js +27 -0
  111. package/lib/carousel/src/util.min.js +1 -0
  112. package/lib/carousel/style/index.js +1 -0
  113. package/lib/carousel/style/style.css +185 -0
  114. package/lib/carousel/style/style.min.css +1 -0
  115. package/lib/carousel-item/index.js +19 -0
  116. package/lib/carousel-item/index.min.js +1 -0
  117. package/lib/carousel-item/style/index.js +1 -0
  118. package/lib/carousel-item/style/style.css +0 -0
  119. package/lib/carousel-item/style/style.min.css +0 -0
  120. package/lib/checkbox/index.js +19 -0
  121. package/lib/checkbox/index.min.js +1 -0
  122. package/lib/checkbox/src/checkbox.js +169 -0
  123. package/lib/checkbox/src/checkbox.min.js +1 -0
  124. package/lib/checkbox/src/group.js +164 -0
  125. package/lib/checkbox/src/group.min.js +1 -0
  126. package/lib/checkbox/style/index.js +1 -0
  127. package/lib/checkbox/style/style.css +117 -0
  128. package/lib/checkbox/style/style.min.css +1 -0
  129. package/lib/checkbox-group/index.js +19 -0
  130. package/lib/checkbox-group/index.min.js +1 -0
  131. package/lib/checkbox-group/style/index.js +1 -0
  132. package/lib/checkbox-group/style/style.css +0 -0
  133. package/lib/checkbox-group/style/style.min.css +0 -0
  134. package/lib/components.js +159 -60
  135. package/lib/components.min.js +1 -1
  136. package/lib/date-picker/src/date-picker.js +3 -0
  137. package/lib/date-picker/src/date-picker.min.js +1 -1
  138. package/lib/icon/style/style.css +1 -1
  139. package/lib/icon/style/style.min.css +1 -1
  140. package/lib/icon-picker/index.js +19 -0
  141. package/lib/icon-picker/index.min.js +1 -0
  142. package/lib/icon-picker/src/icon-picker.js +646 -0
  143. package/lib/icon-picker/src/icon-picker.min.js +1 -0
  144. package/lib/icon-picker/style/index.js +1 -0
  145. package/lib/icon-picker/style/style.css +207 -0
  146. package/lib/icon-picker/style/style.min.css +1 -0
  147. package/lib/index.umd.js +15870 -7738
  148. package/lib/index.umd.min.js +1 -1
  149. package/lib/input/index.js +19 -0
  150. package/lib/input/index.min.js +1 -0
  151. package/lib/input/src/input.js +2897 -0
  152. package/lib/input/src/input.min.js +1 -0
  153. package/lib/input/style/index.js +1 -0
  154. package/lib/input/style/style.css +941 -0
  155. package/lib/input/style/style.min.css +1 -0
  156. package/lib/layout-footer/src/layout-footer.js +2 -1
  157. package/lib/layout-header/src/layout-header.js +2 -1
  158. package/lib/optgroup/index.js +19 -0
  159. package/lib/optgroup/index.min.js +1 -0
  160. package/lib/optgroup/style/index.js +1 -0
  161. package/lib/optgroup/style/style.css +0 -0
  162. package/lib/optgroup/style/style.min.css +0 -0
  163. package/lib/option/index.js +19 -0
  164. package/lib/option/index.min.js +1 -0
  165. package/lib/option/style/index.js +1 -0
  166. package/lib/option/style/style.css +0 -0
  167. package/lib/option/style/style.min.css +0 -0
  168. package/lib/pager/index.js +19 -0
  169. package/lib/pager/index.min.js +1 -0
  170. package/lib/pager/src/pager.js +714 -0
  171. package/lib/pager/src/pager.min.js +1 -0
  172. package/lib/password-input/index.js +19 -0
  173. package/lib/password-input/index.min.js +1 -0
  174. package/lib/password-input/src/password-input.js +398 -0
  175. package/lib/password-input/src/password-input.min.js +1 -0
  176. package/lib/password-input/style/index.js +1 -0
  177. package/lib/password-input/style/style.css +604 -0
  178. package/lib/password-input/style/style.min.css +1 -0
  179. package/lib/pulldown/src/pulldown.js +5 -1
  180. package/lib/pulldown/src/pulldown.min.js +1 -1
  181. package/lib/select/index.js +19 -0
  182. package/lib/select/index.min.js +1 -0
  183. package/lib/select/src/optgroup.js +97 -0
  184. package/lib/select/src/optgroup.min.js +1 -0
  185. package/lib/select/src/option-info.js +33 -0
  186. package/lib/select/src/option-info.min.js +1 -0
  187. package/lib/select/src/option.js +93 -0
  188. package/lib/select/src/option.min.js +1 -0
  189. package/lib/select/src/select.js +1315 -0
  190. package/lib/select/src/select.min.js +1 -0
  191. package/lib/select/src/util.js +50 -0
  192. package/lib/select/src/util.min.js +1 -0
  193. package/lib/select/style/index.js +1 -0
  194. package/lib/select/style/style.css +207 -0
  195. package/lib/select/style/style.min.css +1 -0
  196. package/lib/style.css +1 -1
  197. package/lib/style.min.css +1 -1
  198. package/lib/tab-pane/index.js +19 -0
  199. package/lib/tab-pane/index.min.js +1 -0
  200. package/lib/tab-pane/style/index.js +1 -0
  201. package/lib/tab-pane/style/style.css +0 -0
  202. package/lib/tab-pane/style/style.min.css +0 -0
  203. package/lib/tabs/index.js +19 -0
  204. package/lib/tabs/index.min.js +1 -0
  205. package/lib/tabs/src/tab-pane.js +128 -0
  206. package/lib/tabs/src/tab-pane.min.js +1 -0
  207. package/lib/tabs/src/tabs.js +630 -0
  208. package/lib/tabs/src/tabs.min.js +1 -0
  209. package/lib/tabs/src/util.js +29 -0
  210. package/lib/tabs/src/util.min.js +1 -0
  211. package/lib/tabs/style/index.js +1 -0
  212. package/lib/tabs/style/style.css +342 -0
  213. package/lib/tabs/style/style.min.css +1 -0
  214. package/lib/ui/index.js +1 -1
  215. package/lib/ui/index.min.js +1 -1
  216. package/lib/ui/src/log.js +1 -1
  217. package/lib/ui/src/log.min.js +1 -1
  218. package/lib/vxe-carousel/index.js +23 -0
  219. package/lib/vxe-carousel/index.min.js +1 -0
  220. package/lib/vxe-carousel/style/index.js +1 -0
  221. package/lib/vxe-carousel/style/style.css +185 -0
  222. package/lib/vxe-carousel/style/style.min.css +1 -0
  223. package/lib/vxe-carousel-item/index.js +23 -0
  224. package/lib/vxe-carousel-item/index.min.js +1 -0
  225. package/lib/vxe-carousel-item/style/index.js +1 -0
  226. package/lib/vxe-carousel-item/style/style.css +0 -0
  227. package/lib/vxe-carousel-item/style/style.min.css +0 -0
  228. package/lib/vxe-checkbox/index.js +23 -0
  229. package/lib/vxe-checkbox/index.min.js +1 -0
  230. package/lib/vxe-checkbox/style/index.js +1 -0
  231. package/lib/vxe-checkbox/style/style.css +117 -0
  232. package/lib/vxe-checkbox/style/style.min.css +1 -0
  233. package/lib/vxe-checkbox-group/index.js +23 -0
  234. package/lib/vxe-checkbox-group/index.min.js +1 -0
  235. package/lib/vxe-checkbox-group/style/index.js +1 -0
  236. package/lib/vxe-checkbox-group/style/style.css +0 -0
  237. package/lib/vxe-checkbox-group/style/style.min.css +0 -0
  238. package/lib/vxe-icon-picker/index.js +23 -0
  239. package/lib/vxe-icon-picker/index.min.js +1 -0
  240. package/lib/vxe-icon-picker/style/index.js +1 -0
  241. package/lib/vxe-icon-picker/style/style.css +207 -0
  242. package/lib/vxe-icon-picker/style/style.min.css +1 -0
  243. package/lib/vxe-input/index.js +23 -0
  244. package/lib/vxe-input/index.min.js +1 -0
  245. package/lib/vxe-input/style/index.js +1 -0
  246. package/lib/vxe-input/style/style.css +941 -0
  247. package/lib/vxe-input/style/style.min.css +1 -0
  248. package/lib/vxe-optgroup/index.js +23 -0
  249. package/lib/vxe-optgroup/index.min.js +1 -0
  250. package/lib/vxe-optgroup/style/index.js +1 -0
  251. package/lib/vxe-optgroup/style/style.css +0 -0
  252. package/lib/vxe-optgroup/style/style.min.css +0 -0
  253. package/lib/vxe-option/index.js +23 -0
  254. package/lib/vxe-option/index.min.js +1 -0
  255. package/lib/vxe-option/style/index.js +1 -0
  256. package/lib/vxe-option/style/style.css +0 -0
  257. package/lib/vxe-option/style/style.min.css +0 -0
  258. package/lib/vxe-password-input/index.js +23 -0
  259. package/lib/vxe-password-input/index.min.js +1 -0
  260. package/lib/vxe-password-input/style/index.js +1 -0
  261. package/lib/vxe-password-input/style/style.css +604 -0
  262. package/lib/vxe-password-input/style/style.min.css +1 -0
  263. package/lib/vxe-select/index.js +23 -0
  264. package/lib/vxe-select/index.min.js +1 -0
  265. package/lib/vxe-select/style/index.js +1 -0
  266. package/lib/vxe-select/style/style.css +207 -0
  267. package/lib/vxe-select/style/style.min.css +1 -0
  268. package/lib/vxe-tab-pane/index.js +23 -0
  269. package/lib/vxe-tab-pane/index.min.js +1 -0
  270. package/lib/vxe-tab-pane/style/index.js +1 -0
  271. package/lib/vxe-tab-pane/style/style.css +0 -0
  272. package/lib/vxe-tab-pane/style/style.min.css +0 -0
  273. package/lib/vxe-tabs/index.js +23 -0
  274. package/lib/vxe-tabs/index.min.js +1 -0
  275. package/lib/vxe-tabs/style/index.js +1 -0
  276. package/lib/vxe-tabs/style/style.css +342 -0
  277. package/lib/vxe-tabs/style/style.min.css +1 -0
  278. package/package.json +1 -1
  279. package/packages/button/src/button.ts +3 -0
  280. package/packages/carousel/index.ts +16 -0
  281. package/packages/carousel/src/carousel-item.ts +114 -0
  282. package/packages/carousel/src/carousel.ts +449 -0
  283. package/packages/carousel/src/util.ts +21 -0
  284. package/packages/carousel-item/index.ts +16 -0
  285. package/packages/checkbox/index.ts +16 -0
  286. package/packages/checkbox/src/checkbox.ts +176 -0
  287. package/packages/checkbox/src/group.ts +178 -0
  288. package/packages/checkbox-group/index.ts +16 -0
  289. package/packages/components.ts +39 -39
  290. package/packages/date-picker/src/date-picker.ts +3 -0
  291. package/packages/icon-picker/index.ts +16 -0
  292. package/packages/icon-picker/src/icon-picker.ts +711 -0
  293. package/packages/input/index.ts +16 -0
  294. package/packages/input/src/input.ts +2995 -0
  295. package/packages/layout-footer/src/layout-footer.ts +4 -3
  296. package/packages/layout-header/src/layout-header.ts +2 -1
  297. package/packages/optgroup/index.ts +16 -0
  298. package/packages/option/index.ts +16 -0
  299. package/packages/pager/index.ts +16 -0
  300. package/packages/pager/src/pager.ts +743 -0
  301. package/packages/password-input/index.ts +16 -0
  302. package/packages/password-input/src/password-input.ts +427 -0
  303. package/packages/pulldown/src/pulldown.ts +5 -1
  304. package/packages/select/index.ts +16 -0
  305. package/packages/select/src/optgroup.ts +107 -0
  306. package/packages/select/src/option-info.ts +20 -0
  307. package/packages/select/src/option.ts +103 -0
  308. package/packages/select/src/select.ts +1325 -0
  309. package/packages/select/src/util.ts +46 -0
  310. package/packages/tab-pane/index.ts +16 -0
  311. package/packages/tabs/index.ts +16 -0
  312. package/packages/tabs/src/tab-pane.ts +136 -0
  313. package/packages/tabs/src/tabs.ts +630 -0
  314. package/packages/tabs/src/util.ts +21 -0
  315. package/types/components/carousel.d.ts +5 -0
  316. package/types/components/icon-picker.d.ts +4 -0
  317. package/types/components/input.d.ts +9 -1
  318. package/types/components/optgroup.d.ts +10 -4
  319. package/types/components/tabs.d.ts +4 -0
  320. /package/es/icon/style/{iconfont.1725630285930.ttf → iconfont.1725723159302.ttf} +0 -0
  321. /package/es/icon/style/{iconfont.1725630285930.woff → iconfont.1725723159302.woff} +0 -0
  322. /package/es/icon/style/{iconfont.1725630285930.woff2 → iconfont.1725723159302.woff2} +0 -0
  323. /package/es/{iconfont.1725630285930.ttf → iconfont.1725723159302.ttf} +0 -0
  324. /package/es/{iconfont.1725630285930.woff → iconfont.1725723159302.woff} +0 -0
  325. /package/es/{iconfont.1725630285930.woff2 → iconfont.1725723159302.woff2} +0 -0
  326. /package/lib/icon/style/{iconfont.1725630285930.ttf → iconfont.1725723159302.ttf} +0 -0
  327. /package/lib/icon/style/{iconfont.1725630285930.woff → iconfont.1725723159302.woff} +0 -0
  328. /package/lib/icon/style/{iconfont.1725630285930.woff2 → iconfont.1725723159302.woff2} +0 -0
  329. /package/lib/{iconfont.1725630285930.ttf → iconfont.1725723159302.ttf} +0 -0
  330. /package/lib/{iconfont.1725630285930.woff → iconfont.1725723159302.woff} +0 -0
  331. /package/lib/{iconfont.1725630285930.woff2 → iconfont.1725723159302.woff2} +0 -0
@@ -0,0 +1,16 @@
1
+ import { VueConstructor } from 'vue'
2
+ import { VxeUI } from '@vxe-ui/core'
3
+ import VxeCarouselComponent from './src/carousel'
4
+ import { dynamicApp } from '../dynamics'
5
+
6
+ export const VxeCarousel = Object.assign({}, VxeCarouselComponent, {
7
+ install (app: VueConstructor) {
8
+ app.component(VxeCarouselComponent.name as string, VxeCarouselComponent)
9
+ }
10
+ })
11
+
12
+ dynamicApp.use(VxeCarousel)
13
+ VxeUI.component(VxeCarouselComponent)
14
+
15
+ export const Carousel = VxeCarousel
16
+ export default VxeCarousel
@@ -0,0 +1,114 @@
1
+ import { CreateElement, PropType, VNode } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
3
+ import XEUtils from 'xe-utils'
4
+ import { globalMixins, createEvent } from '../../ui'
5
+ import { assembleCarouselItem, destroyCarouselItem } from './util'
6
+
7
+ import type { VxeCarouselItemPropTypes, CarouselItemReactData, VxeCarouselItemEmits, VxeCarouselDefines, VxeComponentSizeType, ValueOf, VxeCarouselConstructor, VxeCarouselPrivateMethods } from '../../../types'
8
+
9
+ export default defineVxeComponent({
10
+ name: 'VxeCarouselItem',
11
+ mixins: [
12
+ globalMixins.sizeMixin
13
+ ],
14
+ props: {
15
+ name: [String, Number] as PropType<VxeCarouselItemPropTypes.Name>,
16
+ className: String as PropType<VxeCarouselItemPropTypes.ClassName>,
17
+ url: String as PropType<VxeCarouselItemPropTypes.Url>
18
+ },
19
+ inject: {
20
+ $xeCarousel: {
21
+ default: null
22
+ }
23
+ },
24
+ data () {
25
+ const xID = XEUtils.uniqueId()
26
+ const reactData: CarouselItemReactData = {
27
+ currentDate: null
28
+ }
29
+ const itemConfig: VxeCarouselDefines.ItemConfig = {
30
+ id: xID,
31
+ name: '',
32
+ url: '',
33
+ className: '',
34
+ slots: {}
35
+ }
36
+ return {
37
+ xID,
38
+ reactData,
39
+ itemConfig
40
+ }
41
+ },
42
+ computed: {
43
+ ...({} as {
44
+ computeSize(): VxeComponentSizeType
45
+ $xeCarousel(): (VxeCarouselConstructor & VxeCarouselPrivateMethods) | null
46
+ })
47
+ },
48
+ methods: {
49
+ //
50
+ // Method
51
+ //
52
+ dispatchEvent (type: ValueOf<VxeCarouselItemEmits>, params: Record<string, any>, evnt: Event | null) {
53
+ const $xeCarouselItem = this
54
+ $xeCarouselItem.$emit(type, createEvent(evnt, { $carouselItem: $xeCarouselItem }, params))
55
+ },
56
+ //
57
+ // Render
58
+ //
59
+ renderVN (h: CreateElement): VNode {
60
+ return h('div', {
61
+ ref: 'refElem'
62
+ })
63
+ }
64
+ },
65
+ watch: {
66
+ name (val) {
67
+ const $xeCarouselItem = this
68
+ const itemConfig = $xeCarouselItem.itemConfig
69
+
70
+ itemConfig.name = val
71
+ },
72
+ url (val) {
73
+ const $xeCarouselItem = this
74
+ const itemConfig = $xeCarouselItem.itemConfig
75
+
76
+ itemConfig.url = val
77
+ }
78
+ },
79
+ created () {
80
+ const $xeCarouselItem = this
81
+ const props = $xeCarouselItem
82
+ const slots = $xeCarouselItem.$scopedSlots
83
+ const itemConfig = $xeCarouselItem.itemConfig
84
+
85
+ Object.assign(itemConfig, {
86
+ name: props.name,
87
+ url: props.url,
88
+ className: props.className,
89
+ slots
90
+ })
91
+ },
92
+ mounted () {
93
+ const $xeCarouselItem = this
94
+ const itemConfig = $xeCarouselItem.itemConfig
95
+ const $xeCarousel = $xeCarouselItem.$xeCarousel
96
+
97
+ const elem = $xeCarouselItem.$refs.refElem as HTMLElement
98
+ if ($xeCarousel && elem) {
99
+ assembleCarouselItem($xeCarousel, elem, itemConfig)
100
+ }
101
+ },
102
+ beforeDestroy () {
103
+ const $xeCarouselItem = this
104
+ const itemConfig = $xeCarouselItem.itemConfig
105
+ const $xeCarousel = $xeCarouselItem.$xeCarousel
106
+
107
+ if ($xeCarousel) {
108
+ destroyCarouselItem($xeCarousel, itemConfig)
109
+ }
110
+ },
111
+ render (this: any, h) {
112
+ return this.renderVN(h)
113
+ }
114
+ })
@@ -0,0 +1,449 @@
1
+ import { CreateElement, PropType, VNode } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
3
+ import XEUtils from 'xe-utils'
4
+ import { getConfig, getIcon, createEvent, globalMixins, renderEmptyElement } from '../../ui'
5
+ import { getSlotVNs } from '../../ui/src/vn'
6
+ import { toCssUnit } from '../..//ui/src/dom'
7
+ import VxeLoadingComponent from '../../loading/src/loading'
8
+
9
+ import type { CarouselReactData, VxeComponentSizeType, VxeCarouselPropTypes, CarouselInternalData, VxeCarouselEmits, VxeCarouselDefines, ValueOf } from '../../../types'
10
+
11
+ export default defineVxeComponent({
12
+ name: 'VxeCarousel',
13
+ mixins: [
14
+ globalMixins.sizeMixin
15
+ ],
16
+ props: {
17
+ value: [String, Number] as PropType<VxeCarouselPropTypes.ModelValue>,
18
+ options: Array as PropType<VxeCarouselPropTypes.Options>,
19
+ loading: Boolean as PropType<VxeCarouselPropTypes.Loading>,
20
+ height: {
21
+ type: [Number, String] as PropType<VxeCarouselPropTypes.Height>,
22
+ default: () => getConfig().carousel.height
23
+ },
24
+ width: {
25
+ type: [Number, String] as PropType<VxeCarouselPropTypes.Width>,
26
+ default: () => getConfig().carousel.width
27
+ },
28
+ autoPlay: {
29
+ type: Boolean as PropType<VxeCarouselPropTypes.AutoPlay>,
30
+ default: () => getConfig().carousel.autoPlay
31
+ },
32
+ interval: {
33
+ type: [Number, String] as PropType<VxeCarouselPropTypes.Interval>,
34
+ default: () => getConfig().carousel.interval
35
+ },
36
+ loop: {
37
+ type: Boolean as PropType<VxeCarouselPropTypes.Loop>,
38
+ default: () => getConfig().carousel.loop
39
+ },
40
+ vertical: {
41
+ type: Boolean as PropType<VxeCarouselPropTypes.Vertical>,
42
+ default: () => getConfig().carousel.vertical
43
+ },
44
+ showIndicators: {
45
+ type: Boolean as PropType<VxeCarouselPropTypes.ShowIndicators>,
46
+ default: () => getConfig().carousel.showIndicators
47
+ }
48
+ },
49
+ data () {
50
+ const xID = XEUtils.uniqueId()
51
+ const reactData: CarouselReactData = {
52
+ activeName: '',
53
+ staticItems: [],
54
+ itemWidth: 0,
55
+ itemHeight: 0
56
+ }
57
+ const internalData: CarouselInternalData = {
58
+ apTimeout: undefined,
59
+ stopFlag: false
60
+ }
61
+ return {
62
+ xID,
63
+ reactData,
64
+ internalData
65
+ }
66
+ },
67
+ provide () {
68
+ const $xeCarousel = this
69
+ return {
70
+ $xeCarousel
71
+ }
72
+ },
73
+ computed: {
74
+ ...({} as {
75
+ computeSize(): VxeComponentSizeType
76
+ }),
77
+ computeListStyle () {
78
+ const $xeCarousel = this
79
+ const props = $xeCarousel
80
+ const reactData = $xeCarousel.reactData
81
+
82
+ const { vertical, options } = props
83
+ const { activeName, itemWidth, itemHeight, staticItems } = reactData
84
+ const list = (staticItems && staticItems.length ? staticItems : options) || []
85
+ const activeIndex = Math.max(0, XEUtils.findIndexOf(list, item => item.name === activeName))
86
+ const stys: Record<string, any> = {}
87
+ if (vertical) {
88
+ stys.transform = `translateY(-${activeIndex * itemHeight}px)`
89
+ } else {
90
+ stys.width = `${itemWidth * list.length}px`
91
+ stys.transform = `translateX(-${activeIndex * itemWidth}px)`
92
+ }
93
+ return stys
94
+ }
95
+ },
96
+ methods: {
97
+ //
98
+ // Method
99
+ //
100
+ dispatchEvent (type: ValueOf<VxeCarouselEmits>, params: Record<string, any>, evnt: Event | null) {
101
+ const $xeCarousel = this
102
+ $xeCarousel.$emit(type, createEvent(evnt, { $carousel: $xeCarousel }, params))
103
+ },
104
+ prev () {
105
+ const $xeCarousel = this
106
+
107
+ if ($xeCarousel.handlePrevNext(false)) {
108
+ $xeCarousel.handleAutoPlay()
109
+ }
110
+ return $xeCarousel.$nextTick()
111
+ },
112
+ next () {
113
+ const $xeCarousel = this
114
+
115
+ if ($xeCarousel.handlePrevNext(true)) {
116
+ $xeCarousel.handleAutoPlay()
117
+ }
118
+ return $xeCarousel.$nextTick()
119
+ },
120
+ updateStyle () {
121
+ const $xeCarousel = this
122
+ const reactData = $xeCarousel.reactData
123
+
124
+ $xeCarousel.$nextTick(() => {
125
+ const wrapperElem = $xeCarousel.$refs.refWrapperElem as HTMLElement
126
+ if (wrapperElem) {
127
+ reactData.itemWidth = wrapperElem.clientWidth
128
+ reactData.itemHeight = wrapperElem.clientHeight
129
+ }
130
+ })
131
+ },
132
+ clickItemEvent (evnt: Event, item: VxeCarouselDefines.ItemConfig | VxeCarouselPropTypes.Option) {
133
+ const $xeCarousel = this
134
+ const reactData = $xeCarousel.reactData
135
+
136
+ const value = item.name
137
+ reactData.activeName = item.name
138
+ $xeCarousel.$emit('input', value)
139
+ $xeCarousel.$emit('change', { value }, evnt)
140
+ $xeCarousel.updateStyle()
141
+ },
142
+ initDefaultActive (list?: VxeCarouselDefines.ItemConfig[] | VxeCarouselPropTypes.Options) {
143
+ const $xeCarousel = this
144
+ const props = $xeCarousel
145
+ const reactData = $xeCarousel.reactData
146
+
147
+ let activeName: VxeCarouselPropTypes.ModelValue | undefined = null
148
+ if (list && list.length) {
149
+ let validVal = false
150
+ activeName = props.value
151
+ list.forEach((item) => {
152
+ if (activeName === item.name) {
153
+ validVal = true
154
+ }
155
+ })
156
+ if (!validVal) {
157
+ activeName = list[0].name
158
+ $xeCarousel.$emit('input', activeName)
159
+ }
160
+ }
161
+ reactData.activeName = activeName
162
+ },
163
+ handlePrevNext (isNext: boolean) {
164
+ const $xeCarousel = this
165
+ const props = $xeCarousel
166
+ const reactData = $xeCarousel.reactData
167
+
168
+ const { options, loop } = props
169
+ const { activeName, staticItems } = reactData
170
+ const list = (staticItems && staticItems.length ? staticItems : options) || []
171
+ const index = Math.max(0, XEUtils.findIndexOf(list, item => item.name === activeName))
172
+ if (index > -1) {
173
+ let item: VxeCarouselDefines.ItemConfig | VxeCarouselPropTypes.Option | null = null
174
+ if (isNext) {
175
+ if (index < list.length - 1) {
176
+ item = list[index + 1]
177
+ } else {
178
+ if (loop) {
179
+ item = list[0]
180
+ }
181
+ }
182
+ } else {
183
+ if (index > 0) {
184
+ item = list[index - 1]
185
+ } else {
186
+ if (loop) {
187
+ item = list[list.length - 1]
188
+ }
189
+ }
190
+ }
191
+ if (item) {
192
+ const name = item.name
193
+ const value = name
194
+ reactData.activeName = name
195
+ $xeCarousel.$emit('input', value)
196
+ return true
197
+ }
198
+ }
199
+ return false
200
+ },
201
+ prevEvent (evnt: Event) {
202
+ const $xeCarousel = this
203
+ const reactData = $xeCarousel.reactData
204
+
205
+ if ($xeCarousel.handlePrevNext(false)) {
206
+ const value = reactData.activeName
207
+ $xeCarousel.$emit('change', { value }, evnt)
208
+ }
209
+ },
210
+ nextEvent (evnt: Event) {
211
+ const $xeCarousel = this
212
+ const reactData = $xeCarousel.reactData
213
+
214
+ if ($xeCarousel.handlePrevNext(true)) {
215
+ const value = reactData.activeName
216
+ $xeCarousel.$emit('change', { value }, evnt)
217
+ }
218
+ },
219
+ stopAutoPlay () {
220
+ const $xeCarousel = this
221
+ const internalData = $xeCarousel.internalData
222
+
223
+ const { apTimeout } = internalData
224
+ internalData.stopFlag = true
225
+ if (apTimeout) {
226
+ clearTimeout(apTimeout)
227
+ internalData.apTimeout = undefined
228
+ }
229
+ },
230
+ handleAutoPlay () {
231
+ const $xeCarousel = this
232
+ const props = $xeCarousel
233
+ const internalData = $xeCarousel.internalData
234
+
235
+ const { autoPlay, interval } = props
236
+ const { stopFlag } = internalData
237
+ $xeCarousel.stopAutoPlay()
238
+ if (autoPlay) {
239
+ internalData.stopFlag = false
240
+ internalData.apTimeout = setTimeout(() => {
241
+ if (!stopFlag) {
242
+ $xeCarousel.handlePrevNext(true)
243
+ }
244
+ }, XEUtils.toNumber(interval) || 300)
245
+ }
246
+ },
247
+ mouseenterEvent () {
248
+ const $xeCarousel = this
249
+
250
+ $xeCarousel.stopAutoPlay()
251
+ },
252
+ mouseleaveEvent () {
253
+ const $xeCarousel = this
254
+
255
+ $xeCarousel.handleAutoPlay()
256
+ },
257
+ callSlot (slotFunc: any, params: any) {
258
+ const $xeCarousel = this
259
+ const slots = $xeCarousel.$scopedSlots
260
+
261
+ if (slotFunc) {
262
+ if (XEUtils.isString(slotFunc)) {
263
+ slotFunc = slots[slotFunc] || null
264
+ }
265
+ if (XEUtils.isFunction(slotFunc)) {
266
+ return getSlotVNs(slotFunc(params))
267
+ }
268
+ }
269
+ return []
270
+ },
271
+
272
+ //
273
+ // Render
274
+ //
275
+ renderItemWrapper (h: CreateElement, list: VxeCarouselDefines.ItemConfig[] | VxeCarouselPropTypes.Options) {
276
+ const $xeCarousel = this
277
+ const props = $xeCarousel
278
+ const reactData = $xeCarousel.reactData
279
+
280
+ const { height } = props
281
+ const { activeName } = reactData
282
+ const listStyle = $xeCarousel.computeListStyle
283
+
284
+ return h('div', {
285
+ class: 'vxe-carousel--list',
286
+ style: listStyle
287
+ }, list.map(item => {
288
+ const { name, url, slots } = item
289
+ const defaultSlot = slots ? slots.default : null
290
+ return h('div', {
291
+ key: `${name}`,
292
+ class: ['vxe-carousel--item-inner', {
293
+ 'is--active': activeName === name
294
+ }],
295
+ style: height
296
+ ? {
297
+ height: toCssUnit(height)
298
+ }
299
+ : {}
300
+ }, defaultSlot
301
+ ? $xeCarousel.callSlot(defaultSlot, {})
302
+ : [
303
+ h('img', {
304
+ class: 'vxe-carousel--item-img',
305
+ attrs: {
306
+ src: url
307
+ }
308
+ })
309
+ ])
310
+ }))
311
+ },
312
+ renderIndicators (h: CreateElement, list: VxeCarouselDefines.ItemConfig[] | VxeCarouselPropTypes.Options) {
313
+ const $xeCarousel = this
314
+ const reactData = $xeCarousel.reactData
315
+
316
+ const { activeName } = reactData
317
+ return h('div', {
318
+ class: 'vxe-carousel--indicators'
319
+ }, list.map((item) => {
320
+ const { name } = item
321
+ return h('div', {
322
+ key: `${name}`,
323
+ class: ['vxe-carousel--indicators-item', {
324
+ 'is--active': activeName === name
325
+ }],
326
+ on: {
327
+ click (evnt: MouseEvent) {
328
+ $xeCarousel.clickItemEvent(evnt, item)
329
+ }
330
+ }
331
+ })
332
+ }))
333
+ },
334
+ renderVN (h: CreateElement): VNode {
335
+ const $xeCarousel = this
336
+ const props = $xeCarousel
337
+ const slots = $xeCarousel.$scopedSlots
338
+ const reactData = $xeCarousel.reactData
339
+
340
+ const { loading, height, width, showIndicators, vertical, options } = props
341
+ const { staticItems } = reactData
342
+ const defaultSlot = slots.default
343
+ const list = (staticItems && staticItems.length ? staticItems : options) || []
344
+
345
+ return h('div', {
346
+ ref: 'refElem',
347
+ class: ['vxe-carousel', `is--${vertical ? 'vertical' : 'horizontal'}`],
348
+ style: width
349
+ ? {
350
+ width: toCssUnit(width)
351
+ }
352
+ : {},
353
+ on: {
354
+ mouseenter: $xeCarousel.mouseenterEvent,
355
+ mouseleave: $xeCarousel.mouseleaveEvent
356
+ }
357
+ }, [
358
+ h('div', {
359
+ class: 'vxe-carousel--slots'
360
+ }, defaultSlot ? defaultSlot({}) : []),
361
+ h('div', {
362
+ ref: 'refWrapperElem',
363
+ class: 'vxe-carousel--item-wrapper',
364
+ style: height
365
+ ? {
366
+ height: toCssUnit(height)
367
+ }
368
+ : {}
369
+ }, [
370
+ $xeCarousel.renderItemWrapper(h, list)
371
+ ]),
372
+ showIndicators ? $xeCarousel.renderIndicators(h, list) : renderEmptyElement($xeCarousel),
373
+ h('div', {
374
+ class: 'vxe-carousel--btn-wrapper'
375
+ }, [
376
+ h('div', {
377
+ class: 'vxe-carousel--previous-btn',
378
+ on: {
379
+ click: $xeCarousel.prevEvent
380
+ }
381
+ }, [
382
+ h('i', {
383
+ class: vertical ? getIcon().CAROUSEL_VERTICAL_PREVIOUS : getIcon().CAROUSEL_HORIZONTAL_PREVIOUS
384
+ })
385
+ ]),
386
+ h('div', {
387
+ class: 'vxe-carousel--next-btn',
388
+ on: {
389
+ click: $xeCarousel.nextEvent
390
+ }
391
+ }, [
392
+ h('i', {
393
+ class: vertical ? getIcon().CAROUSEL_VERTICAL_NEXT : getIcon().CAROUSEL_HORIZONTAL_NEXT
394
+ })
395
+ ])
396
+ ]),
397
+ /**
398
+ * 加载中
399
+ */
400
+ h(VxeLoadingComponent, {
401
+ class: 'vxe-carousel--loading',
402
+ props: {
403
+ value: loading
404
+ }
405
+ })
406
+ ])
407
+ }
408
+ },
409
+ watch: {
410
+ options () {
411
+ const $xeCarousel = this
412
+ const props = $xeCarousel
413
+
414
+ $xeCarousel.initDefaultActive(props.options)
415
+ },
416
+ 'reactData.staticItems' () {
417
+ const $xeCarousel = this
418
+ const reactData = $xeCarousel.reactData
419
+
420
+ $xeCarousel.initDefaultActive(reactData.staticItems)
421
+ },
422
+ autoPlay () {
423
+ const $xeCarousel = this
424
+
425
+ $xeCarousel.handleAutoPlay()
426
+ }
427
+ },
428
+ created () {
429
+ const $xeCarousel = this
430
+ const props = $xeCarousel
431
+ const reactData = $xeCarousel.reactData
432
+
433
+ $xeCarousel.initDefaultActive(reactData.staticItems.length ? reactData.staticItems : props.options)
434
+ },
435
+ mounted () {
436
+ const $xeCarousel = this
437
+
438
+ $xeCarousel.handleAutoPlay()
439
+ $xeCarousel.updateStyle()
440
+ },
441
+ beforeDestroy () {
442
+ const $xeCarousel = this
443
+
444
+ $xeCarousel.stopAutoPlay()
445
+ },
446
+ render (this: any, h) {
447
+ return this.renderVN(h)
448
+ }
449
+ })
@@ -0,0 +1,21 @@
1
+ import XEUtils from 'xe-utils'
2
+
3
+ import type { VxeCarouselConstructor, VxeCarouselPrivateMethods, VxeCarouselDefines } from '../../../types'
4
+
5
+ export function assembleCarouselItem ($xeCarousel: VxeCarouselConstructor & VxeCarouselPrivateMethods, elem: HTMLElement, itemConfig: VxeCarouselDefines.ItemConfig) {
6
+ const staticItems = $xeCarousel.reactData.staticItems
7
+ const parentElem = elem.parentNode
8
+ if (parentElem) {
9
+ staticItems.splice(XEUtils.arrayIndexOf(parentElem.children, elem), 0, itemConfig)
10
+ }
11
+ $xeCarousel.reactData.staticItems = staticItems.slice(0)
12
+ }
13
+
14
+ export function destroyCarouselItem ($xeCarousel: VxeCarouselConstructor & VxeCarouselPrivateMethods, itemConfig: VxeCarouselDefines.ItemConfig) {
15
+ const staticItems = $xeCarousel.reactData.staticItems
16
+ const index = XEUtils.findIndexOf(staticItems, item => item.id === itemConfig.id)
17
+ if (index > -1) {
18
+ staticItems.splice(index, 1)
19
+ }
20
+ $xeCarousel.reactData.staticItems = staticItems.slice(0)
21
+ }
@@ -0,0 +1,16 @@
1
+ import { VueConstructor } from 'vue'
2
+ import { VxeUI } from '@vxe-ui/core'
3
+ import VxeCarouselItemComponent from '../carousel/src/carousel-item'
4
+ import { dynamicApp } from '../dynamics'
5
+
6
+ export const VxeCarouselItem = Object.assign({}, VxeCarouselItemComponent, {
7
+ install (app: VueConstructor) {
8
+ app.component(VxeCarouselItemComponent.name as string, VxeCarouselItemComponent)
9
+ }
10
+ })
11
+
12
+ dynamicApp.use(VxeCarouselItem)
13
+ VxeUI.component(VxeCarouselItemComponent)
14
+
15
+ export const CarouselItem = VxeCarouselItem
16
+ export default VxeCarouselItem
@@ -0,0 +1,16 @@
1
+ import { VueConstructor } from 'vue'
2
+ import { VxeUI } from '@vxe-ui/core'
3
+ import VxeCheckboxComponent from './src/checkbox'
4
+ import { dynamicApp } from '../dynamics'
5
+
6
+ export const VxeCheckbox = Object.assign(VxeCheckboxComponent, {
7
+ install (app: VueConstructor) {
8
+ app.component(VxeCheckboxComponent.name as string, VxeCheckboxComponent)
9
+ }
10
+ })
11
+
12
+ dynamicApp.use(VxeCheckbox)
13
+ VxeUI.component(VxeCheckboxComponent)
14
+
15
+ export const Checkbox = VxeCheckbox
16
+ export default VxeCheckbox