@element-plus/nightly 0.0.20220404 → 0.0.20220407

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 (296) hide show
  1. package/dist/index.full.js +8 -3
  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 +8 -3
  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.mjs +2 -2
  232. package/es/components/carousel/src/carousel-item.mjs +155 -7
  233. package/es/components/carousel/src/carousel-item.mjs.map +1 -1
  234. package/es/components/carousel/src/carousel-item2.mjs +7 -155
  235. package/es/components/carousel/src/carousel-item2.mjs.map +1 -1
  236. package/es/components/image/index.d.ts +4 -0
  237. package/es/components/image/src/image.d.ts +1 -0
  238. package/es/components/image/src/image.mjs +4 -0
  239. package/es/components/image/src/image.mjs.map +1 -1
  240. package/es/components/image/src/image.vue.d.ts +4 -0
  241. package/es/components/image/src/image2.mjs +2 -1
  242. package/es/components/image/src/image2.mjs.map +1 -1
  243. package/es/components/index.mjs +1 -1
  244. package/es/components/table-v2/index.d.ts +0 -0
  245. package/es/components/table-v2/index.mjs +2 -0
  246. package/es/components/table-v2/index.mjs.map +1 -0
  247. package/es/components/table-v2/src/column.d.ts +21 -0
  248. package/es/components/table-v2/src/column.mjs +45 -0
  249. package/es/components/table-v2/src/column.mjs.map +1 -0
  250. package/es/components/table-v2/src/constants.d.ts +1 -0
  251. package/es/components/table-v2/src/constants.mjs +4 -0
  252. package/es/components/table-v2/src/constants.mjs.map +1 -0
  253. package/es/components/table-v2/src/table.d.ts +80 -0
  254. package/es/components/table-v2/src/table.mjs +80 -0
  255. package/es/components/table-v2/src/table.mjs.map +1 -0
  256. package/es/components/table-v2/src/types.d.ts +70 -0
  257. package/es/components/table-v2/src/types.mjs +2 -0
  258. package/es/components/table-v2/src/types.mjs.map +1 -0
  259. package/es/index.mjs +1 -1
  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/carousel/index.js +2 -2
  264. package/lib/components/carousel/src/carousel-item.js +155 -7
  265. package/lib/components/carousel/src/carousel-item.js.map +1 -1
  266. package/lib/components/carousel/src/carousel-item2.js +7 -155
  267. package/lib/components/carousel/src/carousel-item2.js.map +1 -1
  268. package/lib/components/image/index.d.ts +4 -0
  269. package/lib/components/image/src/image.d.ts +1 -0
  270. package/lib/components/image/src/image.js +4 -0
  271. package/lib/components/image/src/image.js.map +1 -1
  272. package/lib/components/image/src/image.vue.d.ts +4 -0
  273. package/lib/components/image/src/image2.js +2 -1
  274. package/lib/components/image/src/image2.js.map +1 -1
  275. package/lib/components/index.js +1 -1
  276. package/lib/components/table-v2/index.d.ts +0 -0
  277. package/lib/components/table-v2/index.js +3 -0
  278. package/lib/components/table-v2/index.js.map +1 -0
  279. package/lib/components/table-v2/src/column.d.ts +21 -0
  280. package/lib/components/table-v2/src/column.js +49 -0
  281. package/lib/components/table-v2/src/column.js.map +1 -0
  282. package/lib/components/table-v2/src/constants.d.ts +1 -0
  283. package/lib/components/table-v2/src/constants.js +8 -0
  284. package/lib/components/table-v2/src/constants.js.map +1 -0
  285. package/lib/components/table-v2/src/table.d.ts +80 -0
  286. package/lib/components/table-v2/src/table.js +84 -0
  287. package/lib/components/table-v2/src/table.js.map +1 -0
  288. package/lib/components/table-v2/src/types.d.ts +70 -0
  289. package/lib/components/table-v2/src/types.js +3 -0
  290. package/lib/components/table-v2/src/types.js.map +1 -0
  291. package/lib/index.js +1 -1
  292. package/lib/version.d.ts +1 -1
  293. package/lib/version.js +1 -1
  294. package/lib/version.js.map +1 -1
  295. package/package.json +2 -2
  296. package/web-types.json +1 -1
