@wfrog/vc-ui 1.11.10 → 1.11.11

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.
Files changed (134) hide show
  1. package/dist/es/chunk/Bw0Rhd-r.mjs +110 -0
  2. package/dist/es/chunk/CqTdDZkE.mjs +31 -0
  3. package/dist/es/chunk/{DAnWZLYj.mjs → CzWfBa_8.mjs} +96 -2
  4. package/dist/es/chunk/D229kQ56.mjs +28 -0
  5. package/dist/es/chunk/{Cxx_YWUC.mjs → DcouM6gM.mjs} +6 -548
  6. package/dist/es/chunk/Fo0dZYnz.mjs +128 -0
  7. package/dist/es/chunk/KanuIcmc.mjs +412 -0
  8. package/dist/es/chunk/{B71xEPfK.mjs → uuUHUjSk.mjs} +4 -35
  9. package/dist/es/components/backbottom/backbottom.mjs +3 -2
  10. package/dist/es/components/button/button.mjs +4 -5
  11. package/dist/es/components/choice/choice.mjs +4 -4
  12. package/dist/es/components/choice/index.css +1 -1
  13. package/dist/es/components/color-switch/color-switch.mjs +73 -1046
  14. package/dist/es/components/color-switch/index.css +1 -1
  15. package/dist/es/components/cropper/cropper.mjs +11 -117
  16. package/dist/es/components/cropper/index.css +1 -1
  17. package/dist/es/components/currency/currency.mjs +4 -5
  18. package/dist/es/components/daterange-picker/daterange-picker.mjs +8 -6253
  19. package/dist/es/components/dialog/dialog.mjs +7 -400
  20. package/dist/es/components/dialog/index.css +1 -1
  21. package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +10 -11
  22. package/dist/es/components/dialog-map-point/dialog-map-point.mjs +4 -3
  23. package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +9 -1374
  24. package/dist/es/components/dialog-upload-images/index.css +1 -1
  25. package/dist/es/components/drag-verify/drag-verify.mjs +3 -2
  26. package/dist/es/components/drawer/drawer.mjs +10 -352
  27. package/dist/es/components/drawer/index.css +1 -1
  28. package/dist/es/components/easy-pagination/easy-pagination.mjs +3 -2
  29. package/dist/es/components/explorer/explorer.mjs +3 -3
  30. package/dist/es/components/explorer-column-table/explorer-column-table.mjs +5 -7
  31. package/dist/es/components/explorer-column-table/index.css +1 -1
  32. package/dist/es/components/explorer-container/explorer-container.d.ts +1 -1
  33. package/dist/es/components/explorer-container/explorer-container.mjs +4 -3
  34. package/dist/es/components/explorer-filter/explorer-filter.mjs +5 -4
  35. package/dist/es/components/explorer-footer/explorer-footer.mjs +4 -8
  36. package/dist/es/components/explorer-form/explorer-form.mjs +4 -3
  37. package/dist/es/components/explorer-list/explorer-list.mjs +5 -4
  38. package/dist/es/components/explorer-modal-form/explorer-modal-form.mjs +4 -3
  39. package/dist/es/components/explorer-panel/explorer-panel.mjs +3 -3
  40. package/dist/es/components/explorer-query/explorer-query.mjs +9 -2201
  41. package/dist/es/components/explorer-query/index.css +1 -1
  42. package/dist/es/components/explorer-table/explorer-table.mjs +5 -8
  43. package/dist/es/components/explorer-tools/explorer-tools.mjs +13 -264
  44. package/dist/es/components/explorer-tools/index.css +1 -1
  45. package/dist/es/components/explorer-tree/explorer-tree.mjs +4 -5
  46. package/dist/es/components/icon-picker/icon-picker.mjs +8 -12
  47. package/dist/es/components/image/image.mjs +4 -4
  48. package/dist/es/components/info-tooltip/info-tooltip.mjs +336 -4
  49. package/dist/es/components/input/input.mjs +3 -2
  50. package/dist/es/components/input-number/input-number.mjs +3 -3
  51. package/dist/es/components/pca-picker/index.css +1 -1
  52. package/dist/es/components/pca-picker/pca-picker.mjs +443 -601
  53. package/dist/es/components/screenfull/screenfull.mjs +4 -3
  54. package/dist/es/components/scrollbar/scrollbar.mjs +3 -2
  55. package/dist/es/components/select/select.mjs +3 -5
  56. package/dist/es/components/single-player/index.css +1 -1
  57. package/dist/es/components/single-player/single-player.mjs +10 -1087
  58. package/dist/es/components/splitter/splitter.mjs +3 -3
  59. package/dist/es/components/splitter-panel/splitter-panel.mjs +3 -3
  60. package/dist/es/components/switch/index.css +1 -1
  61. package/dist/es/components/switch/switch.mjs +9 -395
  62. package/dist/es/components/tags/tags.mjs +7 -9
  63. package/dist/es/components/text-ellipsis/text-ellipsis.mjs +3 -3
  64. package/dist/es/components/thousand-input/thousand-input.mjs +33 -1
  65. package/dist/es/components/tinymce/tinymce.mjs +4 -3
  66. package/dist/es/components/transfer/transfer.mjs +3 -4
  67. package/dist/es/components/transfer-panel/transfer-panel.mjs +5 -4
  68. package/dist/es/components/tree-picker/popover-cascader.css +1 -1
  69. package/dist/es/components/tree-picker/tree-picker.mjs +5 -10
  70. package/dist/es/index.mjs +1 -1
  71. package/dist/index.css +13 -40
  72. package/package.json +1 -1
  73. package/dist/es/chunk/B-rxnVJv.mjs +0 -3
  74. package/dist/es/chunk/B5HpgPRt.mjs +0 -69
  75. package/dist/es/chunk/BBhZKpIc.mjs +0 -2179
  76. package/dist/es/chunk/BDcsaNYa.mjs +0 -59
  77. package/dist/es/chunk/BTSSEFfD.mjs +0 -319
  78. package/dist/es/chunk/BTpNRPQW.mjs +0 -55
  79. package/dist/es/chunk/BVBK1U57.mjs +0 -96
  80. package/dist/es/chunk/Bc6yUGLs.mjs +0 -45
  81. package/dist/es/chunk/BjVI1XMz.mjs +0 -40
  82. package/dist/es/chunk/BlzQCBDu.mjs +0 -5741
  83. package/dist/es/chunk/BpJKnxlF.mjs +0 -476
  84. package/dist/es/chunk/Brp-qSBw.mjs +0 -2003
  85. package/dist/es/chunk/BunQI8Jb.mjs +0 -390
  86. package/dist/es/chunk/C0XgBrDz.mjs +0 -775
  87. package/dist/es/chunk/C0pTANRX.mjs +0 -109
  88. package/dist/es/chunk/CBMjhoFP.mjs +0 -101
  89. package/dist/es/chunk/CBiNtNvQ.mjs +0 -242
  90. package/dist/es/chunk/CBlJeNBO.mjs +0 -890
  91. package/dist/es/chunk/CCVL_Zj-.mjs +0 -427
  92. package/dist/es/chunk/CEl4MyfJ.mjs +0 -252
  93. package/dist/es/chunk/CJK5_jsA.mjs +0 -53
  94. package/dist/es/chunk/CKOcwq5V.mjs +0 -44
  95. package/dist/es/chunk/COs9dJZa.mjs +0 -66
  96. package/dist/es/chunk/CPt6MxJW.mjs +0 -375
  97. package/dist/es/chunk/CVqW0jzp.mjs +0 -107
  98. package/dist/es/chunk/CccIsEqA.mjs +0 -128
  99. package/dist/es/chunk/CjLR27-a.mjs +0 -582
  100. package/dist/es/chunk/CoGexPPD.mjs +0 -2192
  101. package/dist/es/chunk/CsLIbnzG.mjs +0 -64
  102. package/dist/es/chunk/Ct6q2FXg.mjs +0 -5
  103. package/dist/es/chunk/Cuq5meQh.mjs +0 -184
  104. package/dist/es/chunk/CvYIOfT1.mjs +0 -23
  105. package/dist/es/chunk/CxHJBf4l.mjs +0 -31
  106. package/dist/es/chunk/CzdaOBtA.mjs +0 -66
  107. package/dist/es/chunk/D0QTifnI.mjs +0 -54
  108. package/dist/es/chunk/D1QnA2iT.mjs +0 -229
  109. package/dist/es/chunk/D3AvJlVX.mjs +0 -188
  110. package/dist/es/chunk/D9Lr0Bzb.mjs +0 -1136
  111. package/dist/es/chunk/DCkPv0hy.mjs +0 -29
  112. package/dist/es/chunk/DRwwUUhy.mjs +0 -49
  113. package/dist/es/chunk/DX-2VRY2.mjs +0 -836
  114. package/dist/es/chunk/DZ2oTFad.mjs +0 -687
  115. package/dist/es/chunk/D_bou1py.mjs +0 -55
  116. package/dist/es/chunk/Da199A5L.mjs +0 -314
  117. package/dist/es/chunk/DbhQlaOz.mjs +0 -94
  118. package/dist/es/chunk/Dgu95mOy.mjs +0 -237
  119. package/dist/es/chunk/DhGOsWxx.mjs +0 -6
  120. package/dist/es/chunk/Dm_Sj5aH.mjs +0 -487
  121. package/dist/es/chunk/Dmi-1GRO.mjs +0 -163
  122. package/dist/es/chunk/DodoD9a9.mjs +0 -52
  123. package/dist/es/chunk/DrrVDcwm.mjs +0 -955
  124. package/dist/es/chunk/Du_zJ1Fz.mjs +0 -49
  125. package/dist/es/chunk/DxxbB5jY.mjs +0 -34
  126. package/dist/es/chunk/Gk1J52Yw.mjs +0 -207
  127. package/dist/es/chunk/NsldgdCh.mjs +0 -704
  128. package/dist/es/chunk/V6KjsUQN.mjs +0 -35
  129. package/dist/es/chunk/eEsLFV3s.mjs +0 -76
  130. package/dist/es/chunk/fqiLhk0V.mjs +0 -2065
  131. package/dist/es/chunk/nxVM7re4.mjs +0 -35
  132. package/dist/es/chunk/s7HLrANj.mjs +0 -215
  133. package/dist/es/chunk/vPhxogl3.mjs +0 -19
  134. package/dist/es/components/icon/icon2.mjs +0 -27
