@element-plus/nightly 0.0.20240123 → 0.0.20240124

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 (320) 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-eg.js +1 -1
  12. package/dist/locale/ar-eg.min.js +1 -1
  13. package/dist/locale/ar-eg.min.mjs +1 -1
  14. package/dist/locale/ar-eg.mjs +1 -1
  15. package/dist/locale/ar.js +1 -1
  16. package/dist/locale/ar.min.js +1 -1
  17. package/dist/locale/ar.min.mjs +1 -1
  18. package/dist/locale/ar.mjs +1 -1
  19. package/dist/locale/az.js +1 -1
  20. package/dist/locale/az.min.js +1 -1
  21. package/dist/locale/az.min.mjs +1 -1
  22. package/dist/locale/az.mjs +1 -1
  23. package/dist/locale/bg.js +1 -1
  24. package/dist/locale/bg.min.js +1 -1
  25. package/dist/locale/bg.min.mjs +1 -1
  26. package/dist/locale/bg.mjs +1 -1
  27. package/dist/locale/bn.js +1 -1
  28. package/dist/locale/bn.min.js +1 -1
  29. package/dist/locale/bn.min.mjs +1 -1
  30. package/dist/locale/bn.mjs +1 -1
  31. package/dist/locale/ca.js +1 -1
  32. package/dist/locale/ca.min.js +1 -1
  33. package/dist/locale/ca.min.mjs +1 -1
  34. package/dist/locale/ca.mjs +1 -1
  35. package/dist/locale/ckb.js +1 -1
  36. package/dist/locale/ckb.min.js +1 -1
  37. package/dist/locale/ckb.min.mjs +1 -1
  38. package/dist/locale/ckb.mjs +1 -1
  39. package/dist/locale/cs.js +1 -1
  40. package/dist/locale/cs.min.js +1 -1
  41. package/dist/locale/cs.min.mjs +1 -1
  42. package/dist/locale/cs.mjs +1 -1
  43. package/dist/locale/da.js +1 -1
  44. package/dist/locale/da.min.js +1 -1
  45. package/dist/locale/da.min.mjs +1 -1
  46. package/dist/locale/da.mjs +1 -1
  47. package/dist/locale/de.js +1 -1
  48. package/dist/locale/de.min.js +1 -1
  49. package/dist/locale/de.min.mjs +1 -1
  50. package/dist/locale/de.mjs +1 -1
  51. package/dist/locale/el.js +1 -1
  52. package/dist/locale/el.min.js +1 -1
  53. package/dist/locale/el.min.mjs +1 -1
  54. package/dist/locale/el.mjs +1 -1
  55. package/dist/locale/en.js +1 -1
  56. package/dist/locale/en.min.js +1 -1
  57. package/dist/locale/en.min.mjs +1 -1
  58. package/dist/locale/en.mjs +1 -1
  59. package/dist/locale/eo.js +1 -1
  60. package/dist/locale/eo.min.js +1 -1
  61. package/dist/locale/eo.min.mjs +1 -1
  62. package/dist/locale/eo.mjs +1 -1
  63. package/dist/locale/es.js +1 -1
  64. package/dist/locale/es.min.js +1 -1
  65. package/dist/locale/es.min.mjs +1 -1
  66. package/dist/locale/es.mjs +1 -1
  67. package/dist/locale/et.js +1 -1
  68. package/dist/locale/et.min.js +1 -1
  69. package/dist/locale/et.min.mjs +1 -1
  70. package/dist/locale/et.mjs +1 -1
  71. package/dist/locale/eu.js +1 -1
  72. package/dist/locale/eu.min.js +1 -1
  73. package/dist/locale/eu.min.mjs +1 -1
  74. package/dist/locale/eu.mjs +1 -1
  75. package/dist/locale/fa.js +1 -1
  76. package/dist/locale/fa.min.js +1 -1
  77. package/dist/locale/fa.min.mjs +1 -1
  78. package/dist/locale/fa.mjs +1 -1
  79. package/dist/locale/fi.js +1 -1
  80. package/dist/locale/fi.min.js +1 -1
  81. package/dist/locale/fi.min.mjs +1 -1
  82. package/dist/locale/fi.mjs +1 -1
  83. package/dist/locale/fr.js +1 -1
  84. package/dist/locale/fr.min.js +1 -1
  85. package/dist/locale/fr.min.mjs +1 -1
  86. package/dist/locale/fr.mjs +1 -1
  87. package/dist/locale/he.js +1 -1
  88. package/dist/locale/he.min.js +1 -1
  89. package/dist/locale/he.min.mjs +1 -1
  90. package/dist/locale/he.mjs +1 -1
  91. package/dist/locale/hr.js +1 -1
  92. package/dist/locale/hr.min.js +1 -1
  93. package/dist/locale/hr.min.mjs +1 -1
  94. package/dist/locale/hr.mjs +1 -1
  95. package/dist/locale/hu.js +1 -1
  96. package/dist/locale/hu.min.js +1 -1
  97. package/dist/locale/hu.min.mjs +1 -1
  98. package/dist/locale/hu.mjs +1 -1
  99. package/dist/locale/hy-am.js +1 -1
  100. package/dist/locale/hy-am.min.js +1 -1
  101. package/dist/locale/hy-am.min.mjs +1 -1
  102. package/dist/locale/hy-am.mjs +1 -1
  103. package/dist/locale/id.js +1 -1
  104. package/dist/locale/id.min.js +1 -1
  105. package/dist/locale/id.min.mjs +1 -1
  106. package/dist/locale/id.mjs +1 -1
  107. package/dist/locale/it.js +1 -1
  108. package/dist/locale/it.min.js +1 -1
  109. package/dist/locale/it.min.mjs +1 -1
  110. package/dist/locale/it.mjs +1 -1
  111. package/dist/locale/ja.js +1 -1
  112. package/dist/locale/ja.min.js +1 -1
  113. package/dist/locale/ja.min.mjs +1 -1
  114. package/dist/locale/ja.mjs +1 -1
  115. package/dist/locale/kk.js +1 -1
  116. package/dist/locale/kk.min.js +1 -1
  117. package/dist/locale/kk.min.mjs +1 -1
  118. package/dist/locale/kk.mjs +1 -1
  119. package/dist/locale/km.js +1 -1
  120. package/dist/locale/km.min.js +1 -1
  121. package/dist/locale/km.min.mjs +1 -1
  122. package/dist/locale/km.mjs +1 -1
  123. package/dist/locale/ko.js +1 -1
  124. package/dist/locale/ko.min.js +1 -1
  125. package/dist/locale/ko.min.mjs +1 -1
  126. package/dist/locale/ko.mjs +1 -1
  127. package/dist/locale/ku.js +1 -1
  128. package/dist/locale/ku.min.js +1 -1
  129. package/dist/locale/ku.min.mjs +1 -1
  130. package/dist/locale/ku.mjs +1 -1
  131. package/dist/locale/ky.js +1 -1
  132. package/dist/locale/ky.min.js +1 -1
  133. package/dist/locale/ky.min.mjs +1 -1
  134. package/dist/locale/ky.mjs +1 -1
  135. package/dist/locale/lt.js +1 -1
  136. package/dist/locale/lt.min.js +1 -1
  137. package/dist/locale/lt.min.mjs +1 -1
  138. package/dist/locale/lt.mjs +1 -1
  139. package/dist/locale/lv.js +1 -1
  140. package/dist/locale/lv.min.js +1 -1
  141. package/dist/locale/lv.min.mjs +1 -1
  142. package/dist/locale/lv.mjs +1 -1
  143. package/dist/locale/mg.js +1 -1
  144. package/dist/locale/mg.min.js +1 -1
  145. package/dist/locale/mg.min.mjs +1 -1
  146. package/dist/locale/mg.mjs +1 -1
  147. package/dist/locale/mn.js +1 -1
  148. package/dist/locale/mn.min.js +1 -1
  149. package/dist/locale/mn.min.mjs +1 -1
  150. package/dist/locale/mn.mjs +1 -1
  151. package/dist/locale/nb-no.js +1 -1
  152. package/dist/locale/nb-no.min.js +1 -1
  153. package/dist/locale/nb-no.min.mjs +1 -1
  154. package/dist/locale/nb-no.mjs +1 -1
  155. package/dist/locale/nl.js +1 -1
  156. package/dist/locale/nl.min.js +1 -1
  157. package/dist/locale/nl.min.mjs +1 -1
  158. package/dist/locale/nl.mjs +1 -1
  159. package/dist/locale/pa.js +1 -1
  160. package/dist/locale/pa.min.js +1 -1
  161. package/dist/locale/pa.min.mjs +1 -1
  162. package/dist/locale/pa.mjs +1 -1
  163. package/dist/locale/pl.js +1 -1
  164. package/dist/locale/pl.min.js +1 -1
  165. package/dist/locale/pl.min.mjs +1 -1
  166. package/dist/locale/pl.mjs +1 -1
  167. package/dist/locale/pt-br.js +1 -1
  168. package/dist/locale/pt-br.min.js +1 -1
  169. package/dist/locale/pt-br.min.mjs +1 -1
  170. package/dist/locale/pt-br.mjs +1 -1
  171. package/dist/locale/pt.js +1 -1
  172. package/dist/locale/pt.min.js +1 -1
  173. package/dist/locale/pt.min.mjs +1 -1
  174. package/dist/locale/pt.mjs +1 -1
  175. package/dist/locale/ro.js +1 -1
  176. package/dist/locale/ro.min.js +1 -1
  177. package/dist/locale/ro.min.mjs +1 -1
  178. package/dist/locale/ro.mjs +1 -1
  179. package/dist/locale/ru.js +1 -1
  180. package/dist/locale/ru.min.js +1 -1
  181. package/dist/locale/ru.min.mjs +1 -1
  182. package/dist/locale/ru.mjs +1 -1
  183. package/dist/locale/sk.js +1 -1
  184. package/dist/locale/sk.min.js +1 -1
  185. package/dist/locale/sk.min.mjs +1 -1
  186. package/dist/locale/sk.mjs +1 -1
  187. package/dist/locale/sl.js +1 -1
  188. package/dist/locale/sl.min.js +1 -1
  189. package/dist/locale/sl.min.mjs +1 -1
  190. package/dist/locale/sl.mjs +1 -1
  191. package/dist/locale/sr.js +1 -1
  192. package/dist/locale/sr.min.js +1 -1
  193. package/dist/locale/sr.min.mjs +1 -1
  194. package/dist/locale/sr.mjs +1 -1
  195. package/dist/locale/sv.js +1 -1
  196. package/dist/locale/sv.min.js +1 -1
  197. package/dist/locale/sv.min.mjs +1 -1
  198. package/dist/locale/sv.mjs +1 -1
  199. package/dist/locale/sw.js +1 -1
  200. package/dist/locale/sw.min.js +1 -1
  201. package/dist/locale/sw.min.mjs +1 -1
  202. package/dist/locale/sw.mjs +1 -1
  203. package/dist/locale/ta.js +1 -1
  204. package/dist/locale/ta.min.js +1 -1
  205. package/dist/locale/ta.min.mjs +1 -1
  206. package/dist/locale/ta.mjs +1 -1
  207. package/dist/locale/th.js +1 -1
  208. package/dist/locale/th.min.js +1 -1
  209. package/dist/locale/th.min.mjs +1 -1
  210. package/dist/locale/th.mjs +1 -1
  211. package/dist/locale/tk.js +1 -1
  212. package/dist/locale/tk.min.js +1 -1
  213. package/dist/locale/tk.min.mjs +1 -1
  214. package/dist/locale/tk.mjs +1 -1
  215. package/dist/locale/tr.js +1 -1
  216. package/dist/locale/tr.min.js +1 -1
  217. package/dist/locale/tr.min.mjs +1 -1
  218. package/dist/locale/tr.mjs +1 -1
  219. package/dist/locale/ug-cn.js +1 -1
  220. package/dist/locale/ug-cn.min.js +1 -1
  221. package/dist/locale/ug-cn.min.mjs +1 -1
  222. package/dist/locale/ug-cn.mjs +1 -1
  223. package/dist/locale/uk.js +1 -1
  224. package/dist/locale/uk.min.js +1 -1
  225. package/dist/locale/uk.min.mjs +1 -1
  226. package/dist/locale/uk.mjs +1 -1
  227. package/dist/locale/uz-uz.js +1 -1
  228. package/dist/locale/uz-uz.min.js +1 -1
  229. package/dist/locale/uz-uz.min.mjs +1 -1
  230. package/dist/locale/uz-uz.mjs +1 -1
  231. package/dist/locale/vi.js +1 -1
  232. package/dist/locale/vi.min.js +1 -1
  233. package/dist/locale/vi.min.mjs +1 -1
  234. package/dist/locale/vi.mjs +1 -1
  235. package/dist/locale/zh-cn.js +1 -1
  236. package/dist/locale/zh-cn.min.js +1 -1
  237. package/dist/locale/zh-cn.min.mjs +1 -1
  238. package/dist/locale/zh-cn.mjs +1 -1
  239. package/dist/locale/zh-tw.js +1 -1
  240. package/dist/locale/zh-tw.min.js +1 -1
  241. package/dist/locale/zh-tw.min.mjs +1 -1
  242. package/dist/locale/zh-tw.mjs +1 -1
  243. package/es/components/divider/index.mjs +2 -2
  244. package/es/components/divider/src/divider.mjs +35 -17
  245. package/es/components/divider/src/divider.mjs.map +1 -1
  246. package/es/components/divider/src/divider2.mjs +17 -35
  247. package/es/components/divider/src/divider2.mjs.map +1 -1
  248. package/es/components/form/index.mjs +2 -2
  249. package/es/components/form/src/form.mjs +54 -152
  250. package/es/components/form/src/form.mjs.map +1 -1
  251. package/es/components/form/src/form2.mjs +152 -54
  252. package/es/components/form/src/form2.mjs.map +1 -1
  253. package/es/components/index.mjs +4 -4
  254. package/es/components/menu/index.mjs +2 -2
  255. package/es/components/menu/src/menu-item.mjs +97 -14
  256. package/es/components/menu/src/menu-item.mjs.map +1 -1
  257. package/es/components/menu/src/menu-item2.mjs +14 -97
  258. package/es/components/menu/src/menu-item2.mjs.map +1 -1
  259. package/es/components/scrollbar/index.mjs +1 -1
  260. package/es/components/scrollbar/src/bar2.mjs +1 -1
  261. package/es/components/scrollbar/src/thumb.mjs +11 -130
  262. package/es/components/scrollbar/src/thumb.mjs.map +1 -1
  263. package/es/components/scrollbar/src/thumb2.mjs +130 -11
  264. package/es/components/scrollbar/src/thumb2.mjs.map +1 -1
  265. package/es/components/time-select/index.mjs +1 -1
  266. package/es/components/time-select/src/time-select.mjs +48 -120
  267. package/es/components/time-select/src/time-select.mjs.map +1 -1
  268. package/es/components/time-select/src/time-select2.mjs +120 -48
  269. package/es/components/time-select/src/time-select2.mjs.map +1 -1
  270. package/es/components/tour/src/content.mjs +44 -63
  271. package/es/components/tour/src/content.mjs.map +1 -1
  272. package/es/components/tour/src/content2.mjs +63 -44
  273. package/es/components/tour/src/content2.mjs.map +1 -1
  274. package/es/components/tour/src/step.mjs +1 -1
  275. package/es/components/tour/src/tour.mjs +1 -1
  276. package/es/components/tour/src/tour2.mjs +1 -1
  277. package/es/index.mjs +4 -4
  278. package/es/version.d.ts +1 -1
  279. package/es/version.mjs +1 -1
  280. package/es/version.mjs.map +1 -1
  281. package/lib/components/divider/index.js +2 -2
  282. package/lib/components/divider/src/divider.js +35 -17
  283. package/lib/components/divider/src/divider.js.map +1 -1
  284. package/lib/components/divider/src/divider2.js +17 -35
  285. package/lib/components/divider/src/divider2.js.map +1 -1
  286. package/lib/components/form/index.js +2 -2
  287. package/lib/components/form/src/form.js +54 -151
  288. package/lib/components/form/src/form.js.map +1 -1
  289. package/lib/components/form/src/form2.js +151 -54
  290. package/lib/components/form/src/form2.js.map +1 -1
  291. package/lib/components/index.js +4 -4
  292. package/lib/components/menu/index.js +2 -2
  293. package/lib/components/menu/src/menu-item.js +97 -15
  294. package/lib/components/menu/src/menu-item.js.map +1 -1
  295. package/lib/components/menu/src/menu-item2.js +15 -97
  296. package/lib/components/menu/src/menu-item2.js.map +1 -1
  297. package/lib/components/scrollbar/index.js +1 -1
  298. package/lib/components/scrollbar/src/bar2.js +1 -1
  299. package/lib/components/scrollbar/src/thumb.js +11 -130
  300. package/lib/components/scrollbar/src/thumb.js.map +1 -1
  301. package/lib/components/scrollbar/src/thumb2.js +130 -11
  302. package/lib/components/scrollbar/src/thumb2.js.map +1 -1
  303. package/lib/components/time-select/index.js +1 -1
  304. package/lib/components/time-select/src/time-select.js +48 -125
  305. package/lib/components/time-select/src/time-select.js.map +1 -1
  306. package/lib/components/time-select/src/time-select2.js +125 -48
  307. package/lib/components/time-select/src/time-select2.js.map +1 -1
  308. package/lib/components/tour/src/content.js +45 -63
  309. package/lib/components/tour/src/content.js.map +1 -1
  310. package/lib/components/tour/src/content2.js +63 -45
  311. package/lib/components/tour/src/content2.js.map +1 -1
  312. package/lib/components/tour/src/step.js +1 -1
  313. package/lib/components/tour/src/tour.js +1 -1
  314. package/lib/components/tour/src/tour2.js +1 -1
  315. package/lib/index.js +4 -4
  316. package/lib/version.d.ts +1 -1
  317. package/lib/version.js +1 -1
  318. package/lib/version.js.map +1 -1
  319. package/package.json +1 -1
  320. package/web-types.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"thumb2.mjs","sources":["../../../../../../packages/components/scrollbar/src/thumb.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type Thumb from './thumb.vue'\n\nexport const thumbProps = buildProps({\n vertical: Boolean,\n size: String,\n move: Number,\n ratio: {\n type: Number,\n required: true,\n },\n always: Boolean,\n} as const)\nexport type ThumbProps = ExtractPropTypes<typeof thumbProps>\n\nexport type ThumbInstance = InstanceType<typeof Thumb>\n"],"names":[],"mappings":";;;AACY,MAAC,UAAU,GAAG,UAAU,CAAC;AACrC,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,QAAQ,EAAE,IAAI;AAClB,GAAG;AACH,EAAE,MAAM,EAAE,OAAO;AACjB,CAAC;;;;"}
