@element-plus/nightly 0.0.20240304 → 0.0.20240306
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 +71 -66
- package/dist/index.full.min.js +4 -4
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +4 -4
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +71 -66
- 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 +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/affix/index.mjs +2 -2
- package/es/components/affix/src/affix.mjs +26 -117
- package/es/components/affix/src/affix.mjs.map +1 -1
- package/es/components/affix/src/affix2.mjs +117 -26
- package/es/components/affix/src/affix2.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 +8 -8
- package/es/components/input/index.mjs +2 -2
- package/es/components/input/src/input.mjs +453 -115
- package/es/components/input/src/input.mjs.map +1 -1
- package/es/components/input/src/input2.mjs +115 -453
- package/es/components/input/src/input2.mjs.map +1 -1
- package/es/components/link/index.mjs +2 -2
- package/es/components/link/src/link.mjs +51 -25
- package/es/components/link/src/link.mjs.map +1 -1
- package/es/components/link/src/link2.mjs +25 -51
- package/es/components/link/src/link2.mjs.map +1 -1
- package/es/components/popper/index.mjs +2 -2
- package/es/components/popper/src/arrow.mjs +8 -37
- package/es/components/popper/src/arrow.mjs.map +1 -1
- package/es/components/popper/src/arrow2.mjs +37 -8
- package/es/components/popper/src/arrow2.mjs.map +1 -1
- package/es/components/radio/index.mjs +2 -2
- package/es/components/radio/src/radio-button.mjs +1 -1
- package/es/components/radio/src/radio-group.mjs +1 -1
- package/es/components/radio/src/radio.mjs +73 -34
- package/es/components/radio/src/radio.mjs.map +1 -1
- package/es/components/radio/src/radio2.mjs +34 -73
- package/es/components/radio/src/radio2.mjs.map +1 -1
- package/es/components/skeleton/index.mjs +2 -2
- package/es/components/skeleton/src/skeleton-item.mjs +23 -18
- package/es/components/skeleton/src/skeleton-item.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton-item2.mjs +18 -23
- package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton2.mjs +1 -1
- package/es/components/table/src/filter-panel.mjs +2 -2
- package/es/components/table/src/filter-panel.mjs.map +1 -1
- package/es/components/tooltip/src/tooltip.mjs +1 -1
- package/es/components/tooltip/src/tooltip2.mjs +1 -1
- package/es/components/transfer/src/transfer-panel2.mjs +2 -2
- package/es/components/transfer/src/transfer-panel2.mjs.map +1 -1
- package/es/components/watermark/index.mjs +2 -2
- package/es/components/watermark/src/watermark.mjs +209 -28
- package/es/components/watermark/src/watermark.mjs.map +1 -1
- package/es/components/watermark/src/watermark2.mjs +28 -209
- package/es/components/watermark/src/watermark2.mjs.map +1 -1
- package/es/index.mjs +8 -8
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/affix/index.js +2 -2
- package/lib/components/affix/src/affix.js +27 -117
- package/lib/components/affix/src/affix.js.map +1 -1
- package/lib/components/affix/src/affix2.js +117 -27
- package/lib/components/affix/src/affix2.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 +8 -8
- package/lib/components/input/index.js +2 -2
- package/lib/components/input/src/input.js +452 -115
- package/lib/components/input/src/input.js.map +1 -1
- package/lib/components/input/src/input2.js +115 -452
- package/lib/components/input/src/input2.js.map +1 -1
- package/lib/components/link/index.js +2 -2
- package/lib/components/link/src/link.js +51 -26
- package/lib/components/link/src/link.js.map +1 -1
- package/lib/components/link/src/link2.js +26 -51
- package/lib/components/link/src/link2.js.map +1 -1
- package/lib/components/popper/index.js +2 -2
- package/lib/components/popper/src/arrow.js +9 -37
- package/lib/components/popper/src/arrow.js.map +1 -1
- package/lib/components/popper/src/arrow2.js +37 -9
- package/lib/components/popper/src/arrow2.js.map +1 -1
- package/lib/components/radio/index.js +2 -2
- package/lib/components/radio/src/radio-button.js +1 -1
- package/lib/components/radio/src/radio-group.js +1 -1
- package/lib/components/radio/src/radio.js +73 -36
- package/lib/components/radio/src/radio.js.map +1 -1
- package/lib/components/radio/src/radio2.js +36 -73
- package/lib/components/radio/src/radio2.js.map +1 -1
- package/lib/components/skeleton/index.js +2 -2
- package/lib/components/skeleton/src/skeleton-item.js +23 -18
- package/lib/components/skeleton/src/skeleton-item.js.map +1 -1
- package/lib/components/skeleton/src/skeleton-item2.js +18 -23
- package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
- package/lib/components/skeleton/src/skeleton2.js +1 -1
- package/lib/components/table/src/filter-panel.js +2 -2
- package/lib/components/table/src/filter-panel.js.map +1 -1
- package/lib/components/tooltip/src/tooltip.js +1 -1
- package/lib/components/tooltip/src/tooltip2.js +1 -1
- package/lib/components/transfer/src/transfer-panel2.js +2 -2
- package/lib/components/transfer/src/transfer-panel2.js.map +1 -1
- package/lib/components/watermark/index.js +2 -2
- package/lib/components/watermark/src/watermark.js +209 -28
- package/lib/components/watermark/src/watermark.js.map +1 -1
- package/lib/components/watermark/src/watermark2.js +28 -209
- package/lib/components/watermark/src/watermark2.js.map +1 -1
- package/lib/index.js +8 -8
- 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-anchor.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/anchor-link.scss +3 -4
- package/theme-chalk/src/anchor.scss +8 -12
- package/theme-chalk/src/input.scss +0 -1
- package/web-types.json +1 -1
|
@@ -2,126 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var vue = require('vue');
|
|
6
|
-
var core = require('@vueuse/core');
|
|
7
5
|
require('../../../utils/index.js');
|
|
8
|
-
require('../../../
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var style = require('../../../utils/dom/style.js');
|
|
13
|
-
var error = require('../../../utils/error.js');
|
|
14
|
-
var scroll = require('../../../utils/dom/scroll.js');
|
|
6
|
+
require('../../../constants/index.js');
|
|
7
|
+
var runtime = require('../../../utils/vue/props/runtime.js');
|
|
8
|
+
var types = require('../../../utils/types.js');
|
|
9
|
+
var event = require('../../../constants/event.js');
|
|
15
10
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
width: rootWidth,
|
|
34
|
-
top: rootTop,
|
|
35
|
-
bottom: rootBottom,
|
|
36
|
-
update: updateRoot
|
|
37
|
-
} = core.useElementBounding(root, { windowScroll: false });
|
|
38
|
-
const targetRect = core.useElementBounding(target);
|
|
39
|
-
const fixed = vue.ref(false);
|
|
40
|
-
const scrollTop = vue.ref(0);
|
|
41
|
-
const transform = vue.ref(0);
|
|
42
|
-
const rootStyle = vue.computed(() => {
|
|
43
|
-
return {
|
|
44
|
-
height: fixed.value ? `${rootHeight.value}px` : "",
|
|
45
|
-
width: fixed.value ? `${rootWidth.value}px` : ""
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
const affixStyle = vue.computed(() => {
|
|
49
|
-
if (!fixed.value)
|
|
50
|
-
return {};
|
|
51
|
-
const offset = props.offset ? style.addUnit(props.offset) : 0;
|
|
52
|
-
return {
|
|
53
|
-
height: `${rootHeight.value}px`,
|
|
54
|
-
width: `${rootWidth.value}px`,
|
|
55
|
-
top: props.position === "top" ? offset : "",
|
|
56
|
-
bottom: props.position === "bottom" ? offset : "",
|
|
57
|
-
transform: transform.value ? `translateY(${transform.value}px)` : "",
|
|
58
|
-
zIndex: props.zIndex
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
const update = () => {
|
|
62
|
-
if (!scrollContainer.value)
|
|
63
|
-
return;
|
|
64
|
-
scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
|
|
65
|
-
if (props.position === "top") {
|
|
66
|
-
if (props.target) {
|
|
67
|
-
const difference = targetRect.bottom.value - props.offset - rootHeight.value;
|
|
68
|
-
fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0;
|
|
69
|
-
transform.value = difference < 0 ? difference : 0;
|
|
70
|
-
} else {
|
|
71
|
-
fixed.value = props.offset > rootTop.value;
|
|
72
|
-
}
|
|
73
|
-
} else if (props.target) {
|
|
74
|
-
const difference = windowHeight.value - targetRect.top.value - props.offset - rootHeight.value;
|
|
75
|
-
fixed.value = windowHeight.value - props.offset < rootBottom.value && windowHeight.value > targetRect.top.value;
|
|
76
|
-
transform.value = difference < 0 ? -difference : 0;
|
|
77
|
-
} else {
|
|
78
|
-
fixed.value = windowHeight.value - props.offset < rootBottom.value;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
const handleScroll = () => {
|
|
82
|
-
updateRoot();
|
|
83
|
-
emit("scroll", {
|
|
84
|
-
scrollTop: scrollTop.value,
|
|
85
|
-
fixed: fixed.value
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
vue.watch(fixed, (val) => emit("change", val));
|
|
89
|
-
vue.onMounted(() => {
|
|
90
|
-
var _a;
|
|
91
|
-
if (props.target) {
|
|
92
|
-
target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
|
|
93
|
-
if (!target.value)
|
|
94
|
-
error.throwError(COMPONENT_NAME, `Target is not existed: ${props.target}`);
|
|
95
|
-
} else {
|
|
96
|
-
target.value = document.documentElement;
|
|
97
|
-
}
|
|
98
|
-
scrollContainer.value = scroll.getScrollContainer(root.value, true);
|
|
99
|
-
updateRoot();
|
|
100
|
-
});
|
|
101
|
-
core.useEventListener(scrollContainer, "scroll", handleScroll);
|
|
102
|
-
vue.watchEffect(update);
|
|
103
|
-
expose({
|
|
104
|
-
update,
|
|
105
|
-
updateRoot
|
|
106
|
-
});
|
|
107
|
-
return (_ctx, _cache) => {
|
|
108
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
109
|
-
ref_key: "root",
|
|
110
|
-
ref: root,
|
|
111
|
-
class: vue.normalizeClass(vue.unref(ns).b()),
|
|
112
|
-
style: vue.normalizeStyle(vue.unref(rootStyle))
|
|
113
|
-
}, [
|
|
114
|
-
vue.createElementVNode("div", {
|
|
115
|
-
class: vue.normalizeClass({ [vue.unref(ns).m("fixed")]: fixed.value }),
|
|
116
|
-
style: vue.normalizeStyle(vue.unref(affixStyle))
|
|
117
|
-
}, [
|
|
118
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
119
|
-
], 6)
|
|
120
|
-
], 6);
|
|
121
|
-
};
|
|
11
|
+
const affixProps = runtime.buildProps({
|
|
12
|
+
zIndex: {
|
|
13
|
+
type: runtime.definePropType([Number, String]),
|
|
14
|
+
default: 100
|
|
15
|
+
},
|
|
16
|
+
target: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: ""
|
|
19
|
+
},
|
|
20
|
+
offset: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 0
|
|
23
|
+
},
|
|
24
|
+
position: {
|
|
25
|
+
type: String,
|
|
26
|
+
values: ["top", "bottom"],
|
|
27
|
+
default: "top"
|
|
122
28
|
}
|
|
123
29
|
});
|
|
124
|
-
|
|
30
|
+
const affixEmits = {
|
|
31
|
+
scroll: ({ scrollTop, fixed }) => types.isNumber(scrollTop) && types.isBoolean(fixed),
|
|
32
|
+
[event.CHANGE_EVENT]: (fixed) => types.isBoolean(fixed)
|
|
33
|
+
};
|
|
125
34
|
|
|
126
|
-
exports
|
|
35
|
+
exports.affixEmits = affixEmits;
|
|
36
|
+
exports.affixProps = affixProps;
|
|
127
37
|
//# sourceMappingURL=affix.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affix.js","sources":["../../../../../../packages/components/affix/src/affix.
|
|
1
|
+
{"version":3,"file":"affix.js","sources":["../../../../../../packages/components/affix/src/affix.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isBoolean,\n isNumber,\n} from '@element-plus/utils'\nimport { CHANGE_EVENT } from '@element-plus/constants'\nimport type { ExtractPropTypes } from 'vue'\nimport type { ZIndexProperty } from 'csstype'\nimport type Affix from './affix.vue'\n\nexport const affixProps = buildProps({\n /**\n * @description affix element zIndex value\n * */\n zIndex: {\n type: definePropType<ZIndexProperty>([Number, String]),\n default: 100,\n },\n /**\n * @description target container. (CSS selector)\n */\n target: {\n type: String,\n default: '',\n },\n /**\n * @description offset distance\n * */\n offset: {\n type: Number,\n default: 0,\n },\n /**\n * @description position of affix\n * */\n position: {\n type: String,\n values: ['top', 'bottom'],\n default: 'top',\n },\n} as const)\nexport type AffixProps = ExtractPropTypes<typeof affixProps>\n\nexport const affixEmits = {\n scroll: ({ scrollTop, fixed }: { scrollTop: number; fixed: boolean }) =>\n isNumber(scrollTop) && isBoolean(fixed),\n [CHANGE_EVENT]: (fixed: boolean) => isBoolean(fixed),\n}\nexport type AffixEmits = typeof affixEmits\n\nexport type AffixInstance = InstanceType<typeof Affix>\n"],"names":["buildProps","definePropType","isNumber","isBoolean","CHANGE_EVENT"],"mappings":";;;;;;;;;;AAOY,MAAC,UAAU,GAAGA,kBAAU,CAAC;AACrC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAEC,sBAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1C,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC7B,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,UAAU,GAAG;AAC1B,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAKC,cAAQ,CAAC,SAAS,CAAC,IAAIC,eAAS,CAAC,KAAK,CAAC;AAC3E,EAAE,CAACC,kBAAY,GAAG,CAAC,KAAK,KAAKD,eAAS,CAAC,KAAK,CAAC;AAC7C;;;;;"}
|
|
@@ -2,36 +2,126 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var core = require('@vueuse/core');
|
|
5
7
|
require('../../../utils/index.js');
|
|
6
|
-
require('../../../
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
require('../../../hooks/index.js');
|
|
9
|
+
var affix = require('./affix.js');
|
|
10
|
+
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
11
|
+
var index = require('../../../hooks/use-namespace/index.js');
|
|
12
|
+
var style = require('../../../utils/dom/style.js');
|
|
13
|
+
var error = require('../../../utils/error.js');
|
|
14
|
+
var scroll = require('../../../utils/dom/scroll.js');
|
|
10
15
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
const COMPONENT_NAME = "ElAffix";
|
|
17
|
+
const __default__ = vue.defineComponent({
|
|
18
|
+
name: COMPONENT_NAME
|
|
19
|
+
});
|
|
20
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
21
|
+
...__default__,
|
|
22
|
+
props: affix.affixProps,
|
|
23
|
+
emits: affix.affixEmits,
|
|
24
|
+
setup(__props, { expose, emit }) {
|
|
25
|
+
const props = __props;
|
|
26
|
+
const ns = index.useNamespace("affix");
|
|
27
|
+
const target = vue.shallowRef();
|
|
28
|
+
const root = vue.shallowRef();
|
|
29
|
+
const scrollContainer = vue.shallowRef();
|
|
30
|
+
const { height: windowHeight } = core.useWindowSize();
|
|
31
|
+
const {
|
|
32
|
+
height: rootHeight,
|
|
33
|
+
width: rootWidth,
|
|
34
|
+
top: rootTop,
|
|
35
|
+
bottom: rootBottom,
|
|
36
|
+
update: updateRoot
|
|
37
|
+
} = core.useElementBounding(root, { windowScroll: false });
|
|
38
|
+
const targetRect = core.useElementBounding(target);
|
|
39
|
+
const fixed = vue.ref(false);
|
|
40
|
+
const scrollTop = vue.ref(0);
|
|
41
|
+
const transform = vue.ref(0);
|
|
42
|
+
const rootStyle = vue.computed(() => {
|
|
43
|
+
return {
|
|
44
|
+
height: fixed.value ? `${rootHeight.value}px` : "",
|
|
45
|
+
width: fixed.value ? `${rootWidth.value}px` : ""
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
const affixStyle = vue.computed(() => {
|
|
49
|
+
if (!fixed.value)
|
|
50
|
+
return {};
|
|
51
|
+
const offset = props.offset ? style.addUnit(props.offset) : 0;
|
|
52
|
+
return {
|
|
53
|
+
height: `${rootHeight.value}px`,
|
|
54
|
+
width: `${rootWidth.value}px`,
|
|
55
|
+
top: props.position === "top" ? offset : "",
|
|
56
|
+
bottom: props.position === "bottom" ? offset : "",
|
|
57
|
+
transform: transform.value ? `translateY(${transform.value}px)` : "",
|
|
58
|
+
zIndex: props.zIndex
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
const update = () => {
|
|
62
|
+
if (!scrollContainer.value)
|
|
63
|
+
return;
|
|
64
|
+
scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
|
|
65
|
+
if (props.position === "top") {
|
|
66
|
+
if (props.target) {
|
|
67
|
+
const difference = targetRect.bottom.value - props.offset - rootHeight.value;
|
|
68
|
+
fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0;
|
|
69
|
+
transform.value = difference < 0 ? difference : 0;
|
|
70
|
+
} else {
|
|
71
|
+
fixed.value = props.offset > rootTop.value;
|
|
72
|
+
}
|
|
73
|
+
} else if (props.target) {
|
|
74
|
+
const difference = windowHeight.value - targetRect.top.value - props.offset - rootHeight.value;
|
|
75
|
+
fixed.value = windowHeight.value - props.offset < rootBottom.value && windowHeight.value > targetRect.top.value;
|
|
76
|
+
transform.value = difference < 0 ? -difference : 0;
|
|
77
|
+
} else {
|
|
78
|
+
fixed.value = windowHeight.value - props.offset < rootBottom.value;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const handleScroll = () => {
|
|
82
|
+
updateRoot();
|
|
83
|
+
emit("scroll", {
|
|
84
|
+
scrollTop: scrollTop.value,
|
|
85
|
+
fixed: fixed.value
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
vue.watch(fixed, (val) => emit("change", val));
|
|
89
|
+
vue.onMounted(() => {
|
|
90
|
+
var _a;
|
|
91
|
+
if (props.target) {
|
|
92
|
+
target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
|
|
93
|
+
if (!target.value)
|
|
94
|
+
error.throwError(COMPONENT_NAME, `Target is not existed: ${props.target}`);
|
|
95
|
+
} else {
|
|
96
|
+
target.value = document.documentElement;
|
|
97
|
+
}
|
|
98
|
+
scrollContainer.value = scroll.getScrollContainer(root.value, true);
|
|
99
|
+
updateRoot();
|
|
100
|
+
});
|
|
101
|
+
core.useEventListener(scrollContainer, "scroll", handleScroll);
|
|
102
|
+
vue.watchEffect(update);
|
|
103
|
+
expose({
|
|
104
|
+
update,
|
|
105
|
+
updateRoot
|
|
106
|
+
});
|
|
107
|
+
return (_ctx, _cache) => {
|
|
108
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
109
|
+
ref_key: "root",
|
|
110
|
+
ref: root,
|
|
111
|
+
class: vue.normalizeClass(vue.unref(ns).b()),
|
|
112
|
+
style: vue.normalizeStyle(vue.unref(rootStyle))
|
|
113
|
+
}, [
|
|
114
|
+
vue.createElementVNode("div", {
|
|
115
|
+
class: vue.normalizeClass({ [vue.unref(ns).m("fixed")]: fixed.value }),
|
|
116
|
+
style: vue.normalizeStyle(vue.unref(affixStyle))
|
|
117
|
+
}, [
|
|
118
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
119
|
+
], 6)
|
|
120
|
+
], 6);
|
|
121
|
+
};
|
|
28
122
|
}
|
|
29
123
|
});
|
|
30
|
-
|
|
31
|
-
scroll: ({ scrollTop, fixed }) => types.isNumber(scrollTop) && types.isBoolean(fixed),
|
|
32
|
-
[event.CHANGE_EVENT]: (fixed) => types.isBoolean(fixed)
|
|
33
|
-
};
|
|
124
|
+
var Affix = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "affix.vue"]]);
|
|
34
125
|
|
|
35
|
-
exports
|
|
36
|
-
exports.affixProps = affixProps;
|
|
126
|
+
exports["default"] = Affix;
|
|
37
127
|
//# sourceMappingURL=affix2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affix2.js","sources":["../../../../../../packages/components/affix/src/affix.
|
|
1
|
+
{"version":3,"file":"affix2.js","sources":["../../../../../../packages/components/affix/src/affix.vue"],"sourcesContent":["<template>\n <div ref=\"root\" :class=\"ns.b()\" :style=\"rootStyle\">\n <div :class=\"{ [ns.m('fixed')]: fixed }\" :style=\"affixStyle\">\n <slot />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, onMounted, ref, shallowRef, watch, watchEffect } from 'vue'\nimport {\n useElementBounding,\n useEventListener,\n useWindowSize,\n} from '@vueuse/core'\nimport { addUnit, getScrollContainer, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { affixEmits, affixProps } from './affix'\nimport type { CSSProperties } from 'vue'\n\nconst COMPONENT_NAME = 'ElAffix'\ndefineOptions({\n name: COMPONENT_NAME,\n})\n\nconst props = defineProps(affixProps)\nconst emit = defineEmits(affixEmits)\n\nconst ns = useNamespace('affix')\n\nconst target = shallowRef<HTMLElement>()\nconst root = shallowRef<HTMLDivElement>()\nconst scrollContainer = shallowRef<HTMLElement | Window>()\nconst { height: windowHeight } = useWindowSize()\nconst {\n height: rootHeight,\n width: rootWidth,\n top: rootTop,\n bottom: rootBottom,\n update: updateRoot,\n} = useElementBounding(root, { windowScroll: false })\nconst targetRect = useElementBounding(target)\n\nconst fixed = ref(false)\nconst scrollTop = ref(0)\nconst transform = ref(0)\n\nconst rootStyle = computed<CSSProperties>(() => {\n return {\n height: fixed.value ? `${rootHeight.value}px` : '',\n width: fixed.value ? `${rootWidth.value}px` : '',\n }\n})\n\nconst affixStyle = computed<CSSProperties>(() => {\n if (!fixed.value) return {}\n\n const offset = props.offset ? addUnit(props.offset) : 0\n return {\n height: `${rootHeight.value}px`,\n width: `${rootWidth.value}px`,\n top: props.position === 'top' ? offset : '',\n bottom: props.position === 'bottom' ? offset : '',\n transform: transform.value ? `translateY(${transform.value}px)` : '',\n zIndex: props.zIndex,\n }\n})\n\nconst update = () => {\n if (!scrollContainer.value) return\n\n scrollTop.value =\n scrollContainer.value instanceof Window\n ? document.documentElement.scrollTop\n : scrollContainer.value.scrollTop || 0\n\n if (props.position === 'top') {\n if (props.target) {\n const difference =\n targetRect.bottom.value - props.offset - rootHeight.value\n fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0\n transform.value = difference < 0 ? difference : 0\n } else {\n fixed.value = props.offset > rootTop.value\n }\n } else if (props.target) {\n const difference =\n windowHeight.value -\n targetRect.top.value -\n props.offset -\n rootHeight.value\n fixed.value =\n windowHeight.value - props.offset < rootBottom.value &&\n windowHeight.value > targetRect.top.value\n transform.value = difference < 0 ? -difference : 0\n } else {\n fixed.value = windowHeight.value - props.offset < rootBottom.value\n }\n}\n\nconst handleScroll = () => {\n updateRoot()\n emit('scroll', {\n scrollTop: scrollTop.value,\n fixed: fixed.value,\n })\n}\n\nwatch(fixed, (val) => emit('change', val))\n\nonMounted(() => {\n if (props.target) {\n target.value =\n document.querySelector<HTMLElement>(props.target) ?? undefined\n if (!target.value)\n throwError(COMPONENT_NAME, `Target is not existed: ${props.target}`)\n } else {\n target.value = document.documentElement\n }\n scrollContainer.value = getScrollContainer(root.value!, true)\n updateRoot()\n})\n\nuseEventListener(scrollContainer, 'scroll', handleScroll)\nwatchEffect(update)\n\ndefineExpose({\n /** @description update affix status */\n update,\n /** @description update rootRect info */\n updateRoot,\n})\n</script>\n"],"names":["useNamespace","shallowRef","useWindowSize","useElementBounding","ref","computed","addUnit","watch","onMounted","throwError","getScrollContainer","useEventListener","watchEffect"],"mappings":";;;;;;;;;;;;;;;;uCAqBc,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR;;;;;;;AAKA,IAAM,MAAA,EAAA,GAAKA,mBAAa,OAAO,CAAA,CAAA;AAE/B,IAAA,MAAM,SAASC,cAAwB,EAAA,CAAA;AACvC,IAAA,MAAM,OAAOA,cAA2B,EAAA,CAAA;AACxC,IAAA,MAAM,kBAAkBA,cAAiC,EAAA,CAAA;AACzD,IAAM,MAAA,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,yBAAA,CAAA,IAAA,CAAA,KAAA,EAAA,IAAA,CAAA,CAAA;AAAA,MACZ,UAAA,EAAA,CAAA;AAED,KAAiB,CAAA,CAAA;AACjB,IAAAC,qBAAkB,CAAA,eAAA,EAAA,QAAA,EAAA,YAAA,CAAA,CAAA;AAElB,IAAaC,eAAA,CAAA,MAAA,CAAA,CAAA;AAAA,IAEX,MAAA,CAAA;AAAA,MAEA,MAAA;AAAA,MACD,UAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -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;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 +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":";;;;;;;;;;;AAIY,MAAC,gBAAgB,GAAG,CAAC,KAAK,EAAE;AACxC,EAAE,KAAK;AACP,EAAE,eAAe;AACjB,EAAE,WAAW;AACb,EAAE,UAAU;AACZ,EAAE,mBAAmB;AACrB,CAAC,KAAK;AACN,EAAE,MAAM,aAAa,GAAGA,UAAM,CAACC,iCAAuB,EAAE,KAAK,CAAC,CAAC,CAAC;AAChE,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAGC,uBAAW,EAAE,CAAC;AACrC,EAAE,MAAM,EAAE,IAAI,EAAE,GAAGC,sBAAkB,EAAE,CAAC;AACxC,EAAE,SAAS,eAAe,CAAC,KAAK,EAAE;AAClC,IAAI,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AACvB,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,SAAS,KAAK,IAAI,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,KAAK,IAAI,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,UAAU,KAAK,IAAI,GAAG,EAAE,GAAG,KAAK,CAAC,UAAU,KAAK,IAAI,GAAG,EAAE,GAAG,KAAK,CAAC;AAC7O,GAAG;AACH,EAAE,SAAS,eAAe,CAAC,OAAO,EAAE,CAAC,EAAE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,CAAC;AAC9H,EAAEC,SAAK,CAAC,MAAM,KAAK,CAAC,UAAU,EAAE,MAAM;AACtC,IAAI,IAAI,aAAa,CAAC,KAAK,EAAE;AAC7B,MAAM,QAAQ,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,KAAKC,eAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7F,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE,OAAO;AACT,IAAI,YAAY;AAChB,IAAI,WAAW;AACf,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -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();
|