@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
@@ -2,110 +2,275 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var vue = require('vue');
6
+ var shared = require('@vue/shared');
5
7
  require('../../../utils/index.js');
8
+ var index$2 = require('../../icon/index.js');
9
+ require('../../form/index.js');
10
+ var iconsVue = require('@element-plus/icons-vue');
6
11
  require('../../../constants/index.js');
7
- var runtime = require('../../../utils/vue/props/runtime.js');
8
- var validator = require('../../../utils/vue/validator.js');
9
- var icon = require('../../../utils/vue/icon.js');
12
+ require('../../../hooks/index.js');
13
+ var _switch = require('./switch.js');
14
+ var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
15
+ var useFormItem = require('../../form/src/hooks/use-form-item.js');
16
+ var useFormCommonProps = require('../../form/src/hooks/use-form-common-props.js');
17
+ var index = require('../../../hooks/use-namespace/index.js');
18
+ var index$1 = require('../../../hooks/use-deprecated/index.js');
19
+ var style = require('../../../utils/dom/style.js');
10
20
  var event = require('../../../constants/event.js');
21
+ var error = require('../../../utils/error.js');
11
22
  var types = require('../../../utils/types.js');
12
- var shared = require('@vue/shared');
13
23
 
14
- const switchProps = runtime.buildProps({
15
- modelValue: {
16
- type: [Boolean, String, Number],
17
- default: false
18
- },
19
- disabled: {
20
- type: Boolean,
21
- default: false
22
- },
23
- loading: {
24
- type: Boolean,
25
- default: false
26
- },
27
- size: {
28
- type: String,
29
- validator: validator.isValidComponentSize
30
- },
31
- width: {
32
- type: [String, Number],
33
- default: ""
34
- },
35
- inlinePrompt: {
36
- type: Boolean,
37
- default: false
38
- },
39
- inactiveActionIcon: {
40
- type: icon.iconPropType
41
- },
42
- activeActionIcon: {
43
- type: icon.iconPropType
44
- },
45
- activeIcon: {
46
- type: icon.iconPropType
47
- },
48
- inactiveIcon: {
49
- type: icon.iconPropType
50
- },
51
- activeText: {
52
- type: String,
53
- default: ""
54
- },
55
- inactiveText: {
56
- type: String,
57
- default: ""
58
- },
59
- activeValue: {
60
- type: [Boolean, String, Number],
61
- default: true
62
- },
63
- inactiveValue: {
64
- type: [Boolean, String, Number],
65
- default: false
66
- },
67
- activeColor: {
68
- type: String,
69
- default: ""
70
- },
71
- inactiveColor: {
72
- type: String,
73
- default: ""
74
- },
75
- borderColor: {
76
- type: String,
77
- default: ""
78
- },
79
- name: {
80
- type: String,
81
- default: ""
82
- },
83
- validateEvent: {
84
- type: Boolean,
85
- default: true
86
- },
87
- beforeChange: {
88
- type: runtime.definePropType(Function)
89
- },
90
- id: String,
91
- tabindex: {
92
- type: [String, Number]
93
- },
94
- value: {
95
- type: [Boolean, String, Number],
96
- default: false
97
- },
98
- label: {
99
- type: String,
100
- default: void 0
24
+ const _hoisted_1 = ["onClick"];
25
+ const _hoisted_2 = ["id", "aria-checked", "aria-disabled", "aria-label", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"];
26
+ const _hoisted_3 = ["aria-hidden"];
27
+ const _hoisted_4 = ["aria-hidden"];
28
+ const _hoisted_5 = ["aria-hidden"];
29
+ const COMPONENT_NAME = "ElSwitch";
30
+ const __default__ = vue.defineComponent({
31
+ name: COMPONENT_NAME
32
+ });
33
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
34
+ ...__default__,
35
+ props: _switch.switchProps,
36
+ emits: _switch.switchEmits,
37
+ setup(__props, { expose, emit }) {
38
+ const props = __props;
39
+ const vm = vue.getCurrentInstance();
40
+ const { formItem } = useFormItem.useFormItem();
41
+ const switchSize = useFormCommonProps.useFormSize();
42
+ const ns = index.useNamespace("switch");
43
+ const useBatchDeprecated = (list) => {
44
+ list.forEach((param) => {
45
+ index$1.useDeprecated({
46
+ from: param[0],
47
+ replacement: param[1],
48
+ scope: COMPONENT_NAME,
49
+ version: "2.3.0",
50
+ ref: "https://element-plus.org/en-US/component/switch.html#attributes",
51
+ type: "Attribute"
52
+ }, vue.computed(() => {
53
+ var _a;
54
+ return !!((_a = vm.vnode.props) == null ? void 0 : _a[param[2]]);
55
+ }));
56
+ });
57
+ };
58
+ useBatchDeprecated([
59
+ ['"value"', '"model-value" or "v-model"', "value"],
60
+ ['"active-color"', "CSS var `--el-switch-on-color`", "activeColor"],
61
+ ['"inactive-color"', "CSS var `--el-switch-off-color`", "inactiveColor"],
62
+ ['"border-color"', "CSS var `--el-switch-border-color`", "borderColor"]
63
+ ]);
64
+ const { inputId } = useFormItem.useFormItemInputId(props, {
65
+ formItemContext: formItem
66
+ });
67
+ const switchDisabled = useFormCommonProps.useFormDisabled(vue.computed(() => props.loading));
68
+ const isControlled = vue.ref(props.modelValue !== false);
69
+ const input = vue.ref();
70
+ const core = vue.ref();
71
+ const switchKls = vue.computed(() => [
72
+ ns.b(),
73
+ ns.m(switchSize.value),
74
+ ns.is("disabled", switchDisabled.value),
75
+ ns.is("checked", checked.value)
76
+ ]);
77
+ const labelLeftKls = vue.computed(() => [
78
+ ns.e("label"),
79
+ ns.em("label", "left"),
80
+ ns.is("active", !checked.value)
81
+ ]);
82
+ const labelRightKls = vue.computed(() => [
83
+ ns.e("label"),
84
+ ns.em("label", "right"),
85
+ ns.is("active", checked.value)
86
+ ]);
87
+ const coreStyle = vue.computed(() => ({
88
+ width: style.addUnit(props.width)
89
+ }));
90
+ vue.watch(() => props.modelValue, () => {
91
+ isControlled.value = true;
92
+ });
93
+ vue.watch(() => props.value, () => {
94
+ isControlled.value = false;
95
+ });
96
+ const actualValue = vue.computed(() => {
97
+ return isControlled.value ? props.modelValue : props.value;
98
+ });
99
+ const checked = vue.computed(() => actualValue.value === props.activeValue);
100
+ if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
101
+ emit(event.UPDATE_MODEL_EVENT, props.inactiveValue);
102
+ emit(event.CHANGE_EVENT, props.inactiveValue);
103
+ emit(event.INPUT_EVENT, props.inactiveValue);
104
+ }
105
+ vue.watch(checked, (val) => {
106
+ var _a;
107
+ input.value.checked = val;
108
+ if (props.validateEvent) {
109
+ (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => error.debugWarn(err));
110
+ }
111
+ });
112
+ const handleChange = () => {
113
+ const val = checked.value ? props.inactiveValue : props.activeValue;
114
+ emit(event.UPDATE_MODEL_EVENT, val);
115
+ emit(event.CHANGE_EVENT, val);
116
+ emit(event.INPUT_EVENT, val);
117
+ vue.nextTick(() => {
118
+ input.value.checked = checked.value;
119
+ });
120
+ };
121
+ const switchValue = () => {
122
+ if (switchDisabled.value)
123
+ return;
124
+ const { beforeChange } = props;
125
+ if (!beforeChange) {
126
+ handleChange();
127
+ return;
128
+ }
129
+ const shouldChange = beforeChange();
130
+ const isPromiseOrBool = [
131
+ shared.isPromise(shouldChange),
132
+ types.isBoolean(shouldChange)
133
+ ].includes(true);
134
+ if (!isPromiseOrBool) {
135
+ error.throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
136
+ }
137
+ if (shared.isPromise(shouldChange)) {
138
+ shouldChange.then((result) => {
139
+ if (result) {
140
+ handleChange();
141
+ }
142
+ }).catch((e) => {
143
+ error.debugWarn(COMPONENT_NAME, `some error occurred: ${e}`);
144
+ });
145
+ } else if (shouldChange) {
146
+ handleChange();
147
+ }
148
+ };
149
+ const styles = vue.computed(() => {
150
+ return ns.cssVarBlock({
151
+ ...props.activeColor ? { "on-color": props.activeColor } : null,
152
+ ...props.inactiveColor ? { "off-color": props.inactiveColor } : null,
153
+ ...props.borderColor ? { "border-color": props.borderColor } : null
154
+ });
155
+ });
156
+ const focus = () => {
157
+ var _a, _b;
158
+ (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
159
+ };
160
+ vue.onMounted(() => {
161
+ input.value.checked = checked.value;
162
+ });
163
+ expose({
164
+ focus,
165
+ checked
166
+ });
167
+ return (_ctx, _cache) => {
168
+ return vue.openBlock(), vue.createElementBlock("div", {
169
+ class: vue.normalizeClass(vue.unref(switchKls)),
170
+ style: vue.normalizeStyle(vue.unref(styles)),
171
+ onClick: vue.withModifiers(switchValue, ["prevent"])
172
+ }, [
173
+ vue.createElementVNode("input", {
174
+ id: vue.unref(inputId),
175
+ ref_key: "input",
176
+ ref: input,
177
+ class: vue.normalizeClass(vue.unref(ns).e("input")),
178
+ type: "checkbox",
179
+ role: "switch",
180
+ "aria-checked": vue.unref(checked),
181
+ "aria-disabled": vue.unref(switchDisabled),
182
+ "aria-label": _ctx.label,
183
+ name: _ctx.name,
184
+ "true-value": _ctx.activeValue,
185
+ "false-value": _ctx.inactiveValue,
186
+ disabled: vue.unref(switchDisabled),
187
+ tabindex: _ctx.tabindex,
188
+ onChange: handleChange,
189
+ onKeydown: vue.withKeys(switchValue, ["enter"])
190
+ }, null, 42, _hoisted_2),
191
+ !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (vue.openBlock(), vue.createElementBlock("span", {
192
+ key: 0,
193
+ class: vue.normalizeClass(vue.unref(labelLeftKls))
194
+ }, [
195
+ _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.ElIcon), { key: 0 }, {
196
+ default: vue.withCtx(() => [
197
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveIcon)))
198
+ ]),
199
+ _: 1
200
+ })) : vue.createCommentVNode("v-if", true),
201
+ !_ctx.inactiveIcon && _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
202
+ key: 1,
203
+ "aria-hidden": vue.unref(checked)
204
+ }, vue.toDisplayString(_ctx.inactiveText), 9, _hoisted_3)) : vue.createCommentVNode("v-if", true)
205
+ ], 2)) : vue.createCommentVNode("v-if", true),
206
+ vue.createElementVNode("span", {
207
+ ref_key: "core",
208
+ ref: core,
209
+ class: vue.normalizeClass(vue.unref(ns).e("core")),
210
+ style: vue.normalizeStyle(vue.unref(coreStyle))
211
+ }, [
212
+ _ctx.inlinePrompt ? (vue.openBlock(), vue.createElementBlock("div", {
213
+ key: 0,
214
+ class: vue.normalizeClass(vue.unref(ns).e("inner"))
215
+ }, [
216
+ _ctx.activeIcon || _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.ElIcon), {
217
+ key: 0,
218
+ class: vue.normalizeClass(vue.unref(ns).is("icon"))
219
+ }, {
220
+ default: vue.withCtx(() => [
221
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
222
+ ]),
223
+ _: 1
224
+ }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
225
+ key: 1,
226
+ class: vue.normalizeClass(vue.unref(ns).is("text")),
227
+ "aria-hidden": !vue.unref(checked)
228
+ }, vue.toDisplayString(vue.unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, _hoisted_4)) : vue.createCommentVNode("v-if", true)
229
+ ], 2)) : vue.createCommentVNode("v-if", true),
230
+ vue.createElementVNode("div", {
231
+ class: vue.normalizeClass(vue.unref(ns).e("action"))
232
+ }, [
233
+ _ctx.loading ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.ElIcon), {
234
+ key: 0,
235
+ class: vue.normalizeClass(vue.unref(ns).is("loading"))
236
+ }, {
237
+ default: vue.withCtx(() => [
238
+ vue.createVNode(vue.unref(iconsVue.Loading))
239
+ ]),
240
+ _: 1
241
+ }, 8, ["class"])) : _ctx.activeActionIcon && vue.unref(checked) ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.ElIcon), { key: 1 }, {
242
+ default: vue.withCtx(() => [
243
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeActionIcon)))
244
+ ]),
245
+ _: 1
246
+ })) : _ctx.inactiveActionIcon && !vue.unref(checked) ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.ElIcon), { key: 2 }, {
247
+ default: vue.withCtx(() => [
248
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveActionIcon)))
249
+ ]),
250
+ _: 1
251
+ })) : vue.createCommentVNode("v-if", true)
252
+ ], 2)
253
+ ], 6),
254
+ !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (vue.openBlock(), vue.createElementBlock("span", {
255
+ key: 1,
256
+ class: vue.normalizeClass(vue.unref(labelRightKls))
257
+ }, [
258
+ _ctx.activeIcon ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.ElIcon), { key: 0 }, {
259
+ default: vue.withCtx(() => [
260
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeIcon)))
261
+ ]),
262
+ _: 1
263
+ })) : vue.createCommentVNode("v-if", true),
264
+ !_ctx.activeIcon && _ctx.activeText ? (vue.openBlock(), vue.createElementBlock("span", {
265
+ key: 1,
266
+ "aria-hidden": !vue.unref(checked)
267
+ }, vue.toDisplayString(_ctx.activeText), 9, _hoisted_5)) : vue.createCommentVNode("v-if", true)
268
+ ], 2)) : vue.createCommentVNode("v-if", true)
269
+ ], 14, _hoisted_1);
270
+ };
101
271
  }