@@ -0,0 +1,45 @@
1
+ import '../../../utils/index.mjs';
2
+ import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
3
+
4
+ const widthType = {
5
+ type: Number,
6
+ default: void 0
7
+ };
8
+ const tableV2ColumnProps = buildProps({
9
+ align: {
10
+ type: definePropType(String),
11
+ default: "left"
12
+ },
13
+ class: String,
14
+ dataKey: String,
15
+ fixed: {
16
+ type: definePropType([String, Boolean]),
17
+ default: false
18
+ },
19
+ headerClass: String,
20
+ hidden: Boolean,
21
+ resizable: Boolean,
22
+ style: {
23
+ type: definePropType(Object)
24
+ },
25
+ sortable: Boolean,
26
+ title: String,
27
+ maxWidth: widthType,
28
+ minWidth: widthType,
29
+ width: {
30
+ type: Number,
31
+ required: true
32
+ },
33
+ cellRenderer: {
34
+ type: definePropType(Function)
35
+ },
36
+ dataGetter: {
37
+ type: definePropType(Function)
38
+ },
39
+ headerRenderer: {
40
+ type: definePropType(Function)
41
+ }
42
+ });
43
+
44
+ export { tableV2ColumnProps };
45
+ //# sourceMappingURL=column.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column.mjs","sources":["../../../../../../packages/components/table-v2/src/column.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\n\nimport type { ExtractPropTypes, StyleValue } from 'vue'\nimport type {\n Alignment,\n CellRenderer,\n DataGetter,\n FixedDirection,\n HeaderRenderer,\n} from './types'\n\nconst widthType = {\n type: Number,\n default: undefined,\n} as const\n\nexport const tableV2ColumnProps = buildProps({\n /**\n * Attributes\n */\n align: {\n type: definePropType<Alignment>(String),\n default: 'left',\n },\n class: String,\n dataKey: String,\n fixed: {\n type: definePropType<boolean | FixedDirection>([String, Boolean]),\n default: false,\n },\n headerClass: String,\n hidden: Boolean,\n resizable: Boolean,\n style: {\n type: definePropType<StyleValue>(Object),\n },\n sortable: Boolean,\n title: String,\n\n maxWidth: widthType,\n minWidth: widthType,\n width: {\n type: Number,\n required: true,\n },\n\n // getters & renderers\n cellRenderer: {\n type: definePropType<CellRenderer<any>>(Function),\n },\n dataGetter: {\n type: definePropType<DataGetter<any>>(Function),\n },\n headerRenderer: {\n type: definePropType<HeaderRenderer<any>>(Function),\n },\n} as const)\n\nexport type TableV2ColumnProps = ExtractPropTypes<typeof tableV2ColumnProps>\n"],"names":[],"mappings":";;;AACA,MAAM,SAAS,GAAG;AAClB,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,OAAO,EAAE,KAAK,CAAC;AACjB,CAAC,CAAC;AACU,MAAC,kBAAkB,GAAG,UAAU,CAAC;AAC7C,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,OAAO,EAAE,MAAM;AACjB,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3C,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,WAAW,EAAE,MAAM;AACrB,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,QAAQ,EAAE,SAAS;AACrB,EAAE,QAAQ,EAAE,SAAS;AACrB,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,QAAQ,EAAE,IAAI;AAClB,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,EAAE,cAAc,EAAE;AAClB,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,CAAC;;;;"}
@@ -0,0 +1 @@
1
+ export declare const sortOrders: readonly ["asc", "desc"];
@@ -0,0 +1,4 @@
1
+ const sortOrders = ["asc", "desc"];
2
+
3
+ export { sortOrders };
4
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.mjs","sources":["../../../../../../packages/components/table-v2/src/constants.ts"],"sourcesContent":["export const sortOrders = ['asc', 'desc'] as const\n"],"names":[],"mappings":"AAAY,MAAC,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM;;;;"}
@@ -0,0 +1,80 @@
1
+ import type { ExtractPropTypes, StyleValue } from 'vue';
2
+ import type { Column, ColumnCommonParams, RowCommonParams, SortOrder } from './types';
3
+ /**
4
+ * Param types
5
+ */
6
+ export declare type ColumnSortParams<T> = {
7
+ column: Column<T>;
8
+ key: KeyType;
9
+ order: SortOrder;
10
+ };
11
+ export declare type RowExpandParams<T> = {
12
+ expanded: boolean;
13
+ rowKey: KeyType;
14
+ } & RowCommonParams<T>;
15
+ export declare type RowEventHandlerParams<T> = {
16
+ rowKey: KeyType;
17
+ event: Event;
18
+ } & RowCommonParams<T>;
19
+ /**
20
+ * Renderer/Getter types
21
+ */
22
+ export declare type ExtraCellPropGetter<T> = (params: ColumnCommonParams<T> & RowCommonParams<T>) => any;
23
+ export declare type ExtractHeaderPropGetter<T> = (params: {
24
+ columns: Column<T>[];
25
+ headerIndex: number;
26
+ }) => any;
27
+ export declare type ExtractHeaderCellPropGetter<T> = (params: ColumnCommonParams<T> & {
28
+ headerIndex: number;
29
+ }) => any;
30
+ export declare type ExtractRowPropGetter<T> = (params: {
31
+ columns: Column<T>[];
32
+ } & RowCommonParams<T>) => any;
33
+ export declare type HeaderClassNameGetter<T> = (params: {
34
+ columns: Column<T>[];
35
+ headerIndex: number;
36
+ }) => string;
37
+ export declare type RowClassNameGetter<T> = (params: {
38
+ columns: Column<T>[];
39
+ } & RowCommonParams<T>) => string;
40
+ /**
41
+ * Handler types
42
+ */
43
+ export declare type ColumnSortHandler<T> = (params: ColumnSortParams<T>) => void;
44
+ export declare type RowExpandHandler<T> = (params: RowExpandParams<T>) => void;
45
+ export declare type RowEventHandler<T> = (params: RowEventHandlerParams<T>) => void;
46
+ export declare type RowEventHandlers<T> = {
47
+ click?: RowEventHandler<T>;
48
+ contextmenu?: RowEventHandler<T>;
49
+ dblclick?: RowEventHandler<T>;
50
+ mouseenter?: RowEventHandler<T>;
51
+ mouseleave?: RowEventHandler<T>;
52
+ };
53
+ export declare const tableV2Props: {
54
+ readonly rowKey: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<KeyType>, unknown, unknown, unknown, unknown>;
55
+ readonly cellProps: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<any>, unknown, unknown, unknown, unknown>;
56
+ readonly headerClassName: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<string | HeaderClassNameGetter<any>>, unknown, unknown, unknown, unknown>;
57
+ readonly headerProps: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<any>, unknown, unknown, unknown, unknown>;
58
+ readonly headerCellProps: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<any>, unknown, unknown, unknown, unknown>;
59
+ readonly rowClassName: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<string | RowClassNameGetter<any>>, unknown, unknown, unknown, unknown>;
60
+ readonly rowProps: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<any>, unknown, unknown, unknown, unknown>;
61
+ readonly columns: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<Column<any>[]>, unknown, true, unknown, unknown>;
62
+ readonly fixedData: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<any[]>, unknown, unknown, unknown, unknown>;
63
+ readonly data: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<any[]>, unknown, unknown, unknown, unknown>;
64
+ readonly expandColumnKey: StringConstructor;
65
+ readonly expandedRowKeys: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<KeyType[]>, unknown, unknown, unknown, unknown>;
66
+ readonly defaultExpandedRowKeys: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<KeyType[]>, unknown, unknown, unknown, unknown>;
67
+ readonly classNames: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<string | string[]>, unknown, unknown, unknown, unknown>;
68
+ readonly disabled: BooleanConstructor;
69
+ readonly footerHeight: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<number | number[]>, unknown, unknown, unknown, unknown>;
70
+ readonly headerHeight: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<number | number[]>, unknown, unknown, unknown, unknown>;
71
+ readonly style: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<StyleValue>, unknown, unknown, unknown, unknown>;
72
+ readonly sortBy: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<{
73
+ key: KeyType;
74
+ order: readonly ["asc", "desc"];
75
+ }>, unknown, unknown, unknown, unknown>;
76
+ readonly onColumnSort: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<ColumnSortParams<any>>, unknown, unknown, unknown, unknown>;
77
+ readonly onRowExpanded: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<RowExpandHandler<any>>, unknown, unknown, unknown, unknown>;
78
+ readonly rowEventHandlers: import("element-plus/es/utils").BuildPropReturn<import("element-plus/es/utils").PropWrapper<RowEventHandlers<any>>, unknown, unknown, unknown, unknown>;
79
+ };
80
+ export declare type TableV2Props = ExtractPropTypes<typeof tableV2Props>;
@@ -0,0 +1,80 @@
1
+ import '../../../utils/index.mjs';
2
+ import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
3
+
4
+ const tableV2Props = buildProps({
5
+ rowKey: {
6
+ type: definePropType([String, Number, Symbol])
7
+ },
8
+ cellProps: {
9
+ type: definePropType([Object, Function])
10
+ },
11
+ headerClassName: {
12
+ type: definePropType([
13
+ String,
14
+ Function
15
+ ])
16
+ },
17
+ headerProps: {
18
+ type: definePropType([
19
+ Object,
20
+ Function
21
+ ])
22
+ },
23
+ headerCellProps: {
24
+ type: definePropType([
25
+ Object,
26
+ Function
27
+ ])
28
+ },
29
+ rowClassName: {
30
+ type: definePropType([String, Function])
31
+ },
32
+ rowProps: {
33
+ type: definePropType([Object, Function])
34
+ },
35
+ columns: {
36
+ type: definePropType(Array),
37
+ required: true
38
+ },
39
+ fixedData: {
40
+ type: definePropType(Array)
41
+ },
42
+ data: {
43
+ type: definePropType(Array)
44
+ },
45
+ expandColumnKey: String,
46
+ expandedRowKeys: {
47
+ type: definePropType(Array)
48
+ },
49
+ defaultExpandedRowKeys: {
50
+ type: definePropType(Array)
51
+ },
52
+ classNames: {
53
+ type: definePropType([String, Array])
54
+ },
55
+ disabled: Boolean,
56
+ footerHeight: {
57
+ type: definePropType([Number, Array])
58
+ },
59
+ headerHeight: {
60
+ type: definePropType([Number, Array])
61
+ },
62
+ style: {
63
+ type: definePropType([String, Array, Object])
64
+ },
65
+ sortBy: {
66
+ type: definePropType(Object)
67
+ },
68
+ onColumnSort: {
69
+ type: definePropType(Function)
70
+ },
71
+ onRowExpanded: {
72
+ type: definePropType(Function)
73
+ },
74
+ rowEventHandlers: {
75
+ type: definePropType(Object)
76
+ }
77
+ });
78
+
79
+ export { tableV2Props };
80
+ //# sourceMappingURL=table.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.mjs","sources":["../../../../../../packages/components/table-v2/src/table.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\n\nimport type { ExtractPropTypes, StyleValue } from 'vue'\nimport type {\n Column,\n ColumnCommonParams,\n RowCommonParams,\n SortOrder,\n} from './types'\n\n/**\n * Param types\n */\nexport type ColumnSortParams<T> = {\n column: Column<T>\n key: KeyType\n order: SortOrder\n}\n\nexport type RowExpandParams<T> = {\n expanded: boolean\n rowKey: KeyType\n} & RowCommonParams<T>\n\nexport type RowEventHandlerParams<T> = {\n rowKey: KeyType\n event: Event\n} & RowCommonParams<T>\n\n/**\n * Renderer/Getter types\n */\n\nexport type ExtraCellPropGetter<T> = (\n params: ColumnCommonParams<T> & RowCommonParams<T>\n) => any\n\nexport type ExtractHeaderPropGetter<T> = (params: {\n columns: Column<T>[]\n headerIndex: number\n}) => any\n\nexport type ExtractHeaderCellPropGetter<T> = (\n params: ColumnCommonParams<T> & { headerIndex: number }\n) => any\n\nexport type ExtractRowPropGetter<T> = (\n params: { columns: Column<T>[] } & RowCommonParams<T>\n) => any\n\nexport type HeaderClassNameGetter<T> = (params: {\n columns: Column<T>[]\n headerIndex: number\n}) => string\n\nexport type RowClassNameGetter<T> = (\n params: { columns: Column<T>[] } & RowCommonParams<T>\n) => string\n\n/**\n * Handler types\n */\nexport type ColumnSortHandler<T> = (params: ColumnSortParams<T>) => void\nexport type RowExpandHandler<T> = (params: RowExpandParams<T>) => void\nexport type RowEventHandler<T> = (params: RowEventHandlerParams<T>) => void\n\nexport type RowEventHandlers<T> = {\n click?: RowEventHandler<T>\n contextmenu?: RowEventHandler<T>\n dblclick?: RowEventHandler<T>\n mouseenter?: RowEventHandler<T>\n mouseleave?: RowEventHandler<T>\n}\n\nexport const tableV2Props = buildProps({\n /**\n * Unique items\n */\n rowKey: {\n type: definePropType<KeyType>([String, Number, Symbol]),\n },\n\n /**\n * extra props deriver\n */\n cellProps: {\n type: definePropType<any | ExtraCellPropGetter<any>>([Object, Function]),\n },\n headerClassName: {\n type: definePropType<string | HeaderClassNameGetter<any>>([\n String,\n Function,\n ]),\n },\n headerProps: {\n type: definePropType<any | ExtractHeaderPropGetter<any>>([\n Object,\n Function,\n ]),\n },\n headerCellProps: {\n type: definePropType<any | ExtractHeaderCellPropGetter<any>>([\n Object,\n Function,\n ]),\n },\n rowClassName: {\n type: definePropType<string | RowClassNameGetter<any>>([String, Function]),\n },\n rowProps: {\n type: definePropType<any | ExtractRowPropGetter<any>>([Object, Function]),\n },\n\n /**\n * Data models\n */\n columns: {\n type: definePropType<Column<any>[]>(Array),\n required: true,\n },\n fixedData: {\n type: definePropType<any[]>(Array),\n },\n data: {\n type: definePropType<any[]>(Array),\n },\n\n /**\n * Expanded keys\n */\n expandColumnKey: String,\n expandedRowKeys: {\n type: definePropType<KeyType[]>(Array),\n },\n defaultExpandedRowKeys: {\n type: definePropType<KeyType[]>(Array),\n },\n\n /**\n * Attributes\n */\n classNames: {\n type: definePropType<string | string[]>([String, Array]),\n },\n disabled: Boolean,\n footerHeight: {\n type: definePropType<number | number[]>([Number, Array]),\n },\n headerHeight: {\n type: definePropType<number | number[]>([Number, Array]),\n },\n style: {\n type: definePropType<StyleValue>([String, Array, Object]),\n },\n sortBy: {\n type: definePropType<{ key: KeyType; order: SortOrder }>(Object),\n },\n\n /**\n * Handlers\n */\n onColumnSort: {\n type: definePropType<ColumnSortParams<any>>(Function),\n },\n onRowExpanded: {\n type: definePropType<RowExpandHandler<any>>(Function),\n },\n rowEventHandlers: {\n type: definePropType<RowEventHandlers<any>>(Object),\n },\n} as const)\n\nexport type TableV2Props = ExtractPropTypes<typeof tableV2Props>\n"],"names":[],"mappings":";;;AACY,MAAC,YAAY,GAAG,UAAU,CAAC;AACvC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAClD,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC5C,GAAG;AACH,EAAE,eAAe,EAAE;AACnB,IAAI,IAAI,EAAE,cAAc,CAAC;AACzB,MAAM,MAAM;AACZ,MAAM,QAAQ;AACd,KAAK,CAAC;AACN,GAAG;AACH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AAE,cAAc,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACzC,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AACjD,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,EAAE,gBAAgB,EAAE;AACpB,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,CAAC;;;;"}
@@ -0,0 +1,70 @@
1
+ import type { StyleValue, VNode } from 'vue';
2
+ import type { sortOrders } from './constants';
3
+ export declare type Alignment = 'left' | 'center' | 'right';
4
+ export declare type FixedDirection = 'left' | 'right';
5
+ export declare type KeyType = string | number | symbol;
6
+ export declare type SortOrder = typeof sortOrders;
7
+ /**
8
+ * Param types
9
+ */
10
+ export declare type CellRendererParams<T> = {
11
+ cellData: T;
12
+ } & RowCommonParams<T> & ColumnCommonParams<T>;
13
+ export declare type ColumnCommonParams<T> = {
14
+ columns: Column<T>[];
15
+ column: Column<T>;
16
+ columnIndex: number;
17
+ };
18
+ export declare type HeaderRendererParams<T> = {
19
+ headerIndex: number;
20
+ } & ColumnCommonParams<T>;
21
+ export declare type RowCommonParams<T> = {
22
+ rowData: T[];
23
+ rowIndex: number;
24
+ };
25
+ export declare type ClassNameGetterParams<T> = {
26
+ cellData: T;
27
+ } & RowCommonParams<T> & ColumnCommonParams<T>;
28
+ export declare type DataGetterParams<T> = {
29
+ columns: Column<T>[];
30
+ column: Column<T>;
31
+ columnIndex: number;
32
+ } & RowCommonParams<T>;
33
+ export declare type DataGetter<T> = (params: DataGetterParams<T>) => T;
34
+ export declare type ClassNameGetter<T> = (params: ClassNameGetterParams<T>) => string;
35
+ /**
36
+ * Renderer/Getter types
37
+ */
38
+ export declare type CellRenderer<T> = (params: CellRendererParams<T>) => VNode;
39
+ export declare type HeaderRenderer<T> = (params: HeaderRendererParams<T>) => VNode;
40
+ export declare type Column<T = any> = {
41
+ key: KeyType;
42
+ /**
43
+ * Data part
44
+ */
45
+ dataKey?: string;
46
+ dataGetter?: DataGetter<T>;
47
+ /**
48
+ * Attributes
49
+ */
50
+ align?: Alignment;
51
+ className?: any | ClassNameGetter<T>;
52
+ fixed?: true | FixedDirection;
53
+ title?: string;
54
+ hidden?: boolean;
55
+ maxWidth?: number;
56
+ minWidth?: number;
57
+ resizable?: boolean;
58
+ style?: StyleValue;
59
+ sortable?: boolean;
60
+ width: number;
61
+ /**
62
+ * Renderers
63
+ */
64
+ cellRenderer?: CellRenderer<T>;
65
+ headerRenderer?: HeaderRenderer<T>;
66
+ /**
67
+ * Extendable sections
68
+ */
69
+ [key: string]: any;
70
+ };
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/es/index.mjs CHANGED
@@ -29,7 +29,7 @@ export { ElCalendar } from './components/calendar/index.mjs';
29
29
  export { cardProps } from './components/card/src/card.mjs';