1
+ {"version":3,"file":"thumb2.mjs","sources":["../../../../../../packages/components/scrollbar/src/thumb.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"always || visible\"\n ref=\"instance\"\n :class=\"[ns.e('bar'), ns.is(bar.key)]\"\n @mousedown=\"clickTrackHandler\"\n >\n <div\n ref=\"thumb\"\n :class=\"ns.e('thumb')\"\n :style=\"thumbStyle\"\n @mousedown=\"clickThumbHandler\"\n />\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, onBeforeUnmount, ref, toRef } from 'vue'\nimport { useEventListener } from '@vueuse/core'\nimport { isClient, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { scrollbarContextKey } from './constants'\nimport { BAR_MAP, renderThumbStyle } from './util'\nimport { thumbProps } from './thumb'\n\nconst COMPONENT_NAME = 'Thumb'\nconst props = defineProps(thumbProps)\n\nconst scrollbar = inject(scrollbarContextKey)\nconst ns = useNamespace('scrollbar')\n\nif (!scrollbar) throwError(COMPONENT_NAME, 'can not inject scrollbar context')\n\nconst instance = ref<HTMLDivElement>()\nconst thumb = ref<HTMLDivElement>()\n\nconst thumbState = ref<Partial<Record<'X' | 'Y', number>>>({})\nconst visible = ref(false)\n\nlet cursorDown = false\nlet cursorLeave = false\nlet originalOnSelectStart:\n | ((this: GlobalEventHandlers, ev: Event) => any)\n | null = isClient ? document.onselectstart : null\n\nconst bar = computed(() => BAR_MAP[props.vertical ? 'vertical' : 'horizontal'])\n\nconst thumbStyle = computed(() =>\n renderThumbStyle({\n size: props.size,\n move: props.move,\n bar: bar.value,\n })\n)\n\nconst offsetRatio = computed(\n () =>\n // offsetRatioX = original width of thumb / current width of thumb / ratioX\n // offsetRatioY = original height of thumb / current height of thumb / ratioY\n // instance height = wrap height - GAP\n instance.value![bar.value.offset] ** 2 /\n scrollbar.wrapElement![bar.value.scrollSize] /\n props.ratio /\n thumb.value![bar.value.offset]\n)\n\nconst clickThumbHandler = (e: MouseEvent) => {\n // prevent click event of middle and right button\n e.stopPropagation()\n if (e.ctrlKey || [1, 2].includes(e.button)) return\n\n window.getSelection()?.removeAllRanges()\n startDrag(e)\n\n const el = e.currentTarget as HTMLDivElement\n if (!el) return\n thumbState.value[bar.value.axis] =\n el[bar.value.offset] -\n (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction])\n}\n\nconst clickTrackHandler = (e: MouseEvent) => {\n if (!thumb.value || !instance.value || !scrollbar.wrapElement) return\n\n const offset = Math.abs(\n (e.target as HTMLElement).getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]\n )\n const thumbHalf = thumb.value[bar.value.offset] / 2\n const thumbPositionPercentage =\n ((offset - thumbHalf) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n scrollbar.wrapElement[bar.value.scroll] =\n (thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n}\n\nconst startDrag = (e: MouseEvent) => {\n e.stopImmediatePropagation()\n cursorDown = true\n document.addEventListener('mousemove', mouseMoveDocumentHandler)\n document.addEventListener('mouseup', mouseUpDocumentHandler)\n originalOnSelectStart = document.onselectstart\n document.onselectstart = () => false\n}\n\nconst mouseMoveDocumentHandler = (e: MouseEvent) => {\n if (!instance.value || !thumb.value) return\n if (cursorDown === false) return\n\n const prevPage = thumbState.value[bar.value.axis]\n if (!prevPage) return\n\n const offset =\n (instance.value.getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]) *\n -1\n const thumbClickPosition = thumb.value[bar.value.offset] - prevPage\n const thumbPositionPercentage =\n ((offset - thumbClickPosition) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n scrollbar.wrapElement[bar.value.scroll] =\n (thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n}\n\nconst mouseUpDocumentHandler = () => {\n cursorDown = false\n thumbState.value[bar.value.axis] = 0\n document.removeEventListener('mousemove', mouseMoveDocumentHandler)\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n restoreOnselectstart()\n if (cursorLeave) visible.value = false\n}\n\nconst mouseMoveScrollbarHandler = () => {\n cursorLeave = false\n visible.value = !!props.size\n}\n\nconst mouseLeaveScrollbarHandler = () => {\n cursorLeave = true\n visible.value = cursorDown\n}\n\nonBeforeUnmount(() => {\n restoreOnselectstart()\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n})\n\nconst restoreOnselectstart = () => {\n if (document.onselectstart !== originalOnSelectStart)\n document.onselectstart = originalOnSelectStart\n}\n\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mousemove',\n mouseMoveScrollbarHandler\n)\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mouseleave',\n mouseLeaveScrollbarHandler\n)\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA8BA,IAAM,MAAA,SAAA,GAAY,OAAO,mBAAmB,CAAA,CAAA;AAC5C,IAAM,MAAA,EAAA,GAAK,aAAa,WAAW,CAAA,CAAA;AAEnC,IAAA,IAAI,CAAC,SAAA;AAAW,MAAA,UAAA,CAAW,gBAAgB,kCAAkC,CAAA,CAAA;AAE7E,IAAA,MAAM,WAAW,GAAoB,EAAA,CAAA;AACrC,IAAA,MAAM,QAAQ,GAAoB,EAAA,CAAA;AAElC,IAAM,MAAA,UAAA,GAAa,GAAwC,CAAA,EAAE,CAAA,CAAA;AAC7D,IAAM,MAAA,OAAA,GAAU,IAAI,KAAK,CAAA,CAAA;AAEzB,IAAA,IAAI,UAAa,GAAA,KAAA,CAAA;AACjB,IAAA,IAAI,WAAc,GAAA,KAAA,CAAA;AAClB,IAAI,IAAA,qBAAA,GAEO,QAAW,GAAA,QAAA,CAAS,aAAgB,GAAA,IAAA,CAAA;AAE/C,IAAA,MAAM,MAAM,QAAS,CAAA,MAAM,QAAQ,KAAM,CAAA,QAAA,GAAW,aAAa,YAAa,CAAA,CAAA,CAAA;AAE9E,IAAM,MA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nC,OAAA,CAAA,KAAA,GAAA,KAAA,CAAA;AAEA,KAAA,CAAA;AACE,IAAc,MAAA,yBAAA,GAAA,MAAA;AACd,MAAQ,WAAA,GAAA,KAAgB,CAAA;AAAA,MAC1B,OAAA,CAAA,KAAA,GAAA,CAAA,CAAA,KAAA,CAAA,IAAA,CAAA;AAEA,KAAA,CAAA;AACE,IAAc,MAAA,0BAAA,GAAA,MAAA;AACd,MAAA,WAAgB,GAAA,IAAA,CAAA;AAAA,MAClB,OAAA,CAAA,KAAA,GAAA,UAAA,CAAA;AAEA,KAAA,CAAA;AACE,IAAqB,eAAA,CAAA,MAAA;AACrB,MAAS,oBAAA,EAAA,CAAA;AAAqD,MAC/D,QAAA,CAAA,mBAAA,CAAA,SAAA,EAAA,sBAAA,CAAA,CAAA;AAED,KAAA,CAAA,CAAA;AACE,IAAA,MAAI,oBAA2B,GAAA,MAAA;AAC7B,MAAA,IAAA,QAAyB,CAAA,aAAA,KAAA,qBAAA;AAAA,QAC7B,QAAA,CAAA,aAAA,GAAA,qBAAA,CAAA;AAEA,KAAA,CAAA;AAKA,IAAA,gBAAA,CACE,KAAM,CAAA,SAAA,EAAW,kBAAkB,CAAA,EACnC,sCAEF,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import TimeSelect from './src/time-select.mjs';
1
+ import TimeSelect from './src/time-select2.mjs';
2
2
 
3
3
  TimeSelect.install = (app) => {
4
4
  app.component(TimeSelect.name, TimeSelect);
@@ -1,126 +1,54 @@
1
- import { defineComponent, ref, computed, openBlock, createBlock, unref, withCtx, normalizeClass, resolveDynamicComponent, createCommentVNode, createElementBlock, Fragment, renderList } from 'vue';
2
- import dayjs from 'dayjs';
3
- import customParseFormat from 'dayjs/plugin/customParseFormat.js';
4
- import { ElSelect } from '../../select/index.mjs';
5
- import '../../form/index.mjs';
6
- import { ElIcon } from '../../icon/index.mjs';
1
+ import '../../../utils/index.mjs';
2
+ import { Clock, CircleClose } from '@element-plus/icons-vue';
7
3
  import '../../../hooks/index.mjs';
8
- import { timeSelectProps } from './time-select2.mjs';
9
- import { parseTime, formatTime, compareTime, nextTime } from './utils.mjs';
10
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
11
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
12
- import { useFormDisabled } from '../../form/src/hooks/use-form-common-props.mjs';
13
- import { useLocale } from '../../../hooks/use-locale/index.mjs';
4
+ import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
5
+ import { useSizeProp } from '../../../hooks/use-size/index.mjs';
14
6
 
15
- const __default__ = defineComponent({
16
- name: "ElTimeSelect"
17
- });
18
- const _sfc_main = /* @__PURE__ */ defineComponent({
19
- ...__default__,
20
- props: timeSelectProps,
21
- emits: ["change", "blur", "focus", "update:modelValue"],
22
- setup(__props, { expose }) {
23
- const props = __props;
24
- dayjs.extend(customParseFormat);
25
- const { Option: ElOption } = ElSelect;
26
- const nsInput = useNamespace("input");
27
- const select = ref();
28
- const _disabled = useFormDisabled();
29
- const { lang } = useLocale();
30
- const value = computed(() => props.modelValue);
31
- const start = computed(() => {
32
- const time = parseTime(props.start);
33
- return time ? formatTime(time) : null;
34
- });
35
- const end = computed(() => {
36
- const time = parseTime(props.end);
37
- return time ? formatTime(time) : null;
38
- });
39
- const step = computed(() => {
40
- const time = parseTime(props.step);
41
- return time ? formatTime(time) : null;
42
- });
43
- const minTime = computed(() => {
44
- const time = parseTime(props.minTime || "");
45
- return time ? formatTime(time) : null;
46
- });
47
- const maxTime = computed(() => {
48
- const time = parseTime(props.maxTime || "");
49
- return time ? formatTime(time) : null;
50
- });
51
- const items = computed(() => {
52
- const result = [];
53
- if (props.start && props.end && props.step) {
54
- let current = start.value;
55
- let currentTime;
56
- while (current && end.value && compareTime(current, end.value) <= 0) {
57
- currentTime = dayjs(current, "HH:mm").locale(lang.value).format(props.format);
58
- result.push({
59
- value: currentTime,
60
- disabled: compareTime(current, minTime.value || "-1:-1") <= 0 || compareTime(current, maxTime.value || "100:100") >= 0
61
- });
62
- current = nextTime(current, step.value);
63
- }
64
- }
65
- return result;
66
- });
67
- const blur = () => {
68
- var _a, _b;
69
- (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
70
- };
71
- const focus = () => {
72
- var _a, _b;
73
- (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
74
- };
75
- expose({
76
- blur,
77
- focus
78
- });
79
- return (_ctx, _cache) => {
80
- return openBlock(), createBlock(unref(ElSelect), {
81
- ref_key: "select",
82
- ref: select,
83
- "model-value": unref(value),
84
- disabled: unref(_disabled),
85
- clearable: _ctx.clearable,
86
- "clear-icon": _ctx.clearIcon,
87
- size: _ctx.size,
88
- effect: _ctx.effect,
89
- placeholder: _ctx.placeholder,
90
- "default-first-option": "",
91
- filterable: _ctx.editable,
92
- "onUpdate:modelValue": _cache[0] || (_cache[0] = (event) => _ctx.$emit("update:modelValue", event)),
93
- onChange: _cache[1] || (_cache[1] = (event) => _ctx.$emit("change", event)),
94
- onBlur: _cache[2] || (_cache[2] = (event) => _ctx.$emit("blur", event)),
95
- onFocus: _cache[3] || (_cache[3] = (event) => _ctx.$emit("focus", event))
96
- }, {
97
- prefix: withCtx(() => [
98
- _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
99
- key: 0,
100
- class: normalizeClass(unref(nsInput).e("prefix-icon"))
101
- }, {
102
- default: withCtx(() => [
103
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
104
- ]),
105
- _: 1
106
- }, 8, ["class"])) : createCommentVNode("v-if", true)
107
- ]),
108
- default: withCtx(() => [
109
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item) => {
110
- return openBlock(), createBlock(unref(ElOption), {
111
- key: item.value,
112
- label: item.value,
113
- value: item.value,
114
- disabled: item.disabled
115
- }, null, 8, ["label", "value", "disabled"]);
116
- }), 128))
117
- ]),
118
- _: 1
119
- }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable"]);
120
- };
7
+ const timeSelectProps = buildProps({
8
+ format: {
9
+ type: String,
10
+ default: "HH:mm"
11
+ },
12
+ modelValue: String,
13
+ disabled: Boolean,
14
+ editable: {
15
+ type: Boolean,
16
+ default: true
17
+ },
18
+ effect: {
19
+ type: String,
20
+ default: "light"
21
+ },
22
+ clearable: {
23
+ type: Boolean,
24
+ default: true
25
+ },
26
+ size: useSizeProp,
27
+ placeholder: String,
28
+ start: {
29
+ type: String,
30
+ default: "09:00"
31
+ },
32
+ end: {
33
+ type: String,
34
+ default: "18:00"
35
+ },
36
+ step: {
37
+ type: String,
38
+ default: "00:30"
39
+ },
40
+ minTime: String,
41
+ maxTime: String,
42
+ name: String,
43
+ prefixIcon: {
44
+ type: definePropType([String, Object]),
45
+ default: () => Clock
46
+ },
47
+ clearIcon: {
48
+ type: definePropType([String, Object]),
49
+ default: () => CircleClose
121
50
  }
122
51
  });
123
- var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "time-select.vue"]]);
124
52
 