102
272
  });
103
- const switchEmits = {
104
- [event.UPDATE_MODEL_EVENT]: (val) => types.isBoolean(val) || shared.isString(val) || types.isNumber(val),
105
- [event.CHANGE_EVENT]: (val) => types.isBoolean(val) || shared.isString(val) || types.isNumber(val),
106
- [event.INPUT_EVENT]: (val) => types.isBoolean(val) || shared.isString(val) || types.isNumber(val)
107
- };
273
+ var Switch = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/switch/src/switch.vue"]]);
108
274
 
109
- exports.switchEmits = switchEmits;
110
- exports.switchProps = switchProps;
275
+ exports["default"] = Switch;
111
276
  //# sourceMappingURL=switch2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch2.js","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":["buildProps","isValidComponentSize","iconPropType","definePropType","UPDATE_MODEL_EVENT","isBoolean","isString","isNumber","CHANGE_EVENT","INPUT_EVENT"],"mappings":";;;;;;;;;;;;;AAcY,MAAC,WAAW,GAAGA,kBAAU,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,OAA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G,CAAC,IAAIC,eAAQ,CAAC,GAAG,CAAC,IAAIC,cAAQ,CAAC,GAAG,CAAC;AAC1E;;;;;"}
1
+ {"version":3,"file":"switch2.js","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":["getCurrentInstance","useFormItem","useFormSize","useNamespace","useDeprecated","computed","useFormDisabled","ref","addUnit","watch","UPDATE_MODEL_EVENT","CHANGE_EVENT","INPUT_EVENT","debugWarn","nextTick","isPromise","isBoolean","throwError","onMounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAkGc,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR;;;;;;;AAKA,IAAA,MAAM,KAAKA,sBAAmB,EAAA,CAAA;AAC9B,IAAM,MAAA,EAAE,aAAaC,uBAAY,EAAA,CAAA;AACjC,IAAA,MAAM,aAAaC,8BAAY,EAAA,CAAA;AAC/B,IAAM,MAAA,EAAA,GAAKC,mBAAa,QAAQ,CAAA,CAAA;AAEhC,IAAM,MAAA,kBAAA,GAAqB,CAAC,IAAqB,KAAA;AAC/C,MAAK,IAAA,CAAA,OAAA,CAAQ,CAAC,KAAU,KAAA;AACtB,QACEC,qBAAA,CAAA;AAAA,UACE,MAAM,KAAM,CAAA,CAAA,CAAA;AAAA,UACZ,aAAa,KAAM,CAAA,CAAA,CAAA;AAAA,UACnB,KAAO,EAAA,cAAA;AAAA,UACP,OAAS,EAAA,OAAA;AAAA,UACT,GAAK,EAAA,iEAAA;AAAA,UACL,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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,IAIAa,aAAA,CAAA,MAAA;AAAA,MACD,KAAA,CAAA,KAAA,CAAA,OAAA,GAAA,OAAA,CAAA,KAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -6,7 +6,7 @@ require('../../utils/index.js');
6
6
  var tooltip$1 = require('./src/tooltip2.js');
7
7
  var tooltip = require('./src/tooltip.js');
8
8
  var trigger = require('./src/trigger.js');
9
- var content = require('./src/content.js');
9
+ var content = require('./src/content2.js');
10
10
  var constants = require('./src/constants.js');
11
11
  var install = require('../../utils/vue/install.js');
12
12
 
@@ -2,40 +2,186 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var vue = require('vue');
6
+ var core = require('@vueuse/core');
7
+ require('../../../hooks/index.js');
5
8
  require('../../../utils/index.js');
6
9
  require('../../popper/index.js');
7
- require('../../../hooks/index.js');
8
- var runtime = require('../../../utils/vue/props/runtime.js');
9
- var index = require('../../../hooks/use-delayed-toggle/index.js');
10
- var content = require('../../popper/src/content.js');
10
+ var constants = require('./constants.js');
11
+ var content = require('./content2.js');
12
+ var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
13
+ var index = require('../../../hooks/use-popper-container/index.js');
14
+ var index$1 = require('../../../hooks/use-namespace/index.js');
15
+ var event = require('../../../utils/dom/event.js');
16
+ var content$1 = require('../../popper/src/content2.js');
11
17
 
12
- const useTooltipContentProps = runtime.buildProps({
13
- ...index.useDelayedToggleProps,
14
- ...content.popperContentProps,
15
- appendTo: {
16
- type: runtime.definePropType([String, Object])
17
- },
18
- content: {
19
- type: String,
20
- default: ""
21
- },
22
- rawContent: {
23
- type: Boolean,
24
- default: false
25
- },
26
- persistent: Boolean,
27
- ariaLabel: String,
28
- visible: {
29
- type: runtime.definePropType(Boolean),
30
- default: null
31
- },
32
- transition: String,
33
- teleported: {
34
- type: Boolean,
35
- default: true
36
- },
37
- disabled: Boolean
18
+ const __default__ = vue.defineComponent({
19
+ name: "ElTooltipContent",
20
+ inheritAttrs: false
21
+ });
22
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
23
+ ...__default__,
24
+ props: content.useTooltipContentProps,
25
+ setup(__props, { expose }) {
26
+ const props = __props;
27
+ const { selector } = index.usePopperContainerId();
28
+ const ns = index$1.useNamespace("tooltip");
29
+ const contentRef = vue.ref(null);
30
+ const destroyed = vue.ref(false);
31
+ const {
32
+ controlled,
33
+ id,
34
+ open,
35
+ trigger,
36
+ onClose,
37
+ onOpen,
38
+ onShow,
39
+ onHide,
40
+ onBeforeShow,
41
+ onBeforeHide
42
+ } = vue.inject(constants.TOOLTIP_INJECTION_KEY, void 0);
43
+ const transitionClass = vue.computed(() => {
44
+ return props.transition || `${ns.namespace.value}-fade-in-linear`;
45
+ });
46
+ const persistentRef = vue.computed(() => {
47
+ if (process.env.NODE_ENV === "test") {
48
+ return true;
49
+ }
50
+ return props.persistent;
51
+ });
52
+ vue.onBeforeUnmount(() => {
53
+ destroyed.value = true;
54
+ });
55
+ const shouldRender = vue.computed(() => {
56
+ return vue.unref(persistentRef) ? true : vue.unref(open);
57
+ });
58
+ const shouldShow = vue.computed(() => {
59
+ return props.disabled ? false : vue.unref(open);
60
+ });
61
+ const appendTo = vue.computed(() => {
62
+ return props.appendTo || selector.value;
63
+ });
64
+ const contentStyle = vue.computed(() => {
65
+ var _a;
66
+ return (_a = props.style) != null ? _a : {};
67
+ });
68
+ const ariaHidden = vue.computed(() => !vue.unref(open));
69
+ const onTransitionLeave = () => {
70
+ onHide();
71
+ };
72
+ const stopWhenControlled = () => {
73
+ if (vue.unref(controlled))
74
+ return true;
75
+ };
76
+ const onContentEnter = event.composeEventHandlers(stopWhenControlled, () => {
77
+ if (props.enterable && vue.unref(trigger) === "hover") {
78
+ onOpen();
79
+ }
80
+ });
81
+ const onContentLeave = event.composeEventHandlers(stopWhenControlled, () => {
82
+ if (vue.unref(trigger) === "hover") {
83
+ onClose();
84
+ }
85
+ });
86
+ const onBeforeEnter = () => {
87
+ var _a, _b;
88
+ (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
89
+ onBeforeShow == null ? void 0 : onBeforeShow();
90
+ };
91
+ const onBeforeLeave = () => {
92
+ onBeforeHide == null ? void 0 : onBeforeHide();
93
+ };
94
+ const onAfterShow = () => {
95
+ onShow();
96
+ stopHandle = core.onClickOutside(vue.computed(() => {
97
+ var _a;
98
+ return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
99
+ }), () => {
100
+ if (vue.unref(controlled))
101
+ return;
102
+ const $trigger = vue.unref(trigger);
103
+ if ($trigger !== "hover") {
104
+ onClose();
105
+ }
106
+ });
107
+ };
108
+ const onBlur = () => {
109
+ if (!props.virtualTriggering) {
110
+ onClose();
111
+ }
112
+ };
113
+ let stopHandle;
114
+ vue.watch(() => vue.unref(open), (val) => {
115
+ if (!val) {
116
+ stopHandle == null ? void 0 : stopHandle();
117
+ }
118
+ }, {
119
+ flush: "post"
120
+ });
121
+ vue.watch(() => props.content, () => {
122
+ var _a, _b;
123
+ (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
124
+ });
125
+ expose({
126
+ contentRef
127
+ });
128
+ return (_ctx, _cache) => {
129
+ return vue.openBlock(), vue.createBlock(vue.Teleport, {
130
+ disabled: !_ctx.teleported,
131
+ to: vue.unref(appendTo)
132
+ }, [
133
+ vue.createVNode(vue.Transition, {
134
+ name: vue.unref(transitionClass),
135
+ onAfterLeave: onTransitionLeave,
136
+ onBeforeEnter,
137
+ onAfterEnter: onAfterShow,
138
+ onBeforeLeave
139
+ }, {
140
+ default: vue.withCtx(() => [
141
+ vue.unref(shouldRender) ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(content$1["default"]), vue.mergeProps({
142
+ key: 0,
143
+ id: vue.unref(id),
144
+ ref_key: "contentRef",
145
+ ref: contentRef
146
+ }, _ctx.$attrs, {
147
+ "aria-label": _ctx.ariaLabel,
148
+ "aria-hidden": vue.unref(ariaHidden),
149
+ "boundaries-padding": _ctx.boundariesPadding,
150
+ "fallback-placements": _ctx.fallbackPlacements,
151
+ "gpu-acceleration": _ctx.gpuAcceleration,
152
+ offset: _ctx.offset,
153
+ placement: _ctx.placement,
154
+ "popper-options": _ctx.popperOptions,
155
+ strategy: _ctx.strategy,
156
+ effect: _ctx.effect,
157
+ enterable: _ctx.enterable,
158
+ pure: _ctx.pure,
159
+ "popper-class": _ctx.popperClass,
160
+ "popper-style": [_ctx.popperStyle, vue.unref(contentStyle)],
161
+ "reference-el": _ctx.referenceEl,
162
+ "trigger-target-el": _ctx.triggerTargetEl,
163
+ visible: vue.unref(shouldShow),
164
+ "z-index": _ctx.zIndex,
165
+ onMouseenter: vue.unref(onContentEnter),
166
+ onMouseleave: vue.unref(onContentLeave),
167
+ onBlur,
168
+ onClose: vue.unref(onClose)
169
+ }), {
170
+ default: vue.withCtx(() => [
171
+ !destroyed.value ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
172
+ ]),
173
+ _: 3
174
+ }, 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"])), [
175
+ [vue.vShow, vue.unref(shouldShow)]
176
+ ]) : vue.createCommentVNode("v-if", true)
177
+ ]),
178
+ _: 3
179
+ }, 8, ["name"])
180
+ ], 8, ["disabled", "to"]);
181
+ };
182
+ }
38
183
  });
184
+ var ElTooltipContent = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
39
185
 
40
- exports.useTooltipContentProps = useTooltipContentProps;
186
+ exports["default"] = ElTooltipContent;
41
187
  //# sourceMappingURL=content.js.map