element-plus 2.3.4 → 2.3.5
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.
- package/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/dist/index.full.js +111 -38
- package/dist/index.full.min.js +15 -15
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +15 -15
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +111 -38
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/ckb.js +1 -1
- package/dist/locale/ckb.min.js +1 -1
- package/dist/locale/ckb.min.mjs +1 -1
- package/dist/locale/ckb.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +21 -21
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.js.map +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.min.mjs.map +1 -1
- package/dist/locale/fa.mjs +21 -21
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/carousel/index.d.ts +10 -0
- package/es/components/carousel/src/carousel-item.vue.d.ts +1 -0
- package/es/components/carousel/src/carousel-item2.mjs +7 -1
- package/es/components/carousel/src/carousel-item2.mjs.map +1 -1
- package/es/components/carousel/src/carousel.vue.d.ts +8 -0
- package/es/components/carousel/src/carousel2.mjs +7 -2
- package/es/components/carousel/src/carousel2.mjs.map +1 -1
- package/es/components/carousel/src/constants.d.ts +1 -0
- package/es/components/carousel/src/constants.mjs.map +1 -1
- package/es/components/carousel/src/use-carousel-item.d.ts +1 -0
- package/es/components/carousel/src/use-carousel-item.mjs +7 -5
- package/es/components/carousel/src/use-carousel-item.mjs.map +1 -1
- package/es/components/carousel/src/use-carousel.d.ts +8 -0
- package/es/components/carousel/src/use-carousel.mjs +21 -1
- package/es/components/carousel/src/use-carousel.mjs.map +1 -1
- package/es/components/cascader/index.d.ts +16 -16
- package/es/components/cascader/src/cascader.vue.d.ts +8 -8
- package/es/components/check-tag/index.d.ts +1 -0
- package/es/components/check-tag/src/check-tag.mjs.map +1 -1
- package/es/components/check-tag/src/check-tag.vue.d.ts +1 -0
- package/es/components/check-tag/src/check-tag2.mjs +3 -2
- package/es/components/check-tag/src/check-tag2.mjs.map +1 -1
- package/es/components/empty/src/empty.mjs.map +1 -1
- package/es/components/image/src/image2.mjs +1 -1
- package/es/components/image/src/image2.mjs.map +1 -1
- package/es/components/input-number/src/input-number2.mjs +4 -1
- package/es/components/input-number/src/input-number2.mjs.map +1 -1
- package/es/components/loading/src/service.mjs +2 -2
- package/es/components/loading/src/service.mjs.map +1 -1
- package/es/components/menu/src/menu.mjs +1 -1
- package/es/components/menu/src/menu.mjs.map +1 -1
- package/es/components/page-header/src/page-header.mjs.map +1 -1
- package/es/components/progress/src/progress.mjs.map +1 -1
- package/es/components/result/src/result.mjs.map +1 -1
- package/es/components/select/src/useSelect.mjs +4 -0
- package/es/components/select/src/useSelect.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton-item.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton.mjs.map +1 -1
- package/es/components/steps/index.d.ts +2 -0
- package/es/components/steps/src/item.vue.d.ts +1 -0
- package/es/components/steps/src/item2.mjs +9 -6
- package/es/components/steps/src/item2.mjs.map +1 -1
- package/es/components/table/src/table-header/event-helper.mjs +6 -2
- package/es/components/table/src/table-header/event-helper.mjs.map +1 -1
- package/es/components/table-v2/src/renderers/cell.mjs +1 -1
- package/es/components/table-v2/src/renderers/cell.mjs.map +1 -1
- package/es/components/tag/index.d.ts +8 -8
- package/es/components/tag/src/tag.d.ts +2 -2
- package/es/components/tag/src/tag.mjs +2 -2
- package/es/components/tag/src/tag.mjs.map +1 -1
- package/es/components/tag/src/tag.vue.d.ts +8 -8
- package/es/components/tag/src/tag2.mjs +3 -3
- package/es/components/tag/src/tag2.mjs.map +1 -1
- package/es/components/time-select/src/time-select.mjs.map +1 -1
- package/es/components/time-select/src/time-select2.mjs.map +1 -1
- package/es/components/timeline/index.d.ts +38 -0
- package/es/components/timeline/src/timeline-item.mjs.map +1 -1
- package/es/components/timeline/src/timeline-item.vue.d.ts +19 -0
- package/es/components/timeline/src/timeline-item2.mjs +9 -7
- package/es/components/timeline/src/timeline-item2.mjs.map +1 -1
- package/es/components/tree/index.d.ts +2 -2
- package/es/components/tree/src/model/useDragNode.mjs +2 -2
- package/es/components/tree/src/model/useDragNode.mjs.map +1 -1
- package/es/components/tree/src/tree.type.d.ts +1 -1
- package/es/components/tree/src/tree.vue.d.ts +1 -1
- package/es/components/tree-select/src/tree-select.mjs.map +1 -1
- package/es/components/tree-select/src/tree.mjs +20 -3
- package/es/components/tree-select/src/tree.mjs.map +1 -1
- package/es/components/upload/src/upload-content2.mjs +5 -1
- package/es/components/upload/src/upload-content2.mjs.map +1 -1
- package/es/locale/lang/fa.mjs +20 -20
- package/es/locale/lang/fa.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/carousel/index.d.ts +10 -0
- package/lib/components/carousel/src/carousel-item.vue.d.ts +1 -0
- package/lib/components/carousel/src/carousel-item2.js +7 -1
- package/lib/components/carousel/src/carousel-item2.js.map +1 -1
- package/lib/components/carousel/src/carousel.vue.d.ts +8 -0
- package/lib/components/carousel/src/carousel2.js +7 -2
- package/lib/components/carousel/src/carousel2.js.map +1 -1
- package/lib/components/carousel/src/constants.d.ts +1 -0
- package/lib/components/carousel/src/constants.js.map +1 -1
- package/lib/components/carousel/src/use-carousel-item.d.ts +1 -0
- package/lib/components/carousel/src/use-carousel-item.js +7 -5
- package/lib/components/carousel/src/use-carousel-item.js.map +1 -1
- package/lib/components/carousel/src/use-carousel.d.ts +8 -0
- package/lib/components/carousel/src/use-carousel.js +21 -1
- package/lib/components/carousel/src/use-carousel.js.map +1 -1
- package/lib/components/cascader/index.d.ts +16 -16
- package/lib/components/cascader/src/cascader.vue.d.ts +8 -8
- package/lib/components/check-tag/index.d.ts +1 -0
- package/lib/components/check-tag/src/check-tag.js.map +1 -1
- package/lib/components/check-tag/src/check-tag.vue.d.ts +1 -0
- package/lib/components/check-tag/src/check-tag2.js +2 -1
- package/lib/components/check-tag/src/check-tag2.js.map +1 -1
- package/lib/components/empty/src/empty.js.map +1 -1
- package/lib/components/image/src/image2.js +1 -1
- package/lib/components/image/src/image2.js.map +1 -1
- package/lib/components/input-number/src/input-number2.js +3 -0
- package/lib/components/input-number/src/input-number2.js.map +1 -1
- package/lib/components/loading/src/service.js +2 -2
- package/lib/components/loading/src/service.js.map +1 -1
- package/lib/components/menu/src/menu.js +1 -1
- package/lib/components/menu/src/menu.js.map +1 -1
- package/lib/components/page-header/src/page-header.js.map +1 -1
- package/lib/components/progress/src/progress.js.map +1 -1
- package/lib/components/result/src/result.js.map +1 -1
- package/lib/components/select/src/useSelect.js +4 -0
- package/lib/components/select/src/useSelect.js.map +1 -1
- package/lib/components/skeleton/src/skeleton-item.js.map +1 -1
- package/lib/components/skeleton/src/skeleton.js.map +1 -1
- package/lib/components/steps/index.d.ts +2 -0
- package/lib/components/steps/src/item.vue.d.ts +1 -0
- package/lib/components/steps/src/item2.js +9 -6
- package/lib/components/steps/src/item2.js.map +1 -1
- package/lib/components/table/src/table-header/event-helper.js +6 -2
- package/lib/components/table/src/table-header/event-helper.js.map +1 -1
- package/lib/components/table-v2/src/renderers/cell.js +1 -1
- package/lib/components/table-v2/src/renderers/cell.js.map +1 -1
- package/lib/components/tag/index.d.ts +8 -8
- package/lib/components/tag/src/tag.d.ts +2 -2
- package/lib/components/tag/src/tag.js +2 -2
- package/lib/components/tag/src/tag.js.map +1 -1
- package/lib/components/tag/src/tag.vue.d.ts +8 -8
- package/lib/components/tag/src/tag2.js +3 -3
- package/lib/components/tag/src/tag2.js.map +1 -1
- package/lib/components/time-select/src/time-select.js.map +1 -1
- package/lib/components/time-select/src/time-select2.js.map +1 -1
- package/lib/components/timeline/index.d.ts +38 -0
- package/lib/components/timeline/src/timeline-item.js.map +1 -1
- package/lib/components/timeline/src/timeline-item.vue.d.ts +19 -0
- package/lib/components/timeline/src/timeline-item2.js +8 -6
- package/lib/components/timeline/src/timeline-item2.js.map +1 -1
- package/lib/components/tree/index.d.ts +2 -2
- package/lib/components/tree/src/model/useDragNode.js +2 -2
- package/lib/components/tree/src/model/useDragNode.js.map +1 -1
- package/lib/components/tree/src/tree.type.d.ts +1 -1
- package/lib/components/tree/src/tree.vue.d.ts +1 -1
- package/lib/components/tree-select/src/tree-select.js.map +1 -1
- package/lib/components/tree-select/src/tree.js +20 -3
- package/lib/components/tree-select/src/tree.js.map +1 -1
- package/lib/components/upload/src/upload-content2.js +4 -0
- package/lib/components/upload/src/upload-content2.js.map +1 -1
- package/lib/locale/lang/fa.js +20 -20
- package/lib/locale/lang/fa.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/tags.json +1 -1
- package/theme-chalk/el-carousel-item.css +1 -1
- package/theme-chalk/el-carousel.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/carousel-item.scss +8 -0
- package/theme-chalk/src/carousel.scss +9 -2
- package/theme-chalk/src/image.scss +6 -6
- package/theme-chalk/src/progress.scss +10 -1
- package/theme-chalk/src/text.scss +1 -1
- package/web-types.json +1 -1
|
@@ -20,6 +20,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
20
20
|
const props = __props;
|
|
21
21
|
const ns = index.useNamespace("carousel");
|
|
22
22
|
const {
|
|
23
|
+
carouselItemRef,
|
|
23
24
|
active,
|
|
24
25
|
animating,
|
|
25
26
|
hover,
|
|
@@ -42,13 +43,18 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
42
43
|
});
|
|
43
44
|
return (_ctx, _cache) => {
|
|
44
45
|
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
46
|
+
ref_key: "carouselItemRef",
|
|
47
|
+
ref: carouselItemRef,
|
|
45
48
|
class: vue.normalizeClass([
|
|
46
49
|
vue.unref(ns).e("item"),
|
|
47
50
|
vue.unref(ns).is("active", vue.unref(active)),
|
|
48
51
|
vue.unref(ns).is("in-stage", vue.unref(inStage)),
|
|
49
52
|
vue.unref(ns).is("hover", vue.unref(hover)),
|
|
50
53
|
vue.unref(ns).is("animating", vue.unref(animating)),
|
|
51
|
-
{
|
|
54
|
+
{
|
|
55
|
+
[vue.unref(ns).em("item", "card")]: vue.unref(isCardType),
|
|
56
|
+
[vue.unref(ns).em("item", "card-vertical")]: vue.unref(isCardType) && vue.unref(isVertical)
|
|
57
|
+
}
|
|
52
58
|
]),
|
|
53
59
|
style: vue.normalizeStyle(vue.unref(itemStyle)),
|
|
54
60
|
onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleItemClick) && vue.unref(handleItemClick)(...args))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel-item2.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 { computed, unref } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { carouselItemProps } from './carousel-item'\nimport { useCarouselItem } from './use-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 {\n active,\n animating,\n hover,\n inStage,\n isVertical,\n translate,\n isCardType,\n scale,\n ready,\n handleItemClick,\n} = useCarouselItem(props, COMPONENT_NAME)\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</script>\n"],"names":["useNamespace","useCarouselItem","computed","unref"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"carousel-item2.js","sources":["../../../../../../packages/components/carousel/src/carousel-item.vue"],"sourcesContent":["<template>\n <div\n v-show=\"ready\"\n ref=\"carouselItemRef\"\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 {\n [ns.em('item', 'card')]: isCardType,\n [ns.em('item', 'card-vertical')]: isCardType && isVertical,\n },\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 { computed, unref } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { carouselItemProps } from './carousel-item'\nimport { useCarouselItem } from './use-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 {\n carouselItemRef,\n active,\n animating,\n hover,\n inStage,\n isVertical,\n translate,\n isCardType,\n scale,\n ready,\n handleItemClick,\n} = useCarouselItem(props, COMPONENT_NAME)\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</script>\n"],"names":["useNamespace","useCarouselItem","computed","unref"],"mappings":";;;;;;;;;;;;uCA+Bc,CAAA;AAAA,EACZ,IAAM,EAAA,gBAAA;AACR;;;;;;AAGA,IAAM,MAAA,EAAA,GAAKA,mBAAa,UAAU,CAAA,CAAA;AAGlC,IAAM,MAAA;AAAA,MACJ,eAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,KAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,SAAA;AAAA,MACA,UAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA,eAAA;AAAA,KACE,GAAAC,+BAAA,CAAgB,OAAO,cAAc,CAAA,CAAA;AAEzC,IAAM,MAAA,SAAA,GAAYC,aAAwB,MAAM;AAC9C,MAAA,MAAM,aAAgB,GAAA,CAAA,SAAA,EAAYC,SAAM,CAAA,UAAU,IAAI,GAAM,GAAA,GAAA,CAAA,CAAA,CAAA;AAC5D,MAAA,MAAM,UAAa,GAAA,CAAA,EAAG,aAAiB,CAAA,CAAA,EAAAA,SAAA,CAAM,SAAS,CAAA,CAAA,GAAA,CAAA,CAAA;AACtD,MAAM,MAAA,MAAA,GAAS,CAAS,MAAA,EAAAA,SAAA,CAAM,KAAK,CAAA,CAAA,CAAA,CAAA,CAAA;AACnC,MAAA,MAAM,YAAY,CAAC,UAAA,EAAY,MAAM,CAAA,CAAE,KAAK,GAAG,CAAA,CAAA;AAE/C,MAAO,OAAA;AAAA,QACL,SAAA;AAAA,OACF,CAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -35,6 +35,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
35
35
|
hover: import("vue").Ref<boolean>;
|
|
36
36
|
isCardType: import("vue").ComputedRef<boolean>;
|
|
37
37
|
items: import("vue").ShallowRef<import("./constants").CarouselItemContext[]>;
|
|
38
|
+
isVertical: import("vue").ComputedRef<boolean>;
|
|
39
|
+
containerStyle: import("vue").ComputedRef<{
|
|
40
|
+
height: string;
|
|
41
|
+
overflow?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
height: string;
|
|
44
|
+
overflow: string;
|
|
45
|
+
}>;
|
|
38
46
|
handleButtonEnter: (arrow: "right" | "left") => void;
|
|
39
47
|
handleButtonLeave: () => void;
|
|
40
48
|
handleIndicatorClick: (index: number) => void;
|
|
@@ -31,6 +31,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
31
31
|
hover,
|
|
32
32
|
isCardType,
|
|
33
33
|
items,
|
|
34
|
+
isVertical,
|
|
35
|
+
containerStyle,
|
|
34
36
|
handleButtonEnter,
|
|
35
37
|
handleButtonLeave,
|
|
36
38
|
handleIndicatorClick,
|
|
@@ -55,9 +57,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
55
57
|
if (vue.unref(hasLabel)) {
|
|
56
58
|
classes.push(ns.em("indicators", "labels"));
|
|
57
59
|
}
|
|
58
|
-
if (props.indicatorPosition === "outside"
|
|
60
|
+
if (props.indicatorPosition === "outside") {
|
|
59
61
|
classes.push(ns.em("indicators", "outside"));
|
|
60
62
|
}
|
|
63
|
+
if (vue.unref(isVertical)) {
|
|
64
|
+
classes.push(ns.em("indicators", "right"));
|
|
65
|
+
}
|
|
61
66
|
return classes;
|
|
62
67
|
});
|
|
63
68
|
expose({
|
|
@@ -75,7 +80,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
75
80
|
}, [
|
|
76
81
|
vue.createElementVNode("div", {
|
|
77
82
|
class: vue.normalizeClass(vue.unref(ns).e("container")),
|
|
78
|
-
style: vue.normalizeStyle(
|
|
83
|
+
style: vue.normalizeStyle(vue.unref(containerStyle))
|
|
79
84
|
}, [
|
|
80
85
|
vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
|
|
81
86
|
key: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel2.js","sources":["../../../../../../packages/components/carousel/src/carousel.vue"],"sourcesContent":["<template>\n <div\n ref=\"root\"\n :class=\"carouselClasses\"\n @mouseenter.stop=\"handleMouseEnter\"\n @mouseleave.stop=\"handleMouseLeave\"\n >\n <div :class=\"ns.e('container')\" :style=\"
|
|
1
|
+
{"version":3,"file":"carousel2.js","sources":["../../../../../../packages/components/carousel/src/carousel.vue"],"sourcesContent":["<template>\n <div\n ref=\"root\"\n :class=\"carouselClasses\"\n @mouseenter.stop=\"handleMouseEnter\"\n @mouseleave.stop=\"handleMouseLeave\"\n >\n <div :class=\"ns.e('container')\" :style=\"containerStyle\">\n <transition v-if=\"arrowDisplay\" name=\"carousel-arrow-left\">\n <button\n v-show=\"\n (arrow === 'always' || hover) && (props.loop || activeIndex > 0)\n \"\n type=\"button\"\n :class=\"[ns.e('arrow'), ns.em('arrow', 'left')]\"\n @mouseenter=\"handleButtonEnter('left')\"\n @mouseleave=\"handleButtonLeave\"\n @click.stop=\"throttledArrowClick(activeIndex - 1)\"\n >\n <ElIcon>\n <ArrowLeft />\n </ElIcon>\n </button>\n </transition>\n <transition v-if=\"arrowDisplay\" name=\"carousel-arrow-right\">\n <button\n v-show=\"\n (arrow === 'always' || hover) &&\n (props.loop || activeIndex < items.length - 1)\n \"\n type=\"button\"\n :class=\"[ns.e('arrow'), ns.em('arrow', 'right')]\"\n @mouseenter=\"handleButtonEnter('right')\"\n @mouseleave=\"handleButtonLeave\"\n @click.stop=\"throttledArrowClick(activeIndex + 1)\"\n >\n <ElIcon>\n <ArrowRight />\n </ElIcon>\n </button>\n </transition>\n <slot />\n </div>\n <ul v-if=\"indicatorPosition !== 'none'\" :class=\"indicatorsClasses\">\n <li\n v-for=\"(item, index) in items\"\n :key=\"index\"\n :class=\"[\n ns.e('indicator'),\n ns.em('indicator', direction),\n ns.is('active', index === activeIndex),\n ]\"\n @mouseenter=\"throttledIndicatorHover(index)\"\n @click.stop=\"handleIndicatorClick(index)\"\n >\n <button :class=\"ns.e('button')\">\n <span v-if=\"hasLabel\">{{ item.props.label }}</span>\n </button>\n </li>\n </ul>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, unref } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { ArrowLeft, ArrowRight } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { carouselEmits, carouselProps } from './carousel'\nimport { useCarousel } from './use-carousel'\n\nconst COMPONENT_NAME = 'ElCarousel'\ndefineOptions({\n name: COMPONENT_NAME,\n})\n\nconst props = defineProps(carouselProps)\nconst emit = defineEmits(carouselEmits)\nconst {\n root,\n activeIndex,\n arrowDisplay,\n hasLabel,\n hover,\n isCardType,\n items,\n isVertical,\n containerStyle,\n handleButtonEnter,\n handleButtonLeave,\n handleIndicatorClick,\n handleMouseEnter,\n handleMouseLeave,\n setActiveItem,\n prev,\n next,\n throttledArrowClick,\n throttledIndicatorHover,\n} = useCarousel(props, emit, COMPONENT_NAME)\nconst ns = useNamespace('carousel')\n\nconst carouselClasses = computed(() => {\n const classes = [ns.b(), ns.m(props.direction)]\n if (unref(isCardType)) {\n classes.push(ns.m('card'))\n }\n return classes\n})\n\nconst indicatorsClasses = computed(() => {\n const classes = [ns.e('indicators'), ns.em('indicators', props.direction)]\n if (unref(hasLabel)) {\n classes.push(ns.em('indicators', 'labels'))\n }\n if (props.indicatorPosition === 'outside') {\n classes.push(ns.em('indicators', 'outside'))\n }\n if (unref(isVertical)) {\n classes.push(ns.em('indicators', 'right'))\n }\n return classes\n})\n\ndefineExpose({\n /** @description manually switch slide */\n setActiveItem,\n /** @description switch to the previous slide */\n prev,\n /** @description switch to the next slide */\n next,\n})\n</script>\n"],"names":["useCarousel","useNamespace","computed","unref"],"mappings":";;;;;;;;;;;;;;;;uCAwEc,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR;;;;;;;AAIA,IAAM,MAAA;AAAA,MACJ,IAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,MACA,QAAA;AAAA,MACA,KAAA;AAAA,MACA,UAAA;AAAA,MACA,KAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,iBAAA;AAAA,MACA,iBAAA;AAAA,MACA,oBAAA;AAAA,MACA,gBAAA;AAAA,MACA,gBAAA;AAAA,MACA,aAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA;AAAA,MACA,mBAAA;AAAA,MACA,uBAAA;AAAA,KACE,GAAAA,uBAAA,CAAY,KAAO,EAAA,IAAA,EAAM,cAAc,CAAA,CAAA;AAC3C,IAAM,MAAA,EAAA,GAAKC,mBAAa,UAAU,CAAA,CAAA;AAElC,IAAM,MAAA,eAAA,GAAkBC,aAAS,MAAM;AACrC,MAAM,MAAA,OAAA,GAAU,CAAC,EAAG,CAAA,CAAA,IAAK,EAAG,CAAA,CAAA,CAAE,KAAM,CAAA,SAAS,CAAC,CAAA,CAAA;AAC9C,MAAI,IAAAC,SAAA,CAAM,UAAU,CAAG,EAAA;AACrB,QAAA,OAAA,CAAQ,IAAK,CAAA,EAAA,CAAG,CAAE,CAAA,MAAM,CAAC,CAAA,CAAA;AAAA,OAC3B;AACA,MAAO,OAAA,OAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAED,IAAM,MAAA,iBAAA,GAAoBD,aAAS,MAAM;AACvC,MAAM,MAAA,OAAA,GAAU,CAAC,EAAA,CAAG,CAAE,CAAA,YAAY,CAAG,EAAA,EAAA,CAAG,EAAG,CAAA,YAAA,EAAc,KAAM,CAAA,SAAS,CAAC,CAAA,CAAA;AACzE,MAAI,IAAAC,SAAA,CAAM,QAAQ,CAAG,EAAA;AACnB,QAAA,OAAA,CAAQ,IAAK,CAAA,EAAA,CAAG,EAAG,CAAA,YAAA,EAAc,QAAQ,CAAC,CAAA,CAAA;AAAA,OAC5C;AACA,MAAI,IAAA,KAAA,CAAM,sBAAsB,SAAW,EAAA;AACzC,QAAA,OAAA,CAAQ,IAAK,CAAA,EAAA,CAAG,EAAG,CAAA,YAAA,EAAc,SAAS,CAAC,CAAA,CAAA;AAAA,OAC7C;AACA,MAAI,IAAAA,SAAA,CAAM,UAAU,CAAG,EAAA;AACrB,QAAA,OAAA,CAAQ,IAAK,CAAA,EAAA,CAAG,EAAG,CAAA,YAAA,EAAc,OAAO,CAAC,CAAA,CAAA;AAAA,OAC3C;AACA,MAAO,OAAA,OAAA,CAAA;AAAA,KACR,CAAA,CAAA;AAED,IAAa,MAAA,CAAA;AAAA,MAEX,aAAA;AAAA,MAEA,IAAA;AAAA,MAEA,IAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -24,5 +24,6 @@ export declare type CarouselContext = {
|
|
|
24
24
|
addItem: (item: CarouselItemContext) => void;
|
|
25
25
|
removeItem: (uid: number) => void;
|
|
26
26
|
setActiveItem: (index: number) => void;
|
|
27
|
+
setContainerHeight: (height: number) => void;
|
|
27
28
|
};
|
|
28
29
|
export declare const carouselContextKey: InjectionKey<CarouselContext>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../../../packages/components/carousel/src/constants.ts"],"sourcesContent":["import type { InjectionKey, Ref } from 'vue'\n\nimport type { CarouselItemProps } from './carousel-item'\n\nexport type CarouselItemStates = {\n hover: boolean\n translate: number\n scale: number\n active: boolean\n ready: boolean\n inStage: boolean\n animating: boolean\n}\n\nexport type CarouselItemContext = {\n props: CarouselItemProps\n states: CarouselItemStates\n uid: number\n translateItem: (index: number, activeIndex: number, oldIndex?: number) => void\n}\n\nexport type CarouselContext = {\n root: Ref<HTMLElement | undefined>\n items: Ref<CarouselItemContext[]>\n isCardType: Ref<boolean>\n isVertical: Ref<boolean>\n loop: boolean\n addItem: (item: CarouselItemContext) => void\n removeItem: (uid: number) => void\n setActiveItem: (index: number) => void\n}\n\nexport const carouselContextKey: InjectionKey<CarouselContext> =\n Symbol('carouselContextKey')\n"],"names":[],"mappings":";;;;AAAY,MAAC,kBAAkB,GAAG,MAAM,CAAC,oBAAoB;;;;"}
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../../packages/components/carousel/src/constants.ts"],"sourcesContent":["import type { InjectionKey, Ref } from 'vue'\n\nimport type { CarouselItemProps } from './carousel-item'\n\nexport type CarouselItemStates = {\n hover: boolean\n translate: number\n scale: number\n active: boolean\n ready: boolean\n inStage: boolean\n animating: boolean\n}\n\nexport type CarouselItemContext = {\n props: CarouselItemProps\n states: CarouselItemStates\n uid: number\n translateItem: (index: number, activeIndex: number, oldIndex?: number) => void\n}\n\nexport type CarouselContext = {\n root: Ref<HTMLElement | undefined>\n items: Ref<CarouselItemContext[]>\n isCardType: Ref<boolean>\n isVertical: Ref<boolean>\n loop: boolean\n addItem: (item: CarouselItemContext) => void\n removeItem: (uid: number) => void\n setActiveItem: (index: number) => void\n setContainerHeight: (height: number) => void\n}\n\nexport const carouselContextKey: InjectionKey<CarouselContext> =\n Symbol('carouselContextKey')\n"],"names":[],"mappings":";;;;AAAY,MAAC,kBAAkB,GAAG,MAAM,CAAC,oBAAoB;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CarouselItemProps } from './carousel-item';
|
|
2
2
|
export declare const useCarouselItem: (props: CarouselItemProps, componentName: string) => {
|
|
3
|
+
carouselItemRef: import("vue").Ref<HTMLElement | undefined>;
|
|
3
4
|
active: import("vue").Ref<boolean>;
|
|
4
5
|
animating: import("vue").Ref<boolean>;
|
|
5
6
|
hover: import("vue").Ref<boolean>;
|
|
@@ -18,6 +18,7 @@ const useCarouselItem = (props, componentName) => {
|
|
|
18
18
|
error.debugWarn(componentName, "compositional hook can only be invoked inside setups");
|
|
19
19
|
}
|
|
20
20
|
const CARD_SCALE = 0.83;
|
|
21
|
+
const carouselItemRef = vue.ref();
|
|
21
22
|
const hover = vue.ref(false);
|
|
22
23
|
const translate = vue.ref(0);
|
|
23
24
|
const scale = vue.ref(1);
|
|
@@ -43,8 +44,8 @@ const useCarouselItem = (props, componentName) => {
|
|
|
43
44
|
return index;
|
|
44
45
|
}
|
|
45
46
|
function calcCardTranslate(index, activeIndex) {
|
|
46
|
-
var _a;
|
|
47
|
-
const parentWidth = ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetWidth) || 0;
|
|
47
|
+
var _a, _b;
|
|
48
|
+
const parentWidth = vue.unref(isVertical) ? ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetHeight) || 0 : ((_b = carouselContext.root.value) == null ? void 0 : _b.offsetWidth) || 0;
|
|
48
49
|
if (inStage.value) {
|
|
49
50
|
return parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1) / 4;
|
|
50
51
|
} else if (index < activeIndex) {
|
|
@@ -74,9 +75,6 @@ const useCarouselItem = (props, componentName) => {
|
|
|
74
75
|
const _isVertical = vue.unref(isVertical);
|
|
75
76
|
active.value = isActive;
|
|
76
77
|
if (_isCardType) {
|
|
77
|
-
if (_isVertical) {
|
|
78
|
-
error.debugWarn("Carousel", "vertical direction is not supported for card mode");
|
|
79
|
-
}
|
|
80
78
|
inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
|
|
81
79
|
translate.value = calcCardTranslate(index, activeIndex);
|
|
82
80
|
scale.value = vue.unref(active) ? 1 : CARD_SCALE;
|
|
@@ -84,6 +82,9 @@ const useCarouselItem = (props, componentName) => {
|
|
|
84
82
|
translate.value = calcTranslate(index, activeIndex, _isVertical);
|
|
85
83
|
}
|
|
86
84
|
ready.value = true;
|
|
85
|
+
if (isActive && carouselItemRef.value) {
|
|
86
|
+
carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight);
|
|
87
|
+
}
|
|
87
88
|
};
|
|
88
89
|
function handleItemClick() {
|
|
89
90
|
if (carouselContext && vue.unref(isCardType)) {
|
|
@@ -111,6 +112,7 @@ const useCarouselItem = (props, componentName) => {
|
|
|
111
112
|
carouselContext.removeItem(instance.uid);
|
|
112
113
|
});
|
|
113
114
|
return {
|
|
115
|
+
carouselItemRef,
|
|
114
116
|
active,
|
|
115
117
|
animating,
|
|
116
118
|
hover,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-carousel-item.js","sources":["../../../../../../packages/components/carousel/src/use-carousel-item.ts"],"sourcesContent":["import {\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 { carouselContextKey } from './constants'\n\nimport type { CarouselItemProps } from './carousel-item'\n\nexport const useCarouselItem = (\n props: CarouselItemProps,\n componentName: string\n) => {\n const carouselContext = inject(carouselContextKey)!\n // instance\n const instance = getCurrentInstance()!\n if (!carouselContext) {\n debugWarn(\n componentName,\n 'usage: <el-carousel></el-carousel-item></el-carousel>'\n )\n }\n\n if (!instance) {\n debugWarn(\n componentName,\n 'compositional hook can only be invoked inside setups'\n )\n }\n\n const CARD_SCALE = 0.83\n\n const hover = ref(false)\n const translate = ref(0)\n const scale = ref(1)\n const active = ref(false)\n const ready = ref(false)\n const inStage = ref(false)\n const animating = ref(false)\n\n // computed\n const { isCardType, isVertical } = carouselContext\n\n // methods\n\n function 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\n function 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\n function 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 =\n (isVertical ? rootEl.offsetHeight : rootEl.offsetWidth) || 0\n return distance * (index - activeIndex)\n }\n\n const 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
|
|
1
|
+
{"version":3,"file":"use-carousel-item.js","sources":["../../../../../../packages/components/carousel/src/use-carousel-item.ts"],"sourcesContent":["import {\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 { carouselContextKey } from './constants'\n\nimport type { CarouselItemProps } from './carousel-item'\n\nexport const useCarouselItem = (\n props: CarouselItemProps,\n componentName: string\n) => {\n const carouselContext = inject(carouselContextKey)!\n // instance\n const instance = getCurrentInstance()!\n if (!carouselContext) {\n debugWarn(\n componentName,\n 'usage: <el-carousel></el-carousel-item></el-carousel>'\n )\n }\n\n if (!instance) {\n debugWarn(\n componentName,\n 'compositional hook can only be invoked inside setups'\n )\n }\n\n const CARD_SCALE = 0.83\n\n const carouselItemRef = ref<HTMLElement>()\n const hover = ref(false)\n const translate = ref(0)\n const scale = ref(1)\n const active = ref(false)\n const ready = ref(false)\n const inStage = ref(false)\n const animating = ref(false)\n\n // computed\n const { isCardType, isVertical } = carouselContext\n\n // methods\n\n function 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\n function calcCardTranslate(index: number, activeIndex: number) {\n const parentWidth = unref(isVertical)\n ? carouselContext.root.value?.offsetHeight || 0\n : carouselContext.root.value?.offsetWidth || 0\n\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\n function 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 =\n (isVertical ? rootEl.offsetHeight : rootEl.offsetWidth) || 0\n return distance * (index - activeIndex)\n }\n\n const 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 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 if (isActive && carouselItemRef.value) {\n carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight)\n }\n }\n\n function 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\n onMounted(() => {\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\n onUnmounted(() => {\n carouselContext.removeItem(instance.uid)\n })\n\n return {\n carouselItemRef,\n active,\n animating,\n hover,\n inStage,\n isVertical,\n translate,\n isCardType,\n scale,\n ready,\n handleItemClick,\n }\n}\n"],"names":["inject","carouselContextKey","getCurrentInstance","debugWarn","ref","unref","isUndefined","onMounted","reactive","onUnmounted"],"mappings":";;;;;;;;;;AAWY,MAAC,eAAe,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK;AACzD,EAAE,MAAM,eAAe,GAAGA,UAAM,CAACC,4BAAkB,CAAC,CAAC;AACrD,EAAE,MAAM,QAAQ,GAAGC,sBAAkB,EAAE,CAAC;AACxC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nB,KAAK,CAAC,CAAC;AACP,GAAG,CAAC,CAAC;AACL,EAAEC,eAAW,CAAC,MAAM;AACpB,IAAI,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC7C,GAAG,CAAC,CAAC;AACL,EAAE,OAAO;AACT,IAAI,eAAe;AACnB,IAAI,MAAM;AACV,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,OAAO;AACX,IAAI,UAAU;AACd,IAAI,SAAS;AACb,IAAI,UAAU;AACd,IAAI,KAAK;AACT,IAAI,KAAK;AACT,IAAI,eAAe;AACnB,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -9,6 +9,14 @@ export declare const useCarousel: (props: CarouselProps, emit: SetupContext<Caro
|
|
|
9
9
|
hover: import("vue").Ref<boolean>;
|
|
10
10
|
isCardType: import("vue").ComputedRef<boolean>;
|
|
11
11
|
items: import("vue").ShallowRef<CarouselItemContext[]>;
|
|
12
|
+
isVertical: import("vue").ComputedRef<boolean>;
|
|
13
|
+
containerStyle: import("vue").ComputedRef<{
|
|
14
|
+
height: string;
|
|
15
|
+
overflow?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
height: string;
|
|
18
|
+
overflow: string;
|
|
19
|
+
}>;
|
|
12
20
|
handleButtonEnter: (arrow: 'left' | 'right') => void;
|
|
13
21
|
handleButtonLeave: () => void;
|
|
14
22
|
handleIndicatorClick: (index: number) => void;
|
|
@@ -23,12 +23,24 @@ const useCarousel = (props, emit, componentName) => {
|
|
|
23
23
|
const timer = vue.ref(null);
|
|
24
24
|
const hover = vue.ref(false);
|
|
25
25
|
const root = vue.ref();
|
|
26
|
+
const containerHeight = vue.ref(0);
|
|
26
27
|
const arrowDisplay = vue.computed(() => props.arrow !== "never" && !vue.unref(isVertical));
|
|
27
28
|
const hasLabel = vue.computed(() => {
|
|
28
29
|
return items.value.some((item) => item.props.label.toString().length > 0);
|
|
29
30
|
});
|
|
30
31
|
const isCardType = vue.computed(() => props.type === "card");
|
|
31
32
|
const isVertical = vue.computed(() => props.direction === "vertical");
|
|
33
|
+
const containerStyle = vue.computed(() => {
|
|
34
|
+
if (props.height !== "auto") {
|
|
35
|
+
return {
|
|
36
|
+
height: props.height
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
height: `${containerHeight.value}px`,
|
|
41
|
+
overflow: "hidden"
|
|
42
|
+
};
|
|
43
|
+
});
|
|
32
44
|
const throttledArrowClick = lodashUnified.throttle((index) => {
|
|
33
45
|
setActiveItem(index);
|
|
34
46
|
}, THROTTLE_TIME, { trailing: true });
|
|
@@ -148,6 +160,11 @@ const useCarousel = (props, emit, componentName) => {
|
|
|
148
160
|
pauseTimer();
|
|
149
161
|
startTimer();
|
|
150
162
|
}
|
|
163
|
+
function setContainerHeight(height) {
|
|
164
|
+
if (props.height !== "auto")
|
|
165
|
+
return;
|
|
166
|
+
containerHeight.value = height;
|
|
167
|
+
}
|
|
151
168
|
vue.watch(() => activeIndex.value, (current, prev2) => {
|
|
152
169
|
resetItemPosition(prev2);
|
|
153
170
|
if (prev2 > -1) {
|
|
@@ -187,7 +204,8 @@ const useCarousel = (props, emit, componentName) => {
|
|
|
187
204
|
loop: props.loop,
|
|
188
205
|
addItem,
|
|
189
206
|
removeItem,
|
|
190
|
-
setActiveItem
|
|
207
|
+
setActiveItem,
|
|
208
|
+
setContainerHeight
|
|
191
209
|
});
|
|
192
210
|
return {
|
|
193
211
|
root,
|
|
@@ -197,6 +215,8 @@ const useCarousel = (props, emit, componentName) => {
|
|
|
197
215
|
hover,
|
|
198
216
|
isCardType,
|
|
199
217
|
items,
|
|
218
|
+
isVertical,
|
|
219
|
+
containerStyle,
|
|
200
220
|
handleButtonEnter,
|
|
201
221
|
handleButtonLeave,
|
|
202
222
|
handleIndicatorClick,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-carousel.js","sources":["../../../../../../packages/components/carousel/src/use-carousel.ts"],"sourcesContent":["import {\n computed,\n getCurrentInstance,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n unref,\n watch,\n} from 'vue'\nimport { throttle } from 'lodash-unified'\nimport { useResizeObserver } from '@vueuse/core'\nimport { debugWarn, isString } from '@element-plus/utils'\nimport { useOrderedChildren } from '@element-plus/hooks'\nimport { carouselContextKey } from './constants'\n\nimport type { SetupContext } from 'vue'\nimport type { CarouselItemContext } from './constants'\nimport type { CarouselEmits, CarouselProps } from './carousel'\n\nconst THROTTLE_TIME = 300\n\nexport const useCarousel = (\n props: CarouselProps,\n emit: SetupContext<CarouselEmits>['emit'],\n componentName: string\n) => {\n const {\n children: items,\n addChild: addItem,\n removeChild: removeItem,\n } = useOrderedChildren<CarouselItemContext>(\n getCurrentInstance()!,\n 'ElCarouselItem'\n )\n\n // refs\n const activeIndex = ref(-1)\n const timer = ref<ReturnType<typeof setInterval> | null>(null)\n const hover = ref(false)\n const root = ref<HTMLDivElement>()\n\n // computed\n const arrowDisplay = computed(\n () => props.arrow !== 'never' && !unref(isVertical)\n )\n\n const hasLabel = computed(() => {\n return items.value.some((item) => item.props.label.toString().length > 0)\n })\n\n const isCardType = computed(() => props.type === 'card')\n const isVertical = computed(() => props.direction === 'vertical')\n\n // methods\n const throttledArrowClick = throttle(\n (index: number) => {\n setActiveItem(index)\n },\n THROTTLE_TIME,\n { trailing: true }\n )\n\n const throttledIndicatorHover = throttle((index: number) => {\n handleIndicatorHover(index)\n }, THROTTLE_TIME)\n\n function pauseTimer() {\n if (timer.value) {\n clearInterval(timer.value)\n timer.value = null\n }\n }\n\n function startTimer() {\n if (props.interval <= 0 || !props.autoplay || timer.value) return\n timer.value = setInterval(() => playSlides(), props.interval)\n }\n\n const playSlides = () => {\n if (activeIndex.value < items.value.length - 1) {\n activeIndex.value = activeIndex.value + 1\n } else if (props.loop) {\n activeIndex.value = 0\n }\n }\n\n function setActiveItem(index: number | string) {\n if (isString(index)) {\n const filteredItems = items.value.filter(\n (item) => item.props.name === index\n )\n if (filteredItems.length > 0) {\n index = items.value.indexOf(filteredItems[0])\n }\n }\n index = Number(index)\n if (Number.isNaN(index) || index !== Math.floor(index)) {\n debugWarn(componentName, 'index must be integer.')\n return\n }\n const itemCount = items.value.length\n const oldIndex = activeIndex.value\n if (index < 0) {\n activeIndex.value = props.loop ? itemCount - 1 : 0\n } else if (index >= itemCount) {\n activeIndex.value = props.loop ? 0 : itemCount - 1\n } else {\n activeIndex.value = index\n }\n if (oldIndex === activeIndex.value) {\n resetItemPosition(oldIndex)\n }\n resetTimer()\n }\n\n function resetItemPosition(oldIndex?: number) {\n items.value.forEach((item, index) => {\n item.translateItem(index, activeIndex.value, oldIndex)\n })\n }\n\n function itemInStage(item: CarouselItemContext, index: number) {\n const _items = unref(items)\n const itemCount = _items.length\n if (itemCount === 0 || !item.states.inStage) return false\n const nextItemIndex = index + 1\n const prevItemIndex = index - 1\n const lastItemIndex = itemCount - 1\n const isLastItemActive = _items[lastItemIndex].states.active\n const isFirstItemActive = _items[0].states.active\n const isNextItemActive = _items[nextItemIndex]?.states?.active\n const isPrevItemActive = _items[prevItemIndex]?.states?.active\n\n if ((index === lastItemIndex && isFirstItemActive) || isNextItemActive) {\n return 'left'\n } else if ((index === 0 && isLastItemActive) || isPrevItemActive) {\n return 'right'\n }\n return false\n }\n\n function handleMouseEnter() {\n hover.value = true\n if (props.pauseOnHover) {\n pauseTimer()\n }\n }\n\n function handleMouseLeave() {\n hover.value = false\n startTimer()\n }\n\n function handleButtonEnter(arrow: 'left' | 'right') {\n if (unref(isVertical)) return\n items.value.forEach((item, index) => {\n if (arrow === itemInStage(item, index)) {\n item.states.hover = true\n }\n })\n }\n\n function handleButtonLeave() {\n if (unref(isVertical)) return\n items.value.forEach((item) => {\n item.states.hover = false\n })\n }\n\n function handleIndicatorClick(index: number) {\n activeIndex.value = index\n }\n\n function handleIndicatorHover(index: number) {\n if (props.trigger === 'hover' && index !== activeIndex.value) {\n activeIndex.value = index\n }\n }\n\n function prev() {\n setActiveItem(activeIndex.value - 1)\n }\n\n function next() {\n setActiveItem(activeIndex.value + 1)\n }\n\n function resetTimer() {\n pauseTimer()\n startTimer()\n }\n\n // watch\n watch(\n () => activeIndex.value,\n (current, prev) => {\n resetItemPosition(prev)\n if (prev > -1) {\n emit('change', current, prev)\n }\n }\n )\n watch(\n () => props.autoplay,\n (autoplay) => {\n autoplay ? startTimer() : pauseTimer()\n }\n )\n watch(\n () => props.loop,\n () => {\n setActiveItem(activeIndex.value)\n }\n )\n\n watch(\n () => props.interval,\n () => {\n resetTimer()\n }\n )\n\n watch(\n () => items.value,\n () => {\n if (items.value.length > 0) setActiveItem(props.initialIndex)\n }\n )\n\n const resizeObserver = shallowRef<ReturnType<typeof useResizeObserver>>()\n // lifecycle\n onMounted(() => {\n resizeObserver.value = useResizeObserver(root.value, () => {\n resetItemPosition()\n })\n startTimer()\n })\n\n onBeforeUnmount(() => {\n pauseTimer()\n if (root.value && resizeObserver.value) resizeObserver.value.stop()\n })\n\n // provide\n provide(carouselContextKey, {\n root,\n isCardType,\n isVertical,\n items,\n loop: props.loop,\n addItem,\n removeItem,\n setActiveItem,\n })\n\n return {\n root,\n activeIndex,\n arrowDisplay,\n hasLabel,\n hover,\n isCardType,\n items,\n handleButtonEnter,\n handleButtonLeave,\n handleIndicatorClick,\n handleMouseEnter,\n handleMouseLeave,\n setActiveItem,\n prev,\n next,\n throttledArrowClick,\n throttledIndicatorHover,\n }\n}\n"],"names":["useOrderedChildren","getCurrentInstance","ref","computed","unref","throttle","isString","debugWarn","watch","shallowRef","onMounted","useResizeObserver","onBeforeUnmount","provide","carouselContextKey"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,aAAa,GAAG,GAAG,CAAC;AACd,MAAC,WAAW,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,aAAa,KAAK;AAC3D,EAAE,MAAM;AACR,IAAI,QAAQ,EAAE,KAAK;AACnB,IAAI,QAAQ,EAAE,OAAO;AACrB,IAAI,WAAW,EAAE,UAAU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S,CAAC,MAAM;AAClB,IAAI,cAAc,CAAC,KAAK,GAAGC,sBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM;AAC/D,MAAM,iBAAiB,EAAE,CAAC;AAC1B,KAAK,CAAC,CAAC;AACP,IAAI,UAAU,EAAE,CAAC;AACjB,GAAG,CAAC,CAAC;AACL,EAAEC,mBAAe,CAAC,MAAM;AACxB,IAAI,UAAU,EAAE,CAAC;AACjB,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,cAAc,CAAC,KAAK;AAC1C,MAAM,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;AAClC,GAAG,CAAC,CAAC;AACL,EAAEC,WAAO,CAACC,4BAAkB,EAAE;AAC9B,IAAI,IAAI;AACR,IAAI,UAAU;AACd,IAAI,UAAU;AACd,IAAI,KAAK;AACT,IAAI,IAAI,EAAE,KAAK,CAAC,IAAI;AACpB,IAAI,OAAO;AACX,IAAI,UAAU;AACd,IAAI,aAAa;AACjB,GAAG,CAAC,CAAC;AACL,EAAE,OAAO;AACT,IAAI,IAAI;AACR,IAAI,WAAW;AACf,IAAI,YAAY;AAChB,IAAI,QAAQ;AACZ,IAAI,KAAK;AACT,IAAI,UAAU;AACd,IAAI,KAAK;AACT,IAAI,iBAAiB;AACrB,IAAI,iBAAiB;AACrB,IAAI,oBAAoB;AACxB,IAAI,gBAAgB;AACpB,IAAI,gBAAgB;AACpB,IAAI,aAAa;AACjB,IAAI,IAAI;AACR,IAAI,IAAI;AACR,IAAI,mBAAmB;AACvB,IAAI,uBAAuB;AAC3B,GAAG,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"use-carousel.js","sources":["../../../../../../packages/components/carousel/src/use-carousel.ts"],"sourcesContent":["import {\n computed,\n getCurrentInstance,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n unref,\n watch,\n} from 'vue'\nimport { throttle } from 'lodash-unified'\nimport { useResizeObserver } from '@vueuse/core'\nimport { debugWarn, isString } from '@element-plus/utils'\nimport { useOrderedChildren } from '@element-plus/hooks'\nimport { carouselContextKey } from './constants'\n\nimport type { SetupContext } from 'vue'\nimport type { CarouselItemContext } from './constants'\nimport type { CarouselEmits, CarouselProps } from './carousel'\n\nconst THROTTLE_TIME = 300\n\nexport const useCarousel = (\n props: CarouselProps,\n emit: SetupContext<CarouselEmits>['emit'],\n componentName: string\n) => {\n const {\n children: items,\n addChild: addItem,\n removeChild: removeItem,\n } = useOrderedChildren<CarouselItemContext>(\n getCurrentInstance()!,\n 'ElCarouselItem'\n )\n\n // refs\n const activeIndex = ref(-1)\n const timer = ref<ReturnType<typeof setInterval> | null>(null)\n const hover = ref(false)\n const root = ref<HTMLDivElement>()\n const containerHeight = ref<number>(0)\n\n // computed\n const arrowDisplay = computed(\n () => props.arrow !== 'never' && !unref(isVertical)\n )\n\n const hasLabel = computed(() => {\n return items.value.some((item) => item.props.label.toString().length > 0)\n })\n\n const isCardType = computed(() => props.type === 'card')\n const isVertical = computed(() => props.direction === 'vertical')\n\n const containerStyle = computed(() => {\n if (props.height !== 'auto') {\n return {\n height: props.height,\n }\n }\n return {\n height: `${containerHeight.value}px`,\n overflow: 'hidden',\n }\n })\n\n // methods\n const throttledArrowClick = throttle(\n (index: number) => {\n setActiveItem(index)\n },\n THROTTLE_TIME,\n { trailing: true }\n )\n\n const throttledIndicatorHover = throttle((index: number) => {\n handleIndicatorHover(index)\n }, THROTTLE_TIME)\n\n function pauseTimer() {\n if (timer.value) {\n clearInterval(timer.value)\n timer.value = null\n }\n }\n\n function startTimer() {\n if (props.interval <= 0 || !props.autoplay || timer.value) return\n timer.value = setInterval(() => playSlides(), props.interval)\n }\n\n const playSlides = () => {\n if (activeIndex.value < items.value.length - 1) {\n activeIndex.value = activeIndex.value + 1\n } else if (props.loop) {\n activeIndex.value = 0\n }\n }\n\n function setActiveItem(index: number | string) {\n if (isString(index)) {\n const filteredItems = items.value.filter(\n (item) => item.props.name === index\n )\n if (filteredItems.length > 0) {\n index = items.value.indexOf(filteredItems[0])\n }\n }\n index = Number(index)\n if (Number.isNaN(index) || index !== Math.floor(index)) {\n debugWarn(componentName, 'index must be integer.')\n return\n }\n const itemCount = items.value.length\n const oldIndex = activeIndex.value\n if (index < 0) {\n activeIndex.value = props.loop ? itemCount - 1 : 0\n } else if (index >= itemCount) {\n activeIndex.value = props.loop ? 0 : itemCount - 1\n } else {\n activeIndex.value = index\n }\n if (oldIndex === activeIndex.value) {\n resetItemPosition(oldIndex)\n }\n resetTimer()\n }\n\n function resetItemPosition(oldIndex?: number) {\n items.value.forEach((item, index) => {\n item.translateItem(index, activeIndex.value, oldIndex)\n })\n }\n\n function itemInStage(item: CarouselItemContext, index: number) {\n const _items = unref(items)\n const itemCount = _items.length\n if (itemCount === 0 || !item.states.inStage) return false\n const nextItemIndex = index + 1\n const prevItemIndex = index - 1\n const lastItemIndex = itemCount - 1\n const isLastItemActive = _items[lastItemIndex].states.active\n const isFirstItemActive = _items[0].states.active\n const isNextItemActive = _items[nextItemIndex]?.states?.active\n const isPrevItemActive = _items[prevItemIndex]?.states?.active\n\n if ((index === lastItemIndex && isFirstItemActive) || isNextItemActive) {\n return 'left'\n } else if ((index === 0 && isLastItemActive) || isPrevItemActive) {\n return 'right'\n }\n return false\n }\n\n function handleMouseEnter() {\n hover.value = true\n if (props.pauseOnHover) {\n pauseTimer()\n }\n }\n\n function handleMouseLeave() {\n hover.value = false\n startTimer()\n }\n\n function handleButtonEnter(arrow: 'left' | 'right') {\n if (unref(isVertical)) return\n items.value.forEach((item, index) => {\n if (arrow === itemInStage(item, index)) {\n item.states.hover = true\n }\n })\n }\n\n function handleButtonLeave() {\n if (unref(isVertical)) return\n items.value.forEach((item) => {\n item.states.hover = false\n })\n }\n\n function handleIndicatorClick(index: number) {\n activeIndex.value = index\n }\n\n function handleIndicatorHover(index: number) {\n if (props.trigger === 'hover' && index !== activeIndex.value) {\n activeIndex.value = index\n }\n }\n\n function prev() {\n setActiveItem(activeIndex.value - 1)\n }\n\n function next() {\n setActiveItem(activeIndex.value + 1)\n }\n\n function resetTimer() {\n pauseTimer()\n startTimer()\n }\n\n function setContainerHeight(height: number) {\n if (props.height !== 'auto') return\n containerHeight.value = height\n }\n\n // watch\n watch(\n () => activeIndex.value,\n (current, prev) => {\n resetItemPosition(prev)\n if (prev > -1) {\n emit('change', current, prev)\n }\n }\n )\n watch(\n () => props.autoplay,\n (autoplay) => {\n autoplay ? startTimer() : pauseTimer()\n }\n )\n watch(\n () => props.loop,\n () => {\n setActiveItem(activeIndex.value)\n }\n )\n\n watch(\n () => props.interval,\n () => {\n resetTimer()\n }\n )\n\n watch(\n () => items.value,\n () => {\n if (items.value.length > 0) setActiveItem(props.initialIndex)\n }\n )\n\n const resizeObserver = shallowRef<ReturnType<typeof useResizeObserver>>()\n // lifecycle\n onMounted(() => {\n resizeObserver.value = useResizeObserver(root.value, () => {\n resetItemPosition()\n })\n startTimer()\n })\n\n onBeforeUnmount(() => {\n pauseTimer()\n if (root.value && resizeObserver.value) resizeObserver.value.stop()\n })\n\n // provide\n provide(carouselContextKey, {\n root,\n isCardType,\n isVertical,\n items,\n loop: props.loop,\n addItem,\n removeItem,\n setActiveItem,\n setContainerHeight,\n })\n\n return {\n root,\n activeIndex,\n arrowDisplay,\n hasLabel,\n hover,\n isCardType,\n items,\n isVertical,\n containerStyle,\n handleButtonEnter,\n handleButtonLeave,\n handleIndicatorClick,\n handleMouseEnter,\n handleMouseLeave,\n setActiveItem,\n prev,\n next,\n throttledArrowClick,\n throttledIndicatorHover,\n }\n}\n"],"names":["useOrderedChildren","getCurrentInstance","ref","computed","unref","throttle","isString","debugWarn","watch","shallowRef","onMounted","useResizeObserver","onBeforeUnmount","provide","carouselContextKey"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,aAAa,GAAG,GAAG,CAAC;AACd,MAAC,WAAW,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,aAAa,KAAK;AAC3D,EAAE,MAAM;AACR,IAAI,QAAQ,EA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;AACX,IAAI,UAAU;AACd,IAAI,aAAa;AACjB,IAAI,kBAAkB;AACtB,GAAG,CAAC,CAAC;AACL,EAAE,OAAO;AACT,IAAI,IAAI;AACR,IAAI,WAAW;AACf,IAAI,YAAY;AAChB,IAAI,QAAQ;AACZ,IAAI,KAAK;AACT,IAAI,UAAU;AACd,IAAI,KAAK;AACT,IAAI,UAAU;AACd,IAAI,cAAc;AAClB,IAAI,iBAAiB;AACrB,IAAI,iBAAiB;AACrB,IAAI,oBAAoB;AACxB,IAAI,gBAAgB;AACpB,IAAI,gBAAgB;AACpB,IAAI,aAAa;AACjB,IAAI,IAAI;AACR,IAAI,IAAI;AACR,IAAI,mBAAmB;AACvB,IAAI,uBAAuB;AAC3B,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -13078,20 +13078,20 @@ declare const _Cascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
13078
13078
|
readonly noresize: boolean;
|
|
13079
13079
|
}>> & Record<string, any>;
|
|
13080
13080
|
ElTag: SFCWithInstall<import("vue").DefineComponent<{
|
|
13081
|
-
readonly closable: BooleanConstructor;
|
|
13082
13081
|
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "success" | "warning" | "info" | "danger", unknown, "", boolean>;
|
|
13083
|
-
readonly
|
|
13082
|
+
readonly closable: BooleanConstructor;
|
|
13084
13083
|
readonly disableTransitions: BooleanConstructor;
|
|
13084
|
+
readonly hit: BooleanConstructor;
|
|
13085
13085
|
readonly color: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
13086
13086
|
readonly size: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "default" | "small" | "large", unknown, "", boolean>;
|
|
13087
13087
|
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "light" | "dark" | "plain", unknown, "light", boolean>;
|
|
13088
13088
|
readonly round: BooleanConstructor;
|
|
13089
13089
|
}, {
|
|
13090
13090
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
13091
|
-
readonly closable: BooleanConstructor;
|
|
13092
13091
|
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "success" | "warning" | "info" | "danger", unknown, "", boolean>;
|
|
13093
|
-
readonly
|
|
13092
|
+
readonly closable: BooleanConstructor;
|
|
13094
13093
|
readonly disableTransitions: BooleanConstructor;
|
|
13094
|
+
readonly hit: BooleanConstructor;
|
|
13095
13095
|
readonly color: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
13096
13096
|
readonly size: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "default" | "small" | "large", unknown, "", boolean>;
|
|
13097
13097
|
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "light" | "dark" | "plain", unknown, "light", boolean>;
|
|
@@ -13120,7 +13120,7 @@ declare const _Cascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
13120
13120
|
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
13121
13121
|
cssVarBlockName: (name: string) => string;
|
|
13122
13122
|
};
|
|
13123
|
-
|
|
13123
|
+
containerKls: import("vue").ComputedRef<string[]>;
|
|
13124
13124
|
handleClose: (event: MouseEvent) => void;
|
|
13125
13125
|
handleClick: (event: MouseEvent) => void;
|
|
13126
13126
|
ElIcon: SFCWithInstall<import("vue").DefineComponent<{
|
|
@@ -13191,10 +13191,10 @@ declare const _Cascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
13191
13191
|
close: (evt: MouseEvent) => boolean;
|
|
13192
13192
|
click: (evt: MouseEvent) => boolean;
|
|
13193
13193
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13194
|
-
readonly closable: BooleanConstructor;
|
|
13195
13194
|
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "success" | "warning" | "info" | "danger", unknown, "", boolean>;
|
|
13196
|
-
readonly
|
|
13195
|
+
readonly closable: BooleanConstructor;
|
|
13197
13196
|
readonly disableTransitions: BooleanConstructor;
|
|
13197
|
+
readonly hit: BooleanConstructor;
|
|
13198
13198
|
readonly color: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
13199
13199
|
readonly size: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "default" | "small" | "large", unknown, "", boolean>;
|
|
13200
13200
|
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "light" | "dark" | "plain", unknown, "light", boolean>;
|
|
@@ -13209,8 +13209,8 @@ declare const _Cascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
13209
13209
|
readonly size: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", unknown>;
|
|
13210
13210
|
readonly color: string;
|
|
13211
13211
|
readonly round: boolean;
|
|
13212
|
-
readonly hit: boolean;
|
|
13213
13212
|
readonly disableTransitions: boolean;
|
|
13213
|
+
readonly hit: boolean;
|
|
13214
13214
|
}>> & Record<string, any>;
|
|
13215
13215
|
ElIcon: SFCWithInstall<import("vue").DefineComponent<{
|
|
13216
13216
|
readonly size: {
|
|
@@ -26445,20 +26445,20 @@ export declare const ElCascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
26445
26445
|
readonly noresize: boolean;
|
|
26446
26446
|
}>> & Record<string, any>;
|
|
26447
26447
|
ElTag: SFCWithInstall<import("vue").DefineComponent<{
|
|
26448
|
-
readonly closable: BooleanConstructor;
|
|
26449
26448
|
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "success" | "warning" | "info" | "danger", unknown, "", boolean>;
|
|
26450
|
-
readonly
|
|
26449
|
+
readonly closable: BooleanConstructor;
|
|
26451
26450
|
readonly disableTransitions: BooleanConstructor;
|
|
26451
|
+
readonly hit: BooleanConstructor;
|
|
26452
26452
|
readonly color: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
26453
26453
|
readonly size: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "default" | "small" | "large", unknown, "", boolean>;
|
|
26454
26454
|
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "light" | "dark" | "plain", unknown, "light", boolean>;
|
|
26455
26455
|
readonly round: BooleanConstructor;
|
|
26456
26456
|
}, {
|
|
26457
26457
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
26458
|
-
readonly closable: BooleanConstructor;
|
|
26459
26458
|
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "success" | "warning" | "info" | "danger", unknown, "", boolean>;
|
|
26460
|
-
readonly
|
|
26459
|
+
readonly closable: BooleanConstructor;
|
|
26461
26460
|
readonly disableTransitions: BooleanConstructor;
|
|
26461
|
+
readonly hit: BooleanConstructor;
|
|
26462
26462
|
readonly color: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
26463
26463
|
readonly size: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "default" | "small" | "large", unknown, "", boolean>;
|
|
26464
26464
|
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "light" | "dark" | "plain", unknown, "light", boolean>;
|
|
@@ -26487,7 +26487,7 @@ export declare const ElCascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
26487
26487
|
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
26488
26488
|
cssVarBlockName: (name: string) => string;
|
|
26489
26489
|
};
|
|
26490
|
-
|
|
26490
|
+
containerKls: import("vue").ComputedRef<string[]>;
|
|
26491
26491
|
handleClose: (event: MouseEvent) => void;
|
|
26492
26492
|
handleClick: (event: MouseEvent) => void;
|
|
26493
26493
|
ElIcon: SFCWithInstall<import("vue").DefineComponent<{
|
|
@@ -26558,10 +26558,10 @@ export declare const ElCascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
26558
26558
|
close: (evt: MouseEvent) => boolean;
|
|
26559
26559
|
click: (evt: MouseEvent) => boolean;
|
|
26560
26560
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26561
|
-
readonly closable: BooleanConstructor;
|
|
26562
26561
|
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "success" | "warning" | "info" | "danger", unknown, "", boolean>;
|
|
26563
|
-
readonly
|
|
26562
|
+
readonly closable: BooleanConstructor;
|
|
26564
26563
|
readonly disableTransitions: BooleanConstructor;
|
|
26564
|
+
readonly hit: BooleanConstructor;
|
|
26565
26565
|
readonly color: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
26566
26566
|
readonly size: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "default" | "small" | "large", unknown, "", boolean>;
|
|
26567
26567
|
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "light" | "dark" | "plain", unknown, "light", boolean>;
|
|
@@ -26576,8 +26576,8 @@ export declare const ElCascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
26576
26576
|
readonly size: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", unknown>;
|
|
26577
26577
|
readonly color: string;
|
|
26578
26578
|
readonly round: boolean;
|
|
26579
|
-
readonly hit: boolean;
|
|
26580
26579
|
readonly disableTransitions: boolean;
|
|
26580
|
+
readonly hit: boolean;
|
|
26581
26581
|
}>> & Record<string, any>;
|
|
26582
26582
|
ElIcon: SFCWithInstall<import("vue").DefineComponent<{
|
|
26583
26583
|
readonly size: {
|
|
@@ -13081,20 +13081,20 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
13081
13081
|
readonly noresize: boolean;
|
|
13082
13082
|
}>> & Record<string, any>;
|
|
13083
13083
|
ElTag: import("element-plus/es/utils").SFCWithInstall<import("vue").DefineComponent<{
|
|
13084
|
-
readonly closable: BooleanConstructor;
|
|
13085
13084
|
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "success" | "warning" | "info" | "danger", unknown, "", boolean>;
|
|
13086
|
-
readonly
|
|
13085
|
+
readonly closable: BooleanConstructor;
|
|
13087
13086
|
readonly disableTransitions: BooleanConstructor;
|
|
13087
|
+
readonly hit: BooleanConstructor;
|
|
13088
13088
|
readonly color: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
13089
13089
|
readonly size: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "default" | "small" | "large", unknown, "", boolean>;
|
|
13090
13090
|
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "light" | "dark" | "plain", unknown, "light", boolean>;
|
|
13091
13091
|
readonly round: BooleanConstructor;
|
|
13092
13092
|
}, {
|
|
13093
13093
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
13094
|
-
readonly closable: BooleanConstructor;
|
|
13095
13094
|
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "success" | "warning" | "info" | "danger", unknown, "", boolean>;
|
|
13096
|
-
readonly
|
|
13095
|
+
readonly closable: BooleanConstructor;
|
|
13097
13096
|
readonly disableTransitions: BooleanConstructor;
|
|
13097
|
+
readonly hit: BooleanConstructor;
|
|
13098
13098
|
readonly color: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
13099
13099
|
readonly size: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "default" | "small" | "large", unknown, "", boolean>;
|
|
13100
13100
|
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "light" | "dark" | "plain", unknown, "light", boolean>;
|
|
@@ -13123,7 +13123,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
13123
13123
|
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
13124
13124
|
cssVarBlockName: (name: string) => string;
|
|
13125
13125
|
};
|
|
13126
|
-
|
|
13126
|
+
containerKls: ComputedRef<string[]>;
|
|
13127
13127
|
handleClose: (event: MouseEvent) => void;
|
|
13128
13128
|
handleClick: (event: MouseEvent) => void;
|
|
13129
13129
|
ElIcon: import("element-plus/es/utils").SFCWithInstall<import("vue").DefineComponent<{
|
|
@@ -13194,10 +13194,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
13194
13194
|
close: (evt: MouseEvent) => boolean;
|
|
13195
13195
|
click: (evt: MouseEvent) => boolean;
|
|
13196
13196
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13197
|
-
readonly closable: BooleanConstructor;
|
|
13198
13197
|
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "success" | "warning" | "info" | "danger", unknown, "", boolean>;
|
|
13199
|
-
readonly
|
|
13198
|
+
readonly closable: BooleanConstructor;
|
|
13200
13199
|
readonly disableTransitions: BooleanConstructor;
|
|
13200
|
+
readonly hit: BooleanConstructor;
|
|
13201
13201
|
readonly color: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
13202
13202
|
readonly size: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "default" | "small" | "large", unknown, "", boolean>;
|
|
13203
13203
|
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "light" | "dark" | "plain", unknown, "light", boolean>;
|
|
@@ -13212,8 +13212,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
13212
13212
|
readonly size: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", unknown>;
|
|
13213
13213
|
readonly color: string;
|
|
13214
13214
|
readonly round: boolean;
|
|
13215
|
-
readonly hit: boolean;
|
|
13216
13215
|
readonly disableTransitions: boolean;
|
|
13216
|
+
readonly hit: boolean;
|
|
13217
13217
|
}>> & Record<string, any>;
|
|
13218
13218
|
ElIcon: import("element-plus/es/utils").SFCWithInstall<import("vue").DefineComponent<{
|
|
13219
13219
|
readonly size: {
|
|
@@ -26,6 +26,7 @@ export declare const ElCheckTag: import("element-plus/es/utils").SFCWithInstall<
|
|
|
26
26
|
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
27
27
|
cssVarBlockName: (name: string) => string;
|
|
28
28
|
};
|
|
29
|
+
containerKls: import("vue").ComputedRef<string[]>;
|
|
29
30
|
handleChange: () => void;
|
|
30
31
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
31
32
|
'update:checked': (value: boolean) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-tag.js","sources":["../../../../../../packages/components/check-tag/src/check-tag.ts"],"sourcesContent":["import { buildProps, isBoolean } from '@element-plus/utils'\nimport { CHANGE_EVENT } from '@element-plus/constants'\n\nimport type CheckTag from './check-tag.vue'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const checkTagProps = buildProps({\n checked: {\n type: Boolean,\n default: false,\n },\n} as const)\nexport type CheckTagProps = ExtractPropTypes<typeof checkTagProps>\n\nexport const checkTagEmits = {\n 'update:checked': (value: boolean) => isBoolean(value),\n [CHANGE_EVENT]: (value: boolean) => isBoolean(value),\n}\nexport type CheckTagEmits = typeof checkTagEmits\n\nexport type CheckTagInstance = InstanceType<typeof CheckTag>\n"],"names":["buildProps","isBoolean","CHANGE_EVENT"],"mappings":";;;;;;;;;;AAEY,MAAC,aAAa,GAAGA,kBAAU,CAAC;AACxC,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,aAAa,GAAG;AAC7B,EAAE,gBAAgB,EAAE,CAAC,KAAK,KAAKC,eAAS,CAAC,KAAK,CAAC;AAC/C,EAAE,CAACC,kBAAY,GAAG,CAAC,KAAK,KAAKD,eAAS,CAAC,KAAK,CAAC;AAC7C;;;;;"}
|
|
1
|
+
{"version":3,"file":"check-tag.js","sources":["../../../../../../packages/components/check-tag/src/check-tag.ts"],"sourcesContent":["import { buildProps, isBoolean } from '@element-plus/utils'\nimport { CHANGE_EVENT } from '@element-plus/constants'\n\nimport type CheckTag from './check-tag.vue'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const checkTagProps = buildProps({\n /**\n * @description is checked\n */\n checked: {\n type: Boolean,\n default: false,\n },\n} as const)\nexport type CheckTagProps = ExtractPropTypes<typeof checkTagProps>\n\nexport const checkTagEmits = {\n 'update:checked': (value: boolean) => isBoolean(value),\n [CHANGE_EVENT]: (value: boolean) => isBoolean(value),\n}\nexport type CheckTagEmits = typeof checkTagEmits\n\nexport type CheckTagInstance = InstanceType<typeof CheckTag>\n"],"names":["buildProps","isBoolean","CHANGE_EVENT"],"mappings":";;;;;;;;;;AAEY,MAAC,aAAa,GAAGA,kBAAU,CAAC;AACxC,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,aAAa,GAAG;AAC7B,EAAE,gBAAgB,EAAE,CAAC,KAAK,KAAKC,eAAS,CAAC,KAAK,CAAC;AAC/C,EAAE,CAACC,kBAAY,GAAG,CAAC,KAAK,KAAKD,eAAS,CAAC,KAAK,CAAC;AAC7C;;;;;"}
|
|
@@ -26,6 +26,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
26
26
|
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
|
27
27
|
cssVarBlockName: (name: string) => string;
|
|
28
28
|
};
|
|
29
|
+
containerKls: import("vue").ComputedRef<string[]>;
|
|
29
30
|
handleChange: () => void;
|
|
30
31
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
31
32
|
'update:checked': (value: boolean) => boolean;
|
|
@@ -20,6 +20,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
20
20
|
setup(__props, { emit }) {
|
|
21
21
|
const props = __props;
|
|
22
22
|
const ns = index.useNamespace("check-tag");
|
|
23
|
+
const containerKls = vue.computed(() => [ns.b(), ns.is("checked", props.checked)]);
|
|
23
24
|
const handleChange = () => {
|
|
24
25
|
const checked = !props.checked;
|
|
25
26
|
emit(event.CHANGE_EVENT, checked);
|
|
@@ -27,7 +28,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
27
28
|
};
|
|
28
29
|
return (_ctx, _cache) => {
|
|
29
30
|
return vue.openBlock(), vue.createElementBlock("span", {
|
|
30
|
-
class: vue.normalizeClass(
|
|
31
|
+
class: vue.normalizeClass(vue.unref(containerKls)),
|
|
31
32
|
onClick: handleChange
|
|
32
33
|
}, [
|
|
33
34
|
vue.renderSlot(_ctx.$slots, "default")
|