125
- export { TimeSelect as default };
53
+ export { timeSelectProps };
126
54
  //# sourceMappingURL=time-select.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"time-select.mjs","sources":["../../../../../../packages/components/time-select/src/time-select.vue"],"sourcesContent":["<template>\n <el-select\n ref=\"select\"\n :model-value=\"value\"\n :disabled=\"_disabled\"\n :clearable=\"clearable\"\n :clear-icon=\"clearIcon\"\n :size=\"size\"\n :effect=\"effect\"\n :placeholder=\"placeholder\"\n default-first-option\n :filterable=\"editable\"\n @update:model-value=\"(event) => $emit('update:modelValue', event)\"\n @change=\"(event) => $emit('change', event)\"\n @blur=\"(event) => $emit('blur', event)\"\n @focus=\"(event) => $emit('focus', event)\"\n >\n <el-option\n v-for=\"item in items\"\n :key=\"item.value\"\n :label=\"item.value\"\n :value=\"item.value\"\n :disabled=\"item.disabled\"\n />\n <template #prefix>\n <el-icon v-if=\"prefixIcon\" :class=\"nsInput.e('prefix-icon')\">\n <component :is=\"prefixIcon\" />\n </el-icon>\n </template>\n </el-select>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref } from 'vue'\nimport dayjs from 'dayjs'\nimport customParseFormat from 'dayjs/plugin/customParseFormat.js'\nimport ElSelect from '@element-plus/components/select'\nimport { useFormDisabled } from '@element-plus/components/form'\nimport ElIcon from '@element-plus/components/icon'\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { timeSelectProps } from './time-select'\nimport { compareTime, formatTime, nextTime, parseTime } from './utils'\n\ndayjs.extend(customParseFormat)\n\nconst { Option: ElOption } = ElSelect\n\ndefineOptions({\n name: 'ElTimeSelect',\n})\n\ndefineEmits(['change', 'blur', 'focus', 'update:modelValue'])\n\nconst props = defineProps(timeSelectProps)\n\nconst nsInput = useNamespace('input')\nconst select = ref<typeof ElSelect>()\n\nconst _disabled = useFormDisabled()\nconst { lang } = useLocale()\n\nconst value = computed(() => props.modelValue)\nconst start = computed(() => {\n const time = parseTime(props.start)\n return time ? formatTime(time) : null\n})\n\nconst end = computed(() => {\n const time = parseTime(props.end)\n return time ? formatTime(time) : null\n})\n\nconst step = computed(() => {\n const time = parseTime(props.step)\n return time ? formatTime(time) : null\n})\n\nconst minTime = computed(() => {\n const time = parseTime(props.minTime || '')\n return time ? formatTime(time) : null\n})\n\nconst maxTime = computed(() => {\n const time = parseTime(props.maxTime || '')\n return time ? formatTime(time) : null\n})\n\nconst items = computed(() => {\n const result: { value: string; disabled: boolean }[] = []\n if (props.start && props.end && props.step) {\n let current = start.value\n let currentTime: string\n while (current && end.value && compareTime(current, end.value) <= 0) {\n currentTime = dayjs(current, 'HH:mm')\n .locale(lang.value)\n .format(props.format)\n result.push({\n value: currentTime,\n disabled:\n compareTime(current, minTime.value || '-1:-1') <= 0 ||\n compareTime(current, maxTime.value || '100:100') >= 0,\n })\n current = nextTime(current, step.value!)\n }\n }\n return result\n})\n\nconst blur = () => {\n select.value?.blur?.()\n}\n\nconst focus = () => {\n select.value?.focus?.()\n}\n\ndefineExpose({\n /**\n * @description focus the Input component\n */\n blur,\n /**\n * @description blur the Input component\n */\n focus,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;mCA+Cc,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AANA,IAAA,KAAA,CAAM,OAAO,iBAAiB,CAAA,CAAA;AAE9B,IAAM,MAAA,EAAE,QAAQ,QAAa,EAAA,GAAA,QAAA,CAAA;AAU7B,IAAM,MAAA,OAAA,GAAU,aAAa,OAAO,CAAA,CAAA;AACpC,IAAA,MAAM,SAAS,GAAqB,EAAA,CAAA;AAEpC,IAAA,MAAM,YAAY,eAAgB,EAAA,CAAA;AAClC,IAAM,MAAA,EAAE,SAAS,SAAU,EAAA,CAAA;AAE3B,IAAA,MAAM,KAAQ,GAAA,QAAA,CAAS,MAAM,KAAA,CAAM,UAAU,CAAA,CAAA;AAC7C,IAAM,MAAA,KAAA,GAAQ,SAAS,MAAM;AAC3B,MAAM,MAAA,IAAA,GAAO,SAAU,CAAA,KAAA,CAAM,KAAK,CAAA,CAAA;AAClC,MAAO,OAAA,IAAA,GAAO,UAAW,CAAA,IAAI,CAAI,GAAA,IAAA,CAAA;AAAA,KAClC,CAAA,CAAA;AAED,IAAM,MAAA,GAAA,GAAM,SAAS,MAAM;AACzB,MAAM,MAAA,IAAA,GAAO,SAAU,CAAA,KAAA,CAAM,GAAG,CAAA,CAAA;AAChC,MAAO,OAAA,IAAA,GAAO,UAAW,CAAA,IAAI,CAAI,GAAA,IAAA,CAAA;AAAA,KAClC,CAAA,CAAA;AAED,IAAM,MAAA,IAAA,GAAO,SAAS,MAAM;AAC1B,MAAM,MAAA,IAAA,GAAO,SAAU,CAAA,KAAA,CAAM,IAAI,CAAA,CAAA;AACjC,MAAO,OAAA,IAAA,GAAO,UAAW,CAAA,IAAI,CAAI,GAAA,I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AAA;AACD,UAAU,OAAA,GAAA,QAAA,CAAS,OAAS,EAAA,IAAA,CAAK,KAAM,CAAA,CAAA;AAAA,SACzC;AAAA,OACF;AACA,MAAO,OAAA,MAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAED,IAAA,MAAM,OAAO,MAAM;AACjB,MAAA,IAAA,EAAA;AAAqB,MACvB,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,MAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AAEA,KAAA,CAAA;AACE,IAAA,MAAA,cAAsB;AAAA,MACxB,IAAA,EAAA,EAAA,EAAA,CAAA;AAEA,MAAa,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,MAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AAAA,KAIX,CAAA;AAAA,IAIA,MAAA,CAAA;AAAA,MACD,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"time-select.mjs","sources":["../../../../../../packages/components/time-select/src/time-select.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport { CircleClose, Clock } from '@element-plus/icons-vue'\nimport { useSizeProp } from '@element-plus/hooks'\nimport type TimeSelect from './time-select.vue'\nimport type { Component, ExtractPropTypes, PropType } from 'vue'\n\nexport const timeSelectProps = buildProps({\n /**\n * @description set format of time\n */\n format: {\n type: String,\n default: 'HH:mm',\n },\n /**\n * @description binding value\n */\n modelValue: String,\n /**\n * @description whether TimeSelect is disabled\n */\n disabled: Boolean,\n /**\n * @description whether the input is editable\n */\n editable: {\n type: Boolean,\n default: true,\n },\n /**\n * @description Tooltip theme, built-in theme: `dark` / `light`\n */\n effect: {\n type: String as PropType<'light' | 'dark' | string>,\n default: 'light',\n },\n /**\n * @description whether to show clear button\n */\n clearable: {\n type: Boolean,\n default: true,\n },\n /**\n * @description size of Input\n */\n size: useSizeProp,\n /**\n * @description placeholder in non-range mode\n */\n placeholder: String,\n /**\n * @description start time\n */\n start: {\n type: String,\n default: '09:00',\n },\n /**\n * @description end time\n */\n end: {\n type: String,\n default: '18:00',\n },\n /**\n * @description time step\n */\n step: {\n type: String,\n default: '00:30',\n },\n /**\n * @description minimum time, any time before this time will be disabled\n */\n minTime: String,\n /**\n * @description maximum time, any time after this time will be disabled\n */\n maxTime: String,\n /**\n * @description same as `name` in native input\n */\n name: String,\n /**\n * @description custom prefix icon component\n */\n prefixIcon: {\n type: definePropType<string | Component>([String, Object]),\n default: () => Clock,\n },\n /**\n * @description custom clear icon component\n */\n clearIcon: {\n type: definePropType<string | Component>([String, Object]),\n default: () => CircleClose,\n },\n} as const)\n\nexport type TimeSelectProps = ExtractPropTypes<typeof timeSelectProps>\n\nexport type TimeSelectInstance = InstanceType<typeof TimeSelect>\n"],"names":[],"mappings":";;;;;;AAGY,MAAC,eAAe,GAAG,UAAU,CAAC;AAC1C,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,UAAU,EAAE,MAAM;AACpB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,WAAW,EAAE,MAAM;AACrB,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,OAAO,EAAE,MAAM;AACjB,EAAE,OAAO,EAAE,MAAM;AACjB,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,IAAI,OAAO,EAAE,MAAM,KAAK;AACxB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,IAAI,OAAO,EAAE,MAAM,WAAW;AAC9B,GAAG;AACH,CAAC;;;;"}
