@element-plus/nightly 0.0.20220203 → 0.0.20220207

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 (377) hide show
  1. package/README.md +6 -12
  2. package/attributes.json +1 -1
  3. package/dist/index.css +1 -1
  4. package/dist/index.full.js +150 -95
  5. package/dist/index.full.min.js +6 -6
  6. package/dist/index.full.min.js.map +1 -1
  7. package/dist/index.full.min.mjs +6 -6
  8. package/dist/index.full.min.mjs.map +1 -1
  9. package/dist/index.full.mjs +149 -96
  10. package/dist/locale/af.js +1 -1
  11. package/dist/locale/af.min.js +1 -1
  12. package/dist/locale/af.min.mjs +1 -1
  13. package/dist/locale/af.mjs +1 -1
  14. package/dist/locale/ar.js +1 -1
  15. package/dist/locale/ar.min.js +1 -1
  16. package/dist/locale/ar.min.mjs +1 -1
  17. package/dist/locale/ar.mjs +1 -1
  18. package/dist/locale/bg.js +1 -1
  19. package/dist/locale/bg.min.js +1 -1
  20. package/dist/locale/bg.min.mjs +1 -1
  21. package/dist/locale/bg.mjs +1 -1
  22. package/dist/locale/bn.js +1 -1
  23. package/dist/locale/bn.min.js +1 -1
  24. package/dist/locale/bn.min.mjs +1 -1
  25. package/dist/locale/bn.mjs +1 -1
  26. package/dist/locale/ca.js +1 -1
  27. package/dist/locale/ca.min.js +1 -1
  28. package/dist/locale/ca.min.mjs +1 -1
  29. package/dist/locale/ca.mjs +1 -1
  30. package/dist/locale/cs.js +1 -1
  31. package/dist/locale/cs.min.js +1 -1
  32. package/dist/locale/cs.min.mjs +1 -1
  33. package/dist/locale/cs.mjs +1 -1
  34. package/dist/locale/da.js +1 -1
  35. package/dist/locale/da.min.js +1 -1
  36. package/dist/locale/da.min.mjs +1 -1
  37. package/dist/locale/da.mjs +1 -1
  38. package/dist/locale/de.js +1 -1
  39. package/dist/locale/de.min.js +1 -1
  40. package/dist/locale/de.min.mjs +1 -1
  41. package/dist/locale/de.mjs +1 -1
  42. package/dist/locale/el.js +1 -1
  43. package/dist/locale/el.min.js +1 -1
  44. package/dist/locale/el.min.mjs +1 -1
  45. package/dist/locale/el.mjs +1 -1
  46. package/dist/locale/en.js +1 -1
  47. package/dist/locale/en.min.js +1 -1
  48. package/dist/locale/en.min.mjs +1 -1
  49. package/dist/locale/en.mjs +1 -1
  50. package/dist/locale/eo.js +1 -1
  51. package/dist/locale/eo.min.js +1 -1
  52. package/dist/locale/eo.min.mjs +1 -1
  53. package/dist/locale/eo.mjs +1 -1
  54. package/dist/locale/es.js +1 -1
  55. package/dist/locale/es.min.js +1 -1
  56. package/dist/locale/es.min.mjs +1 -1
  57. package/dist/locale/es.mjs +1 -1
  58. package/dist/locale/et.js +1 -1
  59. package/dist/locale/et.min.js +1 -1
  60. package/dist/locale/et.min.mjs +1 -1
  61. package/dist/locale/et.mjs +1 -1
  62. package/dist/locale/eu.js +1 -1
  63. package/dist/locale/eu.min.js +1 -1
  64. package/dist/locale/eu.min.mjs +1 -1
  65. package/dist/locale/eu.mjs +1 -1
  66. package/dist/locale/fa.js +1 -1
  67. package/dist/locale/fa.min.js +1 -1
  68. package/dist/locale/fa.min.mjs +1 -1
  69. package/dist/locale/fa.mjs +1 -1
  70. package/dist/locale/fi.js +1 -1
  71. package/dist/locale/fi.min.js +1 -1
  72. package/dist/locale/fi.min.mjs +1 -1
  73. package/dist/locale/fi.mjs +1 -1
  74. package/dist/locale/fr.js +1 -1
  75. package/dist/locale/fr.min.js +1 -1
  76. package/dist/locale/fr.min.mjs +1 -1
  77. package/dist/locale/fr.mjs +1 -1
  78. package/dist/locale/he.js +1 -1
  79. package/dist/locale/he.min.js +1 -1
  80. package/dist/locale/he.min.mjs +1 -1
  81. package/dist/locale/he.mjs +1 -1
  82. package/dist/locale/hr.js +1 -1
  83. package/dist/locale/hr.min.js +1 -1
  84. package/dist/locale/hr.min.mjs +1 -1
  85. package/dist/locale/hr.mjs +1 -1
  86. package/dist/locale/hu.js +1 -1
  87. package/dist/locale/hu.min.js +1 -1
  88. package/dist/locale/hu.min.mjs +1 -1
  89. package/dist/locale/hu.mjs +1 -1
  90. package/dist/locale/hy-am.js +1 -1
  91. package/dist/locale/hy-am.min.js +1 -1
  92. package/dist/locale/hy-am.min.mjs +1 -1
  93. package/dist/locale/hy-am.mjs +1 -1
  94. package/dist/locale/id.js +1 -1
  95. package/dist/locale/id.min.js +1 -1
  96. package/dist/locale/id.min.mjs +1 -1
  97. package/dist/locale/id.mjs +1 -1
  98. package/dist/locale/it.js +1 -1
  99. package/dist/locale/it.min.js +1 -1
  100. package/dist/locale/it.min.mjs +1 -1
  101. package/dist/locale/it.mjs +1 -1
  102. package/dist/locale/ja.js +1 -1
  103. package/dist/locale/ja.min.js +1 -1
  104. package/dist/locale/ja.min.mjs +1 -1
  105. package/dist/locale/ja.mjs +1 -1
  106. package/dist/locale/kk.js +1 -1
  107. package/dist/locale/kk.min.js +1 -1
  108. package/dist/locale/kk.min.mjs +1 -1
  109. package/dist/locale/kk.mjs +1 -1
  110. package/dist/locale/km.js +1 -1
  111. package/dist/locale/km.min.js +1 -1
  112. package/dist/locale/km.min.mjs +1 -1
  113. package/dist/locale/km.mjs +1 -1
  114. package/dist/locale/ko.js +1 -1
  115. package/dist/locale/ko.min.js +1 -1
  116. package/dist/locale/ko.min.mjs +1 -1
  117. package/dist/locale/ko.mjs +1 -1
  118. package/dist/locale/ku.js +1 -1
  119. package/dist/locale/ku.min.js +1 -1
  120. package/dist/locale/ku.min.mjs +1 -1
  121. package/dist/locale/ku.mjs +1 -1
  122. package/dist/locale/ky.js +1 -1
  123. package/dist/locale/ky.min.js +1 -1
  124. package/dist/locale/ky.min.mjs +1 -1
  125. package/dist/locale/ky.mjs +1 -1
  126. package/dist/locale/lt.js +1 -1
  127. package/dist/locale/lt.min.js +1 -1
  128. package/dist/locale/lt.min.mjs +1 -1
  129. package/dist/locale/lt.mjs +1 -1
  130. package/dist/locale/lv.js +1 -1
  131. package/dist/locale/lv.min.js +1 -1
  132. package/dist/locale/lv.min.mjs +1 -1
  133. package/dist/locale/lv.mjs +1 -1
  134. package/dist/locale/mn.js +1 -1
  135. package/dist/locale/mn.min.js +1 -1
  136. package/dist/locale/mn.min.mjs +1 -1
  137. package/dist/locale/mn.mjs +1 -1
  138. package/dist/locale/nb-no.js +1 -1
  139. package/dist/locale/nb-no.min.js +1 -1
  140. package/dist/locale/nb-no.min.mjs +1 -1
  141. package/dist/locale/nb-no.mjs +1 -1
  142. package/dist/locale/nl.js +1 -1
  143. package/dist/locale/nl.min.js +1 -1
  144. package/dist/locale/nl.min.mjs +1 -1
  145. package/dist/locale/nl.mjs +1 -1
  146. package/dist/locale/pa.js +1 -1
  147. package/dist/locale/pa.min.js +1 -1
  148. package/dist/locale/pa.min.mjs +1 -1
  149. package/dist/locale/pa.mjs +1 -1
  150. package/dist/locale/pl.js +1 -1
  151. package/dist/locale/pl.min.js +1 -1
  152. package/dist/locale/pl.min.mjs +1 -1
  153. package/dist/locale/pl.mjs +1 -1
  154. package/dist/locale/pt-br.js +1 -1
  155. package/dist/locale/pt-br.min.js +1 -1
  156. package/dist/locale/pt-br.min.mjs +1 -1
  157. package/dist/locale/pt-br.mjs +1 -1
  158. package/dist/locale/pt.js +1 -1
  159. package/dist/locale/pt.min.js +1 -1
  160. package/dist/locale/pt.min.mjs +1 -1
  161. package/dist/locale/pt.mjs +1 -1
  162. package/dist/locale/ro.js +1 -1
  163. package/dist/locale/ro.min.js +1 -1
  164. package/dist/locale/ro.min.mjs +1 -1
  165. package/dist/locale/ro.mjs +1 -1
  166. package/dist/locale/ru.js +1 -1
  167. package/dist/locale/ru.min.js +1 -1
  168. package/dist/locale/ru.min.mjs +1 -1
  169. package/dist/locale/ru.mjs +1 -1
  170. package/dist/locale/sk.js +1 -1
  171. package/dist/locale/sk.min.js +1 -1
  172. package/dist/locale/sk.min.mjs +1 -1
  173. package/dist/locale/sk.mjs +1 -1
  174. package/dist/locale/sl.js +1 -1
  175. package/dist/locale/sl.min.js +1 -1
  176. package/dist/locale/sl.min.mjs +1 -1
  177. package/dist/locale/sl.mjs +1 -1
  178. package/dist/locale/sr.js +1 -1
  179. package/dist/locale/sr.min.js +1 -1
  180. package/dist/locale/sr.min.mjs +1 -1
  181. package/dist/locale/sr.mjs +1 -1
  182. package/dist/locale/sv.js +1 -1
  183. package/dist/locale/sv.min.js +1 -1
  184. package/dist/locale/sv.min.mjs +1 -1
  185. package/dist/locale/sv.mjs +1 -1
  186. package/dist/locale/ta.js +1 -1
  187. package/dist/locale/ta.min.js +1 -1
  188. package/dist/locale/ta.min.mjs +1 -1
  189. package/dist/locale/ta.mjs +1 -1
  190. package/dist/locale/th.js +1 -1
  191. package/dist/locale/th.min.js +1 -1
  192. package/dist/locale/th.min.mjs +1 -1
  193. package/dist/locale/th.mjs +1 -1
  194. package/dist/locale/tk.js +1 -1
  195. package/dist/locale/tk.min.js +1 -1
  196. package/dist/locale/tk.min.mjs +1 -1
  197. package/dist/locale/tk.mjs +1 -1
  198. package/dist/locale/tr.js +1 -1
  199. package/dist/locale/tr.min.js +1 -1
  200. package/dist/locale/tr.min.mjs +1 -1
  201. package/dist/locale/tr.mjs +1 -1
  202. package/dist/locale/ug-cn.js +1 -1
  203. package/dist/locale/ug-cn.min.js +1 -1
  204. package/dist/locale/ug-cn.min.mjs +1 -1
  205. package/dist/locale/ug-cn.mjs +1 -1
  206. package/dist/locale/uk.js +1 -1
  207. package/dist/locale/uk.min.js +1 -1
  208. package/dist/locale/uk.min.mjs +1 -1
  209. package/dist/locale/uk.mjs +1 -1
  210. package/dist/locale/uz-uz.js +1 -1
  211. package/dist/locale/uz-uz.min.js +1 -1
  212. package/dist/locale/uz-uz.min.mjs +1 -1
  213. package/dist/locale/uz-uz.mjs +1 -1
  214. package/dist/locale/vi.js +1 -1
  215. package/dist/locale/vi.min.js +1 -1
  216. package/dist/locale/vi.min.mjs +1 -1
  217. package/dist/locale/vi.mjs +1 -1
  218. package/dist/locale/zh-cn.js +1 -1
  219. package/dist/locale/zh-cn.min.js +1 -1
  220. package/dist/locale/zh-cn.min.mjs +1 -1
  221. package/dist/locale/zh-cn.mjs +1 -1
  222. package/dist/locale/zh-tw.js +1 -1
  223. package/dist/locale/zh-tw.min.js +1 -1
  224. package/dist/locale/zh-tw.min.mjs +1 -1
  225. package/dist/locale/zh-tw.mjs +1 -1
  226. package/es/components/autocomplete/index.d.ts +12 -4
  227. package/es/components/autocomplete/src/index.mjs +11 -4
  228. package/es/components/autocomplete/src/index.mjs.map +1 -1
  229. package/es/components/autocomplete/src/index.vue.d.ts +6 -2
  230. package/es/components/cascader/index.d.ts +12 -4
  231. package/es/components/cascader/src/index.mjs +12 -5
  232. package/es/components/cascader/src/index.mjs.map +1 -1
  233. package/es/components/cascader/src/index.vue.d.ts +6 -2
  234. package/es/components/index.mjs +3 -2
  235. package/es/components/index.mjs.map +1 -1
  236. package/es/components/pagination/src/pagination.mjs +5 -3
  237. package/es/components/pagination/src/pagination.mjs.map +1 -1
  238. package/es/components/popconfirm/index.d.ts +26 -22
  239. package/es/components/popconfirm/src/popconfirm.d.ts +12 -11
  240. package/es/components/popconfirm/src/popconfirm.mjs +48 -43
  241. package/es/components/popconfirm/src/popconfirm.mjs.map +1 -1
  242. package/es/components/popconfirm/src/popconfirm.vue.d.ts +26 -22
  243. package/es/components/popconfirm/src/popconfirm2.mjs +8 -3
  244. package/es/components/popconfirm/src/popconfirm2.mjs.map +1 -1
  245. package/es/components/popover/index.d.ts +26 -0
  246. package/es/components/popover/src/index.mjs +8 -3
  247. package/es/components/popover/src/index.mjs.map +1 -1
  248. package/es/components/popover/src/index.vue.d.ts +39 -26
  249. package/es/components/popover/src/popover.d.ts +5 -0
  250. package/es/components/popover/src/popover.mjs +2 -0
  251. package/es/components/popover/src/popover.mjs.map +1 -1
  252. package/es/components/popper/index.d.ts +1 -0
  253. package/es/components/popper/index.mjs +1 -0
  254. package/es/components/popper/index.mjs.map +1 -1
  255. package/es/components/popper/src/deprecation.d.ts +3 -0
  256. package/es/components/popper/src/deprecation.mjs +24 -0
  257. package/es/components/popper/src/deprecation.mjs.map +1 -0
  258. package/es/components/select/index.d.ts +6 -2
  259. package/es/components/select/src/select.mjs +13 -6
  260. package/es/components/select/src/select.mjs.map +1 -1
  261. package/es/components/select/src/select.vue.d.ts +30 -26
  262. package/es/components/select-v2/index.d.ts +12 -12
  263. package/es/components/select-v2/src/defaults.d.ts +2 -1
  264. package/es/components/select-v2/src/defaults.mjs +4 -1
  265. package/es/components/select-v2/src/defaults.mjs.map +1 -1
  266. package/es/components/select-v2/src/select.mjs +2 -2
  267. package/es/components/select-v2/src/select.mjs.map +1 -1
  268. package/es/components/select-v2/src/select.vue.d.ts +6 -6
  269. package/es/components/select-v2/src/useSelect.d.ts +1 -4
  270. package/es/components/select-v2/src/useSelect.mjs +4 -2
  271. package/es/components/select-v2/src/useSelect.mjs.map +1 -1
  272. package/es/components/switch/index.mjs +2 -2
  273. package/es/components/switch/src/switch.mjs +247 -86
  274. package/es/components/switch/src/switch.mjs.map +1 -1
  275. package/es/components/switch/src/switch2.mjs +86 -247
  276. package/es/components/switch/src/switch2.mjs.map +1 -1
  277. package/es/components/table/src/table/style-helper.mjs +2 -0
  278. package/es/components/table/src/table/style-helper.mjs.map +1 -1
  279. package/es/components/timeline/index.mjs +2 -2
  280. package/es/components/timeline/src/timeline-item.mjs +73 -37
  281. package/es/components/timeline/src/timeline-item.mjs.map +1 -1
  282. package/es/components/timeline/src/timeline-item2.mjs +37 -73
  283. package/es/components/timeline/src/timeline-item2.mjs.map +1 -1
  284. package/es/components/tree/index.d.ts +8 -8
  285. package/es/components/tree/src/tree.mjs +0 -1
  286. package/es/components/tree/src/tree.mjs.map +1 -1
  287. package/es/components/tree/src/tree.vue.d.ts +4 -4
  288. package/es/hooks/index.d.ts +1 -0
  289. package/es/hooks/index.mjs +1 -0
  290. package/es/hooks/index.mjs.map +1 -1
  291. package/es/hooks/use-deprecated/index.d.ts +10 -0
  292. package/es/hooks/use-deprecated/index.mjs +17 -0
  293. package/es/hooks/use-deprecated/index.mjs.map +1 -0
  294. package/es/index.mjs +4 -2
  295. package/es/index.mjs.map +1 -1
  296. package/es/version.d.ts +1 -1
  297. package/es/version.mjs +1 -1
  298. package/es/version.mjs.map +1 -1
  299. package/lib/components/autocomplete/index.d.ts +12 -4
  300. package/lib/components/autocomplete/src/index.js +11 -4
  301. package/lib/components/autocomplete/src/index.js.map +1 -1
  302. package/lib/components/autocomplete/src/index.vue.d.ts +6 -2
  303. package/lib/components/cascader/index.d.ts +12 -4
  304. package/lib/components/cascader/src/index.js +12 -5
  305. package/lib/components/cascader/src/index.js.map +1 -1
  306. package/lib/components/cascader/src/index.vue.d.ts +6 -2
  307. package/lib/components/index.js +4 -2
  308. package/lib/components/index.js.map +1 -1
  309. package/lib/components/pagination/src/pagination.js +5 -3
  310. package/lib/components/pagination/src/pagination.js.map +1 -1
  311. package/lib/components/popconfirm/index.d.ts +26 -22
  312. package/lib/components/popconfirm/src/popconfirm.d.ts +12 -11
  313. package/lib/components/popconfirm/src/popconfirm.js +48 -43
  314. package/lib/components/popconfirm/src/popconfirm.js.map +1 -1
  315. package/lib/components/popconfirm/src/popconfirm.vue.d.ts +26 -22
  316. package/lib/components/popconfirm/src/popconfirm2.js +8 -3
  317. package/lib/components/popconfirm/src/popconfirm2.js.map +1 -1
  318. package/lib/components/popover/index.d.ts +26 -0
  319. package/lib/components/popover/src/index.js +8 -3
  320. package/lib/components/popover/src/index.js.map +1 -1
  321. package/lib/components/popover/src/index.vue.d.ts +39 -26
  322. package/lib/components/popover/src/popover.d.ts +5 -0
  323. package/lib/components/popover/src/popover.js +2 -0
  324. package/lib/components/popover/src/popover.js.map +1 -1
  325. package/lib/components/popper/index.d.ts +1 -0
  326. package/lib/components/popper/index.js +2 -0
  327. package/lib/components/popper/index.js.map +1 -1
  328. package/lib/components/popper/src/deprecation.d.ts +3 -0
  329. package/lib/components/popper/src/deprecation.js +28 -0
  330. package/lib/components/popper/src/deprecation.js.map +1 -0
  331. package/lib/components/select/index.d.ts +6 -2
  332. package/lib/components/select/src/select.js +13 -6
  333. package/lib/components/select/src/select.js.map +1 -1
  334. package/lib/components/select/src/select.vue.d.ts +30 -26
  335. package/lib/components/select-v2/index.d.ts +12 -12
  336. package/lib/components/select-v2/src/defaults.d.ts +2 -1
  337. package/lib/components/select-v2/src/defaults.js +4 -1
  338. package/lib/components/select-v2/src/defaults.js.map +1 -1
  339. package/lib/components/select-v2/src/select.js +2 -2
  340. package/lib/components/select-v2/src/select.js.map +1 -1
  341. package/lib/components/select-v2/src/select.vue.d.ts +6 -6
  342. package/lib/components/select-v2/src/useSelect.d.ts +1 -4
  343. package/lib/components/select-v2/src/useSelect.js +11 -9
  344. package/lib/components/select-v2/src/useSelect.js.map +1 -1
  345. package/lib/components/switch/index.js +2 -2
  346. package/lib/components/switch/src/switch.js +247 -87
  347. package/lib/components/switch/src/switch.js.map +1 -1
  348. package/lib/components/switch/src/switch2.js +87 -247
  349. package/lib/components/switch/src/switch2.js.map +1 -1
  350. package/lib/components/table/src/table/style-helper.js +2 -0
  351. package/lib/components/table/src/table/style-helper.js.map +1 -1
  352. package/lib/components/timeline/index.js +2 -2
  353. package/lib/components/timeline/src/timeline-item.js +73 -37
  354. package/lib/components/timeline/src/timeline-item.js.map +1 -1
  355. package/lib/components/timeline/src/timeline-item2.js +37 -73
  356. package/lib/components/timeline/src/timeline-item2.js.map +1 -1
  357. package/lib/components/tree/index.d.ts +8 -8
  358. package/lib/components/tree/src/tree.js +0 -1
  359. package/lib/components/tree/src/tree.js.map +1 -1
  360. package/lib/components/tree/src/tree.vue.d.ts +4 -4
  361. package/lib/hooks/index.d.ts +1 -0
  362. package/lib/hooks/index.js +62 -60
  363. package/lib/hooks/index.js.map +1 -1
  364. package/lib/hooks/use-deprecated/index.d.ts +10 -0
  365. package/lib/hooks/use-deprecated/index.js +21 -0
  366. package/lib/hooks/use-deprecated/index.js.map +1 -0
  367. package/lib/index.js +66 -62
  368. package/lib/index.js.map +1 -1
  369. package/lib/version.d.ts +1 -1
  370. package/lib/version.js +1 -1
  371. package/lib/version.js.map +1 -1
  372. package/package.json +2 -2
  373. package/tags.json +1 -1
  374. package/theme-chalk/el-pagination.css +1 -1
  375. package/theme-chalk/index.css +1 -1
  376. package/theme-chalk/src/pagination.scss +4 -1
  377. package/web-types.json +1 -1
