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,630 @@
1
+ import { PropType, CreateElement, VNode } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
3
+ import XEUtils from 'xe-utils'
4
+ import { createEvent, getConfig, getIcon, globalEvents, permission, renderEmptyElement } from '../../ui'
5
+ import { getSlotVNs } from '../../ui/src/vn'
6
+ import { toCssUnit } from '../..//ui/src/dom'
7
+ import { warnLog } from '../../ui/src/log'
8
+
9
+ import type { VxeTabsPropTypes, VxeTabPaneProps, VxeTabsEmits, TabsInternalData, TabsReactData, VxeComponentSizeType, VxeTabsConstructor, VxeTabsPrivateMethods, VxeTabPaneDefines, ValueOf } from '../../../types'
10
+
11
+ export default defineVxeComponent({
12
+ name: 'VxeTabs',
13
+ props: {
14
+ value: [String, Number, Boolean] as PropType<VxeTabsPropTypes.ModelValue>,
15
+ options: Array as PropType<VxeTabsPropTypes.Options>,
16
+ height: [String, Number] as PropType<VxeTabsPropTypes.Height>,
17
+ destroyOnClose: Boolean as PropType<VxeTabsPropTypes.DestroyOnClose>,
18
+ titleWidth: [String, Number] as PropType<VxeTabsPropTypes.TitleWidth>,
19
+ titleAlign: [String, Number] as PropType<VxeTabsPropTypes.TitleAlign>,
20
+ type: String as PropType<VxeTabsPropTypes.Type>,
21
+ showClose: Boolean as PropType<VxeTabsPropTypes.ShowClose>,
22
+ padding: {
23
+ type: Boolean as PropType<VxeTabsPropTypes.Padding>,
24
+ default: () => getConfig().tabs.padding
25
+ },
26
+ trigger: String as PropType<VxeTabsPropTypes.Trigger>,
27
+ beforeChangeMethod: Function as PropType<VxeTabsPropTypes.BeforeChangeMethod>,
28
+ beforeCloseMethod: Function as PropType<VxeTabsPropTypes.BeforeCloseMethod>
29
+ },
30
+ inject: {
31
+ $xeParentTabs: {
32
+ from: '$xeTabs',
33
+ default: null
34
+ }
35
+ },
36
+ provide () {
37
+ const $xeTabs = this
38
+ return {
39
+ $xeTabs
40
+ }
41
+ },
42
+ data () {
43
+ const xID = XEUtils.uniqueId()
44
+ const reactData: TabsReactData = {
45
+ staticTabs: [],
46
+ activeName: null,
47
+ initNames: [],
48
+ lintLeft: 0,
49
+ lintWidth: 0,
50
+ isTabOver: false,
51
+ resizeFlag: 1
52
+ }
53
+ const internalData: TabsInternalData = {
54
+ slTimeout: undefined
55
+ }
56
+ return {
57
+ xID,
58
+ reactData,
59
+ internalData
60
+ }
61
+ },
62
+ computed: {
63
+ ...({} as {
64
+ computeSize(): VxeComponentSizeType
65
+ $xeParentTabs():(VxeTabsConstructor & VxeTabsPrivateMethods) | null
66
+ }),
67
+ computeParentResizeFlag () {
68
+ const $xeTabs = this
69
+ const $xeParentTabs = $xeTabs.$xeParentTabs
70
+
71
+ return $xeParentTabs ? $xeParentTabs.reactData.resizeFlag : null
72
+ },
73
+ computeTabOptions (this: any) {
74
+ const $xeTabs = this
75
+ const props = $xeTabs
76
+
77
+ const options = props.options as VxeTabsPropTypes.Options
78
+ return (options || []).filter((item) => $xeTabs.handleFilterTab(item))
79
+ },
80
+ computeTabStaticOptions (this: any) {
81
+ const $xeTabs = this
82
+ const reactData = $xeTabs.reactData
83
+
84
+ const staticTabs = reactData.staticTabs as VxeTabPaneDefines.TabConfig[]
85
+ return staticTabs.filter((item) => $xeTabs.handleFilterTab(item))
86
+ }
87
+ },
88
+ methods: {
89
+ //
90
+ // Method
91
+ //
92
+ dispatchEvent (type: ValueOf<VxeTabsEmits>, params: Record<string, any>, evnt: Event | null) {
93
+ const $xeTabs = this
94
+ $xeTabs.$emit(type, createEvent(evnt, { $tabs: $xeTabs }, params))
95
+ },
96
+ prev () {
97
+ const $xeTabs = this
98
+
99
+ return $xeTabs.handlePrevNext(false)
100
+ },
101
+ next () {
102
+ const $xeTabs = this
103
+
104
+ return $xeTabs.handlePrevNext(true)
105
+ },
106
+ prevTab () {
107
+ const $xeTabs = this
108
+
109
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
110
+ warnLog('vxe.error.delFunc', ['prevTab', 'prev'])
111
+ }
112
+ return $xeTabs.prev()
113
+ },
114
+ nextTab () {
115
+ const $xeTabs = this
116
+
117
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
118
+ warnLog('vxe.error.delFunc', ['nextTab', 'next'])
119
+ }
120
+ return $xeTabs.next()
121
+ },
122
+ handleFilterTab (item: VxeTabPaneProps | VxeTabPaneDefines.TabConfig) {
123
+ const { permissionCode } = item
124
+ if (permissionCode) {
125
+ if (!permission.checkVisible(permissionCode)) {
126
+ return false
127
+ }
128
+ }
129
+ return true
130
+ },
131
+ callSlot (slotFunc: any, params: any) {
132
+ const $xeTabs = this
133
+ const slots = $xeTabs.$scopedSlots
134
+
135
+ if (slotFunc) {
136
+ if (XEUtils.isString(slotFunc)) {
137
+ slotFunc = slots[slotFunc] || null
138
+ }
139
+ if (XEUtils.isFunction(slotFunc)) {
140
+ return getSlotVNs(slotFunc(params))
141
+ }
142
+ }
143
+ return []
144
+ },
145
+ updateTabStyle () {
146
+ const $xeTabs = this
147
+ const props = $xeTabs
148
+ const reactData = $xeTabs.reactData
149
+
150
+ $xeTabs.$nextTick(() => {
151
+ const { type } = props
152
+ const { activeName } = reactData
153
+ const tabOptions = $xeTabs.computeTabOptions
154
+ const tabStaticOptions = $xeTabs.computeTabStaticOptions
155
+ const headerWrapperEl = $xeTabs.$refs.refHeadWrapperElem as HTMLDivElement
156
+ let lintWidth = 0
157
+ let lintLeft = 0
158
+ let isOver = false
159
+ if (headerWrapperEl) {
160
+ const index = XEUtils.findIndexOf(tabStaticOptions.length ? tabStaticOptions : tabOptions, item => item.name === activeName)
161
+ const { children, scrollWidth, clientWidth } = headerWrapperEl
162
+ isOver = scrollWidth !== clientWidth
163
+ if (index > -1) {
164
+ const tabEl = children[index] as HTMLDivElement
165
+ const tabWidth = tabEl.clientWidth
166
+ if (type) {
167
+ if (type === 'card') {
168
+ lintWidth = tabWidth + 2
169
+ lintLeft = tabEl.offsetLeft
170
+ } else if (type === 'border-card') {
171
+ lintWidth = tabWidth + 2
172
+ lintLeft = tabEl.offsetLeft - 1
173
+ }
174
+ } else {
175
+ lintWidth = Math.max(4, Math.floor(tabWidth * 0.6))
176
+ lintLeft = tabEl.offsetLeft + Math.floor((tabWidth - lintWidth) / 2)
177
+ }
178
+ }
179
+ }
180
+ reactData.lintLeft = lintLeft
181
+ reactData.lintWidth = lintWidth
182
+ reactData.isTabOver = isOver
183
+ })
184
+ },
185
+ addInitName (name: VxeTabsPropTypes.ModelValue, evnt: Event | null) {
186
+ const $xeTabs = this
187
+ const reactData = $xeTabs.reactData
188
+
189
+ const { initNames } = reactData
190
+ if (name && !initNames.includes(name)) {
191
+ $xeTabs.dispatchEvent('tab-load', { name }, evnt)
192
+ initNames.push(name)
193
+ return true
194
+ }
195
+ return false
196
+ },
197
+ initDefaultName (list?: VxeTabsPropTypes.Options | VxeTabPaneDefines.TabConfig[]) {
198
+ const $xeTabs = this
199
+ const props = $xeTabs
200
+ const reactData = $xeTabs.reactData
201
+
202
+ let activeName: VxeTabsPropTypes.ModelValue = null
203
+ if (list && list.length) {
204
+ let validVal = false
205
+ activeName = props.value
206
+ list.forEach((item) => {
207
+ if (activeName === item.name) {
208
+ validVal = true
209
+ }
210
+ if (item && item.preload) {
211
+ $xeTabs.addInitName(item.name, null)
212
+ }
213
+ })
214
+ if (!validVal) {
215
+ activeName = list[0].name
216
+ $xeTabs.addInitName(activeName, null)
217
+ $xeTabs.$emit('input', activeName)
218
+ }
219
+ }
220
+ reactData.activeName = activeName
221
+ },
222
+ clickEvent (evnt: KeyboardEvent, item: VxeTabPaneProps | VxeTabPaneDefines.TabConfig) {
223
+ const $xeTabs = this
224
+ const props = $xeTabs
225
+ const reactData = $xeTabs.reactData
226
+
227
+ const { trigger } = props
228
+ const beforeMethod = props.beforeChangeMethod || getConfig().tabs.beforeChangeMethod
229
+ const { activeName } = reactData
230
+ const { name } = item
231
+ if (trigger === 'manual') {
232
+ $xeTabs.dispatchEvent('tab-click', { name }, evnt)
233
+ return
234
+ }
235
+ const value = name
236
+ reactData.activeName = name
237
+ $xeTabs.$emit('input', value)
238
+ $xeTabs.dispatchEvent('tab-click', { name }, evnt)
239
+ $xeTabs.addInitName(name, evnt)
240
+ if (name !== activeName) {
241
+ if (!beforeMethod || beforeMethod({ $tabs: $xeTabs, name, oldName: activeName, newName: name })) {
242
+ $xeTabs.dispatchEvent('change', { value, name, oldName: activeName, newName: name }, evnt)
243
+ } else {
244
+ $xeTabs.dispatchEvent('tab-change-fail', { value, name, oldName: activeName, newName: name }, evnt)
245
+ }
246
+ }
247
+ },
248
+ handleCloseTabEvent (evnt: KeyboardEvent, item: VxeTabPaneDefines.TabConfig | VxeTabPaneProps, index: number, list: VxeTabsPropTypes.Options | VxeTabPaneDefines.TabConfig[]) {
249
+ const $xeTabs = this
250
+ const props = $xeTabs
251
+ const reactData = $xeTabs.reactData
252
+
253
+ evnt.stopPropagation()
254
+ const { activeName } = reactData
255
+ const beforeMethod = props.beforeCloseMethod || getConfig().tabs.beforeCloseMethod
256
+ const { name } = item
257
+ const value = activeName
258
+ let nextName = value
259
+ if (activeName === name) {
260
+ const nextItem = index < list.length - 1 ? list[index + 1] : list[index - 1]
261
+ nextName = nextItem ? nextItem.name : null
262
+ }
263
+ if (!beforeMethod || beforeMethod({ $tabs: $xeTabs, value, name, nextName })) {
264
+ $xeTabs.dispatchEvent('tab-close', { value, name, nextName }, evnt)
265
+ } else {
266
+ $xeTabs.dispatchEvent('tab-close-fail', { value, name, nextName }, evnt)
267
+ }
268
+ },
269
+ startScrollAnimation (offsetPos: number, offsetSize: number) {
270
+ const $xeTabs = this
271
+ const internalData = $xeTabs.internalData
272
+
273
+ const { slTimeout } = internalData
274
+ let offsetLeft = offsetSize
275
+ let scrollCount = 6
276
+ let delayNum = 35
277
+ if (slTimeout) {
278
+ clearTimeout(slTimeout)
279
+ internalData.slTimeout = undefined
280
+ }
281
+ const scrollAnimate = () => {
282
+ const headerWrapperEl = $xeTabs.$refs.refHeadWrapperElem as HTMLDivElement
283
+ if (scrollCount > 0) {
284
+ scrollCount--
285
+ if (headerWrapperEl) {
286
+ const { clientWidth, scrollWidth, scrollLeft } = headerWrapperEl
287
+ offsetLeft = Math.floor(offsetLeft / 2)
288
+ if (offsetPos > 0) {
289
+ if (clientWidth + scrollLeft < scrollWidth) {
290
+ headerWrapperEl.scrollLeft += offsetLeft
291
+ delayNum -= 4
292
+ internalData.slTimeout = setTimeout(scrollAnimate, delayNum)
293
+ }
294
+ } else {
295
+ if (scrollLeft > 0) {
296
+ headerWrapperEl.scrollLeft -= offsetLeft
297
+ delayNum -= 4
298
+ internalData.slTimeout = setTimeout(scrollAnimate, delayNum)
299
+ }
300
+ }
301
+ $xeTabs.updateTabStyle()
302
+ }
303
+ }
304
+ }
305
+ scrollAnimate()
306
+ },
307
+ handleScrollToLeft (offsetPos: number) {
308
+ const $xeTabs = this
309
+
310
+ const headerWrapperEl = $xeTabs.$refs.refHeadWrapperElem as HTMLDivElement
311
+ if (headerWrapperEl) {
312
+ const offsetSize = Math.floor(headerWrapperEl.clientWidth * 0.75)
313
+ $xeTabs.startScrollAnimation(offsetPos, offsetSize)
314
+ }
315
+ },
316
+ scrollLeftEvent () {
317
+ const $xeTabs = this
318
+
319
+ $xeTabs.handleScrollToLeft(-1)
320
+ },
321
+ scrollRightEvent () {
322
+ const $xeTabs = this
323
+
324
+ $xeTabs.handleScrollToLeft(1)
325
+ },
326
+ scrollToTab (name: VxeTabsPropTypes.ModelValue) {
327
+ const $xeTabs = this
328
+
329
+ const tabOptions = $xeTabs.computeTabOptions
330
+ const tabStaticOptions = $xeTabs.computeTabStaticOptions
331
+ return $xeTabs.$nextTick().then(() => {
332
+ const headerWrapperEl = $xeTabs.$refs.refHeadWrapperElem as HTMLDivElement
333
+ if (headerWrapperEl) {
334
+ const index = XEUtils.findIndexOf(tabStaticOptions.length ? tabStaticOptions : tabOptions, item => item.name === name)
335
+ if (index > -1) {
336
+ const { scrollLeft, clientWidth, children } = headerWrapperEl
337
+ const tabEl = children[index] as HTMLDivElement
338
+ if (tabEl) {
339
+ const tabOffsetLeft = tabEl.offsetLeft
340
+ const tabClientWidth = tabEl.clientWidth
341
+ // 如果右侧被挡
342
+ const overSize = (tabOffsetLeft + tabClientWidth) - (scrollLeft + clientWidth)
343
+ if (overSize > 0) {
344
+ headerWrapperEl.scrollLeft += overSize
345
+ }
346
+ // 如果左侧被挡,优先
347
+ if (tabOffsetLeft < scrollLeft) {
348
+ headerWrapperEl.scrollLeft = tabOffsetLeft
349
+ }
350
+ }
351
+ }
352
+ $xeTabs.updateTabStyle()
353
+ }
354
+ })
355
+ },
356
+ handlePrevNext (isNext: boolean) {
357
+ const $xeTabs = this
358
+ const reactData = $xeTabs.reactData
359
+
360
+ const { activeName } = reactData
361
+ const tabOptions = $xeTabs.computeTabOptions
362
+ const tabStaticOptions = $xeTabs.computeTabStaticOptions
363
+ const list = tabStaticOptions.length ? tabStaticOptions : tabOptions
364
+ const index = XEUtils.findIndexOf(list, item => item.name === activeName)
365
+ if (index > -1) {
366
+ let item: VxeTabPaneProps | null = null
367
+ if (isNext) {
368
+ if (index < list.length - 1) {
369
+ item = list[index + 1]
370
+ }
371
+ } else {
372
+ if (index > 0) {
373
+ item = list[index - 1]
374
+ }
375
+ }
376
+ if (item) {
377
+ const name = item.name
378
+ const value = name
379
+ reactData.activeName = name
380
+ $xeTabs.$emit('input', value)
381
+ $xeTabs.addInitName(name, null)
382
+ }
383
+ }
384
+ return $xeTabs.$nextTick()
385
+ },
386
+
387
+ //
388
+ // Render
389
+ //
390
+ renderTabHeader (h: CreateElement, tabList: VxeTabsPropTypes.Options | VxeTabPaneDefines.TabConfig[]) {
391
+ const $xeTabs = this
392
+ const props = $xeTabs
393
+ const slots = $xeTabs.$scopedSlots
394
+ const reactData = $xeTabs.reactData
395
+
396
+ const { type, titleWidth: allTitleWidth, titleAlign: allTitleAlign, showClose } = props
397
+ const { activeName, lintLeft, lintWidth, isTabOver } = reactData
398
+ const extraSlot = slots.extra
399
+ return h('div', {
400
+ class: 'vxe-tabs-header'
401
+ }, [
402
+ isTabOver
403
+ ? h('div', {
404
+ class: 'vxe-tabs-header--bar vxe-tabs-header--left-bar',
405
+ on: {
406
+ click: $xeTabs.scrollLeftEvent
407
+ }
408
+ }, [
409
+ h('span', {
410
+ class: getIcon().TABS_TAB_BUTTON_LEFT
411
+ })
412
+ ])
413
+ : renderEmptyElement($xeTabs),
414
+ h('div', {
415
+ class: 'vxe-tabs-header--wrapper'
416
+ }, [
417
+ h('div', {
418
+ ref: 'refHeadWrapperElem',
419
+ class: 'vxe-tabs-header--item-wrapper'
420
+ }, tabList.map((item, index) => {
421
+ const { title, titleWidth, titleAlign, icon, name, slots } = item
422
+ const tabSlot = slots ? slots.tab : null
423
+ const itemWidth = titleWidth || allTitleWidth
424
+ const itemAlign = titleAlign || allTitleAlign
425
+ return h('div', {
426
+ key: `${name}`,
427
+ class: ['vxe-tabs-header--item', itemAlign ? `align--${itemAlign}` : '', {
428
+ 'is--active': activeName === name
429
+ }],
430
+ style: itemWidth
431
+ ? {
432
+ width: toCssUnit(itemWidth)
433
+ }
434
+ : {},
435
+ on: {
436
+ click (evnt: KeyboardEvent) {
437
+ $xeTabs.clickEvent(evnt, item)
438
+ }
439
+ }
440
+ }, [
441
+ h('div', {
442
+ class: 'vxe-tabs-header--item-inner'
443
+ }, [
444
+ h('div', {
445
+ class: 'vxe-tabs-header--item-content'
446
+ }, [
447
+ icon
448
+ ? h('span', {
449
+ class: 'vxe-tabs-header--item-icon'
450
+ }, [
451
+ h('i', {
452
+ class: icon
453
+ })
454
+ ])
455
+ : renderEmptyElement($xeTabs),
456
+ h('span', {
457
+ class: 'vxe-tabs-header--item-name'
458
+ }, tabSlot ? $xeTabs.callSlot(tabSlot, { name, title }) : `${title}`)
459
+ ]),
460
+ showClose
461
+ ? h('div', {
462
+ class: 'vxe-tabs-header--close-btn',
463
+ on: {
464
+ click (evnt: KeyboardEvent) {
465
+ $xeTabs.handleCloseTabEvent(evnt, item, index, tabList)
466
+ }
467
+ }
468
+ }, [
469
+ h('i', {
470
+ class: getIcon().TABS_TAB_CLOSE
471
+ })
472
+ ])
473
+ : renderEmptyElement($xeTabs)
474
+ ])
475
+ ])
476
+ }).concat([
477
+ h('span', {
478
+ key: 'line',
479
+ class: `vxe-tabs-header--active-line type--${type || 'default'}`,
480
+ style: {
481
+ left: `${lintLeft}px`,
482
+ width: `${lintWidth}px`
483
+ }
484
+ })
485
+ ]))
486
+ ]),
487
+ isTabOver
488
+ ? h('div', {
489
+ class: 'vxe-tabs-header--bar vxe-tabs-header--right-bar',
490
+ on: {
491
+ click: $xeTabs.scrollRightEvent
492
+ }
493
+ }, [
494
+ h('span', {
495
+ class: getIcon().TABS_TAB_BUTTON_RIGHT
496
+ })
497
+ ])
498
+ : renderEmptyElement($xeTabs),
499
+ extraSlot
500
+ ? h('div', {
501
+ class: 'vxe-tabs-header--extra'
502
+ }, getSlotVNs(extraSlot({})))
503
+ : renderEmptyElement($xeTabs)
504
+ ])
505
+ },
506
+ renderTabPane (h: CreateElement, item: VxeTabPaneProps | VxeTabPaneDefines.TabConfig) {
507
+ const $xeTabs = this
508
+ const reactData = $xeTabs.reactData
509
+
510
+ const { initNames, activeName } = reactData
511
+ const { name, slots } = item
512
+ const defaultSlot = slots ? slots.default : null
513
+ return name && initNames.includes(name)
514
+ ? h('div', {
515
+ key: name,
516
+ class: ['vxe-tabs-pane--item', {
517
+ 'is--visible': activeName === name,
518
+ 'has--content': !!defaultSlot
519
+ }]
520
+ }, defaultSlot ? $xeTabs.callSlot(defaultSlot, { name }) : [])
521
+ : renderEmptyElement($xeTabs)
522
+ },
523
+ renderTabContent (h: CreateElement, tabList: VxeTabsPropTypes.Options | VxeTabPaneDefines.TabConfig[]) {
524
+ const $xeTabs = this
525
+ const props = $xeTabs
526
+ const reactData = $xeTabs.reactData
527
+
528
+ const { destroyOnClose } = props
529
+ const { activeName } = reactData
530
+ const activeDefaultTab = tabList.find(item => item.name === activeName)
531
+ if (destroyOnClose) {
532
+ return [activeDefaultTab ? $xeTabs.renderTabPane(h, activeDefaultTab) : renderEmptyElement($xeTabs)]
533
+ }
534
+ return tabList.map((item) => $xeTabs.renderTabPane(h, item))
535
+ },
536
+ renderVN (h: CreateElement): VNode {
537
+ const $xeTabs = this
538
+ const props = $xeTabs
539
+ const slots = $xeTabs.$scopedSlots
540
+
541
+ const { type, height, padding, trigger } = props
542
+ const tabOptions = $xeTabs.computeTabOptions
543
+ const tabStaticOptions = $xeTabs.computeTabStaticOptions
544
+ const defaultSlot = slots.default
545
+ const tabList = defaultSlot ? tabStaticOptions : tabOptions
546
+
547
+ return h('div', {
548
+ ref: 'refElem',
549
+ class: ['vxe-tabs', `vxe-tabs--${type || 'default'}`, `trigger--${trigger === 'manual' ? 'trigger' : 'default'}`, {
550
+ 'is--padding': padding,
551
+ 'is--height': height
552
+ }],
553
+ style: height
554
+ ? {
555
+ height: toCssUnit(height)
556
+ }
557
+ : {}
558
+ }, [
559
+ h('div', {
560
+ class: 'vxe-tabs-slots'
561
+ }, defaultSlot ? defaultSlot({}) : []),
562
+ $xeTabs.renderTabHeader(h, tabList),
563
+ h('div', {
564
+ class: 'vxe-tabs-pane'
565
+ }, $xeTabs.renderTabContent(h, tabList))
566
+ ])
567
+ }
568
+ },
569
+ watch: {
570
+ value (val) {
571
+ const $xeTabs = this
572
+ const reactData = $xeTabs.reactData
573
+
574
+ $xeTabs.addInitName(val, null)
575
+ reactData.activeName = val
576
+ },
577
+ 'reactData.activeName' (val) {
578
+ const $xeTabs = this
579
+ const reactData = $xeTabs.reactData
580
+
581
+ $xeTabs.scrollToTab(val)
582
+ $xeTabs.$nextTick(() => {
583
+ reactData.resizeFlag++
584
+ })
585
+ },
586
+ options () {
587
+ const $xeTabs = this
588
+ const props = $xeTabs
589
+
590
+ $xeTabs.initDefaultName(props.options)
591
+ $xeTabs.updateTabStyle()
592
+ },
593
+ 'reactData.staticTabs' () {
594
+ const $xeTabs = this
595
+ const reactData = $xeTabs.reactData
596
+
597
+ $xeTabs.initDefaultName(reactData.staticTabs)
598
+ $xeTabs.updateTabStyle()
599
+ },
600
+ computeParentResizeFlag () {
601
+ const $xeTabs = this
602
+
603
+ $xeTabs.$nextTick(() => {
604
+ $xeTabs.updateTabStyle()
605
+ })
606
+ }
607
+ },
608
+ created () {
609
+ const $xeTabs = this
610
+ const props = $xeTabs
611
+ const reactData = $xeTabs.reactData
612
+
613
+ $xeTabs.addInitName(props.value, null)
614
+ $xeTabs.initDefaultName(reactData.staticTabs.length ? reactData.staticTabs : props.options)
615
+ },
616
+ mounted () {
617
+ const $xeTabs = this
618
+
619
+ $xeTabs.updateTabStyle()
620
+ globalEvents.on($xeTabs, 'resize', $xeTabs.updateTabStyle)
621
+ },
622
+ beforeDestroy () {
623
+ const $xeTabs = this
624
+
625
+ globalEvents.off($xeTabs, 'resize')
626
+ },
627
+ render (this: any, h) {
628
+ return this.renderVN(h)
629
+ }
630
+ })
@@ -0,0 +1,21 @@
1
+ import XEUtils from 'xe-utils'
2
+
3
+ import type { VxeTabsConstructor, VxeTabsPrivateMethods, VxeTabPaneDefines } from '../../../types'
4
+
5
+ export function assembleAnchorTab ($xeTabs: VxeTabsConstructor & VxeTabsPrivateMethods, elem: HTMLElement, tabConfig: VxeTabPaneDefines.TabConfig) {
6
+ const staticLinks = $xeTabs.reactData.staticTabs
7
+ const parentElem = elem.parentNode
8
+ if (parentElem) {
9
+ staticLinks.splice(XEUtils.arrayIndexOf(parentElem.children, elem), 0, tabConfig)
10
+ $xeTabs.reactData.staticTabs = staticLinks.slice(0)
11
+ }
12
+ }
13
+
14
+ export function destroyAnchorTab ($xeTabs: VxeTabsConstructor & VxeTabsPrivateMethods, tabConfig: VxeTabPaneDefines.TabConfig) {
15
+ const staticTabs = $xeTabs.reactData.staticTabs
16
+ const matchObj = XEUtils.findTree(staticTabs, item => item.id === tabConfig.id, { children: 'children' })
17
+ if (matchObj) {
18
+ matchObj.items.splice(matchObj.index, 1)
19
+ }
20
+ $xeTabs.reactData.staticTabs = staticTabs.slice(0)
21
+ }
@@ -56,6 +56,11 @@ export interface CarouselReactData {
56
56
  itemHeight: number
57
57
  }