@@ -1,54 +1,126 @@
1
- import '../../../utils/index.mjs';
2
- import { Clock, CircleClose } from '@element-plus/icons-vue';
1
+ import { defineComponent, ref, computed, openBlock, createBlock, unref, withCtx, normalizeClass, resolveDynamicComponent, createCommentVNode, createElementBlock, Fragment, renderList } from 'vue';
2
+ import dayjs from 'dayjs';
3
+ import customParseFormat from 'dayjs/plugin/customParseFormat.js';
4
+ import { ElSelect } from '../../select/index.mjs';
5
+ import '../../form/index.mjs';
6
+ import { ElIcon } from '../../icon/index.mjs';
3
7
  import '../../../hooks/index.mjs';
4
- import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
5
- import { useSizeProp } from '../../../hooks/use-size/index.mjs';
8
+ import { timeSelectProps } from './time-select.mjs';
9
+ import { parseTime, formatTime, compareTime, nextTime } from './utils.mjs';
10
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
11
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
12
+ import { useFormDisabled } from '../../form/src/hooks/use-form-common-props.mjs';
13
+ import { useLocale } from '../../../hooks/use-locale/index.mjs';
6
14
 
7
- const timeSelectProps = buildProps({
8
- format: {
9
- type: String,
10
- default: "HH:mm"
11
- },
12
- modelValue: String,
13
- disabled: Boolean,
14
- editable: {
15
- type: Boolean,
16
- default: true
17
- },
18
- effect: {
19
- type: String,
20
- default: "light"
21
- },
22
- clearable: {
23
- type: Boolean,
24
- default: true
25
- },
26
- size: useSizeProp,
27
- placeholder: String,
28
- start: {
29
- type: String,
30
- default: "09:00"
31
- },
32
- end: {
33
- type: String,
34
- default: "18:00"
35
- },
36
- step: {
37
- type: String,
38
- default: "00:30"
39
- },
40
- minTime: String,
41
- maxTime: String,
42
- name: String,
43
- prefixIcon: {
44
- type: definePropType([String, Object]),
45
- default: () => Clock
46
- },
47
- clearIcon: {
48
- type: definePropType([String, Object]),
49
- default: () => CircleClose
15
+ const __default__ = defineComponent({
16
+ name: "ElTimeSelect"
17
+ });
18
+ const _sfc_main = /* @__PURE__ */ defineComponent({
19
+ ...__default__,
20
+ props: timeSelectProps,
21
+ emits: ["change", "blur", "focus", "update:modelValue"],
22
+ setup(__props, { expose }) {
23
+ const props = __props;
24
+ dayjs.extend(customParseFormat);
25
+ const { Option: ElOption } = ElSelect;
26
+ const nsInput = useNamespace("input");
27
+ const select = ref();
28
+ const _disabled = useFormDisabled();
29
+ const { lang } = useLocale();
30
+ const value = computed(() => props.modelValue);
31
+ const start = computed(() => {
32
+ const time = parseTime(props.start);
33
+ return time ? formatTime(time) : null;
34
+ });
35
+ const end = computed(() => {
36
+ const time = parseTime(props.end);
37
+ return time ? formatTime(time) : null;
38
+ });
39
+ const step = computed(() => {
40
+ const time = parseTime(props.step);
41
+ return time ? formatTime(time) : null;
42
+ });
43
+ const minTime = computed(() => {
44
+ const time = parseTime(props.minTime || "");
45
+ return time ? formatTime(time) : null;
46
+ });
47
+ const maxTime = computed(() => {
48
+ const time = parseTime(props.maxTime || "");
49
+ return time ? formatTime(time) : null;
50
+ });
51
+ const items = computed(() => {
52
+ const result = [];
53
+ if (props.start && props.end && props.step) {
54
+ let current = start.value;
55
+ let currentTime;
56
+ while (current && end.value && compareTime(current, end.value) <= 0) {
57
+ currentTime = dayjs(current, "HH:mm").locale(lang.value).format(props.format);
58
+ result.push({
59
+ value: currentTime,
60
+ disabled: compareTime(current, minTime.value || "-1:-1") <= 0 || compareTime(current, maxTime.value || "100:100") >= 0
61
+ });
62
+ current = nextTime(current, step.value);
63
+ }
64
+ }
65
+ return result;
66
+ });
67
+ const blur = () => {
68
+ var _a, _b;
69
+ (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
70
+ };
71
+ const focus = () => {
72
+ var _a, _b;
73
+ (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
74
+ };
75
+ expose({
76
+ blur,
77
+ focus
78
+ });
79
+ return (_ctx, _cache) => {
80
+ return openBlock(), createBlock(unref(ElSelect), {
81
+ ref_key: "select",
82
+ ref: select,
83
+ "model-value": unref(value),
84
+ disabled: unref(_disabled),
85
+ clearable: _ctx.clearable,
86
+ "clear-icon": _ctx.clearIcon,
87
+ size: _ctx.size,
88
+ effect: _ctx.effect,
89
+ placeholder: _ctx.placeholder,
90
+ "default-first-option": "",
91
+ filterable: _ctx.editable,
92
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = (event) => _ctx.$emit("update:modelValue", event)),
93
+ onChange: _cache[1] || (_cache[1] = (event) => _ctx.$emit("change", event)),
94
+ onBlur: _cache[2] || (_cache[2] = (event) => _ctx.$emit("blur", event)),
95
+ onFocus: _cache[3] || (_cache[3] = (event) => _ctx.$emit("focus", event))
96
+ }, {
97
+ prefix: withCtx(() => [
98
+ _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
99
+ key: 0,
100
+ class: normalizeClass(unref(nsInput).e("prefix-icon"))
101
+ }, {
102
+ default: withCtx(() => [
103
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
104
+ ]),
105
+ _: 1
106
+ }, 8, ["class"])) : createCommentVNode("v-if", true)
107
+ ]),
108
+ default: withCtx(() => [
109
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item) => {
110
+ return openBlock(), createBlock(unref(ElOption), {
111
+ key: item.value,
112
+ label: item.value,
113
+ value: item.value,
114
+ disabled: item.disabled
115
+ }, null, 8, ["label", "value", "disabled"]);
116
+ }), 128))
117
+ ]),
118
+ _: 1
119
+ }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable"]);
120
+ };
50
121
  }
