@element-plus/nightly 0.0.20240630 → 0.0.20240701
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 +4 -3
- 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 +4 -3
- 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/anchor/index.mjs +1 -1
- package/es/components/anchor/src/anchor-link.mjs +82 -6
- package/es/components/anchor/src/anchor-link.mjs.map +1 -1
- package/es/components/anchor/src/anchor-link2.mjs +6 -82
- package/es/components/anchor/src/anchor-link2.mjs.map +1 -1
- package/es/components/calendar/index.mjs +2 -2
- package/es/components/calendar/src/calendar.mjs +131 -18
- package/es/components/calendar/src/calendar.mjs.map +1 -1
- package/es/components/calendar/src/calendar2.mjs +18 -131
- package/es/components/calendar/src/calendar2.mjs.map +1 -1
- package/es/components/image/src/image2.mjs +2 -1
- package/es/components/image/src/image2.mjs.map +1 -1
- package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
- package/es/components/index.mjs +2 -2
- package/es/components/pagination/src/components/jumper.mjs +60 -9
- package/es/components/pagination/src/components/jumper.mjs.map +1 -1
- package/es/components/pagination/src/components/jumper2.mjs +9 -60
- package/es/components/pagination/src/components/jumper2.mjs.map +1 -1
- package/es/components/pagination/src/pagination.mjs +1 -1
- package/es/components/scrollbar/src/bar.mjs +11 -64
- package/es/components/scrollbar/src/bar.mjs.map +1 -1
- package/es/components/scrollbar/src/bar2.mjs +64 -11
- package/es/components/scrollbar/src/bar2.mjs.map +1 -1
- package/es/components/scrollbar/src/scrollbar2.mjs +1 -1
- package/es/components/tooltip-v2/src/content2.mjs +1 -1
- package/es/components/visual-hidden/index.mjs +3 -3
- package/es/components/visual-hidden/src/visual-hidden.mjs +35 -7
- package/es/components/visual-hidden/src/visual-hidden.mjs.map +1 -1
- package/es/components/visual-hidden/src/visual-hidden2.mjs +7 -35
- package/es/components/visual-hidden/src/visual-hidden2.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 +2 -2
- 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 +1 -1
- package/lib/components/anchor/src/anchor-link.js +82 -6
- package/lib/components/anchor/src/anchor-link.js.map +1 -1
- package/lib/components/anchor/src/anchor-link2.js +6 -82
- package/lib/components/anchor/src/anchor-link2.js.map +1 -1
- package/lib/components/calendar/index.js +2 -2
- package/lib/components/calendar/src/calendar.js +131 -19
- package/lib/components/calendar/src/calendar.js.map +1 -1
- package/lib/components/calendar/src/calendar2.js +19 -131
- package/lib/components/calendar/src/calendar2.js.map +1 -1
- package/lib/components/image/src/image2.js +2 -1
- package/lib/components/image/src/image2.js.map +1 -1
- package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
- package/lib/components/index.js +2 -2
- package/lib/components/pagination/src/components/jumper.js +60 -9
- package/lib/components/pagination/src/components/jumper.js.map +1 -1
- package/lib/components/pagination/src/components/jumper2.js +9 -60
- package/lib/components/pagination/src/components/jumper2.js.map +1 -1
- package/lib/components/pagination/src/pagination.js +1 -1
- package/lib/components/scrollbar/src/bar.js +11 -64
- package/lib/components/scrollbar/src/bar.js.map +1 -1
- package/lib/components/scrollbar/src/bar2.js +64 -11
- package/lib/components/scrollbar/src/bar2.js.map +1 -1
- package/lib/components/scrollbar/src/scrollbar2.js +1 -1
- package/lib/components/tooltip-v2/src/content2.js +1 -1
- package/lib/components/visual-hidden/index.js +2 -2
- package/lib/components/visual-hidden/src/visual-hidden.js +35 -7
- package/lib/components/visual-hidden/src/visual-hidden.js.map +1 -1
- package/lib/components/visual-hidden/src/visual-hidden2.js +7 -35
- package/lib/components/visual-hidden/src/visual-hidden2.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 +2 -2
- 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,72 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
var thumb = require('./thumb2.js');
|
|
8
|
-
var bar = require('./bar2.js');
|
|
9
|
-
var constants = require('./constants.js');
|
|
10
|
-
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
5
|
+
require('../../../utils/index.js');
|
|
6
|
+
var runtime = require('../../../utils/vue/props/runtime.js');
|
|
11
7
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const sizeWidth = vue.ref("");
|
|
21
|
-
const sizeHeight = vue.ref("");
|
|
22
|
-
const ratioY = vue.ref(1);
|
|
23
|
-
const ratioX = vue.ref(1);
|
|
24
|
-
const handleScroll = (wrap) => {
|
|
25
|
-
if (wrap) {
|
|
26
|
-
const offsetHeight = wrap.offsetHeight - util.GAP;
|
|
27
|
-
const offsetWidth = wrap.offsetWidth - util.GAP;
|
|
28
|
-
moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
|
|
29
|
-
moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const update = () => {
|
|
33
|
-
const wrap = scrollbar == null ? void 0 : scrollbar.wrapElement;
|
|
34
|
-
if (!wrap)
|
|
35
|
-
return;
|
|
36
|
-
const offsetHeight = wrap.offsetHeight - util.GAP;
|
|
37
|
-
const offsetWidth = wrap.offsetWidth - util.GAP;
|
|
38
|
-
const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
|
|
39
|
-
const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
|
|
40
|
-
const height = Math.max(originalHeight, props.minSize);
|
|
41
|
-
const width = Math.max(originalWidth, props.minSize);
|
|
42
|
-
ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
|
|
43
|
-
ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
|
|
44
|
-
sizeHeight.value = height + util.GAP < offsetHeight ? `${height}px` : "";
|
|
45
|
-
sizeWidth.value = width + util.GAP < offsetWidth ? `${width}px` : "";
|
|
46
|
-
};
|
|
47
|
-
expose({
|
|
48
|
-
handleScroll,
|
|
49
|
-
update
|
|
50
|
-
});
|
|
51
|
-
return (_ctx, _cache) => {
|
|
52
|
-
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
53
|
-
vue.createVNode(thumb["default"], {
|
|
54
|
-
move: moveX.value,
|
|
55
|
-
ratio: ratioX.value,
|
|
56
|
-
size: sizeWidth.value,
|
|
57
|
-
always: _ctx.always
|
|
58
|
-
}, null, 8, ["move", "ratio", "size", "always"]),
|
|
59
|
-
vue.createVNode(thumb["default"], {
|
|
60
|
-
move: moveY.value,
|
|
61
|
-
ratio: ratioY.value,
|
|
62
|
-
size: sizeHeight.value,
|
|
63
|
-
vertical: "",
|
|
64
|
-
always: _ctx.always
|
|
65
|
-
}, null, 8, ["move", "ratio", "size", "always"])
|
|
66
|
-
], 64);
|
|
67
|
-
};
|
|
8
|
+
const barProps = runtime.buildProps({
|
|
9
|
+
always: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: true
|
|
12
|
+
},
|
|
13
|
+
minSize: {
|
|
14
|
+
type: Number,
|
|
15
|
+
required: true
|
|
68
16
|
}
|
|
69
17
|
});
|
|
70
|
-
var Bar = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "bar.vue"]]);
|
|
71
18
|
|
|
72
|
-
exports
|
|
19
|
+
exports.barProps = barProps;
|
|
73
20
|
//# sourceMappingURL=bar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar.js","sources":["../../../../../../packages/components/scrollbar/src/bar.
|
|
1
|
+
{"version":3,"file":"bar.js","sources":["../../../../../../packages/components/scrollbar/src/bar.ts"],"sourcesContent":["import { buildProps } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type Bar from './bar.vue'\n\nexport const barProps = buildProps({\n always: {\n type: Boolean,\n default: true,\n },\n minSize: {\n type: Number,\n required: true,\n },\n} as const)\nexport type BarProps = ExtractPropTypes<typeof barProps>\n\nexport type BarInstance = InstanceType<typeof Bar>\n"],"names":["buildProps"],"mappings":";;;;;;;AACY,MAAC,QAAQ,GAAGA,kBAAU,CAAC;AACnC,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,QAAQ,EAAE,IAAI;AAClB,GAAG;AACH,CAAC;;;;"}
|
|
@@ -2,19 +2,72 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('
|
|
6
|
-
var
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var util = require('./util.js');
|
|
7
|
+
var thumb = require('./thumb2.js');
|
|
8
|
+
var bar = require('./bar.js');
|
|
9
|
+
var constants = require('./constants.js');
|
|
10
|
+
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
7
11
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
13
|
+
__name: "bar",
|
|
14
|
+
props: bar.barProps,
|
|
15
|
+
setup(__props, { expose }) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
const scrollbar = vue.inject(constants.scrollbarContextKey);
|
|
18
|
+
const moveX = vue.ref(0);
|
|
19
|
+
const moveY = vue.ref(0);
|
|
20
|
+
const sizeWidth = vue.ref("");
|
|
21
|
+
const sizeHeight = vue.ref("");
|
|
22
|
+
const ratioY = vue.ref(1);
|
|
23
|
+
const ratioX = vue.ref(1);
|
|
24
|
+
const handleScroll = (wrap) => {
|
|
25
|
+
if (wrap) {
|
|
26
|
+
const offsetHeight = wrap.offsetHeight - util.GAP;
|
|
27
|
+
const offsetWidth = wrap.offsetWidth - util.GAP;
|
|
28
|
+
moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
|
|
29
|
+
moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const update = () => {
|
|
33
|
+
const wrap = scrollbar == null ? void 0 : scrollbar.wrapElement;
|
|
34
|
+
if (!wrap)
|
|
35
|
+
return;
|
|
36
|
+
const offsetHeight = wrap.offsetHeight - util.GAP;
|
|
37
|
+
const offsetWidth = wrap.offsetWidth - util.GAP;
|
|
38
|
+
const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
|
|
39
|
+
const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
|
|
40
|
+
const height = Math.max(originalHeight, props.minSize);
|
|
41
|
+
const width = Math.max(originalWidth, props.minSize);
|
|
42
|
+
ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
|
|
43
|
+
ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
|
|
44
|
+
sizeHeight.value = height + util.GAP < offsetHeight ? `${height}px` : "";
|
|
45
|
+
sizeWidth.value = width + util.GAP < offsetWidth ? `${width}px` : "";
|
|
46
|
+
};
|
|
47
|
+
expose({
|
|
48
|
+
handleScroll,
|
|
49
|
+
update
|
|
50
|
+
});
|
|
51
|
+
return (_ctx, _cache) => {
|
|
52
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
53
|
+
vue.createVNode(thumb["default"], {
|
|
54
|
+
move: moveX.value,
|
|
55
|
+
ratio: ratioX.value,
|
|
56
|
+
size: sizeWidth.value,
|
|
57
|
+
always: _ctx.always
|
|
58
|
+
}, null, 8, ["move", "ratio", "size", "always"]),
|
|
59
|
+
vue.createVNode(thumb["default"], {
|
|
60
|
+
move: moveY.value,
|
|
61
|
+
ratio: ratioY.value,
|
|
62
|
+
size: sizeHeight.value,
|
|
63
|
+
vertical: "",
|
|
64
|
+
always: _ctx.always
|
|
65
|
+
}, null, 8, ["move", "ratio", "size", "always"])
|
|
66
|
+
], 64);
|
|
67
|
+
};
|
|
16
68
|
}
|
|
17
69
|
});
|
|
70
|
+
var Bar = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "bar.vue"]]);
|
|
18
71
|
|
|
19
|
-
exports
|
|
72
|
+
exports["default"] = Bar;
|
|
20
73
|
//# sourceMappingURL=bar2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar2.js","sources":["../../../../../../packages/components/scrollbar/src/bar.
|
|
1
|
+
{"version":3,"file":"bar2.js","sources":["../../../../../../packages/components/scrollbar/src/bar.vue"],"sourcesContent":["<template>\n <thumb :move=\"moveX\" :ratio=\"ratioX\" :size=\"sizeWidth\" :always=\"always\" />\n <thumb\n :move=\"moveY\"\n :ratio=\"ratioY\"\n :size=\"sizeHeight\"\n vertical\n :always=\"always\"\n />\n</template>\n<script lang=\"ts\" setup>\nimport { inject, ref } from 'vue'\nimport { GAP } from './util'\nimport Thumb from './thumb.vue'\nimport { barProps } from './bar'\nimport { scrollbarContextKey } from './constants'\n\nconst props = defineProps(barProps)\n\nconst scrollbar = inject(scrollbarContextKey)\n\nconst moveX = ref(0)\nconst moveY = ref(0)\nconst sizeWidth = ref('')\nconst sizeHeight = ref('')\nconst ratioY = ref(1)\nconst ratioX = ref(1)\n\nconst handleScroll = (wrap: HTMLDivElement) => {\n if (wrap) {\n const offsetHeight = wrap.offsetHeight - GAP\n const offsetWidth = wrap.offsetWidth - GAP\n\n moveY.value = ((wrap.scrollTop * 100) / offsetHeight) * ratioY.value\n moveX.value = ((wrap.scrollLeft * 100) / offsetWidth) * ratioX.value\n }\n}\n\nconst update = () => {\n const wrap = scrollbar?.wrapElement\n if (!wrap) return\n const offsetHeight = wrap.offsetHeight - GAP\n const offsetWidth = wrap.offsetWidth - GAP\n\n const originalHeight = offsetHeight ** 2 / wrap.scrollHeight\n const originalWidth = offsetWidth ** 2 / wrap.scrollWidth\n const height = Math.max(originalHeight, props.minSize)\n const width = Math.max(originalWidth, props.minSize)\n\n ratioY.value =\n originalHeight /\n (offsetHeight - originalHeight) /\n (height / (offsetHeight - height))\n ratioX.value =\n originalWidth /\n (offsetWidth - originalWidth) /\n (width / (offsetWidth - width))\n\n sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : ''\n sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : ''\n}\n\ndefineExpose({\n handleScroll,\n update,\n})\n</script>\n"],"names":["inject","scrollbarContextKey","ref","GAP"],"mappings":";;;;;;;;;;;;;;;;AAmBA,IAAM,MAAA,SAAA,GAAYA,WAAOC,6BAAmB,CAAA,CAAA;AAE5C,IAAM,MAAA,KAAA,GAAQC,QAAI,CAAC,CAAA,CAAA;AACnB,IAAM,MAAA,KAAA,GAAQA,QAAI,CAAC,CAAA,CAAA;AACnB,IAAM,MAAA,SAAA,GAAYA,QAAI,EAAE,CAAA,CAAA;AACxB,IAAM,MAAA,UAAA,GAAaA,QAAI,EAAE,CAAA,CAAA;AACzB,IAAM,MAAA,MAAA,GAASA,QAAI,CAAC,CAAA,CAAA;AACpB,IAAM,MAAA,MAAA,GAASA,QAAI,CAAC,CAAA,CAAA;AAEpB,IAAM,MAAA,YAAA,GAAe,CAAC,IAAyB,KAAA;AAC7C,MAAA,IAAI,IAAM,EAAA;AACR,QAAM,MAAA,YAAA,GAAe,KAAK,YAAe,GAAAC,QAAA,CAAA;AACzC,QAAM,MAAA,WAAA,GAAc,KAAK,WAAc,GAAAA,QAAA,CAAA;AAEvC,QAAA,KAAA,CAAM,KAAU,GAAA,IAAA,CAAK,SAAY,GAAA,GAAA,GAAO,eAAgB,MAAO,CAAA,KAAA,CAAA;AAC/D,QAAA,KAAA,CAAM,KAAU,GAAA,IAAA,CAAK,UAAa,GAAA,GAAA,GAAO,cAAe,MAAO,CAAA,KAAA,CAAA;AAAA,OACjE;AAAA,KACF,CAAA;AAEA,IAAA,MAAM,SAAS,MAAM;AACnB,MAAA,MAAM,OAAO,SAAW,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,SAAA,CAAA,WAAA,CAAA;AACxB,MAAA,IAAI,CAAC,IAAA;AAAM,QAAA,OAAA;AACX,MAAM,MAAA,YAAA,GAAe,KAAK,YAAe,GAAAA,QAAA,CAAA;AACzC,MAAM,MAAA,WAAA,GAAc,KAAK,WAAc,GAAAA,QAAA,CAAA;AAEvC,MAAM,MAAA,cAAA,GAAiB,YAAgB,IAAA,CAAA,GAAI,IAAK,CAAA,YAAA,CAAA;AAChD,MAAM,MAAA,aAAA,GAAgB,WAAe,IAAA,CAAA,GAAI,IAAK,CAAA,WAAA,CAAA;AAC9C,MAAA,MAAM,MAAS,GAAA,IAAA,CAAK,GAAI,CAAA,cAAA,EAAgB,MAAM,OAAO,CAAA,CAAA;AACrD,MAAA,MAAM,KAAQ,GAAA,IAAA,CAAK,GAAI,CAAA,aAAA,EAAe,MAAM,OAAO,CAAA,CAAA;AAEnD,MAAA,MAAA,CAAO,KACL,GAAA,cAAA,IACgB,YAAA,GAAA,cAAA,CAAA,cACU,YAAA,GAAA,MAAA,CAAA,CAAA,CAAA;AAC5B,MAAA,MAAA,CAAO,KACL,GAAA,aAAA,IACe,WAAA,GAAA,aAAA,CAAA,aACS,WAAA,GAAA,KAAA,CAAA,CAAA,CAAA;AAE1B,MAAA,UAAA,CAAW,KAAQ,GAAA,MAAA,GAASA,QAAM,GAAA,YAAA,GAAe,GAAG,MAAa,CAAA,EAAA,CAAA,GAAA,EAAA,CAAA;AACjE,MAAA,SAAA,CAAU,KAAQ,GAAA,KAAA,GAAQA,QAAM,GAAA,WAAA,GAAc,GAAG,KAAY,CAAA,EAAA,CAAA,GAAA,EAAA,CAAA;AAAA,KAC/D,CAAA;AAEA,IAAa,MAAA,CAAA;AAAA,MACX,YAAA;AAAA,MACA,MAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -6,7 +6,7 @@ var vue = require('vue');
|
|
|
6
6
|
var core = require('@vueuse/core');
|
|
7
7
|
require('../../../utils/index.js');
|
|
8
8
|
require('../../../hooks/index.js');
|
|
9
|
-
var bar = require('./
|
|
9
|
+
var bar = require('./bar2.js');
|
|
10
10
|
var constants = require('./constants.js');
|
|
11
11
|
var scrollbar = require('./scrollbar.js');
|
|
12
12
|
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
@@ -13,7 +13,7 @@ var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper
|
|
|
13
13
|
var index = require('../../../hooks/use-floating/index.js');
|
|
14
14
|
var index$1 = require('../../../hooks/use-z-index/index.js');
|
|
15
15
|
var index$2 = require('../../../hooks/use-namespace/index.js');
|
|
16
|
-
var visualHidden = require('../../visual-hidden/src/visual-
|
|
16
|
+
var visualHidden = require('../../visual-hidden/src/visual-hidden.js');
|
|
17
17
|
|
|
18
18
|
const _hoisted_1 = ["data-side"];
|
|
19
19
|
const __default__ = vue.defineComponent({
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var visualHidden = require('./src/visual-
|
|
6
|
-
var visualHidden$1 = require('./src/visual-
|
|
5
|
+
var visualHidden = require('./src/visual-hidden.js');
|
|
6
|
+
var visualHidden$1 = require('./src/visual-hidden2.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -2,15 +2,43 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('
|
|
6
|
-
var
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var visualHidden = require('./visual-hidden2.js');
|
|
7
|
+
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const __default__ = vue.defineComponent({
|
|
10
|
+
name: "ElVisuallyHidden"
|
|
11
|
+
});
|
|
12
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
13
|
+
...__default__,
|
|
14
|
+
props: visualHidden.visualHiddenProps,
|
|
15
|
+
setup(__props) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
const computedStyle = vue.computed(() => {
|
|
18
|
+
return [
|
|
19
|
+
props.style,
|
|
20
|
+
{
|
|
21
|
+
position: "absolute",
|
|
22
|
+
border: 0,
|
|
23
|
+
width: 1,
|
|
24
|
+
height: 1,
|
|
25
|
+
padding: 0,
|
|
26
|
+
margin: -1,
|
|
27
|
+
overflow: "hidden",
|
|
28
|
+
clip: "rect(0, 0, 0, 0)",
|
|
29
|
+
whiteSpace: "nowrap",
|
|
30
|
+
wordWrap: "normal"
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
});
|
|
34
|
+
return (_ctx, _cache) => {
|
|
35
|
+
return vue.openBlock(), vue.createElementBlock("span", vue.mergeProps(_ctx.$attrs, { style: vue.unref(computedStyle) }), [
|
|
36
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
37
|
+
], 16);
|
|
38
|
+
};
|
|
12
39
|
}
|
|
13
40
|
});
|
|
41
|
+
var ElVisuallyHidden = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "visual-hidden.vue"]]);
|
|
14
42
|
|
|
15
|
-
exports
|
|
43
|
+
exports["default"] = ElVisuallyHidden;
|
|
16
44
|
//# sourceMappingURL=visual-hidden.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual-hidden.js","sources":["../../../../../../packages/components/visual-hidden/src/visual-hidden.
|
|
1
|
+
{"version":3,"file":"visual-hidden.js","sources":["../../../../../../packages/components/visual-hidden/src/visual-hidden.vue"],"sourcesContent":["<template>\n <span v-bind=\"$attrs\" :style=\"computedStyle\">\n <slot />\n </span>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport { visualHiddenProps } from './visual-hidden'\nimport type { StyleValue } from 'vue'\nconst props = defineProps(visualHiddenProps)\n\ndefineOptions({\n name: 'ElVisuallyHidden',\n})\n\nconst computedStyle = computed<StyleValue>(() => {\n return [\n props.style,\n {\n position: 'absolute',\n border: 0,\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n wordWrap: 'normal',\n },\n ]\n})\n</script>\n"],"names":["computed"],"mappings":";;;;;;;;uCAYc,CAAA;AAAA,EACZ,IAAM,EAAA,kBAAA;AACR,CAAA,CAAA,CAAA;;;;;;AAEA,IAAM,MAAA,aAAA,GAAgBA,aAAqB,MAAM;AAC/C,MAAO,OAAA;AAAA,QACL,KAAM,CAAA,KAAA;AAAA,QACN;AAAA,UACE,QAAU,EAAA,UAAA;AAAA,UACV,MAAQ,EAAA,CAAA;AAAA,UACR,KAAO,EAAA,CAAA;AAAA,UACP,MAAQ,EAAA,CAAA;AAAA,UACR,OAAS,EAAA,CAAA;AAAA,UACT,MAAQ,EAAA,CAAA,CAAA;AAAA,UACR,QAAU,EAAA,QAAA;AAAA,UACV,IAAM,EAAA,kBAAA;AAAA,UACN,UAAY,EAAA,QAAA;AAAA,UACZ,QAAU,EAAA,QAAA;AAAA,SACZ;AAAA,OACF,CAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;"}
|
|
@@ -2,43 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
5
|
+
require('../../../utils/index.js');
|
|
6
|
+
var runtime = require('../../../utils/vue/props/runtime.js');
|
|
8
7
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
...__default__,
|
|
14
|
-
props: visualHidden.visualHiddenProps,
|
|
15
|
-
setup(__props) {
|
|
16
|
-
const props = __props;
|
|
17
|
-
const computedStyle = vue.computed(() => {
|
|
18
|
-
return [
|
|
19
|
-
props.style,
|
|
20
|
-
{
|
|
21
|
-
position: "absolute",
|
|
22
|
-
border: 0,
|
|
23
|
-
width: 1,
|
|
24
|
-
height: 1,
|
|
25
|
-
padding: 0,
|
|
26
|
-
margin: -1,
|
|
27
|
-
overflow: "hidden",
|
|
28
|
-
clip: "rect(0, 0, 0, 0)",
|
|
29
|
-
whiteSpace: "nowrap",
|
|
30
|
-
wordWrap: "normal"
|
|
31
|
-
}
|
|
32
|
-
];
|
|
33
|
-
});
|
|
34
|
-
return (_ctx, _cache) => {
|
|
35
|
-
return vue.openBlock(), vue.createElementBlock("span", vue.mergeProps(_ctx.$attrs, { style: vue.unref(computedStyle) }), [
|
|
36
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
37
|
-
], 16);
|
|
38
|
-
};
|
|
8
|
+
const visualHiddenProps = runtime.buildProps({
|
|
9
|
+
style: {
|
|
10
|
+
type: runtime.definePropType([String, Object, Array]),
|
|
11
|
+
default: () => ({})
|
|
39
12
|
}
|
|
40
13
|
});
|
|
41
|
-
var ElVisuallyHidden = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "visual-hidden.vue"]]);
|
|
42
14
|
|
|
43
|
-
exports
|
|
15
|
+
exports.visualHiddenProps = visualHiddenProps;
|
|
44
16
|
//# sourceMappingURL=visual-hidden2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual-hidden2.js","sources":["../../../../../../packages/components/visual-hidden/src/visual-hidden.
|
|
1
|
+
{"version":3,"file":"visual-hidden2.js","sources":["../../../../../../packages/components/visual-hidden/src/visual-hidden.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport type { StyleValue } from 'vue'\n\nexport const visualHiddenProps = buildProps({\n style: {\n type: definePropType<StyleValue>([String, Object, Array]),\n default: () => ({}),\n },\n} as const)\n"],"names":["buildProps","definePropType"],"mappings":";;;;;;;AACY,MAAC,iBAAiB,GAAGA,kBAAU,CAAC;AAC5C,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAEC,sBAAc,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACjD,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;AACvB,GAAG;AACH,CAAC;;;;"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('../../utils/index.js');
|
|
6
|
-
var watermark$1 = require('./src/
|
|
7
|
-
var watermark = require('./src/
|
|
6
|
+
var watermark$1 = require('./src/watermark.js');
|
|
7
|
+
var watermark = require('./src/watermark2.js');
|
|
8
8
|
var install = require('../../utils/vue/install.js');
|
|
9
9
|
|
|
10
10
|
const ElWatermark = install.withInstall(watermark$1["default"]);
|
|
@@ -2,36 +2,217 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('
|
|
6
|
-
var
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var core = require('@vueuse/core');
|
|
7
|
+
var watermark = require('./watermark2.js');
|
|
8
|
+
var utils = require('./utils.js');
|
|
9
|
+
var useClips = require('./useClips.js');
|
|
10
|
+
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
7
11
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
12
|
+
const __default__ = vue.defineComponent({
|
|
13
|
+
name: "ElWatermark"
|
|
14
|
+
});
|
|
15
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
16
|
+
...__default__,
|
|
17
|
+
props: watermark.watermarkProps,
|
|
18
|
+
setup(__props) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
const style = {
|
|
21
|
+
position: "relative"
|
|
22
|
+
};
|
|
23
|
+
const color = vue.computed(() => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.color) != null ? _b : "rgba(0,0,0,.15)";
|
|
26
|
+
});
|
|
27
|
+
const fontSize = vue.computed(() => {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.fontSize) != null ? _b : 16;
|
|
30
|
+
});
|
|
31
|
+
const fontWeight = vue.computed(() => {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.fontWeight) != null ? _b : "normal";
|
|
34
|
+
});
|
|
35
|
+
const fontStyle = vue.computed(() => {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.fontStyle) != null ? _b : "normal";
|
|
38
|
+
});
|
|
39
|
+
const fontFamily = vue.computed(() => {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.fontFamily) != null ? _b : "sans-serif";
|
|
42
|
+
});
|
|
43
|
+
const textAlign = vue.computed(() => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.textAlign) != null ? _b : "center";
|
|
46
|
+
});
|
|
47
|
+
const textBaseline = vue.computed(() => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
return (_b = (_a = props.font) == null ? void 0 : _a.textBaseline) != null ? _b : "hanging";
|
|
50
|
+
});
|
|
51
|
+
const gapX = vue.computed(() => props.gap[0]);
|
|
52
|
+
const gapY = vue.computed(() => props.gap[1]);
|
|
53
|
+
const gapXCenter = vue.computed(() => gapX.value / 2);
|
|
54
|
+
const gapYCenter = vue.computed(() => gapY.value / 2);
|
|
55
|
+
const offsetLeft = vue.computed(() => {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
return (_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : gapXCenter.value;
|
|
58
|
+
});
|
|
59
|
+
const offsetTop = vue.computed(() => {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
return (_b = (_a = props.offset) == null ? void 0 : _a[1]) != null ? _b : gapYCenter.value;
|
|
62
|
+
});
|
|
63
|
+
const getMarkStyle = () => {
|
|
64
|
+
const markStyle = {
|
|
65
|
+
zIndex: props.zIndex,
|
|
66
|
+
position: "absolute",
|
|
67
|
+
left: 0,
|
|
68
|
+
top: 0,
|
|
69
|
+
width: "100%",
|
|
70
|
+
height: "100%",
|
|
71
|
+
pointerEvents: "none",
|
|
72
|
+
backgroundRepeat: "repeat"
|
|
73
|
+
};
|
|
74
|
+
let positionLeft = offsetLeft.value - gapXCenter.value;
|
|
75
|
+
let positionTop = offsetTop.value - gapYCenter.value;
|
|
76
|
+
if (positionLeft > 0) {
|
|
77
|
+
markStyle.left = `${positionLeft}px`;
|
|
78
|
+
markStyle.width = `calc(100% - ${positionLeft}px)`;
|
|
79
|
+
positionLeft = 0;
|
|
80
|
+
}
|
|
81
|
+
if (positionTop > 0) {
|
|
82
|
+
markStyle.top = `${positionTop}px`;
|
|
83
|
+
markStyle.height = `calc(100% - ${positionTop}px)`;
|
|
84
|
+
positionTop = 0;
|
|
85
|
+
}
|
|
86
|
+
markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
|
|
87
|
+
return markStyle;
|
|
88
|
+
};
|
|
89
|
+
const containerRef = vue.shallowRef(null);
|
|
90
|
+
const watermarkRef = vue.shallowRef();
|
|
91
|
+
const stopObservation = vue.ref(false);
|
|
92
|
+
const destroyWatermark = () => {
|
|
93
|
+
if (watermarkRef.value) {
|
|
94
|
+
watermarkRef.value.remove();
|
|
95
|
+
watermarkRef.value = void 0;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const appendWatermark = (base64Url, markWidth) => {
|
|
99
|
+
var _a;
|
|
100
|
+
if (containerRef.value && watermarkRef.value) {
|
|
101
|
+
stopObservation.value = true;
|
|
102
|
+
watermarkRef.value.setAttribute("style", utils.getStyleStr({
|
|
103
|
+
...getMarkStyle(),
|
|
104
|
+
backgroundImage: `url('${base64Url}')`,
|
|
105
|
+
backgroundSize: `${Math.floor(markWidth)}px`
|
|
106
|
+
}));
|
|
107
|
+
(_a = containerRef.value) == null ? void 0 : _a.append(watermarkRef.value);
|
|
108
|
+
setTimeout(() => {
|
|
109
|
+
stopObservation.value = false;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const getMarkSize = (ctx) => {
|
|
114
|
+
let defaultWidth = 120;
|
|
115
|
+
let defaultHeight = 64;
|
|
116
|
+
const image = props.image;
|
|
117
|
+
const content = props.content;
|
|
118
|
+
const width = props.width;
|
|
119
|
+
const height = props.height;
|
|
120
|
+
if (!image && ctx.measureText) {
|
|
121
|
+
ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
|
|
122
|
+
const contents = Array.isArray(content) ? content : [content];
|
|
123
|
+
const sizes = contents.map((item) => {
|
|
124
|
+
const metrics = ctx.measureText(item);
|
|
125
|
+
return [
|
|
126
|
+
metrics.width,
|
|
127
|
+
metrics.fontBoundingBoxAscent !== void 0 ? metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent : metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent
|
|
128
|
+
];
|
|
129
|
+
});
|
|
130
|
+
defaultWidth = Math.ceil(Math.max(...sizes.map((size) => size[0])));
|
|
131
|
+
defaultHeight = Math.ceil(Math.max(...sizes.map((size) => size[1]))) * contents.length + (contents.length - 1) * useClips.FontGap;
|
|
132
|
+
}
|
|
133
|
+
return [width != null ? width : defaultWidth, height != null ? height : defaultHeight];
|
|
134
|
+
};
|
|
135
|
+
const getClips = useClips["default"]();
|
|
136
|
+
const renderWatermark = () => {
|
|
137
|
+
const canvas = document.createElement("canvas");
|
|
138
|
+
const ctx = canvas.getContext("2d");
|
|
139
|
+
const image = props.image;
|
|
140
|
+
const content = props.content;
|
|
141
|
+
const rotate = props.rotate;
|
|
142
|
+
if (ctx) {
|
|
143
|
+
if (!watermarkRef.value) {
|
|
144
|
+
watermarkRef.value = document.createElement("div");
|
|
145
|
+
}
|
|
146
|
+
const ratio = utils.getPixelRatio();
|
|
147
|
+
const [markWidth, markHeight] = getMarkSize(ctx);
|
|
148
|
+
const drawCanvas = (drawContent) => {
|
|
149
|
+
const [textClips, clipWidth] = getClips(drawContent || "", rotate, ratio, markWidth, markHeight, {
|
|
150
|
+
color: color.value,
|
|
151
|
+
fontSize: fontSize.value,
|
|
152
|
+
fontStyle: fontStyle.value,
|
|
153
|
+
fontWeight: fontWeight.value,
|
|
154
|
+
fontFamily: fontFamily.value,
|
|
155
|
+
textAlign: textAlign.value,
|
|
156
|
+
textBaseline: textBaseline.value
|
|
157
|
+
}, gapX.value, gapY.value);
|
|
158
|
+
appendWatermark(textClips, clipWidth);
|
|
159
|
+
};
|
|
160
|
+
if (image) {
|
|
161
|
+
const img = new Image();
|
|
162
|
+
img.onload = () => {
|
|
163
|
+
drawCanvas(img);
|
|
164
|
+
};
|
|
165
|
+
img.onerror = () => {
|
|
166
|
+
drawCanvas(content);
|
|
167
|
+
};
|
|
168
|
+
img.crossOrigin = "anonymous";
|
|
169
|
+
img.referrerPolicy = "no-referrer";
|
|
170
|
+
img.src = image;
|
|
171
|
+
} else {
|
|
172
|
+
drawCanvas(content);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
vue.onMounted(() => {
|
|
177
|
+
renderWatermark();
|
|
178
|
+
});
|
|
179
|
+
vue.watch(() => props, () => {
|
|
180
|
+
renderWatermark();
|
|
181
|
+
}, {
|
|
182
|
+
deep: true,
|
|
183
|
+
flush: "post"
|
|
184
|
+
});
|
|
185
|
+
vue.onBeforeUnmount(() => {
|
|
186
|
+
destroyWatermark();
|
|
187
|
+
});
|
|
188
|
+
const onMutate = (mutations) => {
|
|
189
|
+
if (stopObservation.value) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
mutations.forEach((mutation) => {
|
|
193
|
+
if (utils.reRendering(mutation, watermarkRef.value)) {
|
|
194
|
+
destroyWatermark();
|
|
195
|
+
renderWatermark();
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
core.useMutationObserver(containerRef, onMutate, {
|
|
200
|
+
attributes: true,
|
|
201
|
+
subtree: true,
|
|
202
|
+
childList: true
|
|
203
|
+
});
|
|
204
|
+
return (_ctx, _cache) => {
|
|
205
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
206
|
+
ref_key: "containerRef",
|
|
207
|
+
ref: containerRef,
|
|
208
|
+
style: vue.normalizeStyle([style])
|
|
209
|
+
}, [
|
|
210
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
211
|
+
], 4);
|
|
212
|
+
};
|
|
33
213
|
}
|
|
34
214
|
});
|
|
215
|
+
var Watermark = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "watermark.vue"]]);
|
|
35
216
|
|
|
36
|
-
exports
|
|
217
|
+
exports["default"] = Watermark;
|
|
37
218
|
//# sourceMappingURL=watermark.js.map
|