element-pe 2.0.6 → 2.0.7

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 (302) hide show
  1. package/dist/index.full.js +1 -1
  2. package/dist/index.full.min.js +1 -1
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +1 -1
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +1 -1
  7. package/es/components/affix/index.mjs +2 -2
  8. package/es/components/affix/src/affix.mjs +114 -23
  9. package/es/components/affix/src/affix.mjs.map +1 -1
  10. package/es/components/affix/src/affix2.mjs +23 -114
  11. package/es/components/affix/src/affix2.mjs.map +1 -1
  12. package/es/components/autocomplete/index.mjs +2 -2
  13. package/es/components/autocomplete/src/autocomplete.mjs +325 -67
  14. package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
  15. package/es/components/autocomplete/src/autocomplete2.mjs +67 -325
  16. package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
  17. package/es/components/backtop/index.mjs +2 -2
  18. package/es/components/backtop/src/backtop.mjs +100 -21
  19. package/es/components/backtop/src/backtop.mjs.map +1 -1
  20. package/es/components/backtop/src/backtop2.mjs +21 -100
  21. package/es/components/backtop/src/backtop2.mjs.map +1 -1
  22. package/es/components/breadcrumb/index.mjs +2 -2
  23. package/es/components/breadcrumb/src/breadcrumb-item.mjs +11 -57
  24. package/es/components/breadcrumb/src/breadcrumb-item.mjs.map +1 -1
  25. package/es/components/breadcrumb/src/breadcrumb-item2.mjs +57 -11
  26. package/es/components/breadcrumb/src/breadcrumb-item2.mjs.map +1 -1
  27. package/es/components/button/index.mjs +3 -3
  28. package/es/components/button/src/button-group.mjs +5 -30
  29. package/es/components/button/src/button-group.mjs.map +1 -1
  30. package/es/components/button/src/button-group2.mjs +30 -5
  31. package/es/components/button/src/button-group2.mjs.map +1 -1
  32. package/es/components/button/src/button.mjs +106 -51
  33. package/es/components/button/src/button.mjs.map +1 -1
  34. package/es/components/button/src/button2.mjs +51 -106
  35. package/es/components/button/src/button2.mjs.map +1 -1
  36. package/es/components/carousel/index.mjs +2 -2
  37. package/es/components/carousel/src/carousel.mjs +48 -319
  38. package/es/components/carousel/src/carousel.mjs.map +1 -1
  39. package/es/components/carousel/src/carousel2.mjs +319 -48
  40. package/es/components/carousel/src/carousel2.mjs.map +1 -1
  41. package/es/components/dialog/index.mjs +2 -2
  42. package/es/components/dialog/src/dialog.mjs +113 -70
  43. package/es/components/dialog/src/dialog.mjs.map +1 -1
  44. package/es/components/dialog/src/dialog2.mjs +70 -113
  45. package/es/components/dialog/src/dialog2.mjs.map +1 -1
  46. package/es/components/drawer/index.mjs +2 -2
  47. package/es/components/drawer/src/drawer.mjs +21 -126
  48. package/es/components/drawer/src/drawer.mjs.map +1 -1
  49. package/es/components/drawer/src/drawer2.mjs +126 -21
  50. package/es/components/drawer/src/drawer2.mjs.map +1 -1
  51. package/es/components/empty/index.mjs +2 -2
  52. package/es/components/empty/src/empty.mjs +11 -56
  53. package/es/components/empty/src/empty.mjs.map +1 -1
  54. package/es/components/empty/src/empty2.mjs +56 -11
  55. package/es/components/empty/src/empty2.mjs.map +1 -1
  56. package/es/components/form/index.mjs +2 -2
  57. package/es/components/form/src/form-item.mjs +43 -272
  58. package/es/components/form/src/form-item.mjs.map +1 -1
  59. package/es/components/form/src/form-item2.mjs +272 -43
  60. package/es/components/form/src/form-item2.mjs.map +1 -1
  61. package/es/components/icon/index.mjs +2 -2
  62. package/es/components/icon/src/icon.mjs +35 -8
  63. package/es/components/icon/src/icon.mjs.map +1 -1
  64. package/es/components/icon/src/icon2.mjs +8 -35
  65. package/es/components/icon/src/icon2.mjs.map +1 -1
  66. package/es/components/index.mjs +26 -26
  67. package/es/components/input/index.mjs +2 -2
  68. package/es/components/input/src/input.mjs +92 -433
  69. package/es/components/input/src/input.mjs.map +1 -1
  70. package/es/components/input/src/input2.mjs +433 -92
  71. package/es/components/input/src/input2.mjs.map +1 -1
  72. package/es/components/input-number/index.mjs +2 -2
  73. package/es/components/input-number/src/input-number.mjs +284 -53
  74. package/es/components/input-number/src/input-number.mjs.map +1 -1
  75. package/es/components/input-number/src/input-number2.mjs +53 -284
  76. package/es/components/input-number/src/input-number2.mjs.map +1 -1
  77. package/es/components/link/index.mjs +2 -2
  78. package/es/components/link/src/link.mjs +49 -22
  79. package/es/components/link/src/link.mjs.map +1 -1
  80. package/es/components/link/src/link2.mjs +22 -49
  81. package/es/components/link/src/link2.mjs.map +1 -1
  82. package/es/components/menu/index.mjs +2 -2
  83. package/es/components/menu/src/menu-item-group.mjs +4 -51
  84. package/es/components/menu/src/menu-item-group.mjs.map +1 -1
  85. package/es/components/menu/src/menu-item-group2.mjs +51 -4
  86. package/es/components/menu/src/menu-item-group2.mjs.map +1 -1
  87. package/es/components/page-header/index.mjs +2 -2
  88. package/es/components/page-header/src/page-header.mjs +60 -17
  89. package/es/components/page-header/src/page-header.mjs.map +1 -1
  90. package/es/components/page-header/src/page-header2.mjs +17 -60
  91. package/es/components/page-header/src/page-header2.mjs.map +1 -1
  92. package/es/components/popconfirm/index.mjs +2 -2
  93. package/es/components/popconfirm/src/popconfirm.mjs +52 -119
  94. package/es/components/popconfirm/src/popconfirm.mjs.map +1 -1
  95. package/es/components/popconfirm/src/popconfirm2.mjs +119 -52
  96. package/es/components/popconfirm/src/popconfirm2.mjs.map +1 -1
  97. package/es/components/popper/index.mjs +2 -2
  98. package/es/components/popper/src/arrow.mjs +37 -7
  99. package/es/components/popper/src/arrow.mjs.map +1 -1
  100. package/es/components/popper/src/arrow2.mjs +7 -37
  101. package/es/components/popper/src/arrow2.mjs.map +1 -1
  102. package/es/components/progress/index.mjs +2 -2
  103. package/es/components/progress/src/progress.mjs +230 -57
  104. package/es/components/progress/src/progress.mjs.map +1 -1
  105. package/es/components/progress/src/progress2.mjs +57 -230
  106. package/es/components/progress/src/progress2.mjs.map +1 -1
  107. package/es/components/radio/index.mjs +2 -2
  108. package/es/components/radio/src/radio-group.mjs +20 -84
  109. package/es/components/radio/src/radio-group.mjs.map +1 -1
  110. package/es/components/radio/src/radio-group2.mjs +84 -20
  111. package/es/components/radio/src/radio-group2.mjs.map +1 -1
  112. package/es/components/rate/index.mjs +2 -2
  113. package/es/components/rate/src/rate.mjs +239 -88
  114. package/es/components/rate/src/rate.mjs.map +1 -1
  115. package/es/components/rate/src/rate2.mjs +88 -239
  116. package/es/components/rate/src/rate2.mjs.map +1 -1
  117. package/es/components/skeleton/index.mjs +2 -2
  118. package/es/components/skeleton/src/skeleton-item.mjs +18 -23
  119. package/es/components/skeleton/src/skeleton-item.mjs.map +1 -1
  120. package/es/components/skeleton/src/skeleton-item2.mjs +23 -18
  121. package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
  122. package/es/components/skeleton/src/skeleton.mjs +1 -1
  123. package/es/components/switch/index.mjs +2 -2
  124. package/es/components/switch/src/switch.mjs +250 -87
  125. package/es/components/switch/src/switch.mjs.map +1 -1
  126. package/es/components/switch/src/switch2.mjs +87 -250
  127. package/es/components/switch/src/switch2.mjs.map +1 -1
  128. package/es/components/tabs/index.mjs +3 -3
  129. package/es/components/tabs/src/tab-bar.mjs +76 -7
  130. package/es/components/tabs/src/tab-bar.mjs.map +1 -1
  131. package/es/components/tabs/src/tab-bar2.mjs +7 -76
  132. package/es/components/tabs/src/tab-bar2.mjs.map +1 -1
  133. package/es/components/tabs/src/tab-nav.mjs +1 -1
  134. package/es/components/tabs/src/tab-pane.mjs +60 -14
  135. package/es/components/tabs/src/tab-pane.mjs.map +1 -1
  136. package/es/components/tabs/src/tab-pane2.mjs +14 -60
  137. package/es/components/tabs/src/tab-pane2.mjs.map +1 -1
  138. package/es/components/teleport/index.mjs +2 -2
  139. package/es/components/teleport/src/teleport.mjs +18 -43
  140. package/es/components/teleport/src/teleport.mjs.map +1 -1
  141. package/es/components/teleport/src/teleport2.mjs +43 -18
  142. package/es/components/teleport/src/teleport2.mjs.map +1 -1
  143. package/es/components/tooltip/src/tooltip2.mjs +2 -2
  144. package/es/components/tooltip-v2/index.mjs +3 -3
  145. package/es/components/tooltip-v2/src/arrow.mjs +22 -38
  146. package/es/components/tooltip-v2/src/arrow.mjs.map +1 -1
  147. package/es/components/tooltip-v2/src/arrow2.mjs +38 -22
  148. package/es/components/tooltip-v2/src/arrow2.mjs.map +1 -1
  149. package/es/components/tooltip-v2/src/tooltip.mjs +20 -73
  150. package/es/components/tooltip-v2/src/tooltip.mjs.map +1 -1
  151. package/es/components/tooltip-v2/src/tooltip2.mjs +73 -20
  152. package/es/components/tooltip-v2/src/tooltip2.mjs.map +1 -1
  153. package/es/index.mjs +26 -26
  154. package/lib/components/affix/index.js +2 -2
  155. package/lib/components/affix/src/affix.js +114 -24
  156. package/lib/components/affix/src/affix.js.map +1 -1
  157. package/lib/components/affix/src/affix2.js +24 -114
  158. package/lib/components/affix/src/affix2.js.map +1 -1
  159. package/lib/components/autocomplete/index.js +2 -2
  160. package/lib/components/autocomplete/src/autocomplete.js +324 -67
  161. package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
  162. package/lib/components/autocomplete/src/autocomplete2.js +67 -324
  163. package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
  164. package/lib/components/backtop/index.js +2 -2
  165. package/lib/components/backtop/src/backtop.js +100 -22
  166. package/lib/components/backtop/src/backtop.js.map +1 -1
  167. package/lib/components/backtop/src/backtop2.js +22 -100
  168. package/lib/components/backtop/src/backtop2.js.map +1 -1
  169. package/lib/components/breadcrumb/index.js +2 -2
  170. package/lib/components/breadcrumb/src/breadcrumb-item.js +11 -57
  171. package/lib/components/breadcrumb/src/breadcrumb-item.js.map +1 -1
  172. package/lib/components/breadcrumb/src/breadcrumb-item2.js +57 -11
  173. package/lib/components/breadcrumb/src/breadcrumb-item2.js.map +1 -1
  174. package/lib/components/button/index.js +3 -3
  175. package/lib/components/button/src/button-group.js +5 -30
  176. package/lib/components/button/src/button-group.js.map +1 -1
  177. package/lib/components/button/src/button-group2.js +30 -5
  178. package/lib/components/button/src/button-group2.js.map +1 -1
  179. package/lib/components/button/src/button.js +106 -54
  180. package/lib/components/button/src/button.js.map +1 -1
  181. package/lib/components/button/src/button2.js +54 -106
  182. package/lib/components/button/src/button2.js.map +1 -1
  183. package/lib/components/carousel/index.js +2 -2
  184. package/lib/components/carousel/src/carousel.js +49 -319
  185. package/lib/components/carousel/src/carousel.js.map +1 -1
  186. package/lib/components/carousel/src/carousel2.js +319 -49
  187. package/lib/components/carousel/src/carousel2.js.map +1 -1
  188. package/lib/components/dialog/index.js +2 -2
  189. package/lib/components/dialog/src/dialog.js +113 -71
  190. package/lib/components/dialog/src/dialog.js.map +1 -1
  191. package/lib/components/dialog/src/dialog2.js +71 -113
  192. package/lib/components/dialog/src/dialog2.js.map +1 -1
  193. package/lib/components/drawer/index.js +2 -2
  194. package/lib/components/drawer/src/drawer.js +22 -126
  195. package/lib/components/drawer/src/drawer.js.map +1 -1
  196. package/lib/components/drawer/src/drawer2.js +126 -22
  197. package/lib/components/drawer/src/drawer2.js.map +1 -1
  198. package/lib/components/empty/index.js +2 -2
  199. package/lib/components/empty/src/empty.js +11 -56
  200. package/lib/components/empty/src/empty.js.map +1 -1
  201. package/lib/components/empty/src/empty2.js +56 -11
  202. package/lib/components/empty/src/empty2.js.map +1 -1
  203. package/lib/components/form/index.js +2 -2
  204. package/lib/components/form/src/form-item.js +44 -276
  205. package/lib/components/form/src/form-item.js.map +1 -1
  206. package/lib/components/form/src/form-item2.js +276 -44
  207. package/lib/components/form/src/form-item2.js.map +1 -1
  208. package/lib/components/icon/index.js +2 -2
  209. package/lib/components/icon/src/icon.js +35 -8
  210. package/lib/components/icon/src/icon.js.map +1 -1
  211. package/lib/components/icon/src/icon2.js +8 -35
  212. package/lib/components/icon/src/icon2.js.map +1 -1
  213. package/lib/components/index.js +26 -26
  214. package/lib/components/input/index.js +2 -2
  215. package/lib/components/input/src/input.js +92 -432
  216. package/lib/components/input/src/input.js.map +1 -1
  217. package/lib/components/input/src/input2.js +432 -92
  218. package/lib/components/input/src/input2.js.map +1 -1
  219. package/lib/components/input-number/index.js +2 -2
  220. package/lib/components/input-number/src/input-number.js +284 -54
  221. package/lib/components/input-number/src/input-number.js.map +1 -1
  222. package/lib/components/input-number/src/input-number2.js +54 -284
  223. package/lib/components/input-number/src/input-number2.js.map +1 -1
  224. package/lib/components/link/index.js +2 -2
  225. package/lib/components/link/src/link.js +49 -23
  226. package/lib/components/link/src/link.js.map +1 -1
  227. package/lib/components/link/src/link2.js +23 -49
  228. package/lib/components/link/src/link2.js.map +1 -1
  229. package/lib/components/menu/index.js +2 -2
  230. package/lib/components/menu/src/menu-item-group.js +4 -51
  231. package/lib/components/menu/src/menu-item-group.js.map +1 -1
  232. package/lib/components/menu/src/menu-item-group2.js +51 -4
  233. package/lib/components/menu/src/menu-item-group2.js.map +1 -1
  234. package/lib/components/page-header/index.js +2 -2
  235. package/lib/components/page-header/src/page-header.js +60 -18
  236. package/lib/components/page-header/src/page-header.js.map +1 -1
  237. package/lib/components/page-header/src/page-header2.js +18 -60
  238. package/lib/components/page-header/src/page-header2.js.map +1 -1
  239. package/lib/components/popconfirm/index.js +2 -2
  240. package/lib/components/popconfirm/src/popconfirm.js +52 -119
  241. package/lib/components/popconfirm/src/popconfirm.js.map +1 -1
  242. package/lib/components/popconfirm/src/popconfirm2.js +119 -52
  243. package/lib/components/popconfirm/src/popconfirm2.js.map +1 -1
  244. package/lib/components/popper/index.js +2 -2
  245. package/lib/components/popper/src/arrow.js +37 -7
  246. package/lib/components/popper/src/arrow.js.map +1 -1
  247. package/lib/components/popper/src/arrow2.js +7 -37
  248. package/lib/components/popper/src/arrow2.js.map +1 -1
  249. package/lib/components/progress/index.js +2 -2
  250. package/lib/components/progress/src/progress.js +230 -57
  251. package/lib/components/progress/src/progress.js.map +1 -1
  252. package/lib/components/progress/src/progress2.js +57 -230
  253. package/lib/components/progress/src/progress2.js.map +1 -1
  254. package/lib/components/radio/index.js +2 -2
  255. package/lib/components/radio/src/radio-group.js +21 -84
  256. package/lib/components/radio/src/radio-group.js.map +1 -1
  257. package/lib/components/radio/src/radio-group2.js +84 -21
  258. package/lib/components/radio/src/radio-group2.js.map +1 -1
  259. package/lib/components/rate/index.js +2 -2
  260. package/lib/components/rate/src/rate.js +239 -89
  261. package/lib/components/rate/src/rate.js.map +1 -1
  262. package/lib/components/rate/src/rate2.js +89 -239
  263. package/lib/components/rate/src/rate2.js.map +1 -1
  264. package/lib/components/skeleton/index.js +2 -2
  265. package/lib/components/skeleton/src/skeleton-item.js +18 -23
  266. package/lib/components/skeleton/src/skeleton-item.js.map +1 -1
  267. package/lib/components/skeleton/src/skeleton-item2.js +23 -18
  268. package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
  269. package/lib/components/skeleton/src/skeleton.js +1 -1
  270. package/lib/components/switch/index.js +2 -2
  271. package/lib/components/switch/src/switch.js +249 -87
  272. package/lib/components/switch/src/switch.js.map +1 -1
  273. package/lib/components/switch/src/switch2.js +87 -249
  274. package/lib/components/switch/src/switch2.js.map +1 -1
  275. package/lib/components/tabs/index.js +3 -3
  276. package/lib/components/tabs/src/tab-bar.js +76 -7
  277. package/lib/components/tabs/src/tab-bar.js.map +1 -1
  278. package/lib/components/tabs/src/tab-bar2.js +7 -76
  279. package/lib/components/tabs/src/tab-bar2.js.map +1 -1
  280. package/lib/components/tabs/src/tab-nav.js +1 -1
  281. package/lib/components/tabs/src/tab-pane.js +60 -14
  282. package/lib/components/tabs/src/tab-pane.js.map +1 -1
  283. package/lib/components/tabs/src/tab-pane2.js +14 -60
  284. package/lib/components/tabs/src/tab-pane2.js.map +1 -1
  285. package/lib/components/teleport/index.js +2 -2
  286. package/lib/components/teleport/src/teleport.js +18 -43
  287. package/lib/components/teleport/src/teleport.js.map +1 -1
  288. package/lib/components/teleport/src/teleport2.js +43 -18
  289. package/lib/components/teleport/src/teleport2.js.map +1 -1
  290. package/lib/components/tooltip/src/tooltip2.js +2 -2
  291. package/lib/components/tooltip-v2/index.js +3 -3
  292. package/lib/components/tooltip-v2/src/arrow.js +23 -38
  293. package/lib/components/tooltip-v2/src/arrow.js.map +1 -1
  294. package/lib/components/tooltip-v2/src/arrow2.js +38 -23
  295. package/lib/components/tooltip-v2/src/arrow2.js.map +1 -1
  296. package/lib/components/tooltip-v2/src/tooltip.js +20 -73
  297. package/lib/components/tooltip-v2/src/tooltip.js.map +1 -1
  298. package/lib/components/tooltip-v2/src/tooltip2.js +73 -20
  299. package/lib/components/tooltip-v2/src/tooltip2.js.map +1 -1
  300. package/lib/index.js +26 -26
  301. package/package.json +1 -1
  302. package/web-types.json +1 -1
