code-monkey-ui 1.1.4-beta → 1.1.4

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 (555) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index.full.js +670 -608
  3. package/dist/index.full.min.js +20 -16
  4. package/dist/index.full.min.js.map +1 -1
  5. package/dist/index.full.min.mjs +20 -16
  6. package/dist/index.full.min.mjs.map +1 -1
  7. package/dist/index.full.mjs +534 -472
  8. package/es/components/affix/index.mjs +2 -2
  9. package/es/components/affix/src/affix.mjs +117 -26
  10. package/es/components/affix/src/affix.mjs.map +1 -1
  11. package/es/components/affix/src/affix2.mjs +26 -117
  12. package/es/components/affix/src/affix2.mjs.map +1 -1
  13. package/es/components/alert/index.mjs +2 -2
  14. package/es/components/alert/src/alert.mjs +36 -96
  15. package/es/components/alert/src/alert.mjs.map +1 -1
  16. package/es/components/alert/src/alert2.mjs +96 -36
  17. package/es/components/alert/src/alert2.mjs.map +1 -1
  18. package/es/components/autocomplete/index.mjs +2 -2
  19. package/es/components/autocomplete/src/autocomplete.mjs +361 -81
  20. package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
  21. package/es/components/autocomplete/src/autocomplete2.mjs +81 -361
  22. package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
  23. package/es/components/badge/index.mjs +2 -2
  24. package/es/components/badge/src/badge.mjs +55 -17
  25. package/es/components/badge/src/badge.mjs.map +1 -1
  26. package/es/components/badge/src/badge2.mjs +17 -55
  27. package/es/components/badge/src/badge2.mjs.map +1 -1
  28. package/es/components/batch/index.d.ts +743 -23
  29. package/es/components/batch/src/batch.d.ts +8 -1
  30. package/es/components/batch/src/batch.mjs +11 -4
  31. package/es/components/batch/src/batch.mjs.map +1 -1
  32. package/es/components/batch/src/batch.vue.d.ts +743 -23
  33. package/es/components/batch/src/batch2.mjs +74 -26
  34. package/es/components/batch/src/batch2.mjs.map +1 -1
  35. package/es/components/batch/src/constants.d.ts +6 -0
  36. package/es/components/batch/src/constants.mjs +4 -0
  37. package/es/components/batch/src/constants.mjs.map +1 -0
  38. package/es/components/batch/src/use-batch.d.ts +2 -1
  39. package/es/components/batch/src/use-batch.mjs +5 -2
  40. package/es/components/batch/src/use-batch.mjs.map +1 -1
  41. package/es/components/batch/style/css.d.ts +4 -0
  42. package/es/components/batch/style/css.mjs +4 -0
  43. package/es/components/batch/style/css.mjs.map +1 -1
  44. package/es/components/batch/style/index.d.ts +4 -0
  45. package/es/components/batch/style/index.mjs +4 -0
  46. package/es/components/batch/style/index.mjs.map +1 -1
  47. package/es/components/cascader/src/cascader2.mjs +1 -1
  48. package/es/components/cascader-panel/src/index.mjs +1 -1
  49. package/es/components/cascader-panel/src/menu.mjs +1 -1
  50. package/es/components/cascader-panel/src/node.mjs +209 -116
  51. package/es/components/cascader-panel/src/node.mjs.map +1 -1
  52. package/es/components/cascader-panel/src/node2.mjs +116 -209
  53. package/es/components/cascader-panel/src/node2.mjs.map +1 -1
  54. package/es/components/cascader-panel/src/store.mjs +1 -1
  55. package/es/components/check-tag/index.mjs +2 -2
  56. package/es/components/check-tag/src/check-tag.mjs +12 -31
  57. package/es/components/check-tag/src/check-tag.mjs.map +1 -1
  58. package/es/components/check-tag/src/check-tag2.mjs +31 -12
  59. package/es/components/check-tag/src/check-tag2.mjs.map +1 -1
  60. package/es/components/col/index.mjs +2 -2
  61. package/es/components/col/src/col.mjs +43 -66
  62. package/es/components/col/src/col.mjs.map +1 -1
  63. package/es/components/col/src/col2.mjs +66 -43
  64. package/es/components/col/src/col2.mjs.map +1 -1
  65. package/es/components/collapse/index.mjs +2 -2
  66. package/es/components/collapse/src/collapse.mjs +17 -28
  67. package/es/components/collapse/src/collapse.mjs.map +1 -1
  68. package/es/components/collapse/src/collapse2.mjs +28 -17
  69. package/es/components/collapse/src/collapse2.mjs.map +1 -1
  70. package/es/components/collection/index.mjs +1 -1
  71. package/es/components/collection/src/collection.mjs +10 -62
  72. package/es/components/collection/src/collection.mjs.map +1 -1
  73. package/es/components/collection/src/collection2.mjs +62 -10
  74. package/es/components/collection/src/collection2.mjs.map +1 -1
  75. package/es/components/color-picker/index.mjs +2 -2
  76. package/es/components/color-picker/src/color-picker.mjs +40 -402
  77. package/es/components/color-picker/src/color-picker.mjs.map +1 -1
  78. package/es/components/color-picker/src/color-picker2.mjs +402 -40
  79. package/es/components/color-picker/src/color-picker2.mjs.map +1 -1
  80. package/es/components/color-picker/src/components/predefine.mjs +1 -1
  81. package/es/components/countdown/index.mjs +2 -2
  82. package/es/components/countdown/src/countdown.mjs +74 -23
  83. package/es/components/countdown/src/countdown.mjs.map +1 -1
  84. package/es/components/countdown/src/countdown2.mjs +23 -74
  85. package/es/components/countdown/src/countdown2.mjs.map +1 -1
  86. package/es/components/descriptions/src/description.mjs +1 -1
  87. package/es/components/descriptions/src/descriptions-row.mjs +7 -64
  88. package/es/components/descriptions/src/descriptions-row.mjs.map +1 -1
  89. package/es/components/descriptions/src/descriptions-row2.mjs +64 -7
  90. package/es/components/descriptions/src/descriptions-row2.mjs.map +1 -1
  91. package/es/components/dialog/src/dialog-content.mjs +89 -29
  92. package/es/components/dialog/src/dialog-content.mjs.map +1 -1
  93. package/es/components/dialog/src/dialog-content2.mjs +29 -89
  94. package/es/components/dialog/src/dialog-content2.mjs.map +1 -1
  95. package/es/components/dialog/src/dialog.mjs +1 -1
  96. package/es/components/dialog/src/dialog2.mjs +1 -1
  97. package/es/components/divider/index.mjs +2 -2
  98. package/es/components/divider/src/divider.mjs +17 -35
  99. package/es/components/divider/src/divider.mjs.map +1 -1
  100. package/es/components/divider/src/divider2.mjs +35 -17
  101. package/es/components/divider/src/divider2.mjs.map +1 -1
  102. package/es/components/drawer/index.mjs +2 -2
  103. package/es/components/drawer/src/drawer.mjs +176 -26
  104. package/es/components/drawer/src/drawer.mjs.map +1 -1
  105. package/es/components/drawer/src/drawer2.mjs +26 -176
  106. package/es/components/drawer/src/drawer2.mjs.map +1 -1
  107. package/es/components/dropdown/src/dropdown-item-impl.mjs +1 -1
  108. package/es/components/dropdown/src/dropdown.mjs +1 -1
  109. package/es/components/dsh-cascader/index.d.ts +12 -0
  110. package/es/components/dsh-cascader/src/dsh-cascader.mjs +1 -1
  111. package/es/components/dsh-cascader/src/dsh-cascader.vue.d.ts +6 -0
  112. package/es/components/dsh-cascader-panel/index.d.ts +4 -0
  113. package/es/components/dsh-cascader-panel/src/config.d.ts +1 -0
  114. package/es/components/dsh-cascader-panel/src/config.mjs +2 -1
  115. package/es/components/dsh-cascader-panel/src/config.mjs.map +1 -1
  116. package/es/components/dsh-cascader-panel/src/dsh-node-content.d.ts +8 -0
  117. package/es/components/dsh-cascader-panel/src/dsh-node-content.mjs +8 -2
  118. package/es/components/dsh-cascader-panel/src/dsh-node-content.mjs.map +1 -1
  119. package/es/components/dsh-cascader-panel/src/index.mjs +19 -24
  120. package/es/components/dsh-cascader-panel/src/index.mjs.map +1 -1
  121. package/es/components/dsh-cascader-panel/src/index.vue.d.ts +2 -0
  122. package/es/components/dsh-cascader-panel/src/menu.mjs +1 -1
  123. package/es/components/dsh-cascader-panel/src/node.d.ts +1 -0
  124. package/es/components/dsh-cascader-panel/src/node.mjs +229 -115
  125. package/es/components/dsh-cascader-panel/src/node.mjs.map +1 -1
  126. package/es/components/dsh-cascader-panel/src/node2.mjs +115 -226
  127. package/es/components/dsh-cascader-panel/src/node2.mjs.map +1 -1
  128. package/es/components/dsh-cascader-panel/src/store.mjs +6 -7
  129. package/es/components/dsh-cascader-panel/src/store.mjs.map +1 -1
  130. package/es/components/dsh-select/src/select.mjs +1 -1
  131. package/es/components/image-viewer/index.mjs +2 -2
  132. package/es/components/image-viewer/src/image-viewer.mjs +401 -41
  133. package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
  134. package/es/components/image-viewer/src/image-viewer2.mjs +41 -401
  135. package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
  136. package/es/components/index.mjs +34 -34
  137. package/es/components/menu/index.mjs +4 -4
  138. package/es/components/menu/src/menu-item-group.mjs +35 -4
  139. package/es/components/menu/src/menu-item-group.mjs.map +1 -1
  140. package/es/components/menu/src/menu-item-group2.mjs +4 -35
  141. package/es/components/menu/src/menu-item-group2.mjs.map +1 -1
  142. package/es/components/menu/src/menu-item.mjs +97 -14
  143. package/es/components/menu/src/menu-item.mjs.map +1 -1
  144. package/es/components/menu/src/menu-item2.mjs +14 -97
  145. package/es/components/menu/src/menu-item2.mjs.map +1 -1
  146. package/es/components/message/index.mjs +1 -1
  147. package/es/components/message/src/message.mjs +86 -148
  148. package/es/components/message/src/message.mjs.map +1 -1
  149. package/es/components/message/src/message2.mjs +148 -86
  150. package/es/components/message/src/message2.mjs.map +1 -1
  151. package/es/components/message/src/method.mjs +2 -2
  152. package/es/components/notification/index.mjs +1 -1
  153. package/es/components/notification/src/notification.mjs +149 -67
  154. package/es/components/notification/src/notification.mjs.map +1 -1
  155. package/es/components/notification/src/notification2.mjs +67 -149
  156. package/es/components/notification/src/notification2.mjs.map +1 -1
  157. package/es/components/notification/src/notify.mjs +2 -2
  158. package/es/components/pagination/src/components/jumper.mjs +60 -9
  159. package/es/components/pagination/src/components/jumper.mjs.map +1 -1
  160. package/es/components/pagination/src/components/jumper2.mjs +9 -60
  161. package/es/components/pagination/src/components/jumper2.mjs.map +1 -1
  162. package/es/components/pagination/src/components/next.mjs +38 -19
  163. package/es/components/pagination/src/components/next.mjs.map +1 -1
  164. package/es/components/pagination/src/components/next2.mjs +19 -38
  165. package/es/components/pagination/src/components/next2.mjs.map +1 -1
  166. package/es/components/pagination/src/components/sizes.mjs +23 -69
  167. package/es/components/pagination/src/components/sizes.mjs.map +1 -1
  168. package/es/components/pagination/src/components/sizes2.mjs +69 -23
  169. package/es/components/pagination/src/components/sizes2.mjs.map +1 -1
  170. package/es/components/pagination/src/pagination.mjs +3 -3
  171. package/es/components/popper/index.mjs +6 -6
  172. package/es/components/popper/src/arrow.mjs +8 -37
  173. package/es/components/popper/src/arrow.mjs.map +1 -1
  174. package/es/components/popper/src/arrow2.mjs +37 -8
  175. package/es/components/popper/src/arrow2.mjs.map +1 -1
  176. package/es/components/popper/src/popper.mjs +25 -32
  177. package/es/components/popper/src/popper.mjs.map +1 -1
  178. package/es/components/popper/src/popper2.mjs +32 -25
  179. package/es/components/popper/src/popper2.mjs.map +1 -1
  180. package/es/components/popper/src/trigger.mjs +119 -31
  181. package/es/components/popper/src/trigger.mjs.map +1 -1
  182. package/es/components/popper/src/trigger2.mjs +31 -119
  183. package/es/components/popper/src/trigger2.mjs.map +1 -1
  184. package/es/components/radio/index.mjs +6 -6
  185. package/es/components/radio/src/radio-button.mjs +66 -9
  186. package/es/components/radio/src/radio-button.mjs.map +1 -1
  187. package/es/components/radio/src/radio-button2.mjs +9 -66
  188. package/es/components/radio/src/radio-button2.mjs.map +1 -1
  189. package/es/components/radio/src/radio-group.mjs +36 -68
  190. package/es/components/radio/src/radio-group.mjs.map +1 -1
  191. package/es/components/radio/src/radio-group2.mjs +68 -36
  192. package/es/components/radio/src/radio-group2.mjs.map +1 -1
  193. package/es/components/radio/src/radio.mjs +30 -73
  194. package/es/components/radio/src/radio.mjs.map +1 -1
  195. package/es/components/radio/src/radio2.mjs +73 -30
  196. package/es/components/radio/src/radio2.mjs.map +1 -1
  197. package/es/components/result/index.mjs +2 -2
  198. package/es/components/result/src/result.mjs +29 -63
  199. package/es/components/result/src/result.mjs.map +1 -1
  200. package/es/components/result/src/result2.mjs +63 -29
  201. package/es/components/result/src/result2.mjs.map +1 -1
  202. package/es/components/roving-focus-group/src/roving-focus-group.mjs +1 -1
  203. package/es/components/row/index.mjs +2 -2
  204. package/es/components/row/src/row.mjs +45 -29
  205. package/es/components/row/src/row.mjs.map +1 -1
  206. package/es/components/row/src/row2.mjs +29 -45
  207. package/es/components/row/src/row2.mjs.map +1 -1
  208. package/es/components/select/src/select.mjs +1 -1
  209. package/es/components/skeleton/index.d.ts +1 -1
  210. package/es/components/skeleton/index.mjs +4 -4
  211. package/es/components/skeleton/src/skeleton-item.mjs +23 -18
  212. package/es/components/skeleton/src/skeleton-item.mjs.map +1 -1
  213. package/es/components/skeleton/src/skeleton-item2.mjs +18 -23
  214. package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
  215. package/es/components/skeleton/src/skeleton.mjs +22 -49
  216. package/es/components/skeleton/src/skeleton.mjs.map +1 -1
  217. package/es/components/skeleton/src/skeleton.vue.d.ts +1 -1
  218. package/es/components/skeleton/src/skeleton2.mjs +49 -22
  219. package/es/components/skeleton/src/skeleton2.mjs.map +1 -1
  220. package/es/components/slider/src/button.mjs +21 -93
  221. package/es/components/slider/src/button.mjs.map +1 -1
  222. package/es/components/slider/src/button2.mjs +93 -21
  223. package/es/components/slider/src/button2.mjs.map +1 -1
  224. package/es/components/slider/src/slider2.mjs +1 -1
  225. package/es/components/switch/index.mjs +2 -2
  226. package/es/components/switch/src/switch.mjs +264 -98
  227. package/es/components/switch/src/switch.mjs.map +1 -1
  228. package/es/components/switch/src/switch2.mjs +98 -264
  229. package/es/components/switch/src/switch2.mjs.map +1 -1
  230. package/es/components/table/src/table-header/event-helper.mjs +6 -1
  231. package/es/components/table/src/table-header/event-helper.mjs.map +1 -1
  232. package/es/components/tabs/index.mjs +2 -2
  233. package/es/components/tabs/src/tab-pane.mjs +72 -13
  234. package/es/components/tabs/src/tab-pane.mjs.map +1 -1
  235. package/es/components/tabs/src/tab-pane2.mjs +13 -72
  236. package/es/components/tabs/src/tab-pane2.mjs.map +1 -1
  237. package/es/components/tag/index.mjs +2 -2
  238. package/es/components/tag/src/tag.mjs +94 -33
  239. package/es/components/tag/src/tag.mjs.map +1 -1
  240. package/es/components/tag/src/tag2.mjs +33 -94
  241. package/es/components/tag/src/tag2.mjs.map +1 -1
  242. package/es/components/text/index.mjs +2 -2
  243. package/es/components/text/src/text.mjs +38 -24
  244. package/es/components/text/src/text.mjs.map +1 -1
  245. package/es/components/text/src/text2.mjs +24 -38
  246. package/es/components/text/src/text2.mjs.map +1 -1
  247. package/es/components/tooltip/index.mjs +2 -2
  248. package/es/components/tooltip/src/tooltip.mjs +170 -31
  249. package/es/components/tooltip/src/tooltip.mjs.map +1 -1
  250. package/es/components/tooltip/src/tooltip2.mjs +31 -170
  251. package/es/components/tooltip/src/tooltip2.mjs.map +1 -1
  252. package/es/components/tooltip/src/trigger.mjs +1 -1
  253. package/es/components/tooltip/src/trigger2.mjs +1 -1
  254. package/es/components/tooltip-v2/index.mjs +1 -1
  255. package/es/components/tooltip-v2/src/content.mjs +50 -112
  256. package/es/components/tooltip-v2/src/content.mjs.map +1 -1
  257. package/es/components/tooltip-v2/src/content2.mjs +112 -50
  258. package/es/components/tooltip-v2/src/content2.mjs.map +1 -1
  259. package/es/components/tooltip-v2/src/tooltip.mjs +2 -2
  260. package/es/components/tooltip-v2/src/tooltip2.mjs +1 -1
  261. package/es/components/transfer/src/composables/use-check.mjs +1 -1
  262. package/es/components/transfer/src/transfer-panel.mjs +128 -19
  263. package/es/components/transfer/src/transfer-panel.mjs.map +1 -1
  264. package/es/components/transfer/src/transfer-panel2.mjs +19 -128
  265. package/es/components/transfer/src/transfer-panel2.mjs.map +1 -1
  266. package/es/components/transfer/src/transfer2.mjs +1 -1
  267. package/es/components/upload/index.mjs +1 -1
  268. package/es/components/upload/src/upload-content.mjs +33 -194
  269. package/es/components/upload/src/upload-content.mjs.map +1 -1
  270. package/es/components/upload/src/upload-content2.mjs +194 -33
  271. package/es/components/upload/src/upload-content2.mjs.map +1 -1
  272. package/es/components/upload/src/upload2.mjs +1 -1
  273. package/es/components/visual-hidden/index.mjs +3 -3
  274. package/es/components/visual-hidden/src/visual-hidden.mjs +35 -7
  275. package/es/components/visual-hidden/src/visual-hidden.mjs.map +1 -1
  276. package/es/components/visual-hidden/src/visual-hidden2.mjs +7 -35
  277. package/es/components/visual-hidden/src/visual-hidden2.mjs.map +1 -1
  278. package/es/index.mjs +34 -34
  279. package/lib/components/affix/index.js +2 -2
  280. package/lib/components/affix/src/affix.js +117 -27
  281. package/lib/components/affix/src/affix.js.map +1 -1
  282. package/lib/components/affix/src/affix2.js +27 -117
  283. package/lib/components/affix/src/affix2.js.map +1 -1
  284. package/lib/components/alert/index.js +2 -2
  285. package/lib/components/alert/src/alert.js +37 -95
  286. package/lib/components/alert/src/alert.js.map +1 -1
  287. package/lib/components/alert/src/alert2.js +95 -37
  288. package/lib/components/alert/src/alert2.js.map +1 -1
  289. package/lib/components/autocomplete/index.js +2 -2
  290. package/lib/components/autocomplete/src/autocomplete.js +360 -81
  291. package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
  292. package/lib/components/autocomplete/src/autocomplete2.js +81 -360
  293. package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
  294. package/lib/components/badge/index.js +2 -2
  295. package/lib/components/badge/src/badge.js +55 -17
  296. package/lib/components/badge/src/badge.js.map +1 -1
  297. package/lib/components/badge/src/badge2.js +17 -55
  298. package/lib/components/badge/src/badge2.js.map +1 -1
  299. package/lib/components/batch/index.d.ts +743 -23
  300. package/lib/components/batch/src/batch.d.ts +8 -1
  301. package/lib/components/batch/src/batch.js +11 -4
  302. package/lib/components/batch/src/batch.js.map +1 -1
  303. package/lib/components/batch/src/batch.vue.d.ts +743 -23
  304. package/lib/components/batch/src/batch2.js +73 -25
  305. package/lib/components/batch/src/batch2.js.map +1 -1
  306. package/lib/components/batch/src/constants.d.ts +6 -0
  307. package/lib/components/batch/src/constants.js +8 -0
  308. package/lib/components/batch/src/constants.js.map +1 -0
  309. package/lib/components/batch/src/use-batch.d.ts +2 -1
  310. package/lib/components/batch/src/use-batch.js +4 -1
  311. package/lib/components/batch/src/use-batch.js.map +1 -1
  312. package/lib/components/batch/style/css.d.ts +4 -0
  313. package/lib/components/batch/style/css.js +4 -0
  314. package/lib/components/batch/style/css.js.map +1 -1
  315. package/lib/components/batch/style/index.d.ts +4 -0
  316. package/lib/components/batch/style/index.js +4 -0
  317. package/lib/components/batch/style/index.js.map +1 -1
  318. package/lib/components/cascader/src/cascader2.js +1 -1
  319. package/lib/components/cascader-panel/src/index.js +1 -1
  320. package/lib/components/cascader-panel/src/menu.js +1 -1
  321. package/lib/components/cascader-panel/src/node.js +209 -116
  322. package/lib/components/cascader-panel/src/node.js.map +1 -1
  323. package/lib/components/cascader-panel/src/node2.js +116 -209
  324. package/lib/components/cascader-panel/src/node2.js.map +1 -1
  325. package/lib/components/cascader-panel/src/store.js +1 -1
  326. package/lib/components/check-tag/index.js +2 -2
  327. package/lib/components/check-tag/src/check-tag.js +13 -31
  328. package/lib/components/check-tag/src/check-tag.js.map +1 -1
  329. package/lib/components/check-tag/src/check-tag2.js +31 -13
  330. package/lib/components/check-tag/src/check-tag2.js.map +1 -1
  331. package/lib/components/col/index.js +2 -2
  332. package/lib/components/col/src/col.js +43 -66
  333. package/lib/components/col/src/col.js.map +1 -1
  334. package/lib/components/col/src/col2.js +66 -43
  335. package/lib/components/col/src/col2.js.map +1 -1
  336. package/lib/components/collapse/index.js +2 -2
  337. package/lib/components/collapse/src/collapse.js +19 -28
  338. package/lib/components/collapse/src/collapse.js.map +1 -1
  339. package/lib/components/collapse/src/collapse2.js +28 -19
  340. package/lib/components/collapse/src/collapse2.js.map +1 -1
  341. package/lib/components/collection/index.js +1 -1
  342. package/lib/components/collection/src/collection.js +9 -62
  343. package/lib/components/collection/src/collection.js.map +1 -1
  344. package/lib/components/collection/src/collection2.js +62 -9
  345. package/lib/components/collection/src/collection2.js.map +1 -1
  346. package/lib/components/color-picker/index.js +2 -2
  347. package/lib/components/color-picker/src/color-picker.js +40 -400
  348. package/lib/components/color-picker/src/color-picker.js.map +1 -1
  349. package/lib/components/color-picker/src/color-picker2.js +400 -40
  350. package/lib/components/color-picker/src/color-picker2.js.map +1 -1
  351. package/lib/components/color-picker/src/components/predefine.js +1 -1
  352. package/lib/components/countdown/index.js +2 -2
  353. package/lib/components/countdown/src/countdown.js +74 -24
  354. package/lib/components/countdown/src/countdown.js.map +1 -1
  355. package/lib/components/countdown/src/countdown2.js +24 -74
  356. package/lib/components/countdown/src/countdown2.js.map +1 -1
  357. package/lib/components/descriptions/src/description.js +1 -1
  358. package/lib/components/descriptions/src/descriptions-row.js +7 -64
  359. package/lib/components/descriptions/src/descriptions-row.js.map +1 -1
  360. package/lib/components/descriptions/src/descriptions-row2.js +64 -7
  361. package/lib/components/descriptions/src/descriptions-row2.js.map +1 -1
  362. package/lib/components/dialog/src/dialog-content.js +88 -29
  363. package/lib/components/dialog/src/dialog-content.js.map +1 -1
  364. package/lib/components/dialog/src/dialog-content2.js +29 -88
  365. package/lib/components/dialog/src/dialog-content2.js.map +1 -1
  366. package/lib/components/dialog/src/dialog.js +1 -1
  367. package/lib/components/dialog/src/dialog2.js +1 -1
  368. package/lib/components/divider/index.js +2 -2
  369. package/lib/components/divider/src/divider.js +17 -35
  370. package/lib/components/divider/src/divider.js.map +1 -1
  371. package/lib/components/divider/src/divider2.js +35 -17
  372. package/lib/components/divider/src/divider2.js.map +1 -1
  373. package/lib/components/drawer/index.js +2 -2
  374. package/lib/components/drawer/src/drawer.js +176 -27
  375. package/lib/components/drawer/src/drawer.js.map +1 -1
  376. package/lib/components/drawer/src/drawer2.js +27 -176
  377. package/lib/components/drawer/src/drawer2.js.map +1 -1
  378. package/lib/components/dropdown/src/dropdown-item-impl.js +1 -1
  379. package/lib/components/dropdown/src/dropdown.js +1 -1
  380. package/lib/components/dsh-cascader/index.d.ts +12 -0
  381. package/lib/components/dsh-cascader/src/dsh-cascader.js +1 -1
  382. package/lib/components/dsh-cascader/src/dsh-cascader.vue.d.ts +6 -0
  383. package/lib/components/dsh-cascader-panel/index.d.ts +4 -0
  384. package/lib/components/dsh-cascader-panel/src/config.d.ts +1 -0
  385. package/lib/components/dsh-cascader-panel/src/config.js +2 -1
  386. package/lib/components/dsh-cascader-panel/src/config.js.map +1 -1
  387. package/lib/components/dsh-cascader-panel/src/dsh-node-content.d.ts +8 -0
  388. package/lib/components/dsh-cascader-panel/src/dsh-node-content.js +8 -2
  389. package/lib/components/dsh-cascader-panel/src/dsh-node-content.js.map +1 -1
  390. package/lib/components/dsh-cascader-panel/src/index.js +19 -24
  391. package/lib/components/dsh-cascader-panel/src/index.js.map +1 -1
  392. package/lib/components/dsh-cascader-panel/src/index.vue.d.ts +2 -0
  393. package/lib/components/dsh-cascader-panel/src/menu.js +1 -1
  394. package/lib/components/dsh-cascader-panel/src/node.d.ts +1 -0
  395. package/lib/components/dsh-cascader-panel/src/node.js +229 -115
  396. package/lib/components/dsh-cascader-panel/src/node.js.map +1 -1
  397. package/lib/components/dsh-cascader-panel/src/node2.js +115 -226
  398. package/lib/components/dsh-cascader-panel/src/node2.js.map +1 -1
  399. package/lib/components/dsh-cascader-panel/src/store.js +6 -7
  400. package/lib/components/dsh-cascader-panel/src/store.js.map +1 -1
  401. package/lib/components/dsh-select/src/select.js +1 -1
  402. package/lib/components/image-viewer/index.js +2 -2
  403. package/lib/components/image-viewer/src/image-viewer.js +401 -42
  404. package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
  405. package/lib/components/image-viewer/src/image-viewer2.js +42 -401
  406. package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
  407. package/lib/components/index.js +34 -34
  408. package/lib/components/menu/index.js +4 -4
  409. package/lib/components/menu/src/menu-item-group.js +35 -4
  410. package/lib/components/menu/src/menu-item-group.js.map +1 -1
  411. package/lib/components/menu/src/menu-item-group2.js +4 -35
  412. package/lib/components/menu/src/menu-item-group2.js.map +1 -1
  413. package/lib/components/menu/src/menu-item.js +97 -15
  414. package/lib/components/menu/src/menu-item.js.map +1 -1
  415. package/lib/components/menu/src/menu-item2.js +15 -97
  416. package/lib/components/menu/src/menu-item2.js.map +1 -1
  417. package/lib/components/message/index.js +1 -1
  418. package/lib/components/message/src/message.js +88 -147
  419. package/lib/components/message/src/message.js.map +1 -1
  420. package/lib/components/message/src/message2.js +147 -88
  421. package/lib/components/message/src/message2.js.map +1 -1
  422. package/lib/components/message/src/method.js +2 -2
  423. package/lib/components/notification/index.js +1 -1
  424. package/lib/components/notification/src/notification.js +148 -68
  425. package/lib/components/notification/src/notification.js.map +1 -1
  426. package/lib/components/notification/src/notification2.js +68 -148
  427. package/lib/components/notification/src/notification2.js.map +1 -1
  428. package/lib/components/notification/src/notify.js +2 -2
  429. package/lib/components/pagination/src/components/jumper.js +60 -9
  430. package/lib/components/pagination/src/components/jumper.js.map +1 -1
  431. package/lib/components/pagination/src/components/jumper2.js +9 -60
  432. package/lib/components/pagination/src/components/jumper2.js.map +1 -1
  433. package/lib/components/pagination/src/components/next.js +38 -19
  434. package/lib/components/pagination/src/components/next.js.map +1 -1
  435. package/lib/components/pagination/src/components/next2.js +19 -38
  436. package/lib/components/pagination/src/components/next2.js.map +1 -1
  437. package/lib/components/pagination/src/components/sizes.js +23 -69
  438. package/lib/components/pagination/src/components/sizes.js.map +1 -1
  439. package/lib/components/pagination/src/components/sizes2.js +69 -23
  440. package/lib/components/pagination/src/components/sizes2.js.map +1 -1
  441. package/lib/components/pagination/src/pagination.js +3 -3
  442. package/lib/components/popper/index.js +6 -6
  443. package/lib/components/popper/src/arrow.js +9 -37
  444. package/lib/components/popper/src/arrow.js.map +1 -1
  445. package/lib/components/popper/src/arrow2.js +37 -9
  446. package/lib/components/popper/src/arrow2.js.map +1 -1
  447. package/lib/components/popper/src/popper.js +28 -32
  448. package/lib/components/popper/src/popper.js.map +1 -1
  449. package/lib/components/popper/src/popper2.js +32 -28
  450. package/lib/components/popper/src/popper2.js.map +1 -1
  451. package/lib/components/popper/src/trigger.js +119 -32
  452. package/lib/components/popper/src/trigger.js.map +1 -1
  453. package/lib/components/popper/src/trigger2.js +32 -119
  454. package/lib/components/popper/src/trigger2.js.map +1 -1
  455. package/lib/components/radio/index.js +6 -6
  456. package/lib/components/radio/src/radio-button.js +66 -9
  457. package/lib/components/radio/src/radio-button.js.map +1 -1
  458. package/lib/components/radio/src/radio-button2.js +9 -66
  459. package/lib/components/radio/src/radio-button2.js.map +1 -1
  460. package/lib/components/radio/src/radio-group.js +37 -68
  461. package/lib/components/radio/src/radio-group.js.map +1 -1
  462. package/lib/components/radio/src/radio-group2.js +68 -37
  463. package/lib/components/radio/src/radio-group2.js.map +1 -1
  464. package/lib/components/radio/src/radio.js +32 -73
  465. package/lib/components/radio/src/radio.js.map +1 -1
  466. package/lib/components/radio/src/radio2.js +73 -32
  467. package/lib/components/radio/src/radio2.js.map +1 -1
  468. package/lib/components/result/index.js +2 -2
  469. package/lib/components/result/src/result.js +31 -63
  470. package/lib/components/result/src/result.js.map +1 -1
  471. package/lib/components/result/src/result2.js +63 -31
  472. package/lib/components/result/src/result2.js.map +1 -1
  473. package/lib/components/roving-focus-group/src/roving-focus-group.js +1 -1
  474. package/lib/components/row/index.js +2 -2
  475. package/lib/components/row/src/row.js +45 -31
  476. package/lib/components/row/src/row.js.map +1 -1
  477. package/lib/components/row/src/row2.js +31 -45
  478. package/lib/components/row/src/row2.js.map +1 -1
  479. package/lib/components/select/src/select.js +1 -1
  480. package/lib/components/skeleton/index.d.ts +1 -1
  481. package/lib/components/skeleton/index.js +4 -4
  482. package/lib/components/skeleton/src/skeleton-item.js +23 -18
  483. package/lib/components/skeleton/src/skeleton-item.js.map +1 -1
  484. package/lib/components/skeleton/src/skeleton-item2.js +18 -23
  485. package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
  486. package/lib/components/skeleton/src/skeleton.js +22 -49
  487. package/lib/components/skeleton/src/skeleton.js.map +1 -1
  488. package/lib/components/skeleton/src/skeleton.vue.d.ts +1 -1
  489. package/lib/components/skeleton/src/skeleton2.js +49 -22
  490. package/lib/components/skeleton/src/skeleton2.js.map +1 -1
  491. package/lib/components/slider/src/button.js +22 -93
  492. package/lib/components/slider/src/button.js.map +1 -1
  493. package/lib/components/slider/src/button2.js +93 -22
  494. package/lib/components/slider/src/button2.js.map +1 -1
  495. package/lib/components/slider/src/slider2.js +1 -1
  496. package/lib/components/switch/index.js +2 -2
  497. package/lib/components/switch/src/switch.js +263 -98
  498. package/lib/components/switch/src/switch.js.map +1 -1
  499. package/lib/components/switch/src/switch2.js +98 -263
  500. package/lib/components/switch/src/switch2.js.map +1 -1
  501. package/lib/components/table/src/table-header/event-helper.js +6 -1
  502. package/lib/components/table/src/table-header/event-helper.js.map +1 -1
  503. package/lib/components/tabs/index.js +2 -2
  504. package/lib/components/tabs/src/tab-pane.js +72 -13
  505. package/lib/components/tabs/src/tab-pane.js.map +1 -1
  506. package/lib/components/tabs/src/tab-pane2.js +13 -72
  507. package/lib/components/tabs/src/tab-pane2.js.map +1 -1
  508. package/lib/components/tag/index.js +2 -2
  509. package/lib/components/tag/src/tag.js +94 -34
  510. package/lib/components/tag/src/tag.js.map +1 -1
  511. package/lib/components/tag/src/tag2.js +34 -94
  512. package/lib/components/tag/src/tag2.js.map +1 -1
  513. package/lib/components/text/index.js +2 -2
  514. package/lib/components/text/src/text.js +38 -24
  515. package/lib/components/text/src/text.js.map +1 -1
  516. package/lib/components/text/src/text2.js +24 -38
  517. package/lib/components/text/src/text2.js.map +1 -1
  518. package/lib/components/tooltip/index.js +2 -2
  519. package/lib/components/tooltip/src/tooltip.js +169 -34
  520. package/lib/components/tooltip/src/tooltip.js.map +1 -1
  521. package/lib/components/tooltip/src/tooltip2.js +34 -169
  522. package/lib/components/tooltip/src/tooltip2.js.map +1 -1
  523. package/lib/components/tooltip/src/trigger.js +1 -1
  524. package/lib/components/tooltip/src/trigger2.js +1 -1
  525. package/lib/components/tooltip-v2/index.js +1 -1
  526. package/lib/components/tooltip-v2/src/content.js +50 -112
  527. package/lib/components/tooltip-v2/src/content.js.map +1 -1
  528. package/lib/components/tooltip-v2/src/content2.js +112 -50
  529. package/lib/components/tooltip-v2/src/content2.js.map +1 -1
  530. package/lib/components/tooltip-v2/src/tooltip.js +2 -2
  531. package/lib/components/tooltip-v2/src/tooltip2.js +1 -1
  532. package/lib/components/transfer/src/composables/use-check.js +1 -1
  533. package/lib/components/transfer/src/transfer-panel.js +128 -21
  534. package/lib/components/transfer/src/transfer-panel.js.map +1 -1
  535. package/lib/components/transfer/src/transfer-panel2.js +21 -128
  536. package/lib/components/transfer/src/transfer-panel2.js.map +1 -1
  537. package/lib/components/transfer/src/transfer2.js +1 -1
  538. package/lib/components/upload/index.js +1 -1
  539. package/lib/components/upload/src/upload-content.js +31 -192
  540. package/lib/components/upload/src/upload-content.js.map +1 -1
  541. package/lib/components/upload/src/upload-content2.js +192 -31
  542. package/lib/components/upload/src/upload-content2.js.map +1 -1
  543. package/lib/components/upload/src/upload2.js +1 -1
  544. package/lib/components/visual-hidden/index.js +2 -2
  545. package/lib/components/visual-hidden/src/visual-hidden.js +35 -7
  546. package/lib/components/visual-hidden/src/visual-hidden.js.map +1 -1
  547. package/lib/components/visual-hidden/src/visual-hidden2.js +7 -35
  548. package/lib/components/visual-hidden/src/visual-hidden2.js.map +1 -1
  549. package/lib/index.js +34 -34
  550. package/package.json +1 -1
  551. package/theme-chalk/el-batch.css +1 -1
  552. package/theme-chalk/el-dsh-cascader.css +1 -1
  553. package/theme-chalk/index.css +1 -1
  554. package/theme-chalk/src/batch.scss +3 -2
  555. package/theme-chalk/src/dsh/dsh-cascader.scss +3 -3
