@element-plus/nightly 0.0.20240326 → 0.0.20240327

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 (284) hide show
  1. package/dist/index.full.js +2 -2
  2. package/dist/index.full.min.js +2 -2
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +2 -2
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +2 -2
  7. package/dist/locale/af.js +1 -1
  8. package/dist/locale/af.min.js +1 -1
  9. package/dist/locale/af.min.mjs +1 -1
  10. package/dist/locale/af.mjs +1 -1
  11. package/dist/locale/ar-eg.js +1 -1
  12. package/dist/locale/ar-eg.min.js +1 -1
  13. package/dist/locale/ar-eg.min.mjs +1 -1
  14. package/dist/locale/ar-eg.mjs +1 -1
  15. package/dist/locale/ar.js +1 -1
  16. package/dist/locale/ar.min.js +1 -1
  17. package/dist/locale/ar.min.mjs +1 -1
  18. package/dist/locale/ar.mjs +1 -1
  19. package/dist/locale/az.js +1 -1
  20. package/dist/locale/az.min.js +1 -1
  21. package/dist/locale/az.min.mjs +1 -1
  22. package/dist/locale/az.mjs +1 -1
  23. package/dist/locale/bg.js +1 -1
  24. package/dist/locale/bg.min.js +1 -1
  25. package/dist/locale/bg.min.mjs +1 -1
  26. package/dist/locale/bg.mjs +1 -1
  27. package/dist/locale/bn.js +1 -1
  28. package/dist/locale/bn.min.js +1 -1
  29. package/dist/locale/bn.min.mjs +1 -1
  30. package/dist/locale/bn.mjs +1 -1
  31. package/dist/locale/ca.js +1 -1
  32. package/dist/locale/ca.min.js +1 -1
  33. package/dist/locale/ca.min.mjs +1 -1
  34. package/dist/locale/ca.mjs +1 -1
  35. package/dist/locale/ckb.js +1 -1
  36. package/dist/locale/ckb.min.js +1 -1
  37. package/dist/locale/ckb.min.mjs +1 -1
  38. package/dist/locale/ckb.mjs +1 -1
  39. package/dist/locale/cs.js +1 -1
  40. package/dist/locale/cs.min.js +1 -1
  41. package/dist/locale/cs.min.mjs +1 -1
  42. package/dist/locale/cs.mjs +1 -1
  43. package/dist/locale/da.js +1 -1
  44. package/dist/locale/da.min.js +1 -1
  45. package/dist/locale/da.min.mjs +1 -1
  46. package/dist/locale/da.mjs +1 -1
  47. package/dist/locale/de.js +1 -1
  48. package/dist/locale/de.min.js +1 -1
  49. package/dist/locale/de.min.mjs +1 -1
  50. package/dist/locale/de.mjs +1 -1
  51. package/dist/locale/el.js +1 -1
  52. package/dist/locale/el.min.js +1 -1
  53. package/dist/locale/el.min.mjs +1 -1
  54. package/dist/locale/el.mjs +1 -1
  55. package/dist/locale/en.js +1 -1
  56. package/dist/locale/en.min.js +1 -1
  57. package/dist/locale/en.min.mjs +1 -1
  58. package/dist/locale/en.mjs +1 -1
  59. package/dist/locale/eo.js +1 -1
  60. package/dist/locale/eo.min.js +1 -1
  61. package/dist/locale/eo.min.mjs +1 -1
  62. package/dist/locale/eo.mjs +1 -1
  63. package/dist/locale/es.js +1 -1
  64. package/dist/locale/es.min.js +1 -1
  65. package/dist/locale/es.min.mjs +1 -1
  66. package/dist/locale/es.mjs +1 -1
  67. package/dist/locale/et.js +1 -1
  68. package/dist/locale/et.min.js +1 -1
  69. package/dist/locale/et.min.mjs +1 -1
  70. package/dist/locale/et.mjs +1 -1
  71. package/dist/locale/eu.js +1 -1
  72. package/dist/locale/eu.min.js +1 -1
  73. package/dist/locale/eu.min.mjs +1 -1
  74. package/dist/locale/eu.mjs +1 -1
  75. package/dist/locale/fa.js +1 -1
  76. package/dist/locale/fa.min.js +1 -1
  77. package/dist/locale/fa.min.mjs +1 -1
  78. package/dist/locale/fa.mjs +1 -1
  79. package/dist/locale/fi.js +1 -1
  80. package/dist/locale/fi.min.js +1 -1
  81. package/dist/locale/fi.min.mjs +1 -1
  82. package/dist/locale/fi.mjs +1 -1
  83. package/dist/locale/fr.js +1 -1
  84. package/dist/locale/fr.min.js +1 -1
  85. package/dist/locale/fr.min.mjs +1 -1
  86. package/dist/locale/fr.mjs +1 -1
  87. package/dist/locale/he.js +1 -1
  88. package/dist/locale/he.min.js +1 -1
  89. package/dist/locale/he.min.mjs +1 -1
  90. package/dist/locale/he.mjs +1 -1
  91. package/dist/locale/hr.js +1 -1
  92. package/dist/locale/hr.min.js +1 -1
  93. package/dist/locale/hr.min.mjs +1 -1
  94. package/dist/locale/hr.mjs +1 -1
  95. package/dist/locale/hu.js +1 -1
  96. package/dist/locale/hu.min.js +1 -1
  97. package/dist/locale/hu.min.mjs +1 -1
  98. package/dist/locale/hu.mjs +1 -1
  99. package/dist/locale/hy-am.js +1 -1
  100. package/dist/locale/hy-am.min.js +1 -1
  101. package/dist/locale/hy-am.min.mjs +1 -1
  102. package/dist/locale/hy-am.mjs +1 -1
  103. package/dist/locale/id.js +1 -1
  104. package/dist/locale/id.min.js +1 -1
  105. package/dist/locale/id.min.mjs +1 -1
  106. package/dist/locale/id.mjs +1 -1
  107. package/dist/locale/it.js +1 -1
  108. package/dist/locale/it.min.js +1 -1
  109. package/dist/locale/it.min.mjs +1 -1
  110. package/dist/locale/it.mjs +1 -1
  111. package/dist/locale/ja.js +1 -1
  112. package/dist/locale/ja.min.js +1 -1
  113. package/dist/locale/ja.min.mjs +1 -1
  114. package/dist/locale/ja.mjs +1 -1
  115. package/dist/locale/kk.js +1 -1
  116. package/dist/locale/kk.min.js +1 -1
  117. package/dist/locale/kk.min.mjs +1 -1
  118. package/dist/locale/kk.mjs +1 -1
  119. package/dist/locale/km.js +1 -1
  120. package/dist/locale/km.min.js +1 -1
  121. package/dist/locale/km.min.mjs +1 -1
  122. package/dist/locale/km.mjs +1 -1
  123. package/dist/locale/ko.js +1 -1
  124. package/dist/locale/ko.min.js +1 -1
  125. package/dist/locale/ko.min.mjs +1 -1
  126. package/dist/locale/ko.mjs +1 -1
  127. package/dist/locale/ku.js +1 -1
  128. package/dist/locale/ku.min.js +1 -1
  129. package/dist/locale/ku.min.mjs +1 -1
  130. package/dist/locale/ku.mjs +1 -1
  131. package/dist/locale/ky.js +1 -1
  132. package/dist/locale/ky.min.js +1 -1
  133. package/dist/locale/ky.min.mjs +1 -1
  134. package/dist/locale/ky.mjs +1 -1
  135. package/dist/locale/lt.js +1 -1
  136. package/dist/locale/lt.min.js +1 -1
  137. package/dist/locale/lt.min.mjs +1 -1
  138. package/dist/locale/lt.mjs +1 -1
  139. package/dist/locale/lv.js +1 -1
  140. package/dist/locale/lv.min.js +1 -1
  141. package/dist/locale/lv.min.mjs +1 -1
  142. package/dist/locale/lv.mjs +1 -1
  143. package/dist/locale/mg.js +1 -1
  144. package/dist/locale/mg.min.js +1 -1
  145. package/dist/locale/mg.min.mjs +1 -1
  146. package/dist/locale/mg.mjs +1 -1
  147. package/dist/locale/mn.js +1 -1
  148. package/dist/locale/mn.min.js +1 -1
  149. package/dist/locale/mn.min.mjs +1 -1
  150. package/dist/locale/mn.mjs +1 -1
  151. package/dist/locale/nb-no.js +1 -1
  152. package/dist/locale/nb-no.min.js +1 -1
  153. package/dist/locale/nb-no.min.mjs +1 -1
  154. package/dist/locale/nb-no.mjs +1 -1
  155. package/dist/locale/nl.js +1 -1
  156. package/dist/locale/nl.min.js +1 -1
  157. package/dist/locale/nl.min.mjs +1 -1
  158. package/dist/locale/nl.mjs +1 -1
  159. package/dist/locale/pa.js +1 -1
  160. package/dist/locale/pa.min.js +1 -1
  161. package/dist/locale/pa.min.mjs +1 -1
  162. package/dist/locale/pa.mjs +1 -1
  163. package/dist/locale/pl.js +1 -1
  164. package/dist/locale/pl.min.js +1 -1
  165. package/dist/locale/pl.min.mjs +1 -1
  166. package/dist/locale/pl.mjs +1 -1
  167. package/dist/locale/pt-br.js +1 -1
  168. package/dist/locale/pt-br.min.js +1 -1
  169. package/dist/locale/pt-br.min.mjs +1 -1
  170. package/dist/locale/pt-br.mjs +1 -1
  171. package/dist/locale/pt.js +1 -1
  172. package/dist/locale/pt.min.js +1 -1
  173. package/dist/locale/pt.min.mjs +1 -1
  174. package/dist/locale/pt.mjs +1 -1
  175. package/dist/locale/ro.js +1 -1
  176. package/dist/locale/ro.min.js +1 -1
  177. package/dist/locale/ro.min.mjs +1 -1
  178. package/dist/locale/ro.mjs +1 -1
  179. package/dist/locale/ru.js +1 -1
  180. package/dist/locale/ru.min.js +1 -1
  181. package/dist/locale/ru.min.mjs +1 -1
  182. package/dist/locale/ru.mjs +1 -1
  183. package/dist/locale/sk.js +1 -1
  184. package/dist/locale/sk.min.js +1 -1
  185. package/dist/locale/sk.min.mjs +1 -1
  186. package/dist/locale/sk.mjs +1 -1
  187. package/dist/locale/sl.js +1 -1
  188. package/dist/locale/sl.min.js +1 -1
  189. package/dist/locale/sl.min.mjs +1 -1
  190. package/dist/locale/sl.mjs +1 -1
  191. package/dist/locale/sr.js +1 -1
  192. package/dist/locale/sr.min.js +1 -1
  193. package/dist/locale/sr.min.mjs +1 -1
  194. package/dist/locale/sr.mjs +1 -1
  195. package/dist/locale/sv.js +1 -1
  196. package/dist/locale/sv.min.js +1 -1
  197. package/dist/locale/sv.min.mjs +1 -1
  198. package/dist/locale/sv.mjs +1 -1
  199. package/dist/locale/sw.js +1 -1
  200. package/dist/locale/sw.min.js +1 -1
  201. package/dist/locale/sw.min.mjs +1 -1
  202. package/dist/locale/sw.mjs +1 -1
  203. package/dist/locale/ta.js +1 -1
  204. package/dist/locale/ta.min.js +1 -1
  205. package/dist/locale/ta.min.mjs +1 -1
  206. package/dist/locale/ta.mjs +1 -1
  207. package/dist/locale/th.js +1 -1
  208. package/dist/locale/th.min.js +1 -1
  209. package/dist/locale/th.min.mjs +1 -1
  210. package/dist/locale/th.mjs +1 -1
  211. package/dist/locale/tk.js +1 -1
  212. package/dist/locale/tk.min.js +1 -1
  213. package/dist/locale/tk.min.mjs +1 -1
  214. package/dist/locale/tk.mjs +1 -1
  215. package/dist/locale/tr.js +1 -1
  216. package/dist/locale/tr.min.js +1 -1
  217. package/dist/locale/tr.min.mjs +1 -1
  218. package/dist/locale/tr.mjs +1 -1
  219. package/dist/locale/ug-cn.js +1 -1
  220. package/dist/locale/ug-cn.min.js +1 -1
  221. package/dist/locale/ug-cn.min.mjs +1 -1
  222. package/dist/locale/ug-cn.mjs +1 -1
  223. package/dist/locale/uk.js +1 -1
  224. package/dist/locale/uk.min.js +1 -1
  225. package/dist/locale/uk.min.mjs +1 -1
  226. package/dist/locale/uk.mjs +1 -1
  227. package/dist/locale/uz-uz.js +1 -1
  228. package/dist/locale/uz-uz.min.js +1 -1
  229. package/dist/locale/uz-uz.min.mjs +1 -1
  230. package/dist/locale/uz-uz.mjs +1 -1
  231. package/dist/locale/vi.js +1 -1
  232. package/dist/locale/vi.min.js +1 -1
  233. package/dist/locale/vi.min.mjs +1 -1
  234. package/dist/locale/vi.mjs +1 -1
  235. package/dist/locale/zh-cn.js +1 -1
  236. package/dist/locale/zh-cn.min.js +1 -1
  237. package/dist/locale/zh-cn.min.mjs +1 -1
  238. package/dist/locale/zh-cn.mjs +1 -1
  239. package/dist/locale/zh-tw.js +1 -1
  240. package/dist/locale/zh-tw.min.js +1 -1
  241. package/dist/locale/zh-tw.min.mjs +1 -1
  242. package/dist/locale/zh-tw.mjs +1 -1
  243. package/es/components/cascader/index.mjs +2 -2
  244. package/es/components/cascader/src/cascader.mjs +65 -630
  245. package/es/components/cascader/src/cascader.mjs.map +1 -1
  246. package/es/components/cascader/src/cascader2.mjs +630 -65
  247. package/es/components/cascader/src/cascader2.mjs.map +1 -1
  248. package/es/components/checkbox/index.mjs +2 -2
  249. package/es/components/checkbox/src/checkbox-group.mjs +72 -28
  250. package/es/components/checkbox/src/checkbox-group.mjs.map +1 -1
  251. package/es/components/checkbox/src/checkbox-group2.mjs +28 -72
  252. package/es/components/checkbox/src/checkbox-group2.mjs.map +1 -1
  253. package/es/components/index.mjs +3 -3
  254. package/es/components/progress/index.mjs +2 -2
  255. package/es/components/progress/src/progress.mjs +205 -59
  256. package/es/components/progress/src/progress.mjs.map +1 -1
  257. package/es/components/progress/src/progress2.mjs +59 -205
  258. package/es/components/progress/src/progress2.mjs.map +1 -1
  259. package/es/index.mjs +3 -3
  260. package/es/version.d.ts +1 -1
  261. package/es/version.mjs +1 -1
  262. package/es/version.mjs.map +1 -1
  263. package/lib/components/cascader/index.js +2 -2
  264. package/lib/components/cascader/src/cascader.js +66 -630
  265. package/lib/components/cascader/src/cascader.js.map +1 -1
  266. package/lib/components/cascader/src/cascader2.js +630 -66
  267. package/lib/components/cascader/src/cascader2.js.map +1 -1
  268. package/lib/components/checkbox/index.js +2 -2
  269. package/lib/components/checkbox/src/checkbox-group.js +72 -29
  270. package/lib/components/checkbox/src/checkbox-group.js.map +1 -1
  271. package/lib/components/checkbox/src/checkbox-group2.js +29 -72
  272. package/lib/components/checkbox/src/checkbox-group2.js.map +1 -1
  273. package/lib/components/index.js +3 -3
  274. package/lib/components/progress/index.js +2 -2
  275. package/lib/components/progress/src/progress.js +205 -59
  276. package/lib/components/progress/src/progress.js.map +1 -1
  277. package/lib/components/progress/src/progress2.js +59 -205
  278. package/lib/components/progress/src/progress2.js.map +1 -1
  279. package/lib/index.js +3 -3
  280. package/lib/version.d.ts +1 -1
  281. package/lib/version.js +1 -1
  282. package/lib/version.js.map +1 -1
  283. package/package.json +2 -2
  284. package/web-types.json +1 -1