@@ -1,128 +0,0 @@
1
- import { isClient } from '@vueuse/core';
2
- import { e as isWindow } from './Bc6yUGLs.mjs';
3
- import { r as rAF, c as cAF } from './DhGOsWxx.mjs';
4
- import { g as getStyle } from './DodoD9a9.mjs';
5
- import { f as isFunction } from './Gk1J52Yw.mjs';
6
-
7
- function easeInOutCubic(t, b, c, d) {
8
- const cc = c - b;
9
- t /= d / 2;
10
- if (t < 1) {
11
- return cc / 2 * t * t * t + b;
12
- }
13
- return cc / 2 * ((t -= 2) * t * t + 2) + b;
14
- }
15
-
16
- const isScroll = (el, isVertical) => {
17
- if (!isClient)
18
- return false;
19
- const key = {
20
- undefined: "overflow",
21
- true: "overflow-y",
22
- false: "overflow-x"
23
- }[String(isVertical)];
24
- const overflow = getStyle(el, key);
25
- return ["scroll", "auto", "overlay"].some((s) => overflow.includes(s));
26
- };
27
- const getScrollContainer = (el, isVertical) => {
28
- if (!isClient)
29
- return;
30
- let parent = el;
31
- while (parent) {
32
- if ([window, document, document.documentElement].includes(parent))
33
- return window;
34
- if (isScroll(parent, isVertical))
35
- return parent;
36
- parent = parent.parentNode;
37
- }
38
- return parent;
39
- };
40
- let scrollBarWidth;
41
- const getScrollBarWidth = (namespace) => {
42
- var _a;
43
- if (!isClient)
44
- return 0;
45
- if (scrollBarWidth !== void 0)
46
- return scrollBarWidth;
47
- const outer = document.createElement("div");
48
- outer.className = `${namespace}-scrollbar__wrap`;
49
- outer.style.visibility = "hidden";
50
- outer.style.width = "100px";
51
- outer.style.position = "absolute";
52
- outer.style.top = "-9999px";
53
- document.body.appendChild(outer);
54
- const widthNoScroll = outer.offsetWidth;
55
- outer.style.overflow = "scroll";
56
- const inner = document.createElement("div");
57
- inner.style.width = "100%";
58
- outer.appendChild(inner);
59
- const widthWithScroll = inner.offsetWidth;
60
- (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
61
- scrollBarWidth = widthNoScroll - widthWithScroll;
62
- return scrollBarWidth;
63
- };
64
- function scrollIntoView(container, selected) {
65
- if (!isClient)
66
- return;
67
- if (!selected) {
68
- container.scrollTop = 0;
69
- return;
70
- }
71
- const offsetParents = [];
72
- let pointer = selected.offsetParent;
73
- while (pointer !== null && container !== pointer && container.contains(pointer)) {
74
- offsetParents.push(pointer);
75
- pointer = pointer.offsetParent;
76
- }
77
- const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
78
- const bottom = top + selected.offsetHeight;
79
- const viewRectTop = container.scrollTop;
80
- const viewRectBottom = viewRectTop + container.clientHeight;
81
- if (top < viewRectTop) {
82
- container.scrollTop = top;
83
- } else if (bottom > viewRectBottom) {
84
- container.scrollTop = bottom - container.clientHeight;
85
- }
86
- }
87
- function animateScrollTo(container, from, to, duration, callback) {
88
- const startTime = Date.now();
89
- let handle;
90
- const scroll = () => {
91
- const timestamp = Date.now();
92
- const time = timestamp - startTime;
93
- const nextScrollTop = easeInOutCubic(
94
- time > duration ? duration : time,
95
- from,
96
- to,
97
- duration
98
- );
99
- if (isWindow(container)) {
100
- container.scrollTo(window.pageXOffset, nextScrollTop);
101
- } else {
102
- container.scrollTop = nextScrollTop;
103
- }
104
- if (time < duration) {
105
- handle = rAF(scroll);
106
- } else if (isFunction(callback)) {
107
- callback();
108
- }
109
- };
110
- scroll();
111
- return () => {
112
- handle && cAF(handle);
113
- };
114
- }
115
- const getScrollElement = (target, container) => {
116
- if (isWindow(container)) {
117
- return target.ownerDocument.documentElement;
118
- }
119
- return container;
120
- };
121
- const getScrollTop = (container) => {
122
- if (isWindow(container)) {
123
- return window.scrollY;
124
- }
125
- return container.scrollTop;
126
- };
127
-
128
- export { animateScrollTo as a, getScrollTop as b, getScrollContainer as c, getScrollBarWidth as d, getScrollElement as g, scrollIntoView as s };
@@ -1,582 +0,0 @@
1
- import { defineComponent, inject, ref, computed, onBeforeUnmount, toRef, createBlock, openBlock, Transition, unref, withCtx, withDirectives, createElementVNode, withModifiers, normalizeClass, normalizeStyle, vShow, createElementBlock, Fragment, createVNode, watch, nextTick, provide, reactive, onActivated, onMounted, onUpdated, createCommentVNode, resolveDynamicComponent, renderSlot } from 'vue';
2
- import { useEventListener, isClient, useResizeObserver } from '@vueuse/core';
3
- import { b as buildProps, u as useNamespace, t as throwError, d as definePropType, a as debugWarn, j as isObject } from './Gk1J52Yw.mjs';
4
- import { _ as _export_sfc, w as withInstall } from './V6KjsUQN.mjs';
5
- import { u as useAriaProps } from './BunQI8Jb.mjs';
6
- import { b as isNumber } from './Bc6yUGLs.mjs';
7
- import { a as addUnit } from './DodoD9a9.mjs';
8
-
9
- const GAP = 4;
10
- const BAR_MAP = {
11
- vertical: {
12
- offset: "offsetHeight",
13
- scroll: "scrollTop",
14
- scrollSize: "scrollHeight",
15
- size: "height",
16
- key: "vertical",
17
- axis: "Y",
18
- client: "clientY",
19
- direction: "top"
20
- },
21
- horizontal: {
22
- offset: "offsetWidth",
23
- scroll: "scrollLeft",
24
- scrollSize: "scrollWidth",
25
- size: "width",
26
- key: "horizontal",
27
- axis: "X",
28
- client: "clientX",
29
- direction: "left"
30
- }
31
- };
32
- const renderThumbStyle = ({
33
- move,
34
- size,
35
- bar
36
- }) => ({
37
- [bar.size]: size,
38
- transform: `translate${bar.axis}(${move}%)`
39
- });
40
-
41
- const scrollbarContextKey = Symbol(
42
- "scrollbarContextKey"
43
- );
44
-
45
- const thumbProps = buildProps({
46
- vertical: Boolean,
47
- size: String,
48
- move: Number,
49
- ratio: {
50
- type: Number,
51
- required: true
52
- },
53
- always: Boolean
54
- });
55
-
56
- const COMPONENT_NAME$1 = "Thumb";
57
- const _sfc_main$2 = defineComponent({
58
- __name: "thumb",
59
- props: thumbProps,
60
- setup(__props) {
61
- const props = __props;
62
- const scrollbar = inject(scrollbarContextKey);
63
- const ns = useNamespace("scrollbar");
64
- if (!scrollbar)
65
- throwError(COMPONENT_NAME$1, "can not inject scrollbar context");
66
- const instance = ref();
67
- const thumb = ref();
68
- const thumbState = ref({});
69
- const visible = ref(false);
70
- let cursorDown = false;
71
- let cursorLeave = false;
72
- let baseScrollHeight = 0;
73
- let baseScrollWidth = 0;
74
- let originalOnSelectStart = isClient ? document.onselectstart : null;
75
- const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
76
- const thumbStyle = computed(
77
- () => renderThumbStyle({
78
- size: props.size,
79
- move: props.move,
80
- bar: bar.value
81
- })
82
- );
83
- const offsetRatio = computed(
84
- () => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]
85
- );
86
- const clickThumbHandler = (e) => {
87
- var _a;
88
- e.stopPropagation();
89
- if (e.ctrlKey || [1, 2].includes(e.button))
90
- return;
91
- (_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
92
- startDrag(e);
93
- const el = e.currentTarget;
94
- if (!el)
95
- return;
96
- thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
97
- };
98
- const clickTrackHandler = (e) => {
99
- if (!thumb.value || !instance.value || !scrollbar.wrapElement)
100
- return;
101
- const offset = Math.abs(
102
- e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]
103
- );
104
- const thumbHalf = thumb.value[bar.value.offset] / 2;
105
- const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
106
- scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
107
- };
108
- const startDrag = (e) => {
109
- e.stopImmediatePropagation();
110
- cursorDown = true;
111
- baseScrollHeight = scrollbar.wrapElement.scrollHeight;
112
- baseScrollWidth = scrollbar.wrapElement.scrollWidth;
113
- document.addEventListener("mousemove", mouseMoveDocumentHandler);
114
- document.addEventListener("mouseup", mouseUpDocumentHandler);
115
- originalOnSelectStart = document.onselectstart;
116
- document.onselectstart = () => false;
117
- };
118
- const mouseMoveDocumentHandler = (e) => {
119
- if (!instance.value || !thumb.value)
120
- return;
121
- if (cursorDown === false)
122
- return;
123
- const prevPage = thumbState.value[bar.value.axis];
124
- if (!prevPage)
125
- return;
126
- const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
127
- const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
128
- const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
129
- if (bar.value.scroll === "scrollLeft") {
130
- scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * baseScrollWidth / 100;
131
- } else {
132
- scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * baseScrollHeight / 100;
133
- }
134
- };
135
- const mouseUpDocumentHandler = () => {
136
- cursorDown = false;
137
- thumbState.value[bar.value.axis] = 0;
138
- document.removeEventListener("mousemove", mouseMoveDocumentHandler);
139
- document.removeEventListener("mouseup", mouseUpDocumentHandler);
140
- restoreOnselectstart();
141
- if (cursorLeave)
142
- visible.value = false;
143
- };
144
- const mouseMoveScrollbarHandler = () => {
145
- cursorLeave = false;
146
- visible.value = !!props.size;
147
- };
148
- const mouseLeaveScrollbarHandler = () => {
149
- cursorLeave = true;
150
- visible.value = cursorDown;
151
- };
152
- onBeforeUnmount(() => {
153
- restoreOnselectstart();
154
- document.removeEventListener("mouseup", mouseUpDocumentHandler);
155
- });
156
- const restoreOnselectstart = () => {
157
- if (document.onselectstart !== originalOnSelectStart)
158
- document.onselectstart = originalOnSelectStart;
159
- };
160
- useEventListener(
161
- toRef(scrollbar, "scrollbarElement"),
162
- "mousemove",
163
- mouseMoveScrollbarHandler
164
- );
165
- useEventListener(
166
- toRef(scrollbar, "scrollbarElement"),
167
- "mouseleave",
168
- mouseLeaveScrollbarHandler
169
- );
170
- return (_ctx, _cache) => {
171
- return openBlock(), createBlock(Transition, {
172
- name: unref(ns).b("fade"),
173
- persisted: ""
174
- }, {
175
- default: withCtx(() => [
176
- withDirectives(createElementVNode(
177
- "div",
178
- {
179
- ref_key: "instance",
180
- ref: instance,
181
- class: normalizeClass([unref(ns).e("bar"), unref(ns).is(bar.value.key)]),
182
- onMousedown: clickTrackHandler,
183
- onClick: _cache[0] || (_cache[0] = withModifiers(() => {
184
- }, ["stop"]))
185
- },
186
- [
187
- createElementVNode(
188
- "div",
189
- {
190
- ref_key: "thumb",
191
- ref: thumb,
192
- class: normalizeClass(unref(ns).e("thumb")),
193
- style: normalizeStyle(thumbStyle.value),
194
- onMousedown: clickThumbHandler
195
- },
196
- null,
197
- 38
198
- )
199
- ],
200
- 34
201
- ), [
202
- [vShow, _ctx.always || visible.value]
203
- ])
204
- ]),
205
- _: 1
206
- }, 8, ["name"]);
207
- };
208
- }
209
- });
210
- var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);
211
-
212
- const barProps = buildProps({
213
- always: {
214
- type: Boolean,
215
- default: true
216
- },
217
- minSize: {
218
- type: Number,
219
- required: true
220
- }
221
- });
222
-
223
- const _sfc_main$1 = defineComponent({
224
- __name: "bar",
225
- props: barProps,
226
- setup(__props, { expose: __expose }) {
227
- const props = __props;
228
- const scrollbar = inject(scrollbarContextKey);
229
- const moveX = ref(0);
230
- const moveY = ref(0);
231
- const sizeWidth = ref("");
232
- const sizeHeight = ref("");
233
- const ratioY = ref(1);
234
- const ratioX = ref(1);
235
- const handleScroll = (wrap) => {
236
- if (wrap) {
237
- const offsetHeight = wrap.offsetHeight - GAP;
238
- const offsetWidth = wrap.offsetWidth - GAP;
239
- moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
240
- moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
241
- }
242
- };
243
- const update = () => {
244
- const wrap = scrollbar == null ? void 0 : scrollbar.wrapElement;
245
- if (!wrap)
246
- return;
247
- const offsetHeight = wrap.offsetHeight - GAP;
248
- const offsetWidth = wrap.offsetWidth - GAP;
249
- const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
250
- const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
251
- const height = Math.max(originalHeight, props.minSize);
252
- const width = Math.max(originalWidth, props.minSize);
253
- ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
254
- ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
255
- sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
256
- sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
257
- };
258
- __expose({
259
- handleScroll,
260
- update
261
- });
262
- return (_ctx, _cache) => {
263
- return openBlock(), createElementBlock(
264
- Fragment,
265
- null,
266
- [
267
- createVNode(Thumb, {
268
- move: moveX.value,
269
- ratio: ratioX.value,
270
- size: sizeWidth.value,
271
- always: _ctx.always
272
- }, null, 8, ["move", "ratio", "size", "always"]),
273
- createVNode(Thumb, {
274
- move: moveY.value,
275
- ratio: ratioY.value,
276
- size: sizeHeight.value,
277
- vertical: "",
278
- always: _ctx.always
279
- }, null, 8, ["move", "ratio", "size", "always"])
280
- ],
281
- 64
282
- );
283
- };
284
- }
285
- });
286
- var Bar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);
287
-
288
- const scrollbarProps = buildProps({
289
- distance: {
290
- type: Number,
291
- default: 0
292
- },
293
- height: {
294
- type: [String, Number],
295
- default: ""
296
- },
297
- maxHeight: {
298
- type: [String, Number],
299
- default: ""
300
- },
301
- native: Boolean,
302
- wrapStyle: {
303
- type: definePropType([String, Object, Array]),
304
- default: ""
305
- },
306
- wrapClass: {
307
- type: [String, Array],
308
- default: ""
309
- },
310
- viewClass: {
311
- type: [String, Array],
312
- default: ""
313
- },
314
- viewStyle: {
315
- type: [String, Array, Object],
316
- default: ""
317
- },
318
- noresize: Boolean,
319
- tag: {
320
- type: String,
321
- default: "div"
322
- },
323
- always: Boolean,
324
- minSize: {
325
- type: Number,
326
- default: 20
327
- },
328
- tabindex: {
329
- type: [String, Number],
330
- default: void 0
331
- },
332
- id: String,
333
- role: String,
334
- ...useAriaProps(["ariaLabel", "ariaOrientation"])
335
- });
336
- const scrollbarEmits = {
337
- "end-reached": (direction) => ["left", "right", "top", "bottom"].includes(direction),
338
- scroll: ({
339
- scrollTop,
340
- scrollLeft
341
- }) => [scrollTop, scrollLeft].every(isNumber)
342
- };
343
-
344
- const _hoisted_1 = ["tabindex"];
345
- const COMPONENT_NAME = "ElScrollbar";
346
- const _sfc_main = defineComponent({
347
- ...{
348
- name: COMPONENT_NAME
349
- },
350
- __name: "scrollbar",
351
- props: scrollbarProps,
352
- emits: scrollbarEmits,
353
- setup(__props, { expose: __expose, emit: __emit }) {
354
- const props = __props;
355
- const emit = __emit;
356
- const ns = useNamespace("scrollbar");
357
- let stopResizeObserver = void 0;
358
- let stopWrapResizeObserver = void 0;
359
- let stopResizeListener = void 0;
360
- let wrapScrollTop = 0;
361
- let wrapScrollLeft = 0;
362
- let direction = "";
363
- const distanceScrollState = {
364
- bottom: false,
365
- top: false,
366
- right: false,
367
- left: false
368
- };
369
- const scrollbarRef = ref();
370
- const wrapRef = ref();
371
- const resizeRef = ref();
372
- const barRef = ref();
373
- const wrapStyle = computed(() => {
374
- const style = {};
375
- const height = addUnit(props.height);
376
- const maxHeight = addUnit(props.maxHeight);
377
- if (height)
378
- style.height = height;
379
- if (maxHeight)
380
- style.maxHeight = maxHeight;
381
- return [props.wrapStyle, style];
382
- });
383
- const wrapKls = computed(() => {
384
- return [
385
- props.wrapClass,
386
- ns.e("wrap"),
387
- { [ns.em("wrap", "hidden-default")]: !props.native }
388
- ];
389
- });
390
- const resizeKls = computed(() => {
391
- return [ns.e("view"), props.viewClass];
392
- });
393
- const shouldSkipDirection = (direction2) => {
394
- var _a;
395
- return (_a = distanceScrollState[direction2]) != null ? _a : false;
396
- };
397
- const DIRECTION_PAIRS = {
398
- top: "bottom",
399
- bottom: "top",
400
- left: "right",
401
- right: "left"
402
- };
403
- const updateTriggerStatus = (arrivedStates) => {
404
- const oppositeDirection = DIRECTION_PAIRS[direction];
405
- if (!oppositeDirection)
406
- return;
407
- const arrived = arrivedStates[direction];
408
- const oppositeArrived = arrivedStates[oppositeDirection];
409
- if (arrived && !distanceScrollState[direction]) {
410
- distanceScrollState[direction] = true;
411
- }
412
- if (!oppositeArrived && distanceScrollState[oppositeDirection]) {
413
- distanceScrollState[oppositeDirection] = false;
414
- }
415
- };
416
- const handleScroll = () => {
417
- var _a;
418
- if (wrapRef.value) {
419
- (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
420
- const prevTop = wrapScrollTop;
421
- const prevLeft = wrapScrollLeft;
422
- wrapScrollTop = wrapRef.value.scrollTop;
423
- wrapScrollLeft = wrapRef.value.scrollLeft;
424
- const arrivedStates = {
425
- bottom: wrapScrollTop + wrapRef.value.clientHeight >= wrapRef.value.scrollHeight - props.distance,
426
- top: wrapScrollTop <= props.distance && prevTop !== 0,
427
- right: wrapScrollLeft + wrapRef.value.clientWidth >= wrapRef.value.scrollWidth - props.distance && prevLeft !== wrapScrollLeft,
428
- left: wrapScrollLeft <= props.distance && prevLeft !== 0
429
- };
430
- emit("scroll", {
431
- scrollTop: wrapScrollTop,
432
- scrollLeft: wrapScrollLeft
433
- });
434
- if (prevTop !== wrapScrollTop) {
435
- direction = wrapScrollTop > prevTop ? "bottom" : "top";
436
- }
437
- if (prevLeft !== wrapScrollLeft) {
438
- direction = wrapScrollLeft > prevLeft ? "right" : "left";
439
- }
440
- if (props.distance > 0) {
441
- if (shouldSkipDirection(direction)) {
442
- return;
443
- }
444
- updateTriggerStatus(arrivedStates);
445
- }
446
- if (arrivedStates[direction])
447
- emit("end-reached", direction);
448
- }
449
- };
450
- function scrollTo(arg1, arg2) {
451
- if (isObject(arg1)) {
452
- wrapRef.value.scrollTo(arg1);
453
- } else if (isNumber(arg1) && isNumber(arg2)) {
454
- wrapRef.value.scrollTo(arg1, arg2);
455
- }
456
- }
457
- const setScrollTop = (value) => {
458
- if (!isNumber(value)) {
459
- debugWarn(COMPONENT_NAME, "value must be a number");
460
- return;
461
- }
462
- wrapRef.value.scrollTop = value;
463
- };
464
- const setScrollLeft = (value) => {
465
- if (!isNumber(value)) {
466
- debugWarn(COMPONENT_NAME, "value must be a number");
467
- return;
468
- }
469
- wrapRef.value.scrollLeft = value;
470
- };
471
- const update = () => {
472
- var _a;
473
- (_a = barRef.value) == null ? void 0 : _a.update();
474
- distanceScrollState[direction] = false;
475
- };
476
- watch(
477
- () => props.noresize,
478
- (noresize) => {
479
- if (noresize) {
480
- stopResizeObserver == null ? void 0 : stopResizeObserver();
481
- stopWrapResizeObserver == null ? void 0 : stopWrapResizeObserver();
482
- stopResizeListener == null ? void 0 : stopResizeListener();
483
- } else {
484
- ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
485
- ({ stop: stopWrapResizeObserver } = useResizeObserver(wrapRef, update));
486
- stopResizeListener = useEventListener("resize", update);
487
- }
488
- },
489
- { immediate: true }
490
- );
491
- watch(
492
- () => [props.maxHeight, props.height],
493
- () => {
494
- if (!props.native)
495
- nextTick(() => {
496
- var _a;
497
- update();
498
- if (wrapRef.value) {
499
- (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
500
- }
501
- });
502
- }
503
- );
504
- provide(
505
- scrollbarContextKey,
506
- reactive({
507
- scrollbarElement: scrollbarRef,
508
- wrapElement: wrapRef
509
- })
510
- );
511
- onActivated(() => {
512
- if (wrapRef.value) {
513
- wrapRef.value.scrollTop = wrapScrollTop;
514
- wrapRef.value.scrollLeft = wrapScrollLeft;
515
- }
516
- });
517
- onMounted(() => {
518
- if (!props.native)
519
- nextTick(() => {
520
- update();
521
- });
522
- });
523
- onUpdated(() => update());
524
- __expose({
525
- wrapRef,
526
- update,
527
- scrollTo,
528
- setScrollTop,
529
- setScrollLeft,
530
- handleScroll
531
- });
532
- return (_ctx, _cache) => {
533
- return openBlock(), createElementBlock(
534
- "div",
535
- {
536
- ref_key: "scrollbarRef",
537
- ref: scrollbarRef,
538
- class: normalizeClass(unref(ns).b())
539
- },
540
- [
541
- createElementVNode("div", {
542
- ref_key: "wrapRef",
543
- ref: wrapRef,
544
- class: normalizeClass(wrapKls.value),
545
- style: normalizeStyle(wrapStyle.value),
546
- tabindex: _ctx.tabindex,
547
- onScroll: handleScroll
548
- }, [
549
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
550
- id: _ctx.id,
551
- ref_key: "resizeRef",
552
- ref: resizeRef,
553
- class: normalizeClass(resizeKls.value),
554
- style: normalizeStyle(_ctx.viewStyle),
555
- role: _ctx.role,
556
- "aria-label": _ctx.ariaLabel,
557
- "aria-orientation": _ctx.ariaOrientation
558
- }, {
559
- default: withCtx(() => [
560
- renderSlot(_ctx.$slots, "default")
561
- ]),
562
- _: 3
563
- }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
564
- ], 46, _hoisted_1),
565
- !_ctx.native ? (openBlock(), createBlock(Bar, {
566
- key: 0,
567
- ref_key: "barRef",
568
- ref: barRef,
569
- always: _ctx.always,
570
- "min-size": _ctx.minSize
571
- }, null, 8, ["always", "min-size"])) : createCommentVNode("v-if", true)
572
- ],
573
- 2
574
- );
575
- };
576
- }
577
- });
578
- var Scrollbar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);
579
-
580
- const ElScrollbar = withInstall(Scrollbar);
581
-
582
- export { ElScrollbar as E, scrollbarEmits as s };