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,711 @@
1
+ import { PropType, CreateElement, VNode } from 'vue'
2
+ import { defineVxeComponent } from '../../ui/src/comp'
3
+ import XEUtils from 'xe-utils'
4
+ import { getConfig, getIcon, getI18n, globalEvents, createEvent, globalMixins, GLOBAL_EVENT_KEYS, renderEmptyElement } from '../../ui'
5
+ import { getEventTargetNode, getAbsolutePos } from '../../ui/src/dom'
6
+ import { getLastZIndex, nextZIndex, getFuncText } from '../../ui/src/utils'
7
+
8
+ import type { VxeIconPickerPropTypes, IconPickerInternalData, ValueOf, IconPickerReactData, VxeComponentSizeType, VxeIconPickerEmits, VxeTableConstructor, VxeTablePrivateMethods, VxeIconPickerDefines, VxeDrawerConstructor, VxeDrawerMethods, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, VxeModalConstructor, VxeModalMethods } from '../../../types'
9
+
10
+ export default defineVxeComponent({
11
+ name: 'VxeIconPicker',
12
+ mixins: [
13
+ globalMixins.sizeMixin
14
+ ],
15
+ model: {
16
+ prop: 'value',
17
+ event: 'modelValue'
18
+ },
19
+ props: {
20
+ value: String as PropType<VxeIconPickerPropTypes.ModelValue>,
21
+ placeholder: String as PropType<VxeIconPickerPropTypes.Placeholder>,
22
+ clearable: Boolean as PropType<VxeIconPickerPropTypes.Clearable>,
23
+ size: {
24
+ type: String as PropType<VxeIconPickerPropTypes.Size>,
25
+ default: () => getConfig().iconPicker.size || getConfig().size
26
+ },
27
+ className: [String, Function] as PropType<VxeIconPickerPropTypes.ClassName>,
28
+ popupClassName: [String, Function] as PropType<VxeIconPickerPropTypes.PopupClassName>,
29
+ showIconTitle: {
30
+ type: Boolean as PropType<VxeIconPickerPropTypes.ShowIconTitle>,
31
+ default: () => getConfig().iconPicker.showIconTitle
32
+ },
33
+ readonly: {
34
+ type: Boolean as PropType<VxeIconPickerPropTypes.Readonly>,
35
+ default: null
36
+ },
37
+ disabled: {
38
+ type: Boolean as PropType<VxeIconPickerPropTypes.Disabled>,
39
+ default: null
40
+ },
41
+ icons: Array as PropType<VxeIconPickerPropTypes.Icons>,
42
+ placement: String as PropType<VxeIconPickerPropTypes.Placement>,
43
+ transfer: {
44
+ type: Boolean as PropType<VxeIconPickerPropTypes.Transfer>,
45
+ default: null
46
+ }
47
+ },
48
+ inject: {
49
+ $xeModal: {
50
+ default: null
51
+ },
52
+ $xeDrawer: {
53
+ default: null
54
+ },
55
+ $xeTable: {
56
+ default: null
57
+ },
58
+ $xeForm: {
59
+ default: null
60
+ },
61
+ formItemInfo: {
62
+ from: 'xeFormItemInfo',
63
+ default: null
64
+ }
65
+ },
66
+ provide () {
67
+ const $xeIconPicker = this
68
+ return {
69
+ $xeIconPicker
70
+ }
71
+ },
72
+ data () {
73
+ const reactData: IconPickerReactData = {
74
+ initialized: false,
75
+ selectIcon: '',
76
+ panelIndex: 0,
77
+ panelStyle: {},
78
+ panelPlacement: null,
79
+ visiblePanel: false,
80
+ isAniVisible: false,
81
+ isActivated: false
82
+ }
83
+ const internalData: IconPickerInternalData = {
84
+ hpTimeout: undefined
85
+ }
86
+ return {
87
+ xID: XEUtils.uniqueId(),
88
+ reactData,
89
+ internalData
90
+ }
91
+ },
92
+ computed: {
93
+ ...({} as {
94
+ computeSize(): VxeComponentSizeType
95
+ $xeModal(): (VxeModalConstructor & VxeModalMethods) | null
96
+ $xeDrawer(): (VxeDrawerConstructor & VxeDrawerMethods) | null
97
+ $xeTable(): (VxeTableConstructor & VxeTablePrivateMethods) | null
98
+ $xeForm(): (VxeFormConstructor & VxeFormPrivateMethods) | null
99
+ formItemInfo(): VxeFormDefines.ProvideItemInfo | null
100
+ }),
101
+ computeFormReadonly () {
102
+ const $xeIconPicker = this
103
+ const props = $xeIconPicker
104
+ const $xeForm = $xeIconPicker.$xeForm
105
+
106
+ const { readonly } = props
107
+ if (readonly === null) {
108
+ if ($xeForm) {
109
+ return $xeForm.readonly
110
+ }
111
+ return false
112
+ }
113
+ return readonly
114
+ },
115
+ computeIsDisabled () {
116
+ const $xeIconPicker = this
117
+ const props = $xeIconPicker
118
+ const $xeForm = $xeIconPicker.$xeForm
119
+
120
+ const { disabled } = props
121
+ if (disabled === null) {
122
+ if ($xeForm) {
123
+ return $xeForm.disabled
124
+ }
125
+ return false
126
+ }
127
+ return disabled
128
+ },
129
+ computeBtnTransfer () {
130
+ const $xeIconPicker = this
131
+ const props = $xeIconPicker
132
+ const $xeTable = $xeIconPicker.$xeTable
133
+ const $xeModal = $xeIconPicker.$xeModal
134
+ const $xeDrawer = $xeIconPicker.$xeDrawer
135
+ const $xeForm = $xeIconPicker.$xeForm
136
+
137
+ const { transfer } = props
138
+ if (transfer === null) {
139
+ const globalTransfer = getConfig().iconPicker.transfer
140
+ if (XEUtils.isBoolean(globalTransfer)) {
141
+ return globalTransfer
142
+ }
143
+ if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
144
+ return true
145
+ }
146
+ }
147
+ return transfer
148
+ },
149
+ computeInpPlaceholder () {
150
+ const $xeIconPicker = this
151
+ const props = $xeIconPicker
152
+
153
+ const { placeholder } = props
154
+ if (placeholder) {
155
+ return getFuncText(placeholder)
156
+ }
157
+ const globalPlaceholder = getConfig().select.placeholder
158
+ if (globalPlaceholder) {
159
+ return getFuncText(globalPlaceholder)
160
+ }
161
+ return getI18n('vxe.base.pleaseSelect')
162
+ },
163
+ computeIconList () {
164
+ const $xeIconPicker = this
165
+ const props = $xeIconPicker
166
+
167
+ let { icons } = props
168
+ if (!icons || !icons.length) {
169
+ icons = getConfig().iconPicker.icons || []
170
+ }
171
+ return icons.map(name => {
172
+ return {
173
+ title: name,
174
+ icon: `vxe-icon-${name}`
175
+ }
176
+ })
177
+ },
178
+ computeIconGroupList () {
179
+ const $xeIconPicker = this
180
+
181
+ const iconList = $xeIconPicker.computeIconList as {
182
+ title: string
183
+ icon: string
184
+ }[]
185
+ return XEUtils.chunk(iconList, 4)
186
+ }
187
+ },
188
+ methods: {
189
+ //
190
+ // Method
191
+ //
192
+ dispatchEvent (type: ValueOf<VxeIconPickerEmits>, params: Record<string, any>, evnt: Event | null) {
193
+ const $xeIconPicker = this
194
+ $xeIconPicker.$emit(type, createEvent(evnt, { $iconPicker: $xeIconPicker }, params))
195
+ },
196
+ isPanelVisible () {
197
+ const $xeIconPicker = this
198
+ const reactData = $xeIconPicker.reactData
199
+
200
+ return reactData.visiblePanel
201
+ },
202
+ togglePanel () {
203
+ const $xeIconPicker = this
204
+ const reactData = $xeIconPicker.reactData
205
+
206
+ if (reactData.visiblePanel) {
207
+ $xeIconPicker.hideOptionPanel()
208
+ } else {
209
+ $xeIconPicker.showOptionPanel()
210
+ }
211
+ return $xeIconPicker.$nextTick()
212
+ },
213
+ hidePanel () {
214
+ const $xeIconPicker = this
215
+ const reactData = $xeIconPicker.reactData
216
+
217
+ if (reactData.visiblePanel) {
218
+ $xeIconPicker.hideOptionPanel()
219
+ }
220
+ return $xeIconPicker.$nextTick()
221
+ },
222
+ showPanel () {
223
+ const $xeIconPicker = this
224
+ const reactData = $xeIconPicker.reactData
225
+
226
+ if (!reactData.visiblePanel) {
227
+ $xeIconPicker.showOptionPanel()
228
+ }
229
+ return $xeIconPicker.$nextTick()
230
+ },
231
+ focus () {
232
+ const $xeIconPicker = this
233
+ const reactData = $xeIconPicker.reactData
234
+
235
+ const $input = $xeIconPicker.$refs.refInput as HTMLInputElement
236
+ reactData.isActivated = true
237
+ $input.blur()
238
+ return $xeIconPicker.$nextTick()
239
+ },
240
+ blur () {
241
+ const $xeIconPicker = this
242
+ const reactData = $xeIconPicker.reactData
243
+
244
+ const $input = $xeIconPicker.$refs.refInput as HTMLInputElement
245
+ $input.blur()
246
+ reactData.isActivated = false
247
+ return $xeIconPicker.$nextTick()
248
+ },
249
+ updateZindex () {
250
+ const $xeIconPicker = this
251
+ const reactData = $xeIconPicker.reactData
252
+
253
+ if (reactData.panelIndex < getLastZIndex()) {
254
+ reactData.panelIndex = nextZIndex()
255
+ }
256
+ },
257
+ updatePlacement () {
258
+ const $xeIconPicker = this
259
+ const props = $xeIconPicker
260
+ const reactData = $xeIconPicker.reactData
261
+
262
+ return $xeIconPicker.$nextTick().then(() => {
263
+ const { placement } = props
264
+ const { panelIndex } = reactData
265
+ const el = $xeIconPicker.$refs.refElem as HTMLElement
266
+ const panelElem = $xeIconPicker.$refs.refOptionPanel as HTMLElement
267
+ const btnTransfer = $xeIconPicker.computeBtnTransfer
268
+ if (panelElem && el) {
269
+ const targetHeight = el.offsetHeight
270
+ const targetWidth = el.offsetWidth
271
+ const panelHeight = panelElem.offsetHeight
272
+ const panelWidth = panelElem.offsetWidth
273
+ const marginSize = 5
274
+ const panelStyle: { [key: string]: any } = {
275
+ zIndex: panelIndex
276
+ }
277
+ const { boundingTop, boundingLeft, visibleHeight, visibleWidth } = getAbsolutePos(el)
278
+ let panelPlacement = 'bottom'
279
+ if (btnTransfer) {
280
+ let left = boundingLeft
281
+ let top = boundingTop + targetHeight
282
+ if (placement === 'top') {
283
+ panelPlacement = 'top'
284
+ top = boundingTop - panelHeight
285
+ } else if (!placement) {
286
+ // 如果下面不够放,则向上
287
+ if (top + panelHeight + marginSize > visibleHeight) {
288
+ panelPlacement = 'top'
289
+ top = boundingTop - panelHeight
290
+ }
291
+ // 如果上面不够放,则向下(优先)
292
+ if (top < marginSize) {
293
+ panelPlacement = 'bottom'
294
+ top = boundingTop + targetHeight
295
+ }
296
+ }
297
+ // 如果溢出右边
298
+ if (left + panelWidth + marginSize > visibleWidth) {
299
+ left -= left + panelWidth + marginSize - visibleWidth
300
+ }
301
+ // 如果溢出左边
302
+ if (left < marginSize) {
303
+ left = marginSize
304
+ }
305
+ Object.assign(panelStyle, {
306
+ left: `${left}px`,
307
+ top: `${top}px`,
308
+ minWidth: `${targetWidth}px`
309
+ })
310
+ } else {
311
+ if (placement === 'top') {
312
+ panelPlacement = 'top'
313
+ panelStyle.bottom = `${targetHeight}px`
314
+ } else if (!placement) {
315
+ // 如果下面不够放,则向上
316
+ if (boundingTop + targetHeight + panelHeight > visibleHeight) {
317
+ // 如果上面不够放,则向下(优先)
318
+ if (boundingTop - targetHeight - panelHeight > marginSize) {
319
+ panelPlacement = 'top'
320
+ panelStyle.bottom = `${targetHeight}px`
321
+ }
322
+ }
323
+ }
324
+ }
325
+ reactData.panelStyle = panelStyle
326
+ reactData.panelPlacement = panelPlacement
327
+ return $xeIconPicker.$nextTick()
328
+ }
329
+ })
330
+ },
331
+ showOptionPanel () {
332
+ const $xeIconPicker = this
333
+ const reactData = $xeIconPicker.reactData
334
+ const internalData = $xeIconPicker.internalData
335
+
336
+ const { hpTimeout } = internalData
337
+ const isDisabled = $xeIconPicker.computeIsDisabled
338
+ if (!isDisabled) {
339
+ if (hpTimeout) {
340
+ clearTimeout(hpTimeout)
341
+ internalData.hpTimeout = undefined
342
+ }
343
+ const btnTransfer = $xeIconPicker.computeBtnTransfer
344
+ const panelElem = $xeIconPicker.$refs.refOptionPanel as HTMLElement
345
+ if (!reactData.initialized) {
346
+ reactData.initialized = true
347
+ if (btnTransfer) {
348
+ if (panelElem) {
349
+ document.body.appendChild(panelElem)
350
+ }
351
+ }
352
+ }
353
+ reactData.isActivated = true
354
+ reactData.isAniVisible = true
355
+ setTimeout(() => {
356
+ reactData.visiblePanel = true
357
+ }, 10)
358
+ $xeIconPicker.updateZindex()
359
+ $xeIconPicker.updatePlacement()
360
+ }
361
+ },
362
+ hideOptionPanel () {
363
+ const $xeIconPicker = this
364
+ const reactData = $xeIconPicker.reactData
365
+ const internalData = $xeIconPicker.internalData
366
+
367
+ reactData.visiblePanel = false
368
+ internalData.hpTimeout = window.setTimeout(() => {
369
+ reactData.isAniVisible = false
370
+ }, 350)
371
+ },
372
+ changeEvent (evnt: Event, selectValue: any) {
373
+ const $xeIconPicker = this
374
+ const props = $xeIconPicker
375
+ const reactData = $xeIconPicker.reactData
376
+ const $xeForm = $xeIconPicker.$xeForm
377
+ const formItemInfo = $xeIconPicker.formItemInfo
378
+
379
+ reactData.selectIcon = selectValue
380
+ if (selectValue !== props.value) {
381
+ $xeIconPicker.$emit('modelValue', selectValue)
382
+ $xeIconPicker.dispatchEvent('change', { value: selectValue }, evnt)
383
+ // 自动更新校验状态
384
+ if ($xeForm && formItemInfo) {
385
+ $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, selectValue)
386
+ }
387
+ }
388
+ },
389
+ focusEvent () {
390
+ const $xeIconPicker = this
391
+ const reactData = $xeIconPicker.reactData
392
+
393
+ const isDisabled = $xeIconPicker.computeIsDisabled
394
+ if (!isDisabled) {
395
+ if (!reactData.visiblePanel) {
396
+ $xeIconPicker.showOptionPanel()
397
+ }
398
+ }
399
+ },
400
+ blurEvent () {
401
+ const $xeIconPicker = this
402
+ const reactData = $xeIconPicker.reactData
403
+
404
+ reactData.isActivated = false
405
+ },
406
+ clearValueEvent (evnt: Event, selectValue: any) {
407
+ const $xeIconPicker = this
408
+
409
+ $xeIconPicker.changeEvent(evnt, selectValue)
410
+ $xeIconPicker.dispatchEvent('clear', { value: selectValue }, evnt)
411
+ },
412
+ clearEvent (params: any, evnt: Event) {
413
+ const $xeIconPicker = this
414
+
415
+ $xeIconPicker.clearValueEvent(evnt, null)
416
+ $xeIconPicker.hideOptionPanel()
417
+ },
418
+ togglePanelEvent (evnt: MouseEvent) {
419
+ const $xeIconPicker = this
420
+ const reactData = $xeIconPicker.reactData
421
+
422
+ evnt.preventDefault()
423
+ if (reactData.visiblePanel) {
424
+ $xeIconPicker.hideOptionPanel()
425
+ } else {
426
+ $xeIconPicker.showOptionPanel()
427
+ }
428
+ },
429
+ clickEvent (evnt: MouseEvent) {
430
+ const $xeIconPicker = this
431
+
432
+ $xeIconPicker.togglePanelEvent(evnt)
433
+ $xeIconPicker.dispatchEvent('click', {}, evnt)
434
+ },
435
+ handleGlobalMousewheelEvent (evnt: MouseEvent) {
436
+ const $xeIconPicker = this
437
+ const reactData = $xeIconPicker.reactData
438
+
439
+ const { visiblePanel } = reactData
440
+ const isDisabled = $xeIconPicker.computeIsDisabled
441
+ if (!isDisabled) {
442
+ if (visiblePanel) {
443
+ const panelElem = $xeIconPicker.$refs.refOptionPanel as HTMLElement
444
+ if (getEventTargetNode(evnt, panelElem).flag) {
445
+ $xeIconPicker.updatePlacement()
446
+ } else {
447
+ $xeIconPicker.hideOptionPanel()
448
+ }
449
+ }
450
+ }
451
+ },
452
+ handleGlobalMousedownEvent (evnt: MouseEvent) {
453
+ const $xeIconPicker = this
454
+ const reactData = $xeIconPicker.reactData
455
+
456
+ const { visiblePanel } = reactData
457
+ const isDisabled = $xeIconPicker.computeIsDisabled
458
+ if (!isDisabled) {
459
+ const el = $xeIconPicker.$refs.refElem as HTMLElement
460
+ const panelElem = $xeIconPicker.$refs.refOptionPanel as HTMLElement
461
+ reactData.isActivated = getEventTargetNode(evnt, el).flag || getEventTargetNode(evnt, panelElem).flag
462
+ if (visiblePanel && !reactData.isActivated) {
463
+ $xeIconPicker.hideOptionPanel()
464
+ }
465
+ }
466
+ },
467
+ handleGlobalKeydownEvent (evnt: KeyboardEvent) {
468
+ const $xeIconPicker = this
469
+ const props = $xeIconPicker
470
+ const reactData = $xeIconPicker.reactData
471
+
472
+ const { clearable } = props
473
+ const { visiblePanel } = reactData
474
+ const isDisabled = $xeIconPicker.computeIsDisabled
475
+ if (!isDisabled) {
476
+ const isTab = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.TAB)
477
+ const isEnter = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER)
478
+ const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE)
479
+ const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP)
480
+ const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN)
481
+ const isDel = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.DELETE)
482
+ const isSpacebar = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.SPACEBAR)
483
+ if (isTab) {
484
+ reactData.isActivated = false
485
+ }
486
+ if (visiblePanel) {
487
+ if (isEsc || isTab) {
488
+ $xeIconPicker.hideOptionPanel()
489
+ } else if (isEnter) {
490
+ evnt.preventDefault()
491
+ evnt.stopPropagation()
492
+ // changeOptionEvent(evnt, currentValue, currentOption)
493
+ } else if (isUpArrow || isDwArrow) {
494
+ evnt.preventDefault()
495
+ // let { firstOption, offsetOption } = findOffsetOption(currentValue, isUpArrow)
496
+ // if (!offsetOption && !findVisibleOption(currentValue)) {
497
+ // offsetOption = firstOption
498
+ // }
499
+ // setCurrentOption(offsetOption)
500
+ // scrollToOption(offsetOption, isDwArrow)
501
+ } else if (isSpacebar) {
502
+ evnt.preventDefault()
503
+ }
504
+ } else if ((isUpArrow || isDwArrow || isEnter || isSpacebar) && reactData.isActivated) {
505
+ evnt.preventDefault()
506
+ $xeIconPicker.showOptionPanel()
507
+ }
508
+ if (reactData.isActivated) {
509
+ if (isDel && clearable) {
510
+ $xeIconPicker.clearValueEvent(evnt, null)
511
+ }
512
+ }
513
+ }
514
+ },
515
+ handleGlobalBlurEvent () {
516
+ const $xeIconPicker = this
517
+
518
+ $xeIconPicker.hideOptionPanel()
519
+ },
520
+ handleClickIconEvent (evnt: MouseEvent, item: VxeIconPickerDefines.IconItemObj) {
521
+ const $xeIconPicker = this
522
+
523
+ const value = item.icon
524
+ $xeIconPicker.changeEvent(evnt, value)
525
+ $xeIconPicker.hideOptionPanel()
526
+ },
527
+
528
+ //
529
+ // Render
530
+ //
531
+ renderIconWrapper (h: CreateElement) {
532
+ const $xeIconPicker = this
533
+ const props = $xeIconPicker
534
+
535
+ const { showIconTitle } = props
536
+ const iconGroupList = $xeIconPicker.computeIconGroupList
537
+ const isDisabled = $xeIconPicker.computeIsDisabled
538
+
539
+ return h('div', {
540
+ class: 'vxe-ico-picker--list-wrapper'
541
+ }, iconGroupList.map(list => {
542
+ return h('div', {
543
+ class: 'vxe-ico-picker--list'
544
+ }, list.map(item => {
545
+ return h('div', {
546
+ class: 'vxe-ico-picker--item',
547
+ on: {
548
+ click (evnt: MouseEvent) {
549
+ if (!isDisabled) {
550
+ $xeIconPicker.handleClickIconEvent(evnt, item)
551
+ }
552
+ }
553
+ }
554
+ }, [
555
+ h('div', {
556
+ class: 'vxe-ico-picker--item-icon'
557
+ }, [
558
+ h('i', {
559
+ class: item.icon || ''
560
+ })
561
+ ]),
562
+ showIconTitle
563
+ ? h('div', {
564
+ class: 'vxe-ico-picker--item-title'
565
+ }, `${item.title || ''}`)
566
+ : renderEmptyElement($xeIconPicker)
567
+ ])
568
+ }))
569
+ }))
570
+ },
571
+ renderVN (h: CreateElement): VNode {
572
+ const $xeIconPicker = this
573
+ const props = $xeIconPicker
574
+ const reactData = $xeIconPicker.reactData
575
+
576
+ const { className, popupClassName, clearable } = props
577
+ const { initialized, isActivated, visiblePanel, selectIcon } = reactData
578
+ const vSize = $xeIconPicker.computeSize
579
+ const isDisabled = $xeIconPicker.computeIsDisabled
580
+ const btnTransfer = $xeIconPicker.computeBtnTransfer
581
+ const formReadonly = $xeIconPicker.computeFormReadonly
582
+ const inpPlaceholder = $xeIconPicker.computeInpPlaceholder
583
+
584
+ if (formReadonly) {
585
+ return h('div', {
586
+ ref: 'refElem',
587
+ class: ['vxe-ico-picker--readonly', className]
588
+ }, [
589
+ h('i', {
590
+ class: selectIcon
591
+ })
592
+ ])
593
+ }
594
+ return h('div', {
595
+ ref: 'refElem',
596
+ class: ['vxe-ico-picker', className ? (XEUtils.isFunction(className) ? className({ $iconPicker: $xeIconPicker }) : className) : '', {
597
+ [`size--${vSize}`]: vSize,
598
+ 'show--clear': clearable && !isDisabled && !!selectIcon,
599
+ 'is--visible': visiblePanel,
600
+ 'is--disabled': isDisabled,
601
+ 'is--active': isActivated
602
+ }]
603
+ }, [
604
+ h('div', {
605
+ class: 'vxe-ico-picker--inner',
606
+ on: {
607
+ click: $xeIconPicker.clickEvent
608
+ }
609
+ }, [
610
+ h('input', {
611
+ ref: 'refInput',
612
+ class: 'vxe-ico-picker--input',
613
+ on: {
614
+ focus: $xeIconPicker.focusEvent,
615
+ blur: $xeIconPicker.blurEvent
616
+ }
617
+ }),
618
+ selectIcon
619
+ ? h('div', {
620
+ class: 'vxe-ico-picker--icon'
621
+ }, [
622
+ h('i', {
623
+ class: selectIcon
624
+ })
625
+ ])
626
+ : h('div', {
627
+ class: 'vxe-ico-picker--placeholder'
628
+ }, inpPlaceholder),
629
+ h('div', {
630
+ class: 'vxe-ico-picker--suffix'
631
+ }, [
632
+ h('div', {
633
+ class: 'vxe-ico-picker--clear-icon',
634
+ on: {
635
+ click: $xeIconPicker.clearEvent
636
+ }
637
+ }, [
638
+ h('i', {
639
+ class: getIcon().INPUT_CLEAR
640
+ })
641
+ ]),
642
+ h('div', {
643
+ class: 'vxe-ico-picker--suffix-icon'
644
+ }, [
645
+ h('i', {
646
+ class: visiblePanel ? getIcon().ICON_PICKER_OPEN : getIcon().ICON_PICKER_CLOSE
647
+ })
648
+ ])
649
+ ])
650
+ ]),
651
+ h('div', {
652
+ ref: 'refOptionPanel',
653
+ class: ['vxe-table--ignore-clear vxe-ico-picker--panel', popupClassName ? (XEUtils.isFunction(popupClassName) ? popupClassName({ $iconPicker: $xeIconPicker }) : popupClassName) : '', {
654
+ [`size--${vSize}`]: vSize,
655
+ 'is--transfer': btnTransfer,
656
+ 'ani--leave': reactData.isAniVisible,
657
+ 'ani--enter': visiblePanel
658
+ }],
659
+ attrs: {
660
+ placement: reactData.panelPlacement
661
+ },
662
+ style: reactData.panelStyle
663
+ }, initialized
664
+ ? [
665
+ initialized
666
+ ? h('div', {
667
+ class: 'vxe-ico-picker--panel-wrapper'
668
+ }, [
669
+ $xeIconPicker.renderIconWrapper(h)
670
+ ])
671
+ : renderEmptyElement($xeIconPicker)
672
+ ]
673
+ : [])
674
+ ])
675
+ }
676
+ },
677
+ watch: {
678
+ value (val) {
679
+ const $xeIconPicker = this
680
+ const reactData = $xeIconPicker.reactData
681
+
682
+ reactData.selectIcon = `${val || ''}`
683
+ }
684
+ },
685
+ created () {
686
+ const $xeIconPicker = this
687
+ const props = $xeIconPicker
688
+ const reactData = $xeIconPicker.reactData
689
+
690
+ reactData.selectIcon = `${props.value || ''}`
691
+ globalEvents.on($xeIconPicker, 'mousewheel', $xeIconPicker.handleGlobalMousewheelEvent)
692
+ globalEvents.on($xeIconPicker, 'mousedown', $xeIconPicker.handleGlobalMousedownEvent)
693
+ globalEvents.on($xeIconPicker, 'keydown', $xeIconPicker.handleGlobalKeydownEvent)
694
+ globalEvents.on($xeIconPicker, 'blur', $xeIconPicker.handleGlobalBlurEvent)
695
+ },
696
+ beforeDestroy () {
697
+ const $xeIconPicker = this
698
+
699
+ const panelElem = $xeIconPicker.$refs.refOptionPanel as HTMLElement | undefined
700
+ if (panelElem && panelElem.parentNode) {
701
+ panelElem.parentNode.removeChild(panelElem)
702
+ }
703
+ globalEvents.off($xeIconPicker, 'mousewheel')
704
+ globalEvents.off($xeIconPicker, 'mousedown')
705
+ globalEvents.off($xeIconPicker, 'keydown')
706
+ globalEvents.off($xeIconPicker, 'blur')
707
+ },
708
+ render (this: any, h) {
709
+ return this.renderVN(h)
710
+ }
711
+ })