51
122
  });
123
+ var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "time-select.vue"]]);
52
124
 
53
- export { timeSelectProps };
125
+ export { TimeSelect as default };
54
126
  //# sourceMappingURL=time-select2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"time-select2.mjs","sources":["../../../../../../packages/components/time-select/src/time-select.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport { CircleClose, Clock } from '@element-plus/icons-vue'\nimport { useSizeProp } from '@element-plus/hooks'\nimport type TimeSelect from './time-select.vue'\nimport type { Component, ExtractPropTypes, PropType } from 'vue'\n\nexport const timeSelectProps = buildProps({\n /**\n * @description set format of time\n */\n format: {\n type: String,\n default: 'HH:mm',\n },\n /**\n * @description binding value\n */\n modelValue: String,\n /**\n * @description whether TimeSelect is disabled\n */\n disabled: Boolean,\n /**\n * @description whether the input is editable\n */\n editable: {\n type: Boolean,\n default: true,\n },\n /**\n * @description Tooltip theme, built-in theme: `dark` / `light`\n */\n effect: {\n type: String as PropType<'light' | 'dark' | string>,\n default: 'light',\n },\n /**\n * @description whether to show clear button\n */\n clearable: {\n type: Boolean,\n default: true,\n },\n /**\n * @description size of Input\n */\n size: useSizeProp,\n /**\n * @description placeholder in non-range mode\n */\n placeholder: String,\n /**\n * @description start time\n */\n start: {\n type: String,\n default: '09:00',\n },\n /**\n * @description end time\n */\n end: {\n type: String,\n default: '18:00',\n },\n /**\n * @description time step\n */\n step: {\n type: String,\n default: '00:30',\n },\n /**\n * @description minimum time, any time before this time will be disabled\n */\n minTime: String,\n /**\n * @description maximum time, any time after this time will be disabled\n */\n maxTime: String,\n /**\n * @description same as `name` in native input\n */\n name: String,\n /**\n * @description custom prefix icon component\n */\n prefixIcon: {\n type: definePropType<string | Component>([String, Object]),\n default: () => Clock,\n },\n /**\n * @description custom clear icon component\n */\n clearIcon: {\n type: definePropType<string | Component>([String, Object]),\n default: () => CircleClose,\n },\n} as const)\n\nexport type TimeSelectProps = ExtractPropTypes<typeof timeSelectProps>\n\nexport type TimeSelectInstance = InstanceType<typeof TimeSelect>\n"],"names":[],"mappings":";;;;;;AAGY,MAAC,eAAe,GAAG,UAAU,CAAC;AAC1C,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,UAAU,EAAE,MAAM;AACpB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,WAAW,EAAE,MAAM;AACrB,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,OAAO,EAAE,MAAM;AACjB,EAAE,OAAO,EAAE,MAAM;AACjB,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,IAAI,OAAO,EAAE,MAAM,KAAK;AACxB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,IAAI,OAAO,EAAE,MAAM,WAAW;AAC9B,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"time-select2.mjs","sources":["../../../../../../packages/components/time-select/src/time-select.vue"],"sourcesContent":["<template>\n <el-select\n ref=\"select\"\n :model-value=\"value\"\n :disabled=\"_disabled\"\n :clearable=\"clearable\"\n :clear-icon=\"clearIcon\"\n :size=\"size\"\n :effect=\"effect\"\n :placeholder=\"placeholder\"\n default-first-option\n :filterable=\"editable\"\n @update:model-value=\"(event) => $emit('update:modelValue', event)\"\n @change=\"(event) => $emit('change', event)\"\n @blur=\"(event) => $emit('blur', event)\"\n @focus=\"(event) => $emit('focus', event)\"\n >\n <el-option\n v-for=\"item in items\"\n :key=\"item.value\"\n :label=\"item.value\"\n :value=\"item.value\"\n :disabled=\"item.disabled\"\n />\n <template #prefix>\n <el-icon v-if=\"prefixIcon\" :class=\"nsInput.e('prefix-icon')\">\n <component :is=\"prefixIcon\" />\n </el-icon>\n </template>\n </el-select>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref } from 'vue'\nimport dayjs from 'dayjs'\nimport customParseFormat from 'dayjs/plugin/customParseFormat.js'\nimport ElSelect from '@element-plus/components/select'\nimport { useFormDisabled } from '@element-plus/components/form'\nimport ElIcon from '@element-plus/components/icon'\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { timeSelectProps } from './time-select'\nimport { compareTime, formatTime, nextTime, parseTime } from './utils'\n\ndayjs.extend(customParseFormat)\n\nconst { Option: ElOption } = ElSelect\n\ndefineOptions({\n name: 'ElTimeSelect',\n})\n\ndefineEmits(['change', 'blur', 'focus', 'update:modelValue'])\n\nconst props = defineProps(timeSelectProps)\n\nconst nsInput = useNamespace('input')\nconst select = ref<typeof ElSelect>()\n\nconst _disabled = useFormDisabled()\nconst { lang } = useLocale()\n\nconst value = computed(() => props.modelValue)\nconst start = computed(() => {\n const time = parseTime(props.start)\n return time ? formatTime(time) : null\n})\n\nconst end = computed(() => {\n const time = parseTime(props.end)\n return time ? formatTime(time) : null\n})\n\nconst step = computed(() => {\n const time = parseTime(props.step)\n return time ? formatTime(time) : null\n})\n\nconst minTime = computed(() => {\n const time = parseTime(props.minTime || '')\n return time ? formatTime(time) : null\n})\n\nconst maxTime = computed(() => {\n const time = parseTime(props.maxTime || '')\n return time ? formatTime(time) : null\n})\n\nconst items = computed(() => {\n const result: { value: string; disabled: boolean }[] = []\n if (props.start && props.end && props.step) {\n let current = start.value\n let currentTime: string\n while (current && end.value && compareTime(current, end.value) <= 0) {\n currentTime = dayjs(current, 'HH:mm')\n .locale(lang.value)\n .format(props.format)\n result.push({\n value: currentTime,\n disabled:\n compareTime(current, minTime.value || '-1:-1') <= 0 ||\n compareTime(current, maxTime.value || '100:100') >= 0,\n })\n current = nextTime(current, step.value!)\n }\n }\n return result\n})\n\nconst blur = () => {\n select.value?.blur?.()\n}\n\nconst focus = () => {\n select.value?.focus?.()\n}\n\ndefineExpose({\n /**\n * @description focus the Input component\n */\n blur,\n /**\n * @description blur the Input component\n */\n focus,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;mCA+Cc,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CA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A,CAAA,EAAA,GAAA,MAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AAEA,KAAA,CAAA;AACE,IAAA,MAAA,cAAsB;AAAA,MACxB,IAAA,EAAA,EAAA,EAAA,CAAA;AAEA,MAAa,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,MAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AAAA,KAIX,CAAA;AAAA,IAIA,MAAA,CAAA;AAAA,MACD,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,68 +1,49 @@