@@ -1,253 +1,92 @@
1
- import { defineComponent, computed, ref, watch, nextTick, onMounted, resolveComponent, openBlock, createElementBlock, normalizeClass, withModifiers, createElementVNode, withKeys, createBlock, withCtx, resolveDynamicComponent, createCommentVNode, toDisplayString, normalizeStyle, Fragment, createVNode } from 'vue';
2
- import { isPromise } from '@vue/shared';
3
- import { isBool } from '../../../utils/util.mjs';
4
- import { throwError, debugWarn } from '../../../utils/error.mjs';
5
- import { ElIcon } from '../../icon/index.mjs';
6
- import { Loading } from '@element-plus/icons-vue';
1
+ import { buildProps, definePropType } from '../../../utils/props.mjs';
7
2
  import { UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT } from '../../../utils/constants.mjs';
8
- import '../../../hooks/index.mjs';
9
- import { switchProps, switchEmits } from './switch.mjs';
10
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
11
- import { useFormItem } from '../../../hooks/use-form-item/index.mjs';
12
- import { useDisabled, useSize } from '../../../hooks/use-common-props/index.mjs';
13
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
3
+ import { isBool, isNumber } from '../../../utils/util.mjs';
4
+ import { isValidComponentSize } from '../../../utils/validators.mjs';
5
+ import { isString } from '@vue/shared';
14
6
 
