@element-plus/nightly 0.0.20260426 → 0.0.20260427

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 (290) hide show
  1. package/dist/index.full.js +22 -6
  2. package/dist/index.full.min.js +3 -3
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +3 -3
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +22 -6
  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/hi.js +1 -1
  92. package/dist/locale/hi.min.js +1 -1
  93. package/dist/locale/hi.min.mjs +1 -1
  94. package/dist/locale/hi.mjs +1 -1
  95. package/dist/locale/hr.js +1 -1
  96. package/dist/locale/hr.min.js +1 -1
  97. package/dist/locale/hr.min.mjs +1 -1
  98. package/dist/locale/hr.mjs +1 -1
  99. package/dist/locale/hu.js +1 -1
  100. package/dist/locale/hu.min.js +1 -1
  101. package/dist/locale/hu.min.mjs +1 -1
  102. package/dist/locale/hu.mjs +1 -1
  103. package/dist/locale/hy-am.js +1 -1
  104. package/dist/locale/hy-am.min.js +1 -1
  105. package/dist/locale/hy-am.min.mjs +1 -1
  106. package/dist/locale/hy-am.mjs +1 -1
  107. package/dist/locale/id.js +1 -1
  108. package/dist/locale/id.min.js +1 -1
  109. package/dist/locale/id.min.mjs +1 -1
  110. package/dist/locale/id.mjs +1 -1
  111. package/dist/locale/it.js +1 -1
  112. package/dist/locale/it.min.js +1 -1
  113. package/dist/locale/it.min.mjs +1 -1
  114. package/dist/locale/it.mjs +1 -1
  115. package/dist/locale/ja.js +1 -1
  116. package/dist/locale/ja.min.js +1 -1
  117. package/dist/locale/ja.min.mjs +1 -1
  118. package/dist/locale/ja.mjs +1 -1
  119. package/dist/locale/kk.js +1 -1
  120. package/dist/locale/kk.min.js +1 -1
  121. package/dist/locale/kk.min.mjs +1 -1
  122. package/dist/locale/kk.mjs +1 -1
  123. package/dist/locale/km.js +1 -1
  124. package/dist/locale/km.min.js +1 -1
  125. package/dist/locale/km.min.mjs +1 -1
  126. package/dist/locale/km.mjs +1 -1
  127. package/dist/locale/ko.js +1 -1
  128. package/dist/locale/ko.min.js +1 -1
  129. package/dist/locale/ko.min.mjs +1 -1
  130. package/dist/locale/ko.mjs +1 -1
  131. package/dist/locale/ku.js +1 -1
  132. package/dist/locale/ku.min.js +1 -1
  133. package/dist/locale/ku.min.mjs +1 -1
  134. package/dist/locale/ku.mjs +1 -1
  135. package/dist/locale/ky.js +1 -1
  136. package/dist/locale/ky.min.js +1 -1
  137. package/dist/locale/ky.min.mjs +1 -1
  138. package/dist/locale/ky.mjs +1 -1
  139. package/dist/locale/lo.js +1 -1
  140. package/dist/locale/lo.min.js +1 -1
  141. package/dist/locale/lo.min.mjs +1 -1
  142. package/dist/locale/lo.mjs +1 -1
  143. package/dist/locale/lt.js +1 -1
  144. package/dist/locale/lt.min.js +1 -1
  145. package/dist/locale/lt.min.mjs +1 -1
  146. package/dist/locale/lt.mjs +1 -1
  147. package/dist/locale/lv.js +1 -1
  148. package/dist/locale/lv.min.js +1 -1
  149. package/dist/locale/lv.min.mjs +1 -1
  150. package/dist/locale/lv.mjs +1 -1
  151. package/dist/locale/mg.js +1 -1
  152. package/dist/locale/mg.min.js +1 -1
  153. package/dist/locale/mg.min.mjs +1 -1
  154. package/dist/locale/mg.mjs +1 -1
  155. package/dist/locale/mn.js +1 -1
  156. package/dist/locale/mn.min.js +1 -1
  157. package/dist/locale/mn.min.mjs +1 -1
  158. package/dist/locale/mn.mjs +1 -1
  159. package/dist/locale/ms.js +1 -1
  160. package/dist/locale/ms.min.js +1 -1
  161. package/dist/locale/ms.min.mjs +1 -1
  162. package/dist/locale/ms.mjs +1 -1
  163. package/dist/locale/my.js +1 -1
  164. package/dist/locale/my.min.js +1 -1
  165. package/dist/locale/my.min.mjs +1 -1
  166. package/dist/locale/my.mjs +1 -1
  167. package/dist/locale/nb-no.js +1 -1
  168. package/dist/locale/nb-no.min.js +1 -1
  169. package/dist/locale/nb-no.min.mjs +1 -1
  170. package/dist/locale/nb-no.mjs +1 -1
  171. package/dist/locale/nl.js +1 -1
  172. package/dist/locale/nl.min.js +1 -1
  173. package/dist/locale/nl.min.mjs +1 -1
  174. package/dist/locale/nl.mjs +1 -1
  175. package/dist/locale/no.js +1 -1
  176. package/dist/locale/no.min.js +1 -1
  177. package/dist/locale/no.min.mjs +1 -1
  178. package/dist/locale/no.mjs +1 -1
  179. package/dist/locale/pa.js +1 -1
  180. package/dist/locale/pa.min.js +1 -1
  181. package/dist/locale/pa.min.mjs +1 -1
  182. package/dist/locale/pa.mjs +1 -1
  183. package/dist/locale/pl.js +1 -1
  184. package/dist/locale/pl.min.js +1 -1
  185. package/dist/locale/pl.min.mjs +1 -1
  186. package/dist/locale/pl.mjs +1 -1
  187. package/dist/locale/pt-br.js +1 -1
  188. package/dist/locale/pt-br.min.js +1 -1
  189. package/dist/locale/pt-br.min.mjs +1 -1
  190. package/dist/locale/pt-br.mjs +1 -1
  191. package/dist/locale/pt.js +1 -1
  192. package/dist/locale/pt.min.js +1 -1
  193. package/dist/locale/pt.min.mjs +1 -1
  194. package/dist/locale/pt.mjs +1 -1
  195. package/dist/locale/ro.js +1 -1
  196. package/dist/locale/ro.min.js +1 -1
  197. package/dist/locale/ro.min.mjs +1 -1
  198. package/dist/locale/ro.mjs +1 -1
  199. package/dist/locale/ru.js +1 -1
  200. package/dist/locale/ru.min.js +1 -1
  201. package/dist/locale/ru.min.mjs +1 -1
  202. package/dist/locale/ru.mjs +1 -1
  203. package/dist/locale/sk.js +1 -1
  204. package/dist/locale/sk.min.js +1 -1
  205. package/dist/locale/sk.min.mjs +1 -1
  206. package/dist/locale/sk.mjs +1 -1
  207. package/dist/locale/sl.js +1 -1
  208. package/dist/locale/sl.min.js +1 -1
  209. package/dist/locale/sl.min.mjs +1 -1
  210. package/dist/locale/sl.mjs +1 -1
  211. package/dist/locale/sr.js +1 -1
  212. package/dist/locale/sr.min.js +1 -1
  213. package/dist/locale/sr.min.mjs +1 -1
  214. package/dist/locale/sr.mjs +1 -1
  215. package/dist/locale/sv.js +1 -1
  216. package/dist/locale/sv.min.js +1 -1
  217. package/dist/locale/sv.min.mjs +1 -1
  218. package/dist/locale/sv.mjs +1 -1
  219. package/dist/locale/sw.js +1 -1
  220. package/dist/locale/sw.min.js +1 -1
  221. package/dist/locale/sw.min.mjs +1 -1
  222. package/dist/locale/sw.mjs +1 -1
  223. package/dist/locale/ta.js +1 -1
  224. package/dist/locale/ta.min.js +1 -1
  225. package/dist/locale/ta.min.mjs +1 -1
  226. package/dist/locale/ta.mjs +1 -1
  227. package/dist/locale/te.js +1 -1
  228. package/dist/locale/te.min.js +1 -1
  229. package/dist/locale/te.min.mjs +1 -1
  230. package/dist/locale/te.mjs +1 -1
  231. package/dist/locale/th.js +1 -1
  232. package/dist/locale/th.min.js +1 -1
  233. package/dist/locale/th.min.mjs +1 -1
  234. package/dist/locale/th.mjs +1 -1
  235. package/dist/locale/tk.js +1 -1
  236. package/dist/locale/tk.min.js +1 -1
  237. package/dist/locale/tk.min.mjs +1 -1
  238. package/dist/locale/tk.mjs +1 -1
  239. package/dist/locale/tr.js +1 -1
  240. package/dist/locale/tr.min.js +1 -1
  241. package/dist/locale/tr.min.mjs +1 -1
  242. package/dist/locale/tr.mjs +1 -1
  243. package/dist/locale/ug-cn.js +1 -1
  244. package/dist/locale/ug-cn.min.js +1 -1
  245. package/dist/locale/ug-cn.min.mjs +1 -1
  246. package/dist/locale/ug-cn.mjs +1 -1
  247. package/dist/locale/uk.js +1 -1
  248. package/dist/locale/uk.min.js +1 -1
  249. package/dist/locale/uk.min.mjs +1 -1
  250. package/dist/locale/uk.mjs +1 -1
  251. package/dist/locale/uz-uz.js +1 -1
  252. package/dist/locale/uz-uz.min.js +1 -1
  253. package/dist/locale/uz-uz.min.mjs +1 -1
  254. package/dist/locale/uz-uz.mjs +1 -1
  255. package/dist/locale/vi.js +1 -1
  256. package/dist/locale/vi.min.js +1 -1
  257. package/dist/locale/vi.min.mjs +1 -1
  258. package/dist/locale/vi.mjs +1 -1
  259. package/dist/locale/zh-cn.js +1 -1
  260. package/dist/locale/zh-cn.min.js +1 -1
  261. package/dist/locale/zh-cn.min.mjs +1 -1
  262. package/dist/locale/zh-cn.mjs +1 -1
  263. package/dist/locale/zh-hk.js +1 -1
  264. package/dist/locale/zh-hk.min.js +1 -1
  265. package/dist/locale/zh-hk.min.mjs +1 -1
  266. package/dist/locale/zh-hk.mjs +1 -1
  267. package/dist/locale/zh-mo.js +1 -1
  268. package/dist/locale/zh-mo.min.js +1 -1
  269. package/dist/locale/zh-mo.min.mjs +1 -1
  270. package/dist/locale/zh-mo.mjs +1 -1
  271. package/dist/locale/zh-tw.js +1 -1
  272. package/dist/locale/zh-tw.min.js +1 -1
  273. package/dist/locale/zh-tw.min.mjs +1 -1
  274. package/dist/locale/zh-tw.mjs +1 -1
  275. package/es/components/input/src/input.vue_vue_type_script_setup_true_lang.mjs +22 -5
  276. package/es/components/input/src/input.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  277. package/es/components/input/src/input2.mjs.map +1 -1
  278. package/es/components/message/src/message.d.ts +1 -1
  279. package/es/components/notification/src/notification.d.ts +1 -1
  280. package/es/version.mjs +1 -1
  281. package/es/version.mjs.map +1 -1
  282. package/lib/components/input/src/input.vue_vue_type_script_setup_true_lang.js +21 -4
  283. package/lib/components/input/src/input.vue_vue_type_script_setup_true_lang.js.map +1 -1
  284. package/lib/components/input/src/input2.js.map +1 -1
  285. package/lib/components/message/src/message.d.ts +1 -1
  286. package/lib/components/notification/src/notification.d.ts +1 -1
  287. package/lib/version.js +1 -1
  288. package/lib/version.js.map +1 -1
  289. package/package.json +3 -3
  290. package/web-types.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"input2.mjs","names":[],"sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n containerKls,\n {\n [nsInput.bm('group', 'append')]: $slots.append,\n [nsInput.bm('group', 'prepend')]: $slots.prepend,\n },\n ]\"\n :style=\"containerStyle\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n >\n <!-- input -->\n <template v-if=\"type !== 'textarea'\">\n <!-- prepend slot -->\n <div v-if=\"$slots.prepend\" :class=\"nsInput.be('group', 'prepend')\">\n <slot name=\"prepend\" />\n </div>\n\n <div ref=\"wrapperRef\" :class=\"wrapperKls\">\n <!-- prefix slot -->\n <span v-if=\"$slots.prefix || prefixIcon\" :class=\"nsInput.e('prefix')\">\n <span :class=\"nsInput.e('prefix-inner')\">\n <slot name=\"prefix\" />\n <el-icon v-if=\"prefixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"prefixIcon\" />\n </el-icon>\n </span>\n </span>\n\n <input\n :id=\"inputId\"\n ref=\"input\"\n :class=\"nsInput.e('inner')\"\n v-bind=\"attrs\"\n :name=\"name\"\n :minlength=\"countGraphemes ? undefined : minlength\"\n :maxlength=\"countGraphemes ? undefined : maxlength\"\n :type=\"showPassword ? (passwordVisible ? 'text' : 'password') : type\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :tabindex=\"tabindex\"\n :aria-label=\"ariaLabel\"\n :placeholder=\"placeholder\"\n :style=\"inputStyle\"\n :form=\"form\"\n :autofocus=\"autofocus\"\n :role=\"containerRole\"\n :inputmode=\"inputmode\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n\n <!-- suffix slot -->\n <span v-if=\"suffixVisible\" :class=\"nsInput.e('suffix')\">\n <span :class=\"nsInput.e('suffix-inner')\">\n <el-icon\n v-if=\"renderClear\"\n :class=\"[nsInput.e('icon'), nsInput.e('clear')]\"\n :style=\"{ visibility: showClear ? 'visible' : 'hidden' }\"\n @mousedown.prevent=\"NOOP\"\n @click=\"clear\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <template\n v-if=\"!showClear || !showPwdVisible || !isWordLimitVisible\"\n >\n <slot name=\"suffix\" />\n <el-icon v-if=\"suffixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"suffixIcon\" />\n </el-icon>\n </template>\n <el-icon\n v-if=\"showPwdVisible\"\n :class=\"[nsInput.e('icon'), nsInput.e('password')]\"\n @click=\"handlePasswordVisible\"\n @mousedown.prevent=\"NOOP\"\n @mouseup.prevent=\"NOOP\"\n >\n <slot name=\"password-icon\" :visible=\"passwordVisible\">\n <component :is=\"passwordIcon\" />\n </slot>\n </el-icon>\n <span\n v-if=\"isWordLimitVisible\"\n :class=\"[\n nsInput.e('count'),\n nsInput.is('outside', wordLimitPosition === 'outside'),\n ]\"\n >\n <span :class=\"nsInput.e('count-inner')\">\n {{ textLength }} / {{ maxlength }}\n </span>\n </span>\n <el-icon\n v-if=\"validateState && validateIcon && needStatusIcon\"\n :class=\"[\n nsInput.e('icon'),\n nsInput.e('validateIcon'),\n nsInput.is('loading', validateState === 'validating'),\n ]\"\n >\n <component :is=\"validateIcon\" />\n </el-icon>\n </span>\n </span>\n </div>\n\n <!-- append slot -->\n <div v-if=\"$slots.append\" :class=\"nsInput.be('group', 'append')\">\n <slot name=\"append\" />\n </div>\n </template>\n\n <!-- textarea -->\n <template v-else>\n <textarea\n :id=\"inputId\"\n ref=\"textarea\"\n :class=\"[\n nsTextarea.e('inner'),\n nsInput.is('focus', isFocused),\n nsTextarea.is('clearable', clearable),\n ]\"\n v-bind=\"attrs\"\n :name=\"name\"\n :minlength=\"countGraphemes ? undefined : minlength\"\n :maxlength=\"countGraphemes ? undefined : maxlength\"\n :tabindex=\"tabindex\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :style=\"textareaStyle\"\n :aria-label=\"ariaLabel\"\n :placeholder=\"placeholder\"\n :form=\"form\"\n :autofocus=\"autofocus\"\n :rows=\"rows\"\n :role=\"containerRole\"\n :inputmode=\"inputmode\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n <el-icon\n v-if=\"showClear\"\n :class=\"[nsTextarea.e('icon'), nsTextarea.e('clear')]\"\n @mousedown.prevent=\"NOOP\"\n @click=\"clear\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <span\n v-if=\"isWordLimitVisible\"\n :style=\"countStyle\"\n :class=\"[\n nsInput.e('count'),\n nsInput.is('outside', wordLimitPosition === 'outside'),\n ]\"\n >\n {{ textLength }} / {{ maxlength }}\n </span>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\n onMounted,\n ref,\n shallowRef,\n toRef,\n useAttrs as useRawAttrs,\n useSlots,\n watch,\n} from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { isNil } from 'lodash-unified'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Hide, View } from '@element-plus/icons-vue'\nimport {\n useFormDisabled,\n useFormItem,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport {\n NOOP,\n ValidateComponentsMap,\n debugWarn,\n isClient,\n isObject,\n} from '@element-plus/utils'\nimport {\n useAttrs,\n useComposition,\n useCursor,\n useFocusController,\n useNamespace,\n} from '@element-plus/hooks'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { calcTextareaHeight, looseToNumber } from './utils'\nimport { inputEmits, inputPropsDefaults } from './input'\n\nimport type { StyleValue } from 'vue'\nimport type { InputProps } from './input'\n\ntype TargetElement = HTMLInputElement | HTMLTextAreaElement\n\nconst COMPONENT_NAME = 'ElInput'\ndefineOptions({\n name: COMPONENT_NAME,\n inheritAttrs: false,\n})\nconst props = withDefaults(defineProps<InputProps>(), inputPropsDefaults)\nconst emit = defineEmits(inputEmits)\n\nconst rawAttrs = useRawAttrs()\nconst slots = useSlots()\n\nconst containerKls = computed(() => [\n props.type === 'textarea' ? nsTextarea.b() : nsInput.b(),\n nsInput.m(inputSize.value),\n nsInput.is('disabled', inputDisabled.value),\n nsInput.is('exceed', inputExceed.value),\n {\n [nsInput.b('group')]: slots.prepend || slots.append,\n [nsInput.m('prefix')]: slots.prefix || props.prefixIcon,\n [nsInput.m('suffix')]:\n slots.suffix || props.suffixIcon || props.clearable || props.showPassword,\n [nsInput.bm('suffix', 'password-clear')]:\n showClear.value && showPwdVisible.value,\n [nsInput.b('hidden')]: props.type === 'hidden',\n },\n rawAttrs.class,\n])\n\nconst wrapperKls = computed(() => [\n nsInput.e('wrapper'),\n nsInput.is('focus', isFocused.value),\n])\n\nconst attrs = useAttrs()\nconst maxlength = computed(() => props.maxlength?.toString())\n\nconst { form: elForm, formItem: elFormItem } = useFormItem()\nconst { inputId } = useFormItemInputId(props, {\n formItemContext: elFormItem,\n})\nconst inputSize = useFormSize()\nconst inputDisabled = useFormDisabled()\nconst nsInput = useNamespace('input')\nconst nsTextarea = useNamespace('textarea')\n\nconst input = shallowRef<HTMLInputElement>()\nconst textarea = shallowRef<HTMLTextAreaElement>()\n\nconst hovering = ref(false)\nconst passwordVisible = ref(false)\nconst countStyle = ref<StyleValue>()\nconst textareaCalcStyle = shallowRef(props.inputStyle)\nconst saveValue = ref('')\nconst textareaHeight = ref<string>()\n\nconst _ref = computed(() => input.value || textarea.value)\n\n// wrapperRef for type=\"text\", handleFocus and handleBlur for type=\"textarea\"\n// @ts-ignore - used in template ref binding, TS cannot detect template usage\nconst { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(\n _ref,\n {\n disabled: inputDisabled,\n afterBlur() {\n if (props.validateEvent) {\n elFormItem?.validate?.('blur').catch(NOOP)\n }\n },\n }\n)\n\nconst needStatusIcon = computed(() => elForm?.statusIcon ?? false)\nconst validateState = computed(() => elFormItem?.validateState || '')\nconst validateIcon = computed(\n () => validateState.value && ValidateComponentsMap[validateState.value]\n)\nconst passwordIcon = computed(() => (passwordVisible.value ? View : Hide))\nconst containerStyle = computed<StyleValue>(() => [\n rawAttrs.style as StyleValue,\n])\nconst textareaStyle = computed<StyleValue>(() => [\n props.inputStyle,\n textareaCalcStyle.value,\n { resize: props.resize },\n textareaHeight.value ? { height: textareaHeight.value } : undefined,\n])\nconst nativeInputValue = computed(() =>\n isNil(props.modelValue) ? '' : String(props.modelValue)\n)\nconst renderClear = computed(\n () => props.clearable && !inputDisabled.value && !props.readonly\n)\nconst showClear = computed(\n () =>\n renderClear.value &&\n !!nativeInputValue.value &&\n (isFocused.value || hovering.value)\n)\nconst showPwdVisible = computed(\n () => props.showPassword && !inputDisabled.value && !!nativeInputValue.value\n)\nconst isWordLimitVisible = computed(\n () =>\n props.showWordLimit &&\n !!maxlength.value &&\n (props.type === 'text' || props.type === 'textarea') &&\n !inputDisabled.value &&\n !props.readonly &&\n !props.showPassword\n)\nconst textLength = computed(() => {\n if (props.countGraphemes && props.showWordLimit) {\n return props.countGraphemes(nativeInputValue.value)\n }\n return nativeInputValue.value.length\n})\nconst inputExceed = computed(\n () =>\n // show exceed style if length of initial value greater then maxlength\n !!isWordLimitVisible.value && textLength.value > Number(maxlength.value)\n)\nconst suffixVisible = computed(\n () =>\n !!slots.suffix ||\n !!props.suffixIcon ||\n props.clearable ||\n props.showPassword ||\n isWordLimitVisible.value ||\n (!!validateState.value && needStatusIcon.value)\n)\nconst hasModelModifiers = computed(\n () => !!Object.keys(props.modelModifiers).length\n)\n\nconst [recordCursor, setCursor] = useCursor(input)\n\nuseResizeObserver(textarea, (entries) => {\n onceInitSizeTextarea()\n if (\n !isWordLimitVisible.value ||\n (props.resize !== 'both' && props.resize !== 'horizontal')\n )\n return\n const entry = entries[0]\n const { width } = entry.contentRect\n countStyle.value = {\n /** right: 100% - width + padding(22) - right(10) */\n right: `calc(100% - ${width + 22 - 10}px)`,\n }\n})\n\nconst resizeTextarea = () => {\n const { type, autosize } = props\n\n if (!isClient || type !== 'textarea' || !textarea.value) return\n\n if (autosize) {\n const minRows = isObject(autosize) ? autosize.minRows : undefined\n const maxRows = isObject(autosize) ? autosize.maxRows : undefined\n const textareaStyle = calcTextareaHeight(textarea.value, minRows, maxRows)\n\n // If the scrollbar is displayed, the height of the textarea needs more space than the calculated height.\n // If set textarea height in this case, the scrollbar will not hide.\n // So we need to hide scrollbar first, and reset it in next tick.\n // see https://github.com/element-plus/element-plus/issues/8825\n textareaCalcStyle.value = {\n overflowY: 'hidden',\n ...textareaStyle,\n }\n\n nextTick(() => {\n // NOTE: Force repaint to make sure the style set above is applied.\n textarea.value!.offsetHeight\n textareaCalcStyle.value = textareaStyle\n })\n } else {\n textareaCalcStyle.value = {\n minHeight: calcTextareaHeight(textarea.value).minHeight,\n }\n }\n}\n\nconst createOnceInitResize = (resizeTextarea: () => void) => {\n let isInit = false\n return () => {\n if (isInit || !props.autosize) {\n if (props.resize !== 'none') {\n // The execution here may occur before `setTimeout(resizeTextarea)`,\n // potentially causing a regression of issue #21836, so the assignment needs to be deferred.\n setTimeout(() => {\n textareaHeight.value = textarea.value?.style.height\n })\n }\n return\n }\n const isElHidden = textarea.value?.offsetParent === null\n if (!isElHidden) {\n setTimeout(resizeTextarea)\n isInit = true\n }\n }\n}\n// fix: https://github.com/element-plus/element-plus/issues/12074\nconst onceInitSizeTextarea = createOnceInitResize(resizeTextarea)\n\nconst setNativeInputValue = () => {\n const input = _ref.value\n const formatterValue = props.formatter\n ? props.formatter(nativeInputValue.value)\n : nativeInputValue.value\n if (!input || input.value === formatterValue || props.type === 'file') return\n input.value = formatterValue\n}\n\nconst formatValue = (value: string) => {\n const { trim, number } = props.modelModifiers\n if (trim) {\n value = value.trim()\n }\n if (number) {\n value = `${looseToNumber(value)}`\n }\n if (props.formatter && props.parser) {\n value = props.parser(value)\n }\n return value\n}\n\nconst handleInput = async (event: Event) => {\n // should not emit input during composition\n // see: https://github.com/ElemeFE/element/issues/10516\n if (isComposing.value) return\n\n const { lazy } = props.modelModifiers\n let { value } = event.target as TargetElement\n let shouldForceNativeUpdate = false\n if (lazy) {\n emit(INPUT_EVENT, value)\n return\n }\n\n value = formatValue(value)\n\n if (props.countGraphemes && maxlength.value != null) {\n const limit = Number(maxlength.value)\n const graphemes = props.countGraphemes(value)\n const saveGraphemes = props.countGraphemes(saveValue.value)\n if (graphemes > limit && graphemes > saveGraphemes) {\n // If current value already exceeds limit, block further input and keep exceed state.\n if (saveGraphemes > limit) {\n value = saveValue.value\n shouldForceNativeUpdate = true\n } else {\n // Keep unchanged suffix like native maxlength behavior.\n // Instead of truncating from the end of the whole string,\n // only limit the inserted segment to available capacity.\n const prevValue = saveValue.value\n const nextValue = value\n let prefixLen = 0\n\n while (\n prefixLen < prevValue.length &&\n prefixLen < nextValue.length &&\n prevValue[prefixLen] === nextValue[prefixLen]\n ) {\n prefixLen++\n }\n\n let prevSuffixIndex = prevValue.length\n let nextSuffixIndex = nextValue.length\n while (\n prevSuffixIndex > prefixLen &&\n nextSuffixIndex > prefixLen &&\n prevValue[prevSuffixIndex - 1] === nextValue[nextSuffixIndex - 1]\n ) {\n prevSuffixIndex--\n nextSuffixIndex--\n }\n\n const before = nextValue.slice(0, prefixLen)\n const removed = prevValue.slice(prefixLen, prevSuffixIndex)\n const inserted = nextValue.slice(prefixLen, nextSuffixIndex)\n const after = nextValue.slice(nextSuffixIndex)\n\n const removedCount = props.countGraphemes(removed)\n const baseCount = saveGraphemes - removedCount\n const availableInserted = Math.max(0, limit - baseCount)\n\n let acceptedInserted = ''\n if (availableInserted > 0) {\n // Use Intl.Segmenter for proper grapheme cluster iteration if available.\n if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {\n const segmenter = new Intl.Segmenter(undefined, {\n granularity: 'grapheme',\n })\n for (const { segment } of segmenter.segment(inserted)) {\n const candidate = acceptedInserted + segment\n const newCount = props.countGraphemes(candidate)\n if (newCount > availableInserted) break\n acceptedInserted = candidate\n }\n } else {\n // Fallback to code-point iteration for older environments.\n for (const char of Array.from(inserted)) {\n const candidate = acceptedInserted + char\n const newCount = props.countGraphemes(candidate)\n if (newCount > availableInserted) break\n acceptedInserted = candidate\n }\n }\n }\n\n value = before + acceptedInserted + after\n shouldForceNativeUpdate = true\n }\n }\n }\n\n // hack for https://github.com/ElemeFE/element/issues/8548\n // should remove the following line when we don't support IE\n if (String(value) === nativeInputValue.value) {\n // preserve native features while being compatible with #9501\n if (props.formatter || shouldForceNativeUpdate) {\n const target = event.target as TargetElement\n const blockedValue = target.value\n const selectionStart = target.selectionStart\n const selectionEnd = target.selectionEnd\n setNativeInputValue()\n // Keep caret position stable when input is blocked and value is reset.\n if (\n shouldForceNativeUpdate &&\n _ref.value &&\n selectionStart != null &&\n selectionEnd != null\n ) {\n const restoredValue = _ref.value.value\n const afterTxt = blockedValue.slice(Math.max(0, selectionEnd))\n let caretPos = Math.min(selectionStart, restoredValue.length)\n\n if (afterTxt && restoredValue.endsWith(afterTxt)) {\n caretPos = restoredValue.length - afterTxt.length\n }\n\n _ref.value.setSelectionRange(caretPos, caretPos)\n }\n }\n return\n }\n saveValue.value = value\n\n recordCursor()\n emit(UPDATE_MODEL_EVENT, value)\n emit(INPUT_EVENT, value)\n\n // ensure native input value is controlled\n // see: https://github.com/ElemeFE/element/issues/12850\n await nextTick()\n\n if ((props.formatter && props.parser) || !hasModelModifiers.value) {\n setNativeInputValue()\n }\n setCursor()\n}\n\nconst handleChange = async (event: Event) => {\n let { value } = event.target as TargetElement\n\n value = formatValue(value)\n if (props.modelModifiers.lazy) {\n emit(UPDATE_MODEL_EVENT, value)\n }\n emit(CHANGE_EVENT, value, event)\n\n await nextTick()\n setNativeInputValue()\n}\n\nconst {\n isComposing,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n} = useComposition({ emit, afterComposition: handleInput })\n\nconst handlePasswordVisible = () => {\n passwordVisible.value = !passwordVisible.value\n}\n\nconst focus = () => _ref.value?.focus()\n\nconst blur = () => _ref.value?.blur()\n\nconst handleMouseLeave = (evt: MouseEvent) => {\n hovering.value = false\n emit('mouseleave', evt)\n}\n\nconst handleMouseEnter = (evt: MouseEvent) => {\n hovering.value = true\n emit('mouseenter', evt)\n}\n\nconst handleKeydown = (evt: KeyboardEvent) => {\n emit('keydown', evt)\n}\n\nconst select = () => {\n _ref.value?.select()\n}\n\nconst clear = (evt?: MouseEvent) => {\n emit(UPDATE_MODEL_EVENT, '')\n emit(CHANGE_EVENT, '')\n emit('clear', evt)\n emit(INPUT_EVENT, '')\n}\n\nwatch(\n () => props.modelValue,\n () => {\n nextTick(() => {\n resizeTextarea()\n if (props.autosize) {\n textareaHeight.value = undefined\n }\n })\n if (props.validateEvent) {\n elFormItem?.validate?.('change').catch(NOOP)\n }\n }\n)\n\nwatch(\n () => nativeInputValue.value,\n (val) => {\n saveValue.value = val\n },\n { immediate: true }\n)\n\n// native input value is set explicitly\n// do not use v-model / :value in template\n// see: https://github.com/ElemeFE/element/issues/14521\nwatch(nativeInputValue, (newValue) => {\n if (!_ref.value) {\n return\n }\n const { trim, number } = props.modelModifiers\n const elValue = _ref.value.value\n const displayValue =\n (number || props.type === 'number') && !/^0\\d/.test(elValue)\n ? `${looseToNumber(elValue)}`\n : elValue\n\n if (displayValue === newValue) {\n return\n }\n\n if (document.activeElement === _ref.value && _ref.value.type !== 'range') {\n if (trim && displayValue.trim() === newValue) {\n return\n }\n }\n\n setNativeInputValue()\n})\n\n// when change between <input> and <textarea>,\n// update DOM dependent value and styles\n// https://github.com/ElemeFE/element/issues/14857\nwatch(\n () => props.type,\n async () => {\n await nextTick()\n setNativeInputValue()\n resizeTextarea()\n }\n)\n\nonMounted(() => {\n if (!props.formatter && props.parser) {\n debugWarn(\n COMPONENT_NAME,\n 'If you set the parser, you also need to set the formatter.'\n )\n }\n setNativeInputValue()\n nextTick(resizeTextarea)\n})\n\ndefineExpose({\n /** @description HTML input element */\n input,\n /** @description HTML textarea element */\n textarea,\n /** @description HTML element, input or textarea */\n ref: _ref,\n /** @description style of textarea. */\n textareaStyle,\n\n /** @description from props (used on unit test) */\n autosize: toRef(props, 'autosize'),\n\n /** @description is input composing */\n isComposing,\n\n /** @description whether the password is visible */\n passwordVisible,\n\n /** @description HTML input element native method */\n focus,\n /** @description HTML input element native method */\n blur,\n /** @description HTML input element native method */\n select,\n /** @description clear input value */\n clear,\n /** @description resize textarea. */\n resizeTextarea,\n})\n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"input2.mjs","names":[],"sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n containerKls,\n {\n [nsInput.bm('group', 'append')]: $slots.append,\n [nsInput.bm('group', 'prepend')]: $slots.prepend,\n },\n ]\"\n :style=\"containerStyle\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n >\n <!-- input -->\n <template v-if=\"type !== 'textarea'\">\n <!-- prepend slot -->\n <div v-if=\"$slots.prepend\" :class=\"nsInput.be('group', 'prepend')\">\n <slot name=\"prepend\" />\n </div>\n\n <div ref=\"wrapperRef\" :class=\"wrapperKls\">\n <!-- prefix slot -->\n <span v-if=\"$slots.prefix || prefixIcon\" :class=\"nsInput.e('prefix')\">\n <span :class=\"nsInput.e('prefix-inner')\">\n <slot name=\"prefix\" />\n <el-icon v-if=\"prefixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"prefixIcon\" />\n </el-icon>\n </span>\n </span>\n\n <input\n :id=\"inputId\"\n ref=\"input\"\n :class=\"nsInput.e('inner')\"\n v-bind=\"attrs\"\n :name=\"name\"\n :minlength=\"countGraphemes ? undefined : minlength\"\n :maxlength=\"countGraphemes ? undefined : maxlength\"\n :type=\"showPassword ? (passwordVisible ? 'text' : 'password') : type\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :tabindex=\"tabindex\"\n :aria-label=\"ariaLabel\"\n :placeholder=\"placeholder\"\n :style=\"inputStyle\"\n :form=\"form\"\n :autofocus=\"autofocus\"\n :role=\"containerRole\"\n :inputmode=\"inputmode\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n\n <!-- suffix slot -->\n <span v-if=\"suffixVisible\" :class=\"nsInput.e('suffix')\">\n <span :class=\"nsInput.e('suffix-inner')\">\n <el-icon\n v-if=\"renderClear\"\n :class=\"[nsInput.e('icon'), nsInput.e('clear')]\"\n :style=\"{ visibility: showClear ? 'visible' : 'hidden' }\"\n @mousedown.prevent=\"NOOP\"\n @click=\"clear\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <template\n v-if=\"!showClear || !showPwdVisible || !isWordLimitVisible\"\n >\n <slot name=\"suffix\" />\n <el-icon v-if=\"suffixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"suffixIcon\" />\n </el-icon>\n </template>\n <el-icon\n v-if=\"showPwdVisible\"\n :class=\"[nsInput.e('icon'), nsInput.e('password')]\"\n @click=\"handlePasswordVisible\"\n @mousedown.prevent=\"NOOP\"\n @mouseup.prevent=\"NOOP\"\n >\n <slot name=\"password-icon\" :visible=\"passwordVisible\">\n <component :is=\"passwordIcon\" />\n </slot>\n </el-icon>\n <span\n v-if=\"isWordLimitVisible\"\n :class=\"[\n nsInput.e('count'),\n nsInput.is('outside', wordLimitPosition === 'outside'),\n ]\"\n >\n <span :class=\"nsInput.e('count-inner')\">\n {{ textLength }} / {{ maxlength }}\n </span>\n </span>\n <el-icon\n v-if=\"validateState && validateIcon && needStatusIcon\"\n :class=\"[\n nsInput.e('icon'),\n nsInput.e('validateIcon'),\n nsInput.is('loading', validateState === 'validating'),\n ]\"\n >\n <component :is=\"validateIcon\" />\n </el-icon>\n </span>\n </span>\n </div>\n\n <!-- append slot -->\n <div v-if=\"$slots.append\" :class=\"nsInput.be('group', 'append')\">\n <slot name=\"append\" />\n </div>\n </template>\n\n <!-- textarea -->\n <template v-else>\n <textarea\n :id=\"inputId\"\n ref=\"textarea\"\n :class=\"[\n nsTextarea.e('inner'),\n nsInput.is('focus', isFocused),\n nsTextarea.is('clearable', clearable),\n ]\"\n v-bind=\"attrs\"\n :name=\"name\"\n :minlength=\"countGraphemes ? undefined : minlength\"\n :maxlength=\"countGraphemes ? undefined : maxlength\"\n :tabindex=\"tabindex\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :style=\"textareaStyle\"\n :aria-label=\"ariaLabel\"\n :placeholder=\"placeholder\"\n :form=\"form\"\n :autofocus=\"autofocus\"\n :rows=\"rows\"\n :role=\"containerRole\"\n :inputmode=\"inputmode\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n <el-icon\n v-if=\"showClear\"\n :class=\"[nsTextarea.e('icon'), nsTextarea.e('clear')]\"\n :style=\"clearIconStyle\"\n @mousedown.prevent=\"NOOP\"\n @click=\"clear\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <span\n v-if=\"isWordLimitVisible\"\n :style=\"countStyle\"\n :class=\"[\n nsInput.e('count'),\n nsInput.is('outside', wordLimitPosition === 'outside'),\n ]\"\n >\n {{ textLength }} / {{ maxlength }}\n </span>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n shallowRef,\n toRef,\n useAttrs as useRawAttrs,\n useSlots,\n watch,\n} from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { isNil } from 'lodash-unified'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Hide, View } from '@element-plus/icons-vue'\nimport {\n useFormDisabled,\n useFormItem,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport {\n NOOP,\n ValidateComponentsMap,\n cAF,\n debugWarn,\n isClient,\n isObject,\n rAF,\n} from '@element-plus/utils'\nimport {\n useAttrs,\n useComposition,\n useCursor,\n useFocusController,\n useNamespace,\n} from '@element-plus/hooks'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { calcTextareaHeight, looseToNumber } from './utils'\nimport { inputEmits, inputPropsDefaults } from './input'\n\nimport type { StyleValue } from 'vue'\nimport type { InputProps } from './input'\n\ntype TargetElement = HTMLInputElement | HTMLTextAreaElement\n\nconst COMPONENT_NAME = 'ElInput'\ndefineOptions({\n name: COMPONENT_NAME,\n inheritAttrs: false,\n})\nconst props = withDefaults(defineProps<InputProps>(), inputPropsDefaults)\nconst emit = defineEmits(inputEmits)\n\nconst rawAttrs = useRawAttrs()\nconst slots = useSlots()\n\nconst containerKls = computed(() => [\n props.type === 'textarea' ? nsTextarea.b() : nsInput.b(),\n nsInput.m(inputSize.value),\n nsInput.is('disabled', inputDisabled.value),\n nsInput.is('exceed', inputExceed.value),\n {\n [nsInput.b('group')]: slots.prepend || slots.append,\n [nsInput.m('prefix')]: slots.prefix || props.prefixIcon,\n [nsInput.m('suffix')]:\n slots.suffix || props.suffixIcon || props.clearable || props.showPassword,\n [nsInput.bm('suffix', 'password-clear')]:\n showClear.value && showPwdVisible.value,\n [nsInput.b('hidden')]: props.type === 'hidden',\n },\n rawAttrs.class,\n])\n\nconst wrapperKls = computed(() => [\n nsInput.e('wrapper'),\n nsInput.is('focus', isFocused.value),\n])\n\nconst attrs = useAttrs()\nconst maxlength = computed(() => props.maxlength?.toString())\n\nconst { form: elForm, formItem: elFormItem } = useFormItem()\nconst { inputId } = useFormItemInputId(props, {\n formItemContext: elFormItem,\n})\nconst inputSize = useFormSize()\nconst inputDisabled = useFormDisabled()\nconst nsInput = useNamespace('input')\nconst nsTextarea = useNamespace('textarea')\n\nconst input = shallowRef<HTMLInputElement>()\nconst textarea = shallowRef<HTMLTextAreaElement>()\n\nconst hovering = ref(false)\nconst passwordVisible = ref(false)\nconst countStyle = ref<StyleValue>()\nconst clearIconStyle = ref<StyleValue>()\nconst textareaCalcStyle = shallowRef(props.inputStyle)\nconst saveValue = ref('')\nconst textareaHeight = ref<string>()\n\nconst _ref = computed(() => input.value || textarea.value)\n\n// wrapperRef for type=\"text\", handleFocus and handleBlur for type=\"textarea\"\n// @ts-ignore - used in template ref binding, TS cannot detect template usage\nconst { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(\n _ref,\n {\n disabled: inputDisabled,\n afterBlur() {\n if (props.validateEvent) {\n elFormItem?.validate?.('blur').catch(NOOP)\n }\n },\n }\n)\n\nconst needStatusIcon = computed(() => elForm?.statusIcon ?? false)\nconst validateState = computed(() => elFormItem?.validateState || '')\nconst validateIcon = computed(\n () => validateState.value && ValidateComponentsMap[validateState.value]\n)\nconst passwordIcon = computed(() => (passwordVisible.value ? View : Hide))\nconst containerStyle = computed<StyleValue>(() => [\n rawAttrs.style as StyleValue,\n])\nconst textareaStyle = computed<StyleValue>(() => [\n props.inputStyle,\n textareaCalcStyle.value,\n { resize: props.resize },\n textareaHeight.value ? { height: textareaHeight.value } : undefined,\n])\nconst nativeInputValue = computed(() =>\n isNil(props.modelValue) ? '' : String(props.modelValue)\n)\nconst renderClear = computed(\n () => props.clearable && !inputDisabled.value && !props.readonly\n)\nconst showClear = computed(\n () =>\n renderClear.value &&\n !!nativeInputValue.value &&\n (isFocused.value || hovering.value)\n)\nconst showPwdVisible = computed(\n () => props.showPassword && !inputDisabled.value && !!nativeInputValue.value\n)\nconst isWordLimitVisible = computed(\n () =>\n props.showWordLimit &&\n !!maxlength.value &&\n (props.type === 'text' || props.type === 'textarea') &&\n !inputDisabled.value &&\n !props.readonly &&\n !props.showPassword\n)\nconst textLength = computed(() => {\n if (props.countGraphemes && props.showWordLimit) {\n return props.countGraphemes(nativeInputValue.value)\n }\n return nativeInputValue.value.length\n})\nconst inputExceed = computed(\n () =>\n // show exceed style if length of initial value greater then maxlength\n !!isWordLimitVisible.value && textLength.value > Number(maxlength.value)\n)\nconst suffixVisible = computed(\n () =>\n !!slots.suffix ||\n !!props.suffixIcon ||\n props.clearable ||\n props.showPassword ||\n isWordLimitVisible.value ||\n (!!validateState.value && needStatusIcon.value)\n)\nconst hasModelModifiers = computed(\n () => !!Object.keys(props.modelModifiers).length\n)\n\nconst [recordCursor, setCursor] = useCursor(input)\n\nlet rAFId: number | undefined\n\nuseResizeObserver(textarea, (entries) => {\n onceInitSizeTextarea()\n if (\n (!isWordLimitVisible.value && !renderClear.value) ||\n (props.resize !== 'both' && props.resize !== 'horizontal')\n )\n return\n const entry = entries[0]\n const { width } = entry.target.getBoundingClientRect()\n\n const updateStyle = () => {\n rAFId = undefined\n countStyle.value = {\n /** right: 100% - (width - right(10)) */\n right: `calc(100% - ${width - 10}px)`,\n }\n clearIconStyle.value = {\n /** right: 100% - (width - right(11)) */\n right: `calc(100% - ${width - 11}px)`,\n }\n }\n\n rAFId && cAF(rAFId)\n rAFId = rAF(updateStyle)\n})\n\nconst resizeTextarea = () => {\n const { type, autosize } = props\n\n if (!isClient || type !== 'textarea' || !textarea.value) return\n\n if (autosize) {\n const minRows = isObject(autosize) ? autosize.minRows : undefined\n const maxRows = isObject(autosize) ? autosize.maxRows : undefined\n const textareaStyle = calcTextareaHeight(textarea.value, minRows, maxRows)\n\n // If the scrollbar is displayed, the height of the textarea needs more space than the calculated height.\n // If set textarea height in this case, the scrollbar will not hide.\n // So we need to hide scrollbar first, and reset it in next tick.\n // see https://github.com/element-plus/element-plus/issues/8825\n textareaCalcStyle.value = {\n overflowY: 'hidden',\n ...textareaStyle,\n }\n\n nextTick(() => {\n // NOTE: Force repaint to make sure the style set above is applied.\n textarea.value!.offsetHeight\n textareaCalcStyle.value = textareaStyle\n })\n } else {\n textareaCalcStyle.value = {\n minHeight: calcTextareaHeight(textarea.value).minHeight,\n }\n }\n}\n\nconst createOnceInitResize = (resizeTextarea: () => void) => {\n let isInit = false\n return () => {\n if (isInit || !props.autosize) {\n if (props.resize !== 'none') {\n // The execution here may occur before `setTimeout(resizeTextarea)`,\n // potentially causing a regression of issue #21836, so the assignment needs to be deferred.\n setTimeout(() => {\n textareaHeight.value = textarea.value?.style.height\n })\n }\n return\n }\n const isElHidden = textarea.value?.offsetParent === null\n if (!isElHidden) {\n setTimeout(resizeTextarea)\n isInit = true\n }\n }\n}\n// fix: https://github.com/element-plus/element-plus/issues/12074\nconst onceInitSizeTextarea = createOnceInitResize(resizeTextarea)\n\nconst setNativeInputValue = () => {\n const input = _ref.value\n const formatterValue = props.formatter\n ? props.formatter(nativeInputValue.value)\n : nativeInputValue.value\n if (!input || input.value === formatterValue || props.type === 'file') return\n input.value = formatterValue\n}\n\nconst formatValue = (value: string) => {\n const { trim, number } = props.modelModifiers\n if (trim) {\n value = value.trim()\n }\n if (number) {\n value = `${looseToNumber(value)}`\n }\n if (props.formatter && props.parser) {\n value = props.parser(value)\n }\n return value\n}\n\nconst handleInput = async (event: Event) => {\n // should not emit input during composition\n // see: https://github.com/ElemeFE/element/issues/10516\n if (isComposing.value) return\n\n const { lazy } = props.modelModifiers\n let { value } = event.target as TargetElement\n let shouldForceNativeUpdate = false\n if (lazy) {\n emit(INPUT_EVENT, value)\n return\n }\n\n value = formatValue(value)\n\n if (props.countGraphemes && maxlength.value != null) {\n const limit = Number(maxlength.value)\n const graphemes = props.countGraphemes(value)\n const saveGraphemes = props.countGraphemes(saveValue.value)\n if (graphemes > limit && graphemes > saveGraphemes) {\n // If current value already exceeds limit, block further input and keep exceed state.\n if (saveGraphemes > limit) {\n value = saveValue.value\n shouldForceNativeUpdate = true\n } else {\n // Keep unchanged suffix like native maxlength behavior.\n // Instead of truncating from the end of the whole string,\n // only limit the inserted segment to available capacity.\n const prevValue = saveValue.value\n const nextValue = value\n let prefixLen = 0\n\n while (\n prefixLen < prevValue.length &&\n prefixLen < nextValue.length &&\n prevValue[prefixLen] === nextValue[prefixLen]\n ) {\n prefixLen++\n }\n\n let prevSuffixIndex = prevValue.length\n let nextSuffixIndex = nextValue.length\n while (\n prevSuffixIndex > prefixLen &&\n nextSuffixIndex > prefixLen &&\n prevValue[prevSuffixIndex - 1] === nextValue[nextSuffixIndex - 1]\n ) {\n prevSuffixIndex--\n nextSuffixIndex--\n }\n\n const before = nextValue.slice(0, prefixLen)\n const removed = prevValue.slice(prefixLen, prevSuffixIndex)\n const inserted = nextValue.slice(prefixLen, nextSuffixIndex)\n const after = nextValue.slice(nextSuffixIndex)\n\n const removedCount = props.countGraphemes(removed)\n const baseCount = saveGraphemes - removedCount\n const availableInserted = Math.max(0, limit - baseCount)\n\n let acceptedInserted = ''\n if (availableInserted > 0) {\n // Use Intl.Segmenter for proper grapheme cluster iteration if available.\n if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {\n const segmenter = new Intl.Segmenter(undefined, {\n granularity: 'grapheme',\n })\n for (const { segment } of segmenter.segment(inserted)) {\n const candidate = acceptedInserted + segment\n const newCount = props.countGraphemes(candidate)\n if (newCount > availableInserted) break\n acceptedInserted = candidate\n }\n } else {\n // Fallback to code-point iteration for older environments.\n for (const char of Array.from(inserted)) {\n const candidate = acceptedInserted + char\n const newCount = props.countGraphemes(candidate)\n if (newCount > availableInserted) break\n acceptedInserted = candidate\n }\n }\n }\n\n value = before + acceptedInserted + after\n shouldForceNativeUpdate = true\n }\n }\n }\n\n // hack for https://github.com/ElemeFE/element/issues/8548\n // should remove the following line when we don't support IE\n if (String(value) === nativeInputValue.value) {\n // preserve native features while being compatible with #9501\n if (props.formatter || shouldForceNativeUpdate) {\n const target = event.target as TargetElement\n const blockedValue = target.value\n const selectionStart = target.selectionStart\n const selectionEnd = target.selectionEnd\n setNativeInputValue()\n // Keep caret position stable when input is blocked and value is reset.\n if (\n shouldForceNativeUpdate &&\n _ref.value &&\n selectionStart != null &&\n selectionEnd != null\n ) {\n const restoredValue = _ref.value.value\n const afterTxt = blockedValue.slice(Math.max(0, selectionEnd))\n let caretPos = Math.min(selectionStart, restoredValue.length)\n\n if (afterTxt && restoredValue.endsWith(afterTxt)) {\n caretPos = restoredValue.length - afterTxt.length\n }\n\n _ref.value.setSelectionRange(caretPos, caretPos)\n }\n }\n return\n }\n saveValue.value = value\n\n recordCursor()\n emit(UPDATE_MODEL_EVENT, value)\n emit(INPUT_EVENT, value)\n\n // ensure native input value is controlled\n // see: https://github.com/ElemeFE/element/issues/12850\n await nextTick()\n\n if ((props.formatter && props.parser) || !hasModelModifiers.value) {\n setNativeInputValue()\n }\n setCursor()\n}\n\nconst handleChange = async (event: Event) => {\n let { value } = event.target as TargetElement\n\n value = formatValue(value)\n if (props.modelModifiers.lazy) {\n emit(UPDATE_MODEL_EVENT, value)\n }\n emit(CHANGE_EVENT, value, event)\n\n await nextTick()\n setNativeInputValue()\n}\n\nconst {\n isComposing,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n} = useComposition({ emit, afterComposition: handleInput })\n\nconst handlePasswordVisible = () => {\n passwordVisible.value = !passwordVisible.value\n}\n\nconst focus = () => _ref.value?.focus()\n\nconst blur = () => _ref.value?.blur()\n\nconst handleMouseLeave = (evt: MouseEvent) => {\n hovering.value = false\n emit('mouseleave', evt)\n}\n\nconst handleMouseEnter = (evt: MouseEvent) => {\n hovering.value = true\n emit('mouseenter', evt)\n}\n\nconst handleKeydown = (evt: KeyboardEvent) => {\n emit('keydown', evt)\n}\n\nconst select = () => {\n _ref.value?.select()\n}\n\nconst clear = (evt?: MouseEvent) => {\n emit(UPDATE_MODEL_EVENT, '')\n emit(CHANGE_EVENT, '')\n emit('clear', evt)\n emit(INPUT_EVENT, '')\n}\n\nwatch(\n () => props.modelValue,\n () => {\n nextTick(() => {\n resizeTextarea()\n if (props.autosize) {\n textareaHeight.value = undefined\n }\n })\n if (props.validateEvent) {\n elFormItem?.validate?.('change').catch(NOOP)\n }\n }\n)\n\nwatch(\n () => nativeInputValue.value,\n (val) => {\n saveValue.value = val\n },\n { immediate: true }\n)\n\n// native input value is set explicitly\n// do not use v-model / :value in template\n// see: https://github.com/ElemeFE/element/issues/14521\nwatch(nativeInputValue, (newValue) => {\n if (!_ref.value) {\n return\n }\n const { trim, number } = props.modelModifiers\n const elValue = _ref.value.value\n const displayValue =\n (number || props.type === 'number') && !/^0\\d/.test(elValue)\n ? `${looseToNumber(elValue)}`\n : elValue\n\n if (displayValue === newValue) {\n return\n }\n\n if (document.activeElement === _ref.value && _ref.value.type !== 'range') {\n if (trim && displayValue.trim() === newValue) {\n return\n }\n }\n\n setNativeInputValue()\n})\n\n// when change between <input> and <textarea>,\n// update DOM dependent value and styles\n// https://github.com/ElemeFE/element/issues/14857\nwatch(\n () => props.type,\n async () => {\n await nextTick()\n setNativeInputValue()\n resizeTextarea()\n }\n)\n\nonMounted(() => {\n if (!props.formatter && props.parser) {\n debugWarn(\n COMPONENT_NAME,\n 'If you set the parser, you also need to set the formatter.'\n )\n }\n setNativeInputValue()\n nextTick(resizeTextarea)\n})\n\nonBeforeUnmount(() => {\n rAFId && cAF(rAFId)\n})\n\ndefineExpose({\n /** @description HTML input element */\n input,\n /** @description HTML textarea element */\n textarea,\n /** @description HTML element, input or textarea */\n ref: _ref,\n /** @description style of textarea. */\n textareaStyle,\n\n /** @description from props (used on unit test) */\n autosize: toRef(props, 'autosize'),\n\n /** @description is input composing */\n isComposing,\n\n /** @description whether the password is visible */\n passwordVisible,\n\n /** @description HTML input element native method */\n focus,\n /** @description HTML input element native method */\n blur,\n /** @description HTML input element native method */\n select,\n /** @description clear input value */\n clear,\n /** @description resize textarea. */\n resizeTextarea,\n})\n</script>\n"],"mappings":""}