1
- import { defineComponent, ref, watch, toRef, computed, inject, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, createVNode, withCtx, renderSlot, createCommentVNode } from 'vue';
2
- import '../../focus-trap/index.mjs';
3
- import { tourContentProps, tourContentEmits } from './content2.mjs';
4
- import { useFloating, tourKey } from './helper.mjs';
5
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
6
- import ElFocusTrap from '../../focus-trap/src/focus-trap.mjs';
1
+ import '../../../utils/index.mjs';
2
+ import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
7
3
 
8
- const _hoisted_1 = ["data-side"];
9
- const __default__ = defineComponent({
10
- name: "ElTourContent"
11
- });
12
- const _sfc_main = /* @__PURE__ */ defineComponent({
13
- ...__default__,
14
- props: tourContentProps,
15
- emits: tourContentEmits,
16
- setup(__props, { emit }) {
17
- const props = __props;
18
- const placement = ref(props.placement);
19
- const strategy = ref(props.strategy);
20
- const contentRef = ref(null);
21
- const arrowRef = ref(null);
22
- watch(() => props.placement, () => {
23
- placement.value = props.placement;
24
- });
25
- const { contentStyle, arrowStyle } = useFloating(toRef(props, "reference"), contentRef, arrowRef, placement, strategy, toRef(props, "offset"), toRef(props, "zIndex"), toRef(props, "showArrow"));
26
- const side = computed(() => {
27
- return placement.value.split("-")[0];
28
- });
29
- const { ns } = inject(tourKey);
30
- const onCloseRequested = () => {
31
- emit("close");
32
- };
33
- return (_ctx, _cache) => {
34
- return openBlock(), createElementBlock("div", {
35
- ref_key: "contentRef",
36
- ref: contentRef,
37
- style: normalizeStyle(unref(contentStyle)),
38
- class: normalizeClass(unref(ns).e("content")),
39
- "data-side": unref(side),
40
- tabindex: "-1"
41
- }, [
42
- createVNode(unref(ElFocusTrap), {
43
- loop: "",
44
- trapped: "",
45
- "focus-start-el": "container",
46
- "focus-trap-el": contentRef.value || void 0,
47
- onReleaseRequested: onCloseRequested
48
- }, {
49
- default: withCtx(() => [
50
- renderSlot(_ctx.$slots, "default")
51
- ]),
52
- _: 3
53
- }, 8, ["focus-trap-el"]),
54
- _ctx.showArrow ? (openBlock(), createElementBlock("span", {
55
- key: 0,
56
- ref_key: "arrowRef",
57
- ref: arrowRef,
58
- style: normalizeStyle(unref(arrowStyle)),
59
- class: normalizeClass(unref(ns).e("arrow"))
60
- }, null, 6)) : createCommentVNode("v-if", true)
61
- ], 14, _hoisted_1);
62
- };
4
+ const tourStrategies = ["absolute", "fixed"];
5
+ const tourPlacements = [
6
+ "top-start",
7
+ "top-end",
8
+ "top",
9
+ "bottom-start",
10
+ "bottom-end",
11
+ "bottom",
12
+ "left-start",
13
+ "left-end",
14
+ "left",
15
+ "right-start",
16
+ "right-end",
17
+ "right"
18
+ ];
19
+ const tourContentProps = buildProps({
20
+ placement: {
21
+ type: definePropType(String),
22
+ values: tourPlacements,
23
+ default: "bottom"
24
+ },
25
+ reference: {
26
+ type: definePropType(Object),
27
+ default: null
28
+ },
29
+ strategy: {
30
+ type: definePropType(String),
31
+ values: tourStrategies,
32
+ default: "absolute"
33
+ },
34
+ offset: {
35
+ type: Number,
36
+ default: 10
37
+ },
38
+ showArrow: Boolean,
39
+ zIndex: {
40
+ type: Number,
41
+ default: 2001
63
42
  }
64
43
  });
65
- var ElTourContent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "content.vue"]]);
44
+ const tourContentEmits = {
45
+ close: () => true
46
+ };
66
47
 