15
- const COMPONENT_NAME = "ElSwitch";
16
- const _sfc_main = defineComponent({
17
- name: COMPONENT_NAME,
18
- components: { ElIcon, Loading },
19
- props: switchProps,
20
- emits: switchEmits,
21
- setup(props, { emit }) {
22
- const { formItem } = useFormItem();
23
- const switchDisabled = useDisabled(computed(() => props.loading));
24
- const ns = useNamespace("switch");
25
- const switchSize = useSize();
26
- const isModelValue = ref(props.modelValue !== false);
27
- const input = ref();
28
- const core = ref();
29
- const switchKls = computed(() => [
30
- ns.b(),
31
- ns.m(switchSize.value),
32
- ns.is("disabled", switchDisabled.value),
33
- ns.is("checked", checked.value)
34
- ]);
35
- watch(() => props.modelValue, () => {
36
- isModelValue.value = true;
37
- });
38
- watch(() => props.value, () => {
39
- isModelValue.value = false;
40
- });
41
- const actualValue = computed(() => {
42
- return isModelValue.value ? props.modelValue : props.value;
43
- });
44
- const checked = computed(() => actualValue.value === props.activeValue);
45
- if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
46
- emit(UPDATE_MODEL_EVENT, props.inactiveValue);
47
- emit(CHANGE_EVENT, props.inactiveValue);
48
- emit(INPUT_EVENT, props.inactiveValue);
49
- }
50
- watch(checked, () => {
51
- var _a;
52
- input.value.checked = checked.value;
53
- if (props.activeColor || props.inactiveColor) {
54
- setBackgroundColor();
55
- }
56
- if (props.validateEvent) {
57
- (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change");
58
- }
59
- });
60
- const handleChange = () => {
61
- const val = checked.value ? props.inactiveValue : props.activeValue;
62
- emit(UPDATE_MODEL_EVENT, val);
63
- emit(CHANGE_EVENT, val);
64
- emit(INPUT_EVENT, val);
65
- nextTick(() => {
66
- input.value.checked = checked.value;
67
- });
68
- };
69
- const switchValue = () => {
70
- if (switchDisabled.value)
71
- return;
72
- const { beforeChange } = props;
73
- if (!beforeChange) {
74
- handleChange();
75
- return;
76
- }
77
- const shouldChange = beforeChange();
78
- const isExpectType = [isPromise(shouldChange), isBool(shouldChange)].some((i) => i);
79
- if (!isExpectType) {
80
- throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
81
- }
82
- if (isPromise(shouldChange)) {
83
- shouldChange.then((result) => {
84
- if (result) {
85
- handleChange();
86
- }
87
- }).catch((e) => {
88
- debugWarn(COMPONENT_NAME, `some error occurred: ${e}`);
89
- });
90
- } else if (shouldChange) {
91
- handleChange();
92
- }
93
- };
94
- const setBackgroundColor = () => {
95
- const newColor = checked.value ? props.activeColor : props.inactiveColor;
96
- const coreEl = core.value;
97
- if (props.borderColor)
98
- coreEl.style.borderColor = props.borderColor;
99
- else if (!props.borderColor)
100
- coreEl.style.borderColor = newColor;
101
- coreEl.style.backgroundColor = newColor;
102
- coreEl.children[0].style.color = newColor;
103
- };
104
- const focus = () => {
105
- var _a, _b;
106
- (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
107
- };
108
- onMounted(() => {
109
- if (props.activeColor || props.inactiveColor || props.borderColor) {
110
- setBackgroundColor();
111
- }
112
- input.value.checked = checked.value;
113
- });
114
- return {
115
- ns,
116
- input,
117
- core,
118
- switchDisabled,
119
- checked,
120
- switchKls,
121
- handleChange,
122
- switchValue,
123
- focus
124
- };
7
+ const switchProps = buildProps({
8
+ modelValue: {
9
+ type: [Boolean, String, Number],
10
+ default: false
11
+ },
12
+ value: {
13
+ type: [Boolean, String, Number],
14
+ default: false
15
+ },
16
+ disabled: {
17
+ type: Boolean,
18
+ default: false
19
+ },
20
+ width: {
21
+ type: Number,
22
+ default: 40
23
+ },
24
+ inlinePrompt: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ activeIcon: {
29
+ type: definePropType([String, Object, Function]),
30
+ default: ""
31
+ },
32
+ inactiveIcon: {
33
+ type: definePropType([String, Object, Function]),
34
+ default: ""
35
+ },
36
+ activeText: {
37
+ type: String,
38
+ default: ""
39
+ },
40
+ inactiveText: {
41
+ type: String,
42
+ default: ""
43
+ },
44
+ activeColor: {
45
+ type: String,
46
+ default: ""
47
+ },
48
+ inactiveColor: {
49
+ type: String,
50
+ default: ""
51
+ },
52
+ borderColor: {
53
+ type: String,
54
+ default: ""
55
+ },
56
+ activeValue: {
57
+ type: [Boolean, String, Number],
58
+ default: true
59
+ },
60
+ inactiveValue: {
61
+ type: [Boolean, String, Number],
62
+ default: false
63
+ },
64
+ name: {
65
+ type: String,
66
+ default: ""
67
+ },
68
+ validateEvent: {
69
+ type: Boolean,
70
+ default: true
71
+ },
72
+ id: String,
73
+ loading: {
74
+ type: Boolean,
75
+ default: false
76
+ },
77
+ beforeChange: {
78
+ type: definePropType(Function)
79
+ },
80
+ size: {
81
+ type: String,
82
+ validator: isValidComponentSize
125
83
  }
126
84
  });
127
- const _hoisted_1 = ["aria-checked", "aria-disabled"];
128
- const _hoisted_2 = ["id", "name", "true-value", "false-value", "disabled"];
129
- const _hoisted_3 = ["aria-hidden"];
130
- const _hoisted_4 = ["aria-hidden"];
131
- const _hoisted_5 = ["aria-hidden"];
132
- const _hoisted_6 = ["aria-hidden"];
133
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
134
- const _component_el_icon = resolveComponent("el-icon");
135
- const _component_loading = resolveComponent("loading");
136
- return openBlock(), createElementBlock("div", {
137
- class: normalizeClass(_ctx.switchKls),
138
- role: "switch",
139
- "aria-checked": _ctx.checked,
140
- "aria-disabled": _ctx.switchDisabled,
141
- onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["prevent"]))
142
- }, [
143
- createElementVNode("input", {
144
- id: _ctx.id,
145
- ref: "input",
146
- class: normalizeClass(_ctx.ns.e("input")),
147
- type: "checkbox",
148
- name: _ctx.name,
149
- "true-value": _ctx.activeValue,
150
- "false-value": _ctx.inactiveValue,
151
- disabled: _ctx.switchDisabled,
152
- onChange: _cache[0] || (_cache[0] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
153
- onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["enter"]))
154
- }, null, 42, _hoisted_2),
155
- !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
156
- key: 0,
157
- class: normalizeClass([
158
- _ctx.ns.e("label"),
159
- _ctx.ns.em("label", "left"),
160
- _ctx.ns.is("active", !_ctx.checked)
161
- ])
162
- }, [
163
- _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
164
- default: withCtx(() => [
165
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
166
- ]),
167
- _: 1
168
- })) : createCommentVNode("v-if", true),
169
- !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
170
- key: 1,
171
- "aria-hidden": _ctx.checked
172
- }, toDisplayString(_ctx.inactiveText), 9, _hoisted_3)) : createCommentVNode("v-if", true)
173
- ], 2)) : createCommentVNode("v-if", true),
174
- createElementVNode("span", {
175
- ref: "core",
176
- class: normalizeClass(_ctx.ns.e("core")),
177
- style: normalizeStyle({ width: (_ctx.width || 40) + "px" })
178
- }, [
179
- _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
180
- key: 0,
181
- class: normalizeClass(_ctx.ns.e("inner"))
182
- }, [
183
- _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
184
- _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, {
185
- key: 0,
186
- class: normalizeClass([_ctx.ns.is("icon"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
187
- }, {
188
- default: withCtx(() => [
189
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
190
- ]),
191
- _: 1
192
- }, 8, ["class"])) : createCommentVNode("v-if", true),
193
- _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, {
194
- key: 1,
195
- class: normalizeClass([_ctx.ns.is("icon"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
196
- }, {
197
- default: withCtx(() => [
198
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
199
- ]),
200
- _: 1
201
- }, 8, ["class"])) : createCommentVNode("v-if", true)
202
- ], 64)) : _ctx.activeText || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
203
- _ctx.activeText ? (openBlock(), createElementBlock("span", {
204
- key: 0,
205
- class: normalizeClass([_ctx.ns.is("text"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
206
- "aria-hidden": !_ctx.checked
207
- }, toDisplayString(_ctx.activeText.substr(0, 1)), 11, _hoisted_4)) : createCommentVNode("v-if", true),
208
- _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
209
- key: 1,
210
- class: normalizeClass([_ctx.ns.is("text"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
211
- "aria-hidden": _ctx.checked
212
- }, toDisplayString(_ctx.inactiveText.substr(0, 1)), 11, _hoisted_5)) : createCommentVNode("v-if", true)
213
- ], 64)) : createCommentVNode("v-if", true)
214
- ], 2)) : createCommentVNode("v-if", true),
215
- createElementVNode("div", {
216
- class: normalizeClass(_ctx.ns.e("action"))
217
- }, [
218
- _ctx.loading ? (openBlock(), createBlock(_component_el_icon, {
219
- key: 0,
220
- class: normalizeClass(_ctx.ns.is("loading"))
221
- }, {
222
- default: withCtx(() => [
223
- createVNode(_component_loading)
224
- ]),
225
- _: 1
226
- }, 8, ["class"])) : createCommentVNode("v-if", true)
227
- ], 2)
228
- ], 6),
229
- !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
230
- key: 1,
231
- class: normalizeClass([
232
- _ctx.ns.e("label"),
233
- _ctx.ns.em("label", "right"),
234
- _ctx.ns.is("active", _ctx.checked)
235
- ])
236
- }, [
237
- _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
238
- default: withCtx(() => [
239
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
240
- ]),
241
- _: 1
242
- })) : createCommentVNode("v-if", true),
243
- !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
244
- key: 1,
245
- "aria-hidden": !_ctx.checked
246
- }, toDisplayString(_ctx.activeText), 9, _hoisted_6)) : createCommentVNode("v-if", true)
247
- ], 2)) : createCommentVNode("v-if", true)
248
- ], 10, _hoisted_1);
249
- }
250
- var Switch = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
85
+ const switchEmits = {
86
+ [UPDATE_MODEL_EVENT]: (val) => isBool(val) || isString(val) || isNumber(val),
87
+ [CHANGE_EVENT]: (val) => isBool(val) || isString(val) || isNumber(val),
88
+ [INPUT_EVENT]: (val) => isBool(val) || isString(val) || isNumber(val)
89
+ };
251
90
 