@@ -2,275 +2,110 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var vue = require('vue');
6
- var shared = require('@vue/shared');
7
- var iconsVue = require('@element-plus/icons-vue');
8
5
  require('../../../utils/index.js');
9
- var index$2 = require('../../icon/index.js');
10
- require('../../form/index.js');
11
6
  require('../../../constants/index.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');
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');
20
10
  var event = require('../../../constants/event.js');
21
- var error = require('../../../utils/error.js');
22
11
  var types = require('../../../utils/types.js');
12
+ var shared = require('@vue/shared');
23
13
 
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
- };
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
271
101
  }
272
102
  });
273
- var Switch = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "D:\\project\\work\\code-monkey-ui\\packages\\components\\switch\\src\\switch.vue"]]);
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
+ };
274
108
 
275
- exports["default"] = Switch;
109
+ exports.switchEmits = switchEmits;
110
+ exports.switchProps = switchProps;
276
111
  //# sourceMappingURL=switch2.js.map
@@ -1 +1 @@
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 { Loading } from '@element-plus/icons-vue'\nimport {\n addUnit,\n debugWarn,\n isBoolean,\n throwError,\n} from '@code-monkey-ui/utils'\nimport ElIcon from '@code-monkey-ui/components/icon'\nimport {\n useFormDisabled,\n useFormItem,\n useFormItemInputId,\n useFormSize,\n} from '@code-monkey-ui/components/form'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@code-monkey-ui/constants'\nimport { useDeprecated, useNamespace } from '@code-monkey-ui/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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAuGc,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,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,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,IAIAa,aAAA,CAAA,MAAA;AAAA,MACD,KAAA,CAAA,KAAA,CAAA,OAAA,GAAA,OAAA,CAAA,KAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
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 '@code-monkey-ui/utils'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@code-monkey-ui/constants'\nimport type { ComponentSize } from '@code-monkey-ui/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,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,EAAEC,8BAAoB;AACnC,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;A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,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAEC,sBAAc,CAAC,QAAQ,CAAC;AAClC,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,CAACC,wBAAkB,GAAG,CAAC,GAAG,KAAKC,eAAS,CAAC,GAAG,CAAC,IAAIC,eAAQ,CAAC,GAAG,CAAC,IAAIC,cAAQ,CAAC,GAAG,CAAC;AACjF,EAAE,CAACC,kBAAY,GAAG,CAAC,GAAG,KAAKH,eAAS,CAAC,GAAG,CAAC,IAAIC,eAAQ,CAAC,GAAG,CAAC,IAAIC,cAAQ,CAAC,GAAG,CAAC;AAC3E,EAAE,CAACE,iBAAW,GAAG,CAAC,GAAG,KAAKJ,eAAS,CAAC,GAAG,CAAC,IAAIC,eAAQ,CAAC,GAAG,CAAC,IAAIC,cAAQ,CAAC,GAAG,CAAC;AAC1E;;;;;"}
@@ -43,7 +43,12 @@ function useEvent(props, emit) {
43
43
  const tableLeft = tableEl.getBoundingClientRect().left;
44
44
  const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
45
45
  const columnRect = columnEl.getBoundingClientRect();
46
- const minLeft = columnRect.left - tableLeft + 30;
46
+ let minLeft = 0;
47
+ if (column.minWidth > 30) {
48
+ minLeft = columnRect.left - tableLeft + column.minWidth;
49
+ } else {
50
+ minLeft = columnRect.left - tableLeft + 30;
51
+ }
47
52
  style.addClass(columnEl, "noclick");
48
53
  dragState.value = {
49
54
  startMouseLeft: event.clientX,
@@ -1 +1 @@
1
- {"version":3,"file":"event-helper.js","sources":["../../../../../../../packages/components/table/src/table-header/event-helper.ts"],"sourcesContent":["// @ts-nocheck\nimport { getCurrentInstance, inject, ref } from 'vue'\nimport {\n addClass,\n hasClass,\n isClient,\n isElement,\n removeClass,\n} from '@code-monkey-ui/utils'\nimport { TABLE_INJECTION_KEY } from '../tokens'\nimport type { TableHeaderProps } from '.'\nimport type { TableColumnCtx } from '../table-column/defaults'\n\nfunction useEvent<T>(props: TableHeaderProps<T>, emit) {\n const instance = getCurrentInstance()\n const parent = inject(TABLE_INJECTION_KEY)\n const handleFilterClick = (event: Event) => {\n event.stopPropagation()\n return\n }\n\n const handleHeaderClick = (event: Event, column: TableColumnCtx<T>) => {\n if (!column.filters && column.sortable) {\n handleSortClick(event, column, false)\n } else if (column.filterable && !column.sortable) {\n handleFilterClick(event)\n }\n parent?.emit('header-click', column, event)\n }\n\n const handleHeaderContextMenu = (event: Event, column: TableColumnCtx<T>) => {\n parent?.emit('header-contextmenu', column, event)\n }\n const draggingColumn = ref(null)\n const dragging = ref(false)\n const dragState = ref({})\n const handleMouseDown = (event: MouseEvent, column: TableColumnCtx<T>) => {\n if (!isClient) return\n if (column.children && column.children.length > 0) return\n /* istanbul ignore if */\n if (draggingColumn.value && props.border) {\n dragging.value = true\n\n const table = parent\n emit('set-drag-visible', true)\n const tableEl = table?.vnode.el\n const tableLeft = tableEl.getBoundingClientRect().left\n const columnEl = instance.vnode.el.querySelector(`th.${column.id}`)\n const columnRect = columnEl.getBoundingClientRect()\n const minLeft = columnRect.left - tableLeft + 30\n\n addClass(columnEl, 'noclick')\n\n dragState.value = {\n startMouseLeft: event.clientX,\n startLeft: columnRect.right - tableLeft,\n startColumnLeft: columnRect.left - tableLeft,\n tableLeft,\n }\n const resizeProxy = table?.refs.resizeProxy as HTMLElement\n resizeProxy.style.left = `${(dragState.value as any).startLeft}px`\n\n document.onselectstart = function () {\n return false\n }\n document.ondragstart = function () {\n return false\n }\n\n const handleMouseMove = (event: MouseEvent) => {\n const deltaLeft =\n event.clientX - (dragState.value as any).startMouseLeft\n const proxyLeft = (dragState.value as any).startLeft + deltaLeft\n\n resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`\n }\n\n const handleMouseUp = () => {\n if (dragging.value) {\n const { startColumnLeft, startLeft } = dragState.value as any\n const finalLeft = Number.parseInt(resizeProxy.style.left, 10)\n const columnWidth = finalLeft - startColumnLeft\n column.width = column.realWidth = columnWidth\n table?.emit(\n 'header-dragend',\n column.width,\n startLeft - startColumnLeft,\n column,\n event\n )\n requestAnimationFrame(() => {\n props.store.scheduleLayout(false, true)\n })\n document.body.style.cursor = ''\n dragging.value = false\n draggingColumn.value = null\n dragState.value = {}\n emit('set-drag-visible', false)\n }\n\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n document.onselectstart = null\n document.ondragstart = null\n\n setTimeout(() => {\n removeClass(columnEl, 'noclick')\n }, 0)\n }\n\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n }\n }\n\n const handleMouseMove = (event: MouseEvent, column: TableColumnCtx<T>) => {\n if (column.children && column.children.length > 0) return\n const el = event.target as HTMLElement\n if (!isElement(el)) {\n return\n }\n const target = el?.closest('th')\n\n if (!column || !column.resizable) return\n\n if (!dragging.value && props.border) {\n const rect = target.getBoundingClientRect()\n\n const bodyStyle = document.body.style\n if (rect.width > 12 && rect.right - event.pageX < 8) {\n bodyStyle.cursor = 'col-resize'\n if (hasClass(target, 'is-sortable')) {\n target.style.cursor = 'col-resize'\n }\n draggingColumn.value = column\n } else if (!dragging.value) {\n bodyStyle.cursor = ''\n if (hasClass(target, 'is-sortable')) {\n target.style.cursor = 'pointer'\n }\n draggingColumn.value = null\n }\n }\n }\n\n const handleMouseOut = () => {\n if (!isClient) return\n document.body.style.cursor = ''\n }\n const toggleOrder = ({ order, sortOrders }) => {\n if (order === '') return sortOrders[0]\n const index = sortOrders.indexOf(order || null)\n return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1]\n }\n const handleSortClick = (\n event: Event,\n column: TableColumnCtx<T>,\n givenOrder: string | boolean\n ) => {\n event.stopPropagation()\n const order =\n column.order === givenOrder ? null : givenOrder || toggleOrder(column)\n\n const target = (event.target as HTMLElement)?.closest('th')\n\n if (target) {\n if (hasClass(target, 'noclick')) {\n removeClass(target, 'noclick')\n return\n }\n }\n\n if (!column.sortable) return\n\n const states = props.store.states\n let sortProp = states.sortProp.value\n let sortOrder\n const sortingColumn = states.sortingColumn.value\n\n if (\n sortingColumn !== column ||\n (sortingColumn === column && sortingColumn.order === null)\n ) {\n if (sortingColumn) {\n sortingColumn.order = null\n }\n states.sortingColumn.value = column\n sortProp = column.property\n }\n if (!order) {\n sortOrder = column.order = null\n } else {\n sortOrder = column.order = order\n }\n\n states.sortProp.value = sortProp\n states.sortOrder.value = sortOrder\n\n parent?.store.commit('changeSortCondition')\n }\n\n return {\n handleHeaderClick,\n handleHeaderContextMenu,\n handleMouseDown,\n handleMouseMove,\n handleMouseOut,\n handleSortClick,\n handleFilterClick,\n }\n}\n\nexport default useEvent\n"],"names":["getCurrentInstance","inject","TABLE_INJECTION_KEY","ref","isClient","addClass","removeClass","isElement","hasClass"],"mappings":";;;;;;;;;;;AASA,SAAS,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE;AAC/B,EAAE,MAAM,QAAQ,GAAGA,sBAAkB,EAAE,CAAC;AACxC,EAAE,MAAM,MAAM,GAAGC,UAAM,CAACC,0BAAmB,CAAC,CAAC;AAC7C,EAAE,MAAM,iBAAiB,GAAG,CAAC,KAAK,KAAK;AACvC,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;AAC5B,IAAI,OAAO;AACX,GAAG,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AK,GAAG,IAAI,CAAC;AACnC,OAAO;AACP,MAAM,MAAM,CAAC,aAAa,CAAC,KAAK,GAAG,MAAM,CAAC;AAC1C,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AACjC,KAAK;AACL,IAAI,IAAI,CAAC,KAAK,EAAE;AAChB,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;AACtC,KAAK,MAAM;AACX,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;AACvC,KAAK;AACL,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC;AACrC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,SAAS,CAAC;AACvC,IAAI,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACzE,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,iBAAiB;AACrB,IAAI,uBAAuB;AAC3B,IAAI,eAAe;AACnB,IAAI,eAAe;AACnB,IAAI,cAAc;AAClB,IAAI,eAAe;AACnB,IAAI,iBAAiB;AACrB,GAAG,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"event-helper.js","sources":["../../../../../../../packages/components/table/src/table-header/event-helper.ts"],"sourcesContent":["// @ts-nocheck\nimport { getCurrentInstance, inject, ref } from 'vue'\nimport {\n addClass,\n hasClass,\n isClient,\n isElement,\n removeClass,\n} from '@code-monkey-ui/utils'\nimport { TABLE_INJECTION_KEY } from '../tokens'\nimport type { TableHeaderProps } from '.'\nimport type { TableColumnCtx } from '../table-column/defaults'\n\nfunction useEvent<T>(props: TableHeaderProps<T>, emit) {\n const instance = getCurrentInstance()\n const parent = inject(TABLE_INJECTION_KEY)\n const handleFilterClick = (event: Event) => {\n event.stopPropagation()\n return\n }\n\n const handleHeaderClick = (event: Event, column: TableColumnCtx<T>) => {\n if (!column.filters && column.sortable) {\n handleSortClick(event, column, false)\n } else if (column.filterable && !column.sortable) {\n handleFilterClick(event)\n }\n parent?.emit('header-click', column, event)\n }\n\n const handleHeaderContextMenu = (event: Event, column: TableColumnCtx<T>) => {\n parent?.emit('header-contextmenu', column, event)\n }\n const draggingColumn = ref(null)\n const dragging = ref(false)\n const dragState = ref({})\n const handleMouseDown = (event: MouseEvent, column: TableColumnCtx<T>) => {\n if (!isClient) return\n if (column.children && column.children.length > 0) return\n /* istanbul ignore if */\n if (draggingColumn.value && props.border) {\n dragging.value = true\n\n const table = parent\n emit('set-drag-visible', true)\n const tableEl = table?.vnode.el\n const tableLeft = tableEl.getBoundingClientRect().left\n const columnEl = instance.vnode.el.querySelector(`th.${column.id}`)\n const columnRect = columnEl.getBoundingClientRect()\n let minLeft = 0\n if (column.minWidth > 30) {\n minLeft = columnRect.left - tableLeft + column.minWidth\n } else {\n minLeft = columnRect.left - tableLeft + 30\n }\n\n addClass(columnEl, 'noclick')\n\n dragState.value = {\n startMouseLeft: event.clientX,\n startLeft: columnRect.right - tableLeft,\n startColumnLeft: columnRect.left - tableLeft,\n tableLeft,\n }\n const resizeProxy = table?.refs.resizeProxy as HTMLElement\n resizeProxy.style.left = `${(dragState.value as any).startLeft}px`\n\n document.onselectstart = function () {\n return false\n }\n document.ondragstart = function () {\n return false\n }\n\n const handleMouseMove = (event: MouseEvent) => {\n const deltaLeft =\n event.clientX - (dragState.value as any).startMouseLeft\n const proxyLeft = (dragState.value as any).startLeft + deltaLeft\n\n resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`\n }\n\n const handleMouseUp = () => {\n if (dragging.value) {\n const { startColumnLeft, startLeft } = dragState.value as any\n const finalLeft = Number.parseInt(resizeProxy.style.left, 10)\n const columnWidth = finalLeft - startColumnLeft\n column.width = column.realWidth = columnWidth\n table?.emit(\n 'header-dragend',\n column.width,\n startLeft - startColumnLeft,\n column,\n event\n )\n requestAnimationFrame(() => {\n props.store.scheduleLayout(false, true)\n })\n document.body.style.cursor = ''\n dragging.value = false\n draggingColumn.value = null\n dragState.value = {}\n emit('set-drag-visible', false)\n }\n\n document.removeEventListener('mousemove', handleMouseMove)\n document.removeEventListener('mouseup', handleMouseUp)\n document.onselectstart = null\n document.ondragstart = null\n\n setTimeout(() => {\n removeClass(columnEl, 'noclick')\n }, 0)\n }\n\n document.addEventListener('mousemove', handleMouseMove)\n document.addEventListener('mouseup', handleMouseUp)\n }\n }\n\n const handleMouseMove = (event: MouseEvent, column: TableColumnCtx<T>) => {\n if (column.children && column.children.length > 0) return\n const el = event.target as HTMLElement\n if (!isElement(el)) {\n return\n }\n const target = el?.closest('th')\n\n if (!column || !column.resizable) return\n\n if (!dragging.value && props.border) {\n const rect = target.getBoundingClientRect()\n\n const bodyStyle = document.body.style\n if (rect.width > 12 && rect.right - event.pageX < 8) {\n bodyStyle.cursor = 'col-resize'\n if (hasClass(target, 'is-sortable')) {\n target.style.cursor = 'col-resize'\n }\n draggingColumn.value = column\n } else if (!dragging.value) {\n bodyStyle.cursor = ''\n if (hasClass(target, 'is-sortable')) {\n target.style.cursor = 'pointer'\n }\n draggingColumn.value = null\n }\n }\n }\n\n const handleMouseOut = () => {\n if (!isClient) return\n document.body.style.cursor = ''\n }\n const toggleOrder = ({ order, sortOrders }) => {\n if (order === '') return sortOrders[0]\n const index = sortOrders.indexOf(order || null)\n return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1]\n }\n const handleSortClick = (\n event: Event,\n column: TableColumnCtx<T>,\n givenOrder: string | boolean\n ) => {\n event.stopPropagation()\n const order =\n column.order === givenOrder ? null : givenOrder || toggleOrder(column)\n\n const target = (event.target as HTMLElement)?.closest('th')\n\n if (target) {\n if (hasClass(target, 'noclick')) {\n removeClass(target, 'noclick')\n return\n }\n }\n\n if (!column.sortable) return\n\n const states = props.store.states\n let sortProp = states.sortProp.value\n let sortOrder\n const sortingColumn = states.sortingColumn.value\n\n if (\n sortingColumn !== column ||\n (sortingColumn === column && sortingColumn.order === null)\n ) {\n if (sortingColumn) {\n sortingColumn.order = null\n }\n states.sortingColumn.value = column\n sortProp = column.property\n }\n if (!order) {\n sortOrder = column.order = null\n } else {\n sortOrder = column.order = order\n }\n\n states.sortProp.value = sortProp\n states.sortOrder.value = sortOrder\n\n parent?.store.commit('changeSortCondition')\n }\n\n return {\n handleHeaderClick,\n handleHeaderContextMenu,\n handleMouseDown,\n handleMouseMove,\n handleMouseOut,\n handleSortClick,\n handleFilterClick,\n }\n}\n\nexport default useEvent\n"],"names":["getCurrentInstance","inject","TABLE_INJECTION_KEY","ref","isClient","addClass","removeClass","isElement","hasClass"],"mappings":";;;;;;;;;;;AASA,SAAS,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE;AAC/B,EAAE,MAAM,QAAQ,GAAGA,sBAAkB,EAAE,CAAC;AACxC,EAAE,MAAM,MAAM,GAAGC,UAAM,CAACC,0BAAmB,CAAC,CAAC;AAC7C,EAAE,MAAM,iBAAiB,GAAG,CAAC,KAAK,KAAK;AACvC,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;AAC5B,IAAI,OAAO;AACX,GAAG,CAAC;AACJ,EAAE,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK;AAC/C,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE;AAC5C,MAAM,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAC5C,KAAK,MAAM,IAAI,MAAM,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;AACtD,MAAM,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAC/B,KAAK;AACL,IAAI,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACzE,GAAG,CAAC;AACJ,EAAE,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,MAAM,KA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K;AACL,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC;AACrC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,SAAS,CAAC;AACvC,IAAI,MAAM,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACzE,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,iBAAiB;AACrB,IAAI,uBAAuB;AAC3B,IAAI,eAAe;AACnB,IAAI,eAAe;AACnB,IAAI,cAAc;AAClB,IAAI,eAAe;AACnB,IAAI,iBAAiB;AACrB,GAAG,CAAC;AACJ;;;;"}
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('../../utils/index.js');
6
6
  var tabs = require('./src/tabs.js');
7
- var tabPane$1 = require('./src/tab-pane2.js');
7
+ var tabPane$1 = require('./src/tab-pane.js');
8
8
  var tabBar = require('./src/tab-bar.js');
9
9
  var tabNav = require('./src/tab-nav.js');
10
- var tabPane = require('./src/tab-pane.js');
10
+ var tabPane = require('./src/tab-pane2.js');
11
11
  var constants = require('./src/constants.js');
12
12
  var install = require('../../utils/vue/install.js');
13
13
 
@@ -2,21 +2,80 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var vue = require('vue');
6
+ var core = require('@vueuse/core');
5
7
  require('../../../utils/index.js');
6
- var runtime = require('../../../utils/vue/props/runtime.js');
8
+ require('../../../hooks/index.js');
9
+ var constants = require('./constants.js');
10
+ var tabPane = require('./tab-pane2.js');
11
+ var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
12
+ var error = require('../../../utils/error.js');
13
+ var index = require('../../../hooks/use-namespace/index.js');
7
14
 
8
- const tabPaneProps = runtime.buildProps({
9
- label: {
10
- type: String,
11
- default: ""
12
- },
13
- name: {
14
- type: [String, Number]
15
- },
16
- closable: Boolean,
17
- disabled: Boolean,
18
- lazy: Boolean
15
+ const _hoisted_1 = ["id", "aria-hidden", "aria-labelledby"];
16
+ const COMPONENT_NAME = "ElTabPane";
17
+ const __default__ = vue.defineComponent({
18
+ name: COMPONENT_NAME
19
19
  });
20
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
21
+ ...__default__,
22
+ props: tabPane.tabPaneProps,
23
+ setup(__props) {
24
+ const props = __props;
25
+ const instance = vue.getCurrentInstance();
26
+ const slots = vue.useSlots();
27
+ const tabsRoot = vue.inject(constants.tabsRootContextKey);
28
+ if (!tabsRoot)
29
+ error.throwError(COMPONENT_NAME, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
30
+ const ns = index.useNamespace("tab-pane");
31
+ const index$1 = vue.ref();
32
+ const isClosable = vue.computed(() => props.closable || tabsRoot.props.closable);
33
+ const active = core.eagerComputed(() => {
34
+ var _a;
35
+ return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index$1.value);
36
+ });
37
+ const loaded = vue.ref(active.value);
38
+ const paneName = vue.computed(() => {
39
+ var _a;
40
+ return (_a = props.name) != null ? _a : index$1.value;
41
+ });
42
+ const shouldBeRender = core.eagerComputed(() => !props.lazy || loaded.value || active.value);
43
+ vue.watch(active, (val) => {
44
+ if (val)
45
+ loaded.value = true;
46
+ });
47
+ const pane = vue.reactive({
48
+ uid: instance.uid,
49
+ slots,
50
+ props,
51
+ paneName,
52
+ active,
53
+ index: index$1,
54
+ isClosable
55
+ });
56
+ vue.onMounted(() => {
57
+ tabsRoot.registerPane(pane);
58
+ });
59
+ vue.onUnmounted(() => {
60
+ tabsRoot.unregisterPane(pane.uid);
61
+ });
62
+ return (_ctx, _cache) => {
63
+ return vue.unref(shouldBeRender) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
64
+ key: 0,
65
+ id: `pane-${vue.unref(paneName)}`,
66
+ class: vue.normalizeClass(vue.unref(ns).b()),
67
+ role: "tabpanel",
68
+ "aria-hidden": !vue.unref(active),
69
+ "aria-labelledby": `tab-${vue.unref(paneName)}`
70
+ }, [
71
+ vue.renderSlot(_ctx.$slots, "default")
72
+ ], 10, _hoisted_1)), [
73
+ [vue.vShow, vue.unref(active)]
74
+ ]) : vue.createCommentVNode("v-if", true);
75
+ };
76
+ }
77
+ });
78
+ var TabPane = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "D:\\project\\work\\code-monkey-ui\\packages\\components\\tabs\\src\\tab-pane.vue"]]);
20
79
 