67
- export { ElTourContent as default };
48
+ export { tourContentEmits, tourContentProps };
68
49
  //# sourceMappingURL=content.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"content.mjs","sources":["../../../../../../packages/components/tour/src/content.vue"],"sourcesContent":["<template>\n <div\n ref=\"contentRef\"\n :style=\"contentStyle\"\n :class=\"ns.e('content')\"\n :data-side=\"side\"\n tabindex=\"-1\"\n >\n <el-focus-trap\n loop\n trapped\n focus-start-el=\"container\"\n :focus-trap-el=\"contentRef || undefined\"\n @release-requested=\"onCloseRequested\"\n >\n <slot />\n </el-focus-trap>\n <span\n v-if=\"showArrow\"\n ref=\"arrowRef\"\n :style=\"arrowStyle\"\n :class=\"ns.e('arrow')\"\n />\n </div>\n</template>\n<script setup lang=\"ts\">\nimport { computed, inject, ref, toRef, watch } from 'vue'\nimport ElFocusTrap from '@element-plus/components/focus-trap'\nimport { tourContentEmits, tourContentProps } from './content'\nimport { tourKey, useFloating } from './helper'\n\ndefineOptions({\n name: 'ElTourContent',\n})\n\nconst props = defineProps(tourContentProps)\nconst emit = defineEmits(tourContentEmits)\n\nconst placement = ref(props.placement)\nconst strategy = ref(props.strategy)\nconst contentRef = ref<HTMLElement | null>(null)\nconst arrowRef = ref<HTMLElement | null>(null)\n\nwatch(\n () => props.placement,\n () => {\n placement.value = props.placement\n }\n)\n\nconst { contentStyle, arrowStyle } = useFloating(\n toRef(props, 'reference'),\n contentRef,\n arrowRef,\n placement,\n strategy,\n toRef(props, 'offset'),\n toRef(props, 'zIndex'),\n toRef(props, 'showArrow')\n)\n\nconst side = computed(() => {\n return placement.value.split('-')[0]\n})\n\nconst { ns } = inject(tourKey)!\n\nconst onCloseRequested = () => {\n emit('close')\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;mCA+Bc,CAAA;AAAA,EACZ,IAAM,EAAA,eAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,SAAA,GAAY,GAAI,CAAA,KAAA,CAAM,SAAS,CAAA,CAAA;AACrC,IAAM,MAAA,QAAA,GAAW,GAAI,CAAA,KAAA,CAAM,QAAQ,CAAA,CAAA;AACnC,IAAM,MAAA,UAAA,GAAa,IAAwB,IAAI,CAAA,CAAA;AAC/C,IAAM,MAAA,QAAA,GAAW,IAAwB,IAAI,CAAA,CAAA;AAE7C,IACE,KAAA,CAAA,MAAM,KAAM,CAAA,SAAA,EACZ,MAAM;AACJ,MAAA,SAAA,CAAU,QAAQ,KAAM,CAAA,SAAA,CAAA;AAAA,KAE5B,CAAA,CAAA;AAEA,IAAM,MAAA,EAAE,cAAc,UAAe,EAAA,GAAA,WAAA,CACnC,MAAM,KAAO,EAAA,WAAW,CACxB,EAAA,UAAA,EACA,QACA,EAAA,SAAA,EACA,UACA,KAAM,CAAA,KAAA,EAAO,QAAQ,CAAA,EACrB,KAAM,CAAA,KAAA,EAAO,QAAQ,CACrB,EAAA,KAAA,CAAM,KAAO,EAAA,WAAW,CAC1B,CAAA,CAAA;AAEA,IAAM,MAAA,IAAA,GAAO,SAAS,MAAM;AAC1B,MAAA,OAAO,SAAU,CAAA,KAAA,CAAM,KAAM,CAAA,GAAG,CAAE,CAAA,CAAA,CAAA,CAAA;AAAA,KACnC,CAAA,CAAA;AAED,IAAM,MAAA,EAAE,EAAO,EAAA,GAAA,MAAA,CAAO,OAAO,CAAA,CAAA;AAE7B,IAAA,MAAM,mBAAmB,MAAM;AAC7B,MAAA,IAAA,CAAK,OAAO,CAAA,CAAA;AAAA,KACd,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"content.mjs","sources":["../../../../../../packages/components/tour/src/content.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type { Placement, Strategy, VirtualElement } from '@floating-ui/dom'\n\nconst tourStrategies = ['absolute', 'fixed'] as const\n\nconst tourPlacements = [\n 'top-start',\n 'top-end',\n 'top',\n 'bottom-start',\n 'bottom-end',\n 'bottom',\n 'left-start',\n 'left-end',\n 'left',\n 'right-start',\n 'right-end',\n 'right',\n] as const\n\nexport const tourContentProps = buildProps({\n /**\n * @description position of the guide card relative to the target element\n */\n placement: {\n type: definePropType<Placement>(String),\n values: tourPlacements,\n default: 'bottom',\n },\n /**\n * @description the reference dom\n */\n reference: {\n type: definePropType<HTMLElement | VirtualElement | null>(Object),\n default: null,\n },\n /**\n * @description position strategy of the content\n */\n strategy: {\n type: definePropType<Strategy>(String),\n values: tourStrategies,\n default: 'absolute',\n },\n /**\n * @description offset of the arrow\n */\n offset: {\n type: Number,\n default: 10,\n },\n /**\n * @description @description whether to show the arrow\n */\n showArrow: Boolean,\n /**\n * @description content's zIndex\n */\n zIndex: {\n type: Number,\n default: 2001,\n },\n})\n\nexport type TourContentProps = ExtractPropTypes<typeof tourContentProps>\n\nexport const tourContentEmits = {\n close: () => true,\n}\nexport type TourContentEmits = typeof tourContentEmits\n"],"names":[],"mappings":";;;AACA,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC7C,MAAM,cAAc,GAAG;AACvB,EAAE,WAAW;AACb,EAAE,SAAS;AACX,EAAE,KAAK;AACP,EAAE,cAAc;AAChB,EAAE,YAAY;AACd,EAAE,QAAQ;AACV,EAAE,YAAY;AACd,EAAE,UAAU;AACZ,EAAE,MAAM;AACR,EAAE,aAAa;AACf,EAAE,WAAW;AACb,EAAE,OAAO;AACT,CAAC,CAAC;AACU,MAAC,gBAAgB,GAAG,UAAU,CAAC;AAC3C,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,OAAO,EAAE,UAAU;AACvB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,gBAAgB,GAAG;AAChC,EAAE,KAAK,EAAE,MAAM,IAAI;AACnB;;;;"}