@@ -1,73 +1,638 @@
1
- import '../../cascader-panel/index.mjs';
2
- import '../../../utils/index.mjs';
1
+ import { defineComponent, useAttrs, ref, computed, nextTick, watch, onMounted, openBlock, createBlock, unref, withCtx, withDirectives, createElementBlock, normalizeClass, normalizeStyle, createVNode, withModifiers, Fragment, renderList, toDisplayString, createElementVNode, withKeys, vModelText, createCommentVNode, isRef, vShow, renderSlot } from 'vue';
2
+ import { isPromise } from '@vue/shared';
3
+ import { cloneDeep, debounce } from 'lodash-unified';
4
+ import { isClient, useCssVar, useResizeObserver } from '@vueuse/core';
5
+ import _CascaderPanel from '../../cascader-panel/index.mjs';
6
+ import { ElInput } from '../../input/index.mjs';
7
+ import { ElTooltip } from '../../tooltip/index.mjs';
8
+ import { ElScrollbar } from '../../scrollbar/index.mjs';
9
+ import { ElTag } from '../../tag/index.mjs';
10
+ import { ElIcon } from '../../icon/index.mjs';
11
+ import '../../form/index.mjs';
12
+ import '../../../directives/index.mjs';
3
13
  import '../../../hooks/index.mjs';