@@ -134,7 +134,7 @@ declare const messageProps: {
134
134
  readonly type: EpPropFinalized<StringConstructor, "info" | "primary" | "success" | "warning" | "error", unknown, "info", boolean>;
135
135
  readonly plain: EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
136
136
  readonly offset: EpPropFinalized<NumberConstructor, unknown, unknown, 16, boolean>;
137
- readonly placement: EpPropFinalized<StringConstructor, "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right", unknown, undefined, boolean>;
137
+ readonly placement: EpPropFinalized<StringConstructor, "top" | "bottom" | "top-right" | "top-left" | "bottom-right" | "bottom-left", unknown, undefined, boolean>;
138
138
  readonly zIndex: EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
139
139
  readonly grouping: EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
140
140
  readonly repeatNum: EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
@@ -110,7 +110,7 @@ declare const notificationProps: {
110
110
  readonly validator: ((val: unknown) => boolean) | undefined;
111
111
  __epPropKey: true;
112
112
  };
113
- readonly position: EpPropFinalized<StringConstructor, "top-left" | "top-right" | "bottom-left" | "bottom-right", unknown, "top-right", boolean>;
113
+ readonly position: EpPropFinalized<StringConstructor, "top-right" | "top-left" | "bottom-right" | "bottom-left", unknown, "top-right", boolean>;
114
114
  readonly showClose: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
115
115
  readonly title: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
116
116
  readonly type: EpPropFinalized<StringConstructor, "" | "info" | "primary" | "success" | "warning" | "error", unknown, "", boolean>;
package/es/version.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region ../../packages/element-plus/version.ts
2
- const version = "0.0.20260426";
2
+ const version = "0.0.20260427";
3
3
 
4
4
  //#endregion
5
5
  export { version };
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","names":[],"sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.20260426'\n"],"mappings":";AAAA,MAAa,UAAU"}
1
+ {"version":3,"file":"version.mjs","names":[],"sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.20260427'\n"],"mappings":";AAAA,MAAa,UAAU"}
@@ -1,5 +1,6 @@
1
1
  const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
