@element-plus/nightly 0.0.20231122 → 0.0.20231123

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 (368) hide show
  1. package/dist/index.full.js +2 -2
  2. package/dist/index.full.min.js +2 -2
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +2 -2
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +2 -2
  7. package/dist/locale/af.js +1 -1
  8. package/dist/locale/af.min.js +1 -1
  9. package/dist/locale/af.min.mjs +1 -1
  10. package/dist/locale/af.mjs +1 -1
  11. package/dist/locale/ar.js +1 -1
  12. package/dist/locale/ar.min.js +1 -1
  13. package/dist/locale/ar.min.mjs +1 -1
  14. package/dist/locale/ar.mjs +1 -1
  15. package/dist/locale/az.js +1 -1
  16. package/dist/locale/az.min.js +1 -1
  17. package/dist/locale/az.min.mjs +1 -1
  18. package/dist/locale/az.mjs +1 -1
  19. package/dist/locale/bg.js +1 -1
  20. package/dist/locale/bg.min.js +1 -1
  21. package/dist/locale/bg.min.mjs +1 -1
  22. package/dist/locale/bg.mjs +1 -1
  23. package/dist/locale/bn.js +1 -1
  24. package/dist/locale/bn.min.js +1 -1
  25. package/dist/locale/bn.min.mjs +1 -1
  26. package/dist/locale/bn.mjs +1 -1
  27. package/dist/locale/ca.js +1 -1
  28. package/dist/locale/ca.min.js +1 -1
  29. package/dist/locale/ca.min.mjs +1 -1
  30. package/dist/locale/ca.mjs +1 -1
  31. package/dist/locale/ckb.js +1 -1
  32. package/dist/locale/ckb.min.js +1 -1
  33. package/dist/locale/ckb.min.mjs +1 -1
  34. package/dist/locale/ckb.mjs +1 -1
  35. package/dist/locale/cs.js +1 -1
  36. package/dist/locale/cs.min.js +1 -1
  37. package/dist/locale/cs.min.mjs +1 -1
  38. package/dist/locale/cs.mjs +1 -1
  39. package/dist/locale/da.js +1 -1
  40. package/dist/locale/da.min.js +1 -1
  41. package/dist/locale/da.min.mjs +1 -1
  42. package/dist/locale/da.mjs +1 -1
  43. package/dist/locale/de.js +1 -1
  44. package/dist/locale/de.min.js +1 -1
  45. package/dist/locale/de.min.mjs +1 -1
  46. package/dist/locale/de.mjs +1 -1
  47. package/dist/locale/el.js +1 -1
  48. package/dist/locale/el.min.js +1 -1
  49. package/dist/locale/el.min.mjs +1 -1
  50. package/dist/locale/el.mjs +1 -1
  51. package/dist/locale/en.js +1 -1
  52. package/dist/locale/en.min.js +1 -1
  53. package/dist/locale/en.min.mjs +1 -1
  54. package/dist/locale/en.mjs +1 -1
  55. package/dist/locale/eo.js +1 -1
  56. package/dist/locale/eo.min.js +1 -1
  57. package/dist/locale/eo.min.mjs +1 -1
  58. package/dist/locale/eo.mjs +1 -1
  59. package/dist/locale/es.js +1 -1
  60. package/dist/locale/es.min.js +1 -1
  61. package/dist/locale/es.min.mjs +1 -1
  62. package/dist/locale/es.mjs +1 -1
  63. package/dist/locale/et.js +1 -1
  64. package/dist/locale/et.min.js +1 -1
  65. package/dist/locale/et.min.mjs +1 -1
  66. package/dist/locale/et.mjs +1 -1
  67. package/dist/locale/eu.js +1 -1
  68. package/dist/locale/eu.min.js +1 -1
  69. package/dist/locale/eu.min.mjs +1 -1
  70. package/dist/locale/eu.mjs +1 -1
  71. package/dist/locale/fa.js +1 -1
  72. package/dist/locale/fa.min.js +1 -1
  73. package/dist/locale/fa.min.mjs +1 -1
  74. package/dist/locale/fa.mjs +1 -1
  75. package/dist/locale/fi.js +1 -1
  76. package/dist/locale/fi.min.js +1 -1
  77. package/dist/locale/fi.min.mjs +1 -1
  78. package/dist/locale/fi.mjs +1 -1
  79. package/dist/locale/fr.js +1 -1
  80. package/dist/locale/fr.min.js +1 -1
  81. package/dist/locale/fr.min.mjs +1 -1
  82. package/dist/locale/fr.mjs +1 -1
  83. package/dist/locale/he.js +1 -1
  84. package/dist/locale/he.min.js +1 -1
  85. package/dist/locale/he.min.mjs +1 -1
  86. package/dist/locale/he.mjs +1 -1
  87. package/dist/locale/hr.js +1 -1
  88. package/dist/locale/hr.min.js +1 -1
  89. package/dist/locale/hr.min.mjs +1 -1
  90. package/dist/locale/hr.mjs +1 -1
  91. package/dist/locale/hu.js +1 -1
  92. package/dist/locale/hu.min.js +1 -1
  93. package/dist/locale/hu.min.mjs +1 -1
  94. package/dist/locale/hu.mjs +1 -1
  95. package/dist/locale/hy-am.js +1 -1
  96. package/dist/locale/hy-am.min.js +1 -1
  97. package/dist/locale/hy-am.min.mjs +1 -1
  98. package/dist/locale/hy-am.mjs +1 -1
  99. package/dist/locale/id.js +1 -1
  100. package/dist/locale/id.min.js +1 -1
  101. package/dist/locale/id.min.mjs +1 -1
  102. package/dist/locale/id.mjs +1 -1
  103. package/dist/locale/it.js +1 -1
  104. package/dist/locale/it.min.js +1 -1
  105. package/dist/locale/it.min.mjs +1 -1
  106. package/dist/locale/it.mjs +1 -1
  107. package/dist/locale/ja.js +1 -1
  108. package/dist/locale/ja.min.js +1 -1
  109. package/dist/locale/ja.min.mjs +1 -1
  110. package/dist/locale/ja.mjs +1 -1
  111. package/dist/locale/kk.js +1 -1
  112. package/dist/locale/kk.min.js +1 -1
  113. package/dist/locale/kk.min.mjs +1 -1
  114. package/dist/locale/kk.mjs +1 -1
  115. package/dist/locale/km.js +1 -1
  116. package/dist/locale/km.min.js +1 -1
  117. package/dist/locale/km.min.mjs +1 -1
  118. package/dist/locale/km.mjs +1 -1
  119. package/dist/locale/ko.js +1 -1
  120. package/dist/locale/ko.min.js +1 -1
  121. package/dist/locale/ko.min.mjs +1 -1
  122. package/dist/locale/ko.mjs +1 -1
  123. package/dist/locale/ku.js +1 -1
  124. package/dist/locale/ku.min.js +1 -1
  125. package/dist/locale/ku.min.mjs +1 -1
  126. package/dist/locale/ku.mjs +1 -1
  127. package/dist/locale/ky.js +1 -1
  128. package/dist/locale/ky.min.js +1 -1
  129. package/dist/locale/ky.min.mjs +1 -1
  130. package/dist/locale/ky.mjs +1 -1
  131. package/dist/locale/lt.js +1 -1
  132. package/dist/locale/lt.min.js +1 -1
  133. package/dist/locale/lt.min.mjs +1 -1
  134. package/dist/locale/lt.mjs +1 -1
  135. package/dist/locale/lv.js +1 -1
  136. package/dist/locale/lv.min.js +1 -1
  137. package/dist/locale/lv.min.mjs +1 -1
  138. package/dist/locale/lv.mjs +1 -1
  139. package/dist/locale/mg.js +1 -1
  140. package/dist/locale/mg.min.js +1 -1
  141. package/dist/locale/mg.min.mjs +1 -1
  142. package/dist/locale/mg.mjs +1 -1
  143. package/dist/locale/mn.js +1 -1
  144. package/dist/locale/mn.min.js +1 -1
  145. package/dist/locale/mn.min.mjs +1 -1
  146. package/dist/locale/mn.mjs +1 -1
  147. package/dist/locale/nb-no.js +1 -1
  148. package/dist/locale/nb-no.min.js +1 -1
  149. package/dist/locale/nb-no.min.mjs +1 -1
  150. package/dist/locale/nb-no.mjs +1 -1
  151. package/dist/locale/nl.js +1 -1
  152. package/dist/locale/nl.min.js +1 -1
  153. package/dist/locale/nl.min.mjs +1 -1
  154. package/dist/locale/nl.mjs +1 -1
  155. package/dist/locale/pa.js +1 -1
  156. package/dist/locale/pa.min.js +1 -1
  157. package/dist/locale/pa.min.mjs +1 -1
  158. package/dist/locale/pa.mjs +1 -1
  159. package/dist/locale/pl.js +1 -1
  160. package/dist/locale/pl.min.js +1 -1
  161. package/dist/locale/pl.min.mjs +1 -1
  162. package/dist/locale/pl.mjs +1 -1
  163. package/dist/locale/pt-br.js +1 -1
  164. package/dist/locale/pt-br.min.js +1 -1
  165. package/dist/locale/pt-br.min.mjs +1 -1
  166. package/dist/locale/pt-br.mjs +1 -1
  167. package/dist/locale/pt.js +1 -1
  168. package/dist/locale/pt.min.js +1 -1
  169. package/dist/locale/pt.min.mjs +1 -1
  170. package/dist/locale/pt.mjs +1 -1
  171. package/dist/locale/ro.js +1 -1
  172. package/dist/locale/ro.min.js +1 -1
  173. package/dist/locale/ro.min.mjs +1 -1
  174. package/dist/locale/ro.mjs +1 -1
  175. package/dist/locale/ru.js +1 -1
  176. package/dist/locale/ru.min.js +1 -1
  177. package/dist/locale/ru.min.mjs +1 -1
  178. package/dist/locale/ru.mjs +1 -1
  179. package/dist/locale/sk.js +1 -1
  180. package/dist/locale/sk.min.js +1 -1
  181. package/dist/locale/sk.min.mjs +1 -1
  182. package/dist/locale/sk.mjs +1 -1
  183. package/dist/locale/sl.js +1 -1
  184. package/dist/locale/sl.min.js +1 -1
  185. package/dist/locale/sl.min.mjs +1 -1
  186. package/dist/locale/sl.mjs +1 -1
  187. package/dist/locale/sr.js +1 -1
  188. package/dist/locale/sr.min.js +1 -1
  189. package/dist/locale/sr.min.mjs +1 -1
  190. package/dist/locale/sr.mjs +1 -1
  191. package/dist/locale/sv.js +1 -1
  192. package/dist/locale/sv.min.js +1 -1
  193. package/dist/locale/sv.min.mjs +1 -1
  194. package/dist/locale/sv.mjs +1 -1
  195. package/dist/locale/sw.js +1 -1
  196. package/dist/locale/sw.min.js +1 -1
  197. package/dist/locale/sw.min.mjs +1 -1
  198. package/dist/locale/sw.mjs +1 -1
  199. package/dist/locale/ta.js +1 -1
  200. package/dist/locale/ta.min.js +1 -1
  201. package/dist/locale/ta.min.mjs +1 -1
  202. package/dist/locale/ta.mjs +1 -1
  203. package/dist/locale/th.js +1 -1
  204. package/dist/locale/th.min.js +1 -1
  205. package/dist/locale/th.min.mjs +1 -1
  206. package/dist/locale/th.mjs +1 -1
  207. package/dist/locale/tk.js +1 -1
  208. package/dist/locale/tk.min.js +1 -1
  209. package/dist/locale/tk.min.mjs +1 -1
  210. package/dist/locale/tk.mjs +1 -1
  211. package/dist/locale/tr.js +1 -1
  212. package/dist/locale/tr.min.js +1 -1
  213. package/dist/locale/tr.min.mjs +1 -1
  214. package/dist/locale/tr.mjs +1 -1
  215. package/dist/locale/ug-cn.js +1 -1
  216. package/dist/locale/ug-cn.min.js +1 -1
  217. package/dist/locale/ug-cn.min.mjs +1 -1
  218. package/dist/locale/ug-cn.mjs +1 -1
  219. package/dist/locale/uk.js +1 -1
  220. package/dist/locale/uk.min.js +1 -1
  221. package/dist/locale/uk.min.mjs +1 -1
  222. package/dist/locale/uk.mjs +1 -1
  223. package/dist/locale/uz-uz.js +1 -1
  224. package/dist/locale/uz-uz.min.js +1 -1
  225. package/dist/locale/uz-uz.min.mjs +1 -1
  226. package/dist/locale/uz-uz.mjs +1 -1
  227. package/dist/locale/vi.js +1 -1
  228. package/dist/locale/vi.min.js +1 -1
  229. package/dist/locale/vi.min.mjs +1 -1
  230. package/dist/locale/vi.mjs +1 -1
  231. package/dist/locale/zh-cn.js +1 -1
  232. package/dist/locale/zh-cn.min.js +1 -1
  233. package/dist/locale/zh-cn.min.mjs +1 -1
  234. package/dist/locale/zh-cn.mjs +1 -1
  235. package/dist/locale/zh-tw.js +1 -1
  236. package/dist/locale/zh-tw.min.js +1 -1
  237. package/dist/locale/zh-tw.min.mjs +1 -1
  238. package/dist/locale/zh-tw.mjs +1 -1
  239. package/es/components/autocomplete/src/autocomplete.mjs +1 -1
  240. package/es/components/cascader/src/cascader.mjs +1 -1
  241. package/es/components/checkbox/index.mjs +2 -2
  242. package/es/components/checkbox/src/checkbox-button.mjs +1 -1
  243. package/es/components/checkbox/src/checkbox.mjs +50 -117
  244. package/es/components/checkbox/src/checkbox.mjs.map +1 -1
  245. package/es/components/checkbox/src/checkbox2.mjs +117 -50
  246. package/es/components/checkbox/src/checkbox2.mjs.map +1 -1
  247. package/es/components/dropdown/src/dropdown-item-impl.mjs +1 -1
  248. package/es/components/dropdown/src/dropdown-menu.mjs +1 -1
  249. package/es/components/dropdown/src/dropdown.mjs +1 -1
  250. package/es/components/dropdown/src/dropdown2.mjs +1 -1
  251. package/es/components/empty/index.mjs +2 -2
  252. package/es/components/empty/src/empty.mjs +55 -11
  253. package/es/components/empty/src/empty.mjs.map +1 -1
  254. package/es/components/empty/src/empty2.mjs +11 -55
  255. package/es/components/empty/src/empty2.mjs.map +1 -1
  256. package/es/components/index.mjs +7 -7
  257. package/es/components/page-header/index.mjs +2 -2
  258. package/es/components/page-header/src/page-header.mjs +103 -17
  259. package/es/components/page-header/src/page-header.mjs.map +1 -1
  260. package/es/components/page-header/src/page-header2.mjs +17 -103
  261. package/es/components/page-header/src/page-header2.mjs.map +1 -1
  262. package/es/components/popconfirm/src/popconfirm.mjs +1 -1
  263. package/es/components/popover/src/popover.mjs +1 -1
  264. package/es/components/popper/index.mjs +2 -2
  265. package/es/components/popper/src/trigger.mjs +119 -31
  266. package/es/components/popper/src/trigger.mjs.map +1 -1
  267. package/es/components/popper/src/trigger2.mjs +31 -119
  268. package/es/components/popper/src/trigger2.mjs.map +1 -1
  269. package/es/components/roving-focus-group/index.mjs +3 -3
  270. package/es/components/roving-focus-group/src/roving-focus-group-impl.mjs +1 -1
  271. package/es/components/roving-focus-group/src/roving-focus-group.mjs +27 -29
  272. package/es/components/roving-focus-group/src/roving-focus-group.mjs.map +1 -1
  273. package/es/components/roving-focus-group/src/roving-focus-group2.mjs +29 -27
  274. package/es/components/roving-focus-group/src/roving-focus-group2.mjs.map +1 -1
  275. package/es/components/roving-focus-group/src/roving-focus-item.mjs +1 -1
  276. package/es/components/select/src/select.mjs +1 -1
  277. package/es/components/select-v2/src/defaults.mjs +1 -1
  278. package/es/components/switch/index.mjs +2 -2
  279. package/es/components/switch/src/switch.mjs +98 -264
  280. package/es/components/switch/src/switch.mjs.map +1 -1
  281. package/es/components/switch/src/switch2.mjs +264 -98
  282. package/es/components/switch/src/switch2.mjs.map +1 -1
  283. package/es/components/tooltip/index.mjs +1 -1
  284. package/es/components/tooltip/src/content.mjs +177 -31
  285. package/es/components/tooltip/src/content.mjs.map +1 -1
  286. package/es/components/tooltip/src/content2.mjs +31 -177
  287. package/es/components/tooltip/src/content2.mjs.map +1 -1
  288. package/es/components/tooltip/src/tooltip.mjs +1 -1
  289. package/es/components/tooltip/src/tooltip2.mjs +1 -1
  290. package/es/components/tooltip/src/trigger.mjs +1 -1
  291. package/es/components/tooltip/src/trigger2.mjs +1 -1
  292. package/es/components/tooltip-v2/index.mjs +1 -1
  293. package/es/components/tooltip-v2/src/arrow.mjs +22 -37
  294. package/es/components/tooltip-v2/src/arrow.mjs.map +1 -1
  295. package/es/components/tooltip-v2/src/arrow2.mjs +37 -22
  296. package/es/components/tooltip-v2/src/arrow2.mjs.map +1 -1
  297. package/es/components/tooltip-v2/src/tooltip.mjs +1 -1
  298. package/es/components/tooltip-v2/src/tooltip2.mjs +2 -2
  299. package/es/index.mjs +7 -7
  300. package/es/version.d.ts +1 -1
  301. package/es/version.mjs +1 -1
  302. package/es/version.mjs.map +1 -1
  303. package/lib/components/autocomplete/src/autocomplete.js +1 -1
  304. package/lib/components/cascader/src/cascader.js +1 -1
  305. package/lib/components/checkbox/index.js +2 -2
  306. package/lib/components/checkbox/src/checkbox-button.js +1 -1
  307. package/lib/components/checkbox/src/checkbox.js +51 -117
  308. package/lib/components/checkbox/src/checkbox.js.map +1 -1
  309. package/lib/components/checkbox/src/checkbox2.js +117 -51
  310. package/lib/components/checkbox/src/checkbox2.js.map +1 -1
  311. package/lib/components/dropdown/src/dropdown-item-impl.js +1 -1
  312. package/lib/components/dropdown/src/dropdown-menu.js +1 -1
  313. package/lib/components/dropdown/src/dropdown.js +1 -1
  314. package/lib/components/dropdown/src/dropdown2.js +1 -1
  315. package/lib/components/empty/index.js +2 -2
  316. package/lib/components/empty/src/empty.js +55 -11
  317. package/lib/components/empty/src/empty.js.map +1 -1
  318. package/lib/components/empty/src/empty2.js +11 -55
  319. package/lib/components/empty/src/empty2.js.map +1 -1
  320. package/lib/components/index.js +7 -7
  321. package/lib/components/page-header/index.js +2 -2
  322. package/lib/components/page-header/src/page-header.js +103 -18
  323. package/lib/components/page-header/src/page-header.js.map +1 -1
  324. package/lib/components/page-header/src/page-header2.js +18 -103
  325. package/lib/components/page-header/src/page-header2.js.map +1 -1
  326. package/lib/components/popconfirm/src/popconfirm.js +1 -1
  327. package/lib/components/popover/src/popover.js +1 -1
  328. package/lib/components/popper/index.js +2 -2
  329. package/lib/components/popper/src/trigger.js +119 -32
  330. package/lib/components/popper/src/trigger.js.map +1 -1
  331. package/lib/components/popper/src/trigger2.js +32 -119
  332. package/lib/components/popper/src/trigger2.js.map +1 -1
  333. package/lib/components/roving-focus-group/index.js +2 -2
  334. package/lib/components/roving-focus-group/src/roving-focus-group-impl.js +1 -1
  335. package/lib/components/roving-focus-group/src/roving-focus-group.js +27 -33
  336. package/lib/components/roving-focus-group/src/roving-focus-group.js.map +1 -1
  337. package/lib/components/roving-focus-group/src/roving-focus-group2.js +33 -27
  338. package/lib/components/roving-focus-group/src/roving-focus-group2.js.map +1 -1
  339. package/lib/components/roving-focus-group/src/roving-focus-item.js +1 -1
  340. package/lib/components/select/src/select.js +1 -1
  341. package/lib/components/select-v2/src/defaults.js +1 -1
  342. package/lib/components/switch/index.js +2 -2
  343. package/lib/components/switch/src/switch.js +98 -263
  344. package/lib/components/switch/src/switch.js.map +1 -1
  345. package/lib/components/switch/src/switch2.js +263 -98
  346. package/lib/components/switch/src/switch2.js.map +1 -1
  347. package/lib/components/tooltip/index.js +1 -1
  348. package/lib/components/tooltip/src/content.js +177 -31
  349. package/lib/components/tooltip/src/content.js.map +1 -1
  350. package/lib/components/tooltip/src/content2.js +31 -177
  351. package/lib/components/tooltip/src/content2.js.map +1 -1
  352. package/lib/components/tooltip/src/tooltip.js +1 -1
  353. package/lib/components/tooltip/src/tooltip2.js +1 -1
  354. package/lib/components/tooltip/src/trigger.js +1 -1
  355. package/lib/components/tooltip/src/trigger2.js +1 -1
  356. package/lib/components/tooltip-v2/index.js +1 -1
  357. package/lib/components/tooltip-v2/src/arrow.js +23 -37
  358. package/lib/components/tooltip-v2/src/arrow.js.map +1 -1
  359. package/lib/components/tooltip-v2/src/arrow2.js +37 -23
  360. package/lib/components/tooltip-v2/src/arrow2.js.map +1 -1
  361. package/lib/components/tooltip-v2/src/tooltip.js +1 -1
  362. package/lib/components/tooltip-v2/src/tooltip2.js +2 -2
  363. package/lib/index.js +7 -7
  364. package/lib/version.d.ts +1 -1
  365. package/lib/version.js +1 -1
  366. package/lib/version.js.map +1 -1
  367. package/package.json +1 -1
  368. package/web-types.json +1 -1
