vxe-table 3.23.4 → 3.23.6

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 (76) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/table/module/custom/mixin.js +1 -1
  6. package/es/table/module/filter/mixin.js +71 -56
  7. package/es/table/module/keyboard/mixin.js +3 -5
  8. package/es/table/src/body.js +3 -3
  9. package/es/table/src/footer.js +3 -3
  10. package/es/table/src/header.js +6 -6
  11. package/es/table/src/methods.js +128 -68
  12. package/es/table/src/table.js +10 -2
  13. package/es/table/src/util.js +6 -5
  14. package/es/table/style.css +1 -1
  15. package/es/table/style.min.css +1 -1
  16. package/es/ui/index.js +1 -1
  17. package/es/ui/src/dom.js +162 -0
  18. package/es/ui/src/log.js +1 -1
  19. package/es/vxe-table/style.css +1 -1
  20. package/es/vxe-table/style.min.css +1 -1
  21. package/lib/index.css +1 -1
  22. package/lib/index.min.css +1 -1
  23. package/lib/index.umd.js +321 -134
  24. package/lib/index.umd.min.js +1 -1
  25. package/lib/style.css +1 -1
  26. package/lib/style.min.css +1 -1
  27. package/lib/table/module/custom/mixin.js +1 -1
  28. package/lib/table/module/custom/mixin.min.js +1 -1
  29. package/lib/table/module/filter/mixin.js +69 -58
  30. package/lib/table/module/filter/mixin.min.js +1 -1
  31. package/lib/table/module/keyboard/mixin.js +3 -6
  32. package/lib/table/module/keyboard/mixin.min.js +1 -1
  33. package/lib/table/src/body.js +5 -4
  34. package/lib/table/src/body.min.js +1 -1
  35. package/lib/table/src/footer.js +5 -4
  36. package/lib/table/src/footer.min.js +1 -1
  37. package/lib/table/src/header.js +10 -8
  38. package/lib/table/src/header.min.js +1 -1
  39. package/lib/table/src/methods.js +46 -44
  40. package/lib/table/src/methods.min.js +1 -1
  41. package/lib/table/src/table.js +10 -2
  42. package/lib/table/src/table.min.js +1 -1
  43. package/lib/table/src/util.js +6 -5
  44. package/lib/table/src/util.min.js +1 -1
  45. package/lib/table/style/style.css +1 -1
  46. package/lib/table/style/style.min.css +1 -1
  47. package/lib/ui/index.js +1 -1
  48. package/lib/ui/index.min.js +1 -1
  49. package/lib/ui/src/dom.js +167 -0
  50. package/lib/ui/src/dom.min.js +1 -1
  51. package/lib/ui/src/log.js +1 -1
  52. package/lib/ui/src/log.min.js +1 -1
  53. package/lib/vxe-table/style/style.css +1 -1
  54. package/lib/vxe-table/style/style.min.css +1 -1
  55. package/package.json +2 -2
  56. package/packages/table/module/custom/mixin.ts +1 -2
  57. package/packages/table/module/filter/mixin.ts +72 -53
  58. package/packages/table/module/keyboard/mixin.ts +3 -5
  59. package/packages/table/src/body.ts +3 -3
  60. package/packages/table/src/footer.ts +3 -3
  61. package/packages/table/src/header.ts +6 -6
  62. package/packages/table/src/methods.ts +166 -80
  63. package/packages/table/src/table.ts +10 -2
  64. package/packages/table/src/util.ts +9 -6
  65. package/packages/ui/src/dom.ts +176 -0
  66. package/styles/components/table-module/filter.scss +1 -1
  67. package/styles/theme/base.scss +2 -0
  68. package/styles/theme/dark.scss +4 -4
  69. package/styles/theme/light.scss +4 -4
  70. package/styles/variable.scss +4 -4
  71. /package/es/{iconfont.1788399048088.ttf → iconfont.1788695175944.ttf} +0 -0
  72. /package/es/{iconfont.1788399048088.woff → iconfont.1788695175944.woff} +0 -0
  73. /package/es/{iconfont.1788399048088.woff2 → iconfont.1788695175944.woff2} +0 -0
  74. /package/lib/{iconfont.1788399048088.ttf → iconfont.1788695175944.ttf} +0 -0
  75. /package/lib/{iconfont.1788399048088.woff → iconfont.1788695175944.woff} +0 -0
  76. /package/lib/{iconfont.1788399048088.woff2 → iconfont.1788695175944.woff2} +0 -0
@@ -201,6 +201,20 @@ export function hasEventInputTarget (target: EventTarget | Element | null) {
201
201
  return tagName && ['input', 'textarea'].includes((tagName.toLowerCase()))
202
202
  }
203
203
 