2
2
  const require_event = require('../../../constants/event.js');
3
+ const require_raf = require('../../../utils/raf.js');
3
4
  const require_error = require('../../../utils/error.js');
4
5
  const require_icon = require('../../../utils/vue/icon.js');
5
6
  const require_index = require('../../../hooks/use-attrs/index.js');
@@ -93,6 +94,7 @@ var input_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.
93
94
  const hovering = (0, vue.ref)(false);
94
95
  const passwordVisible = (0, vue.ref)(false);
95
96
  const countStyle = (0, vue.ref)();
97
+ const clearIconStyle = (0, vue.ref)();
96
98
  const textareaCalcStyle = (0, vue.shallowRef)(props.inputStyle);
97
99
  const saveValue = (0, vue.ref)("");
98
100
  const textareaHeight = (0, vue.ref)();
@@ -127,11 +129,18 @@ var input_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.
127
129
  const suffixVisible = (0, vue.computed)(() => !!slots.suffix || !!props.suffixIcon || props.clearable || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
128
130
  const hasModelModifiers = (0, vue.computed)(() => !!Object.keys(props.modelModifiers).length);
129
131
  const [recordCursor, setCursor] = require_index$2.useCursor(input);
132
+ let rAFId;
130
133
  (0, _vueuse_core.useResizeObserver)(textarea, (entries) => {
131
134
  onceInitSizeTextarea();
132
- if (!isWordLimitVisible.value || props.resize !== "both" && props.resize !== "horizontal") return;
133
- const { width } = entries[0].contentRect;
134
- countStyle.value = { right: `calc(100% - ${width + 22 - 10}px)` };
135
+ if (!isWordLimitVisible.value && !renderClear.value || props.resize !== "both" && props.resize !== "horizontal") return;
136
+ const { width } = entries[0].target.getBoundingClientRect();
137
+ const updateStyle = () => {
138
+ rAFId = void 0;
139
+ countStyle.value = { right: `calc(100% - ${width - 10}px)` };
140
+ clearIconStyle.value = { right: `calc(100% - ${width - 11}px)` };
141
+ };
142
+ rAFId && require_raf.cAF(rAFId);
143
+ rAFId = require_raf.rAF(updateStyle);
135
144
  });
136
145
  const resizeTextarea = () => {
137
146
  const { type, autosize } = props;
@@ -323,6 +332,9 @@ var input_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.
323
332
  setNativeInputValue();
324
333
  (0, vue.nextTick)(resizeTextarea);
325
334
  });