21
- exports.tabPaneProps = tabPaneProps;
80
+ exports["default"] = TabPane;
22
81
  //# sourceMappingURL=tab-pane.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tab-pane.js","sources":["../../../../../../packages/components/tabs/src/tab-pane.ts"],"sourcesContent":["import { buildProps } from '@code-monkey-ui/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type TabPane from './tab-pane.vue'\n\nexport const tabPaneProps = buildProps({\n label: {\n type: String,\n default: '',\n },\n name: {\n type: [String, Number],\n },\n closable: Boolean,\n disabled: Boolean,\n lazy: Boolean,\n} as const)\n\nexport type TabPaneProps = ExtractPropTypes<typeof tabPaneProps>\n\nexport type TabPaneInstance = InstanceType<typeof TabPane>\n"],"names":["buildProps"],"mappings":";;;;;;;AACY,MAAC,YAAY,GAAGA,kBAAU,CAAC;AACvC,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,IAAI,EAAE,OAAO;AACf,CAAC;;;;"}
1
+ {"version":3,"file":"tab-pane.js","sources":["../../../../../../packages/components/tabs/src/tab-pane.vue"],"sourcesContent":["<template>\n <div\n v-if=\"shouldBeRender\"\n v-show=\"active\"\n :id=\"`pane-${paneName}`\"\n :class=\"ns.b()\"\n role=\"tabpanel\"\n :aria-hidden=\"!active\"\n :aria-labelledby=\"`tab-${paneName}`\"\n >\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n getCurrentInstance,\n inject,\n onMounted,\n onUnmounted,\n reactive,\n ref,\n useSlots,\n watch,\n} from 'vue'\nimport { eagerComputed } from '@vueuse/core'\nimport { throwError } from '@code-monkey-ui/utils'\nimport { useNamespace } from '@code-monkey-ui/hooks'\nimport { tabsRootContextKey } from './constants'\nimport { tabPaneProps } from './tab-pane'\n\nconst COMPONENT_NAME = 'ElTabPane'\ndefineOptions({\n name: COMPONENT_NAME,\n})\nconst props = defineProps(tabPaneProps)\n\nconst instance = getCurrentInstance()!\nconst slots = useSlots()\n\nconst tabsRoot = inject(tabsRootContextKey)\nif (!tabsRoot)\n throwError(COMPONENT_NAME, 'usage: <el-tabs><el-tab-pane /></el-tabs/>')\n\nconst ns = useNamespace('tab-pane')\n\nconst index = ref<string>()\nconst isClosable = computed(() => props.closable || tabsRoot.props.closable)\nconst active = eagerComputed(\n () => tabsRoot.currentName.value === (props.name ?? index.value)\n)\nconst loaded = ref(active.value)\nconst paneName = computed(() => props.name ?? index.value)\nconst shouldBeRender = eagerComputed(\n () => !props.lazy || loaded.value || active.value\n)\n\nwatch(active, (val) => {\n if (val) loaded.value = true\n})\n\nconst pane = reactive({\n uid: instance.uid,\n slots,\n props,\n paneName,\n active,\n index,\n isClosable,\n})\n\nonMounted(() => {\n tabsRoot.registerPane(pane)\n})\n\nonUnmounted(() => {\n tabsRoot.unregisterPane(pane.uid)\n})\n</script>\n"],"names":["getCurrentInstance","useSlots","inject","tabsRootContextKey","throwError","useNamespace","index","ref","computed","eagerComputed","watch","reactive"],"mappings":";;;;;;;;;;;;;;;;uCAiCc,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR;;;;;;AAGA,IAAA,MAAM,WAAWA,sBAAmB,EAAA,CAAA;AACpC,IAAA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