4
- import '../../tooltip/index.mjs';
5
- import '../../tag/index.mjs';
14
+ import '../../../utils/index.mjs';
6
15
  import '../../../constants/index.mjs';
7
- import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
8
- import { CommonProps } from '../../cascader-panel/src/config.mjs';
9
- import { useSizeProp } from '../../../hooks/use-size/index.mjs';
10
- import { useTooltipContentProps } from '../../tooltip/src/content.mjs';
11
- import { tagProps } from '../../tag/src/tag.mjs';
16
+ import { CircleClose, ArrowDown, Check } from '@element-plus/icons-vue';
17
+ import { cascaderProps, cascaderEmits } from './cascader.mjs';
18
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
19
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
20
+ import { useLocale } from '../../../hooks/use-locale/index.mjs';
21
+ import { useFormItem } from '../../form/src/hooks/use-form-item.mjs';
22
+ import { useFormSize } from '../../form/src/hooks/use-form-common-props.mjs';
12
23
  import { UPDATE_MODEL_EVENT, CHANGE_EVENT } from '../../../constants/event.mjs';
13
- import { isBoolean } from '../../../utils/types.mjs';
24
+ import { debugWarn } from '../../../utils/error.mjs';
25
+ import { isKorean } from '../../../utils/i18n.mjs';
26
+ import { EVENT_CODE } from '../../../constants/aria.mjs';
27
+ import { focusNode, getSibling } from '../../../utils/dom/aria.mjs';
28
+ import ClickOutside from '../../../directives/click-outside/index.mjs';
14
29
 