204
+ /**
205
+ * 判断是否由内部可复用控件触发,输入框带有 vxe-reusekeep-contro
206
+ */
207
+ function hasReusekeepControl (elem: EventTarget | HTMLElement | null) {
208
+ if (elem) {
209
+ return hasClass(elem as HTMLElement, 'vxe-reusekeep-contro')
210
+ }
211
+ return false
212
+ }
213
+
214
+ export function hasAxternalInputTarget (target: EventTarget | Element | null) {
215
+ return hasEventInputTarget(target) ? !hasReusekeepControl(target) : false
216
+ }
217
+
204
218
  const scrollIntoViewIfNeeded = 'scrollIntoViewIfNeeded'
205
219
  const scrollIntoView = 'scrollIntoView'
206
220
 
@@ -247,6 +261,168 @@ export function wheelScrollTopTo (diffNum: number, cb: (progress: number) => voi
247
261
  })
248
262
  }
249
263
 
264
+ interface PanelPlacementOptions {
265
+ defaultTop?: number
266
+ defaultLeft?: number
267
+ placement?: '' | 'top' | 'bottom' | null
268
+ defaultPlacement?: '' | 'top' | 'bottom' | null
269
+ teleportTo?: boolean
270
+ marginSize?: number
271
+ isMinWidth?: boolean
272
+ }
273
+
274
+ /**
275
+ * 通用定位计算
276
+ */
277
+ 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
+ teleportTo: false,
280
+ marginSize: 18,
281
+ isMinWidth: true
282
+ }, options)
283
+ let panelPlacement: 'top' | 'bottom' = 'bottom'
284
+ let top: number | '' = ''
285
+ let bottom: number | '' = ''
286
+ let left = 0
287
+ let minWidth: number | '' = ''
288
+ let arrowLeft: number | '' = ''
289
+ const stys: Record<string, string> = {}
290
+ if (panelElem && targetElem) {
291
+ const bodyEl = document.body
292
+ const parentWrapperEl = getPopupWrapperElement(panelElem)
293
+ if (parentWrapperEl) {
294
+ const targetWidth = targetElem.offsetWidth
295
+ const targetHeight = targetElem.offsetHeight
296
+ const panelWidth = panelElem.offsetWidth
297
+ const panelHeight = panelElem.offsetHeight
298
+
299
+ const parentWrapperRect = parentWrapperEl.getBoundingClientRect()
300
+ const panelRect = panelElem.getBoundingClientRect()
301
+ const targetRect = targetElem.getBoundingClientRect()
302
+ const visibleHeight = bodyEl.clientHeight
303
+ const visibleWidth = bodyEl.clientWidth
304
+
305
+ const offsetLeft = parentWrapperRect.left
306
+ const offsetTop = parentWrapperRect.top
307
+ const targetLeft = targetRect.left
308
+ const targetTop = targetRect.top
309
+
310
+ minWidth = targetElem.offsetWidth
311
+
312
+ if (teleportTo) {
313
+ left = defaultLeft || (targetLeft - (panelWidth - targetWidth) / 2)
314
+ top = defaultTop || (targetTop + targetHeight)
315
+ if (placement === 'top') {
316
+ panelPlacement = 'top'
317
+ top = targetTop - panelHeight
318
+ } else if (!placement) {
319
+ if (defaultPlacement === 'top') {
320
+ panelPlacement = 'top'
321
+ if (!defaultTop) {
322
+ top = targetTop - panelHeight
323
+ }
324
+ // 如果上面不够放,则向下
325
+ if (top < marginSize) {
326
+ panelPlacement = 'bottom'
327
+ top = targetTop + targetHeight
328
+ }
329
+ // 如果下面不够放,则向上(优先)
330
+ if (top + panelHeight + marginSize > visibleHeight) {
331
+ panelPlacement = 'top'
332
+ top = targetTop - panelHeight
333
+ }
334
+ } else {
335
+ // 如果下面不够放,则向上
336
+ if (top + panelHeight + marginSize > visibleHeight) {
337
+ panelPlacement = 'top'
338
+ top = targetTop - panelHeight
339
+ }
340
+ // 如果上面不够放,则向下(优先)
341
+ if (top < marginSize) {
342
+ panelPlacement = 'bottom'
343
+ top = targetTop + targetHeight
344
+ }
345
+ }
346
+ }
347
+ // 如果溢出右边
348
+ if (left + panelWidth + marginSize > visibleWidth) {
349
+ left -= left + panelWidth + marginSize - visibleWidth
350
+ }
351
+ // 如果溢出左边
352
+ if (left < marginSize) {
353
+ left = marginSize
354
+ }
355
+
356
+ // 偏移
357
+ top -= offsetTop
358
+ left -= offsetLeft
359
+ } else {
360
+ if (placement === 'top') {
361
+ panelPlacement = 'top'
362
+ bottom = targetHeight
363
+ } else if (!placement) {
364
+ // 如果下面不够放,则向上
365
+ top = targetHeight
366
+ if (targetTop + targetHeight + panelHeight + marginSize > visibleHeight) {
367
+ // 如果上面不够放,则向下(优先)
368
+ if (targetTop - targetHeight - panelHeight > marginSize) {
369
+ panelPlacement = 'top'
370
+ top = ''
371
+ bottom = targetHeight
372
+ }
373
+ }
374
+ }
375
+ // 是否超出右侧
376
+ if (panelRect.left + panelRect.width + marginSize > visibleWidth) {
377
+ left = -(panelRect.left + panelRect.width + marginSize - visibleWidth)
378
+ }
379
+ }
380
+ if (XEUtils.isNumber(top)) {
381
+ stys.top = toCssUnit(top)
382
+ }
383
+ if (XEUtils.isNumber(bottom)) {
384
+ stys.bottom = toCssUnit(bottom)
385
+ }
386
+ if (XEUtils.isNumber(left)) {
387
+ stys.left = toCssUnit(left)
388
+ }
389
+ if (isMinWidth && XEUtils.isNumber(minWidth)) {
390
+ stys.minWidth = toCssUnit(minWidth)
391
+ }
392
+
393
+ // 箭头
394
+ if (left === targetLeft) {
395
+ if (targetWidth <= panelWidth) {
396
+ arrowLeft = targetWidth / 2
397
+ }
398
+ } else if (left < targetLeft) {
399
+ if (left + panelWidth > targetLeft + targetWidth) {
400
+ arrowLeft = (targetLeft - left) + targetWidth / 2
401
+ } else {
402
+ arrowLeft = (targetLeft - left) + (panelWidth - (targetLeft - left)) / 2
403
+ }
404
+ }
405
+ }
406
+ }
407
+ return {
408
+ top: top || 0,
409
+ bottom: bottom || 0,
410
+ left: left || 0,
411
+ arrowLeft: arrowLeft || 0,
412
+ style: stys,
413
+ placement: panelPlacement
414
+ }
415
+ }
416
+
417
+ export function getPopupWrapperElement (panelElem: HTMLElement | null | undefined) {
418
+ if (!panelElem) {
419
+ return null
420
+ }
421
+ const bodyEl = document.body
422
+ const parentEl = panelElem.parentElement
423
+ return (parentEl === bodyEl ? document.documentElement : parentEl) || null
424
+ }
425
+
250
426
  export function getPopupContainer (appendTo: string | HTMLElement | ((params: any) => string | HTMLElement) | undefined) {
251
427
  const selectElem = appendTo && XEUtils.isFunction(appendTo) ? appendTo({}) : appendTo
252
428
  return selectElem || 'body'
@@ -70,7 +70,7 @@
70
70
  padding-top: 0.2em;
71
71
  }