30
30
  export { ElCard } from './components/card/index.mjs';
31
31
  export { carouselEmits, carouselProps } from './components/carousel/src/carousel.mjs';
32
- export { carouselItemProps } from './components/carousel/src/carousel-item.mjs';
32
+ export { carouselItemProps } from './components/carousel/src/carousel-item2.mjs';
33
33
  export { ElCarousel, ElCarouselItem } from './components/carousel/index.mjs';
34
34
  export { ElCascader } from './components/cascader/index.mjs';
35
35
  export { CASCADER_PANEL_INJECTION_KEY, ExpandTrigger } from './components/cascader-panel/src/types.mjs';
package/es/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "0.0.20220404";
1
+ export declare const version = "0.0.20220407";
package/es/version.mjs CHANGED
@@ -1,4 +1,4 @@
1
- const version = "0.0.20220404";
1
+ const version = "0.0.20220407";
2
2
 
3
3
  export { version };
4
4
  //# sourceMappingURL=version.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.20220404'\n"],"names":[],"mappings":"AAAY,MAAC,OAAO,GAAG;;;;"}
1
+ {"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.20220407'\n"],"names":[],"mappings":"AAAY,MAAC,OAAO,GAAG;;;;"}
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('../../utils/index.js');
6
6
  var carousel$1 = require('./src/carousel2.js');
