@element-plus/nightly 0.0.20231009 → 0.0.20231011
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 +1016 -538
- package/dist/index.full.min.js +25 -25
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +23 -23
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +1016 -538
- 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 +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- 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/component.mjs +3 -1
- package/es/component.mjs.map +1 -1
- package/es/components/carousel/index.d.ts +5 -0
- package/es/components/carousel/src/carousel.vue.d.ts +5 -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/use-carousel.d.ts +6 -0
- package/es/components/carousel/src/use-carousel.mjs +33 -1
- package/es/components/carousel/src/use-carousel.mjs.map +1 -1
- package/es/components/checkbox/index.d.ts +12 -0
- package/es/components/checkbox/src/checkbox-button.vue.d.ts +4 -0
- package/es/components/checkbox/src/checkbox.d.ts +1 -0
- package/es/components/checkbox/src/checkbox.mjs +2 -1
- package/es/components/checkbox/src/checkbox.mjs.map +1 -1
- package/es/components/checkbox/src/checkbox.vue.d.ts +4 -0
- package/es/components/checkbox/src/composables/use-checkbox-status.mjs +2 -2
- package/es/components/checkbox/src/composables/use-checkbox-status.mjs.map +1 -1
- package/es/components/color-picker/index.d.ts +18 -1
- package/es/components/color-picker/src/color-picker.d.ts +2 -0
- package/es/components/color-picker/src/color-picker.mjs +3 -1
- package/es/components/color-picker/src/color-picker.mjs.map +1 -1
- package/es/components/color-picker/src/color-picker.vue.d.ts +18 -1
- package/es/components/color-picker/src/color-picker2.mjs +83 -11
- package/es/components/color-picker/src/color-picker2.mjs.map +1 -1
- package/es/components/descriptions/src/description-item.mjs.map +1 -1
- package/es/components/descriptions/src/description.mjs.map +1 -1
- package/es/components/drawer/index.mjs +2 -2
- package/es/components/drawer/src/drawer.mjs +26 -176
- package/es/components/drawer/src/drawer.mjs.map +1 -1
- package/es/components/drawer/src/drawer2.mjs +176 -26
- package/es/components/drawer/src/drawer2.mjs.map +1 -1
- package/es/components/index.mjs +1 -1
- package/es/components/table/src/table.mjs +2 -1
- package/es/components/table/src/table.mjs.map +1 -1
- package/es/components/transfer/index.d.ts +40 -0
- package/es/components/transfer/src/transfer-panel.vue.d.ts +8 -0
- package/es/components/transfer/src/transfer.vue.d.ts +40 -0
- package/es/components/tree-v2/index.d.ts +8 -0
- package/es/components/tree-v2/src/tree-node.vue.d.ts +8 -0
- package/es/components/tree-v2/src/tree.vue.d.ts +8 -0
- package/es/components/watermark/index.d.ts +94 -0
- package/es/components/watermark/index.mjs +9 -0
- package/es/components/watermark/index.mjs.map +1 -0
- package/es/components/watermark/src/useClips.d.ts +7 -0
- package/es/components/watermark/src/useClips.mjs +82 -0
- package/es/components/watermark/src/useClips.mjs.map +1 -0
- package/es/components/watermark/src/utils.d.ts +8 -0
- package/es/components/watermark/src/utils.mjs +22 -0
- package/es/components/watermark/src/utils.mjs.map +1 -0
- package/es/components/watermark/src/watermark.d.ts +32 -0
- package/es/components/watermark/src/watermark.mjs +33 -0
- package/es/components/watermark/src/watermark.mjs.map +1 -0
- package/es/components/watermark/src/watermark.vue.d.ts +94 -0
- package/es/components/watermark/src/watermark2.mjs +202 -0
- package/es/components/watermark/src/watermark2.mjs.map +1 -0
- package/es/components/watermark/style/index.d.ts +0 -0
- package/es/components/watermark/style/index.mjs +2 -0
- package/es/components/watermark/style/index.mjs.map +1 -0
- package/es/hooks/use-focus-controller/index.d.ts +6 -1
- package/es/hooks/use-focus-controller/index.mjs +5 -2
- package/es/hooks/use-focus-controller/index.mjs.map +1 -1
- package/es/index.mjs +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/component.js +3 -1
- package/lib/component.js.map +1 -1
- package/lib/components/carousel/index.d.ts +5 -0
- package/lib/components/carousel/src/carousel.vue.d.ts +5 -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/use-carousel.d.ts +6 -0
- package/lib/components/carousel/src/use-carousel.js +32 -0
- package/lib/components/carousel/src/use-carousel.js.map +1 -1
- package/lib/components/checkbox/index.d.ts +12 -0
- package/lib/components/checkbox/src/checkbox-button.vue.d.ts +4 -0
- package/lib/components/checkbox/src/checkbox.d.ts +1 -0
- package/lib/components/checkbox/src/checkbox.js +2 -1
- package/lib/components/checkbox/src/checkbox.js.map +1 -1
- package/lib/components/checkbox/src/checkbox.vue.d.ts +4 -0
- package/lib/components/checkbox/src/composables/use-checkbox-status.js +1 -1
- package/lib/components/checkbox/src/composables/use-checkbox-status.js.map +1 -1
- package/lib/components/color-picker/index.d.ts +18 -1
- package/lib/components/color-picker/src/color-picker.d.ts +2 -0
- package/lib/components/color-picker/src/color-picker.js +3 -1
- package/lib/components/color-picker/src/color-picker.js.map +1 -1
- package/lib/components/color-picker/src/color-picker.vue.d.ts +18 -1
- package/lib/components/color-picker/src/color-picker2.js +93 -21
- package/lib/components/color-picker/src/color-picker2.js.map +1 -1
- package/lib/components/descriptions/src/description-item.js.map +1 -1
- package/lib/components/descriptions/src/description.js.map +1 -1
- package/lib/components/drawer/index.js +2 -2
- package/lib/components/drawer/src/drawer.js +27 -176
- package/lib/components/drawer/src/drawer.js.map +1 -1
- package/lib/components/drawer/src/drawer2.js +176 -27
- package/lib/components/drawer/src/drawer2.js.map +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/table/src/table.js +2 -1
- package/lib/components/table/src/table.js.map +1 -1
- package/lib/components/transfer/index.d.ts +40 -0
- package/lib/components/transfer/src/transfer-panel.vue.d.ts +8 -0
- package/lib/components/transfer/src/transfer.vue.d.ts +40 -0
- package/lib/components/tree-v2/index.d.ts +8 -0
- package/lib/components/tree-v2/src/tree-node.vue.d.ts +8 -0
- package/lib/components/tree-v2/src/tree.vue.d.ts +8 -0
- package/lib/components/watermark/index.d.ts +94 -0
- package/lib/components/watermark/index.js +15 -0
- package/lib/components/watermark/index.js.map +1 -0
- package/lib/components/watermark/src/useClips.d.ts +7 -0
- package/lib/components/watermark/src/useClips.js +87 -0
- package/lib/components/watermark/src/useClips.js.map +1 -0
- package/lib/components/watermark/src/utils.d.ts +8 -0
- package/lib/components/watermark/src/utils.js +29 -0
- package/lib/components/watermark/src/utils.js.map +1 -0
- package/lib/components/watermark/src/watermark.d.ts +32 -0
- package/lib/components/watermark/src/watermark.js +37 -0
- package/lib/components/watermark/src/watermark.js.map +1 -0
- package/lib/components/watermark/src/watermark.vue.d.ts +94 -0
- package/lib/components/watermark/src/watermark2.js +206 -0
- package/lib/components/watermark/src/watermark2.js.map +1 -0
- package/lib/components/watermark/style/index.d.ts +0 -0
- package/lib/components/watermark/style/index.js +3 -0
- package/lib/components/watermark/style/index.js.map +1 -0
- package/lib/hooks/use-focus-controller/index.d.ts +6 -1
- package/lib/hooks/use-focus-controller/index.js +5 -2
- package/lib/hooks/use-focus-controller/index.js.map +1 -1
- package/lib/index.js +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-color-picker.css +1 -1
- package/theme-chalk/el-table-v2.css +1 -1
- package/theme-chalk/el-table.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/color-picker.scss +8 -2
- package/theme-chalk/src/common/var.scss +1 -0
- package/theme-chalk/src/table.scss +16 -9
- package/web-types.json +1 -1
package/es/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.20231011'\n"],"names":[],"mappings":"AAAY,MAAC,OAAO,GAAG;;;;"}
|
package/lib/component.js
CHANGED
|
@@ -73,6 +73,7 @@ var index$13 = require('./components/tree/index.js');
|
|
|
73
73
|
var index$14 = require('./components/tree-select/index.js');
|
|
74
74
|
var index$15 = require('./components/tree-v2/index.js');
|
|
75
75
|
var index$16 = require('./components/upload/index.js');
|
|
76
|
+
var index$17 = require('./components/watermark/index.js');
|
|
76
77
|
|
|
77
78
|
var Components = [
|
|
78
79
|
index.ElAffix,
|
|
@@ -172,7 +173,8 @@ var Components = [
|
|
|
172
173
|
index$13.ElTree,
|
|
173
174
|
index$14.ElTreeSelect,
|
|
174
175
|
index$15.ElTreeV2,
|
|
175
|
-
index$16.ElUpload
|
|
176
|
+
index$16.ElUpload,
|
|
177
|
+
index$17.ElWatermark
|
|
176
178
|
];
|
|
177
179
|
|
|
178
180
|
exports["default"] = Components;
|
package/lib/component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../packages/element-plus/component.ts"],"sourcesContent":["import { ElAffix } from '@element-plus/components/affix'\nimport { ElAlert } from '@element-plus/components/alert'\nimport { ElAutocomplete } from '@element-plus/components/autocomplete'\nimport { ElAvatar } from '@element-plus/components/avatar'\nimport { ElBacktop } from '@element-plus/components/backtop'\nimport { ElBadge } from '@element-plus/components/badge'\nimport {\n ElBreadcrumb,\n ElBreadcrumbItem,\n} from '@element-plus/components/breadcrumb'\nimport { ElButton, ElButtonGroup } from '@element-plus/components/button'\nimport { ElCalendar } from '@element-plus/components/calendar'\nimport { ElCard } from '@element-plus/components/card'\nimport { ElCarousel, ElCarouselItem } from '@element-plus/components/carousel'\nimport { ElCascader } from '@element-plus/components/cascader'\nimport { ElCascaderPanel } from '@element-plus/components/cascader-panel'\nimport { ElCheckTag } from '@element-plus/components/check-tag'\nimport {\n ElCheckbox,\n ElCheckboxButton,\n ElCheckboxGroup,\n} from '@element-plus/components/checkbox'\nimport { ElCol } from '@element-plus/components/col'\nimport { ElCollapse, ElCollapseItem } from '@element-plus/components/collapse'\nimport { ElCollapseTransition } from '@element-plus/components/collapse-transition'\nimport { ElColorPicker } from '@element-plus/components/color-picker'\nimport { ElConfigProvider } from '@element-plus/components/config-provider'\nimport {\n ElAside,\n ElContainer,\n ElFooter,\n ElHeader,\n ElMain,\n} from '@element-plus/components/container'\nimport { ElDatePicker } from '@element-plus/components/date-picker'\nimport {\n ElDescriptions,\n ElDescriptionsItem,\n} from '@element-plus/components/descriptions'\nimport { ElDialog } from '@element-plus/components/dialog'\nimport { ElDivider } from '@element-plus/components/divider'\nimport { ElDrawer } from '@element-plus/components/drawer'\nimport {\n ElDropdown,\n ElDropdownItem,\n ElDropdownMenu,\n} from '@element-plus/components/dropdown'\nimport { ElEmpty } from '@element-plus/components/empty'\nimport { ElForm, ElFormItem } from '@element-plus/components/form'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { ElImage } from '@element-plus/components/image'\nimport { ElImageViewer } from '@element-plus/components/image-viewer'\nimport { ElInput } from '@element-plus/components/input'\nimport { ElInputNumber } from '@element-plus/components/input-number'\nimport { ElLink } from '@element-plus/components/link'\nimport {\n ElMenu,\n ElMenuItem,\n ElMenuItemGroup,\n ElSubMenu,\n} from '@element-plus/components/menu'\nimport { ElPageHeader } from '@element-plus/components/page-header'\nimport { ElPagination } from '@element-plus/components/pagination'\nimport { ElPopconfirm } from '@element-plus/components/popconfirm'\nimport { ElPopover } from '@element-plus/components/popover'\nimport { ElPopper } from '@element-plus/components/popper'\nimport { ElProgress } from '@element-plus/components/progress'\nimport {\n ElRadio,\n ElRadioButton,\n ElRadioGroup,\n} from '@element-plus/components/radio'\nimport { ElRate } from '@element-plus/components/rate'\nimport { ElResult } from '@element-plus/components/result'\nimport { ElRow } from '@element-plus/components/row'\nimport { ElScrollbar } from '@element-plus/components/scrollbar'\nimport {\n ElOption,\n ElOptionGroup,\n ElSelect,\n} from '@element-plus/components/select'\nimport { ElSelectV2 } from '@element-plus/components/select-v2'\nimport { ElSkeleton, ElSkeletonItem } from '@element-plus/components/skeleton'\nimport { ElSlider } from '@element-plus/components/slider'\nimport { ElSpace } from '@element-plus/components/space'\nimport { ElStatistic } from '@element-plus/components/statistic'\nimport { ElCountdown } from '@element-plus/components/countdown'\nimport { ElStep, ElSteps } from '@element-plus/components/steps'\nimport { ElSwitch } from '@element-plus/components/switch'\nimport { ElTable, ElTableColumn } from '@element-plus/components/table'\nimport { ElAutoResizer, ElTableV2 } from '@element-plus/components/table-v2'\nimport { ElTabPane, ElTabs } from '@element-plus/components/tabs'\nimport { ElTag } from '@element-plus/components/tag'\nimport { ElText } from '@element-plus/components/text'\nimport { ElTimePicker } from '@element-plus/components/time-picker'\nimport { ElTimeSelect } from '@element-plus/components/time-select'\nimport { ElTimeline, ElTimelineItem } from '@element-plus/components/timeline'\nimport { ElTooltip } from '@element-plus/components/tooltip'\nimport { ElTooltipV2 } from '@element-plus/components/tooltip-v2'\nimport { ElTransfer } from '@element-plus/components/transfer'\nimport { ElTree } from '@element-plus/components/tree'\nimport { ElTreeSelect } from '@element-plus/components/tree-select'\nimport { ElTreeV2 } from '@element-plus/components/tree-v2'\nimport { ElUpload } from '@element-plus/components/upload'\n\nimport type { Plugin } from 'vue'\n\nexport default [\n ElAffix,\n ElAlert,\n ElAutocomplete,\n ElAutoResizer,\n ElAvatar,\n ElBacktop,\n ElBadge,\n ElBreadcrumb,\n ElBreadcrumbItem,\n ElButton,\n ElButtonGroup,\n ElCalendar,\n ElCard,\n ElCarousel,\n ElCarouselItem,\n ElCascader,\n ElCascaderPanel,\n ElCheckTag,\n ElCheckbox,\n ElCheckboxButton,\n ElCheckboxGroup,\n ElCol,\n ElCollapse,\n ElCollapseItem,\n ElCollapseTransition,\n ElColorPicker,\n ElConfigProvider,\n ElContainer,\n ElAside,\n ElFooter,\n ElHeader,\n ElMain,\n ElDatePicker,\n ElDescriptions,\n ElDescriptionsItem,\n ElDialog,\n ElDivider,\n ElDrawer,\n ElDropdown,\n ElDropdownItem,\n ElDropdownMenu,\n ElEmpty,\n ElForm,\n ElFormItem,\n ElIcon,\n ElImage,\n ElImageViewer,\n ElInput,\n ElInputNumber,\n ElLink,\n ElMenu,\n ElMenuItem,\n ElMenuItemGroup,\n ElSubMenu,\n ElPageHeader,\n ElPagination,\n ElPopconfirm,\n ElPopover,\n ElPopper,\n ElProgress,\n ElRadio,\n ElRadioButton,\n ElRadioGroup,\n ElRate,\n ElResult,\n ElRow,\n ElScrollbar,\n ElSelect,\n ElOption,\n ElOptionGroup,\n ElSelectV2,\n ElSkeleton,\n ElSkeletonItem,\n ElSlider,\n ElSpace,\n ElStatistic,\n ElCountdown,\n ElSteps,\n ElStep,\n ElSwitch,\n ElTable,\n ElTableColumn,\n ElTableV2,\n ElTabs,\n ElTabPane,\n ElTag,\n ElText,\n ElTimePicker,\n ElTimeSelect,\n ElTimeline,\n ElTimelineItem,\n ElTooltip,\n ElTooltipV2,\n ElTransfer,\n ElTree,\n ElTreeSelect,\n ElTreeV2,\n ElUpload,\n] as Plugin[]\n"],"names":["ElAffix","ElAlert","ElAutocomplete","ElAutoResizer","ElAvatar","ElBacktop","ElBadge","ElBreadcrumb","ElBreadcrumbItem","ElButton","ElButtonGroup","ElCalendar","ElCard","ElCarousel","ElCarouselItem","ElCascader","ElCascaderPanel","ElCheckTag","ElCheckbox","ElCheckboxButton","ElCheckboxGroup","ElCol","ElCollapse","ElCollapseItem","ElCollapseTransition","ElColorPicker","ElConfigProvider","ElContainer","ElAside","ElFooter","ElHeader","ElMain","ElDatePicker","ElDescriptions","ElDescriptionsItem","ElDialog","ElDivider","ElDrawer","ElDropdown","ElDropdownItem","ElDropdownMenu","ElEmpty","ElForm","ElFormItem","ElIcon","ElImage","ElImageViewer","ElInput","ElInputNumber","ElLink","ElMenu","ElMenuItem","ElMenuItemGroup","ElSubMenu","ElPageHeader","ElPagination","ElPopconfirm","ElPopover","ElPopper","ElProgress","ElRadio","ElRadioButton","ElRadioGroup","ElRate","ElResult","ElRow","ElScrollbar","ElSelect","ElOption","ElOptionGroup","ElSelectV2","ElSkeleton","ElSkeletonItem","ElSlider","ElSpace","ElStatistic","ElCountdown","ElSteps","ElStep","ElSwitch","ElTable","ElTableColumn","ElTableV2","ElTabs","ElTabPane","ElTag","ElText","ElTimePicker","ElTimeSelect","ElTimeline","ElTimelineItem","ElTooltip","ElTooltipV2","ElTransfer","ElTree","ElTreeSelect","ElTreeV2","ElUpload"],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../packages/element-plus/component.ts"],"sourcesContent":["import { ElAffix } from '@element-plus/components/affix'\nimport { ElAlert } from '@element-plus/components/alert'\nimport { ElAutocomplete } from '@element-plus/components/autocomplete'\nimport { ElAvatar } from '@element-plus/components/avatar'\nimport { ElBacktop } from '@element-plus/components/backtop'\nimport { ElBadge } from '@element-plus/components/badge'\nimport {\n ElBreadcrumb,\n ElBreadcrumbItem,\n} from '@element-plus/components/breadcrumb'\nimport { ElButton, ElButtonGroup } from '@element-plus/components/button'\nimport { ElCalendar } from '@element-plus/components/calendar'\nimport { ElCard } from '@element-plus/components/card'\nimport { ElCarousel, ElCarouselItem } from '@element-plus/components/carousel'\nimport { ElCascader } from '@element-plus/components/cascader'\nimport { ElCascaderPanel } from '@element-plus/components/cascader-panel'\nimport { ElCheckTag } from '@element-plus/components/check-tag'\nimport {\n ElCheckbox,\n ElCheckboxButton,\n ElCheckboxGroup,\n} from '@element-plus/components/checkbox'\nimport { ElCol } from '@element-plus/components/col'\nimport { ElCollapse, ElCollapseItem } from '@element-plus/components/collapse'\nimport { ElCollapseTransition } from '@element-plus/components/collapse-transition'\nimport { ElColorPicker } from '@element-plus/components/color-picker'\nimport { ElConfigProvider } from '@element-plus/components/config-provider'\nimport {\n ElAside,\n ElContainer,\n ElFooter,\n ElHeader,\n ElMain,\n} from '@element-plus/components/container'\nimport { ElDatePicker } from '@element-plus/components/date-picker'\nimport {\n ElDescriptions,\n ElDescriptionsItem,\n} from '@element-plus/components/descriptions'\nimport { ElDialog } from '@element-plus/components/dialog'\nimport { ElDivider } from '@element-plus/components/divider'\nimport { ElDrawer } from '@element-plus/components/drawer'\nimport {\n ElDropdown,\n ElDropdownItem,\n ElDropdownMenu,\n} from '@element-plus/components/dropdown'\nimport { ElEmpty } from '@element-plus/components/empty'\nimport { ElForm, ElFormItem } from '@element-plus/components/form'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { ElImage } from '@element-plus/components/image'\nimport { ElImageViewer } from '@element-plus/components/image-viewer'\nimport { ElInput } from '@element-plus/components/input'\nimport { ElInputNumber } from '@element-plus/components/input-number'\nimport { ElLink } from '@element-plus/components/link'\nimport {\n ElMenu,\n ElMenuItem,\n ElMenuItemGroup,\n ElSubMenu,\n} from '@element-plus/components/menu'\nimport { ElPageHeader } from '@element-plus/components/page-header'\nimport { ElPagination } from '@element-plus/components/pagination'\nimport { ElPopconfirm } from '@element-plus/components/popconfirm'\nimport { ElPopover } from '@element-plus/components/popover'\nimport { ElPopper } from '@element-plus/components/popper'\nimport { ElProgress } from '@element-plus/components/progress'\nimport {\n ElRadio,\n ElRadioButton,\n ElRadioGroup,\n} from '@element-plus/components/radio'\nimport { ElRate } from '@element-plus/components/rate'\nimport { ElResult } from '@element-plus/components/result'\nimport { ElRow } from '@element-plus/components/row'\nimport { ElScrollbar } from '@element-plus/components/scrollbar'\nimport {\n ElOption,\n ElOptionGroup,\n ElSelect,\n} from '@element-plus/components/select'\nimport { ElSelectV2 } from '@element-plus/components/select-v2'\nimport { ElSkeleton, ElSkeletonItem } from '@element-plus/components/skeleton'\nimport { ElSlider } from '@element-plus/components/slider'\nimport { ElSpace } from '@element-plus/components/space'\nimport { ElStatistic } from '@element-plus/components/statistic'\nimport { ElCountdown } from '@element-plus/components/countdown'\nimport { ElStep, ElSteps } from '@element-plus/components/steps'\nimport { ElSwitch } from '@element-plus/components/switch'\nimport { ElTable, ElTableColumn } from '@element-plus/components/table'\nimport { ElAutoResizer, ElTableV2 } from '@element-plus/components/table-v2'\nimport { ElTabPane, ElTabs } from '@element-plus/components/tabs'\nimport { ElTag } from '@element-plus/components/tag'\nimport { ElText } from '@element-plus/components/text'\nimport { ElTimePicker } from '@element-plus/components/time-picker'\nimport { ElTimeSelect } from '@element-plus/components/time-select'\nimport { ElTimeline, ElTimelineItem } from '@element-plus/components/timeline'\nimport { ElTooltip } from '@element-plus/components/tooltip'\nimport { ElTooltipV2 } from '@element-plus/components/tooltip-v2'\nimport { ElTransfer } from '@element-plus/components/transfer'\nimport { ElTree } from '@element-plus/components/tree'\nimport { ElTreeSelect } from '@element-plus/components/tree-select'\nimport { ElTreeV2 } from '@element-plus/components/tree-v2'\nimport { ElUpload } from '@element-plus/components/upload'\nimport { ElWatermark } from '@element-plus/components/watermark'\n\nimport type { Plugin } from 'vue'\n\nexport default [\n ElAffix,\n ElAlert,\n ElAutocomplete,\n ElAutoResizer,\n ElAvatar,\n ElBacktop,\n ElBadge,\n ElBreadcrumb,\n ElBreadcrumbItem,\n ElButton,\n ElButtonGroup,\n ElCalendar,\n ElCard,\n ElCarousel,\n ElCarouselItem,\n ElCascader,\n ElCascaderPanel,\n ElCheckTag,\n ElCheckbox,\n ElCheckboxButton,\n ElCheckboxGroup,\n ElCol,\n ElCollapse,\n ElCollapseItem,\n ElCollapseTransition,\n ElColorPicker,\n ElConfigProvider,\n ElContainer,\n ElAside,\n ElFooter,\n ElHeader,\n ElMain,\n ElDatePicker,\n ElDescriptions,\n ElDescriptionsItem,\n ElDialog,\n ElDivider,\n ElDrawer,\n ElDropdown,\n ElDropdownItem,\n ElDropdownMenu,\n ElEmpty,\n ElForm,\n ElFormItem,\n ElIcon,\n ElImage,\n ElImageViewer,\n ElInput,\n ElInputNumber,\n ElLink,\n ElMenu,\n ElMenuItem,\n ElMenuItemGroup,\n ElSubMenu,\n ElPageHeader,\n ElPagination,\n ElPopconfirm,\n ElPopover,\n ElPopper,\n ElProgress,\n ElRadio,\n ElRadioButton,\n ElRadioGroup,\n ElRate,\n ElResult,\n ElRow,\n ElScrollbar,\n ElSelect,\n ElOption,\n ElOptionGroup,\n ElSelectV2,\n ElSkeleton,\n ElSkeletonItem,\n ElSlider,\n ElSpace,\n ElStatistic,\n ElCountdown,\n ElSteps,\n ElStep,\n ElSwitch,\n ElTable,\n ElTableColumn,\n ElTableV2,\n ElTabs,\n ElTabPane,\n ElTag,\n ElText,\n ElTimePicker,\n ElTimeSelect,\n ElTimeline,\n ElTimelineItem,\n ElTooltip,\n ElTooltipV2,\n ElTransfer,\n ElTree,\n ElTreeSelect,\n ElTreeV2,\n ElUpload,\n ElWatermark,\n] as Plugin[]\n"],"names":["ElAffix","ElAlert","ElAutocomplete","ElAutoResizer","ElAvatar","ElBacktop","ElBadge","ElBreadcrumb","ElBreadcrumbItem","ElButton","ElButtonGroup","ElCalendar","ElCard","ElCarousel","ElCarouselItem","ElCascader","ElCascaderPanel","ElCheckTag","ElCheckbox","ElCheckboxButton","ElCheckboxGroup","ElCol","ElCollapse","ElCollapseItem","ElCollapseTransition","ElColorPicker","ElConfigProvider","ElContainer","ElAside","ElFooter","ElHeader","ElMain","ElDatePicker","ElDescriptions","ElDescriptionsItem","ElDialog","ElDivider","ElDrawer","ElDropdown","ElDropdownItem","ElDropdownMenu","ElEmpty","ElForm","ElFormItem","ElIcon","ElImage","ElImageViewer","ElInput","ElInputNumber","ElLink","ElMenu","ElMenuItem","ElMenuItemGroup","ElSubMenu","ElPageHeader","ElPagination","ElPopconfirm","ElPopover","ElPopper","ElProgress","ElRadio","ElRadioButton","ElRadioGroup","ElRate","ElResult","ElRow","ElScrollbar","ElSelect","ElOption","ElOptionGroup","ElSelectV2","ElSkeleton","ElSkeletonItem","ElSlider","ElSpace","ElStatistic","ElCountdown","ElSteps","ElStep","ElSwitch","ElTable","ElTableColumn","ElTableV2","ElTabs","ElTabPane","ElTag","ElText","ElTimePicker","ElTimeSelect","ElTimeline","ElTimelineItem","ElTooltip","ElTooltipV2","ElTransfer","ElTree","ElTreeSelect","ElTreeV2","ElUpload","ElWatermark"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,iBAAe;AACf,EAAEA,aAAO;AACT,EAAEC,eAAO;AACT,EAAEC,sBAAc;AAChB,EAAEC,qBAAa;AACf,EAAEC,gBAAQ;AACV,EAAEC,iBAAS;AACX,EAAEC,eAAO;AACT,EAAEC,oBAAY;AACd,EAAEC,wBAAgB;AAClB,EAAEC,gBAAQ;AACV,EAAEC,qBAAa;AACf,EAAEC,kBAAU;AACZ,EAAEC,cAAM;AACR,EAAEC,kBAAU;AAC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BAAW;AACb,EAAEC,eAAO;AACT,EAAEC,cAAM;AACR,EAAEC,gBAAQ;AACV,EAAEC,eAAO;AACT,EAAEC,qBAAa;AACf,EAAEC,iBAAS;AACX,EAAEC,cAAM;AACR,EAAEC,iBAAS;AACX,EAAEC,aAAK;AACP,EAAEC,cAAM;AACR,EAAEC,oBAAY;AACd,EAAEC,oBAAY;AACd,EAAEC,kBAAU;AACZ,EAAEC,sBAAc;AAChB,EAAEC,kBAAS;AACX,EAAEC,oBAAW;AACb,EAAEC,mBAAU;AACZ,EAAEC,eAAM;AACR,EAAEC,qBAAY;AACd,EAAEC,iBAAQ;AACV,EAAEC,iBAAQ;AACV,EAAEC,oBAAW;AACb,CAAC;;;;"}
|
|
@@ -51,6 +51,11 @@ export declare const ElCarousel: import("@element-plus/nightly/es/utils").SFCWit
|
|
|
51
51
|
setActiveItem: (index: string | number) => void;
|
|
52
52
|
prev: () => void;
|
|
53
53
|
next: () => void;
|
|
54
|
+
PlaceholderItem: () => ({
|
|
55
|
+
[name: string]: unknown;
|
|
56
|
+
$stable?: boolean | undefined;
|
|
57
|
+
} | import("@element-plus/nightly/es/utils").VNodeChildAtom)[] | null;
|
|
58
|
+
isTwoLengthShow: (index: number) => boolean;
|
|
54
59
|
throttledArrowClick: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
55
60
|
throttledIndicatorHover: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
56
61
|
ns: {
|
|
@@ -51,6 +51,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
51
51
|
setActiveItem: (index: string | number) => void;
|
|
52
52
|
prev: () => void;
|
|
53
53
|
next: () => void;
|
|
54
|
+
PlaceholderItem: () => ({
|
|
55
|
+
[name: string]: unknown;
|
|
56
|
+
$stable?: boolean | undefined;
|
|
57
|
+
} | import("../../../utils").VNodeChildAtom)[] | null;
|
|
58
|
+
isTwoLengthShow: (index: number) => boolean;
|
|
54
59
|
throttledArrowClick: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
55
60
|
throttledIndicatorHover: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
56
61
|
ns: {
|
|
@@ -41,6 +41,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
41
41
|
setActiveItem,
|
|
42
42
|
prev,
|
|
43
43
|
next,
|
|
44
|
+
PlaceholderItem,
|
|
45
|
+
isTwoLengthShow,
|
|
44
46
|
throttledArrowClick,
|
|
45
47
|
throttledIndicatorHover
|
|
46
48
|
} = useCarousel.useCarousel(props, emit, COMPONENT_NAME);
|
|
@@ -138,6 +140,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
138
140
|
]),
|
|
139
141
|
_: 1
|
|
140
142
|
})) : vue.createCommentVNode("v-if", true),
|
|
143
|
+
vue.createVNode(vue.unref(PlaceholderItem)),
|
|
141
144
|
vue.renderSlot(_ctx.$slots, "default")
|
|
142
145
|
], 6),
|
|
143
146
|
_ctx.indicatorPosition !== "none" ? (vue.openBlock(), vue.createElementBlock("ul", {
|
|
@@ -145,7 +148,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
145
148
|
class: vue.normalizeClass(vue.unref(indicatorsClasses))
|
|
146
149
|
}, [
|
|
147
150
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item, index) => {
|
|
148
|
-
return vue.openBlock(), vue.createElementBlock("li", {
|
|
151
|
+
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
|
|
149
152
|
key: index,
|
|
150
153
|
class: vue.normalizeClass([
|
|
151
154
|
vue.unref(ns).e("indicator"),
|
|
@@ -160,7 +163,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
160
163
|
}, [
|
|
161
164
|
vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2, vue.toDisplayString(item.props.label), 1)) : vue.createCommentVNode("v-if", true)
|
|
162
165
|
], 2)
|
|
163
|
-
], 42, _hoisted_1)
|
|
166
|
+
], 42, _hoisted_1)), [
|
|
167
|
+
[vue.vShow, vue.unref(isTwoLengthShow)(index)]
|
|
168
|
+
]);
|
|
164
169
|
}), 128))
|
|
165
170
|
], 2)) : vue.createCommentVNode("v-if", true)
|
|
166
171
|
], 34);
|
|
@@ -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=\"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":";;;;;;;;;;;;;;;;
|
|
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 <PlaceholderItem />\n <slot />\n </div>\n <ul v-if=\"indicatorPosition !== 'none'\" :class=\"indicatorsClasses\">\n <li\n v-for=\"(item, index) in items\"\n v-show=\"isTwoLengthShow(index)\"\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 PlaceholderItem,\n isTwoLengthShow,\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":";;;;;;;;;;;;;;;;uCA0Ec,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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AC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -17,6 +17,7 @@ export declare const useCarousel: (props: CarouselProps, emit: SetupContext<Caro
|
|
|
17
17
|
height: string;
|
|
18
18
|
overflow: string;
|
|
19
19
|
}>;
|
|
20
|
+
isItemsTwoLength: import("vue").Ref<boolean>;
|
|
20
21
|
handleButtonEnter: (arrow: 'left' | 'right') => void;
|
|
21
22
|
handleButtonLeave: () => void;
|
|
22
23
|
handleIndicatorClick: (index: number) => void;
|
|
@@ -25,6 +26,11 @@ export declare const useCarousel: (props: CarouselProps, emit: SetupContext<Caro
|
|
|
25
26
|
setActiveItem: (index: number | string) => void;
|
|
26
27
|
prev: () => void;
|
|
27
28
|
next: () => void;
|
|
29
|
+
PlaceholderItem: () => ({
|
|
30
|
+
[name: string]: unknown;
|
|
31
|
+
$stable?: boolean | undefined;
|
|
32
|
+
} | import("@element-plus/nightly/es/utils").VNodeChildAtom)[] | null;
|
|
33
|
+
isTwoLengthShow: (index: number) => boolean;
|
|
28
34
|
throttledArrowClick: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
29
35
|
throttledIndicatorHover: import("lodash").DebouncedFunc<(index: number) => void>;
|
|
30
36
|
};
|
|
@@ -11,6 +11,7 @@ var constants = require('./constants.js');
|
|
|
11
11
|
var index = require('../../../hooks/use-ordered-children/index.js');
|
|
12
12
|
var shared = require('@vue/shared');
|
|
13
13
|
var error = require('../../../utils/error.js');
|
|
14
|
+
var vnode = require('../../../utils/vue/vnode.js');
|
|
14
15
|
|
|
15
16
|
const THROTTLE_TIME = 300;
|
|
16
17
|
const useCarousel = (props, emit, componentName) => {
|
|
@@ -19,11 +20,13 @@ const useCarousel = (props, emit, componentName) => {
|
|
|
19
20
|
addChild: addItem,
|
|
20
21
|
removeChild: removeItem
|
|
21
22
|
} = index.useOrderedChildren(vue.getCurrentInstance(), "ElCarouselItem");
|
|
23
|
+
const slots = vue.useSlots();
|
|
22
24
|
const activeIndex = vue.ref(-1);
|
|
23
25
|
const timer = vue.ref(null);
|
|
24
26
|
const hover = vue.ref(false);
|
|
25
27
|
const root = vue.ref();
|
|
26
28
|
const containerHeight = vue.ref(0);
|
|
29
|
+
const isItemsTwoLength = vue.ref(true);
|
|
27
30
|
const arrowDisplay = vue.computed(() => props.arrow !== "never" && !vue.unref(isVertical));
|
|
28
31
|
const hasLabel = vue.computed(() => {
|
|
29
32
|
return items.value.some((item) => item.props.label.toString().length > 0);
|
|
@@ -47,6 +50,11 @@ const useCarousel = (props, emit, componentName) => {
|
|
|
47
50
|
const throttledIndicatorHover = lodashUnified.throttle((index) => {
|
|
48
51
|
handleIndicatorHover(index);
|
|
49
52
|
}, THROTTLE_TIME);
|
|
53
|
+
const isTwoLengthShow = (index) => {
|
|
54
|
+
if (!isItemsTwoLength.value)
|
|
55
|
+
return true;
|
|
56
|
+
return activeIndex.value <= 1 ? index <= 1 : index > 1;
|
|
57
|
+
};
|
|
50
58
|
function pauseTimer() {
|
|
51
59
|
if (timer.value) {
|
|
52
60
|
clearInterval(timer.value);
|
|
@@ -165,8 +173,29 @@ const useCarousel = (props, emit, componentName) => {
|
|
|
165
173
|
return;
|
|
166
174
|
containerHeight.value = height;
|
|
167
175
|
}
|
|
176
|
+
function PlaceholderItem() {
|
|
177
|
+
var _a;
|
|
178
|
+
const defaultSlots = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
|
179
|
+
if (!defaultSlots)
|
|
180
|
+
return null;
|
|
181
|
+
const flatSlots = vnode.flattedChildren(defaultSlots);
|
|
182
|
+
const carouselItemsName = "ElCarouselItem";
|
|
183
|
+
const normalizeSlots = flatSlots.filter((slot) => {
|
|
184
|
+
return vue.isVNode(slot) && slot.type.name === carouselItemsName;
|
|
185
|
+
});
|
|
186
|
+
if ((normalizeSlots == null ? void 0 : normalizeSlots.length) === 2 && props.loop && !isCardType.value) {
|
|
187
|
+
isItemsTwoLength.value = true;
|
|
188
|
+
return normalizeSlots;
|
|
189
|
+
}
|
|
190
|
+
isItemsTwoLength.value = false;
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
168
193
|
vue.watch(() => activeIndex.value, (current, prev2) => {
|
|
169
194
|
resetItemPosition(prev2);
|
|
195
|
+
if (isItemsTwoLength.value) {
|
|
196
|
+
current = current % 2;
|
|
197
|
+
prev2 = prev2 % 2;
|
|
198
|
+
}
|
|
170
199
|
if (prev2 > -1) {
|
|
171
200
|
emit("change", current, prev2);
|
|
172
201
|
}
|
|
@@ -219,6 +248,7 @@ const useCarousel = (props, emit, componentName) => {
|
|
|
219
248
|
items,
|
|
220
249
|
isVertical,
|
|
221
250
|
containerStyle,
|
|
251
|
+
isItemsTwoLength,
|
|
222
252
|
handleButtonEnter,
|
|
223
253
|
handleButtonLeave,
|
|
224
254
|
handleIndicatorClick,
|
|
@@ -227,6 +257,8 @@ const useCarousel = (props, emit, componentName) => {
|
|
|
227
257
|
setActiveItem,
|
|
228
258
|
prev,
|
|
229
259
|
next,
|
|
260
|
+
PlaceholderItem,
|
|
261
|
+
isTwoLengthShow,
|
|
230
262
|
throttledArrowClick,
|
|
231
263
|
throttledIndicatorHover
|
|
232
264
|
};
|
|
@@ -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 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 const resizeObserver = shallowRef<ReturnType<typeof useResizeObserver>>()\n // lifecycle\n onMounted(() => {\n watch(\n () => items.value,\n () => {\n if (items.value.length > 0) setActiveItem(props.initialIndex)\n },\n {\n immediate: true,\n }\n )\n\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,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AACT,IAAI,IAAI,EAAE,KAAK,CAAC,IAAI;AACpB,IAAI,OAAO;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;;;;"}
|
|
1
|
+
{"version":3,"file":"use-carousel.js","sources":["../../../../../../packages/components/carousel/src/use-carousel.ts"],"sourcesContent":["import {\n computed,\n getCurrentInstance,\n isVNode,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n unref,\n useSlots,\n watch,\n} from 'vue'\nimport { throttle } from 'lodash-unified'\nimport { useResizeObserver } from '@vueuse/core'\nimport { debugWarn, flattedChildren, 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 const slots = useSlots()\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 const isItemsTwoLength = ref(true)\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 const isTwoLengthShow = (index: number) => {\n if (!isItemsTwoLength.value) return true\n return activeIndex.value <= 1 ? index <= 1 : index > 1\n }\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 function PlaceholderItem() {\n // fix: https://github.com/element-plus/element-plus/issues/12139\n const defaultSlots = slots.default?.()\n if (!defaultSlots) return null\n\n const flatSlots = flattedChildren(defaultSlots)\n\n const carouselItemsName = 'ElCarouselItem'\n\n const normalizeSlots = flatSlots.filter((slot) => {\n return isVNode(slot) && (slot.type as any).name === carouselItemsName\n })\n\n if (normalizeSlots?.length === 2 && props.loop && !isCardType.value) {\n isItemsTwoLength.value = true\n return normalizeSlots\n }\n isItemsTwoLength.value = false\n return null\n }\n\n // watch\n watch(\n () => activeIndex.value,\n (current, prev) => {\n resetItemPosition(prev)\n if (isItemsTwoLength.value) {\n current = current % 2\n prev = prev % 2\n }\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 const resizeObserver = shallowRef<ReturnType<typeof useResizeObserver>>()\n // lifecycle\n onMounted(() => {\n watch(\n () => items.value,\n () => {\n if (items.value.length > 0) setActiveItem(props.initialIndex)\n },\n {\n immediate: true,\n }\n )\n\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 isItemsTwoLength,\n handleButtonEnter,\n handleButtonLeave,\n handleIndicatorClick,\n handleMouseEnter,\n handleMouseLeave,\n setActiveItem,\n prev,\n next,\n PlaceholderItem,\n isTwoLengthShow,\n throttledArrowClick,\n throttledIndicatorHover,\n }\n}\n"],"names":["useOrderedChildren","getCurrentInstance","useSlots","ref","computed","unref","throttle","isString","debugWarn","flattedChildren","isVNode","watch","shallowRef","onMounted","useResizeObserver","onBeforeUnmount","provide","carouselContextKey"],"mappings":";;;;;;;;;;;;;;;AAkBA,M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C,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,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,gBAAgB;AACpB,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,eAAe;AACnB,IAAI,eAAe;AACnB,IAAI,mBAAmB;AACvB,IAAI,uBAAuB;AAC3B,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -5,6 +5,7 @@ export declare const ElCheckbox: import("@element-plus/nightly/es/utils").SFCWit
|
|
|
5
5
|
};
|
|
6
6
|
label: {
|
|
7
7
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
8
|
+
default: undefined;
|
|
8
9
|
};
|
|
9
10
|
indeterminate: BooleanConstructor;
|
|
10
11
|
disabled: BooleanConstructor;
|
|
@@ -49,6 +50,7 @@ export declare const ElCheckbox: import("@element-plus/nightly/es/utils").SFCWit
|
|
|
49
50
|
};
|
|
50
51
|
label: {
|
|
51
52
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
53
|
+
default: undefined;
|
|
52
54
|
};
|
|
53
55
|
indeterminate: BooleanConstructor;
|
|
54
56
|
disabled: BooleanConstructor;
|
|
@@ -132,6 +134,7 @@ export declare const ElCheckbox: import("@element-plus/nightly/es/utils").SFCWit
|
|
|
132
134
|
};
|
|
133
135
|
label: {
|
|
134
136
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
137
|
+
default: undefined;
|
|
135
138
|
};
|
|
136
139
|
indeterminate: BooleanConstructor;
|
|
137
140
|
disabled: BooleanConstructor;
|
|
@@ -173,6 +176,7 @@ export declare const ElCheckbox: import("@element-plus/nightly/es/utils").SFCWit
|
|
|
173
176
|
"onUpdate:modelValue"?: ((val: import("./src/checkbox").CheckboxValueType) => any) | undefined;
|
|
174
177
|
}, {
|
|
175
178
|
modelValue: string | number | boolean;
|
|
179
|
+
label: string | number | boolean | Record<string, any>;
|
|
176
180
|
id: string;
|
|
177
181
|
disabled: boolean;
|
|
178
182
|
name: string;
|
|
@@ -191,6 +195,7 @@ export declare const ElCheckbox: import("@element-plus/nightly/es/utils").SFCWit
|
|
|
191
195
|
};
|
|
192
196
|
label: {
|
|
193
197
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
198
|
+
default: undefined;
|
|
194
199
|
};
|
|
195
200
|
indeterminate: BooleanConstructor;
|
|
196
201
|
disabled: BooleanConstructor;
|
|
@@ -235,6 +240,7 @@ export declare const ElCheckbox: import("@element-plus/nightly/es/utils").SFCWit
|
|
|
235
240
|
};
|
|
236
241
|
label: {
|
|
237
242
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
243
|
+
default: undefined;
|
|
238
244
|
};
|
|
239
245
|
indeterminate: BooleanConstructor;
|
|
240
246
|
disabled: BooleanConstructor;
|
|
@@ -318,6 +324,7 @@ export declare const ElCheckbox: import("@element-plus/nightly/es/utils").SFCWit
|
|
|
318
324
|
};
|
|
319
325
|
label: {
|
|
320
326
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
327
|
+
default: undefined;
|
|
321
328
|
};
|
|
322
329
|
indeterminate: BooleanConstructor;
|
|
323
330
|
disabled: BooleanConstructor;
|
|
@@ -359,6 +366,7 @@ export declare const ElCheckbox: import("@element-plus/nightly/es/utils").SFCWit
|
|
|
359
366
|
"onUpdate:modelValue"?: ((val: import("./src/checkbox").CheckboxValueType) => any) | undefined;
|
|
360
367
|
}, {
|
|
361
368
|
modelValue: string | number | boolean;
|
|
369
|
+
label: string | number | boolean | Record<string, any>;
|
|
362
370
|
id: string;
|
|
363
371
|
disabled: boolean;
|
|
364
372
|
name: string;
|
|
@@ -468,6 +476,7 @@ export declare const ElCheckboxButton: import("@element-plus/nightly/es/utils").
|
|
|
468
476
|
};
|
|
469
477
|
label: {
|
|
470
478
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
479
|
+
default: undefined;
|
|
471
480
|
};
|
|
472
481
|
indeterminate: BooleanConstructor;
|
|
473
482
|
disabled: BooleanConstructor;
|
|
@@ -512,6 +521,7 @@ export declare const ElCheckboxButton: import("@element-plus/nightly/es/utils").
|
|
|
512
521
|
};
|
|
513
522
|
label: {
|
|
514
523
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
524
|
+
default: undefined;
|
|
515
525
|
};
|
|
516
526
|
indeterminate: BooleanConstructor;
|
|
517
527
|
disabled: BooleanConstructor;
|
|
@@ -595,6 +605,7 @@ export declare const ElCheckboxButton: import("@element-plus/nightly/es/utils").
|
|
|
595
605
|
};
|
|
596
606
|
label: {
|
|
597
607
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
608
|
+
default: undefined;
|
|
598
609
|
};
|
|
599
610
|
indeterminate: BooleanConstructor;
|
|
600
611
|
disabled: BooleanConstructor;
|
|
@@ -636,6 +647,7 @@ export declare const ElCheckboxButton: import("@element-plus/nightly/es/utils").
|
|
|
636
647
|
"onUpdate:modelValue"?: ((val: import("./src/checkbox").CheckboxValueType) => any) | undefined;
|
|
637
648
|
}, {
|
|
638
649
|
modelValue: string | number | boolean;
|
|
650
|
+
label: string | number | boolean | Record<string, any>;
|
|
639
651
|
id: string;
|
|
640
652
|
disabled: boolean;
|
|
641
653
|
name: string;
|
|
@@ -6,6 +6,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
6
6
|
};
|
|
7
7
|
label: {
|
|
8
8
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
9
|
+
default: undefined;
|
|
9
10
|
};
|
|
10
11
|
indeterminate: BooleanConstructor;
|
|
11
12
|
disabled: BooleanConstructor;
|
|
@@ -50,6 +51,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
50
51
|
};
|
|
51
52
|
label: {
|
|
52
53
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
54
|
+
default: undefined;
|
|
53
55
|
};
|
|
54
56
|
indeterminate: BooleanConstructor;
|
|
55
57
|
disabled: BooleanConstructor;
|
|
@@ -133,6 +135,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
133
135
|
};
|
|
134
136
|
label: {
|
|
135
137
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
138
|
+
default: undefined;
|
|
136
139
|
};
|
|
137
140
|
indeterminate: BooleanConstructor;
|
|
138
141
|
disabled: BooleanConstructor;
|
|
@@ -174,6 +177,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
174
177
|
"onUpdate:modelValue"?: ((val: import("./checkbox").CheckboxValueType) => any) | undefined;
|
|
175
178
|
}, {
|
|
176
179
|
modelValue: string | number | boolean;
|
|
180
|
+
label: string | number | boolean | Record<string, any>;
|
|
177
181
|
id: string;
|
|
178
182
|
disabled: boolean;
|
|
179
183
|
name: string;
|
|
@@ -14,6 +14,7 @@ export declare const checkboxProps: {
|
|
|
14
14
|
*/
|
|
15
15
|
label: {
|
|
16
16
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
17
|
+
default: undefined;
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
19
20
|
* @description Set indeterminate state, only responsible for style control
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sources":["../../../../../../packages/components/checkbox/src/checkbox.ts"],"sourcesContent":["import { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useSizeProp } from '@element-plus/hooks'\nimport { isBoolean, isNumber, isString } from '@element-plus/utils'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type Checkbox from './checkbox.vue'\n\nexport type CheckboxValueType = string | number | boolean\n\nexport const checkboxProps = {\n /**\n * @description binding value\n */\n modelValue: {\n type: [Number, String, Boolean],\n default: undefined,\n },\n /**\n * @description value of the Checkbox when used inside a `checkbox-group`\n */\n label: {\n type: [String, Boolean, Number, Object],\n },\n /**\n * @description Set indeterminate state, only responsible for style control\n */\n indeterminate: Boolean,\n /**\n * @description whether the Checkbox is disabled\n */\n disabled: Boolean,\n /**\n * @description if the Checkbox is checked\n */\n checked: Boolean,\n /**\n * @description native 'name' attribute\n */\n name: {\n type: String,\n default: undefined,\n },\n /**\n * @description value of the Checkbox if it's checked\n */\n trueLabel: {\n type: [String, Number],\n default: undefined,\n },\n /**\n * @description value of the Checkbox if it's not checked\n */\n falseLabel: {\n type: [String, Number],\n default: undefined,\n },\n /**\n * @description input id\n */\n id: {\n type: String,\n default: undefined,\n },\n /**\n * @description same as [aria-controls](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls), takes effect when `indeterminate` is `true`\n */\n controls: {\n type: String,\n default: undefined,\n },\n /**\n * @description whether to add a border around Checkbox\n */\n border: Boolean,\n /**\n * @description size of the Checkbox\n */\n size: useSizeProp,\n /**\n * @description input tabindex\n */\n tabindex: [String, Number],\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n}\n\nexport const checkboxEmits = {\n [UPDATE_MODEL_EVENT]: (val: CheckboxValueType) =>\n isString(val) || isNumber(val) || isBoolean(val),\n change: (val: CheckboxValueType) =>\n isString(val) || isNumber(val) || isBoolean(val),\n}\n\nexport type CheckboxProps = ExtractPropTypes<typeof checkboxProps>\nexport type CheckboxEmits = typeof checkboxEmits\nexport type CheckboxInstance = InstanceType<typeof Checkbox>\n"],"names":["useSizeProp","UPDATE_MODEL_EVENT","isString","isNumber","isBoolean"],"mappings":";;;;;;;;;;;;AAGY,MAAC,aAAa,GAAG;AAC7B,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;AACnC,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;AAC3C,GAAG;AACH,EAAE,aAAa,EAAE,OAAO;AACxB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,OAAO,EAAE,OAAO;AAClB,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,EAAE,EAAE;AACN,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,IAAI,EAAEA,iBAAW;AACnB,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC5B,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE;AACU,MAAC,aAAa,GAAG;AAC7B,EAAE,CAACC,wBAAkB,GAAG,CAAC,GAAG,KAAKC,eAAQ,CAAC,GAAG,CAAC,IAAIC,cAAQ,CAAC,GAAG,CAAC,IAAIC,eAAS,CAAC,GAAG,CAAC;AACjF,EAAE,MAAM,EAAE,CAAC,GAAG,KAAKF,eAAQ,CAAC,GAAG,CAAC,IAAIC,cAAQ,CAAC,GAAG,CAAC,IAAIC,eAAS,CAAC,GAAG,CAAC;AACnE;;;;;"}
|
|
1
|
+
{"version":3,"file":"checkbox.js","sources":["../../../../../../packages/components/checkbox/src/checkbox.ts"],"sourcesContent":["import { UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport { useSizeProp } from '@element-plus/hooks'\nimport { isBoolean, isNumber, isString } from '@element-plus/utils'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type Checkbox from './checkbox.vue'\n\nexport type CheckboxValueType = string | number | boolean\n\nexport const checkboxProps = {\n /**\n * @description binding value\n */\n modelValue: {\n type: [Number, String, Boolean],\n default: undefined,\n },\n /**\n * @description value of the Checkbox when used inside a `checkbox-group`\n */\n label: {\n type: [String, Boolean, Number, Object],\n default: undefined,\n },\n /**\n * @description Set indeterminate state, only responsible for style control\n */\n indeterminate: Boolean,\n /**\n * @description whether the Checkbox is disabled\n */\n disabled: Boolean,\n /**\n * @description if the Checkbox is checked\n */\n checked: Boolean,\n /**\n * @description native 'name' attribute\n */\n name: {\n type: String,\n default: undefined,\n },\n /**\n * @description value of the Checkbox if it's checked\n */\n trueLabel: {\n type: [String, Number],\n default: undefined,\n },\n /**\n * @description value of the Checkbox if it's not checked\n */\n falseLabel: {\n type: [String, Number],\n default: undefined,\n },\n /**\n * @description input id\n */\n id: {\n type: String,\n default: undefined,\n },\n /**\n * @description same as [aria-controls](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-controls), takes effect when `indeterminate` is `true`\n */\n controls: {\n type: String,\n default: undefined,\n },\n /**\n * @description whether to add a border around Checkbox\n */\n border: Boolean,\n /**\n * @description size of the Checkbox\n */\n size: useSizeProp,\n /**\n * @description input tabindex\n */\n tabindex: [String, Number],\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n}\n\nexport const checkboxEmits = {\n [UPDATE_MODEL_EVENT]: (val: CheckboxValueType) =>\n isString(val) || isNumber(val) || isBoolean(val),\n change: (val: CheckboxValueType) =>\n isString(val) || isNumber(val) || isBoolean(val),\n}\n\nexport type CheckboxProps = ExtractPropTypes<typeof checkboxProps>\nexport type CheckboxEmits = typeof checkboxEmits\nexport type CheckboxInstance = InstanceType<typeof Checkbox>\n"],"names":["useSizeProp","UPDATE_MODEL_EVENT","isString","isNumber","isBoolean"],"mappings":";;;;;;;;;;;;AAGY,MAAC,aAAa,GAAG;AAC7B,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;AACnC,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;AAC3C,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,aAAa,EAAE,OAAO;AACxB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,OAAO,EAAE,OAAO;AAClB,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,EAAE,EAAE;AACN,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK,CAAC;AACnB,GAAG;AACH,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,IAAI,EAAEA,iBAAW;AACnB,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC5B,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE;AACU,MAAC,aAAa,GAAG;AAC7B,EAAE,CAACC,wBAAkB,GAAG,CAAC,GAAG,KAAKC,eAAQ,CAAC,GAAG,CAAC,IAAIC,cAAQ,CAAC,GAAG,CAAC,IAAIC,eAAS,CAAC,GAAG,CAAC;AACjF,EAAE,MAAM,EAAE,CAAC,GAAG,KAAKF,eAAQ,CAAC,GAAG,CAAC,IAAIC,cAAQ,CAAC,GAAG,CAAC,IAAIC,eAAS,CAAC,GAAG,CAAC;AACnE;;;;;"}
|
|
@@ -5,6 +5,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
5
5
|
};
|
|
6
6
|
label: {
|
|
7
7
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
8
|
+
default: undefined;
|
|
8
9
|
};
|
|
9
10
|
indeterminate: BooleanConstructor;
|
|
10
11
|
disabled: BooleanConstructor;
|
|
@@ -49,6 +50,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
49
50
|
};
|
|
50
51
|
label: {
|
|
51
52
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
53
|
+
default: undefined;
|
|
52
54
|
};
|
|
53
55
|
indeterminate: BooleanConstructor;
|
|
54
56
|
disabled: BooleanConstructor;
|
|
@@ -132,6 +134,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
132
134
|
};
|
|
133
135
|
label: {
|
|
134
136
|
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
|
|
137
|
+
default: undefined;
|
|
135
138
|
};
|
|
136
139
|
indeterminate: BooleanConstructor;
|
|
137
140
|
disabled: BooleanConstructor;
|
|
@@ -173,6 +176,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
173
176
|
"onUpdate:modelValue"?: ((val: import("./checkbox").CheckboxValueType) => any) | undefined;
|
|
174
177
|
}, {
|
|
175
178
|
modelValue: string | number | boolean;
|
|
179
|
+
label: string | number | boolean | Record<string, any>;
|
|
176
180
|
id: string;
|
|
177
181
|
disabled: boolean;
|
|
178
182
|
name: string;
|
|
@@ -41,7 +41,7 @@ const useCheckboxStatus = (props, slots, { model }) => {
|
|
|
41
41
|
return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
|
|
42
42
|
}));
|
|
43
43
|
const hasOwnLabel = vue.computed(() => {
|
|
44
|
-
return !!
|
|
44
|
+
return !!slots.default || !lodashUnified.isNil(props.label);
|
|
45
45
|
});
|
|
46
46
|
return {
|
|
47
47
|
checkboxButtonSize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-checkbox-status.js","sources":["../../../../../../../packages/components/checkbox/src/composables/use-checkbox-status.ts"],"sourcesContent":["import { computed, inject, ref, toRaw } from 'vue'\nimport { isEqual } from 'lodash-unified'\nimport { useFormSize } from '@element-plus/components/form'\nimport { isArray, isBoolean, isObject } from '@element-plus/utils'\nimport { checkboxGroupContextKey } from '../constants'\n\nimport type { ComponentInternalInstance } from 'vue'\nimport type { CheckboxProps } from '../checkbox'\nimport type { CheckboxModel } from '../composables'\n\nexport const useCheckboxStatus = (\n props: CheckboxProps,\n slots: ComponentInternalInstance['slots'],\n { model }: Pick<CheckboxModel, 'model'>\n) => {\n const checkboxGroup = inject(checkboxGroupContextKey, undefined)\n const isFocused = ref(false)\n const isChecked = computed<boolean>(() => {\n const value = model.value\n if (isBoolean(value)) {\n return value\n } else if (isArray(value)) {\n if (isObject(props.label)) {\n return value.map(toRaw).some((o) => isEqual(o, props.label))\n } else {\n return value.map(toRaw).includes(props.label)\n }\n } else if (value !== null && value !== undefined) {\n return value === props.trueLabel\n } else {\n return !!value\n }\n })\n\n const checkboxButtonSize = useFormSize(\n computed(() => checkboxGroup?.size?.value),\n {\n prop: true,\n }\n )\n const checkboxSize = useFormSize(computed(() => checkboxGroup?.size?.value))\n\n const hasOwnLabel = computed<boolean>(() => {\n return !!
|
|
1
|
+
{"version":3,"file":"use-checkbox-status.js","sources":["../../../../../../../packages/components/checkbox/src/composables/use-checkbox-status.ts"],"sourcesContent":["import { computed, inject, ref, toRaw } from 'vue'\nimport { isEqual, isNil } from 'lodash-unified'\nimport { useFormSize } from '@element-plus/components/form'\nimport { isArray, isBoolean, isObject } from '@element-plus/utils'\nimport { checkboxGroupContextKey } from '../constants'\n\nimport type { ComponentInternalInstance } from 'vue'\nimport type { CheckboxProps } from '../checkbox'\nimport type { CheckboxModel } from '../composables'\n\nexport const useCheckboxStatus = (\n props: CheckboxProps,\n slots: ComponentInternalInstance['slots'],\n { model }: Pick<CheckboxModel, 'model'>\n) => {\n const checkboxGroup = inject(checkboxGroupContextKey, undefined)\n const isFocused = ref(false)\n const isChecked = computed<boolean>(() => {\n const value = model.value\n if (isBoolean(value)) {\n return value\n } else if (isArray(value)) {\n if (isObject(props.label)) {\n return value.map(toRaw).some((o) => isEqual(o, props.label))\n } else {\n return value.map(toRaw).includes(props.label)\n }\n } else if (value !== null && value !== undefined) {\n return value === props.trueLabel\n } else {\n return !!value\n }\n })\n\n const checkboxButtonSize = useFormSize(\n computed(() => checkboxGroup?.size?.value),\n {\n prop: true,\n }\n )\n const checkboxSize = useFormSize(computed(() => checkboxGroup?.size?.value))\n\n const hasOwnLabel = computed<boolean>(() => {\n return !!slots.default || !isNil(props.label)\n })\n\n return {\n checkboxButtonSize,\n isChecked,\n isFocused,\n checkboxSize,\n hasOwnLabel,\n }\n}\n\nexport type CheckboxStatus = ReturnType<typeof useCheckboxStatus>\n"],"names":["inject","checkboxGroupContextKey","ref","computed","isBoolean","isArray","isObject","toRaw","isEqual","useFormSize","isNil"],"mappings":";;;;;;;;;;;;;AAKY,MAAC,iBAAiB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK;AAC9D,EAAE,MAAM,aAAa,GAAGA,UAAM,CAACC,iCAAuB,EAAE,KAAK,CAAC,CAAC,CAAC;AAChE,EAAE,MAAM,SAAS,GAAGC,OAAG,CAAC,KAAK,CAAC,CAAC;AAC/B,EAAE,MAAM,SAAS,GAAGC,YAAQ,CAAC,MAAM;AACnC,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;AAC9B,IAAI,IAAIC,eAAS,CAAC,KAAK,CAAC,EAAE;AAC1B,MAAM,OAAO,KAAK,CAAC;AACnB,KAAK,MAAM,IAAIC,cAAO,CAAC,KAAK,CAAC,EAAE;AAC/B,MAAM,IAAIC,eAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;AACjC,QAAQ,OAAO,KAAK,CAAC,GAAG,CAACC,SAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAKC,qBAAO,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAA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