252
- export { Switch as default };
91
+ export { switchEmits, switchProps };
253
92
  //# sourceMappingURL=switch2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch2.mjs","sources":["../../../../../../packages/components/switch/src/switch.vue"],"sourcesContent":["<template>\n <div\n :class=\"switchKls\"\n role=\"switch\"\n :aria-checked=\"checked\"\n :aria-disabled=\"switchDisabled\"\n @click.prevent=\"switchValue\"\n >\n <input\n :id=\"id\"\n ref=\"input\"\n :class=\"ns.e('input')\"\n type=\"checkbox\"\n :name=\"name\"\n :true-value=\"activeValue\"\n :false-value=\"inactiveValue\"\n :disabled=\"switchDisabled\"\n @change=\"handleChange\"\n @keydown.enter=\"switchValue\"\n />\n <span\n v-if=\"!inlinePrompt && (inactiveIcon || inactiveText)\"\n :class=\"[\n ns.e('label'),\n ns.em('label', 'left'),\n ns.is('active', !checked),\n ]\"\n >\n <el-icon v-if=\"inactiveIcon\"><component :is=\"inactiveIcon\" /></el-icon>\n <span v-if=\"!inactiveIcon && inactiveText\" :aria-hidden=\"checked\">{{\n inactiveText\n }}</span>\n </span>\n <span\n ref=\"core\"\n :class=\"ns.e('core')\"\n :style=\"{ width: (width || 40) + 'px' }\"\n >\n <div v-if=\"inlinePrompt\" :class=\"ns.e('inner')\">\n <template v-if=\"activeIcon || inactiveIcon\">\n <el-icon\n v-if=\"activeIcon\"\n :class=\"[ns.is('icon'), checked ? ns.is('show') : ns.is('hide')]\"\n >\n <component :is=\"activeIcon\" />\n </el-icon>\n <el-icon\n v-if=\"inactiveIcon\"\n :class=\"[ns.is('icon'), !checked ? ns.is('show') : ns.is('hide')]\"\n >\n <component :is=\"inactiveIcon\" />\n </el-icon>\n </template>\n <template v-else-if=\"activeText || inactiveIcon\">\n <span\n v-if=\"activeText\"\n :class=\"[ns.is('text'), checked ? ns.is('show') : ns.is('hide')]\"\n :aria-hidden=\"!checked\"\n >\n {{ activeText.substr(0, 1) }}\n </span>\n <span\n v-if=\"inactiveText\"\n :class=\"[ns.is('text'), !checked ? ns.is('show') : ns.is('hide')]\"\n :aria-hidden=\"checked\"\n >\n {{ inactiveText.substr(0, 1) }}\n </span>\n </template>\n </div>\n <div :class=\"ns.e('action')\">\n <el-icon v-if=\"loading\" :class=\"ns.is('loading')\"><loading /></el-icon>\n </div>\n </span>\n <span\n v-if=\"!inlinePrompt && (activeIcon || activeText)\"\n :class=\"[\n ns.e('label'),\n ns.em('label', 'right'),\n ns.is('active', checked),\n ]\"\n >\n <el-icon v-if=\"activeIcon\"><component :is=\"activeIcon\" /></el-icon>\n <span v-if=\"!activeIcon && activeText\" :aria-hidden=\"!checked\">{{\n activeText\n }}</span>\n </span>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, computed, onMounted, ref, nextTick, watch } from 'vue'\nimport { isPromise } from '@vue/shared'\nimport { isBool } from '@element-plus/utils/util'\nimport { throwError, debugWarn } from '@element-plus/utils/error'\nimport ElIcon from '@element-plus/components/icon'\nimport { Loading } from '@element-plus/icons-vue'\nimport {\n UPDATE_MODEL_EVENT,\n CHANGE_EVENT,\n INPUT_EVENT,\n} from '@element-plus/utils/constants'\nimport {\n useDisabled,\n useFormItem,\n useNamespace,\n useSize,\n} from '@element-plus/hooks'\nimport { switchProps, switchEmits } from './switch'\n\nconst COMPONENT_NAME = 'ElSwitch'\n\nexport default defineComponent({\n name: COMPONENT_NAME,\n components: { ElIcon, Loading },\n\n props: switchProps,\n emits: switchEmits,\n\n setup(props, { emit }) {\n const { formItem } = useFormItem()\n const switchDisabled = useDisabled(computed(() => props.loading))\n const ns = useNamespace('switch')\n\n const switchSize = useSize()\n const isModelValue = ref(props.modelValue !== false)\n const input = ref<HTMLInputElement>()\n const core = ref<HTMLSpanElement>()\n\n const switchKls = computed(() => [\n ns.b(),\n ns.m(switchSize.value),\n ns.is('disabled', switchDisabled.value),\n ns.is('checked', checked.value),\n ])\n\n watch(\n () => props.modelValue,\n () => {\n isModelValue.value = true\n }\n )\n\n watch(\n () => props.value,\n () => {\n isModelValue.value = false\n }\n )\n\n const actualValue = computed(() => {\n return isModelValue.value ? props.modelValue : props.value\n })\n\n const checked = computed(() => actualValue.value === props.activeValue)\n\n if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {\n emit(UPDATE_MODEL_EVENT, props.inactiveValue)\n emit(CHANGE_EVENT, props.inactiveValue)\n emit(INPUT_EVENT, props.inactiveValue)\n }\n\n watch(checked, () => {\n input.value!.checked = checked.value\n\n if (props.activeColor || props.inactiveColor) {\n setBackgroundColor()\n }\n\n if (props.validateEvent) {\n formItem?.validate?.('change')\n }\n })\n\n const handleChange = (): void => {\n const val = checked.value ? props.inactiveValue : props.activeValue\n emit(UPDATE_MODEL_EVENT, val)\n emit(CHANGE_EVENT, val)\n emit(INPUT_EVENT, val)\n nextTick(() => {\n input.value!.checked = checked.value\n })\n }\n\n const switchValue = (): void => {\n if (switchDisabled.value) return\n\n const { beforeChange } = props\n if (!beforeChange) {\n handleChange()\n return\n }\n\n const shouldChange = beforeChange()\n\n const isExpectType = [isPromise(shouldChange), isBool(shouldChange)].some(\n (i) => i\n )\n if (!isExpectType) {\n throwError(\n COMPONENT_NAME,\n 'beforeChange must return type `Promise<boolean>` or `boolean`'\n )\n }\n\n if (isPromise(shouldChange)) {\n shouldChange\n .then((result) => {\n if (result) {\n handleChange()\n }\n })\n .catch((e) => {\n debugWarn(COMPONENT_NAME, `some error occurred: ${e}`)\n })\n } else if (shouldChange) {\n handleChange()\n }\n }\n\n const setBackgroundColor = (): void => {\n const newColor = checked.value ? props.activeColor : props.inactiveColor\n const coreEl = core.value\n if (props.borderColor) coreEl!.style.borderColor = props.borderColor\n else if (!props.borderColor) coreEl!.style.borderColor = newColor\n coreEl!.style.backgroundColor = newColor\n ;(coreEl!.children[0] as HTMLDivElement).style.color = newColor\n }\n\n const focus = (): void => {\n input.value?.focus?.()\n }\n\n onMounted(() => {\n if (props.activeColor || props.inactiveColor || props.borderColor) {\n setBackgroundColor()\n }\n\n input.value!.checked = checked.value\n })\n\n return {\n ns,\n input,\n core,\n switchDisabled,\n checked,\n switchKls,\n handleChange,\n switchValue,\n focus,\n }\n },\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA8GA,MAAM,iBAAiB;AAEvB,MAAK,YAAa,gBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY,EAAE,QAAQ;AAAA,EAEtB,OAAO;AAAA,EACP,OAAO;AAAA,EAEP,MAAM,OAAO,EAAE,QAAQ;AACrB,UAAM,EAAE,aAAa;AACrB,UAAM,iBAAiB,YAAY,SAAS,MAAM,MAAM;AACxD,UAAM,KAAK,aAAa;AAExB,UAAM,aAAa;AACnB,UAAM,eAAe,IAAI,MAAM,eAAe;AAC9C,UAAM,QAAQ;AACd,UAAM,OAAO;AAEb,UAAM,YAAY,SAAS,MAAM;AAAA,MAC/B,GAAG;AAAA,MACH,GAAG,EAAE,WAAW;AAAA,MAChB,GAAG,GAAG,YAAY,eAAe;AAAA,MACjC,GAAG,GAAG,WAAW,QAAQ;AAAA;AAG3B,UACE,MAAM,MAAM,YACZ,MAAM;AACJ,mBAAa,QAAQ;AAAA;AAIzB,UACE,MAAM,MAAM,OACZ,MAAM;AACJ,mBAAa,QAAQ;AAAA;AAIzB,UAAM,cAAc,SAAS,MAAM;AACjC,aAAO,aAAa,QAAQ,MAAM,aAAa,MAAM;AAAA;AAGvD,UAAM,UAAU,SAAS,MAAM,YAAY,UAAU,MAAM;AAE3D,QAAI,CAAC,CAAC,MAAM,aAAa,MAAM,eAAe,SAAS,YAAY,QAAQ;AACzE,WAAK,oB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AAiC;;;AAMhE;AAA0C;AAA9B;;;;AACA;QAAa;AAAA;AACtC;;;;;;;;;;"}