@@ -1,106 +1,272 @@
1
+ import { defineComponent, getCurrentInstance, computed, ref, watch, nextTick, onMounted, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, withModifiers, createElementVNode, withKeys, createBlock, withCtx, resolveDynamicComponent, createCommentVNode, toDisplayString, createVNode } from 'vue';
2
+ import { isPromise } from '@vue/shared';
1
3
  import '../../../utils/index.mjs';
4
+ import { ElIcon } from '../../icon/index.mjs';
5
+ import '../../form/index.mjs';
6
+ import { Loading } from '@element-plus/icons-vue';
2
7
  import '../../../constants/index.mjs';
3
- import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
4
- import { isValidComponentSize } from '../../../utils/vue/validator.mjs';
5
- import { iconPropType } from '../../../utils/vue/icon.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, useFormItemInputId } from '../../form/src/hooks/use-form-item.mjs';
12
+ import { useFormSize, useFormDisabled } from '../../form/src/hooks/use-form-common-props.mjs';
13
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
14
+ import { useDeprecated } from '../../../hooks/use-deprecated/index.mjs';
15
+ import { addUnit } from '../../../utils/dom/style.mjs';
6
16
  import { UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT } from '../../../constants/event.mjs';
7
- import { isBoolean, isNumber } from '../../../utils/types.mjs';
8
- import { isString } from '@vue/shared';
17
+ import { debugWarn, throwError } from '../../../utils/error.mjs';
18
+ import { isBoolean } from '../../../utils/types.mjs';
9
19
 