15
- const cascaderProps = buildProps({
16
- ...CommonProps,
17
- size: useSizeProp,
18
- placeholder: String,
19
- disabled: Boolean,
20
- clearable: Boolean,
21
- filterable: Boolean,
22
- filterMethod: {
23
- type: definePropType(Function),
24
- default: (node, keyword) => node.text.includes(keyword)
25
- },
26
- separator: {
27
- type: String,
28
- default: " / "
29
- },
30
- showAllLevels: {
31
- type: Boolean,
32
- default: true
33
- },
34
- collapseTags: Boolean,
35
- maxCollapseTags: {
36
- type: Number,
37
- default: 1
38
- },
39
- collapseTagsTooltip: {
40
- type: Boolean,
41
- default: false
42
- },
43
- debounce: {
44
- type: Number,
45
- default: 300
46
- },
47
- beforeFilter: {
48
- type: definePropType(Function),
49
- default: () => true
50
- },
51
- popperClass: {
52
- type: String,
53
- default: ""
54
- },
55
- teleported: useTooltipContentProps.teleported,
56
- tagType: { ...tagProps.type, default: "info" },
57
- validateEvent: {
58
- type: Boolean,
59
- default: true
30
+ const _hoisted_1 = { key: 0 };
31
+ const _hoisted_2 = ["placeholder", "onKeydown"];
32
+ const _hoisted_3 = ["onClick"];
33
+ const COMPONENT_NAME = "ElCascader";
34
+ const __default__ = defineComponent({
35
+ name: COMPONENT_NAME
36
+ });
37
+ const _sfc_main = /* @__PURE__ */ defineComponent({
38
+ ...__default__,
39
+ props: cascaderProps,
40
+ emits: cascaderEmits,
41
+ setup(__props, { expose, emit }) {
42
+ const props = __props;
43
+ const popperOptions = {
44
+ modifiers: [
45
+ {
46
+ name: "arrowPosition",
47
+ enabled: true,
48
+ phase: "main",
49
+ fn: ({ state }) => {
50
+ const { modifiersData, placement } = state;
51
+ if (["right", "left", "bottom", "top"].includes(placement))
52
+ return;
53
+ modifiersData.arrow.x = 35;
54
+ },
55
+ requires: ["arrow"]
56
+ }
57
+ ]
58
+ };
59
+ const attrs = useAttrs();
60
+ let inputInitialHeight = 0;
61
+ let pressDeleteCount = 0;
62
+ const nsCascader = useNamespace("cascader");
63
+ const nsInput = useNamespace("input");
64
+ const { t } = useLocale();
65
+ const { form, formItem } = useFormItem();
66
+ const tooltipRef = ref(null);
67
+ const input = ref(null);
68
+ const tagWrapper = ref(null);
69
+ const cascaderPanelRef = ref(null);
70
+ const suggestionPanel = ref(null);
71
+ const popperVisible = ref(false);
72
+ const inputHover = ref(false);
73
+ const filtering = ref(false);
74
+ const filterFocus = ref(false);
75
+ const inputValue = ref("");
76
+ const searchInputValue = ref("");
77
+ const presentTags = ref([]);
78
+ const allPresentTags = ref([]);
79
+ const suggestions = ref([]);
80
+ const isOnComposition = ref(false);
81
+ const cascaderStyle = computed(() => {
82
+ return attrs.style;
83
+ });
84
+ const isDisabled = computed(() => props.disabled || (form == null ? void 0 : form.disabled));
85
+ const inputPlaceholder = computed(() => props.placeholder || t("el.cascader.placeholder"));
86
+ const currentPlaceholder = computed(() => searchInputValue.value || presentTags.value.length > 0 || isOnComposition.value ? "" : inputPlaceholder.value);
87
+ const realSize = useFormSize();
88
+ const tagSize = computed(() => ["small"].includes(realSize.value) ? "small" : "default");
89
+ const multiple = computed(() => !!props.props.multiple);
90
+ const readonly = computed(() => !props.filterable || multiple.value);
91
+ const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
92
+ const checkedNodes = computed(() => {
93
+ var _a;
94
+ return ((_a = cascaderPanelRef.value) == null ? void 0 : _a.checkedNodes) || [];
95
+ });
96
+ const clearBtnVisible = computed(() => {
97
+ if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
98
+ return false;
99
+ return !!checkedNodes.value.length;
100
+ });
101
+ const presentText = computed(() => {
102
+ const { showAllLevels, separator } = props;
103
+ const nodes = checkedNodes.value;
104
+ return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
105
+ });
106
+ const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
107
+ const checkedValue = computed({
108
+ get() {
109
+ return cloneDeep(props.modelValue);
110
+ },
111
+ set(val) {
112
+ emit(UPDATE_MODEL_EVENT, val);
113
+ emit(CHANGE_EVENT, val);
114
+ if (props.validateEvent) {
115
+ formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
116
+ }
117
+ }
118
+ });
119
+ const cascaderKls = computed(() => {
120
+ return [
121
+ nsCascader.b(),
122
+ nsCascader.m(realSize.value),
123
+ nsCascader.is("disabled", isDisabled.value),
124
+ attrs.class
125
+ ];
126
+ });
127
+ const cascaderIconKls = computed(() => {
128
+ return [
129
+ nsInput.e("icon"),
130
+ "icon-arrow-down",
131
+ nsCascader.is("reverse", popperVisible.value)
132
+ ];
133
+ });
134
+ const inputClass = computed(() => {
135
+ return nsCascader.is("focus", popperVisible.value || filterFocus.value);
136
+ });
137
+ const contentRef = computed(() => {
138
+ var _a, _b;
139
+ return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
140
+ });
141
+ const togglePopperVisible = (visible) => {
142
+ var _a, _b, _c;
143
+ if (isDisabled.value)
144
+ return;
145
+ visible = visible != null ? visible : !popperVisible.value;
146
+ if (visible !== popperVisible.value) {
147
+ popperVisible.value = visible;
148
+ (_b = (_a = input.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
149
+ if (visible) {
150
+ updatePopperPosition();
151
+ nextTick((_c = cascaderPanelRef.value) == null ? void 0 : _c.scrollToExpandingNode);
152
+ } else if (props.filterable) {
153
+ syncPresentTextValue();
154
+ }
155
+ emit("visibleChange", visible);
156
+ }
157
+ };
158
+ const updatePopperPosition = () => {
159
+ nextTick(() => {
160
+ var _a;
161
+ (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
162
+ });
163
+ };
164
+ const hideSuggestionPanel = () => {
165
+ filtering.value = false;
166
+ };
167
+ const genTag = (node) => {
168
+ const { showAllLevels, separator } = props;
169
+ return {
170
+ node,
171
+ key: node.uid,
172
+ text: node.calcText(showAllLevels, separator),
173
+ hitState: false,
174
+ closable: !isDisabled.value && !node.isDisabled,
175
+ isCollapseTag: false
176
+ };
177
+ };
178
+ const deleteTag = (tag) => {
179
+ var _a;
180
+ const node = tag.node;
181
+ node.doCheck(false);
182
+ (_a = cascaderPanelRef.value) == null ? void 0 : _a.calculateCheckedValue();
183
+ emit("removeTag", node.valueByOption);
184
+ };
185
+ const calculatePresentTags = () => {
186
+ if (!multiple.value)
187
+ return;
188
+ const nodes = checkedNodes.value;
189
+ const tags = [];
190
+ const allTags = [];
191
+ nodes.forEach((node) => allTags.push(genTag(node)));
192
+ allPresentTags.value = allTags;
193
+ if (nodes.length) {
194
+ nodes.slice(0, props.maxCollapseTags).forEach((node) => tags.push(genTag(node)));
195
+ const rest = nodes.slice(props.maxCollapseTags);
196
+ const restCount = rest.length;
197
+ if (restCount) {
198
+ if (props.collapseTags) {
199
+ tags.push({
200
+ key: -1,
201
+ text: `+ ${restCount}`,
202
+ closable: false,
203
+ isCollapseTag: true
204
+ });
205
+ } else {
206
+ rest.forEach((node) => tags.push(genTag(node)));
207
+ }
208
+ }
209
+ }
210
+ presentTags.value = tags;
211
+ };
212
+ const calculateSuggestions = () => {
213
+ var _a, _b;
214
+ const { filterMethod, showAllLevels, separator } = props;
215
+ const res = (_b = (_a = cascaderPanelRef.value) == null ? void 0 : _a.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => {
216
+ if (node.isDisabled)
217
+ return false;
218
+ node.calcText(showAllLevels, separator);
219
+ return filterMethod(node, searchKeyword.value);
220
+ });
221
+ if (multiple.value) {
222
+ presentTags.value.forEach((tag) => {
223
+ tag.hitState = false;
224
+ });
225
+ allPresentTags.value.forEach((tag) => {
226
+ tag.hitState = false;
227
+ });
228
+ }
229
+ filtering.value = true;
230
+ suggestions.value = res;
231
+ updatePopperPosition();
232
+ };
233
+ const focusFirstNode = () => {
234
+ var _a;
235
+ let firstNode;
236
+ if (filtering.value && suggestionPanel.value) {
237
+ firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
238
+ } else {
239
+ firstNode = (_a = cascaderPanelRef.value) == null ? void 0 : _a.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
240
+ }
241
+ if (firstNode) {
242
+ firstNode.focus();
243
+ !filtering.value && firstNode.click();
244
+ }
245
+ };
246
+ const updateStyle = () => {
247
+ var _a, _b;
248
+ const inputInner = (_a = input.value) == null ? void 0 : _a.input;
249
+ const tagWrapperEl = tagWrapper.value;
250
+ const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
251
+ if (!isClient || !inputInner)
252
+ return;
253
+ if (suggestionPanelEl) {
254
+ const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
255
+ suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
256
+ }
257
+ if (tagWrapperEl) {
258
+ const { offsetHeight } = tagWrapperEl;
259
+ const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
260
+ inputInner.style.height = height;
261
+ updatePopperPosition();
262
+ }
263
+ };
264
+ const getCheckedNodes = (leafOnly) => {
265
+ var _a;
266
+ return (_a = cascaderPanelRef.value) == null ? void 0 : _a.getCheckedNodes(leafOnly);
267
+ };
268
+ const handleExpandChange = (value) => {
269
+ updatePopperPosition();
270
+ emit("expandChange", value);
271
+ };
272
+ const handleComposition = (event) => {
273
+ var _a;
274
+ const text = (_a = event.target) == null ? void 0 : _a.value;
275
+ if (event.type === "compositionend") {
276
+ isOnComposition.value = false;
277
+ nextTick(() => handleInput(text));
278
+ } else {
279
+ const lastCharacter = text[text.length - 1] || "";
280
+ isOnComposition.value = !isKorean(lastCharacter);
281
+ }
282
+ };
283
+ const handleKeyDown = (e) => {
284
+ if (isOnComposition.value)
285
+ return;
286
+ switch (e.code) {
287
+ case EVENT_CODE.enter:
288
+ togglePopperVisible();
289
+ break;
290
+ case EVENT_CODE.down:
291
+ togglePopperVisible(true);
292
+ nextTick(focusFirstNode);
293
+ e.preventDefault();
294
+ break;
295
+ case EVENT_CODE.esc:
296
+ if (popperVisible.value === true) {
297
+ e.preventDefault();
298
+ e.stopPropagation();
299
+ togglePopperVisible(false);
300
+ }
301
+ break;
302
+ case EVENT_CODE.tab:
303
+ togglePopperVisible(false);
304
+ break;
305
+ }
306
+ };
307
+ const handleClear = () => {
308
+ var _a;
309
+ (_a = cascaderPanelRef.value) == null ? void 0 : _a.clearCheckedNodes();
310
+ if (!popperVisible.value && props.filterable) {
311
+ syncPresentTextValue();
312
+ }
313
+ togglePopperVisible(false);
314
+ };
315
+ const syncPresentTextValue = () => {
316
+ const { value } = presentText;
317
+ inputValue.value = value;
318
+ searchInputValue.value = value;
319
+ };
320
+ const handleSuggestionClick = (node) => {
321
+ var _a, _b;
322
+ const { checked } = node;
323
+ if (multiple.value) {
324
+ (_a = cascaderPanelRef.value) == null ? void 0 : _a.handleCheckChange(node, !checked, false);
325
+ } else {
326
+ !checked && ((_b = cascaderPanelRef.value) == null ? void 0 : _b.handleCheckChange(node, true, false));
327
+ togglePopperVisible(false);
328
+ }
329
+ };
330
+ const handleSuggestionKeyDown = (e) => {
331
+ const target = e.target;
332
+ const { code } = e;
333
+ switch (code) {
334
+ case EVENT_CODE.up:
335
+ case EVENT_CODE.down: {
336
+ const distance = code === EVENT_CODE.up ? -1 : 1;
337
+ focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
338
+ break;
339
+ }
340
+ case EVENT_CODE.enter:
341
+ target.click();
342
+ break;
343
+ }
344
+ };
345
+ const handleDelete = () => {
346
+ const tags = presentTags.value;
347
+ const lastTag = tags[tags.length - 1];
348
+ pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
349
+ if (!lastTag || !pressDeleteCount || props.collapseTags && tags.length > 1)
350
+ return;
351
+ if (lastTag.hitState) {
352
+ deleteTag(lastTag);
353
+ } else {
354
+ lastTag.hitState = true;
355
+ }
356
+ };
357
+ const handleFocus = (e) => {
358
+ const el = e.target;
359
+ const name = nsCascader.e("search-input");
360
+ if (el.className === name) {
361
+ filterFocus.value = true;
362
+ }
363
+ emit("focus", e);
364
+ };
365
+ const handleBlur = (e) => {
366
+ filterFocus.value = false;
367
+ emit("blur", e);
368
+ };
369
+ const handleFilter = debounce(() => {
370
+ const { value } = searchKeyword;
371
+ if (!value)
372
+ return;
373
+ const passed = props.beforeFilter(value);
374
+ if (isPromise(passed)) {
375
+ passed.then(calculateSuggestions).catch(() => {
376
+ });
377
+ } else if (passed !== false) {
378
+ calculateSuggestions();
379
+ } else {
380
+ hideSuggestionPanel();
381
+ }
382
+ }, props.debounce);
383
+ const handleInput = (val, e) => {
384
+ !popperVisible.value && togglePopperVisible(true);
385
+ if (e == null ? void 0 : e.isComposing)
386
+ return;
387
+ val ? handleFilter() : hideSuggestionPanel();
388
+ };
389
+ const getInputInnerHeight = (inputInner) => Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
390
+ watch(filtering, updatePopperPosition);
391
+ watch([checkedNodes, isDisabled], calculatePresentTags);
392
+ watch(presentTags, () => {
393
+ nextTick(() => updateStyle());
394
+ });
395
+ watch(realSize, async () => {
396
+ await nextTick();
397
+ const inputInner = input.value.input;
398
+ inputInitialHeight = getInputInnerHeight(inputInner) || inputInitialHeight;
399
+ updateStyle();
400
+ });
401
+ watch(presentText, syncPresentTextValue, { immediate: true });
402
+ onMounted(() => {
403
+ const inputInner = input.value.input;
404
+ const inputInnerHeight = getInputInnerHeight(inputInner);
405
+ inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
406
+ useResizeObserver(inputInner, updateStyle);
407
+ });
408
+ expose({
409
+ getCheckedNodes,
410
+ cascaderPanelRef,
411
+ togglePopperVisible,
412
+ contentRef
413
+ });
414
+ return (_ctx, _cache) => {
415
+ return openBlock(), createBlock(unref(ElTooltip), {
416
+ ref_key: "tooltipRef",
417
+ ref: tooltipRef,
418
+ visible: popperVisible.value,
419
+ teleported: _ctx.teleported,
420
+ "popper-class": [unref(nsCascader).e("dropdown"), _ctx.popperClass],
421
+ "popper-options": popperOptions,
422
+ "fallback-placements": [
423
+ "bottom-start",
424
+ "bottom",
425
+ "top-start",
426
+ "top",
427
+ "right",
428
+ "left"
429
+ ],
430
+ "stop-popper-mouse-event": false,
431
+ "gpu-acceleration": false,
432
+ placement: "bottom-start",
433
+ transition: `${unref(nsCascader).namespace.value}-zoom-in-top`,
434
+ effect: "light",
435
+ pure: "",
436
+ persistent: "",
437
+ onHide: hideSuggestionPanel
438
+ }, {
439
+ default: withCtx(() => [
440
+ withDirectives((openBlock(), createElementBlock("div", {
441
+ class: normalizeClass(unref(cascaderKls)),
442
+ style: normalizeStyle(unref(cascaderStyle)),
443
+ onClick: _cache[5] || (_cache[5] = () => togglePopperVisible(unref(readonly) ? void 0 : true)),
444
+ onKeydown: handleKeyDown,
445
+ onMouseenter: _cache[6] || (_cache[6] = ($event) => inputHover.value = true),
446
+ onMouseleave: _cache[7] || (_cache[7] = ($event) => inputHover.value = false)
447
+ }, [
448
+ createVNode(unref(ElInput), {
449
+ ref_key: "input",
450
+ ref: input,
451
+ modelValue: inputValue.value,
452
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inputValue.value = $event),
453
+ placeholder: unref(currentPlaceholder),
454
+ readonly: unref(readonly),
455
+ disabled: unref(isDisabled),
456
+ "validate-event": false,
457
+ size: unref(realSize),
458
+ class: normalizeClass(unref(inputClass)),
459
+ tabindex: unref(multiple) && _ctx.filterable && !unref(isDisabled) ? -1 : void 0,
460
+ onCompositionstart: handleComposition,
461
+ onCompositionupdate: handleComposition,
462
+ onCompositionend: handleComposition,
463
+ onFocus: handleFocus,
464
+ onBlur: handleBlur,
465
+ onInput: handleInput
466
+ }, {
467
+ suffix: withCtx(() => [
468
+ unref(clearBtnVisible) ? (openBlock(), createBlock(unref(ElIcon), {
469
+ key: "clear",
470
+ class: normalizeClass([unref(nsInput).e("icon"), "icon-circle-close"]),
471
+ onClick: withModifiers(handleClear, ["stop"])
472
+ }, {
473
+ default: withCtx(() => [
474
+ createVNode(unref(CircleClose))
475
+ ]),
476
+ _: 1
477
+ }, 8, ["class", "onClick"])) : (openBlock(), createBlock(unref(ElIcon), {
478
+ key: "arrow-down",
479
+ class: normalizeClass(unref(cascaderIconKls)),
480
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => togglePopperVisible(), ["stop"]))
481
+ }, {
482
+ default: withCtx(() => [
483
+ createVNode(unref(ArrowDown))
484
+ ]),
485
+ _: 1
486
+ }, 8, ["class"]))
487
+ ]),
488
+ _: 1
489
+ }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex"]),
490
+ unref(multiple) ? (openBlock(), createElementBlock("div", {
491
+ key: 0,
492
+ ref_key: "tagWrapper",
493
+ ref: tagWrapper,
494
+ class: normalizeClass([
495
+ unref(nsCascader).e("tags"),
496
+ unref(nsCascader).is("validate", Boolean(unref(validateState)))
497
+ ])
498
+ }, [
499
+ (openBlock(true), createElementBlock(Fragment, null, renderList(presentTags.value, (tag) => {
500
+ return openBlock(), createBlock(unref(ElTag), {
501
+ key: tag.key,
502
+ type: _ctx.tagType,
503
+ size: unref(tagSize),
504
+ hit: tag.hitState,
505
+ closable: tag.closable,
506
+ "disable-transitions": "",
507
+ onClose: ($event) => deleteTag(tag)
508
+ }, {
509
+ default: withCtx(() => [
510
+ tag.isCollapseTag === false ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(tag.text), 1)) : (openBlock(), createBlock(unref(ElTooltip), {
511
+ key: 1,
512
+ disabled: popperVisible.value || !_ctx.collapseTagsTooltip,
513
+ "fallback-placements": ["bottom", "top", "right", "left"],
514
+ placement: "bottom",
515
+ effect: "light"
516
+ }, {
517
+ default: withCtx(() => [
518
+ createElementVNode("span", null, toDisplayString(tag.text), 1)
519
+ ]),
520
+ content: withCtx(() => [
521
+ createElementVNode("div", {
522
+ class: normalizeClass(unref(nsCascader).e("collapse-tags"))
523
+ }, [
524
+ (openBlock(true), createElementBlock(Fragment, null, renderList(allPresentTags.value.slice(_ctx.maxCollapseTags), (tag2, idx) => {
525
+ return openBlock(), createElementBlock("div", {
526
+ key: idx,
527
+ class: normalizeClass(unref(nsCascader).e("collapse-tag"))
528
+ }, [
529
+ (openBlock(), createBlock(unref(ElTag), {
530
+ key: tag2.key,
531
+ class: "in-tooltip",
532
+ type: _ctx.tagType,
533
+ size: unref(tagSize),
534
+ hit: tag2.hitState,
535
+ closable: tag2.closable,
536
+ "disable-transitions": "",
537
+ onClose: ($event) => deleteTag(tag2)
538
+ }, {
539
+ default: withCtx(() => [
540
+ createElementVNode("span", null, toDisplayString(tag2.text), 1)
541
+ ]),
542
+ _: 2
543
+ }, 1032, ["type", "size", "hit", "closable", "onClose"]))
544
+ ], 2);
545
+ }), 128))
546
+ ], 2)
547
+ ]),
548
+ _: 2
549
+ }, 1032, ["disabled"]))
550
+ ]),
551
+ _: 2
552
+ }, 1032, ["type", "size", "hit", "closable", "onClose"]);
553
+ }), 128)),
554
+ _ctx.filterable && !unref(isDisabled) ? withDirectives((openBlock(), createElementBlock("input", {
555
+ key: 0,
556
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => searchInputValue.value = $event),
557
+ type: "text",
558
+ class: normalizeClass(unref(nsCascader).e("search-input")),
559
+ placeholder: unref(presentText) ? "" : unref(inputPlaceholder),
560
+ onInput: _cache[3] || (_cache[3] = (e) => handleInput(searchInputValue.value, e)),
561
+ onClick: _cache[4] || (_cache[4] = withModifiers(($event) => togglePopperVisible(true), ["stop"])),
562
+ onKeydown: withKeys(handleDelete, ["delete"]),
563
+ onCompositionstart: handleComposition,
564
+ onCompositionupdate: handleComposition,
565
+ onCompositionend: handleComposition,
566
+ onFocus: handleFocus,
567
+ onBlur: handleBlur
568
+ }, null, 42, _hoisted_2)), [
569
+ [vModelText, searchInputValue.value]
570
+ ]) : createCommentVNode("v-if", true)
571
+ ], 2)) : createCommentVNode("v-if", true)
572
+ ], 38)), [
573
+ [unref(ClickOutside), () => togglePopperVisible(false), unref(contentRef)]
574
+ ])
575
+ ]),
576
+ content: withCtx(() => [
577
+ withDirectives(createVNode(unref(_CascaderPanel), {
578
+ ref_key: "cascaderPanelRef",
579
+ ref: cascaderPanelRef,
580
+ modelValue: unref(checkedValue),
581
+ "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(checkedValue) ? checkedValue.value = $event : null),
582
+ options: _ctx.options,
583
+ props: props.props,
584
+ border: false,
585
+ "render-label": _ctx.$slots.default,
586
+ onExpandChange: handleExpandChange,
587
+ onClose: _cache[9] || (_cache[9] = ($event) => _ctx.$nextTick(() => togglePopperVisible(false)))
588
+ }, null, 8, ["modelValue", "options", "props", "render-label"]), [
589
+ [vShow, !filtering.value]
590
+ ]),
591
+ _ctx.filterable ? withDirectives((openBlock(), createBlock(unref(ElScrollbar), {
592
+ key: 0,
593
+ ref_key: "suggestionPanel",
594
+ ref: suggestionPanel,
595
+ tag: "ul",
596
+ class: normalizeClass(unref(nsCascader).e("suggestion-panel")),
597
+ "view-class": unref(nsCascader).e("suggestion-list"),
598
+ onKeydown: handleSuggestionKeyDown
599
+ }, {
600
+ default: withCtx(() => [
601
+ suggestions.value.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(suggestions.value, (item) => {
602
+ return openBlock(), createElementBlock("li", {
603
+ key: item.uid,
604
+ class: normalizeClass([
605
+ unref(nsCascader).e("suggestion-item"),
606
+ unref(nsCascader).is("checked", item.checked)
607
+ ]),
608
+ tabindex: -1,
609
+ onClick: ($event) => handleSuggestionClick(item)
610
+ }, [
611
+ createElementVNode("span", null, toDisplayString(item.text), 1),
612
+ item.checked ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
613
+ default: withCtx(() => [
614
+ createVNode(unref(Check))
615
+ ]),
616
+ _: 1
617
+ })) : createCommentVNode("v-if", true)
618
+ ], 10, _hoisted_3);
619
+ }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
620
+ createElementVNode("li", {
621
+ class: normalizeClass(unref(nsCascader).e("empty-text"))
622
+ }, toDisplayString(unref(t)("el.cascader.noMatch")), 3)
623
+ ])
624
+ ]),
625
+ _: 3
626
+ }, 8, ["class", "view-class"])), [
627
+ [vShow, filtering.value]
628
+ ]) : createCommentVNode("v-if", true)
629
+ ]),
630
+ _: 3
631
+ }, 8, ["visible", "teleported", "popper-class", "transition"]);
632
+ };
60
633
  }
61
634
  });
62
- const cascaderEmits = {
63
- [UPDATE_MODEL_EVENT]: (val) => !!val || val === null,
64
- [CHANGE_EVENT]: (val) => !!val || val === null,
65
- focus: (evt) => evt instanceof FocusEvent,
66
- blur: (evt) => evt instanceof FocusEvent,
67
- visibleChange: (val) => isBoolean(val),
68
- expandChange: (val) => !!val,
69
- removeTag: (val) => !!val
70
- };
635
+ var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "cascader.vue"]]);
71
636
 
72
- export { cascaderEmits, cascaderProps };
637
+ export { Cascader as default };
73
638
  //# sourceMappingURL=cascader2.mjs.map