1
+ {"version":3,"file":"switch2.mjs","sources":["../../../../../../packages/components/switch/src/switch.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils/props'\nimport {\n UPDATE_MODEL_EVENT,\n CHANGE_EVENT,\n INPUT_EVENT,\n} from '@element-plus/utils/constants'\nimport { isBool, isNumber, isString } from '@element-plus/utils/util'\nimport { isValidComponentSize } from '@element-plus/utils/validators'\nimport type { ComponentSize } from '@element-plus/utils/types'\nimport type Switch from './switch.vue'\nimport type { Component, ExtractPropTypes, PropType } from 'vue'\n\nexport const switchProps = buildProps({\n modelValue: {\n type: [Boolean, String, Number],\n default: false,\n },\n value: {\n type: [Boolean, String, Number],\n default: false,\n },\n disabled: {\n type: Boolean,\n default: false,\n },\n width: {\n type: Number,\n default: 40,\n },\n inlinePrompt: {\n type: Boolean,\n default: false,\n },\n activeIcon: {\n type: definePropType<string | Component>([String, Object, Function]),\n default: '',\n },\n inactiveIcon: {\n type: definePropType<string | Component>([String, Object, Function]),\n default: '',\n },\n activeText: {\n type: String,\n default: '',\n },\n inactiveText: {\n type: String,\n default: '',\n },\n activeColor: {\n type: String,\n default: '',\n },\n inactiveColor: {\n type: String,\n default: '',\n },\n borderColor: {\n type: String,\n default: '',\n },\n activeValue: {\n type: [Boolean, String, Number],\n default: true,\n },\n inactiveValue: {\n type: [Boolean, String, Number],\n default: false,\n },\n name: {\n type: String,\n default: '',\n },\n validateEvent: {\n type: Boolean,\n default: true,\n },\n id: String,\n loading: {\n type: Boolean,\n default: false,\n },\n beforeChange: {\n type: definePropType<() => Promise<boolean> | boolean>(Function),\n },\n size: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n} as const)\n\nexport type SwitchProps = ExtractPropTypes<typeof switchProps>\n\nexport const switchEmits = {\n [UPDATE_MODEL_EVENT]: (val: boolean | string | number) =>\n isBool(val) || isString(val) || isNumber(val),\n [CHANGE_EVENT]: (val: boolean | string | number) =>\n isBool(val) || isString(val) || isNumber(val),\n [INPUT_EVENT]: (val: boolean | string | number) =>\n isBool(val) || isString(val) || isNumber(val),\n}\nexport type SwitchEmits = typeof switchEmits\n\nexport type SwitchInstance = InstanceType<typeof Switch>\n"],"names":[],"mappings":";;;;;;AAQY,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;AACnC,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;AACnC,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AACpD,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AACpD,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,MAAM;AACh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AC,GAAG,CAAC;AAC9E,EAAE,CAAC,YAAY,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC;AACxE,EAAE,CAAC,WAAW,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC;AACvE;;;;"}
@@ -122,6 +122,8 @@ function useStyle(props, layout, store, table) {
122
122
  };