10
- const switchProps = buildProps({
11
- modelValue: {
12
- type: [Boolean, String, Number],
13
- default: false
14
- },
15
- disabled: {
16
- type: Boolean,
17
- default: false
18
- },
19
- loading: {
20
- type: Boolean,
21
- default: false
22
- },
23
- size: {
24
- type: String,
25
- validator: isValidComponentSize
26
- },
27
- width: {
28
- type: [String, Number],
29
- default: ""
30
- },
31
- inlinePrompt: {
32
- type: Boolean,
33
- default: false
34
- },
35
- inactiveActionIcon: {
36
- type: iconPropType
37
- },
38
- activeActionIcon: {
39
- type: iconPropType
40
- },
41
- activeIcon: {
42
- type: iconPropType
43
- },
44
- inactiveIcon: {
45
- type: iconPropType
46
- },
47
- activeText: {
48
- type: String,
49
- default: ""
50
- },
51
- inactiveText: {
52
- type: String,
53
- default: ""
54
- },
55
- activeValue: {
56
- type: [Boolean, String, Number],
57
- default: true
58
- },
59
- inactiveValue: {
60
- type: [Boolean, String, Number],
61
- default: false
62
- },
63
- activeColor: {
64
- type: String,
65
- default: ""
66
- },
67
- inactiveColor: {
68
- type: String,
69
- default: ""
70
- },
71
- borderColor: {
72
- type: String,
73
- default: ""
74
- },
75
- name: {
76
- type: String,
77
- default: ""
78
- },
79
- validateEvent: {
80
- type: Boolean,
81
- default: true
82
- },
83
- beforeChange: {
84
- type: definePropType(Function)
85
- },
86
- id: String,
87
- tabindex: {
88
- type: [String, Number]
89
- },
90
- value: {
91
- type: [Boolean, String, Number],
92
- default: false
93
- },
94
- label: {
95
- type: String,
96
- default: void 0
20
+ const _hoisted_1 = ["onClick"];
21
+ const _hoisted_2 = ["id", "aria-checked", "aria-disabled", "aria-label", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"];
22
+ const _hoisted_3 = ["aria-hidden"];
23
+ const _hoisted_4 = ["aria-hidden"];
24
+ const _hoisted_5 = ["aria-hidden"];
25
+ const COMPONENT_NAME = "ElSwitch";
26
+ const __default__ = defineComponent({
27
+ name: COMPONENT_NAME
28
+ });
29
+ const _sfc_main = /* @__PURE__ */ defineComponent({
30
+ ...__default__,
31
+ props: switchProps,
32
+ emits: switchEmits,
33
+ setup(__props, { expose, emit }) {
34
+ const props = __props;
35
+ const vm = getCurrentInstance();
36
+ const { formItem } = useFormItem();
37
+ const switchSize = useFormSize();
38
+ const ns = useNamespace("switch");
39
+ const useBatchDeprecated = (list) => {
40
+ list.forEach((param) => {
41
+ useDeprecated({
42
+ from: param[0],
43
+ replacement: param[1],
44
+ scope: COMPONENT_NAME,
45
+ version: "2.3.0",
46
+ ref: "https://element-plus.org/en-US/component/switch.html#attributes",
47
+ type: "Attribute"
48
+ }, computed(() => {
49
+ var _a;
50
+ return !!((_a = vm.vnode.props) == null ? void 0 : _a[param[2]]);
51
+ }));
52
+ });
53
+ };
54
+ useBatchDeprecated([
55
+ ['"value"', '"model-value" or "v-model"', "value"],
56
+ ['"active-color"', "CSS var `--el-switch-on-color`", "activeColor"],
57
+ ['"inactive-color"', "CSS var `--el-switch-off-color`", "inactiveColor"],
58
+ ['"border-color"', "CSS var `--el-switch-border-color`", "borderColor"]
59
+ ]);
60
+ const { inputId } = useFormItemInputId(props, {
61
+ formItemContext: formItem
62
+ });
63
+ const switchDisabled = useFormDisabled(computed(() => props.loading));
64
+ const isControlled = ref(props.modelValue !== false);
65
+ const input = ref();
66
+ const core = ref();
67
+ const switchKls = computed(() => [
68
+ ns.b(),
69
+ ns.m(switchSize.value),
70
+ ns.is("disabled", switchDisabled.value),
71
+ ns.is("checked", checked.value)
72
+ ]);
73
+ const labelLeftKls = computed(() => [
74
+ ns.e("label"),
75
+ ns.em("label", "left"),
76
+ ns.is("active", !checked.value)
77
+ ]);
78
+ const labelRightKls = computed(() => [
79
+ ns.e("label"),
80
+ ns.em("label", "right"),
81
+ ns.is("active", checked.value)
82
+ ]);
83
+ const coreStyle = computed(() => ({
84
+ width: addUnit(props.width)
85
+ }));
86
+ watch(() => props.modelValue, () => {
87
+ isControlled.value = true;
88
+ });
89
+ watch(() => props.value, () => {
90
+ isControlled.value = false;
91
+ });
92
+ const actualValue = computed(() => {
93
+ return isControlled.value ? props.modelValue : props.value;
94
+ });
95
+ const checked = computed(() => actualValue.value === props.activeValue);
96
+ if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
97
+ emit(UPDATE_MODEL_EVENT, props.inactiveValue);
98
+ emit(CHANGE_EVENT, props.inactiveValue);
99
+ emit(INPUT_EVENT, props.inactiveValue);
100
+ }
101
+ watch(checked, (val) => {
102
+ var _a;
103
+ input.value.checked = val;
104
+ if (props.validateEvent) {
105
+ (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn(err));
106
+ }
107
+ });
108
+ const handleChange = () => {
109
+ const val = checked.value ? props.inactiveValue : props.activeValue;
110
+ emit(UPDATE_MODEL_EVENT, val);
111
+ emit(CHANGE_EVENT, val);
112
+ emit(INPUT_EVENT, val);
113
+ nextTick(() => {
114
+ input.value.checked = checked.value;
115
+ });
116
+ };
117
+ const switchValue = () => {
118
+ if (switchDisabled.value)
119
+ return;
120
+ const { beforeChange } = props;
121
+ if (!beforeChange) {
122
+ handleChange();
123
+ return;
124
+ }
125
+ const shouldChange = beforeChange();
126
+ const isPromiseOrBool = [
127
+ isPromise(shouldChange),
128
+ isBoolean(shouldChange)
129
+ ].includes(true);
130
+ if (!isPromiseOrBool) {
131
+ throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
132
+ }
133
+ if (isPromise(shouldChange)) {
134
+ shouldChange.then((result) => {
135
+ if (result) {
136
+ handleChange();
137
+ }
138
+ }).catch((e) => {
139
+ debugWarn(COMPONENT_NAME, `some error occurred: ${e}`);
140
+ });
141
+ } else if (shouldChange) {
142
+ handleChange();
143
+ }
144
+ };
145
+ const styles = computed(() => {
146
+ return ns.cssVarBlock({
147
+ ...props.activeColor ? { "on-color": props.activeColor } : null,
148
+ ...props.inactiveColor ? { "off-color": props.inactiveColor } : null,
149
+ ...props.borderColor ? { "border-color": props.borderColor } : null
150
+ });
151
+ });
152
+ const focus = () => {
153
+ var _a, _b;
154
+ (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
155
+ };
156
+ onMounted(() => {
157
+ input.value.checked = checked.value;
158
+ });
159
+ expose({
160
+ focus,
161
+ checked
162
+ });
163
+ return (_ctx, _cache) => {
164
+ return openBlock(), createElementBlock("div", {
165
+ class: normalizeClass(unref(switchKls)),
166
+ style: normalizeStyle(unref(styles)),
167
+ onClick: withModifiers(switchValue, ["prevent"])
168
+ }, [
169
+ createElementVNode("input", {
170
+ id: unref(inputId),
171
+ ref_key: "input",
172
+ ref: input,
173
+ class: normalizeClass(unref(ns).e("input")),
174
+ type: "checkbox",
175
+ role: "switch",
176
+ "aria-checked": unref(checked),
177
+ "aria-disabled": unref(switchDisabled),
178
+ "aria-label": _ctx.label,
179
+ name: _ctx.name,
180
+ "true-value": _ctx.activeValue,
181
+ "false-value": _ctx.inactiveValue,
182
+ disabled: unref(switchDisabled),
183
+ tabindex: _ctx.tabindex,
184
+ onChange: handleChange,
185
+ onKeydown: withKeys(switchValue, ["enter"])
186
+ }, null, 42, _hoisted_2),
187
+ !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
188
+ key: 0,
189
+ class: normalizeClass(unref(labelLeftKls))
190
+ }, [
191
+ _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
192
+ default: withCtx(() => [
193
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
194
+ ]),
195
+ _: 1
196
+ })) : createCommentVNode("v-if", true),
197
+ !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
198
+ key: 1,
199
+ "aria-hidden": unref(checked)
200
+ }, toDisplayString(_ctx.inactiveText), 9, _hoisted_3)) : createCommentVNode("v-if", true)
201
+ ], 2)) : createCommentVNode("v-if", true),
202
+ createElementVNode("span", {
203
+ ref_key: "core",
204
+ ref: core,
205
+ class: normalizeClass(unref(ns).e("core")),
206
+ style: normalizeStyle(unref(coreStyle))
207
+ }, [
208
+ _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
209
+ key: 0,
210
+ class: normalizeClass(unref(ns).e("inner"))
211
+ }, [
212
+ _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), {
213
+ key: 0,
214
+ class: normalizeClass(unref(ns).is("icon"))
215
+ }, {
216
+ default: withCtx(() => [
217
+ (openBlock(), createBlock(resolveDynamicComponent(unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
218
+ ]),
219
+ _: 1
220
+ }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
221
+ key: 1,
222
+ class: normalizeClass(unref(ns).is("text")),
223
+ "aria-hidden": !unref(checked)
224
+ }, toDisplayString(unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, _hoisted_4)) : createCommentVNode("v-if", true)
225
+ ], 2)) : createCommentVNode("v-if", true),
226
+ createElementVNode("div", {
227
+ class: normalizeClass(unref(ns).e("action"))
228
+ }, [
229
+ _ctx.loading ? (openBlock(), createBlock(unref(ElIcon), {
230
+ key: 0,
231
+ class: normalizeClass(unref(ns).is("loading"))
232
+ }, {
233
+ default: withCtx(() => [
234
+ createVNode(unref(Loading))
235
+ ]),
236
+ _: 1
237
+ }, 8, ["class"])) : _ctx.activeActionIcon && unref(checked) ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
238
+ default: withCtx(() => [
239
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeActionIcon)))
240
+ ]),
241
+ _: 1
242
+ })) : _ctx.inactiveActionIcon && !unref(checked) ? (openBlock(), createBlock(unref(ElIcon), { key: 2 }, {
243
+ default: withCtx(() => [
244
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveActionIcon)))
245
+ ]),
246
+ _: 1
247
+ })) : createCommentVNode("v-if", true)
248
+ ], 2)
249
+ ], 6),
250
+ !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
251
+ key: 1,
252
+ class: normalizeClass(unref(labelRightKls))
253
+ }, [
254
+ _ctx.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
255
+ default: withCtx(() => [
256
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
257
+ ]),
258
+ _: 1
259
+ })) : createCommentVNode("v-if", true),
260
+ !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
261
+ key: 1,
262
+ "aria-hidden": !unref(checked)
263
+ }, toDisplayString(_ctx.activeText), 9, _hoisted_5)) : createCommentVNode("v-if", true)
264
+ ], 2)) : createCommentVNode("v-if", true)
265
+ ], 14, _hoisted_1);
266
+ };
97
267
  }
