@element-plus/nightly 0.0.20220810 → 0.0.20220813

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 (288) hide show
  1. package/dist/index.full.js +218 -143
  2. package/dist/index.full.min.js +14 -14
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +14 -14
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +219 -144
  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.js +1 -1
  12. package/dist/locale/ar.min.js +1 -1
  13. package/dist/locale/ar.min.mjs +1 -1
  14. package/dist/locale/ar.mjs +1 -1
  15. package/dist/locale/az.js +1 -1
  16. package/dist/locale/az.min.js +1 -1
  17. package/dist/locale/az.min.mjs +1 -1
  18. package/dist/locale/az.mjs +1 -1
  19. package/dist/locale/bg.js +1 -1
  20. package/dist/locale/bg.min.js +1 -1
  21. package/dist/locale/bg.min.mjs +1 -1
  22. package/dist/locale/bg.mjs +1 -1
  23. package/dist/locale/bn.js +1 -1
  24. package/dist/locale/bn.min.js +1 -1
  25. package/dist/locale/bn.min.mjs +1 -1
  26. package/dist/locale/bn.mjs +1 -1
  27. package/dist/locale/ca.js +1 -1
  28. package/dist/locale/ca.min.js +1 -1
  29. package/dist/locale/ca.min.mjs +1 -1
  30. package/dist/locale/ca.mjs +1 -1
  31. package/dist/locale/cs.js +1 -1
  32. package/dist/locale/cs.min.js +1 -1
  33. package/dist/locale/cs.min.mjs +1 -1
  34. package/dist/locale/cs.mjs +1 -1
  35. package/dist/locale/da.js +1 -1
  36. package/dist/locale/da.min.js +1 -1
  37. package/dist/locale/da.min.mjs +1 -1
  38. package/dist/locale/da.mjs +1 -1
  39. package/dist/locale/de.js +1 -1
  40. package/dist/locale/de.min.js +1 -1
  41. package/dist/locale/de.min.mjs +1 -1
  42. package/dist/locale/de.mjs +1 -1
  43. package/dist/locale/el.js +1 -1
  44. package/dist/locale/el.min.js +1 -1
  45. package/dist/locale/el.min.mjs +1 -1
  46. package/dist/locale/el.mjs +1 -1
  47. package/dist/locale/en.js +1 -1
  48. package/dist/locale/en.min.js +1 -1
  49. package/dist/locale/en.min.mjs +1 -1
  50. package/dist/locale/en.mjs +1 -1
  51. package/dist/locale/eo.js +1 -1
  52. package/dist/locale/eo.min.js +1 -1
  53. package/dist/locale/eo.min.mjs +1 -1
  54. package/dist/locale/eo.mjs +1 -1
  55. package/dist/locale/es.js +1 -1
  56. package/dist/locale/es.min.js +1 -1
  57. package/dist/locale/es.min.mjs +1 -1
  58. package/dist/locale/es.mjs +1 -1
  59. package/dist/locale/et.js +1 -1
  60. package/dist/locale/et.min.js +1 -1
  61. package/dist/locale/et.min.mjs +1 -1
  62. package/dist/locale/et.mjs +1 -1
  63. package/dist/locale/eu.js +1 -1
  64. package/dist/locale/eu.min.js +1 -1
  65. package/dist/locale/eu.min.mjs +1 -1
  66. package/dist/locale/eu.mjs +1 -1
  67. package/dist/locale/fa.js +1 -1
  68. package/dist/locale/fa.min.js +1 -1
  69. package/dist/locale/fa.min.mjs +1 -1
  70. package/dist/locale/fa.mjs +1 -1
  71. package/dist/locale/fi.js +1 -1
  72. package/dist/locale/fi.min.js +1 -1
  73. package/dist/locale/fi.min.mjs +1 -1
  74. package/dist/locale/fi.mjs +1 -1
  75. package/dist/locale/fr.js +1 -1
  76. package/dist/locale/fr.min.js +1 -1
  77. package/dist/locale/fr.min.mjs +1 -1
  78. package/dist/locale/fr.mjs +1 -1
  79. package/dist/locale/he.js +1 -1
  80. package/dist/locale/he.min.js +1 -1
  81. package/dist/locale/he.min.mjs +1 -1
  82. package/dist/locale/he.mjs +1 -1
  83. package/dist/locale/hr.js +1 -1
  84. package/dist/locale/hr.min.js +1 -1
  85. package/dist/locale/hr.min.mjs +1 -1
  86. package/dist/locale/hr.mjs +1 -1
  87. package/dist/locale/hu.js +1 -1
  88. package/dist/locale/hu.min.js +1 -1
  89. package/dist/locale/hu.min.mjs +1 -1
  90. package/dist/locale/hu.mjs +1 -1
  91. package/dist/locale/hy-am.js +1 -1
  92. package/dist/locale/hy-am.min.js +1 -1
  93. package/dist/locale/hy-am.min.mjs +1 -1
  94. package/dist/locale/hy-am.mjs +1 -1
  95. package/dist/locale/id.js +1 -1
  96. package/dist/locale/id.min.js +1 -1
  97. package/dist/locale/id.min.mjs +1 -1
  98. package/dist/locale/id.mjs +1 -1
  99. package/dist/locale/it.js +1 -1
  100. package/dist/locale/it.min.js +1 -1
  101. package/dist/locale/it.min.mjs +1 -1
  102. package/dist/locale/it.mjs +1 -1
  103. package/dist/locale/ja.js +1 -1
  104. package/dist/locale/ja.min.js +1 -1
  105. package/dist/locale/ja.min.mjs +1 -1
  106. package/dist/locale/ja.mjs +1 -1
  107. package/dist/locale/kk.js +1 -1
  108. package/dist/locale/kk.min.js +1 -1
  109. package/dist/locale/kk.min.mjs +1 -1
  110. package/dist/locale/kk.mjs +1 -1
  111. package/dist/locale/km.js +1 -1
  112. package/dist/locale/km.min.js +1 -1
  113. package/dist/locale/km.min.mjs +1 -1
  114. package/dist/locale/km.mjs +1 -1
  115. package/dist/locale/ko.js +1 -1
  116. package/dist/locale/ko.min.js +1 -1
  117. package/dist/locale/ko.min.mjs +1 -1
  118. package/dist/locale/ko.mjs +1 -1
  119. package/dist/locale/ku.js +1 -1
  120. package/dist/locale/ku.min.js +1 -1
  121. package/dist/locale/ku.min.mjs +1 -1
  122. package/dist/locale/ku.mjs +1 -1
  123. package/dist/locale/ky.js +1 -1
  124. package/dist/locale/ky.min.js +1 -1
  125. package/dist/locale/ky.min.mjs +1 -1
  126. package/dist/locale/ky.mjs +1 -1
  127. package/dist/locale/lt.js +1 -1
  128. package/dist/locale/lt.min.js +1 -1
  129. package/dist/locale/lt.min.mjs +1 -1
  130. package/dist/locale/lt.mjs +1 -1
  131. package/dist/locale/lv.js +1 -1
  132. package/dist/locale/lv.min.js +1 -1
  133. package/dist/locale/lv.min.mjs +1 -1
  134. package/dist/locale/lv.mjs +1 -1
  135. package/dist/locale/mg.js +1 -1
  136. package/dist/locale/mg.min.js +1 -1
  137. package/dist/locale/mg.min.mjs +1 -1
  138. package/dist/locale/mg.mjs +1 -1
  139. package/dist/locale/mn.js +1 -1
  140. package/dist/locale/mn.min.js +1 -1
  141. package/dist/locale/mn.min.mjs +1 -1
  142. package/dist/locale/mn.mjs +1 -1
  143. package/dist/locale/nb-no.js +1 -1
  144. package/dist/locale/nb-no.min.js +1 -1
  145. package/dist/locale/nb-no.min.mjs +1 -1
  146. package/dist/locale/nb-no.mjs +1 -1
  147. package/dist/locale/nl.js +1 -1
  148. package/dist/locale/nl.min.js +1 -1
  149. package/dist/locale/nl.min.mjs +1 -1
  150. package/dist/locale/nl.mjs +1 -1
  151. package/dist/locale/pa.js +1 -1
  152. package/dist/locale/pa.min.js +1 -1
  153. package/dist/locale/pa.min.mjs +1 -1
  154. package/dist/locale/pa.mjs +1 -1
  155. package/dist/locale/pl.js +1 -1
  156. package/dist/locale/pl.min.js +1 -1
  157. package/dist/locale/pl.min.mjs +1 -1
  158. package/dist/locale/pl.mjs +1 -1
  159. package/dist/locale/pt-br.js +1 -1
  160. package/dist/locale/pt-br.min.js +1 -1
  161. package/dist/locale/pt-br.min.mjs +1 -1
  162. package/dist/locale/pt-br.mjs +1 -1
  163. package/dist/locale/pt.js +1 -1
  164. package/dist/locale/pt.min.js +1 -1
  165. package/dist/locale/pt.min.mjs +1 -1
  166. package/dist/locale/pt.mjs +1 -1
  167. package/dist/locale/ro.js +1 -1
  168. package/dist/locale/ro.min.js +1 -1
  169. package/dist/locale/ro.min.mjs +1 -1
  170. package/dist/locale/ro.mjs +1 -1
  171. package/dist/locale/ru.js +1 -1
  172. package/dist/locale/ru.min.js +1 -1
  173. package/dist/locale/ru.min.mjs +1 -1
  174. package/dist/locale/ru.mjs +1 -1
  175. package/dist/locale/sk.js +1 -1
  176. package/dist/locale/sk.min.js +1 -1
  177. package/dist/locale/sk.min.mjs +1 -1
  178. package/dist/locale/sk.mjs +1 -1
  179. package/dist/locale/sl.js +1 -1
  180. package/dist/locale/sl.min.js +1 -1
  181. package/dist/locale/sl.min.mjs +1 -1
  182. package/dist/locale/sl.mjs +1 -1
  183. package/dist/locale/sr.js +1 -1
  184. package/dist/locale/sr.min.js +1 -1
  185. package/dist/locale/sr.min.mjs +1 -1
  186. package/dist/locale/sr.mjs +1 -1
  187. package/dist/locale/sv.js +1 -1
  188. package/dist/locale/sv.min.js +1 -1
  189. package/dist/locale/sv.min.mjs +1 -1
  190. package/dist/locale/sv.mjs +1 -1
  191. package/dist/locale/ta.js +1 -1
  192. package/dist/locale/ta.min.js +1 -1
  193. package/dist/locale/ta.min.mjs +1 -1
  194. package/dist/locale/ta.mjs +1 -1
  195. package/dist/locale/th.js +1 -1
  196. package/dist/locale/th.min.js +1 -1
  197. package/dist/locale/th.min.mjs +1 -1
  198. package/dist/locale/th.mjs +1 -1
  199. package/dist/locale/tk.js +1 -1
  200. package/dist/locale/tk.min.js +1 -1
  201. package/dist/locale/tk.min.mjs +1 -1
  202. package/dist/locale/tk.mjs +1 -1
  203. package/dist/locale/tr.js +1 -1
  204. package/dist/locale/tr.min.js +1 -1
  205. package/dist/locale/tr.min.mjs +1 -1
  206. package/dist/locale/tr.mjs +1 -1
  207. package/dist/locale/ug-cn.js +1 -1
  208. package/dist/locale/ug-cn.min.js +1 -1
  209. package/dist/locale/ug-cn.min.mjs +1 -1
  210. package/dist/locale/ug-cn.mjs +1 -1
  211. package/dist/locale/uk.js +1 -1
  212. package/dist/locale/uk.min.js +1 -1
  213. package/dist/locale/uk.min.mjs +1 -1
  214. package/dist/locale/uk.mjs +1 -1
  215. package/dist/locale/uz-uz.js +1 -1
  216. package/dist/locale/uz-uz.min.js +1 -1
  217. package/dist/locale/uz-uz.min.mjs +1 -1
  218. package/dist/locale/uz-uz.mjs +1 -1
  219. package/dist/locale/vi.js +1 -1
  220. package/dist/locale/vi.min.js +1 -1
  221. package/dist/locale/vi.min.mjs +1 -1
  222. package/dist/locale/vi.mjs +1 -1
  223. package/dist/locale/zh-cn.js +1 -1
  224. package/dist/locale/zh-cn.min.js +1 -1
  225. package/dist/locale/zh-cn.min.mjs +1 -1
  226. package/dist/locale/zh-cn.mjs +1 -1
  227. package/dist/locale/zh-tw.js +1 -1
  228. package/dist/locale/zh-tw.min.js +1 -1
  229. package/dist/locale/zh-tw.min.mjs +1 -1
  230. package/dist/locale/zh-tw.mjs +1 -1
  231. package/es/components/carousel/index.d.ts +1 -1
  232. package/es/components/carousel/src/carousel.vue.d.ts +1 -1
  233. package/es/components/color-picker/src/index.mjs +2 -2
  234. package/es/components/color-picker/src/index.mjs.map +1 -1
  235. package/es/components/index.mjs +1 -1
  236. package/es/components/popover/src/popover2.mjs +1 -1
  237. package/es/components/popover/src/popover2.mjs.map +1 -1
  238. package/es/components/rate/index.mjs +2 -2
  239. package/es/components/rate/src/rate.mjs +94 -249
  240. package/es/components/rate/src/rate.mjs.map +1 -1
  241. package/es/components/rate/src/rate2.mjs +249 -94
  242. package/es/components/rate/src/rate2.mjs.map +1 -1
  243. package/es/components/slider/src/composables/use-marks.mjs +1 -1
  244. package/es/components/slider/src/composables/use-marks.mjs.map +1 -1
  245. package/es/components/slot/src/only-child.mjs +3 -1
  246. package/es/components/slot/src/only-child.mjs.map +1 -1
  247. package/es/components/table/src/table/style-helper.mjs +1 -1
  248. package/es/components/table/src/table/style-helper.mjs.map +1 -1
  249. package/es/components/table/src/table-body/render-helper.mjs +1 -1
  250. package/es/components/table/src/table-body/render-helper.mjs.map +1 -1
  251. package/es/hooks/use-id/index.mjs +4 -1
  252. package/es/hooks/use-id/index.mjs.map +1 -1
  253. package/es/hooks/use-lockscreen/index.mjs +4 -6
  254. package/es/hooks/use-lockscreen/index.mjs.map +1 -1
  255. package/es/index.mjs +1 -1
  256. package/es/version.d.ts +1 -1
  257. package/es/version.mjs +1 -1
  258. package/es/version.mjs.map +1 -1
  259. package/lib/components/carousel/index.d.ts +1 -1
  260. package/lib/components/carousel/src/carousel.vue.d.ts +1 -1
  261. package/lib/components/color-picker/src/index.js +2 -2
  262. package/lib/components/color-picker/src/index.js.map +1 -1
  263. package/lib/components/index.js +1 -1
  264. package/lib/components/popover/src/popover2.js +1 -1
  265. package/lib/components/popover/src/popover2.js.map +1 -1
  266. package/lib/components/rate/index.js +2 -2
  267. package/lib/components/rate/src/rate.js +94 -248
  268. package/lib/components/rate/src/rate.js.map +1 -1
  269. package/lib/components/rate/src/rate2.js +248 -94
  270. package/lib/components/rate/src/rate2.js.map +1 -1
  271. package/lib/components/slider/src/composables/use-marks.js +1 -1
  272. package/lib/components/slider/src/composables/use-marks.js.map +1 -1
  273. package/lib/components/slot/src/only-child.js +3 -1
  274. package/lib/components/slot/src/only-child.js.map +1 -1
  275. package/lib/components/table/src/table/style-helper.js +1 -1
  276. package/lib/components/table/src/table/style-helper.js.map +1 -1
  277. package/lib/components/table/src/table-body/render-helper.js +1 -1
  278. package/lib/components/table/src/table-body/render-helper.js.map +1 -1
  279. package/lib/hooks/use-id/index.js +4 -1
  280. package/lib/hooks/use-id/index.js.map +1 -1
  281. package/lib/hooks/use-lockscreen/index.js +4 -6
  282. package/lib/hooks/use-lockscreen/index.js.map +1 -1
  283. package/lib/index.js +1 -1
  284. package/lib/version.d.ts +1 -1
  285. package/lib/version.js +1 -1
  286. package/lib/version.js.map +1 -1
  287. package/package.json +3 -3
  288. package/web-types.json +1 -1