123
123
  const bindEvents = () => {
124
124
  var _a;
125
+ if (!table.refs.scrollWrapper)
126
+ return;
125
127
  (_a = table.refs.scrollWrapper.wrap$) == null ? void 0 : _a.addEventListener("scroll", syncPostion, {
126
128
  passive: true
127
129
  });
@@ -1 +1 @@
1
- {"version":3,"file":"style-helper.mjs","sources":["../../../../../../../packages/components/table/src/table/style-helper.ts"],"sourcesContent":["import {\n onMounted,\n onBeforeUnmount,\n computed,\n ref,\n watchEffect,\n watch,\n unref,\n nextTick,\n} from 'vue'\nimport {\n addResizeListener,\n removeResizeListener,\n} from '@element-plus/utils/resize-event'\nimport { on, off } from '@element-plus/utils/dom'\nimport { useSize } from '@element-plus/hooks'\nimport { parseHeight } from '../util'\n\nimport type { ResizableElement } from '@element-plus/utils/resize-event'\nimport type { Table, TableProps } from './defaults'\nimport type { Store } from '../store'\nimport type TableLayout from '../table-layout'\nimport type { TableColumnCtx } from '../table-column/defaults'\n\nfunction useStyle<T>(\n props: TableProps<T>,\n layout: TableLayout<T>,\n store: Store<T>,\n table: Table<T>\n) {\n const isHidden = ref(false)\n const renderExpanded = ref(null)\n const resizeProxyVisible = ref(false)\n const setDragVisible = (visible: boolean) => {\n resizeProxyVisible.value = visible\n }\n const resizeState = ref({\n width: null,\n height: null,\n })\n const isGroup = ref(false)\n\n watchEffect(() => {\n layout.setHeight(props.height)\n })\n watchEffect(() => {\n layout.setMaxHeight(props.maxHeight)\n })\n watch(\n () => [props.currentRowKey, store.states.rowKey],\n ([currentRowKey, rowKey]) => {\n if (!unref(rowKey)) return\n store.setCurrentRowKey(`${currentRowKey}`)\n },\n {\n immediate: true,\n }\n )\n watch(\n () => props.data,\n (data) => {\n table.store.commit('setData', data)\n },\n {\n immediate: true,\n deep: true,\n }\n )\n watchEffect(() => {\n if (props.expandRowKeys) {\n store.setExpandRowKeysAdapter(props.expandRowKeys)\n }\n })\n\n const handleMouseLeave = () => {\n table.store.commit('setHoverRow', null)\n if (table.hoverState) table.hoverState = null\n }\n\n const handleHeaderFooterMousewheel = (event, data) => {\n const { pixelX, pixelY } = data\n if (Math.abs(pixelX) >= Math.abs(pixelY)) {\n table.refs.bodyWrapper.scrollLeft += data.pixelX / 5\n }\n }\n\n const shouldUpdateHeight = computed(() => {\n return (\n props.height ||\n props.maxHeight ||\n store.states.fixedColumns.value.length > 0 ||\n store.states.rightFixedColumns.value.length > 0\n )\n })\n\n const tableBodyStyles = computed(() => {\n return {\n width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : '',\n }\n })\n\n const doLayout = () => {\n if (shouldUpdateHeight.value) {\n layout.updateElsHeight()\n }\n layout.updateColumnsWidth()\n requestAnimationFrame(syncPostion)\n }\n onMounted(async () => {\n setScrollClass('is-scrolling-left')\n store.updateColumns()\n await nextTick()\n bindEvents()\n requestAnimationFrame(doLayout)\n\n resizeState.value = {\n width: table.vnode.el.offsetWidth,\n height: table.vnode.el.offsetHeight,\n }\n\n // init filters\n store.states.columns.value.forEach((column: TableColumnCtx<T>) => {\n if (column.filteredValue && column.filteredValue.length) {\n table.store.commit('filterChange', {\n column,\n values: column.filteredValue,\n silent: true,\n })\n }\n })\n table.$ready = true\n })\n const setScrollClassByEl = (el: HTMLElement, className: string) => {\n if (!el) return\n const classList = Array.from(el.classList).filter(\n (item) => !item.startsWith('is-scrolling-')\n )\n classList.push(layout.scrollX.value ? className : 'is-scrolling-none')\n el.className = classList.join(' ')\n }\n const setScrollClass = (className: string) => {\n const { tableWrapper } = table.refs\n setScrollClassByEl(tableWrapper, className)\n }\n const syncPostion = function () {\n if (!table.refs.scrollWrapper) return\n const scrollContainer = table.refs.scrollWrapper.wrap$\n if (!scrollContainer) return\n const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer\n const { headerWrapper, footerWrapper } = table.refs\n if (headerWrapper) headerWrapper.scrollLeft = scrollLeft\n if (footerWrapper) footerWrapper.scrollLeft = scrollLeft\n const maxScrollLeftPosition = scrollWidth - offsetWidth - 1\n if (scrollLeft >= maxScrollLeftPosition) {\n setScrollClass('is-scrolling-right')\n } else if (scrollLeft === 0) {\n setScrollClass('is-scrolling-left')\n } else {\n setScrollClass('is-scrolling-middle')\n }\n }\n\n const bindEvents = () => {\n table.refs.scrollWrapper.wrap$?.addEventListener('scroll', syncPostion, {\n passive: true,\n })\n if (props.fit) {\n addResizeListener(table.vnode.el as ResizableElement, resizeListener)\n } else {\n on(window, 'resize', doLayout)\n }\n }\n onBeforeUnmount(() => {\n unbindEvents()\n })\n const unbindEvents = () => {\n table.refs.scrollWrapper.wrap$?.removeEventListener(\n 'scroll',\n syncPostion,\n true\n )\n if (props.fit) {\n removeResizeListener(table.vnode.el as ResizableElement, resizeListener)\n } else {\n off(window, 'resize', doLayout)\n }\n }\n const resizeListener = () => {\n if (!table.$ready) return\n let shouldUpdateLayout = false\n const el = table.vnode.el\n const { width: oldWidth, height: oldHeight } = resizeState.value\n\n const width = el.offsetWidth\n if (oldWidth !== width) {\n shouldUpdateLayout = true\n }\n\n const height = el.offsetHeight\n if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {\n shouldUpdateLayout = true\n }\n\n if (shouldUpdateLayout) {\n resizeState.value = {\n width,\n height,\n }\n doLayout()\n }\n }\n const tableSize = useSize()\n const bodyWidth = computed(() => {\n const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout\n return bodyWidth_.value\n ? `${(bodyWidth_.value as number) - (scrollY.value ? gutterWidth : 0)}px`\n : ''\n })\n\n const height = computed(() => {\n const headerHeight = layout.headerHeight.value || 0\n const bodyHeight = layout.bodyHeight.value\n const footerHeight = layout.footerHeight.value || 0\n if (props.height) {\n return bodyHeight ? bodyHeight : undefined\n } else if (props.maxHeight) {\n const maxHeight = parseHeight(props.maxHeight)\n return maxHeight - footerHeight - (props.showHeader ? headerHeight : 0)\n }\n return undefined\n })\n\n const bodyHeight = computed(() => {\n const headerHeight = layout.headerHeight.value || 0\n const bodyHeight = layout.bodyHeight.value\n const footerHeight = layout.footerHeight.value || 0\n if (props.height) {\n return {\n height: bodyHeight ? `${bodyHeight}px` : '',\n }\n } else if (props.maxHeight) {\n const maxHeight = parseHeight(props.maxHeight)\n if (typeof maxHeight === 'number') {\n return {\n 'max-height': `${\n maxHeight - footerHeight - (props.showHeader ? headerHeight : 0)\n }px`,\n }\n }\n }\n return {}\n })\n const emptyBlockStyle = computed(() => {\n if (props.data && props.data.length) return null\n let height = '100%'\n if (layout.appendHeight.value) {\n height = `calc(100% - ${layout.appendHeight.value}px)`\n }\n return {\n width: bodyWidth.value,\n height,\n }\n })\n /**\n * fix layout\n */\n const handleFixedMousewheel = (event, data) => {\n const bodyWrapper = table.refs.bodyWrapper\n if (Math.abs(data.spinY) > 0) {\n const currentScrollTop = bodyWrapper.scrollTop\n if (data.pixelY < 0 && currentScrollTop !== 0) {\n event.preventDefault()\n }\n if (\n data.pixelY > 0 &&\n bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop\n ) {\n event.preventDefault()\n }\n bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5)\n } else {\n bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5)\n }\n }\n const fixedHeight = computed(() => {\n if (props.maxHeight) {\n if (props.showSummary) {\n return {\n bottom: 0,\n }\n }\n return {\n bottom:\n layout.scrollX.value && props.data.length\n ? `${layout.gutterWidth}px`\n : '',\n }\n } else {\n if (props.showSummary) {\n return {\n height: layout.tableHeight.value\n ? `${layout.tableHeight.value}px`\n : '',\n }\n }\n return {\n height: layout.viewportHeight.value\n ? `${layout.viewportHeight.value}px`\n : '',\n }\n }\n })\n const fixedBodyHeight = computed(() => {\n if (props.height) {\n return {\n height: layout.fixedBodyHeight.value\n ? `${layout.fixedBodyHeight.value}px`\n : '',\n }\n } else if (props.maxHeight) {\n let maxHeight = parseHeight(props.maxHeight)\n if (typeof maxHeight === 'number') {\n maxHeight = layout.scrollX.value\n ? maxHeight - layout.gutterWidth\n : maxHeight\n if (props.showHeader) {\n maxHeight -= layout.headerHeight.value\n }\n maxHeight -= layout.footerHeight.value\n return {\n 'max-height': `${maxHeight}px`,\n }\n }\n }\n return {}\n })\n\n return {\n isHidden,\n renderExpanded,\n setDragVisible,\n isGroup,\n handleMouseLeave,\n handleHeaderFooterMousewheel,\n tableSize,\n bodyHeight,\n height,\n emptyBlockStyle,\n handleFixedMousewheel,\n fixedHeight,\n fixedBodyHeight,\n resizeProxyVisible,\n bodyWidth,\n resizeState,\n doLayout,\n tableBodyStyles,\n }\n}\n\nexport default useStyle\n"],"names":[],"mappings":";;;;;;;AAiBA,SAAS,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE;AAC/C,EAAE,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;AAC9B,EAAE,MAAM,cAAc,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;AACnC,EAAE,MAAM,kBAAkB,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;AACxC,EAAE,MAAM,cAAc,GAAG,CAAC,OAAO,KAAK;AACtC,IAAI,kBAAkB,CAAC,KAAK,GAAG,OAAO,CAAC;AACvC,GAAG,CAAC;AACJ,EAAE,MAAM,WAAW,GAAG,GAAG,CAAC;AAC1B,IAAI,KAAK,EAAE,IAAI;AACf,IAAI,MAAM,EAAE,IAAI;AAChB,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;AAC7B,EA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S,GAAG,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACnD,MAAM,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;AACzC,QAAQ,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC;AACtF,QAAQ,IAAI,KAAK,CAAC,UAAU,EAAE;AAC9B,UAAU,SAAS,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC;AACjD,SAAS;AACT,QAAQ,SAAS,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC;AAC/C,QAAQ,OAAO;AACf,UAAU,YAAY,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC;AACxC,SAAS,CAAC;AACV,OAAO;AACP,KAAK;AACL,IAAI,OAAO,EAAE,CAAC;AACd,GAAG,CAAC,CAAC;AACL,EAAE,OAAO;AACT,IAAI,QAAQ;AACZ,IAAI,cAAc;AAClB,IAAI,cAAc;AAClB,IAAI,OAAO;AACX,IAAI,gBAAgB;AACpB,IAAI,4BAA4B;AAChC,IAAI,SAAS;AACb,IAAI,UAAU;AACd,IAAI,MAAM;AACV,IAAI,eAAe;AACnB,IAAI,qBAAqB;AACzB,IAAI,WAAW;AACf,IAAI,eAAe;AACnB,IAAI,kBAAkB;AACtB,IAAI,SAAS;AACb,IAAI,WAAW;AACf,IAAI,QAAQ;AACZ,IAAI,eAAe;AACnB,GAAG,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"style-helper.mjs","sources":["../../../../../../../packages/components/table/src/table/style-helper.ts"],"sourcesContent":["import {\n onMounted,\n onBeforeUnmount,\n computed,\n ref,\n watchEffect,\n watch,\n unref,\n nextTick,\n} from 'vue'\nimport {\n addResizeListener,\n removeResizeListener,\n} from '@element-plus/utils/resize-event'\nimport { on, off } from '@element-plus/utils/dom'\nimport { useSize } from '@element-plus/hooks'\nimport { parseHeight } from '../util'\n\nimport type { ResizableElement } from '@element-plus/utils/resize-event'\nimport type { Table, TableProps } from './defaults'\nimport type { Store } from '../store'\nimport type TableLayout from '../table-layout'\nimport type { TableColumnCtx } from '../table-column/defaults'\n\nfunction useStyle<T>(\n props: TableProps<T>,\n layout: TableLayout<T>,\n store: Store<T>,\n table: Table<T>\n) {\n const isHidden = ref(false)\n const renderExpanded = ref(null)\n const resizeProxyVisible = ref(false)\n const setDragVisible = (visible: boolean) => {\n resizeProxyVisible.value = visible\n }\n const resizeState = ref({\n width: null,\n height: null,\n })\n const isGroup = ref(false)\n\n watchEffect(() => {\n layout.setHeight(props.height)\n })\n watchEffect(() => {\n layout.setMaxHeight(props.maxHeight)\n })\n watch(\n () => [props.currentRowKey, store.states.rowKey],\n ([currentRowKey, rowKey]) => {\n if (!unref(rowKey)) return\n store.setCurrentRowKey(`${currentRowKey}`)\n },\n {\n immediate: true,\n }\n )\n watch(\n () => props.data,\n (data) => {\n table.store.commit('setData', data)\n },\n {\n immediate: true,\n deep: true,\n }\n )\n watchEffect(() => {\n if (props.expandRowKeys) {\n store.setExpandRowKeysAdapter(props.expandRowKeys)\n }\n })\n\n const handleMouseLeave = () => {\n table.store.commit('setHoverRow', null)\n if (table.hoverState) table.hoverState = null\n }\n\n const handleHeaderFooterMousewheel = (event, data) => {\n const { pixelX, pixelY } = data\n if (Math.abs(pixelX) >= Math.abs(pixelY)) {\n table.refs.bodyWrapper.scrollLeft += data.pixelX / 5\n }\n }\n\n const shouldUpdateHeight = computed(() => {\n return (\n props.height ||\n props.maxHeight ||\n store.states.fixedColumns.value.length > 0 ||\n store.states.rightFixedColumns.value.length > 0\n )\n })\n\n const tableBodyStyles = computed(() => {\n return {\n width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : '',\n }\n })\n\n const doLayout = () => {\n if (shouldUpdateHeight.value) {\n layout.updateElsHeight()\n }\n layout.updateColumnsWidth()\n requestAnimationFrame(syncPostion)\n }\n onMounted(async () => {\n setScrollClass('is-scrolling-left')\n store.updateColumns()\n await nextTick()\n bindEvents()\n requestAnimationFrame(doLayout)\n\n resizeState.value = {\n width: table.vnode.el.offsetWidth,\n height: table.vnode.el.offsetHeight,\n }\n\n // init filters\n store.states.columns.value.forEach((column: TableColumnCtx<T>) => {\n if (column.filteredValue && column.filteredValue.length) {\n table.store.commit('filterChange', {\n column,\n values: column.filteredValue,\n silent: true,\n })\n }\n })\n table.$ready = true\n })\n const setScrollClassByEl = (el: HTMLElement, className: string) => {\n if (!el) return\n const classList = Array.from(el.classList).filter(\n (item) => !item.startsWith('is-scrolling-')\n )\n classList.push(layout.scrollX.value ? className : 'is-scrolling-none')\n el.className = classList.join(' ')\n }\n const setScrollClass = (className: string) => {\n const { tableWrapper } = table.refs\n setScrollClassByEl(tableWrapper, className)\n }\n const syncPostion = function () {\n if (!table.refs.scrollWrapper) return\n const scrollContainer = table.refs.scrollWrapper.wrap$\n if (!scrollContainer) return\n const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer\n const { headerWrapper, footerWrapper } = table.refs\n if (headerWrapper) headerWrapper.scrollLeft = scrollLeft\n if (footerWrapper) footerWrapper.scrollLeft = scrollLeft\n const maxScrollLeftPosition = scrollWidth - offsetWidth - 1\n if (scrollLeft >= maxScrollLeftPosition) {\n setScrollClass('is-scrolling-right')\n } else if (scrollLeft === 0) {\n setScrollClass('is-scrolling-left')\n } else {\n setScrollClass('is-scrolling-middle')\n }\n }\n\n const bindEvents = () => {\n if (!table.refs.scrollWrapper) return\n table.refs.scrollWrapper.wrap$?.addEventListener('scroll', syncPostion, {\n passive: true,\n })\n if (props.fit) {\n addResizeListener(table.vnode.el as ResizableElement, resizeListener)\n } else {\n on(window, 'resize', doLayout)\n }\n }\n onBeforeUnmount(() => {\n unbindEvents()\n })\n const unbindEvents = () => {\n table.refs.scrollWrapper.wrap$?.removeEventListener(\n 'scroll',\n syncPostion,\n true\n )\n if (props.fit) {\n removeResizeListener(table.vnode.el as ResizableElement, resizeListener)\n } else {\n off(window, 'resize', doLayout)\n }\n }\n const resizeListener = () => {\n if (!table.$ready) return\n let shouldUpdateLayout = false\n const el = table.vnode.el\n const { width: oldWidth, height: oldHeight } = resizeState.value\n\n const width = el.offsetWidth\n if (oldWidth !== width) {\n shouldUpdateLayout = true\n }\n\n const height = el.offsetHeight\n if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {\n shouldUpdateLayout = true\n }\n\n if (shouldUpdateLayout) {\n resizeState.value = {\n width,\n height,\n }\n doLayout()\n }\n }\n const tableSize = useSize()\n const bodyWidth = computed(() => {\n const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout\n return bodyWidth_.value\n ? `${(bodyWidth_.value as number) - (scrollY.value ? gutterWidth : 0)}px`\n : ''\n })\n\n const height = computed(() => {\n const headerHeight = layout.headerHeight.value || 0\n const bodyHeight = layout.bodyHeight.value\n const footerHeight = layout.footerHeight.value || 0\n if (props.height) {\n return bodyHeight ? bodyHeight : undefined\n } else if (props.maxHeight) {\n const maxHeight = parseHeight(props.maxHeight)\n return maxHeight - footerHeight - (props.showHeader ? headerHeight : 0)\n }\n return undefined\n })\n\n const bodyHeight = computed(() => {\n const headerHeight = layout.headerHeight.value || 0\n const bodyHeight = layout.bodyHeight.value\n const footerHeight = layout.footerHeight.value || 0\n if (props.height) {\n return {\n height: bodyHeight ? `${bodyHeight}px` : '',\n }\n } else if (props.maxHeight) {\n const maxHeight = parseHeight(props.maxHeight)\n if (typeof maxHeight === 'number') {\n return {\n 'max-height': `${\n maxHeight - footerHeight - (props.showHeader ? headerHeight : 0)\n }px`,\n }\n }\n }\n return {}\n })\n const emptyBlockStyle = computed(() => {\n if (props.data && props.data.length) return null\n let height = '100%'\n if (layout.appendHeight.value) {\n height = `calc(100% - ${layout.appendHeight.value}px)`\n }\n return {\n width: bodyWidth.value,\n height,\n }\n })\n /**\n * fix layout\n */\n const handleFixedMousewheel = (event, data) => {\n const bodyWrapper = table.refs.bodyWrapper\n if (Math.abs(data.spinY) > 0) {\n const currentScrollTop = bodyWrapper.scrollTop\n if (data.pixelY < 0 && currentScrollTop !== 0) {\n event.preventDefault()\n }\n if (\n data.pixelY > 0 &&\n bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop\n ) {\n event.preventDefault()\n }\n bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5)\n } else {\n bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5)\n }\n }\n const fixedHeight = computed(() => {\n if (props.maxHeight) {\n if (props.showSummary) {\n return {\n bottom: 0,\n }\n }\n return {\n bottom:\n layout.scrollX.value && props.data.length\n ? `${layout.gutterWidth}px`\n : '',\n }\n } else {\n if (props.showSummary) {\n return {\n height: layout.tableHeight.value\n ? `${layout.tableHeight.value}px`\n : '',\n }\n }\n return {\n height: layout.viewportHeight.value\n ? `${layout.viewportHeight.value}px`\n : '',\n }\n }\n })\n const fixedBodyHeight = computed(() => {\n if (props.height) {\n return {\n height: layout.fixedBodyHeight.value\n ? `${layout.fixedBodyHeight.value}px`\n : '',\n }\n } else if (props.maxHeight) {\n let maxHeight = parseHeight(props.maxHeight)\n if (typeof maxHeight === 'number') {\n maxHeight = layout.scrollX.value\n ? maxHeight - layout.gutterWidth\n : maxHeight\n if (props.showHeader) {\n maxHeight -= layout.headerHeight.value\n }\n maxHeight -= layout.footerHeight.value\n return {\n 'max-height': `${maxHeight}px`,\n }\n }\n }\n return {}\n })\n\n return {\n isHidden,\n renderExpanded,\n setDragVisible,\n isGroup,\n handleMouseLeave,\n handleHeaderFooterMousewheel,\n tableSize,\n bodyHeight,\n height,\n emptyBlockStyle,\n handleFixedMousewheel,\n fixedHeight,\n fixedBodyHeight,\n resizeProxyVisible,\n bodyWidth,\n resizeState,\n doLayout,\n tableBodyStyles,\n }\n}\n\nexport default useStyle\n"],"names":[],"mappings":";;;;;;;AAiBA,SAAS,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE;AAC/C,EAAE,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,C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AACd,IAAI,MAAM;AACV,IAAI,eAAe;AACnB,IAAI,qBAAqB;AACzB,IAAI,WAAW;AACf,IAAI,eAAe;AACnB,IAAI,kBAAkB;AACtB,IAAI,SAAS;AACb,IAAI,WAAW;AACf,IAAI,QAAQ;AACZ,IAAI,eAAe;AACnB,GAAG,CAAC;AACJ;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { withInstall, withNoopInstall } from '../../utils/with-install.mjs';
2
2
  import Timeline from './src/timeline.mjs';
3
- import TimelineItem from './src/timeline-item2.mjs';
4
- export { timelineItemProps } from './src/timeline-item.mjs';
3
+ import TimelineItem from './src/timeline-item.mjs';
4
+ export { timelineItemProps } from './src/timeline-item2.mjs';
5
5
 
6
6
  const ElTimeline = withInstall(Timeline, {
7
7
  TimelineItem
@@ -1,43 +1,79 @@
1
- import { buildProps, definePropType } from '../../../utils/props.mjs';
1
+ import { defineComponent, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, createBlock, withCtx, resolveDynamicComponent, createCommentVNode, renderSlot, toDisplayString } from 'vue';
2
+ import { ElIcon } from '../../icon/index.mjs';
3
+ import '../../../hooks/index.mjs';
4
+ import { timelineItemProps } from './timeline-item2.mjs';
5
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
6
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
2
7
 
3
- const timelineItemProps = buildProps({
4
- timestamp: {
5
- type: String,
6
- default: ""
8
+ const _sfc_main = defineComponent({
9
+ name: "ElTimelineItem",
10
+ components: {
11
+ ElIcon
7
12
  },
8
- hideTimestamp: {
9
- type: Boolean,
10
- default: false
11
- },
12
- center: {
13
- type: Boolean,
14
- default: false
15
- },
16
- placement: {
17
- type: String,
18
- default: "bottom"
19
- },
20
- type: {
21
- type: String,
22
- default: ""
23
- },
24
- color: {
25
- type: String,
26
- default: ""
27
- },
28
- size: {
29
- type: String,
30
- default: "normal"
31
- },
32
- icon: {
33
- type: definePropType([String, Object]),
34
- default: ""
35
- },
36
- hollow: {
37
- type: Boolean,
38
- default: false
13
+ props: timelineItemProps,
14
+ setup() {
15
+ const ns = useNamespace("timeline-item");
16
+ return {
17
+ ns
18
+ };
39
19
  }
40
20
  });
21
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
22
+ const _component_el_icon = resolveComponent("el-icon");
23
+ return openBlock(), createElementBlock("li", {
24
+ class: normalizeClass([_ctx.ns.b(), { [_ctx.ns.e("center")]: _ctx.center }])
25
+ }, [
26
+ createElementVNode("div", {
27
+ class: normalizeClass(_ctx.ns.e("tail"))
28
+ }, null, 2),
29
+ !_ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
30
+ key: 0,
31
+ class: normalizeClass([
32
+ _ctx.ns.e("node"),
33
+ _ctx.ns.em("node", _ctx.size || ""),
34
+ _ctx.ns.em("node", _ctx.type || ""),
35
+ _ctx.ns.is("hollow", _ctx.hollow)
36
+ ]),
37
+ style: normalizeStyle({
38
+ backgroundColor: _ctx.color
39
+ })
40
+ }, [
41
+ _ctx.icon ? (openBlock(), createBlock(_component_el_icon, {
42
+ key: 0,
43
+ class: normalizeClass(_ctx.ns.e("icon"))
44
+ }, {
45
+ default: withCtx(() => [
46
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
47
+ ]),
48
+ _: 1
49
+ }, 8, ["class"])) : createCommentVNode("v-if", true)
50
+ ], 6)) : createCommentVNode("v-if", true),
51
+ _ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
52
+ key: 1,
53
+ class: normalizeClass(_ctx.ns.e("dot"))
54
+ }, [
55
+ renderSlot(_ctx.$slots, "dot")
56
+ ], 2)) : createCommentVNode("v-if", true),
57
+ createElementVNode("div", {
58
+ class: normalizeClass(_ctx.ns.e("wrapper"))
59
+ }, [
60
+ !_ctx.hideTimestamp && _ctx.placement === "top" ? (openBlock(), createElementBlock("div", {
61
+ key: 0,
62
+ class: normalizeClass([_ctx.ns.e("timestamp"), _ctx.ns.is("top")])
63
+ }, toDisplayString(_ctx.timestamp), 3)) : createCommentVNode("v-if", true),
64
+ createElementVNode("div", {
65
+ class: normalizeClass(_ctx.ns.e("content"))
66
+ }, [
67
+ renderSlot(_ctx.$slots, "default")
68
+ ], 2),
69
+ !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (openBlock(), createElementBlock("div", {
70
+ key: 1,
71
+ class: normalizeClass([_ctx.ns.e("timestamp"), _ctx.ns.is("bottom")])
72
+ }, toDisplayString(_ctx.timestamp), 3)) : createCommentVNode("v-if", true)
73
+ ], 2)
74
+ ], 2);
75
+ }
76
+ var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
41
77
 
42
- export { timelineItemProps };
78
+ export { TimelineItem as default };
43
79
  //# sourceMappingURL=timeline-item.mjs.map