vxe-table 3.25.0-beta.2 → 3.25.0-beta.3

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 (41) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/module/custom/panel.js +2 -2
  3. package/es/table/module/filter/mixin.js +1 -0
  4. package/es/table/src/methods.js +2 -2
  5. package/es/table/src/table.js +8 -4
  6. package/es/ui/index.js +1 -1
  7. package/es/ui/src/dom.js +11 -8
  8. package/es/ui/src/log.js +1 -1
  9. package/lib/index.umd.js +31 -74
  10. package/lib/index.umd.min.js +1 -1
  11. package/lib/style.css +1 -1
  12. package/lib/table/module/custom/panel.js +2 -2
  13. package/lib/table/module/custom/panel.min.js +1 -1
  14. package/lib/table/module/filter/mixin.js +1 -0
  15. package/lib/table/module/filter/mixin.min.js +1 -1
  16. package/lib/table/src/methods.js +6 -6
  17. package/lib/table/src/methods.min.js +1 -1
  18. package/lib/table/src/table.js +12 -4
  19. package/lib/table/src/table.min.js +1 -1
  20. package/lib/ui/index.js +1 -1
  21. package/lib/ui/index.min.js +1 -1
  22. package/lib/ui/src/dom.js +11 -7
  23. package/lib/ui/src/dom.min.js +1 -1
  24. package/lib/ui/src/log.js +1 -1
  25. package/lib/ui/src/log.min.js +1 -1
  26. package/package.json +2 -2
  27. package/packages/table/module/custom/panel.ts +2 -2
  28. package/packages/table/module/filter/mixin.ts +1 -0
  29. package/packages/table/src/methods.ts +3 -2
  30. package/packages/table/src/table.ts +8 -4
  31. package/packages/ui/src/dom.ts +12 -8
  32. package/es/table/src/scrollbar.js +0 -54
  33. package/lib/table/src/scrollbar.js +0 -63
  34. package/lib/table/src/scrollbar.min.js +0 -1
  35. package/packages/table/src/scrollbar.ts +0 -57
  36. /package/es/{iconfont.1792035018941.ttf → iconfont.1792117667851.ttf} +0 -0
  37. /package/es/{iconfont.1792035018941.woff → iconfont.1792117667851.woff} +0 -0
  38. /package/es/{iconfont.1792035018941.woff2 → iconfont.1792117667851.woff2} +0 -0
  39. /package/lib/{iconfont.1792035018941.ttf → iconfont.1792117667851.ttf} +0 -0
  40. /package/lib/{iconfont.1792035018941.woff → iconfont.1792117667851.woff} +0 -0
  41. /package/lib/{iconfont.1792035018941.woff2 → iconfont.1792117667851.woff2} +0 -0