58
58
 
59
+ export interface CarouselInternalData {
60
+ apTimeout: undefined | number
61
+ stopFlag: boolean
62
+ }
63
+
59
64
  export interface CarouselMethods {
60
65
  dispatchEvent(type: ValueOf<VxeCarouselEmits>, params: Record<string, any>, evnt: Event | null): void
61
66
  /**
@@ -63,6 +63,10 @@ export interface IconPickerReactData {
63
63
  isActivated: boolean
64
64
  }
65
65
 
66
+ export interface IconPickerInternalData {
67
+ hpTimeout?: undefined | number
68
+ }
69
+
66
70
  export interface IconPickerMethods {
67
71
  dispatchEvent(type: ValueOf<VxeIconPickerEmits>, params: Record<string, any>, evnt: Event | null): void
68
72
  /**
@@ -152,7 +152,7 @@ export interface InputReactData {
152
152
  showPwd: boolean
153
153
  visiblePanel: boolean
154
154
  isAniVisible: boolean
155
- panelStyle: VxeComponentStyleType | null
155
+ panelStyle: VxeComponentStyleType
156
156
  panelPlacement: VxeInputPropTypes.Placement
157
157
  isActivated: boolean
158
158
  inputValue: any
@@ -164,6 +164,14 @@ export interface InputReactData {
164
164
  currentDate: any
165
165
  }
166
166
 
167
+ export interface InputInternalData {
168
+ yearSize: number
169
+ monthSize: number
170
+ quarterSize: number
171
+ hpTimeout?: undefined | number
172
+ dnTimeout?: undefined | number
173
+ }
174
+
167
175
  export interface InputMethods {
168
176
  dispatchEvent(type: ValueOf<VxeInputEmits>, params: Record<string, any>, evnt: Event | null): void
169
177
  /**