335
+ (0, vue.onBeforeUnmount)(() => {
336
+ rAFId && require_raf.cAF(rAFId);
337
+ });
326
338
  __expose({
327
339
  input,
328
340
  textarea,
@@ -497,12 +509,17 @@ var input_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.
497
509
  showClear.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(require_index$5.ElIcon), {
498
510
  key: 0,
499
511
  class: (0, vue.normalizeClass)([(0, vue.unref)(nsTextarea).e("icon"), (0, vue.unref)(nsTextarea).e("clear")]),
512
+ style: (0, vue.normalizeStyle)(clearIconStyle.value),
500
513
  onMousedown: (0, vue.withModifiers)((0, vue.unref)(_vue_shared.NOOP), ["prevent"]),
501
514
  onClick: clear
502
515
  }, {
503
516
  default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(__props.clearIcon)))]),
504
517
  _: 1
505
- }, 8, ["class", "onMousedown"])) : (0, vue.createCommentVNode)("v-if", true),
518
+ }, 8, [
519
+ "class",
520
+ "style",
521
+ "onMousedown"
522
+ ])) : (0, vue.createCommentVNode)("v-if", true),
506
523
  isWordLimitVisible.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
507
524
  key: 1,
508
525
  style: (0, vue.normalizeStyle)(countStyle.value),
