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