@@ -2,259 +2,105 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var vue = require('vue');
5
+ var iconsVue = require('@element-plus/icons-vue');
6
6
  require('../../../constants/index.js');
7
7
  require('../../../utils/index.js');
8
- require('../../../tokens/index.js');
9
- var index$3 = require('../../icon/index.js');
10
- require('../../../hooks/index.js');
11
- var rate = require('./rate2.js');
12
- var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
13
- var shared = require('@vue/shared');
14
- var form = require('../../../tokens/form.js');
15
- var index = require('../../../hooks/use-common-props/index.js');
16
- var index$1 = require('../../../hooks/use-namespace/index.js');
17
- var index$2 = require('../../../hooks/use-form-item/index.js');
8
+ var runtime = require('../../../utils/vue/props/runtime.js');
9
+ var typescript = require('../../../utils/typescript.js');
10
+ var icon = require('../../../utils/vue/icon.js');
11
+ var validator = require('../../../utils/vue/validator.js');
18
12
  var event = require('../../../constants/event.js');
19
- var aria = require('../../../constants/aria.js');
20
- var style = require('../../../utils/dom/style.js');
13
+ var core = require('@vueuse/core');
21
14
 
22
- const _hoisted_1 = ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"];
23
- const _hoisted_2 = ["onMousemove", "onClick"];
24
- const __default__ = {
25
- name: "ElRate"
26
- };
27
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
28
- ...__default__,
29
- props: rate.rateProps,
30
- emits: rate.rateEmits,
31
- setup(__props, { expose, emit }) {
32
- const props = __props;
33
- function getValueFromMap(value, map) {
34
- const isExcludedObject = (val) => shared.isObject(val);
35
- const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
36
- const val = map[key];
37
- const excluded = isExcludedObject(val) ? val.excluded : false;
38
- return excluded ? value < key : value <= key;
39
- }).sort((a, b) => a - b);
40
- const matchedValue = map[matchedKeys[0]];
41
- return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
42
- }
43
- const formContext = vue.inject(form.formContextKey, void 0);
44
- const formItemContext = vue.inject(form.formItemContextKey, void 0);
45
- const rateSize = index.useSize();
46
- const ns = index$1.useNamespace("rate");
47
- const { inputId, isLabeledByFormItem } = index$2.useFormItemInputId(props, {
48
- formItemContext
49
- });
50
- const currentValue = vue.ref(props.modelValue);
51
- const hoverIndex = vue.ref(-1);
52
- const pointerAtLeftHalf = vue.ref(true);
53
- const rateClasses = vue.computed(() => [ns.b(), ns.m(rateSize.value)]);
54
- const rateDisabled = vue.computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
55
- const rateStyles = vue.computed(() => {
56
- return ns.cssVarBlock({
57
- "void-color": props.voidColor,
58
- "disabled-void-color": props.disabledVoidColor,
59
- "fill-color": activeColor.value
60
- });
61
- });
62
- const text = vue.computed(() => {
63
- let result = "";
64
- if (props.showScore) {
65
- result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
66
- } else if (props.showText) {
67
- result = props.texts[Math.ceil(currentValue.value) - 1];
68
- }
69
- return result;
70
- });
71
- const valueDecimal = vue.computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
72
- const colorMap = vue.computed(() => shared.isArray(props.colors) ? {
73
- [props.lowThreshold]: props.colors[0],
74
- [props.highThreshold]: { value: props.colors[1], excluded: true },
75
- [props.max]: props.colors[2]
76
- } : props.colors);
77
- const activeColor = vue.computed(() => {
78
- const color = getValueFromMap(currentValue.value, colorMap.value);
79
- return shared.isObject(color) ? "" : color;
80
- });
81
- const decimalStyle = vue.computed(() => {
82
- let width = "";
83
- if (rateDisabled.value) {
84
- width = `${valueDecimal.value}%`;
85
- } else if (props.allowHalf) {
86
- width = "50%";
87
- }
88
- return {
89
- color: activeColor.value,
90
- width
91
- };
92
- });
93
- const componentMap = vue.computed(() => shared.isArray(props.icons) ? {
94
- [props.lowThreshold]: props.icons[0],
95
- [props.highThreshold]: {
96
- value: props.icons[1],
97
- excluded: true
98
- },
99
- [props.max]: props.icons[2]
100
- } : props.icons);
101
- const decimalIconComponent = vue.computed(() => getValueFromMap(props.modelValue, componentMap.value));
102
- const voidComponent = vue.computed(() => rateDisabled.value ? props.disabledVoidIcon : props.voidIcon);
103
- const activeComponent = vue.computed(() => getValueFromMap(currentValue.value, componentMap.value));
104
- const iconComponents = vue.computed(() => {
105
- const result = Array.from({ length: props.max });
106
- const threshold = currentValue.value;
107
- result.fill(activeComponent.value, 0, threshold);
108
- result.fill(voidComponent.value, threshold, props.max);
109
- return result;
110
- });
111
- function showDecimalIcon(item) {
112
- const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
113
- const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
114
- return showWhenDisabled || showWhenAllowHalf;
115
- }
116
- function selectValue(value) {
117
- if (rateDisabled.value) {
118
- return;
119
- }
120
- if (props.allowHalf && pointerAtLeftHalf.value) {
121
- emit(event.UPDATE_MODEL_EVENT, currentValue.value);
122
- if (props.modelValue !== currentValue.value) {
123
- emit("change", currentValue.value);
124
- }
125
- } else {
126
- emit(event.UPDATE_MODEL_EVENT, value);
127
- if (props.modelValue !== value) {
128
- emit("change", value);
129
- }
130
- }
131
- }
132
- function handleKey(e) {
133
- if (rateDisabled.value) {
134
- return;
135
- }
136
- let _currentValue = currentValue.value;
137
- const code = e.code;
138
- if (code === aria.EVENT_CODE.up || code === aria.EVENT_CODE.right) {
139
- if (props.allowHalf) {
140
- _currentValue += 0.5;
141
- } else {
142
- _currentValue += 1;
143
- }
144
- e.stopPropagation();
145
- e.preventDefault();
146
- } else if (code === aria.EVENT_CODE.left || code === aria.EVENT_CODE.down) {
147
- if (props.allowHalf) {
148
- _currentValue -= 0.5;
149
- } else {
150
- _currentValue -= 1;
151
- }
152
- e.stopPropagation();
153
- e.preventDefault();
154
- }
155
- _currentValue = _currentValue < 0 ? 0 : _currentValue;
156
- _currentValue = _currentValue > props.max ? props.max : _currentValue;
157
- emit(event.UPDATE_MODEL_EVENT, _currentValue);
158
- emit("change", _currentValue);
159
- return _currentValue;
160
- }
161
- function setCurrentValue(value, event) {
162
- if (rateDisabled.value) {
163
- return;
164
- }
165
- if (props.allowHalf) {
166
- let target = event.target;
167
- if (style.hasClass(target, ns.e("item"))) {
168
- target = target.querySelector(`.${ns.e("icon")}`);
169
- }
170
- if (target.clientWidth === 0 || style.hasClass(target, ns.e("decimal"))) {
171
- target = target.parentNode;
172
- }
173
- pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
174
- currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
175
- } else {
176
- currentValue.value = value;
177
- }
178
- hoverIndex.value = value;
179
- }
180
- function resetCurrentValue() {
181
- if (rateDisabled.value) {
182
- return;
183
- }
184
- if (props.allowHalf) {
185
- pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
186
- }
187
- currentValue.value = props.modelValue;
188
- hoverIndex.value = -1;
189
- }
190
- vue.watch(() => props.modelValue, (val) => {
191
- currentValue.value = val;
192
- pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
193
- });
194
- if (!props.modelValue) {
195
- emit(event.UPDATE_MODEL_EVENT, 0);
196
- }
197
- expose({
198
- setCurrentValue,
199
- resetCurrentValue
200
- });
201
- return (_ctx, _cache) => {
202
- var _a;
203
- return vue.openBlock(), vue.createElementBlock("div", {
204
- id: vue.unref(inputId),
205
- class: vue.normalizeClass([vue.unref(rateClasses), vue.unref(ns).is("disabled", vue.unref(rateDisabled))]),
206
- role: "slider",
207
- "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || "rating" : void 0,
208
- "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
209
- "aria-valuenow": currentValue.value,
210
- "aria-valuetext": vue.unref(text) || void 0,
211
- "aria-valuemin": "0",
212
- "aria-valuemax": _ctx.max,
213
- tabindex: "0",
214
- style: vue.normalizeStyle(vue.unref(rateStyles)),
215
- onKeydown: handleKey
216
- }, [
217
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.max, (item, key) => {
218
- return vue.openBlock(), vue.createElementBlock("span", {
219
- key,
220
- class: vue.normalizeClass(vue.unref(ns).e("item")),
221
- onMousemove: ($event) => setCurrentValue(item, $event),
222
- onMouseleave: resetCurrentValue,
223
- onClick: ($event) => selectValue(item)
224
- }, [
225
- vue.createVNode(vue.unref(index$3.ElIcon), {
226
- class: vue.normalizeClass([
227
- vue.unref(ns).e("icon"),
228
- { hover: hoverIndex.value === item },
229
- vue.unref(ns).is("active", item <= currentValue.value)
230
- ])
231
- }, {
232
- default: vue.withCtx(() => [
233
- !showDecimalIcon(item) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponents)[item - 1]), { key: 0 })) : vue.createCommentVNode("v-if", true),
234
- showDecimalIcon(item) ? (vue.openBlock(), vue.createBlock(vue.unref(index$3.ElIcon), {
235
- key: 1,
236
- style: vue.normalizeStyle(vue.unref(decimalStyle)),
237
- class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).e("decimal")])
238
- }, {
239
- default: vue.withCtx(() => [
240
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(decimalIconComponent))))
241
- ]),
242
- _: 1
243
- }, 8, ["style", "class"])) : vue.createCommentVNode("v-if", true)
244
- ]),
245
- _: 2
246
- }, 1032, ["class"])
247
- ], 42, _hoisted_2);
248
- }), 128)),
249
- _ctx.showText || _ctx.showScore ? (vue.openBlock(), vue.createElementBlock("span", {
250
- key: 0,
251
- class: vue.normalizeClass(vue.unref(ns).e("text"))
252
- }, vue.toDisplayString(vue.unref(text)), 3)) : vue.createCommentVNode("v-if", true)
253
- ], 46, _hoisted_1);
254
- };
15
+ const rateProps = runtime.buildProps({
16
+ modelValue: {
17
+ type: Number,
18
+ default: 0
19
+ },
20
+ id: {
21
+ type: String,
22
+ default: void 0
23
+ },
24
+ lowThreshold: {
25
+ type: Number,
26
+ default: 2
27
+ },
28
+ highThreshold: {
29
+ type: Number,
30
+ default: 4
31
+ },
32
+ max: {
33
+ type: Number,
34
+ default: 5
35
+ },
36
+ colors: {
37
+ type: runtime.definePropType([Array, Object]),
38
+ default: () => typescript.mutable(["", "", ""])
39
+ },
40
+ voidColor: {
41
+ type: String,
42
+ default: ""
43
+ },
44
+ disabledVoidColor: {
45
+ type: String,
46
+ default: ""
47
+ },
48
+ icons: {
49
+ type: runtime.definePropType([Array, Object]),
50
+ default: () => [iconsVue.StarFilled, iconsVue.StarFilled, iconsVue.StarFilled]
51
+ },
52
+ voidIcon: {
53
+ type: icon.iconPropType,
54
+ default: () => iconsVue.Star
55
+ },
56
+ disabledVoidIcon: {
57
+ type: icon.iconPropType,
58
+ default: () => iconsVue.StarFilled
59
+ },
60
+ disabled: {
61
+ type: Boolean
62
+ },
63
+ allowHalf: {
64
+ type: Boolean
65
+ },
66
+ showText: {
67
+ type: Boolean
68
+ },
69
+ showScore: {
70
+ type: Boolean
71
+ },
72
+ textColor: {
73
+ type: String,
74
+ default: ""
75
+ },
76
+ texts: {
77
+ type: runtime.definePropType(Array),
78
+ default: () => typescript.mutable([
79
+ "Extremely bad",
80
+ "Disappointed",
81
+ "Fair",
82
+ "Satisfied",
83
+ "Surprise"
84
+ ])
85
+ },
86
+ scoreTemplate: {
87
+ type: String,
88
+ default: "{value}"
89
+ },
90
+ size: {
91
+ type: String,
92
+ validator: validator.isValidComponentSize
93
+ },
94
+ label: {
95
+ type: String,
96
+ default: void 0
255
97
  }
256
98
  });