@@ -25673,12 +25673,12 @@ const _sfc_main$X = defineComponent({
25673
25673
  }
25674
25674
  data.userInput = null;
25675
25675
  emit("update:modelValue", newVal);
25676
- emit("input", newVal);
25677
25676
  emit("change", newVal, oldVal);
25678
25677
  (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
25679
25678
  data.currentValue = newVal;
25680
25679
  };
25681
25680
  const handleInput = (value) => {
25681
+ emit("input", value);
25682
25682
  return data.userInput = value;
25683
25683
  };
25684
25684
  const handleInputChange = (value) => {
@@ -1,6 +1,6 @@
1
1
  import '../../utils/index.mjs';
2
- import Affix from './src/affix2.mjs';
3
- export { affixEmits, affixProps } from './src/affix.mjs';
2
+ import Affix from './src/affix.mjs';
3
+ export { affixEmits, affixProps } from './src/affix2.mjs';
4
4
  import { withInstall } from '../../utils/vue/install.mjs';
5
5
 
6
6
  const ElAffix = withInstall(Affix);
@@ -1,29 +1,120 @@
1
+ import { defineComponent, shallowRef, ref, computed, watch, onMounted, watchEffect, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createElementVNode, renderSlot } from 'vue';
2
+ import { useWindowSize, useElementBounding, useEventListener } from '@vueuse/core';
1
3
  import '../../../utils/index.mjs';
2
- import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
4
+ import '../../../hooks/index.mjs';
5
+ import { affixProps, affixEmits } from './affix2.mjs';
6
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
7
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
8
+ import { throwError } from '../../../utils/error.mjs';
9
+ import { getScrollContainer } from '../../../utils/dom/scroll.mjs';
3
10
 
4
- const affixProps = buildProps({
5
- zIndex: {
6
- type: definePropType([Number, String]),
7
- default: 100
8
- },
9
- target: {
10
- type: String,
11
- default: ""
12
- },
13
- offset: {
14
- type: Number,
15
- default: 0
16
- },
17
- position: {
18
- type: String,
19
- values: ["top", "bottom"],
20
- default: "top"
11
+ const __default__ = {
12
+ name: "ElAffix"
13
+ };
14
+ const _sfc_main = /* @__PURE__ */ defineComponent({
15
+ ...__default__,
16
+ props: affixProps,
17
+ emits: affixEmits,
18
+ setup(__props, { expose, emit }) {
19
+ const props = __props;
20
+ const COMPONENT_NAME = "ElAffix";
21
+ const ns = useNamespace("affix");
22
+ const target = shallowRef();
23
+ const root = shallowRef();
24
+ const scrollContainer = shallowRef();
25
+ const { height: windowHeight } = useWindowSize();
26
+ const {
27
+ height: rootHeight,
28
+ width: rootWidth,
29
+ top: rootTop,
30
+ bottom: rootBottom,
31
+ update: updateRoot
32
+ } = useElementBounding(root);
33
+ const targetRect = useElementBounding(target);
34
+ const fixed = ref(false);
35
+ const scrollTop = ref(0);
36
+ const transform = ref(0);
37
+ const rootStyle = computed(() => {
38
+ return {
39
+ height: fixed.value ? `${rootHeight.value}px` : "",
40
+ width: fixed.value ? `${rootWidth.value}px` : ""
41
+ };
42
+ });
43
+ const affixStyle = computed(() => {
44
+ if (!fixed.value)
45
+ return {};
46
+ const offset = props.offset ? `${props.offset}px` : 0;
47
+ return {
48
+ height: `${rootHeight.value}px`,
49
+ width: `${rootWidth.value}px`,
50
+ top: props.position === "top" ? offset : "",
51
+ bottom: props.position === "bottom" ? offset : "",
52
+ transform: transform.value ? `translateY(${transform.value}px)` : "",
53
+ zIndex: props.zIndex
54
+ };
55
+ });
56
+ const update = () => {
57
+ if (!scrollContainer.value)
58
+ return;
59
+ scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
60
+ if (props.position === "top") {
61
+ if (props.target) {
62
+ const difference = targetRect.bottom.value - props.offset - rootHeight.value;
63
+ fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0;
64
+ transform.value = difference < 0 ? difference : 0;
65
+ } else {
66
+ fixed.value = props.offset > rootTop.value;
67
+ }
68
+ } else if (props.target) {
69
+ const difference = windowHeight.value - targetRect.top.value - props.offset - rootHeight.value;
70
+ fixed.value = windowHeight.value - props.offset < rootBottom.value && windowHeight.value > targetRect.top.value;
71
+ transform.value = difference < 0 ? -difference : 0;
72
+ } else {
73
+ fixed.value = windowHeight.value - props.offset < rootBottom.value;
74
+ }
75
+ };
76
+ const handleScroll = () => {
77
+ emit("scroll", {
78
+ scrollTop: scrollTop.value,
79
+ fixed: fixed.value
80
+ });
81
+ };
82
+ watch(fixed, (val) => emit("change", val));
83
+ onMounted(() => {
84
+ var _a;
85
+ if (props.target) {
86
+ target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
87
+ if (!target.value)
88
+ throwError(COMPONENT_NAME, `Target is not existed: ${props.target}`);
89
+ } else {
90
+ target.value = document.documentElement;
91
+ }
92
+ scrollContainer.value = getScrollContainer(root.value, true);
93
+ updateRoot();
94
+ });
95
+ useEventListener(scrollContainer, "scroll", handleScroll);
96
+ watchEffect(update);
97
+ expose({
98
+ update
99
+ });
100
+ return (_ctx, _cache) => {
101
+ return openBlock(), createElementBlock("div", {
102
+ ref_key: "root",
103
+ ref: root,
104
+ class: normalizeClass(unref(ns).b()),
105
+ style: normalizeStyle(unref(rootStyle))
106
+ }, [
107
+ createElementVNode("div", {
108
+ class: normalizeClass({ [unref(ns).m("fixed")]: fixed.value }),
109
+ style: normalizeStyle(unref(affixStyle))
110
+ }, [
111
+ renderSlot(_ctx.$slots, "default")
112
+ ], 6)
113
+ ], 6);
114
+ };
21
115
  }
22
116
  });
23
- const affixEmits = {
24
- scroll: ({ scrollTop, fixed }) => typeof scrollTop === "number" && typeof fixed === "boolean",
25
- change: (fixed) => typeof fixed === "boolean"
26
- };
117
+ var Affix = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-pe/packages/components/affix/src/affix.vue"]]);
27
118
 
28
- export { affixEmits, affixProps };
119
+ export { Affix as default };
29
120
  //# sourceMappingURL=affix.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"affix.mjs","sources":["../../../../../../packages/components/affix/src/affix.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type { ZIndexProperty } from 'csstype'\nimport type Affix from './affix.vue'\n\nexport const affixProps = buildProps({\n zIndex: {\n type: definePropType<ZIndexProperty>([Number, String]),\n default: 100,\n },\n target: {\n type: String,\n default: '',\n },\n offset: {\n type: Number,\n default: 0,\n },\n position: {\n type: String,\n values: ['top', 'bottom'],\n default: 'top',\n },\n} as const)\nexport type AffixProps = ExtractPropTypes<typeof affixProps>\n\nexport const affixEmits = {\n scroll: ({ scrollTop, fixed }: { scrollTop: number; fixed: boolean }) =>\n typeof scrollTop === 'number' && typeof fixed === 'boolean',\n change: (fixed: boolean) => typeof fixed === 'boolean',\n}\nexport type AffixEmits = typeof affixEmits\n\nexport type AffixInstance = InstanceType<typeof Affix>\n"],"names":[],"mappings":";;;AACY,MAAC,UAAU,GAAG,UAAU,CAAC;AACrC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC7B,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,UAAU,GAAG;AAC1B,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,OAAO,SAAS,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS;AAC/F,EAAE,MAAM,EAAE,CAAC,KAAK,KAAK,OAAO,KAAK,KAAK,SAAS;AAC/C;;;;"}
1
+ {"version":3,"file":"affix.mjs","sources":["../../../../../../packages/components/affix/src/affix.vue"],"sourcesContent":["<template>\n <div ref=\"root\" :class=\"ns.b()\" :style=\"rootStyle\">\n <div :class=\"{ [ns.m('fixed')]: fixed }\" :style=\"affixStyle\">\n <slot />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, onMounted, ref, shallowRef, watch, watchEffect } from 'vue'\nimport {\n useElementBounding,\n useEventListener,\n useWindowSize,\n} from '@vueuse/core'\nimport { getScrollContainer, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { affixEmits, affixProps } from './affix'\nimport type { CSSProperties } from 'vue'\n\nconst COMPONENT_NAME = 'ElAffix'\ndefineOptions({\n name: 'ElAffix',\n})\n\nconst props = defineProps(affixProps)\nconst emit = defineEmits(affixEmits)\n\nconst ns = useNamespace('affix')\n\nconst target = shallowRef<HTMLElement>()\nconst root = shallowRef<HTMLDivElement>()\nconst scrollContainer = shallowRef<HTMLElement | Window>()\nconst { height: windowHeight } = useWindowSize()\nconst {\n height: rootHeight,\n width: rootWidth,\n top: rootTop,\n bottom: rootBottom,\n update: updateRoot,\n} = useElementBounding(root)\nconst targetRect = useElementBounding(target)\n\nconst fixed = ref(false)\nconst scrollTop = ref(0)\nconst transform = ref(0)\n\nconst rootStyle = computed<CSSProperties>(() => {\n return {\n height: fixed.value ? `${rootHeight.value}px` : '',\n width: fixed.value ? `${rootWidth.value}px` : '',\n }\n})\n\nconst affixStyle = computed<CSSProperties>(() => {\n if (!fixed.value) return {}\n\n const offset = props.offset ? `${props.offset}px` : 0\n return {\n height: `${rootHeight.value}px`,\n width: `${rootWidth.value}px`,\n top: props.position === 'top' ? offset : '',\n bottom: props.position === 'bottom' ? offset : '',\n transform: transform.value ? `translateY(${transform.value}px)` : '',\n zIndex: props.zIndex,\n }\n})\n\nconst update = () => {\n if (!scrollContainer.value) return\n\n scrollTop.value =\n scrollContainer.value instanceof Window\n ? document.documentElement.scrollTop\n : scrollContainer.value.scrollTop || 0\n\n if (props.position === 'top') {\n if (props.target) {\n const difference =\n targetRect.bottom.value - props.offset - rootHeight.value\n fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0\n transform.value = difference < 0 ? difference : 0\n } else {\n fixed.value = props.offset > rootTop.value\n }\n } else if (props.target) {\n const difference =\n windowHeight.value -\n targetRect.top.value -\n props.offset -\n rootHeight.value\n fixed.value =\n windowHeight.value - props.offset < rootBottom.value &&\n windowHeight.value > targetRect.top.value\n transform.value = difference < 0 ? -difference : 0\n } else {\n fixed.value = windowHeight.value - props.offset < rootBottom.value\n }\n}\n\nconst handleScroll = () => {\n emit('scroll', {\n scrollTop: scrollTop.value,\n fixed: fixed.value,\n })\n}\n\nwatch(fixed, (val) => emit('change', val))\n\nonMounted(() => {\n if (props.target) {\n target.value =\n document.querySelector<HTMLElement>(props.target) ?? undefined\n if (!target.value)\n throwError(COMPONENT_NAME, `Target is not existed: ${props.target}`)\n } else {\n target.value = document.documentElement\n }\n scrollContainer.value = getScrollContainer(root.value!, true)\n updateRoot()\n})\n\nuseEventListener(scrollContainer, 'scroll', handleScroll)\nwatchEffect(update)\n\ndefineExpose({\n /** @description update affix status */\n update,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,IAAA,MAAA,cAA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A;AACA,MAAA,eAAA,CAAA,KAAA,GAAA,kBAAA,CAAA,IAAA,CAAA,KAAA,EAAA,IAAA,CAAA,CAAA;AAAA,MACA,UAAA,EAAA,CAAA;AAEA,KAAA,CAAA,CAAA;AACA,IAAA,gBAAA,CAAA,eAAA,EAAA,QAAA,EAAA,YAAA,CAAA,CAAA;AAEA,IAAA,WAAA,CAAA,MAAA,CAAA,CAAA;AAAA,IAEA,MAAA,CAAA;AAAA,MACA,MAAA;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,120 +1,29 @@
1
- import { defineComponent, shallowRef, ref, computed, watch, onMounted, watchEffect, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, createElementVNode, renderSlot } from 'vue';
2
- import { useWindowSize, useElementBounding, useEventListener } from '@vueuse/core';
3
1
  import '../../../utils/index.mjs';
4
- import '../../../hooks/index.mjs';
5
- import { affixProps, affixEmits } from './affix.mjs';
6
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
7
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
8
- import { throwError } from '../../../utils/error.mjs';
9
- import { getScrollContainer } from '../../../utils/dom/scroll.mjs';
2
+ import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
10
3
 
11
- const __default__ = {
12
- name: "ElAffix"
13
- };
14
- const _sfc_main = /* @__PURE__ */ defineComponent({
15
- ...__default__,
16
- props: affixProps,
17
- emits: affixEmits,
18
- setup(__props, { expose, emit }) {
19
- const props = __props;
20
- const COMPONENT_NAME = "ElAffix";
21
- const ns = useNamespace("affix");
22
- const target = shallowRef();
23
- const root = shallowRef();
24
- const scrollContainer = shallowRef();
25
- const { height: windowHeight } = useWindowSize();
26
- const {
27
- height: rootHeight,
28
- width: rootWidth,
29
- top: rootTop,
30
- bottom: rootBottom,
31
- update: updateRoot
32
- } = useElementBounding(root);
33
- const targetRect = useElementBounding(target);
34
- const fixed = ref(false);
35
- const scrollTop = ref(0);
36
- const transform = ref(0);
37
- const rootStyle = computed(() => {
38
- return {
39
- height: fixed.value ? `${rootHeight.value}px` : "",
40
- width: fixed.value ? `${rootWidth.value}px` : ""
41
- };
42
- });
43
- const affixStyle = computed(() => {
44
- if (!fixed.value)
45
- return {};
46
- const offset = props.offset ? `${props.offset}px` : 0;
47
- return {
48
- height: `${rootHeight.value}px`,
49
- width: `${rootWidth.value}px`,
50
- top: props.position === "top" ? offset : "",
51
- bottom: props.position === "bottom" ? offset : "",
52
- transform: transform.value ? `translateY(${transform.value}px)` : "",
53
- zIndex: props.zIndex
54
- };
55
- });
56
- const update = () => {
57
- if (!scrollContainer.value)
58
- return;
59
- scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
60
- if (props.position === "top") {
61
- if (props.target) {
62
- const difference = targetRect.bottom.value - props.offset - rootHeight.value;
63
- fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0;
64
- transform.value = difference < 0 ? difference : 0;
65
- } else {
66
- fixed.value = props.offset > rootTop.value;
67
- }
68
- } else if (props.target) {
69
- const difference = windowHeight.value - targetRect.top.value - props.offset - rootHeight.value;
70
- fixed.value = windowHeight.value - props.offset < rootBottom.value && windowHeight.value > targetRect.top.value;
71
- transform.value = difference < 0 ? -difference : 0;
72
- } else {
73
- fixed.value = windowHeight.value - props.offset < rootBottom.value;
74
- }
75
- };
76
- const handleScroll = () => {
77
- emit("scroll", {
78
- scrollTop: scrollTop.value,
79
- fixed: fixed.value
80
- });
81
- };
82
- watch(fixed, (val) => emit("change", val));
83
- onMounted(() => {
84
- var _a;
85
- if (props.target) {
86
- target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
87
- if (!target.value)
88
- throwError(COMPONENT_NAME, `Target is not existed: ${props.target}`);
89
- } else {
90
- target.value = document.documentElement;
91
- }
92
- scrollContainer.value = getScrollContainer(root.value, true);
93
- updateRoot();
94
- });
95
- useEventListener(scrollContainer, "scroll", handleScroll);
96
- watchEffect(update);
97
- expose({
98
- update
99
- });
100
- return (_ctx, _cache) => {
101
- return openBlock(), createElementBlock("div", {
102
- ref_key: "root",
103
- ref: root,
104
- class: normalizeClass(unref(ns).b()),
105
- style: normalizeStyle(unref(rootStyle))
106
- }, [
107
- createElementVNode("div", {
108
- class: normalizeClass({ [unref(ns).m("fixed")]: fixed.value }),
109
- style: normalizeStyle(unref(affixStyle))
110
- }, [
111
- renderSlot(_ctx.$slots, "default")
112
- ], 6)
113
- ], 6);
114
- };
4
+ const affixProps = buildProps({
5
+ zIndex: {
6
+ type: definePropType([Number, String]),
7
+ default: 100
8
+ },
9
+ target: {
10
+ type: String,
11
+ default: ""
12
+ },
13
+ offset: {
14
+ type: Number,
15
+ default: 0
16
+ },
17
+ position: {
18
+ type: String,
19
+ values: ["top", "bottom"],
20
+ default: "top"
115
21
  }
116
22
  });
117
- var Affix = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-pe/packages/components/affix/src/affix.vue"]]);
23
+ const affixEmits = {
24
+ scroll: ({ scrollTop, fixed }) => typeof scrollTop === "number" && typeof fixed === "boolean",
25
+ change: (fixed) => typeof fixed === "boolean"
26
+ };
118
27
 
119
- export { Affix as default };
28
+ export { affixEmits, affixProps };
120
29
  //# sourceMappingURL=affix2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"affix2.mjs","sources":["../../../../../../packages/components/affix/src/affix.vue"],"sourcesContent":["<template>\n <div ref=\"root\" :class=\"ns.b()\" :style=\"rootStyle\">\n <div :class=\"{ [ns.m('fixed')]: fixed }\" :style=\"affixStyle\">\n <slot />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, onMounted, ref, shallowRef, watch, watchEffect } from 'vue'\nimport {\n useElementBounding,\n useEventListener,\n useWindowSize,\n} from '@vueuse/core'\nimport { getScrollContainer, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { affixEmits, affixProps } from './affix'\nimport type { CSSProperties } from 'vue'\n\nconst COMPONENT_NAME = 'ElAffix'\ndefineOptions({\n name: 'ElAffix',\n})\n\nconst props = defineProps(affixProps)\nconst emit = defineEmits(affixEmits)\n\nconst ns = useNamespace('affix')\n\nconst target = shallowRef<HTMLElement>()\nconst root = shallowRef<HTMLDivElement>()\nconst scrollContainer = shallowRef<HTMLElement | Window>()\nconst { height: windowHeight } = useWindowSize()\nconst {\n height: rootHeight,\n width: rootWidth,\n top: rootTop,\n bottom: rootBottom,\n update: updateRoot,\n} = useElementBounding(root)\nconst targetRect = useElementBounding(target)\n\nconst fixed = ref(false)\nconst scrollTop = ref(0)\nconst transform = ref(0)\n\nconst rootStyle = computed<CSSProperties>(() => {\n return {\n height: fixed.value ? `${rootHeight.value}px` : '',\n width: fixed.value ? `${rootWidth.value}px` : '',\n }\n})\n\nconst affixStyle = computed<CSSProperties>(() => {\n if (!fixed.value) return {}\n\n const offset = props.offset ? `${props.offset}px` : 0\n return {\n height: `${rootHeight.value}px`,\n width: `${rootWidth.value}px`,\n top: props.position === 'top' ? offset : '',\n bottom: props.position === 'bottom' ? offset : '',\n transform: transform.value ? `translateY(${transform.value}px)` : '',\n zIndex: props.zIndex,\n }\n})\n\nconst update = () => {\n if (!scrollContainer.value) return\n\n scrollTop.value =\n scrollContainer.value instanceof Window\n ? document.documentElement.scrollTop\n : scrollContainer.value.scrollTop || 0\n\n if (props.position === 'top') {\n if (props.target) {\n const difference =\n targetRect.bottom.value - props.offset - rootHeight.value\n fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0\n transform.value = difference < 0 ? difference : 0\n } else {\n fixed.value = props.offset > rootTop.value\n }\n } else if (props.target) {\n const difference =\n windowHeight.value -\n targetRect.top.value -\n props.offset -\n rootHeight.value\n fixed.value =\n windowHeight.value - props.offset < rootBottom.value &&\n windowHeight.value > targetRect.top.value\n transform.value = difference < 0 ? -difference : 0\n } else {\n fixed.value = windowHeight.value - props.offset < rootBottom.value\n }\n}\n\nconst handleScroll = () => {\n emit('scroll', {\n scrollTop: scrollTop.value,\n fixed: fixed.value,\n })\n}\n\nwatch(fixed, (val) => emit('change', val))\n\nonMounted(() => {\n if (props.target) {\n target.value =\n document.querySelector<HTMLElement>(props.target) ?? undefined\n if (!target.value)\n throwError(COMPONENT_NAME, `Target is not existed: ${props.target}`)\n } else {\n target.value = document.documentElement\n }\n scrollContainer.value = getScrollContainer(root.value!, true)\n updateRoot()\n})\n\nuseEventListener(scrollContainer, 'scroll', handleScroll)\nwatchEffect(update)\n\ndefineExpose({\n /** @description update affix status */\n update,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,IAAA,MAAA,cAAA,GAAA,SAAA,CAAA;AAQA,IAAA,MAAA,EAAA,GAAA,aAAA,OAAA,CAAA,CAAA;AAEA,IAAA,MAAA,SAAA,UAAA,EAAA,CAAA;AACA,IAAA,MAAA,OAAA,UAAA,EAAA,CAAA;AACA,IAAA,MAAA,kBAAA,UAAA,EAAA,CAAA;AACA,IAAA,MAAA,EAAA,MAAA,EAAA,YAAA,EAAA,GAAA,aAAA,EAAA,CAAA;AACA,IAAA,MAAA;AAAA,MACA,MAAA,EAAA,UAAA;AAAA,MACA,KAAA,EAAA,SAAA;AAAA,MACA,GAAA,EAAA,OAAA;AAAA,MACA,MAAA,EAAA,UAAA;AAAA,MACA,MAAA,EAAA,UAAA;AAAA,KAAA,GACA,mBAAA,IAAA,CAAA,CAAA;AACA,IAAA,MAAA,UAAA,GAAA,mBAAA,MAAA,CAAA,CAAA;AAEA,IAAA,MAAA,KAAA,GAAA,IAAA,KAAA,CAAA,CAAA;AACA,IAAA,MAAA,SAAA,GAAA,IAAA,CAAA,CAAA,CAAA;AACA,IAAA,MAAA,SAAA,GAAA,IAAA,CAAA,CAAA,CAAA;AAEA,IAAA,MAAA,SAAA,GAAA,SAAA,MAAA;AACA,MAAA,OAAA;AAAA,QACA,MAAA,EAAA,KAAA,CAAA,KAAA,GAAA,CAAA,EAAA,WAAA,KAAA,CAAA,EAAA,CAAA,GAAA,EAAA;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,MAAA,EAAA;AACA,QAAA,MAAA,CAAA,KAAA,GAAA,CAAA,EAAA,GAAA,QAAA,CAAA,aAAA,CAAA,KAAA,CAAA,MAAA,CAAA,KAAA,IAAA,GAAA,EAAA,GAAA,KAAA,CAAA,CAAA;AACA,QAAA,IAAA,CAAA,MAAA,CAAA,KAAA;AAAA,UACA,UAAA,CAAA,cAAA,EAAA,CAAA,uBAAA,EAAA,KAAA,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA;AACA,OAAA,MAAA;AAAA,QACA,MAAA,CAAA,KAAA,GAAA,QAAA,CAAA,eAAA,CAAA;AACA,OAAA;AACA,MAAA,eAAA,CAAA,KAAA,GAAA,kBAAA,CAAA,IAAA,CAAA,KAAA,EAAA,IAAA,CAAA,CAAA;AAAA,MACA,UAAA,EAAA,CAAA;AAEA,KAAA,CAAA,CAAA;AACA,IAAA,gBAAA,CAAA,eAAA,EAAA,QAAA,EAAA,YAAA,CAAA,CAAA;AAEA,IAAA,WAAA,CAAA,MAAA,CAAA,CAAA;AAAA,IAEA,MAAA,CAAA;AAAA,MACA,MAAA;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"affix2.mjs","sources":["../../../../../../packages/components/affix/src/affix.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type { ZIndexProperty } from 'csstype'\nimport type Affix from './affix.vue'\n\nexport const affixProps = buildProps({\n zIndex: {\n type: definePropType<ZIndexProperty>([Number, String]),\n default: 100,\n },\n target: {\n type: String,\n default: '',\n },\n offset: {\n type: Number,\n default: 0,\n },\n position: {\n type: String,\n values: ['top', 'bottom'],\n default: 'top',\n },\n} as const)\nexport type AffixProps = ExtractPropTypes<typeof affixProps>\n\nexport const affixEmits = {\n scroll: ({ scrollTop, fixed }: { scrollTop: number; fixed: boolean }) =>\n typeof scrollTop === 'number' && typeof fixed === 'boolean',\n change: (fixed: boolean) => typeof fixed === 'boolean',\n}\nexport type AffixEmits = typeof affixEmits\n\nexport type AffixInstance = InstanceType<typeof Affix>\n"],"names":[],"mappings":";;;AACY,MAAC,UAAU,GAAG,UAAU,CAAC;AACrC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC7B,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,UAAU,GAAG;AAC1B,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,OAAO,SAAS,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS;AAC/F,EAAE,MAAM,EAAE,CAAC,KAAK,KAAK,OAAO,KAAK,KAAK,SAAS;AAC/C;;;;"}
@@ -1,6 +1,6 @@
1
1
  import '../../utils/index.mjs';
2
- import Autocomplete from './src/autocomplete2.mjs';
3
- export { autocompleteEmits, autocompleteProps } from './src/autocomplete.mjs';
2
+ import Autocomplete from './src/autocomplete.mjs';
3
+ export { autocompleteEmits, autocompleteProps } from './src/autocomplete2.mjs';
4
4
  import { withInstall } from '../../utils/vue/install.mjs';
5
5
 
6
6
  const ElAutocomplete = withInstall(Autocomplete);