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