257
- var Rate = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/rate/src/rate.vue"]]);
99
+ const rateEmits = {
100
+ [event.CHANGE_EVENT]: (value) => core.isNumber(value),
101
+ [event.UPDATE_MODEL_EVENT]: (value) => core.isNumber(value)
102
+ };
258
103
 
259
- exports["default"] = Rate;
104
+ exports.rateEmits = rateEmits;
105
+ exports.rateProps = rateProps;
260
106
  //# sourceMappingURL=rate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rate.js","sources":["../../../../../../packages/components/rate/src/rate.vue"],"sourcesContent":["<template>\n <div\n :id=\"inputId\"\n :class=\"[rateClasses, ns.is('disabled', rateDisabled)]\"\n role=\"slider\"\n :aria-label=\"!isLabeledByFormItem ? label || 'rating' : undefined\"\n :aria-labelledby=\"\n isLabeledByFormItem ? formItemContext?.labelId : undefined\n \"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text || undefined\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n tabindex=\"0\"\n :style=\"rateStyles\"\n @keydown=\"handleKey\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n :class=\"ns.e('item')\"\n @mousemove=\"setCurrentValue(item, $event)\"\n @mouseleave=\"resetCurrentValue\"\n @click=\"selectValue(item)\"\n >\n <el-icon\n :class=\"[\n ns.e('icon'),\n { hover: hoverIndex === item },\n ns.is('active', item <= currentValue),\n ]\"\n >\n <component\n :is=\"iconComponents[item - 1]\"\n v-if=\"!showDecimalIcon(item)\"\n />\n <el-icon\n v-if=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n :class=\"[ns.e('icon'), ns.e('decimal')]\"\n >\n <component :is=\"decimalIconComponent\" />\n </el-icon>\n </el-icon>\n </span>\n <span v-if=\"showText || showScore\" :class=\"ns.e('text')\">\n {{ text }}\n </span>\n </div>\n</template>\n<script lang=\"ts\" setup>\nimport { type CSSProperties, computed, inject, ref, watch } from 'vue'\nimport { EVENT_CODE, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { hasClass, isArray, isObject } from '@element-plus/utils'\nimport { formContextKey, formItemContextKey } from '@element-plus/tokens'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { useFormItemInputId, useNamespace, useSize } from '@element-plus/hooks'\nimport { rateEmits, rateProps } from './rate'\n\nfunction getValueFromMap<T>(\n value: number,\n map: Record<string, T | { excluded?: boolean; value: T }>\n) {\n const isExcludedObject = (\n val: unknown\n ): val is { excluded?: boolean } & Record<any, unknown> => isObject(val)\n\n const matchedKeys = Object.keys(map)\n .map((key) => +key)\n .filter((key) => {\n const val = map[key]\n const excluded = isExcludedObject(val) ? val.excluded : false\n return excluded ? value < key : value <= key\n })\n .sort((a, b) => a - b)\n const matchedValue = map[matchedKeys[0]]\n return (isExcludedObject(matchedValue) && matchedValue.value) || matchedValue\n}\n\ndefineOptions({\n name: 'ElRate',\n})\n\nconst props = defineProps(rateProps)\nconst emit = defineEmits(rateEmits)\n\nconst formContext = inject(formContextKey, undefined)\nconst formItemContext = inject(formItemContextKey, undefined)\nconst rateSize = useSize()\nconst ns = useNamespace('rate')\nconst { inputId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext,\n})\n\nconst currentValue = ref(props.modelValue)\nconst hoverIndex = ref(-1)\nconst pointerAtLeftHalf = ref(true)\n\nconst rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)])\nconst rateDisabled = computed(() => props.disabled || formContext?.disabled)\nconst rateStyles = computed(() => {\n return ns.cssVarBlock({\n 'void-color': props.voidColor,\n 'disabled-void-color': props.disabledVoidColor,\n 'fill-color': activeColor.value,\n }) as CSSProperties\n})\n\nconst text = computed(() => {\n let result = ''\n if (props.showScore) {\n result = props.scoreTemplate.replace(\n /\\{\\s*value\\s*\\}/,\n rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`\n )\n } else if (props.showText) {\n result = props.texts[Math.ceil(currentValue.value) - 1]\n }\n return result\n})\nconst valueDecimal = computed(\n () => props.modelValue * 100 - Math.floor(props.modelValue) * 100\n)\nconst colorMap = computed(() =>\n isArray(props.colors)\n ? {\n [props.lowThreshold]: props.colors[0],\n [props.highThreshold]: { value: props.colors[1], excluded: true },\n [props.max]: props.colors[2],\n }\n : props.colors\n)\nconst activeColor = computed(() => {\n const color = getValueFromMap(currentValue.value, colorMap.value)\n // {value: '', excluded: true} returned\n return isObject(color) ? '' : color\n})\nconst decimalStyle = computed(() => {\n let width = ''\n if (rateDisabled.value) {\n width = `${valueDecimal.value}%`\n } else if (props.allowHalf) {\n width = '50%'\n }\n return {\n color: activeColor.value,\n width,\n }\n})\nconst componentMap = computed(() =>\n isArray(props.icons)\n ? {\n [props.lowThreshold]: props.icons[0],\n [props.highThreshold]: {\n value: props.icons[1],\n excluded: true,\n },\n [props.max]: props.icons[2],\n }\n : props.icons\n)\nconst decimalIconComponent = computed(() =>\n getValueFromMap(props.modelValue, componentMap.value)\n)\nconst voidComponent = computed(() =>\n rateDisabled.value ? props.disabledVoidIcon : props.voidIcon\n)\nconst activeComponent = computed(() =>\n getValueFromMap(currentValue.value, componentMap.value)\n)\nconst iconComponents = computed(() => {\n const result = Array.from({ length: props.max })\n const threshold = currentValue.value\n result.fill(activeComponent.value, 0, threshold)\n result.fill(voidComponent.value, threshold, props.max)\n return result\n})\n\nfunction showDecimalIcon(item: number) {\n const showWhenDisabled =\n rateDisabled.value &&\n valueDecimal.value > 0 &&\n item - 1 < props.modelValue &&\n item > props.modelValue\n const showWhenAllowHalf =\n props.allowHalf &&\n pointerAtLeftHalf.value &&\n item - 0.5 <= currentValue.value &&\n item > currentValue.value\n return showWhenDisabled || showWhenAllowHalf\n}\n\nfunction selectValue(value: number) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && pointerAtLeftHalf.value) {\n emit(UPDATE_MODEL_EVENT, currentValue.value)\n if (props.modelValue !== currentValue.value) {\n emit('change', currentValue.value)\n }\n } else {\n emit(UPDATE_MODEL_EVENT, value)\n if (props.modelValue !== value) {\n emit('change', value)\n }\n }\n}\n\nfunction handleKey(e: KeyboardEvent) {\n if (rateDisabled.value) {\n return\n }\n let _currentValue = currentValue.value\n const code = e.code\n if (code === EVENT_CODE.up || code === EVENT_CODE.right) {\n if (props.allowHalf) {\n _currentValue += 0.5\n } else {\n _currentValue += 1\n }\n e.stopPropagation()\n e.preventDefault()\n } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {\n if (props.allowHalf) {\n _currentValue -= 0.5\n } else {\n _currentValue -= 1\n }\n e.stopPropagation()\n e.preventDefault()\n }\n _currentValue = _currentValue < 0 ? 0 : _currentValue\n _currentValue = _currentValue > props.max ? props.max : _currentValue\n emit(UPDATE_MODEL_EVENT, _currentValue)\n emit('change', _currentValue)\n return _currentValue\n}\n\nfunction setCurrentValue(value: number, event: MouseEvent) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n // TODO: use cache via computed https://github.com/element-plus/element-plus/pull/5456#discussion_r786472092\n let target = event.target as HTMLElement\n if (hasClass(target, ns.e('item'))) {\n target = target.querySelector(`.${ns.e('icon')}`)!\n }\n if (target.clientWidth === 0 || hasClass(target, ns.e('decimal'))) {\n target = target.parentNode as HTMLElement\n }\n pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth\n currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value\n } else {\n currentValue.value = value\n }\n hoverIndex.value = value\n}\n\nfunction resetCurrentValue() {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n currentValue.value = props.modelValue\n hoverIndex.value = -1\n}\n\nwatch(\n () => props.modelValue,\n (val) => {\n currentValue.value = val\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n)\n\nif (!props.modelValue) {\n emit(UPDATE_MODEL_EVENT, 0)\n}\n\ndefineExpose({\n /** @description set current value */\n setCurrentValue,\n /** @description reset current value */\n resetCurrentValue,\n})\n</script>\n"],"names":["isObject","inject","formContextKey","formItemContextKey","useSize","useNamespace","useFormItemInputId","ref","computed","isArray","UPDATE_MODEL_EVENT","EVENT_CODE","hasClass","watch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,IAAA,SAAA,eAAA,CACA,OACA,GACA,EAAA;AACA,MAAA,MAAA,gBAAA,GAAA,CACA,GACA,KAAAA,eAAA,CAAA,GAAA,CAAA,CAAA;AAEA,MAAA,MAAA,WAAA,GAAA,MAAA,CAAA,IAAA,CAAA,GAAA,CACA,CAAA,GAAA,CAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CACA,CAAA,MAAA,CAAA,CAAA,GAAA,KAAA;AACA,QAAA,MAAA,MAAA,GAAA,CAAA,GAAA,CAAA,CAAA;AACA,QAAA,MAAA,QA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A;AACA,MAAA,IAAA,MAAA,SAAA,EAAA;AACA,QAAA,iBAAA,CAAA,QAAA,KAAA,CAAA,UAAA,KAAA,IAAA,CAAA,KAAA,CAAA,MAAA,UAAA,CAAA,CAAA;AAAA,OACA;AACA,MAAA,YAAA,CAAA,QAAA,KAAA,CAAA,UAAA,CAAA;AACA,MAAA,UAAA,CAAA,KAAA,GAAA,CAAA,CAAA,CAAA;AAAA,KACA;AAEA,IAAAC,SAAA,CACA,MAAA,KAAA,CAAA,UACA,EAAA,CAAA,GAAA,KAAA;AACA,MAAA,YAAA,CAAA,KAAA,GAAA,GAAA,CAAA;AACA,MAAA,iBAAA,CAAA,QAAA,KAAA,CAAA,UAAA,KAAA,IAAA,CAAA,KAAA,CAAA,MAAA,UAAA,CAAA,CAAA;AAAA,KAEA,CAAA,CAAA;AAEA,IAAA,IAAA,CAAA,MAAA,UAAA,EAAA;AACA,MAAA,IAAA,CAAAH,0BAAA,CAAA,CAAA,CAAA;AAAA,KACA;AAEA,IAAA,MAAA,CAAA;AAAA,MAEA,eAAA;AAAA,MAEA,iBAAA;AAAA,KACA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"rate.js","sources":["../../../../../../packages/components/rate/src/rate.ts"],"sourcesContent":["import { Star, StarFilled } from '@element-plus/icons-vue'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport {\n buildProps,\n definePropType,\n iconPropType,\n isNumber,\n isValidComponentSize,\n mutable,\n} from '@element-plus/utils'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type { Component, ExtractPropTypes, PropType } from 'vue'\nimport type Rate from './rate.vue'\n\nexport const rateProps = buildProps({\n modelValue: {\n type: Number,\n default: 0,\n },\n id: {\n type: String,\n default: undefined,\n },\n lowThreshold: {\n type: Number,\n default: 2,\n },\n highThreshold: {\n type: Number,\n default: 4,\n },\n max: {\n type: Number,\n default: 5,\n },\n colors: {\n type: definePropType<string[] | Record<number, string>>([Array, Object]),\n default: () => mutable(['', '', ''] as const),\n },\n voidColor: {\n type: String,\n default: '',\n },\n disabledVoidColor: {\n type: String,\n default: '',\n },\n icons: {\n type: definePropType<\n Array<string | Component> | Record<number, string | Component>\n >([Array, Object]),\n default: () => [StarFilled, StarFilled, StarFilled],\n },\n voidIcon: {\n type: iconPropType,\n default: () => Star,\n },\n disabledVoidIcon: {\n type: iconPropType,\n default: () => StarFilled,\n },\n disabled: {\n type: Boolean,\n },\n allowHalf: {\n type: Boolean,\n },\n showText: {\n type: Boolean,\n },\n showScore: {\n type: Boolean,\n },\n textColor: {\n type: String,\n default: '',\n },\n texts: {\n type: definePropType<string[]>(Array),\n default: () =>\n mutable([\n 'Extremely bad',\n 'Disappointed',\n 'Fair',\n 'Satisfied',\n 'Surprise',\n ] as const),\n },\n scoreTemplate: {\n type: String,\n default: '{value}',\n },\n size: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n label: {\n type: String,\n default: undefined,\n },\n} as const)\n\nexport type RateProps = ExtractPropTypes<typeof rateProps>\n\nexport const rateEmits = {\n [CHANGE_EVENT]: (value: number) => isNumber(value),\n [UPDATE_MODEL_EVENT]: (value: number) => isNumber(value),\n}\nexport type RateEmits = typeof rateEmits\n\nexport type RateInstance = InstanceType<typeof Rate>\n"],"names":["buildProps","definePropType","mutable","StarFilled","iconPropType","Star","isValidComponentSize","CHANGE_EVENT","isNumber","UPDATE_MODEL_EVENT"],"mappings":";;;;;;;;;;;;;;AAUY,MAAC,SAAS,GAAGA,kBAAU,CAAC;AACpC,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,EAAE,EAAE;AACN,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,YAAY,EAAE;AAChB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