@@ -266,6 +266,7 @@ interface PanelPlacementOptions {
266
266
  defaultLeft?: number
267
267
  placement?: '' | 'top' | 'bottom' | null
268
268
  defaultPlacement?: '' | 'top' | 'bottom' | null
269
+ appendTo?: string | HTMLElement | ((params: any) => string | HTMLElement)
269
270
  teleportTo?: boolean
270
271
  marginSize?: number
271
272
  isMinWidth?: boolean
@@ -275,7 +276,8 @@ interface PanelPlacementOptions {
275
276
  * 通用定位计算
276
277
  */
277
278
  export function updatePanelPlacement (targetElem: HTMLElement | null | undefined, panelElem: HTMLElement | null | undefined, options: PanelPlacementOptions) {
278
- const { defaultTop, defaultLeft, placement, defaultPlacement, teleportTo, marginSize, isMinWidth } = Object.assign({
279
+ const { defaultTop, defaultLeft, placement, defaultPlacement, appendTo, teleportTo, marginSize, isMinWidth } = Object.assign({
280
+ appendTo: '',
279
281
  teleportTo: false,
280
282
  marginSize: 18,
281
283
  isMinWidth: true
@@ -289,7 +291,7 @@ export function updatePanelPlacement (targetElem: HTMLElement | null | undefined
289
291
  const stys: Record<string, string> = {}
290
292
  if (panelElem && targetElem) {
291
293
  const bodyEl = document.body
292
- const parentWrapperEl = getPopupWrapperElement(panelElem)
294
+ const parentWrapperEl = getPopupWrapperElement(teleportTo ? getPopupAppendElement(appendTo) : panelElem)
293
295
  if (parentWrapperEl) {
294
296
  const targetWidth = targetElem.offsetWidth
295
297
  const targetHeight = targetElem.offsetHeight
@@ -302,16 +304,18 @@ export function updatePanelPlacement (targetElem: HTMLElement | null | undefined
302
304
  const visibleHeight = bodyEl.clientHeight
303
305
  const visibleWidth = bodyEl.clientWidth
304
306
 
305
- const offsetLeft = parentWrapperRect.left
306
- const offsetTop = parentWrapperRect.top
307
+ const parentWrapperScrollLeft = parentWrapperEl.scrollLeft
308
+ const parentWrapperScrollTop = parentWrapperEl.scrollTop
309
+ const parentWrapperOffsetLeft = parentWrapperRect.left
310
+ const parentWrapperOffsetTop = parentWrapperRect.top
307
311
  const targetLeft = targetRect.left
308
312
  const targetTop = targetRect.top
309
313
 
310
314
  minWidth = targetElem.offsetWidth
311
315
 
312
316
  if (teleportTo) {
313
- left = defaultLeft || (targetLeft - (panelWidth - targetWidth) / 2)
314
- top = defaultTop || (targetTop + targetHeight)
317
+ left = (defaultLeft || (targetLeft - (panelWidth - targetWidth) / 2)) - parentWrapperScrollLeft
318
+ top = (defaultTop || (targetTop + targetHeight)) - parentWrapperScrollTop
315
319
  if (placement === 'top') {
316
320
  panelPlacement = 'top'
317
321
  top = targetTop - panelHeight
@@ -354,8 +358,8 @@ export function updatePanelPlacement (targetElem: HTMLElement | null | undefined
354
358
  }
355
359
 
356
360
  // 偏移
357
- top -= offsetTop
358
- left -= offsetLeft
361
+ top -= parentWrapperOffsetTop
362
+ left -= parentWrapperOffsetLeft
359
363
  } else {
360
364
  if (placement === 'top') {
361
365
  panelPlacement = 'top'
@@ -1,54 +0,0 @@
1
- /**
2
- * 计算滚动条滑块的长度
3
- */
4
- export function getThumbSize(viewportSize, contentSize, trackSize) {
5
- if (contentSize <= viewportSize) {
6
- return 0;
7
- }
8
- const ratio = viewportSize / contentSize;
9
- const ideal = trackSize * ratio;
10
- return Math.max(20, Math.min(ideal, trackSize));
11
- }
12
- /**
13
- * 计算滚动条滑块的偏移位置
14
- */
15
- export function getThumbOffsetSize(offsetSize, viewportSize, contentSize, trackSize, thumbSize) {
16
- const maxScroll = contentSize - viewportSize;
17
- if (maxScroll <= 0) {
18
- return 0;
19
- }
20
- const maxThumbOffset = trackSize - thumbSize;
21
- if (maxThumbOffset <= 0) {
22
- return 0;
23
- }
24
- const clamped = Math.min(Math.max(offsetSize, 0), maxScroll);
25
- const ratio = clamped / maxScroll;
26
- return ratio * maxThumbOffset;
27
- }
28
- /**
29
- * 根据点击轨道的位置,计算滑块的偏移位置
30
- */
31
- export function getScrollFromClick(clickPosition, viewportSize, contentSize, trackSize, thumbSize) {
32
- const maxThumbOffset = trackSize - thumbSize;
33
- const maxScroll = contentSize - viewportSize;
34
- if (maxScroll <= 0 || maxThumbOffset <= 0) {
35
- return 0;
36
- }
37
- let thumbOffset = clickPosition - thumbSize / 2;
38
- thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
39
- const scrollOffset = (thumbOffset / maxThumbOffset) * maxScroll;
40
- return scrollOffset;
41
- }
42
- /**
43
- * 拖拽 thumb 时,根据鼠标位置计算滑块的偏移位置
44
- */
45
- export function getScrollFromDrag(pointerPosition, dragOffset, viewportSize, contentSize, trackSize, thumbSize) {
46
- const maxScroll = contentSize - viewportSize;
47
- const maxThumbOffset = trackSize - thumbSize;
48
- if (maxScroll <= 0 || maxThumbOffset <= 0) {
49
- return 0;
50
- }
51
- let thumbOffset = pointerPosition - dragOffset;
52
- thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
53
- return (thumbOffset / maxThumbOffset) * maxScroll;
54
- }
@@ -1,63 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getScrollFromClick = getScrollFromClick;
7
- exports.getScrollFromDrag = getScrollFromDrag;
8
- exports.getThumbOffsetSize = getThumbOffsetSize;
9
- exports.getThumbSize = getThumbSize;
10
- /**
11
- * 计算滚动条滑块的长度
12
- */
13
- function getThumbSize(viewportSize, contentSize, trackSize) {
14
- if (contentSize <= viewportSize) {
15
- return 0;
16
- }
17
- const ratio = viewportSize / contentSize;
18
- const ideal = trackSize * ratio;
19
- return Math.max(20, Math.min(ideal, trackSize));
20
- }
21
- /**
22
- * 计算滚动条滑块的偏移位置
23
- */
24
- function getThumbOffsetSize(offsetSize, viewportSize, contentSize, trackSize, thumbSize) {
25
- const maxScroll = contentSize - viewportSize;
26
- if (maxScroll <= 0) {
27
- return 0;
28
- }
29
- const maxThumbOffset = trackSize - thumbSize;
30
- if (maxThumbOffset <= 0) {
31
- return 0;
32
- }
33
- const clamped = Math.min(Math.max(offsetSize, 0), maxScroll);
34
- const ratio = clamped / maxScroll;
35
- return ratio * maxThumbOffset;
36
- }
37
- /**
38
- * 根据点击轨道的位置,计算滑块的偏移位置
39
- */
40
- function getScrollFromClick(clickPosition, viewportSize, contentSize, trackSize, thumbSize) {
41
- const maxThumbOffset = trackSize - thumbSize;
42
- const maxScroll = contentSize - viewportSize;
43
- if (maxScroll <= 0 || maxThumbOffset <= 0) {
44
- return 0;
45
- }
46
- let thumbOffset = clickPosition - thumbSize / 2;
47
- thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
48
- const scrollOffset = thumbOffset / maxThumbOffset * maxScroll;
49
- return scrollOffset;
50
- }
51
- /**
52
- * 拖拽 thumb 时,根据鼠标位置计算滑块的偏移位置
53
- */
54
- function getScrollFromDrag(pointerPosition, dragOffset, viewportSize, contentSize, trackSize, thumbSize) {
55
- const maxScroll = contentSize - viewportSize;
56
- const maxThumbOffset = trackSize - thumbSize;
57
- if (maxScroll <= 0 || maxThumbOffset <= 0) {
58
- return 0;
59
- }
60
- let thumbOffset = pointerPosition - dragOffset;
61
- thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
62
- return thumbOffset / maxThumbOffset * maxScroll;
63
- }
@@ -1 +0,0 @@
1
- function getThumbSize(t,e,r){return e<=t?0:Math.max(20,Math.min(r*(t/e),r))}function getThumbOffsetSize(t,e,r,o,m){r-=e;return r<=0||(e=o-m)<=0?0:Math.min(Math.max(t,0),r)/r*e}function getScrollFromClick(t,e,r,o,m){o-=m,r-=e;return r<=0||o<=0?0:(e=t-m/2,(e=Math.min(Math.max(e,0),o))/o*r)}function getScrollFromDrag(t,e,r,o,m,i){o-=r,r=m-i;return o<=0||r<=0?0:(m=t-e,(m=Math.min(Math.max(m,0),r))/r*o)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getScrollFromClick=getScrollFromClick,exports.getScrollFromDrag=getScrollFromDrag,exports.getThumbOffsetSize=getThumbOffsetSize,exports.getThumbSize=getThumbSize;
@@ -1,57 +0,0 @@
1
- /**
2
- * 计算滚动条滑块的长度
3
- */
4
- export function getThumbSize (viewportSize: number, contentSize: number, trackSize: number) {
5
- if (contentSize <= viewportSize) {
6
- return 0
7
- }
8
- const ratio = viewportSize / contentSize
9
- const ideal = trackSize * ratio
10
- return Math.max(20, Math.min(ideal, trackSize))
11
- }
12
-
13
- /**
14
- * 计算滚动条滑块的偏移位置
15
- */
16
- export function getThumbOffsetSize (offsetSize: number, viewportSize: number, contentSize: number, trackSize: number, thumbSize: number) {
17
- const maxScroll = contentSize - viewportSize
18
- if (maxScroll <= 0) {
19
- return 0
20
- }
21
- const maxThumbOffset = trackSize - thumbSize
22
- if (maxThumbOffset <= 0) {
23
- return 0
24
- }
25
- const clamped = Math.min(Math.max(offsetSize, 0), maxScroll)
26
- const ratio = clamped / maxScroll
27
- return ratio * maxThumbOffset
28
- }
29
-
30
- /**
31
- * 根据点击轨道的位置,计算滑块的偏移位置
32
- */
33
- export function getScrollFromClick (clickPosition: number, viewportSize: number, contentSize: number, trackSize: number, thumbSize: number) {
34
- const maxThumbOffset = trackSize - thumbSize
35
- const maxScroll = contentSize - viewportSize
36
- if (maxScroll <= 0 || maxThumbOffset <= 0) {
37
- return 0
38
- }
39
- let thumbOffset = clickPosition - thumbSize / 2
40
- thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset)
41
- const scrollOffset = (thumbOffset / maxThumbOffset) * maxScroll
42
- return scrollOffset
43
- }
44
-
45
- /**
46
- * 拖拽 thumb 时,根据鼠标位置计算滑块的偏移位置
47
- */
48
- export function getScrollFromDrag (pointerPosition: number, dragOffset: number, viewportSize: number, contentSize: number, trackSize: number, thumbSize: number) {
49
- const maxScroll = contentSize - viewportSize
50
- const maxThumbOffset = trackSize - thumbSize
51
- if (maxScroll <= 0 || maxThumbOffset <= 0) {
52
- return 0
53
- }
54
- let thumbOffset = pointerPosition - dragOffset
55
- thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset)
56
- return (thumbOffset / maxThumbOffset) * maxScroll
57
- }