@element-plus/nightly 0.0.20240305 → 0.0.20240307
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/dist/index.full.js +67 -62
- package/dist/index.full.min.js +3 -3
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +3 -3
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +67 -62
- 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-eg.js +1 -1
- package/dist/locale/ar-eg.min.js +1 -1
- package/dist/locale/ar-eg.min.mjs +1 -1
- package/dist/locale/ar-eg.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/sw.js +1 -1
- package/dist/locale/sw.min.js +1 -1
- package/dist/locale/sw.min.mjs +1 -1
- package/dist/locale/sw.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 +2 -2
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.js.map +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.min.mjs.map +1 -1
- package/dist/locale/zh-tw.mjs +2 -2
- package/es/components/anchor/index.mjs +2 -2
- package/es/components/anchor/src/anchor.mjs +193 -38
- package/es/components/anchor/src/anchor.mjs.map +1 -1
- package/es/components/anchor/src/anchor2.mjs +38 -193
- package/es/components/anchor/src/anchor2.mjs.map +1 -1
- package/es/components/check-tag/index.mjs +2 -2
- package/es/components/check-tag/src/check-tag.mjs +17 -35
- package/es/components/check-tag/src/check-tag.mjs.map +1 -1
- package/es/components/check-tag/src/check-tag2.mjs +35 -17
- package/es/components/check-tag/src/check-tag2.mjs.map +1 -1
- package/es/components/checkbox/src/checkbox-button.mjs +3 -2
- package/es/components/checkbox/src/checkbox-button.mjs.map +1 -1
- package/es/components/checkbox/src/checkbox2.mjs +58 -55
- package/es/components/checkbox/src/checkbox2.mjs.map +1 -1
- package/es/components/checkbox/src/composables/use-checkbox-event.mjs +2 -2
- package/es/components/checkbox/src/composables/use-checkbox-event.mjs.map +1 -1
- package/es/components/checkbox/src/composables/use-checkbox.mjs +2 -1
- package/es/components/checkbox/src/composables/use-checkbox.mjs.map +1 -1
- package/es/components/index.mjs +2 -2
- package/es/components/pagination/src/components/pager.mjs +17 -216
- package/es/components/pagination/src/components/pager.mjs.map +1 -1
- package/es/components/pagination/src/components/pager2.mjs +216 -17
- package/es/components/pagination/src/components/pager2.mjs.map +1 -1
- package/es/components/pagination/src/pagination.mjs +1 -1
- package/es/index.mjs +2 -2
- package/es/locale/lang/zh-tw.mjs +1 -1
- package/es/locale/lang/zh-tw.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/anchor/index.js +2 -2
- package/lib/components/anchor/src/anchor.js +192 -38
- package/lib/components/anchor/src/anchor.js.map +1 -1
- package/lib/components/anchor/src/anchor2.js +38 -192
- package/lib/components/anchor/src/anchor2.js.map +1 -1
- package/lib/components/check-tag/index.js +2 -2
- package/lib/components/check-tag/src/check-tag.js +18 -35
- package/lib/components/check-tag/src/check-tag.js.map +1 -1
- package/lib/components/check-tag/src/check-tag2.js +35 -18
- package/lib/components/check-tag/src/check-tag2.js.map +1 -1
- package/lib/components/checkbox/src/checkbox-button.js +3 -2
- package/lib/components/checkbox/src/checkbox-button.js.map +1 -1
- package/lib/components/checkbox/src/checkbox2.js +58 -55
- package/lib/components/checkbox/src/checkbox2.js.map +1 -1
- package/lib/components/checkbox/src/composables/use-checkbox-event.js +2 -2
- package/lib/components/checkbox/src/composables/use-checkbox-event.js.map +1 -1
- package/lib/components/checkbox/src/composables/use-checkbox.js +2 -1
- package/lib/components/checkbox/src/composables/use-checkbox.js.map +1 -1
- package/lib/components/index.js +2 -2
- package/lib/components/pagination/src/components/pager.js +17 -216
- package/lib/components/pagination/src/components/pager.js.map +1 -1
- package/lib/components/pagination/src/components/pager2.js +216 -17
- package/lib/components/pagination/src/components/pager2.js.map +1 -1
- package/lib/components/pagination/src/pagination.js +1 -1
- package/lib/index.js +2 -2
- package/lib/locale/lang/zh-tw.js +1 -1
- package/lib/locale/lang/zh-tw.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/web-types.json +1 -1
|
@@ -2,28 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('
|
|
5
|
+
var vue = require('vue');
|
|
6
6
|
require('../../../constants/index.js');
|
|
7
|
-
|
|
8
|
-
var
|
|
7
|
+
require('../../../hooks/index.js');
|
|
8
|
+
var checkTag = require('./check-tag.js');
|
|
9
|
+
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
10
|
+
var index = require('../../../hooks/use-namespace/index.js');
|
|
9
11
|
var event = require('../../../constants/event.js');
|
|
10
12
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const __default__ = vue.defineComponent({
|
|
14
|
+
name: "ElCheckTag"
|
|
15
|
+
});
|
|
16
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
17
|
+
...__default__,
|
|
18
|
+
props: checkTag.checkTagProps,
|
|
19
|
+
emits: checkTag.checkTagEmits,
|
|
20
|
+
setup(__props, { emit }) {
|
|
21
|
+
const props = __props;
|
|
22
|
+
const ns = index.useNamespace("check-tag");
|
|
23
|
+
const containerKls = vue.computed(() => [
|
|
24
|
+
ns.b(),
|
|
25
|
+
ns.is("checked", props.checked),
|
|
26
|
+
ns.m(props.type || "primary")
|
|
27
|
+
]);
|
|
28
|
+
const handleChange = () => {
|
|
29
|
+
const checked = !props.checked;
|
|
30
|
+
emit(event.CHANGE_EVENT, checked);
|
|
31
|
+
emit("update:checked", checked);
|
|
32
|
+
};
|
|
33
|
+
return (_ctx, _cache) => {
|
|
34
|
+
return vue.openBlock(), vue.createElementBlock("span", {
|
|
35
|
+
class: vue.normalizeClass(vue.unref(containerKls)),
|
|
36
|
+
onClick: handleChange
|
|
37
|
+
}, [
|
|
38
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
39
|
+
], 2);
|
|
40
|
+
};
|
|
20
41
|
}
|
|
21
42
|
});
|
|
22
|
-
|
|
23
|
-
"update:checked": (value) => types.isBoolean(value),
|
|
24
|
-
[event.CHANGE_EVENT]: (value) => types.isBoolean(value)
|
|
25
|
-
};
|
|
43
|
+
var CheckTag = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "check-tag.vue"]]);
|
|
26
44
|
|
|
27
|
-
exports
|
|
28
|
-
exports.checkTagProps = checkTagProps;
|
|
45
|
+
exports["default"] = CheckTag;
|
|
29
46
|
//# sourceMappingURL=check-tag2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-tag2.js","sources":["../../../../../../packages/components/check-tag/src/check-tag.
|
|
1
|
+
{"version":3,"file":"check-tag2.js","sources":["../../../../../../packages/components/check-tag/src/check-tag.vue"],"sourcesContent":["<template>\n <span :class=\"containerKls\" @click=\"handleChange\">\n <slot />\n </span>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { CHANGE_EVENT } from '@element-plus/constants'\nimport { useNamespace } from '@element-plus/hooks'\nimport { checkTagEmits, checkTagProps } from './check-tag'\n\ndefineOptions({\n name: 'ElCheckTag',\n})\nconst props = defineProps(checkTagProps)\nconst emit = defineEmits(checkTagEmits)\n\nconst ns = useNamespace('check-tag')\nconst containerKls = computed(() => [\n ns.b(),\n ns.is('checked', props.checked),\n ns.m(props.type || 'primary'),\n])\n\nconst handleChange = () => {\n const checked = !props.checked\n emit(CHANGE_EVENT, checked)\n emit('update:checked', checked)\n}\n</script>\n"],"names":["useNamespace","computed","CHANGE_EVENT"],"mappings":";;;;;;;;;;;;uCAYc,CAAA;AAAA,EACZ,IAAM,EAAA,YAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAIA,IAAM,MAAA,EAAA,GAAKA,mBAAa,WAAW,CAAA,CAAA;AACnC,IAAM,MAAA,YAAA,GAAeC,aAAS,MAAM;AAAA,MAClC,GAAG,CAAE,EAAA;AAAA,MACL,EAAG,CAAA,EAAA,CAAG,SAAW,EAAA,KAAA,CAAM,OAAO,CAAA;AAAA,MAC9B,EAAG,CAAA,CAAA,CAAE,KAAM,CAAA,IAAA,IAAQ,SAAS,CAAA;AAAA,KAC7B,CAAA,CAAA;AAED,IAAA,MAAM,eAAe,MAAM;AACzB,MAAM,MAAA,OAAA,GAAU,CAAC,KAAM,CAAA,OAAA,CAAA;AACvB,MAAA,IAAA,CAAKC,oBAAc,OAAO,CAAA,CAAA;AAC1B,MAAA,IAAA,CAAK,kBAAkB,OAAO,CAAA,CAAA;AAAA,KAChC,CAAA;;;;;;;;;;;;;;;"}
|
|
@@ -54,6 +54,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
54
54
|
];
|
|
55
55
|
});
|
|
56
56
|
return (_ctx, _cache) => {
|
|
57
|
+
var _a, _b;
|
|
57
58
|
return vue.openBlock(), vue.createElementBlock("label", {
|
|
58
59
|
class: vue.normalizeClass(vue.unref(labelKls))
|
|
59
60
|
}, [
|
|
@@ -65,8 +66,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
65
66
|
name: _ctx.name,
|
|
66
67
|
tabindex: _ctx.tabindex,
|
|
67
68
|
disabled: vue.unref(isDisabled),
|
|
68
|
-
"true-value": _ctx.trueValue
|
|
69
|
-
"false-value": _ctx.falseValue
|
|
69
|
+
"true-value": (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel,
|
|
70
|
+
"false-value": (_b = _ctx.falseValue) != null ? _b : _ctx.falseLabel,
|
|
70
71
|
onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
|
|
71
72
|
onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
|
|
72
73
|
onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-button.js","sources":["../../../../../../packages/components/checkbox/src/checkbox-button.vue"],"sourcesContent":["<template>\n <label :class=\"labelKls\">\n <input\n v-if=\"trueValue || falseValue || trueLabel || falseLabel\"\n v-model=\"model\"\n :class=\"ns.be('button', 'original')\"\n type=\"checkbox\"\n :name=\"name\"\n :tabindex=\"tabindex\"\n :disabled=\"isDisabled\"\n :true-value=\"trueValue
|
|
1
|
+
{"version":3,"file":"checkbox-button.js","sources":["../../../../../../packages/components/checkbox/src/checkbox-button.vue"],"sourcesContent":["<template>\n <label :class=\"labelKls\">\n <input\n v-if=\"trueValue || falseValue || trueLabel || falseLabel\"\n v-model=\"model\"\n :class=\"ns.be('button', 'original')\"\n type=\"checkbox\"\n :name=\"name\"\n :tabindex=\"tabindex\"\n :disabled=\"isDisabled\"\n :true-value=\"trueValue ?? trueLabel\"\n :false-value=\"falseValue ?? falseLabel\"\n @change=\"handleChange\"\n @focus=\"isFocused = true\"\n @blur=\"isFocused = false\"\n @click.stop\n />\n <input\n v-else\n v-model=\"model\"\n :class=\"ns.be('button', 'original')\"\n type=\"checkbox\"\n :name=\"name\"\n :tabindex=\"tabindex\"\n :disabled=\"isDisabled\"\n :value=\"actualValue\"\n @change=\"handleChange\"\n @focus=\"isFocused = true\"\n @blur=\"isFocused = false\"\n @click.stop\n />\n\n <span\n v-if=\"$slots.default || label\"\n :class=\"ns.be('button', 'inner')\"\n :style=\"isChecked ? activeStyle : undefined\"\n >\n <slot>{{ label }}</slot>\n </span>\n </label>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, useSlots } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { checkboxGroupContextKey } from './constants'\nimport { useCheckbox } from './composables'\nimport { checkboxEmits, checkboxProps } from './checkbox'\n\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'ElCheckboxButton',\n})\n\nconst props = defineProps(checkboxProps)\ndefineEmits(checkboxEmits)\nconst slots = useSlots()\n\nconst {\n isFocused,\n isChecked,\n isDisabled,\n checkboxButtonSize,\n model,\n actualValue,\n handleChange,\n} = useCheckbox(props, slots)\nconst checkboxGroup = inject(checkboxGroupContextKey, undefined)\nconst ns = useNamespace('checkbox')\n\nconst activeStyle = computed<CSSProperties>(() => {\n const fillValue = checkboxGroup?.fill?.value ?? ''\n return {\n backgroundColor: fillValue,\n borderColor: fillValue,\n color: checkboxGroup?.textColor?.value ?? '',\n boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : undefined,\n }\n})\n\nconst labelKls = computed(() => {\n return [\n ns.b('button'),\n ns.bm('button', checkboxButtonSize.value),\n ns.is('disabled', isDisabled.value),\n ns.is('checked', isChecked.value),\n ns.is('focus', isFocused.value),\n ]\n})\n</script>\n"],"names":["useSlots","useCheckbox","inject","checkboxGroupContextKey","useNamespace","computed"],"mappings":";;;;;;;;;;;;;;;uCAmDc,CAAA;AAAA,EACZ,IAAM,EAAA,kBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAIA,IAAA,MAAM,QAAQA,YAAS,EAAA,CAAA;AAEvB,IAAM,MAAA;AAAA,MACJ,SAAA;AAAA,MACA,SAAA;AAAA,MACA,UAAA;AAAA,MACA,kBAAA;AAAA,MACA,KAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,KACE,GAAAC,uBAAA,CAAY,OAAO,KAAK,CAAA,CAAA;AAC5B,IAAM,MAAA,aAAA,GAAgBC,UAAO,CAAAC,iCAAA,EAAyB,KAAS,CAAA,CAAA,CAAA;AAC/D,IAAM,MAAA,EAAA,GAAKC,mBAAa,UAAU,CAAA,CAAA;AAElC,IAAM,MAAA,WAAA,GAAcC,aAAwB,MAAM;AAChD,MAAM,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAY,CAAe;AACjC,MAAO,MAAA,SAAA,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,aAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,aAAA,CAAA,IAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAA,KAAA,IAAA,GAAA,EAAA,GAAA,EAAA,CAAA;AAAA,MAAA,OACY;AAAA,QACjB,eAAa,EAAA,SAAA;AAAA,QACb,WAAsB,EAAA,SAAA;AAAoB,QAC1C,KAAA,EAAA,CAAA,EAAA,GAAuB,CAAA,EAAA,GAAA,aAAA,IAAA,IAA4B,GAAA,KAAA,CAAA,GAAA,aAAA,CAAA,SAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAA,KAAA,IAAA,GAAA,EAAA,GAAA,EAAA;AAAA,QACrD,SAAA,EAAA,SAAA,GAAA,CAAA,WAAA,EAAA,SAAA,CAAA,CAAA,GAAA,KAAA,CAAA;AAAA,OACD,CAAA;AAED,KAAM,CAAA,CAAA;AACJ,IAAO,MAAA,QAAA,GAAAA,YAAA,CAAA,MAAA;AAAA,MACL,OAAK;AAAQ,QACb,EAAG,CAAA,CAAA,CAAA,QAAa,CAAA;AAAwB,QACxC,EAAG,CAAA,EAAA,CAAG,QAAY,EAAA,kBAAgB,CAAA,KAAA,CAAA;AAAA,QAClC,EAAG,CAAA,EAAA,CAAG,UAAW,EAAA,UAAe,CAAA,KAAA,CAAA;AAAA,QAChC,EAAG,CAAA,EAAA,CAAG,SAAS,EAAA,SAAe,CAAA,KAAA,CAAA;AAAA,QAChC,EAAA,CAAA,EAAA,CAAA,OAAA,EAAA,SAAA,CAAA,KAAA,CAAA;AAAA,OACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -60,62 +60,65 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
60
60
|
"aria-controls": _ctx.indeterminate ? _ctx.controls : null,
|
|
61
61
|
onClick: vue.unref(onClickRoot)
|
|
62
62
|
}, {
|
|
63
|
-
default: vue.withCtx(() =>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}, [
|
|
67
|
-
_ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
|
|
68
|
-
key: 0,
|
|
69
|
-
id: vue.unref(inputId),
|
|
70
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null),
|
|
71
|
-
class: vue.normalizeClass(vue.unref(ns).e("original")),
|
|
72
|
-
type: "checkbox",
|
|
73
|
-
indeterminate: _ctx.indeterminate,
|
|
74
|
-
name: _ctx.name,
|
|
75
|
-
tabindex: _ctx.tabindex,
|
|
76
|
-
disabled: vue.unref(isDisabled),
|
|
77
|
-
"true-value": _ctx.trueValue || _ctx.trueLabel,
|
|
78
|
-
"false-value": _ctx.falseValue || _ctx.falseLabel,
|
|
79
|
-
onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
|
|
80
|
-
onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
|
|
81
|
-
onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
|
|
82
|
-
onClick: _cache[4] || (_cache[4] = vue.withModifiers(() => {
|
|
83
|
-
}, ["stop"]))
|
|
84
|
-
}, null, 42, _hoisted_1)), [
|
|
85
|
-
[vue.vModelCheckbox, vue.unref(model)]
|
|
86
|
-
]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
|
|
87
|
-
key: 1,
|
|
88
|
-
id: vue.unref(inputId),
|
|
89
|
-
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.isRef(model) ? model.value = $event : null),
|
|
90
|
-
class: vue.normalizeClass(vue.unref(ns).e("original")),
|
|
91
|
-
type: "checkbox",
|
|
92
|
-
indeterminate: _ctx.indeterminate,
|
|
93
|
-
disabled: vue.unref(isDisabled),
|
|
94
|
-
value: vue.unref(actualValue),
|
|
95
|
-
name: _ctx.name,
|
|
96
|
-
tabindex: _ctx.tabindex,
|
|
97
|
-
onChange: _cache[6] || (_cache[6] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
|
|
98
|
-
onFocus: _cache[7] || (_cache[7] = ($event) => isFocused.value = true),
|
|
99
|
-
onBlur: _cache[8] || (_cache[8] = ($event) => isFocused.value = false),
|
|
100
|
-
onClick: _cache[9] || (_cache[9] = vue.withModifiers(() => {
|
|
101
|
-
}, ["stop"]))
|
|
102
|
-
}, null, 42, _hoisted_2)), [
|
|
103
|
-
[vue.vModelCheckbox, vue.unref(model)]
|
|
104
|
-
]),
|
|
63
|
+
default: vue.withCtx(() => {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
return [
|
|
105
66
|
vue.createElementVNode("span", {
|
|
106
|
-
class: vue.normalizeClass(vue.unref(
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
67
|
+
class: vue.normalizeClass(vue.unref(spanKls))
|
|
68
|
+
}, [
|
|
69
|
+
_ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
|
|
70
|
+
key: 0,
|
|
71
|
+
id: vue.unref(inputId),
|
|
72
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null),
|
|
73
|
+
class: vue.normalizeClass(vue.unref(ns).e("original")),
|
|
74
|
+
type: "checkbox",
|
|
75
|
+
indeterminate: _ctx.indeterminate,
|
|
76
|
+
name: _ctx.name,
|
|
77
|
+
tabindex: _ctx.tabindex,
|
|
78
|
+
disabled: vue.unref(isDisabled),
|
|
79
|
+
"true-value": (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel,
|
|
80
|
+
"false-value": (_b = _ctx.falseValue) != null ? _b : _ctx.falseLabel,
|
|
81
|
+
onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
|
|
82
|
+
onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
|
|
83
|
+
onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
|
|
84
|
+
onClick: _cache[4] || (_cache[4] = vue.withModifiers(() => {
|
|
85
|
+
}, ["stop"]))
|
|
86
|
+
}, null, 42, _hoisted_1)), [
|
|
87
|
+
[vue.vModelCheckbox, vue.unref(model)]
|
|
88
|
+
]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
|
|
89
|
+
key: 1,
|
|
90
|
+
id: vue.unref(inputId),
|
|
91
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.isRef(model) ? model.value = $event : null),
|
|
92
|
+
class: vue.normalizeClass(vue.unref(ns).e("original")),
|
|
93
|
+
type: "checkbox",
|
|
94
|
+
indeterminate: _ctx.indeterminate,
|
|
95
|
+
disabled: vue.unref(isDisabled),
|
|
96
|
+
value: vue.unref(actualValue),
|
|
97
|
+
name: _ctx.name,
|
|
98
|
+
tabindex: _ctx.tabindex,
|
|
99
|
+
onChange: _cache[6] || (_cache[6] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
|
|
100
|
+
onFocus: _cache[7] || (_cache[7] = ($event) => isFocused.value = true),
|
|
101
|
+
onBlur: _cache[8] || (_cache[8] = ($event) => isFocused.value = false),
|
|
102
|
+
onClick: _cache[9] || (_cache[9] = vue.withModifiers(() => {
|
|
103
|
+
}, ["stop"]))
|
|
104
|
+
}, null, 42, _hoisted_2)), [
|
|
105
|
+
[vue.vModelCheckbox, vue.unref(model)]
|
|
106
|
+
]),
|
|
107
|
+
vue.createElementVNode("span", {
|
|
108
|
+
class: vue.normalizeClass(vue.unref(ns).e("inner"))
|
|
109
|
+
}, null, 2)
|
|
110
|
+
], 2),
|
|
111
|
+
vue.unref(hasOwnLabel) ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
112
|
+
key: 0,
|
|
113
|
+
class: vue.normalizeClass(vue.unref(ns).e("label"))
|
|
114
|
+
}, [
|
|
115
|
+
vue.renderSlot(_ctx.$slots, "default"),
|
|
116
|
+
!_ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
117
|
+
vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
|
|
118
|
+
], 64)) : vue.createCommentVNode("v-if", true)
|
|
119
|
+
], 2)) : vue.createCommentVNode("v-if", true)
|
|
120
|
+
];
|
|
121
|
+
}),
|
|
119
122
|
_: 3
|
|
120
123
|
}, 8, ["class", "aria-controls", "onClick"]);
|
|
121
124
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox2.js","sources":["../../../../../../packages/components/checkbox/src/checkbox.vue"],"sourcesContent":["<template>\n <component\n :is=\"!hasOwnLabel && isLabeledByFormItem ? 'span' : 'label'\"\n :class=\"compKls\"\n :aria-controls=\"indeterminate ? controls : null\"\n @click=\"onClickRoot\"\n >\n <span :class=\"spanKls\">\n <input\n v-if=\"trueValue || falseValue || trueLabel || falseLabel\"\n :id=\"inputId\"\n v-model=\"model\"\n :class=\"ns.e('original')\"\n type=\"checkbox\"\n :indeterminate=\"indeterminate\"\n :name=\"name\"\n :tabindex=\"tabindex\"\n :disabled=\"isDisabled\"\n :true-value=\"trueValue
|
|
1
|
+
{"version":3,"file":"checkbox2.js","sources":["../../../../../../packages/components/checkbox/src/checkbox.vue"],"sourcesContent":["<template>\n <component\n :is=\"!hasOwnLabel && isLabeledByFormItem ? 'span' : 'label'\"\n :class=\"compKls\"\n :aria-controls=\"indeterminate ? controls : null\"\n @click=\"onClickRoot\"\n >\n <span :class=\"spanKls\">\n <input\n v-if=\"trueValue || falseValue || trueLabel || falseLabel\"\n :id=\"inputId\"\n v-model=\"model\"\n :class=\"ns.e('original')\"\n type=\"checkbox\"\n :indeterminate=\"indeterminate\"\n :name=\"name\"\n :tabindex=\"tabindex\"\n :disabled=\"isDisabled\"\n :true-value=\"trueValue ?? trueLabel\"\n :false-value=\"falseValue ?? falseLabel\"\n @change=\"handleChange\"\n @focus=\"isFocused = true\"\n @blur=\"isFocused = false\"\n @click.stop\n />\n <input\n v-else\n :id=\"inputId\"\n v-model=\"model\"\n :class=\"ns.e('original')\"\n type=\"checkbox\"\n :indeterminate=\"indeterminate\"\n :disabled=\"isDisabled\"\n :value=\"actualValue\"\n :name=\"name\"\n :tabindex=\"tabindex\"\n @change=\"handleChange\"\n @focus=\"isFocused = true\"\n @blur=\"isFocused = false\"\n @click.stop\n />\n <span :class=\"ns.e('inner')\" />\n </span>\n <span v-if=\"hasOwnLabel\" :class=\"ns.e('label')\">\n <slot />\n <template v-if=\"!$slots.default\">{{ label }}</template>\n </span>\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, useSlots } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { checkboxEmits, checkboxProps } from './checkbox'\nimport { useCheckbox } from './composables'\n\ndefineOptions({\n name: 'ElCheckbox',\n})\n\nconst props = defineProps(checkboxProps)\ndefineEmits(checkboxEmits)\nconst slots = useSlots()\n\nconst {\n inputId,\n isLabeledByFormItem,\n isChecked,\n isDisabled,\n isFocused,\n checkboxSize,\n hasOwnLabel,\n model,\n actualValue,\n handleChange,\n onClickRoot,\n} = useCheckbox(props, slots)\n\nconst ns = useNamespace('checkbox')\n\nconst compKls = computed(() => {\n return [\n ns.b(),\n ns.m(checkboxSize.value),\n ns.is('disabled', isDisabled.value),\n ns.is('bordered', props.border),\n ns.is('checked', isChecked.value),\n ]\n})\n\nconst spanKls = computed(() => {\n return [\n ns.e('input'),\n ns.is('disabled', isDisabled.value),\n ns.is('checked', isChecked.value),\n ns.is('indeterminate', props.indeterminate),\n ns.is('focus', isFocused.value),\n ]\n})\n</script>\n"],"names":["useSlots","useCheckbox","useNamespace","computed"],"mappings":";;;;;;;;;;;;;;uCAwDc,CAAA;AAAA,EACZ,IAAM,EAAA,YAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAIA,IAAA,MAAM,QAAQA,YAAS,EAAA,CAAA;AAEvB,IAAM,MAAA;AAAA,MACJ,OAAA;AAAA,MACA,mBAAA;AAAA,MACA,SAAA;AAAA,MACA,UAAA;AAAA,MACA,SAAA;AAAA,MACA,YAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,MACA,WAAA;AAAA,KACE,GAAAC,uBAAA,CAAY,OAAO,KAAK,CAAA,CAAA;AAE5B,IAAM,MAAA,EAAA,GAAKC,mBAAa,UAAU,CAAA,CAAA;AAElC,IAAM,MAAA,OAAA,GAAUC,aAAS,MAAM;AAC7B,MAAO,OAAA;AAAA,QACL,GAAG,CAAE,EAAA;AAAA,QACL,EAAA,CAAG,CAAE,CAAA,YAAA,CAAa,KAAK,CAAA;AAAA,QACvB,EAAG,CAAA,EAAA,CAAG,UAAY,EAAA,UAAA,CAAW,KAAK,CAAA;AAAA,QAClC,EAAG,CAAA,EAAA,CAAG,UAAY,EAAA,KAAA,CAAM,MAAM,CAAA;AAAA,QAC9B,EAAG,CAAA,EAAA,CAAG,SAAW,EAAA,SAAA,CAAU,KAAK,CAAA;AAAA,OAClC,CAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAM,MAAA,OAAA,GAAUA,aAAS,MAAM;AAC7B,MAAO,OAAA;AAAA,QACL,EAAA,CAAG,EAAE,OAAO,CAAA;AAAA,QACZ,EAAG,CAAA,EAAA,CAAG,UAAY,EAAA,UAAA,CAAW,KAAK,CAAA;AAAA,QAClC,EAAG,CAAA,EAAA,CAAG,SAAW,EAAA,SAAA,CAAU,KAAK,CAAA;AAAA,QAChC,EAAG,CAAA,EAAA,CAAG,eAAiB,EAAA,KAAA,CAAM,aAAa,CAAA;AAAA,QAC1C,EAAG,CAAA,EAAA,CAAG,OAAS,EAAA,SAAA,CAAU,KAAK,CAAA;AAAA,OAChC,CAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -20,8 +20,8 @@ const useCheckboxEvent = (props, {
|
|
|
20
20
|
const { formItem } = useFormItem.useFormItem();
|
|
21
21
|
const { emit } = vue.getCurrentInstance();
|
|
22
22
|
function getLabeledValue(value) {
|
|
23
|
-
var _a, _b;
|
|
24
|
-
return [true, props.trueValue, props.trueLabel].includes(value) ? (_a = props.trueValue
|
|
23
|
+
var _a, _b, _c, _d;
|
|
24
|
+
return [true, props.trueValue, props.trueLabel].includes(value) ? (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true : (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false;
|
|
25
25
|
}
|
|
26
26
|
function emitChangeEvent(checked, e) {
|
|
27
27
|
emit("change", getLabeledValue(checked), e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-checkbox-event.js","sources":["../../../../../../../packages/components/checkbox/src/composables/use-checkbox-event.ts"],"sourcesContent":["import { computed, getCurrentInstance, inject, nextTick, watch } from 'vue'\nimport { useFormItem } from '@element-plus/components/form'\nimport { debugWarn } from '@element-plus/utils'\nimport { checkboxGroupContextKey } from '../constants'\n\nimport type { useFormItemInputId } from '@element-plus/components/form'\nimport type { CheckboxProps } from '../checkbox'\nimport type {\n CheckboxDisabled,\n CheckboxModel,\n CheckboxStatus,\n} from '../composables'\n\nexport const useCheckboxEvent = (\n props: CheckboxProps,\n {\n model,\n isLimitExceeded,\n hasOwnLabel,\n isDisabled,\n isLabeledByFormItem,\n }: Pick<CheckboxModel, 'model' | 'isLimitExceeded'> &\n Pick<CheckboxStatus, 'hasOwnLabel'> &\n Pick<CheckboxDisabled, 'isDisabled'> &\n Pick<ReturnType<typeof useFormItemInputId>, 'isLabeledByFormItem'>\n) => {\n const checkboxGroup = inject(checkboxGroupContextKey, undefined)\n const { formItem } = useFormItem()\n const { emit } = getCurrentInstance()!\n\n function getLabeledValue(value: string | number | boolean) {\n return [true, props.trueValue, props.trueLabel].includes(value)\n ?
|
|
1
|
+
{"version":3,"file":"use-checkbox-event.js","sources":["../../../../../../../packages/components/checkbox/src/composables/use-checkbox-event.ts"],"sourcesContent":["import { computed, getCurrentInstance, inject, nextTick, watch } from 'vue'\nimport { useFormItem } from '@element-plus/components/form'\nimport { debugWarn } from '@element-plus/utils'\nimport { checkboxGroupContextKey } from '../constants'\n\nimport type { useFormItemInputId } from '@element-plus/components/form'\nimport type { CheckboxProps } from '../checkbox'\nimport type {\n CheckboxDisabled,\n CheckboxModel,\n CheckboxStatus,\n} from '../composables'\n\nexport const useCheckboxEvent = (\n props: CheckboxProps,\n {\n model,\n isLimitExceeded,\n hasOwnLabel,\n isDisabled,\n isLabeledByFormItem,\n }: Pick<CheckboxModel, 'model' | 'isLimitExceeded'> &\n Pick<CheckboxStatus, 'hasOwnLabel'> &\n Pick<CheckboxDisabled, 'isDisabled'> &\n Pick<ReturnType<typeof useFormItemInputId>, 'isLabeledByFormItem'>\n) => {\n const checkboxGroup = inject(checkboxGroupContextKey, undefined)\n const { formItem } = useFormItem()\n const { emit } = getCurrentInstance()!\n\n function getLabeledValue(value: string | number | boolean) {\n return [true, props.trueValue, props.trueLabel].includes(value)\n ? props.trueValue ?? props.trueLabel ?? true\n : props.falseValue ?? props.falseLabel ?? false\n }\n\n function emitChangeEvent(\n checked: string | number | boolean,\n e: InputEvent | MouseEvent\n ) {\n emit('change', getLabeledValue(checked), e)\n }\n\n function handleChange(e: Event) {\n if (isLimitExceeded.value) return\n\n const target = e.target as HTMLInputElement\n emit('change', getLabeledValue(target.checked), e)\n }\n\n async function onClickRoot(e: MouseEvent) {\n if (isLimitExceeded.value) return\n\n if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {\n // fix: https://github.com/element-plus/element-plus/issues/9981\n const eventTargets: EventTarget[] = e.composedPath()\n const hasLabel = eventTargets.some(\n (item) => (item as HTMLElement).tagName === 'LABEL'\n )\n if (!hasLabel) {\n model.value = getLabeledValue(\n [false, props.falseValue, props.falseLabel].includes(model.value)\n )\n await nextTick()\n emitChangeEvent(model.value, e)\n }\n }\n }\n\n const validateEvent = computed(\n () => checkboxGroup?.validateEvent || props.validateEvent\n )\n\n watch(\n () => props.modelValue,\n () => {\n if (validateEvent.value) {\n formItem?.validate('change').catch((err) => debugWarn(err))\n }\n }\n )\n\n return {\n handleChange,\n onClickRoot,\n }\n}\n"],"names":["inject","checkboxGroupContextKey","useFormItem","getCurrentInstance","nextTick","computed","watch","debugWarn"],"mappings":"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"}
|
|
@@ -41,10 +41,11 @@ const useCheckbox = (props, slots) => {
|
|
|
41
41
|
});
|
|
42
42
|
const setStoreValue = () => {
|
|
43
43
|
function addToStore() {
|
|
44
|
+
var _a, _b;
|
|
44
45
|
if (shared.isArray(model.value) && !model.value.includes(actualValue.value)) {
|
|
45
46
|
model.value.push(actualValue.value);
|
|
46
47
|
} else {
|
|
47
|
-
model.value = props.trueValue
|
|
48
|
+
model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true;
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
props.checked && addToStore();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-checkbox.js","sources":["../../../../../../../packages/components/checkbox/src/composables/use-checkbox.ts"],"sourcesContent":["import { computed } from 'vue'\nimport { useFormItem, useFormItemInputId } from '@element-plus/components/form'\nimport { isArray, isPropAbsent } from '@element-plus/utils'\nimport { useDeprecated } from '@element-plus/hooks'\nimport { useCheckboxDisabled } from './use-checkbox-disabled'\nimport { useCheckboxEvent } from './use-checkbox-event'\nimport { useCheckboxModel } from './use-checkbox-model'\nimport { useCheckboxStatus } from './use-checkbox-status'\nimport type { ComponentInternalInstance } from 'vue'\n\nimport type { CheckboxProps } from '../checkbox'\n\nexport const useCheckbox = (\n props: CheckboxProps,\n slots: ComponentInternalInstance['slots']\n) => {\n const { formItem: elFormItem } = useFormItem()\n const { model, isGroup, isLimitExceeded } = useCheckboxModel(props)\n const {\n isFocused,\n isChecked,\n checkboxButtonSize,\n checkboxSize,\n hasOwnLabel,\n actualValue,\n } = useCheckboxStatus(props, slots, { model })\n const { isDisabled } = useCheckboxDisabled({ model, isChecked })\n const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext: elFormItem,\n disableIdGeneration: hasOwnLabel,\n disableIdManagement: isGroup,\n })\n const { handleChange, onClickRoot } = useCheckboxEvent(props, {\n model,\n isLimitExceeded,\n hasOwnLabel,\n isDisabled,\n isLabeledByFormItem,\n })\n\n const setStoreValue = () => {\n function addToStore() {\n if (isArray(model.value) && !model.value.includes(actualValue.value)) {\n model.value.push(actualValue.value)\n } else {\n model.value = props.trueValue
|
|
1
|
+
{"version":3,"file":"use-checkbox.js","sources":["../../../../../../../packages/components/checkbox/src/composables/use-checkbox.ts"],"sourcesContent":["import { computed } from 'vue'\nimport { useFormItem, useFormItemInputId } from '@element-plus/components/form'\nimport { isArray, isPropAbsent } from '@element-plus/utils'\nimport { useDeprecated } from '@element-plus/hooks'\nimport { useCheckboxDisabled } from './use-checkbox-disabled'\nimport { useCheckboxEvent } from './use-checkbox-event'\nimport { useCheckboxModel } from './use-checkbox-model'\nimport { useCheckboxStatus } from './use-checkbox-status'\nimport type { ComponentInternalInstance } from 'vue'\n\nimport type { CheckboxProps } from '../checkbox'\n\nexport const useCheckbox = (\n props: CheckboxProps,\n slots: ComponentInternalInstance['slots']\n) => {\n const { formItem: elFormItem } = useFormItem()\n const { model, isGroup, isLimitExceeded } = useCheckboxModel(props)\n const {\n isFocused,\n isChecked,\n checkboxButtonSize,\n checkboxSize,\n hasOwnLabel,\n actualValue,\n } = useCheckboxStatus(props, slots, { model })\n const { isDisabled } = useCheckboxDisabled({ model, isChecked })\n const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext: elFormItem,\n disableIdGeneration: hasOwnLabel,\n disableIdManagement: isGroup,\n })\n const { handleChange, onClickRoot } = useCheckboxEvent(props, {\n model,\n isLimitExceeded,\n hasOwnLabel,\n isDisabled,\n isLabeledByFormItem,\n })\n\n const setStoreValue = () => {\n function addToStore() {\n if (isArray(model.value) && !model.value.includes(actualValue.value)) {\n model.value.push(actualValue.value)\n } else {\n model.value = props.trueValue ?? props.trueLabel ?? true\n }\n }\n props.checked && addToStore()\n }\n\n setStoreValue()\n\n useDeprecated(\n {\n from: 'label act as value',\n replacement: 'value',\n version: '3.0.0',\n scope: 'el-checkbox',\n ref: 'https://element-plus.org/en-US/component/checkbox.html',\n },\n computed(() => isGroup.value && isPropAbsent(props.value))\n )\n\n useDeprecated(\n {\n from: 'true-label',\n replacement: 'true-value',\n version: '3.0.0',\n scope: 'el-checkbox',\n ref: 'https://element-plus.org/en-US/component/checkbox.html',\n },\n computed(() => !!props.trueLabel)\n )\n\n useDeprecated(\n {\n from: 'false-label',\n replacement: 'false-value',\n version: '3.0.0',\n scope: 'el-checkbox',\n ref: 'https://element-plus.org/en-US/component/checkbox.html',\n },\n computed(() => !!props.falseLabel)\n )\n\n return {\n inputId,\n isLabeledByFormItem,\n isChecked,\n isDisabled,\n isFocused,\n checkboxButtonSize,\n checkboxSize,\n hasOwnLabel,\n model,\n actualValue,\n handleChange,\n onClickRoot,\n }\n}\n"],"names":["useFormItem","useCheckboxModel","useCheckboxStatus","useCheckboxDisabled","useFormItemInputId","useCheckboxEvent","isArray","useDeprecated","computed","isPropAbsent"],"mappings":";;;;;;;;;;;;;;;;;AAQY,MAAC,WAAW,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK;AAC7C,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAGA,uBAAW,EAAE,CAAC;AACjD,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,GAAGC,iCAAgB,CAAC,KAAK,CAAC,CAAC;AACtE,EAAE,MAAM;AACR,IAAI,SAAS;AACb,IAAI,SAAS;AACb,IAAI,kBAAkB;AACtB,IAAI,YAAY;AAChB,IAAI,WAAW;AACf,IAAI,WAAW;AACf,GAAG,GAAGC,mCAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;AACjD,EAAE,MAAM,EAAE,UAAU,EAAE,GAAGC,uCAAmB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AACnE,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAGC,8BAAkB,CAAC,KAAK,EAAE;AACrE,IAAI,eAAe,EAAE,UAAU;AAC/B,IAAI,mBAAmB,EAAE,WAAW;AACpC,IAAI,mBAAmB,EAAE,OAAO;AAChC,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAGC,iCAAgB,CAAC,KAAK,EAAE;AAChE,IAAI,KAAK;AACT,IAAI,eAAe;AACnB,IAAI,WAAW;AACf,IAAI,UAAU;AACd,IAAI,mBAAmB;AACvB,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,aAAa,GAAG,MAAM;AAC9B,IAAI,SAAS,UAAU,GAAG;AAC1B,MAAM,IAAI,EAAE,EAAE,EAAE,CAAC;AACjB,MAAM,IAAIC,cAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;AAC5E,QAAQ,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,OAAO,MAAM;AACb,QAAQ,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,SAAS,KAAK,IAAI,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,KAAK,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC;AACvG,OAAO;AACP,KAAK;AACL,IAAI,KAAK,CAAC,OAAO,IAAI,UAAU,EAAE,CAAC;AAClC,GAAG,CAAC;AACJ,EAAE,aAAa,EAAE,CAAC;AAClB,EAAEC,mBAAa,CAAC;AAChB,IAAI,IAAI,EAAE,oBAAoB;AAC9B,IAAI,WAAW,EAAE,OAAO;AACxB,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,KAAK,EAAE,aAAa;AACxB,IAAI,GAAG,EAAE,wDAAwD;AACjE,GAAG,EAAEC,YAAQ,CAAC,MAAM,OAAO,CAAC,KAAK,IAAIC,kBAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACjE,EAAEF,mBAAa,CAAC;AAChB,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,WAAW,EAAE,YAAY;AAC7B,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,KAAK,EAAE,aAAa;AACxB,IAAI,GAAG,EAAE,wDAAwD;AACjE,GAAG,EAAEC,YAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;AACxC,EAAED,mBAAa,CAAC;AAChB,IAAI,IAAI,EAAE,aAAa;AACvB,IAAI,WAAW,EAAE,aAAa;AAC9B,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,KAAK,EAAE,aAAa;AACxB,IAAI,GAAG,EAAE,wDAAwD;AACjE,GAAG,EAAEC,YAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;AACzC,EAAE,OAAO;AACT,IAAI,OAAO;AACX,IAAI,mBAAmB;AACvB,IAAI,SAAS;AACb,IAAI,UAAU;AACd,IAAI,SAAS;AACb,IAAI,kBAAkB;AACtB,IAAI,YAAY;AAChB,IAAI,WAAW;AACf,IAAI,KAAK;AACT,IAAI,WAAW;AACf,IAAI,YAAY;AAChB,IAAI,WAAW;AACf,GAAG,CAAC;AACJ;;;;"}
|
package/lib/components/index.js
CHANGED
|
@@ -101,7 +101,7 @@ var constants$2 = require('./carousel/src/constants.js');
|
|
|
101
101
|
var cascader = require('./cascader/src/cascader.js');
|
|
102
102
|
var types = require('./cascader-panel/src/types.js');
|
|
103
103
|
var config = require('./cascader-panel/src/config.js');
|
|
104
|
-
var checkTag = require('./check-tag/src/check-
|
|
104
|
+
var checkTag = require('./check-tag/src/check-tag.js');
|
|
105
105
|
var checkboxGroup = require('./checkbox/src/checkbox-group.js');
|
|
106
106
|
var checkbox = require('./checkbox/src/checkbox.js');
|
|
107
107
|
var constants$3 = require('./checkbox/src/constants.js');
|
|
@@ -215,7 +215,7 @@ var dynamicSizeGrid = require('./virtual-list/src/components/dynamic-size-grid.j
|
|
|
215
215
|
var props$1 = require('./virtual-list/src/props.js');
|
|
216
216
|
var watermark = require('./watermark/src/watermark.js');
|
|
217
217
|
var tour = require('./tour/src/tour.js');
|
|
218
|
-
var anchor = require('./anchor/src/
|
|
218
|
+
var anchor = require('./anchor/src/anchor2.js');
|
|
219
219
|
var directive = require('./loading/src/directive.js');
|
|
220
220
|
var service = require('./loading/src/service.js');
|
|
221
221
|
var message = require('./message/src/message.js');
|
|
@@ -2,223 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
require('../../../../hooks/index.js');
|
|
8
|
-
var pager = require('./pager2.js');
|
|
9
|
-
var pluginVue_exportHelper = require('../../../../_virtual/plugin-vue_export-helper.js');
|
|
10
|
-
var index = require('../../../../hooks/use-namespace/index.js');
|
|
11
|
-
var index$1 = require('../../../../hooks/use-locale/index.js');
|
|
5
|
+
require('../../../../utils/index.js');
|
|
6
|
+
var runtime = require('../../../../utils/vue/props/runtime.js');
|
|
12
7
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
const paginationPagerProps = runtime.buildProps({
|
|
9
|
+
currentPage: {
|
|
10
|
+
type: Number,
|
|
11
|
+
default: 1
|
|
12
|
+
},
|
|
13
|
+
pageCount: {
|
|
14
|
+
type: Number,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
pagerCount: {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: 7
|
|
20
|
+
},
|
|
21
|
+
disabled: Boolean
|
|
21
22
|
});
|
|
22
|
-
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
23
|
-
...__default__,
|
|
24
|
-
props: pager.paginationPagerProps,
|
|
25
|
-
emits: ["change"],
|
|
26
|
-
setup(__props, { emit }) {
|
|
27
|
-
const props = __props;
|
|
28
|
-
const nsPager = index.useNamespace("pager");
|
|
29
|
-
const nsIcon = index.useNamespace("icon");
|
|
30
|
-
const { t } = index$1.useLocale();
|
|
31
|
-
const showPrevMore = vue.ref(false);
|
|
32
|
-
const showNextMore = vue.ref(false);
|
|
33
|
-
const quickPrevHover = vue.ref(false);
|
|
34
|
-
const quickNextHover = vue.ref(false);
|
|
35
|
-
const quickPrevFocus = vue.ref(false);
|
|
36
|
-
const quickNextFocus = vue.ref(false);
|
|
37
|
-
const pagers = vue.computed(() => {
|
|
38
|
-
const pagerCount = props.pagerCount;
|
|
39
|
-
const halfPagerCount = (pagerCount - 1) / 2;
|
|
40
|
-
const currentPage = Number(props.currentPage);
|
|
41
|
-
const pageCount = Number(props.pageCount);
|
|
42
|
-
let showPrevMore2 = false;
|
|
43
|
-
let showNextMore2 = false;
|
|
44
|
-
if (pageCount > pagerCount) {
|
|
45
|
-
if (currentPage > pagerCount - halfPagerCount) {
|
|
46
|
-
showPrevMore2 = true;
|
|
47
|
-
}
|
|
48
|
-
if (currentPage < pageCount - halfPagerCount) {
|
|
49
|
-
showNextMore2 = true;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const array = [];
|
|
53
|
-
if (showPrevMore2 && !showNextMore2) {
|
|
54
|
-
const startPage = pageCount - (pagerCount - 2);
|
|
55
|
-
for (let i = startPage; i < pageCount; i++) {
|
|
56
|
-
array.push(i);
|
|
57
|
-
}
|
|
58
|
-
} else if (!showPrevMore2 && showNextMore2) {
|
|
59
|
-
for (let i = 2; i < pagerCount; i++) {
|
|
60
|
-
array.push(i);
|
|
61
|
-
}
|
|
62
|
-
} else if (showPrevMore2 && showNextMore2) {
|
|
63
|
-
const offset = Math.floor(pagerCount / 2) - 1;
|
|
64
|
-
for (let i = currentPage - offset; i <= currentPage + offset; i++) {
|
|
65
|
-
array.push(i);
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
for (let i = 2; i < pageCount; i++) {
|
|
69
|
-
array.push(i);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return array;
|
|
73
|
-
});
|
|
74
|
-
const prevMoreKls = vue.computed(() => [
|
|
75
|
-
"more",
|
|
76
|
-
"btn-quickprev",
|
|
77
|
-
nsIcon.b(),
|
|
78
|
-
nsPager.is("disabled", props.disabled)
|
|
79
|
-
]);
|
|
80
|
-
const nextMoreKls = vue.computed(() => [
|
|
81
|
-
"more",
|
|
82
|
-
"btn-quicknext",
|
|
83
|
-
nsIcon.b(),
|
|
84
|
-
nsPager.is("disabled", props.disabled)
|
|
85
|
-
]);
|
|
86
|
-
const tabindex = vue.computed(() => props.disabled ? -1 : 0);
|
|
87
|
-
vue.watchEffect(() => {
|
|
88
|
-
const halfPagerCount = (props.pagerCount - 1) / 2;
|
|
89
|
-
showPrevMore.value = false;
|
|
90
|
-
showNextMore.value = false;
|
|
91
|
-
if (props.pageCount > props.pagerCount) {
|
|
92
|
-
if (props.currentPage > props.pagerCount - halfPagerCount) {
|
|
93
|
-
showPrevMore.value = true;
|
|
94
|
-
}
|
|
95
|
-
if (props.currentPage < props.pageCount - halfPagerCount) {
|
|
96
|
-
showNextMore.value = true;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
function onMouseEnter(forward = false) {
|
|
101
|
-
if (props.disabled)
|
|
102
|
-
return;
|
|
103
|
-
if (forward) {
|
|
104
|
-
quickPrevHover.value = true;
|
|
105
|
-
} else {
|
|
106
|
-
quickNextHover.value = true;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function onFocus(forward = false) {
|
|
110
|
-
if (forward) {
|
|
111
|
-
quickPrevFocus.value = true;
|
|
112
|
-
} else {
|
|
113
|
-
quickNextFocus.value = true;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
function onEnter(e) {
|
|
117
|
-
const target = e.target;
|
|
118
|
-
if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
|
|
119
|
-
const newPage = Number(target.textContent);
|
|
120
|
-
if (newPage !== props.currentPage) {
|
|
121
|
-
emit("change", newPage);
|
|
122
|
-
}
|
|
123
|
-
} else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
|
|
124
|
-
onPagerClick(e);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
function onPagerClick(event) {
|
|
128
|
-
const target = event.target;
|
|
129
|
-
if (target.tagName.toLowerCase() === "ul" || props.disabled) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
let newPage = Number(target.textContent);
|
|
133
|
-
const pageCount = props.pageCount;
|
|
134
|
-
const currentPage = props.currentPage;
|
|
135
|
-
const pagerCountOffset = props.pagerCount - 2;
|
|
136
|
-
if (target.className.includes("more")) {
|
|
137
|
-
if (target.className.includes("quickprev")) {
|
|
138
|
-
newPage = currentPage - pagerCountOffset;
|
|
139
|
-
} else if (target.className.includes("quicknext")) {
|
|
140
|
-
newPage = currentPage + pagerCountOffset;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (!Number.isNaN(+newPage)) {
|
|
144
|
-
if (newPage < 1) {
|
|
145
|
-
newPage = 1;
|
|
146
|
-
}
|
|
147
|
-
if (newPage > pageCount) {
|
|
148
|
-
newPage = pageCount;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (newPage !== currentPage) {
|
|
152
|
-
emit("change", newPage);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return (_ctx, _cache) => {
|
|
156
|
-
return vue.openBlock(), vue.createElementBlock("ul", {
|
|
157
|
-
class: vue.normalizeClass(vue.unref(nsPager).b()),
|
|
158
|
-
onClick: onPagerClick,
|
|
159
|
-
onKeyup: vue.withKeys(onEnter, ["enter"])
|
|
160
|
-
}, [
|
|
161
|
-
_ctx.pageCount > 0 ? (vue.openBlock(), vue.createElementBlock("li", {
|
|
162
|
-
key: 0,
|
|
163
|
-
class: vue.normalizeClass([[
|
|
164
|
-
vue.unref(nsPager).is("active", _ctx.currentPage === 1),
|
|
165
|
-
vue.unref(nsPager).is("disabled", _ctx.disabled)
|
|
166
|
-
], "number"]),
|
|
167
|
-
"aria-current": _ctx.currentPage === 1,
|
|
168
|
-
"aria-label": vue.unref(t)("el.pagination.currentPage", { pager: 1 }),
|
|
169
|
-
tabindex: vue.unref(tabindex)
|
|
170
|
-
}, " 1 ", 10, _hoisted_2)) : vue.createCommentVNode("v-if", true),
|
|
171
|
-
showPrevMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
|
|
172
|
-
key: 1,
|
|
173
|
-
class: vue.normalizeClass(vue.unref(prevMoreKls)),
|
|
174
|
-
tabindex: vue.unref(tabindex),
|
|
175
|
-
"aria-label": vue.unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
|
|
176
|
-
onMouseenter: _cache[0] || (_cache[0] = ($event) => onMouseEnter(true)),
|
|
177
|
-
onMouseleave: _cache[1] || (_cache[1] = ($event) => quickPrevHover.value = false),
|
|
178
|
-
onFocus: _cache[2] || (_cache[2] = ($event) => onFocus(true)),
|
|
179
|
-
onBlur: _cache[3] || (_cache[3] = ($event) => quickPrevFocus.value = false)
|
|
180
|
-
}, [
|
|
181
|
-
(quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.DArrowLeft), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.MoreFilled), { key: 1 }))
|
|
182
|
-
], 42, _hoisted_3)) : vue.createCommentVNode("v-if", true),
|
|
183
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pagers), (pager) => {
|
|
184
|
-
return vue.openBlock(), vue.createElementBlock("li", {
|
|
185
|
-
key: pager,
|
|
186
|
-
class: vue.normalizeClass([[
|
|
187
|
-
vue.unref(nsPager).is("active", _ctx.currentPage === pager),
|
|
188
|
-
vue.unref(nsPager).is("disabled", _ctx.disabled)
|
|
189
|
-
], "number"]),
|
|
190
|
-
"aria-current": _ctx.currentPage === pager,
|
|
191
|
-
"aria-label": vue.unref(t)("el.pagination.currentPage", { pager }),
|
|
192
|
-
tabindex: vue.unref(tabindex)
|
|
193
|
-
}, vue.toDisplayString(pager), 11, _hoisted_4);
|
|
194
|
-
}), 128)),
|
|
195
|
-
showNextMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
|
|
196
|
-
key: 2,
|
|
197
|
-
class: vue.normalizeClass(vue.unref(nextMoreKls)),
|
|
198
|
-
tabindex: vue.unref(tabindex),
|
|
199
|
-
"aria-label": vue.unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
|
|
200
|
-
onMouseenter: _cache[4] || (_cache[4] = ($event) => onMouseEnter()),
|
|
201
|
-
onMouseleave: _cache[5] || (_cache[5] = ($event) => quickNextHover.value = false),
|
|
202
|
-
onFocus: _cache[6] || (_cache[6] = ($event) => onFocus()),
|
|
203
|
-
onBlur: _cache[7] || (_cache[7] = ($event) => quickNextFocus.value = false)
|
|
204
|
-
}, [
|
|
205
|
-
(quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.DArrowRight), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.MoreFilled), { key: 1 }))
|
|
206
|
-
], 42, _hoisted_5)) : vue.createCommentVNode("v-if", true),
|
|
207
|
-
_ctx.pageCount > 1 ? (vue.openBlock(), vue.createElementBlock("li", {
|
|
208
|
-
key: 3,
|
|
209
|
-
class: vue.normalizeClass([[
|
|
210
|
-
vue.unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
|
|
211
|
-
vue.unref(nsPager).is("disabled", _ctx.disabled)
|
|
212
|
-
], "number"]),
|
|
213
|
-
"aria-current": _ctx.currentPage === _ctx.pageCount,
|
|
214
|
-
"aria-label": vue.unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
|
|
215
|
-
tabindex: vue.unref(tabindex)
|
|
216
|
-
}, vue.toDisplayString(_ctx.pageCount), 11, _hoisted_6)) : vue.createCommentVNode("v-if", true)
|
|
217
|
-
], 42, _hoisted_1);
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
var Pager = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "pager.vue"]]);
|
|
222
23
|
|
|
223
|
-
exports
|
|
24
|
+
exports.paginationPagerProps = paginationPagerProps;
|
|
224
25
|
//# sourceMappingURL=pager.js.map
|