7
- var carouselItem$1 = require('./src/carousel-item2.js');
7
+ var carouselItem$1 = require('./src/carousel-item.js');
8
8
  var carousel = require('./src/carousel.js');
9
- var carouselItem = require('./src/carousel-item.js');
9
+ var carouselItem = require('./src/carousel-item2.js');
10
10
  var install = require('../../utils/vue/install.js');
11
11
 
12
12
  const ElCarousel = install.withInstall(carousel$1["default"], {
@@ -2,16 +2,164 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var vue = require('vue');
5
6
  require('../../../utils/index.js');
6
- var props = require('../../../utils/vue/props.js');
7
+ require('../../../hooks/index.js');
8
+ require('../../../tokens/index.js');
9
+ var carouselItem = require('./carousel-item2.js');
10
+ var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
11
+ var index = require('../../../hooks/use-namespace/index.js');
12
+ var carousel = require('../../../tokens/carousel.js');
13
+ var error = require('../../../utils/error.js');
14
+ var types = require('../../../utils/types.js');
7
15
 
8
- const carouselItemProps = props.buildProps({
9
- name: { type: String, default: "" },
10
- label: {
11
- type: [String, Number],
12
- default: ""
16
+ const __default__ = {
17
+ name: "ElCarouselItem"
18
+ };
19
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
20
+ ...__default__,
21
+ props: carouselItem.carouselItemProps,
22
+ setup(__props) {
23
+ const props = __props;
24
+ const ns = index.useNamespace("carousel");
25
+ const COMPONENT_NAME = "ElCarouselItem";
26
+ const carouselContext = vue.inject(carousel.carouselContextKey);
27
+ const instance = vue.getCurrentInstance();
28
+ if (!carouselContext) {
29
+ error.debugWarn(COMPONENT_NAME, "usage: <el-carousel></el-carousel-item></el-carousel>");
30
+ }
31
+ if (!instance) {
32
+ error.debugWarn(COMPONENT_NAME, "compositional hook can only be invoked inside setups");
33
+ }
34
+ const CARD_SCALE = 0.83;
35
+ const hover = vue.ref(false);
36
+ const translate = vue.ref(0);
37
+ const scale = vue.ref(1);
38
+ const active = vue.ref(false);
39
+ const ready = vue.ref(false);
40
+ const inStage = vue.ref(false);
41
+ const animating = vue.ref(false);
42
+ const { isCardType, isVertical } = carouselContext;
43
+ const itemStyle = vue.computed(() => {
44
+ const translateType = `translate${vue.unref(isVertical) ? "Y" : "X"}`;
45
+ const _translate = `${translateType}(${vue.unref(translate)}px)`;
46
+ const _scale = `scale(${vue.unref(scale)})`;
47
+ const transform = [_translate, _scale].join(" ");
48
+ return {
49
+ transform
50
+ };
51
+ });
52
+ function processIndex(index, activeIndex, length) {
53
+ const lastItemIndex = length - 1;
54
+ const prevItemIndex = activeIndex - 1;
55
+ const nextItemIndex = activeIndex + 1;
56
+ const halfItemIndex = length / 2;
57
+ if (activeIndex === 0 && index === lastItemIndex) {
58
+ return -1;
59
+ } else if (activeIndex === lastItemIndex && index === 0) {
60
+ return length;
61
+ } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {
62
+ return length + 1;
63
+ } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {
64
+ return -2;
65
+ }
66
+ return index;
67
+ }
68
+ function calcCardTranslate(index, activeIndex) {
69
+ var _a;
70
+ const parentWidth = ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetWidth) || 0;
71
+ if (inStage.value) {
72
+ return parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1) / 4;
73
+ } else if (index < activeIndex) {
74
+ return -(1 + CARD_SCALE) * parentWidth / 4;
75
+ } else {
76
+ return (3 + CARD_SCALE) * parentWidth / 4;
77
+ }
78
+ }
79
+ function calcTranslate(index, activeIndex, isVertical2) {
80
+ const rootEl = carouselContext.root.value;
81
+ if (!rootEl)
82
+ return 0;
83
+ const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
84
+ return distance * (index - activeIndex);
85
+ }
86
+ const translateItem = (index, activeIndex, oldIndex) => {
87
+ var _a;
88
+ const _isCardType = vue.unref(isCardType);
89
+ const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN;
90
+ const isActive = index === activeIndex;
91
+ if (!_isCardType && !types.isUndefined(oldIndex)) {
92
+ animating.value = isActive || index === oldIndex;
93
+ }
94
+ if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
95
+ index = processIndex(index, activeIndex, carouselItemLength);
96
+ }
97
+ const _isVertical = vue.unref(isVertical);
98
+ active.value = isActive;
99
+ if (_isCardType) {
100
+ if (_isVertical) {
101
+ error.debugWarn("Carousel", "vertical direction is not supported for card mode");
102
+ }
103
+ inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
104
+ translate.value = calcCardTranslate(index, activeIndex);
105
+ scale.value = vue.unref(active) ? 1 : CARD_SCALE;
106
+ } else {
107
+ translate.value = calcTranslate(index, activeIndex, _isVertical);
108
+ }
109
+ ready.value = true;
110
+ };
111
+ function handleItemClick() {
112
+ if (carouselContext && vue.unref(isCardType)) {
113
+ const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
114
+ carouselContext.setActiveItem(index);
115
+ }
116
+ }
117
+ vue.onMounted(() => {
118
+ carouselContext.addItem({
119
+ props,
120
+ states: vue.reactive({
121
+ hover,
122
+ translate,
123
+ scale,
124
+ active,
125
+ ready,
126
+ inStage,
127
+ animating
128
+ }),
129
+ uid: instance.uid,
130
+ translateItem
131
+ });
132
+ });
133
+ vue.onUnmounted(() => {
134
+ carouselContext.removeItem(instance.uid);
135
+ });
136
+ return (_ctx, _cache) => {
137
+ return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
138
+ class: vue.normalizeClass([
139
+ vue.unref(ns).e("item"),
140
+ vue.unref(ns).is("active", active.value),
141
+ vue.unref(ns).is("in-stage", inStage.value),
142
+ vue.unref(ns).is("hover", hover.value),
143
+ vue.unref(ns).is("animating", animating.value),
144
+ { [vue.unref(ns).em("item", "card")]: vue.unref(isCardType) }
145
+ ]),
146
+ style: vue.normalizeStyle(vue.unref(itemStyle)),
147
+ onClick: handleItemClick
148
+ }, [
149
+ vue.unref(isCardType) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
150
+ key: 0,
151
+ class: vue.normalizeClass(vue.unref(ns).e("mask"))
152
+ }, null, 2)), [
153
+ [vue.vShow, !active.value]
154
+ ]) : vue.createCommentVNode("v-if", true),
155
+ vue.renderSlot(_ctx.$slots, "default")
156
+ ], 6)), [
157
+ [vue.vShow, ready.value]
158
+ ]);
159
+ };
13
160
  }