72
72
  .vxe-table--filter-body {
73
- max-height: 200px;
73
+ max-height: var(--vxe-ui-vxe-table-filter-default-max-height);
74
74
  padding-bottom: 0.2em;
75
75
  }
76
76
  & > ul {
@@ -106,6 +106,8 @@
106
106
  --vxe-ui-vxe-table-custom-column-header-align-width: var(--vxe-ui-vxe-table-custom-column-align-width);
107
107
  --vxe-ui-vxe-table-custom-column-footer-align-width: var(--vxe-ui-vxe-table-custom-column-align-width);
108
108
 
109
+ --vxe-ui-vxe-table-filter-default-max-height: 260px;
110
+
109
111
  /*toolbar*/
110
112
  --vxe-ui-toolbar-custom-active-background-color: #D9DADB;
111
113
  --vxe-ui-toolbar-height-xlarge: 54px;
@@ -30,10 +30,6 @@
30
30
 
31
31
  /*table*/
32
32
  --vxe-ui-table-header-background-color: #28282a;
33
- --vxe-ui-table-column-to-row-background-color: #28282a;
34
- --vxe-ui-table-column-hover-background-color: #242f3b;
35
- --vxe-ui-table-column-current-background-color: #18222c;
36
- --vxe-ui-table-column-hover-current-background-color: #242f3b;
37
33
  --vxe-ui-table-border-color: #37373a;
38
34
  --vxe-ui-table-row-hover-background-color: #262727;
39
35
  --vxe-ui-table-row-striped-background-color: #1D1D1D;
@@ -44,6 +40,10 @@
44
40
  --vxe-ui-table-row-hover-checkbox-checked-background-color: #6e5326;
45
41
  --vxe-ui-table-row-current-background-color: #18222c;
46
42
  --vxe-ui-table-row-hover-current-background-color: #242f3b;
43
+ --vxe-ui-table-column-to-row-background-color: #28282a;
44
+ --vxe-ui-table-column-hover-background-color: var(--vxe-ui-table-row-hover-background-color);
45
+ --vxe-ui-table-column-current-background-color: var(-vxe-ui-table-row-current-background-color);
46
+ --vxe-ui-table-column-hover-current-background-color: var(--vxe-ui-table-row-current-background-color);
47
47
  --vxe-ui-table-fixed-scrolling-box-shadow-color: rgba(0, 0, 0, 0.8);
48
48
  --vxe-ui-table-drag-over-background-color:rgba(48, 48, 0, 0.3);
49
49
  }