98
268
  });
99
- const switchEmits = {
100
- [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
101
- [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
102
- [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
103
- };
269
+ var Switch = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/switch/src/switch.vue"]]);
104
270
 
105
- export { switchEmits, switchProps };
271
+ export { Switch as default };
106
272
  //# sourceMappingURL=switch2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch2.mjs","sources":["../../../../../../packages/components/switch/src/switch.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n iconPropType,\n isBoolean,\n isNumber,\n isString,\n isValidComponentSize,\n} from '@element-plus/utils'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type Switch from './switch.vue'\nimport type { ExtractPropTypes, PropType } from 'vue'\n\nexport const switchProps = buildProps({\n /**\n * @description binding value, it should be equivalent to either `active-value` or `inactive-value`, by default it's `boolean` type\n */\n modelValue: {\n type: [Boolean, String, Number],\n default: false,\n },\n /**\n * @description whether Switch is disabled\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * @description whether Switch is in loading state\n */\n loading: {\n type: Boolean,\n default: false,\n },\n /**\n * @description size of Switch\n */\n size: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n /**\n * @description width of Switch\n */\n width: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description whether icon or text is displayed inside dot, only the first character will be rendered for text\n */\n inlinePrompt: {\n type: Boolean,\n default: false,\n },\n /**\n * @description component of the icon displayed in action when in `off` state\n */\n inactiveActionIcon: {\n type: iconPropType,\n },\n /**\n * @description component of the icon displayed in action when in `on` state\n */\n activeActionIcon: {\n type: iconPropType,\n },\n /**\n * @description component of the icon displayed when in `on` state, overrides `active-text`\n */\n activeIcon: {\n type: iconPropType,\n },\n /**\n * @description component of the icon displayed when in `off` state, overrides `inactive-text`\n */\n inactiveIcon: {\n type: iconPropType,\n },\n /**\n * @description text displayed when in `on` state\n */\n activeText: {\n type: String,\n default: '',\n },\n /**\n * @description text displayed when in `off` state\n */\n inactiveText: {\n type: String,\n default: '',\n },\n /**\n * @description switch value when in `on` state\n */\n activeValue: {\n type: [Boolean, String, Number],\n default: true,\n },\n /**\n * @description switch value when in `off` state\n */\n inactiveValue: {\n type: [Boolean, String, Number],\n default: false,\n },\n /**\n * @deprecated background color when in `on` state ( deprecated, use CSS var `--el-switch-on-color` instead )\n */\n activeColor: {\n type: String,\n default: '',\n },\n /**\n * @deprecated background color when in `off` state ( deprecated, use CSS var `--el-switch-off-color` instead )\n */\n inactiveColor: {\n type: String,\n default: '',\n },\n /**\n * @deprecated border color of the switch ( deprecated, use CSS var `--el-switch-border-color` instead )\n */\n borderColor: {\n type: String,\n default: '',\n },\n /**\n * @description input name of Switch\n */\n name: {\n type: String,\n default: '',\n },\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n /**\n * @description before-change hook before the switch state changes. If `false` is returned or a `Promise` is returned and then is rejected, will stop switching\n */\n beforeChange: {\n type: definePropType<() => Promise<boolean> | boolean>(Function),\n },\n /**\n * @description id for input\n */\n id: String,\n /**\n * @description tabindex for input\n */\n tabindex: {\n type: [String, Number],\n },\n /**\n * @deprecated binding value ( deprecated, use `model-value / v-model` instead )\n */\n value: {\n type: [Boolean, String, Number],\n default: false,\n },\n /**\n * @description native input aria-label\n */\n label: {\n type: String,\n default: undefined,\n },\n} as const)\n\nexport type SwitchProps = ExtractPropTypes<typeof switchProps>\n\nexport const switchEmits = {\n [UPDATE_MODEL_EVENT]: (val: boolean | string | number) =>\n isBoolean(val) || isString(val) || isNumber(val),\n [CHANGE_EVENT]: (val: boolean | string | number) =>\n isBoolean(val) || isString(val) || isNumber(val),\n [INPUT_EVENT]: (val: boolean | string | number) =>\n isBoolean(val) || isString(val) || isNumber(val),\n}\nexport type SwitchEmits = typeof switchEmits\n\nexport type SwitchInstance = InstanceType<typeof Switch>\n"],"names":[],"mappings":";;;;;;;;;AAcY,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,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,SAAS,EAAE,oBAAoB;AACnC,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,kBAAkB,EAAE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GAAG;AACH,EAAE,EAAE,EAAE,MAAM;AACZ,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,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,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,WAAW,GAAG;AAC3B,EAAE,CAAC,kBAAkB,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC;AACjF,EAAE,CAAC,YAAY,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC;AAC3E,EAAE,CAAC,WAAW,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC;AAC1E;;;;"}
1
+ {"version":3,"file":"switch2.mjs","sources":["../../../../../../packages/components/switch/src/switch.vue"],"sourcesContent":["<template>\n <div :class=\"switchKls\" :style=\"styles\" @click.prevent=\"switchValue\">\n <input\n :id=\"inputId\"\n ref=\"input\"\n :class=\"ns.e('input')\"\n type=\"checkbox\"\n role=\"switch\"\n :aria-checked=\"checked\"\n :aria-disabled=\"switchDisabled\"\n :aria-label=\"label\"\n :name=\"name\"\n :true-value=\"activeValue\"\n :false-value=\"inactiveValue\"\n :disabled=\"switchDisabled\"\n :tabindex=\"tabindex\"\n @change=\"handleChange\"\n @keydown.enter=\"switchValue\"\n />\n <span\n v-if=\"!inlinePrompt && (inactiveIcon || inactiveText)\"\n :class=\"labelLeftKls\"\n >\n <el-icon v-if=\"inactiveIcon\">\n <component :is=\"inactiveIcon\" />\n </el-icon>\n <span v-if=\"!inactiveIcon && inactiveText\" :aria-hidden=\"checked\">{{\n inactiveText\n }}</span>\n </span>\n <span ref=\"core\" :class=\"ns.e('core')\" :style=\"coreStyle\">\n <div v-if=\"inlinePrompt\" :class=\"ns.e('inner')\">\n <template v-if=\"activeIcon || inactiveIcon\">\n <el-icon :class=\"ns.is('icon')\">\n <component :is=\"checked ? activeIcon : inactiveIcon\" />\n </el-icon>\n </template>\n <template v-else-if=\"activeText || inactiveText\">\n <span :class=\"ns.is('text')\" :aria-hidden=\"!checked\">\n {{ checked ? activeText : inactiveText }}\n </span>\n </template>\n </div>\n <div :class=\"ns.e('action')\">\n <el-icon v-if=\"loading\" :class=\"ns.is('loading')\">\n <loading />\n </el-icon>\n <el-icon v-else-if=\"activeActionIcon && checked\">\n <component :is=\"activeActionIcon\" />\n </el-icon>\n <el-icon v-else-if=\"inactiveActionIcon && !checked\">\n <component :is=\"inactiveActionIcon\" />\n </el-icon>\n </div>\n </span>\n <span\n v-if=\"!inlinePrompt && (activeIcon || activeText)\"\n :class=\"labelRightKls\"\n >\n <el-icon v-if=\"activeIcon\">\n <component :is=\"activeIcon\" />\n </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\" setup>\nimport {\n computed,\n getCurrentInstance,\n nextTick,\n onMounted,\n ref,\n watch,\n} from 'vue'\nimport { isPromise } from '@vue/shared'\nimport { addUnit, debugWarn, isBoolean, throwError } from '@element-plus/utils'\nimport ElIcon from '@element-plus/components/icon'\nimport {\n useFormDisabled,\n useFormItem,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport { Loading } from '@element-plus/icons-vue'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { useDeprecated, useNamespace } from '@element-plus/hooks'\nimport { switchEmits, switchProps } from './switch'\nimport type { CSSProperties } from 'vue'\n\nconst COMPONENT_NAME = 'ElSwitch'\ndefineOptions({\n name: COMPONENT_NAME,\n})\n\nconst props = defineProps(switchProps)\nconst emit = defineEmits(switchEmits)\n\nconst vm = getCurrentInstance()!\nconst { formItem } = useFormItem()\nconst switchSize = useFormSize()\nconst ns = useNamespace('switch')\n\nconst useBatchDeprecated = (list: string[][]) => {\n list.forEach((param) => {\n useDeprecated(\n {\n from: param[0],\n replacement: param[1],\n scope: COMPONENT_NAME,\n version: '2.3.0',\n ref: 'https://element-plus.org/en-US/component/switch.html#attributes',\n type: 'Attribute',\n },\n computed(() => !!vm.vnode.props?.[param[2]])\n )\n })\n}\nuseBatchDeprecated([\n ['\"value\"', '\"model-value\" or \"v-model\"', 'value'],\n ['\"active-color\"', 'CSS var `--el-switch-on-color`', 'activeColor'],\n ['\"inactive-color\"', 'CSS var `--el-switch-off-color`', 'inactiveColor'],\n ['\"border-color\"', 'CSS var `--el-switch-border-color`', 'borderColor'],\n])\n\nconst { inputId } = useFormItemInputId(props, {\n formItemContext: formItem,\n})\n\nconst switchDisabled = useFormDisabled(computed(() => props.loading))\nconst isControlled = ref(props.modelValue !== false)\nconst input = ref<HTMLInputElement>()\nconst core = ref<HTMLSpanElement>()\n\nconst switchKls = computed(() => [\n ns.b(),\n ns.m(switchSize.value),\n ns.is('disabled', switchDisabled.value),\n ns.is('checked', checked.value),\n])\n\nconst labelLeftKls = computed(() => [\n ns.e('label'),\n ns.em('label', 'left'),\n ns.is('active', !checked.value),\n])\n\nconst labelRightKls = computed(() => [\n ns.e('label'),\n ns.em('label', 'right'),\n ns.is('active', checked.value),\n])\n\nconst coreStyle = computed<CSSProperties>(() => ({\n width: addUnit(props.width),\n}))\n\nwatch(\n () => props.modelValue,\n () => {\n isControlled.value = true\n }\n)\n\nwatch(\n () => props.value,\n () => {\n isControlled.value = false\n }\n)\n\nconst actualValue = computed(() => {\n return isControlled.value ? props.modelValue : props.value\n})\n\nconst checked = computed(() => actualValue.value === props.activeValue)\n\nif (![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\nwatch(checked, (val) => {\n input.value!.checked = val\n\n if (props.validateEvent) {\n formItem?.validate?.('change').catch((err) => debugWarn(err))\n }\n})\n\nconst handleChange = () => {\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\nconst switchValue = () => {\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 isPromiseOrBool = [\n isPromise(shouldChange),\n isBoolean(shouldChange),\n ].includes(true)\n if (!isPromiseOrBool) {\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\nconst styles = computed(() => {\n return ns.cssVarBlock({\n ...(props.activeColor ? { 'on-color': props.activeColor } : null),\n ...(props.inactiveColor ? { 'off-color': props.inactiveColor } : null),\n ...(props.borderColor ? { 'border-color': props.borderColor } : null),\n })\n})\n\nconst focus = (): void => {\n input.value?.focus?.()\n}\n\nonMounted(() => {\n input.value!.checked = checked.value\n})\n\ndefineExpose({\n /**\n * @description manual focus to the switch component\n **/\n focus,\n /**\n * @description whether Switch is checked\n */\n checked,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;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AAA,CAAA,CAAA,CAAA,CAAA;AAAA,SACF,CAAA,CAAA;AAEA,OAAM,MAAA,IAAA,YAAwB,EAAA;AAC5B,QAAA,YAAsB,EAAA,CAAA;AAAA,OAAA;AACwC,KAAA,CAAA;AACK,IAAA,YACvD,GAAA,QAAA,CAAA,MAAgC;AAAsB,MAClE,OAAC,EAAA,CAAA,WAAA,CAAA;AAAA,QACF,GAAA,KAAA,CAAA,WAAA,GAAA,EAAA,UAAA,EAAA,KAAA,CAAA,WAAA,EAAA,GAAA,IAAA;AAED,QAAA,sBAA0B,GAAA,EAAA,WAAA,EAAA,KAAA,CAAA,aAAA,EAAA,GAAA,IAAA;AACxB,QAAA,GAAA,iBAAqB,GAAA,EAAA,cAAA,EAAA,KAAA,CAAA,WAAA,EAAA,GAAA,IAAA;AAAA,OACvB,CAAA,CAAA;AAEA,KAAA,CAAA,CAAA;AACE,IAAM,MAAA,KAAA,GAAO;AAAkB,MAChC,IAAA,EAAA,EAAA,EAAA,CAAA;AAED,MAAa,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,KAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AAAA,KAIX,CAAA;AAAA,IAIA,SAAA,CAAA,MAAA;AAAA,MACD,KAAA,CAAA,KAAA,CAAA,OAAA,GAAA,OAAA,CAAA,KAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,7 +2,7 @@ import '../../utils/index.mjs';
2
2
  import Tooltip from './src/tooltip2.mjs';
3
3
  export { tooltipEmits, useTooltipModelToggle, useTooltipModelToggleEmits, useTooltipModelToggleProps, useTooltipProps } from './src/tooltip.mjs';
4
4
  export { useTooltipTriggerProps } from './src/trigger.mjs';
5
- export { useTooltipContentProps } from './src/content.mjs';
5
+ export { useTooltipContentProps } from './src/content2.mjs';
6
6
  export { TOOLTIP_INJECTION_KEY } from './src/constants.mjs';
7
7
  import { withInstall } from '../../utils/vue/install.mjs';
8
8
 
@@ -1,37 +1,183 @@
1
+ import { defineComponent, ref, inject, computed, onBeforeUnmount, unref, watch, openBlock, createBlock, Teleport, createVNode, Transition, withCtx, withDirectives, mergeProps, renderSlot, createCommentVNode, vShow } from 'vue';
2
+ import { onClickOutside } from '@vueuse/core';
3
+ import '../../../hooks/index.mjs';
1
4
  import '../../../utils/index.mjs';
2
5
  import '../../popper/index.mjs';
3
- import '../../../hooks/index.mjs';
4
- import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
5
- import { useDelayedToggleProps } from '../../../hooks/use-delayed-toggle/index.mjs';
6
- import { popperContentProps } from '../../popper/src/content.mjs';
6
+ import { TOOLTIP_INJECTION_KEY } from './constants.mjs';
7
+ import { useTooltipContentProps } from './content2.mjs';
8
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
9
+ import { usePopperContainerId } from '../../../hooks/use-popper-container/index.mjs';
10
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
11
+ import { composeEventHandlers } from '../../../utils/dom/event.mjs';
12
+ import ElPopperContent from '../../popper/src/content2.mjs';
7
13
 
8
- const useTooltipContentProps = buildProps({
9
- ...useDelayedToggleProps,
10
- ...popperContentProps,
11
- appendTo: {
12
- type: definePropType([String, Object])
13
- },
14
- content: {
15
- type: String,
16
- default: ""
17
- },
18
- rawContent: {
19
- type: Boolean,
20
- default: false
21
- },
22
- persistent: Boolean,
23
- ariaLabel: String,
24
- visible: {
25
- type: definePropType(Boolean),
26
- default: null
27
- },
28
- transition: String,
29
- teleported: {
30
- type: Boolean,
31
- default: true
32
- },
33
- disabled: Boolean
14
+ const __default__ = defineComponent({
15
+ name: "ElTooltipContent",
16
+ inheritAttrs: false
17
+ });
18
+ const _sfc_main = /* @__PURE__ */ defineComponent({
19
+ ...__default__,
20
+ props: useTooltipContentProps,
21
+ setup(__props, { expose }) {
22
+ const props = __props;
23
+ const { selector } = usePopperContainerId();
24
+ const ns = useNamespace("tooltip");
25
+ const contentRef = ref(null);
26
+ const destroyed = ref(false);
27
+ const {
28
+ controlled,
29
+ id,
30
+ open,
31
+ trigger,
32
+ onClose,
33
+ onOpen,
34
+ onShow,
35
+ onHide,
36
+ onBeforeShow,
37
+ onBeforeHide
38
+ } = inject(TOOLTIP_INJECTION_KEY, void 0);
39
+ const transitionClass = computed(() => {
40
+ return props.transition || `${ns.namespace.value}-fade-in-linear`;
41
+ });
42
+ const persistentRef = computed(() => {
43
+ if (process.env.NODE_ENV === "test") {
44
+ return true;
45
+ }
46
+ return props.persistent;
47
+ });
48
+ onBeforeUnmount(() => {
49
+ destroyed.value = true;
50
+ });
51
+ const shouldRender = computed(() => {
52
+ return unref(persistentRef) ? true : unref(open);
53
+ });
54
+ const shouldShow = computed(() => {
55
+ return props.disabled ? false : unref(open);
56
+ });
57
+ const appendTo = computed(() => {
58
+ return props.appendTo || selector.value;
59
+ });
60
+ const contentStyle = computed(() => {
61
+ var _a;
62
+ return (_a = props.style) != null ? _a : {};
63
+ });
64
+ const ariaHidden = computed(() => !unref(open));
65
+ const onTransitionLeave = () => {
66
+ onHide();
67
+ };
68
+ const stopWhenControlled = () => {
69
+ if (unref(controlled))
70
+ return true;
71
+ };
72
+ const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
73
+ if (props.enterable && unref(trigger) === "hover") {
74
+ onOpen();
75
+ }
76
+ });
77
+ const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
78
+ if (unref(trigger) === "hover") {
79
+ onClose();
80
+ }
81
+ });
82
+ const onBeforeEnter = () => {
83
+ var _a, _b;
84
+ (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
85
+ onBeforeShow == null ? void 0 : onBeforeShow();
86
+ };
87
+ const onBeforeLeave = () => {
88
+ onBeforeHide == null ? void 0 : onBeforeHide();
89
+ };
90
+ const onAfterShow = () => {
91
+ onShow();
92
+ stopHandle = onClickOutside(computed(() => {
93
+ var _a;
94
+ return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
95
+ }), () => {
96
+ if (unref(controlled))
97
+ return;
98
+ const $trigger = unref(trigger);
99
+ if ($trigger !== "hover") {
100
+ onClose();
101
+ }
102
+ });
103
+ };
104
+ const onBlur = () => {
105
+ if (!props.virtualTriggering) {
106
+ onClose();
107
+ }
108
+ };
109
+ let stopHandle;
110
+ watch(() => unref(open), (val) => {
111
+ if (!val) {
112
+ stopHandle == null ? void 0 : stopHandle();
113
+ }
114
+ }, {
115
+ flush: "post"
116
+ });
117
+ watch(() => props.content, () => {
118
+ var _a, _b;
119
+ (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
120
+ });
121
+ expose({
122
+ contentRef
123
+ });
124
+ return (_ctx, _cache) => {
125
+ return openBlock(), createBlock(Teleport, {
126
+ disabled: !_ctx.teleported,
127
+ to: unref(appendTo)
128
+ }, [
129
+ createVNode(Transition, {
130
+ name: unref(transitionClass),
131
+ onAfterLeave: onTransitionLeave,
132
+ onBeforeEnter,
133
+ onAfterEnter: onAfterShow,
134
+ onBeforeLeave
135
+ }, {
136
+ default: withCtx(() => [
137
+ unref(shouldRender) ? withDirectives((openBlock(), createBlock(unref(ElPopperContent), mergeProps({
138
+ key: 0,
139
+ id: unref(id),
140
+ ref_key: "contentRef",
141
+ ref: contentRef
142
+ }, _ctx.$attrs, {
143
+ "aria-label": _ctx.ariaLabel,
144
+ "aria-hidden": unref(ariaHidden),
145
+ "boundaries-padding": _ctx.boundariesPadding,
146
+ "fallback-placements": _ctx.fallbackPlacements,
147
+ "gpu-acceleration": _ctx.gpuAcceleration,
148
+ offset: _ctx.offset,
149
+ placement: _ctx.placement,
150
+ "popper-options": _ctx.popperOptions,
151
+ strategy: _ctx.strategy,
152
+ effect: _ctx.effect,
153
+ enterable: _ctx.enterable,
154
+ pure: _ctx.pure,
155
+ "popper-class": _ctx.popperClass,
156
+ "popper-style": [_ctx.popperStyle, unref(contentStyle)],
157
+ "reference-el": _ctx.referenceEl,
158
+ "trigger-target-el": _ctx.triggerTargetEl,
159
+ visible: unref(shouldShow),
160
+ "z-index": _ctx.zIndex,
161
+ onMouseenter: unref(onContentEnter),
162
+ onMouseleave: unref(onContentLeave),
163
+ onBlur,
164
+ onClose: unref(onClose)
165
+ }), {
166
+ default: withCtx(() => [
167
+ !destroyed.value ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
168
+ ]),
169
+ _: 3
170
+ }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
171
+ [vShow, unref(shouldShow)]
172
+ ]) : createCommentVNode("v-if", true)
173
+ ]),
174
+ _: 3
175
+ }, 8, ["name"])
176
+ ], 8, ["disabled", "to"]);
177
+ };
178
+ }
34
179
  });
180
+ var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
35
181
 
36
- export { useTooltipContentProps };
182
+ export { ElTooltipContent as default };
37
183
  //# sourceMappingURL=content.mjs.map