14
161
  });
162
+ var CarouselItem = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/carousel/src/carousel-item.vue"]]);
15
163
 
16
- exports.carouselItemProps = carouselItemProps;
164
+ exports["default"] = CarouselItem;
17
165
  //# sourceMappingURL=carousel-item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"carousel-item.js","sources":["../../../../../../packages/components/carousel/src/carousel-item.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type CarouselItem from './carousel-item.vue'\n\nexport const carouselItemProps = buildProps({\n name: { type: String, default: '' },\n label: {\n type: [String, Number],\n default: '',\n },\n} as const)\n\nexport type CarouselItemProps = ExtractPropTypes<typeof carouselItemProps>\n\nexport type CarouselItemInstance = InstanceType<typeof CarouselItem>\n"],"names":["buildProps"],"mappings":";;;;;;;AACY,MAAC,iBAAiB,GAAGA,gBAAU,CAAC;AAC5C,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;AACrC,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,CAAC;;;;"}
1
+ {"version":3,"file":"carousel-item.js","sources":["../../../../../../packages/components/carousel/src/carousel-item.vue"],"sourcesContent":["<template>\n <div\n v-show=\"ready\"\n :class=\"[\n ns.e('item'),\n ns.is('active', active),\n ns.is('in-stage', inStage),\n ns.is('hover', hover),\n ns.is('animating', animating),\n { [ns.em('item', 'card')]: isCardType },\n ]\"\n :style=\"itemStyle\"\n @click=\"handleItemClick\"\n >\n <div v-if=\"isCardType\" v-show=\"!active\" :class=\"ns.e('mask')\" />\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n getCurrentInstance,\n inject,\n onMounted,\n onUnmounted,\n reactive,\n ref,\n unref,\n} from 'vue'\nimport { debugWarn, isUndefined } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { carouselContextKey } from '@element-plus/tokens'\nimport { carouselItemProps } from './carousel-item'\n\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'ElCarouselItem',\n})\n\nconst props = defineProps(carouselItemProps)\nconst ns = useNamespace('carousel')\nconst COMPONENT_NAME = 'ElCarouselItem'\n// inject\nconst carouselContext = inject(carouselContextKey)!\n// instance\nconst instance = getCurrentInstance()!\nif (!carouselContext) {\n debugWarn(\n COMPONENT_NAME,\n 'usage: <el-carousel></el-carousel-item></el-carousel>'\n )\n}\n\nif (!instance) {\n debugWarn(\n COMPONENT_NAME,\n 'compositional hook can only be invoked inside setups'\n )\n}\n\nconst CARD_SCALE = 0.83\n\nconst hover = ref(false)\nconst translate = ref(0)\nconst scale = ref(1)\nconst active = ref(false)\nconst ready = ref(false)\nconst inStage = ref(false)\nconst animating = ref(false)\n\n// computed\nconst { isCardType, isVertical } = carouselContext\n\nconst itemStyle = computed<CSSProperties>(() => {\n const translateType = `translate${unref(isVertical) ? 'Y' : 'X'}`\n const _translate = `${translateType}(${unref(translate)}px)`\n const _scale = `scale(${unref(scale)})`\n const transform = [_translate, _scale].join(' ')\n\n return {\n transform,\n }\n})\n\n// methods\n\nfunction processIndex(index: number, activeIndex: number, length: number) {\n const lastItemIndex = length - 1\n const prevItemIndex = activeIndex - 1\n const nextItemIndex = activeIndex + 1\n const halfItemIndex = length / 2\n\n if (activeIndex === 0 && index === lastItemIndex) {\n return -1\n } else if (activeIndex === lastItemIndex && index === 0) {\n return length\n } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {\n return length + 1\n } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {\n return -2\n }\n return index\n}\n\nfunction calcCardTranslate(index: number, activeIndex: number) {\n const parentWidth = carouselContext.root.value?.offsetWidth || 0\n if (inStage.value) {\n return (parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1)) / 4\n } else if (index < activeIndex) {\n return (-(1 + CARD_SCALE) * parentWidth) / 4\n } else {\n return ((3 + CARD_SCALE) * parentWidth) / 4\n }\n}\n\nfunction calcTranslate(\n index: number,\n activeIndex: number,\n isVertical: boolean\n) {\n const rootEl = carouselContext.root.value\n if (!rootEl) return 0\n\n const distance = (isVertical ? rootEl.offsetHeight : rootEl.offsetWidth) || 0\n return distance * (index - activeIndex)\n}\n\nconst translateItem = (\n index: number,\n activeIndex: number,\n oldIndex?: number\n) => {\n const _isCardType = unref(isCardType)\n const carouselItemLength = carouselContext.items.value.length ?? Number.NaN\n\n const isActive = index === activeIndex\n if (!_isCardType && !isUndefined(oldIndex)) {\n animating.value = isActive || index === oldIndex\n }\n\n if (!isActive && carouselItemLength > 2 && carouselContext.loop) {\n index = processIndex(index, activeIndex, carouselItemLength)\n }\n\n const _isVertical = unref(isVertical)\n active.value = isActive\n\n if (_isCardType) {\n if (_isVertical) {\n debugWarn('Carousel', 'vertical direction is not supported for card mode')\n }\n inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1\n translate.value = calcCardTranslate(index, activeIndex)\n scale.value = unref(active) ? 1 : CARD_SCALE\n } else {\n translate.value = calcTranslate(index, activeIndex, _isVertical)\n }\n\n ready.value = true\n}\n\nfunction handleItemClick() {\n if (carouselContext && unref(isCardType)) {\n const index = carouselContext.items.value.findIndex(\n ({ uid }) => uid === instance.uid\n )\n carouselContext.setActiveItem(index)\n }\n}\n\n// lifecycle\nonMounted(() => {\n carouselContext.addItem({\n props,\n states: reactive({\n hover,\n translate,\n scale,\n active,\n ready,\n inStage,\n animating,\n }),\n uid: instance.uid,\n translateItem,\n })\n})\n\nonUnmounted(() => {\n carouselContext.removeItem(instance.uid)\n})\n</script>\n"],"names":["useNamespace","inject","carouselContextKey","getCurrentInstance","debugWarn","ref","computed","unref","isUndefined","onMounted","reactive","onUnmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAA,MAAA,EAAA,GAAAA,mBAAA,UAAA,CAAA,CAAA;AACA,IAAA,MAAA,cAAA,GAAA,gBAAA,CAAA;AAEA,IAAA,MAAA,eAAA,GAAAC,WAAAC,2BAAA,CAAA,CAAA;AAEA,IAAA,MAAA,WAAAC,sBAAA,EAAA,CAAA;AACA,IAAA,IAAA,CAAA,eAAA,EAAA;AACA,MAAAC,eAAA,CACA,gBACA,uDACA,CAAA,CAAA;AAAA,KACA;AAEA,IAAA,IAAA,CAAA,QAAA,EAAA;AACA,MAAAA,eAAA,CACA,gBACA,sDACA,CAAA,CAAA;AAAA,KACA;AAEA,IAAA,MAAA,UAAA,GAAA,IAAA,CAAA;AAEA,IAAA,MAAA,KAAA,GAAAC,QAAA,KAAA,CAAA,CAAA;AACA,IAAA,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