@@ -26,10 +26,6 @@
26
26
 
27
27
  /*table*/
28
28
  --vxe-ui-table-header-background-color: #{light_variable.$vxe-ui-table-header-background-color};
29
- --vxe-ui-table-column-to-row-background-color: #{light_variable.$vxe-ui-table-column-to-row-background-color};
30
- --vxe-ui-table-column-hover-background-color: #{light_variable.$vxe-ui-table-column-hover-background-color};
31
- --vxe-ui-table-column-current-background-color: #{light_variable.$vxe-ui-table-column-current-background-color};
32
- --vxe-ui-table-column-hover-current-background-color: #{light_variable.$vxe-ui-table-column-hover-current-background-color};
33
29
  --vxe-ui-table-border-color: #{light_variable.$vxe-ui-table-border-color};
34
30
  --vxe-ui-table-row-hover-background-color: #{light_variable.$vxe-ui-table-row-hover-background-color};
35
31
  --vxe-ui-table-row-striped-background-color: #{light_variable.$vxe-ui-table-row-striped-background-color};
@@ -40,6 +36,10 @@
40
36
  --vxe-ui-table-row-hover-checkbox-checked-background-color: #{light_variable.$vxe-ui-table-row-hover-checkbox-checked-background-color};
41
37
  --vxe-ui-table-row-current-background-color: #{light_variable.$vxe-ui-table-row-current-background-color};
42
38
  --vxe-ui-table-row-hover-current-background-color: #{light_variable.$vxe-ui-table-row-hover-current-background-color};
39
+ --vxe-ui-table-column-to-row-background-color: #{light_variable.$vxe-ui-table-column-to-row-background-color};
40
+ --vxe-ui-table-column-hover-background-color: #{light_variable.$vxe-ui-table-column-hover-background-color};
41
+ --vxe-ui-table-column-current-background-color: #{light_variable.$vxe-ui-table-column-current-background-color};
42
+ --vxe-ui-table-column-hover-current-background-color: #{light_variable.$vxe-ui-table-column-hover-current-background-color};
43
43
  --vxe-ui-table-fixed-scrolling-box-shadow-color: #{light_variable.$vxe-ui-table-fixed-scrolling-box-shadow-color};
44
44
  --vxe-ui-table-drag-over-background-color:#{light_variable.$vxe-ui-table-drag-over-background-color};
45
45
  }
@@ -25,10 +25,6 @@ $vxe-ui-loading-background-color: rgba(255, 255, 255, 0.5) !default;
25
25
 
26
26
  /*table*/
27
27
  $vxe-ui-table-header-background-color: #f8f8f9 !default;
28
- $vxe-ui-table-column-to-row-background-color: #f8f8f9 !default;
29
- $vxe-ui-table-column-hover-background-color: #d7effb !default;
30
- $vxe-ui-table-column-current-background-color: #e6f7ff !default;
31
- $vxe-ui-table-column-hover-current-background-color: #d7effb !default;
32
28
  $vxe-ui-table-border-color: #e8eaec !default;
33
29
  $vxe-ui-table-row-hover-background-color: #f5f7fa !default;
34
30
  $vxe-ui-table-row-striped-background-color: #fafafa !default;
@@ -39,6 +35,10 @@ $vxe-ui-table-row-checkbox-checked-background-color: #fff3e0 !default;
39
35
  $vxe-ui-table-row-hover-checkbox-checked-background-color: #ffebbc !default;
40
36
  $vxe-ui-table-row-current-background-color: #e6f7ff !default;
41
37
  $vxe-ui-table-row-hover-current-background-color: #d7effb !default;
38
+ $vxe-ui-table-column-to-row-background-color: #f8f8f9 !default;
39
+ $vxe-ui-table-column-hover-background-color: #eceef1 !default;
40
+ $vxe-ui-table-column-current-background-color: $vxe-ui-table-row-current-background-color !default;
41
+ $vxe-ui-table-column-hover-current-background-color: $vxe-ui-table-row-hover-current-background-color !default;
42
42
  $vxe-ui-table-fixed-scrolling-box-shadow-color: rgba(0, 0, 0, 0.12) !default;
43
43
  $vxe-ui-table-drag-over-background-color:rgba(255,255,200,0.3) !default;
44
44