@@ -1 +1 @@
1
- {"version":3,"file":"input.vue_vue_type_script_setup_true_lang.js","names":["$slots"],"sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n containerKls,\n {\n [nsInput.bm('group', 'append')]: $slots.append,\n [nsInput.bm('group', 'prepend')]: $slots.prepend,\n },\n ]\"\n :style=\"containerStyle\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n >\n <!-- input -->\n <template v-if=\"type !== 'textarea'\">\n <!-- prepend slot -->\n <div v-if=\"$slots.prepend\" :class=\"nsInput.be('group', 'prepend')\">\n <slot name=\"prepend\" />\n </div>\n\n <div ref=\"wrapperRef\" :class=\"wrapperKls\">\n <!-- prefix slot -->\n <span v-if=\"$slots.prefix || prefixIcon\" :class=\"nsInput.e('prefix')\">\n <span :class=\"nsInput.e('prefix-inner')\">\n <slot name=\"prefix\" />\n <el-icon v-if=\"prefixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"prefixIcon\" />\n </el-icon>\n </span>\n </span>\n\n <input\n :id=\"inputId\"\n ref=\"input\"\n :class=\"nsInput.e('inner')\"\n v-bind=\"attrs\"\n :name=\"name\"\n :minlength=\"countGraphemes ? undefined : minlength\"\n :maxlength=\"countGraphemes ? undefined : maxlength\"\n :type=\"showPassword ? (passwordVisible ? 'text' : 'password') : type\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :tabindex=\"tabindex\"\n :aria-label=\"ariaLabel\"\n :placeholder=\"placeholder\"\n :style=\"inputStyle\"\n :form=\"form\"\n :autofocus=\"autofocus\"\n :role=\"containerRole\"\n :inputmode=\"inputmode\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n\n <!-- suffix slot -->\n <span v-if=\"suffixVisible\" :class=\"nsInput.e('suffix')\">\n <span :class=\"nsInput.e('suffix-inner')\">\n <el-icon\n v-if=\"renderClear\"\n :class=\"[nsInput.e('icon'), nsInput.e('clear')]\"\n :style=\"{ visibility: showClear ? 'visible' : 'hidden' }\"\n @mousedown.prevent=\"NOOP\"\n @click=\"clear\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <template\n v-if=\"!showClear || !showPwdVisible || !isWordLimitVisible\"\n >\n <slot name=\"suffix\" />\n <el-icon v-if=\"suffixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"suffixIcon\" />\n </el-icon>\n </template>\n <el-icon\n v-if=\"showPwdVisible\"\n :class=\"[nsInput.e('icon'), nsInput.e('password')]\"\n @click=\"handlePasswordVisible\"\n @mousedown.prevent=\"NOOP\"\n @mouseup.prevent=\"NOOP\"\n >\n <slot name=\"password-icon\" :visible=\"passwordVisible\">\n <component :is=\"passwordIcon\" />\n </slot>\n </el-icon>\n <span\n v-if=\"isWordLimitVisible\"\n :class=\"[\n nsInput.e('count'),\n nsInput.is('outside', wordLimitPosition === 'outside'),\n ]\"\n >\n <span :class=\"nsInput.e('count-inner')\">\n {{ textLength }} / {{ maxlength }}\n </span>\n </span>\n <el-icon\n v-if=\"validateState && validateIcon && needStatusIcon\"\n :class=\"[\n nsInput.e('icon'),\n nsInput.e('validateIcon'),\n nsInput.is('loading', validateState === 'validating'),\n ]\"\n >\n <component :is=\"validateIcon\" />\n </el-icon>\n </span>\n </span>\n </div>\n\n <!-- append slot -->\n <div v-if=\"$slots.append\" :class=\"nsInput.be('group', 'append')\">\n <slot name=\"append\" />\n </div>\n </template>\n\n <!-- textarea -->\n <template v-else>\n <textarea\n :id=\"inputId\"\n ref=\"textarea\"\n :class=\"[\n nsTextarea.e('inner'),\n nsInput.is('focus', isFocused),\n nsTextarea.is('clearable', clearable),\n ]\"\n v-bind=\"attrs\"\n :name=\"name\"\n :minlength=\"countGraphemes ? undefined : minlength\"\n :maxlength=\"countGraphemes ? undefined : maxlength\"\n :tabindex=\"tabindex\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :style=\"textareaStyle\"\n :aria-label=\"ariaLabel\"\n :placeholder=\"placeholder\"\n :form=\"form\"\n :autofocus=\"autofocus\"\n :rows=\"rows\"\n :role=\"containerRole\"\n :inputmode=\"inputmode\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n <el-icon\n v-if=\"showClear\"\n :class=\"[nsTextarea.e('icon'), nsTextarea.e('clear')]\"\n @mousedown.prevent=\"NOOP\"\n @click=\"clear\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <span\n v-if=\"isWordLimitVisible\"\n :style=\"countStyle\"\n :class=\"[\n nsInput.e('count'),\n nsInput.is('outside', wordLimitPosition === 'outside'),\n ]\"\n >\n {{ textLength }} / {{ maxlength }}\n </span>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\n onMounted,\n ref,\n shallowRef,\n toRef,\n useAttrs as useRawAttrs,\n useSlots,\n watch,\n} from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { isNil } from 'lodash-unified'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Hide, View } from '@element-plus/icons-vue'\nimport {\n useFormDisabled,\n useFormItem,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport {\n NOOP,\n ValidateComponentsMap,\n debugWarn,\n isClient,\n isObject,\n} from '@element-plus/utils'\nimport {\n useAttrs,\n useComposition,\n useCursor,\n useFocusController,\n useNamespace,\n} from '@element-plus/hooks'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { calcTextareaHeight, looseToNumber } from './utils'\nimport { inputEmits, inputPropsDefaults } from './input'\n\nimport type { StyleValue } from 'vue'\nimport type { InputProps } from './input'\n\ntype TargetElement = HTMLInputElement | HTMLTextAreaElement\n\nconst COMPONENT_NAME = 'ElInput'\ndefineOptions({\n name: COMPONENT_NAME,\n inheritAttrs: false,\n})\nconst props = withDefaults(defineProps<InputProps>(), inputPropsDefaults)\nconst emit = defineEmits(inputEmits)\n\nconst rawAttrs = useRawAttrs()\nconst slots = useSlots()\n\nconst containerKls = computed(() => [\n props.type === 'textarea' ? nsTextarea.b() : nsInput.b(),\n nsInput.m(inputSize.value),\n nsInput.is('disabled', inputDisabled.value),\n nsInput.is('exceed', inputExceed.value),\n {\n [nsInput.b('group')]: slots.prepend || slots.append,\n [nsInput.m('prefix')]: slots.prefix || props.prefixIcon,\n [nsInput.m('suffix')]:\n slots.suffix || props.suffixIcon || props.clearable || props.showPassword,\n [nsInput.bm('suffix', 'password-clear')]:\n showClear.value && showPwdVisible.value,\n [nsInput.b('hidden')]: props.type === 'hidden',\n },\n rawAttrs.class,\n])\n\nconst wrapperKls = computed(() => [\n nsInput.e('wrapper'),\n nsInput.is('focus', isFocused.value),\n])\n\nconst attrs = useAttrs()\nconst maxlength = computed(() => props.maxlength?.toString())\n\nconst { form: elForm, formItem: elFormItem } = useFormItem()\nconst { inputId } = useFormItemInputId(props, {\n formItemContext: elFormItem,\n})\nconst inputSize = useFormSize()\nconst inputDisabled = useFormDisabled()\nconst nsInput = useNamespace('input')\nconst nsTextarea = useNamespace('textarea')\n\nconst input = shallowRef<HTMLInputElement>()\nconst textarea = shallowRef<HTMLTextAreaElement>()\n\nconst hovering = ref(false)\nconst passwordVisible = ref(false)\nconst countStyle = ref<StyleValue>()\nconst textareaCalcStyle = shallowRef(props.inputStyle)\nconst saveValue = ref('')\nconst textareaHeight = ref<string>()\n\nconst _ref = computed(() => input.value || textarea.value)\n\n// wrapperRef for type=\"text\", handleFocus and handleBlur for type=\"textarea\"\n// @ts-ignore - used in template ref binding, TS cannot detect template usage\nconst { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(\n _ref,\n {\n disabled: inputDisabled,\n afterBlur() {\n if (props.validateEvent) {\n elFormItem?.validate?.('blur').catch(NOOP)\n }\n },\n }\n)\n\nconst needStatusIcon = computed(() => elForm?.statusIcon ?? false)\nconst validateState = computed(() => elFormItem?.validateState || '')\nconst validateIcon = computed(\n () => validateState.value && ValidateComponentsMap[validateState.value]\n)\nconst passwordIcon = computed(() => (passwordVisible.value ? View : Hide))\nconst containerStyle = computed<StyleValue>(() => [\n rawAttrs.style as StyleValue,\n])\nconst textareaStyle = computed<StyleValue>(() => [\n props.inputStyle,\n textareaCalcStyle.value,\n { resize: props.resize },\n textareaHeight.value ? { height: textareaHeight.value } : undefined,\n])\nconst nativeInputValue = computed(() =>\n isNil(props.modelValue) ? '' : String(props.modelValue)\n)\nconst renderClear = computed(\n () => props.clearable && !inputDisabled.value && !props.readonly\n)\nconst showClear = computed(\n () =>\n renderClear.value &&\n !!nativeInputValue.value &&\n (isFocused.value || hovering.value)\n)\nconst showPwdVisible = computed(\n () => props.showPassword && !inputDisabled.value && !!nativeInputValue.value\n)\nconst isWordLimitVisible = computed(\n () =>\n props.showWordLimit &&\n !!maxlength.value &&\n (props.type === 'text' || props.type === 'textarea') &&\n !inputDisabled.value &&\n !props.readonly &&\n !props.showPassword\n)\nconst textLength = computed(() => {\n if (props.countGraphemes && props.showWordLimit) {\n return props.countGraphemes(nativeInputValue.value)\n }\n return nativeInputValue.value.length\n})\nconst inputExceed = computed(\n () =>\n // show exceed style if length of initial value greater then maxlength\n !!isWordLimitVisible.value && textLength.value > Number(maxlength.value)\n)\nconst suffixVisible = computed(\n () =>\n !!slots.suffix ||\n !!props.suffixIcon ||\n props.clearable ||\n props.showPassword ||\n isWordLimitVisible.value ||\n (!!validateState.value && needStatusIcon.value)\n)\nconst hasModelModifiers = computed(\n () => !!Object.keys(props.modelModifiers).length\n)\n\nconst [recordCursor, setCursor] = useCursor(input)\n\nuseResizeObserver(textarea, (entries) => {\n onceInitSizeTextarea()\n if (\n !isWordLimitVisible.value ||\n (props.resize !== 'both' && props.resize !== 'horizontal')\n )\n return\n const entry = entries[0]\n const { width } = entry.contentRect\n countStyle.value = {\n /** right: 100% - width + padding(22) - right(10) */\n right: `calc(100% - ${width + 22 - 10}px)`,\n }\n})\n\nconst resizeTextarea = () => {\n const { type, autosize } = props\n\n if (!isClient || type !== 'textarea' || !textarea.value) return\n\n if (autosize) {\n const minRows = isObject(autosize) ? autosize.minRows : undefined\n const maxRows = isObject(autosize) ? autosize.maxRows : undefined\n const textareaStyle = calcTextareaHeight(textarea.value, minRows, maxRows)\n\n // If the scrollbar is displayed, the height of the textarea needs more space than the calculated height.\n // If set textarea height in this case, the scrollbar will not hide.\n // So we need to hide scrollbar first, and reset it in next tick.\n // see https://github.com/element-plus/element-plus/issues/8825\n textareaCalcStyle.value = {\n overflowY: 'hidden',\n ...textareaStyle,\n }\n\n nextTick(() => {\n // NOTE: Force repaint to make sure the style set above is applied.\n textarea.value!.offsetHeight\n textareaCalcStyle.value = textareaStyle\n })\n } else {\n textareaCalcStyle.value = {\n minHeight: calcTextareaHeight(textarea.value).minHeight,\n }\n }\n}\n\nconst createOnceInitResize = (resizeTextarea: () => void) => {\n let isInit = false\n return () => {\n if (isInit || !props.autosize) {\n if (props.resize !== 'none') {\n // The execution here may occur before `setTimeout(resizeTextarea)`,\n // potentially causing a regression of issue #21836, so the assignment needs to be deferred.\n setTimeout(() => {\n textareaHeight.value = textarea.value?.style.height\n })\n }\n return\n }\n const isElHidden = textarea.value?.offsetParent === null\n if (!isElHidden) {\n setTimeout(resizeTextarea)\n isInit = true\n }\n }\n}\n// fix: https://github.com/element-plus/element-plus/issues/12074\nconst onceInitSizeTextarea = createOnceInitResize(resizeTextarea)\n\nconst setNativeInputValue = () => {\n const input = _ref.value\n const formatterValue = props.formatter\n ? props.formatter(nativeInputValue.value)\n : nativeInputValue.value\n if (!input || input.value === formatterValue || props.type === 'file') return\n input.value = formatterValue\n}\n\nconst formatValue = (value: string) => {\n const { trim, number } = props.modelModifiers\n if (trim) {\n value = value.trim()\n }\n if (number) {\n value = `${looseToNumber(value)}`\n }\n if (props.formatter && props.parser) {\n value = props.parser(value)\n }\n return value\n}\n\nconst handleInput = async (event: Event) => {\n // should not emit input during composition\n // see: https://github.com/ElemeFE/element/issues/10516\n if (isComposing.value) return\n\n const { lazy } = props.modelModifiers\n let { value } = event.target as TargetElement\n let shouldForceNativeUpdate = false\n if (lazy) {\n emit(INPUT_EVENT, value)\n return\n }\n\n value = formatValue(value)\n\n if (props.countGraphemes && maxlength.value != null) {\n const limit = Number(maxlength.value)\n const graphemes = props.countGraphemes(value)\n const saveGraphemes = props.countGraphemes(saveValue.value)\n if (graphemes > limit && graphemes > saveGraphemes) {\n // If current value already exceeds limit, block further input and keep exceed state.\n if (saveGraphemes > limit) {\n value = saveValue.value\n shouldForceNativeUpdate = true\n } else {\n // Keep unchanged suffix like native maxlength behavior.\n // Instead of truncating from the end of the whole string,\n // only limit the inserted segment to available capacity.\n const prevValue = saveValue.value\n const nextValue = value\n let prefixLen = 0\n\n while (\n prefixLen < prevValue.length &&\n prefixLen < nextValue.length &&\n prevValue[prefixLen] === nextValue[prefixLen]\n ) {\n prefixLen++\n }\n\n let prevSuffixIndex = prevValue.length\n let nextSuffixIndex = nextValue.length\n while (\n prevSuffixIndex > prefixLen &&\n nextSuffixIndex > prefixLen &&\n prevValue[prevSuffixIndex - 1] === nextValue[nextSuffixIndex - 1]\n ) {\n prevSuffixIndex--\n nextSuffixIndex--\n }\n\n const before = nextValue.slice(0, prefixLen)\n const removed = prevValue.slice(prefixLen, prevSuffixIndex)\n const inserted = nextValue.slice(prefixLen, nextSuffixIndex)\n const after = nextValue.slice(nextSuffixIndex)\n\n const removedCount = props.countGraphemes(removed)\n const baseCount = saveGraphemes - removedCount\n const availableInserted = Math.max(0, limit - baseCount)\n\n let acceptedInserted = ''\n if (availableInserted > 0) {\n // Use Intl.Segmenter for proper grapheme cluster iteration if available.\n if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {\n const segmenter = new Intl.Segmenter(undefined, {\n granularity: 'grapheme',\n })\n for (const { segment } of segmenter.segment(inserted)) {\n const candidate = acceptedInserted + segment\n const newCount = props.countGraphemes(candidate)\n if (newCount > availableInserted) break\n acceptedInserted = candidate\n }\n } else {\n // Fallback to code-point iteration for older environments.\n for (const char of Array.from(inserted)) {\n const candidate = acceptedInserted + char\n const newCount = props.countGraphemes(candidate)\n if (newCount > availableInserted) break\n acceptedInserted = candidate\n }\n }\n }\n\n value = before + acceptedInserted + after\n shouldForceNativeUpdate = true\n }\n }\n }\n\n // hack for https://github.com/ElemeFE/element/issues/8548\n // should remove the following line when we don't support IE\n if (String(value) === nativeInputValue.value) {\n // preserve native features while being compatible with #9501\n if (props.formatter || shouldForceNativeUpdate) {\n const target = event.target as TargetElement\n const blockedValue = target.value\n const selectionStart = target.selectionStart\n const selectionEnd = target.selectionEnd\n setNativeInputValue()\n // Keep caret position stable when input is blocked and value is reset.\n if (\n shouldForceNativeUpdate &&\n _ref.value &&\n selectionStart != null &&\n selectionEnd != null\n ) {\n const restoredValue = _ref.value.value\n const afterTxt = blockedValue.slice(Math.max(0, selectionEnd))\n let caretPos = Math.min(selectionStart, restoredValue.length)\n\n if (afterTxt && restoredValue.endsWith(afterTxt)) {\n caretPos = restoredValue.length - afterTxt.length\n }\n\n _ref.value.setSelectionRange(caretPos, caretPos)\n }\n }\n return\n }\n saveValue.value = value\n\n recordCursor()\n emit(UPDATE_MODEL_EVENT, value)\n emit(INPUT_EVENT, value)\n\n // ensure native input value is controlled\n // see: https://github.com/ElemeFE/element/issues/12850\n await nextTick()\n\n if ((props.formatter && props.parser) || !hasModelModifiers.value) {\n setNativeInputValue()\n }\n setCursor()\n}\n\nconst handleChange = async (event: Event) => {\n let { value } = event.target as TargetElement\n\n value = formatValue(value)\n if (props.modelModifiers.lazy) {\n emit(UPDATE_MODEL_EVENT, value)\n }\n emit(CHANGE_EVENT, value, event)\n\n await nextTick()\n setNativeInputValue()\n}\n\nconst {\n isComposing,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n} = useComposition({ emit, afterComposition: handleInput })\n\nconst handlePasswordVisible = () => {\n passwordVisible.value = !passwordVisible.value\n}\n\nconst focus = () => _ref.value?.focus()\n\nconst blur = () => _ref.value?.blur()\n\nconst handleMouseLeave = (evt: MouseEvent) => {\n hovering.value = false\n emit('mouseleave', evt)\n}\n\nconst handleMouseEnter = (evt: MouseEvent) => {\n hovering.value = true\n emit('mouseenter', evt)\n}\n\nconst handleKeydown = (evt: KeyboardEvent) => {\n emit('keydown', evt)\n}\n\nconst select = () => {\n _ref.value?.select()\n}\n\nconst clear = (evt?: MouseEvent) => {\n emit(UPDATE_MODEL_EVENT, '')\n emit(CHANGE_EVENT, '')\n emit('clear', evt)\n emit(INPUT_EVENT, '')\n}\n\nwatch(\n () => props.modelValue,\n () => {\n nextTick(() => {\n resizeTextarea()\n if (props.autosize) {\n textareaHeight.value = undefined\n }\n })\n if (props.validateEvent) {\n elFormItem?.validate?.('change').catch(NOOP)\n }\n }\n)\n\nwatch(\n () => nativeInputValue.value,\n (val) => {\n saveValue.value = val\n },\n { immediate: true }\n)\n\n// native input value is set explicitly\n// do not use v-model / :value in template\n// see: https://github.com/ElemeFE/element/issues/14521\nwatch(nativeInputValue, (newValue) => {\n if (!_ref.value) {\n return\n }\n const { trim, number } = props.modelModifiers\n const elValue = _ref.value.value\n const displayValue =\n (number || props.type === 'number') && !/^0\\d/.test(elValue)\n ? `${looseToNumber(elValue)}`\n : elValue\n\n if (displayValue === newValue) {\n return\n }\n\n if (document.activeElement === _ref.value && _ref.value.type !== 'range') {\n if (trim && displayValue.trim() === newValue) {\n return\n }\n }\n\n setNativeInputValue()\n})\n\n// when change between <input> and <textarea>,\n// update DOM dependent value and styles\n// https://github.com/ElemeFE/element/issues/14857\nwatch(\n () => props.type,\n async () => {\n await nextTick()\n setNativeInputValue()\n resizeTextarea()\n }\n)\n\nonMounted(() => {\n if (!props.formatter && props.parser) {\n debugWarn(\n COMPONENT_NAME,\n 'If you set the parser, you also need to set the formatter.'\n )\n }\n setNativeInputValue()\n nextTick(resizeTextarea)\n})\n\ndefineExpose({\n /** @description HTML input element */\n input,\n /** @description HTML textarea element */\n textarea,\n /** @description HTML element, input or textarea */\n ref: _ref,\n /** @description style of textarea. */\n textareaStyle,\n\n /** @description from props (used on unit test) */\n autosize: toRef(props, 'autosize'),\n\n /** @description is input composing */\n isComposing,\n\n /** @description whether the password is visible */\n passwordVisible,\n\n /** @description HTML input element native method */\n focus,\n /** @description HTML input element native method */\n blur,\n /** @description HTML input element native method */\n select,\n /** @description clear input value */\n clear,\n /** @description resize textarea. */\n resizeTextarea,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmOA,MAAM,iBAAiB;;;;;;;;EAKvB,MAAM,QAAQ;EACd,MAAM,OAAO;EAEb,MAAM,8BAAuB;EAC7B,MAAM,2BAAiB;EAEvB,MAAM,uCAA8B;GAClC,MAAM,SAAS,aAAa,WAAW,GAAG,GAAG,QAAQ,GAAG;GACxD,QAAQ,EAAE,UAAU,MAAM;GAC1B,QAAQ,GAAG,YAAY,cAAc,MAAM;GAC3C,QAAQ,GAAG,UAAU,YAAY,MAAM;GACvC;KACG,QAAQ,EAAE,QAAQ,GAAG,MAAM,WAAW,MAAM;KAC5C,QAAQ,EAAE,SAAS,GAAG,MAAM,UAAU,MAAM;KAC5C,QAAQ,EAAE,SAAS,GAClB,MAAM,UAAU,MAAM,cAAc,MAAM,aAAa,MAAM;KAC9D,QAAQ,GAAG,UAAU,iBAAiB,GACrC,UAAU,SAAS,eAAe;KACnC,QAAQ,EAAE,SAAS,GAAG,MAAM,SAAS;IACvC;GACD,SAAS;GACV,CAAA;EAED,MAAM,qCAA4B,CAChC,QAAQ,EAAE,UAAU,EACpB,QAAQ,GAAG,SAAS,UAAU,MAAM,CACrC,CAAA;EAED,MAAM,QAAQ,wBAAS;EACvB,MAAM,oCAA2B,MAAM,WAAW,UAAU,CAAA;EAE5D,MAAM,EAAE,MAAM,QAAQ,UAAU,eAAe,mCAAY;EAC3D,MAAM,EAAE,YAAY,yCAAmB,OAAO,EAC5C,iBAAiB,YAClB,CAAA;EACD,MAAM,YAAY,2CAAY;EAC9B,MAAM,gBAAgB,+CAAgB;EACtC,MAAM,UAAU,6BAAa,QAAO;EACpC,MAAM,aAAa,6BAAa,WAAU;EAE1C,MAAM,6BAAqC;EAC3C,MAAM,gCAA2C;EAEjD,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AA;KAC1C,mDAAmB,iBAAI,EAAA,CAAA,UAAA,CAAA;KACvB,SAAO;;qCAEqB,8EAAb,QAAA,UAAS,CAAA;;;IAGnB,mBAAA,2DAQD,QAAA;;KAPJ,+BAAO,WAAA,MAAU;KACjB,+BAAK,gBAAc,QAAO,CAAC,EAAC,QAAA,iBAAqB,QAAO,CAAC,GAAE,WAAY,QAAA,sBAAiB,UAAA;gCAKtF,WAAA,MAAU,GAAG,iCAAM,UAAA,MAAS,EAAA,EAAA"}
1
+ {"version":3,"file":"input.vue_vue_type_script_setup_true_lang.js","names":["$slots"],"sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n containerKls,\n {\n [nsInput.bm('group', 'append')]: $slots.append,\n [nsInput.bm('group', 'prepend')]: $slots.prepend,\n },\n ]\"\n :style=\"containerStyle\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n >\n <!-- input -->\n <template v-if=\"type !== 'textarea'\">\n <!-- prepend slot -->\n <div v-if=\"$slots.prepend\" :class=\"nsInput.be('group', 'prepend')\">\n <slot name=\"prepend\" />\n </div>\n\n <div ref=\"wrapperRef\" :class=\"wrapperKls\">\n <!-- prefix slot -->\n <span v-if=\"$slots.prefix || prefixIcon\" :class=\"nsInput.e('prefix')\">\n <span :class=\"nsInput.e('prefix-inner')\">\n <slot name=\"prefix\" />\n <el-icon v-if=\"prefixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"prefixIcon\" />\n </el-icon>\n </span>\n </span>\n\n <input\n :id=\"inputId\"\n ref=\"input\"\n :class=\"nsInput.e('inner')\"\n v-bind=\"attrs\"\n :name=\"name\"\n :minlength=\"countGraphemes ? undefined : minlength\"\n :maxlength=\"countGraphemes ? undefined : maxlength\"\n :type=\"showPassword ? (passwordVisible ? 'text' : 'password') : type\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :tabindex=\"tabindex\"\n :aria-label=\"ariaLabel\"\n :placeholder=\"placeholder\"\n :style=\"inputStyle\"\n :form=\"form\"\n :autofocus=\"autofocus\"\n :role=\"containerRole\"\n :inputmode=\"inputmode\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n\n <!-- suffix slot -->\n <span v-if=\"suffixVisible\" :class=\"nsInput.e('suffix')\">\n <span :class=\"nsInput.e('suffix-inner')\">\n <el-icon\n v-if=\"renderClear\"\n :class=\"[nsInput.e('icon'), nsInput.e('clear')]\"\n :style=\"{ visibility: showClear ? 'visible' : 'hidden' }\"\n @mousedown.prevent=\"NOOP\"\n @click=\"clear\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <template\n v-if=\"!showClear || !showPwdVisible || !isWordLimitVisible\"\n >\n <slot name=\"suffix\" />\n <el-icon v-if=\"suffixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"suffixIcon\" />\n </el-icon>\n </template>\n <el-icon\n v-if=\"showPwdVisible\"\n :class=\"[nsInput.e('icon'), nsInput.e('password')]\"\n @click=\"handlePasswordVisible\"\n @mousedown.prevent=\"NOOP\"\n @mouseup.prevent=\"NOOP\"\n >\n <slot name=\"password-icon\" :visible=\"passwordVisible\">\n <component :is=\"passwordIcon\" />\n </slot>\n </el-icon>\n <span\n v-if=\"isWordLimitVisible\"\n :class=\"[\n nsInput.e('count'),\n nsInput.is('outside', wordLimitPosition === 'outside'),\n ]\"\n >\n <span :class=\"nsInput.e('count-inner')\">\n {{ textLength }} / {{ maxlength }}\n </span>\n </span>\n <el-icon\n v-if=\"validateState && validateIcon && needStatusIcon\"\n :class=\"[\n nsInput.e('icon'),\n nsInput.e('validateIcon'),\n nsInput.is('loading', validateState === 'validating'),\n ]\"\n >\n <component :is=\"validateIcon\" />\n </el-icon>\n </span>\n </span>\n </div>\n\n <!-- append slot -->\n <div v-if=\"$slots.append\" :class=\"nsInput.be('group', 'append')\">\n <slot name=\"append\" />\n </div>\n </template>\n\n <!-- textarea -->\n <template v-else>\n <textarea\n :id=\"inputId\"\n ref=\"textarea\"\n :class=\"[\n nsTextarea.e('inner'),\n nsInput.is('focus', isFocused),\n nsTextarea.is('clearable', clearable),\n ]\"\n v-bind=\"attrs\"\n :name=\"name\"\n :minlength=\"countGraphemes ? undefined : minlength\"\n :maxlength=\"countGraphemes ? undefined : maxlength\"\n :tabindex=\"tabindex\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :style=\"textareaStyle\"\n :aria-label=\"ariaLabel\"\n :placeholder=\"placeholder\"\n :form=\"form\"\n :autofocus=\"autofocus\"\n :rows=\"rows\"\n :role=\"containerRole\"\n :inputmode=\"inputmode\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n <el-icon\n v-if=\"showClear\"\n :class=\"[nsTextarea.e('icon'), nsTextarea.e('clear')]\"\n :style=\"clearIconStyle\"\n @mousedown.prevent=\"NOOP\"\n @click=\"clear\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <span\n v-if=\"isWordLimitVisible\"\n :style=\"countStyle\"\n :class=\"[\n nsInput.e('count'),\n nsInput.is('outside', wordLimitPosition === 'outside'),\n ]\"\n >\n {{ textLength }} / {{ maxlength }}\n </span>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n shallowRef,\n toRef,\n useAttrs as useRawAttrs,\n useSlots,\n watch,\n} from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { isNil } from 'lodash-unified'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Hide, View } from '@element-plus/icons-vue'\nimport {\n useFormDisabled,\n useFormItem,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport {\n NOOP,\n ValidateComponentsMap,\n cAF,\n debugWarn,\n isClient,\n isObject,\n rAF,\n} from '@element-plus/utils'\nimport {\n useAttrs,\n useComposition,\n useCursor,\n useFocusController,\n useNamespace,\n} from '@element-plus/hooks'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { calcTextareaHeight, looseToNumber } from './utils'\nimport { inputEmits, inputPropsDefaults } from './input'\n\nimport type { StyleValue } from 'vue'\nimport type { InputProps } from './input'\n\ntype TargetElement = HTMLInputElement | HTMLTextAreaElement\n\nconst COMPONENT_NAME = 'ElInput'\ndefineOptions({\n name: COMPONENT_NAME,\n inheritAttrs: false,\n})\nconst props = withDefaults(defineProps<InputProps>(), inputPropsDefaults)\nconst emit = defineEmits(inputEmits)\n\nconst rawAttrs = useRawAttrs()\nconst slots = useSlots()\n\nconst containerKls = computed(() => [\n props.type === 'textarea' ? nsTextarea.b() : nsInput.b(),\n nsInput.m(inputSize.value),\n nsInput.is('disabled', inputDisabled.value),\n nsInput.is('exceed', inputExceed.value),\n {\n [nsInput.b('group')]: slots.prepend || slots.append,\n [nsInput.m('prefix')]: slots.prefix || props.prefixIcon,\n [nsInput.m('suffix')]:\n slots.suffix || props.suffixIcon || props.clearable || props.showPassword,\n [nsInput.bm('suffix', 'password-clear')]:\n showClear.value && showPwdVisible.value,\n [nsInput.b('hidden')]: props.type === 'hidden',\n },\n rawAttrs.class,\n])\n\nconst wrapperKls = computed(() => [\n nsInput.e('wrapper'),\n nsInput.is('focus', isFocused.value),\n])\n\nconst attrs = useAttrs()\nconst maxlength = computed(() => props.maxlength?.toString())\n\nconst { form: elForm, formItem: elFormItem } = useFormItem()\nconst { inputId } = useFormItemInputId(props, {\n formItemContext: elFormItem,\n})\nconst inputSize = useFormSize()\nconst inputDisabled = useFormDisabled()\nconst nsInput = useNamespace('input')\nconst nsTextarea = useNamespace('textarea')\n\nconst input = shallowRef<HTMLInputElement>()\nconst textarea = shallowRef<HTMLTextAreaElement>()\n\nconst hovering = ref(false)\nconst passwordVisible = ref(false)\nconst countStyle = ref<StyleValue>()\nconst clearIconStyle = ref<StyleValue>()\nconst textareaCalcStyle = shallowRef(props.inputStyle)\nconst saveValue = ref('')\nconst textareaHeight = ref<string>()\n\nconst _ref = computed(() => input.value || textarea.value)\n\n// wrapperRef for type=\"text\", handleFocus and handleBlur for type=\"textarea\"\n// @ts-ignore - used in template ref binding, TS cannot detect template usage\nconst { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(\n _ref,\n {\n disabled: inputDisabled,\n afterBlur() {\n if (props.validateEvent) {\n elFormItem?.validate?.('blur').catch(NOOP)\n }\n },\n }\n)\n\nconst needStatusIcon = computed(() => elForm?.statusIcon ?? false)\nconst validateState = computed(() => elFormItem?.validateState || '')\nconst validateIcon = computed(\n () => validateState.value && ValidateComponentsMap[validateState.value]\n)\nconst passwordIcon = computed(() => (passwordVisible.value ? View : Hide))\nconst containerStyle = computed<StyleValue>(() => [\n rawAttrs.style as StyleValue,\n])\nconst textareaStyle = computed<StyleValue>(() => [\n props.inputStyle,\n textareaCalcStyle.value,\n { resize: props.resize },\n textareaHeight.value ? { height: textareaHeight.value } : undefined,\n])\nconst nativeInputValue = computed(() =>\n isNil(props.modelValue) ? '' : String(props.modelValue)\n)\nconst renderClear = computed(\n () => props.clearable && !inputDisabled.value && !props.readonly\n)\nconst showClear = computed(\n () =>\n renderClear.value &&\n !!nativeInputValue.value &&\n (isFocused.value || hovering.value)\n)\nconst showPwdVisible = computed(\n () => props.showPassword && !inputDisabled.value && !!nativeInputValue.value\n)\nconst isWordLimitVisible = computed(\n () =>\n props.showWordLimit &&\n !!maxlength.value &&\n (props.type === 'text' || props.type === 'textarea') &&\n !inputDisabled.value &&\n !props.readonly &&\n !props.showPassword\n)\nconst textLength = computed(() => {\n if (props.countGraphemes && props.showWordLimit) {\n return props.countGraphemes(nativeInputValue.value)\n }\n return nativeInputValue.value.length\n})\nconst inputExceed = computed(\n () =>\n // show exceed style if length of initial value greater then maxlength\n !!isWordLimitVisible.value && textLength.value > Number(maxlength.value)\n)\nconst suffixVisible = computed(\n () =>\n !!slots.suffix ||\n !!props.suffixIcon ||\n props.clearable ||\n props.showPassword ||\n isWordLimitVisible.value ||\n (!!validateState.value && needStatusIcon.value)\n)\nconst hasModelModifiers = computed(\n () => !!Object.keys(props.modelModifiers).length\n)\n\nconst [recordCursor, setCursor] = useCursor(input)\n\nlet rAFId: number | undefined\n\nuseResizeObserver(textarea, (entries) => {\n onceInitSizeTextarea()\n if (\n (!isWordLimitVisible.value && !renderClear.value) ||\n (props.resize !== 'both' && props.resize !== 'horizontal')\n )\n return\n const entry = entries[0]\n const { width } = entry.target.getBoundingClientRect()\n\n const updateStyle = () => {\n rAFId = undefined\n countStyle.value = {\n /** right: 100% - (width - right(10)) */\n right: `calc(100% - ${width - 10}px)`,\n }\n clearIconStyle.value = {\n /** right: 100% - (width - right(11)) */\n right: `calc(100% - ${width - 11}px)`,\n }\n }\n\n rAFId && cAF(rAFId)\n rAFId = rAF(updateStyle)\n})\n\nconst resizeTextarea = () => {\n const { type, autosize } = props\n\n if (!isClient || type !== 'textarea' || !textarea.value) return\n\n if (autosize) {\n const minRows = isObject(autosize) ? autosize.minRows : undefined\n const maxRows = isObject(autosize) ? autosize.maxRows : undefined\n const textareaStyle = calcTextareaHeight(textarea.value, minRows, maxRows)\n\n // If the scrollbar is displayed, the height of the textarea needs more space than the calculated height.\n // If set textarea height in this case, the scrollbar will not hide.\n // So we need to hide scrollbar first, and reset it in next tick.\n // see https://github.com/element-plus/element-plus/issues/8825\n textareaCalcStyle.value = {\n overflowY: 'hidden',\n ...textareaStyle,\n }\n\n nextTick(() => {\n // NOTE: Force repaint to make sure the style set above is applied.\n textarea.value!.offsetHeight\n textareaCalcStyle.value = textareaStyle\n })\n } else {\n textareaCalcStyle.value = {\n minHeight: calcTextareaHeight(textarea.value).minHeight,\n }\n }\n}\n\nconst createOnceInitResize = (resizeTextarea: () => void) => {\n let isInit = false\n return () => {\n if (isInit || !props.autosize) {\n if (props.resize !== 'none') {\n // The execution here may occur before `setTimeout(resizeTextarea)`,\n // potentially causing a regression of issue #21836, so the assignment needs to be deferred.\n setTimeout(() => {\n textareaHeight.value = textarea.value?.style.height\n })\n }\n return\n }\n const isElHidden = textarea.value?.offsetParent === null\n if (!isElHidden) {\n setTimeout(resizeTextarea)\n isInit = true\n }\n }\n}\n// fix: https://github.com/element-plus/element-plus/issues/12074\nconst onceInitSizeTextarea = createOnceInitResize(resizeTextarea)\n\nconst setNativeInputValue = () => {\n const input = _ref.value\n const formatterValue = props.formatter\n ? props.formatter(nativeInputValue.value)\n : nativeInputValue.value\n if (!input || input.value === formatterValue || props.type === 'file') return\n input.value = formatterValue\n}\n\nconst formatValue = (value: string) => {\n const { trim, number } = props.modelModifiers\n if (trim) {\n value = value.trim()\n }\n if (number) {\n value = `${looseToNumber(value)}`\n }\n if (props.formatter && props.parser) {\n value = props.parser(value)\n }\n return value\n}\n\nconst handleInput = async (event: Event) => {\n // should not emit input during composition\n // see: https://github.com/ElemeFE/element/issues/10516\n if (isComposing.value) return\n\n const { lazy } = props.modelModifiers\n let { value } = event.target as TargetElement\n let shouldForceNativeUpdate = false\n if (lazy) {\n emit(INPUT_EVENT, value)\n return\n }\n\n value = formatValue(value)\n\n if (props.countGraphemes && maxlength.value != null) {\n const limit = Number(maxlength.value)\n const graphemes = props.countGraphemes(value)\n const saveGraphemes = props.countGraphemes(saveValue.value)\n if (graphemes > limit && graphemes > saveGraphemes) {\n // If current value already exceeds limit, block further input and keep exceed state.\n if (saveGraphemes > limit) {\n value = saveValue.value\n shouldForceNativeUpdate = true\n } else {\n // Keep unchanged suffix like native maxlength behavior.\n // Instead of truncating from the end of the whole string,\n // only limit the inserted segment to available capacity.\n const prevValue = saveValue.value\n const nextValue = value\n let prefixLen = 0\n\n while (\n prefixLen < prevValue.length &&\n prefixLen < nextValue.length &&\n prevValue[prefixLen] === nextValue[prefixLen]\n ) {\n prefixLen++\n }\n\n let prevSuffixIndex = prevValue.length\n let nextSuffixIndex = nextValue.length\n while (\n prevSuffixIndex > prefixLen &&\n nextSuffixIndex > prefixLen &&\n prevValue[prevSuffixIndex - 1] === nextValue[nextSuffixIndex - 1]\n ) {\n prevSuffixIndex--\n nextSuffixIndex--\n }\n\n const before = nextValue.slice(0, prefixLen)\n const removed = prevValue.slice(prefixLen, prevSuffixIndex)\n const inserted = nextValue.slice(prefixLen, nextSuffixIndex)\n const after = nextValue.slice(nextSuffixIndex)\n\n const removedCount = props.countGraphemes(removed)\n const baseCount = saveGraphemes - removedCount\n const availableInserted = Math.max(0, limit - baseCount)\n\n let acceptedInserted = ''\n if (availableInserted > 0) {\n // Use Intl.Segmenter for proper grapheme cluster iteration if available.\n if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {\n const segmenter = new Intl.Segmenter(undefined, {\n granularity: 'grapheme',\n })\n for (const { segment } of segmenter.segment(inserted)) {\n const candidate = acceptedInserted + segment\n const newCount = props.countGraphemes(candidate)\n if (newCount > availableInserted) break\n acceptedInserted = candidate\n }\n } else {\n // Fallback to code-point iteration for older environments.\n for (const char of Array.from(inserted)) {\n const candidate = acceptedInserted + char\n const newCount = props.countGraphemes(candidate)\n if (newCount > availableInserted) break\n acceptedInserted = candidate\n }\n }\n }\n\n value = before + acceptedInserted + after\n shouldForceNativeUpdate = true\n }\n }\n }\n\n // hack for https://github.com/ElemeFE/element/issues/8548\n // should remove the following line when we don't support IE\n if (String(value) === nativeInputValue.value) {\n // preserve native features while being compatible with #9501\n if (props.formatter || shouldForceNativeUpdate) {\n const target = event.target as TargetElement\n const blockedValue = target.value\n const selectionStart = target.selectionStart\n const selectionEnd = target.selectionEnd\n setNativeInputValue()\n // Keep caret position stable when input is blocked and value is reset.\n if (\n shouldForceNativeUpdate &&\n _ref.value &&\n selectionStart != null &&\n selectionEnd != null\n ) {\n const restoredValue = _ref.value.value\n const afterTxt = blockedValue.slice(Math.max(0, selectionEnd))\n let caretPos = Math.min(selectionStart, restoredValue.length)\n\n if (afterTxt && restoredValue.endsWith(afterTxt)) {\n caretPos = restoredValue.length - afterTxt.length\n }\n\n _ref.value.setSelectionRange(caretPos, caretPos)\n }\n }\n return\n }\n saveValue.value = value\n\n recordCursor()\n emit(UPDATE_MODEL_EVENT, value)\n emit(INPUT_EVENT, value)\n\n // ensure native input value is controlled\n // see: https://github.com/ElemeFE/element/issues/12850\n await nextTick()\n\n if ((props.formatter && props.parser) || !hasModelModifiers.value) {\n setNativeInputValue()\n }\n setCursor()\n}\n\nconst handleChange = async (event: Event) => {\n let { value } = event.target as TargetElement\n\n value = formatValue(value)\n if (props.modelModifiers.lazy) {\n emit(UPDATE_MODEL_EVENT, value)\n }\n emit(CHANGE_EVENT, value, event)\n\n await nextTick()\n setNativeInputValue()\n}\n\nconst {\n isComposing,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n} = useComposition({ emit, afterComposition: handleInput })\n\nconst handlePasswordVisible = () => {\n passwordVisible.value = !passwordVisible.value\n}\n\nconst focus = () => _ref.value?.focus()\n\nconst blur = () => _ref.value?.blur()\n\nconst handleMouseLeave = (evt: MouseEvent) => {\n hovering.value = false\n emit('mouseleave', evt)\n}\n\nconst handleMouseEnter = (evt: MouseEvent) => {\n hovering.value = true\n emit('mouseenter', evt)\n}\n\nconst handleKeydown = (evt: KeyboardEvent) => {\n emit('keydown', evt)\n}\n\nconst select = () => {\n _ref.value?.select()\n}\n\nconst clear = (evt?: MouseEvent) => {\n emit(UPDATE_MODEL_EVENT, '')\n emit(CHANGE_EVENT, '')\n emit('clear', evt)\n emit(INPUT_EVENT, '')\n}\n\nwatch(\n () => props.modelValue,\n () => {\n nextTick(() => {\n resizeTextarea()\n if (props.autosize) {\n textareaHeight.value = undefined\n }\n })\n if (props.validateEvent) {\n elFormItem?.validate?.('change').catch(NOOP)\n }\n }\n)\n\nwatch(\n () => nativeInputValue.value,\n (val) => {\n saveValue.value = val\n },\n { immediate: true }\n)\n\n// native input value is set explicitly\n// do not use v-model / :value in template\n// see: https://github.com/ElemeFE/element/issues/14521\nwatch(nativeInputValue, (newValue) => {\n if (!_ref.value) {\n return\n }\n const { trim, number } = props.modelModifiers\n const elValue = _ref.value.value\n const displayValue =\n (number || props.type === 'number') && !/^0\\d/.test(elValue)\n ? `${looseToNumber(elValue)}`\n : elValue\n\n if (displayValue === newValue) {\n return\n }\n\n if (document.activeElement === _ref.value && _ref.value.type !== 'range') {\n if (trim && displayValue.trim() === newValue) {\n return\n }\n }\n\n setNativeInputValue()\n})\n\n// when change between <input> and <textarea>,\n// update DOM dependent value and styles\n// https://github.com/ElemeFE/element/issues/14857\nwatch(\n () => props.type,\n async () => {\n await nextTick()\n setNativeInputValue()\n resizeTextarea()\n }\n)\n\nonMounted(() => {\n if (!props.formatter && props.parser) {\n debugWarn(\n COMPONENT_NAME,\n 'If you set the parser, you also need to set the formatter.'\n )\n }\n setNativeInputValue()\n nextTick(resizeTextarea)\n})\n\nonBeforeUnmount(() => {\n rAFId && cAF(rAFId)\n})\n\ndefineExpose({\n /** @description HTML input element */\n input,\n /** @description HTML textarea element */\n textarea,\n /** @description HTML element, input or textarea */\n ref: _ref,\n /** @description style of textarea. */\n textareaStyle,\n\n /** @description from props (used on unit test) */\n autosize: toRef(props, 'autosize'),\n\n /** @description is input composing */\n isComposing,\n\n /** @description whether the password is visible */\n passwordVisible,\n\n /** @description HTML input element native method */\n focus,\n /** @description HTML input element native method */\n blur,\n /** @description HTML input element native method */\n select,\n /** @description clear input value */\n clear,\n /** @description resize textarea. */\n resizeTextarea,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuOA,MAAM,iBAAiB;;;;;;;;EAKvB,MAAM,QAAQ;EACd,MAAM,OAAO;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AAA,CAAA;KAC1C,+BAAO,eAAA,MAAc;KACrB,mDAAmB,iBAAI,EAAA,CAAA,UAAA,CAAA;KACvB,SAAO;;qCAEqB,8EAAb,QAAA,UAAS,CAAA;;;;;;;IAGnB,mBAAA,2DAQD,QAAA;;KAPJ,+BAAO,WAAA,MAAU;KACjB,+BAAK,gBAAc,QAAO,CAAC,EAAC,QAAA,iBAAqB,QAAO,CAAC,GAAE,WAAY,QAAA,sBAAiB,UAAA;gCAKtF,WAAA,MAAU,GAAG,iCAAM,UAAA,MAAS,EAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"input2.js","names":[],"sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n containerKls,\n {\n [nsInput.bm('group', 'append')]: $slots.append,\n [nsInput.bm('group', 'prepend')]: $slots.prepend,\n },\n ]\"\n :style=\"containerStyle\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n >\n <!-- input -->\n <template v-if=\"type !== 'textarea'\">\n <!-- prepend slot -->\n <div v-if=\"$slots.prepend\" :class=\"nsInput.be('group', 'prepend')\">\n <slot name=\"prepend\" />\n </div>\n\n <div ref=\"wrapperRef\" :class=\"wrapperKls\">\n <!-- prefix slot -->\n <span v-if=\"$slots.prefix || prefixIcon\" :class=\"nsInput.e('prefix')\">\n <span :class=\"nsInput.e('prefix-inner')\">\n <slot name=\"prefix\" />\n <el-icon v-if=\"prefixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"prefixIcon\" />\n </el-icon>\n </span>\n </span>\n\n <input\n :id=\"inputId\"\n ref=\"input\"\n :class=\"nsInput.e('inner')\"\n v-bind=\"attrs\"\n :name=\"name\"\n :minlength=\"countGraphemes ? undefined : minlength\"\n :maxlength=\"countGraphemes ? undefined : maxlength\"\n :type=\"showPassword ? (passwordVisible ? 'text' : 'password') : type\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :tabindex=\"tabindex\"\n :aria-label=\"ariaLabel\"\n :placeholder=\"placeholder\"\n :style=\"inputStyle\"\n :form=\"form\"\n :autofocus=\"autofocus\"\n :role=\"containerRole\"\n :inputmode=\"inputmode\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n\n <!-- suffix slot -->\n <span v-if=\"suffixVisible\" :class=\"nsInput.e('suffix')\">\n <span :class=\"nsInput.e('suffix-inner')\">\n <el-icon\n v-if=\"renderClear\"\n :class=\"[nsInput.e('icon'), nsInput.e('clear')]\"\n :style=\"{ visibility: showClear ? 'visible' : 'hidden' }\"\n @mousedown.prevent=\"NOOP\"\n @click=\"clear\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <template\n v-if=\"!showClear || !showPwdVisible || !isWordLimitVisible\"\n >\n <slot name=\"suffix\" />\n <el-icon v-if=\"suffixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"suffixIcon\" />\n </el-icon>\n </template>\n <el-icon\n v-if=\"showPwdVisible\"\n :class=\"[nsInput.e('icon'), nsInput.e('password')]\"\n @click=\"handlePasswordVisible\"\n @mousedown.prevent=\"NOOP\"\n @mouseup.prevent=\"NOOP\"\n >\n <slot name=\"password-icon\" :visible=\"passwordVisible\">\n <component :is=\"passwordIcon\" />\n </slot>\n </el-icon>\n <span\n v-if=\"isWordLimitVisible\"\n :class=\"[\n nsInput.e('count'),\n nsInput.is('outside', wordLimitPosition === 'outside'),\n ]\"\n >\n <span :class=\"nsInput.e('count-inner')\">\n {{ textLength }} / {{ maxlength }}\n </span>\n </span>\n <el-icon\n v-if=\"validateState && validateIcon && needStatusIcon\"\n :class=\"[\n nsInput.e('icon'),\n nsInput.e('validateIcon'),\n nsInput.is('loading', validateState === 'validating'),\n ]\"\n >\n <component :is=\"validateIcon\" />\n </el-icon>\n </span>\n </span>\n </div>\n\n <!-- append slot -->\n <div v-if=\"$slots.append\" :class=\"nsInput.be('group', 'append')\">\n <slot name=\"append\" />\n </div>\n </template>\n\n <!-- textarea -->\n <template v-else>\n <textarea\n :id=\"inputId\"\n ref=\"textarea\"\n :class=\"[\n nsTextarea.e('inner'),\n nsInput.is('focus', isFocused),\n nsTextarea.is('clearable', clearable),\n ]\"\n v-bind=\"attrs\"\n :name=\"name\"\n :minlength=\"countGraphemes ? undefined : minlength\"\n :maxlength=\"countGraphemes ? undefined : maxlength\"\n :tabindex=\"tabindex\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :style=\"textareaStyle\"\n :aria-label=\"ariaLabel\"\n :placeholder=\"placeholder\"\n :form=\"form\"\n :autofocus=\"autofocus\"\n :rows=\"rows\"\n :role=\"containerRole\"\n :inputmode=\"inputmode\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n <el-icon\n v-if=\"showClear\"\n :class=\"[nsTextarea.e('icon'), nsTextarea.e('clear')]\"\n @mousedown.prevent=\"NOOP\"\n @click=\"clear\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <span\n v-if=\"isWordLimitVisible\"\n :style=\"countStyle\"\n :class=\"[\n nsInput.e('count'),\n nsInput.is('outside', wordLimitPosition === 'outside'),\n ]\"\n >\n {{ textLength }} / {{ maxlength }}\n </span>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\n onMounted,\n ref,\n shallowRef,\n toRef,\n useAttrs as useRawAttrs,\n useSlots,\n watch,\n} from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { isNil } from 'lodash-unified'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Hide, View } from '@element-plus/icons-vue'\nimport {\n useFormDisabled,\n useFormItem,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport {\n NOOP,\n ValidateComponentsMap,\n debugWarn,\n isClient,\n isObject,\n} from '@element-plus/utils'\nimport {\n useAttrs,\n useComposition,\n useCursor,\n useFocusController,\n useNamespace,\n} from '@element-plus/hooks'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { calcTextareaHeight, looseToNumber } from './utils'\nimport { inputEmits, inputPropsDefaults } from './input'\n\nimport type { StyleValue } from 'vue'\nimport type { InputProps } from './input'\n\ntype TargetElement = HTMLInputElement | HTMLTextAreaElement\n\nconst COMPONENT_NAME = 'ElInput'\ndefineOptions({\n name: COMPONENT_NAME,\n inheritAttrs: false,\n})\nconst props = withDefaults(defineProps<InputProps>(), inputPropsDefaults)\nconst emit = defineEmits(inputEmits)\n\nconst rawAttrs = useRawAttrs()\nconst slots = useSlots()\n\nconst containerKls = computed(() => [\n props.type === 'textarea' ? nsTextarea.b() : nsInput.b(),\n nsInput.m(inputSize.value),\n nsInput.is('disabled', inputDisabled.value),\n nsInput.is('exceed', inputExceed.value),\n {\n [nsInput.b('group')]: slots.prepend || slots.append,\n [nsInput.m('prefix')]: slots.prefix || props.prefixIcon,\n [nsInput.m('suffix')]:\n slots.suffix || props.suffixIcon || props.clearable || props.showPassword,\n [nsInput.bm('suffix', 'password-clear')]:\n showClear.value && showPwdVisible.value,\n [nsInput.b('hidden')]: props.type === 'hidden',\n },\n rawAttrs.class,\n])\n\nconst wrapperKls = computed(() => [\n nsInput.e('wrapper'),\n nsInput.is('focus', isFocused.value),\n])\n\nconst attrs = useAttrs()\nconst maxlength = computed(() => props.maxlength?.toString())\n\nconst { form: elForm, formItem: elFormItem } = useFormItem()\nconst { inputId } = useFormItemInputId(props, {\n formItemContext: elFormItem,\n})\nconst inputSize = useFormSize()\nconst inputDisabled = useFormDisabled()\nconst nsInput = useNamespace('input')\nconst nsTextarea = useNamespace('textarea')\n\nconst input = shallowRef<HTMLInputElement>()\nconst textarea = shallowRef<HTMLTextAreaElement>()\n\nconst hovering = ref(false)\nconst passwordVisible = ref(false)\nconst countStyle = ref<StyleValue>()\nconst textareaCalcStyle = shallowRef(props.inputStyle)\nconst saveValue = ref('')\nconst textareaHeight = ref<string>()\n\nconst _ref = computed(() => input.value || textarea.value)\n\n// wrapperRef for type=\"text\", handleFocus and handleBlur for type=\"textarea\"\n// @ts-ignore - used in template ref binding, TS cannot detect template usage\nconst { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(\n _ref,\n {\n disabled: inputDisabled,\n afterBlur() {\n if (props.validateEvent) {\n elFormItem?.validate?.('blur').catch(NOOP)\n }\n },\n }\n)\n\nconst needStatusIcon = computed(() => elForm?.statusIcon ?? false)\nconst validateState = computed(() => elFormItem?.validateState || '')\nconst validateIcon = computed(\n () => validateState.value && ValidateComponentsMap[validateState.value]\n)\nconst passwordIcon = computed(() => (passwordVisible.value ? View : Hide))\nconst containerStyle = computed<StyleValue>(() => [\n rawAttrs.style as StyleValue,\n])\nconst textareaStyle = computed<StyleValue>(() => [\n props.inputStyle,\n textareaCalcStyle.value,\n { resize: props.resize },\n textareaHeight.value ? { height: textareaHeight.value } : undefined,\n])\nconst nativeInputValue = computed(() =>\n isNil(props.modelValue) ? '' : String(props.modelValue)\n)\nconst renderClear = computed(\n () => props.clearable && !inputDisabled.value && !props.readonly\n)\nconst showClear = computed(\n () =>\n renderClear.value &&\n !!nativeInputValue.value &&\n (isFocused.value || hovering.value)\n)\nconst showPwdVisible = computed(\n () => props.showPassword && !inputDisabled.value && !!nativeInputValue.value\n)\nconst isWordLimitVisible = computed(\n () =>\n props.showWordLimit &&\n !!maxlength.value &&\n (props.type === 'text' || props.type === 'textarea') &&\n !inputDisabled.value &&\n !props.readonly &&\n !props.showPassword\n)\nconst textLength = computed(() => {\n if (props.countGraphemes && props.showWordLimit) {\n return props.countGraphemes(nativeInputValue.value)\n }\n return nativeInputValue.value.length\n})\nconst inputExceed = computed(\n () =>\n // show exceed style if length of initial value greater then maxlength\n !!isWordLimitVisible.value && textLength.value > Number(maxlength.value)\n)\nconst suffixVisible = computed(\n () =>\n !!slots.suffix ||\n !!props.suffixIcon ||\n props.clearable ||\n props.showPassword ||\n isWordLimitVisible.value ||\n (!!validateState.value && needStatusIcon.value)\n)\nconst hasModelModifiers = computed(\n () => !!Object.keys(props.modelModifiers).length\n)\n\nconst [recordCursor, setCursor] = useCursor(input)\n\nuseResizeObserver(textarea, (entries) => {\n onceInitSizeTextarea()\n if (\n !isWordLimitVisible.value ||\n (props.resize !== 'both' && props.resize !== 'horizontal')\n )\n return\n const entry = entries[0]\n const { width } = entry.contentRect\n countStyle.value = {\n /** right: 100% - width + padding(22) - right(10) */\n right: `calc(100% - ${width + 22 - 10}px)`,\n }\n})\n\nconst resizeTextarea = () => {\n const { type, autosize } = props\n\n if (!isClient || type !== 'textarea' || !textarea.value) return\n\n if (autosize) {\n const minRows = isObject(autosize) ? autosize.minRows : undefined\n const maxRows = isObject(autosize) ? autosize.maxRows : undefined\n const textareaStyle = calcTextareaHeight(textarea.value, minRows, maxRows)\n\n // If the scrollbar is displayed, the height of the textarea needs more space than the calculated height.\n // If set textarea height in this case, the scrollbar will not hide.\n // So we need to hide scrollbar first, and reset it in next tick.\n // see https://github.com/element-plus/element-plus/issues/8825\n textareaCalcStyle.value = {\n overflowY: 'hidden',\n ...textareaStyle,\n }\n\n nextTick(() => {\n // NOTE: Force repaint to make sure the style set above is applied.\n textarea.value!.offsetHeight\n textareaCalcStyle.value = textareaStyle\n })\n } else {\n textareaCalcStyle.value = {\n minHeight: calcTextareaHeight(textarea.value).minHeight,\n }\n }\n}\n\nconst createOnceInitResize = (resizeTextarea: () => void) => {\n let isInit = false\n return () => {\n if (isInit || !props.autosize) {\n if (props.resize !== 'none') {\n // The execution here may occur before `setTimeout(resizeTextarea)`,\n // potentially causing a regression of issue #21836, so the assignment needs to be deferred.\n setTimeout(() => {\n textareaHeight.value = textarea.value?.style.height\n })\n }\n return\n }\n const isElHidden = textarea.value?.offsetParent === null\n if (!isElHidden) {\n setTimeout(resizeTextarea)\n isInit = true\n }\n }\n}\n// fix: https://github.com/element-plus/element-plus/issues/12074\nconst onceInitSizeTextarea = createOnceInitResize(resizeTextarea)\n\nconst setNativeInputValue = () => {\n const input = _ref.value\n const formatterValue = props.formatter\n ? props.formatter(nativeInputValue.value)\n : nativeInputValue.value\n if (!input || input.value === formatterValue || props.type === 'file') return\n input.value = formatterValue\n}\n\nconst formatValue = (value: string) => {\n const { trim, number } = props.modelModifiers\n if (trim) {\n value = value.trim()\n }\n if (number) {\n value = `${looseToNumber(value)}`\n }\n if (props.formatter && props.parser) {\n value = props.parser(value)\n }\n return value\n}\n\nconst handleInput = async (event: Event) => {\n // should not emit input during composition\n // see: https://github.com/ElemeFE/element/issues/10516\n if (isComposing.value) return\n\n const { lazy } = props.modelModifiers\n let { value } = event.target as TargetElement\n let shouldForceNativeUpdate = false\n if (lazy) {\n emit(INPUT_EVENT, value)\n return\n }\n\n value = formatValue(value)\n\n if (props.countGraphemes && maxlength.value != null) {\n const limit = Number(maxlength.value)\n const graphemes = props.countGraphemes(value)\n const saveGraphemes = props.countGraphemes(saveValue.value)\n if (graphemes > limit && graphemes > saveGraphemes) {\n // If current value already exceeds limit, block further input and keep exceed state.\n if (saveGraphemes > limit) {\n value = saveValue.value\n shouldForceNativeUpdate = true\n } else {\n // Keep unchanged suffix like native maxlength behavior.\n // Instead of truncating from the end of the whole string,\n // only limit the inserted segment to available capacity.\n const prevValue = saveValue.value\n const nextValue = value\n let prefixLen = 0\n\n while (\n prefixLen < prevValue.length &&\n prefixLen < nextValue.length &&\n prevValue[prefixLen] === nextValue[prefixLen]\n ) {\n prefixLen++\n }\n\n let prevSuffixIndex = prevValue.length\n let nextSuffixIndex = nextValue.length\n while (\n prevSuffixIndex > prefixLen &&\n nextSuffixIndex > prefixLen &&\n prevValue[prevSuffixIndex - 1] === nextValue[nextSuffixIndex - 1]\n ) {\n prevSuffixIndex--\n nextSuffixIndex--\n }\n\n const before = nextValue.slice(0, prefixLen)\n const removed = prevValue.slice(prefixLen, prevSuffixIndex)\n const inserted = nextValue.slice(prefixLen, nextSuffixIndex)\n const after = nextValue.slice(nextSuffixIndex)\n\n const removedCount = props.countGraphemes(removed)\n const baseCount = saveGraphemes - removedCount\n const availableInserted = Math.max(0, limit - baseCount)\n\n let acceptedInserted = ''\n if (availableInserted > 0) {\n // Use Intl.Segmenter for proper grapheme cluster iteration if available.\n if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {\n const segmenter = new Intl.Segmenter(undefined, {\n granularity: 'grapheme',\n })\n for (const { segment } of segmenter.segment(inserted)) {\n const candidate = acceptedInserted + segment\n const newCount = props.countGraphemes(candidate)\n if (newCount > availableInserted) break\n acceptedInserted = candidate\n }\n } else {\n // Fallback to code-point iteration for older environments.\n for (const char of Array.from(inserted)) {\n const candidate = acceptedInserted + char\n const newCount = props.countGraphemes(candidate)\n if (newCount > availableInserted) break\n acceptedInserted = candidate\n }\n }\n }\n\n value = before + acceptedInserted + after\n shouldForceNativeUpdate = true\n }\n }\n }\n\n // hack for https://github.com/ElemeFE/element/issues/8548\n // should remove the following line when we don't support IE\n if (String(value) === nativeInputValue.value) {\n // preserve native features while being compatible with #9501\n if (props.formatter || shouldForceNativeUpdate) {\n const target = event.target as TargetElement\n const blockedValue = target.value\n const selectionStart = target.selectionStart\n const selectionEnd = target.selectionEnd\n setNativeInputValue()\n // Keep caret position stable when input is blocked and value is reset.\n if (\n shouldForceNativeUpdate &&\n _ref.value &&\n selectionStart != null &&\n selectionEnd != null\n ) {\n const restoredValue = _ref.value.value\n const afterTxt = blockedValue.slice(Math.max(0, selectionEnd))\n let caretPos = Math.min(selectionStart, restoredValue.length)\n\n if (afterTxt && restoredValue.endsWith(afterTxt)) {\n caretPos = restoredValue.length - afterTxt.length\n }\n\n _ref.value.setSelectionRange(caretPos, caretPos)\n }\n }\n return\n }\n saveValue.value = value\n\n recordCursor()\n emit(UPDATE_MODEL_EVENT, value)\n emit(INPUT_EVENT, value)\n\n // ensure native input value is controlled\n // see: https://github.com/ElemeFE/element/issues/12850\n await nextTick()\n\n if ((props.formatter && props.parser) || !hasModelModifiers.value) {\n setNativeInputValue()\n }\n setCursor()\n}\n\nconst handleChange = async (event: Event) => {\n let { value } = event.target as TargetElement\n\n value = formatValue(value)\n if (props.modelModifiers.lazy) {\n emit(UPDATE_MODEL_EVENT, value)\n }\n emit(CHANGE_EVENT, value, event)\n\n await nextTick()\n setNativeInputValue()\n}\n\nconst {\n isComposing,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n} = useComposition({ emit, afterComposition: handleInput })\n\nconst handlePasswordVisible = () => {\n passwordVisible.value = !passwordVisible.value\n}\n\nconst focus = () => _ref.value?.focus()\n\nconst blur = () => _ref.value?.blur()\n\nconst handleMouseLeave = (evt: MouseEvent) => {\n hovering.value = false\n emit('mouseleave', evt)\n}\n\nconst handleMouseEnter = (evt: MouseEvent) => {\n hovering.value = true\n emit('mouseenter', evt)\n}\n\nconst handleKeydown = (evt: KeyboardEvent) => {\n emit('keydown', evt)\n}\n\nconst select = () => {\n _ref.value?.select()\n}\n\nconst clear = (evt?: MouseEvent) => {\n emit(UPDATE_MODEL_EVENT, '')\n emit(CHANGE_EVENT, '')\n emit('clear', evt)\n emit(INPUT_EVENT, '')\n}\n\nwatch(\n () => props.modelValue,\n () => {\n nextTick(() => {\n resizeTextarea()\n if (props.autosize) {\n textareaHeight.value = undefined\n }\n })\n if (props.validateEvent) {\n elFormItem?.validate?.('change').catch(NOOP)\n }\n }\n)\n\nwatch(\n () => nativeInputValue.value,\n (val) => {\n saveValue.value = val\n },\n { immediate: true }\n)\n\n// native input value is set explicitly\n// do not use v-model / :value in template\n// see: https://github.com/ElemeFE/element/issues/14521\nwatch(nativeInputValue, (newValue) => {\n if (!_ref.value) {\n return\n }\n const { trim, number } = props.modelModifiers\n const elValue = _ref.value.value\n const displayValue =\n (number || props.type === 'number') && !/^0\\d/.test(elValue)\n ? `${looseToNumber(elValue)}`\n : elValue\n\n if (displayValue === newValue) {\n return\n }\n\n if (document.activeElement === _ref.value && _ref.value.type !== 'range') {\n if (trim && displayValue.trim() === newValue) {\n return\n }\n }\n\n setNativeInputValue()\n})\n\n// when change between <input> and <textarea>,\n// update DOM dependent value and styles\n// https://github.com/ElemeFE/element/issues/14857\nwatch(\n () => props.type,\n async () => {\n await nextTick()\n setNativeInputValue()\n resizeTextarea()\n }\n)\n\nonMounted(() => {\n if (!props.formatter && props.parser) {\n debugWarn(\n COMPONENT_NAME,\n 'If you set the parser, you also need to set the formatter.'\n )\n }\n setNativeInputValue()\n nextTick(resizeTextarea)\n})\n\ndefineExpose({\n /** @description HTML input element */\n input,\n /** @description HTML textarea element */\n textarea,\n /** @description HTML element, input or textarea */\n ref: _ref,\n /** @description style of textarea. */\n textareaStyle,\n\n /** @description from props (used on unit test) */\n autosize: toRef(props, 'autosize'),\n\n /** @description is input composing */\n isComposing,\n\n /** @description whether the password is visible */\n passwordVisible,\n\n /** @description HTML input element native method */\n focus,\n /** @description HTML input element native method */\n blur,\n /** @description HTML input element native method */\n select,\n /** @description clear input value */\n clear,\n /** @description resize textarea. */\n resizeTextarea,\n})\n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"input2.js","names":[],"sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <div\n :class=\"[\n containerKls,\n {\n [nsInput.bm('group', 'append')]: $slots.append,\n [nsInput.bm('group', 'prepend')]: $slots.prepend,\n },\n ]\"\n :style=\"containerStyle\"\n @mouseenter=\"handleMouseEnter\"\n @mouseleave=\"handleMouseLeave\"\n >\n <!-- input -->\n <template v-if=\"type !== 'textarea'\">\n <!-- prepend slot -->\n <div v-if=\"$slots.prepend\" :class=\"nsInput.be('group', 'prepend')\">\n <slot name=\"prepend\" />\n </div>\n\n <div ref=\"wrapperRef\" :class=\"wrapperKls\">\n <!-- prefix slot -->\n <span v-if=\"$slots.prefix || prefixIcon\" :class=\"nsInput.e('prefix')\">\n <span :class=\"nsInput.e('prefix-inner')\">\n <slot name=\"prefix\" />\n <el-icon v-if=\"prefixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"prefixIcon\" />\n </el-icon>\n </span>\n </span>\n\n <input\n :id=\"inputId\"\n ref=\"input\"\n :class=\"nsInput.e('inner')\"\n v-bind=\"attrs\"\n :name=\"name\"\n :minlength=\"countGraphemes ? undefined : minlength\"\n :maxlength=\"countGraphemes ? undefined : maxlength\"\n :type=\"showPassword ? (passwordVisible ? 'text' : 'password') : type\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :tabindex=\"tabindex\"\n :aria-label=\"ariaLabel\"\n :placeholder=\"placeholder\"\n :style=\"inputStyle\"\n :form=\"form\"\n :autofocus=\"autofocus\"\n :role=\"containerRole\"\n :inputmode=\"inputmode\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n\n <!-- suffix slot -->\n <span v-if=\"suffixVisible\" :class=\"nsInput.e('suffix')\">\n <span :class=\"nsInput.e('suffix-inner')\">\n <el-icon\n v-if=\"renderClear\"\n :class=\"[nsInput.e('icon'), nsInput.e('clear')]\"\n :style=\"{ visibility: showClear ? 'visible' : 'hidden' }\"\n @mousedown.prevent=\"NOOP\"\n @click=\"clear\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <template\n v-if=\"!showClear || !showPwdVisible || !isWordLimitVisible\"\n >\n <slot name=\"suffix\" />\n <el-icon v-if=\"suffixIcon\" :class=\"nsInput.e('icon')\">\n <component :is=\"suffixIcon\" />\n </el-icon>\n </template>\n <el-icon\n v-if=\"showPwdVisible\"\n :class=\"[nsInput.e('icon'), nsInput.e('password')]\"\n @click=\"handlePasswordVisible\"\n @mousedown.prevent=\"NOOP\"\n @mouseup.prevent=\"NOOP\"\n >\n <slot name=\"password-icon\" :visible=\"passwordVisible\">\n <component :is=\"passwordIcon\" />\n </slot>\n </el-icon>\n <span\n v-if=\"isWordLimitVisible\"\n :class=\"[\n nsInput.e('count'),\n nsInput.is('outside', wordLimitPosition === 'outside'),\n ]\"\n >\n <span :class=\"nsInput.e('count-inner')\">\n {{ textLength }} / {{ maxlength }}\n </span>\n </span>\n <el-icon\n v-if=\"validateState && validateIcon && needStatusIcon\"\n :class=\"[\n nsInput.e('icon'),\n nsInput.e('validateIcon'),\n nsInput.is('loading', validateState === 'validating'),\n ]\"\n >\n <component :is=\"validateIcon\" />\n </el-icon>\n </span>\n </span>\n </div>\n\n <!-- append slot -->\n <div v-if=\"$slots.append\" :class=\"nsInput.be('group', 'append')\">\n <slot name=\"append\" />\n </div>\n </template>\n\n <!-- textarea -->\n <template v-else>\n <textarea\n :id=\"inputId\"\n ref=\"textarea\"\n :class=\"[\n nsTextarea.e('inner'),\n nsInput.is('focus', isFocused),\n nsTextarea.is('clearable', clearable),\n ]\"\n v-bind=\"attrs\"\n :name=\"name\"\n :minlength=\"countGraphemes ? undefined : minlength\"\n :maxlength=\"countGraphemes ? undefined : maxlength\"\n :tabindex=\"tabindex\"\n :disabled=\"inputDisabled\"\n :readonly=\"readonly\"\n :autocomplete=\"autocomplete\"\n :style=\"textareaStyle\"\n :aria-label=\"ariaLabel\"\n :placeholder=\"placeholder\"\n :form=\"form\"\n :autofocus=\"autofocus\"\n :rows=\"rows\"\n :role=\"containerRole\"\n :inputmode=\"inputmode\"\n @compositionstart=\"handleCompositionStart\"\n @compositionupdate=\"handleCompositionUpdate\"\n @compositionend=\"handleCompositionEnd\"\n @input=\"handleInput\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @change=\"handleChange\"\n @keydown=\"handleKeydown\"\n />\n <el-icon\n v-if=\"showClear\"\n :class=\"[nsTextarea.e('icon'), nsTextarea.e('clear')]\"\n :style=\"clearIconStyle\"\n @mousedown.prevent=\"NOOP\"\n @click=\"clear\"\n >\n <component :is=\"clearIcon\" />\n </el-icon>\n <span\n v-if=\"isWordLimitVisible\"\n :style=\"countStyle\"\n :class=\"[\n nsInput.e('count'),\n nsInput.is('outside', wordLimitPosition === 'outside'),\n ]\"\n >\n {{ textLength }} / {{ maxlength }}\n </span>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n shallowRef,\n toRef,\n useAttrs as useRawAttrs,\n useSlots,\n watch,\n} from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { isNil } from 'lodash-unified'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Hide, View } from '@element-plus/icons-vue'\nimport {\n useFormDisabled,\n useFormItem,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport {\n NOOP,\n ValidateComponentsMap,\n cAF,\n debugWarn,\n isClient,\n isObject,\n rAF,\n} from '@element-plus/utils'\nimport {\n useAttrs,\n useComposition,\n useCursor,\n useFocusController,\n useNamespace,\n} from '@element-plus/hooks'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { calcTextareaHeight, looseToNumber } from './utils'\nimport { inputEmits, inputPropsDefaults } from './input'\n\nimport type { StyleValue } from 'vue'\nimport type { InputProps } from './input'\n\ntype TargetElement = HTMLInputElement | HTMLTextAreaElement\n\nconst COMPONENT_NAME = 'ElInput'\ndefineOptions({\n name: COMPONENT_NAME,\n inheritAttrs: false,\n})\nconst props = withDefaults(defineProps<InputProps>(), inputPropsDefaults)\nconst emit = defineEmits(inputEmits)\n\nconst rawAttrs = useRawAttrs()\nconst slots = useSlots()\n\nconst containerKls = computed(() => [\n props.type === 'textarea' ? nsTextarea.b() : nsInput.b(),\n nsInput.m(inputSize.value),\n nsInput.is('disabled', inputDisabled.value),\n nsInput.is('exceed', inputExceed.value),\n {\n [nsInput.b('group')]: slots.prepend || slots.append,\n [nsInput.m('prefix')]: slots.prefix || props.prefixIcon,\n [nsInput.m('suffix')]:\n slots.suffix || props.suffixIcon || props.clearable || props.showPassword,\n [nsInput.bm('suffix', 'password-clear')]:\n showClear.value && showPwdVisible.value,\n [nsInput.b('hidden')]: props.type === 'hidden',\n },\n rawAttrs.class,\n])\n\nconst wrapperKls = computed(() => [\n nsInput.e('wrapper'),\n nsInput.is('focus', isFocused.value),\n])\n\nconst attrs = useAttrs()\nconst maxlength = computed(() => props.maxlength?.toString())\n\nconst { form: elForm, formItem: elFormItem } = useFormItem()\nconst { inputId } = useFormItemInputId(props, {\n formItemContext: elFormItem,\n})\nconst inputSize = useFormSize()\nconst inputDisabled = useFormDisabled()\nconst nsInput = useNamespace('input')\nconst nsTextarea = useNamespace('textarea')\n\nconst input = shallowRef<HTMLInputElement>()\nconst textarea = shallowRef<HTMLTextAreaElement>()\n\nconst hovering = ref(false)\nconst passwordVisible = ref(false)\nconst countStyle = ref<StyleValue>()\nconst clearIconStyle = ref<StyleValue>()\nconst textareaCalcStyle = shallowRef(props.inputStyle)\nconst saveValue = ref('')\nconst textareaHeight = ref<string>()\n\nconst _ref = computed(() => input.value || textarea.value)\n\n// wrapperRef for type=\"text\", handleFocus and handleBlur for type=\"textarea\"\n// @ts-ignore - used in template ref binding, TS cannot detect template usage\nconst { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(\n _ref,\n {\n disabled: inputDisabled,\n afterBlur() {\n if (props.validateEvent) {\n elFormItem?.validate?.('blur').catch(NOOP)\n }\n },\n }\n)\n\nconst needStatusIcon = computed(() => elForm?.statusIcon ?? false)\nconst validateState = computed(() => elFormItem?.validateState || '')\nconst validateIcon = computed(\n () => validateState.value && ValidateComponentsMap[validateState.value]\n)\nconst passwordIcon = computed(() => (passwordVisible.value ? View : Hide))\nconst containerStyle = computed<StyleValue>(() => [\n rawAttrs.style as StyleValue,\n])\nconst textareaStyle = computed<StyleValue>(() => [\n props.inputStyle,\n textareaCalcStyle.value,\n { resize: props.resize },\n textareaHeight.value ? { height: textareaHeight.value } : undefined,\n])\nconst nativeInputValue = computed(() =>\n isNil(props.modelValue) ? '' : String(props.modelValue)\n)\nconst renderClear = computed(\n () => props.clearable && !inputDisabled.value && !props.readonly\n)\nconst showClear = computed(\n () =>\n renderClear.value &&\n !!nativeInputValue.value &&\n (isFocused.value || hovering.value)\n)\nconst showPwdVisible = computed(\n () => props.showPassword && !inputDisabled.value && !!nativeInputValue.value\n)\nconst isWordLimitVisible = computed(\n () =>\n props.showWordLimit &&\n !!maxlength.value &&\n (props.type === 'text' || props.type === 'textarea') &&\n !inputDisabled.value &&\n !props.readonly &&\n !props.showPassword\n)\nconst textLength = computed(() => {\n if (props.countGraphemes && props.showWordLimit) {\n return props.countGraphemes(nativeInputValue.value)\n }\n return nativeInputValue.value.length\n})\nconst inputExceed = computed(\n () =>\n // show exceed style if length of initial value greater then maxlength\n !!isWordLimitVisible.value && textLength.value > Number(maxlength.value)\n)\nconst suffixVisible = computed(\n () =>\n !!slots.suffix ||\n !!props.suffixIcon ||\n props.clearable ||\n props.showPassword ||\n isWordLimitVisible.value ||\n (!!validateState.value && needStatusIcon.value)\n)\nconst hasModelModifiers = computed(\n () => !!Object.keys(props.modelModifiers).length\n)\n\nconst [recordCursor, setCursor] = useCursor(input)\n\nlet rAFId: number | undefined\n\nuseResizeObserver(textarea, (entries) => {\n onceInitSizeTextarea()\n if (\n (!isWordLimitVisible.value && !renderClear.value) ||\n (props.resize !== 'both' && props.resize !== 'horizontal')\n )\n return\n const entry = entries[0]\n const { width } = entry.target.getBoundingClientRect()\n\n const updateStyle = () => {\n rAFId = undefined\n countStyle.value = {\n /** right: 100% - (width - right(10)) */\n right: `calc(100% - ${width - 10}px)`,\n }\n clearIconStyle.value = {\n /** right: 100% - (width - right(11)) */\n right: `calc(100% - ${width - 11}px)`,\n }\n }\n\n rAFId && cAF(rAFId)\n rAFId = rAF(updateStyle)\n})\n\nconst resizeTextarea = () => {\n const { type, autosize } = props\n\n if (!isClient || type !== 'textarea' || !textarea.value) return\n\n if (autosize) {\n const minRows = isObject(autosize) ? autosize.minRows : undefined\n const maxRows = isObject(autosize) ? autosize.maxRows : undefined\n const textareaStyle = calcTextareaHeight(textarea.value, minRows, maxRows)\n\n // If the scrollbar is displayed, the height of the textarea needs more space than the calculated height.\n // If set textarea height in this case, the scrollbar will not hide.\n // So we need to hide scrollbar first, and reset it in next tick.\n // see https://github.com/element-plus/element-plus/issues/8825\n textareaCalcStyle.value = {\n overflowY: 'hidden',\n ...textareaStyle,\n }\n\n nextTick(() => {\n // NOTE: Force repaint to make sure the style set above is applied.\n textarea.value!.offsetHeight\n textareaCalcStyle.value = textareaStyle\n })\n } else {\n textareaCalcStyle.value = {\n minHeight: calcTextareaHeight(textarea.value).minHeight,\n }\n }\n}\n\nconst createOnceInitResize = (resizeTextarea: () => void) => {\n let isInit = false\n return () => {\n if (isInit || !props.autosize) {\n if (props.resize !== 'none') {\n // The execution here may occur before `setTimeout(resizeTextarea)`,\n // potentially causing a regression of issue #21836, so the assignment needs to be deferred.\n setTimeout(() => {\n textareaHeight.value = textarea.value?.style.height\n })\n }\n return\n }\n const isElHidden = textarea.value?.offsetParent === null\n if (!isElHidden) {\n setTimeout(resizeTextarea)\n isInit = true\n }\n }\n}\n// fix: https://github.com/element-plus/element-plus/issues/12074\nconst onceInitSizeTextarea = createOnceInitResize(resizeTextarea)\n\nconst setNativeInputValue = () => {\n const input = _ref.value\n const formatterValue = props.formatter\n ? props.formatter(nativeInputValue.value)\n : nativeInputValue.value\n if (!input || input.value === formatterValue || props.type === 'file') return\n input.value = formatterValue\n}\n\nconst formatValue = (value: string) => {\n const { trim, number } = props.modelModifiers\n if (trim) {\n value = value.trim()\n }\n if (number) {\n value = `${looseToNumber(value)}`\n }\n if (props.formatter && props.parser) {\n value = props.parser(value)\n }\n return value\n}\n\nconst handleInput = async (event: Event) => {\n // should not emit input during composition\n // see: https://github.com/ElemeFE/element/issues/10516\n if (isComposing.value) return\n\n const { lazy } = props.modelModifiers\n let { value } = event.target as TargetElement\n let shouldForceNativeUpdate = false\n if (lazy) {\n emit(INPUT_EVENT, value)\n return\n }\n\n value = formatValue(value)\n\n if (props.countGraphemes && maxlength.value != null) {\n const limit = Number(maxlength.value)\n const graphemes = props.countGraphemes(value)\n const saveGraphemes = props.countGraphemes(saveValue.value)\n if (graphemes > limit && graphemes > saveGraphemes) {\n // If current value already exceeds limit, block further input and keep exceed state.\n if (saveGraphemes > limit) {\n value = saveValue.value\n shouldForceNativeUpdate = true\n } else {\n // Keep unchanged suffix like native maxlength behavior.\n // Instead of truncating from the end of the whole string,\n // only limit the inserted segment to available capacity.\n const prevValue = saveValue.value\n const nextValue = value\n let prefixLen = 0\n\n while (\n prefixLen < prevValue.length &&\n prefixLen < nextValue.length &&\n prevValue[prefixLen] === nextValue[prefixLen]\n ) {\n prefixLen++\n }\n\n let prevSuffixIndex = prevValue.length\n let nextSuffixIndex = nextValue.length\n while (\n prevSuffixIndex > prefixLen &&\n nextSuffixIndex > prefixLen &&\n prevValue[prevSuffixIndex - 1] === nextValue[nextSuffixIndex - 1]\n ) {\n prevSuffixIndex--\n nextSuffixIndex--\n }\n\n const before = nextValue.slice(0, prefixLen)\n const removed = prevValue.slice(prefixLen, prevSuffixIndex)\n const inserted = nextValue.slice(prefixLen, nextSuffixIndex)\n const after = nextValue.slice(nextSuffixIndex)\n\n const removedCount = props.countGraphemes(removed)\n const baseCount = saveGraphemes - removedCount\n const availableInserted = Math.max(0, limit - baseCount)\n\n let acceptedInserted = ''\n if (availableInserted > 0) {\n // Use Intl.Segmenter for proper grapheme cluster iteration if available.\n if (typeof Intl !== 'undefined' && 'Segmenter' in Intl) {\n const segmenter = new Intl.Segmenter(undefined, {\n granularity: 'grapheme',\n })\n for (const { segment } of segmenter.segment(inserted)) {\n const candidate = acceptedInserted + segment\n const newCount = props.countGraphemes(candidate)\n if (newCount > availableInserted) break\n acceptedInserted = candidate\n }\n } else {\n // Fallback to code-point iteration for older environments.\n for (const char of Array.from(inserted)) {\n const candidate = acceptedInserted + char\n const newCount = props.countGraphemes(candidate)\n if (newCount > availableInserted) break\n acceptedInserted = candidate\n }\n }\n }\n\n value = before + acceptedInserted + after\n shouldForceNativeUpdate = true\n }\n }\n }\n\n // hack for https://github.com/ElemeFE/element/issues/8548\n // should remove the following line when we don't support IE\n if (String(value) === nativeInputValue.value) {\n // preserve native features while being compatible with #9501\n if (props.formatter || shouldForceNativeUpdate) {\n const target = event.target as TargetElement\n const blockedValue = target.value\n const selectionStart = target.selectionStart\n const selectionEnd = target.selectionEnd\n setNativeInputValue()\n // Keep caret position stable when input is blocked and value is reset.\n if (\n shouldForceNativeUpdate &&\n _ref.value &&\n selectionStart != null &&\n selectionEnd != null\n ) {\n const restoredValue = _ref.value.value\n const afterTxt = blockedValue.slice(Math.max(0, selectionEnd))\n let caretPos = Math.min(selectionStart, restoredValue.length)\n\n if (afterTxt && restoredValue.endsWith(afterTxt)) {\n caretPos = restoredValue.length - afterTxt.length\n }\n\n _ref.value.setSelectionRange(caretPos, caretPos)\n }\n }\n return\n }\n saveValue.value = value\n\n recordCursor()\n emit(UPDATE_MODEL_EVENT, value)\n emit(INPUT_EVENT, value)\n\n // ensure native input value is controlled\n // see: https://github.com/ElemeFE/element/issues/12850\n await nextTick()\n\n if ((props.formatter && props.parser) || !hasModelModifiers.value) {\n setNativeInputValue()\n }\n setCursor()\n}\n\nconst handleChange = async (event: Event) => {\n let { value } = event.target as TargetElement\n\n value = formatValue(value)\n if (props.modelModifiers.lazy) {\n emit(UPDATE_MODEL_EVENT, value)\n }\n emit(CHANGE_EVENT, value, event)\n\n await nextTick()\n setNativeInputValue()\n}\n\nconst {\n isComposing,\n handleCompositionStart,\n handleCompositionUpdate,\n handleCompositionEnd,\n} = useComposition({ emit, afterComposition: handleInput })\n\nconst handlePasswordVisible = () => {\n passwordVisible.value = !passwordVisible.value\n}\n\nconst focus = () => _ref.value?.focus()\n\nconst blur = () => _ref.value?.blur()\n\nconst handleMouseLeave = (evt: MouseEvent) => {\n hovering.value = false\n emit('mouseleave', evt)\n}\n\nconst handleMouseEnter = (evt: MouseEvent) => {\n hovering.value = true\n emit('mouseenter', evt)\n}\n\nconst handleKeydown = (evt: KeyboardEvent) => {\n emit('keydown', evt)\n}\n\nconst select = () => {\n _ref.value?.select()\n}\n\nconst clear = (evt?: MouseEvent) => {\n emit(UPDATE_MODEL_EVENT, '')\n emit(CHANGE_EVENT, '')\n emit('clear', evt)\n emit(INPUT_EVENT, '')\n}\n\nwatch(\n () => props.modelValue,\n () => {\n nextTick(() => {\n resizeTextarea()\n if (props.autosize) {\n textareaHeight.value = undefined\n }\n })\n if (props.validateEvent) {\n elFormItem?.validate?.('change').catch(NOOP)\n }\n }\n)\n\nwatch(\n () => nativeInputValue.value,\n (val) => {\n saveValue.value = val\n },\n { immediate: true }\n)\n\n// native input value is set explicitly\n// do not use v-model / :value in template\n// see: https://github.com/ElemeFE/element/issues/14521\nwatch(nativeInputValue, (newValue) => {\n if (!_ref.value) {\n return\n }\n const { trim, number } = props.modelModifiers\n const elValue = _ref.value.value\n const displayValue =\n (number || props.type === 'number') && !/^0\\d/.test(elValue)\n ? `${looseToNumber(elValue)}`\n : elValue\n\n if (displayValue === newValue) {\n return\n }\n\n if (document.activeElement === _ref.value && _ref.value.type !== 'range') {\n if (trim && displayValue.trim() === newValue) {\n return\n }\n }\n\n setNativeInputValue()\n})\n\n// when change between <input> and <textarea>,\n// update DOM dependent value and styles\n// https://github.com/ElemeFE/element/issues/14857\nwatch(\n () => props.type,\n async () => {\n await nextTick()\n setNativeInputValue()\n resizeTextarea()\n }\n)\n\nonMounted(() => {\n if (!props.formatter && props.parser) {\n debugWarn(\n COMPONENT_NAME,\n 'If you set the parser, you also need to set the formatter.'\n )\n }\n setNativeInputValue()\n nextTick(resizeTextarea)\n})\n\nonBeforeUnmount(() => {\n rAFId && cAF(rAFId)\n})\n\ndefineExpose({\n /** @description HTML input element */\n input,\n /** @description HTML textarea element */\n textarea,\n /** @description HTML element, input or textarea */\n ref: _ref,\n /** @description style of textarea. */\n textareaStyle,\n\n /** @description from props (used on unit test) */\n autosize: toRef(props, 'autosize'),\n\n /** @description is input composing */\n isComposing,\n\n /** @description whether the password is visible */\n passwordVisible,\n\n /** @description HTML input element native method */\n focus,\n /** @description HTML input element native method */\n blur,\n /** @description HTML input element native method */\n select,\n /** @description clear input value */\n clear,\n /** @description resize textarea. */\n resizeTextarea,\n})\n</script>\n"],"mappings":""}
@@ -134,7 +134,7 @@ declare const messageProps: {
134
134
  readonly type: EpPropFinalized<StringConstructor, "info" | "primary" | "success" | "warning" | "error", unknown, "info", boolean>;
135
135
  readonly plain: EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
136
136
  readonly offset: EpPropFinalized<NumberConstructor, unknown, unknown, 16, boolean>;
137
- readonly placement: EpPropFinalized<StringConstructor, "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right", unknown, undefined, boolean>;
137
+ readonly placement: EpPropFinalized<StringConstructor, "top" | "bottom" | "top-right" | "top-left" | "bottom-right" | "bottom-left", unknown, undefined, boolean>;
138
138
  readonly zIndex: EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
139
139
  readonly grouping: EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
140
140
  readonly repeatNum: EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
@@ -110,7 +110,7 @@ declare const notificationProps: {
110
110
  readonly validator: ((val: unknown) => boolean) | undefined;
111
111
  __epPropKey: true;
112
112
  };
113
- readonly position: EpPropFinalized<StringConstructor, "top-left" | "top-right" | "bottom-left" | "bottom-right", unknown, "top-right", boolean>;
113
+ readonly position: EpPropFinalized<StringConstructor, "top-right" | "top-left" | "bottom-right" | "bottom-left", unknown, "top-right", boolean>;
114
114
  readonly showClose: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
115
115
  readonly title: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
116
116
  readonly type: EpPropFinalized<StringConstructor, "" | "info" | "primary" | "success" | "warning" | "error", unknown, "", boolean>;
package/lib/version.js CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  //#region ../../packages/element-plus/version.ts
4
- const version = "0.0.20260426";
4
+ const version = "0.0.20260427";
5
5
 
6
6
  //#endregion
7
7
  exports.version = version;
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","names":[],"sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.20260426'\n"],"mappings":";;;AAAA,MAAa,UAAU"}
1
+ {"version":3,"file":"version.js","names":[],"sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.20260427'\n"],"mappings":";;;AAAA,MAAa,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@element-plus/nightly",
3
- "version": "0.0.20260426",
3
+ "version": "0.0.20260427",
4
4
  "description": "A Component Library for Vue 3",
5
5
  "keywords": [
6
6
  "element-plus",
@@ -83,7 +83,7 @@
83
83
  "@ctrl/tinycolor": "^4.2.0",
84
84
  "@element-plus/icons-vue": "^2.3.2",
85
85
  "@floating-ui/dom": "^1.0.1",
86
- "@popperjs/core": "npm:@sxzz/popperjs-es@^2.11.7",
86
+ "@popperjs/core": "npm:@sxzz/popperjs-es@^2.11.8",
87
87
  "@types/lodash": "^4.17.24",
88
88
  "@types/lodash-es": "^4.17.12",
89
89
  "@vueuse/core": "14.2.1",
@@ -110,5 +110,5 @@
110
110
  "not ie 11",
111
111
  "not op_mini all"
112
112
  ],
113
- "gitHead": "744304fb6586f78fd674596ed53690846c747917"
113
+ "gitHead": "575a8380e7ff004b924e85912d4716bf6587f221"
114
114
  }